diff options
author | Erik Schnetter <schnetter@cct.lsu.edu> | 2009-09-15 06:55:37 -0700 |
---|---|---|
committer | Erik Schnetter <schnetter@cct.lsu.edu> | 2009-09-15 06:55:37 -0700 |
commit | e27d340ad64bd380e95bde29472e423718aca06d (patch) | |
tree | 9375a84915f83704011a6a5b48e855cef4acffb1 /ML_WaveToyFO | |
parent | a52abf35db4c68c5e28e8ce9b00b394c4ea382ee (diff) |
Rename FOWaveToy to WaveToyFO
Diffstat (limited to 'ML_WaveToyFO')
-rw-r--r-- | ML_WaveToyFO/configuration.ccl | 4 | ||||
-rw-r--r-- | ML_WaveToyFO/interface.ccl | 73 | ||||
-rw-r--r-- | ML_WaveToyFO/param.ccl | 316 | ||||
-rw-r--r-- | ML_WaveToyFO/schedule.ccl | 120 | ||||
-rw-r--r-- | ML_WaveToyFO/src/Boundaries.c | 457 | ||||
-rw-r--r-- | ML_WaveToyFO/src/Differencing.h | 12 | ||||
-rw-r--r-- | ML_WaveToyFO/src/RegisterMoL.c | 21 | ||||
-rw-r--r-- | ML_WaveToyFO/src/RegisterSymmetries.c | 59 | ||||
-rw-r--r-- | ML_WaveToyFO/src/Startup.c | 10 | ||||
-rw-r--r-- | ML_WaveToyFO/src/WTFO_Gaussian.c | 147 | ||||
-rw-r--r-- | ML_WaveToyFO/src/WTFO_RHS.c | 163 | ||||
-rw-r--r-- | ML_WaveToyFO/src/WTFO_constraints.c | 155 | ||||
-rw-r--r-- | ML_WaveToyFO/src/make.code.defn | 3 |
13 files changed, 1540 insertions, 0 deletions
diff --git a/ML_WaveToyFO/configuration.ccl b/ML_WaveToyFO/configuration.ccl new file mode 100644 index 0000000..8e2c3c5 --- /dev/null +++ b/ML_WaveToyFO/configuration.ccl @@ -0,0 +1,4 @@ +# File produced by Kranc + +REQUIRES GenericFD +REQUIRES LoopControl diff --git a/ML_WaveToyFO/interface.ccl b/ML_WaveToyFO/interface.ccl new file mode 100644 index 0000000..a9f7ff5 --- /dev/null +++ b/ML_WaveToyFO/interface.ccl @@ -0,0 +1,73 @@ +# File produced by Kranc + +implements: ML_WaveToyFO + +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 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 WT_w type=GF timelevels=1 tags='tensortypealias="U" tensorweight=1.0000000000000000000' +{ + w1, + w2, + w3 +} "WT_w" + +public: +CCTK_REAL WT_rho type=GF timelevels=2 tags='tensortypealias="Scalar" tensorweight=1.0000000000000000000' +{ + rho +} "WT_rho" + +public: +CCTK_REAL WT_u type=GF timelevels=2 tags='tensortypealias="Scalar" tensorweight=1.0000000000000000000' +{ + u +} "WT_u" + +public: +CCTK_REAL WT_v type=GF timelevels=2 tags='tensortypealias="D" tensorweight=1.0000000000000000000' +{ + v1, + v2, + v3 +} "WT_v" + +public: +CCTK_REAL WT_rhorhs type=GF timelevels=2 tags='tensortypealias="Scalar" tensorweight=1.0000000000000000000' +{ + rhorhs +} "WT_rhorhs" + +public: +CCTK_REAL WT_urhs type=GF timelevels=2 tags='tensortypealias="Scalar" tensorweight=1.0000000000000000000' +{ + urhs +} "WT_urhs" + +public: +CCTK_REAL WT_vrhs type=GF timelevels=2 tags='tensortypealias="D" tensorweight=1.0000000000000000000' +{ + v1rhs, + v2rhs, + v3rhs +} "WT_vrhs" diff --git a/ML_WaveToyFO/param.ccl b/ML_WaveToyFO/param.ccl new file mode 100644 index 0000000..a75f0b5 --- /dev/null +++ b/ML_WaveToyFO/param.ccl @@ -0,0 +1,316 @@ +# File produced by Kranc + + +shares: GenericFD + +USES CCTK_INT stencil_width +USES CCTK_INT stencil_width_x +USES CCTK_INT stencil_width_y +USES CCTK_INT stencil_width_z +USES CCTK_INT boundary_width + + +shares: MethodOfLines + +USES CCTK_INT MoL_Num_Evolved_Vars + +restricted: +CCTK_INT verbose "verbose" +{ + *:* :: "" +} 0 + +restricted: +CCTK_INT ML_WaveToyFO_MaxNumEvolvedVars "Number of evolved variables used by this thorn" ACCUMULATOR-BASE=MethodofLines::MoL_Num_Evolved_Vars +{ + 5:5 :: "Number of evolved variables used by this thorn" +} 5 + +restricted: +CCTK_INT timelevels "Number of active timelevels" +{ + 0:2 :: "" +} 2 + +restricted: +CCTK_INT rhs_timelevels "Number of active RHS timelevels" +{ + 0:2 :: "" +} 1 + +restricted: +CCTK_INT WTFO_Gaussian_calc_every "WTFO_Gaussian_calc_every" +{ + *:* :: "" +} 1 + +restricted: +CCTK_INT WTFO_RHS_calc_every "WTFO_RHS_calc_every" +{ + *:* :: "" +} 1 + +restricted: +CCTK_INT WTFO_constraints_calc_every "WTFO_constraints_calc_every" +{ + *:* :: "" +} 1 + +restricted: +CCTK_INT WTFO_Gaussian_calc_offset "WTFO_Gaussian_calc_offset" +{ + *:* :: "" +} 0 + +restricted: +CCTK_INT WTFO_RHS_calc_offset "WTFO_RHS_calc_offset" +{ + *:* :: "" +} 0 + +restricted: +CCTK_INT WTFO_constraints_calc_offset "WTFO_constraints_calc_offset" +{ + *:* :: "" +} 0 + +private: +KEYWORD rho_bound "Boundary condition to implement" +{ + "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 u_bound "Boundary condition to implement" +{ + "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 v1_bound "Boundary condition to implement" +{ + "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 v2_bound "Boundary condition to implement" +{ + "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 v3_bound "Boundary condition to implement" +{ + "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 WT_rho_bound "Boundary condition to implement" +{ + "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 WT_u_bound "Boundary condition to implement" +{ + "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 WT_v_bound "Boundary condition to implement" +{ + "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: +CCTK_REAL rho_bound_speed "characteristic speed at boundary" +{ + "0:*" :: "outgoing characteristic speed > 0" +} 1. + +private: +CCTK_REAL u_bound_speed "characteristic speed at boundary" +{ + "0:*" :: "outgoing characteristic speed > 0" +} 1. + +private: +CCTK_REAL v1_bound_speed "characteristic speed at boundary" +{ + "0:*" :: "outgoing characteristic speed > 0" +} 1. + +private: +CCTK_REAL v2_bound_speed "characteristic speed at boundary" +{ + "0:*" :: "outgoing characteristic speed > 0" +} 1. + +private: +CCTK_REAL v3_bound_speed "characteristic speed at boundary" +{ + "0:*" :: "outgoing characteristic speed > 0" +} 1. + +private: +CCTK_REAL WT_rho_bound_speed "characteristic speed at boundary" +{ + "0:*" :: "outgoing characteristic speed > 0" +} 1. + +private: +CCTK_REAL WT_u_bound_speed "characteristic speed at boundary" +{ + "0:*" :: "outgoing characteristic speed > 0" +} 1. + +private: +CCTK_REAL WT_v_bound_speed "characteristic speed at boundary" +{ + "0:*" :: "outgoing characteristic speed > 0" +} 1. + +private: +CCTK_REAL rho_bound_limit "limit value for r -> infinity" +{ + "*:*" :: "value of limit value is unrestricted" +} 0. + +private: +CCTK_REAL u_bound_limit "limit value for r -> infinity" +{ + "*:*" :: "value of limit value is unrestricted" +} 0. + +private: +CCTK_REAL v1_bound_limit "limit value for r -> infinity" +{ + "*:*" :: "value of limit value is unrestricted" +} 0. + +private: +CCTK_REAL v2_bound_limit "limit value for r -> infinity" +{ + "*:*" :: "value of limit value is unrestricted" +} 0. + +private: +CCTK_REAL v3_bound_limit "limit value for r -> infinity" +{ + "*:*" :: "value of limit value is unrestricted" +} 0. + +private: +CCTK_REAL WT_rho_bound_limit "limit value for r -> infinity" +{ + "*:*" :: "value of limit value is unrestricted" +} 0. + +private: +CCTK_REAL WT_u_bound_limit "limit value for r -> infinity" +{ + "*:*" :: "value of limit value is unrestricted" +} 0. + +private: +CCTK_REAL WT_v_bound_limit "limit value for r -> infinity" +{ + "*:*" :: "value of limit value is unrestricted" +} 0. + +private: +CCTK_REAL rho_bound_scalar "Dirichlet boundary value" +{ + "*:*" :: "unrestricted" +} 0. + +private: +CCTK_REAL u_bound_scalar "Dirichlet boundary value" +{ + "*:*" :: "unrestricted" +} 0. + +private: +CCTK_REAL v1_bound_scalar "Dirichlet boundary value" +{ + "*:*" :: "unrestricted" +} 0. + +private: +CCTK_REAL v2_bound_scalar "Dirichlet boundary value" +{ + "*:*" :: "unrestricted" +} 0. + +private: +CCTK_REAL v3_bound_scalar "Dirichlet boundary value" +{ + "*:*" :: "unrestricted" +} 0. + +private: +CCTK_REAL WT_rho_bound_scalar "Dirichlet boundary value" +{ + "*:*" :: "unrestricted" +} 0. + +private: +CCTK_REAL WT_u_bound_scalar "Dirichlet boundary value" +{ + "*:*" :: "unrestricted" +} 0. + +private: +CCTK_REAL WT_v_bound_scalar "Dirichlet boundary value" +{ + "*:*" :: "unrestricted" +} 0. + diff --git a/ML_WaveToyFO/schedule.ccl b/ML_WaveToyFO/schedule.ccl new file mode 100644 index 0000000..4aea873 --- /dev/null +++ b/ML_WaveToyFO/schedule.ccl @@ -0,0 +1,120 @@ +# File produced by Kranc + + +STORAGE: WT_w[1] + +if (timelevels == 1) +{ + STORAGE: WT_rho[1] +} +if (timelevels == 2) +{ + STORAGE: WT_rho[2] +} + +if (timelevels == 1) +{ + STORAGE: WT_u[1] +} +if (timelevels == 2) +{ + STORAGE: WT_u[2] +} + +if (timelevels == 1) +{ + STORAGE: WT_v[1] +} +if (timelevels == 2) +{ + STORAGE: WT_v[2] +} + +if (rhs_timelevels == 1) +{ + STORAGE: WT_rhorhs[1] +} +if (rhs_timelevels == 2) +{ + STORAGE: WT_rhorhs[2] +} + +if (rhs_timelevels == 1) +{ + STORAGE: WT_urhs[1] +} +if (rhs_timelevels == 2) +{ + STORAGE: WT_urhs[2] +} + +if (rhs_timelevels == 1) +{ + STORAGE: WT_vrhs[1] +} +if (rhs_timelevels == 2) +{ + STORAGE: WT_vrhs[2] +} + +schedule ML_WaveToyFO_Startup at STARTUP +{ + LANG: C + OPTIONS: meta +} "create banner" + +schedule ML_WaveToyFO_RegisterVars in MoL_Register +{ + LANG: C + OPTIONS: meta +} "Register Variables for MoL" + +schedule ML_WaveToyFO_RegisterSymmetries in SymmetryRegister +{ + LANG: C + OPTIONS: meta +} "register symmetries" + +schedule WTFO_Gaussian AT initial +{ + LANG: C +} "WTFO_Gaussian" + +schedule WTFO_RHS IN MoL_CalcRHS +{ + LANG: C +} "WTFO_RHS" + +schedule WTFO_RHS AT analysis +{ + LANG: C + SYNC: WT_rhorhs + SYNC: WT_urhs + SYNC: WT_vrhs +} "WTFO_RHS" + +schedule WTFO_constraints AT analysis +{ + LANG: C + SYNC: WT_w +} "WTFO_constraints" + +schedule ML_WaveToyFO_ApplyBoundConds in MoL_PostStep +{ + LANG: C + OPTIONS: level + SYNC: WT_rho + SYNC: WT_u + SYNC: WT_v +} "apply boundary conditions" + +schedule ML_WaveToyFO_CheckBoundaries at BASEGRID +{ + LANG: C + OPTIONS: meta +} "check boundaries treatment" + +schedule group ApplyBCs as ML_WaveToyFO_ApplyBCs in MoL_PostStep after ML_WaveToyFO_ApplyBoundConds +{ + # no language specified +} "Apply boundary conditions controlled by thorn Boundary" diff --git a/ML_WaveToyFO/src/Boundaries.c b/ML_WaveToyFO/src/Boundaries.c new file mode 100644 index 0000000..6c25491 --- /dev/null +++ b/ML_WaveToyFO/src/Boundaries.c @@ -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 */ + + +void ML_WaveToyFO_CheckBoundaries(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + return; +} + +void ML_WaveToyFO_ApplyBoundConds(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT ierr = 0; + + if (CCTK_EQUALS(WT_rho_bound, "none" ) || + CCTK_EQUALS(WT_rho_bound, "static") || + CCTK_EQUALS(WT_rho_bound, "flat" ) || + CCTK_EQUALS(WT_rho_bound, "zero" ) ) + { + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_WaveToyFO::WT_rho", WT_rho_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register WT_rho_bound BC for ML_WaveToyFO::WT_rho!"); + } + + if (CCTK_EQUALS(WT_u_bound, "none" ) || + CCTK_EQUALS(WT_u_bound, "static") || + CCTK_EQUALS(WT_u_bound, "flat" ) || + CCTK_EQUALS(WT_u_bound, "zero" ) ) + { + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_WaveToyFO::WT_u", WT_u_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register WT_u_bound BC for ML_WaveToyFO::WT_u!"); + } + + if (CCTK_EQUALS(WT_v_bound, "none" ) || + CCTK_EQUALS(WT_v_bound, "static") || + CCTK_EQUALS(WT_v_bound, "flat" ) || + CCTK_EQUALS(WT_v_bound, "zero" ) ) + { + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_WaveToyFO::WT_v", WT_v_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register WT_v_bound BC for ML_WaveToyFO::WT_v!"); + } + + if (CCTK_EQUALS(rho_bound, "none" ) || + CCTK_EQUALS(rho_bound, "static") || + CCTK_EQUALS(rho_bound, "flat" ) || + CCTK_EQUALS(rho_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_WaveToyFO::rho", rho_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register rho_bound BC for ML_WaveToyFO::rho!"); + } + + if (CCTK_EQUALS(u_bound, "none" ) || + CCTK_EQUALS(u_bound, "static") || + CCTK_EQUALS(u_bound, "flat" ) || + CCTK_EQUALS(u_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_WaveToyFO::u", u_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register u_bound BC for ML_WaveToyFO::u!"); + } + + if (CCTK_EQUALS(v1_bound, "none" ) || + CCTK_EQUALS(v1_bound, "static") || + CCTK_EQUALS(v1_bound, "flat" ) || + CCTK_EQUALS(v1_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_WaveToyFO::v1", v1_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register v1_bound BC for ML_WaveToyFO::v1!"); + } + + if (CCTK_EQUALS(v2_bound, "none" ) || + CCTK_EQUALS(v2_bound, "static") || + CCTK_EQUALS(v2_bound, "flat" ) || + CCTK_EQUALS(v2_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_WaveToyFO::v2", v2_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register v2_bound BC for ML_WaveToyFO::v2!"); + } + + if (CCTK_EQUALS(v3_bound, "none" ) || + CCTK_EQUALS(v3_bound, "static") || + CCTK_EQUALS(v3_bound, "flat" ) || + CCTK_EQUALS(v3_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_WaveToyFO::v3", v3_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register v3_bound BC for ML_WaveToyFO::v3!"); + } + + if (CCTK_EQUALS(WT_rho_bound, "radiative")) + { + /* apply radiation boundary condition */ + static CCTK_INT handle_WT_rho_bound = -1; + if (handle_WT_rho_bound < 0) handle_WT_rho_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_WT_rho_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_WT_rho_bound , WT_rho_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_WT_rho_bound ,WT_rho_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_WT_rho_bound, + "ML_WaveToyFO::WT_rho", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_WaveToyFO::WT_rho!"); + + } + + if (CCTK_EQUALS(WT_u_bound, "radiative")) + { + /* apply radiation boundary condition */ + static CCTK_INT handle_WT_u_bound = -1; + if (handle_WT_u_bound < 0) handle_WT_u_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_WT_u_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_WT_u_bound , WT_u_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_WT_u_bound ,WT_u_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_WT_u_bound, + "ML_WaveToyFO::WT_u", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_WaveToyFO::WT_u!"); + + } + + if (CCTK_EQUALS(WT_v_bound, "radiative")) + { + /* apply radiation boundary condition */ + static CCTK_INT handle_WT_v_bound = -1; + if (handle_WT_v_bound < 0) handle_WT_v_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_WT_v_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_WT_v_bound , WT_v_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_WT_v_bound ,WT_v_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_WT_v_bound, + "ML_WaveToyFO::WT_v", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_WaveToyFO::WT_v!"); + + } + + if (CCTK_EQUALS(rho_bound, "radiative")) + { + /* apply radiation boundary condition */ + static CCTK_INT handle_rho_bound = -1; + if (handle_rho_bound < 0) handle_rho_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_rho_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_rho_bound , rho_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_rho_bound ,rho_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_rho_bound, + "ML_WaveToyFO::rho", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_WaveToyFO::rho!"); + + } + + if (CCTK_EQUALS(u_bound, "radiative")) + { + /* apply radiation boundary condition */ + static CCTK_INT handle_u_bound = -1; + if (handle_u_bound < 0) handle_u_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_u_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_u_bound , u_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_u_bound ,u_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_u_bound, + "ML_WaveToyFO::u", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_WaveToyFO::u!"); + + } + + if (CCTK_EQUALS(v1_bound, "radiative")) + { + /* apply radiation boundary condition */ + static CCTK_INT handle_v1_bound = -1; + if (handle_v1_bound < 0) handle_v1_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_v1_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_v1_bound , v1_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_v1_bound ,v1_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_v1_bound, + "ML_WaveToyFO::v1", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_WaveToyFO::v1!"); + + } + + if (CCTK_EQUALS(v2_bound, "radiative")) + { + /* apply radiation boundary condition */ + static CCTK_INT handle_v2_bound = -1; + if (handle_v2_bound < 0) handle_v2_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_v2_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_v2_bound , v2_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_v2_bound ,v2_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_v2_bound, + "ML_WaveToyFO::v2", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_WaveToyFO::v2!"); + + } + + if (CCTK_EQUALS(v3_bound, "radiative")) + { + /* apply radiation boundary condition */ + static CCTK_INT handle_v3_bound = -1; + if (handle_v3_bound < 0) handle_v3_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_v3_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_v3_bound , v3_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_v3_bound ,v3_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_v3_bound, + "ML_WaveToyFO::v3", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_WaveToyFO::v3!"); + + } + + if (CCTK_EQUALS(WT_rho_bound, "scalar")) + { + /* apply scalar boundary condition */ + static CCTK_INT handle_WT_rho_bound = -1; + if (handle_WT_rho_bound < 0) handle_WT_rho_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_WT_rho_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_WT_rho_bound ,WT_rho_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_WT_rho_bound, + "ML_WaveToyFO::WT_rho", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Scalar BC for ML_WaveToyFO::WT_rho!"); + + } + + if (CCTK_EQUALS(WT_u_bound, "scalar")) + { + /* apply scalar boundary condition */ + static CCTK_INT handle_WT_u_bound = -1; + if (handle_WT_u_bound < 0) handle_WT_u_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_WT_u_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_WT_u_bound ,WT_u_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_WT_u_bound, + "ML_WaveToyFO::WT_u", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Scalar BC for ML_WaveToyFO::WT_u!"); + + } + + if (CCTK_EQUALS(WT_v_bound, "scalar")) + { + /* apply scalar boundary condition */ + static CCTK_INT handle_WT_v_bound = -1; + if (handle_WT_v_bound < 0) handle_WT_v_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_WT_v_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_WT_v_bound ,WT_v_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_WT_v_bound, + "ML_WaveToyFO::WT_v", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Scalar BC for ML_WaveToyFO::WT_v!"); + + } + + if (CCTK_EQUALS(rho_bound, "scalar")) + { + /* apply scalar boundary condition */ + static CCTK_INT handle_rho_bound = -1; + if (handle_rho_bound < 0) handle_rho_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_rho_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_rho_bound ,rho_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_rho_bound, + "ML_WaveToyFO::rho", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_WaveToyFO::rho!"); + + } + + if (CCTK_EQUALS(u_bound, "scalar")) + { + /* apply scalar boundary condition */ + static CCTK_INT handle_u_bound = -1; + if (handle_u_bound < 0) handle_u_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_u_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_u_bound ,u_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_u_bound, + "ML_WaveToyFO::u", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_WaveToyFO::u!"); + + } + + if (CCTK_EQUALS(v1_bound, "scalar")) + { + /* apply scalar boundary condition */ + static CCTK_INT handle_v1_bound = -1; + if (handle_v1_bound < 0) handle_v1_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_v1_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_v1_bound ,v1_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_v1_bound, + "ML_WaveToyFO::v1", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_WaveToyFO::v1!"); + + } + + if (CCTK_EQUALS(v2_bound, "scalar")) + { + /* apply scalar boundary condition */ + static CCTK_INT handle_v2_bound = -1; + if (handle_v2_bound < 0) handle_v2_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_v2_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_v2_bound ,v2_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_v2_bound, + "ML_WaveToyFO::v2", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_WaveToyFO::v2!"); + + } + + if (CCTK_EQUALS(v3_bound, "scalar")) + { + /* apply scalar boundary condition */ + static CCTK_INT handle_v3_bound = -1; + if (handle_v3_bound < 0) handle_v3_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_v3_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_v3_bound ,v3_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_v3_bound, + "ML_WaveToyFO::v3", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_WaveToyFO::v3!"); + + } + return; +} + + + +/* template for entries in parameter file: +#$bound$#ML_WaveToyFO::WT_rho_bound = "skip" +#$bound$#ML_WaveToyFO::WT_rho_bound_speed = 1.0 +#$bound$#ML_WaveToyFO::WT_rho_bound_limit = 0.0 +#$bound$#ML_WaveToyFO::WT_rho_bound_scalar = 0.0 + +#$bound$#ML_WaveToyFO::WT_u_bound = "skip" +#$bound$#ML_WaveToyFO::WT_u_bound_speed = 1.0 +#$bound$#ML_WaveToyFO::WT_u_bound_limit = 0.0 +#$bound$#ML_WaveToyFO::WT_u_bound_scalar = 0.0 + +#$bound$#ML_WaveToyFO::WT_v_bound = "skip" +#$bound$#ML_WaveToyFO::WT_v_bound_speed = 1.0 +#$bound$#ML_WaveToyFO::WT_v_bound_limit = 0.0 +#$bound$#ML_WaveToyFO::WT_v_bound_scalar = 0.0 + +#$bound$#ML_WaveToyFO::rho_bound = "skip" +#$bound$#ML_WaveToyFO::rho_bound_speed = 1.0 +#$bound$#ML_WaveToyFO::rho_bound_limit = 0.0 +#$bound$#ML_WaveToyFO::rho_bound_scalar = 0.0 + +#$bound$#ML_WaveToyFO::u_bound = "skip" +#$bound$#ML_WaveToyFO::u_bound_speed = 1.0 +#$bound$#ML_WaveToyFO::u_bound_limit = 0.0 +#$bound$#ML_WaveToyFO::u_bound_scalar = 0.0 + +#$bound$#ML_WaveToyFO::v1_bound = "skip" +#$bound$#ML_WaveToyFO::v1_bound_speed = 1.0 +#$bound$#ML_WaveToyFO::v1_bound_limit = 0.0 +#$bound$#ML_WaveToyFO::v1_bound_scalar = 0.0 + +#$bound$#ML_WaveToyFO::v2_bound = "skip" +#$bound$#ML_WaveToyFO::v2_bound_speed = 1.0 +#$bound$#ML_WaveToyFO::v2_bound_limit = 0.0 +#$bound$#ML_WaveToyFO::v2_bound_scalar = 0.0 + +#$bound$#ML_WaveToyFO::v3_bound = "skip" +#$bound$#ML_WaveToyFO::v3_bound_speed = 1.0 +#$bound$#ML_WaveToyFO::v3_bound_limit = 0.0 +#$bound$#ML_WaveToyFO::v3_bound_scalar = 0.0 + +*/ + diff --git a/ML_WaveToyFO/src/Differencing.h b/ML_WaveToyFO/src/Differencing.h new file mode 100644 index 0000000..ae119d2 --- /dev/null +++ b/ML_WaveToyFO/src/Differencing.h @@ -0,0 +1,12 @@ +#define PDstandardNth1(u,i,j,k) (p1o12dx*(-8*(u)[CCTK_GFINDEX3D(cctkGH,(int)(-1 + i),(int)(j),(int)(k))] + 8*(u)[CCTK_GFINDEX3D(cctkGH,(int)(1 + i),(int)(j),(int)(k))] + (u)[CCTK_GFINDEX3D(cctkGH,(int)(-2 + i),(int)(j),(int)(k))] - (u)[CCTK_GFINDEX3D(cctkGH,(int)(2 + i),(int)(j),(int)(k))])) +#define PDstandardNth2(u,i,j,k) (p1o12dy*(-8*(u)[CCTK_GFINDEX3D(cctkGH,(int)(i),(int)(-1 + j),(int)(k))] + 8*(u)[CCTK_GFINDEX3D(cctkGH,(int)(i),(int)(1 + j),(int)(k))] + (u)[CCTK_GFINDEX3D(cctkGH,(int)(i),(int)(-2 + j),(int)(k))] - (u)[CCTK_GFINDEX3D(cctkGH,(int)(i),(int)(2 + j),(int)(k))])) +#define PDstandardNth3(u,i,j,k) (p1o12dz*(-8*(u)[CCTK_GFINDEX3D(cctkGH,(int)(i),(int)(j),(int)(-1 + k))] + 8*(u)[CCTK_GFINDEX3D(cctkGH,(int)(i),(int)(j),(int)(1 + k))] + (u)[CCTK_GFINDEX3D(cctkGH,(int)(i),(int)(j),(int)(-2 + k))] - (u)[CCTK_GFINDEX3D(cctkGH,(int)(i),(int)(j),(int)(2 + k))])) +#define PDstandardNth11(u,i,j,k) (pm1o12dx2*(-16*((u)[CCTK_GFINDEX3D(cctkGH,(int)(-1 + i),(int)(j),(int)(k))] + (u)[CCTK_GFINDEX3D(cctkGH,(int)(1 + i),(int)(j),(int)(k))]) + (u)[CCTK_GFINDEX3D(cctkGH,(int)(-2 + i),(int)(j),(int)(k))] + (u)[CCTK_GFINDEX3D(cctkGH,(int)(2 + i),(int)(j),(int)(k))] + 30*(u)[CCTK_GFINDEX3D(cctkGH,(int)(i),(int)(j),(int)(k))])) +#define PDstandardNth22(u,i,j,k) (pm1o12dy2*(-16*((u)[CCTK_GFINDEX3D(cctkGH,(int)(i),(int)(-1 + j),(int)(k))] + (u)[CCTK_GFINDEX3D(cctkGH,(int)(i),(int)(1 + j),(int)(k))]) + (u)[CCTK_GFINDEX3D(cctkGH,(int)(i),(int)(-2 + j),(int)(k))] + (u)[CCTK_GFINDEX3D(cctkGH,(int)(i),(int)(2 + j),(int)(k))] + 30*(u)[CCTK_GFINDEX3D(cctkGH,(int)(i),(int)(j),(int)(k))])) +#define PDstandardNth33(u,i,j,k) (pm1o12dz2*(-16*((u)[CCTK_GFINDEX3D(cctkGH,(int)(i),(int)(j),(int)(-1 + k))] + (u)[CCTK_GFINDEX3D(cctkGH,(int)(i),(int)(j),(int)(1 + k))]) + (u)[CCTK_GFINDEX3D(cctkGH,(int)(i),(int)(j),(int)(-2 + k))] + (u)[CCTK_GFINDEX3D(cctkGH,(int)(i),(int)(j),(int)(2 + k))] + 30*(u)[CCTK_GFINDEX3D(cctkGH,(int)(i),(int)(j),(int)(k))])) +#define PDstandardNth12(u,i,j,k) (p1o144dxdy*(-64*((u)[CCTK_GFINDEX3D(cctkGH,(int)(-1 + i),(int)(1 + j),(int)(k))] + (u)[CCTK_GFINDEX3D(cctkGH,(int)(1 + i),(int)(-1 + j),(int)(k))]) + 64*((u)[CCTK_GFINDEX3D(cctkGH,(int)(-1 + i),(int)(-1 + j),(int)(k))] + (u)[CCTK_GFINDEX3D(cctkGH,(int)(1 + i),(int)(1 + j),(int)(k))]) + 8*((u)[CCTK_GFINDEX3D(cctkGH,(int)(-1 + i),(int)(2 + j),(int)(k))] + (u)[CCTK_GFINDEX3D(cctkGH,(int)(1 + i),(int)(-2 + j),(int)(k))] + (u)[CCTK_GFINDEX3D(cctkGH,(int)(-2 + i),(int)(1 + j),(int)(k))] + (u)[CCTK_GFINDEX3D(cctkGH,(int)(2 + i),(int)(-1 + j),(int)(k))]) - 8*((u)[CCTK_GFINDEX3D(cctkGH,(int)(-1 + i),(int)(-2 + j),(int)(k))] + (u)[CCTK_GFINDEX3D(cctkGH,(int)(1 + i),(int)(2 + j),(int)(k))] + (u)[CCTK_GFINDEX3D(cctkGH,(int)(-2 + i),(int)(-1 + j),(int)(k))] + (u)[CCTK_GFINDEX3D(cctkGH,(int)(2 + i),(int)(1 + j),(int)(k))]) + (u)[CCTK_GFINDEX3D(cctkGH,(int)(-2 + i),(int)(-2 + j),(int)(k))] - (u)[CCTK_GFINDEX3D(cctkGH,(int)(-2 + i),(int)(2 + j),(int)(k))] - (u)[CCTK_GFINDEX3D(cctkGH,(int)(2 + i),(int)(-2 + j),(int)(k))] + (u)[CCTK_GFINDEX3D(cctkGH,(int)(2 + i),(int)(2 + j),(int)(k))])) +#define PDstandardNth13(u,i,j,k) (p1o144dxdz*(-64*((u)[CCTK_GFINDEX3D(cctkGH,(int)(-1 + i),(int)(j),(int)(1 + k))] + (u)[CCTK_GFINDEX3D(cctkGH,(int)(1 + i),(int)(j),(int)(-1 + k))]) + 64*((u)[CCTK_GFINDEX3D(cctkGH,(int)(-1 + i),(int)(j),(int)(-1 + k))] + (u)[CCTK_GFINDEX3D(cctkGH,(int)(1 + i),(int)(j),(int)(1 + k))]) + 8*((u)[CCTK_GFINDEX3D(cctkGH,(int)(-1 + i),(int)(j),(int)(2 + k))] + (u)[CCTK_GFINDEX3D(cctkGH,(int)(1 + i),(int)(j),(int)(-2 + k))] + (u)[CCTK_GFINDEX3D(cctkGH,(int)(-2 + i),(int)(j),(int)(1 + k))] + (u)[CCTK_GFINDEX3D(cctkGH,(int)(2 + i),(int)(j),(int)(-1 + k))]) - 8*((u)[CCTK_GFINDEX3D(cctkGH,(int)(-1 + i),(int)(j),(int)(-2 + k))] + (u)[CCTK_GFINDEX3D(cctkGH,(int)(1 + i),(int)(j),(int)(2 + k))] + (u)[CCTK_GFINDEX3D(cctkGH,(int)(-2 + i),(int)(j),(int)(-1 + k))] + (u)[CCTK_GFINDEX3D(cctkGH,(int)(2 + i),(int)(j),(int)(1 + k))]) + (u)[CCTK_GFINDEX3D(cctkGH,(int)(-2 + i),(int)(j),(int)(-2 + k))] - (u)[CCTK_GFINDEX3D(cctkGH,(int)(-2 + i),(int)(j),(int)(2 + k))] - (u)[CCTK_GFINDEX3D(cctkGH,(int)(2 + i),(int)(j),(int)(-2 + k))] + (u)[CCTK_GFINDEX3D(cctkGH,(int)(2 + i),(int)(j),(int)(2 + k))])) +#define PDstandardNth21(u,i,j,k) (p1o144dxdy*(-64*((u)[CCTK_GFINDEX3D(cctkGH,(int)(-1 + i),(int)(1 + j),(int)(k))] + (u)[CCTK_GFINDEX3D(cctkGH,(int)(1 + i),(int)(-1 + j),(int)(k))]) + 64*((u)[CCTK_GFINDEX3D(cctkGH,(int)(-1 + i),(int)(-1 + j),(int)(k))] + (u)[CCTK_GFINDEX3D(cctkGH,(int)(1 + i),(int)(1 + j),(int)(k))]) + 8*((u)[CCTK_GFINDEX3D(cctkGH,(int)(-1 + i),(int)(2 + j),(int)(k))] + (u)[CCTK_GFINDEX3D(cctkGH,(int)(1 + i),(int)(-2 + j),(int)(k))] + (u)[CCTK_GFINDEX3D(cctkGH,(int)(-2 + i),(int)(1 + j),(int)(k))] + (u)[CCTK_GFINDEX3D(cctkGH,(int)(2 + i),(int)(-1 + j),(int)(k))]) - 8*((u)[CCTK_GFINDEX3D(cctkGH,(int)(-1 + i),(int)(-2 + j),(int)(k))] + (u)[CCTK_GFINDEX3D(cctkGH,(int)(1 + i),(int)(2 + j),(int)(k))] + (u)[CCTK_GFINDEX3D(cctkGH,(int)(-2 + i),(int)(-1 + j),(int)(k))] + (u)[CCTK_GFINDEX3D(cctkGH,(int)(2 + i),(int)(1 + j),(int)(k))]) + (u)[CCTK_GFINDEX3D(cctkGH,(int)(-2 + i),(int)(-2 + j),(int)(k))] - (u)[CCTK_GFINDEX3D(cctkGH,(int)(-2 + i),(int)(2 + j),(int)(k))] - (u)[CCTK_GFINDEX3D(cctkGH,(int)(2 + i),(int)(-2 + j),(int)(k))] + (u)[CCTK_GFINDEX3D(cctkGH,(int)(2 + i),(int)(2 + j),(int)(k))])) +#define PDstandardNth23(u,i,j,k) (p1o144dydz*(-64*((u)[CCTK_GFINDEX3D(cctkGH,(int)(i),(int)(-1 + j),(int)(1 + k))] + (u)[CCTK_GFINDEX3D(cctkGH,(int)(i),(int)(1 + j),(int)(-1 + k))]) + 64*((u)[CCTK_GFINDEX3D(cctkGH,(int)(i),(int)(-1 + j),(int)(-1 + k))] + (u)[CCTK_GFINDEX3D(cctkGH,(int)(i),(int)(1 + j),(int)(1 + k))]) + 8*((u)[CCTK_GFINDEX3D(cctkGH,(int)(i),(int)(-1 + j),(int)(2 + k))] + (u)[CCTK_GFINDEX3D(cctkGH,(int)(i),(int)(1 + j),(int)(-2 + k))] + (u)[CCTK_GFINDEX3D(cctkGH,(int)(i),(int)(-2 + j),(int)(1 + k))] + (u)[CCTK_GFINDEX3D(cctkGH,(int)(i),(int)(2 + j),(int)(-1 + k))]) - 8*((u)[CCTK_GFINDEX3D(cctkGH,(int)(i),(int)(-1 + j),(int)(-2 + k))] + (u)[CCTK_GFINDEX3D(cctkGH,(int)(i),(int)(1 + j),(int)(2 + k))] + (u)[CCTK_GFINDEX3D(cctkGH,(int)(i),(int)(-2 + j),(int)(-1 + k))] + (u)[CCTK_GFINDEX3D(cctkGH,(int)(i),(int)(2 + j),(int)(1 + k))]) + (u)[CCTK_GFINDEX3D(cctkGH,(int)(i),(int)(-2 + j),(int)(-2 + k))] - (u)[CCTK_GFINDEX3D(cctkGH,(int)(i),(int)(-2 + j),(int)(2 + k))] - (u)[CCTK_GFINDEX3D(cctkGH,(int)(i),(int)(2 + j),(int)(-2 + k))] + (u)[CCTK_GFINDEX3D(cctkGH,(int)(i),(int)(2 + j),(int)(2 + k))])) +#define PDstandardNth31(u,i,j,k) (p1o144dxdz*(-64*((u)[CCTK_GFINDEX3D(cctkGH,(int)(-1 + i),(int)(j),(int)(1 + k))] + (u)[CCTK_GFINDEX3D(cctkGH,(int)(1 + i),(int)(j),(int)(-1 + k))]) + 64*((u)[CCTK_GFINDEX3D(cctkGH,(int)(-1 + i),(int)(j),(int)(-1 + k))] + (u)[CCTK_GFINDEX3D(cctkGH,(int)(1 + i),(int)(j),(int)(1 + k))]) + 8*((u)[CCTK_GFINDEX3D(cctkGH,(int)(-1 + i),(int)(j),(int)(2 + k))] + (u)[CCTK_GFINDEX3D(cctkGH,(int)(1 + i),(int)(j),(int)(-2 + k))] + (u)[CCTK_GFINDEX3D(cctkGH,(int)(-2 + i),(int)(j),(int)(1 + k))] + (u)[CCTK_GFINDEX3D(cctkGH,(int)(2 + i),(int)(j),(int)(-1 + k))]) - 8*((u)[CCTK_GFINDEX3D(cctkGH,(int)(-1 + i),(int)(j),(int)(-2 + k))] + (u)[CCTK_GFINDEX3D(cctkGH,(int)(1 + i),(int)(j),(int)(2 + k))] + (u)[CCTK_GFINDEX3D(cctkGH,(int)(-2 + i),(int)(j),(int)(-1 + k))] + (u)[CCTK_GFINDEX3D(cctkGH,(int)(2 + i),(int)(j),(int)(1 + k))]) + (u)[CCTK_GFINDEX3D(cctkGH,(int)(-2 + i),(int)(j),(int)(-2 + k))] - (u)[CCTK_GFINDEX3D(cctkGH,(int)(-2 + i),(int)(j),(int)(2 + k))] - (u)[CCTK_GFINDEX3D(cctkGH,(int)(2 + i),(int)(j),(int)(-2 + k))] + (u)[CCTK_GFINDEX3D(cctkGH,(int)(2 + i),(int)(j),(int)(2 + k))])) +#define PDstandardNth32(u,i,j,k) (p1o144dydz*(-64*((u)[CCTK_GFINDEX3D(cctkGH,(int)(i),(int)(-1 + j),(int)(1 + k))] + (u)[CCTK_GFINDEX3D(cctkGH,(int)(i),(int)(1 + j),(int)(-1 + k))]) + 64*((u)[CCTK_GFINDEX3D(cctkGH,(int)(i),(int)(-1 + j),(int)(-1 + k))] + (u)[CCTK_GFINDEX3D(cctkGH,(int)(i),(int)(1 + j),(int)(1 + k))]) + 8*((u)[CCTK_GFINDEX3D(cctkGH,(int)(i),(int)(-1 + j),(int)(2 + k))] + (u)[CCTK_GFINDEX3D(cctkGH,(int)(i),(int)(1 + j),(int)(-2 + k))] + (u)[CCTK_GFINDEX3D(cctkGH,(int)(i),(int)(-2 + j),(int)(1 + k))] + (u)[CCTK_GFINDEX3D(cctkGH,(int)(i),(int)(2 + j),(int)(-1 + k))]) - 8*((u)[CCTK_GFINDEX3D(cctkGH,(int)(i),(int)(-1 + j),(int)(-2 + k))] + (u)[CCTK_GFINDEX3D(cctkGH,(int)(i),(int)(1 + j),(int)(2 + k))] + (u)[CCTK_GFINDEX3D(cctkGH,(int)(i),(int)(-2 + j),(int)(-1 + k))] + (u)[CCTK_GFINDEX3D(cctkGH,(int)(i),(int)(2 + j),(int)(1 + k))]) + (u)[CCTK_GFINDEX3D(cctkGH,(int)(i),(int)(-2 + j),(int)(-2 + k))] - (u)[CCTK_GFINDEX3D(cctkGH,(int)(i),(int)(-2 + j),(int)(2 + k))] - (u)[CCTK_GFINDEX3D(cctkGH,(int)(i),(int)(2 + j),(int)(-2 + k))] + (u)[CCTK_GFINDEX3D(cctkGH,(int)(i),(int)(2 + j),(int)(2 + k))])) diff --git a/ML_WaveToyFO/src/RegisterMoL.c b/ML_WaveToyFO/src/RegisterMoL.c new file mode 100644 index 0000000..e6734d4 --- /dev/null +++ b/ML_WaveToyFO/src/RegisterMoL.c @@ -0,0 +1,21 @@ +/* File produced by Kranc */ + +#include "cctk.h" +#include "cctk_Arguments.h" +#include "cctk_Parameters.h" + +void ML_WaveToyFO_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("ML_WaveToyFO::rho"), CCTK_VarIndex("ML_WaveToyFO::rhorhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_WaveToyFO::u"), CCTK_VarIndex("ML_WaveToyFO::urhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_WaveToyFO::v1"), CCTK_VarIndex("ML_WaveToyFO::v1rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_WaveToyFO::v2"), CCTK_VarIndex("ML_WaveToyFO::v2rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_WaveToyFO::v3"), CCTK_VarIndex("ML_WaveToyFO::v3rhs")); + return; +} diff --git a/ML_WaveToyFO/src/RegisterSymmetries.c b/ML_WaveToyFO/src/RegisterSymmetries.c new file mode 100644 index 0000000..d6515c5 --- /dev/null +++ b/ML_WaveToyFO/src/RegisterSymmetries.c @@ -0,0 +1,59 @@ +/* File produced by Kranc */ + +#include "cctk.h" +#include "cctk_Arguments.h" +#include "cctk_Parameters.h" +#include "Symmetry.h" + +void ML_WaveToyFO_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, "ML_WaveToyFO::rho"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_WaveToyFO::u"); + + sym[0] = -1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_WaveToyFO::v1"); + + sym[0] = 1; + sym[1] = -1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_WaveToyFO::v2"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = -1; + SetCartSymVN(cctkGH, sym, "ML_WaveToyFO::v3"); + + sym[0] = -1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_WaveToyFO::w1"); + + sym[0] = 1; + sym[1] = -1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_WaveToyFO::w2"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = -1; + SetCartSymVN(cctkGH, sym, "ML_WaveToyFO::w3"); + +} diff --git a/ML_WaveToyFO/src/Startup.c b/ML_WaveToyFO/src/Startup.c new file mode 100644 index 0000000..76fb99a --- /dev/null +++ b/ML_WaveToyFO/src/Startup.c @@ -0,0 +1,10 @@ +/* File produced by Kranc */ + +#include "cctk.h" + +int ML_WaveToyFO_Startup(void) +{ + const char * banner = "ML_WaveToyFO"; + CCTK_RegisterBanner(banner); + return 0; +} diff --git a/ML_WaveToyFO/src/WTFO_Gaussian.c b/ML_WaveToyFO/src/WTFO_Gaussian.c new file mode 100644 index 0000000..78e0ef3 --- /dev/null +++ b/ML_WaveToyFO/src/WTFO_Gaussian.c @@ -0,0 +1,147 @@ +/* File produced by Kranc */ + +#define KRANC_C + +#include <assert.h> +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include "cctk.h" +#include "cctk_Arguments.h" +#include "cctk_Parameters.h" +#include "GenericFD.h" +#include "Differencing.h" +#include "loopcontrol.h" + +/* Define macros used in calculations */ +#define INITVALUE (42) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) +#define QAD(x) ((x) * (x) * (x) * (x)) + +void WTFO_Gaussian_Body(cGH const * const cctkGH, CCTK_INT const dir, CCTK_INT const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], CCTK_INT const min[3], CCTK_INT const max[3], CCTK_INT const n_subblock_gfs, CCTK_REAL * const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + CCTK_REAL dx = INITVALUE, dy = INITVALUE, dz = INITVALUE; + CCTK_REAL dxi = INITVALUE, dyi = INITVALUE, dzi = INITVALUE; + CCTK_REAL khalf = INITVALUE, kthird = INITVALUE, ktwothird = INITVALUE, kfourthird = INITVALUE, keightthird = INITVALUE; + CCTK_REAL hdxi = INITVALUE, hdyi = INITVALUE, hdzi = INITVALUE; + + + /* Declare predefined quantities */ + CCTK_REAL p1o12dx = INITVALUE; + CCTK_REAL p1o12dy = INITVALUE; + CCTK_REAL p1o12dz = INITVALUE; + CCTK_REAL p1o144dxdy = INITVALUE; + CCTK_REAL p1o144dxdz = INITVALUE; + CCTK_REAL p1o144dydz = INITVALUE; + CCTK_REAL pm1o12dx2 = INITVALUE; + CCTK_REAL pm1o12dy2 = INITVALUE; + CCTK_REAL pm1o12dz2 = INITVALUE; + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering WTFO_Gaussian_Body"); + } + + if (cctk_iteration % WTFO_Gaussian_calc_every != WTFO_Gaussian_calc_offset) + { + return; + } + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + dx = CCTK_DELTA_SPACE(0); + dy = CCTK_DELTA_SPACE(1); + dz = CCTK_DELTA_SPACE(2); + dxi = 1.0 / dx; + dyi = 1.0 / dy; + dzi = 1.0 / dz; + khalf = 0.5; + kthird = 1/3.0; + ktwothird = 2.0/3.0; + kfourthird = 4.0/3.0; + keightthird = 8.0/3.0; + hdxi = 0.5 * dxi; + hdyi = 0.5 * dyi; + hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + p1o12dx = INV(dx)/12.; + p1o12dy = INV(dy)/12.; + p1o12dz = INV(dz)/12.; + p1o144dxdy = (INV(dx)*INV(dy))/144.; + p1o144dxdz = (INV(dx)*INV(dz))/144.; + p1o144dydz = (INV(dy)*INV(dz))/144.; + pm1o12dx2 = -pow(dx,-2)/12.; + pm1o12dy2 = -pow(dy,-2)/12.; + pm1o12dz2 = -pow(dz,-2)/12.; + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (WTFO_Gaussian, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + int index = INITVALUE; + int subblock_index = INITVALUE; + index = CCTK_GFINDEX3D(cctkGH,i,j,k); + subblock_index = i - min[0] + (max[0] - min[0]) * (j - min[1] + (max[1]-min[1]) * (k - min[2])); + + /* Declare shorthands */ + + /* Declare local copies of grid functions */ + CCTK_REAL rhoL = INITVALUE; + CCTK_REAL uL = INITVALUE; + CCTK_REAL v1L = INITVALUE, v2L = INITVALUE, v3L = INITVALUE; + /* Declare precomputed derivatives*/ + + /* Declare derivatives */ + + /* Assign local copies of grid functions */ + + /* Assign local copies of subblock grid functions */ + + /* Include user supplied include files */ + + /* Precompute derivatives (new style) */ + + /* Precompute derivatives (old style) */ + + /* Calculate temporaries and grid functions */ + uL = 0; + + v1L = 0; + + v2L = 0; + + v3L = 0; + + rhoL = 0; + + + /* Copy local copies back to grid functions */ + rho[index] = rhoL; + u[index] = uL; + v1[index] = v1L; + v2[index] = v2L; + v3[index] = v3L; + + /* Copy local copies back to subblock grid functions */ + } + LC_ENDLOOP3 (WTFO_Gaussian); +} + +void WTFO_Gaussian(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverEverything(cctkGH, &WTFO_Gaussian_Body); +} diff --git a/ML_WaveToyFO/src/WTFO_RHS.c b/ML_WaveToyFO/src/WTFO_RHS.c new file mode 100644 index 0000000..3813c63 --- /dev/null +++ b/ML_WaveToyFO/src/WTFO_RHS.c @@ -0,0 +1,163 @@ +/* File produced by Kranc */ + +#define KRANC_C + +#include <assert.h> +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include "cctk.h" +#include "cctk_Arguments.h" +#include "cctk_Parameters.h" +#include "GenericFD.h" +#include "Differencing.h" +#include "loopcontrol.h" + +/* Define macros used in calculations */ +#define INITVALUE (42) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) +#define QAD(x) ((x) * (x) * (x) * (x)) + +void WTFO_RHS_Body(cGH const * const cctkGH, CCTK_INT const dir, CCTK_INT const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], CCTK_INT const min[3], CCTK_INT const max[3], CCTK_INT const n_subblock_gfs, CCTK_REAL * const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + CCTK_REAL dx = INITVALUE, dy = INITVALUE, dz = INITVALUE; + CCTK_REAL dxi = INITVALUE, dyi = INITVALUE, dzi = INITVALUE; + CCTK_REAL khalf = INITVALUE, kthird = INITVALUE, ktwothird = INITVALUE, kfourthird = INITVALUE, keightthird = INITVALUE; + CCTK_REAL hdxi = INITVALUE, hdyi = INITVALUE, hdzi = INITVALUE; + + + /* Declare predefined quantities */ + CCTK_REAL p1o12dx = INITVALUE; + CCTK_REAL p1o12dy = INITVALUE; + CCTK_REAL p1o12dz = INITVALUE; + CCTK_REAL p1o144dxdy = INITVALUE; + CCTK_REAL p1o144dxdz = INITVALUE; + CCTK_REAL p1o144dydz = INITVALUE; + CCTK_REAL pm1o12dx2 = INITVALUE; + CCTK_REAL pm1o12dy2 = INITVALUE; + CCTK_REAL pm1o12dz2 = INITVALUE; + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering WTFO_RHS_Body"); + } + + if (cctk_iteration % WTFO_RHS_calc_every != WTFO_RHS_calc_offset) + { + return; + } + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + dx = CCTK_DELTA_SPACE(0); + dy = CCTK_DELTA_SPACE(1); + dz = CCTK_DELTA_SPACE(2); + dxi = 1.0 / dx; + dyi = 1.0 / dy; + dzi = 1.0 / dz; + khalf = 0.5; + kthird = 1/3.0; + ktwothird = 2.0/3.0; + kfourthird = 4.0/3.0; + keightthird = 8.0/3.0; + hdxi = 0.5 * dxi; + hdyi = 0.5 * dyi; + hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + p1o12dx = INV(dx)/12.; + p1o12dy = INV(dy)/12.; + p1o12dz = INV(dz)/12.; + p1o144dxdy = (INV(dx)*INV(dy))/144.; + p1o144dxdz = (INV(dx)*INV(dz))/144.; + p1o144dydz = (INV(dy)*INV(dz))/144.; + pm1o12dx2 = -pow(dx,-2)/12.; + pm1o12dy2 = -pow(dy,-2)/12.; + pm1o12dz2 = -pow(dz,-2)/12.; + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (WTFO_RHS, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + int index = INITVALUE; + int subblock_index = INITVALUE; + index = CCTK_GFINDEX3D(cctkGH,i,j,k); + subblock_index = i - min[0] + (max[0] - min[0]) * (j - min[1] + (max[1]-min[1]) * (k - min[2])); + + /* Declare shorthands */ + + /* Declare local copies of grid functions */ + CCTK_REAL rhoL = INITVALUE, rhorhsL = INITVALUE; + CCTK_REAL urhsL = INITVALUE; + CCTK_REAL v1L = INITVALUE, v1rhsL = INITVALUE, v2L = INITVALUE, v2rhsL = INITVALUE, v3L = INITVALUE, v3rhsL = INITVALUE; + /* Declare precomputed derivatives*/ + + /* Declare derivatives */ + CCTK_REAL PDstandardNth1rho = INITVALUE; + CCTK_REAL PDstandardNth2rho = INITVALUE; + CCTK_REAL PDstandardNth3rho = INITVALUE; + CCTK_REAL PDstandardNth1v1 = INITVALUE; + CCTK_REAL PDstandardNth2v2 = INITVALUE; + CCTK_REAL PDstandardNth3v3 = INITVALUE; + + /* Assign local copies of grid functions */ + rhoL = rho[index]; + v1L = v1[index]; + v2L = v2[index]; + v3L = v3[index]; + + /* Assign local copies of subblock grid functions */ + + /* Include user supplied include files */ + + /* Precompute derivatives (new style) */ + PDstandardNth1rho = PDstandardNth1(rho, i, j, k); + PDstandardNth2rho = PDstandardNth2(rho, i, j, k); + PDstandardNth3rho = PDstandardNth3(rho, i, j, k); + PDstandardNth1v1 = PDstandardNth1(v1, i, j, k); + PDstandardNth2v2 = PDstandardNth2(v2, i, j, k); + PDstandardNth3v3 = PDstandardNth3(v3, i, j, k); + + /* Precompute derivatives (old style) */ + + /* Calculate temporaries and grid functions */ + urhsL = rhoL; + + rhorhsL = PDstandardNth1v1 + PDstandardNth2v2 + PDstandardNth3v3; + + v1rhsL = PDstandardNth1rho; + + v2rhsL = PDstandardNth2rho; + + v3rhsL = PDstandardNth3rho; + + + /* Copy local copies back to grid functions */ + rhorhs[index] = rhorhsL; + urhs[index] = urhsL; + v1rhs[index] = v1rhsL; + v2rhs[index] = v2rhsL; + v3rhs[index] = v3rhsL; + + /* Copy local copies back to subblock grid functions */ + } + LC_ENDLOOP3 (WTFO_RHS); +} + +void WTFO_RHS(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverInterior(cctkGH, &WTFO_RHS_Body); +} diff --git a/ML_WaveToyFO/src/WTFO_constraints.c b/ML_WaveToyFO/src/WTFO_constraints.c new file mode 100644 index 0000000..0d2cb6b --- /dev/null +++ b/ML_WaveToyFO/src/WTFO_constraints.c @@ -0,0 +1,155 @@ +/* File produced by Kranc */ + +#define KRANC_C + +#include <assert.h> +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include "cctk.h" +#include "cctk_Arguments.h" +#include "cctk_Parameters.h" +#include "GenericFD.h" +#include "Differencing.h" +#include "loopcontrol.h" + +/* Define macros used in calculations */ +#define INITVALUE (42) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) +#define QAD(x) ((x) * (x) * (x) * (x)) + +void WTFO_constraints_Body(cGH const * const cctkGH, CCTK_INT const dir, CCTK_INT const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], CCTK_INT const min[3], CCTK_INT const max[3], CCTK_INT const n_subblock_gfs, CCTK_REAL * const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + CCTK_REAL dx = INITVALUE, dy = INITVALUE, dz = INITVALUE; + CCTK_REAL dxi = INITVALUE, dyi = INITVALUE, dzi = INITVALUE; + CCTK_REAL khalf = INITVALUE, kthird = INITVALUE, ktwothird = INITVALUE, kfourthird = INITVALUE, keightthird = INITVALUE; + CCTK_REAL hdxi = INITVALUE, hdyi = INITVALUE, hdzi = INITVALUE; + + + /* Declare predefined quantities */ + CCTK_REAL p1o12dx = INITVALUE; + CCTK_REAL p1o12dy = INITVALUE; + CCTK_REAL p1o12dz = INITVALUE; + CCTK_REAL p1o144dxdy = INITVALUE; + CCTK_REAL p1o144dxdz = INITVALUE; + CCTK_REAL p1o144dydz = INITVALUE; + CCTK_REAL pm1o12dx2 = INITVALUE; + CCTK_REAL pm1o12dy2 = INITVALUE; + CCTK_REAL pm1o12dz2 = INITVALUE; + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering WTFO_constraints_Body"); + } + + if (cctk_iteration % WTFO_constraints_calc_every != WTFO_constraints_calc_offset) + { + return; + } + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + dx = CCTK_DELTA_SPACE(0); + dy = CCTK_DELTA_SPACE(1); + dz = CCTK_DELTA_SPACE(2); + dxi = 1.0 / dx; + dyi = 1.0 / dy; + dzi = 1.0 / dz; + khalf = 0.5; + kthird = 1/3.0; + ktwothird = 2.0/3.0; + kfourthird = 4.0/3.0; + keightthird = 8.0/3.0; + hdxi = 0.5 * dxi; + hdyi = 0.5 * dyi; + hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + p1o12dx = INV(dx)/12.; + p1o12dy = INV(dy)/12.; + p1o12dz = INV(dz)/12.; + p1o144dxdy = (INV(dx)*INV(dy))/144.; + p1o144dxdz = (INV(dx)*INV(dz))/144.; + p1o144dydz = (INV(dy)*INV(dz))/144.; + pm1o12dx2 = -pow(dx,-2)/12.; + pm1o12dy2 = -pow(dy,-2)/12.; + pm1o12dz2 = -pow(dz,-2)/12.; + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (WTFO_constraints, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + int index = INITVALUE; + int subblock_index = INITVALUE; + index = CCTK_GFINDEX3D(cctkGH,i,j,k); + subblock_index = i - min[0] + (max[0] - min[0]) * (j - min[1] + (max[1]-min[1]) * (k - min[2])); + + /* Declare shorthands */ + + /* Declare local copies of grid functions */ + CCTK_REAL v1L = INITVALUE, v2L = INITVALUE, v3L = INITVALUE; + CCTK_REAL w1L = INITVALUE, w2L = INITVALUE, w3L = INITVALUE; + /* Declare precomputed derivatives*/ + + /* Declare derivatives */ + CCTK_REAL PDstandardNth2v1 = INITVALUE; + CCTK_REAL PDstandardNth3v1 = INITVALUE; + CCTK_REAL PDstandardNth1v2 = INITVALUE; + CCTK_REAL PDstandardNth3v2 = INITVALUE; + CCTK_REAL PDstandardNth1v3 = INITVALUE; + CCTK_REAL PDstandardNth2v3 = INITVALUE; + + /* Assign local copies of grid functions */ + v1L = v1[index]; + v2L = v2[index]; + v3L = v3[index]; + + /* Assign local copies of subblock grid functions */ + + /* Include user supplied include files */ + + /* Precompute derivatives (new style) */ + PDstandardNth2v1 = PDstandardNth2(v1, i, j, k); + PDstandardNth3v1 = PDstandardNth3(v1, i, j, k); + PDstandardNth1v2 = PDstandardNth1(v2, i, j, k); + PDstandardNth3v2 = PDstandardNth3(v2, i, j, k); + PDstandardNth1v3 = PDstandardNth1(v3, i, j, k); + PDstandardNth2v3 = PDstandardNth2(v3, i, j, k); + + /* Precompute derivatives (old style) */ + + /* Calculate temporaries and grid functions */ + w1L = -PDstandardNth2v3 + PDstandardNth3v2; + + w2L = PDstandardNth1v3 - PDstandardNth3v1; + + w3L = -PDstandardNth1v2 + PDstandardNth2v1; + + + /* Copy local copies back to grid functions */ + w1[index] = w1L; + w2[index] = w2L; + w3[index] = w3L; + + /* Copy local copies back to subblock grid functions */ + } + LC_ENDLOOP3 (WTFO_constraints); +} + +void WTFO_constraints(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverInterior(cctkGH, &WTFO_constraints_Body); +} diff --git a/ML_WaveToyFO/src/make.code.defn b/ML_WaveToyFO/src/make.code.defn new file mode 100644 index 0000000..a18c783 --- /dev/null +++ b/ML_WaveToyFO/src/make.code.defn @@ -0,0 +1,3 @@ +# File produced by Kranc + +SRCS = Startup.c RegisterMoL.c RegisterSymmetries.c WTFO_Gaussian.c WTFO_RHS.c WTFO_constraints.c Boundaries.c |