diff options
author | Erik Schnetter <schnetter@cct.lsu.edu> | 2007-11-30 20:34:36 -0600 |
---|---|---|
committer | Erik Schnetter <schnetter@cct.lsu.edu> | 2007-11-30 20:34:36 -0600 |
commit | ade7255aa26dbf98ad1e528d55d10d16de3b359f (patch) | |
tree | 437aa64296b9ccae5004561156e8f89a5826bb46 /MLFO_WaveToy | |
parent | 448082538b5e2a5154f7543bcb157bc57d439dac (diff) |
Add first-order WaveToy. Use makefile to run Kranc
Diffstat (limited to 'MLFO_WaveToy')
-rw-r--r-- | MLFO_WaveToy/configuration.ccl | 6 | ||||
-rw-r--r-- | MLFO_WaveToy/interface.ccl | 79 | ||||
-rw-r--r-- | MLFO_WaveToy/param.ccl | 314 | ||||
-rw-r--r-- | MLFO_WaveToy/schedule.ccl | 86 | ||||
-rw-r--r-- | MLFO_WaveToy/src/Boundaries.c | 444 | ||||
-rw-r--r-- | MLFO_WaveToy/src/Differencing.h | 12 | ||||
-rw-r--r-- | MLFO_WaveToy/src/RegisterMoL.c | 24 | ||||
-rw-r--r-- | MLFO_WaveToy/src/RegisterSymmetries.c | 62 | ||||
-rw-r--r-- | MLFO_WaveToy/src/Startup.c | 13 | ||||
-rw-r--r-- | MLFO_WaveToy/src/WTFO_Gaussian.c | 146 | ||||
-rw-r--r-- | MLFO_WaveToy/src/WTFO_RHS.c | 214 | ||||
-rw-r--r-- | MLFO_WaveToy/src/WTFO_constraints.c | 201 | ||||
-rw-r--r-- | MLFO_WaveToy/src/make.code.defn | 6 |
13 files changed, 1607 insertions, 0 deletions
diff --git a/MLFO_WaveToy/configuration.ccl b/MLFO_WaveToy/configuration.ccl new file mode 100644 index 0000000..0374af4 --- /dev/null +++ b/MLFO_WaveToy/configuration.ccl @@ -0,0 +1,6 @@ +# File produced by user eschnett +# Produced with Mathematica Version 6.0 for Mac OS X x86 (32-bit) (April 20, 2007) + +# Mathematica script written by Ian Hinder and Sascha Husa + +REQUIRES LoopControl diff --git a/MLFO_WaveToy/interface.ccl b/MLFO_WaveToy/interface.ccl new file mode 100644 index 0000000..4862d5f --- /dev/null +++ b/MLFO_WaveToy/interface.ccl @@ -0,0 +1,79 @@ +# File produced by user eschnett +# Produced with Mathematica Version 6.0 for Mac OS X x86 (32-bit) (April 20, 2007) + +# Mathematica script written by Ian Hinder and Sascha Husa + +implements: MLFO_WaveToy + +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 + +CCTK_INT FUNCTION MoLRegisterConstrained(CCTK_INT IN ConstrainedIndex) +USES FUNCTION MoLRegisterConstrained + +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_rhorhs type=GF timelevels=1 tags='tensortypealias="Scalar" tensorweight=1.0000000000000000000' +{ + rhorhs +} "WT_rhorhs" + +public: +CCTK_REAL WT_urhs type=GF timelevels=1 tags='tensortypealias="Scalar" tensorweight=1.0000000000000000000' +{ + urhs +} "WT_urhs" + +public: +CCTK_REAL WT_vrhs type=GF timelevels=1 tags='tensortypealias="D" tensorweight=1.0000000000000000000' +{ + v1rhs, + v2rhs, + v3rhs +} "WT_vrhs" + +public: +CCTK_REAL WT_rho type=GF timelevels=3 tags='tensortypealias="Scalar" tensorweight=1.0000000000000000000' +{ + rho +} "WT_rho" + +public: +CCTK_REAL WT_u type=GF timelevels=3 tags='tensortypealias="Scalar" tensorweight=1.0000000000000000000' +{ + u +} "WT_u" + +public: +CCTK_REAL WT_v type=GF timelevels=3 tags='tensortypealias="D" tensorweight=1.0000000000000000000' +{ + v1, + v2, + v3 +} "WT_v" diff --git a/MLFO_WaveToy/param.ccl b/MLFO_WaveToy/param.ccl new file mode 100644 index 0000000..9ec50d5 --- /dev/null +++ b/MLFO_WaveToy/param.ccl @@ -0,0 +1,314 @@ +# File produced by user eschnett +# Produced with Mathematica Version 6.0 for Mac OS X x86 (32-bit) (April 20, 2007) + +# Mathematica script written by Ian Hinder and Sascha Husa + + +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 +USES CCTK_INT MoL_Num_Constrained_Vars + +restricted: +CCTK_REAL verbose "verbose" +{ + "*:*" :: "no restrictions" +} 0 + +restricted: +CCTK_INT MLFO_WaveToy_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 MLFO_WaveToy_MaxNumConstrainedVars "Number of constrained variables used by this thorn" ACCUMULATOR-BASE=MethodofLines::MoL_Num_Constrained_Vars +{ + 61:61 :: "Number of constrained variables used by this thorn" +} 61 + +restricted: +CCTK_INT WTFO_Gaussian_calc_every "WTFO_Gaussian_calc_every" +{ + *:* :: "no restrictions" +} 1 + +restricted: +CCTK_INT WTFO_RHS_calc_every "WTFO_RHS_calc_every" +{ + *:* :: "no restrictions" +} 1 + +restricted: +CCTK_INT WTFO_constraints_calc_every "WTFO_constraints_calc_every" +{ + *:* :: "no restrictions" +} 1 + +restricted: +CCTK_INT WTFO_Gaussian_calc_offset "WTFO_Gaussian_calc_offset" +{ + *:* :: "no restrictions" +} 0 + +restricted: +CCTK_INT WTFO_RHS_calc_offset "WTFO_RHS_calc_offset" +{ + *:* :: "no restrictions" +} 0 + +restricted: +CCTK_INT WTFO_constraints_calc_offset "WTFO_constraints_calc_offset" +{ + *:* :: "no restrictions" +} 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/MLFO_WaveToy/schedule.ccl b/MLFO_WaveToy/schedule.ccl new file mode 100644 index 0000000..99d73ae --- /dev/null +++ b/MLFO_WaveToy/schedule.ccl @@ -0,0 +1,86 @@ +# File produced by user eschnett +# Produced with Mathematica Version 6.0 for Mac OS X x86 (32-bit) (April 20, 2007) + +# Mathematica script written by Ian Hinder and Sascha Husa + + +STORAGE: WT_w[1] + +STORAGE: WT_rhorhs[1] + +STORAGE: WT_urhs[1] + +STORAGE: WT_vrhs[1] + +STORAGE: WT_rho[3] + +STORAGE: WT_u[3] + +STORAGE: WT_v[3] + +schedule MLFO_WaveToy_Startup at STARTUP +{ + LANG: C + OPTIONS: meta +} "create banner" + +schedule MLFO_WaveToy_RegisterVars in MoL_Register +{ + LANG: C + OPTIONS: meta +} "Register Variables for MoL" + +schedule MLFO_WaveToy_RegisterSymmetries at BASEGRID +{ + 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 MLFO_WaveToy_ApplyBoundConds in MoL_PostStep +{ + LANG: C + OPTIONS: level + SYNC: WT_rho + SYNC: WT_u + SYNC: WT_v +} "apply boundary conditions" + +schedule MLFO_WaveToy_CheckBoundaries at BASEGRID +{ + LANG: C + OPTIONS: meta +} "check boundaries treatment" + +schedule group ApplyBCs as MLFO_WaveToy_ApplyBCs in MoL_PostStep after MLFO_WaveToy_ApplyBoundConds +{ + # no language specified + +} "Apply boundary conditions controlled by thorn Boundary" diff --git a/MLFO_WaveToy/src/Boundaries.c b/MLFO_WaveToy/src/Boundaries.c new file mode 100644 index 0000000..abc7ce9 --- /dev/null +++ b/MLFO_WaveToy/src/Boundaries.c @@ -0,0 +1,444 @@ +/* File produced by user eschnett */ +/* Produced with Mathematica Version 6.0 for Mac OS X x86 (32-bit) (April 20, 2007) */ + +/* Mathematica script written by Ian Hinder and Sascha Husa */ + +#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 MLFO_WaveToy_CheckBoundaries(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS + DECLARE_CCTK_PARAMETERS + + return; +} + +void MLFO_WaveToy_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, + "MLFO_WaveToy::WT_rho", WT_rho_bound); + if (ierr < 0) + CCTK_WARN(-1, "Failed to register WT_rho_bound BC for MLFO_WaveToy::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, + "MLFO_WaveToy::WT_u", WT_u_bound); + if (ierr < 0) + CCTK_WARN(-1, "Failed to register WT_u_bound BC for MLFO_WaveToy::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, + "MLFO_WaveToy::WT_v", WT_v_bound); + if (ierr < 0) + CCTK_WARN(-1, "Failed to register WT_v_bound BC for MLFO_WaveToy::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, + "MLFO_WaveToy::rho", rho_bound); + if (ierr < 0) + CCTK_WARN(-1, "Failed to register rho_bound BC for MLFO_WaveToy::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, + "MLFO_WaveToy::u", u_bound); + if (ierr < 0) + CCTK_WARN(-1, "Failed to register u_bound BC for MLFO_WaveToy::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, + "MLFO_WaveToy::v1", v1_bound); + if (ierr < 0) + CCTK_WARN(-1, "Failed to register v1_bound BC for MLFO_WaveToy::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, + "MLFO_WaveToy::v2", v2_bound); + if (ierr < 0) + CCTK_WARN(-1, "Failed to register v2_bound BC for MLFO_WaveToy::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, + "MLFO_WaveToy::v3", v3_bound); + if (ierr < 0) + CCTK_WARN(-1, "Failed to register v3_bound BC for MLFO_WaveToy::v3!"); + } + + if (CCTK_EQUALS(WT_rho_bound, "radiative")) + { + /* apply radiation boundary condition */ + CCTK_INT handle_WT_rho_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_WT_rho_bound < 0) CCTK_WARN(-1, "could not create table!"); + if (Util_TableSetReal(handle_WT_rho_bound , WT_rho_bound_limit, "LIMIT") < 0) + CCTK_WARN(-1, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_WT_rho_bound ,WT_rho_bound_speed, "SPEED") < 0) + CCTK_WARN(-1, "could not set SPEED value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_WT_rho_bound, + "MLFO_WaveToy::WT_rho", "Radiation"); + + if (ierr < 0) + CCTK_WARN(-1, "Failed to register Radiation BC for MLFO_WaveToy::WT_rho!"); + + } + + if (CCTK_EQUALS(WT_u_bound, "radiative")) + { + /* apply radiation boundary condition */ + CCTK_INT handle_WT_u_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_WT_u_bound < 0) CCTK_WARN(-1, "could not create table!"); + if (Util_TableSetReal(handle_WT_u_bound , WT_u_bound_limit, "LIMIT") < 0) + CCTK_WARN(-1, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_WT_u_bound ,WT_u_bound_speed, "SPEED") < 0) + CCTK_WARN(-1, "could not set SPEED value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_WT_u_bound, + "MLFO_WaveToy::WT_u", "Radiation"); + + if (ierr < 0) + CCTK_WARN(-1, "Failed to register Radiation BC for MLFO_WaveToy::WT_u!"); + + } + + if (CCTK_EQUALS(WT_v_bound, "radiative")) + { + /* apply radiation boundary condition */ + CCTK_INT handle_WT_v_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_WT_v_bound < 0) CCTK_WARN(-1, "could not create table!"); + if (Util_TableSetReal(handle_WT_v_bound , WT_v_bound_limit, "LIMIT") < 0) + CCTK_WARN(-1, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_WT_v_bound ,WT_v_bound_speed, "SPEED") < 0) + CCTK_WARN(-1, "could not set SPEED value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_WT_v_bound, + "MLFO_WaveToy::WT_v", "Radiation"); + + if (ierr < 0) + CCTK_WARN(-1, "Failed to register Radiation BC for MLFO_WaveToy::WT_v!"); + + } + + if (CCTK_EQUALS(rho_bound, "radiative")) + { + /* apply radiation boundary condition */ + CCTK_INT handle_rho_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_rho_bound < 0) CCTK_WARN(-1, "could not create table!"); + if (Util_TableSetReal(handle_rho_bound , rho_bound_limit, "LIMIT") < 0) + CCTK_WARN(-1, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_rho_bound ,rho_bound_speed, "SPEED") < 0) + CCTK_WARN(-1, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_rho_bound, + "MLFO_WaveToy::rho", "Radiation"); + + if (ierr < 0) + CCTK_WARN(-1, "Failed to register Radiation BC for MLFO_WaveToy::rho!"); + + } + + if (CCTK_EQUALS(u_bound, "radiative")) + { + /* apply radiation boundary condition */ + CCTK_INT handle_u_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_u_bound < 0) CCTK_WARN(-1, "could not create table!"); + if (Util_TableSetReal(handle_u_bound , u_bound_limit, "LIMIT") < 0) + CCTK_WARN(-1, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_u_bound ,u_bound_speed, "SPEED") < 0) + CCTK_WARN(-1, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_u_bound, + "MLFO_WaveToy::u", "Radiation"); + + if (ierr < 0) + CCTK_WARN(-1, "Failed to register Radiation BC for MLFO_WaveToy::u!"); + + } + + if (CCTK_EQUALS(v1_bound, "radiative")) + { + /* apply radiation boundary condition */ + CCTK_INT handle_v1_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_v1_bound < 0) CCTK_WARN(-1, "could not create table!"); + if (Util_TableSetReal(handle_v1_bound , v1_bound_limit, "LIMIT") < 0) + CCTK_WARN(-1, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_v1_bound ,v1_bound_speed, "SPEED") < 0) + CCTK_WARN(-1, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_v1_bound, + "MLFO_WaveToy::v1", "Radiation"); + + if (ierr < 0) + CCTK_WARN(-1, "Failed to register Radiation BC for MLFO_WaveToy::v1!"); + + } + + if (CCTK_EQUALS(v2_bound, "radiative")) + { + /* apply radiation boundary condition */ + CCTK_INT handle_v2_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_v2_bound < 0) CCTK_WARN(-1, "could not create table!"); + if (Util_TableSetReal(handle_v2_bound , v2_bound_limit, "LIMIT") < 0) + CCTK_WARN(-1, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_v2_bound ,v2_bound_speed, "SPEED") < 0) + CCTK_WARN(-1, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_v2_bound, + "MLFO_WaveToy::v2", "Radiation"); + + if (ierr < 0) + CCTK_WARN(-1, "Failed to register Radiation BC for MLFO_WaveToy::v2!"); + + } + + if (CCTK_EQUALS(v3_bound, "radiative")) + { + /* apply radiation boundary condition */ + CCTK_INT handle_v3_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_v3_bound < 0) CCTK_WARN(-1, "could not create table!"); + if (Util_TableSetReal(handle_v3_bound , v3_bound_limit, "LIMIT") < 0) + CCTK_WARN(-1, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_v3_bound ,v3_bound_speed, "SPEED") < 0) + CCTK_WARN(-1, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_v3_bound, + "MLFO_WaveToy::v3", "Radiation"); + + if (ierr < 0) + CCTK_WARN(-1, "Failed to register Radiation BC for MLFO_WaveToy::v3!"); + + } + + if (CCTK_EQUALS(WT_rho_bound, "scalar")) + { + /* apply scalar boundary condition */ + CCTK_INT handle_WT_rho_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_WT_rho_bound < 0) CCTK_WARN(-1, "could not create table!"); + if (Util_TableSetReal(handle_WT_rho_bound ,WT_rho_bound_scalar, "SCALAR") < 0) + CCTK_WARN(-1, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_WT_rho_bound, + "MLFO_WaveToy::WT_rho", "scalar"); + + if (ierr < 0) + CCTK_WARN(-1, "Failed to register Scalar BC for MLFO_WaveToy::WT_rho!"); + + } + + if (CCTK_EQUALS(WT_u_bound, "scalar")) + { + /* apply scalar boundary condition */ + CCTK_INT handle_WT_u_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_WT_u_bound < 0) CCTK_WARN(-1, "could not create table!"); + if (Util_TableSetReal(handle_WT_u_bound ,WT_u_bound_scalar, "SCALAR") < 0) + CCTK_WARN(-1, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_WT_u_bound, + "MLFO_WaveToy::WT_u", "scalar"); + + if (ierr < 0) + CCTK_WARN(-1, "Failed to register Scalar BC for MLFO_WaveToy::WT_u!"); + + } + + if (CCTK_EQUALS(WT_v_bound, "scalar")) + { + /* apply scalar boundary condition */ + CCTK_INT handle_WT_v_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_WT_v_bound < 0) CCTK_WARN(-1, "could not create table!"); + if (Util_TableSetReal(handle_WT_v_bound ,WT_v_bound_scalar, "SCALAR") < 0) + CCTK_WARN(-1, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_WT_v_bound, + "MLFO_WaveToy::WT_v", "scalar"); + + if (ierr < 0) + CCTK_WARN(-1, "Failed to register Scalar BC for MLFO_WaveToy::WT_v!"); + + } + + if (CCTK_EQUALS(rho_bound, "scalar")) + { + /* apply scalar boundary condition */ + CCTK_INT handle_rho_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_rho_bound < 0) CCTK_WARN(-1, "could not create table!"); + if (Util_TableSetReal(handle_rho_bound ,rho_bound_scalar, "SCALAR") < 0) + CCTK_WARN(-1, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_rho_bound, + "MLFO_WaveToy::rho", "scalar"); + + if (ierr < 0) + CCTK_WARN(-1, "Error in registering Scalar BC for MLFO_WaveToy::rho!"); + + } + + if (CCTK_EQUALS(u_bound, "scalar")) + { + /* apply scalar boundary condition */ + CCTK_INT handle_u_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_u_bound < 0) CCTK_WARN(-1, "could not create table!"); + if (Util_TableSetReal(handle_u_bound ,u_bound_scalar, "SCALAR") < 0) + CCTK_WARN(-1, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_u_bound, + "MLFO_WaveToy::u", "scalar"); + + if (ierr < 0) + CCTK_WARN(-1, "Error in registering Scalar BC for MLFO_WaveToy::u!"); + + } + + if (CCTK_EQUALS(v1_bound, "scalar")) + { + /* apply scalar boundary condition */ + CCTK_INT handle_v1_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_v1_bound < 0) CCTK_WARN(-1, "could not create table!"); + if (Util_TableSetReal(handle_v1_bound ,v1_bound_scalar, "SCALAR") < 0) + CCTK_WARN(-1, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_v1_bound, + "MLFO_WaveToy::v1", "scalar"); + + if (ierr < 0) + CCTK_WARN(-1, "Error in registering Scalar BC for MLFO_WaveToy::v1!"); + + } + + if (CCTK_EQUALS(v2_bound, "scalar")) + { + /* apply scalar boundary condition */ + CCTK_INT handle_v2_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_v2_bound < 0) CCTK_WARN(-1, "could not create table!"); + if (Util_TableSetReal(handle_v2_bound ,v2_bound_scalar, "SCALAR") < 0) + CCTK_WARN(-1, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_v2_bound, + "MLFO_WaveToy::v2", "scalar"); + + if (ierr < 0) + CCTK_WARN(-1, "Error in registering Scalar BC for MLFO_WaveToy::v2!"); + + } + + if (CCTK_EQUALS(v3_bound, "scalar")) + { + /* apply scalar boundary condition */ + CCTK_INT handle_v3_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_v3_bound < 0) CCTK_WARN(-1, "could not create table!"); + if (Util_TableSetReal(handle_v3_bound ,v3_bound_scalar, "SCALAR") < 0) + CCTK_WARN(-1, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_v3_bound, + "MLFO_WaveToy::v3", "scalar"); + + if (ierr < 0) + CCTK_WARN(-1, "Error in registering Scalar BC for MLFO_WaveToy::v3!"); + + } + return; +} + + + +/* template for entries in parameter file: +#$bound$#MLFO_WaveToy::WT_rho_bound = "skip" +#$bound$#MLFO_WaveToy::WT_rho_bound_speed = 1.0 +#$bound$#MLFO_WaveToy::WT_rho_bound_limit = 0.0 +#$bound$#MLFO_WaveToy::WT_rho_bound_scalar = 0.0 + +#$bound$#MLFO_WaveToy::WT_u_bound = "skip" +#$bound$#MLFO_WaveToy::WT_u_bound_speed = 1.0 +#$bound$#MLFO_WaveToy::WT_u_bound_limit = 0.0 +#$bound$#MLFO_WaveToy::WT_u_bound_scalar = 0.0 + +#$bound$#MLFO_WaveToy::WT_v_bound = "skip" +#$bound$#MLFO_WaveToy::WT_v_bound_speed = 1.0 +#$bound$#MLFO_WaveToy::WT_v_bound_limit = 0.0 +#$bound$#MLFO_WaveToy::WT_v_bound_scalar = 0.0 + +#$bound$#MLFO_WaveToy::rho_bound = "skip" +#$bound$#MLFO_WaveToy::rho_bound_speed = 1.0 +#$bound$#MLFO_WaveToy::rho_bound_limit = 0.0 +#$bound$#MLFO_WaveToy::rho_bound_scalar = 0.0 + +#$bound$#MLFO_WaveToy::u_bound = "skip" +#$bound$#MLFO_WaveToy::u_bound_speed = 1.0 +#$bound$#MLFO_WaveToy::u_bound_limit = 0.0 +#$bound$#MLFO_WaveToy::u_bound_scalar = 0.0 + +#$bound$#MLFO_WaveToy::v1_bound = "skip" +#$bound$#MLFO_WaveToy::v1_bound_speed = 1.0 +#$bound$#MLFO_WaveToy::v1_bound_limit = 0.0 +#$bound$#MLFO_WaveToy::v1_bound_scalar = 0.0 + +#$bound$#MLFO_WaveToy::v2_bound = "skip" +#$bound$#MLFO_WaveToy::v2_bound_speed = 1.0 +#$bound$#MLFO_WaveToy::v2_bound_limit = 0.0 +#$bound$#MLFO_WaveToy::v2_bound_scalar = 0.0 + +#$bound$#MLFO_WaveToy::v3_bound = "skip" +#$bound$#MLFO_WaveToy::v3_bound_speed = 1.0 +#$bound$#MLFO_WaveToy::v3_bound_limit = 0.0 +#$bound$#MLFO_WaveToy::v3_bound_scalar = 0.0 + +*/ + diff --git a/MLFO_WaveToy/src/Differencing.h b/MLFO_WaveToy/src/Differencing.h new file mode 100644 index 0000000..876855b --- /dev/null +++ b/MLFO_WaveToy/src/Differencing.h @@ -0,0 +1,12 @@ +#define PDstandardNth1(u,i,j,k) (p1o12dx*(-8*u[CCTK_GFINDEX3D(cctkGH,-1 + i,j,k)] + 8*u[CCTK_GFINDEX3D(cctkGH,1 + i,j,k)] + u[CCTK_GFINDEX3D(cctkGH,-2 + i,j,k)] - u[CCTK_GFINDEX3D(cctkGH,2 + i,j,k)])) +#define PDstandardNth2(u,i,j,k) (p1o12dy*(-8*u[CCTK_GFINDEX3D(cctkGH,i,-1 + j,k)] + 8*u[CCTK_GFINDEX3D(cctkGH,i,1 + j,k)] + u[CCTK_GFINDEX3D(cctkGH,i,-2 + j,k)] - u[CCTK_GFINDEX3D(cctkGH,i,2 + j,k)])) +#define PDstandardNth3(u,i,j,k) (p1o12dz*(-8*u[CCTK_GFINDEX3D(cctkGH,i,j,-1 + k)] + 8*u[CCTK_GFINDEX3D(cctkGH,i,j,1 + k)] + u[CCTK_GFINDEX3D(cctkGH,i,j,-2 + k)] - u[CCTK_GFINDEX3D(cctkGH,i,j,2 + k)])) +#define PDstandardNth11(u,i,j,k) (pm1o12dx2*(-16*(u[CCTK_GFINDEX3D(cctkGH,-1 + i,j,k)] + u[CCTK_GFINDEX3D(cctkGH,1 + i,j,k)]) + u[CCTK_GFINDEX3D(cctkGH,-2 + i,j,k)] + u[CCTK_GFINDEX3D(cctkGH,2 + i,j,k)] + 30*u[CCTK_GFINDEX3D(cctkGH,i,j,k)])) +#define PDstandardNth22(u,i,j,k) (pm1o12dy2*(-16*(u[CCTK_GFINDEX3D(cctkGH,i,-1 + j,k)] + u[CCTK_GFINDEX3D(cctkGH,i,1 + j,k)]) + u[CCTK_GFINDEX3D(cctkGH,i,-2 + j,k)] + u[CCTK_GFINDEX3D(cctkGH,i,2 + j,k)] + 30*u[CCTK_GFINDEX3D(cctkGH,i,j,k)])) +#define PDstandardNth33(u,i,j,k) (pm1o12dz2*(-16*(u[CCTK_GFINDEX3D(cctkGH,i,j,-1 + k)] + u[CCTK_GFINDEX3D(cctkGH,i,j,1 + k)]) + u[CCTK_GFINDEX3D(cctkGH,i,j,-2 + k)] + u[CCTK_GFINDEX3D(cctkGH,i,j,2 + k)] + 30*u[CCTK_GFINDEX3D(cctkGH,i,j,k)])) +#define PDstandardNth12(u,i,j,k) (p1o144dxdy*(-64*(u[CCTK_GFINDEX3D(cctkGH,-1 + i,1 + j,k)] + u[CCTK_GFINDEX3D(cctkGH,1 + i,-1 + j,k)]) + 64*(u[CCTK_GFINDEX3D(cctkGH,-1 + i,-1 + j,k)] + u[CCTK_GFINDEX3D(cctkGH,1 + i,1 + j,k)]) + 8*(u[CCTK_GFINDEX3D(cctkGH,-1 + i,2 + j,k)] + u[CCTK_GFINDEX3D(cctkGH,1 + i,-2 + j,k)] + u[CCTK_GFINDEX3D(cctkGH,-2 + i,1 + j,k)] + u[CCTK_GFINDEX3D(cctkGH,2 + i,-1 + j,k)]) - 8*(u[CCTK_GFINDEX3D(cctkGH,-1 + i,-2 + j,k)] + u[CCTK_GFINDEX3D(cctkGH,1 + i,2 + j,k)] + u[CCTK_GFINDEX3D(cctkGH,-2 + i,-1 + j,k)] + u[CCTK_GFINDEX3D(cctkGH,2 + i,1 + j,k)]) + u[CCTK_GFINDEX3D(cctkGH,-2 + i,-2 + j,k)] - u[CCTK_GFINDEX3D(cctkGH,-2 + i,2 + j,k)] - u[CCTK_GFINDEX3D(cctkGH,2 + i,-2 + j,k)] + u[CCTK_GFINDEX3D(cctkGH,2 + i,2 + j,k)])) +#define PDstandardNth13(u,i,j,k) (p1o144dxdz*(-64*(u[CCTK_GFINDEX3D(cctkGH,-1 + i,j,1 + k)] + u[CCTK_GFINDEX3D(cctkGH,1 + i,j,-1 + k)]) + 64*(u[CCTK_GFINDEX3D(cctkGH,-1 + i,j,-1 + k)] + u[CCTK_GFINDEX3D(cctkGH,1 + i,j,1 + k)]) + 8*(u[CCTK_GFINDEX3D(cctkGH,-1 + i,j,2 + k)] + u[CCTK_GFINDEX3D(cctkGH,1 + i,j,-2 + k)] + u[CCTK_GFINDEX3D(cctkGH,-2 + i,j,1 + k)] + u[CCTK_GFINDEX3D(cctkGH,2 + i,j,-1 + k)]) - 8*(u[CCTK_GFINDEX3D(cctkGH,-1 + i,j,-2 + k)] + u[CCTK_GFINDEX3D(cctkGH,1 + i,j,2 + k)] + u[CCTK_GFINDEX3D(cctkGH,-2 + i,j,-1 + k)] + u[CCTK_GFINDEX3D(cctkGH,2 + i,j,1 + k)]) + u[CCTK_GFINDEX3D(cctkGH,-2 + i,j,-2 + k)] - u[CCTK_GFINDEX3D(cctkGH,-2 + i,j,2 + k)] - u[CCTK_GFINDEX3D(cctkGH,2 + i,j,-2 + k)] + u[CCTK_GFINDEX3D(cctkGH,2 + i,j,2 + k)])) +#define PDstandardNth21(u,i,j,k) (p1o144dxdy*(-64*(u[CCTK_GFINDEX3D(cctkGH,-1 + i,1 + j,k)] + u[CCTK_GFINDEX3D(cctkGH,1 + i,-1 + j,k)]) + 64*(u[CCTK_GFINDEX3D(cctkGH,-1 + i,-1 + j,k)] + u[CCTK_GFINDEX3D(cctkGH,1 + i,1 + j,k)]) + 8*(u[CCTK_GFINDEX3D(cctkGH,-1 + i,2 + j,k)] + u[CCTK_GFINDEX3D(cctkGH,1 + i,-2 + j,k)] + u[CCTK_GFINDEX3D(cctkGH,-2 + i,1 + j,k)] + u[CCTK_GFINDEX3D(cctkGH,2 + i,-1 + j,k)]) - 8*(u[CCTK_GFINDEX3D(cctkGH,-1 + i,-2 + j,k)] + u[CCTK_GFINDEX3D(cctkGH,1 + i,2 + j,k)] + u[CCTK_GFINDEX3D(cctkGH,-2 + i,-1 + j,k)] + u[CCTK_GFINDEX3D(cctkGH,2 + i,1 + j,k)]) + u[CCTK_GFINDEX3D(cctkGH,-2 + i,-2 + j,k)] - u[CCTK_GFINDEX3D(cctkGH,-2 + i,2 + j,k)] - u[CCTK_GFINDEX3D(cctkGH,2 + i,-2 + j,k)] + u[CCTK_GFINDEX3D(cctkGH,2 + i,2 + j,k)])) +#define PDstandardNth23(u,i,j,k) (p1o144dydz*(-64*(u[CCTK_GFINDEX3D(cctkGH,i,-1 + j,1 + k)] + u[CCTK_GFINDEX3D(cctkGH,i,1 + j,-1 + k)]) + 64*(u[CCTK_GFINDEX3D(cctkGH,i,-1 + j,-1 + k)] + u[CCTK_GFINDEX3D(cctkGH,i,1 + j,1 + k)]) + 8*(u[CCTK_GFINDEX3D(cctkGH,i,-1 + j,2 + k)] + u[CCTK_GFINDEX3D(cctkGH,i,1 + j,-2 + k)] + u[CCTK_GFINDEX3D(cctkGH,i,-2 + j,1 + k)] + u[CCTK_GFINDEX3D(cctkGH,i,2 + j,-1 + k)]) - 8*(u[CCTK_GFINDEX3D(cctkGH,i,-1 + j,-2 + k)] + u[CCTK_GFINDEX3D(cctkGH,i,1 + j,2 + k)] + u[CCTK_GFINDEX3D(cctkGH,i,-2 + j,-1 + k)] + u[CCTK_GFINDEX3D(cctkGH,i,2 + j,1 + k)]) + u[CCTK_GFINDEX3D(cctkGH,i,-2 + j,-2 + k)] - u[CCTK_GFINDEX3D(cctkGH,i,-2 + j,2 + k)] - u[CCTK_GFINDEX3D(cctkGH,i,2 + j,-2 + k)] + u[CCTK_GFINDEX3D(cctkGH,i,2 + j,2 + k)])) +#define PDstandardNth31(u,i,j,k) (p1o144dxdz*(-64*(u[CCTK_GFINDEX3D(cctkGH,-1 + i,j,1 + k)] + u[CCTK_GFINDEX3D(cctkGH,1 + i,j,-1 + k)]) + 64*(u[CCTK_GFINDEX3D(cctkGH,-1 + i,j,-1 + k)] + u[CCTK_GFINDEX3D(cctkGH,1 + i,j,1 + k)]) + 8*(u[CCTK_GFINDEX3D(cctkGH,-1 + i,j,2 + k)] + u[CCTK_GFINDEX3D(cctkGH,1 + i,j,-2 + k)] + u[CCTK_GFINDEX3D(cctkGH,-2 + i,j,1 + k)] + u[CCTK_GFINDEX3D(cctkGH,2 + i,j,-1 + k)]) - 8*(u[CCTK_GFINDEX3D(cctkGH,-1 + i,j,-2 + k)] + u[CCTK_GFINDEX3D(cctkGH,1 + i,j,2 + k)] + u[CCTK_GFINDEX3D(cctkGH,-2 + i,j,-1 + k)] + u[CCTK_GFINDEX3D(cctkGH,2 + i,j,1 + k)]) + u[CCTK_GFINDEX3D(cctkGH,-2 + i,j,-2 + k)] - u[CCTK_GFINDEX3D(cctkGH,-2 + i,j,2 + k)] - u[CCTK_GFINDEX3D(cctkGH,2 + i,j,-2 + k)] + u[CCTK_GFINDEX3D(cctkGH,2 + i,j,2 + k)])) +#define PDstandardNth32(u,i,j,k) (p1o144dydz*(-64*(u[CCTK_GFINDEX3D(cctkGH,i,-1 + j,1 + k)] + u[CCTK_GFINDEX3D(cctkGH,i,1 + j,-1 + k)]) + 64*(u[CCTK_GFINDEX3D(cctkGH,i,-1 + j,-1 + k)] + u[CCTK_GFINDEX3D(cctkGH,i,1 + j,1 + k)]) + 8*(u[CCTK_GFINDEX3D(cctkGH,i,-1 + j,2 + k)] + u[CCTK_GFINDEX3D(cctkGH,i,1 + j,-2 + k)] + u[CCTK_GFINDEX3D(cctkGH,i,-2 + j,1 + k)] + u[CCTK_GFINDEX3D(cctkGH,i,2 + j,-1 + k)]) - 8*(u[CCTK_GFINDEX3D(cctkGH,i,-1 + j,-2 + k)] + u[CCTK_GFINDEX3D(cctkGH,i,1 + j,2 + k)] + u[CCTK_GFINDEX3D(cctkGH,i,-2 + j,-1 + k)] + u[CCTK_GFINDEX3D(cctkGH,i,2 + j,1 + k)]) + u[CCTK_GFINDEX3D(cctkGH,i,-2 + j,-2 + k)] - u[CCTK_GFINDEX3D(cctkGH,i,-2 + j,2 + k)] - u[CCTK_GFINDEX3D(cctkGH,i,2 + j,-2 + k)] + u[CCTK_GFINDEX3D(cctkGH,i,2 + j,2 + k)])) diff --git a/MLFO_WaveToy/src/RegisterMoL.c b/MLFO_WaveToy/src/RegisterMoL.c new file mode 100644 index 0000000..68eeffe --- /dev/null +++ b/MLFO_WaveToy/src/RegisterMoL.c @@ -0,0 +1,24 @@ +/* File produced by user eschnett */ +/* Produced with Mathematica Version 6.0 for Mac OS X x86 (32-bit) (April 20, 2007) */ + +/* Mathematica script written by Ian Hinder and Sascha Husa */ + +#include "cctk.h" +#include "cctk_Arguments.h" +#include "cctk_Parameters.h" + +void MLFO_WaveToy_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("MLFO_WaveToy::rho"), CCTK_VarIndex("MLFO_WaveToy::rhorhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("MLFO_WaveToy::u"), CCTK_VarIndex("MLFO_WaveToy::urhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("MLFO_WaveToy::v1"), CCTK_VarIndex("MLFO_WaveToy::v1rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("MLFO_WaveToy::v2"), CCTK_VarIndex("MLFO_WaveToy::v2rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("MLFO_WaveToy::v3"), CCTK_VarIndex("MLFO_WaveToy::v3rhs")); + return; +} diff --git a/MLFO_WaveToy/src/RegisterSymmetries.c b/MLFO_WaveToy/src/RegisterSymmetries.c new file mode 100644 index 0000000..f6a619c --- /dev/null +++ b/MLFO_WaveToy/src/RegisterSymmetries.c @@ -0,0 +1,62 @@ +/* File produced by user eschnett */ +/* Produced with Mathematica Version 6.0 for Mac OS X x86 (32-bit) (April 20, 2007) */ + +/* Mathematica script written by Ian Hinder and Sascha Husa */ + +#include "cctk.h" +#include "cctk_Arguments.h" +#include "cctk_Parameters.h" +#include "Symmetry.h" + +void MLFO_WaveToy_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, "MLFO_WaveToy::rho"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "MLFO_WaveToy::u"); + + sym[0] = -1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "MLFO_WaveToy::v1"); + + sym[0] = 1; + sym[1] = -1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "MLFO_WaveToy::v2"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = -1; + SetCartSymVN(cctkGH, sym, "MLFO_WaveToy::v3"); + + sym[0] = -1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "MLFO_WaveToy::w1"); + + sym[0] = 1; + sym[1] = -1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "MLFO_WaveToy::w2"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = -1; + SetCartSymVN(cctkGH, sym, "MLFO_WaveToy::w3"); + +} diff --git a/MLFO_WaveToy/src/Startup.c b/MLFO_WaveToy/src/Startup.c new file mode 100644 index 0000000..d630b6d --- /dev/null +++ b/MLFO_WaveToy/src/Startup.c @@ -0,0 +1,13 @@ +/* File produced by user eschnett */ +/* Produced with Mathematica Version 6.0 for Mac OS X x86 (32-bit) (April 20, 2007) */ + +/* Mathematica script written by Ian Hinder and Sascha Husa */ + +#include "cctk.h" + +int MLFO_WaveToy_Startup(void) +{ + const char * banner = "MLFO_WaveToy"; + CCTK_RegisterBanner(banner); + return 0; +} diff --git a/MLFO_WaveToy/src/WTFO_Gaussian.c b/MLFO_WaveToy/src/WTFO_Gaussian.c new file mode 100644 index 0000000..b638cbc --- /dev/null +++ b/MLFO_WaveToy/src/WTFO_Gaussian.c @@ -0,0 +1,146 @@ +/* File produced by user eschnett */ +/* Produced with Mathematica Version 6.0 for Mac OS X x86 (32-bit) (April 20, 2007) */ + +/* Mathematica script written by Ian Hinder and Sascha Husa */ + +#define KRANC_C + +#include <math.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 *cctkGH, CCTK_INT dir, CCTK_INT face, CCTK_REAL normal[3], CCTK_REAL tangentA[3], CCTK_REAL tangentB[3], CCTK_INT min[3], CCTK_INT max[3], CCTK_INT n_subblock_gfs, CCTK_REAL *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 */ + 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/MLFO_WaveToy/src/WTFO_RHS.c b/MLFO_WaveToy/src/WTFO_RHS.c new file mode 100644 index 0000000..58c152a --- /dev/null +++ b/MLFO_WaveToy/src/WTFO_RHS.c @@ -0,0 +1,214 @@ +/* File produced by user eschnett */ +/* Produced with Mathematica Version 6.0 for Mac OS X x86 (32-bit) (April 20, 2007) */ + +/* Mathematica script written by Ian Hinder and Sascha Husa */ + +#define KRANC_C + +#include <math.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 *cctkGH, CCTK_INT dir, CCTK_INT face, CCTK_REAL normal[3], CCTK_REAL tangentA[3], CCTK_REAL tangentB[3], CCTK_INT min[3], CCTK_INT max[3], CCTK_INT n_subblock_gfs, CCTK_REAL *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 */ + 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 */ + CCTK_REAL Jinv11 = INITVALUE, Jinv12 = INITVALUE, Jinv13 = INITVALUE, Jinv21 = INITVALUE, Jinv22 = INITVALUE, Jinv23 = INITVALUE; + CCTK_REAL Jinv31 = INITVALUE, Jinv32 = INITVALUE, Jinv33 = INITVALUE; + + /* Declare local copies of grid functions */ + CCTK_REAL dadxL = INITVALUE; + CCTK_REAL dadyL = INITVALUE; + CCTK_REAL dadzL = INITVALUE; + CCTK_REAL dbdxL = INITVALUE; + CCTK_REAL dbdyL = INITVALUE; + CCTK_REAL dbdzL = INITVALUE; + CCTK_REAL dcdxL = INITVALUE; + CCTK_REAL dcdyL = INITVALUE; + CCTK_REAL dcdzL = INITVALUE; + 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 PDstandardNth2v1 = INITVALUE; + CCTK_REAL PDstandardNth3v1 = INITVALUE; + CCTK_REAL PDstandardNth1v2 = INITVALUE; + CCTK_REAL PDstandardNth2v2 = INITVALUE; + CCTK_REAL PDstandardNth3v2 = INITVALUE; + CCTK_REAL PDstandardNth1v3 = INITVALUE; + CCTK_REAL PDstandardNth2v3 = INITVALUE; + CCTK_REAL PDstandardNth3v3 = INITVALUE; + + /* Assign local copies of grid functions */ + dadxL = dadx[index]; + dadyL = dady[index]; + dadzL = dadz[index]; + dbdxL = dbdx[index]; + dbdyL = dbdy[index]; + dbdzL = dbdz[index]; + dcdxL = dcdx[index]; + dcdyL = dcdy[index]; + dcdzL = dcdz[index]; + 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); + PDstandardNth2v1 = PDstandardNth2(v1, i, j, k); + PDstandardNth3v1 = PDstandardNth3(v1, i, j, k); + PDstandardNth1v2 = PDstandardNth1(v2, i, j, k); + PDstandardNth2v2 = PDstandardNth2(v2, i, j, k); + PDstandardNth3v2 = PDstandardNth3(v2, i, j, k); + PDstandardNth1v3 = PDstandardNth1(v3, i, j, k); + PDstandardNth2v3 = PDstandardNth2(v3, i, j, k); + PDstandardNth3v3 = PDstandardNth3(v3, i, j, k); + + /* Precompute derivatives (old style) */ + + /* Calculate temporaries and grid functions */ + Jinv11 = dadxL; + + Jinv12 = dadyL; + + Jinv13 = dadzL; + + Jinv21 = dbdxL; + + Jinv22 = dbdyL; + + Jinv23 = dbdzL; + + Jinv31 = dcdxL; + + Jinv32 = dcdyL; + + Jinv33 = dcdzL; + + urhsL = rhoL; + + rhorhsL = Jinv11*PDstandardNth1v1 + Jinv12*PDstandardNth1v2 + Jinv13*PDstandardNth1v3 + Jinv21*PDstandardNth2v1 + + Jinv22*PDstandardNth2v2 + Jinv23*PDstandardNth2v3 + Jinv31*PDstandardNth3v1 + Jinv32*PDstandardNth3v2 + + Jinv33*PDstandardNth3v3; + + v1rhsL = Jinv11*PDstandardNth1rho + Jinv21*PDstandardNth2rho + Jinv31*PDstandardNth3rho; + + v2rhsL = Jinv12*PDstandardNth1rho + Jinv22*PDstandardNth2rho + Jinv32*PDstandardNth3rho; + + v3rhsL = Jinv13*PDstandardNth1rho + Jinv23*PDstandardNth2rho + Jinv33*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/MLFO_WaveToy/src/WTFO_constraints.c b/MLFO_WaveToy/src/WTFO_constraints.c new file mode 100644 index 0000000..3d20a99 --- /dev/null +++ b/MLFO_WaveToy/src/WTFO_constraints.c @@ -0,0 +1,201 @@ +/* File produced by user eschnett */ +/* Produced with Mathematica Version 6.0 for Mac OS X x86 (32-bit) (April 20, 2007) */ + +/* Mathematica script written by Ian Hinder and Sascha Husa */ + +#define KRANC_C + +#include <math.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 *cctkGH, CCTK_INT dir, CCTK_INT face, CCTK_REAL normal[3], CCTK_REAL tangentA[3], CCTK_REAL tangentB[3], CCTK_INT min[3], CCTK_INT max[3], CCTK_INT n_subblock_gfs, CCTK_REAL *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 */ + 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 */ + CCTK_REAL Jinv11 = INITVALUE, Jinv12 = INITVALUE, Jinv13 = INITVALUE, Jinv21 = INITVALUE, Jinv22 = INITVALUE, Jinv23 = INITVALUE; + CCTK_REAL Jinv31 = INITVALUE, Jinv32 = INITVALUE, Jinv33 = INITVALUE; + + /* Declare local copies of grid functions */ + CCTK_REAL dadxL = INITVALUE; + CCTK_REAL dadyL = INITVALUE; + CCTK_REAL dadzL = INITVALUE; + CCTK_REAL dbdxL = INITVALUE; + CCTK_REAL dbdyL = INITVALUE; + CCTK_REAL dbdzL = INITVALUE; + CCTK_REAL dcdxL = INITVALUE; + CCTK_REAL dcdyL = INITVALUE; + CCTK_REAL dcdzL = INITVALUE; + CCTK_REAL v1L = INITVALUE, v2L = INITVALUE, v3L = INITVALUE; + CCTK_REAL w1L = INITVALUE, w2L = INITVALUE, w3L = INITVALUE; + /* Declare precomputed derivatives*/ + + /* Declare derivatives */ + CCTK_REAL PDstandardNth1v1 = INITVALUE; + CCTK_REAL PDstandardNth2v1 = INITVALUE; + CCTK_REAL PDstandardNth3v1 = INITVALUE; + CCTK_REAL PDstandardNth1v2 = INITVALUE; + CCTK_REAL PDstandardNth2v2 = INITVALUE; + CCTK_REAL PDstandardNth3v2 = INITVALUE; + CCTK_REAL PDstandardNth1v3 = INITVALUE; + CCTK_REAL PDstandardNth2v3 = INITVALUE; + CCTK_REAL PDstandardNth3v3 = INITVALUE; + + /* Assign local copies of grid functions */ + dadxL = dadx[index]; + dadyL = dady[index]; + dadzL = dadz[index]; + dbdxL = dbdx[index]; + dbdyL = dbdy[index]; + dbdzL = dbdz[index]; + dcdxL = dcdx[index]; + dcdyL = dcdy[index]; + dcdzL = dcdz[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) */ + PDstandardNth1v1 = PDstandardNth1(v1, i, j, k); + PDstandardNth2v1 = PDstandardNth2(v1, i, j, k); + PDstandardNth3v1 = PDstandardNth3(v1, i, j, k); + PDstandardNth1v2 = PDstandardNth1(v2, i, j, k); + PDstandardNth2v2 = PDstandardNth2(v2, i, j, k); + PDstandardNth3v2 = PDstandardNth3(v2, i, j, k); + PDstandardNth1v3 = PDstandardNth1(v3, i, j, k); + PDstandardNth2v3 = PDstandardNth2(v3, i, j, k); + PDstandardNth3v3 = PDstandardNth3(v3, i, j, k); + + /* Precompute derivatives (old style) */ + + /* Calculate temporaries and grid functions */ + Jinv11 = dadxL; + + Jinv12 = dadyL; + + Jinv13 = dadzL; + + Jinv21 = dbdxL; + + Jinv22 = dbdyL; + + Jinv23 = dbdzL; + + Jinv31 = dcdxL; + + Jinv32 = dcdyL; + + Jinv33 = dcdzL; + + w1L = Jinv13*PDstandardNth1v2 - Jinv12*PDstandardNth1v3 + Jinv23*PDstandardNth2v2 - Jinv22*PDstandardNth2v3 + + Jinv33*PDstandardNth3v2 - Jinv32*PDstandardNth3v3; + + w2L = -(Jinv13*PDstandardNth1v1) + Jinv11*PDstandardNth1v3 - Jinv23*PDstandardNth2v1 + Jinv21*PDstandardNth2v3 - + Jinv33*PDstandardNth3v1 + Jinv31*PDstandardNth3v3; + + w3L = Jinv12*PDstandardNth1v1 - Jinv11*PDstandardNth1v2 + Jinv22*PDstandardNth2v1 - Jinv21*PDstandardNth2v2 + + Jinv32*PDstandardNth3v1 - Jinv31*PDstandardNth3v2; + + + /* 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/MLFO_WaveToy/src/make.code.defn b/MLFO_WaveToy/src/make.code.defn new file mode 100644 index 0000000..c034141 --- /dev/null +++ b/MLFO_WaveToy/src/make.code.defn @@ -0,0 +1,6 @@ +# File produced by user eschnett +# Produced with Mathematica Version 6.0 for Mac OS X x86 (32-bit) (April 20, 2007) + +# Mathematica script written by Ian Hinder and Sascha Husa + +SRCS = Startup.c RegisterMoL.c RegisterSymmetries.c WTFO_Gaussian.c WTFO_RHS.c WTFO_constraints.c Boundaries.c |