diff options
Diffstat (limited to 'Examples/Euler')
-rw-r--r-- | Examples/Euler/configuration.ccl | 6 | ||||
-rw-r--r-- | Examples/Euler/interface.ccl | 188 | ||||
-rw-r--r-- | Examples/Euler/param.ccl | 462 | ||||
-rw-r--r-- | Examples/Euler/schedule.ccl | 313 | ||||
-rw-r--r-- | Examples/Euler/src/Boundaries.cc | 457 | ||||
-rw-r--r-- | Examples/Euler/src/Differencing.h | 504 | ||||
-rw-r--r-- | Examples/Euler/src/RegisterMoL.cc | 23 | ||||
-rw-r--r-- | Examples/Euler/src/RegisterSymmetries.cc | 194 | ||||
-rw-r--r-- | Examples/Euler/src/Startup.cc | 10 | ||||
-rw-r--r-- | Examples/Euler/src/euler_conserved.cc | 163 | ||||
-rw-r--r-- | Examples/Euler/src/euler_conserved_flux_1.cc | 186 | ||||
-rw-r--r-- | Examples/Euler/src/euler_flux_1.cc | 222 | ||||
-rw-r--r-- | Examples/Euler/src/euler_initial_shock.cc | 161 | ||||
-rw-r--r-- | Examples/Euler/src/euler_primitives.cc | 163 | ||||
-rw-r--r-- | Examples/Euler/src/euler_reconstruct_1.cc | 245 | ||||
-rw-r--r-- | Examples/Euler/src/euler_rhs_1.cc | 191 | ||||
-rw-r--r-- | Examples/Euler/src/euler_zero_rhs.cc | 157 | ||||
-rw-r--r-- | Examples/Euler/src/make.code.defn | 3 |
18 files changed, 3648 insertions, 0 deletions
diff --git a/Examples/Euler/configuration.ccl b/Examples/Euler/configuration.ccl new file mode 100644 index 0000000..0a66ec2 --- /dev/null +++ b/Examples/Euler/configuration.ccl @@ -0,0 +1,6 @@ +# File produced by Kranc + +REQUIRES GenericFD +OPTIONAL LoopControl +{ +} diff --git a/Examples/Euler/interface.ccl b/Examples/Euler/interface.ccl new file mode 100644 index 0000000..15f32e0 --- /dev/null +++ b/Examples/Euler/interface.ccl @@ -0,0 +1,188 @@ +# File produced by Kranc + +implements: Euler + +inherits: Grid GenericFD Boundary + + + +USES INCLUDE: GenericFD.h +USES INCLUDE: Symmetry.h +USES INCLUDE: sbp_calc_coeffs.h +USES INCLUDE: Boundary.h +USES INCLUDE: loopcontrol.h + +CCTK_INT FUNCTION MoLRegisterEvolved(CCTK_INT IN EvolvedIndex, CCTK_INT IN RHSIndex) +USES FUNCTION MoLRegisterEvolved + +SUBROUTINE Diff_coeff(CCTK_POINTER_TO_CONST IN cctkGH, CCTK_INT IN dir, CCTK_INT IN nsize, CCTK_INT OUT ARRAY imin, CCTK_INT OUT ARRAY imax, CCTK_REAL OUT ARRAY q, CCTK_INT IN table_handle) +USES FUNCTION Diff_coeff + +CCTK_INT FUNCTION MultiPatch_GetMap(CCTK_POINTER_TO_CONST IN cctkGH) +USES FUNCTION MultiPatch_GetMap + +CCTK_INT FUNCTION Boundary_SelectGroupForBC(CCTK_POINTER_TO_CONST IN GH, CCTK_INT IN faces, CCTK_INT IN boundary_width, CCTK_INT IN table_handle, CCTK_STRING IN group_name, CCTK_STRING IN bc_name) +USES FUNCTION Boundary_SelectGroupForBC + +CCTK_INT FUNCTION Boundary_SelectVarForBC(CCTK_POINTER_TO_CONST IN GH, CCTK_INT IN faces, CCTK_INT IN boundary_width, CCTK_INT IN table_handle, CCTK_STRING IN var_name, CCTK_STRING IN bc_name) +USES FUNCTION Boundary_SelectVarForBC + +public: +CCTK_REAL DenF_group type=GF timelevels=1 tags='tensortypealias="Scalar" tensorweight=0' +{ + DenF +} "DenF_group" + +public: +CCTK_REAL DenLeft_group type=GF timelevels=1 tags='tensortypealias="Scalar" tensorweight=0' +{ + DenLeft +} "DenLeft_group" + +public: +CCTK_REAL DenRight_group type=GF timelevels=1 tags='tensortypealias="Scalar" tensorweight=0' +{ + DenRight +} "DenRight_group" + +public: +CCTK_REAL EnF_group type=GF timelevels=1 tags='tensortypealias="Scalar" tensorweight=0' +{ + EnF +} "EnF_group" + +public: +CCTK_REAL EnLeft_group type=GF timelevels=1 tags='tensortypealias="Scalar" tensorweight=0' +{ + EnLeft +} "EnLeft_group" + +public: +CCTK_REAL EnRight_group type=GF timelevels=1 tags='tensortypealias="Scalar" tensorweight=0' +{ + EnRight +} "EnRight_group" + +public: +CCTK_REAL p_group type=GF timelevels=1 tags='tensortypealias="Scalar" tensorweight=0' +{ + p +} "p_group" + +public: +CCTK_REAL pLeft_group type=GF timelevels=1 tags='tensortypealias="Scalar" tensorweight=0' +{ + pLeft +} "pLeft_group" + +public: +CCTK_REAL pRight_group type=GF timelevels=1 tags='tensortypealias="Scalar" tensorweight=0' +{ + pRight +} "pRight_group" + +public: +CCTK_REAL rho_group type=GF timelevels=1 tags='tensortypealias="Scalar" tensorweight=0' +{ + rho +} "rho_group" + +public: +CCTK_REAL rhoLeft_group type=GF timelevels=1 tags='tensortypealias="Scalar" tensorweight=0' +{ + rhoLeft +} "rhoLeft_group" + +public: +CCTK_REAL rhoRight_group type=GF timelevels=1 tags='tensortypealias="Scalar" tensorweight=0' +{ + rhoRight +} "rhoRight_group" + +public: +CCTK_REAL SF_group type=GF timelevels=1 tags='tensortypealias="U" tensorweight=0' +{ + SF1, + SF2, + SF3 +} "SF_group" + +public: +CCTK_REAL SLeft_group type=GF timelevels=1 tags='tensortypealias="U" tensorweight=0' +{ + SLeft1, + SLeft2, + SLeft3 +} "SLeft_group" + +public: +CCTK_REAL SRight_group type=GF timelevels=1 tags='tensortypealias="U" tensorweight=0' +{ + SRight1, + SRight2, + SRight3 +} "SRight_group" + +public: +CCTK_REAL v_group type=GF timelevels=1 tags='tensortypealias="U" tensorweight=0' +{ + v1, + v2, + v3 +} "v_group" + +public: +CCTK_REAL vLeft_group type=GF timelevels=1 tags='tensortypealias="U" tensorweight=0' +{ + vLeft1, + vLeft2, + vLeft3 +} "vLeft_group" + +public: +CCTK_REAL vRight_group type=GF timelevels=1 tags='tensortypealias="U" tensorweight=0' +{ + vRight1, + vRight2, + vRight3 +} "vRight_group" + +public: +CCTK_REAL Den_group type=GF timelevels=3 tags='tensortypealias="Scalar" tensorweight=0' +{ + Den +} "Den_group" + +public: +CCTK_REAL En_group type=GF timelevels=3 tags='tensortypealias="Scalar" tensorweight=0' +{ + En +} "En_group" + +public: +CCTK_REAL S_group type=GF timelevels=3 tags='tensortypealias="U" tensorweight=0' +{ + S1, + S2, + S3 +} "S_group" + +public: +CCTK_REAL Den_grouprhs type=GF timelevels=3 tags='tensortypealias="Scalar" tensorweight=0' +{ + Denrhs +} "Den_grouprhs" + +public: +CCTK_REAL En_grouprhs type=GF timelevels=3 tags='tensortypealias="Scalar" tensorweight=0' +{ + Enrhs +} "En_grouprhs" + +public: +CCTK_REAL S_grouprhs type=GF timelevels=3 tags='tensortypealias="U" tensorweight=0' +{ + S1rhs, + S2rhs, + S3rhs +} "S_grouprhs" diff --git a/Examples/Euler/param.ccl b/Examples/Euler/param.ccl new file mode 100644 index 0000000..96ee289 --- /dev/null +++ b/Examples/Euler/param.ccl @@ -0,0 +1,462 @@ +# File produced by Kranc + + +shares: GenericFD + + + +shares: MethodOfLines + +USES CCTK_INT MoL_Num_Evolved_Vars +USES CCTK_INT MoL_Num_ArrayEvolved_Vars + +restricted: +CCTK_INT verbose "verbose" STEERABLE=ALWAYS +{ + *:* :: "" +} 0 + +restricted: +CCTK_REAL sigma "sigma" +{ + "*:*" :: "" +} 0 + +restricted: +CCTK_REAL v0 "v0" +{ + "*:*" :: "" +} 0 + +restricted: +CCTK_REAL amp "amp" +{ + "*:*" :: "" +} 0 + +restricted: +CCTK_REAL rhoR0 "rhoR0" +{ + "*:*" :: "" +} 0 + +restricted: +CCTK_REAL rhoL0 "rhoL0" +{ + "*:*" :: "" +} 0 + +restricted: +CCTK_REAL vR0 "vR0" +{ + "*:*" :: "" +} 0 + +restricted: +CCTK_REAL vL0 "vL0" +{ + "*:*" :: "" +} 0 + +restricted: +CCTK_REAL pR0 "pR0" +{ + "*:*" :: "" +} 0 + +restricted: +CCTK_REAL pL0 "pL0" +{ + "*:*" :: "" +} 0 + +restricted: +CCTK_REAL gamma "gamma" +{ + "*:*" :: "" +} 0 + +restricted: +CCTK_REAL alpha "alpha" +{ + "*:*" :: "" +} 0 + +restricted: +CCTK_REAL hlleAlpha "hlleAlpha" +{ + "*:*" :: "" +} 0 + +private: +KEYWORD initial_data "initial_data" +{ + "shock" :: "shock" +} "shock" + +restricted: +CCTK_INT Euler_MaxNumEvolvedVars "Number of evolved variables used by this thorn" ACCUMULATOR-BASE=MethodofLines::MoL_Num_Evolved_Vars STEERABLE=RECOVER +{ + 5:5 :: "Number of evolved variables used by this thorn" +} 5 + +restricted: +CCTK_INT Euler_MaxNumArrayEvolvedVars "Number of Array evolved variables used by this thorn" ACCUMULATOR-BASE=MethodofLines::MoL_Num_ArrayEvolved_Vars STEERABLE=RECOVER +{ + 0:0 :: "Number of Array evolved variables used by this thorn" +} 0 + +restricted: +CCTK_INT timelevels "Number of active timelevels" STEERABLE=RECOVER +{ + 0:3 :: "" +} 3 + +restricted: +CCTK_INT rhs_timelevels "Number of active RHS timelevels" STEERABLE=RECOVER +{ + 0:3 :: "" +} 1 + +restricted: +CCTK_INT other_timelevels "Number of active timelevels for non-evolved grid functions" STEERABLE=RECOVER +{ + 0:3 :: "" +} 1 + +restricted: +CCTK_INT euler_initial_shock_calc_every "euler_initial_shock_calc_every" STEERABLE=ALWAYS +{ + *:* :: "" +} 1 + +restricted: +CCTK_INT euler_primitives_calc_every "euler_primitives_calc_every" STEERABLE=ALWAYS +{ + *:* :: "" +} 1 + +restricted: +CCTK_INT euler_conserved_calc_every "euler_conserved_calc_every" STEERABLE=ALWAYS +{ + *:* :: "" +} 1 + +restricted: +CCTK_INT euler_zero_rhs_calc_every "euler_zero_rhs_calc_every" STEERABLE=ALWAYS +{ + *:* :: "" +} 1 + +restricted: +CCTK_INT euler_reconstruct_1_calc_every "euler_reconstruct_1_calc_every" STEERABLE=ALWAYS +{ + *:* :: "" +} 1 + +restricted: +CCTK_INT euler_conserved_flux_1_calc_every "euler_conserved_flux_1_calc_every" STEERABLE=ALWAYS +{ + *:* :: "" +} 1 + +restricted: +CCTK_INT euler_flux_1_calc_every "euler_flux_1_calc_every" STEERABLE=ALWAYS +{ + *:* :: "" +} 1 + +restricted: +CCTK_INT euler_rhs_1_calc_every "euler_rhs_1_calc_every" STEERABLE=ALWAYS +{ + *:* :: "" +} 1 + +restricted: +CCTK_INT euler_initial_shock_calc_offset "euler_initial_shock_calc_offset" STEERABLE=ALWAYS +{ + *:* :: "" +} 0 + +restricted: +CCTK_INT euler_primitives_calc_offset "euler_primitives_calc_offset" STEERABLE=ALWAYS +{ + *:* :: "" +} 0 + +restricted: +CCTK_INT euler_conserved_calc_offset "euler_conserved_calc_offset" STEERABLE=ALWAYS +{ + *:* :: "" +} 0 + +restricted: +CCTK_INT euler_zero_rhs_calc_offset "euler_zero_rhs_calc_offset" STEERABLE=ALWAYS +{ + *:* :: "" +} 0 + +restricted: +CCTK_INT euler_reconstruct_1_calc_offset "euler_reconstruct_1_calc_offset" STEERABLE=ALWAYS +{ + *:* :: "" +} 0 + +restricted: +CCTK_INT euler_conserved_flux_1_calc_offset "euler_conserved_flux_1_calc_offset" STEERABLE=ALWAYS +{ + *:* :: "" +} 0 + +restricted: +CCTK_INT euler_flux_1_calc_offset "euler_flux_1_calc_offset" STEERABLE=ALWAYS +{ + *:* :: "" +} 0 + +restricted: +CCTK_INT euler_rhs_1_calc_offset "euler_rhs_1_calc_offset" STEERABLE=ALWAYS +{ + *:* :: "" +} 0 + +private: +KEYWORD Den_bound "Boundary condition to implement" STEERABLE=ALWAYS +{ + "flat" :: "Flat boundary condition" + "none" :: "No boundary condition" + "static" :: "Boundaries held fixed" + "radiative" :: "Radiation boundary condition" + "scalar" :: "Dirichlet boundary condition" + "newrad" :: "Improved radiative boundary condition" + "skip" :: "skip boundary condition code" +} "skip" + +private: +KEYWORD En_bound "Boundary condition to implement" STEERABLE=ALWAYS +{ + "flat" :: "Flat boundary condition" + "none" :: "No boundary condition" + "static" :: "Boundaries held fixed" + "radiative" :: "Radiation boundary condition" + "scalar" :: "Dirichlet boundary condition" + "newrad" :: "Improved radiative boundary condition" + "skip" :: "skip boundary condition code" +} "skip" + +private: +KEYWORD S1_bound "Boundary condition to implement" STEERABLE=ALWAYS +{ + "flat" :: "Flat boundary condition" + "none" :: "No boundary condition" + "static" :: "Boundaries held fixed" + "radiative" :: "Radiation boundary condition" + "scalar" :: "Dirichlet boundary condition" + "newrad" :: "Improved radiative boundary condition" + "skip" :: "skip boundary condition code" +} "skip" + +private: +KEYWORD S2_bound "Boundary condition to implement" STEERABLE=ALWAYS +{ + "flat" :: "Flat boundary condition" + "none" :: "No boundary condition" + "static" :: "Boundaries held fixed" + "radiative" :: "Radiation boundary condition" + "scalar" :: "Dirichlet boundary condition" + "newrad" :: "Improved radiative boundary condition" + "skip" :: "skip boundary condition code" +} "skip" + +private: +KEYWORD S3_bound "Boundary condition to implement" STEERABLE=ALWAYS +{ + "flat" :: "Flat boundary condition" + "none" :: "No boundary condition" + "static" :: "Boundaries held fixed" + "radiative" :: "Radiation boundary condition" + "scalar" :: "Dirichlet boundary condition" + "newrad" :: "Improved radiative boundary condition" + "skip" :: "skip boundary condition code" +} "skip" + +private: +KEYWORD Den_group_bound "Boundary condition to implement" STEERABLE=ALWAYS +{ + "flat" :: "Flat boundary condition" + "none" :: "No boundary condition" + "static" :: "Boundaries held fixed" + "radiative" :: "Radiation boundary condition" + "scalar" :: "Dirichlet boundary condition" + "newrad" :: "Improved radiative boundary condition" + "skip" :: "skip boundary condition code" +} "none" + +private: +KEYWORD En_group_bound "Boundary condition to implement" STEERABLE=ALWAYS +{ + "flat" :: "Flat boundary condition" + "none" :: "No boundary condition" + "static" :: "Boundaries held fixed" + "radiative" :: "Radiation boundary condition" + "scalar" :: "Dirichlet boundary condition" + "newrad" :: "Improved radiative boundary condition" + "skip" :: "skip boundary condition code" +} "none" + +private: +KEYWORD S_group_bound "Boundary condition to implement" STEERABLE=ALWAYS +{ + "flat" :: "Flat boundary condition" + "none" :: "No boundary condition" + "static" :: "Boundaries held fixed" + "radiative" :: "Radiation boundary condition" + "scalar" :: "Dirichlet boundary condition" + "newrad" :: "Improved radiative boundary condition" + "skip" :: "skip boundary condition code" +} "none" + +private: +CCTK_REAL Den_bound_speed "characteristic speed at boundary" STEERABLE=ALWAYS +{ + "0:*" :: "outgoing characteristic speed > 0" +} 1. + +private: +CCTK_REAL En_bound_speed "characteristic speed at boundary" STEERABLE=ALWAYS +{ + "0:*" :: "outgoing characteristic speed > 0" +} 1. + +private: +CCTK_REAL S1_bound_speed "characteristic speed at boundary" STEERABLE=ALWAYS +{ + "0:*" :: "outgoing characteristic speed > 0" +} 1. + +private: +CCTK_REAL S2_bound_speed "characteristic speed at boundary" STEERABLE=ALWAYS +{ + "0:*" :: "outgoing characteristic speed > 0" +} 1. + +private: +CCTK_REAL S3_bound_speed "characteristic speed at boundary" STEERABLE=ALWAYS +{ + "0:*" :: "outgoing characteristic speed > 0" +} 1. + +private: +CCTK_REAL Den_group_bound_speed "characteristic speed at boundary" STEERABLE=ALWAYS +{ + "0:*" :: "outgoing characteristic speed > 0" +} 1. + +private: +CCTK_REAL En_group_bound_speed "characteristic speed at boundary" STEERABLE=ALWAYS +{ + "0:*" :: "outgoing characteristic speed > 0" +} 1. + +private: +CCTK_REAL S_group_bound_speed "characteristic speed at boundary" STEERABLE=ALWAYS +{ + "0:*" :: "outgoing characteristic speed > 0" +} 1. + +private: +CCTK_REAL Den_bound_limit "limit value for r -> infinity" STEERABLE=ALWAYS +{ + "*:*" :: "value of limit value is unrestricted" +} 0. + +private: +CCTK_REAL En_bound_limit "limit value for r -> infinity" STEERABLE=ALWAYS +{ + "*:*" :: "value of limit value is unrestricted" +} 0. + +private: +CCTK_REAL S1_bound_limit "limit value for r -> infinity" STEERABLE=ALWAYS +{ + "*:*" :: "value of limit value is unrestricted" +} 0. + +private: +CCTK_REAL S2_bound_limit "limit value for r -> infinity" STEERABLE=ALWAYS +{ + "*:*" :: "value of limit value is unrestricted" +} 0. + +private: +CCTK_REAL S3_bound_limit "limit value for r -> infinity" STEERABLE=ALWAYS +{ + "*:*" :: "value of limit value is unrestricted" +} 0. + +private: +CCTK_REAL Den_group_bound_limit "limit value for r -> infinity" STEERABLE=ALWAYS +{ + "*:*" :: "value of limit value is unrestricted" +} 0. + +private: +CCTK_REAL En_group_bound_limit "limit value for r -> infinity" STEERABLE=ALWAYS +{ + "*:*" :: "value of limit value is unrestricted" +} 0. + +private: +CCTK_REAL S_group_bound_limit "limit value for r -> infinity" STEERABLE=ALWAYS +{ + "*:*" :: "value of limit value is unrestricted" +} 0. + +private: +CCTK_REAL Den_bound_scalar "Dirichlet boundary value" STEERABLE=ALWAYS +{ + "*:*" :: "unrestricted" +} 0. + +private: +CCTK_REAL En_bound_scalar "Dirichlet boundary value" STEERABLE=ALWAYS +{ + "*:*" :: "unrestricted" +} 0. + +private: +CCTK_REAL S1_bound_scalar "Dirichlet boundary value" STEERABLE=ALWAYS +{ + "*:*" :: "unrestricted" +} 0. + +private: +CCTK_REAL S2_bound_scalar "Dirichlet boundary value" STEERABLE=ALWAYS +{ + "*:*" :: "unrestricted" +} 0. + +private: +CCTK_REAL S3_bound_scalar "Dirichlet boundary value" STEERABLE=ALWAYS +{ + "*:*" :: "unrestricted" +} 0. + +private: +CCTK_REAL Den_group_bound_scalar "Dirichlet boundary value" STEERABLE=ALWAYS +{ + "*:*" :: "unrestricted" +} 0. + +private: +CCTK_REAL En_group_bound_scalar "Dirichlet boundary value" STEERABLE=ALWAYS +{ + "*:*" :: "unrestricted" +} 0. + +private: +CCTK_REAL S_group_bound_scalar "Dirichlet boundary value" STEERABLE=ALWAYS +{ + "*:*" :: "unrestricted" +} 0. + diff --git a/Examples/Euler/schedule.ccl b/Examples/Euler/schedule.ccl new file mode 100644 index 0000000..0e5da74 --- /dev/null +++ b/Examples/Euler/schedule.ccl @@ -0,0 +1,313 @@ +# File produced by Kranc + + +if (other_timelevels == 1) +{ + STORAGE: DenF_group[1] +} + +if (other_timelevels == 1) +{ + STORAGE: DenLeft_group[1] +} + +if (other_timelevels == 1) +{ + STORAGE: DenRight_group[1] +} + +if (other_timelevels == 1) +{ + STORAGE: EnF_group[1] +} + +if (other_timelevels == 1) +{ + STORAGE: EnLeft_group[1] +} + +if (other_timelevels == 1) +{ + STORAGE: EnRight_group[1] +} + +if (other_timelevels == 1) +{ + STORAGE: p_group[1] +} + +if (other_timelevels == 1) +{ + STORAGE: pLeft_group[1] +} + +if (other_timelevels == 1) +{ + STORAGE: pRight_group[1] +} + +if (other_timelevels == 1) +{ + STORAGE: rho_group[1] +} + +if (other_timelevels == 1) +{ + STORAGE: rhoLeft_group[1] +} + +if (other_timelevels == 1) +{ + STORAGE: rhoRight_group[1] +} + +if (other_timelevels == 1) +{ + STORAGE: SF_group[1] +} + +if (other_timelevels == 1) +{ + STORAGE: SLeft_group[1] +} + +if (other_timelevels == 1) +{ + STORAGE: SRight_group[1] +} + +if (other_timelevels == 1) +{ + STORAGE: v_group[1] +} + +if (other_timelevels == 1) +{ + STORAGE: vLeft_group[1] +} + +if (other_timelevels == 1) +{ + STORAGE: vRight_group[1] +} + +if (timelevels == 1) +{ + STORAGE: Den_group[1] +} +if (timelevels == 2) +{ + STORAGE: Den_group[2] +} +if (timelevels == 3) +{ + STORAGE: Den_group[3] +} + +if (timelevels == 1) +{ + STORAGE: En_group[1] +} +if (timelevels == 2) +{ + STORAGE: En_group[2] +} +if (timelevels == 3) +{ + STORAGE: En_group[3] +} + +if (timelevels == 1) +{ + STORAGE: S_group[1] +} +if (timelevels == 2) +{ + STORAGE: S_group[2] +} +if (timelevels == 3) +{ + STORAGE: S_group[3] +} + +if (rhs_timelevels == 1) +{ + STORAGE: Den_grouprhs[1] +} +if (rhs_timelevels == 2) +{ + STORAGE: Den_grouprhs[2] +} +if (rhs_timelevels == 3) +{ + STORAGE: Den_grouprhs[3] +} + +if (rhs_timelevels == 1) +{ + STORAGE: En_grouprhs[1] +} +if (rhs_timelevels == 2) +{ + STORAGE: En_grouprhs[2] +} +if (rhs_timelevels == 3) +{ + STORAGE: En_grouprhs[3] +} + +if (rhs_timelevels == 1) +{ + STORAGE: S_grouprhs[1] +} +if (rhs_timelevels == 2) +{ + STORAGE: S_grouprhs[2] +} +if (rhs_timelevels == 3) +{ + STORAGE: S_grouprhs[3] +} + +schedule Euler_Startup at STARTUP +{ + LANG: C + OPTIONS: meta +} "create banner" + +schedule Euler_RegisterVars in MoL_Register +{ + LANG: C + OPTIONS: meta +} "Register Variables for MoL" + +schedule Euler_RegisterSymmetries in SymmetryRegister +{ + LANG: C + OPTIONS: meta +} "register symmetries" + + +if (CCTK_EQUALS(initial_data, "shock")) +{ + schedule euler_initial_shock at CCTK_INITIAL as euler_initial + { + LANG: C + } "euler_initial_shock" +} + +schedule euler_primitives in MoL_PostStep after Euler_ApplyBCs +{ + LANG: C +} "euler_primitives" + +schedule euler_conserved at INITIAL after euler_initial +{ + LANG: C +} "euler_conserved" + +schedule euler_zero_rhs in MoL_CalcRHS +{ + LANG: C +} "euler_zero_rhs" + +schedule group euler_reconstruct_1_group in MoL_CalcRHS after euler_zero_rhs +{ + # no language specified +} "euler_reconstruct_1" + +schedule euler_reconstruct_1 in euler_reconstruct_1_group +{ + LANG: C +} "euler_reconstruct_1" + +schedule euler_reconstruct_1_SelectBCs in euler_reconstruct_1_bc_group +{ + LANG: C + OPTIONS: level + SYNC: pLeft_group + SYNC: pRight_group + SYNC: rhoLeft_group + SYNC: rhoRight_group + SYNC: vLeft_group + SYNC: vRight_group +} "euler_reconstruct_1_SelectBCs" + +schedule group ApplyBCs as euler_reconstruct_1_ApplyBCs in euler_reconstruct_1_bc_group after euler_reconstruct_1_SelectBCs +{ + # no language specified +} "Apply BCs for groups set in euler_reconstruct_1" + +schedule group euler_reconstruct_1_bc_group in euler_reconstruct_1_group after euler_reconstruct_1 +{ + # no language specified +} "euler_reconstruct_1" + +schedule group euler_reconstruct_1_bc_group in MoL_PseudoEvolutionBoundaries after MoL_PostStep +{ + # no language specified +} "euler_reconstruct_1" + +schedule euler_conserved_flux_1 in MoL_CalcRHS after euler_reconstruct_1 +{ + LANG: C +} "euler_conserved_flux_1" + +schedule group euler_flux_1_group in MoL_CalcRHS after euler_conserved_flux_1 +{ + # no language specified +} "euler_flux_1" + +schedule euler_flux_1 in euler_flux_1_group +{ + LANG: C +} "euler_flux_1" + +schedule euler_flux_1_SelectBCs in euler_flux_1_bc_group +{ + LANG: C + OPTIONS: level + SYNC: DenF_group + SYNC: EnF_group + SYNC: SF_group +} "euler_flux_1_SelectBCs" + +schedule group ApplyBCs as euler_flux_1_ApplyBCs in euler_flux_1_bc_group after euler_flux_1_SelectBCs +{ + # no language specified +} "Apply BCs for groups set in euler_flux_1" + +schedule group euler_flux_1_bc_group in euler_flux_1_group after euler_flux_1 +{ + # no language specified +} "euler_flux_1" + +schedule group euler_flux_1_bc_group in MoL_PseudoEvolutionBoundaries after MoL_PostStep +{ + # no language specified +} "euler_flux_1" + +schedule euler_rhs_1 in MoL_CalcRHS after euler_flux_1 +{ + LANG: C +} "euler_rhs_1" + +schedule Euler_SelectBoundConds in MoL_PostStep +{ + LANG: C + OPTIONS: level + SYNC: Den_group + SYNC: En_group + SYNC: S_group +} "select boundary conditions" + +schedule Euler_CheckBoundaries at BASEGRID +{ + LANG: C + OPTIONS: meta +} "check boundaries treatment" + +schedule group ApplyBCs as Euler_ApplyBCs in MoL_PostStep after Euler_SelectBoundConds +{ + # no language specified +} "Apply boundary conditions controlled by thorn Boundary" diff --git a/Examples/Euler/src/Boundaries.cc b/Examples/Euler/src/Boundaries.cc new file mode 100644 index 0000000..136e219 --- /dev/null +++ b/Examples/Euler/src/Boundaries.cc @@ -0,0 +1,457 @@ +/* File produced by Kranc */ + +#include "cctk.h" +#include "cctk_Arguments.h" +#include "cctk_Parameters.h" +#include "cctk_Faces.h" +#include "util_Table.h" +#include "Symmetry.h" + + +/* the boundary treatment is split into 3 steps: */ +/* 1. excision */ +/* 2. symmetries */ +/* 3. "other" boundary conditions, e.g. radiative */ + +/* to simplify scheduling and testing, the 3 steps */ +/* are currently applied in separate functions */ + + +extern "C" void Euler_CheckBoundaries(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + return; +} + +extern "C" void Euler_SelectBoundConds(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT ierr = 0; + + if (CCTK_EQUALS(Den_group_bound, "none" ) || + CCTK_EQUALS(Den_group_bound, "static") || + CCTK_EQUALS(Den_group_bound, "flat" ) || + CCTK_EQUALS(Den_group_bound, "zero" ) ) + { + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "Euler::Den_group", Den_group_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register Den_group_bound BC for Euler::Den_group!"); + } + + if (CCTK_EQUALS(En_group_bound, "none" ) || + CCTK_EQUALS(En_group_bound, "static") || + CCTK_EQUALS(En_group_bound, "flat" ) || + CCTK_EQUALS(En_group_bound, "zero" ) ) + { + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "Euler::En_group", En_group_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register En_group_bound BC for Euler::En_group!"); + } + + if (CCTK_EQUALS(S_group_bound, "none" ) || + CCTK_EQUALS(S_group_bound, "static") || + CCTK_EQUALS(S_group_bound, "flat" ) || + CCTK_EQUALS(S_group_bound, "zero" ) ) + { + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "Euler::S_group", S_group_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register S_group_bound BC for Euler::S_group!"); + } + + if (CCTK_EQUALS(Den_bound, "none" ) || + CCTK_EQUALS(Den_bound, "static") || + CCTK_EQUALS(Den_bound, "flat" ) || + CCTK_EQUALS(Den_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "Euler::Den", Den_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register Den_bound BC for Euler::Den!"); + } + + if (CCTK_EQUALS(En_bound, "none" ) || + CCTK_EQUALS(En_bound, "static") || + CCTK_EQUALS(En_bound, "flat" ) || + CCTK_EQUALS(En_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "Euler::En", En_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register En_bound BC for Euler::En!"); + } + + if (CCTK_EQUALS(S1_bound, "none" ) || + CCTK_EQUALS(S1_bound, "static") || + CCTK_EQUALS(S1_bound, "flat" ) || + CCTK_EQUALS(S1_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "Euler::S1", S1_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register S1_bound BC for Euler::S1!"); + } + + if (CCTK_EQUALS(S2_bound, "none" ) || + CCTK_EQUALS(S2_bound, "static") || + CCTK_EQUALS(S2_bound, "flat" ) || + CCTK_EQUALS(S2_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "Euler::S2", S2_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register S2_bound BC for Euler::S2!"); + } + + if (CCTK_EQUALS(S3_bound, "none" ) || + CCTK_EQUALS(S3_bound, "static") || + CCTK_EQUALS(S3_bound, "flat" ) || + CCTK_EQUALS(S3_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "Euler::S3", S3_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register S3_bound BC for Euler::S3!"); + } + + if (CCTK_EQUALS(Den_group_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_Den_group_bound = -1; + if (handle_Den_group_bound < 0) handle_Den_group_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_Den_group_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_Den_group_bound , Den_group_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_Den_group_bound ,Den_group_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_Den_group_bound, + "Euler::Den_group", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for Euler::Den_group!"); + + } + + if (CCTK_EQUALS(En_group_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_En_group_bound = -1; + if (handle_En_group_bound < 0) handle_En_group_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_En_group_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_En_group_bound , En_group_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_En_group_bound ,En_group_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_En_group_bound, + "Euler::En_group", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for Euler::En_group!"); + + } + + if (CCTK_EQUALS(S_group_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_S_group_bound = -1; + if (handle_S_group_bound < 0) handle_S_group_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_S_group_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_S_group_bound , S_group_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_S_group_bound ,S_group_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_S_group_bound, + "Euler::S_group", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for Euler::S_group!"); + + } + + if (CCTK_EQUALS(Den_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_Den_bound = -1; + if (handle_Den_bound < 0) handle_Den_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_Den_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_Den_bound , Den_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_Den_bound ,Den_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_Den_bound, + "Euler::Den", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for Euler::Den!"); + + } + + if (CCTK_EQUALS(En_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_En_bound = -1; + if (handle_En_bound < 0) handle_En_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_En_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_En_bound , En_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_En_bound ,En_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_En_bound, + "Euler::En", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for Euler::En!"); + + } + + if (CCTK_EQUALS(S1_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_S1_bound = -1; + if (handle_S1_bound < 0) handle_S1_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_S1_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_S1_bound , S1_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_S1_bound ,S1_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_S1_bound, + "Euler::S1", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for Euler::S1!"); + + } + + if (CCTK_EQUALS(S2_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_S2_bound = -1; + if (handle_S2_bound < 0) handle_S2_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_S2_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_S2_bound , S2_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_S2_bound ,S2_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_S2_bound, + "Euler::S2", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for Euler::S2!"); + + } + + if (CCTK_EQUALS(S3_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_S3_bound = -1; + if (handle_S3_bound < 0) handle_S3_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_S3_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_S3_bound , S3_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_S3_bound ,S3_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_S3_bound, + "Euler::S3", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for Euler::S3!"); + + } + + if (CCTK_EQUALS(Den_group_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_Den_group_bound = -1; + if (handle_Den_group_bound < 0) handle_Den_group_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_Den_group_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_Den_group_bound ,Den_group_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_Den_group_bound, + "Euler::Den_group", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Scalar BC for Euler::Den_group!"); + + } + + if (CCTK_EQUALS(En_group_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_En_group_bound = -1; + if (handle_En_group_bound < 0) handle_En_group_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_En_group_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_En_group_bound ,En_group_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_En_group_bound, + "Euler::En_group", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Scalar BC for Euler::En_group!"); + + } + + if (CCTK_EQUALS(S_group_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_S_group_bound = -1; + if (handle_S_group_bound < 0) handle_S_group_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_S_group_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_S_group_bound ,S_group_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_S_group_bound, + "Euler::S_group", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Scalar BC for Euler::S_group!"); + + } + + if (CCTK_EQUALS(Den_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_Den_bound = -1; + if (handle_Den_bound < 0) handle_Den_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_Den_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_Den_bound ,Den_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_Den_bound, + "Euler::Den", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for Euler::Den!"); + + } + + if (CCTK_EQUALS(En_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_En_bound = -1; + if (handle_En_bound < 0) handle_En_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_En_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_En_bound ,En_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_En_bound, + "Euler::En", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for Euler::En!"); + + } + + if (CCTK_EQUALS(S1_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_S1_bound = -1; + if (handle_S1_bound < 0) handle_S1_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_S1_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_S1_bound ,S1_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_S1_bound, + "Euler::S1", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for Euler::S1!"); + + } + + if (CCTK_EQUALS(S2_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_S2_bound = -1; + if (handle_S2_bound < 0) handle_S2_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_S2_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_S2_bound ,S2_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_S2_bound, + "Euler::S2", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for Euler::S2!"); + + } + + if (CCTK_EQUALS(S3_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_S3_bound = -1; + if (handle_S3_bound < 0) handle_S3_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_S3_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_S3_bound ,S3_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_S3_bound, + "Euler::S3", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for Euler::S3!"); + + } + return; +} + + + +/* template for entries in parameter file: +#$bound$#Euler::Den_group_bound = "skip" +#$bound$#Euler::Den_group_bound_speed = 1.0 +#$bound$#Euler::Den_group_bound_limit = 0.0 +#$bound$#Euler::Den_group_bound_scalar = 0.0 + +#$bound$#Euler::En_group_bound = "skip" +#$bound$#Euler::En_group_bound_speed = 1.0 +#$bound$#Euler::En_group_bound_limit = 0.0 +#$bound$#Euler::En_group_bound_scalar = 0.0 + +#$bound$#Euler::S_group_bound = "skip" +#$bound$#Euler::S_group_bound_speed = 1.0 +#$bound$#Euler::S_group_bound_limit = 0.0 +#$bound$#Euler::S_group_bound_scalar = 0.0 + +#$bound$#Euler::Den_bound = "skip" +#$bound$#Euler::Den_bound_speed = 1.0 +#$bound$#Euler::Den_bound_limit = 0.0 +#$bound$#Euler::Den_bound_scalar = 0.0 + +#$bound$#Euler::En_bound = "skip" +#$bound$#Euler::En_bound_speed = 1.0 +#$bound$#Euler::En_bound_limit = 0.0 +#$bound$#Euler::En_bound_scalar = 0.0 + +#$bound$#Euler::S1_bound = "skip" +#$bound$#Euler::S1_bound_speed = 1.0 +#$bound$#Euler::S1_bound_limit = 0.0 +#$bound$#Euler::S1_bound_scalar = 0.0 + +#$bound$#Euler::S2_bound = "skip" +#$bound$#Euler::S2_bound_speed = 1.0 +#$bound$#Euler::S2_bound_limit = 0.0 +#$bound$#Euler::S2_bound_scalar = 0.0 + +#$bound$#Euler::S3_bound = "skip" +#$bound$#Euler::S3_bound_speed = 1.0 +#$bound$#Euler::S3_bound_limit = 0.0 +#$bound$#Euler::S3_bound_scalar = 0.0 + +*/ + diff --git a/Examples/Euler/src/Differencing.h b/Examples/Euler/src/Differencing.h new file mode 100644 index 0000000..ab7f0b7 --- /dev/null +++ b/Examples/Euler/src/Differencing.h @@ -0,0 +1,504 @@ +#ifndef KRANC_DIFF_FUNCTIONS +# define PDstandard2nd1(u) ((-KRANC_GFOFFSET3D(u,-1,0,0) + KRANC_GFOFFSET3D(u,1,0,0))*p1o2dx) +#else +# define PDstandard2nd1(u) (PDstandard2nd1_impl(u,p1o2dx,cdj,cdk)) +static CCTK_REAL PDstandard2nd1_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o2dx, ptrdiff_t const cdj, ptrdiff_t const cdk) CCTK_ATTRIBUTE_NOINLINE CCTK_ATTRIBUTE_UNUSED; +static CCTK_REAL PDstandard2nd1_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o2dx, ptrdiff_t const cdj, ptrdiff_t const cdk) +{ + ptrdiff_t const cdi=sizeof(CCTK_REAL); + return (-KRANC_GFOFFSET3D(u,-1,0,0) + KRANC_GFOFFSET3D(u,1,0,0))*p1o2dx; +} +#endif + +#ifndef KRANC_DIFF_FUNCTIONS +# define PDstandard2nd2(u) ((-KRANC_GFOFFSET3D(u,0,-1,0) + KRANC_GFOFFSET3D(u,0,1,0))*p1o2dy) +#else +# define PDstandard2nd2(u) (PDstandard2nd2_impl(u,p1o2dy,cdj,cdk)) +static CCTK_REAL PDstandard2nd2_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o2dy, ptrdiff_t const cdj, ptrdiff_t const cdk) CCTK_ATTRIBUTE_NOINLINE CCTK_ATTRIBUTE_UNUSED; +static CCTK_REAL PDstandard2nd2_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o2dy, ptrdiff_t const cdj, ptrdiff_t const cdk) +{ + ptrdiff_t const cdi=sizeof(CCTK_REAL); + return (-KRANC_GFOFFSET3D(u,0,-1,0) + KRANC_GFOFFSET3D(u,0,1,0))*p1o2dy; +} +#endif + +#ifndef KRANC_DIFF_FUNCTIONS +# define PDstandard2nd3(u) ((-KRANC_GFOFFSET3D(u,0,0,-1) + KRANC_GFOFFSET3D(u,0,0,1))*p1o2dz) +#else +# define PDstandard2nd3(u) (PDstandard2nd3_impl(u,p1o2dz,cdj,cdk)) +static CCTK_REAL PDstandard2nd3_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o2dz, ptrdiff_t const cdj, ptrdiff_t const cdk) CCTK_ATTRIBUTE_NOINLINE CCTK_ATTRIBUTE_UNUSED; +static CCTK_REAL PDstandard2nd3_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o2dz, ptrdiff_t const cdj, ptrdiff_t const cdk) +{ + ptrdiff_t const cdi=sizeof(CCTK_REAL); + return (-KRANC_GFOFFSET3D(u,0,0,-1) + KRANC_GFOFFSET3D(u,0,0,1))*p1o2dz; +} +#endif + +#ifndef KRANC_DIFF_FUNCTIONS +# define PDstandard2nd11(u) ((-2*KRANC_GFOFFSET3D(u,0,0,0) + KRANC_GFOFFSET3D(u,-1,0,0) + KRANC_GFOFFSET3D(u,1,0,0))*p1odx2) +#else +# define PDstandard2nd11(u) (PDstandard2nd11_impl(u,p1odx2,cdj,cdk)) +static CCTK_REAL PDstandard2nd11_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1odx2, ptrdiff_t const cdj, ptrdiff_t const cdk) CCTK_ATTRIBUTE_NOINLINE CCTK_ATTRIBUTE_UNUSED; +static CCTK_REAL PDstandard2nd11_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1odx2, ptrdiff_t const cdj, ptrdiff_t const cdk) +{ + ptrdiff_t const cdi=sizeof(CCTK_REAL); + return (-2*KRANC_GFOFFSET3D(u,0,0,0) + KRANC_GFOFFSET3D(u,-1,0,0) + KRANC_GFOFFSET3D(u,1,0,0))*p1odx2; +} +#endif + +#ifndef KRANC_DIFF_FUNCTIONS +# define PDstandard2nd22(u) ((-2*KRANC_GFOFFSET3D(u,0,0,0) + KRANC_GFOFFSET3D(u,0,-1,0) + KRANC_GFOFFSET3D(u,0,1,0))*p1ody2) +#else +# define PDstandard2nd22(u) (PDstandard2nd22_impl(u,p1ody2,cdj,cdk)) +static CCTK_REAL PDstandard2nd22_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1ody2, ptrdiff_t const cdj, ptrdiff_t const cdk) CCTK_ATTRIBUTE_NOINLINE CCTK_ATTRIBUTE_UNUSED; +static CCTK_REAL PDstandard2nd22_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1ody2, ptrdiff_t const cdj, ptrdiff_t const cdk) +{ + ptrdiff_t const cdi=sizeof(CCTK_REAL); + return (-2*KRANC_GFOFFSET3D(u,0,0,0) + KRANC_GFOFFSET3D(u,0,-1,0) + KRANC_GFOFFSET3D(u,0,1,0))*p1ody2; +} +#endif + +#ifndef KRANC_DIFF_FUNCTIONS +# define PDstandard2nd33(u) ((-2*KRANC_GFOFFSET3D(u,0,0,0) + KRANC_GFOFFSET3D(u,0,0,-1) + KRANC_GFOFFSET3D(u,0,0,1))*p1odz2) +#else +# define PDstandard2nd33(u) (PDstandard2nd33_impl(u,p1odz2,cdj,cdk)) +static CCTK_REAL PDstandard2nd33_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1odz2, ptrdiff_t const cdj, ptrdiff_t const cdk) CCTK_ATTRIBUTE_NOINLINE CCTK_ATTRIBUTE_UNUSED; +static CCTK_REAL PDstandard2nd33_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1odz2, ptrdiff_t const cdj, ptrdiff_t const cdk) +{ + ptrdiff_t const cdi=sizeof(CCTK_REAL); + return (-2*KRANC_GFOFFSET3D(u,0,0,0) + KRANC_GFOFFSET3D(u,0,0,-1) + KRANC_GFOFFSET3D(u,0,0,1))*p1odz2; +} +#endif + +#ifndef KRANC_DIFF_FUNCTIONS +# define PDstandard2nd12(u) ((KRANC_GFOFFSET3D(u,-1,-1,0) - KRANC_GFOFFSET3D(u,-1,1,0) - KRANC_GFOFFSET3D(u,1,-1,0) + KRANC_GFOFFSET3D(u,1,1,0))*p1o4dxdy) +#else +# define PDstandard2nd12(u) (PDstandard2nd12_impl(u,p1o4dxdy,cdj,cdk)) +static CCTK_REAL PDstandard2nd12_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o4dxdy, ptrdiff_t const cdj, ptrdiff_t const cdk) CCTK_ATTRIBUTE_NOINLINE CCTK_ATTRIBUTE_UNUSED; +static CCTK_REAL PDstandard2nd12_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o4dxdy, ptrdiff_t const cdj, ptrdiff_t const cdk) +{ + ptrdiff_t const cdi=sizeof(CCTK_REAL); + return (KRANC_GFOFFSET3D(u,-1,-1,0) - KRANC_GFOFFSET3D(u,-1,1,0) - KRANC_GFOFFSET3D(u,1,-1,0) + KRANC_GFOFFSET3D(u,1,1,0))*p1o4dxdy; +} +#endif + +#ifndef KRANC_DIFF_FUNCTIONS +# define PDstandard2nd13(u) ((KRANC_GFOFFSET3D(u,-1,0,-1) - KRANC_GFOFFSET3D(u,-1,0,1) - KRANC_GFOFFSET3D(u,1,0,-1) + KRANC_GFOFFSET3D(u,1,0,1))*p1o4dxdz) +#else +# define PDstandard2nd13(u) (PDstandard2nd13_impl(u,p1o4dxdz,cdj,cdk)) +static CCTK_REAL PDstandard2nd13_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o4dxdz, ptrdiff_t const cdj, ptrdiff_t const cdk) CCTK_ATTRIBUTE_NOINLINE CCTK_ATTRIBUTE_UNUSED; +static CCTK_REAL PDstandard2nd13_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o4dxdz, ptrdiff_t const cdj, ptrdiff_t const cdk) +{ + ptrdiff_t const cdi=sizeof(CCTK_REAL); + return (KRANC_GFOFFSET3D(u,-1,0,-1) - KRANC_GFOFFSET3D(u,-1,0,1) - KRANC_GFOFFSET3D(u,1,0,-1) + KRANC_GFOFFSET3D(u,1,0,1))*p1o4dxdz; +} +#endif + +#ifndef KRANC_DIFF_FUNCTIONS +# define PDstandard2nd21(u) ((KRANC_GFOFFSET3D(u,-1,-1,0) - KRANC_GFOFFSET3D(u,-1,1,0) - KRANC_GFOFFSET3D(u,1,-1,0) + KRANC_GFOFFSET3D(u,1,1,0))*p1o4dxdy) +#else +# define PDstandard2nd21(u) (PDstandard2nd21_impl(u,p1o4dxdy,cdj,cdk)) +static CCTK_REAL PDstandard2nd21_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o4dxdy, ptrdiff_t const cdj, ptrdiff_t const cdk) CCTK_ATTRIBUTE_NOINLINE CCTK_ATTRIBUTE_UNUSED; +static CCTK_REAL PDstandard2nd21_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o4dxdy, ptrdiff_t const cdj, ptrdiff_t const cdk) +{ + ptrdiff_t const cdi=sizeof(CCTK_REAL); + return (KRANC_GFOFFSET3D(u,-1,-1,0) - KRANC_GFOFFSET3D(u,-1,1,0) - KRANC_GFOFFSET3D(u,1,-1,0) + KRANC_GFOFFSET3D(u,1,1,0))*p1o4dxdy; +} +#endif + +#ifndef KRANC_DIFF_FUNCTIONS +# define PDstandard2nd23(u) ((KRANC_GFOFFSET3D(u,0,-1,-1) - KRANC_GFOFFSET3D(u,0,-1,1) - KRANC_GFOFFSET3D(u,0,1,-1) + KRANC_GFOFFSET3D(u,0,1,1))*p1o4dydz) +#else +# define PDstandard2nd23(u) (PDstandard2nd23_impl(u,p1o4dydz,cdj,cdk)) +static CCTK_REAL PDstandard2nd23_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o4dydz, ptrdiff_t const cdj, ptrdiff_t const cdk) CCTK_ATTRIBUTE_NOINLINE CCTK_ATTRIBUTE_UNUSED; +static CCTK_REAL PDstandard2nd23_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o4dydz, ptrdiff_t const cdj, ptrdiff_t const cdk) +{ + ptrdiff_t const cdi=sizeof(CCTK_REAL); + return (KRANC_GFOFFSET3D(u,0,-1,-1) - KRANC_GFOFFSET3D(u,0,-1,1) - KRANC_GFOFFSET3D(u,0,1,-1) + KRANC_GFOFFSET3D(u,0,1,1))*p1o4dydz; +} +#endif + +#ifndef KRANC_DIFF_FUNCTIONS +# define PDstandard2nd31(u) ((KRANC_GFOFFSET3D(u,-1,0,-1) - KRANC_GFOFFSET3D(u,-1,0,1) - KRANC_GFOFFSET3D(u,1,0,-1) + KRANC_GFOFFSET3D(u,1,0,1))*p1o4dxdz) +#else +# define PDstandard2nd31(u) (PDstandard2nd31_impl(u,p1o4dxdz,cdj,cdk)) +static CCTK_REAL PDstandard2nd31_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o4dxdz, ptrdiff_t const cdj, ptrdiff_t const cdk) CCTK_ATTRIBUTE_NOINLINE CCTK_ATTRIBUTE_UNUSED; +static CCTK_REAL PDstandard2nd31_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o4dxdz, ptrdiff_t const cdj, ptrdiff_t const cdk) +{ + ptrdiff_t const cdi=sizeof(CCTK_REAL); + return (KRANC_GFOFFSET3D(u,-1,0,-1) - KRANC_GFOFFSET3D(u,-1,0,1) - KRANC_GFOFFSET3D(u,1,0,-1) + KRANC_GFOFFSET3D(u,1,0,1))*p1o4dxdz; +} +#endif + +#ifndef KRANC_DIFF_FUNCTIONS +# define PDstandard2nd32(u) ((KRANC_GFOFFSET3D(u,0,-1,-1) - KRANC_GFOFFSET3D(u,0,-1,1) - KRANC_GFOFFSET3D(u,0,1,-1) + KRANC_GFOFFSET3D(u,0,1,1))*p1o4dydz) +#else +# define PDstandard2nd32(u) (PDstandard2nd32_impl(u,p1o4dydz,cdj,cdk)) +static CCTK_REAL PDstandard2nd32_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o4dydz, ptrdiff_t const cdj, ptrdiff_t const cdk) CCTK_ATTRIBUTE_NOINLINE CCTK_ATTRIBUTE_UNUSED; +static CCTK_REAL PDstandard2nd32_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o4dydz, ptrdiff_t const cdj, ptrdiff_t const cdk) +{ + ptrdiff_t const cdi=sizeof(CCTK_REAL); + return (KRANC_GFOFFSET3D(u,0,-1,-1) - KRANC_GFOFFSET3D(u,0,-1,1) - KRANC_GFOFFSET3D(u,0,1,-1) + KRANC_GFOFFSET3D(u,0,1,1))*p1o4dydz; +} +#endif + +#ifndef KRANC_DIFF_FUNCTIONS +# define PDstandard4th1(u) ((-8*KRANC_GFOFFSET3D(u,-1,0,0) + 8*KRANC_GFOFFSET3D(u,1,0,0) + KRANC_GFOFFSET3D(u,-2,0,0) - KRANC_GFOFFSET3D(u,2,0,0))*p1o12dx) +#else +# define PDstandard4th1(u) (PDstandard4th1_impl(u,p1o12dx,cdj,cdk)) +static CCTK_REAL PDstandard4th1_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o12dx, ptrdiff_t const cdj, ptrdiff_t const cdk) CCTK_ATTRIBUTE_NOINLINE CCTK_ATTRIBUTE_UNUSED; +static CCTK_REAL PDstandard4th1_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o12dx, ptrdiff_t const cdj, ptrdiff_t const cdk) +{ + ptrdiff_t const cdi=sizeof(CCTK_REAL); + return (-8*KRANC_GFOFFSET3D(u,-1,0,0) + 8*KRANC_GFOFFSET3D(u,1,0,0) + KRANC_GFOFFSET3D(u,-2,0,0) - KRANC_GFOFFSET3D(u,2,0,0))*p1o12dx; +} +#endif + +#ifndef KRANC_DIFF_FUNCTIONS +# define PDstandard4th2(u) ((-8*KRANC_GFOFFSET3D(u,0,-1,0) + 8*KRANC_GFOFFSET3D(u,0,1,0) + KRANC_GFOFFSET3D(u,0,-2,0) - KRANC_GFOFFSET3D(u,0,2,0))*p1o12dy) +#else +# define PDstandard4th2(u) (PDstandard4th2_impl(u,p1o12dy,cdj,cdk)) +static CCTK_REAL PDstandard4th2_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o12dy, ptrdiff_t const cdj, ptrdiff_t const cdk) CCTK_ATTRIBUTE_NOINLINE CCTK_ATTRIBUTE_UNUSED; +static CCTK_REAL PDstandard4th2_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o12dy, ptrdiff_t const cdj, ptrdiff_t const cdk) +{ + ptrdiff_t const cdi=sizeof(CCTK_REAL); + return (-8*KRANC_GFOFFSET3D(u,0,-1,0) + 8*KRANC_GFOFFSET3D(u,0,1,0) + KRANC_GFOFFSET3D(u,0,-2,0) - KRANC_GFOFFSET3D(u,0,2,0))*p1o12dy; +} +#endif + +#ifndef KRANC_DIFF_FUNCTIONS +# define PDstandard4th3(u) ((-8*KRANC_GFOFFSET3D(u,0,0,-1) + 8*KRANC_GFOFFSET3D(u,0,0,1) + KRANC_GFOFFSET3D(u,0,0,-2) - KRANC_GFOFFSET3D(u,0,0,2))*p1o12dz) +#else +# define PDstandard4th3(u) (PDstandard4th3_impl(u,p1o12dz,cdj,cdk)) +static CCTK_REAL PDstandard4th3_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o12dz, ptrdiff_t const cdj, ptrdiff_t const cdk) CCTK_ATTRIBUTE_NOINLINE CCTK_ATTRIBUTE_UNUSED; +static CCTK_REAL PDstandard4th3_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o12dz, ptrdiff_t const cdj, ptrdiff_t const cdk) +{ + ptrdiff_t const cdi=sizeof(CCTK_REAL); + return (-8*KRANC_GFOFFSET3D(u,0,0,-1) + 8*KRANC_GFOFFSET3D(u,0,0,1) + KRANC_GFOFFSET3D(u,0,0,-2) - KRANC_GFOFFSET3D(u,0,0,2))*p1o12dz; +} +#endif + +#ifndef KRANC_DIFF_FUNCTIONS +# define PDstandard4th11(u) ((30*KRANC_GFOFFSET3D(u,0,0,0) - 16*(KRANC_GFOFFSET3D(u,-1,0,0) + KRANC_GFOFFSET3D(u,1,0,0)) + KRANC_GFOFFSET3D(u,-2,0,0) + KRANC_GFOFFSET3D(u,2,0,0))*pm1o12dx2) +#else +# define PDstandard4th11(u) (PDstandard4th11_impl(u,pm1o12dx2,cdj,cdk)) +static CCTK_REAL PDstandard4th11_impl(CCTK_REAL const* restrict const u, CCTK_REAL const pm1o12dx2, ptrdiff_t const cdj, ptrdiff_t const cdk) CCTK_ATTRIBUTE_NOINLINE CCTK_ATTRIBUTE_UNUSED; +static CCTK_REAL PDstandard4th11_impl(CCTK_REAL const* restrict const u, CCTK_REAL const pm1o12dx2, ptrdiff_t const cdj, ptrdiff_t const cdk) +{ + ptrdiff_t const cdi=sizeof(CCTK_REAL); + return (30*KRANC_GFOFFSET3D(u,0,0,0) - 16*(KRANC_GFOFFSET3D(u,-1,0,0) + KRANC_GFOFFSET3D(u,1,0,0)) + KRANC_GFOFFSET3D(u,-2,0,0) + KRANC_GFOFFSET3D(u,2,0,0))*pm1o12dx2; +} +#endif + +#ifndef KRANC_DIFF_FUNCTIONS +# define PDstandard4th22(u) ((30*KRANC_GFOFFSET3D(u,0,0,0) - 16*(KRANC_GFOFFSET3D(u,0,-1,0) + KRANC_GFOFFSET3D(u,0,1,0)) + KRANC_GFOFFSET3D(u,0,-2,0) + KRANC_GFOFFSET3D(u,0,2,0))*pm1o12dy2) +#else +# define PDstandard4th22(u) (PDstandard4th22_impl(u,pm1o12dy2,cdj,cdk)) +static CCTK_REAL PDstandard4th22_impl(CCTK_REAL const* restrict const u, CCTK_REAL const pm1o12dy2, ptrdiff_t const cdj, ptrdiff_t const cdk) CCTK_ATTRIBUTE_NOINLINE CCTK_ATTRIBUTE_UNUSED; +static CCTK_REAL PDstandard4th22_impl(CCTK_REAL const* restrict const u, CCTK_REAL const pm1o12dy2, ptrdiff_t const cdj, ptrdiff_t const cdk) +{ + ptrdiff_t const cdi=sizeof(CCTK_REAL); + return (30*KRANC_GFOFFSET3D(u,0,0,0) - 16*(KRANC_GFOFFSET3D(u,0,-1,0) + KRANC_GFOFFSET3D(u,0,1,0)) + KRANC_GFOFFSET3D(u,0,-2,0) + KRANC_GFOFFSET3D(u,0,2,0))*pm1o12dy2; +} +#endif + +#ifndef KRANC_DIFF_FUNCTIONS +# define PDstandard4th33(u) ((30*KRANC_GFOFFSET3D(u,0,0,0) - 16*(KRANC_GFOFFSET3D(u,0,0,-1) + KRANC_GFOFFSET3D(u,0,0,1)) + KRANC_GFOFFSET3D(u,0,0,-2) + KRANC_GFOFFSET3D(u,0,0,2))*pm1o12dz2) +#else +# define PDstandard4th33(u) (PDstandard4th33_impl(u,pm1o12dz2,cdj,cdk)) +static CCTK_REAL PDstandard4th33_impl(CCTK_REAL const* restrict const u, CCTK_REAL const pm1o12dz2, ptrdiff_t const cdj, ptrdiff_t const cdk) CCTK_ATTRIBUTE_NOINLINE CCTK_ATTRIBUTE_UNUSED; +static CCTK_REAL PDstandard4th33_impl(CCTK_REAL const* restrict const u, CCTK_REAL const pm1o12dz2, ptrdiff_t const cdj, ptrdiff_t const cdk) +{ + ptrdiff_t const cdi=sizeof(CCTK_REAL); + return (30*KRANC_GFOFFSET3D(u,0,0,0) - 16*(KRANC_GFOFFSET3D(u,0,0,-1) + KRANC_GFOFFSET3D(u,0,0,1)) + KRANC_GFOFFSET3D(u,0,0,-2) + KRANC_GFOFFSET3D(u,0,0,2))*pm1o12dz2; +} +#endif + +#ifndef KRANC_DIFF_FUNCTIONS +# define PDstandard4th12(u) ((-64*(KRANC_GFOFFSET3D(u,-1,1,0) + KRANC_GFOFFSET3D(u,1,-1,0)) + 64*(KRANC_GFOFFSET3D(u,-1,-1,0) + KRANC_GFOFFSET3D(u,1,1,0)) + 8*(KRANC_GFOFFSET3D(u,-1,2,0) + KRANC_GFOFFSET3D(u,1,-2,0) + KRANC_GFOFFSET3D(u,-2,1,0) + KRANC_GFOFFSET3D(u,2,-1,0)) - 8*(KRANC_GFOFFSET3D(u,-1,-2,0) + KRANC_GFOFFSET3D(u,1,2,0) + KRANC_GFOFFSET3D(u,-2,-1,0) + KRANC_GFOFFSET3D(u,2,1,0)) + KRANC_GFOFFSET3D(u,-2,-2,0) - KRANC_GFOFFSET3D(u,-2,2,0) - KRANC_GFOFFSET3D(u,2,-2,0) + KRANC_GFOFFSET3D(u,2,2,0))*p1o144dxdy) +#else +# define PDstandard4th12(u) (PDstandard4th12_impl(u,p1o144dxdy,cdj,cdk)) +static CCTK_REAL PDstandard4th12_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o144dxdy, ptrdiff_t const cdj, ptrdiff_t const cdk) CCTK_ATTRIBUTE_NOINLINE CCTK_ATTRIBUTE_UNUSED; +static CCTK_REAL PDstandard4th12_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o144dxdy, ptrdiff_t const cdj, ptrdiff_t const cdk) +{ + ptrdiff_t const cdi=sizeof(CCTK_REAL); + return (-64*(KRANC_GFOFFSET3D(u,-1,1,0) + KRANC_GFOFFSET3D(u,1,-1,0)) + 64*(KRANC_GFOFFSET3D(u,-1,-1,0) + KRANC_GFOFFSET3D(u,1,1,0)) + 8*(KRANC_GFOFFSET3D(u,-1,2,0) + KRANC_GFOFFSET3D(u,1,-2,0) + KRANC_GFOFFSET3D(u,-2,1,0) + KRANC_GFOFFSET3D(u,2,-1,0)) - 8*(KRANC_GFOFFSET3D(u,-1,-2,0) + KRANC_GFOFFSET3D(u,1,2,0) + KRANC_GFOFFSET3D(u,-2,-1,0) + KRANC_GFOFFSET3D(u,2,1,0)) + KRANC_GFOFFSET3D(u,-2,-2,0) - KRANC_GFOFFSET3D(u,-2,2,0) - KRANC_GFOFFSET3D(u,2,-2,0) + KRANC_GFOFFSET3D(u,2,2,0))*p1o144dxdy; +} +#endif + +#ifndef KRANC_DIFF_FUNCTIONS +# define PDstandard4th13(u) ((-64*(KRANC_GFOFFSET3D(u,-1,0,1) + KRANC_GFOFFSET3D(u,1,0,-1)) + 64*(KRANC_GFOFFSET3D(u,-1,0,-1) + KRANC_GFOFFSET3D(u,1,0,1)) + 8*(KRANC_GFOFFSET3D(u,-1,0,2) + KRANC_GFOFFSET3D(u,1,0,-2) + KRANC_GFOFFSET3D(u,-2,0,1) + KRANC_GFOFFSET3D(u,2,0,-1)) - 8*(KRANC_GFOFFSET3D(u,-1,0,-2) + KRANC_GFOFFSET3D(u,1,0,2) + KRANC_GFOFFSET3D(u,-2,0,-1) + KRANC_GFOFFSET3D(u,2,0,1)) + KRANC_GFOFFSET3D(u,-2,0,-2) - KRANC_GFOFFSET3D(u,-2,0,2) - KRANC_GFOFFSET3D(u,2,0,-2) + KRANC_GFOFFSET3D(u,2,0,2))*p1o144dxdz) +#else +# define PDstandard4th13(u) (PDstandard4th13_impl(u,p1o144dxdz,cdj,cdk)) +static CCTK_REAL PDstandard4th13_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o144dxdz, ptrdiff_t const cdj, ptrdiff_t const cdk) CCTK_ATTRIBUTE_NOINLINE CCTK_ATTRIBUTE_UNUSED; +static CCTK_REAL PDstandard4th13_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o144dxdz, ptrdiff_t const cdj, ptrdiff_t const cdk) +{ + ptrdiff_t const cdi=sizeof(CCTK_REAL); + return (-64*(KRANC_GFOFFSET3D(u,-1,0,1) + KRANC_GFOFFSET3D(u,1,0,-1)) + 64*(KRANC_GFOFFSET3D(u,-1,0,-1) + KRANC_GFOFFSET3D(u,1,0,1)) + 8*(KRANC_GFOFFSET3D(u,-1,0,2) + KRANC_GFOFFSET3D(u,1,0,-2) + KRANC_GFOFFSET3D(u,-2,0,1) + KRANC_GFOFFSET3D(u,2,0,-1)) - 8*(KRANC_GFOFFSET3D(u,-1,0,-2) + KRANC_GFOFFSET3D(u,1,0,2) + KRANC_GFOFFSET3D(u,-2,0,-1) + KRANC_GFOFFSET3D(u,2,0,1)) + KRANC_GFOFFSET3D(u,-2,0,-2) - KRANC_GFOFFSET3D(u,-2,0,2) - KRANC_GFOFFSET3D(u,2,0,-2) + KRANC_GFOFFSET3D(u,2,0,2))*p1o144dxdz; +} +#endif + +#ifndef KRANC_DIFF_FUNCTIONS +# define PDstandard4th21(u) ((-64*(KRANC_GFOFFSET3D(u,-1,1,0) + KRANC_GFOFFSET3D(u,1,-1,0)) + 64*(KRANC_GFOFFSET3D(u,-1,-1,0) + KRANC_GFOFFSET3D(u,1,1,0)) + 8*(KRANC_GFOFFSET3D(u,-1,2,0) + KRANC_GFOFFSET3D(u,1,-2,0) + KRANC_GFOFFSET3D(u,-2,1,0) + KRANC_GFOFFSET3D(u,2,-1,0)) - 8*(KRANC_GFOFFSET3D(u,-1,-2,0) + KRANC_GFOFFSET3D(u,1,2,0) + KRANC_GFOFFSET3D(u,-2,-1,0) + KRANC_GFOFFSET3D(u,2,1,0)) + KRANC_GFOFFSET3D(u,-2,-2,0) - KRANC_GFOFFSET3D(u,-2,2,0) - KRANC_GFOFFSET3D(u,2,-2,0) + KRANC_GFOFFSET3D(u,2,2,0))*p1o144dxdy) +#else +# define PDstandard4th21(u) (PDstandard4th21_impl(u,p1o144dxdy,cdj,cdk)) +static CCTK_REAL PDstandard4th21_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o144dxdy, ptrdiff_t const cdj, ptrdiff_t const cdk) CCTK_ATTRIBUTE_NOINLINE CCTK_ATTRIBUTE_UNUSED; +static CCTK_REAL PDstandard4th21_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o144dxdy, ptrdiff_t const cdj, ptrdiff_t const cdk) +{ + ptrdiff_t const cdi=sizeof(CCTK_REAL); + return (-64*(KRANC_GFOFFSET3D(u,-1,1,0) + KRANC_GFOFFSET3D(u,1,-1,0)) + 64*(KRANC_GFOFFSET3D(u,-1,-1,0) + KRANC_GFOFFSET3D(u,1,1,0)) + 8*(KRANC_GFOFFSET3D(u,-1,2,0) + KRANC_GFOFFSET3D(u,1,-2,0) + KRANC_GFOFFSET3D(u,-2,1,0) + KRANC_GFOFFSET3D(u,2,-1,0)) - 8*(KRANC_GFOFFSET3D(u,-1,-2,0) + KRANC_GFOFFSET3D(u,1,2,0) + KRANC_GFOFFSET3D(u,-2,-1,0) + KRANC_GFOFFSET3D(u,2,1,0)) + KRANC_GFOFFSET3D(u,-2,-2,0) - KRANC_GFOFFSET3D(u,-2,2,0) - KRANC_GFOFFSET3D(u,2,-2,0) + KRANC_GFOFFSET3D(u,2,2,0))*p1o144dxdy; +} +#endif + +#ifndef KRANC_DIFF_FUNCTIONS +# define PDstandard4th23(u) ((-64*(KRANC_GFOFFSET3D(u,0,-1,1) + KRANC_GFOFFSET3D(u,0,1,-1)) + 64*(KRANC_GFOFFSET3D(u,0,-1,-1) + KRANC_GFOFFSET3D(u,0,1,1)) + 8*(KRANC_GFOFFSET3D(u,0,-1,2) + KRANC_GFOFFSET3D(u,0,1,-2) + KRANC_GFOFFSET3D(u,0,-2,1) + KRANC_GFOFFSET3D(u,0,2,-1)) - 8*(KRANC_GFOFFSET3D(u,0,-1,-2) + KRANC_GFOFFSET3D(u,0,1,2) + KRANC_GFOFFSET3D(u,0,-2,-1) + KRANC_GFOFFSET3D(u,0,2,1)) + KRANC_GFOFFSET3D(u,0,-2,-2) - KRANC_GFOFFSET3D(u,0,-2,2) - KRANC_GFOFFSET3D(u,0,2,-2) + KRANC_GFOFFSET3D(u,0,2,2))*p1o144dydz) +#else +# define PDstandard4th23(u) (PDstandard4th23_impl(u,p1o144dydz,cdj,cdk)) +static CCTK_REAL PDstandard4th23_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o144dydz, ptrdiff_t const cdj, ptrdiff_t const cdk) CCTK_ATTRIBUTE_NOINLINE CCTK_ATTRIBUTE_UNUSED; +static CCTK_REAL PDstandard4th23_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o144dydz, ptrdiff_t const cdj, ptrdiff_t const cdk) +{ + ptrdiff_t const cdi=sizeof(CCTK_REAL); + return (-64*(KRANC_GFOFFSET3D(u,0,-1,1) + KRANC_GFOFFSET3D(u,0,1,-1)) + 64*(KRANC_GFOFFSET3D(u,0,-1,-1) + KRANC_GFOFFSET3D(u,0,1,1)) + 8*(KRANC_GFOFFSET3D(u,0,-1,2) + KRANC_GFOFFSET3D(u,0,1,-2) + KRANC_GFOFFSET3D(u,0,-2,1) + KRANC_GFOFFSET3D(u,0,2,-1)) - 8*(KRANC_GFOFFSET3D(u,0,-1,-2) + KRANC_GFOFFSET3D(u,0,1,2) + KRANC_GFOFFSET3D(u,0,-2,-1) + KRANC_GFOFFSET3D(u,0,2,1)) + KRANC_GFOFFSET3D(u,0,-2,-2) - KRANC_GFOFFSET3D(u,0,-2,2) - KRANC_GFOFFSET3D(u,0,2,-2) + KRANC_GFOFFSET3D(u,0,2,2))*p1o144dydz; +} +#endif + +#ifndef KRANC_DIFF_FUNCTIONS +# define PDstandard4th31(u) ((-64*(KRANC_GFOFFSET3D(u,-1,0,1) + KRANC_GFOFFSET3D(u,1,0,-1)) + 64*(KRANC_GFOFFSET3D(u,-1,0,-1) + KRANC_GFOFFSET3D(u,1,0,1)) + 8*(KRANC_GFOFFSET3D(u,-1,0,2) + KRANC_GFOFFSET3D(u,1,0,-2) + KRANC_GFOFFSET3D(u,-2,0,1) + KRANC_GFOFFSET3D(u,2,0,-1)) - 8*(KRANC_GFOFFSET3D(u,-1,0,-2) + KRANC_GFOFFSET3D(u,1,0,2) + KRANC_GFOFFSET3D(u,-2,0,-1) + KRANC_GFOFFSET3D(u,2,0,1)) + KRANC_GFOFFSET3D(u,-2,0,-2) - KRANC_GFOFFSET3D(u,-2,0,2) - KRANC_GFOFFSET3D(u,2,0,-2) + KRANC_GFOFFSET3D(u,2,0,2))*p1o144dxdz) +#else +# define PDstandard4th31(u) (PDstandard4th31_impl(u,p1o144dxdz,cdj,cdk)) +static CCTK_REAL PDstandard4th31_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o144dxdz, ptrdiff_t const cdj, ptrdiff_t const cdk) CCTK_ATTRIBUTE_NOINLINE CCTK_ATTRIBUTE_UNUSED; +static CCTK_REAL PDstandard4th31_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o144dxdz, ptrdiff_t const cdj, ptrdiff_t const cdk) +{ + ptrdiff_t const cdi=sizeof(CCTK_REAL); + return (-64*(KRANC_GFOFFSET3D(u,-1,0,1) + KRANC_GFOFFSET3D(u,1,0,-1)) + 64*(KRANC_GFOFFSET3D(u,-1,0,-1) + KRANC_GFOFFSET3D(u,1,0,1)) + 8*(KRANC_GFOFFSET3D(u,-1,0,2) + KRANC_GFOFFSET3D(u,1,0,-2) + KRANC_GFOFFSET3D(u,-2,0,1) + KRANC_GFOFFSET3D(u,2,0,-1)) - 8*(KRANC_GFOFFSET3D(u,-1,0,-2) + KRANC_GFOFFSET3D(u,1,0,2) + KRANC_GFOFFSET3D(u,-2,0,-1) + KRANC_GFOFFSET3D(u,2,0,1)) + KRANC_GFOFFSET3D(u,-2,0,-2) - KRANC_GFOFFSET3D(u,-2,0,2) - KRANC_GFOFFSET3D(u,2,0,-2) + KRANC_GFOFFSET3D(u,2,0,2))*p1o144dxdz; +} +#endif + +#ifndef KRANC_DIFF_FUNCTIONS +# define PDstandard4th32(u) ((-64*(KRANC_GFOFFSET3D(u,0,-1,1) + KRANC_GFOFFSET3D(u,0,1,-1)) + 64*(KRANC_GFOFFSET3D(u,0,-1,-1) + KRANC_GFOFFSET3D(u,0,1,1)) + 8*(KRANC_GFOFFSET3D(u,0,-1,2) + KRANC_GFOFFSET3D(u,0,1,-2) + KRANC_GFOFFSET3D(u,0,-2,1) + KRANC_GFOFFSET3D(u,0,2,-1)) - 8*(KRANC_GFOFFSET3D(u,0,-1,-2) + KRANC_GFOFFSET3D(u,0,1,2) + KRANC_GFOFFSET3D(u,0,-2,-1) + KRANC_GFOFFSET3D(u,0,2,1)) + KRANC_GFOFFSET3D(u,0,-2,-2) - KRANC_GFOFFSET3D(u,0,-2,2) - KRANC_GFOFFSET3D(u,0,2,-2) + KRANC_GFOFFSET3D(u,0,2,2))*p1o144dydz) +#else +# define PDstandard4th32(u) (PDstandard4th32_impl(u,p1o144dydz,cdj,cdk)) +static CCTK_REAL PDstandard4th32_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o144dydz, ptrdiff_t const cdj, ptrdiff_t const cdk) CCTK_ATTRIBUTE_NOINLINE CCTK_ATTRIBUTE_UNUSED; +static CCTK_REAL PDstandard4th32_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o144dydz, ptrdiff_t const cdj, ptrdiff_t const cdk) +{ + ptrdiff_t const cdi=sizeof(CCTK_REAL); + return (-64*(KRANC_GFOFFSET3D(u,0,-1,1) + KRANC_GFOFFSET3D(u,0,1,-1)) + 64*(KRANC_GFOFFSET3D(u,0,-1,-1) + KRANC_GFOFFSET3D(u,0,1,1)) + 8*(KRANC_GFOFFSET3D(u,0,-1,2) + KRANC_GFOFFSET3D(u,0,1,-2) + KRANC_GFOFFSET3D(u,0,-2,1) + KRANC_GFOFFSET3D(u,0,2,-1)) - 8*(KRANC_GFOFFSET3D(u,0,-1,-2) + KRANC_GFOFFSET3D(u,0,1,2) + KRANC_GFOFFSET3D(u,0,-2,-1) + KRANC_GFOFFSET3D(u,0,2,1)) + KRANC_GFOFFSET3D(u,0,-2,-2) - KRANC_GFOFFSET3D(u,0,-2,2) - KRANC_GFOFFSET3D(u,0,2,-2) + KRANC_GFOFFSET3D(u,0,2,2))*p1o144dydz; +} +#endif + +#ifndef KRANC_DIFF_FUNCTIONS +# define PDonesided2nd1(u) ((3*KRANC_GFOFFSET3D(u,0,0,0) + KRANC_GFOFFSET3D(u,2*dir(1),0,0) - 4*KRANC_GFOFFSET3D(u,dir(1),0,0))*pm1o2dx*dir(1)) +#else +# define PDonesided2nd1(u) (PDonesided2nd1_impl(u,pm1o2dx,cdj,cdk)) +static CCTK_REAL PDonesided2nd1_impl(CCTK_REAL const* restrict const u, CCTK_REAL const pm1o2dx, ptrdiff_t const cdj, ptrdiff_t const cdk) CCTK_ATTRIBUTE_NOINLINE CCTK_ATTRIBUTE_UNUSED; +static CCTK_REAL PDonesided2nd1_impl(CCTK_REAL const* restrict const u, CCTK_REAL const pm1o2dx, ptrdiff_t const cdj, ptrdiff_t const cdk) +{ + ptrdiff_t const cdi=sizeof(CCTK_REAL); + return (3*KRANC_GFOFFSET3D(u,0,0,0) + KRANC_GFOFFSET3D(u,2*dir(1),0,0) - 4*KRANC_GFOFFSET3D(u,dir(1),0,0))*pm1o2dx*dir(1); +} +#endif + +#ifndef KRANC_DIFF_FUNCTIONS +# define PDonesided2nd2(u) ((3*KRANC_GFOFFSET3D(u,0,0,0) + KRANC_GFOFFSET3D(u,0,2*dir(2),0) - 4*KRANC_GFOFFSET3D(u,0,dir(2),0))*pm1o2dy*dir(2)) +#else +# define PDonesided2nd2(u) (PDonesided2nd2_impl(u,pm1o2dy,cdj,cdk)) +static CCTK_REAL PDonesided2nd2_impl(CCTK_REAL const* restrict const u, CCTK_REAL const pm1o2dy, ptrdiff_t const cdj, ptrdiff_t const cdk) CCTK_ATTRIBUTE_NOINLINE CCTK_ATTRIBUTE_UNUSED; +static CCTK_REAL PDonesided2nd2_impl(CCTK_REAL const* restrict const u, CCTK_REAL const pm1o2dy, ptrdiff_t const cdj, ptrdiff_t const cdk) +{ + ptrdiff_t const cdi=sizeof(CCTK_REAL); + return (3*KRANC_GFOFFSET3D(u,0,0,0) + KRANC_GFOFFSET3D(u,0,2*dir(2),0) - 4*KRANC_GFOFFSET3D(u,0,dir(2),0))*pm1o2dy*dir(2); +} +#endif + +#ifndef KRANC_DIFF_FUNCTIONS +# define PDonesided2nd3(u) ((3*KRANC_GFOFFSET3D(u,0,0,0) + KRANC_GFOFFSET3D(u,0,0,2*dir(3)) - 4*KRANC_GFOFFSET3D(u,0,0,dir(3)))*pm1o2dz*dir(3)) +#else +# define PDonesided2nd3(u) (PDonesided2nd3_impl(u,pm1o2dz,cdj,cdk)) +static CCTK_REAL PDonesided2nd3_impl(CCTK_REAL const* restrict const u, CCTK_REAL const pm1o2dz, ptrdiff_t const cdj, ptrdiff_t const cdk) CCTK_ATTRIBUTE_NOINLINE CCTK_ATTRIBUTE_UNUSED; +static CCTK_REAL PDonesided2nd3_impl(CCTK_REAL const* restrict const u, CCTK_REAL const pm1o2dz, ptrdiff_t const cdj, ptrdiff_t const cdk) +{ + ptrdiff_t const cdi=sizeof(CCTK_REAL); + return (3*KRANC_GFOFFSET3D(u,0,0,0) + KRANC_GFOFFSET3D(u,0,0,2*dir(3)) - 4*KRANC_GFOFFSET3D(u,0,0,dir(3)))*pm1o2dz*dir(3); +} +#endif + +#ifndef KRANC_DIFF_FUNCTIONS +# define PDplus1(u) ((-KRANC_GFOFFSET3D(u,0,0,0) + KRANC_GFOFFSET3D(u,1,0,0))*p1odx) +#else +# define PDplus1(u) (PDplus1_impl(u,p1odx,cdj,cdk)) +static CCTK_REAL PDplus1_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1odx, ptrdiff_t const cdj, ptrdiff_t const cdk) CCTK_ATTRIBUTE_NOINLINE CCTK_ATTRIBUTE_UNUSED; +static CCTK_REAL PDplus1_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1odx, ptrdiff_t const cdj, ptrdiff_t const cdk) +{ + ptrdiff_t const cdi=sizeof(CCTK_REAL); + return (-KRANC_GFOFFSET3D(u,0,0,0) + KRANC_GFOFFSET3D(u,1,0,0))*p1odx; +} +#endif + +#ifndef KRANC_DIFF_FUNCTIONS +# define PDplus2(u) ((-KRANC_GFOFFSET3D(u,0,0,0) + KRANC_GFOFFSET3D(u,0,1,0))*p1ody) +#else +# define PDplus2(u) (PDplus2_impl(u,p1ody,cdj,cdk)) +static CCTK_REAL PDplus2_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1ody, ptrdiff_t const cdj, ptrdiff_t const cdk) CCTK_ATTRIBUTE_NOINLINE CCTK_ATTRIBUTE_UNUSED; +static CCTK_REAL PDplus2_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1ody, ptrdiff_t const cdj, ptrdiff_t const cdk) +{ + ptrdiff_t const cdi=sizeof(CCTK_REAL); + return (-KRANC_GFOFFSET3D(u,0,0,0) + KRANC_GFOFFSET3D(u,0,1,0))*p1ody; +} +#endif + +#ifndef KRANC_DIFF_FUNCTIONS +# define PDplus3(u) ((-KRANC_GFOFFSET3D(u,0,0,0) + KRANC_GFOFFSET3D(u,0,0,1))*p1odz) +#else +# define PDplus3(u) (PDplus3_impl(u,p1odz,cdj,cdk)) +static CCTK_REAL PDplus3_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1odz, ptrdiff_t const cdj, ptrdiff_t const cdk) CCTK_ATTRIBUTE_NOINLINE CCTK_ATTRIBUTE_UNUSED; +static CCTK_REAL PDplus3_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1odz, ptrdiff_t const cdj, ptrdiff_t const cdk) +{ + ptrdiff_t const cdi=sizeof(CCTK_REAL); + return (-KRANC_GFOFFSET3D(u,0,0,0) + KRANC_GFOFFSET3D(u,0,0,1))*p1odz; +} +#endif + +#ifndef KRANC_DIFF_FUNCTIONS +# define PDminus1(u) ((KRANC_GFOFFSET3D(u,0,0,0) - KRANC_GFOFFSET3D(u,-1,0,0))*p1odx) +#else +# define PDminus1(u) (PDminus1_impl(u,p1odx,cdj,cdk)) +static CCTK_REAL PDminus1_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1odx, ptrdiff_t const cdj, ptrdiff_t const cdk) CCTK_ATTRIBUTE_NOINLINE CCTK_ATTRIBUTE_UNUSED; +static CCTK_REAL PDminus1_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1odx, ptrdiff_t const cdj, ptrdiff_t const cdk) +{ + ptrdiff_t const cdi=sizeof(CCTK_REAL); + return (KRANC_GFOFFSET3D(u,0,0,0) - KRANC_GFOFFSET3D(u,-1,0,0))*p1odx; +} +#endif + +#ifndef KRANC_DIFF_FUNCTIONS +# define PDminus2(u) ((KRANC_GFOFFSET3D(u,0,0,0) - KRANC_GFOFFSET3D(u,0,-1,0))*p1ody) +#else +# define PDminus2(u) (PDminus2_impl(u,p1ody,cdj,cdk)) +static CCTK_REAL PDminus2_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1ody, ptrdiff_t const cdj, ptrdiff_t const cdk) CCTK_ATTRIBUTE_NOINLINE CCTK_ATTRIBUTE_UNUSED; +static CCTK_REAL PDminus2_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1ody, ptrdiff_t const cdj, ptrdiff_t const cdk) +{ + ptrdiff_t const cdi=sizeof(CCTK_REAL); + return (KRANC_GFOFFSET3D(u,0,0,0) - KRANC_GFOFFSET3D(u,0,-1,0))*p1ody; +} +#endif + +#ifndef KRANC_DIFF_FUNCTIONS +# define PDminus3(u) ((KRANC_GFOFFSET3D(u,0,0,0) - KRANC_GFOFFSET3D(u,0,0,-1))*p1odz) +#else +# define PDminus3(u) (PDminus3_impl(u,p1odz,cdj,cdk)) +static CCTK_REAL PDminus3_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1odz, ptrdiff_t const cdj, ptrdiff_t const cdk) CCTK_ATTRIBUTE_NOINLINE CCTK_ATTRIBUTE_UNUSED; +static CCTK_REAL PDminus3_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1odz, ptrdiff_t const cdj, ptrdiff_t const cdk) +{ + ptrdiff_t const cdi=sizeof(CCTK_REAL); + return (KRANC_GFOFFSET3D(u,0,0,0) - KRANC_GFOFFSET3D(u,0,0,-1))*p1odz; +} +#endif + +#ifndef KRANC_DIFF_FUNCTIONS +# define DiffPlus1(u) ((-KRANC_GFOFFSET3D(u,0,0,0) + KRANC_GFOFFSET3D(u,1,0,0))*p1o1) +#else +# define DiffPlus1(u) (DiffPlus1_impl(u,p1o1,cdj,cdk)) +static CCTK_REAL DiffPlus1_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o1, ptrdiff_t const cdj, ptrdiff_t const cdk) CCTK_ATTRIBUTE_NOINLINE CCTK_ATTRIBUTE_UNUSED; +static CCTK_REAL DiffPlus1_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o1, ptrdiff_t const cdj, ptrdiff_t const cdk) +{ + ptrdiff_t const cdi=sizeof(CCTK_REAL); + return (-KRANC_GFOFFSET3D(u,0,0,0) + KRANC_GFOFFSET3D(u,1,0,0))*p1o1; +} +#endif + +#ifndef KRANC_DIFF_FUNCTIONS +# define DiffPlus2(u) ((-KRANC_GFOFFSET3D(u,0,0,0) + KRANC_GFOFFSET3D(u,0,1,0))*p1o1) +#else +# define DiffPlus2(u) (DiffPlus2_impl(u,p1o1,cdj,cdk)) +static CCTK_REAL DiffPlus2_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o1, ptrdiff_t const cdj, ptrdiff_t const cdk) CCTK_ATTRIBUTE_NOINLINE CCTK_ATTRIBUTE_UNUSED; +static CCTK_REAL DiffPlus2_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o1, ptrdiff_t const cdj, ptrdiff_t const cdk) +{ + ptrdiff_t const cdi=sizeof(CCTK_REAL); + return (-KRANC_GFOFFSET3D(u,0,0,0) + KRANC_GFOFFSET3D(u,0,1,0))*p1o1; +} +#endif + +#ifndef KRANC_DIFF_FUNCTIONS +# define DiffPlus3(u) ((-KRANC_GFOFFSET3D(u,0,0,0) + KRANC_GFOFFSET3D(u,0,0,1))*p1o1) +#else +# define DiffPlus3(u) (DiffPlus3_impl(u,p1o1,cdj,cdk)) +static CCTK_REAL DiffPlus3_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o1, ptrdiff_t const cdj, ptrdiff_t const cdk) CCTK_ATTRIBUTE_NOINLINE CCTK_ATTRIBUTE_UNUSED; +static CCTK_REAL DiffPlus3_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o1, ptrdiff_t const cdj, ptrdiff_t const cdk) +{ + ptrdiff_t const cdi=sizeof(CCTK_REAL); + return (-KRANC_GFOFFSET3D(u,0,0,0) + KRANC_GFOFFSET3D(u,0,0,1))*p1o1; +} +#endif + +#ifndef KRANC_DIFF_FUNCTIONS +# define DiffMinus1(u) ((KRANC_GFOFFSET3D(u,0,0,0) - KRANC_GFOFFSET3D(u,-1,0,0))*p1o1) +#else +# define DiffMinus1(u) (DiffMinus1_impl(u,p1o1,cdj,cdk)) +static CCTK_REAL DiffMinus1_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o1, ptrdiff_t const cdj, ptrdiff_t const cdk) CCTK_ATTRIBUTE_NOINLINE CCTK_ATTRIBUTE_UNUSED; +static CCTK_REAL DiffMinus1_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o1, ptrdiff_t const cdj, ptrdiff_t const cdk) +{ + ptrdiff_t const cdi=sizeof(CCTK_REAL); + return (KRANC_GFOFFSET3D(u,0,0,0) - KRANC_GFOFFSET3D(u,-1,0,0))*p1o1; +} +#endif + +#ifndef KRANC_DIFF_FUNCTIONS +# define DiffMinus2(u) ((KRANC_GFOFFSET3D(u,0,0,0) - KRANC_GFOFFSET3D(u,0,-1,0))*p1o1) +#else +# define DiffMinus2(u) (DiffMinus2_impl(u,p1o1,cdj,cdk)) +static CCTK_REAL DiffMinus2_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o1, ptrdiff_t const cdj, ptrdiff_t const cdk) CCTK_ATTRIBUTE_NOINLINE CCTK_ATTRIBUTE_UNUSED; +static CCTK_REAL DiffMinus2_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o1, ptrdiff_t const cdj, ptrdiff_t const cdk) +{ + ptrdiff_t const cdi=sizeof(CCTK_REAL); + return (KRANC_GFOFFSET3D(u,0,0,0) - KRANC_GFOFFSET3D(u,0,-1,0))*p1o1; +} +#endif + +#ifndef KRANC_DIFF_FUNCTIONS +# define DiffMinus3(u) ((KRANC_GFOFFSET3D(u,0,0,0) - KRANC_GFOFFSET3D(u,0,0,-1))*p1o1) +#else +# define DiffMinus3(u) (DiffMinus3_impl(u,p1o1,cdj,cdk)) +static CCTK_REAL DiffMinus3_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o1, ptrdiff_t const cdj, ptrdiff_t const cdk) CCTK_ATTRIBUTE_NOINLINE CCTK_ATTRIBUTE_UNUSED; +static CCTK_REAL DiffMinus3_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o1, ptrdiff_t const cdj, ptrdiff_t const cdk) +{ + ptrdiff_t const cdi=sizeof(CCTK_REAL); + return (KRANC_GFOFFSET3D(u,0,0,0) - KRANC_GFOFFSET3D(u,0,0,-1))*p1o1; +} +#endif + +#ifndef KRANC_DIFF_FUNCTIONS +# define ShiftMinus1(u) (KRANC_GFOFFSET3D(u,-1,0,0)*p1o1) +#else +# define ShiftMinus1(u) (ShiftMinus1_impl(u,p1o1,cdj,cdk)) +static CCTK_REAL ShiftMinus1_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o1, ptrdiff_t const cdj, ptrdiff_t const cdk) CCTK_ATTRIBUTE_NOINLINE CCTK_ATTRIBUTE_UNUSED; +static CCTK_REAL ShiftMinus1_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o1, ptrdiff_t const cdj, ptrdiff_t const cdk) +{ + ptrdiff_t const cdi=sizeof(CCTK_REAL); + return KRANC_GFOFFSET3D(u,-1,0,0)*p1o1; +} +#endif + +#ifndef KRANC_DIFF_FUNCTIONS +# define ShiftMinus2(u) (KRANC_GFOFFSET3D(u,0,-1,0)*p1o1) +#else +# define ShiftMinus2(u) (ShiftMinus2_impl(u,p1o1,cdj,cdk)) +static CCTK_REAL ShiftMinus2_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o1, ptrdiff_t const cdj, ptrdiff_t const cdk) CCTK_ATTRIBUTE_NOINLINE CCTK_ATTRIBUTE_UNUSED; +static CCTK_REAL ShiftMinus2_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o1, ptrdiff_t const cdj, ptrdiff_t const cdk) +{ + ptrdiff_t const cdi=sizeof(CCTK_REAL); + return KRANC_GFOFFSET3D(u,0,-1,0)*p1o1; +} +#endif + +#ifndef KRANC_DIFF_FUNCTIONS +# define ShiftMinus3(u) (KRANC_GFOFFSET3D(u,0,0,-1)*p1o1) +#else +# define ShiftMinus3(u) (ShiftMinus3_impl(u,p1o1,cdj,cdk)) +static CCTK_REAL ShiftMinus3_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o1, ptrdiff_t const cdj, ptrdiff_t const cdk) CCTK_ATTRIBUTE_NOINLINE CCTK_ATTRIBUTE_UNUSED; +static CCTK_REAL ShiftMinus3_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o1, ptrdiff_t const cdj, ptrdiff_t const cdk) +{ + ptrdiff_t const cdi=sizeof(CCTK_REAL); + return KRANC_GFOFFSET3D(u,0,0,-1)*p1o1; +} +#endif + diff --git a/Examples/Euler/src/RegisterMoL.cc b/Examples/Euler/src/RegisterMoL.cc new file mode 100644 index 0000000..1b63de8 --- /dev/null +++ b/Examples/Euler/src/RegisterMoL.cc @@ -0,0 +1,23 @@ +/* File produced by Kranc */ + +#include "cctk.h" +#include "cctk_Arguments.h" +#include "cctk_Parameters.h" + +extern "C" void Euler_RegisterVars(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT ierr = 0; + + /* Register all the evolved grid functions with MoL */ + ierr += MoLRegisterEvolved(CCTK_VarIndex("Euler::Den"), CCTK_VarIndex("Euler::Denrhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("Euler::En"), CCTK_VarIndex("Euler::Enrhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("Euler::S1"), CCTK_VarIndex("Euler::S1rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("Euler::S2"), CCTK_VarIndex("Euler::S2rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("Euler::S3"), CCTK_VarIndex("Euler::S3rhs")); + + /* Register all the evolved Array functions with MoL */ + return; +} diff --git a/Examples/Euler/src/RegisterSymmetries.cc b/Examples/Euler/src/RegisterSymmetries.cc new file mode 100644 index 0000000..18fc370 --- /dev/null +++ b/Examples/Euler/src/RegisterSymmetries.cc @@ -0,0 +1,194 @@ +/* File produced by Kranc */ + +#include "cctk.h" +#include "cctk_Arguments.h" +#include "cctk_Parameters.h" +#include "Symmetry.h" + +extern "C" void Euler_RegisterSymmetries(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* array holding symmetry definitions */ + CCTK_INT sym[3]; + + + /* Register symmetries of grid functions */ + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "Euler::Den"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "Euler::En"); + + sym[0] = -1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "Euler::S1"); + + sym[0] = 1; + sym[1] = -1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "Euler::S2"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = -1; + SetCartSymVN(cctkGH, sym, "Euler::S3"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "Euler::DenF"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "Euler::DenLeft"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "Euler::DenRight"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "Euler::EnF"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "Euler::EnLeft"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "Euler::EnRight"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "Euler::p"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "Euler::pLeft"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "Euler::pRight"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "Euler::rho"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "Euler::rhoLeft"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "Euler::rhoRight"); + + sym[0] = -1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "Euler::SF1"); + + sym[0] = 1; + sym[1] = -1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "Euler::SF2"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = -1; + SetCartSymVN(cctkGH, sym, "Euler::SF3"); + + sym[0] = -1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "Euler::SLeft1"); + + sym[0] = 1; + sym[1] = -1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "Euler::SLeft2"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = -1; + SetCartSymVN(cctkGH, sym, "Euler::SLeft3"); + + sym[0] = -1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "Euler::SRight1"); + + sym[0] = 1; + sym[1] = -1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "Euler::SRight2"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = -1; + SetCartSymVN(cctkGH, sym, "Euler::SRight3"); + + sym[0] = -1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "Euler::v1"); + + sym[0] = 1; + sym[1] = -1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "Euler::v2"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = -1; + SetCartSymVN(cctkGH, sym, "Euler::v3"); + + sym[0] = -1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "Euler::vLeft1"); + + sym[0] = 1; + sym[1] = -1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "Euler::vLeft2"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = -1; + SetCartSymVN(cctkGH, sym, "Euler::vLeft3"); + + sym[0] = -1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "Euler::vRight1"); + + sym[0] = 1; + sym[1] = -1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "Euler::vRight2"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = -1; + SetCartSymVN(cctkGH, sym, "Euler::vRight3"); + +} diff --git a/Examples/Euler/src/Startup.cc b/Examples/Euler/src/Startup.cc new file mode 100644 index 0000000..88708d0 --- /dev/null +++ b/Examples/Euler/src/Startup.cc @@ -0,0 +1,10 @@ +/* File produced by Kranc */ + +#include "cctk.h" + +extern "C" int Euler_Startup(void) +{ + const char * banner = "Euler"; + CCTK_RegisterBanner(banner); + return 0; +} diff --git a/Examples/Euler/src/euler_conserved.cc b/Examples/Euler/src/euler_conserved.cc new file mode 100644 index 0000000..bfa9113 --- /dev/null +++ b/Examples/Euler/src/euler_conserved.cc @@ -0,0 +1,163 @@ +/* File produced by Kranc */ + +#define KRANC_C + +#include <assert.h> +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include "cctk.h" +#include "cctk_Arguments.h" +#include "cctk_Parameters.h" +#include "GenericFD.h" +#include "Differencing.h" +#include "cctk_Loop.h" +#include "loopcontrol.h" + +/* Define macros used in calculations */ +#define INITVALUE (42) +#define QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +static void euler_conserved_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const imin[3], int const imax[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const cdi = sizeof(CCTK_REAL) * di; + ptrdiff_t const cdj = sizeof(CCTK_REAL) * dj; + ptrdiff_t const cdk = sizeof(CCTK_REAL) * dk; + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dt = ToReal(CCTK_DELTA_TIME); + CCTK_REAL const t = ToReal(cctk_time); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o1 = 1; + CCTK_REAL const p1o12dx = 0.0833333333333333333333333333333*INV(dx); + CCTK_REAL const p1o12dy = 0.0833333333333333333333333333333*INV(dy); + CCTK_REAL const p1o12dz = 0.0833333333333333333333333333333*INV(dz); + CCTK_REAL const p1o144dxdy = 0.00694444444444444444444444444444*INV(dx)*INV(dy); + CCTK_REAL const p1o144dxdz = 0.00694444444444444444444444444444*INV(dx)*INV(dz); + CCTK_REAL const p1o144dydz = 0.00694444444444444444444444444444*INV(dy)*INV(dz); + CCTK_REAL const p1o2dx = 0.5*INV(dx); + CCTK_REAL const p1o2dy = 0.5*INV(dy); + CCTK_REAL const p1o2dz = 0.5*INV(dz); + CCTK_REAL const p1o4dxdy = 0.25*INV(dx)*INV(dy); + CCTK_REAL const p1o4dxdz = 0.25*INV(dx)*INV(dz); + CCTK_REAL const p1o4dydz = 0.25*INV(dy)*INV(dz); + CCTK_REAL const p1odx = INV(dx); + CCTK_REAL const p1odx2 = INV(SQR(dx)); + CCTK_REAL const p1ody = INV(dy); + CCTK_REAL const p1ody2 = INV(SQR(dy)); + CCTK_REAL const p1odz = INV(dz); + CCTK_REAL const p1odz2 = INV(SQR(dz)); + CCTK_REAL const pm1o12dx2 = -0.0833333333333333333333333333333*INV(SQR(dx)); + CCTK_REAL const pm1o12dy2 = -0.0833333333333333333333333333333*INV(SQR(dy)); + CCTK_REAL const pm1o12dz2 = -0.0833333333333333333333333333333*INV(SQR(dz)); + CCTK_REAL const pm1o2dx = -0.5*INV(dx); + CCTK_REAL const pm1o2dy = -0.5*INV(dy); + CCTK_REAL const pm1o2dz = -0.5*INV(dz); + + /* Assign local copies of arrays functions */ + + + + /* Calculate temporaries and arrays functions */ + + /* Copy local copies back to grid functions */ + + /* Loop over the grid points */ + #pragma omp parallel + CCTK_LOOP3 (euler_conserved, + i,j,k, imin[0],imin[1],imin[2], imax[0],imax[1],imax[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + + CCTK_REAL pL = p[index]; + CCTK_REAL rhoL = rho[index]; + CCTK_REAL v1L = v1[index]; + CCTK_REAL v2L = v2[index]; + CCTK_REAL v3L = v3[index]; + + + /* Include user supplied include files */ + + /* Precompute derivatives */ + + /* Calculate temporaries and grid functions */ + CCTK_REAL DenL = rhoL; + + CCTK_REAL S1L = rhoL*v1L; + + CCTK_REAL S2L = rhoL*v2L; + + CCTK_REAL S3L = rhoL*v3L; + + CCTK_REAL EnL = 0.5*INV(-1 + ToReal(gamma))*(2*pL + + rhoL*(SQR(v1L) + SQR(v2L) + SQR(v3L))*(-1 + ToReal(gamma))); + + /* Copy local copies back to grid functions */ + Den[index] = DenL; + En[index] = EnL; + S1[index] = S1L; + S2[index] = S2L; + S3[index] = S3L; + } + CCTK_ENDLOOP3 (euler_conserved); +} + +extern "C" void euler_conserved(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering euler_conserved_Body"); + } + + if (cctk_iteration % euler_conserved_calc_every != euler_conserved_calc_offset) + { + return; + } + + const char *groups[] = {"Euler::Den_group","Euler::En_group","Euler::p_group","Euler::rho_group","Euler::S_group","Euler::v_group"}; + GenericFD_AssertGroupStorage(cctkGH, "euler_conserved", 6, groups); + + + GenericFD_LoopOverEverything(cctkGH, &euler_conserved_Body); + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Leaving euler_conserved_Body"); + } +} diff --git a/Examples/Euler/src/euler_conserved_flux_1.cc b/Examples/Euler/src/euler_conserved_flux_1.cc new file mode 100644 index 0000000..13cf71b --- /dev/null +++ b/Examples/Euler/src/euler_conserved_flux_1.cc @@ -0,0 +1,186 @@ +/* File produced by Kranc */ + +#define KRANC_C + +#include <assert.h> +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include "cctk.h" +#include "cctk_Arguments.h" +#include "cctk_Parameters.h" +#include "GenericFD.h" +#include "Differencing.h" +#include "cctk_Loop.h" +#include "loopcontrol.h" + +/* Define macros used in calculations */ +#define INITVALUE (42) +#define QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +static void euler_conserved_flux_1_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const imin[3], int const imax[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const cdi = sizeof(CCTK_REAL) * di; + ptrdiff_t const cdj = sizeof(CCTK_REAL) * dj; + ptrdiff_t const cdk = sizeof(CCTK_REAL) * dk; + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dt = ToReal(CCTK_DELTA_TIME); + CCTK_REAL const t = ToReal(cctk_time); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o1 = 1; + CCTK_REAL const p1o12dx = 0.0833333333333333333333333333333*INV(dx); + CCTK_REAL const p1o12dy = 0.0833333333333333333333333333333*INV(dy); + CCTK_REAL const p1o12dz = 0.0833333333333333333333333333333*INV(dz); + CCTK_REAL const p1o144dxdy = 0.00694444444444444444444444444444*INV(dx)*INV(dy); + CCTK_REAL const p1o144dxdz = 0.00694444444444444444444444444444*INV(dx)*INV(dz); + CCTK_REAL const p1o144dydz = 0.00694444444444444444444444444444*INV(dy)*INV(dz); + CCTK_REAL const p1o2dx = 0.5*INV(dx); + CCTK_REAL const p1o2dy = 0.5*INV(dy); + CCTK_REAL const p1o2dz = 0.5*INV(dz); + CCTK_REAL const p1o4dxdy = 0.25*INV(dx)*INV(dy); + CCTK_REAL const p1o4dxdz = 0.25*INV(dx)*INV(dz); + CCTK_REAL const p1o4dydz = 0.25*INV(dy)*INV(dz); + CCTK_REAL const p1odx = INV(dx); + CCTK_REAL const p1odx2 = INV(SQR(dx)); + CCTK_REAL const p1ody = INV(dy); + CCTK_REAL const p1ody2 = INV(SQR(dy)); + CCTK_REAL const p1odz = INV(dz); + CCTK_REAL const p1odz2 = INV(SQR(dz)); + CCTK_REAL const pm1o12dx2 = -0.0833333333333333333333333333333*INV(SQR(dx)); + CCTK_REAL const pm1o12dy2 = -0.0833333333333333333333333333333*INV(SQR(dy)); + CCTK_REAL const pm1o12dz2 = -0.0833333333333333333333333333333*INV(SQR(dz)); + CCTK_REAL const pm1o2dx = -0.5*INV(dx); + CCTK_REAL const pm1o2dy = -0.5*INV(dy); + CCTK_REAL const pm1o2dz = -0.5*INV(dz); + + /* Assign local copies of arrays functions */ + + + + /* Calculate temporaries and arrays functions */ + + /* Copy local copies back to grid functions */ + + /* Loop over the grid points */ + #pragma omp parallel + CCTK_LOOP3 (euler_conserved_flux_1, + i,j,k, imin[0],imin[1],imin[2], imax[0],imax[1],imax[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + + CCTK_REAL pLeftL = pLeft[index]; + CCTK_REAL pRightL = pRight[index]; + CCTK_REAL rhoLeftL = rhoLeft[index]; + CCTK_REAL rhoRightL = rhoRight[index]; + CCTK_REAL vLeft1L = vLeft1[index]; + CCTK_REAL vLeft2L = vLeft2[index]; + CCTK_REAL vLeft3L = vLeft3[index]; + CCTK_REAL vRight1L = vRight1[index]; + CCTK_REAL vRight2L = vRight2[index]; + CCTK_REAL vRight3L = vRight3[index]; + + + /* Include user supplied include files */ + + /* Precompute derivatives */ + + /* Calculate temporaries and grid functions */ + CCTK_REAL DenLeftL = rhoLeftL; + + CCTK_REAL DenRightL = rhoRightL; + + CCTK_REAL SLeft1L = rhoLeftL*vLeft1L; + + CCTK_REAL SLeft2L = rhoLeftL*vLeft2L; + + CCTK_REAL SLeft3L = rhoLeftL*vLeft3L; + + CCTK_REAL SRight1L = rhoRightL*vRight1L; + + CCTK_REAL SRight2L = rhoRightL*vRight2L; + + CCTK_REAL SRight3L = rhoRightL*vRight3L; + + CCTK_REAL EnLeftL = 0.5*INV(-1 + ToReal(gamma))*(2*pLeftL + + rhoLeftL*(SQR(vLeft1L) + SQR(vLeft2L) + SQR(vLeft3L))*(-1 + + ToReal(gamma))); + + CCTK_REAL EnRightL = 0.5*INV(-1 + ToReal(gamma))*(2*pRightL + + rhoRightL*(SQR(vRight1L) + SQR(vRight2L) + SQR(vRight3L))*(-1 + + ToReal(gamma))); + + /* Copy local copies back to grid functions */ + DenLeft[index] = DenLeftL; + DenRight[index] = DenRightL; + EnLeft[index] = EnLeftL; + EnRight[index] = EnRightL; + SLeft1[index] = SLeft1L; + SLeft2[index] = SLeft2L; + SLeft3[index] = SLeft3L; + SRight1[index] = SRight1L; + SRight2[index] = SRight2L; + SRight3[index] = SRight3L; + } + CCTK_ENDLOOP3 (euler_conserved_flux_1); +} + +extern "C" void euler_conserved_flux_1(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering euler_conserved_flux_1_Body"); + } + + if (cctk_iteration % euler_conserved_flux_1_calc_every != euler_conserved_flux_1_calc_offset) + { + return; + } + + const char *groups[] = {"Euler::DenLeft_group","Euler::DenRight_group","Euler::EnLeft_group","Euler::EnRight_group","Euler::pLeft_group","Euler::pRight_group","Euler::rhoLeft_group","Euler::rhoRight_group","Euler::SLeft_group","Euler::SRight_group","Euler::vLeft_group","Euler::vRight_group"}; + GenericFD_AssertGroupStorage(cctkGH, "euler_conserved_flux_1", 12, groups); + + + GenericFD_LoopOverEverything(cctkGH, &euler_conserved_flux_1_Body); + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Leaving euler_conserved_flux_1_Body"); + } +} diff --git a/Examples/Euler/src/euler_flux_1.cc b/Examples/Euler/src/euler_flux_1.cc new file mode 100644 index 0000000..4786a56 --- /dev/null +++ b/Examples/Euler/src/euler_flux_1.cc @@ -0,0 +1,222 @@ +/* File produced by Kranc */ + +#define KRANC_C + +#include <assert.h> +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include "cctk.h" +#include "cctk_Arguments.h" +#include "cctk_Parameters.h" +#include "GenericFD.h" +#include "Differencing.h" +#include "cctk_Loop.h" +#include "loopcontrol.h" + +/* Define macros used in calculations */ +#define INITVALUE (42) +#define QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +extern "C" void euler_flux_1_SelectBCs(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT ierr = 0; + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "Euler::DenF_group","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for Euler::DenF_group."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "Euler::EnF_group","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for Euler::EnF_group."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "Euler::SF_group","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for Euler::SF_group."); + return; +} + +static void euler_flux_1_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const imin[3], int const imax[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const cdi = sizeof(CCTK_REAL) * di; + ptrdiff_t const cdj = sizeof(CCTK_REAL) * dj; + ptrdiff_t const cdk = sizeof(CCTK_REAL) * dk; + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dt = ToReal(CCTK_DELTA_TIME); + CCTK_REAL const t = ToReal(cctk_time); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o1 = 1; + CCTK_REAL const p1o12dx = 0.0833333333333333333333333333333*INV(dx); + CCTK_REAL const p1o12dy = 0.0833333333333333333333333333333*INV(dy); + CCTK_REAL const p1o12dz = 0.0833333333333333333333333333333*INV(dz); + CCTK_REAL const p1o144dxdy = 0.00694444444444444444444444444444*INV(dx)*INV(dy); + CCTK_REAL const p1o144dxdz = 0.00694444444444444444444444444444*INV(dx)*INV(dz); + CCTK_REAL const p1o144dydz = 0.00694444444444444444444444444444*INV(dy)*INV(dz); + CCTK_REAL const p1o2dx = 0.5*INV(dx); + CCTK_REAL const p1o2dy = 0.5*INV(dy); + CCTK_REAL const p1o2dz = 0.5*INV(dz); + CCTK_REAL const p1o4dxdy = 0.25*INV(dx)*INV(dy); + CCTK_REAL const p1o4dxdz = 0.25*INV(dx)*INV(dz); + CCTK_REAL const p1o4dydz = 0.25*INV(dy)*INV(dz); + CCTK_REAL const p1odx = INV(dx); + CCTK_REAL const p1odx2 = INV(SQR(dx)); + CCTK_REAL const p1ody = INV(dy); + CCTK_REAL const p1ody2 = INV(SQR(dy)); + CCTK_REAL const p1odz = INV(dz); + CCTK_REAL const p1odz2 = INV(SQR(dz)); + CCTK_REAL const pm1o12dx2 = -0.0833333333333333333333333333333*INV(SQR(dx)); + CCTK_REAL const pm1o12dy2 = -0.0833333333333333333333333333333*INV(SQR(dy)); + CCTK_REAL const pm1o12dz2 = -0.0833333333333333333333333333333*INV(SQR(dz)); + CCTK_REAL const pm1o2dx = -0.5*INV(dx); + CCTK_REAL const pm1o2dy = -0.5*INV(dy); + CCTK_REAL const pm1o2dz = -0.5*INV(dz); + + /* Assign local copies of arrays functions */ + + + + /* Calculate temporaries and arrays functions */ + + /* Copy local copies back to grid functions */ + + /* Loop over the grid points */ + #pragma omp parallel + CCTK_LOOP3 (euler_flux_1, + i,j,k, imin[0],imin[1],imin[2], imax[0],imax[1],imax[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + + CCTK_REAL DenLeftL = DenLeft[index]; + CCTK_REAL DenRightL = DenRight[index]; + CCTK_REAL EnLeftL = EnLeft[index]; + CCTK_REAL EnRightL = EnRight[index]; + CCTK_REAL pLeftL = pLeft[index]; + CCTK_REAL pRightL = pRight[index]; + CCTK_REAL rhoLeftL = rhoLeft[index]; + CCTK_REAL rhoRightL = rhoRight[index]; + CCTK_REAL SLeft1L = SLeft1[index]; + CCTK_REAL SLeft2L = SLeft2[index]; + CCTK_REAL SLeft3L = SLeft3[index]; + CCTK_REAL SRight1L = SRight1[index]; + CCTK_REAL SRight2L = SRight2[index]; + CCTK_REAL SRight3L = SRight3[index]; + CCTK_REAL vLeft1L = vLeft1[index]; + CCTK_REAL vLeft2L = vLeft2[index]; + CCTK_REAL vLeft3L = vLeft3[index]; + CCTK_REAL vRight1L = vRight1[index]; + CCTK_REAL vRight2L = vRight2[index]; + CCTK_REAL vRight3L = vRight3[index]; + + + /* Include user supplied include files */ + + /* Precompute derivatives */ + CCTK_REAL const ShiftMinus1DenRight = ShiftMinus1(&DenRight[index]); + CCTK_REAL const ShiftMinus1EnRight = ShiftMinus1(&EnRight[index]); + CCTK_REAL const ShiftMinus1pRight = ShiftMinus1(&pRight[index]); + CCTK_REAL const ShiftMinus1rhoRight = ShiftMinus1(&rhoRight[index]); + CCTK_REAL const ShiftMinus1SRight1 = ShiftMinus1(&SRight1[index]); + CCTK_REAL const ShiftMinus1SRight2 = ShiftMinus1(&SRight2[index]); + CCTK_REAL const ShiftMinus1SRight3 = ShiftMinus1(&SRight3[index]); + CCTK_REAL const ShiftMinus1vRight1 = ShiftMinus1(&vRight1[index]); + CCTK_REAL const ShiftMinus1vRight2 = ShiftMinus1(&vRight2[index]); + CCTK_REAL const ShiftMinus1vRight3 = ShiftMinus1(&vRight3[index]); + + /* Calculate temporaries and grid functions */ + CCTK_REAL vRightTemp1 = ShiftMinus1vRight1; + + CCTK_REAL vRightTemp2 = ShiftMinus1vRight2; + + CCTK_REAL vRightTemp3 = ShiftMinus1vRight3; + + CCTK_REAL DenFL = 0.5*(rhoLeftL*vLeft1L + + ShiftMinus1rhoRight*vRightTemp1 + (-DenLeftL + + ShiftMinus1DenRight)*ToReal(alpha)); + + CCTK_REAL SF1L = 0.5*(pLeftL + ShiftMinus1pRight + + rhoLeftL*SQR(vLeft1L) + ShiftMinus1rhoRight*SQR(vRightTemp1) + + (-SLeft1L + ShiftMinus1SRight1)*ToReal(alpha)); + + CCTK_REAL SF2L = 0.5*(rhoLeftL*vLeft1L*vLeft2L + + ShiftMinus1rhoRight*vRightTemp1*vRightTemp2 + (-SLeft2L + + ShiftMinus1SRight2)*ToReal(alpha)); + + CCTK_REAL SF3L = 0.5*(rhoLeftL*vLeft1L*vLeft3L + + ShiftMinus1rhoRight*vRightTemp1*vRightTemp3 + (-SLeft3L + + ShiftMinus1SRight3)*ToReal(alpha)); + + CCTK_REAL EnFL = 0.5*((EnLeftL + pLeftL)*vLeft1L + + ShiftMinus1pRight*vRightTemp1 - EnLeftL*ToReal(alpha) + + ShiftMinus1EnRight*(vRightTemp1 + ToReal(alpha))); + + /* Copy local copies back to grid functions */ + DenF[index] = DenFL; + EnF[index] = EnFL; + SF1[index] = SF1L; + SF2[index] = SF2L; + SF3[index] = SF3L; + } + CCTK_ENDLOOP3 (euler_flux_1); +} + +extern "C" void euler_flux_1(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering euler_flux_1_Body"); + } + + if (cctk_iteration % euler_flux_1_calc_every != euler_flux_1_calc_offset) + { + return; + } + + const char *groups[] = {"Euler::DenF_group","Euler::DenLeft_group","Euler::DenRight_group","Euler::EnF_group","Euler::EnLeft_group","Euler::EnRight_group","Euler::pLeft_group","Euler::pRight_group","Euler::rhoLeft_group","Euler::rhoRight_group","Euler::SF_group","Euler::SLeft_group","Euler::SRight_group","Euler::vLeft_group","Euler::vRight_group"}; + GenericFD_AssertGroupStorage(cctkGH, "euler_flux_1", 15, groups); + + GenericFD_EnsureStencilFits(cctkGH, "euler_flux_1", 1, 1, 1); + + GenericFD_LoopOverInterior(cctkGH, &euler_flux_1_Body); + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Leaving euler_flux_1_Body"); + } +} diff --git a/Examples/Euler/src/euler_initial_shock.cc b/Examples/Euler/src/euler_initial_shock.cc new file mode 100644 index 0000000..e1350f0 --- /dev/null +++ b/Examples/Euler/src/euler_initial_shock.cc @@ -0,0 +1,161 @@ +/* File produced by Kranc */ + +#define KRANC_C + +#include <assert.h> +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include "cctk.h" +#include "cctk_Arguments.h" +#include "cctk_Parameters.h" +#include "GenericFD.h" +#include "Differencing.h" +#include "cctk_Loop.h" +#include "loopcontrol.h" + +/* Define macros used in calculations */ +#define INITVALUE (42) +#define QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +static void euler_initial_shock_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const imin[3], int const imax[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const cdi = sizeof(CCTK_REAL) * di; + ptrdiff_t const cdj = sizeof(CCTK_REAL) * dj; + ptrdiff_t const cdk = sizeof(CCTK_REAL) * dk; + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dt = ToReal(CCTK_DELTA_TIME); + CCTK_REAL const t = ToReal(cctk_time); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o1 = 1; + CCTK_REAL const p1o12dx = 0.0833333333333333333333333333333*INV(dx); + CCTK_REAL const p1o12dy = 0.0833333333333333333333333333333*INV(dy); + CCTK_REAL const p1o12dz = 0.0833333333333333333333333333333*INV(dz); + CCTK_REAL const p1o144dxdy = 0.00694444444444444444444444444444*INV(dx)*INV(dy); + CCTK_REAL const p1o144dxdz = 0.00694444444444444444444444444444*INV(dx)*INV(dz); + CCTK_REAL const p1o144dydz = 0.00694444444444444444444444444444*INV(dy)*INV(dz); + CCTK_REAL const p1o2dx = 0.5*INV(dx); + CCTK_REAL const p1o2dy = 0.5*INV(dy); + CCTK_REAL const p1o2dz = 0.5*INV(dz); + CCTK_REAL const p1o4dxdy = 0.25*INV(dx)*INV(dy); + CCTK_REAL const p1o4dxdz = 0.25*INV(dx)*INV(dz); + CCTK_REAL const p1o4dydz = 0.25*INV(dy)*INV(dz); + CCTK_REAL const p1odx = INV(dx); + CCTK_REAL const p1odx2 = INV(SQR(dx)); + CCTK_REAL const p1ody = INV(dy); + CCTK_REAL const p1ody2 = INV(SQR(dy)); + CCTK_REAL const p1odz = INV(dz); + CCTK_REAL const p1odz2 = INV(SQR(dz)); + CCTK_REAL const pm1o12dx2 = -0.0833333333333333333333333333333*INV(SQR(dx)); + CCTK_REAL const pm1o12dy2 = -0.0833333333333333333333333333333*INV(SQR(dy)); + CCTK_REAL const pm1o12dz2 = -0.0833333333333333333333333333333*INV(SQR(dz)); + CCTK_REAL const pm1o2dx = -0.5*INV(dx); + CCTK_REAL const pm1o2dy = -0.5*INV(dy); + CCTK_REAL const pm1o2dz = -0.5*INV(dz); + + /* Assign local copies of arrays functions */ + + + + /* Calculate temporaries and arrays functions */ + + /* Copy local copies back to grid functions */ + + /* Loop over the grid points */ + #pragma omp parallel + CCTK_LOOP3 (euler_initial_shock, + i,j,k, imin[0],imin[1],imin[2], imax[0],imax[1],imax[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + + CCTK_REAL xL = x[index]; + + + /* Include user supplied include files */ + + /* Precompute derivatives */ + + /* Calculate temporaries and grid functions */ + CCTK_REAL rhoL = ToReal(rhoL0) + StepFunction(-0.5 + + xL)*(-ToReal(rhoL0) + ToReal(rhoR0)); + + CCTK_REAL v1L = ToReal(vL0) + StepFunction(-0.5 + xL)*(-ToReal(vL0) + + ToReal(vR0)); + + CCTK_REAL v2L = 0; + + CCTK_REAL v3L = 0; + + CCTK_REAL pL = ToReal(pL0) + StepFunction(-0.5 + xL)*(-ToReal(pL0) + + ToReal(pR0)); + + /* Copy local copies back to grid functions */ + p[index] = pL; + rho[index] = rhoL; + v1[index] = v1L; + v2[index] = v2L; + v3[index] = v3L; + } + CCTK_ENDLOOP3 (euler_initial_shock); +} + +extern "C" void euler_initial_shock(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering euler_initial_shock_Body"); + } + + if (cctk_iteration % euler_initial_shock_calc_every != euler_initial_shock_calc_offset) + { + return; + } + + const char *groups[] = {"grid::coordinates","Euler::p_group","Euler::rho_group","Euler::v_group"}; + GenericFD_AssertGroupStorage(cctkGH, "euler_initial_shock", 4, groups); + + + GenericFD_LoopOverEverything(cctkGH, &euler_initial_shock_Body); + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Leaving euler_initial_shock_Body"); + } +} diff --git a/Examples/Euler/src/euler_primitives.cc b/Examples/Euler/src/euler_primitives.cc new file mode 100644 index 0000000..6f28417 --- /dev/null +++ b/Examples/Euler/src/euler_primitives.cc @@ -0,0 +1,163 @@ +/* File produced by Kranc */ + +#define KRANC_C + +#include <assert.h> +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include "cctk.h" +#include "cctk_Arguments.h" +#include "cctk_Parameters.h" +#include "GenericFD.h" +#include "Differencing.h" +#include "cctk_Loop.h" +#include "loopcontrol.h" + +/* Define macros used in calculations */ +#define INITVALUE (42) +#define QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +static void euler_primitives_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const imin[3], int const imax[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const cdi = sizeof(CCTK_REAL) * di; + ptrdiff_t const cdj = sizeof(CCTK_REAL) * dj; + ptrdiff_t const cdk = sizeof(CCTK_REAL) * dk; + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dt = ToReal(CCTK_DELTA_TIME); + CCTK_REAL const t = ToReal(cctk_time); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o1 = 1; + CCTK_REAL const p1o12dx = 0.0833333333333333333333333333333*INV(dx); + CCTK_REAL const p1o12dy = 0.0833333333333333333333333333333*INV(dy); + CCTK_REAL const p1o12dz = 0.0833333333333333333333333333333*INV(dz); + CCTK_REAL const p1o144dxdy = 0.00694444444444444444444444444444*INV(dx)*INV(dy); + CCTK_REAL const p1o144dxdz = 0.00694444444444444444444444444444*INV(dx)*INV(dz); + CCTK_REAL const p1o144dydz = 0.00694444444444444444444444444444*INV(dy)*INV(dz); + CCTK_REAL const p1o2dx = 0.5*INV(dx); + CCTK_REAL const p1o2dy = 0.5*INV(dy); + CCTK_REAL const p1o2dz = 0.5*INV(dz); + CCTK_REAL const p1o4dxdy = 0.25*INV(dx)*INV(dy); + CCTK_REAL const p1o4dxdz = 0.25*INV(dx)*INV(dz); + CCTK_REAL const p1o4dydz = 0.25*INV(dy)*INV(dz); + CCTK_REAL const p1odx = INV(dx); + CCTK_REAL const p1odx2 = INV(SQR(dx)); + CCTK_REAL const p1ody = INV(dy); + CCTK_REAL const p1ody2 = INV(SQR(dy)); + CCTK_REAL const p1odz = INV(dz); + CCTK_REAL const p1odz2 = INV(SQR(dz)); + CCTK_REAL const pm1o12dx2 = -0.0833333333333333333333333333333*INV(SQR(dx)); + CCTK_REAL const pm1o12dy2 = -0.0833333333333333333333333333333*INV(SQR(dy)); + CCTK_REAL const pm1o12dz2 = -0.0833333333333333333333333333333*INV(SQR(dz)); + CCTK_REAL const pm1o2dx = -0.5*INV(dx); + CCTK_REAL const pm1o2dy = -0.5*INV(dy); + CCTK_REAL const pm1o2dz = -0.5*INV(dz); + + /* Assign local copies of arrays functions */ + + + + /* Calculate temporaries and arrays functions */ + + /* Copy local copies back to grid functions */ + + /* Loop over the grid points */ + #pragma omp parallel + CCTK_LOOP3 (euler_primitives, + i,j,k, imin[0],imin[1],imin[2], imax[0],imax[1],imax[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + + CCTK_REAL DenL = Den[index]; + CCTK_REAL EnL = En[index]; + CCTK_REAL S1L = S1[index]; + CCTK_REAL S2L = S2[index]; + CCTK_REAL S3L = S3[index]; + + + /* Include user supplied include files */ + + /* Precompute derivatives */ + + /* Calculate temporaries and grid functions */ + CCTK_REAL rhoL = DenL; + + CCTK_REAL v1L = S1L*INV(DenL); + + CCTK_REAL v2L = S2L*INV(DenL); + + CCTK_REAL v3L = S3L*INV(DenL); + + CCTK_REAL pL = 0.5*INV(DenL)*(2*DenL*EnL - SQR(S1L) - + SQR(S2L) - SQR(S3L))*(-1 + ToReal(gamma)); + + /* Copy local copies back to grid functions */ + p[index] = pL; + rho[index] = rhoL; + v1[index] = v1L; + v2[index] = v2L; + v3[index] = v3L; + } + CCTK_ENDLOOP3 (euler_primitives); +} + +extern "C" void euler_primitives(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering euler_primitives_Body"); + } + + if (cctk_iteration % euler_primitives_calc_every != euler_primitives_calc_offset) + { + return; + } + + const char *groups[] = {"Euler::Den_group","Euler::En_group","Euler::p_group","Euler::rho_group","Euler::S_group","Euler::v_group"}; + GenericFD_AssertGroupStorage(cctkGH, "euler_primitives", 6, groups); + + + GenericFD_LoopOverEverything(cctkGH, &euler_primitives_Body); + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Leaving euler_primitives_Body"); + } +} diff --git a/Examples/Euler/src/euler_reconstruct_1.cc b/Examples/Euler/src/euler_reconstruct_1.cc new file mode 100644 index 0000000..976472d --- /dev/null +++ b/Examples/Euler/src/euler_reconstruct_1.cc @@ -0,0 +1,245 @@ +/* File produced by Kranc */ + +#define KRANC_C + +#include <assert.h> +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include "cctk.h" +#include "cctk_Arguments.h" +#include "cctk_Parameters.h" +#include "GenericFD.h" +#include "Differencing.h" +#include "cctk_Loop.h" +#include "loopcontrol.h" + +/* Define macros used in calculations */ +#define INITVALUE (42) +#define QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +extern "C" void euler_reconstruct_1_SelectBCs(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT ierr = 0; + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "Euler::pLeft_group","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for Euler::pLeft_group."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "Euler::pRight_group","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for Euler::pRight_group."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "Euler::rhoLeft_group","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for Euler::rhoLeft_group."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "Euler::rhoRight_group","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for Euler::rhoRight_group."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "Euler::vLeft_group","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for Euler::vLeft_group."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "Euler::vRight_group","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for Euler::vRight_group."); + return; +} + +static void euler_reconstruct_1_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const imin[3], int const imax[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const cdi = sizeof(CCTK_REAL) * di; + ptrdiff_t const cdj = sizeof(CCTK_REAL) * dj; + ptrdiff_t const cdk = sizeof(CCTK_REAL) * dk; + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dt = ToReal(CCTK_DELTA_TIME); + CCTK_REAL const t = ToReal(cctk_time); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o1 = 1; + CCTK_REAL const p1o12dx = 0.0833333333333333333333333333333*INV(dx); + CCTK_REAL const p1o12dy = 0.0833333333333333333333333333333*INV(dy); + CCTK_REAL const p1o12dz = 0.0833333333333333333333333333333*INV(dz); + CCTK_REAL const p1o144dxdy = 0.00694444444444444444444444444444*INV(dx)*INV(dy); + CCTK_REAL const p1o144dxdz = 0.00694444444444444444444444444444*INV(dx)*INV(dz); + CCTK_REAL const p1o144dydz = 0.00694444444444444444444444444444*INV(dy)*INV(dz); + CCTK_REAL const p1o2dx = 0.5*INV(dx); + CCTK_REAL const p1o2dy = 0.5*INV(dy); + CCTK_REAL const p1o2dz = 0.5*INV(dz); + CCTK_REAL const p1o4dxdy = 0.25*INV(dx)*INV(dy); + CCTK_REAL const p1o4dxdz = 0.25*INV(dx)*INV(dz); + CCTK_REAL const p1o4dydz = 0.25*INV(dy)*INV(dz); + CCTK_REAL const p1odx = INV(dx); + CCTK_REAL const p1odx2 = INV(SQR(dx)); + CCTK_REAL const p1ody = INV(dy); + CCTK_REAL const p1ody2 = INV(SQR(dy)); + CCTK_REAL const p1odz = INV(dz); + CCTK_REAL const p1odz2 = INV(SQR(dz)); + CCTK_REAL const pm1o12dx2 = -0.0833333333333333333333333333333*INV(SQR(dx)); + CCTK_REAL const pm1o12dy2 = -0.0833333333333333333333333333333*INV(SQR(dy)); + CCTK_REAL const pm1o12dz2 = -0.0833333333333333333333333333333*INV(SQR(dz)); + CCTK_REAL const pm1o2dx = -0.5*INV(dx); + CCTK_REAL const pm1o2dy = -0.5*INV(dy); + CCTK_REAL const pm1o2dz = -0.5*INV(dz); + + /* Assign local copies of arrays functions */ + + + + /* Calculate temporaries and arrays functions */ + + /* Copy local copies back to grid functions */ + + /* Loop over the grid points */ + #pragma omp parallel + CCTK_LOOP3 (euler_reconstruct_1, + i,j,k, imin[0],imin[1],imin[2], imax[0],imax[1],imax[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + + CCTK_REAL pL = p[index]; + CCTK_REAL rhoL = rho[index]; + CCTK_REAL v1L = v1[index]; + CCTK_REAL v2L = v2[index]; + CCTK_REAL v3L = v3[index]; + + + /* Include user supplied include files */ + + /* Precompute derivatives */ + CCTK_REAL const DiffPlus1p = DiffPlus1(&p[index]); + CCTK_REAL const DiffMinus1p = DiffMinus1(&p[index]); + CCTK_REAL const DiffPlus1rho = DiffPlus1(&rho[index]); + CCTK_REAL const DiffMinus1rho = DiffMinus1(&rho[index]); + CCTK_REAL const DiffPlus1v1 = DiffPlus1(&v1[index]); + CCTK_REAL const DiffMinus1v1 = DiffMinus1(&v1[index]); + CCTK_REAL const DiffPlus1v2 = DiffPlus1(&v2[index]); + CCTK_REAL const DiffMinus1v2 = DiffMinus1(&v2[index]); + CCTK_REAL const DiffPlus1v3 = DiffPlus1(&v3[index]); + CCTK_REAL const DiffMinus1v3 = DiffMinus1(&v3[index]); + + /* Calculate temporaries and grid functions */ + CCTK_REAL slopeL = DiffMinus1rho; + + CCTK_REAL slopeR = DiffPlus1rho; + + CCTK_REAL slope = VanLeer(slopeL,slopeR); + + CCTK_REAL rhoLeftL = rhoL - 0.5*slope; + + CCTK_REAL rhoRightL = rhoL + 0.5*slope; + + slopeL = DiffMinus1v1; + + slopeR = DiffPlus1v1; + + slope = VanLeer(slopeL,slopeR); + + CCTK_REAL vLeft1L = v1L - 0.5*slope; + + CCTK_REAL vRight1L = v1L + 0.5*slope; + + slopeL = DiffMinus1v2; + + slopeR = DiffPlus1v2; + + slope = VanLeer(slopeL,slopeR); + + CCTK_REAL vLeft2L = v2L - 0.5*slope; + + CCTK_REAL vRight2L = v2L + 0.5*slope; + + slopeL = DiffMinus1v3; + + slopeR = DiffPlus1v3; + + slope = VanLeer(slopeL,slopeR); + + CCTK_REAL vLeft3L = v3L - 0.5*slope; + + CCTK_REAL vRight3L = v3L + 0.5*slope; + + slopeL = DiffMinus1p; + + slopeR = DiffPlus1p; + + slope = VanLeer(slopeL,slopeR); + + CCTK_REAL pLeftL = pL - 0.5*slope; + + CCTK_REAL pRightL = pL + 0.5*slope; + + /* Copy local copies back to grid functions */ + pLeft[index] = pLeftL; + pRight[index] = pRightL; + rhoLeft[index] = rhoLeftL; + rhoRight[index] = rhoRightL; + vLeft1[index] = vLeft1L; + vLeft2[index] = vLeft2L; + vLeft3[index] = vLeft3L; + vRight1[index] = vRight1L; + vRight2[index] = vRight2L; + vRight3[index] = vRight3L; + } + CCTK_ENDLOOP3 (euler_reconstruct_1); +} + +extern "C" void euler_reconstruct_1(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering euler_reconstruct_1_Body"); + } + + if (cctk_iteration % euler_reconstruct_1_calc_every != euler_reconstruct_1_calc_offset) + { + return; + } + + const char *groups[] = {"Euler::p_group","Euler::pLeft_group","Euler::pRight_group","Euler::rho_group","Euler::rhoLeft_group","Euler::rhoRight_group","Euler::v_group","Euler::vLeft_group","Euler::vRight_group"}; + GenericFD_AssertGroupStorage(cctkGH, "euler_reconstruct_1", 9, groups); + + GenericFD_EnsureStencilFits(cctkGH, "euler_reconstruct_1", 1, 1, 1); + + GenericFD_LoopOverInterior(cctkGH, &euler_reconstruct_1_Body); + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Leaving euler_reconstruct_1_Body"); + } +} diff --git a/Examples/Euler/src/euler_rhs_1.cc b/Examples/Euler/src/euler_rhs_1.cc new file mode 100644 index 0000000..fa611a2 --- /dev/null +++ b/Examples/Euler/src/euler_rhs_1.cc @@ -0,0 +1,191 @@ +/* File produced by Kranc */ + +#define KRANC_C + +#include <assert.h> +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include "cctk.h" +#include "cctk_Arguments.h" +#include "cctk_Parameters.h" +#include "GenericFD.h" +#include "Differencing.h" +#include "cctk_Loop.h" +#include "loopcontrol.h" + +/* Define macros used in calculations */ +#define INITVALUE (42) +#define QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +extern "C" void euler_rhs_1_SelectBCs(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT ierr = 0; + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "Euler::Den_grouprhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for Euler::Den_grouprhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "Euler::En_grouprhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for Euler::En_grouprhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "Euler::S_grouprhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for Euler::S_grouprhs."); + return; +} + +static void euler_rhs_1_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const imin[3], int const imax[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const cdi = sizeof(CCTK_REAL) * di; + ptrdiff_t const cdj = sizeof(CCTK_REAL) * dj; + ptrdiff_t const cdk = sizeof(CCTK_REAL) * dk; + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dt = ToReal(CCTK_DELTA_TIME); + CCTK_REAL const t = ToReal(cctk_time); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o1 = 1; + CCTK_REAL const p1o12dx = 0.0833333333333333333333333333333*INV(dx); + CCTK_REAL const p1o12dy = 0.0833333333333333333333333333333*INV(dy); + CCTK_REAL const p1o12dz = 0.0833333333333333333333333333333*INV(dz); + CCTK_REAL const p1o144dxdy = 0.00694444444444444444444444444444*INV(dx)*INV(dy); + CCTK_REAL const p1o144dxdz = 0.00694444444444444444444444444444*INV(dx)*INV(dz); + CCTK_REAL const p1o144dydz = 0.00694444444444444444444444444444*INV(dy)*INV(dz); + CCTK_REAL const p1o2dx = 0.5*INV(dx); + CCTK_REAL const p1o2dy = 0.5*INV(dy); + CCTK_REAL const p1o2dz = 0.5*INV(dz); + CCTK_REAL const p1o4dxdy = 0.25*INV(dx)*INV(dy); + CCTK_REAL const p1o4dxdz = 0.25*INV(dx)*INV(dz); + CCTK_REAL const p1o4dydz = 0.25*INV(dy)*INV(dz); + CCTK_REAL const p1odx = INV(dx); + CCTK_REAL const p1odx2 = INV(SQR(dx)); + CCTK_REAL const p1ody = INV(dy); + CCTK_REAL const p1ody2 = INV(SQR(dy)); + CCTK_REAL const p1odz = INV(dz); + CCTK_REAL const p1odz2 = INV(SQR(dz)); + CCTK_REAL const pm1o12dx2 = -0.0833333333333333333333333333333*INV(SQR(dx)); + CCTK_REAL const pm1o12dy2 = -0.0833333333333333333333333333333*INV(SQR(dy)); + CCTK_REAL const pm1o12dz2 = -0.0833333333333333333333333333333*INV(SQR(dz)); + CCTK_REAL const pm1o2dx = -0.5*INV(dx); + CCTK_REAL const pm1o2dy = -0.5*INV(dy); + CCTK_REAL const pm1o2dz = -0.5*INV(dz); + + /* Assign local copies of arrays functions */ + + + + /* Calculate temporaries and arrays functions */ + + /* Copy local copies back to grid functions */ + + /* Loop over the grid points */ + #pragma omp parallel + CCTK_LOOP3 (euler_rhs_1, + i,j,k, imin[0],imin[1],imin[2], imax[0],imax[1],imax[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + + CCTK_REAL DenFL = DenF[index]; + CCTK_REAL DenrhsL = Denrhs[index]; + CCTK_REAL EnFL = EnF[index]; + CCTK_REAL EnrhsL = Enrhs[index]; + CCTK_REAL S1rhsL = S1rhs[index]; + CCTK_REAL S2rhsL = S2rhs[index]; + CCTK_REAL S3rhsL = S3rhs[index]; + CCTK_REAL SF1L = SF1[index]; + CCTK_REAL SF2L = SF2[index]; + CCTK_REAL SF3L = SF3[index]; + + + /* Include user supplied include files */ + + /* Precompute derivatives */ + CCTK_REAL const PDplus1DenF = PDplus1(&DenF[index]); + CCTK_REAL const PDplus1EnF = PDplus1(&EnF[index]); + CCTK_REAL const PDplus1SF1 = PDplus1(&SF1[index]); + CCTK_REAL const PDplus1SF2 = PDplus1(&SF2[index]); + CCTK_REAL const PDplus1SF3 = PDplus1(&SF3[index]); + + /* Calculate temporaries and grid functions */ + DenrhsL = DenrhsL - PDplus1DenF; + + S1rhsL = S1rhsL - PDplus1SF1; + + S2rhsL = S2rhsL - PDplus1SF2; + + S3rhsL = S3rhsL - PDplus1SF3; + + EnrhsL = EnrhsL - PDplus1EnF; + + /* Copy local copies back to grid functions */ + Denrhs[index] = DenrhsL; + Enrhs[index] = EnrhsL; + S1rhs[index] = S1rhsL; + S2rhs[index] = S2rhsL; + S3rhs[index] = S3rhsL; + } + CCTK_ENDLOOP3 (euler_rhs_1); +} + +extern "C" void euler_rhs_1(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering euler_rhs_1_Body"); + } + + if (cctk_iteration % euler_rhs_1_calc_every != euler_rhs_1_calc_offset) + { + return; + } + + const char *groups[] = {"Euler::DenF_group","Euler::Den_grouprhs","Euler::EnF_group","Euler::En_grouprhs","Euler::SF_group","Euler::S_grouprhs"}; + GenericFD_AssertGroupStorage(cctkGH, "euler_rhs_1", 6, groups); + + GenericFD_EnsureStencilFits(cctkGH, "euler_rhs_1", 1, 1, 1); + + GenericFD_LoopOverInterior(cctkGH, &euler_rhs_1_Body); + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Leaving euler_rhs_1_Body"); + } +} diff --git a/Examples/Euler/src/euler_zero_rhs.cc b/Examples/Euler/src/euler_zero_rhs.cc new file mode 100644 index 0000000..b5371b0 --- /dev/null +++ b/Examples/Euler/src/euler_zero_rhs.cc @@ -0,0 +1,157 @@ +/* File produced by Kranc */ + +#define KRANC_C + +#include <assert.h> +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include "cctk.h" +#include "cctk_Arguments.h" +#include "cctk_Parameters.h" +#include "GenericFD.h" +#include "Differencing.h" +#include "cctk_Loop.h" +#include "loopcontrol.h" + +/* Define macros used in calculations */ +#define INITVALUE (42) +#define QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +static void euler_zero_rhs_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const imin[3], int const imax[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const cdi = sizeof(CCTK_REAL) * di; + ptrdiff_t const cdj = sizeof(CCTK_REAL) * dj; + ptrdiff_t const cdk = sizeof(CCTK_REAL) * dk; + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dt = ToReal(CCTK_DELTA_TIME); + CCTK_REAL const t = ToReal(cctk_time); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o1 = 1; + CCTK_REAL const p1o12dx = 0.0833333333333333333333333333333*INV(dx); + CCTK_REAL const p1o12dy = 0.0833333333333333333333333333333*INV(dy); + CCTK_REAL const p1o12dz = 0.0833333333333333333333333333333*INV(dz); + CCTK_REAL const p1o144dxdy = 0.00694444444444444444444444444444*INV(dx)*INV(dy); + CCTK_REAL const p1o144dxdz = 0.00694444444444444444444444444444*INV(dx)*INV(dz); + CCTK_REAL const p1o144dydz = 0.00694444444444444444444444444444*INV(dy)*INV(dz); + CCTK_REAL const p1o2dx = 0.5*INV(dx); + CCTK_REAL const p1o2dy = 0.5*INV(dy); + CCTK_REAL const p1o2dz = 0.5*INV(dz); + CCTK_REAL const p1o4dxdy = 0.25*INV(dx)*INV(dy); + CCTK_REAL const p1o4dxdz = 0.25*INV(dx)*INV(dz); + CCTK_REAL const p1o4dydz = 0.25*INV(dy)*INV(dz); + CCTK_REAL const p1odx = INV(dx); + CCTK_REAL const p1odx2 = INV(SQR(dx)); + CCTK_REAL const p1ody = INV(dy); + CCTK_REAL const p1ody2 = INV(SQR(dy)); + CCTK_REAL const p1odz = INV(dz); + CCTK_REAL const p1odz2 = INV(SQR(dz)); + CCTK_REAL const pm1o12dx2 = -0.0833333333333333333333333333333*INV(SQR(dx)); + CCTK_REAL const pm1o12dy2 = -0.0833333333333333333333333333333*INV(SQR(dy)); + CCTK_REAL const pm1o12dz2 = -0.0833333333333333333333333333333*INV(SQR(dz)); + CCTK_REAL const pm1o2dx = -0.5*INV(dx); + CCTK_REAL const pm1o2dy = -0.5*INV(dy); + CCTK_REAL const pm1o2dz = -0.5*INV(dz); + + /* Assign local copies of arrays functions */ + + + + /* Calculate temporaries and arrays functions */ + + /* Copy local copies back to grid functions */ + + /* Loop over the grid points */ + #pragma omp parallel + CCTK_LOOP3 (euler_zero_rhs, + i,j,k, imin[0],imin[1],imin[2], imax[0],imax[1],imax[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + + + + /* Include user supplied include files */ + + /* Precompute derivatives */ + + /* Calculate temporaries and grid functions */ + CCTK_REAL DenrhsL = 0; + + CCTK_REAL S1rhsL = 0; + + CCTK_REAL S2rhsL = 0; + + CCTK_REAL S3rhsL = 0; + + CCTK_REAL EnrhsL = 0; + + /* Copy local copies back to grid functions */ + Denrhs[index] = DenrhsL; + Enrhs[index] = EnrhsL; + S1rhs[index] = S1rhsL; + S2rhs[index] = S2rhsL; + S3rhs[index] = S3rhsL; + } + CCTK_ENDLOOP3 (euler_zero_rhs); +} + +extern "C" void euler_zero_rhs(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering euler_zero_rhs_Body"); + } + + if (cctk_iteration % euler_zero_rhs_calc_every != euler_zero_rhs_calc_offset) + { + return; + } + + const char *groups[] = {"Euler::Den_grouprhs","Euler::En_grouprhs","Euler::S_grouprhs"}; + GenericFD_AssertGroupStorage(cctkGH, "euler_zero_rhs", 3, groups); + + + GenericFD_LoopOverEverything(cctkGH, &euler_zero_rhs_Body); + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Leaving euler_zero_rhs_Body"); + } +} diff --git a/Examples/Euler/src/make.code.defn b/Examples/Euler/src/make.code.defn new file mode 100644 index 0000000..4081620 --- /dev/null +++ b/Examples/Euler/src/make.code.defn @@ -0,0 +1,3 @@ +# File produced by Kranc + +SRCS = Startup.cc RegisterMoL.cc RegisterSymmetries.cc euler_initial_shock.cc euler_primitives.cc euler_conserved.cc euler_zero_rhs.cc euler_reconstruct_1.cc euler_conserved_flux_1.cc euler_flux_1.cc euler_rhs_1.cc Boundaries.cc |