diff options
author | Peter Diener <diener@linux-hn3d.site> | 2009-11-13 13:53:33 -0600 |
---|---|---|
committer | Peter Diener <diener@linux-hn3d.site> | 2009-11-13 13:53:33 -0600 |
commit | 1b38f77d150fbb55cef32fa3b8ac6da3015403d7 (patch) | |
tree | a5f756708c14677cb6ecc7f62fd7a8a6b7cb20cc /m | |
parent | 71ab6fbbc8d2b947bbb9850e43e80024843d2e1b (diff) | |
parent | dde536561012a1d5c43b200721a9fbaaa24fdb30 (diff) |
Merge branch 'HEAD' of carpetgit@carpetcode.dyndns.org:McLachlan.git
Diffstat (limited to 'm')
-rw-r--r-- | m/Makefile | 20 | ||||
-rw-r--r-- | m/McLachlan_BSSN.m | 71 | ||||
-rw-r--r-- | m/WaveToyFO.m | 139 | ||||
-rw-r--r-- | m/prototype/ML_BSSN_Helper/param.ccl | 5 | ||||
-rw-r--r-- | m/prototype/ML_BSSN_Helper/schedule.ccl | 33 | ||||
-rw-r--r-- | m/prototype/ML_BSSN_Helper/src/SetGroupTags.c | 69 | ||||
-rw-r--r-- | m/prototype/ML_BSSN_Helper/src/UnsetCheckpointTags.c | 59 | ||||
-rw-r--r-- | m/prototype/ML_BSSN_Helper/src/make.code.defn | 2 |
8 files changed, 303 insertions, 95 deletions
@@ -56,9 +56,9 @@ WaveToy.out: WaveToy.m done WaveToyFO.out: WaveToyFO.m - rm -rf ML_FOWaveToy + rm -rf ML_WaveToyFO ./runmath.sh $^ - for thorn in ML_FOWaveToy; do \ + for thorn in ML_WaveToyFO; do \ ./copy-if-changed.sh $$thorn ../$$thorn; \ done @@ -71,14 +71,14 @@ hydro.out: hydro.m clean: rm -rf ML_ADM* ML_BSSN* - rm -rf ML_WaveToy ML_FOWaveToy + rm -rf ML_WaveToy ML_WaveToyFO rm -rf ML_hydro - rm -rf McLachlan_ADM.out McLachlan_ADM.err - rm -rf McLachlan_BSSN.out McLachlan_BSSN.err - rm -rf McLachlanW.out McLachlanW.err - rm -rf McLachlanUp.out McLachlanUp.err - rm -rf McLachlan6.out McLachlan6.err - rm -rf WaveToy.out WaveToy.err - rm -rf hydro.out hydro.err + rm -f McLachlan_ADM.out McLachlan_ADM.err + rm -f McLachlan_BSSN.out McLachlan_BSSN.err + rm -f McLachlanW.out McLachlanW.err + rm -f McLachlanUp.out McLachlanUp.err + rm -f McLachlan6.out McLachlan6.err + rm -f WaveToy.out WaveToy.err + rm -f hydro.out hydro.err .PHONY: all clean diff --git a/m/McLachlan_BSSN.m b/m/McLachlan_BSSN.m index 6e19a2e..388aa51 100644 --- a/m/McLachlan_BSSN.m +++ b/m/McLachlan_BSSN.m @@ -40,7 +40,8 @@ derivatives = differencing operators generated by StandardUpwindDifferenceOperator into this form *) - Switch[derivOrder,2, + Switch[derivOrder, + 2, PDupwindNth[1] -> (dir[1]*(-3 + 4*shift[1]^dir[1] - shift[1]^(2*dir[1])))/(2*spacing[1]), 4, @@ -53,12 +54,13 @@ derivatives = 30*shift[1]^(2*dir[1]) + 8*shift[1]^(3*dir[1]) - shift[1]^(4*dir[1])))/(60*spacing[1]), 8, - PDupwindNth[1] -> (dir[1]*(-378 - 5/shift[1]^(3*dir[1]) + - 60/shift[1]^(2*dir[1]) - 420/shift[1]^dir[1] + - 1050*shift[1]^dir[1] - 420*shift[1]^(2*dir[1]) + - 140*shift[1]^(3*dir[1]) - 30*shift[1]^(4*dir[1]) + + PDupwindNth[1] -> (dir[1]*(-378 - 5/shift[1]^(3*dir[1]) + + 60/shift[1]^(2*dir[1]) - 420/shift[1]^dir[1] + + 1050*shift[1]^dir[1] - 420*shift[1]^(2*dir[1]) + + 140*shift[1]^(3*dir[1]) - 30*shift[1]^(4*dir[1]) + 3*shift[1]^(5*dir[1])))/(840*spacing[1])], - Switch[derivOrder,2, + Switch[derivOrder, + 2, PDupwindNth[2] -> (dir[2]*(-3 + 4*shift[2]^dir[2] - shift[2]^(2*dir[2])))/(2*spacing[2]), 4, @@ -71,12 +73,13 @@ derivatives = 30*shift[2]^(2*dir[2]) + 8*shift[2]^(3*dir[2]) - shift[2]^(4*dir[2])))/(60*spacing[2]), 8, - PDupwindNth[2] -> (dir[2]*(-378 - 5/shift[2]^(3*dir[2]) + - 60/shift[2]^(2*dir[2]) - 420/shift[2]^dir[2] + - 1050*shift[2]^dir[2] - 420*shift[2]^(2*dir[2]) + - 140*shift[2]^(3*dir[2]) - 30*shift[2]^(4*dir[2]) + + PDupwindNth[2] -> (dir[2]*(-378 - 5/shift[2]^(3*dir[2]) + + 60/shift[2]^(2*dir[2]) - 420/shift[2]^dir[2] + + 1050*shift[2]^dir[2] - 420*shift[2]^(2*dir[2]) + + 140*shift[2]^(3*dir[2]) - 30*shift[2]^(4*dir[2]) + 3*shift[2]^(5*dir[2])))/(840*spacing[2])], - Switch[derivOrder,2, + Switch[derivOrder, + 2, PDupwindNth[3] -> (dir[3]*(-3 + 4*shift[3]^dir[3] - shift[3]^(2*dir[3])))/(2*spacing[3]), 4, @@ -89,10 +92,10 @@ derivatives = 30*shift[3]^(2*dir[3]) + 8*shift[3]^(3*dir[3]) - shift[3]^(4*dir[3])))/(60*spacing[3]), 8, - PDupwindNth[3] -> (dir[3]*(-378 - 5/shift[3]^(3*dir[3]) + - 60/shift[3]^(2*dir[3]) - 420/shift[3]^dir[3] + - 1050*shift[3]^dir[3] - 420*shift[3]^(2*dir[3]) + - 140*shift[3]^(3*dir[3]) - 30*shift[3]^(4*dir[3]) + + PDupwindNth[3] -> (dir[3]*(-378 - 5/shift[3]^(3*dir[3]) + + 60/shift[3]^(2*dir[3]) - 420/shift[3]^dir[3] + + 1050*shift[3]^dir[3] - 420*shift[3]^(2*dir[3]) + + 140*shift[3]^(3*dir[3]) - 30*shift[3]^(4*dir[3]) + 3*shift[3]^(5*dir[3])))/(840*spacing[3])], (* TODO: make these higher order stencils *) @@ -630,10 +633,30 @@ evolCalc = } }; -RHSBoundaryCalc = +RHSStaticBoundaryCalc = { - Name -> BSSN <> "_RHSBoundary", - Schedule -> {"IN MoL_RHSBoundaries"}, + Name -> BSSN <> "_RHSStaticBoundary", + Schedule -> {"IN MoL_CalcRHS"}, + ConditionalOnKeyword -> {"my_rhs_boundary_condition", "static"}, + Where -> Boundary, + Equations -> + { + dot[phi] -> 0, + dot[gt[la,lb]] -> 0, + dot[trK] -> 0, + dot[At[la,lb]] -> 0, + dot[Xt[ua]] -> 0, + dot[alpha] -> 0, + dot[A] -> 0, + dot[beta[ua]] -> 0, + dot[B[ua]] -> 0 + } +}; + +RHSRadiativeBoundaryCalc = +{ + Name -> BSSN <> "_RHSRadiativeBoundary", + Schedule -> {"IN MoL_CalcRHS"}, ConditionalOnKeyword -> {"my_rhs_boundary_condition", "radiative"}, Where -> Boundary, Shorthands -> {dir[ua], @@ -905,10 +928,17 @@ keywordParameters = Default -> "ADMBase" }, { + Name -> "my_initial_boundary_condition", + Visibility -> "restricted", + (* Description -> "ddd", *) + AllowedValues -> {"none"}, + Default -> "none" + }, + { Name -> "my_rhs_boundary_condition", Visibility -> "restricted", (* Description -> "ddd", *) - AllowedValues -> {"none", "radiative"}, + AllowedValues -> {"none", "static", "radiative"}, Default -> "none" }, { @@ -987,7 +1017,8 @@ calculations = convertFromADMBaseCalc, convertFromADMBaseGammaCalc, evolCalc, - RHSBoundaryCalc, + RHSStaticBoundaryCalc, + RHSRadiativeBoundaryCalc, enforceCalc, boundaryCalc, convertToADMBaseCalc, diff --git a/m/WaveToyFO.m b/m/WaveToyFO.m new file mode 100644 index 0000000..55f951f --- /dev/null +++ b/m/WaveToyFO.m @@ -0,0 +1,139 @@ +$Path = Join[$Path, {"~/Calpha/kranc/Tools/CodeGen", + "~/Calpha/kranc/Tools/MathematicaMisc"}]; + +Get["KrancThorn`"]; + +SetEnhancedTimes[False]; +SetSourceLanguage["C"]; + +(******************************************************************************) +(* Derivatives *) +(******************************************************************************) + +derivOrder = 4; + +derivatives = +{ + PDstandardNth[i_] -> StandardCenteredDifferenceOperator[1,derivOrder/2,i], + PDstandardNth[i_, i_] -> StandardCenteredDifferenceOperator[2,derivOrder/2,i], + PDstandardNth[i_, j_] -> StandardCenteredDifferenceOperator[1,derivOrder/2,i] + StandardCenteredDifferenceOperator[1,derivOrder/2,j] +(* + PDstandardNth[i_, i_, i_] -> + StandardCenteredDifferenceOperator[3,derivOrder/2,i], + PDstandardNth[i_, i_, j_] -> + StandardCenteredDifferenceOperator[2,derivOrder/2,i] + StandardCenteredDifferenceOperator[1,derivOrder/2,j], + PDstandardNth[i_, j_, i_] -> + StandardCenteredDifferenceOperator[2,derivOrder/2,i] + StandardCenteredDifferenceOperator[1,derivOrder/2,j], + PDstandardNth[j_, i_, i_] -> + StandardCenteredDifferenceOperator[2,derivOrder/2,i] + StandardCenteredDifferenceOperator[1,derivOrder/2,j], + PDstandardNth[i_, j_, k_] -> + StandardCenteredDifferenceOperator[1,derivOrder/2,i] + StandardCenteredDifferenceOperator[1,derivOrder/2,j] + StandardCenteredDifferenceOperator[1,derivOrder/2,k] +*) +}; + +FD = PDstandardNth; +ResetJacobians; +DefineJacobian[PD, FD, KD, Zero3]; + +(* timelevels *) +evolutionTimelevels = 2; + +KD = KroneckerDelta; + +(******************************************************************************) +(* Tensors *) +(******************************************************************************) + +(* Register the tensor quantities with the TensorTools package *) +Map [DefineTensor, {u, rho, v, w}]; + +(******************************************************************************) +(* Groups *) +(******************************************************************************) + +evolvedGroups = + {SetGroupName [CreateGroupFromTensor [u ], "WT_u" ], + SetGroupName [CreateGroupFromTensor [v[la]], "WT_v" ], + SetGroupName [CreateGroupFromTensor [rho ], "WT_rho"]}; +evaluatedGroups = + {SetGroupName [CreateGroupFromTensor [w[ua]], "WT_w"]}; + +declaredGroups = Join [evolvedGroups, evaluatedGroups]; +declaredGroupNames = Map [First, declaredGroups]; + +groups = declaredGroups; + +(******************************************************************************) +(* Initial data *) +(******************************************************************************) + +initialCalc = +{ + Name -> "WTFO_Gaussian", + Schedule -> {"AT initial"}, + (* Where -> Boundary, *) + (* Where -> Interior, *) + Equations -> + { + u -> 0, + v[la] -> 0, + rho -> 0 + } +}; + +(******************************************************************************) +(* Evolution equations *) +(******************************************************************************) + +evolCalc = +{ + Name -> "WTFO_RHS", + Schedule -> {"IN MoL_CalcRHS", "AT analysis"}, + Where -> Interior, + Equations -> + { + dot[u] -> rho, + dot[rho] -> KD[ua,ub] PD[v[la],lb], + dot[v[la]] -> PD[rho,la] + } +}; + +(******************************************************************************) +(* Constraint equations *) +(******************************************************************************) + +constraintsCalc = +{ + Name -> "WTFO_constraints", + Schedule -> {"AT analysis"}, + Where -> Interior, + Equations -> + { + w[ua] -> Eps[ua,ub,uc] PD[v[lb],lc] + } +}; + +(******************************************************************************) +(* Construct the thorns *) +(******************************************************************************) + +calculations = +{ + initialCalc, + evolCalc, + constraintsCalc +}; + +CreateKrancThornTT [groups, ".", "ML_WaveToyFO", + Calculations -> calculations, + DeclaredGroups -> declaredGroupNames, + PartialDerivatives -> derivatives, + UseLoopControl -> True, + EvolutionTimelevels -> evolutionTimelevels +]; diff --git a/m/prototype/ML_BSSN_Helper/param.ccl b/m/prototype/ML_BSSN_Helper/param.ccl index 338d0a2..f9267d0 100644 --- a/m/prototype/ML_BSSN_Helper/param.ccl +++ b/m/prototype/ML_BSSN_Helper/param.ccl @@ -17,10 +17,15 @@ USES CCTK_INT boundary_width SHARES: ML_BSSN USES CCTK_INT timelevels +USES CCTK_INT rhs_timelevels USES KEYWORD calculate_ADMBase_variables_at USES CCTK_REAL harmonicF +EXTENDS KEYWORD my_initial_boundary_condition +{ + "extrapolate-gammas" :: "extrapolate-gammas" +} EXTENDS KEYWORD my_rhs_boundary_condition { "NewRad" :: "NewRad" diff --git a/m/prototype/ML_BSSN_Helper/schedule.ccl b/m/prototype/ML_BSSN_Helper/schedule.ccl index 48bea28..2c677cc 100644 --- a/m/prototype/ML_BSSN_Helper/schedule.ccl +++ b/m/prototype/ML_BSSN_Helper/schedule.ccl @@ -21,6 +21,19 @@ if (CCTK_EQUALS (evolution_method, "ML_BSSN")) { STORAGE: ADMBase::shift[3] STORAGE: ADMBase::dtlapse[3] STORAGE: ADMBase::dtshift[3] + } else if (timelevels == 4) { + #STORAGE: ADMBase::metric[4] + #STORAGE: ADMBase::curv[4] + #STORAGE: ADMBase::lapse[4] + #STORAGE: ADMBase::shift[4] + #STORAGE: ADMBase::dtlapse[4] + #STORAGE: ADMBase::dtshift[4] + STORAGE: ADMBase::metric[3] + STORAGE: ADMBase::curv[3] + STORAGE: ADMBase::lapse[3] + STORAGE: ADMBase::shift[3] + STORAGE: ADMBase::dtlapse[3] + STORAGE: ADMBase::dtshift[3] } SCHEDULE ML_BSSN_RegisterSlicing AT startup @@ -29,11 +42,11 @@ if (CCTK_EQUALS (evolution_method, "ML_BSSN")) { OPTIONS: meta } "Register slicing" - SCHEDULE ML_BSSN_UnsetCheckpointTags AT startup + SCHEDULE ML_BSSN_SetGroupTags AT startup BEFORE Driver_Startup { LANG: C OPTIONS: meta - } "Don't checkpoint ADMBase variables" + } "Set checkpointing and prolongation group tags" SCHEDULE ML_BSSN_RegisterConstrained IN MoL_Register { @@ -43,6 +56,13 @@ if (CCTK_EQUALS (evolution_method, "ML_BSSN")) { + #SCHEDULE GROUP ML_BSSN_evolCalcGroup AT postinitial AFTER MoL_PostStep + #{ + #} "Calculate BSSN RHS" + SCHEDULE GROUP MoL_CalcRHS AT postinitial AFTER MoL_PostStep + { + } "Evaluate RHS" + SCHEDULE GROUP ML_BSSN_evolCalcGroup IN MoL_CalcRHS { } "Calculate BSSN RHS" @@ -62,7 +82,7 @@ if (CCTK_EQUALS (evolution_method, "ML_BSSN")) { - if (CCTK_EQUALS (my_rhs_boundary_condition, "NewRad")) + if (CCTK_EQUALS (my_initial_boundary_condition, "extrapolate-gammas")) { SCHEDULE ML_BSSN_ExtrapolateGammas AT initial AFTER ML_BSSN_convertFromADMBaseGamma { @@ -71,7 +91,10 @@ if (CCTK_EQUALS (evolution_method, "ML_BSSN")) { SYNC: ML_dtlapse SYNC: ML_dtshift } "Extrapolate Gammas and time derivatives of lapse and shift" - + } + + if (CCTK_EQUALS (my_rhs_boundary_condition, "NewRad")) + { SCHEDULE ML_BSSN_NewRad IN ML_BSSN_evolCalcGroup AFTER ML_BSSN_RHS { LANG: C @@ -97,7 +120,7 @@ if (CCTK_EQUALS (evolution_method, "ML_BSSN")) { { # if (timelevels > 1) # { - # SCHEDULE ML_BSSN_CopyADMBase AT CCTK_PRESTEP + # SCHEDULE ML_BSSN_CopyADMBase AT prestep # { # LANG: C # } "Copy ADMBase variables to current time level" diff --git a/m/prototype/ML_BSSN_Helper/src/SetGroupTags.c b/m/prototype/ML_BSSN_Helper/src/SetGroupTags.c new file mode 100644 index 0000000..a3f20a7 --- /dev/null +++ b/m/prototype/ML_BSSN_Helper/src/SetGroupTags.c @@ -0,0 +1,69 @@ +#include <cctk.h> +#include <cctk_Parameters.h> +#include <util_Table.h> + +#include <assert.h> + +static void +set_group_tags (int const checkpoint, int const prolongate, + char const * restrict const gn); + +int +ML_BSSN_SetGroupTags (void) +{ + DECLARE_CCTK_PARAMETERS; + + set_group_tags (0, 1, "ADMBase::metric"); + set_group_tags (0, 1, "ADMBase::curv"); + set_group_tags (0, 1, "ADMBase::lapse"); + set_group_tags (0, 1, "ADMBase::shift"); + set_group_tags (0, 1, "ADMBase::dtlapse"); + set_group_tags (0, 1, "ADMBase::dtshift"); + + set_group_tags (0, 0, "ML_BSSN::ML_cons_detg"); + set_group_tags (0, 0, "ML_BSSN::ML_cons_Gamma"); + set_group_tags (0, 0, "ML_BSSN::ML_cons_traceA"); + set_group_tags (0, 0, "ML_BSSN::ML_Ham"); + set_group_tags (0, 0, "ML_BSSN::ML_mom"); + set_group_tags (0, 0, "ML_BSSN::ML_curvrhs"); + + int const checkpoint = rhs_timelevels > 1; + set_group_tags (checkpoint, 0, "ML_BSSN::ML_dtlapserhs"); + set_group_tags (checkpoint, 0, "ML_BSSN::ML_dtshiftrhs"); + set_group_tags (checkpoint, 0, "ML_BSSN::ML_Gammarhs"); + set_group_tags (checkpoint, 0, "ML_BSSN::ML_lapserhs"); + set_group_tags (checkpoint, 0, "ML_BSSN::ML_log_confacrhs"); + set_group_tags (checkpoint, 0, "ML_BSSN::ML_metricrhs"); + set_group_tags (checkpoint, 0, "ML_BSSN::ML_shiftrhs"); + set_group_tags (checkpoint, 0, "ML_BSSN::ML_trace_curvrhs"); + + return 0; +} + +static void +set_group_tags (int const checkpoint, int const prolongate, + char const * restrict const gn) +{ + assert (gn); + + int const gi = CCTK_GroupIndex (gn); + assert (gi >= 0); + + int const table = CCTK_GroupTagsTableI (gi); + assert (table >= 0); + + if (! checkpoint) { + int ierr; + ierr = Util_TableSetString (table, "no", "Checkpoint"); + assert (! ierr); + + ierr = Util_TableSetString (table, "no", "Persistent"); + assert (! ierr); + } + + if (! prolongate) { + int ierr; + ierr = Util_TableSetString (table, "none", "Prolongation"); + assert (! ierr); + } +} diff --git a/m/prototype/ML_BSSN_Helper/src/UnsetCheckpointTags.c b/m/prototype/ML_BSSN_Helper/src/UnsetCheckpointTags.c deleted file mode 100644 index 3eaf347..0000000 --- a/m/prototype/ML_BSSN_Helper/src/UnsetCheckpointTags.c +++ /dev/null @@ -1,59 +0,0 @@ -#include <cctk.h> -#include <util_Table.h> - -#include <assert.h> - -static void -unset_checkpoint_tag (int prolongate, char const * restrict gn); - -int -ML_BSSN_UnsetCheckpointTags (void) -{ - unset_checkpoint_tag (1, "ADMBase::metric"); - unset_checkpoint_tag (1, "ADMBase::curv"); - unset_checkpoint_tag (1, "ADMBase::lapse"); - unset_checkpoint_tag (1, "ADMBase::shift"); - unset_checkpoint_tag (1, "ADMBase::dtlapse"); - unset_checkpoint_tag (1, "ADMBase::dtshift"); - - unset_checkpoint_tag (0, "ML_BSSN::ML_cons_detg"); - unset_checkpoint_tag (0, "ML_BSSN::ML_cons_Gamma"); - unset_checkpoint_tag (0, "ML_BSSN::ML_cons_traceA"); - unset_checkpoint_tag (0, "ML_BSSN::ML_Ham"); - unset_checkpoint_tag (0, "ML_BSSN::ML_mom"); - unset_checkpoint_tag (0, "ML_BSSN::ML_curvrhs"); - unset_checkpoint_tag (0, "ML_BSSN::ML_dtlapserhs"); - unset_checkpoint_tag (0, "ML_BSSN::ML_dtshiftrhs"); - unset_checkpoint_tag (0, "ML_BSSN::ML_Gammarhs"); - unset_checkpoint_tag (0, "ML_BSSN::ML_lapserhs"); - unset_checkpoint_tag (0, "ML_BSSN::ML_log_confacrhs"); - unset_checkpoint_tag (0, "ML_BSSN::ML_metricrhs"); - unset_checkpoint_tag (0, "ML_BSSN::ML_shiftrhs"); - unset_checkpoint_tag (0, "ML_BSSN::ML_trace_curvrhs"); - - return 0; -} - -static void -unset_checkpoint_tag (int const prolongate, char const * restrict const gn) -{ - assert (gn); - - int const gi = CCTK_GroupIndex (gn); - assert (gi >= 0); - - int const table = CCTK_GroupTagsTableI (gi); - assert (table >= 0); - - int ierr; - ierr = Util_TableSetString (table, "no", "Checkpoint"); - assert (! ierr); - - ierr = Util_TableSetString (table, "no", "Persistent"); - assert (! ierr); - - if (! prolongate) { - ierr = Util_TableSetString (table, "none", "Prolongation"); - assert (! ierr); - } -} diff --git a/m/prototype/ML_BSSN_Helper/src/make.code.defn b/m/prototype/ML_BSSN_Helper/src/make.code.defn index 7cc4e72..2625d6c 100644 --- a/m/prototype/ML_BSSN_Helper/src/make.code.defn +++ b/m/prototype/ML_BSSN_Helper/src/make.code.defn @@ -1,3 +1,3 @@ # -*-Makefile-*- -SRCS = ExtrapolateGammas.c NewRad.c RegisterConstrained.c RegisterSlicing.c SelectBCsADMBase.c UnsetCheckpointTags.c +SRCS = ExtrapolateGammas.c NewRad.c RegisterConstrained.c RegisterSlicing.c SelectBCsADMBase.c SetGroupTags.c # CopyADMBase.c |