diff options
171 files changed, 53827 insertions, 0 deletions
diff --git a/ML_ADM/src/Boundaries.cc b/ML_ADM/src/Boundaries.cc new file mode 100644 index 0000000..4e20959 --- /dev/null +++ b/ML_ADM/src/Boundaries.cc @@ -0,0 +1,1081 @@ +/* File produced by Kranc */ + +#include "cctk.h" +#include "cctk_Arguments.h" +#include "cctk_Parameters.h" +#include "cctk_Faces.h" +#include "util_Table.h" +#include "Symmetry.h" + + +/* the boundary treatment is split into 3 steps: */ +/* 1. excision */ +/* 2. symmetries */ +/* 3. "other" boundary conditions, e.g. radiative */ + +/* to simplify scheduling and testing, the 3 steps */ +/* are currently applied in separate functions */ + + +extern "C" void ML_ADM_CheckBoundaries(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + return; +} + +extern "C" void ML_ADM_SelectBoundConds(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT ierr = 0; + + if (CCTK_EQUALS(ML_curv_bound, "none" ) || + CCTK_EQUALS(ML_curv_bound, "static") || + CCTK_EQUALS(ML_curv_bound, "flat" ) || + CCTK_EQUALS(ML_curv_bound, "zero" ) ) + { + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_ADM::ML_curv", ML_curv_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register ML_curv_bound BC for ML_ADM::ML_curv!"); + } + + if (CCTK_EQUALS(ML_lapse_bound, "none" ) || + CCTK_EQUALS(ML_lapse_bound, "static") || + CCTK_EQUALS(ML_lapse_bound, "flat" ) || + CCTK_EQUALS(ML_lapse_bound, "zero" ) ) + { + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_ADM::ML_lapse", ML_lapse_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register ML_lapse_bound BC for ML_ADM::ML_lapse!"); + } + + if (CCTK_EQUALS(ML_metric_bound, "none" ) || + CCTK_EQUALS(ML_metric_bound, "static") || + CCTK_EQUALS(ML_metric_bound, "flat" ) || + CCTK_EQUALS(ML_metric_bound, "zero" ) ) + { + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_ADM::ML_metric", ML_metric_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register ML_metric_bound BC for ML_ADM::ML_metric!"); + } + + if (CCTK_EQUALS(ML_shift_bound, "none" ) || + CCTK_EQUALS(ML_shift_bound, "static") || + CCTK_EQUALS(ML_shift_bound, "flat" ) || + CCTK_EQUALS(ML_shift_bound, "zero" ) ) + { + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_ADM::ML_shift", ML_shift_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register ML_shift_bound BC for ML_ADM::ML_shift!"); + } + + if (CCTK_EQUALS(K11_bound, "none" ) || + CCTK_EQUALS(K11_bound, "static") || + CCTK_EQUALS(K11_bound, "flat" ) || + CCTK_EQUALS(K11_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_ADM::K11", K11_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register K11_bound BC for ML_ADM::K11!"); + } + + if (CCTK_EQUALS(K12_bound, "none" ) || + CCTK_EQUALS(K12_bound, "static") || + CCTK_EQUALS(K12_bound, "flat" ) || + CCTK_EQUALS(K12_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_ADM::K12", K12_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register K12_bound BC for ML_ADM::K12!"); + } + + if (CCTK_EQUALS(K13_bound, "none" ) || + CCTK_EQUALS(K13_bound, "static") || + CCTK_EQUALS(K13_bound, "flat" ) || + CCTK_EQUALS(K13_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_ADM::K13", K13_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register K13_bound BC for ML_ADM::K13!"); + } + + if (CCTK_EQUALS(K22_bound, "none" ) || + CCTK_EQUALS(K22_bound, "static") || + CCTK_EQUALS(K22_bound, "flat" ) || + CCTK_EQUALS(K22_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_ADM::K22", K22_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register K22_bound BC for ML_ADM::K22!"); + } + + if (CCTK_EQUALS(K23_bound, "none" ) || + CCTK_EQUALS(K23_bound, "static") || + CCTK_EQUALS(K23_bound, "flat" ) || + CCTK_EQUALS(K23_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_ADM::K23", K23_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register K23_bound BC for ML_ADM::K23!"); + } + + if (CCTK_EQUALS(K33_bound, "none" ) || + CCTK_EQUALS(K33_bound, "static") || + CCTK_EQUALS(K33_bound, "flat" ) || + CCTK_EQUALS(K33_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_ADM::K33", K33_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register K33_bound BC for ML_ADM::K33!"); + } + + if (CCTK_EQUALS(alpha_bound, "none" ) || + CCTK_EQUALS(alpha_bound, "static") || + CCTK_EQUALS(alpha_bound, "flat" ) || + CCTK_EQUALS(alpha_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_ADM::alpha", alpha_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register alpha_bound BC for ML_ADM::alpha!"); + } + + if (CCTK_EQUALS(g11_bound, "none" ) || + CCTK_EQUALS(g11_bound, "static") || + CCTK_EQUALS(g11_bound, "flat" ) || + CCTK_EQUALS(g11_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_ADM::g11", g11_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register g11_bound BC for ML_ADM::g11!"); + } + + if (CCTK_EQUALS(g12_bound, "none" ) || + CCTK_EQUALS(g12_bound, "static") || + CCTK_EQUALS(g12_bound, "flat" ) || + CCTK_EQUALS(g12_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_ADM::g12", g12_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register g12_bound BC for ML_ADM::g12!"); + } + + if (CCTK_EQUALS(g13_bound, "none" ) || + CCTK_EQUALS(g13_bound, "static") || + CCTK_EQUALS(g13_bound, "flat" ) || + CCTK_EQUALS(g13_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_ADM::g13", g13_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register g13_bound BC for ML_ADM::g13!"); + } + + if (CCTK_EQUALS(g22_bound, "none" ) || + CCTK_EQUALS(g22_bound, "static") || + CCTK_EQUALS(g22_bound, "flat" ) || + CCTK_EQUALS(g22_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_ADM::g22", g22_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register g22_bound BC for ML_ADM::g22!"); + } + + if (CCTK_EQUALS(g23_bound, "none" ) || + CCTK_EQUALS(g23_bound, "static") || + CCTK_EQUALS(g23_bound, "flat" ) || + CCTK_EQUALS(g23_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_ADM::g23", g23_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register g23_bound BC for ML_ADM::g23!"); + } + + if (CCTK_EQUALS(g33_bound, "none" ) || + CCTK_EQUALS(g33_bound, "static") || + CCTK_EQUALS(g33_bound, "flat" ) || + CCTK_EQUALS(g33_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_ADM::g33", g33_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register g33_bound BC for ML_ADM::g33!"); + } + + if (CCTK_EQUALS(beta1_bound, "none" ) || + CCTK_EQUALS(beta1_bound, "static") || + CCTK_EQUALS(beta1_bound, "flat" ) || + CCTK_EQUALS(beta1_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_ADM::beta1", beta1_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register beta1_bound BC for ML_ADM::beta1!"); + } + + if (CCTK_EQUALS(beta2_bound, "none" ) || + CCTK_EQUALS(beta2_bound, "static") || + CCTK_EQUALS(beta2_bound, "flat" ) || + CCTK_EQUALS(beta2_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_ADM::beta2", beta2_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register beta2_bound BC for ML_ADM::beta2!"); + } + + if (CCTK_EQUALS(beta3_bound, "none" ) || + CCTK_EQUALS(beta3_bound, "static") || + CCTK_EQUALS(beta3_bound, "flat" ) || + CCTK_EQUALS(beta3_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_ADM::beta3", beta3_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register beta3_bound BC for ML_ADM::beta3!"); + } + + if (CCTK_EQUALS(ML_curv_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_ML_curv_bound = -1; + if (handle_ML_curv_bound < 0) handle_ML_curv_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_curv_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_curv_bound , ML_curv_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_ML_curv_bound ,ML_curv_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_curv_bound, + "ML_ADM::ML_curv", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_ADM::ML_curv!"); + + } + + if (CCTK_EQUALS(ML_lapse_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_ML_lapse_bound = -1; + if (handle_ML_lapse_bound < 0) handle_ML_lapse_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_lapse_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_lapse_bound , ML_lapse_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_ML_lapse_bound ,ML_lapse_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_lapse_bound, + "ML_ADM::ML_lapse", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_ADM::ML_lapse!"); + + } + + if (CCTK_EQUALS(ML_metric_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_ML_metric_bound = -1; + if (handle_ML_metric_bound < 0) handle_ML_metric_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_metric_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_metric_bound , ML_metric_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_ML_metric_bound ,ML_metric_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_metric_bound, + "ML_ADM::ML_metric", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_ADM::ML_metric!"); + + } + + if (CCTK_EQUALS(ML_shift_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_ML_shift_bound = -1; + if (handle_ML_shift_bound < 0) handle_ML_shift_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_shift_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_shift_bound , ML_shift_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_ML_shift_bound ,ML_shift_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_shift_bound, + "ML_ADM::ML_shift", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_ADM::ML_shift!"); + + } + + if (CCTK_EQUALS(K11_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_K11_bound = -1; + if (handle_K11_bound < 0) handle_K11_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_K11_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_K11_bound , K11_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_K11_bound ,K11_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_K11_bound, + "ML_ADM::K11", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_ADM::K11!"); + + } + + if (CCTK_EQUALS(K12_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_K12_bound = -1; + if (handle_K12_bound < 0) handle_K12_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_K12_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_K12_bound , K12_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_K12_bound ,K12_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_K12_bound, + "ML_ADM::K12", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_ADM::K12!"); + + } + + if (CCTK_EQUALS(K13_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_K13_bound = -1; + if (handle_K13_bound < 0) handle_K13_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_K13_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_K13_bound , K13_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_K13_bound ,K13_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_K13_bound, + "ML_ADM::K13", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_ADM::K13!"); + + } + + if (CCTK_EQUALS(K22_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_K22_bound = -1; + if (handle_K22_bound < 0) handle_K22_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_K22_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_K22_bound , K22_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_K22_bound ,K22_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_K22_bound, + "ML_ADM::K22", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_ADM::K22!"); + + } + + if (CCTK_EQUALS(K23_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_K23_bound = -1; + if (handle_K23_bound < 0) handle_K23_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_K23_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_K23_bound , K23_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_K23_bound ,K23_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_K23_bound, + "ML_ADM::K23", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_ADM::K23!"); + + } + + if (CCTK_EQUALS(K33_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_K33_bound = -1; + if (handle_K33_bound < 0) handle_K33_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_K33_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_K33_bound , K33_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_K33_bound ,K33_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_K33_bound, + "ML_ADM::K33", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_ADM::K33!"); + + } + + if (CCTK_EQUALS(alpha_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_alpha_bound = -1; + if (handle_alpha_bound < 0) handle_alpha_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_alpha_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_alpha_bound , alpha_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_alpha_bound ,alpha_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_alpha_bound, + "ML_ADM::alpha", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_ADM::alpha!"); + + } + + if (CCTK_EQUALS(g11_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_g11_bound = -1; + if (handle_g11_bound < 0) handle_g11_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_g11_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_g11_bound , g11_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_g11_bound ,g11_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_g11_bound, + "ML_ADM::g11", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_ADM::g11!"); + + } + + if (CCTK_EQUALS(g12_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_g12_bound = -1; + if (handle_g12_bound < 0) handle_g12_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_g12_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_g12_bound , g12_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_g12_bound ,g12_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_g12_bound, + "ML_ADM::g12", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_ADM::g12!"); + + } + + if (CCTK_EQUALS(g13_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_g13_bound = -1; + if (handle_g13_bound < 0) handle_g13_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_g13_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_g13_bound , g13_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_g13_bound ,g13_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_g13_bound, + "ML_ADM::g13", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_ADM::g13!"); + + } + + if (CCTK_EQUALS(g22_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_g22_bound = -1; + if (handle_g22_bound < 0) handle_g22_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_g22_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_g22_bound , g22_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_g22_bound ,g22_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_g22_bound, + "ML_ADM::g22", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_ADM::g22!"); + + } + + if (CCTK_EQUALS(g23_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_g23_bound = -1; + if (handle_g23_bound < 0) handle_g23_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_g23_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_g23_bound , g23_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_g23_bound ,g23_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_g23_bound, + "ML_ADM::g23", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_ADM::g23!"); + + } + + if (CCTK_EQUALS(g33_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_g33_bound = -1; + if (handle_g33_bound < 0) handle_g33_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_g33_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_g33_bound , g33_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_g33_bound ,g33_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_g33_bound, + "ML_ADM::g33", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_ADM::g33!"); + + } + + if (CCTK_EQUALS(beta1_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_beta1_bound = -1; + if (handle_beta1_bound < 0) handle_beta1_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_beta1_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_beta1_bound , beta1_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_beta1_bound ,beta1_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_beta1_bound, + "ML_ADM::beta1", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_ADM::beta1!"); + + } + + if (CCTK_EQUALS(beta2_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_beta2_bound = -1; + if (handle_beta2_bound < 0) handle_beta2_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_beta2_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_beta2_bound , beta2_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_beta2_bound ,beta2_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_beta2_bound, + "ML_ADM::beta2", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_ADM::beta2!"); + + } + + if (CCTK_EQUALS(beta3_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_beta3_bound = -1; + if (handle_beta3_bound < 0) handle_beta3_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_beta3_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_beta3_bound , beta3_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_beta3_bound ,beta3_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_beta3_bound, + "ML_ADM::beta3", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_ADM::beta3!"); + + } + + if (CCTK_EQUALS(ML_curv_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_ML_curv_bound = -1; + if (handle_ML_curv_bound < 0) handle_ML_curv_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_curv_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_curv_bound ,ML_curv_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_curv_bound, + "ML_ADM::ML_curv", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Scalar BC for ML_ADM::ML_curv!"); + + } + + if (CCTK_EQUALS(ML_lapse_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_ML_lapse_bound = -1; + if (handle_ML_lapse_bound < 0) handle_ML_lapse_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_lapse_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_lapse_bound ,ML_lapse_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_lapse_bound, + "ML_ADM::ML_lapse", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Scalar BC for ML_ADM::ML_lapse!"); + + } + + if (CCTK_EQUALS(ML_metric_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_ML_metric_bound = -1; + if (handle_ML_metric_bound < 0) handle_ML_metric_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_metric_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_metric_bound ,ML_metric_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_metric_bound, + "ML_ADM::ML_metric", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Scalar BC for ML_ADM::ML_metric!"); + + } + + if (CCTK_EQUALS(ML_shift_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_ML_shift_bound = -1; + if (handle_ML_shift_bound < 0) handle_ML_shift_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_shift_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_shift_bound ,ML_shift_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_shift_bound, + "ML_ADM::ML_shift", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Scalar BC for ML_ADM::ML_shift!"); + + } + + if (CCTK_EQUALS(K11_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_K11_bound = -1; + if (handle_K11_bound < 0) handle_K11_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_K11_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_K11_bound ,K11_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_K11_bound, + "ML_ADM::K11", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_ADM::K11!"); + + } + + if (CCTK_EQUALS(K12_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_K12_bound = -1; + if (handle_K12_bound < 0) handle_K12_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_K12_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_K12_bound ,K12_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_K12_bound, + "ML_ADM::K12", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_ADM::K12!"); + + } + + if (CCTK_EQUALS(K13_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_K13_bound = -1; + if (handle_K13_bound < 0) handle_K13_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_K13_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_K13_bound ,K13_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_K13_bound, + "ML_ADM::K13", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_ADM::K13!"); + + } + + if (CCTK_EQUALS(K22_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_K22_bound = -1; + if (handle_K22_bound < 0) handle_K22_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_K22_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_K22_bound ,K22_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_K22_bound, + "ML_ADM::K22", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_ADM::K22!"); + + } + + if (CCTK_EQUALS(K23_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_K23_bound = -1; + if (handle_K23_bound < 0) handle_K23_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_K23_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_K23_bound ,K23_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_K23_bound, + "ML_ADM::K23", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_ADM::K23!"); + + } + + if (CCTK_EQUALS(K33_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_K33_bound = -1; + if (handle_K33_bound < 0) handle_K33_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_K33_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_K33_bound ,K33_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_K33_bound, + "ML_ADM::K33", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_ADM::K33!"); + + } + + if (CCTK_EQUALS(alpha_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_alpha_bound = -1; + if (handle_alpha_bound < 0) handle_alpha_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_alpha_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_alpha_bound ,alpha_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_alpha_bound, + "ML_ADM::alpha", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_ADM::alpha!"); + + } + + if (CCTK_EQUALS(g11_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_g11_bound = -1; + if (handle_g11_bound < 0) handle_g11_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_g11_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_g11_bound ,g11_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_g11_bound, + "ML_ADM::g11", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_ADM::g11!"); + + } + + if (CCTK_EQUALS(g12_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_g12_bound = -1; + if (handle_g12_bound < 0) handle_g12_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_g12_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_g12_bound ,g12_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_g12_bound, + "ML_ADM::g12", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_ADM::g12!"); + + } + + if (CCTK_EQUALS(g13_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_g13_bound = -1; + if (handle_g13_bound < 0) handle_g13_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_g13_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_g13_bound ,g13_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_g13_bound, + "ML_ADM::g13", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_ADM::g13!"); + + } + + if (CCTK_EQUALS(g22_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_g22_bound = -1; + if (handle_g22_bound < 0) handle_g22_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_g22_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_g22_bound ,g22_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_g22_bound, + "ML_ADM::g22", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_ADM::g22!"); + + } + + if (CCTK_EQUALS(g23_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_g23_bound = -1; + if (handle_g23_bound < 0) handle_g23_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_g23_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_g23_bound ,g23_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_g23_bound, + "ML_ADM::g23", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_ADM::g23!"); + + } + + if (CCTK_EQUALS(g33_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_g33_bound = -1; + if (handle_g33_bound < 0) handle_g33_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_g33_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_g33_bound ,g33_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_g33_bound, + "ML_ADM::g33", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_ADM::g33!"); + + } + + if (CCTK_EQUALS(beta1_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_beta1_bound = -1; + if (handle_beta1_bound < 0) handle_beta1_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_beta1_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_beta1_bound ,beta1_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_beta1_bound, + "ML_ADM::beta1", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_ADM::beta1!"); + + } + + if (CCTK_EQUALS(beta2_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_beta2_bound = -1; + if (handle_beta2_bound < 0) handle_beta2_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_beta2_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_beta2_bound ,beta2_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_beta2_bound, + "ML_ADM::beta2", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_ADM::beta2!"); + + } + + if (CCTK_EQUALS(beta3_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_beta3_bound = -1; + if (handle_beta3_bound < 0) handle_beta3_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_beta3_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_beta3_bound ,beta3_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_beta3_bound, + "ML_ADM::beta3", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_ADM::beta3!"); + + } + return; +} + + + +/* template for entries in parameter file: +#$bound$#ML_ADM::ML_curv_bound = "skip" +#$bound$#ML_ADM::ML_curv_bound_speed = 1.0 +#$bound$#ML_ADM::ML_curv_bound_limit = 0.0 +#$bound$#ML_ADM::ML_curv_bound_scalar = 0.0 + +#$bound$#ML_ADM::ML_lapse_bound = "skip" +#$bound$#ML_ADM::ML_lapse_bound_speed = 1.0 +#$bound$#ML_ADM::ML_lapse_bound_limit = 0.0 +#$bound$#ML_ADM::ML_lapse_bound_scalar = 0.0 + +#$bound$#ML_ADM::ML_metric_bound = "skip" +#$bound$#ML_ADM::ML_metric_bound_speed = 1.0 +#$bound$#ML_ADM::ML_metric_bound_limit = 0.0 +#$bound$#ML_ADM::ML_metric_bound_scalar = 0.0 + +#$bound$#ML_ADM::ML_shift_bound = "skip" +#$bound$#ML_ADM::ML_shift_bound_speed = 1.0 +#$bound$#ML_ADM::ML_shift_bound_limit = 0.0 +#$bound$#ML_ADM::ML_shift_bound_scalar = 0.0 + +#$bound$#ML_ADM::K11_bound = "skip" +#$bound$#ML_ADM::K11_bound_speed = 1.0 +#$bound$#ML_ADM::K11_bound_limit = 0.0 +#$bound$#ML_ADM::K11_bound_scalar = 0.0 + +#$bound$#ML_ADM::K12_bound = "skip" +#$bound$#ML_ADM::K12_bound_speed = 1.0 +#$bound$#ML_ADM::K12_bound_limit = 0.0 +#$bound$#ML_ADM::K12_bound_scalar = 0.0 + +#$bound$#ML_ADM::K13_bound = "skip" +#$bound$#ML_ADM::K13_bound_speed = 1.0 +#$bound$#ML_ADM::K13_bound_limit = 0.0 +#$bound$#ML_ADM::K13_bound_scalar = 0.0 + +#$bound$#ML_ADM::K22_bound = "skip" +#$bound$#ML_ADM::K22_bound_speed = 1.0 +#$bound$#ML_ADM::K22_bound_limit = 0.0 +#$bound$#ML_ADM::K22_bound_scalar = 0.0 + +#$bound$#ML_ADM::K23_bound = "skip" +#$bound$#ML_ADM::K23_bound_speed = 1.0 +#$bound$#ML_ADM::K23_bound_limit = 0.0 +#$bound$#ML_ADM::K23_bound_scalar = 0.0 + +#$bound$#ML_ADM::K33_bound = "skip" +#$bound$#ML_ADM::K33_bound_speed = 1.0 +#$bound$#ML_ADM::K33_bound_limit = 0.0 +#$bound$#ML_ADM::K33_bound_scalar = 0.0 + +#$bound$#ML_ADM::alpha_bound = "skip" +#$bound$#ML_ADM::alpha_bound_speed = 1.0 +#$bound$#ML_ADM::alpha_bound_limit = 0.0 +#$bound$#ML_ADM::alpha_bound_scalar = 0.0 + +#$bound$#ML_ADM::g11_bound = "skip" +#$bound$#ML_ADM::g11_bound_speed = 1.0 +#$bound$#ML_ADM::g11_bound_limit = 0.0 +#$bound$#ML_ADM::g11_bound_scalar = 0.0 + +#$bound$#ML_ADM::g12_bound = "skip" +#$bound$#ML_ADM::g12_bound_speed = 1.0 +#$bound$#ML_ADM::g12_bound_limit = 0.0 +#$bound$#ML_ADM::g12_bound_scalar = 0.0 + +#$bound$#ML_ADM::g13_bound = "skip" +#$bound$#ML_ADM::g13_bound_speed = 1.0 +#$bound$#ML_ADM::g13_bound_limit = 0.0 +#$bound$#ML_ADM::g13_bound_scalar = 0.0 + +#$bound$#ML_ADM::g22_bound = "skip" +#$bound$#ML_ADM::g22_bound_speed = 1.0 +#$bound$#ML_ADM::g22_bound_limit = 0.0 +#$bound$#ML_ADM::g22_bound_scalar = 0.0 + +#$bound$#ML_ADM::g23_bound = "skip" +#$bound$#ML_ADM::g23_bound_speed = 1.0 +#$bound$#ML_ADM::g23_bound_limit = 0.0 +#$bound$#ML_ADM::g23_bound_scalar = 0.0 + +#$bound$#ML_ADM::g33_bound = "skip" +#$bound$#ML_ADM::g33_bound_speed = 1.0 +#$bound$#ML_ADM::g33_bound_limit = 0.0 +#$bound$#ML_ADM::g33_bound_scalar = 0.0 + +#$bound$#ML_ADM::beta1_bound = "skip" +#$bound$#ML_ADM::beta1_bound_speed = 1.0 +#$bound$#ML_ADM::beta1_bound_limit = 0.0 +#$bound$#ML_ADM::beta1_bound_scalar = 0.0 + +#$bound$#ML_ADM::beta2_bound = "skip" +#$bound$#ML_ADM::beta2_bound_speed = 1.0 +#$bound$#ML_ADM::beta2_bound_limit = 0.0 +#$bound$#ML_ADM::beta2_bound_scalar = 0.0 + +#$bound$#ML_ADM::beta3_bound = "skip" +#$bound$#ML_ADM::beta3_bound_speed = 1.0 +#$bound$#ML_ADM::beta3_bound_limit = 0.0 +#$bound$#ML_ADM::beta3_bound_scalar = 0.0 + +*/ + diff --git a/ML_ADM/src/ML_ADM_Minkowski.cc b/ML_ADM/src/ML_ADM_Minkowski.cc new file mode 100644 index 0000000..59b9661 --- /dev/null +++ b/ML_ADM/src/ML_ADM_Minkowski.cc @@ -0,0 +1,151 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +static void ML_ADM_Minkowski_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_ADM_Minkowski_Body"); + } + + if (cctk_iteration % ML_ADM_Minkowski_calc_every != ML_ADM_Minkowski_calc_offset) + { + return; + } + + const char *groups[] = {"ML_ADM::ML_curv","ML_ADM::ML_lapse","ML_ADM::ML_metric","ML_ADM::ML_shift"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_ADM_Minkowski", 4, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o12dx = 0.0833333333333333333333333333333*INV(dx); + CCTK_REAL const p1o12dy = 0.0833333333333333333333333333333*INV(dy); + CCTK_REAL const p1o12dz = 0.0833333333333333333333333333333*INV(dz); + CCTK_REAL const p1o144dxdy = 0.00694444444444444444444444444444*INV(dx)*INV(dy); + CCTK_REAL const p1o144dxdz = 0.00694444444444444444444444444444*INV(dx)*INV(dz); + CCTK_REAL const p1o144dydz = 0.00694444444444444444444444444444*INV(dy)*INV(dz); + CCTK_REAL const pm1o12dx2 = -0.0833333333333333333333333333333*INV(SQR(dx)); + CCTK_REAL const pm1o12dy2 = -0.0833333333333333333333333333333*INV(SQR(dy)); + CCTK_REAL const pm1o12dz2 = -0.0833333333333333333333333333333*INV(SQR(dz)); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_ADM_Minkowski, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + + /* Include user supplied include files */ + + /* Precompute derivatives */ + + /* Calculate temporaries and grid functions */ + CCTK_REAL g11L = 1; + + CCTK_REAL g12L = 0; + + CCTK_REAL g13L = 0; + + CCTK_REAL g22L = 1; + + CCTK_REAL g23L = 0; + + CCTK_REAL g33L = 1; + + CCTK_REAL K11L = 0; + + CCTK_REAL K12L = 0; + + CCTK_REAL K13L = 0; + + CCTK_REAL K22L = 0; + + CCTK_REAL K23L = 0; + + CCTK_REAL K33L = 0; + + CCTK_REAL alphaL = 1; + + CCTK_REAL beta1L = 0; + + CCTK_REAL beta2L = 0; + + CCTK_REAL beta3L = 0; + + + /* Copy local copies back to grid functions */ + alpha[index] = alphaL; + beta1[index] = beta1L; + beta2[index] = beta2L; + beta3[index] = beta3L; + g11[index] = g11L; + g12[index] = g12L; + g13[index] = g13L; + g22[index] = g22L; + g23[index] = g23L; + g33[index] = g33L; + K11[index] = K11L; + K12[index] = K12L; + K13[index] = K13L; + K22[index] = K22L; + K23[index] = K23L; + K33[index] = K33L; + } + LC_ENDLOOP3 (ML_ADM_Minkowski); +} + +extern "C" void ML_ADM_Minkowski(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverEverything(cctkGH, &ML_ADM_Minkowski_Body); +} diff --git a/ML_ADM/src/ML_ADM_RHS.cc b/ML_ADM/src/ML_ADM_RHS.cc new file mode 100644 index 0000000..a03953e --- /dev/null +++ b/ML_ADM/src/ML_ADM_RHS.cc @@ -0,0 +1,482 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +extern "C" void ML_ADM_RHS_SelectBCs(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT ierr = 0; + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_ADM::ML_curvrhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_ADM::ML_curvrhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_ADM::ML_lapserhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_ADM::ML_lapserhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_ADM::ML_metricrhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_ADM::ML_metricrhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_ADM::ML_shiftrhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_ADM::ML_shiftrhs."); + return; +} + +static void ML_ADM_RHS_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_ADM_RHS_Body"); + } + + if (cctk_iteration % ML_ADM_RHS_calc_every != ML_ADM_RHS_calc_offset) + { + return; + } + + const char *groups[] = {"ML_ADM::ML_curv","ML_ADM::ML_curvrhs","ML_ADM::ML_lapse","ML_ADM::ML_lapserhs","ML_ADM::ML_metric","ML_ADM::ML_metricrhs","ML_ADM::ML_shift","ML_ADM::ML_shiftrhs"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_ADM_RHS", 8, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o12dx = 0.0833333333333333333333333333333*INV(dx); + CCTK_REAL const p1o12dy = 0.0833333333333333333333333333333*INV(dy); + CCTK_REAL const p1o12dz = 0.0833333333333333333333333333333*INV(dz); + CCTK_REAL const p1o144dxdy = 0.00694444444444444444444444444444*INV(dx)*INV(dy); + CCTK_REAL const p1o144dxdz = 0.00694444444444444444444444444444*INV(dx)*INV(dz); + CCTK_REAL const p1o144dydz = 0.00694444444444444444444444444444*INV(dy)*INV(dz); + CCTK_REAL const pm1o12dx2 = -0.0833333333333333333333333333333*INV(SQR(dx)); + CCTK_REAL const pm1o12dy2 = -0.0833333333333333333333333333333*INV(SQR(dy)); + CCTK_REAL const pm1o12dz2 = -0.0833333333333333333333333333333*INV(SQR(dz)); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_ADM_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]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + CCTK_REAL alphaL = alpha[index]; + CCTK_REAL beta1L = beta1[index]; + CCTK_REAL beta2L = beta2[index]; + CCTK_REAL beta3L = beta3[index]; + CCTK_REAL g11L = g11[index]; + CCTK_REAL g12L = g12[index]; + CCTK_REAL g13L = g13[index]; + CCTK_REAL g22L = g22[index]; + CCTK_REAL g23L = g23[index]; + CCTK_REAL g33L = g33[index]; + CCTK_REAL K11L = K11[index]; + CCTK_REAL K12L = K12[index]; + CCTK_REAL K13L = K13[index]; + CCTK_REAL K22L = K22[index]; + CCTK_REAL K23L = K23[index]; + CCTK_REAL K33L = K33[index]; + + /* Include user supplied include files */ + + /* Precompute derivatives */ + CCTK_REAL const PDstandardNth1alpha = PDstandardNth1(&alpha[index]); + CCTK_REAL const PDstandardNth2alpha = PDstandardNth2(&alpha[index]); + CCTK_REAL const PDstandardNth3alpha = PDstandardNth3(&alpha[index]); + CCTK_REAL const PDstandardNth11alpha = PDstandardNth11(&alpha[index]); + CCTK_REAL const PDstandardNth22alpha = PDstandardNth22(&alpha[index]); + CCTK_REAL const PDstandardNth33alpha = PDstandardNth33(&alpha[index]); + CCTK_REAL const PDstandardNth12alpha = PDstandardNth12(&alpha[index]); + CCTK_REAL const PDstandardNth13alpha = PDstandardNth13(&alpha[index]); + CCTK_REAL const PDstandardNth23alpha = PDstandardNth23(&alpha[index]); + CCTK_REAL const PDstandardNth1beta1 = PDstandardNth1(&beta1[index]); + CCTK_REAL const PDstandardNth2beta1 = PDstandardNth2(&beta1[index]); + CCTK_REAL const PDstandardNth3beta1 = PDstandardNth3(&beta1[index]); + CCTK_REAL const PDstandardNth1beta2 = PDstandardNth1(&beta2[index]); + CCTK_REAL const PDstandardNth2beta2 = PDstandardNth2(&beta2[index]); + CCTK_REAL const PDstandardNth3beta2 = PDstandardNth3(&beta2[index]); + CCTK_REAL const PDstandardNth1beta3 = PDstandardNth1(&beta3[index]); + CCTK_REAL const PDstandardNth2beta3 = PDstandardNth2(&beta3[index]); + CCTK_REAL const PDstandardNth3beta3 = PDstandardNth3(&beta3[index]); + CCTK_REAL const PDstandardNth1g11 = PDstandardNth1(&g11[index]); + CCTK_REAL const PDstandardNth2g11 = PDstandardNth2(&g11[index]); + CCTK_REAL const PDstandardNth3g11 = PDstandardNth3(&g11[index]); + CCTK_REAL const PDstandardNth22g11 = PDstandardNth22(&g11[index]); + CCTK_REAL const PDstandardNth33g11 = PDstandardNth33(&g11[index]); + CCTK_REAL const PDstandardNth23g11 = PDstandardNth23(&g11[index]); + CCTK_REAL const PDstandardNth1g12 = PDstandardNth1(&g12[index]); + CCTK_REAL const PDstandardNth2g12 = PDstandardNth2(&g12[index]); + CCTK_REAL const PDstandardNth3g12 = PDstandardNth3(&g12[index]); + CCTK_REAL const PDstandardNth33g12 = PDstandardNth33(&g12[index]); + CCTK_REAL const PDstandardNth12g12 = PDstandardNth12(&g12[index]); + CCTK_REAL const PDstandardNth13g12 = PDstandardNth13(&g12[index]); + CCTK_REAL const PDstandardNth23g12 = PDstandardNth23(&g12[index]); + CCTK_REAL const PDstandardNth1g13 = PDstandardNth1(&g13[index]); + CCTK_REAL const PDstandardNth2g13 = PDstandardNth2(&g13[index]); + CCTK_REAL const PDstandardNth3g13 = PDstandardNth3(&g13[index]); + CCTK_REAL const PDstandardNth22g13 = PDstandardNth22(&g13[index]); + CCTK_REAL const PDstandardNth12g13 = PDstandardNth12(&g13[index]); + CCTK_REAL const PDstandardNth13g13 = PDstandardNth13(&g13[index]); + CCTK_REAL const PDstandardNth23g13 = PDstandardNth23(&g13[index]); + CCTK_REAL const PDstandardNth1g22 = PDstandardNth1(&g22[index]); + CCTK_REAL const PDstandardNth2g22 = PDstandardNth2(&g22[index]); + CCTK_REAL const PDstandardNth3g22 = PDstandardNth3(&g22[index]); + CCTK_REAL const PDstandardNth11g22 = PDstandardNth11(&g22[index]); + CCTK_REAL const PDstandardNth33g22 = PDstandardNth33(&g22[index]); + CCTK_REAL const PDstandardNth13g22 = PDstandardNth13(&g22[index]); + CCTK_REAL const PDstandardNth1g23 = PDstandardNth1(&g23[index]); + CCTK_REAL const PDstandardNth2g23 = PDstandardNth2(&g23[index]); + CCTK_REAL const PDstandardNth3g23 = PDstandardNth3(&g23[index]); + CCTK_REAL const PDstandardNth11g23 = PDstandardNth11(&g23[index]); + CCTK_REAL const PDstandardNth12g23 = PDstandardNth12(&g23[index]); + CCTK_REAL const PDstandardNth13g23 = PDstandardNth13(&g23[index]); + CCTK_REAL const PDstandardNth23g23 = PDstandardNth23(&g23[index]); + CCTK_REAL const PDstandardNth1g33 = PDstandardNth1(&g33[index]); + CCTK_REAL const PDstandardNth2g33 = PDstandardNth2(&g33[index]); + CCTK_REAL const PDstandardNth3g33 = PDstandardNth3(&g33[index]); + CCTK_REAL const PDstandardNth11g33 = PDstandardNth11(&g33[index]); + CCTK_REAL const PDstandardNth22g33 = PDstandardNth22(&g33[index]); + CCTK_REAL const PDstandardNth12g33 = PDstandardNth12(&g33[index]); + CCTK_REAL const PDstandardNth1K11 = PDstandardNth1(&K11[index]); + CCTK_REAL const PDstandardNth2K11 = PDstandardNth2(&K11[index]); + CCTK_REAL const PDstandardNth3K11 = PDstandardNth3(&K11[index]); + CCTK_REAL const PDstandardNth1K12 = PDstandardNth1(&K12[index]); + CCTK_REAL const PDstandardNth2K12 = PDstandardNth2(&K12[index]); + CCTK_REAL const PDstandardNth3K12 = PDstandardNth3(&K12[index]); + CCTK_REAL const PDstandardNth1K13 = PDstandardNth1(&K13[index]); + CCTK_REAL const PDstandardNth2K13 = PDstandardNth2(&K13[index]); + CCTK_REAL const PDstandardNth3K13 = PDstandardNth3(&K13[index]); + CCTK_REAL const PDstandardNth1K22 = PDstandardNth1(&K22[index]); + CCTK_REAL const PDstandardNth2K22 = PDstandardNth2(&K22[index]); + CCTK_REAL const PDstandardNth3K22 = PDstandardNth3(&K22[index]); + CCTK_REAL const PDstandardNth1K23 = PDstandardNth1(&K23[index]); + CCTK_REAL const PDstandardNth2K23 = PDstandardNth2(&K23[index]); + CCTK_REAL const PDstandardNth3K23 = PDstandardNth3(&K23[index]); + CCTK_REAL const PDstandardNth1K33 = PDstandardNth1(&K33[index]); + CCTK_REAL const PDstandardNth2K33 = PDstandardNth2(&K33[index]); + CCTK_REAL const PDstandardNth3K33 = PDstandardNth3(&K33[index]); + + /* Calculate temporaries and grid functions */ + CCTK_REAL detg = 2*g12L*g13L*g23L + g33L*(g11L*g22L - SQR(g12L)) - + g22L*SQR(g13L) - g11L*SQR(g23L); + + CCTK_REAL gu11 = INV(detg)*(g22L*g33L - SQR(g23L)); + + CCTK_REAL gu12 = (g13L*g23L - g12L*g33L)*INV(detg); + + CCTK_REAL gu13 = (-(g13L*g22L) + g12L*g23L)*INV(detg); + + CCTK_REAL gu21 = (g13L*g23L - g12L*g33L)*INV(detg); + + CCTK_REAL gu22 = INV(detg)*(g11L*g33L - SQR(g13L)); + + CCTK_REAL gu23 = (g12L*g13L - g11L*g23L)*INV(detg); + + CCTK_REAL gu31 = (-(g13L*g22L) + g12L*g23L)*INV(detg); + + CCTK_REAL gu32 = (g12L*g13L - g11L*g23L)*INV(detg); + + CCTK_REAL gu33 = INV(detg)*(g11L*g22L - SQR(g12L)); + + CCTK_REAL G111 = 0.5*(gu11*PDstandardNth1g11 + + 2*(gu12*PDstandardNth1g12 + gu13*PDstandardNth1g13) - + gu12*PDstandardNth2g11 - gu13*PDstandardNth3g11); + + CCTK_REAL G211 = 0.5*(gu21*PDstandardNth1g11 + + 2*(gu22*PDstandardNth1g12 + gu23*PDstandardNth1g13) - + gu22*PDstandardNth2g11 - gu23*PDstandardNth3g11); + + CCTK_REAL G311 = 0.5*(gu31*PDstandardNth1g11 + + 2*(gu32*PDstandardNth1g12 + gu33*PDstandardNth1g13) - + gu32*PDstandardNth2g11 - gu33*PDstandardNth3g11); + + CCTK_REAL G112 = 0.5*(gu12*PDstandardNth1g22 + gu11*PDstandardNth2g11 + + gu13*(PDstandardNth1g23 + PDstandardNth2g13 - PDstandardNth3g12)); + + CCTK_REAL G212 = 0.5*(gu22*PDstandardNth1g22 + gu21*PDstandardNth2g11 + + gu23*(PDstandardNth1g23 + PDstandardNth2g13 - PDstandardNth3g12)); + + CCTK_REAL G312 = 0.5*(gu32*PDstandardNth1g22 + gu31*PDstandardNth2g11 + + gu33*(PDstandardNth1g23 + PDstandardNth2g13 - PDstandardNth3g12)); + + CCTK_REAL G113 = 0.5*(gu13*PDstandardNth1g33 + gu11*PDstandardNth3g11 + + gu12*(PDstandardNth1g23 - PDstandardNth2g13 + PDstandardNth3g12)); + + CCTK_REAL G213 = 0.5*(gu23*PDstandardNth1g33 + gu21*PDstandardNth3g11 + + gu22*(PDstandardNth1g23 - PDstandardNth2g13 + PDstandardNth3g12)); + + CCTK_REAL G313 = 0.5*(gu33*PDstandardNth1g33 + gu31*PDstandardNth3g11 + + gu32*(PDstandardNth1g23 - PDstandardNth2g13 + PDstandardNth3g12)); + + CCTK_REAL G122 = 0.5*(gu11*(-PDstandardNth1g22 + 2*PDstandardNth2g12) + + gu12*PDstandardNth2g22 + gu13*(2*PDstandardNth2g23 - + PDstandardNth3g22)); + + CCTK_REAL G222 = 0.5*(gu21*(-PDstandardNth1g22 + 2*PDstandardNth2g12) + + gu22*PDstandardNth2g22 + gu23*(2*PDstandardNth2g23 - + PDstandardNth3g22)); + + CCTK_REAL G322 = 0.5*(gu31*(-PDstandardNth1g22 + 2*PDstandardNth2g12) + + gu32*PDstandardNth2g22 + gu33*(2*PDstandardNth2g23 - + PDstandardNth3g22)); + + CCTK_REAL G123 = 0.5*(gu13*PDstandardNth2g33 + + gu11*(-PDstandardNth1g23 + PDstandardNth2g13 + PDstandardNth3g12) + + gu12*PDstandardNth3g22); + + CCTK_REAL G223 = 0.5*(gu23*PDstandardNth2g33 + + gu21*(-PDstandardNth1g23 + PDstandardNth2g13 + PDstandardNth3g12) + + gu22*PDstandardNth3g22); + + CCTK_REAL G323 = 0.5*(gu33*PDstandardNth2g33 + + gu31*(-PDstandardNth1g23 + PDstandardNth2g13 + PDstandardNth3g12) + + gu32*PDstandardNth3g22); + + CCTK_REAL G133 = 0.5*(gu11*(-PDstandardNth1g33 + 2*PDstandardNth3g13) + + gu12*(-PDstandardNth2g33 + 2*PDstandardNth3g23) + + gu13*PDstandardNth3g33); + + CCTK_REAL G233 = 0.5*(gu21*(-PDstandardNth1g33 + 2*PDstandardNth3g13) + + gu22*(-PDstandardNth2g33 + 2*PDstandardNth3g23) + + gu23*PDstandardNth3g33); + + CCTK_REAL G333 = 0.5*(gu31*(-PDstandardNth1g33 + 2*PDstandardNth3g13) + + gu32*(-PDstandardNth2g33 + 2*PDstandardNth3g23) + + gu33*PDstandardNth3g33); + + CCTK_REAL R11 = 2*(G112*G211 + G113*G311 + G213*G312) - G111*(G111 + + G212 + G313) - G211*(G112 + G222 + G323) - G311*(G113 + G223 + G333) + + 0.5*(-(gu22*(PDstandardNth11g22 - 2*PDstandardNth12g12 + + PDstandardNth22g11)) + gu23*(-PDstandardNth11g23 + PDstandardNth12g13 + + PDstandardNth13g12 - PDstandardNth23g11) + gu32*(-PDstandardNth11g23 + + PDstandardNth12g13 + PDstandardNth13g12 - PDstandardNth23g11) - + gu33*(PDstandardNth11g33 - 2*PDstandardNth13g13 + PDstandardNth33g11)) + + SQR(G111) + SQR(G212) + SQR(G313); + + CCTK_REAL R12 = 0.5*(2*(G122*G211 + G123*G311 + G213*G322 + G313*G323) + - 2*(G112*G212 + G112*G313 + G212*G323 + G312*G333 + + gu12*PDstandardNth12g12) + gu13*(PDstandardNth11g23 - + PDstandardNth12g13 - PDstandardNth13g12) + gu12*(PDstandardNth11g22 + + PDstandardNth22g11) + gu32*PDstandardNth22g13 + gu13*PDstandardNth23g11 + + gu32*(-PDstandardNth12g23 + PDstandardNth13g22 - PDstandardNth23g12) + + gu33*PDstandardNth23g13 + gu33*(-PDstandardNth12g33 + + PDstandardNth13g23 - PDstandardNth33g12)); + + CCTK_REAL R13 = 0.5*(2*(G123*G211 + G212*G223 + G133*G311 + G233*G312) + - 2*(G213*G222 + G223*G313 + G113*(G212 + G313) + + gu13*PDstandardNth13g13) + gu12*(PDstandardNth11g23 - + PDstandardNth12g13 - PDstandardNth13g12 + PDstandardNth23g11) + + gu22*(PDstandardNth12g23 - PDstandardNth13g22 - PDstandardNth22g13 + + PDstandardNth23g12) + gu13*(PDstandardNth11g33 + PDstandardNth33g11) + + gu23*(PDstandardNth12g33 - PDstandardNth13g23 - PDstandardNth23g13 + + PDstandardNth33g12)); + + CCTK_REAL R22 = -(G122*(G111 + G212 + G313)) + 2*(G122*G212 + + G123*G312 + G223*G322) - G222*(G112 + G222 + G323) - G322*(G113 + G223 + + G333) + 0.5*(-(gu11*(PDstandardNth11g22 - 2*PDstandardNth12g12 + + PDstandardNth22g11)) + gu13*(PDstandardNth12g23 - PDstandardNth13g22 - + PDstandardNth22g13 + PDstandardNth23g12) + gu31*(PDstandardNth12g23 - + PDstandardNth13g22 - PDstandardNth22g13 + PDstandardNth23g12) - + gu33*(PDstandardNth22g33 - 2*PDstandardNth23g23 + PDstandardNth33g22)) + + SQR(G112) + SQR(G222) + SQR(G323); + + CCTK_REAL R23 = 0.5*(2*(G112*G113 + G122*G213 + G133*G312 + G233*G322) + + gu11*(-PDstandardNth11g23 + PDstandardNth12g13 + PDstandardNth13g12 - + PDstandardNth23g11) + gu21*(-PDstandardNth12g23 + PDstandardNth13g22 + + PDstandardNth22g13 - PDstandardNth23g12) - 2*(G111*G123 + G113*G323 + + G223*(G112 + G323) + gu23*PDstandardNth23g23) + + gu13*(PDstandardNth12g33 - PDstandardNth13g23 - PDstandardNth23g13 + + PDstandardNth33g12) + gu23*(PDstandardNth22g33 + PDstandardNth33g22)); + + CCTK_REAL R33 = -(G133*(G111 + G212 + G313)) + 2*(G123*G213 + + G133*G313) + G233*(-G112 - G222 + G323) - G333*(G113 + G223 + G333) + + 0.5*(-(gu11*(PDstandardNth11g33 - 2*PDstandardNth13g13 + + PDstandardNth33g11)) + gu12*(-PDstandardNth12g33 + PDstandardNth13g23 + + PDstandardNth23g13 - PDstandardNth33g12) + gu21*(-PDstandardNth12g33 + + PDstandardNth13g23 + PDstandardNth23g13 - PDstandardNth33g12) - + gu22*(PDstandardNth22g33 - 2*PDstandardNth23g23 + PDstandardNth33g22)) + + SQR(G113) + SQR(G223) + SQR(G333); + + CCTK_REAL Km11 = gu11*K11L + gu12*K12L + gu13*K13L; + + CCTK_REAL Km21 = gu21*K11L + gu22*K12L + gu23*K13L; + + CCTK_REAL Km31 = gu31*K11L + gu32*K12L + gu33*K13L; + + CCTK_REAL Km12 = gu11*K12L + gu12*K22L + gu13*K23L; + + CCTK_REAL Km22 = gu21*K12L + gu22*K22L + gu23*K23L; + + CCTK_REAL Km32 = gu31*K12L + gu32*K22L + gu33*K23L; + + CCTK_REAL Km13 = gu11*K13L + gu12*K23L + gu13*K33L; + + CCTK_REAL Km23 = gu21*K13L + gu22*K23L + gu23*K33L; + + CCTK_REAL Km33 = gu31*K13L + gu32*K23L + gu33*K33L; + + CCTK_REAL trK = Km11 + Km22 + Km33; + + CCTK_REAL g11rhsL = -2*alphaL*K11L + 2*(g11L*PDstandardNth1beta1 + + g12L*PDstandardNth1beta2 + g13L*PDstandardNth1beta3) + + beta1L*PDstandardNth1g11 + beta2L*PDstandardNth2g11 + + beta3L*PDstandardNth3g11; + + CCTK_REAL g12rhsL = -2*alphaL*K12L + g22L*PDstandardNth1beta2 + + g23L*PDstandardNth1beta3 + beta1L*PDstandardNth1g12 + + g11L*PDstandardNth2beta1 + g12L*(PDstandardNth1beta1 + + PDstandardNth2beta2) + g13L*PDstandardNth2beta3 + + beta2L*PDstandardNth2g12 + beta3L*PDstandardNth3g12; + + CCTK_REAL g13rhsL = -2*alphaL*K13L + g23L*PDstandardNth1beta2 + + g33L*PDstandardNth1beta3 + beta1L*PDstandardNth1g13 + + beta2L*PDstandardNth2g13 + g11L*PDstandardNth3beta1 + + g12L*PDstandardNth3beta2 + g13L*(PDstandardNth1beta1 + + PDstandardNth3beta3) + beta3L*PDstandardNth3g13; + + CCTK_REAL g22rhsL = -2*alphaL*K22L + beta1L*PDstandardNth1g22 + + 2*(g12L*PDstandardNth2beta1 + g22L*PDstandardNth2beta2 + + g23L*PDstandardNth2beta3) + beta2L*PDstandardNth2g22 + + beta3L*PDstandardNth3g22; + + CCTK_REAL g23rhsL = -2*alphaL*K23L + beta1L*PDstandardNth1g23 + + g13L*PDstandardNth2beta1 + g33L*PDstandardNth2beta3 + + beta2L*PDstandardNth2g23 + g12L*PDstandardNth3beta1 + + g22L*PDstandardNth3beta2 + g23L*(PDstandardNth2beta2 + + PDstandardNth3beta3) + beta3L*PDstandardNth3g23; + + CCTK_REAL g33rhsL = -2*alphaL*K33L + beta1L*PDstandardNth1g33 + + beta2L*PDstandardNth2g33 + 2*(g13L*PDstandardNth3beta1 + + g23L*PDstandardNth3beta2 + g33L*PDstandardNth3beta3) + + beta3L*PDstandardNth3g33; + + CCTK_REAL K11rhsL = -PDstandardNth11alpha + G111*PDstandardNth1alpha + + 2*(K11L*PDstandardNth1beta1 + K12L*PDstandardNth1beta2 + + K13L*PDstandardNth1beta3) + beta1L*PDstandardNth1K11 + + G211*PDstandardNth2alpha + beta2L*PDstandardNth2K11 + + G311*PDstandardNth3alpha + beta3L*PDstandardNth3K11 + + alphaL*(-2*(K11L*Km11 + K12L*Km21 + K13L*Km31) + R11 + K11L*trK); + + CCTK_REAL K12rhsL = -PDstandardNth12alpha + G112*PDstandardNth1alpha + + K22L*PDstandardNth1beta2 + K23L*PDstandardNth1beta3 + + beta1L*PDstandardNth1K12 + G212*PDstandardNth2alpha + + K11L*PDstandardNth2beta1 + K12L*(PDstandardNth1beta1 + + PDstandardNth2beta2) + K13L*PDstandardNth2beta3 + + beta2L*PDstandardNth2K12 + G312*PDstandardNth3alpha + + beta3L*PDstandardNth3K12 + alphaL*(-2*(K11L*Km12 + K12L*Km22 + + K13L*Km32) + R12 + K12L*trK); + + CCTK_REAL K13rhsL = -PDstandardNth13alpha + G113*PDstandardNth1alpha + + K23L*PDstandardNth1beta2 + K33L*PDstandardNth1beta3 + + beta1L*PDstandardNth1K13 + G213*PDstandardNth2alpha + + beta2L*PDstandardNth2K13 + G313*PDstandardNth3alpha + + K11L*PDstandardNth3beta1 + K12L*PDstandardNth3beta2 + + K13L*(PDstandardNth1beta1 + PDstandardNth3beta3) + + beta3L*PDstandardNth3K13 + alphaL*(-2*(K11L*Km13 + K12L*Km23 + + K13L*Km33) + R13 + K13L*trK); + + CCTK_REAL K22rhsL = G122*PDstandardNth1alpha + + beta1L*PDstandardNth1K22 - PDstandardNth22alpha + + G222*PDstandardNth2alpha + 2*(K12L*PDstandardNth2beta1 + + K22L*PDstandardNth2beta2 + K23L*PDstandardNth2beta3) + + beta2L*PDstandardNth2K22 + G322*PDstandardNth3alpha + + beta3L*PDstandardNth3K22 + alphaL*(-2*(K12L*Km12 + K22L*Km22 + + K23L*Km32) + R22 + K22L*trK); + + CCTK_REAL K23rhsL = G123*PDstandardNth1alpha + + beta1L*PDstandardNth1K23 - PDstandardNth23alpha + + G223*PDstandardNth2alpha + K13L*PDstandardNth2beta1 + + K33L*PDstandardNth2beta3 + beta2L*PDstandardNth2K23 + + G323*PDstandardNth3alpha + K12L*PDstandardNth3beta1 + + K22L*PDstandardNth3beta2 + K23L*(PDstandardNth2beta2 + + PDstandardNth3beta3) + beta3L*PDstandardNth3K23 + alphaL*(-2*(K12L*Km13 + + K22L*Km23 + K23L*Km33) + R23 + K23L*trK); + + CCTK_REAL K33rhsL = G133*PDstandardNth1alpha + + beta1L*PDstandardNth1K33 + G233*PDstandardNth2alpha + + beta2L*PDstandardNth2K33 - PDstandardNth33alpha + + G333*PDstandardNth3alpha + 2*(K13L*PDstandardNth3beta1 + + K23L*PDstandardNth3beta2 + K33L*PDstandardNth3beta3) + + beta3L*PDstandardNth3K33 + alphaL*(-2*(K13L*Km13 + K23L*Km23 + + K33L*Km33) + R33 + K33L*trK); + + CCTK_REAL alpharhsL = 0; + + CCTK_REAL beta1rhsL = 0; + + CCTK_REAL beta2rhsL = 0; + + CCTK_REAL beta3rhsL = 0; + + + /* Copy local copies back to grid functions */ + alpharhs[index] = alpharhsL; + beta1rhs[index] = beta1rhsL; + beta2rhs[index] = beta2rhsL; + beta3rhs[index] = beta3rhsL; + g11rhs[index] = g11rhsL; + g12rhs[index] = g12rhsL; + g13rhs[index] = g13rhsL; + g22rhs[index] = g22rhsL; + g23rhs[index] = g23rhsL; + g33rhs[index] = g33rhsL; + K11rhs[index] = K11rhsL; + K12rhs[index] = K12rhsL; + K13rhs[index] = K13rhsL; + K22rhs[index] = K22rhsL; + K23rhs[index] = K23rhsL; + K33rhs[index] = K33rhsL; + } + LC_ENDLOOP3 (ML_ADM_RHS); +} + +extern "C" void ML_ADM_RHS(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverInterior(cctkGH, &ML_ADM_RHS_Body); +} diff --git a/ML_ADM/src/ML_ADM_boundary.cc b/ML_ADM/src/ML_ADM_boundary.cc new file mode 100644 index 0000000..790928b --- /dev/null +++ b/ML_ADM/src/ML_ADM_boundary.cc @@ -0,0 +1,172 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +extern "C" void ML_ADM_boundary_SelectBCs(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT ierr = 0; + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_ADM::ML_curv","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_ADM::ML_curv."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_ADM::ML_lapse","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_ADM::ML_lapse."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_ADM::ML_metric","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_ADM::ML_metric."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_ADM::ML_shift","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_ADM::ML_shift."); + return; +} + +static void ML_ADM_boundary_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_ADM_boundary_Body"); + } + + if (cctk_iteration % ML_ADM_boundary_calc_every != ML_ADM_boundary_calc_offset) + { + return; + } + + const char *groups[] = {"ML_ADM::ML_curv","ML_ADM::ML_lapse","ML_ADM::ML_metric","ML_ADM::ML_shift"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_ADM_boundary", 4, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o12dx = 0.0833333333333333333333333333333*INV(dx); + CCTK_REAL const p1o12dy = 0.0833333333333333333333333333333*INV(dy); + CCTK_REAL const p1o12dz = 0.0833333333333333333333333333333*INV(dz); + CCTK_REAL const p1o144dxdy = 0.00694444444444444444444444444444*INV(dx)*INV(dy); + CCTK_REAL const p1o144dxdz = 0.00694444444444444444444444444444*INV(dx)*INV(dz); + CCTK_REAL const p1o144dydz = 0.00694444444444444444444444444444*INV(dy)*INV(dz); + CCTK_REAL const pm1o12dx2 = -0.0833333333333333333333333333333*INV(SQR(dx)); + CCTK_REAL const pm1o12dy2 = -0.0833333333333333333333333333333*INV(SQR(dy)); + CCTK_REAL const pm1o12dz2 = -0.0833333333333333333333333333333*INV(SQR(dz)); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_ADM_boundary, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + + /* Include user supplied include files */ + + /* Precompute derivatives */ + + /* Calculate temporaries and grid functions */ + CCTK_REAL g11L = 1; + + CCTK_REAL g12L = 0; + + CCTK_REAL g13L = 0; + + CCTK_REAL g22L = 1; + + CCTK_REAL g23L = 0; + + CCTK_REAL g33L = 1; + + CCTK_REAL K11L = 0; + + CCTK_REAL K12L = 0; + + CCTK_REAL K13L = 0; + + CCTK_REAL K22L = 0; + + CCTK_REAL K23L = 0; + + CCTK_REAL K33L = 0; + + CCTK_REAL alphaL = 1; + + CCTK_REAL beta1L = 0; + + CCTK_REAL beta2L = 0; + + CCTK_REAL beta3L = 0; + + + /* Copy local copies back to grid functions */ + alpha[index] = alphaL; + beta1[index] = beta1L; + beta2[index] = beta2L; + beta3[index] = beta3L; + g11[index] = g11L; + g12[index] = g12L; + g13[index] = g13L; + g22[index] = g22L; + g23[index] = g23L; + g33[index] = g33L; + K11[index] = K11L; + K12[index] = K12L; + K13[index] = K13L; + K22[index] = K22L; + K23[index] = K23L; + K33[index] = K33L; + } + LC_ENDLOOP3 (ML_ADM_boundary); +} + +extern "C" void ML_ADM_boundary(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverBoundaryWithGhosts(cctkGH, &ML_ADM_boundary_Body); +} diff --git a/ML_ADM/src/ML_ADM_constraints.cc b/ML_ADM/src/ML_ADM_constraints.cc new file mode 100644 index 0000000..132f6e6 --- /dev/null +++ b/ML_ADM/src/ML_ADM_constraints.cc @@ -0,0 +1,390 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +extern "C" void ML_ADM_constraints_SelectBCs(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT ierr = 0; + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_ADM::ML_Ham","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_ADM::ML_Ham."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_ADM::ML_mom","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_ADM::ML_mom."); + return; +} + +static void ML_ADM_constraints_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_ADM_constraints_Body"); + } + + if (cctk_iteration % ML_ADM_constraints_calc_every != ML_ADM_constraints_calc_offset) + { + return; + } + + const char *groups[] = {"ML_ADM::ML_curv","ML_ADM::ML_Ham","ML_ADM::ML_metric","ML_ADM::ML_mom"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_ADM_constraints", 4, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o12dx = 0.0833333333333333333333333333333*INV(dx); + CCTK_REAL const p1o12dy = 0.0833333333333333333333333333333*INV(dy); + CCTK_REAL const p1o12dz = 0.0833333333333333333333333333333*INV(dz); + CCTK_REAL const p1o144dxdy = 0.00694444444444444444444444444444*INV(dx)*INV(dy); + CCTK_REAL const p1o144dxdz = 0.00694444444444444444444444444444*INV(dx)*INV(dz); + CCTK_REAL const p1o144dydz = 0.00694444444444444444444444444444*INV(dy)*INV(dz); + CCTK_REAL const pm1o12dx2 = -0.0833333333333333333333333333333*INV(SQR(dx)); + CCTK_REAL const pm1o12dy2 = -0.0833333333333333333333333333333*INV(SQR(dy)); + CCTK_REAL const pm1o12dz2 = -0.0833333333333333333333333333333*INV(SQR(dz)); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_ADM_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]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + CCTK_REAL g11L = g11[index]; + CCTK_REAL g12L = g12[index]; + CCTK_REAL g13L = g13[index]; + CCTK_REAL g22L = g22[index]; + CCTK_REAL g23L = g23[index]; + CCTK_REAL g33L = g33[index]; + CCTK_REAL K11L = K11[index]; + CCTK_REAL K12L = K12[index]; + CCTK_REAL K13L = K13[index]; + CCTK_REAL K22L = K22[index]; + CCTK_REAL K23L = K23[index]; + CCTK_REAL K33L = K33[index]; + + /* Include user supplied include files */ + + /* Precompute derivatives */ + CCTK_REAL const PDstandardNth1g11 = PDstandardNth1(&g11[index]); + CCTK_REAL const PDstandardNth2g11 = PDstandardNth2(&g11[index]); + CCTK_REAL const PDstandardNth3g11 = PDstandardNth3(&g11[index]); + CCTK_REAL const PDstandardNth22g11 = PDstandardNth22(&g11[index]); + CCTK_REAL const PDstandardNth33g11 = PDstandardNth33(&g11[index]); + CCTK_REAL const PDstandardNth23g11 = PDstandardNth23(&g11[index]); + CCTK_REAL const PDstandardNth1g12 = PDstandardNth1(&g12[index]); + CCTK_REAL const PDstandardNth2g12 = PDstandardNth2(&g12[index]); + CCTK_REAL const PDstandardNth3g12 = PDstandardNth3(&g12[index]); + CCTK_REAL const PDstandardNth33g12 = PDstandardNth33(&g12[index]); + CCTK_REAL const PDstandardNth12g12 = PDstandardNth12(&g12[index]); + CCTK_REAL const PDstandardNth13g12 = PDstandardNth13(&g12[index]); + CCTK_REAL const PDstandardNth23g12 = PDstandardNth23(&g12[index]); + CCTK_REAL const PDstandardNth1g13 = PDstandardNth1(&g13[index]); + CCTK_REAL const PDstandardNth2g13 = PDstandardNth2(&g13[index]); + CCTK_REAL const PDstandardNth3g13 = PDstandardNth3(&g13[index]); + CCTK_REAL const PDstandardNth22g13 = PDstandardNth22(&g13[index]); + CCTK_REAL const PDstandardNth12g13 = PDstandardNth12(&g13[index]); + CCTK_REAL const PDstandardNth13g13 = PDstandardNth13(&g13[index]); + CCTK_REAL const PDstandardNth23g13 = PDstandardNth23(&g13[index]); + CCTK_REAL const PDstandardNth1g22 = PDstandardNth1(&g22[index]); + CCTK_REAL const PDstandardNth2g22 = PDstandardNth2(&g22[index]); + CCTK_REAL const PDstandardNth3g22 = PDstandardNth3(&g22[index]); + CCTK_REAL const PDstandardNth11g22 = PDstandardNth11(&g22[index]); + CCTK_REAL const PDstandardNth33g22 = PDstandardNth33(&g22[index]); + CCTK_REAL const PDstandardNth13g22 = PDstandardNth13(&g22[index]); + CCTK_REAL const PDstandardNth1g23 = PDstandardNth1(&g23[index]); + CCTK_REAL const PDstandardNth2g23 = PDstandardNth2(&g23[index]); + CCTK_REAL const PDstandardNth3g23 = PDstandardNth3(&g23[index]); + CCTK_REAL const PDstandardNth11g23 = PDstandardNth11(&g23[index]); + CCTK_REAL const PDstandardNth12g23 = PDstandardNth12(&g23[index]); + CCTK_REAL const PDstandardNth13g23 = PDstandardNth13(&g23[index]); + CCTK_REAL const PDstandardNth23g23 = PDstandardNth23(&g23[index]); + CCTK_REAL const PDstandardNth1g33 = PDstandardNth1(&g33[index]); + CCTK_REAL const PDstandardNth2g33 = PDstandardNth2(&g33[index]); + CCTK_REAL const PDstandardNth3g33 = PDstandardNth3(&g33[index]); + CCTK_REAL const PDstandardNth11g33 = PDstandardNth11(&g33[index]); + CCTK_REAL const PDstandardNth22g33 = PDstandardNth22(&g33[index]); + CCTK_REAL const PDstandardNth12g33 = PDstandardNth12(&g33[index]); + CCTK_REAL const PDstandardNth2K11 = PDstandardNth2(&K11[index]); + CCTK_REAL const PDstandardNth3K11 = PDstandardNth3(&K11[index]); + CCTK_REAL const PDstandardNth1K12 = PDstandardNth1(&K12[index]); + CCTK_REAL const PDstandardNth2K12 = PDstandardNth2(&K12[index]); + CCTK_REAL const PDstandardNth3K12 = PDstandardNth3(&K12[index]); + CCTK_REAL const PDstandardNth1K13 = PDstandardNth1(&K13[index]); + CCTK_REAL const PDstandardNth2K13 = PDstandardNth2(&K13[index]); + CCTK_REAL const PDstandardNth3K13 = PDstandardNth3(&K13[index]); + CCTK_REAL const PDstandardNth1K22 = PDstandardNth1(&K22[index]); + CCTK_REAL const PDstandardNth3K22 = PDstandardNth3(&K22[index]); + CCTK_REAL const PDstandardNth1K23 = PDstandardNth1(&K23[index]); + CCTK_REAL const PDstandardNth2K23 = PDstandardNth2(&K23[index]); + CCTK_REAL const PDstandardNth3K23 = PDstandardNth3(&K23[index]); + CCTK_REAL const PDstandardNth1K33 = PDstandardNth1(&K33[index]); + CCTK_REAL const PDstandardNth2K33 = PDstandardNth2(&K33[index]); + + /* Calculate temporaries and grid functions */ + CCTK_REAL detg = 2*g12L*g13L*g23L + g33L*(g11L*g22L - SQR(g12L)) - + g22L*SQR(g13L) - g11L*SQR(g23L); + + CCTK_REAL gu11 = INV(detg)*(g22L*g33L - SQR(g23L)); + + CCTK_REAL gu12 = (g13L*g23L - g12L*g33L)*INV(detg); + + CCTK_REAL gu13 = (-(g13L*g22L) + g12L*g23L)*INV(detg); + + CCTK_REAL gu21 = (g13L*g23L - g12L*g33L)*INV(detg); + + CCTK_REAL gu22 = INV(detg)*(g11L*g33L - SQR(g13L)); + + CCTK_REAL gu23 = (g12L*g13L - g11L*g23L)*INV(detg); + + CCTK_REAL gu31 = (-(g13L*g22L) + g12L*g23L)*INV(detg); + + CCTK_REAL gu32 = (g12L*g13L - g11L*g23L)*INV(detg); + + CCTK_REAL gu33 = INV(detg)*(g11L*g22L - SQR(g12L)); + + CCTK_REAL G111 = 0.5*(gu11*PDstandardNth1g11 + + 2*(gu12*PDstandardNth1g12 + gu13*PDstandardNth1g13) - + gu12*PDstandardNth2g11 - gu13*PDstandardNth3g11); + + CCTK_REAL G211 = 0.5*(gu21*PDstandardNth1g11 + + 2*(gu22*PDstandardNth1g12 + gu23*PDstandardNth1g13) - + gu22*PDstandardNth2g11 - gu23*PDstandardNth3g11); + + CCTK_REAL G311 = 0.5*(gu31*PDstandardNth1g11 + + 2*(gu32*PDstandardNth1g12 + gu33*PDstandardNth1g13) - + gu32*PDstandardNth2g11 - gu33*PDstandardNth3g11); + + CCTK_REAL G112 = 0.5*(gu12*PDstandardNth1g22 + gu11*PDstandardNth2g11 + + gu13*(PDstandardNth1g23 + PDstandardNth2g13 - PDstandardNth3g12)); + + CCTK_REAL G212 = 0.5*(gu22*PDstandardNth1g22 + gu21*PDstandardNth2g11 + + gu23*(PDstandardNth1g23 + PDstandardNth2g13 - PDstandardNth3g12)); + + CCTK_REAL G312 = 0.5*(gu32*PDstandardNth1g22 + gu31*PDstandardNth2g11 + + gu33*(PDstandardNth1g23 + PDstandardNth2g13 - PDstandardNth3g12)); + + CCTK_REAL G113 = 0.5*(gu13*PDstandardNth1g33 + gu11*PDstandardNth3g11 + + gu12*(PDstandardNth1g23 - PDstandardNth2g13 + PDstandardNth3g12)); + + CCTK_REAL G213 = 0.5*(gu23*PDstandardNth1g33 + gu21*PDstandardNth3g11 + + gu22*(PDstandardNth1g23 - PDstandardNth2g13 + PDstandardNth3g12)); + + CCTK_REAL G313 = 0.5*(gu33*PDstandardNth1g33 + gu31*PDstandardNth3g11 + + gu32*(PDstandardNth1g23 - PDstandardNth2g13 + PDstandardNth3g12)); + + CCTK_REAL G122 = 0.5*(gu11*(-PDstandardNth1g22 + 2*PDstandardNth2g12) + + gu12*PDstandardNth2g22 + gu13*(2*PDstandardNth2g23 - + PDstandardNth3g22)); + + CCTK_REAL G222 = 0.5*(gu21*(-PDstandardNth1g22 + 2*PDstandardNth2g12) + + gu22*PDstandardNth2g22 + gu23*(2*PDstandardNth2g23 - + PDstandardNth3g22)); + + CCTK_REAL G322 = 0.5*(gu31*(-PDstandardNth1g22 + 2*PDstandardNth2g12) + + gu32*PDstandardNth2g22 + gu33*(2*PDstandardNth2g23 - + PDstandardNth3g22)); + + CCTK_REAL G123 = 0.5*(gu13*PDstandardNth2g33 + + gu11*(-PDstandardNth1g23 + PDstandardNth2g13 + PDstandardNth3g12) + + gu12*PDstandardNth3g22); + + CCTK_REAL G223 = 0.5*(gu23*PDstandardNth2g33 + + gu21*(-PDstandardNth1g23 + PDstandardNth2g13 + PDstandardNth3g12) + + gu22*PDstandardNth3g22); + + CCTK_REAL G323 = 0.5*(gu33*PDstandardNth2g33 + + gu31*(-PDstandardNth1g23 + PDstandardNth2g13 + PDstandardNth3g12) + + gu32*PDstandardNth3g22); + + CCTK_REAL G133 = 0.5*(gu11*(-PDstandardNth1g33 + 2*PDstandardNth3g13) + + gu12*(-PDstandardNth2g33 + 2*PDstandardNth3g23) + + gu13*PDstandardNth3g33); + + CCTK_REAL G233 = 0.5*(gu21*(-PDstandardNth1g33 + 2*PDstandardNth3g13) + + gu22*(-PDstandardNth2g33 + 2*PDstandardNth3g23) + + gu23*PDstandardNth3g33); + + CCTK_REAL G333 = 0.5*(gu31*(-PDstandardNth1g33 + 2*PDstandardNth3g13) + + gu32*(-PDstandardNth2g33 + 2*PDstandardNth3g23) + + gu33*PDstandardNth3g33); + + CCTK_REAL R11 = -(G111*(G111 + G122 + G133)) - G211*(G211 + G222 + + G233) - G311*(G311 + G322 + G333) + 0.5*(-(gu22*(PDstandardNth11g22 - + 2*PDstandardNth12g12 + PDstandardNth22g11)) + gu23*(-PDstandardNth11g23 + + PDstandardNth12g13 + PDstandardNth13g12 - PDstandardNth23g11) + + gu32*(-PDstandardNth11g23 + PDstandardNth12g13 + PDstandardNth13g12 - + PDstandardNth23g11) - gu33*(PDstandardNth11g33 - 2*PDstandardNth13g13 + + PDstandardNth33g11)) + SQR(G111) + SQR(G112) + SQR(G113) + SQR(G211) + + SQR(G212) + SQR(G213) + SQR(G311) + SQR(G312) + SQR(G313); + + CCTK_REAL R12 = 0.5*(2*(G113*G123 + G213*G223 + G313*G323) - + 2*(G112*G133 + G212*G233 + G312*G333 + gu12*PDstandardNth12g12) + + gu13*(PDstandardNth11g23 - PDstandardNth12g13 - PDstandardNth13g12) + + gu12*(PDstandardNth11g22 + PDstandardNth22g11) + + gu32*PDstandardNth22g13 + gu13*PDstandardNth23g11 + + gu32*(-PDstandardNth12g23 + PDstandardNth13g22 - PDstandardNth23g12) + + gu33*PDstandardNth23g13 + gu33*(-PDstandardNth12g33 + + PDstandardNth13g23 - PDstandardNth33g12)); + + CCTK_REAL R13 = 0.5*(2*(G112*G123 + G212*G223 + G312*G323) - + 2*(G113*G122 + G213*G222 + G313*G322 + gu13*PDstandardNth13g13) + + gu12*(PDstandardNth11g23 - PDstandardNth12g13 - PDstandardNth13g12 + + PDstandardNth23g11) + gu22*(PDstandardNth12g23 - PDstandardNth13g22 - + PDstandardNth22g13 + PDstandardNth23g12) + gu13*(PDstandardNth11g33 + + PDstandardNth33g11) + gu23*(PDstandardNth12g33 - PDstandardNth13g23 - + PDstandardNth23g13 + PDstandardNth33g12)); + + CCTK_REAL R22 = -(G122*(G111 + G122 + G133)) - G222*(G211 + G222 + + G233) - G322*(G311 + G322 + G333) + 0.5*(-(gu11*(PDstandardNth11g22 - + 2*PDstandardNth12g12 + PDstandardNth22g11)) + gu13*(PDstandardNth12g23 + - PDstandardNth13g22 - PDstandardNth22g13 + PDstandardNth23g12) + + gu31*(PDstandardNth12g23 - PDstandardNth13g22 - PDstandardNth22g13 + + PDstandardNth23g12) - gu33*(PDstandardNth22g33 - 2*PDstandardNth23g23 + + PDstandardNth33g22)) + SQR(G112) + SQR(G122) + SQR(G123) + SQR(G212) + + SQR(G222) + SQR(G223) + SQR(G312) + SQR(G322) + SQR(G323); + + CCTK_REAL R23 = 0.5*(2*(G112*G113 + G212*G213 + G312*G313) + + gu11*(-PDstandardNth11g23 + PDstandardNth12g13 + PDstandardNth13g12 - + PDstandardNth23g11) + gu21*(-PDstandardNth12g23 + PDstandardNth13g22 + + PDstandardNth22g13 - PDstandardNth23g12) - 2*(G111*G123 + G211*G223 + + G311*G323 + gu23*PDstandardNth23g23) + gu13*(PDstandardNth12g33 - + PDstandardNth13g23 - PDstandardNth23g13 + PDstandardNth33g12) + + gu23*(PDstandardNth22g33 + PDstandardNth33g22)); + + CCTK_REAL R33 = -(G133*(G111 + G122 + G133)) - G233*(G211 + G222 + + G233) - G333*(G311 + G322 + G333) + 0.5*(-(gu11*(PDstandardNth11g33 - + 2*PDstandardNth13g13 + PDstandardNth33g11)) + gu12*(-PDstandardNth12g33 + + PDstandardNth13g23 + PDstandardNth23g13 - PDstandardNth33g12) + + gu21*(-PDstandardNth12g33 + PDstandardNth13g23 + PDstandardNth23g13 - + PDstandardNth33g12) - gu22*(PDstandardNth22g33 - 2*PDstandardNth23g23 + + PDstandardNth33g22)) + SQR(G113) + SQR(G123) + SQR(G133) + SQR(G213) + + SQR(G223) + SQR(G233) + SQR(G313) + SQR(G323) + SQR(G333); + + CCTK_REAL trR = gu11*R11 + (gu12 + gu21)*R12 + (gu13 + gu31)*R13 + + gu22*R22 + (gu23 + gu32)*R23 + gu33*R33; + + CCTK_REAL Km11 = gu11*K11L + gu12*K12L + gu13*K13L; + + CCTK_REAL Km21 = gu21*K11L + gu22*K12L + gu23*K13L; + + CCTK_REAL Km31 = gu31*K11L + gu32*K12L + gu33*K13L; + + CCTK_REAL Km12 = gu11*K12L + gu12*K22L + gu13*K23L; + + CCTK_REAL Km22 = gu21*K12L + gu22*K22L + gu23*K23L; + + CCTK_REAL Km32 = gu31*K12L + gu32*K22L + gu33*K23L; + + CCTK_REAL Km13 = gu11*K13L + gu12*K23L + gu13*K33L; + + CCTK_REAL Km23 = gu21*K13L + gu22*K23L + gu23*K33L; + + CCTK_REAL Km33 = gu31*K13L + gu32*K23L + gu33*K33L; + + CCTK_REAL trK = Km11 + Km22 + Km33; + + CCTK_REAL HL = -2*(Km12*Km21 + Km13*Km31 + Km23*Km32) + trR - + SQR(Km11) - SQR(Km22) - SQR(Km33) + SQR(trK); + + CCTK_REAL M1L = gu21*(-(G112*K11L) + (G111 - G212)*K12L - G312*K13L + + G211*K22L + G311*K23L - PDstandardNth1K12 + PDstandardNth2K11) + + gu22*(-(G122*K11L) + (G112 - G222)*K12L - G322*K13L + G212*K22L + + G312*K23L - PDstandardNth1K22 + PDstandardNth2K12) + gu23*(-(G123*K11L) + + (G113 - G223)*K12L - G323*K13L + G213*K22L + G313*K23L - + PDstandardNth1K23 + PDstandardNth2K13) + gu31*(-(G113*K11L) - G213*K12L + + (G111 - G313)*K13L + G211*K23L + G311*K33L - PDstandardNth1K13 + + PDstandardNth3K11) + gu32*(-(G123*K11L) - G223*K12L + (G112 - + G323)*K13L + G212*K23L + G312*K33L - PDstandardNth1K23 + + PDstandardNth3K12) + gu33*(-(G133*K11L) - G233*K12L + (G113 - + G333)*K13L + G213*K23L + G313*K33L - PDstandardNth1K33 + + PDstandardNth3K13); + + CCTK_REAL M2L = gu11*(G112*K11L + (-G111 + G212)*K12L + G312*K13L - + G211*K22L - G311*K23L + PDstandardNth1K12 - PDstandardNth2K11) + + gu12*(G122*K11L + (-G112 + G222)*K12L + G322*K13L - G212*K22L - + G312*K23L + PDstandardNth1K22 - PDstandardNth2K12) + gu13*(G123*K11L + + (-G113 + G223)*K12L + G323*K13L - G213*K22L - G313*K23L + + PDstandardNth1K23 - PDstandardNth2K13) + gu31*(-(G113*K12L) + G112*K13L + - G213*K22L + (G212 - G313)*K23L + G312*K33L - PDstandardNth2K13 + + PDstandardNth3K12) + gu32*(-(G123*K12L) + G122*K13L - G223*K22L + (G222 + - G323)*K23L + G322*K33L - PDstandardNth2K23 + PDstandardNth3K22) + + gu33*(-(G133*K12L) + G123*K13L - G233*K22L + (G223 - G333)*K23L + + G323*K33L - PDstandardNth2K33 + PDstandardNth3K23); + + CCTK_REAL M3L = gu11*(G113*K11L + G213*K12L + (-G111 + G313)*K13L - + G211*K23L - G311*K33L + PDstandardNth1K13 - PDstandardNth3K11) + + gu12*(G123*K11L + G223*K12L + (-G112 + G323)*K13L - G212*K23L - + G312*K33L + PDstandardNth1K23 - PDstandardNth3K12) + gu21*(G113*K12L - + G112*K13L + G213*K22L + (-G212 + G313)*K23L - G312*K33L + + PDstandardNth2K13 - PDstandardNth3K12) + gu13*(G133*K11L + G233*K12L + + (-G113 + G333)*K13L - G213*K23L - G313*K33L + PDstandardNth1K33 - + PDstandardNth3K13) + gu22*(G123*K12L - G122*K13L + G223*K22L + (-G222 + + G323)*K23L - G322*K33L + PDstandardNth2K23 - PDstandardNth3K22) + + gu23*(G133*K12L - G123*K13L + G233*K22L + (-G223 + G333)*K23L - + G323*K33L + PDstandardNth2K33 - PDstandardNth3K23); + + + /* Copy local copies back to grid functions */ + H[index] = HL; + M1[index] = M1L; + M2[index] = M2L; + M3[index] = M3L; + } + LC_ENDLOOP3 (ML_ADM_constraints); +} + +extern "C" void ML_ADM_constraints(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverInterior(cctkGH, &ML_ADM_constraints_Body); +} diff --git a/ML_ADM/src/ML_ADM_constraints_boundary.cc b/ML_ADM/src/ML_ADM_constraints_boundary.cc new file mode 100644 index 0000000..d607362 --- /dev/null +++ b/ML_ADM/src/ML_ADM_constraints_boundary.cc @@ -0,0 +1,130 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +extern "C" void ML_ADM_constraints_boundary_SelectBCs(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT ierr = 0; + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_ADM::ML_Ham","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_ADM::ML_Ham."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_ADM::ML_mom","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_ADM::ML_mom."); + return; +} + +static void ML_ADM_constraints_boundary_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_ADM_constraints_boundary_Body"); + } + + if (cctk_iteration % ML_ADM_constraints_boundary_calc_every != ML_ADM_constraints_boundary_calc_offset) + { + return; + } + + const char *groups[] = {"ML_ADM::ML_Ham","ML_ADM::ML_mom"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_ADM_constraints_boundary", 2, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o12dx = 0.0833333333333333333333333333333*INV(dx); + CCTK_REAL const p1o12dy = 0.0833333333333333333333333333333*INV(dy); + CCTK_REAL const p1o12dz = 0.0833333333333333333333333333333*INV(dz); + CCTK_REAL const p1o144dxdy = 0.00694444444444444444444444444444*INV(dx)*INV(dy); + CCTK_REAL const p1o144dxdz = 0.00694444444444444444444444444444*INV(dx)*INV(dz); + CCTK_REAL const p1o144dydz = 0.00694444444444444444444444444444*INV(dy)*INV(dz); + CCTK_REAL const pm1o12dx2 = -0.0833333333333333333333333333333*INV(SQR(dx)); + CCTK_REAL const pm1o12dy2 = -0.0833333333333333333333333333333*INV(SQR(dy)); + CCTK_REAL const pm1o12dz2 = -0.0833333333333333333333333333333*INV(SQR(dz)); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_ADM_constraints_boundary, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + + /* Include user supplied include files */ + + /* Precompute derivatives */ + + /* Calculate temporaries and grid functions */ + CCTK_REAL HL = 0; + + CCTK_REAL M1L = 0; + + CCTK_REAL M2L = 0; + + CCTK_REAL M3L = 0; + + + /* Copy local copies back to grid functions */ + H[index] = HL; + M1[index] = M1L; + M2[index] = M2L; + M3[index] = M3L; + } + LC_ENDLOOP3 (ML_ADM_constraints_boundary); +} + +extern "C" void ML_ADM_constraints_boundary(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverBoundaryWithGhosts(cctkGH, &ML_ADM_constraints_boundary_Body); +} diff --git a/ML_ADM/src/ML_ADM_convertFromADMBase.cc b/ML_ADM/src/ML_ADM_convertFromADMBase.cc new file mode 100644 index 0000000..85a7aa9 --- /dev/null +++ b/ML_ADM/src/ML_ADM_convertFromADMBase.cc @@ -0,0 +1,167 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +static void ML_ADM_convertFromADMBase_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_ADM_convertFromADMBase_Body"); + } + + if (cctk_iteration % ML_ADM_convertFromADMBase_calc_every != ML_ADM_convertFromADMBase_calc_offset) + { + return; + } + + const char *groups[] = {"ADMBase::curv","ADMBase::lapse","ADMBase::metric","ADMBase::shift","ML_ADM::ML_curv","ML_ADM::ML_lapse","ML_ADM::ML_metric","ML_ADM::ML_shift"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_ADM_convertFromADMBase", 8, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o12dx = 0.0833333333333333333333333333333*INV(dx); + CCTK_REAL const p1o12dy = 0.0833333333333333333333333333333*INV(dy); + CCTK_REAL const p1o12dz = 0.0833333333333333333333333333333*INV(dz); + CCTK_REAL const p1o144dxdy = 0.00694444444444444444444444444444*INV(dx)*INV(dy); + CCTK_REAL const p1o144dxdz = 0.00694444444444444444444444444444*INV(dx)*INV(dz); + CCTK_REAL const p1o144dydz = 0.00694444444444444444444444444444*INV(dy)*INV(dz); + CCTK_REAL const pm1o12dx2 = -0.0833333333333333333333333333333*INV(SQR(dx)); + CCTK_REAL const pm1o12dy2 = -0.0833333333333333333333333333333*INV(SQR(dy)); + CCTK_REAL const pm1o12dz2 = -0.0833333333333333333333333333333*INV(SQR(dz)); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_ADM_convertFromADMBase, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + CCTK_REAL alpL = alp[index]; + CCTK_REAL betaxL = betax[index]; + CCTK_REAL betayL = betay[index]; + CCTK_REAL betazL = betaz[index]; + CCTK_REAL gxxL = gxx[index]; + CCTK_REAL gxyL = gxy[index]; + CCTK_REAL gxzL = gxz[index]; + CCTK_REAL gyyL = gyy[index]; + CCTK_REAL gyzL = gyz[index]; + CCTK_REAL gzzL = gzz[index]; + CCTK_REAL kxxL = kxx[index]; + CCTK_REAL kxyL = kxy[index]; + CCTK_REAL kxzL = kxz[index]; + CCTK_REAL kyyL = kyy[index]; + CCTK_REAL kyzL = kyz[index]; + CCTK_REAL kzzL = kzz[index]; + + /* Include user supplied include files */ + + /* Precompute derivatives */ + + /* Calculate temporaries and grid functions */ + CCTK_REAL g11L = gxxL; + + CCTK_REAL g12L = gxyL; + + CCTK_REAL g13L = gxzL; + + CCTK_REAL g22L = gyyL; + + CCTK_REAL g23L = gyzL; + + CCTK_REAL g33L = gzzL; + + CCTK_REAL K11L = kxxL; + + CCTK_REAL K12L = kxyL; + + CCTK_REAL K13L = kxzL; + + CCTK_REAL K22L = kyyL; + + CCTK_REAL K23L = kyzL; + + CCTK_REAL K33L = kzzL; + + CCTK_REAL alphaL = alpL; + + CCTK_REAL beta1L = betaxL; + + CCTK_REAL beta2L = betayL; + + CCTK_REAL beta3L = betazL; + + + /* Copy local copies back to grid functions */ + alpha[index] = alphaL; + beta1[index] = beta1L; + beta2[index] = beta2L; + beta3[index] = beta3L; + g11[index] = g11L; + g12[index] = g12L; + g13[index] = g13L; + g22[index] = g22L; + g23[index] = g23L; + g33[index] = g33L; + K11[index] = K11L; + K12[index] = K12L; + K13[index] = K13L; + K22[index] = K22L; + K23[index] = K23L; + K33[index] = K33L; + } + LC_ENDLOOP3 (ML_ADM_convertFromADMBase); +} + +extern "C" void ML_ADM_convertFromADMBase(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverEverything(cctkGH, &ML_ADM_convertFromADMBase_Body); +} diff --git a/ML_ADM/src/ML_ADM_convertToADMBase.cc b/ML_ADM/src/ML_ADM_convertToADMBase.cc new file mode 100644 index 0000000..6df8ec1 --- /dev/null +++ b/ML_ADM/src/ML_ADM_convertToADMBase.cc @@ -0,0 +1,179 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +static void ML_ADM_convertToADMBase_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_ADM_convertToADMBase_Body"); + } + + if (cctk_iteration % ML_ADM_convertToADMBase_calc_every != ML_ADM_convertToADMBase_calc_offset) + { + return; + } + + const char *groups[] = {"ADMBase::curv","ADMBase::dtlapse","ADMBase::dtshift","ADMBase::lapse","ADMBase::metric","ADMBase::shift","ML_ADM::ML_curv","ML_ADM::ML_lapse","ML_ADM::ML_metric","ML_ADM::ML_shift"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_ADM_convertToADMBase", 10, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o12dx = 0.0833333333333333333333333333333*INV(dx); + CCTK_REAL const p1o12dy = 0.0833333333333333333333333333333*INV(dy); + CCTK_REAL const p1o12dz = 0.0833333333333333333333333333333*INV(dz); + CCTK_REAL const p1o144dxdy = 0.00694444444444444444444444444444*INV(dx)*INV(dy); + CCTK_REAL const p1o144dxdz = 0.00694444444444444444444444444444*INV(dx)*INV(dz); + CCTK_REAL const p1o144dydz = 0.00694444444444444444444444444444*INV(dy)*INV(dz); + CCTK_REAL const pm1o12dx2 = -0.0833333333333333333333333333333*INV(SQR(dx)); + CCTK_REAL const pm1o12dy2 = -0.0833333333333333333333333333333*INV(SQR(dy)); + CCTK_REAL const pm1o12dz2 = -0.0833333333333333333333333333333*INV(SQR(dz)); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_ADM_convertToADMBase, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + CCTK_REAL alphaL = alpha[index]; + CCTK_REAL beta1L = beta1[index]; + CCTK_REAL beta2L = beta2[index]; + CCTK_REAL beta3L = beta3[index]; + CCTK_REAL g11L = g11[index]; + CCTK_REAL g12L = g12[index]; + CCTK_REAL g13L = g13[index]; + CCTK_REAL g22L = g22[index]; + CCTK_REAL g23L = g23[index]; + CCTK_REAL g33L = g33[index]; + CCTK_REAL K11L = K11[index]; + CCTK_REAL K12L = K12[index]; + CCTK_REAL K13L = K13[index]; + CCTK_REAL K22L = K22[index]; + CCTK_REAL K23L = K23[index]; + CCTK_REAL K33L = K33[index]; + + /* Include user supplied include files */ + + /* Precompute derivatives */ + + /* Calculate temporaries and grid functions */ + CCTK_REAL gxxL = g11L; + + CCTK_REAL gxyL = g12L; + + CCTK_REAL gxzL = g13L; + + CCTK_REAL gyyL = g22L; + + CCTK_REAL gyzL = g23L; + + CCTK_REAL gzzL = g33L; + + CCTK_REAL kxxL = K11L; + + CCTK_REAL kxyL = K12L; + + CCTK_REAL kxzL = K13L; + + CCTK_REAL kyyL = K22L; + + CCTK_REAL kyzL = K23L; + + CCTK_REAL kzzL = K33L; + + CCTK_REAL alpL = alphaL; + + CCTK_REAL dtalpL = 0; + + CCTK_REAL betaxL = beta1L; + + CCTK_REAL betayL = beta2L; + + CCTK_REAL betazL = beta3L; + + CCTK_REAL dtbetaxL = 0; + + CCTK_REAL dtbetayL = 0; + + CCTK_REAL dtbetazL = 0; + + + /* Copy local copies back to grid functions */ + alp[index] = alpL; + betax[index] = betaxL; + betay[index] = betayL; + betaz[index] = betazL; + dtalp[index] = dtalpL; + dtbetax[index] = dtbetaxL; + dtbetay[index] = dtbetayL; + dtbetaz[index] = dtbetazL; + gxx[index] = gxxL; + gxy[index] = gxyL; + gxz[index] = gxzL; + gyy[index] = gyyL; + gyz[index] = gyzL; + gzz[index] = gzzL; + kxx[index] = kxxL; + kxy[index] = kxyL; + kxz[index] = kxzL; + kyy[index] = kyyL; + kyz[index] = kyzL; + kzz[index] = kzzL; + } + LC_ENDLOOP3 (ML_ADM_convertToADMBase); +} + +extern "C" void ML_ADM_convertToADMBase(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverEverything(cctkGH, &ML_ADM_convertToADMBase_Body); +} diff --git a/ML_ADM/src/RegisterMoL.cc b/ML_ADM/src/RegisterMoL.cc new file mode 100644 index 0000000..55605d7 --- /dev/null +++ b/ML_ADM/src/RegisterMoL.cc @@ -0,0 +1,32 @@ +/* File produced by Kranc */ + +#include "cctk.h" +#include "cctk_Arguments.h" +#include "cctk_Parameters.h" + +extern "C" void ML_ADM_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_ADM::K11"), CCTK_VarIndex("ML_ADM::K11rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_ADM::K12"), CCTK_VarIndex("ML_ADM::K12rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_ADM::K13"), CCTK_VarIndex("ML_ADM::K13rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_ADM::K22"), CCTK_VarIndex("ML_ADM::K22rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_ADM::K23"), CCTK_VarIndex("ML_ADM::K23rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_ADM::K33"), CCTK_VarIndex("ML_ADM::K33rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_ADM::alpha"), CCTK_VarIndex("ML_ADM::alpharhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_ADM::g11"), CCTK_VarIndex("ML_ADM::g11rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_ADM::g12"), CCTK_VarIndex("ML_ADM::g12rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_ADM::g13"), CCTK_VarIndex("ML_ADM::g13rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_ADM::g22"), CCTK_VarIndex("ML_ADM::g22rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_ADM::g23"), CCTK_VarIndex("ML_ADM::g23rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_ADM::g33"), CCTK_VarIndex("ML_ADM::g33rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_ADM::beta1"), CCTK_VarIndex("ML_ADM::beta1rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_ADM::beta2"), CCTK_VarIndex("ML_ADM::beta2rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_ADM::beta3"), CCTK_VarIndex("ML_ADM::beta3rhs")); + return; +} diff --git a/ML_ADM/src/RegisterSymmetries.cc b/ML_ADM/src/RegisterSymmetries.cc new file mode 100644 index 0000000..0d05f97 --- /dev/null +++ b/ML_ADM/src/RegisterSymmetries.cc @@ -0,0 +1,119 @@ +/* File produced by Kranc */ + +#include "cctk.h" +#include "cctk_Arguments.h" +#include "cctk_Parameters.h" +#include "Symmetry.h" + +extern "C" void ML_ADM_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_ADM::K11"); + + sym[0] = -1; + sym[1] = -1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_ADM::K12"); + + sym[0] = -1; + sym[1] = 1; + sym[2] = -1; + SetCartSymVN(cctkGH, sym, "ML_ADM::K13"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_ADM::K22"); + + sym[0] = 1; + sym[1] = -1; + sym[2] = -1; + SetCartSymVN(cctkGH, sym, "ML_ADM::K23"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_ADM::K33"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_ADM::alpha"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_ADM::g11"); + + sym[0] = -1; + sym[1] = -1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_ADM::g12"); + + sym[0] = -1; + sym[1] = 1; + sym[2] = -1; + SetCartSymVN(cctkGH, sym, "ML_ADM::g13"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_ADM::g22"); + + sym[0] = 1; + sym[1] = -1; + sym[2] = -1; + SetCartSymVN(cctkGH, sym, "ML_ADM::g23"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_ADM::g33"); + + sym[0] = -1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_ADM::beta1"); + + sym[0] = 1; + sym[1] = -1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_ADM::beta2"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = -1; + SetCartSymVN(cctkGH, sym, "ML_ADM::beta3"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_ADM::H"); + + sym[0] = -1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_ADM::M1"); + + sym[0] = 1; + sym[1] = -1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_ADM::M2"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = -1; + SetCartSymVN(cctkGH, sym, "ML_ADM::M3"); + +} diff --git a/ML_ADM/src/Startup.cc b/ML_ADM/src/Startup.cc new file mode 100644 index 0000000..97927b7 --- /dev/null +++ b/ML_ADM/src/Startup.cc @@ -0,0 +1,10 @@ +/* File produced by Kranc */ + +#include "cctk.h" + +extern "C" int ML_ADM_Startup(void) +{ + const char * banner = "ML_ADM"; + CCTK_RegisterBanner(banner); + return 0; +} diff --git a/ML_ADMConstraints/src/Boundaries.cc b/ML_ADMConstraints/src/Boundaries.cc new file mode 100644 index 0000000..0d4892d --- /dev/null +++ b/ML_ADMConstraints/src/Boundaries.cc @@ -0,0 +1,41 @@ +/* File produced by Kranc */ + +#include "cctk.h" +#include "cctk_Arguments.h" +#include "cctk_Parameters.h" +#include "cctk_Faces.h" +#include "util_Table.h" +#include "Symmetry.h" + + +/* the boundary treatment is split into 3 steps: */ +/* 1. excision */ +/* 2. symmetries */ +/* 3. "other" boundary conditions, e.g. radiative */ + +/* to simplify scheduling and testing, the 3 steps */ +/* are currently applied in separate functions */ + + +extern "C" void ML_ADMConstraints_CheckBoundaries(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + return; +} + +extern "C" void ML_ADMConstraints_SelectBoundConds(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT ierr = 0; + return; +} + + + +/* template for entries in parameter file: +*/ + diff --git a/ML_ADMConstraints/src/ML_ADMConstraints.cc b/ML_ADMConstraints/src/ML_ADMConstraints.cc new file mode 100644 index 0000000..9e6e0cf --- /dev/null +++ b/ML_ADMConstraints/src/ML_ADMConstraints.cc @@ -0,0 +1,408 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +extern "C" void ML_ADMConstraints_SelectBCs(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT ierr = 0; + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_ADMConstraints::ML_Ham","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_ADMConstraints::ML_Ham."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_ADMConstraints::ML_mom","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_ADMConstraints::ML_mom."); + return; +} + +static void ML_ADMConstraints_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_ADMConstraints_Body"); + } + + if (cctk_iteration % ML_ADMConstraints_calc_every != ML_ADMConstraints_calc_offset) + { + return; + } + + const char *groups[] = {"ADMBase::curv","ADMBase::lapse","ADMBase::metric","ADMBase::shift","ML_ADMConstraints::ML_Ham","ML_ADMConstraints::ML_mom"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_ADMConstraints", 6, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o12dx = 0.0833333333333333333333333333333*INV(dx); + CCTK_REAL const p1o12dy = 0.0833333333333333333333333333333*INV(dy); + CCTK_REAL const p1o12dz = 0.0833333333333333333333333333333*INV(dz); + CCTK_REAL const p1o144dxdy = 0.00694444444444444444444444444444*INV(dx)*INV(dy); + CCTK_REAL const p1o144dxdz = 0.00694444444444444444444444444444*INV(dx)*INV(dz); + CCTK_REAL const p1o144dydz = 0.00694444444444444444444444444444*INV(dy)*INV(dz); + CCTK_REAL const pm1o12dx2 = -0.0833333333333333333333333333333*INV(SQR(dx)); + CCTK_REAL const pm1o12dy2 = -0.0833333333333333333333333333333*INV(SQR(dy)); + CCTK_REAL const pm1o12dz2 = -0.0833333333333333333333333333333*INV(SQR(dz)); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_ADMConstraints, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + CCTK_REAL alpL = alp[index]; + CCTK_REAL betaxL = betax[index]; + CCTK_REAL betayL = betay[index]; + CCTK_REAL betazL = betaz[index]; + CCTK_REAL eTttL = (*stress_energy_state) ? eTtt[index] : ToReal(0.0); + CCTK_REAL eTtxL = (*stress_energy_state) ? eTtx[index] : ToReal(0.0); + CCTK_REAL eTtyL = (*stress_energy_state) ? eTty[index] : ToReal(0.0); + CCTK_REAL eTtzL = (*stress_energy_state) ? eTtz[index] : ToReal(0.0); + CCTK_REAL eTxxL = (*stress_energy_state) ? eTxx[index] : ToReal(0.0); + CCTK_REAL eTxyL = (*stress_energy_state) ? eTxy[index] : ToReal(0.0); + CCTK_REAL eTxzL = (*stress_energy_state) ? eTxz[index] : ToReal(0.0); + CCTK_REAL eTyyL = (*stress_energy_state) ? eTyy[index] : ToReal(0.0); + CCTK_REAL eTyzL = (*stress_energy_state) ? eTyz[index] : ToReal(0.0); + CCTK_REAL eTzzL = (*stress_energy_state) ? eTzz[index] : ToReal(0.0); + CCTK_REAL gxxL = gxx[index]; + CCTK_REAL gxyL = gxy[index]; + CCTK_REAL gxzL = gxz[index]; + CCTK_REAL gyyL = gyy[index]; + CCTK_REAL gyzL = gyz[index]; + CCTK_REAL gzzL = gzz[index]; + CCTK_REAL kxxL = kxx[index]; + CCTK_REAL kxyL = kxy[index]; + CCTK_REAL kxzL = kxz[index]; + CCTK_REAL kyyL = kyy[index]; + CCTK_REAL kyzL = kyz[index]; + CCTK_REAL kzzL = kzz[index]; + + /* Include user supplied include files */ + + /* Precompute derivatives */ + CCTK_REAL const PDstandardNth1gxx = PDstandardNth1(&gxx[index]); + CCTK_REAL const PDstandardNth2gxx = PDstandardNth2(&gxx[index]); + CCTK_REAL const PDstandardNth3gxx = PDstandardNth3(&gxx[index]); + CCTK_REAL const PDstandardNth22gxx = PDstandardNth22(&gxx[index]); + CCTK_REAL const PDstandardNth33gxx = PDstandardNth33(&gxx[index]); + CCTK_REAL const PDstandardNth23gxx = PDstandardNth23(&gxx[index]); + CCTK_REAL const PDstandardNth1gxy = PDstandardNth1(&gxy[index]); + CCTK_REAL const PDstandardNth2gxy = PDstandardNth2(&gxy[index]); + CCTK_REAL const PDstandardNth3gxy = PDstandardNth3(&gxy[index]); + CCTK_REAL const PDstandardNth33gxy = PDstandardNth33(&gxy[index]); + CCTK_REAL const PDstandardNth12gxy = PDstandardNth12(&gxy[index]); + CCTK_REAL const PDstandardNth13gxy = PDstandardNth13(&gxy[index]); + CCTK_REAL const PDstandardNth23gxy = PDstandardNth23(&gxy[index]); + CCTK_REAL const PDstandardNth1gxz = PDstandardNth1(&gxz[index]); + CCTK_REAL const PDstandardNth2gxz = PDstandardNth2(&gxz[index]); + CCTK_REAL const PDstandardNth3gxz = PDstandardNth3(&gxz[index]); + CCTK_REAL const PDstandardNth22gxz = PDstandardNth22(&gxz[index]); + CCTK_REAL const PDstandardNth12gxz = PDstandardNth12(&gxz[index]); + CCTK_REAL const PDstandardNth13gxz = PDstandardNth13(&gxz[index]); + CCTK_REAL const PDstandardNth23gxz = PDstandardNth23(&gxz[index]); + CCTK_REAL const PDstandardNth1gyy = PDstandardNth1(&gyy[index]); + CCTK_REAL const PDstandardNth2gyy = PDstandardNth2(&gyy[index]); + CCTK_REAL const PDstandardNth3gyy = PDstandardNth3(&gyy[index]); + CCTK_REAL const PDstandardNth11gyy = PDstandardNth11(&gyy[index]); + CCTK_REAL const PDstandardNth33gyy = PDstandardNth33(&gyy[index]); + CCTK_REAL const PDstandardNth13gyy = PDstandardNth13(&gyy[index]); + CCTK_REAL const PDstandardNth1gyz = PDstandardNth1(&gyz[index]); + CCTK_REAL const PDstandardNth2gyz = PDstandardNth2(&gyz[index]); + CCTK_REAL const PDstandardNth3gyz = PDstandardNth3(&gyz[index]); + CCTK_REAL const PDstandardNth11gyz = PDstandardNth11(&gyz[index]); + CCTK_REAL const PDstandardNth12gyz = PDstandardNth12(&gyz[index]); + CCTK_REAL const PDstandardNth13gyz = PDstandardNth13(&gyz[index]); + CCTK_REAL const PDstandardNth23gyz = PDstandardNth23(&gyz[index]); + CCTK_REAL const PDstandardNth1gzz = PDstandardNth1(&gzz[index]); + CCTK_REAL const PDstandardNth2gzz = PDstandardNth2(&gzz[index]); + CCTK_REAL const PDstandardNth3gzz = PDstandardNth3(&gzz[index]); + CCTK_REAL const PDstandardNth11gzz = PDstandardNth11(&gzz[index]); + CCTK_REAL const PDstandardNth22gzz = PDstandardNth22(&gzz[index]); + CCTK_REAL const PDstandardNth12gzz = PDstandardNth12(&gzz[index]); + CCTK_REAL const PDstandardNth2kxx = PDstandardNth2(&kxx[index]); + CCTK_REAL const PDstandardNth3kxx = PDstandardNth3(&kxx[index]); + CCTK_REAL const PDstandardNth1kxy = PDstandardNth1(&kxy[index]); + CCTK_REAL const PDstandardNth2kxy = PDstandardNth2(&kxy[index]); + CCTK_REAL const PDstandardNth3kxy = PDstandardNth3(&kxy[index]); + CCTK_REAL const PDstandardNth1kxz = PDstandardNth1(&kxz[index]); + CCTK_REAL const PDstandardNth2kxz = PDstandardNth2(&kxz[index]); + CCTK_REAL const PDstandardNth3kxz = PDstandardNth3(&kxz[index]); + CCTK_REAL const PDstandardNth1kyy = PDstandardNth1(&kyy[index]); + CCTK_REAL const PDstandardNth3kyy = PDstandardNth3(&kyy[index]); + CCTK_REAL const PDstandardNth1kyz = PDstandardNth1(&kyz[index]); + CCTK_REAL const PDstandardNth2kyz = PDstandardNth2(&kyz[index]); + CCTK_REAL const PDstandardNth3kyz = PDstandardNth3(&kyz[index]); + CCTK_REAL const PDstandardNth1kzz = PDstandardNth1(&kzz[index]); + CCTK_REAL const PDstandardNth2kzz = PDstandardNth2(&kzz[index]); + + /* Calculate temporaries and grid functions */ + CCTK_REAL detg = 2*gxyL*gxzL*gyzL + gzzL*(gxxL*gyyL - SQR(gxyL)) - + gyyL*SQR(gxzL) - gxxL*SQR(gyzL); + + CCTK_REAL gu11 = INV(detg)*(gyyL*gzzL - SQR(gyzL)); + + CCTK_REAL gu21 = (gxzL*gyzL - gxyL*gzzL)*INV(detg); + + CCTK_REAL gu31 = (-(gxzL*gyyL) + gxyL*gyzL)*INV(detg); + + CCTK_REAL gu22 = INV(detg)*(gxxL*gzzL - SQR(gxzL)); + + CCTK_REAL gu32 = (gxyL*gxzL - gxxL*gyzL)*INV(detg); + + CCTK_REAL gu33 = INV(detg)*(gxxL*gyyL - SQR(gxyL)); + + CCTK_REAL G111 = 0.5*(gu11*PDstandardNth1gxx + + 2*(gu21*PDstandardNth1gxy + gu31*PDstandardNth1gxz) - + gu21*PDstandardNth2gxx - gu31*PDstandardNth3gxx); + + CCTK_REAL G211 = 0.5*(gu21*PDstandardNth1gxx + + 2*(gu22*PDstandardNth1gxy + gu32*PDstandardNth1gxz) - + gu22*PDstandardNth2gxx - gu32*PDstandardNth3gxx); + + CCTK_REAL G311 = 0.5*(gu31*PDstandardNth1gxx + + 2*(gu32*PDstandardNth1gxy + gu33*PDstandardNth1gxz) - + gu32*PDstandardNth2gxx - gu33*PDstandardNth3gxx); + + CCTK_REAL G112 = 0.5*(gu21*PDstandardNth1gyy + gu11*PDstandardNth2gxx + + gu31*(PDstandardNth1gyz + PDstandardNth2gxz - PDstandardNth3gxy)); + + CCTK_REAL G212 = 0.5*(gu22*PDstandardNth1gyy + gu21*PDstandardNth2gxx + + gu32*(PDstandardNth1gyz + PDstandardNth2gxz - PDstandardNth3gxy)); + + CCTK_REAL G312 = 0.5*(gu32*PDstandardNth1gyy + gu31*PDstandardNth2gxx + + gu33*(PDstandardNth1gyz + PDstandardNth2gxz - PDstandardNth3gxy)); + + CCTK_REAL G113 = 0.5*(gu31*PDstandardNth1gzz + gu11*PDstandardNth3gxx + + gu21*(PDstandardNth1gyz - PDstandardNth2gxz + PDstandardNth3gxy)); + + CCTK_REAL G213 = 0.5*(gu32*PDstandardNth1gzz + gu21*PDstandardNth3gxx + + gu22*(PDstandardNth1gyz - PDstandardNth2gxz + PDstandardNth3gxy)); + + CCTK_REAL G313 = 0.5*(gu33*PDstandardNth1gzz + gu31*PDstandardNth3gxx + + gu32*(PDstandardNth1gyz - PDstandardNth2gxz + PDstandardNth3gxy)); + + CCTK_REAL G122 = 0.5*(gu11*(-PDstandardNth1gyy + 2*PDstandardNth2gxy) + + gu21*PDstandardNth2gyy + gu31*(2*PDstandardNth2gyz - + PDstandardNth3gyy)); + + CCTK_REAL G222 = 0.5*(gu21*(-PDstandardNth1gyy + 2*PDstandardNth2gxy) + + gu22*PDstandardNth2gyy + gu32*(2*PDstandardNth2gyz - + PDstandardNth3gyy)); + + CCTK_REAL G322 = 0.5*(gu31*(-PDstandardNth1gyy + 2*PDstandardNth2gxy) + + gu32*PDstandardNth2gyy + gu33*(2*PDstandardNth2gyz - + PDstandardNth3gyy)); + + CCTK_REAL G123 = 0.5*(gu31*PDstandardNth2gzz + + gu11*(-PDstandardNth1gyz + PDstandardNth2gxz + PDstandardNth3gxy) + + gu21*PDstandardNth3gyy); + + CCTK_REAL G223 = 0.5*(gu32*PDstandardNth2gzz + + gu21*(-PDstandardNth1gyz + PDstandardNth2gxz + PDstandardNth3gxy) + + gu22*PDstandardNth3gyy); + + CCTK_REAL G323 = 0.5*(gu33*PDstandardNth2gzz + + gu31*(-PDstandardNth1gyz + PDstandardNth2gxz + PDstandardNth3gxy) + + gu32*PDstandardNth3gyy); + + CCTK_REAL G133 = 0.5*(gu11*(-PDstandardNth1gzz + 2*PDstandardNth3gxz) + + gu21*(-PDstandardNth2gzz + 2*PDstandardNth3gyz) + + gu31*PDstandardNth3gzz); + + CCTK_REAL G233 = 0.5*(gu21*(-PDstandardNth1gzz + 2*PDstandardNth3gxz) + + gu22*(-PDstandardNth2gzz + 2*PDstandardNth3gyz) + + gu32*PDstandardNth3gzz); + + CCTK_REAL G333 = 0.5*(gu31*(-PDstandardNth1gzz + 2*PDstandardNth3gxz) + + gu32*(-PDstandardNth2gzz + 2*PDstandardNth3gyz) + + gu33*PDstandardNth3gzz); + + CCTK_REAL R11 = 0.5*(-2*(G111*G122 + G111*G133 + G211*G222 + G211*G233 + + G311*G322 + G311*G333 + gu32*PDstandardNth11gyz) + + 2*gu32*PDstandardNth12gxz + 2*gu32*PDstandardNth13gxy + + gu22*(-PDstandardNth11gyy + 2*PDstandardNth12gxy - PDstandardNth22gxx) + - 2*gu32*PDstandardNth23gxx + gu33*(-PDstandardNth11gzz + + 2*PDstandardNth13gxz - PDstandardNth33gxx) + 2*SQR(G112) + 2*SQR(G113) + + 2*SQR(G212) + 2*SQR(G213) + 2*SQR(G312) + 2*SQR(G313)); + + CCTK_REAL R12 = 0.5*(2*(G113*G123 + G213*G223 + G313*G323) - + 2*(G112*G133 + G212*G233 + G312*G333 + gu21*PDstandardNth12gxy) + + gu31*(PDstandardNth11gyz - PDstandardNth12gxz - PDstandardNth13gxy) + + gu21*(PDstandardNth11gyy + PDstandardNth22gxx) + + gu32*PDstandardNth22gxz + gu31*PDstandardNth23gxx + + gu32*(-PDstandardNth12gyz + PDstandardNth13gyy - PDstandardNth23gxy) + + gu33*PDstandardNth23gxz + gu33*(-PDstandardNth12gzz + + PDstandardNth13gyz - PDstandardNth33gxy)); + + CCTK_REAL R13 = 0.5*(2*(G112*G123 + G212*G223 + G312*G323) - + 2*(G113*G122 + G213*G222 + G313*G322 + gu31*PDstandardNth13gxz) + + gu21*(PDstandardNth11gyz - PDstandardNth12gxz - PDstandardNth13gxy + + PDstandardNth23gxx) + gu22*(PDstandardNth12gyz - PDstandardNth13gyy - + PDstandardNth22gxz + PDstandardNth23gxy) + gu31*(PDstandardNth11gzz + + PDstandardNth33gxx) + gu32*(PDstandardNth12gzz - PDstandardNth13gyz - + PDstandardNth23gxz + PDstandardNth33gxy)); + + CCTK_REAL R22 = 0.5*(-2*(G122*(G111 + G133) + G222*(G211 + G233) + + G322*(G311 + G333) + gu31*PDstandardNth13gyy) + + gu11*(-PDstandardNth11gyy + 2*PDstandardNth12gxy - PDstandardNth22gxx) + + gu31*(-2*PDstandardNth22gxz + 2*(PDstandardNth12gyz + + PDstandardNth23gxy)) + gu33*(-PDstandardNth22gzz + 2*PDstandardNth23gyz + - PDstandardNth33gyy) + 2*(SQR(G112) + SQR(G123) + SQR(G212) + + SQR(G223) + SQR(G312) + SQR(G323))); + + CCTK_REAL R23 = 0.5*(2*(G112*G113 + G212*G213 + G312*G313) + + gu11*(-PDstandardNth11gyz + PDstandardNth12gxz + PDstandardNth13gxy - + PDstandardNth23gxx) + gu21*(-PDstandardNth12gyz + PDstandardNth13gyy + + PDstandardNth22gxz - PDstandardNth23gxy) - 2*(G111*G123 + G211*G223 + + G311*G323 + gu32*PDstandardNth23gyz) + gu31*(PDstandardNth12gzz - + PDstandardNth13gyz - PDstandardNth23gxz + PDstandardNth33gxy) + + gu32*(PDstandardNth22gzz + PDstandardNth33gyy)); + + CCTK_REAL R33 = 0.5*(gu11*(-PDstandardNth11gzz + 2*PDstandardNth13gxz + - PDstandardNth33gxx) - 2*((G111 + G122)*G133 + (G211 + G222)*G233 + + (G311 + G322)*G333 + gu21*(PDstandardNth12gzz + PDstandardNth33gxy)) + + gu22*(-PDstandardNth22gzz + 2*PDstandardNth23gyz - PDstandardNth33gyy) + + 2*(gu21*(PDstandardNth13gyz + PDstandardNth23gxz) + SQR(G113) + + SQR(G123) + SQR(G213) + SQR(G223) + SQR(G313) + SQR(G323))); + + CCTK_REAL trR = gu11*R11 + gu22*R22 + 2*(gu21*R12 + gu31*R13 + + gu32*R23) + gu33*R33; + + CCTK_REAL Km11 = gu11*kxxL + gu21*kxyL + gu31*kxzL; + + CCTK_REAL Km21 = gu21*kxxL + gu22*kxyL + gu32*kxzL; + + CCTK_REAL Km31 = gu31*kxxL + gu32*kxyL + gu33*kxzL; + + CCTK_REAL Km12 = gu11*kxyL + gu21*kyyL + gu31*kyzL; + + CCTK_REAL Km22 = gu21*kxyL + gu22*kyyL + gu32*kyzL; + + CCTK_REAL Km32 = gu31*kxyL + gu32*kyyL + gu33*kyzL; + + CCTK_REAL Km13 = gu11*kxzL + gu21*kyzL + gu31*kzzL; + + CCTK_REAL Km23 = gu21*kxzL + gu22*kyzL + gu32*kzzL; + + CCTK_REAL Km33 = gu31*kxzL + gu32*kyzL + gu33*kzzL; + + CCTK_REAL trK = Km11 + Km22 + Km33; + + CCTK_REAL rho = INV(SQR(alpL))*(eTttL - 2*(betayL*eTtyL + + betazL*eTtzL) + 2*(betaxL*(-eTtxL + betayL*eTxyL + betazL*eTxzL) + + betayL*betazL*eTyzL) + eTxxL*SQR(betaxL) + eTyyL*SQR(betayL) + + eTzzL*SQR(betazL)); + + CCTK_REAL S1 = (-eTtxL + betaxL*eTxxL + betayL*eTxyL + + betazL*eTxzL)*INV(alpL); + + CCTK_REAL S2 = (-eTtyL + betaxL*eTxyL + betayL*eTyyL + + betazL*eTyzL)*INV(alpL); + + CCTK_REAL S3 = (-eTtzL + betaxL*eTxzL + betayL*eTyzL + + betazL*eTzzL)*INV(alpL); + + CCTK_REAL HL = -2*(Km12*Km21 + Km13*Km31 + Km23*Km32) - + 50.26548245743669181540229413247204614715*rho + trR - SQR(Km11) - + SQR(Km22) - SQR(Km33) + SQR(trK); + + CCTK_REAL M1L = gu21*(-(G112*kxxL) + (G111 - G212)*kxyL - G312*kxzL + + G211*kyyL + G311*kyzL - PDstandardNth1kxy + PDstandardNth2kxx) + + gu22*(-(G122*kxxL) + (G112 - G222)*kxyL - G322*kxzL + G212*kyyL + + G312*kyzL - PDstandardNth1kyy + PDstandardNth2kxy) + gu31*(-(G113*kxxL) + - G213*kxyL + (G111 - G313)*kxzL + G211*kyzL + G311*kzzL - + PDstandardNth1kxz + PDstandardNth3kxx) + gu32*(G113*kxyL + G112*kxzL + + G213*kyyL + (G212 + G313)*kyzL + G312*kzzL - 2*(G123*kxxL + G223*kxyL + + G323*kxzL + PDstandardNth1kyz) + PDstandardNth2kxz + PDstandardNth3kxy) + + gu33*(-(G133*kxxL) - G233*kxyL + (G113 - G333)*kxzL + G213*kyzL + + G313*kzzL - PDstandardNth1kzz + PDstandardNth3kxz) - + 25.13274122871834590770114706623602307358*S1; + + CCTK_REAL M2L = gu11*(G112*kxxL + (-G111 + G212)*kxyL + G312*kxzL - + G211*kyyL - G311*kyzL + PDstandardNth1kxy - PDstandardNth2kxx) + + gu21*(G122*kxxL + (-G112 + G222)*kxyL + G322*kxzL - G212*kyyL - + G312*kyzL + PDstandardNth1kyy - PDstandardNth2kxy) + gu31*(G123*kxxL + + (-2*G113 + G223)*kxyL + (G112 + G323)*kxzL + G212*kyzL + G312*kzzL + + PDstandardNth1kyz - 2*(G213*kyyL + G313*kyzL + PDstandardNth2kxz) + + PDstandardNth3kxy) + gu32*(-(G123*kxyL) + G122*kxzL - G223*kyyL + (G222 + - G323)*kyzL + G322*kzzL - PDstandardNth2kyz + PDstandardNth3kyy) + + gu33*(-(G133*kxyL) + G123*kxzL - G233*kyyL + (G223 - G333)*kyzL + + G323*kzzL - PDstandardNth2kzz + PDstandardNth3kyz) - + 25.13274122871834590770114706623602307358*S2; + + CCTK_REAL M3L = gu11*(G113*kxxL + G213*kxyL + (-G111 + G313)*kxzL - + G211*kyzL - G311*kzzL + PDstandardNth1kxz - PDstandardNth3kxx) + + gu21*(G123*kxxL + (G113 + G223)*kxyL + (-2*G112 + G323)*kxzL + + G213*kyyL + (-2*G212 + G313)*kyzL + PDstandardNth1kyz + + PDstandardNth2kxz - 2*(G312*kzzL + PDstandardNth3kxy)) + + gu31*(G133*kxxL + G233*kxyL + (-G113 + G333)*kxzL - G213*kyzL - + G313*kzzL + PDstandardNth1kzz - PDstandardNth3kxz) + gu22*(G123*kxyL - + G122*kxzL + G223*kyyL + (-G222 + G323)*kyzL - G322*kzzL + + PDstandardNth2kyz - PDstandardNth3kyy) + gu32*(G133*kxyL - G123*kxzL + + G233*kyyL + (-G223 + G333)*kyzL - G323*kzzL + PDstandardNth2kzz - + PDstandardNth3kyz) - 25.13274122871834590770114706623602307358*S3; + + + /* Copy local copies back to grid functions */ + H[index] = HL; + M1[index] = M1L; + M2[index] = M2L; + M3[index] = M3L; + } + LC_ENDLOOP3 (ML_ADMConstraints); +} + +extern "C" void ML_ADMConstraints(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverInterior(cctkGH, &ML_ADMConstraints_Body); +} diff --git a/ML_ADMConstraints/src/RegisterMoL.cc b/ML_ADMConstraints/src/RegisterMoL.cc new file mode 100644 index 0000000..a44af7e --- /dev/null +++ b/ML_ADMConstraints/src/RegisterMoL.cc @@ -0,0 +1,16 @@ +/* File produced by Kranc */ + +#include "cctk.h" +#include "cctk_Arguments.h" +#include "cctk_Parameters.h" + +extern "C" void ML_ADMConstraints_RegisterVars(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT ierr = 0; + + /* Register all the evolved grid functions with MoL */ + return; +} diff --git a/ML_ADMConstraints/src/RegisterSymmetries.cc b/ML_ADMConstraints/src/RegisterSymmetries.cc new file mode 100644 index 0000000..7d56e99 --- /dev/null +++ b/ML_ADMConstraints/src/RegisterSymmetries.cc @@ -0,0 +1,39 @@ +/* File produced by Kranc */ + +#include "cctk.h" +#include "cctk_Arguments.h" +#include "cctk_Parameters.h" +#include "Symmetry.h" + +extern "C" void ML_ADMConstraints_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_ADMConstraints::H"); + + sym[0] = -1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_ADMConstraints::M1"); + + sym[0] = 1; + sym[1] = -1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_ADMConstraints::M2"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = -1; + SetCartSymVN(cctkGH, sym, "ML_ADMConstraints::M3"); + +} diff --git a/ML_ADMConstraints/src/Startup.cc b/ML_ADMConstraints/src/Startup.cc new file mode 100644 index 0000000..d3d3ed3 --- /dev/null +++ b/ML_ADMConstraints/src/Startup.cc @@ -0,0 +1,10 @@ +/* File produced by Kranc */ + +#include "cctk.h" + +extern "C" int ML_ADMConstraints_Startup(void) +{ + const char * banner = "ML_ADMConstraints"; + CCTK_RegisterBanner(banner); + return 0; +} diff --git a/ML_ADMConstraints_MP/src/Boundaries.cc b/ML_ADMConstraints_MP/src/Boundaries.cc new file mode 100644 index 0000000..e5d9151 --- /dev/null +++ b/ML_ADMConstraints_MP/src/Boundaries.cc @@ -0,0 +1,41 @@ +/* File produced by Kranc */ + +#include "cctk.h" +#include "cctk_Arguments.h" +#include "cctk_Parameters.h" +#include "cctk_Faces.h" +#include "util_Table.h" +#include "Symmetry.h" + + +/* the boundary treatment is split into 3 steps: */ +/* 1. excision */ +/* 2. symmetries */ +/* 3. "other" boundary conditions, e.g. radiative */ + +/* to simplify scheduling and testing, the 3 steps */ +/* are currently applied in separate functions */ + + +extern "C" void ML_ADMConstraints_MP_CheckBoundaries(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + return; +} + +extern "C" void ML_ADMConstraints_MP_SelectBoundConds(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT ierr = 0; + return; +} + + + +/* template for entries in parameter file: +*/ + diff --git a/ML_ADMConstraints_MP/src/ML_ADMConstraints_MP.cc b/ML_ADMConstraints_MP/src/ML_ADMConstraints_MP.cc new file mode 100644 index 0000000..f8057b6 --- /dev/null +++ b/ML_ADMConstraints_MP/src/ML_ADMConstraints_MP.cc @@ -0,0 +1,995 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +extern "C" void ML_ADMConstraints_MP_SelectBCs(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT ierr = 0; + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_ADMConstraints_MP::ML_Ham","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_ADMConstraints_MP::ML_Ham."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_ADMConstraints_MP::ML_mom","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_ADMConstraints_MP::ML_mom."); + return; +} + +static void ML_ADMConstraints_MP_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_ADMConstraints_MP_Body"); + } + + if (cctk_iteration % ML_ADMConstraints_MP_calc_every != ML_ADMConstraints_MP_calc_offset) + { + return; + } + + const char *groups[] = {"ADMBase::curv","ADMBase::lapse","ADMBase::metric","ADMBase::shift","Coordinates::jacobian","Coordinates::jacobian2","ML_ADMConstraints_MP::ML_Ham","ML_ADMConstraints_MP::ML_mom"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_ADMConstraints_MP", 8, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o12dx = 0.0833333333333333333333333333333*INV(dx); + CCTK_REAL const p1o12dy = 0.0833333333333333333333333333333*INV(dy); + CCTK_REAL const p1o12dz = 0.0833333333333333333333333333333*INV(dz); + CCTK_REAL const p1o144dxdy = 0.00694444444444444444444444444444*INV(dx)*INV(dy); + CCTK_REAL const p1o144dxdz = 0.00694444444444444444444444444444*INV(dx)*INV(dz); + CCTK_REAL const p1o144dydz = 0.00694444444444444444444444444444*INV(dy)*INV(dz); + CCTK_REAL const pm1o12dx2 = -0.0833333333333333333333333333333*INV(SQR(dx)); + CCTK_REAL const pm1o12dy2 = -0.0833333333333333333333333333333*INV(SQR(dy)); + CCTK_REAL const pm1o12dz2 = -0.0833333333333333333333333333333*INV(SQR(dz)); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_ADMConstraints_MP, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + CCTK_REAL alpL = alp[index]; + CCTK_REAL betaxL = betax[index]; + CCTK_REAL betayL = betay[index]; + CCTK_REAL betazL = betaz[index]; + CCTK_REAL dJ111L = dJ111[index]; + CCTK_REAL dJ112L = dJ112[index]; + CCTK_REAL dJ113L = dJ113[index]; + CCTK_REAL dJ122L = dJ122[index]; + CCTK_REAL dJ123L = dJ123[index]; + CCTK_REAL dJ133L = dJ133[index]; + CCTK_REAL dJ211L = dJ211[index]; + CCTK_REAL dJ212L = dJ212[index]; + CCTK_REAL dJ213L = dJ213[index]; + CCTK_REAL dJ222L = dJ222[index]; + CCTK_REAL dJ223L = dJ223[index]; + CCTK_REAL dJ233L = dJ233[index]; + CCTK_REAL dJ311L = dJ311[index]; + CCTK_REAL dJ312L = dJ312[index]; + CCTK_REAL dJ313L = dJ313[index]; + CCTK_REAL dJ322L = dJ322[index]; + CCTK_REAL dJ323L = dJ323[index]; + CCTK_REAL dJ333L = dJ333[index]; + CCTK_REAL eTttL = (*stress_energy_state) ? eTtt[index] : ToReal(0.0); + CCTK_REAL eTtxL = (*stress_energy_state) ? eTtx[index] : ToReal(0.0); + CCTK_REAL eTtyL = (*stress_energy_state) ? eTty[index] : ToReal(0.0); + CCTK_REAL eTtzL = (*stress_energy_state) ? eTtz[index] : ToReal(0.0); + CCTK_REAL eTxxL = (*stress_energy_state) ? eTxx[index] : ToReal(0.0); + CCTK_REAL eTxyL = (*stress_energy_state) ? eTxy[index] : ToReal(0.0); + CCTK_REAL eTxzL = (*stress_energy_state) ? eTxz[index] : ToReal(0.0); + CCTK_REAL eTyyL = (*stress_energy_state) ? eTyy[index] : ToReal(0.0); + CCTK_REAL eTyzL = (*stress_energy_state) ? eTyz[index] : ToReal(0.0); + CCTK_REAL eTzzL = (*stress_energy_state) ? eTzz[index] : ToReal(0.0); + CCTK_REAL gxxL = gxx[index]; + CCTK_REAL gxyL = gxy[index]; + CCTK_REAL gxzL = gxz[index]; + CCTK_REAL gyyL = gyy[index]; + CCTK_REAL gyzL = gyz[index]; + CCTK_REAL gzzL = gzz[index]; + CCTK_REAL J11L = J11[index]; + CCTK_REAL J12L = J12[index]; + CCTK_REAL J13L = J13[index]; + CCTK_REAL J21L = J21[index]; + CCTK_REAL J22L = J22[index]; + CCTK_REAL J23L = J23[index]; + CCTK_REAL J31L = J31[index]; + CCTK_REAL J32L = J32[index]; + CCTK_REAL J33L = J33[index]; + CCTK_REAL kxxL = kxx[index]; + CCTK_REAL kxyL = kxy[index]; + CCTK_REAL kxzL = kxz[index]; + CCTK_REAL kyyL = kyy[index]; + CCTK_REAL kyzL = kyz[index]; + CCTK_REAL kzzL = kzz[index]; + + /* Include user supplied include files */ + + /* Precompute derivatives */ + CCTK_REAL const PDstandardNth1gxx = PDstandardNth1(&gxx[index]); + CCTK_REAL const PDstandardNth2gxx = PDstandardNth2(&gxx[index]); + CCTK_REAL const PDstandardNth3gxx = PDstandardNth3(&gxx[index]); + CCTK_REAL const PDstandardNth11gxx = PDstandardNth11(&gxx[index]); + CCTK_REAL const PDstandardNth22gxx = PDstandardNth22(&gxx[index]); + CCTK_REAL const PDstandardNth33gxx = PDstandardNth33(&gxx[index]); + CCTK_REAL const PDstandardNth12gxx = PDstandardNth12(&gxx[index]); + CCTK_REAL const PDstandardNth13gxx = PDstandardNth13(&gxx[index]); + CCTK_REAL const PDstandardNth23gxx = PDstandardNth23(&gxx[index]); + CCTK_REAL const PDstandardNth1gxy = PDstandardNth1(&gxy[index]); + CCTK_REAL const PDstandardNth2gxy = PDstandardNth2(&gxy[index]); + CCTK_REAL const PDstandardNth3gxy = PDstandardNth3(&gxy[index]); + CCTK_REAL const PDstandardNth11gxy = PDstandardNth11(&gxy[index]); + CCTK_REAL const PDstandardNth22gxy = PDstandardNth22(&gxy[index]); + CCTK_REAL const PDstandardNth33gxy = PDstandardNth33(&gxy[index]); + CCTK_REAL const PDstandardNth12gxy = PDstandardNth12(&gxy[index]); + CCTK_REAL const PDstandardNth13gxy = PDstandardNth13(&gxy[index]); + CCTK_REAL const PDstandardNth23gxy = PDstandardNth23(&gxy[index]); + CCTK_REAL const PDstandardNth1gxz = PDstandardNth1(&gxz[index]); + CCTK_REAL const PDstandardNth2gxz = PDstandardNth2(&gxz[index]); + CCTK_REAL const PDstandardNth3gxz = PDstandardNth3(&gxz[index]); + CCTK_REAL const PDstandardNth11gxz = PDstandardNth11(&gxz[index]); + CCTK_REAL const PDstandardNth22gxz = PDstandardNth22(&gxz[index]); + CCTK_REAL const PDstandardNth33gxz = PDstandardNth33(&gxz[index]); + CCTK_REAL const PDstandardNth12gxz = PDstandardNth12(&gxz[index]); + CCTK_REAL const PDstandardNth13gxz = PDstandardNth13(&gxz[index]); + CCTK_REAL const PDstandardNth23gxz = PDstandardNth23(&gxz[index]); + CCTK_REAL const PDstandardNth1gyy = PDstandardNth1(&gyy[index]); + CCTK_REAL const PDstandardNth2gyy = PDstandardNth2(&gyy[index]); + CCTK_REAL const PDstandardNth3gyy = PDstandardNth3(&gyy[index]); + CCTK_REAL const PDstandardNth11gyy = PDstandardNth11(&gyy[index]); + CCTK_REAL const PDstandardNth22gyy = PDstandardNth22(&gyy[index]); + CCTK_REAL const PDstandardNth33gyy = PDstandardNth33(&gyy[index]); + CCTK_REAL const PDstandardNth12gyy = PDstandardNth12(&gyy[index]); + CCTK_REAL const PDstandardNth13gyy = PDstandardNth13(&gyy[index]); + CCTK_REAL const PDstandardNth23gyy = PDstandardNth23(&gyy[index]); + CCTK_REAL const PDstandardNth1gyz = PDstandardNth1(&gyz[index]); + CCTK_REAL const PDstandardNth2gyz = PDstandardNth2(&gyz[index]); + CCTK_REAL const PDstandardNth3gyz = PDstandardNth3(&gyz[index]); + CCTK_REAL const PDstandardNth11gyz = PDstandardNth11(&gyz[index]); + CCTK_REAL const PDstandardNth22gyz = PDstandardNth22(&gyz[index]); + CCTK_REAL const PDstandardNth33gyz = PDstandardNth33(&gyz[index]); + CCTK_REAL const PDstandardNth12gyz = PDstandardNth12(&gyz[index]); + CCTK_REAL const PDstandardNth13gyz = PDstandardNth13(&gyz[index]); + CCTK_REAL const PDstandardNth23gyz = PDstandardNth23(&gyz[index]); + CCTK_REAL const PDstandardNth1gzz = PDstandardNth1(&gzz[index]); + CCTK_REAL const PDstandardNth2gzz = PDstandardNth2(&gzz[index]); + CCTK_REAL const PDstandardNth3gzz = PDstandardNth3(&gzz[index]); + CCTK_REAL const PDstandardNth11gzz = PDstandardNth11(&gzz[index]); + CCTK_REAL const PDstandardNth22gzz = PDstandardNth22(&gzz[index]); + CCTK_REAL const PDstandardNth33gzz = PDstandardNth33(&gzz[index]); + CCTK_REAL const PDstandardNth12gzz = PDstandardNth12(&gzz[index]); + CCTK_REAL const PDstandardNth13gzz = PDstandardNth13(&gzz[index]); + CCTK_REAL const PDstandardNth23gzz = PDstandardNth23(&gzz[index]); + CCTK_REAL const PDstandardNth1kxx = PDstandardNth1(&kxx[index]); + CCTK_REAL const PDstandardNth2kxx = PDstandardNth2(&kxx[index]); + CCTK_REAL const PDstandardNth3kxx = PDstandardNth3(&kxx[index]); + CCTK_REAL const PDstandardNth1kxy = PDstandardNth1(&kxy[index]); + CCTK_REAL const PDstandardNth2kxy = PDstandardNth2(&kxy[index]); + CCTK_REAL const PDstandardNth3kxy = PDstandardNth3(&kxy[index]); + CCTK_REAL const PDstandardNth1kxz = PDstandardNth1(&kxz[index]); + CCTK_REAL const PDstandardNth2kxz = PDstandardNth2(&kxz[index]); + CCTK_REAL const PDstandardNth3kxz = PDstandardNth3(&kxz[index]); + CCTK_REAL const PDstandardNth1kyy = PDstandardNth1(&kyy[index]); + CCTK_REAL const PDstandardNth2kyy = PDstandardNth2(&kyy[index]); + CCTK_REAL const PDstandardNth3kyy = PDstandardNth3(&kyy[index]); + CCTK_REAL const PDstandardNth1kyz = PDstandardNth1(&kyz[index]); + CCTK_REAL const PDstandardNth2kyz = PDstandardNth2(&kyz[index]); + CCTK_REAL const PDstandardNth3kyz = PDstandardNth3(&kyz[index]); + CCTK_REAL const PDstandardNth1kzz = PDstandardNth1(&kzz[index]); + CCTK_REAL const PDstandardNth2kzz = PDstandardNth2(&kzz[index]); + CCTK_REAL const PDstandardNth3kzz = PDstandardNth3(&kzz[index]); + + /* Calculate temporaries and grid functions */ + CCTK_REAL detg = 2*gxyL*gxzL*gyzL + gzzL*(gxxL*gyyL - SQR(gxyL)) - + gyyL*SQR(gxzL) - gxxL*SQR(gyzL); + + CCTK_REAL gu11 = INV(detg)*(gyyL*gzzL - SQR(gyzL)); + + CCTK_REAL gu21 = (gxzL*gyzL - gxyL*gzzL)*INV(detg); + + CCTK_REAL gu31 = (-(gxzL*gyyL) + gxyL*gyzL)*INV(detg); + + CCTK_REAL gu22 = INV(detg)*(gxxL*gzzL - SQR(gxzL)); + + CCTK_REAL gu32 = (gxyL*gxzL - gxxL*gyzL)*INV(detg); + + CCTK_REAL gu33 = INV(detg)*(gxxL*gyyL - SQR(gxyL)); + + CCTK_REAL G111 = 0.5*((gu11*J11L - gu21*J12L - + gu31*J13L)*PDstandardNth1gxx + (gu11*J21L - gu21*J22L - + gu31*J23L)*PDstandardNth2gxx + (gu11*J31L - gu21*J32L - + gu31*J33L)*PDstandardNth3gxx + 2*(J11L*(gu21*PDstandardNth1gxy + + gu31*PDstandardNth1gxz) + J21L*(gu21*PDstandardNth2gxy + + gu31*PDstandardNth2gxz) + J31L*(gu21*PDstandardNth3gxy + + gu31*PDstandardNth3gxz))); + + CCTK_REAL G211 = 0.5*((gu21*J11L - gu22*J12L - + gu32*J13L)*PDstandardNth1gxx + (gu21*J21L - gu22*J22L - + gu32*J23L)*PDstandardNth2gxx + (gu21*J31L - gu22*J32L - + gu32*J33L)*PDstandardNth3gxx + 2*(J11L*(gu22*PDstandardNth1gxy + + gu32*PDstandardNth1gxz) + J21L*(gu22*PDstandardNth2gxy + + gu32*PDstandardNth2gxz) + J31L*(gu22*PDstandardNth3gxy + + gu32*PDstandardNth3gxz))); + + CCTK_REAL G311 = 0.5*((gu31*J11L - gu32*J12L - + gu33*J13L)*PDstandardNth1gxx + (gu31*J21L - gu32*J22L - + gu33*J23L)*PDstandardNth2gxx + (gu31*J31L - gu32*J32L - + gu33*J33L)*PDstandardNth3gxx + 2*(J11L*(gu32*PDstandardNth1gxy + + gu33*PDstandardNth1gxz) + J21L*(gu32*PDstandardNth2gxy + + gu33*PDstandardNth2gxz) + J31L*(gu32*PDstandardNth3gxy + + gu33*PDstandardNth3gxz))); + + CCTK_REAL G112 = 0.5*(gu11*(J12L*PDstandardNth1gxx + + J22L*PDstandardNth2gxx + J32L*PDstandardNth3gxx) + + gu21*(J11L*PDstandardNth1gyy + J21L*PDstandardNth2gyy + + J31L*PDstandardNth3gyy) + gu31*(-(J13L*PDstandardNth1gxy) + + J12L*PDstandardNth1gxz + J11L*PDstandardNth1gyz - + J23L*PDstandardNth2gxy + J22L*PDstandardNth2gxz + + J21L*PDstandardNth2gyz - J33L*PDstandardNth3gxy + + J32L*PDstandardNth3gxz + J31L*PDstandardNth3gyz)); + + CCTK_REAL G212 = 0.5*(gu21*(J12L*PDstandardNth1gxx + + J22L*PDstandardNth2gxx + J32L*PDstandardNth3gxx) + + gu22*(J11L*PDstandardNth1gyy + J21L*PDstandardNth2gyy + + J31L*PDstandardNth3gyy) + gu32*(-(J13L*PDstandardNth1gxy) + + J12L*PDstandardNth1gxz + J11L*PDstandardNth1gyz - + J23L*PDstandardNth2gxy + J22L*PDstandardNth2gxz + + J21L*PDstandardNth2gyz - J33L*PDstandardNth3gxy + + J32L*PDstandardNth3gxz + J31L*PDstandardNth3gyz)); + + CCTK_REAL G312 = 0.5*(gu31*(J12L*PDstandardNth1gxx + + J22L*PDstandardNth2gxx + J32L*PDstandardNth3gxx) + + gu32*(J11L*PDstandardNth1gyy + J21L*PDstandardNth2gyy + + J31L*PDstandardNth3gyy) + gu33*(-(J13L*PDstandardNth1gxy) + + J12L*PDstandardNth1gxz + J11L*PDstandardNth1gyz - + J23L*PDstandardNth2gxy + J22L*PDstandardNth2gxz + + J21L*PDstandardNth2gyz - J33L*PDstandardNth3gxy + + J32L*PDstandardNth3gxz + J31L*PDstandardNth3gyz)); + + CCTK_REAL G113 = 0.5*(gu11*(J13L*PDstandardNth1gxx + + J23L*PDstandardNth2gxx + J33L*PDstandardNth3gxx) + + gu21*(J13L*PDstandardNth1gxy - J12L*PDstandardNth1gxz + + J11L*PDstandardNth1gyz + J23L*PDstandardNth2gxy - + J22L*PDstandardNth2gxz + J21L*PDstandardNth2gyz + + J33L*PDstandardNth3gxy - J32L*PDstandardNth3gxz + + J31L*PDstandardNth3gyz) + gu31*(J11L*PDstandardNth1gzz + + J21L*PDstandardNth2gzz + J31L*PDstandardNth3gzz)); + + CCTK_REAL G213 = 0.5*(gu21*(J13L*PDstandardNth1gxx + + J23L*PDstandardNth2gxx + J33L*PDstandardNth3gxx) + + gu22*(J13L*PDstandardNth1gxy - J12L*PDstandardNth1gxz + + J11L*PDstandardNth1gyz + J23L*PDstandardNth2gxy - + J22L*PDstandardNth2gxz + J21L*PDstandardNth2gyz + + J33L*PDstandardNth3gxy - J32L*PDstandardNth3gxz + + J31L*PDstandardNth3gyz) + gu32*(J11L*PDstandardNth1gzz + + J21L*PDstandardNth2gzz + J31L*PDstandardNth3gzz)); + + CCTK_REAL G313 = 0.5*(gu31*(J13L*PDstandardNth1gxx + + J23L*PDstandardNth2gxx + J33L*PDstandardNth3gxx) + + gu32*(J13L*PDstandardNth1gxy - J12L*PDstandardNth1gxz + + J11L*PDstandardNth1gyz + J23L*PDstandardNth2gxy - + J22L*PDstandardNth2gxz + J21L*PDstandardNth2gyz + + J33L*PDstandardNth3gxy - J32L*PDstandardNth3gxz + + J31L*PDstandardNth3gyz) + gu33*(J11L*PDstandardNth1gzz + + J21L*PDstandardNth2gzz + J31L*PDstandardNth3gzz)); + + CCTK_REAL G122 = 0.5*(gu11*(-(J11L*PDstandardNth1gyy) + + 2*(J12L*PDstandardNth1gxy + J22L*PDstandardNth2gxy) - + J21L*PDstandardNth2gyy + 2*J32L*PDstandardNth3gxy - + J31L*PDstandardNth3gyy) + gu21*(J12L*PDstandardNth1gyy + + J22L*PDstandardNth2gyy + J32L*PDstandardNth3gyy) - + gu31*(J13L*PDstandardNth1gyy + J23L*PDstandardNth2gyy + + J33L*PDstandardNth3gyy - 2*(J12L*PDstandardNth1gyz + + J22L*PDstandardNth2gyz + J32L*PDstandardNth3gyz))); + + CCTK_REAL G222 = 0.5*(gu21*(-(J11L*PDstandardNth1gyy) + + 2*(J12L*PDstandardNth1gxy + J22L*PDstandardNth2gxy) - + J21L*PDstandardNth2gyy + 2*J32L*PDstandardNth3gxy - + J31L*PDstandardNth3gyy) + gu22*(J12L*PDstandardNth1gyy + + J22L*PDstandardNth2gyy + J32L*PDstandardNth3gyy) - + gu32*(J13L*PDstandardNth1gyy + J23L*PDstandardNth2gyy + + J33L*PDstandardNth3gyy - 2*(J12L*PDstandardNth1gyz + + J22L*PDstandardNth2gyz + J32L*PDstandardNth3gyz))); + + CCTK_REAL G322 = 0.5*(gu31*(-(J11L*PDstandardNth1gyy) + + 2*(J12L*PDstandardNth1gxy + J22L*PDstandardNth2gxy) - + J21L*PDstandardNth2gyy + 2*J32L*PDstandardNth3gxy - + J31L*PDstandardNth3gyy) + gu32*(J12L*PDstandardNth1gyy + + J22L*PDstandardNth2gyy + J32L*PDstandardNth3gyy) - + gu33*(J13L*PDstandardNth1gyy + J23L*PDstandardNth2gyy + + J33L*PDstandardNth3gyy - 2*(J12L*PDstandardNth1gyz + + J22L*PDstandardNth2gyz + J32L*PDstandardNth3gyz))); + + CCTK_REAL G123 = 0.5*(gu21*(J13L*PDstandardNth1gyy + + J23L*PDstandardNth2gyy + J33L*PDstandardNth3gyy) + + gu11*(J13L*PDstandardNth1gxy + J12L*PDstandardNth1gxz - + J11L*PDstandardNth1gyz + J23L*PDstandardNth2gxy + + J22L*PDstandardNth2gxz - J21L*PDstandardNth2gyz + + J33L*PDstandardNth3gxy + J32L*PDstandardNth3gxz - + J31L*PDstandardNth3gyz) + gu31*(J12L*PDstandardNth1gzz + + J22L*PDstandardNth2gzz + J32L*PDstandardNth3gzz)); + + CCTK_REAL G223 = 0.5*(gu22*(J13L*PDstandardNth1gyy + + J23L*PDstandardNth2gyy + J33L*PDstandardNth3gyy) + + gu21*(J13L*PDstandardNth1gxy + J12L*PDstandardNth1gxz - + J11L*PDstandardNth1gyz + J23L*PDstandardNth2gxy + + J22L*PDstandardNth2gxz - J21L*PDstandardNth2gyz + + J33L*PDstandardNth3gxy + J32L*PDstandardNth3gxz - + J31L*PDstandardNth3gyz) + gu32*(J12L*PDstandardNth1gzz + + J22L*PDstandardNth2gzz + J32L*PDstandardNth3gzz)); + + CCTK_REAL G323 = 0.5*(gu32*(J13L*PDstandardNth1gyy + + J23L*PDstandardNth2gyy + J33L*PDstandardNth3gyy) + + gu31*(J13L*PDstandardNth1gxy + J12L*PDstandardNth1gxz - + J11L*PDstandardNth1gyz + J23L*PDstandardNth2gxy + + J22L*PDstandardNth2gxz - J21L*PDstandardNth2gyz + + J33L*PDstandardNth3gxy + J32L*PDstandardNth3gxz - + J31L*PDstandardNth3gyz) + gu33*(J12L*PDstandardNth1gzz + + J22L*PDstandardNth2gzz + J32L*PDstandardNth3gzz)); + + CCTK_REAL G133 = 0.5*(gu11*(-(J11L*PDstandardNth1gzz) + + 2*(J13L*PDstandardNth1gxz + J23L*PDstandardNth2gxz) - + J21L*PDstandardNth2gzz + 2*J33L*PDstandardNth3gxz - + J31L*PDstandardNth3gzz) + gu21*(-(J12L*PDstandardNth1gzz) + + 2*(J13L*PDstandardNth1gyz + J23L*PDstandardNth2gyz) - + J22L*PDstandardNth2gzz + 2*J33L*PDstandardNth3gyz - + J32L*PDstandardNth3gzz) + gu31*(J13L*PDstandardNth1gzz + + J23L*PDstandardNth2gzz + J33L*PDstandardNth3gzz)); + + CCTK_REAL G233 = 0.5*(gu21*(-(J11L*PDstandardNth1gzz) + + 2*(J13L*PDstandardNth1gxz + J23L*PDstandardNth2gxz) - + J21L*PDstandardNth2gzz + 2*J33L*PDstandardNth3gxz - + J31L*PDstandardNth3gzz) + gu22*(-(J12L*PDstandardNth1gzz) + + 2*(J13L*PDstandardNth1gyz + J23L*PDstandardNth2gyz) - + J22L*PDstandardNth2gzz + 2*J33L*PDstandardNth3gyz - + J32L*PDstandardNth3gzz) + gu32*(J13L*PDstandardNth1gzz + + J23L*PDstandardNth2gzz + J33L*PDstandardNth3gzz)); + + CCTK_REAL G333 = 0.5*(gu31*(-(J11L*PDstandardNth1gzz) + + 2*(J13L*PDstandardNth1gxz + J23L*PDstandardNth2gxz) - + J21L*PDstandardNth2gzz + 2*J33L*PDstandardNth3gxz - + J31L*PDstandardNth3gzz) + gu32*(-(J12L*PDstandardNth1gzz) + + 2*(J13L*PDstandardNth1gyz + J23L*PDstandardNth2gyz) - + J22L*PDstandardNth2gzz + 2*J33L*PDstandardNth3gyz - + J32L*PDstandardNth3gzz) + gu33*(J13L*PDstandardNth1gzz + + J23L*PDstandardNth2gzz + J33L*PDstandardNth3gzz)); + + CCTK_REAL R11 = 0.5*(-((dJ122L*gu22 + 2*dJ123L*gu32 + + dJ133L*gu33)*PDstandardNth1gxx) + gu32*(-4*J11L*J21L*PDstandardNth12gyz + - 2*J13L*J32L*PDstandardNth13gxx + 2*J13L*J31L*PDstandardNth13gxy + + 2*J12L*J31L*PDstandardNth13gxz - 4*J11L*J31L*PDstandardNth13gyz + + 2*dJ113L*PDstandardNth1gxy) + 2*(gu22*J11L*J12L*PDstandardNth11gxy + + gu32*J11L*J13L*PDstandardNth11gxy + gu32*J11L*J12L*PDstandardNth11gxz + + gu33*J11L*J13L*PDstandardNth11gxz + gu22*J12L*J21L*PDstandardNth12gxy + + gu32*J13L*J21L*PDstandardNth12gxy + gu22*J11L*J22L*PDstandardNth12gxy + + gu32*J11L*J23L*PDstandardNth12gxy + gu32*J12L*J21L*PDstandardNth12gxz + + gu33*J13L*J21L*PDstandardNth12gxz + gu32*J11L*J22L*PDstandardNth12gxz + + gu33*J11L*J23L*PDstandardNth12gxz + gu22*J12L*J31L*PDstandardNth13gxy + + gu22*J11L*J32L*PDstandardNth13gxy + gu32*J11L*J33L*PDstandardNth13gxy + + gu33*J13L*J31L*PDstandardNth13gxz + gu32*J11L*J32L*PDstandardNth13gxz + + gu33*J11L*J33L*PDstandardNth13gxz + dJ112L*gu22*PDstandardNth1gxy) + + 2*dJ112L*gu32*PDstandardNth1gxz - 2*(G111*G122 + G111*G133 + G211*G222 + + G211*G233 + G311*G322 + G311*G333 + gu32*J12L*J13L*PDstandardNth11gxx + + gu22*J12L*J22L*PDstandardNth12gxx + gu32*J13L*J22L*PDstandardNth12gxx + + gu32*J12L*J23L*PDstandardNth12gxx + gu33*J13L*J23L*PDstandardNth12gxx + + gu22*J11L*J21L*PDstandardNth12gyy + gu33*J11L*J21L*PDstandardNth12gzz + + gu22*J12L*J32L*PDstandardNth13gxx + gu32*J12L*J33L*PDstandardNth13gxx + + gu33*J13L*J33L*PDstandardNth13gxx + gu22*J11L*J31L*PDstandardNth13gyy + + gu33*J11L*J31L*PDstandardNth13gzz + dJ111L*gu32*PDstandardNth1gyz) + + 2*gu32*J21L*J23L*PDstandardNth22gxy + + 2*gu32*J21L*J22L*PDstandardNth22gxz - + 2*gu32*J23L*J32L*PDstandardNth23gxx - + 2*gu32*J22L*J33L*PDstandardNth23gxx + + 2*gu32*J23L*J31L*PDstandardNth23gxy + + 2*gu32*J21L*J33L*PDstandardNth23gxy + + 2*gu32*J22L*J31L*PDstandardNth23gxz + + 2*gu32*J21L*J32L*PDstandardNth23gxz - + 4*gu32*J21L*J31L*PDstandardNth23gyz - (dJ222L*gu22 + 2*dJ223L*gu32 + + dJ233L*gu33)*PDstandardNth2gxx + 2*dJ213L*gu32*PDstandardNth2gxy + + 2*dJ212L*gu32*PDstandardNth2gxz - 2*dJ211L*gu32*PDstandardNth2gyz + + 2*gu22*J31L*J32L*PDstandardNth33gxy + + 2*gu32*J31L*J33L*PDstandardNth33gxy + + 2*gu32*J31L*J32L*PDstandardNth33gxz - 2*dJ323L*gu32*PDstandardNth3gxx + + gu22*(-2*J22L*J32L*PDstandardNth23gxx - dJ322L*PDstandardNth3gxx) + + gu33*(2*J21L*J23L*PDstandardNth22gxz - dJ333L*PDstandardNth3gxx) + + 2*dJ312L*gu22*PDstandardNth3gxy + 2*dJ313L*gu32*PDstandardNth3gxy + + 2*dJ312L*gu32*PDstandardNth3gxz + 2*dJ313L*gu33*PDstandardNth3gxz + + gu22*(2*J22L*J31L*PDstandardNth23gxy - dJ311L*PDstandardNth3gyy) - + 2*dJ311L*gu32*PDstandardNth3gyz + gu33*(-2*J23L*J33L*PDstandardNth23gxx + - dJ311L*PDstandardNth3gzz) + 2*SQR(G112) + 2*SQR(G113) + 2*SQR(G212) + + 2*SQR(G213) + 2*SQR(G312) + 2*SQR(G313) - + 2*gu32*PDstandardNth11gyz*SQR(J11L) + + gu22*(2*J21L*J32L*PDstandardNth23gxy - PDstandardNth11gyy*SQR(J11L)) + + gu33*(2*J23L*J31L*PDstandardNth23gxz - PDstandardNth11gzz*SQR(J11L)) + + gu22*(-2*J21L*J31L*PDstandardNth23gyy - PDstandardNth11gxx*SQR(J12L)) + + gu33*(2*J21L*J33L*PDstandardNth23gxz - PDstandardNth11gxx*SQR(J13L)) - + 2*gu32*PDstandardNth22gyz*SQR(J21L) + gu22*(2*dJ212L*PDstandardNth2gxy + - PDstandardNth22gyy*SQR(J21L)) + gu33*(-2*J21L*J31L*PDstandardNth23gzz + - PDstandardNth22gzz*SQR(J21L)) + PDstandardNth22gxx*(-2*gu32*J22L*J23L + - gu22*SQR(J22L)) + gu33*(2*dJ213L*PDstandardNth2gxz - + PDstandardNth22gxx*SQR(J23L)) - 2*gu32*PDstandardNth33gyz*SQR(J31L) + + gu22*(-(dJ111L*PDstandardNth1gyy) + 2*J21L*J22L*PDstandardNth22gxy - + dJ211L*PDstandardNth2gyy - PDstandardNth33gyy*SQR(J31L)) + + gu33*(2*dJ113L*PDstandardNth1gxz - dJ111L*PDstandardNth1gzz - + dJ211L*PDstandardNth2gzz - PDstandardNth33gzz*SQR(J31L)) + + PDstandardNth33gxx*(-2*gu32*J32L*J33L - gu22*SQR(J32L)) + + gu33*(2*J31L*J33L*PDstandardNth33gxz - PDstandardNth33gxx*SQR(J33L))); + + CCTK_REAL R12 = G113*G123 - G112*G133 + G212*G222 + G213*G223 + + G212*(-G222 - G233) + G312*G322 + G313*G323 + G312*(-G322 - G333) + + 0.5*(gu32*((J13L*J22L - J12L*J23L)*PDstandardNth12gxy + (-(J13L*J22L) + + J12L*J23L)*PDstandardNth12gxy + (J13L*J32L - + J12L*J33L)*PDstandardNth13gxy + (-(J13L*J32L) + + J12L*J33L)*PDstandardNth13gxy) + gu22*((J12L*J21L - + J11L*J22L)*PDstandardNth12gyy + (-(J12L*J21L) + + J11L*J22L)*PDstandardNth12gyy + (J12L*J31L - + J11L*J32L)*PDstandardNth13gyy + (-(J12L*J31L) + + J11L*J32L)*PDstandardNth13gyy) + gu31*(J13L*(J12L*PDstandardNth11gxx - + J11L*PDstandardNth11gxy - J21L*PDstandardNth12gxy - + J31L*PDstandardNth13gxy) + J11L*(-(J23L*PDstandardNth12gxy) + + 2*J21L*PDstandardNth12gyz - J33L*PDstandardNth13gxy) + + J12L*(-(J11L*PDstandardNth11gxz) + J23L*PDstandardNth12gxx - + J21L*PDstandardNth12gxz - J31L*PDstandardNth13gxz) + + dJ123L*PDstandardNth1gxx - dJ113L*PDstandardNth1gxy - + dJ112L*PDstandardNth1gxz + dJ111L*PDstandardNth1gyz + + J23L*(J22L*PDstandardNth22gxx - J21L*PDstandardNth22gxy) + + J33L*(J12L*PDstandardNth13gxx - J21L*PDstandardNth23gxy) + + J31L*(2*J11L*PDstandardNth13gyz - J23L*PDstandardNth23gxy) + + J32L*(J13L*PDstandardNth13gxx - J11L*PDstandardNth13gxz - + J21L*PDstandardNth23gxz) + J22L*(J13L*PDstandardNth12gxx - + J11L*PDstandardNth12gxz - J21L*PDstandardNth22gxz - + J31L*PDstandardNth23gxz) + 2*J21L*J31L*PDstandardNth23gyz + + dJ223L*PDstandardNth2gxx - dJ213L*PDstandardNth2gxy - + dJ212L*PDstandardNth2gxz + dJ211L*PDstandardNth2gyz + + J32L*J33L*PDstandardNth33gxx + J33L*(J22L*PDstandardNth23gxx - + J31L*PDstandardNth33gxy) + J32L*(J23L*PDstandardNth23gxx - + J31L*PDstandardNth33gxz) + dJ323L*PDstandardNth3gxx - + dJ313L*PDstandardNth3gxy - dJ312L*PDstandardNth3gxz + + dJ311L*PDstandardNth3gyz + PDstandardNth11gyz*SQR(J11L) + + PDstandardNth22gyz*SQR(J21L) + PDstandardNth33gyz*SQR(J31L)) + + gu21*(-2*J11L*J12L*PDstandardNth11gxy + 2*J12L*J22L*PDstandardNth12gxx + - 2*J12L*J21L*PDstandardNth12gxy - 2*J11L*J22L*PDstandardNth12gxy + + 2*J11L*J21L*PDstandardNth12gyy + 2*J12L*J32L*PDstandardNth13gxx - + 2*J12L*J31L*PDstandardNth13gxy - 2*J11L*J32L*PDstandardNth13gxy + + 2*J11L*J31L*PDstandardNth13gyy + dJ122L*PDstandardNth1gxx - + 2*dJ112L*PDstandardNth1gxy + dJ111L*PDstandardNth1gyy - + 2*J21L*J22L*PDstandardNth22gxy + 2*J22L*J32L*PDstandardNth23gxx - + 2*J22L*J31L*PDstandardNth23gxy - 2*J21L*J32L*PDstandardNth23gxy + + 2*J21L*J31L*PDstandardNth23gyy + dJ222L*PDstandardNth2gxx - + 2*dJ212L*PDstandardNth2gxy + dJ211L*PDstandardNth2gyy - + 2*J31L*J32L*PDstandardNth33gxy + dJ322L*PDstandardNth3gxx - + 2*dJ312L*PDstandardNth3gxy + dJ311L*PDstandardNth3gyy + + PDstandardNth11gyy*SQR(J11L) + PDstandardNth11gxx*SQR(J12L) + + PDstandardNth22gyy*SQR(J21L) + PDstandardNth22gxx*SQR(J22L) + + PDstandardNth33gyy*SQR(J31L) + PDstandardNth33gxx*SQR(J32L)) + + gu32*(J13L*(-(J12L*PDstandardNth11gxy) + J11L*PDstandardNth11gyy - + J22L*PDstandardNth12gxy - J32L*PDstandardNth13gxy) + + J12L*(-(J11L*PDstandardNth11gyz) - J23L*PDstandardNth12gxy - + J21L*PDstandardNth12gyz - J33L*PDstandardNth13gxy - + J31L*PDstandardNth13gyz) + J11L*(J23L*PDstandardNth12gyy - + J32L*PDstandardNth13gyz) - dJ123L*PDstandardNth1gxy + + dJ122L*PDstandardNth1gxz + dJ113L*PDstandardNth1gyy - + dJ112L*PDstandardNth1gyz + J22L*(2*J12L*PDstandardNth12gxz - + J11L*PDstandardNth12gyz - J23L*PDstandardNth22gxy) + + J21L*(J13L*PDstandardNth12gyy - J22L*PDstandardNth22gyz) + + 2*J22L*J32L*PDstandardNth23gxz + J23L*J31L*PDstandardNth23gyy + + J21L*J33L*PDstandardNth23gyy + J31L*(J13L*PDstandardNth13gyy - + J22L*PDstandardNth23gyz) + J21L*(J23L*PDstandardNth22gyy - + J32L*PDstandardNth23gyz) - dJ223L*PDstandardNth2gxy + + dJ222L*PDstandardNth2gxz + dJ213L*PDstandardNth2gyy - + dJ212L*PDstandardNth2gyz + J33L*(J11L*PDstandardNth13gyy - + J22L*PDstandardNth23gxy - J32L*PDstandardNth33gxy) + + J31L*J33L*PDstandardNth33gyy + J32L*(2*J12L*PDstandardNth13gxz - + J23L*PDstandardNth23gxy - J31L*PDstandardNth33gyz) - + dJ323L*PDstandardNth3gxy + dJ322L*PDstandardNth3gxz + + dJ313L*PDstandardNth3gyy - dJ312L*PDstandardNth3gyz + + PDstandardNth11gxz*SQR(J12L) + PDstandardNth22gxz*SQR(J22L) + + PDstandardNth33gxz*SQR(J32L)) + gu33*(-2*J13L*J23L*PDstandardNth12gxy + + J12L*(J13L*PDstandardNth11gxz - J11L*PDstandardNth11gzz - + J21L*PDstandardNth12gzz) + J11L*(J13L*PDstandardNth11gyz - + J22L*PDstandardNth12gzz) - 2*J13L*J33L*PDstandardNth13gxy + + J12L*J33L*PDstandardNth13gxz + J11L*J33L*PDstandardNth13gyz + + J12L*(J23L*PDstandardNth12gxz - J31L*PDstandardNth13gzz) + + J11L*(J23L*PDstandardNth12gyz - J32L*PDstandardNth13gzz) - + dJ133L*PDstandardNth1gxy + dJ123L*PDstandardNth1gxz + + dJ113L*PDstandardNth1gyz - dJ112L*PDstandardNth1gzz + + J22L*J23L*PDstandardNth22gxz + J21L*J23L*PDstandardNth22gyz + + J22L*(J13L*PDstandardNth12gxz - J21L*PDstandardNth22gzz) - + 2*J23L*J33L*PDstandardNth23gxy + J23L*J32L*PDstandardNth23gxz + + J22L*J33L*PDstandardNth23gxz + J23L*J31L*PDstandardNth23gyz + + J21L*J33L*PDstandardNth23gyz + J31L*(J13L*PDstandardNth13gyz - + J22L*PDstandardNth23gzz) + J21L*(J13L*PDstandardNth12gyz - + J32L*PDstandardNth23gzz) - dJ233L*PDstandardNth2gxy + + dJ223L*PDstandardNth2gxz + dJ213L*PDstandardNth2gyz - + dJ212L*PDstandardNth2gzz + J32L*J33L*PDstandardNth33gxz + + J31L*J33L*PDstandardNth33gyz + J32L*(J13L*PDstandardNth13gxz - + J31L*PDstandardNth33gzz) - dJ333L*PDstandardNth3gxy + + dJ323L*PDstandardNth3gxz + dJ313L*PDstandardNth3gyz - + dJ312L*PDstandardNth3gzz - PDstandardNth11gxy*SQR(J13L) - + PDstandardNth22gxy*SQR(J23L) - PDstandardNth33gxy*SQR(J33L))); + + CCTK_REAL R13 = -(G113*G122) + G112*G123 + G212*G223 + G213*(-G222 - + G233) + G213*G233 + G312*G323 + G313*(-G322 - G333) + G313*G333 + + 0.5*(gu32*((J13L*J22L - J12L*J23L)*PDstandardNth12gxz + (-(J13L*J22L) + + J12L*J23L)*PDstandardNth12gxz + (J13L*J32L - + J12L*J33L)*PDstandardNth13gxz + (-(J13L*J32L) + + J12L*J33L)*PDstandardNth13gxz) + gu33*((J13L*J21L - + J11L*J23L)*PDstandardNth12gzz + (-(J13L*J21L) + + J11L*J23L)*PDstandardNth12gzz + (J13L*J31L - + J11L*J33L)*PDstandardNth13gzz + (-(J13L*J31L) + + J11L*J33L)*PDstandardNth13gzz) + gu21*(J13L*(J12L*PDstandardNth11gxx - + J11L*PDstandardNth11gxy - J21L*PDstandardNth12gxy - + J31L*PDstandardNth13gxy) + J11L*(-(J23L*PDstandardNth12gxy) + + 2*J21L*PDstandardNth12gyz - J33L*PDstandardNth13gxy) + + J12L*(-(J11L*PDstandardNth11gxz) + J23L*PDstandardNth12gxx - + J21L*PDstandardNth12gxz - J31L*PDstandardNth13gxz) + + dJ123L*PDstandardNth1gxx - dJ113L*PDstandardNth1gxy - + dJ112L*PDstandardNth1gxz + dJ111L*PDstandardNth1gyz + + J23L*(J22L*PDstandardNth22gxx - J21L*PDstandardNth22gxy) + + J33L*(J12L*PDstandardNth13gxx - J21L*PDstandardNth23gxy) + + J31L*(2*J11L*PDstandardNth13gyz - J23L*PDstandardNth23gxy) + + J32L*(J13L*PDstandardNth13gxx - J11L*PDstandardNth13gxz - + J21L*PDstandardNth23gxz) + J22L*(J13L*PDstandardNth12gxx - + J11L*PDstandardNth12gxz - J21L*PDstandardNth22gxz - + J31L*PDstandardNth23gxz) + 2*J21L*J31L*PDstandardNth23gyz + + dJ223L*PDstandardNth2gxx - dJ213L*PDstandardNth2gxy - + dJ212L*PDstandardNth2gxz + dJ211L*PDstandardNth2gyz + + J32L*J33L*PDstandardNth33gxx + J33L*(J22L*PDstandardNth23gxx - + J31L*PDstandardNth33gxy) + J32L*(J23L*PDstandardNth23gxx - + J31L*PDstandardNth33gxz) + dJ323L*PDstandardNth3gxx - + dJ313L*PDstandardNth3gxy - dJ312L*PDstandardNth3gxz + + dJ311L*PDstandardNth3gyz + PDstandardNth11gyz*SQR(J11L) + + PDstandardNth22gyz*SQR(J21L) + PDstandardNth33gyz*SQR(J31L)) + + gu22*(-2*J12L*J22L*PDstandardNth12gxz + J13L*(J12L*PDstandardNth11gxy - + J11L*PDstandardNth11gyy - J21L*PDstandardNth12gyy) + + J11L*J22L*PDstandardNth12gyz + J13L*J32L*PDstandardNth13gxy - + 2*J12L*J32L*PDstandardNth13gxz + J13L*(J22L*PDstandardNth12gxy - + J31L*PDstandardNth13gyy) + J11L*(J12L*PDstandardNth11gyz - + J23L*PDstandardNth12gyy - J33L*PDstandardNth13gyy) + + J11L*J32L*PDstandardNth13gyz + dJ123L*PDstandardNth1gxy - + dJ122L*PDstandardNth1gxz - dJ113L*PDstandardNth1gyy + + dJ112L*PDstandardNth1gyz + J22L*J23L*PDstandardNth22gxy + + J23L*(J12L*PDstandardNth12gxy - J21L*PDstandardNth22gyy) + + J21L*J22L*PDstandardNth22gyz + J23L*J32L*PDstandardNth23gxy + + J22L*J33L*PDstandardNth23gxy - 2*J22L*J32L*PDstandardNth23gxz + + J31L*(J12L*PDstandardNth13gyz - J23L*PDstandardNth23gyy) + + J21L*(J12L*PDstandardNth12gyz - J33L*PDstandardNth23gyy) + + J22L*J31L*PDstandardNth23gyz + J21L*J32L*PDstandardNth23gyz + + dJ223L*PDstandardNth2gxy - dJ222L*PDstandardNth2gxz - + dJ213L*PDstandardNth2gyy + dJ212L*PDstandardNth2gyz + + J32L*J33L*PDstandardNth33gxy + J33L*(J12L*PDstandardNth13gxy - + J31L*PDstandardNth33gyy) + J31L*J32L*PDstandardNth33gyz + + dJ323L*PDstandardNth3gxy - dJ322L*PDstandardNth3gxz - + dJ313L*PDstandardNth3gyy + dJ312L*PDstandardNth3gyz - + PDstandardNth11gxz*SQR(J12L) - PDstandardNth22gxz*SQR(J22L) - + PDstandardNth33gxz*SQR(J32L)) + gu31*(-2*J11L*J13L*PDstandardNth11gxz + + 2*J13L*J23L*PDstandardNth12gxx - 2*J13L*J21L*PDstandardNth12gxz - + 2*J11L*J23L*PDstandardNth12gxz + 2*J11L*J21L*PDstandardNth12gzz + + 2*J13L*J33L*PDstandardNth13gxx - 2*J13L*J31L*PDstandardNth13gxz - + 2*J11L*J33L*PDstandardNth13gxz + 2*J11L*J31L*PDstandardNth13gzz + + dJ133L*PDstandardNth1gxx - 2*dJ113L*PDstandardNth1gxz + + dJ111L*PDstandardNth1gzz - 2*J21L*J23L*PDstandardNth22gxz + + 2*J23L*J33L*PDstandardNth23gxx - 2*J23L*J31L*PDstandardNth23gxz - + 2*J21L*J33L*PDstandardNth23gxz + 2*J21L*J31L*PDstandardNth23gzz + + dJ233L*PDstandardNth2gxx - 2*dJ213L*PDstandardNth2gxz + + dJ211L*PDstandardNth2gzz - 2*J31L*J33L*PDstandardNth33gxz + + dJ333L*PDstandardNth3gxx - 2*dJ313L*PDstandardNth3gxz + + dJ311L*PDstandardNth3gzz + PDstandardNth11gzz*SQR(J11L) + + PDstandardNth11gxx*SQR(J13L) + PDstandardNth22gzz*SQR(J21L) + + PDstandardNth22gxx*SQR(J23L) + PDstandardNth33gzz*SQR(J31L) + + PDstandardNth33gxx*SQR(J33L)) + gu32*(J13L*(-(J12L*PDstandardNth11gxz) + - J11L*PDstandardNth11gyz - J22L*PDstandardNth12gxz - + J32L*PDstandardNth13gxz) + J12L*(J11L*PDstandardNth11gzz - + J23L*PDstandardNth12gxz - J33L*PDstandardNth13gxz) + + J13L*(2*J23L*PDstandardNth12gxy - J21L*PDstandardNth12gyz - + J31L*PDstandardNth13gyz) + J11L*(-(J23L*PDstandardNth12gyz) + + J22L*PDstandardNth12gzz - J33L*PDstandardNth13gyz) + + dJ133L*PDstandardNth1gxy - dJ123L*PDstandardNth1gxz - + dJ113L*PDstandardNth1gyz + dJ112L*PDstandardNth1gzz + + J22L*(-(J23L*PDstandardNth22gxz) + J21L*PDstandardNth22gzz) + + J32L*(J11L*PDstandardNth13gzz - J23L*PDstandardNth23gxz) + + J31L*(J12L*PDstandardNth13gzz - J23L*PDstandardNth23gyz) + + J21L*(J12L*PDstandardNth12gzz - J23L*PDstandardNth22gyz - + J33L*PDstandardNth23gyz) + J22L*J31L*PDstandardNth23gzz + + J21L*J32L*PDstandardNth23gzz + dJ233L*PDstandardNth2gxy - + dJ223L*PDstandardNth2gxz - dJ213L*PDstandardNth2gyz + + dJ212L*PDstandardNth2gzz + J33L*(2*J23L*PDstandardNth23gxy - + J32L*PDstandardNth33gxz) + J33L*(2*J13L*PDstandardNth13gxy - + J22L*PDstandardNth23gxz - J31L*PDstandardNth33gyz) + + J31L*J32L*PDstandardNth33gzz + dJ333L*PDstandardNth3gxy - + dJ323L*PDstandardNth3gxz - dJ313L*PDstandardNth3gyz + + dJ312L*PDstandardNth3gzz + PDstandardNth11gxy*SQR(J13L) + + PDstandardNth22gxy*SQR(J23L) + PDstandardNth33gxy*SQR(J33L))); + + CCTK_REAL R22 = 0.5*(gu31*(-4*J12L*J22L*PDstandardNth12gxz - + 2*J13L*J21L*PDstandardNth12gyy + 2*J11L*J22L*PDstandardNth12gyz + + 2*J13L*J32L*PDstandardNth13gxy - 4*J12L*J32L*PDstandardNth13gxz - + 2*J13L*J31L*PDstandardNth13gyy + 2*J11L*J32L*PDstandardNth13gyz + + 2*dJ123L*PDstandardNth1gxy) + 2*(gu11*J11L*J12L*PDstandardNth11gxy + + gu31*J12L*J13L*PDstandardNth11gxy + gu31*J11L*J12L*PDstandardNth11gyz + + gu33*J12L*J13L*PDstandardNth11gyz + gu11*J12L*J21L*PDstandardNth12gxy + + gu11*J11L*J22L*PDstandardNth12gxy + gu31*J13L*J22L*PDstandardNth12gxy + + gu31*J12L*J23L*PDstandardNth12gxy + gu31*J12L*J21L*PDstandardNth12gyz + + gu33*J13L*J22L*PDstandardNth12gyz + gu33*J12L*J23L*PDstandardNth12gyz + + gu11*J12L*J31L*PDstandardNth13gxy + gu11*J11L*J32L*PDstandardNth13gxy + + gu31*J12L*J33L*PDstandardNth13gxy + gu31*J12L*J31L*PDstandardNth13gyz + + gu33*J13L*J32L*PDstandardNth13gyz + gu33*J12L*J33L*PDstandardNth13gyz + + dJ112L*gu11*PDstandardNth1gxy) - 2*(G111*G122 + G122*G133 + G211*G222 + + G222*G233 + G311*G322 + G322*G333 + gu31*J11L*J13L*PDstandardNth11gyy + + gu11*J12L*J22L*PDstandardNth12gxx + gu11*J11L*J21L*PDstandardNth12gyy + + gu31*J11L*J23L*PDstandardNth12gyy + gu33*J13L*J23L*PDstandardNth12gyy + + gu33*J12L*J22L*PDstandardNth12gzz + gu11*J12L*J32L*PDstandardNth13gxx + + gu11*J11L*J31L*PDstandardNth13gyy + gu31*J11L*J33L*PDstandardNth13gyy + + gu33*J13L*J33L*PDstandardNth13gyy + gu33*J12L*J32L*PDstandardNth13gzz + + dJ122L*gu31*PDstandardNth1gxz) + (-2*dJ113L*gu31 - + dJ133L*gu33)*PDstandardNth1gyy + 2*dJ112L*gu31*PDstandardNth1gyz + + 2*gu31*J22L*J23L*PDstandardNth22gxy + + 2*gu31*J21L*J22L*PDstandardNth22gyz + + 2*gu31*J23L*J32L*PDstandardNth23gxy + + 2*gu31*J22L*J33L*PDstandardNth23gxy - + 4*gu31*J22L*J32L*PDstandardNth23gxz - + 2*gu31*J23L*J31L*PDstandardNth23gyy - + 2*gu31*J21L*J33L*PDstandardNth23gyy + + 2*gu31*J22L*J31L*PDstandardNth23gyz + + 2*gu31*J21L*J32L*PDstandardNth23gyz + 2*dJ223L*gu31*PDstandardNth2gxy - + 2*dJ222L*gu31*PDstandardNth2gxz - 2*dJ213L*gu31*PDstandardNth2gyy + + 2*dJ212L*gu31*PDstandardNth2gyz + 2*gu11*J31L*J32L*PDstandardNth33gxy + + 2*gu31*J32L*J33L*PDstandardNth33gxy + + 2*gu31*J31L*J32L*PDstandardNth33gyz + + 2*gu33*J32L*J33L*PDstandardNth33gyz + + gu11*(-2*J22L*J32L*PDstandardNth23gxx - dJ322L*PDstandardNth3gxx) + + 2*dJ312L*gu11*PDstandardNth3gxy + 2*dJ323L*gu31*PDstandardNth3gxy - + 2*dJ322L*gu31*PDstandardNth3gxz - 2*dJ313L*gu31*PDstandardNth3gyy + + gu11*(2*J22L*J31L*PDstandardNth23gxy - dJ311L*PDstandardNth3gyy) + + gu33*(-2*J23L*J33L*PDstandardNth23gyy - dJ333L*PDstandardNth3gyy) + + 2*dJ312L*gu31*PDstandardNth3gyz + 2*dJ323L*gu33*PDstandardNth3gyz + + gu33*(2*J23L*J32L*PDstandardNth23gyz - dJ322L*PDstandardNth3gzz) + + 2*SQR(G112) + 2*SQR(G123) + 2*SQR(G212) + 2*SQR(G223) + 2*SQR(G312) + + 2*SQR(G323) + gu11*(2*J21L*J32L*PDstandardNth23gxy - + PDstandardNth11gyy*SQR(J11L)) - 2*gu31*PDstandardNth11gxz*SQR(J12L) + + gu11*(-2*J21L*J31L*PDstandardNth23gyy - PDstandardNth11gxx*SQR(J12L)) + + gu33*(2*J22L*J33L*PDstandardNth23gyz - PDstandardNth11gzz*SQR(J12L)) + + gu33*(-2*J22L*J32L*PDstandardNth23gzz - PDstandardNth11gyy*SQR(J13L)) + + PDstandardNth22gyy*(-2*gu31*J21L*J23L - gu11*SQR(J21L)) - + 2*gu31*PDstandardNth22gxz*SQR(J22L) + gu11*(-(dJ122L*PDstandardNth1gxx) + - dJ111L*PDstandardNth1gyy - dJ222L*PDstandardNth2gxx - + PDstandardNth22gxx*SQR(J22L)) + gu33*(2*dJ123L*PDstandardNth1gyz - + dJ122L*PDstandardNth1gzz - dJ233L*PDstandardNth2gyy - + PDstandardNth22gzz*SQR(J22L)) + gu33*(2*dJ223L*PDstandardNth2gyz - + PDstandardNth22gyy*SQR(J23L)) + gu11*(2*dJ212L*PDstandardNth2gxy - + PDstandardNth33gyy*SQR(J31L)) - 2*gu31*PDstandardNth33gxz*SQR(J32L) + + gu11*(2*J21L*J22L*PDstandardNth22gxy - dJ211L*PDstandardNth2gyy - + PDstandardNth33gxx*SQR(J32L)) + gu33*(2*J22L*J23L*PDstandardNth22gyz - + dJ222L*PDstandardNth2gzz - PDstandardNth33gzz*SQR(J32L)) + + PDstandardNth33gyy*(-2*gu31*J31L*J33L - gu33*SQR(J33L))); + + CCTK_REAL R23 = G112*G113 - G111*G123 + G212*G213 + G223*(-G211 - + G233) + G223*G233 + G312*G313 + G323*(-G311 - G333) + G323*G333 + + 0.5*(gu31*((J13L*J22L - J12L*J23L)*PDstandardNth12gxz + (-(J13L*J22L) + + J12L*J23L)*PDstandardNth12gxz + (J13L*J32L - + J12L*J33L)*PDstandardNth13gxz + (-(J13L*J32L) + + J12L*J33L)*PDstandardNth13gxz) + gu33*((J13L*J22L - + J12L*J23L)*PDstandardNth12gzz + (-(J13L*J22L) + + J12L*J23L)*PDstandardNth12gzz + (J13L*J32L - + J12L*J33L)*PDstandardNth13gzz + (-(J13L*J32L) + + J12L*J33L)*PDstandardNth13gzz) + gu11*(J13L*J21L*PDstandardNth12gxy + + J12L*J21L*PDstandardNth12gxz - 2*J11L*J21L*PDstandardNth12gyz + + J13L*(-(J12L*PDstandardNth11gxx) + J11L*PDstandardNth11gxy - + J22L*PDstandardNth12gxx - J32L*PDstandardNth13gxx) + + J12L*(J11L*PDstandardNth11gxz - J23L*PDstandardNth12gxx - + J33L*PDstandardNth13gxx) + J13L*J31L*PDstandardNth13gxy + + J12L*J31L*PDstandardNth13gxz - 2*J11L*J31L*PDstandardNth13gyz - + dJ123L*PDstandardNth1gxx + dJ113L*PDstandardNth1gxy + + dJ112L*PDstandardNth1gxz - dJ111L*PDstandardNth1gyz + + J23L*(J11L*PDstandardNth12gxy - J22L*PDstandardNth22gxx) + + J21L*J23L*PDstandardNth22gxy + J21L*J22L*PDstandardNth22gxz + + J32L*(J11L*PDstandardNth13gxz - J23L*PDstandardNth23gxx) + + J22L*(J11L*PDstandardNth12gxz - J33L*PDstandardNth23gxx) + + J23L*J31L*PDstandardNth23gxy + J21L*J33L*PDstandardNth23gxy + + J22L*J31L*PDstandardNth23gxz + J21L*J32L*PDstandardNth23gxz - + 2*J21L*J31L*PDstandardNth23gyz - dJ223L*PDstandardNth2gxx + + dJ213L*PDstandardNth2gxy + dJ212L*PDstandardNth2gxz - + dJ211L*PDstandardNth2gyz + J33L*(J11L*PDstandardNth13gxy - + J32L*PDstandardNth33gxx) + J31L*J33L*PDstandardNth33gxy + + J31L*J32L*PDstandardNth33gxz - dJ323L*PDstandardNth3gxx + + dJ313L*PDstandardNth3gxy + dJ312L*PDstandardNth3gxz - + dJ311L*PDstandardNth3gyz - PDstandardNth11gyz*SQR(J11L) - + PDstandardNth22gyz*SQR(J21L) - PDstandardNth33gyz*SQR(J31L)) + + gu21*(J13L*(-(J12L*PDstandardNth11gxy) + J11L*PDstandardNth11gyy - + J22L*PDstandardNth12gxy - J32L*PDstandardNth13gxy) + + J12L*(-(J11L*PDstandardNth11gyz) - J23L*PDstandardNth12gxy - + J21L*PDstandardNth12gyz - J33L*PDstandardNth13gxy - + J31L*PDstandardNth13gyz) + J11L*(J23L*PDstandardNth12gyy - + J32L*PDstandardNth13gyz) - dJ123L*PDstandardNth1gxy + + dJ122L*PDstandardNth1gxz + dJ113L*PDstandardNth1gyy - + dJ112L*PDstandardNth1gyz + J22L*(2*J12L*PDstandardNth12gxz - + J11L*PDstandardNth12gyz - J23L*PDstandardNth22gxy) + + J21L*(J13L*PDstandardNth12gyy - J22L*PDstandardNth22gyz) + + 2*J22L*J32L*PDstandardNth23gxz + J23L*J31L*PDstandardNth23gyy + + J21L*J33L*PDstandardNth23gyy + J31L*(J13L*PDstandardNth13gyy - + J22L*PDstandardNth23gyz) + J21L*(J23L*PDstandardNth22gyy - + J32L*PDstandardNth23gyz) - dJ223L*PDstandardNth2gxy + + dJ222L*PDstandardNth2gxz + dJ213L*PDstandardNth2gyy - + dJ212L*PDstandardNth2gyz + J33L*(J11L*PDstandardNth13gyy - + J22L*PDstandardNth23gxy - J32L*PDstandardNth33gxy) + + J31L*J33L*PDstandardNth33gyy + J32L*(2*J12L*PDstandardNth13gxz - + J23L*PDstandardNth23gxy - J31L*PDstandardNth33gyz) - + dJ323L*PDstandardNth3gxy + dJ322L*PDstandardNth3gxz + + dJ313L*PDstandardNth3gyy - dJ312L*PDstandardNth3gyz + + PDstandardNth11gxz*SQR(J12L) + PDstandardNth22gxz*SQR(J22L) + + PDstandardNth33gxz*SQR(J32L)) + gu31*(J13L*(-(J12L*PDstandardNth11gxz) + - J11L*PDstandardNth11gyz - J22L*PDstandardNth12gxz - + J32L*PDstandardNth13gxz) + J12L*(J11L*PDstandardNth11gzz - + J23L*PDstandardNth12gxz - J33L*PDstandardNth13gxz) + + J13L*(2*J23L*PDstandardNth12gxy - J21L*PDstandardNth12gyz - + J31L*PDstandardNth13gyz) + J11L*(-(J23L*PDstandardNth12gyz) + + J22L*PDstandardNth12gzz - J33L*PDstandardNth13gyz) + + dJ133L*PDstandardNth1gxy - dJ123L*PDstandardNth1gxz - + dJ113L*PDstandardNth1gyz + dJ112L*PDstandardNth1gzz + + J22L*(-(J23L*PDstandardNth22gxz) + J21L*PDstandardNth22gzz) + + J32L*(J11L*PDstandardNth13gzz - J23L*PDstandardNth23gxz) + + J31L*(J12L*PDstandardNth13gzz - J23L*PDstandardNth23gyz) + + J21L*(J12L*PDstandardNth12gzz - J23L*PDstandardNth22gyz - + J33L*PDstandardNth23gyz) + J22L*J31L*PDstandardNth23gzz + + J21L*J32L*PDstandardNth23gzz + dJ233L*PDstandardNth2gxy - + dJ223L*PDstandardNth2gxz - dJ213L*PDstandardNth2gyz + + dJ212L*PDstandardNth2gzz + J33L*(2*J23L*PDstandardNth23gxy - + J32L*PDstandardNth33gxz) + J33L*(2*J13L*PDstandardNth13gxy - + J22L*PDstandardNth23gxz - J31L*PDstandardNth33gyz) + + J31L*J32L*PDstandardNth33gzz + dJ333L*PDstandardNth3gxy - + dJ323L*PDstandardNth3gxz - dJ313L*PDstandardNth3gyz + + dJ312L*PDstandardNth3gzz + PDstandardNth11gxy*SQR(J13L) + + PDstandardNth22gxy*SQR(J23L) + PDstandardNth33gxy*SQR(J33L)) + + gu32*(-2*J12L*J13L*PDstandardNth11gyz + 2*J13L*J23L*PDstandardNth12gyy + - 2*J13L*J22L*PDstandardNth12gyz - 2*J12L*J23L*PDstandardNth12gyz + + 2*J12L*J22L*PDstandardNth12gzz + 2*J13L*J33L*PDstandardNth13gyy - + 2*J13L*J32L*PDstandardNth13gyz - 2*J12L*J33L*PDstandardNth13gyz + + 2*J12L*J32L*PDstandardNth13gzz + dJ133L*PDstandardNth1gyy - + 2*dJ123L*PDstandardNth1gyz + dJ122L*PDstandardNth1gzz - + 2*J22L*J23L*PDstandardNth22gyz + 2*J23L*J33L*PDstandardNth23gyy - + 2*J23L*J32L*PDstandardNth23gyz - 2*J22L*J33L*PDstandardNth23gyz + + 2*J22L*J32L*PDstandardNth23gzz + dJ233L*PDstandardNth2gyy - + 2*dJ223L*PDstandardNth2gyz + dJ222L*PDstandardNth2gzz - + 2*J32L*J33L*PDstandardNth33gyz + dJ333L*PDstandardNth3gyy - + 2*dJ323L*PDstandardNth3gyz + dJ322L*PDstandardNth3gzz + + PDstandardNth11gzz*SQR(J12L) + PDstandardNth11gyy*SQR(J13L) + + PDstandardNth22gzz*SQR(J22L) + PDstandardNth22gyy*SQR(J23L) + + PDstandardNth33gzz*SQR(J32L) + PDstandardNth33gyy*SQR(J33L))); + + CCTK_REAL R33 = 0.5*(gu21*(-4*J13L*J23L*PDstandardNth12gxy + + 2*J13L*J22L*PDstandardNth12gxz + 2*J13L*J21L*PDstandardNth12gyz - + 2*J12L*J21L*PDstandardNth12gzz - 4*J13L*J33L*PDstandardNth13gxy + + 2*J13L*J32L*PDstandardNth13gxz + 2*J13L*J31L*PDstandardNth13gyz - + 2*J12L*J31L*PDstandardNth13gzz - 2*dJ133L*PDstandardNth1gxy) + + 2*dJ123L*gu21*PDstandardNth1gxz + 2*(gu11*J11L*J13L*PDstandardNth11gxz + + gu21*J12L*J13L*PDstandardNth11gxz + gu21*J11L*J13L*PDstandardNth11gyz + + gu22*J12L*J13L*PDstandardNth11gyz + gu11*J13L*J21L*PDstandardNth12gxz + + gu11*J11L*J23L*PDstandardNth12gxz + gu21*J12L*J23L*PDstandardNth12gxz + + gu22*J13L*J22L*PDstandardNth12gyz + gu21*J11L*J23L*PDstandardNth12gyz + + gu22*J12L*J23L*PDstandardNth12gyz + gu11*J13L*J31L*PDstandardNth13gxz + + gu11*J11L*J33L*PDstandardNth13gxz + gu21*J12L*J33L*PDstandardNth13gxz + + gu22*J13L*J32L*PDstandardNth13gyz + gu21*J11L*J33L*PDstandardNth13gyz + + gu22*J12L*J33L*PDstandardNth13gyz + dJ113L*gu11*PDstandardNth1gxz) + + dJ133L*(-(gu11*PDstandardNth1gxx) - gu22*PDstandardNth1gyy) + + 2*dJ113L*gu21*PDstandardNth1gyz - 2*(G111*G133 + G122*G133 + G211*G233 + + G222*G233 + G311*G333 + G322*G333 + gu21*J11L*J12L*PDstandardNth11gzz + + gu11*J13L*J23L*PDstandardNth12gxx + gu22*J13L*J23L*PDstandardNth12gyy + + gu11*J11L*J21L*PDstandardNth12gzz + gu21*J11L*J22L*PDstandardNth12gzz + + gu22*J12L*J22L*PDstandardNth12gzz + gu11*J13L*J33L*PDstandardNth13gxx + + gu22*J13L*J33L*PDstandardNth13gyy + gu11*J11L*J31L*PDstandardNth13gzz + + gu21*J11L*J32L*PDstandardNth13gzz + gu22*J12L*J32L*PDstandardNth13gzz + + dJ112L*gu21*PDstandardNth1gzz) + 2*gu21*J22L*J23L*PDstandardNth22gxz + + 2*gu21*J21L*J23L*PDstandardNth22gyz - + 4*gu21*J23L*J33L*PDstandardNth23gxy + + 2*gu21*J23L*J32L*PDstandardNth23gxz + + 2*gu21*J22L*J33L*PDstandardNth23gxz + + 2*gu21*J23L*J31L*PDstandardNth23gyz + + 2*gu21*J21L*J33L*PDstandardNth23gyz - + 2*gu21*J22L*J31L*PDstandardNth23gzz - + 2*gu21*J21L*J32L*PDstandardNth23gzz - 2*dJ233L*gu21*PDstandardNth2gxy + + 2*dJ223L*gu21*PDstandardNth2gxz + 2*dJ213L*gu21*PDstandardNth2gyz - + 2*dJ212L*gu21*PDstandardNth2gzz + 2*gu21*J32L*J33L*PDstandardNth33gxz + + 2*gu21*J31L*J33L*PDstandardNth33gyz - + 2*gu21*J31L*J32L*PDstandardNth33gzz + + gu11*(2*J23L*J31L*PDstandardNth23gxz - dJ333L*PDstandardNth3gxx) - + 2*dJ333L*gu21*PDstandardNth3gxy + 2*dJ313L*gu11*PDstandardNth3gxz + + 2*dJ323L*gu21*PDstandardNth3gxz + gu22*(-2*J23L*J33L*PDstandardNth23gyy + - dJ333L*PDstandardNth3gyy) + 2*dJ313L*gu21*PDstandardNth3gyz + + 2*dJ323L*gu22*PDstandardNth3gyz - 2*dJ312L*gu21*PDstandardNth3gzz + + gu11*(2*J21L*J33L*PDstandardNth23gxz - dJ311L*PDstandardNth3gzz) + + gu22*(2*J23L*J32L*PDstandardNth23gyz - dJ322L*PDstandardNth3gzz) + + 2*SQR(G113) + 2*SQR(G123) + 2*SQR(G213) + 2*SQR(G223) + 2*SQR(G313) + + 2*SQR(G323) + gu11*(-2*J21L*J31L*PDstandardNth23gzz - + PDstandardNth11gzz*SQR(J11L)) + gu22*(2*J22L*J33L*PDstandardNth23gyz - + PDstandardNth11gzz*SQR(J12L)) - 2*gu21*PDstandardNth11gxy*SQR(J13L) + + gu11*(-(dJ111L*PDstandardNth1gzz) + 2*J21L*J23L*PDstandardNth22gxz - + dJ233L*PDstandardNth2gxx - PDstandardNth11gxx*SQR(J13L)) + + gu22*(-2*J22L*J32L*PDstandardNth23gzz - PDstandardNth11gyy*SQR(J13L)) + + PDstandardNth22gzz*(-2*gu21*J21L*J22L - gu11*SQR(J21L)) + + gu22*(2*dJ123L*PDstandardNth1gyz - dJ122L*PDstandardNth1gzz - + dJ233L*PDstandardNth2gyy - PDstandardNth22gzz*SQR(J22L)) - + 2*gu21*PDstandardNth22gxy*SQR(J23L) + gu11*(2*dJ213L*PDstandardNth2gxz + - PDstandardNth22gxx*SQR(J23L)) + gu22*(2*dJ223L*PDstandardNth2gyz - + PDstandardNth22gyy*SQR(J23L)) + gu11*(-2*J23L*J33L*PDstandardNth23gxx - + dJ211L*PDstandardNth2gzz - PDstandardNth33gzz*SQR(J31L)) + + gu22*(2*J22L*J23L*PDstandardNth22gyz - dJ222L*PDstandardNth2gzz - + PDstandardNth33gzz*SQR(J32L)) - 2*gu21*PDstandardNth33gxy*SQR(J33L) + + gu11*(2*J31L*J33L*PDstandardNth33gxz - PDstandardNth33gxx*SQR(J33L)) + + gu22*(2*J32L*J33L*PDstandardNth33gyz - PDstandardNth33gyy*SQR(J33L))); + + CCTK_REAL trR = gu11*R11 + gu22*R22 + 2*(gu21*R12 + gu31*R13 + + gu32*R23) + gu33*R33; + + CCTK_REAL Km11 = gu11*kxxL + gu21*kxyL + gu31*kxzL; + + CCTK_REAL Km21 = gu21*kxxL + gu22*kxyL + gu32*kxzL; + + CCTK_REAL Km31 = gu31*kxxL + gu32*kxyL + gu33*kxzL; + + CCTK_REAL Km12 = gu11*kxyL + gu21*kyyL + gu31*kyzL; + + CCTK_REAL Km22 = gu21*kxyL + gu22*kyyL + gu32*kyzL; + + CCTK_REAL Km32 = gu31*kxyL + gu32*kyyL + gu33*kyzL; + + CCTK_REAL Km13 = gu11*kxzL + gu21*kyzL + gu31*kzzL; + + CCTK_REAL Km23 = gu21*kxzL + gu22*kyzL + gu32*kzzL; + + CCTK_REAL Km33 = gu31*kxzL + gu32*kyzL + gu33*kzzL; + + CCTK_REAL trK = Km11 + Km22 + Km33; + + CCTK_REAL rho = INV(SQR(alpL))*(eTttL - 2*(betayL*eTtyL + + betazL*eTtzL) + 2*(betaxL*(-eTtxL + betayL*eTxyL + betazL*eTxzL) + + betayL*betazL*eTyzL) + eTxxL*SQR(betaxL) + eTyyL*SQR(betayL) + + eTzzL*SQR(betazL)); + + CCTK_REAL S1 = (-eTtxL + betaxL*eTxxL + betayL*eTxyL + + betazL*eTxzL)*INV(alpL); + + CCTK_REAL S2 = (-eTtyL + betaxL*eTxyL + betayL*eTyyL + + betazL*eTyzL)*INV(alpL); + + CCTK_REAL S3 = (-eTtzL + betaxL*eTxzL + betayL*eTyzL + + betazL*eTzzL)*INV(alpL); + + CCTK_REAL HL = -2*(Km12*Km21 + Km13*Km31 + Km23*Km32) - + 50.26548245743669181540229413247204614715*rho + trR - SQR(Km11) - + SQR(Km22) - SQR(Km33) + SQR(trK); + + CCTK_REAL M1L = gu21*(-(G112*kxxL) + (G111 - G212)*kxyL - G312*kxzL + + G211*kyyL + G311*kyzL + J12L*PDstandardNth1kxx - J11L*PDstandardNth1kxy + + J22L*PDstandardNth2kxx - J21L*PDstandardNth2kxy + + J32L*PDstandardNth3kxx - J31L*PDstandardNth3kxy) + gu31*(-(G113*kxxL) - + G213*kxyL + (G111 - G313)*kxzL + G211*kyzL + G311*kzzL + + J13L*PDstandardNth1kxx - J11L*PDstandardNth1kxz + + J23L*PDstandardNth2kxx - J21L*PDstandardNth2kxz + + J33L*PDstandardNth3kxx - J31L*PDstandardNth3kxz) + gu22*(-(G122*kxxL) + + (G112 - G222)*kxyL - G322*kxzL + G212*kyyL + G312*kyzL + + J12L*PDstandardNth1kxy - J11L*PDstandardNth1kyy + + J22L*PDstandardNth2kxy - J21L*PDstandardNth2kyy + + J32L*PDstandardNth3kxy - J31L*PDstandardNth3kyy) + gu32*(G113*kxyL + + G112*kxzL + G213*kyyL + (G212 + G313)*kyzL + G312*kzzL + + J13L*PDstandardNth1kxy + J12L*PDstandardNth1kxz + + J23L*PDstandardNth2kxy + J22L*PDstandardNth2kxz + + J33L*PDstandardNth3kxy + J32L*PDstandardNth3kxz - 2*(G123*kxxL + + G223*kxyL + G323*kxzL + J11L*PDstandardNth1kyz + J21L*PDstandardNth2kyz + + J31L*PDstandardNth3kyz)) + gu33*(-(G133*kxxL) - G233*kxyL + (G113 - + G333)*kxzL + G213*kyzL + G313*kzzL + J13L*PDstandardNth1kxz - + J11L*PDstandardNth1kzz + J23L*PDstandardNth2kxz - + J21L*PDstandardNth2kzz + J33L*PDstandardNth3kxz - + J31L*PDstandardNth3kzz) - 25.13274122871834590770114706623602307358*S1; + + CCTK_REAL M2L = gu11*(G112*kxxL + (-G111 + G212)*kxyL + G312*kxzL - + G211*kyyL - G311*kyzL - J12L*PDstandardNth1kxx + J11L*PDstandardNth1kxy + - J22L*PDstandardNth2kxx + J21L*PDstandardNth2kxy - + J32L*PDstandardNth3kxx + J31L*PDstandardNth3kxy) + gu21*(G122*kxxL + + (-G112 + G222)*kxyL + G322*kxzL - G212*kyyL - G312*kyzL - + J12L*PDstandardNth1kxy + J11L*PDstandardNth1kyy - + J22L*PDstandardNth2kxy + J21L*PDstandardNth2kyy - + J32L*PDstandardNth3kxy + J31L*PDstandardNth3kyy) + gu31*(G123*kxxL + + (-2*G113 + G223)*kxyL + (G112 + G323)*kxzL + G212*kyzL + G312*kzzL + + J13L*PDstandardNth1kxy + J11L*PDstandardNth1kyz + + J23L*PDstandardNth2kxy + J21L*PDstandardNth2kyz + + J33L*PDstandardNth3kxy - 2*(G213*kyyL + G313*kyzL + + J12L*PDstandardNth1kxz + J22L*PDstandardNth2kxz + + J32L*PDstandardNth3kxz) + J31L*PDstandardNth3kyz) + gu32*(-(G123*kxyL) + + G122*kxzL - G223*kyyL + (G222 - G323)*kyzL + G322*kzzL + + J13L*PDstandardNth1kyy - J12L*PDstandardNth1kyz + + J23L*PDstandardNth2kyy - J22L*PDstandardNth2kyz + + J33L*PDstandardNth3kyy - J32L*PDstandardNth3kyz) + gu33*(-(G133*kxyL) + + G123*kxzL - G233*kyyL + (G223 - G333)*kyzL + G323*kzzL + + J13L*PDstandardNth1kyz - J12L*PDstandardNth1kzz + + J23L*PDstandardNth2kyz - J22L*PDstandardNth2kzz + + J33L*PDstandardNth3kyz - J32L*PDstandardNth3kzz) - + 25.13274122871834590770114706623602307358*S2; + + CCTK_REAL M3L = gu11*(G113*kxxL + G213*kxyL + (-G111 + G313)*kxzL - + G211*kyzL - G311*kzzL - J13L*PDstandardNth1kxx + J11L*PDstandardNth1kxz + - J23L*PDstandardNth2kxx + J21L*PDstandardNth2kxz - + J33L*PDstandardNth3kxx + J31L*PDstandardNth3kxz) + gu21*(G123*kxxL + + (G113 + G223)*kxyL + (-2*G112 + G323)*kxzL + G213*kyyL + (-2*G212 + + G313)*kyzL + J12L*PDstandardNth1kxz + J11L*PDstandardNth1kyz + + J22L*PDstandardNth2kxz + J21L*PDstandardNth2kyz - 2*(G312*kzzL + + J13L*PDstandardNth1kxy + J23L*PDstandardNth2kxy + + J33L*PDstandardNth3kxy) + J32L*PDstandardNth3kxz + + J31L*PDstandardNth3kyz) + gu22*(G123*kxyL - G122*kxzL + G223*kyyL + + (-G222 + G323)*kyzL - G322*kzzL - J13L*PDstandardNth1kyy + + J12L*PDstandardNth1kyz - J23L*PDstandardNth2kyy + + J22L*PDstandardNth2kyz - J33L*PDstandardNth3kyy + + J32L*PDstandardNth3kyz) + gu31*(G133*kxxL + G233*kxyL + (-G113 + + G333)*kxzL - G213*kyzL - G313*kzzL - J13L*PDstandardNth1kxz + + J11L*PDstandardNth1kzz - J23L*PDstandardNth2kxz + + J21L*PDstandardNth2kzz - J33L*PDstandardNth3kxz + + J31L*PDstandardNth3kzz) + gu32*(G133*kxyL - G123*kxzL + G233*kyyL + + (-G223 + G333)*kyzL - G323*kzzL - J13L*PDstandardNth1kyz + + J12L*PDstandardNth1kzz - J23L*PDstandardNth2kyz + + J22L*PDstandardNth2kzz - J33L*PDstandardNth3kyz + + J32L*PDstandardNth3kzz) - 25.13274122871834590770114706623602307358*S3; + + + /* Copy local copies back to grid functions */ + H[index] = HL; + M1[index] = M1L; + M2[index] = M2L; + M3[index] = M3L; + } + LC_ENDLOOP3 (ML_ADMConstraints_MP); +} + +extern "C" void ML_ADMConstraints_MP(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverInterior(cctkGH, &ML_ADMConstraints_MP_Body); +} diff --git a/ML_ADMConstraints_MP/src/RegisterMoL.cc b/ML_ADMConstraints_MP/src/RegisterMoL.cc new file mode 100644 index 0000000..9d0e767 --- /dev/null +++ b/ML_ADMConstraints_MP/src/RegisterMoL.cc @@ -0,0 +1,16 @@ +/* File produced by Kranc */ + +#include "cctk.h" +#include "cctk_Arguments.h" +#include "cctk_Parameters.h" + +extern "C" void ML_ADMConstraints_MP_RegisterVars(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT ierr = 0; + + /* Register all the evolved grid functions with MoL */ + return; +} diff --git a/ML_ADMConstraints_MP/src/RegisterSymmetries.cc b/ML_ADMConstraints_MP/src/RegisterSymmetries.cc new file mode 100644 index 0000000..f6cca33 --- /dev/null +++ b/ML_ADMConstraints_MP/src/RegisterSymmetries.cc @@ -0,0 +1,39 @@ +/* File produced by Kranc */ + +#include "cctk.h" +#include "cctk_Arguments.h" +#include "cctk_Parameters.h" +#include "Symmetry.h" + +extern "C" void ML_ADMConstraints_MP_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_ADMConstraints_MP::H"); + + sym[0] = -1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_ADMConstraints_MP::M1"); + + sym[0] = 1; + sym[1] = -1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_ADMConstraints_MP::M2"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = -1; + SetCartSymVN(cctkGH, sym, "ML_ADMConstraints_MP::M3"); + +} diff --git a/ML_ADMConstraints_MP/src/Startup.cc b/ML_ADMConstraints_MP/src/Startup.cc new file mode 100644 index 0000000..291cf43 --- /dev/null +++ b/ML_ADMConstraints_MP/src/Startup.cc @@ -0,0 +1,10 @@ +/* File produced by Kranc */ + +#include "cctk.h" + +extern "C" int ML_ADMConstraints_MP_Startup(void) +{ + const char * banner = "ML_ADMConstraints_MP"; + CCTK_RegisterBanner(banner); + return 0; +} diff --git a/ML_ADMConstraints_O2/src/Boundaries.cc b/ML_ADMConstraints_O2/src/Boundaries.cc new file mode 100644 index 0000000..044e909 --- /dev/null +++ b/ML_ADMConstraints_O2/src/Boundaries.cc @@ -0,0 +1,41 @@ +/* File produced by Kranc */ + +#include "cctk.h" +#include "cctk_Arguments.h" +#include "cctk_Parameters.h" +#include "cctk_Faces.h" +#include "util_Table.h" +#include "Symmetry.h" + + +/* the boundary treatment is split into 3 steps: */ +/* 1. excision */ +/* 2. symmetries */ +/* 3. "other" boundary conditions, e.g. radiative */ + +/* to simplify scheduling and testing, the 3 steps */ +/* are currently applied in separate functions */ + + +extern "C" void ML_ADMConstraints_O2_CheckBoundaries(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + return; +} + +extern "C" void ML_ADMConstraints_O2_SelectBoundConds(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT ierr = 0; + return; +} + + + +/* template for entries in parameter file: +*/ + diff --git a/ML_ADMConstraints_O2/src/ML_ADMConstraints_O2.cc b/ML_ADMConstraints_O2/src/ML_ADMConstraints_O2.cc new file mode 100644 index 0000000..0febf70 --- /dev/null +++ b/ML_ADMConstraints_O2/src/ML_ADMConstraints_O2.cc @@ -0,0 +1,408 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +extern "C" void ML_ADMConstraints_O2_SelectBCs(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT ierr = 0; + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_ADMConstraints_O2::ML_Ham","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_ADMConstraints_O2::ML_Ham."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_ADMConstraints_O2::ML_mom","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_ADMConstraints_O2::ML_mom."); + return; +} + +static void ML_ADMConstraints_O2_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_ADMConstraints_O2_Body"); + } + + if (cctk_iteration % ML_ADMConstraints_O2_calc_every != ML_ADMConstraints_O2_calc_offset) + { + return; + } + + const char *groups[] = {"ADMBase::curv","ADMBase::lapse","ADMBase::metric","ADMBase::shift","ML_ADMConstraints_O2::ML_Ham","ML_ADMConstraints_O2::ML_mom"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_ADMConstraints_O2", 6, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o2dx = 0.5*INV(dx); + CCTK_REAL const p1o2dy = 0.5*INV(dy); + CCTK_REAL const p1o2dz = 0.5*INV(dz); + CCTK_REAL const p1o4dxdy = 0.25*INV(dx)*INV(dy); + CCTK_REAL const p1o4dxdz = 0.25*INV(dx)*INV(dz); + CCTK_REAL const p1o4dydz = 0.25*INV(dy)*INV(dz); + CCTK_REAL const p1odx2 = INV(SQR(dx)); + CCTK_REAL const p1ody2 = INV(SQR(dy)); + CCTK_REAL const p1odz2 = INV(SQR(dz)); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_ADMConstraints_O2, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + CCTK_REAL alpL = alp[index]; + CCTK_REAL betaxL = betax[index]; + CCTK_REAL betayL = betay[index]; + CCTK_REAL betazL = betaz[index]; + CCTK_REAL eTttL = (*stress_energy_state) ? eTtt[index] : ToReal(0.0); + CCTK_REAL eTtxL = (*stress_energy_state) ? eTtx[index] : ToReal(0.0); + CCTK_REAL eTtyL = (*stress_energy_state) ? eTty[index] : ToReal(0.0); + CCTK_REAL eTtzL = (*stress_energy_state) ? eTtz[index] : ToReal(0.0); + CCTK_REAL eTxxL = (*stress_energy_state) ? eTxx[index] : ToReal(0.0); + CCTK_REAL eTxyL = (*stress_energy_state) ? eTxy[index] : ToReal(0.0); + CCTK_REAL eTxzL = (*stress_energy_state) ? eTxz[index] : ToReal(0.0); + CCTK_REAL eTyyL = (*stress_energy_state) ? eTyy[index] : ToReal(0.0); + CCTK_REAL eTyzL = (*stress_energy_state) ? eTyz[index] : ToReal(0.0); + CCTK_REAL eTzzL = (*stress_energy_state) ? eTzz[index] : ToReal(0.0); + CCTK_REAL gxxL = gxx[index]; + CCTK_REAL gxyL = gxy[index]; + CCTK_REAL gxzL = gxz[index]; + CCTK_REAL gyyL = gyy[index]; + CCTK_REAL gyzL = gyz[index]; + CCTK_REAL gzzL = gzz[index]; + CCTK_REAL kxxL = kxx[index]; + CCTK_REAL kxyL = kxy[index]; + CCTK_REAL kxzL = kxz[index]; + CCTK_REAL kyyL = kyy[index]; + CCTK_REAL kyzL = kyz[index]; + CCTK_REAL kzzL = kzz[index]; + + /* Include user supplied include files */ + + /* Precompute derivatives */ + CCTK_REAL const PDstandardNth1gxx = PDstandardNth1(&gxx[index]); + CCTK_REAL const PDstandardNth2gxx = PDstandardNth2(&gxx[index]); + CCTK_REAL const PDstandardNth3gxx = PDstandardNth3(&gxx[index]); + CCTK_REAL const PDstandardNth22gxx = PDstandardNth22(&gxx[index]); + CCTK_REAL const PDstandardNth33gxx = PDstandardNth33(&gxx[index]); + CCTK_REAL const PDstandardNth23gxx = PDstandardNth23(&gxx[index]); + CCTK_REAL const PDstandardNth1gxy = PDstandardNth1(&gxy[index]); + CCTK_REAL const PDstandardNth2gxy = PDstandardNth2(&gxy[index]); + CCTK_REAL const PDstandardNth3gxy = PDstandardNth3(&gxy[index]); + CCTK_REAL const PDstandardNth33gxy = PDstandardNth33(&gxy[index]); + CCTK_REAL const PDstandardNth12gxy = PDstandardNth12(&gxy[index]); + CCTK_REAL const PDstandardNth13gxy = PDstandardNth13(&gxy[index]); + CCTK_REAL const PDstandardNth23gxy = PDstandardNth23(&gxy[index]); + CCTK_REAL const PDstandardNth1gxz = PDstandardNth1(&gxz[index]); + CCTK_REAL const PDstandardNth2gxz = PDstandardNth2(&gxz[index]); + CCTK_REAL const PDstandardNth3gxz = PDstandardNth3(&gxz[index]); + CCTK_REAL const PDstandardNth22gxz = PDstandardNth22(&gxz[index]); + CCTK_REAL const PDstandardNth12gxz = PDstandardNth12(&gxz[index]); + CCTK_REAL const PDstandardNth13gxz = PDstandardNth13(&gxz[index]); + CCTK_REAL const PDstandardNth23gxz = PDstandardNth23(&gxz[index]); + CCTK_REAL const PDstandardNth1gyy = PDstandardNth1(&gyy[index]); + CCTK_REAL const PDstandardNth2gyy = PDstandardNth2(&gyy[index]); + CCTK_REAL const PDstandardNth3gyy = PDstandardNth3(&gyy[index]); + CCTK_REAL const PDstandardNth11gyy = PDstandardNth11(&gyy[index]); + CCTK_REAL const PDstandardNth33gyy = PDstandardNth33(&gyy[index]); + CCTK_REAL const PDstandardNth13gyy = PDstandardNth13(&gyy[index]); + CCTK_REAL const PDstandardNth1gyz = PDstandardNth1(&gyz[index]); + CCTK_REAL const PDstandardNth2gyz = PDstandardNth2(&gyz[index]); + CCTK_REAL const PDstandardNth3gyz = PDstandardNth3(&gyz[index]); + CCTK_REAL const PDstandardNth11gyz = PDstandardNth11(&gyz[index]); + CCTK_REAL const PDstandardNth12gyz = PDstandardNth12(&gyz[index]); + CCTK_REAL const PDstandardNth13gyz = PDstandardNth13(&gyz[index]); + CCTK_REAL const PDstandardNth23gyz = PDstandardNth23(&gyz[index]); + CCTK_REAL const PDstandardNth1gzz = PDstandardNth1(&gzz[index]); + CCTK_REAL const PDstandardNth2gzz = PDstandardNth2(&gzz[index]); + CCTK_REAL const PDstandardNth3gzz = PDstandardNth3(&gzz[index]); + CCTK_REAL const PDstandardNth11gzz = PDstandardNth11(&gzz[index]); + CCTK_REAL const PDstandardNth22gzz = PDstandardNth22(&gzz[index]); + CCTK_REAL const PDstandardNth12gzz = PDstandardNth12(&gzz[index]); + CCTK_REAL const PDstandardNth2kxx = PDstandardNth2(&kxx[index]); + CCTK_REAL const PDstandardNth3kxx = PDstandardNth3(&kxx[index]); + CCTK_REAL const PDstandardNth1kxy = PDstandardNth1(&kxy[index]); + CCTK_REAL const PDstandardNth2kxy = PDstandardNth2(&kxy[index]); + CCTK_REAL const PDstandardNth3kxy = PDstandardNth3(&kxy[index]); + CCTK_REAL const PDstandardNth1kxz = PDstandardNth1(&kxz[index]); + CCTK_REAL const PDstandardNth2kxz = PDstandardNth2(&kxz[index]); + CCTK_REAL const PDstandardNth3kxz = PDstandardNth3(&kxz[index]); + CCTK_REAL const PDstandardNth1kyy = PDstandardNth1(&kyy[index]); + CCTK_REAL const PDstandardNth3kyy = PDstandardNth3(&kyy[index]); + CCTK_REAL const PDstandardNth1kyz = PDstandardNth1(&kyz[index]); + CCTK_REAL const PDstandardNth2kyz = PDstandardNth2(&kyz[index]); + CCTK_REAL const PDstandardNth3kyz = PDstandardNth3(&kyz[index]); + CCTK_REAL const PDstandardNth1kzz = PDstandardNth1(&kzz[index]); + CCTK_REAL const PDstandardNth2kzz = PDstandardNth2(&kzz[index]); + + /* Calculate temporaries and grid functions */ + CCTK_REAL detg = 2*gxyL*gxzL*gyzL + gzzL*(gxxL*gyyL - SQR(gxyL)) - + gyyL*SQR(gxzL) - gxxL*SQR(gyzL); + + CCTK_REAL gu11 = INV(detg)*(gyyL*gzzL - SQR(gyzL)); + + CCTK_REAL gu21 = (gxzL*gyzL - gxyL*gzzL)*INV(detg); + + CCTK_REAL gu31 = (-(gxzL*gyyL) + gxyL*gyzL)*INV(detg); + + CCTK_REAL gu22 = INV(detg)*(gxxL*gzzL - SQR(gxzL)); + + CCTK_REAL gu32 = (gxyL*gxzL - gxxL*gyzL)*INV(detg); + + CCTK_REAL gu33 = INV(detg)*(gxxL*gyyL - SQR(gxyL)); + + CCTK_REAL G111 = 0.5*(gu11*PDstandardNth1gxx + + 2*(gu21*PDstandardNth1gxy + gu31*PDstandardNth1gxz) - + gu21*PDstandardNth2gxx - gu31*PDstandardNth3gxx); + + CCTK_REAL G211 = 0.5*(gu21*PDstandardNth1gxx + + 2*(gu22*PDstandardNth1gxy + gu32*PDstandardNth1gxz) - + gu22*PDstandardNth2gxx - gu32*PDstandardNth3gxx); + + CCTK_REAL G311 = 0.5*(gu31*PDstandardNth1gxx + + 2*(gu32*PDstandardNth1gxy + gu33*PDstandardNth1gxz) - + gu32*PDstandardNth2gxx - gu33*PDstandardNth3gxx); + + CCTK_REAL G112 = 0.5*(gu21*PDstandardNth1gyy + gu11*PDstandardNth2gxx + + gu31*(PDstandardNth1gyz + PDstandardNth2gxz - PDstandardNth3gxy)); + + CCTK_REAL G212 = 0.5*(gu22*PDstandardNth1gyy + gu21*PDstandardNth2gxx + + gu32*(PDstandardNth1gyz + PDstandardNth2gxz - PDstandardNth3gxy)); + + CCTK_REAL G312 = 0.5*(gu32*PDstandardNth1gyy + gu31*PDstandardNth2gxx + + gu33*(PDstandardNth1gyz + PDstandardNth2gxz - PDstandardNth3gxy)); + + CCTK_REAL G113 = 0.5*(gu31*PDstandardNth1gzz + gu11*PDstandardNth3gxx + + gu21*(PDstandardNth1gyz - PDstandardNth2gxz + PDstandardNth3gxy)); + + CCTK_REAL G213 = 0.5*(gu32*PDstandardNth1gzz + gu21*PDstandardNth3gxx + + gu22*(PDstandardNth1gyz - PDstandardNth2gxz + PDstandardNth3gxy)); + + CCTK_REAL G313 = 0.5*(gu33*PDstandardNth1gzz + gu31*PDstandardNth3gxx + + gu32*(PDstandardNth1gyz - PDstandardNth2gxz + PDstandardNth3gxy)); + + CCTK_REAL G122 = 0.5*(gu11*(-PDstandardNth1gyy + 2*PDstandardNth2gxy) + + gu21*PDstandardNth2gyy + gu31*(2*PDstandardNth2gyz - + PDstandardNth3gyy)); + + CCTK_REAL G222 = 0.5*(gu21*(-PDstandardNth1gyy + 2*PDstandardNth2gxy) + + gu22*PDstandardNth2gyy + gu32*(2*PDstandardNth2gyz - + PDstandardNth3gyy)); + + CCTK_REAL G322 = 0.5*(gu31*(-PDstandardNth1gyy + 2*PDstandardNth2gxy) + + gu32*PDstandardNth2gyy + gu33*(2*PDstandardNth2gyz - + PDstandardNth3gyy)); + + CCTK_REAL G123 = 0.5*(gu31*PDstandardNth2gzz + + gu11*(-PDstandardNth1gyz + PDstandardNth2gxz + PDstandardNth3gxy) + + gu21*PDstandardNth3gyy); + + CCTK_REAL G223 = 0.5*(gu32*PDstandardNth2gzz + + gu21*(-PDstandardNth1gyz + PDstandardNth2gxz + PDstandardNth3gxy) + + gu22*PDstandardNth3gyy); + + CCTK_REAL G323 = 0.5*(gu33*PDstandardNth2gzz + + gu31*(-PDstandardNth1gyz + PDstandardNth2gxz + PDstandardNth3gxy) + + gu32*PDstandardNth3gyy); + + CCTK_REAL G133 = 0.5*(gu11*(-PDstandardNth1gzz + 2*PDstandardNth3gxz) + + gu21*(-PDstandardNth2gzz + 2*PDstandardNth3gyz) + + gu31*PDstandardNth3gzz); + + CCTK_REAL G233 = 0.5*(gu21*(-PDstandardNth1gzz + 2*PDstandardNth3gxz) + + gu22*(-PDstandardNth2gzz + 2*PDstandardNth3gyz) + + gu32*PDstandardNth3gzz); + + CCTK_REAL G333 = 0.5*(gu31*(-PDstandardNth1gzz + 2*PDstandardNth3gxz) + + gu32*(-PDstandardNth2gzz + 2*PDstandardNth3gyz) + + gu33*PDstandardNth3gzz); + + CCTK_REAL R11 = 0.5*(-2*(G111*G122 + G111*G133 + G211*G222 + G211*G233 + + G311*G322 + G311*G333 + gu32*PDstandardNth11gyz) + + 2*gu32*PDstandardNth12gxz + 2*gu32*PDstandardNth13gxy + + gu22*(-PDstandardNth11gyy + 2*PDstandardNth12gxy - PDstandardNth22gxx) + - 2*gu32*PDstandardNth23gxx + gu33*(-PDstandardNth11gzz + + 2*PDstandardNth13gxz - PDstandardNth33gxx) + 2*SQR(G112) + 2*SQR(G113) + + 2*SQR(G212) + 2*SQR(G213) + 2*SQR(G312) + 2*SQR(G313)); + + CCTK_REAL R12 = 0.5*(2*(G113*G123 + G213*G223 + G313*G323) - + 2*(G112*G133 + G212*G233 + G312*G333 + gu21*PDstandardNth12gxy) + + gu31*(PDstandardNth11gyz - PDstandardNth12gxz - PDstandardNth13gxy) + + gu21*(PDstandardNth11gyy + PDstandardNth22gxx) + + gu32*PDstandardNth22gxz + gu31*PDstandardNth23gxx + + gu32*(-PDstandardNth12gyz + PDstandardNth13gyy - PDstandardNth23gxy) + + gu33*PDstandardNth23gxz + gu33*(-PDstandardNth12gzz + + PDstandardNth13gyz - PDstandardNth33gxy)); + + CCTK_REAL R13 = 0.5*(2*(G112*G123 + G212*G223 + G312*G323) - + 2*(G113*G122 + G213*G222 + G313*G322 + gu31*PDstandardNth13gxz) + + gu21*(PDstandardNth11gyz - PDstandardNth12gxz - PDstandardNth13gxy + + PDstandardNth23gxx) + gu22*(PDstandardNth12gyz - PDstandardNth13gyy - + PDstandardNth22gxz + PDstandardNth23gxy) + gu31*(PDstandardNth11gzz + + PDstandardNth33gxx) + gu32*(PDstandardNth12gzz - PDstandardNth13gyz - + PDstandardNth23gxz + PDstandardNth33gxy)); + + CCTK_REAL R22 = 0.5*(-2*(G122*(G111 + G133) + G222*(G211 + G233) + + G322*(G311 + G333) + gu31*PDstandardNth13gyy) + + gu11*(-PDstandardNth11gyy + 2*PDstandardNth12gxy - PDstandardNth22gxx) + + gu31*(-2*PDstandardNth22gxz + 2*(PDstandardNth12gyz + + PDstandardNth23gxy)) + gu33*(-PDstandardNth22gzz + 2*PDstandardNth23gyz + - PDstandardNth33gyy) + 2*(SQR(G112) + SQR(G123) + SQR(G212) + + SQR(G223) + SQR(G312) + SQR(G323))); + + CCTK_REAL R23 = 0.5*(2*(G112*G113 + G212*G213 + G312*G313) + + gu11*(-PDstandardNth11gyz + PDstandardNth12gxz + PDstandardNth13gxy - + PDstandardNth23gxx) + gu21*(-PDstandardNth12gyz + PDstandardNth13gyy + + PDstandardNth22gxz - PDstandardNth23gxy) - 2*(G111*G123 + G211*G223 + + G311*G323 + gu32*PDstandardNth23gyz) + gu31*(PDstandardNth12gzz - + PDstandardNth13gyz - PDstandardNth23gxz + PDstandardNth33gxy) + + gu32*(PDstandardNth22gzz + PDstandardNth33gyy)); + + CCTK_REAL R33 = 0.5*(gu11*(-PDstandardNth11gzz + 2*PDstandardNth13gxz + - PDstandardNth33gxx) - 2*((G111 + G122)*G133 + (G211 + G222)*G233 + + (G311 + G322)*G333 + gu21*(PDstandardNth12gzz + PDstandardNth33gxy)) + + gu22*(-PDstandardNth22gzz + 2*PDstandardNth23gyz - PDstandardNth33gyy) + + 2*(gu21*(PDstandardNth13gyz + PDstandardNth23gxz) + SQR(G113) + + SQR(G123) + SQR(G213) + SQR(G223) + SQR(G313) + SQR(G323))); + + CCTK_REAL trR = gu11*R11 + gu22*R22 + 2*(gu21*R12 + gu31*R13 + + gu32*R23) + gu33*R33; + + CCTK_REAL Km11 = gu11*kxxL + gu21*kxyL + gu31*kxzL; + + CCTK_REAL Km21 = gu21*kxxL + gu22*kxyL + gu32*kxzL; + + CCTK_REAL Km31 = gu31*kxxL + gu32*kxyL + gu33*kxzL; + + CCTK_REAL Km12 = gu11*kxyL + gu21*kyyL + gu31*kyzL; + + CCTK_REAL Km22 = gu21*kxyL + gu22*kyyL + gu32*kyzL; + + CCTK_REAL Km32 = gu31*kxyL + gu32*kyyL + gu33*kyzL; + + CCTK_REAL Km13 = gu11*kxzL + gu21*kyzL + gu31*kzzL; + + CCTK_REAL Km23 = gu21*kxzL + gu22*kyzL + gu32*kzzL; + + CCTK_REAL Km33 = gu31*kxzL + gu32*kyzL + gu33*kzzL; + + CCTK_REAL trK = Km11 + Km22 + Km33; + + CCTK_REAL rho = INV(SQR(alpL))*(eTttL - 2*(betayL*eTtyL + + betazL*eTtzL) + 2*(betaxL*(-eTtxL + betayL*eTxyL + betazL*eTxzL) + + betayL*betazL*eTyzL) + eTxxL*SQR(betaxL) + eTyyL*SQR(betayL) + + eTzzL*SQR(betazL)); + + CCTK_REAL S1 = (-eTtxL + betaxL*eTxxL + betayL*eTxyL + + betazL*eTxzL)*INV(alpL); + + CCTK_REAL S2 = (-eTtyL + betaxL*eTxyL + betayL*eTyyL + + betazL*eTyzL)*INV(alpL); + + CCTK_REAL S3 = (-eTtzL + betaxL*eTxzL + betayL*eTyzL + + betazL*eTzzL)*INV(alpL); + + CCTK_REAL HL = -2*(Km12*Km21 + Km13*Km31 + Km23*Km32) - + 50.26548245743669181540229413247204614715*rho + trR - SQR(Km11) - + SQR(Km22) - SQR(Km33) + SQR(trK); + + CCTK_REAL M1L = gu21*(-(G112*kxxL) + (G111 - G212)*kxyL - G312*kxzL + + G211*kyyL + G311*kyzL - PDstandardNth1kxy + PDstandardNth2kxx) + + gu22*(-(G122*kxxL) + (G112 - G222)*kxyL - G322*kxzL + G212*kyyL + + G312*kyzL - PDstandardNth1kyy + PDstandardNth2kxy) + gu31*(-(G113*kxxL) + - G213*kxyL + (G111 - G313)*kxzL + G211*kyzL + G311*kzzL - + PDstandardNth1kxz + PDstandardNth3kxx) + gu32*(G113*kxyL + G112*kxzL + + G213*kyyL + (G212 + G313)*kyzL + G312*kzzL - 2*(G123*kxxL + G223*kxyL + + G323*kxzL + PDstandardNth1kyz) + PDstandardNth2kxz + PDstandardNth3kxy) + + gu33*(-(G133*kxxL) - G233*kxyL + (G113 - G333)*kxzL + G213*kyzL + + G313*kzzL - PDstandardNth1kzz + PDstandardNth3kxz) - + 25.13274122871834590770114706623602307358*S1; + + CCTK_REAL M2L = gu11*(G112*kxxL + (-G111 + G212)*kxyL + G312*kxzL - + G211*kyyL - G311*kyzL + PDstandardNth1kxy - PDstandardNth2kxx) + + gu21*(G122*kxxL + (-G112 + G222)*kxyL + G322*kxzL - G212*kyyL - + G312*kyzL + PDstandardNth1kyy - PDstandardNth2kxy) + gu31*(G123*kxxL + + (-2*G113 + G223)*kxyL + (G112 + G323)*kxzL + G212*kyzL + G312*kzzL + + PDstandardNth1kyz - 2*(G213*kyyL + G313*kyzL + PDstandardNth2kxz) + + PDstandardNth3kxy) + gu32*(-(G123*kxyL) + G122*kxzL - G223*kyyL + (G222 + - G323)*kyzL + G322*kzzL - PDstandardNth2kyz + PDstandardNth3kyy) + + gu33*(-(G133*kxyL) + G123*kxzL - G233*kyyL + (G223 - G333)*kyzL + + G323*kzzL - PDstandardNth2kzz + PDstandardNth3kyz) - + 25.13274122871834590770114706623602307358*S2; + + CCTK_REAL M3L = gu11*(G113*kxxL + G213*kxyL + (-G111 + G313)*kxzL - + G211*kyzL - G311*kzzL + PDstandardNth1kxz - PDstandardNth3kxx) + + gu21*(G123*kxxL + (G113 + G223)*kxyL + (-2*G112 + G323)*kxzL + + G213*kyyL + (-2*G212 + G313)*kyzL + PDstandardNth1kyz + + PDstandardNth2kxz - 2*(G312*kzzL + PDstandardNth3kxy)) + + gu31*(G133*kxxL + G233*kxyL + (-G113 + G333)*kxzL - G213*kyzL - + G313*kzzL + PDstandardNth1kzz - PDstandardNth3kxz) + gu22*(G123*kxyL - + G122*kxzL + G223*kyyL + (-G222 + G323)*kyzL - G322*kzzL + + PDstandardNth2kyz - PDstandardNth3kyy) + gu32*(G133*kxyL - G123*kxzL + + G233*kyyL + (-G223 + G333)*kyzL - G323*kzzL + PDstandardNth2kzz - + PDstandardNth3kyz) - 25.13274122871834590770114706623602307358*S3; + + + /* Copy local copies back to grid functions */ + H[index] = HL; + M1[index] = M1L; + M2[index] = M2L; + M3[index] = M3L; + } + LC_ENDLOOP3 (ML_ADMConstraints_O2); +} + +extern "C" void ML_ADMConstraints_O2(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverInterior(cctkGH, &ML_ADMConstraints_O2_Body); +} diff --git a/ML_ADMConstraints_O2/src/RegisterMoL.cc b/ML_ADMConstraints_O2/src/RegisterMoL.cc new file mode 100644 index 0000000..076ead3 --- /dev/null +++ b/ML_ADMConstraints_O2/src/RegisterMoL.cc @@ -0,0 +1,16 @@ +/* File produced by Kranc */ + +#include "cctk.h" +#include "cctk_Arguments.h" +#include "cctk_Parameters.h" + +extern "C" void ML_ADMConstraints_O2_RegisterVars(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT ierr = 0; + + /* Register all the evolved grid functions with MoL */ + return; +} diff --git a/ML_ADMConstraints_O2/src/RegisterSymmetries.cc b/ML_ADMConstraints_O2/src/RegisterSymmetries.cc new file mode 100644 index 0000000..a7e067d --- /dev/null +++ b/ML_ADMConstraints_O2/src/RegisterSymmetries.cc @@ -0,0 +1,39 @@ +/* File produced by Kranc */ + +#include "cctk.h" +#include "cctk_Arguments.h" +#include "cctk_Parameters.h" +#include "Symmetry.h" + +extern "C" void ML_ADMConstraints_O2_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_ADMConstraints_O2::H"); + + sym[0] = -1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_ADMConstraints_O2::M1"); + + sym[0] = 1; + sym[1] = -1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_ADMConstraints_O2::M2"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = -1; + SetCartSymVN(cctkGH, sym, "ML_ADMConstraints_O2::M3"); + +} diff --git a/ML_ADMConstraints_O2/src/Startup.cc b/ML_ADMConstraints_O2/src/Startup.cc new file mode 100644 index 0000000..5e66b49 --- /dev/null +++ b/ML_ADMConstraints_O2/src/Startup.cc @@ -0,0 +1,10 @@ +/* File produced by Kranc */ + +#include "cctk.h" + +extern "C" int ML_ADMConstraints_O2_Startup(void) +{ + const char * banner = "ML_ADMConstraints_O2"; + CCTK_RegisterBanner(banner); + return 0; +} diff --git a/ML_ADMQuantities/src/Boundaries.cc b/ML_ADMQuantities/src/Boundaries.cc new file mode 100644 index 0000000..81fb6dd --- /dev/null +++ b/ML_ADMQuantities/src/Boundaries.cc @@ -0,0 +1,41 @@ +/* File produced by Kranc */ + +#include "cctk.h" +#include "cctk_Arguments.h" +#include "cctk_Parameters.h" +#include "cctk_Faces.h" +#include "util_Table.h" +#include "Symmetry.h" + + +/* the boundary treatment is split into 3 steps: */ +/* 1. excision */ +/* 2. symmetries */ +/* 3. "other" boundary conditions, e.g. radiative */ + +/* to simplify scheduling and testing, the 3 steps */ +/* are currently applied in separate functions */ + + +extern "C" void ML_ADMQuantities_CheckBoundaries(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + return; +} + +extern "C" void ML_ADMQuantities_SelectBoundConds(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT ierr = 0; + return; +} + + + +/* template for entries in parameter file: +*/ + diff --git a/ML_ADMQuantities/src/ML_ADMQuantities.cc b/ML_ADMQuantities/src/ML_ADMQuantities.cc new file mode 100644 index 0000000..bf57482 --- /dev/null +++ b/ML_ADMQuantities/src/ML_ADMQuantities.cc @@ -0,0 +1,645 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +extern "C" void ML_ADMQuantities_SelectBCs(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT ierr = 0; + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_ADMQuantities::ML_Jadm","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_ADMQuantities::ML_Jadm."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_ADMQuantities::ML_Madm","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_ADMQuantities::ML_Madm."); + return; +} + +static void ML_ADMQuantities_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_ADMQuantities_Body"); + } + + if (cctk_iteration % ML_ADMQuantities_calc_every != ML_ADMQuantities_calc_offset) + { + return; + } + + const char *groups[] = {"grid::coordinates","Grid::coordinates","McLachlan::ML_curv","McLachlan::ML_Gamma","McLachlan::ML_lapse","McLachlan::ML_log_confac","McLachlan::ML_metric","McLachlan::ML_shift","McLachlan::ML_trace_curv","ML_ADMQuantities::ML_Jadm","ML_ADMQuantities::ML_Madm"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_ADMQuantities", 11, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o12dx = 0.0833333333333333333333333333333*INV(dx); + CCTK_REAL const p1o12dy = 0.0833333333333333333333333333333*INV(dy); + CCTK_REAL const p1o12dz = 0.0833333333333333333333333333333*INV(dz); + CCTK_REAL const p1o144dxdy = 0.00694444444444444444444444444444*INV(dx)*INV(dy); + CCTK_REAL const p1o144dxdz = 0.00694444444444444444444444444444*INV(dx)*INV(dz); + CCTK_REAL const p1o144dydz = 0.00694444444444444444444444444444*INV(dy)*INV(dz); + CCTK_REAL const p1odx = INV(dx); + CCTK_REAL const p1ody = INV(dy); + CCTK_REAL const p1odz = INV(dz); + CCTK_REAL const pm1o12dx2 = -0.0833333333333333333333333333333*INV(SQR(dx)); + CCTK_REAL const pm1o12dy2 = -0.0833333333333333333333333333333*INV(SQR(dy)); + CCTK_REAL const pm1o12dz2 = -0.0833333333333333333333333333333*INV(SQR(dz)); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_ADMQuantities, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + CCTK_REAL alphaL = alpha[index]; + CCTK_REAL At11L = At11[index]; + CCTK_REAL At12L = At12[index]; + CCTK_REAL At13L = At13[index]; + CCTK_REAL At22L = At22[index]; + CCTK_REAL At23L = At23[index]; + CCTK_REAL At33L = At33[index]; + CCTK_REAL beta1L = beta1[index]; + CCTK_REAL beta2L = beta2[index]; + CCTK_REAL beta3L = beta3[index]; + CCTK_REAL eTttL = (*stress_energy_state) ? eTtt[index] : ToReal(0.0); + CCTK_REAL eTtxL = (*stress_energy_state) ? eTtx[index] : ToReal(0.0); + CCTK_REAL eTtyL = (*stress_energy_state) ? eTty[index] : ToReal(0.0); + CCTK_REAL eTtzL = (*stress_energy_state) ? eTtz[index] : ToReal(0.0); + CCTK_REAL eTxxL = (*stress_energy_state) ? eTxx[index] : ToReal(0.0); + CCTK_REAL eTxyL = (*stress_energy_state) ? eTxy[index] : ToReal(0.0); + CCTK_REAL eTxzL = (*stress_energy_state) ? eTxz[index] : ToReal(0.0); + CCTK_REAL eTyyL = (*stress_energy_state) ? eTyy[index] : ToReal(0.0); + CCTK_REAL eTyzL = (*stress_energy_state) ? eTyz[index] : ToReal(0.0); + CCTK_REAL eTzzL = (*stress_energy_state) ? eTzz[index] : ToReal(0.0); + CCTK_REAL gt11L = gt11[index]; + CCTK_REAL gt12L = gt12[index]; + CCTK_REAL gt13L = gt13[index]; + CCTK_REAL gt22L = gt22[index]; + CCTK_REAL gt23L = gt23[index]; + CCTK_REAL gt33L = gt33[index]; + CCTK_REAL phiL = phi[index]; + CCTK_REAL trKL = trK[index]; + CCTK_REAL xL = x[index]; + CCTK_REAL Xt1L = Xt1[index]; + CCTK_REAL Xt2L = Xt2[index]; + CCTK_REAL Xt3L = Xt3[index]; + CCTK_REAL yL = y[index]; + CCTK_REAL zL = z[index]; + + /* Include user supplied include files */ + + /* Precompute derivatives */ + CCTK_REAL const PDstandardNth1gt11 = PDstandardNth1(>11[index]); + CCTK_REAL const PDstandardNth2gt11 = PDstandardNth2(>11[index]); + CCTK_REAL const PDstandardNth3gt11 = PDstandardNth3(>11[index]); + CCTK_REAL const PDstandardNth11gt11 = PDstandardNth11(>11[index]); + CCTK_REAL const PDstandardNth22gt11 = PDstandardNth22(>11[index]); + CCTK_REAL const PDstandardNth33gt11 = PDstandardNth33(>11[index]); + CCTK_REAL const PDstandardNth12gt11 = PDstandardNth12(>11[index]); + CCTK_REAL const PDstandardNth13gt11 = PDstandardNth13(>11[index]); + CCTK_REAL const PDstandardNth23gt11 = PDstandardNth23(>11[index]); + CCTK_REAL const PDstandardNth1gt12 = PDstandardNth1(>12[index]); + CCTK_REAL const PDstandardNth2gt12 = PDstandardNth2(>12[index]); + CCTK_REAL const PDstandardNth3gt12 = PDstandardNth3(>12[index]); + CCTK_REAL const PDstandardNth11gt12 = PDstandardNth11(>12[index]); + CCTK_REAL const PDstandardNth22gt12 = PDstandardNth22(>12[index]); + CCTK_REAL const PDstandardNth33gt12 = PDstandardNth33(>12[index]); + CCTK_REAL const PDstandardNth12gt12 = PDstandardNth12(>12[index]); + CCTK_REAL const PDstandardNth13gt12 = PDstandardNth13(>12[index]); + CCTK_REAL const PDstandardNth23gt12 = PDstandardNth23(>12[index]); + CCTK_REAL const PDstandardNth1gt13 = PDstandardNth1(>13[index]); + CCTK_REAL const PDstandardNth2gt13 = PDstandardNth2(>13[index]); + CCTK_REAL const PDstandardNth3gt13 = PDstandardNth3(>13[index]); + CCTK_REAL const PDstandardNth11gt13 = PDstandardNth11(>13[index]); + CCTK_REAL const PDstandardNth22gt13 = PDstandardNth22(>13[index]); + CCTK_REAL const PDstandardNth33gt13 = PDstandardNth33(>13[index]); + CCTK_REAL const PDstandardNth12gt13 = PDstandardNth12(>13[index]); + CCTK_REAL const PDstandardNth13gt13 = PDstandardNth13(>13[index]); + CCTK_REAL const PDstandardNth23gt13 = PDstandardNth23(>13[index]); + CCTK_REAL const PDstandardNth1gt22 = PDstandardNth1(>22[index]); + CCTK_REAL const PDstandardNth2gt22 = PDstandardNth2(>22[index]); + CCTK_REAL const PDstandardNth3gt22 = PDstandardNth3(>22[index]); + CCTK_REAL const PDstandardNth11gt22 = PDstandardNth11(>22[index]); + CCTK_REAL const PDstandardNth22gt22 = PDstandardNth22(>22[index]); + CCTK_REAL const PDstandardNth33gt22 = PDstandardNth33(>22[index]); + CCTK_REAL const PDstandardNth12gt22 = PDstandardNth12(>22[index]); + CCTK_REAL const PDstandardNth13gt22 = PDstandardNth13(>22[index]); + CCTK_REAL const PDstandardNth23gt22 = PDstandardNth23(>22[index]); + CCTK_REAL const PDstandardNth1gt23 = PDstandardNth1(>23[index]); + CCTK_REAL const PDstandardNth2gt23 = PDstandardNth2(>23[index]); + CCTK_REAL const PDstandardNth3gt23 = PDstandardNth3(>23[index]); + CCTK_REAL const PDstandardNth11gt23 = PDstandardNth11(>23[index]); + CCTK_REAL const PDstandardNth22gt23 = PDstandardNth22(>23[index]); + CCTK_REAL const PDstandardNth33gt23 = PDstandardNth33(>23[index]); + CCTK_REAL const PDstandardNth12gt23 = PDstandardNth12(>23[index]); + CCTK_REAL const PDstandardNth13gt23 = PDstandardNth13(>23[index]); + CCTK_REAL const PDstandardNth23gt23 = PDstandardNth23(>23[index]); + CCTK_REAL const PDstandardNth1gt33 = PDstandardNth1(>33[index]); + CCTK_REAL const PDstandardNth2gt33 = PDstandardNth2(>33[index]); + CCTK_REAL const PDstandardNth3gt33 = PDstandardNth3(>33[index]); + CCTK_REAL const PDstandardNth11gt33 = PDstandardNth11(>33[index]); + CCTK_REAL const PDstandardNth22gt33 = PDstandardNth22(>33[index]); + CCTK_REAL const PDstandardNth33gt33 = PDstandardNth33(>33[index]); + CCTK_REAL const PDstandardNth12gt33 = PDstandardNth12(>33[index]); + CCTK_REAL const PDstandardNth13gt33 = PDstandardNth13(>33[index]); + CCTK_REAL const PDstandardNth23gt33 = PDstandardNth23(>33[index]); + CCTK_REAL const PDstandardNth1trK = PDstandardNth1(&trK[index]); + CCTK_REAL const PDstandardNth2trK = PDstandardNth2(&trK[index]); + CCTK_REAL const PDstandardNth3trK = PDstandardNth3(&trK[index]); + CCTK_REAL const PDstandardNth1Xt1 = PDstandardNth1(&Xt1[index]); + CCTK_REAL const PDstandardNth2Xt1 = PDstandardNth2(&Xt1[index]); + CCTK_REAL const PDstandardNth3Xt1 = PDstandardNth3(&Xt1[index]); + CCTK_REAL const PDstandardNth1Xt2 = PDstandardNth1(&Xt2[index]); + CCTK_REAL const PDstandardNth2Xt2 = PDstandardNth2(&Xt2[index]); + CCTK_REAL const PDstandardNth3Xt2 = PDstandardNth3(&Xt2[index]); + CCTK_REAL const PDstandardNth1Xt3 = PDstandardNth1(&Xt3[index]); + CCTK_REAL const PDstandardNth2Xt3 = PDstandardNth2(&Xt3[index]); + CCTK_REAL const PDstandardNth3Xt3 = PDstandardNth3(&Xt3[index]); + + /* Calculate temporaries and grid functions */ + CCTK_REAL detgt = 1; + + CCTK_REAL gtu11 = INV(detgt)*(gt22L*gt33L - SQR(gt23L)); + + CCTK_REAL gtu21 = (gt13L*gt23L - gt12L*gt33L)*INV(detgt); + + CCTK_REAL gtu31 = (-(gt13L*gt22L) + gt12L*gt23L)*INV(detgt); + + CCTK_REAL gtu22 = INV(detgt)*(gt11L*gt33L - SQR(gt13L)); + + CCTK_REAL gtu32 = (gt12L*gt13L - gt11L*gt23L)*INV(detgt); + + CCTK_REAL gtu33 = INV(detgt)*(gt11L*gt22L - SQR(gt12L)); + + CCTK_REAL dgtu111 = -2*(gtu11*gtu21*PDstandardNth1gt12 + + gtu11*gtu31*PDstandardNth1gt13 + gtu21*gtu31*PDstandardNth1gt23) - + PDstandardNth1gt11*SQR(gtu11) - PDstandardNth1gt22*SQR(gtu21) - + PDstandardNth1gt33*SQR(gtu31); + + CCTK_REAL dgtu211 = gtu21*(-(gtu11*PDstandardNth1gt11) - + gtu31*PDstandardNth1gt13 - gtu22*PDstandardNth1gt22) + + gtu32*(-(gtu11*PDstandardNth1gt13) - gtu21*PDstandardNth1gt23) + + gtu31*(-(gtu22*PDstandardNth1gt23) - gtu32*PDstandardNth1gt33) - + PDstandardNth1gt12*(gtu11*gtu22 + SQR(gtu21)); + + CCTK_REAL dgtu311 = -((gtu21*gtu31 + gtu11*gtu32)*PDstandardNth1gt12) + + gtu11*(-(gtu31*PDstandardNth1gt11) - gtu33*PDstandardNth1gt13) + + gtu32*(-(gtu21*PDstandardNth1gt22) - gtu31*PDstandardNth1gt23) + + gtu33*(-(gtu21*PDstandardNth1gt23) - gtu31*PDstandardNth1gt33) - + PDstandardNth1gt13*SQR(gtu31); + + CCTK_REAL dgtu221 = -2*(gtu21*gtu22*PDstandardNth1gt12 + + gtu21*gtu32*PDstandardNth1gt13 + gtu22*gtu32*PDstandardNth1gt23) - + PDstandardNth1gt11*SQR(gtu21) - PDstandardNth1gt22*SQR(gtu22) - + PDstandardNth1gt33*SQR(gtu32); + + CCTK_REAL dgtu321 = -((gtu22*gtu31 + gtu21*gtu32)*PDstandardNth1gt12) + + gtu31*(-(gtu21*PDstandardNth1gt11) - gtu32*PDstandardNth1gt13) + + gtu33*(-(gtu21*PDstandardNth1gt13) - gtu22*PDstandardNth1gt23) + + gtu32*(-(gtu22*PDstandardNth1gt22) - gtu33*PDstandardNth1gt33) - + PDstandardNth1gt23*SQR(gtu32); + + CCTK_REAL dgtu331 = -2*(gtu31*gtu32*PDstandardNth1gt12 + + gtu31*gtu33*PDstandardNth1gt13 + gtu32*gtu33*PDstandardNth1gt23) - + PDstandardNth1gt11*SQR(gtu31) - PDstandardNth1gt22*SQR(gtu32) - + PDstandardNth1gt33*SQR(gtu33); + + CCTK_REAL dgtu112 = -2*(gtu11*gtu21*PDstandardNth2gt12 + + gtu11*gtu31*PDstandardNth2gt13 + gtu21*gtu31*PDstandardNth2gt23) - + PDstandardNth2gt11*SQR(gtu11) - PDstandardNth2gt22*SQR(gtu21) - + PDstandardNth2gt33*SQR(gtu31); + + CCTK_REAL dgtu212 = gtu21*(-(gtu11*PDstandardNth2gt11) - + gtu31*PDstandardNth2gt13 - gtu22*PDstandardNth2gt22) + + gtu32*(-(gtu11*PDstandardNth2gt13) - gtu21*PDstandardNth2gt23) + + gtu31*(-(gtu22*PDstandardNth2gt23) - gtu32*PDstandardNth2gt33) - + PDstandardNth2gt12*(gtu11*gtu22 + SQR(gtu21)); + + CCTK_REAL dgtu312 = -((gtu21*gtu31 + gtu11*gtu32)*PDstandardNth2gt12) + + gtu11*(-(gtu31*PDstandardNth2gt11) - gtu33*PDstandardNth2gt13) + + gtu32*(-(gtu21*PDstandardNth2gt22) - gtu31*PDstandardNth2gt23) + + gtu33*(-(gtu21*PDstandardNth2gt23) - gtu31*PDstandardNth2gt33) - + PDstandardNth2gt13*SQR(gtu31); + + CCTK_REAL dgtu222 = -2*(gtu21*gtu22*PDstandardNth2gt12 + + gtu21*gtu32*PDstandardNth2gt13 + gtu22*gtu32*PDstandardNth2gt23) - + PDstandardNth2gt11*SQR(gtu21) - PDstandardNth2gt22*SQR(gtu22) - + PDstandardNth2gt33*SQR(gtu32); + + CCTK_REAL dgtu322 = -((gtu22*gtu31 + gtu21*gtu32)*PDstandardNth2gt12) + + gtu31*(-(gtu21*PDstandardNth2gt11) - gtu32*PDstandardNth2gt13) + + gtu33*(-(gtu21*PDstandardNth2gt13) - gtu22*PDstandardNth2gt23) + + gtu32*(-(gtu22*PDstandardNth2gt22) - gtu33*PDstandardNth2gt33) - + PDstandardNth2gt23*SQR(gtu32); + + CCTK_REAL dgtu332 = -2*(gtu31*gtu32*PDstandardNth2gt12 + + gtu31*gtu33*PDstandardNth2gt13 + gtu32*gtu33*PDstandardNth2gt23) - + PDstandardNth2gt11*SQR(gtu31) - PDstandardNth2gt22*SQR(gtu32) - + PDstandardNth2gt33*SQR(gtu33); + + CCTK_REAL dgtu113 = -2*(gtu11*gtu21*PDstandardNth3gt12 + + gtu11*gtu31*PDstandardNth3gt13 + gtu21*gtu31*PDstandardNth3gt23) - + PDstandardNth3gt11*SQR(gtu11) - PDstandardNth3gt22*SQR(gtu21) - + PDstandardNth3gt33*SQR(gtu31); + + CCTK_REAL dgtu213 = gtu21*(-(gtu11*PDstandardNth3gt11) - + gtu31*PDstandardNth3gt13 - gtu22*PDstandardNth3gt22) + + gtu32*(-(gtu11*PDstandardNth3gt13) - gtu21*PDstandardNth3gt23) + + gtu31*(-(gtu22*PDstandardNth3gt23) - gtu32*PDstandardNth3gt33) - + PDstandardNth3gt12*(gtu11*gtu22 + SQR(gtu21)); + + CCTK_REAL dgtu313 = -((gtu21*gtu31 + gtu11*gtu32)*PDstandardNth3gt12) + + gtu11*(-(gtu31*PDstandardNth3gt11) - gtu33*PDstandardNth3gt13) + + gtu32*(-(gtu21*PDstandardNth3gt22) - gtu31*PDstandardNth3gt23) + + gtu33*(-(gtu21*PDstandardNth3gt23) - gtu31*PDstandardNth3gt33) - + PDstandardNth3gt13*SQR(gtu31); + + CCTK_REAL dgtu223 = -2*(gtu21*gtu22*PDstandardNth3gt12 + + gtu21*gtu32*PDstandardNth3gt13 + gtu22*gtu32*PDstandardNth3gt23) - + PDstandardNth3gt11*SQR(gtu21) - PDstandardNth3gt22*SQR(gtu22) - + PDstandardNth3gt33*SQR(gtu32); + + CCTK_REAL dgtu323 = -((gtu22*gtu31 + gtu21*gtu32)*PDstandardNth3gt12) + + gtu31*(-(gtu21*PDstandardNth3gt11) - gtu32*PDstandardNth3gt13) + + gtu33*(-(gtu21*PDstandardNth3gt13) - gtu22*PDstandardNth3gt23) + + gtu32*(-(gtu22*PDstandardNth3gt22) - gtu33*PDstandardNth3gt33) - + PDstandardNth3gt23*SQR(gtu32); + + CCTK_REAL dgtu333 = -2*(gtu31*gtu32*PDstandardNth3gt12 + + gtu31*gtu33*PDstandardNth3gt13 + gtu32*gtu33*PDstandardNth3gt23) - + PDstandardNth3gt11*SQR(gtu31) - PDstandardNth3gt22*SQR(gtu32) - + PDstandardNth3gt33*SQR(gtu33); + + CCTK_REAL Gtl111 = 0.5*PDstandardNth1gt11; + + CCTK_REAL Gtl112 = 0.5*PDstandardNth2gt11; + + CCTK_REAL Gtl113 = 0.5*PDstandardNth3gt11; + + CCTK_REAL Gtl122 = -0.5*PDstandardNth1gt22 + PDstandardNth2gt12; + + CCTK_REAL Gtl123 = 0.5*(-PDstandardNth1gt23 + PDstandardNth2gt13 + + PDstandardNth3gt12); + + CCTK_REAL Gtl133 = -0.5*PDstandardNth1gt33 + PDstandardNth3gt13; + + CCTK_REAL Gtl211 = PDstandardNth1gt12 - 0.5*PDstandardNth2gt11; + + CCTK_REAL Gtl212 = 0.5*PDstandardNth1gt22; + + CCTK_REAL Gtl213 = 0.5*(PDstandardNth1gt23 - PDstandardNth2gt13 + + PDstandardNth3gt12); + + CCTK_REAL Gtl222 = 0.5*PDstandardNth2gt22; + + CCTK_REAL Gtl223 = 0.5*PDstandardNth3gt22; + + CCTK_REAL Gtl233 = -0.5*PDstandardNth2gt33 + PDstandardNth3gt23; + + CCTK_REAL Gtl311 = PDstandardNth1gt13 - 0.5*PDstandardNth3gt11; + + CCTK_REAL Gtl312 = 0.5*(PDstandardNth1gt23 + PDstandardNth2gt13 - + PDstandardNth3gt12); + + CCTK_REAL Gtl313 = 0.5*PDstandardNth1gt33; + + CCTK_REAL Gtl322 = PDstandardNth2gt23 - 0.5*PDstandardNth3gt22; + + CCTK_REAL Gtl323 = 0.5*PDstandardNth2gt33; + + CCTK_REAL Gtl333 = 0.5*PDstandardNth3gt33; + + CCTK_REAL Gtlu111 = Gtl111*gtu11 + Gtl112*gtu21 + Gtl113*gtu31; + + CCTK_REAL Gtlu112 = Gtl111*gtu21 + Gtl112*gtu22 + Gtl113*gtu32; + + CCTK_REAL Gtlu113 = Gtl111*gtu31 + Gtl112*gtu32 + Gtl113*gtu33; + + CCTK_REAL Gtlu121 = Gtl112*gtu11 + Gtl122*gtu21 + Gtl123*gtu31; + + CCTK_REAL Gtlu122 = Gtl112*gtu21 + Gtl122*gtu22 + Gtl123*gtu32; + + CCTK_REAL Gtlu123 = Gtl112*gtu31 + Gtl122*gtu32 + Gtl123*gtu33; + + CCTK_REAL Gtlu131 = Gtl113*gtu11 + Gtl123*gtu21 + Gtl133*gtu31; + + CCTK_REAL Gtlu132 = Gtl113*gtu21 + Gtl123*gtu22 + Gtl133*gtu32; + + CCTK_REAL Gtlu133 = Gtl113*gtu31 + Gtl123*gtu32 + Gtl133*gtu33; + + CCTK_REAL Gtlu211 = Gtl211*gtu11 + Gtl212*gtu21 + Gtl213*gtu31; + + CCTK_REAL Gtlu212 = Gtl211*gtu21 + Gtl212*gtu22 + Gtl213*gtu32; + + CCTK_REAL Gtlu213 = Gtl211*gtu31 + Gtl212*gtu32 + Gtl213*gtu33; + + CCTK_REAL Gtlu221 = Gtl212*gtu11 + Gtl222*gtu21 + Gtl223*gtu31; + + CCTK_REAL Gtlu222 = Gtl212*gtu21 + Gtl222*gtu22 + Gtl223*gtu32; + + CCTK_REAL Gtlu223 = Gtl212*gtu31 + Gtl222*gtu32 + Gtl223*gtu33; + + CCTK_REAL Gtlu231 = Gtl213*gtu11 + Gtl223*gtu21 + Gtl233*gtu31; + + CCTK_REAL Gtlu232 = Gtl213*gtu21 + Gtl223*gtu22 + Gtl233*gtu32; + + CCTK_REAL Gtlu233 = Gtl213*gtu31 + Gtl223*gtu32 + Gtl233*gtu33; + + CCTK_REAL Gtlu311 = Gtl311*gtu11 + Gtl312*gtu21 + Gtl313*gtu31; + + CCTK_REAL Gtlu312 = Gtl311*gtu21 + Gtl312*gtu22 + Gtl313*gtu32; + + CCTK_REAL Gtlu313 = Gtl311*gtu31 + Gtl312*gtu32 + Gtl313*gtu33; + + CCTK_REAL Gtlu321 = Gtl312*gtu11 + Gtl322*gtu21 + Gtl323*gtu31; + + CCTK_REAL Gtlu322 = Gtl312*gtu21 + Gtl322*gtu22 + Gtl323*gtu32; + + CCTK_REAL Gtlu323 = Gtl312*gtu31 + Gtl322*gtu32 + Gtl323*gtu33; + + CCTK_REAL Gtlu331 = Gtl313*gtu11 + Gtl323*gtu21 + Gtl333*gtu31; + + CCTK_REAL Gtlu332 = Gtl313*gtu21 + Gtl323*gtu22 + Gtl333*gtu32; + + CCTK_REAL Gtlu333 = Gtl313*gtu31 + Gtl323*gtu32 + Gtl333*gtu33; + + CCTK_REAL Gt111 = Gtl111*gtu11 + Gtl211*gtu21 + Gtl311*gtu31; + + CCTK_REAL Gt211 = Gtl111*gtu21 + Gtl211*gtu22 + Gtl311*gtu32; + + CCTK_REAL Gt311 = Gtl111*gtu31 + Gtl211*gtu32 + Gtl311*gtu33; + + CCTK_REAL Gt112 = Gtl112*gtu11 + Gtl212*gtu21 + Gtl312*gtu31; + + CCTK_REAL Gt212 = Gtl112*gtu21 + Gtl212*gtu22 + Gtl312*gtu32; + + CCTK_REAL Gt312 = Gtl112*gtu31 + Gtl212*gtu32 + Gtl312*gtu33; + + CCTK_REAL Gt113 = Gtl113*gtu11 + Gtl213*gtu21 + Gtl313*gtu31; + + CCTK_REAL Gt213 = Gtl113*gtu21 + Gtl213*gtu22 + Gtl313*gtu32; + + CCTK_REAL Gt313 = Gtl113*gtu31 + Gtl213*gtu32 + Gtl313*gtu33; + + CCTK_REAL Gt122 = Gtl122*gtu11 + Gtl222*gtu21 + Gtl322*gtu31; + + CCTK_REAL Gt222 = Gtl122*gtu21 + Gtl222*gtu22 + Gtl322*gtu32; + + CCTK_REAL Gt322 = Gtl122*gtu31 + Gtl222*gtu32 + Gtl322*gtu33; + + CCTK_REAL Gt123 = Gtl123*gtu11 + Gtl223*gtu21 + Gtl323*gtu31; + + CCTK_REAL Gt223 = Gtl123*gtu21 + Gtl223*gtu22 + Gtl323*gtu32; + + CCTK_REAL Gt323 = Gtl123*gtu31 + Gtl223*gtu32 + Gtl323*gtu33; + + CCTK_REAL Gt133 = Gtl133*gtu11 + Gtl233*gtu21 + Gtl333*gtu31; + + CCTK_REAL Gt233 = Gtl133*gtu21 + Gtl233*gtu22 + Gtl333*gtu32; + + CCTK_REAL Gt333 = Gtl133*gtu31 + Gtl233*gtu32 + Gtl333*gtu33; + + CCTK_REAL Xtn1 = Gt111*gtu11 + Gt122*gtu22 + 2*(Gt112*gtu21 + + Gt113*gtu31 + Gt123*gtu32) + Gt133*gtu33; + + CCTK_REAL Xtn2 = Gt211*gtu11 + Gt222*gtu22 + 2*(Gt212*gtu21 + + Gt213*gtu31 + Gt223*gtu32) + Gt233*gtu33; + + CCTK_REAL Xtn3 = Gt311*gtu11 + Gt322*gtu22 + 2*(Gt312*gtu21 + + Gt313*gtu31 + Gt323*gtu32) + Gt333*gtu33; + + CCTK_REAL Rt11 = 3*(Gt111*Gtlu111 + Gt112*Gtlu112 + Gt113*Gtlu113) + + 2*(Gt211*Gtlu121 + Gt212*Gtlu122 + Gt213*Gtlu123 + Gt311*Gtlu131 + + Gt312*Gtlu132 + Gt313*Gtlu133) + Gt211*Gtlu211 + Gt212*Gtlu212 + + Gt213*Gtlu213 + Gt311*Gtlu311 + Gt312*Gtlu312 + Gt313*Gtlu313 + + gt11L*PDstandardNth1Xt1 + gt12L*PDstandardNth1Xt2 + + gt13L*PDstandardNth1Xt3 + 0.5*(-(gtu11*PDstandardNth11gt11) - + 2*gtu21*PDstandardNth12gt11 - 2*gtu31*PDstandardNth13gt11 - + gtu22*PDstandardNth22gt11 - 2*gtu32*PDstandardNth23gt11 - + gtu33*PDstandardNth33gt11) + Gtl111*Xtn1 + Gtl112*Xtn2 + Gtl113*Xtn3; + + CCTK_REAL Rt12 = 0.5*(4*(Gt211*Gtlu221 + Gt212*Gtlu222 + + Gt213*Gtlu223) + 2*(Gt112*Gtlu111 + Gt122*Gtlu112 + Gt123*Gtlu113 + + Gt111*Gtlu121 + Gt212*Gtlu121 + Gt112*Gtlu122 + Gt222*Gtlu122 + + Gt113*Gtlu123 + Gt223*Gtlu123 + Gt312*Gtlu131 + Gt322*Gtlu132 + + Gt323*Gtlu133 + Gt111*Gtlu211 + Gt112*Gtlu212 + Gt113*Gtlu213 + + Gt311*Gtlu231 + Gt312*Gtlu232 + Gt313*Gtlu233 + Gt311*Gtlu321 + + Gt312*Gtlu322 + Gt313*Gtlu323) - gtu11*PDstandardNth11gt12 - + 2*gtu21*PDstandardNth12gt12 - 2*gtu31*PDstandardNth13gt12 + + gt12L*PDstandardNth1Xt1 + gt22L*PDstandardNth1Xt2 + + gt23L*PDstandardNth1Xt3 - gtu22*PDstandardNth22gt12 - + 2*gtu32*PDstandardNth23gt12 + gt11L*PDstandardNth2Xt1 + + gt12L*PDstandardNth2Xt2 + gt13L*PDstandardNth2Xt3 - + gtu33*PDstandardNth33gt12 + Gtl112*Xtn1 + Gtl211*Xtn1 + Gtl122*Xtn2 + + Gtl212*Xtn2 + Gtl123*Xtn3 + Gtl213*Xtn3); + + CCTK_REAL Rt13 = 0.5*(2*(Gt113*Gtlu111 + Gt123*Gtlu112 + Gt133*Gtlu113 + + Gt213*Gtlu121 + Gt223*Gtlu122 + Gt233*Gtlu123 + Gt111*Gtlu131 + + Gt313*Gtlu131 + Gt112*Gtlu132 + Gt323*Gtlu132 + Gt113*Gtlu133 + + Gt333*Gtlu133 + Gt211*Gtlu231 + Gt212*Gtlu232 + Gt213*Gtlu233 + + Gt111*Gtlu311 + Gt112*Gtlu312 + Gt113*Gtlu313 + Gt211*Gtlu321 + + Gt212*Gtlu322 + Gt213*Gtlu323) + 4*(Gt311*Gtlu331 + Gt312*Gtlu332 + + Gt313*Gtlu333) - gtu11*PDstandardNth11gt13 - + 2*gtu21*PDstandardNth12gt13 - 2*gtu31*PDstandardNth13gt13 + + gt13L*PDstandardNth1Xt1 + gt23L*PDstandardNth1Xt2 + + gt33L*PDstandardNth1Xt3 - gtu22*PDstandardNth22gt13 - + 2*gtu32*PDstandardNth23gt13 - gtu33*PDstandardNth33gt13 + + gt11L*PDstandardNth3Xt1 + gt12L*PDstandardNth3Xt2 + + gt13L*PDstandardNth3Xt3 + Gtl113*Xtn1 + Gtl311*Xtn1 + Gtl123*Xtn2 + + Gtl312*Xtn2 + Gtl133*Xtn3 + Gtl313*Xtn3); + + CCTK_REAL Rt22 = Gt112*(Gtlu121 + 2*Gtlu211) + Gt122*(Gtlu122 + + 2*Gtlu212) + Gt123*(Gtlu123 + 2*Gtlu213) + 3*(Gt212*Gtlu221 + + Gt222*Gtlu222 + Gt223*Gtlu223) + 2*(Gt312*Gtlu231 + Gt322*Gtlu232 + + Gt323*Gtlu233) + Gt312*Gtlu321 + Gt322*Gtlu322 + Gt323*Gtlu323 + + gt12L*PDstandardNth2Xt1 + gt22L*PDstandardNth2Xt2 + + gt23L*PDstandardNth2Xt3 + 0.5*(-(gtu11*PDstandardNth11gt22) - + 2*gtu21*PDstandardNth12gt22 - 2*gtu31*PDstandardNth13gt22 - + gtu22*PDstandardNth22gt22 - 2*gtu32*PDstandardNth23gt22 - + gtu33*PDstandardNth33gt22) + Gtl212*Xtn1 + Gtl222*Xtn2 + Gtl223*Xtn3; + + CCTK_REAL Rt23 = 0.5*(2*(Gt112*Gtlu131 + Gt122*Gtlu132 + Gt123*Gtlu133 + + Gt113*Gtlu211 + Gt123*Gtlu212 + Gt133*Gtlu213 + Gt213*Gtlu221 + + Gt223*Gtlu222 + Gt233*Gtlu223 + Gt212*Gtlu231 + Gt313*Gtlu231 + + Gt222*Gtlu232 + Gt323*Gtlu232 + Gt223*Gtlu233 + Gt333*Gtlu233 + + Gt112*Gtlu311 + Gt122*Gtlu312 + Gt123*Gtlu313 + Gt212*Gtlu321 + + Gt222*Gtlu322 + Gt223*Gtlu323) + 4*(Gt312*Gtlu331 + Gt322*Gtlu332 + + Gt323*Gtlu333) - gtu11*PDstandardNth11gt23 - + 2*gtu21*PDstandardNth12gt23 - 2*gtu31*PDstandardNth13gt23 - + gtu22*PDstandardNth22gt23 - 2*gtu32*PDstandardNth23gt23 + + gt13L*PDstandardNth2Xt1 + gt23L*PDstandardNth2Xt2 + + gt33L*PDstandardNth2Xt3 - gtu33*PDstandardNth33gt23 + + gt12L*PDstandardNth3Xt1 + gt22L*PDstandardNth3Xt2 + + gt23L*PDstandardNth3Xt3 + Gtl213*Xtn1 + Gtl312*Xtn1 + Gtl223*Xtn2 + + Gtl322*Xtn2 + Gtl233*Xtn3 + Gtl323*Xtn3); + + CCTK_REAL Rt33 = Gt113*(Gtlu131 + 2*Gtlu311) + Gt123*(Gtlu132 + + 2*Gtlu312) + Gt133*(Gtlu133 + 2*Gtlu313) + Gt213*(Gtlu231 + 2*Gtlu321) + + Gt223*(Gtlu232 + 2*Gtlu322) + Gt233*(Gtlu233 + 2*Gtlu323) + + 3*(Gt313*Gtlu331 + Gt323*Gtlu332 + Gt333*Gtlu333) + + 0.5*(-(gtu11*PDstandardNth11gt33) - 2*gtu21*PDstandardNth12gt33 - + 2*gtu31*PDstandardNth13gt33 - gtu22*PDstandardNth22gt33 - + 2*gtu32*PDstandardNth23gt33 - gtu33*PDstandardNth33gt33) + + gt13L*PDstandardNth3Xt1 + gt23L*PDstandardNth3Xt2 + + gt33L*PDstandardNth3Xt3 + Gtl313*Xtn1 + Gtl323*Xtn2 + Gtl333*Xtn3; + + CCTK_REAL trRt = gtu11*Rt11 + gtu22*Rt22 + 2*(gtu21*Rt12 + gtu31*Rt13 + + gtu32*Rt23) + gtu33*Rt33; + + CCTK_REAL ephi = + IfThen(ToReal(conformalMethod),INV(sqrt(phiL)),exp(phiL)); + + CCTK_REAL Atm11 = At11L*gtu11 + At12L*gtu21 + At13L*gtu31; + + CCTK_REAL Atm21 = At11L*gtu21 + At12L*gtu22 + At13L*gtu32; + + CCTK_REAL Atm31 = At11L*gtu31 + At12L*gtu32 + At13L*gtu33; + + CCTK_REAL Atm12 = At12L*gtu11 + At22L*gtu21 + At23L*gtu31; + + CCTK_REAL Atm22 = At12L*gtu21 + At22L*gtu22 + At23L*gtu32; + + CCTK_REAL Atm32 = At12L*gtu31 + At22L*gtu32 + At23L*gtu33; + + CCTK_REAL Atm13 = At13L*gtu11 + At23L*gtu21 + At33L*gtu31; + + CCTK_REAL Atm23 = At13L*gtu21 + At23L*gtu22 + At33L*gtu32; + + CCTK_REAL Atm33 = At13L*gtu31 + At23L*gtu32 + At33L*gtu33; + + CCTK_REAL rho = INV(SQR(alphaL))*(eTttL - 2*(beta2L*eTtyL + + beta3L*eTtzL) + 2*(beta1L*(-eTtxL + beta2L*eTxyL + beta3L*eTxzL) + + beta2L*beta3L*eTyzL) + eTxxL*SQR(beta1L) + eTyyL*SQR(beta2L) + + eTzzL*SQR(beta3L)); + + CCTK_REAL S1 = (-eTtxL + beta1L*eTxxL + beta2L*eTxyL + + beta3L*eTxzL)*INV(alphaL); + + CCTK_REAL S2 = (-eTtyL + beta1L*eTxyL + beta2L*eTyyL + + beta3L*eTyzL)*INV(alphaL); + + CCTK_REAL S3 = (-eTtzL + beta1L*eTxzL + beta2L*eTyzL + + beta3L*eTzzL)*INV(alphaL); + + CCTK_REAL MadmL = + 0.01989436788648691697111047042156429525431*(-((Gt111*Gtlu111 + + Gt112*Gtlu112 + Gt113*Gtlu113 + Gt211*Gtlu121 + Gt212*Gtlu122 + + Gt213*Gtlu123 + Gt311*Gtlu131 + Gt312*Gtlu132 + Gt313*Gtlu133)*gtu11) + + (-(Gt122*Gtlu112) - Gt123*Gtlu113 - Gt222*Gtlu122 - Gt223*Gtlu123 - + Gt322*Gtlu132 - Gt323*Gtlu133 - Gt111*Gtlu211 + Gt112*(-Gtlu111 - + Gtlu212) - Gt113*Gtlu213 - Gt211*Gtlu221 + Gt212*(-Gtlu121 - Gtlu222) - + Gt213*Gtlu223 - Gt311*Gtlu231 + Gt312*(-Gtlu131 - Gtlu232) - + Gt313*Gtlu233)*gtu21 - (Gt112*Gtlu211 + Gt122*Gtlu212 + Gt123*Gtlu213 + + Gt212*Gtlu221 + Gt222*Gtlu222 + Gt223*Gtlu223 + Gt312*Gtlu231 + + Gt322*Gtlu232 + Gt323*Gtlu233)*gtu22 + (-(Gt123*Gtlu112) - + Gt133*Gtlu113 - Gt223*Gtlu122 - Gt233*Gtlu123 - Gt323*Gtlu132 - + Gt333*Gtlu133 - Gt111*Gtlu311 - Gt112*Gtlu312 + Gt113*(-Gtlu111 - + Gtlu313) - Gt211*Gtlu321 - Gt212*Gtlu322 + Gt213*(-Gtlu121 - Gtlu323) - + Gt311*Gtlu331 - Gt312*Gtlu332 + Gt313*(-Gtlu131 - Gtlu333))*gtu31 + + (-(Gt113*Gtlu211) - Gt133*Gtlu213 - Gt213*Gtlu221 - Gt233*Gtlu223 - + Gt313*Gtlu231 - Gt333*Gtlu233 - Gt112*Gtlu311 - Gt122*Gtlu312 + + Gt123*(-Gtlu212 - Gtlu313) - Gt212*Gtlu321 - Gt222*Gtlu322 + + Gt223*(-Gtlu222 - Gtlu323) - Gt312*Gtlu331 - Gt322*Gtlu332 + + Gt323*(-Gtlu232 - Gtlu333))*gtu32 - (Gt113*Gtlu311 + Gt123*Gtlu312 + + Gt133*Gtlu313 + Gt213*Gtlu321 + Gt223*Gtlu322 + Gt233*Gtlu323 + + Gt313*Gtlu331 + Gt323*Gtlu332 + Gt333*Gtlu333)*gtu33 + trRt - ephi*trRt + + pow(ephi,5)*(2*Atm12*Atm21 + 2.*Atm13*Atm31 + 2.*Atm23*Atm32 + + 50.26548245743669181540229413247204614715*rho + SQR(Atm11) + SQR(Atm22) + + SQR(Atm33) - 0.6666666666666666666666666666666666666667*SQR(trKL))); + + CCTK_REAL Jadm1L = + 0.01989436788648691697111047042156429525431*(2*Atm23 - 2*Atm32 + + (-(At11L*dgtu113) - 2*At12L*dgtu213 - At22L*dgtu223 - 2*At13L*dgtu313 - + 2*At23L*dgtu323 - At33L*dgtu333 + + 1.33333333333333333333333333333*PDstandardNth3trK + + 50.26548245743669181540229413247204614715*S3)*yL + (At11L*dgtu112 + + At22L*dgtu222 + 2*(At12L*dgtu212 + At13L*dgtu312 + At23L*dgtu322) + + At33L*dgtu332 - 1.33333333333333333333333333333*PDstandardNth2trK - + 50.26548245743669181540229413247204614715*S2)*zL)*pow(ephi,6); + + CCTK_REAL Jadm2L = + 0.01989436788648691697111047042156429525431*(-2*Atm13 + 2*Atm31 + + (At11L*dgtu113 + At22L*dgtu223 + 2*(At12L*dgtu213 + At13L*dgtu313 + + At23L*dgtu323) + At33L*dgtu333 - + 1.33333333333333333333333333333*PDstandardNth3trK - + 50.26548245743669181540229413247204614715*S3)*xL + (-(At11L*dgtu111) - + 2*At12L*dgtu211 - At22L*dgtu221 - 2*At13L*dgtu311 - 2*At23L*dgtu321 - + At33L*dgtu331 + 1.33333333333333333333333333333*PDstandardNth1trK + + 50.26548245743669181540229413247204614715*S1)*zL)*pow(ephi,6); + + CCTK_REAL Jadm3L = + 0.01989436788648691697111047042156429525431*(2*Atm12 - 2*Atm21 + + (-(At11L*dgtu112) - 2*At12L*dgtu212 - At22L*dgtu222 - 2*At13L*dgtu312 - + 2*At23L*dgtu322 - At33L*dgtu332 + + 1.33333333333333333333333333333*PDstandardNth2trK + + 50.26548245743669181540229413247204614715*S2)*xL + (At11L*dgtu111 + + At22L*dgtu221 + 2*(At12L*dgtu211 + At13L*dgtu311 + At23L*dgtu321) + + At33L*dgtu331 - 1.33333333333333333333333333333*PDstandardNth1trK - + 50.26548245743669181540229413247204614715*S1)*yL)*pow(ephi,6); + + + /* Copy local copies back to grid functions */ + Jadm1[index] = Jadm1L; + Jadm2[index] = Jadm2L; + Jadm3[index] = Jadm3L; + Madm[index] = MadmL; + } + LC_ENDLOOP3 (ML_ADMQuantities); +} + +extern "C" void ML_ADMQuantities(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverInterior(cctkGH, &ML_ADMQuantities_Body); +} diff --git a/ML_ADMQuantities/src/RegisterMoL.cc b/ML_ADMQuantities/src/RegisterMoL.cc new file mode 100644 index 0000000..9a145b1 --- /dev/null +++ b/ML_ADMQuantities/src/RegisterMoL.cc @@ -0,0 +1,16 @@ +/* File produced by Kranc */ + +#include "cctk.h" +#include "cctk_Arguments.h" +#include "cctk_Parameters.h" + +extern "C" void ML_ADMQuantities_RegisterVars(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT ierr = 0; + + /* Register all the evolved grid functions with MoL */ + return; +} diff --git a/ML_ADMQuantities/src/RegisterSymmetries.cc b/ML_ADMQuantities/src/RegisterSymmetries.cc new file mode 100644 index 0000000..c8d33d2 --- /dev/null +++ b/ML_ADMQuantities/src/RegisterSymmetries.cc @@ -0,0 +1,39 @@ +/* File produced by Kranc */ + +#include "cctk.h" +#include "cctk_Arguments.h" +#include "cctk_Parameters.h" +#include "Symmetry.h" + +extern "C" void ML_ADMQuantities_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_ADMQuantities::Jadm1"); + + sym[0] = 1; + sym[1] = -1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_ADMQuantities::Jadm2"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = -1; + SetCartSymVN(cctkGH, sym, "ML_ADMQuantities::Jadm3"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_ADMQuantities::Madm"); + +} diff --git a/ML_ADMQuantities/src/Startup.cc b/ML_ADMQuantities/src/Startup.cc new file mode 100644 index 0000000..461aeb7 --- /dev/null +++ b/ML_ADMQuantities/src/Startup.cc @@ -0,0 +1,10 @@ +/* File produced by Kranc */ + +#include "cctk.h" + +extern "C" int ML_ADMQuantities_Startup(void) +{ + const char * banner = "ML_ADMQuantities"; + CCTK_RegisterBanner(banner); + return 0; +} diff --git a/ML_ADMQuantities_MP/src/Boundaries.cc b/ML_ADMQuantities_MP/src/Boundaries.cc new file mode 100644 index 0000000..0e315fb --- /dev/null +++ b/ML_ADMQuantities_MP/src/Boundaries.cc @@ -0,0 +1,41 @@ +/* File produced by Kranc */ + +#include "cctk.h" +#include "cctk_Arguments.h" +#include "cctk_Parameters.h" +#include "cctk_Faces.h" +#include "util_Table.h" +#include "Symmetry.h" + + +/* the boundary treatment is split into 3 steps: */ +/* 1. excision */ +/* 2. symmetries */ +/* 3. "other" boundary conditions, e.g. radiative */ + +/* to simplify scheduling and testing, the 3 steps */ +/* are currently applied in separate functions */ + + +extern "C" void ML_ADMQuantities_MP_CheckBoundaries(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + return; +} + +extern "C" void ML_ADMQuantities_MP_SelectBoundConds(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT ierr = 0; + return; +} + + + +/* template for entries in parameter file: +*/ + diff --git a/ML_ADMQuantities_MP/src/ML_ADMQuantities_MP.cc b/ML_ADMQuantities_MP/src/ML_ADMQuantities_MP.cc new file mode 100644 index 0000000..5083e92 --- /dev/null +++ b/ML_ADMQuantities_MP/src/ML_ADMQuantities_MP.cc @@ -0,0 +1,1082 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +extern "C" void ML_ADMQuantities_MP_SelectBCs(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT ierr = 0; + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_ADMQuantities_MP::ML_Jadm","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_ADMQuantities_MP::ML_Jadm."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_ADMQuantities_MP::ML_Madm","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_ADMQuantities_MP::ML_Madm."); + return; +} + +static void ML_ADMQuantities_MP_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_ADMQuantities_MP_Body"); + } + + if (cctk_iteration % ML_ADMQuantities_MP_calc_every != ML_ADMQuantities_MP_calc_offset) + { + return; + } + + const char *groups[] = {"Coordinates::jacobian","Coordinates::jacobian2","grid::coordinates","Grid::coordinates","McLachlan::ML_curv","McLachlan::ML_Gamma","McLachlan::ML_lapse","McLachlan::ML_log_confac","McLachlan::ML_metric","McLachlan::ML_shift","McLachlan::ML_trace_curv","ML_ADMQuantities_MP::ML_Jadm","ML_ADMQuantities_MP::ML_Madm"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_ADMQuantities_MP", 13, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o12dx = 0.0833333333333333333333333333333*INV(dx); + CCTK_REAL const p1o12dy = 0.0833333333333333333333333333333*INV(dy); + CCTK_REAL const p1o12dz = 0.0833333333333333333333333333333*INV(dz); + CCTK_REAL const p1o144dxdy = 0.00694444444444444444444444444444*INV(dx)*INV(dy); + CCTK_REAL const p1o144dxdz = 0.00694444444444444444444444444444*INV(dx)*INV(dz); + CCTK_REAL const p1o144dydz = 0.00694444444444444444444444444444*INV(dy)*INV(dz); + CCTK_REAL const p1odx = INV(dx); + CCTK_REAL const p1ody = INV(dy); + CCTK_REAL const p1odz = INV(dz); + CCTK_REAL const pm1o12dx2 = -0.0833333333333333333333333333333*INV(SQR(dx)); + CCTK_REAL const pm1o12dy2 = -0.0833333333333333333333333333333*INV(SQR(dy)); + CCTK_REAL const pm1o12dz2 = -0.0833333333333333333333333333333*INV(SQR(dz)); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_ADMQuantities_MP, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + CCTK_REAL alphaL = alpha[index]; + CCTK_REAL At11L = At11[index]; + CCTK_REAL At12L = At12[index]; + CCTK_REAL At13L = At13[index]; + CCTK_REAL At22L = At22[index]; + CCTK_REAL At23L = At23[index]; + CCTK_REAL At33L = At33[index]; + CCTK_REAL beta1L = beta1[index]; + CCTK_REAL beta2L = beta2[index]; + CCTK_REAL beta3L = beta3[index]; + CCTK_REAL dJ111L = dJ111[index]; + CCTK_REAL dJ112L = dJ112[index]; + CCTK_REAL dJ113L = dJ113[index]; + CCTK_REAL dJ122L = dJ122[index]; + CCTK_REAL dJ123L = dJ123[index]; + CCTK_REAL dJ133L = dJ133[index]; + CCTK_REAL dJ211L = dJ211[index]; + CCTK_REAL dJ212L = dJ212[index]; + CCTK_REAL dJ213L = dJ213[index]; + CCTK_REAL dJ222L = dJ222[index]; + CCTK_REAL dJ223L = dJ223[index]; + CCTK_REAL dJ233L = dJ233[index]; + CCTK_REAL dJ311L = dJ311[index]; + CCTK_REAL dJ312L = dJ312[index]; + CCTK_REAL dJ313L = dJ313[index]; + CCTK_REAL dJ322L = dJ322[index]; + CCTK_REAL dJ323L = dJ323[index]; + CCTK_REAL dJ333L = dJ333[index]; + CCTK_REAL eTttL = (*stress_energy_state) ? eTtt[index] : ToReal(0.0); + CCTK_REAL eTtxL = (*stress_energy_state) ? eTtx[index] : ToReal(0.0); + CCTK_REAL eTtyL = (*stress_energy_state) ? eTty[index] : ToReal(0.0); + CCTK_REAL eTtzL = (*stress_energy_state) ? eTtz[index] : ToReal(0.0); + CCTK_REAL eTxxL = (*stress_energy_state) ? eTxx[index] : ToReal(0.0); + CCTK_REAL eTxyL = (*stress_energy_state) ? eTxy[index] : ToReal(0.0); + CCTK_REAL eTxzL = (*stress_energy_state) ? eTxz[index] : ToReal(0.0); + CCTK_REAL eTyyL = (*stress_energy_state) ? eTyy[index] : ToReal(0.0); + CCTK_REAL eTyzL = (*stress_energy_state) ? eTyz[index] : ToReal(0.0); + CCTK_REAL eTzzL = (*stress_energy_state) ? eTzz[index] : ToReal(0.0); + CCTK_REAL gt11L = gt11[index]; + CCTK_REAL gt12L = gt12[index]; + CCTK_REAL gt13L = gt13[index]; + CCTK_REAL gt22L = gt22[index]; + CCTK_REAL gt23L = gt23[index]; + CCTK_REAL gt33L = gt33[index]; + CCTK_REAL J11L = J11[index]; + CCTK_REAL J12L = J12[index]; + CCTK_REAL J13L = J13[index]; + CCTK_REAL J21L = J21[index]; + CCTK_REAL J22L = J22[index]; + CCTK_REAL J23L = J23[index]; + CCTK_REAL J31L = J31[index]; + CCTK_REAL J32L = J32[index]; + CCTK_REAL J33L = J33[index]; + CCTK_REAL phiL = phi[index]; + CCTK_REAL trKL = trK[index]; + CCTK_REAL xL = x[index]; + CCTK_REAL Xt1L = Xt1[index]; + CCTK_REAL Xt2L = Xt2[index]; + CCTK_REAL Xt3L = Xt3[index]; + CCTK_REAL yL = y[index]; + CCTK_REAL zL = z[index]; + + /* Include user supplied include files */ + + /* Precompute derivatives */ + CCTK_REAL const PDstandardNth1gt11 = PDstandardNth1(>11[index]); + CCTK_REAL const PDstandardNth2gt11 = PDstandardNth2(>11[index]); + CCTK_REAL const PDstandardNth3gt11 = PDstandardNth3(>11[index]); + CCTK_REAL const PDstandardNth11gt11 = PDstandardNth11(>11[index]); + CCTK_REAL const PDstandardNth22gt11 = PDstandardNth22(>11[index]); + CCTK_REAL const PDstandardNth33gt11 = PDstandardNth33(>11[index]); + CCTK_REAL const PDstandardNth12gt11 = PDstandardNth12(>11[index]); + CCTK_REAL const PDstandardNth13gt11 = PDstandardNth13(>11[index]); + CCTK_REAL const PDstandardNth23gt11 = PDstandardNth23(>11[index]); + CCTK_REAL const PDstandardNth1gt12 = PDstandardNth1(>12[index]); + CCTK_REAL const PDstandardNth2gt12 = PDstandardNth2(>12[index]); + CCTK_REAL const PDstandardNth3gt12 = PDstandardNth3(>12[index]); + CCTK_REAL const PDstandardNth11gt12 = PDstandardNth11(>12[index]); + CCTK_REAL const PDstandardNth22gt12 = PDstandardNth22(>12[index]); + CCTK_REAL const PDstandardNth33gt12 = PDstandardNth33(>12[index]); + CCTK_REAL const PDstandardNth12gt12 = PDstandardNth12(>12[index]); + CCTK_REAL const PDstandardNth13gt12 = PDstandardNth13(>12[index]); + CCTK_REAL const PDstandardNth23gt12 = PDstandardNth23(>12[index]); + CCTK_REAL const PDstandardNth1gt13 = PDstandardNth1(>13[index]); + CCTK_REAL const PDstandardNth2gt13 = PDstandardNth2(>13[index]); + CCTK_REAL const PDstandardNth3gt13 = PDstandardNth3(>13[index]); + CCTK_REAL const PDstandardNth11gt13 = PDstandardNth11(>13[index]); + CCTK_REAL const PDstandardNth22gt13 = PDstandardNth22(>13[index]); + CCTK_REAL const PDstandardNth33gt13 = PDstandardNth33(>13[index]); + CCTK_REAL const PDstandardNth12gt13 = PDstandardNth12(>13[index]); + CCTK_REAL const PDstandardNth13gt13 = PDstandardNth13(>13[index]); + CCTK_REAL const PDstandardNth23gt13 = PDstandardNth23(>13[index]); + CCTK_REAL const PDstandardNth1gt22 = PDstandardNth1(>22[index]); + CCTK_REAL const PDstandardNth2gt22 = PDstandardNth2(>22[index]); + CCTK_REAL const PDstandardNth3gt22 = PDstandardNth3(>22[index]); + CCTK_REAL const PDstandardNth11gt22 = PDstandardNth11(>22[index]); + CCTK_REAL const PDstandardNth22gt22 = PDstandardNth22(>22[index]); + CCTK_REAL const PDstandardNth33gt22 = PDstandardNth33(>22[index]); + CCTK_REAL const PDstandardNth12gt22 = PDstandardNth12(>22[index]); + CCTK_REAL const PDstandardNth13gt22 = PDstandardNth13(>22[index]); + CCTK_REAL const PDstandardNth23gt22 = PDstandardNth23(>22[index]); + CCTK_REAL const PDstandardNth1gt23 = PDstandardNth1(>23[index]); + CCTK_REAL const PDstandardNth2gt23 = PDstandardNth2(>23[index]); + CCTK_REAL const PDstandardNth3gt23 = PDstandardNth3(>23[index]); + CCTK_REAL const PDstandardNth11gt23 = PDstandardNth11(>23[index]); + CCTK_REAL const PDstandardNth22gt23 = PDstandardNth22(>23[index]); + CCTK_REAL const PDstandardNth33gt23 = PDstandardNth33(>23[index]); + CCTK_REAL const PDstandardNth12gt23 = PDstandardNth12(>23[index]); + CCTK_REAL const PDstandardNth13gt23 = PDstandardNth13(>23[index]); + CCTK_REAL const PDstandardNth23gt23 = PDstandardNth23(>23[index]); + CCTK_REAL const PDstandardNth1gt33 = PDstandardNth1(>33[index]); + CCTK_REAL const PDstandardNth2gt33 = PDstandardNth2(>33[index]); + CCTK_REAL const PDstandardNth3gt33 = PDstandardNth3(>33[index]); + CCTK_REAL const PDstandardNth11gt33 = PDstandardNth11(>33[index]); + CCTK_REAL const PDstandardNth22gt33 = PDstandardNth22(>33[index]); + CCTK_REAL const PDstandardNth33gt33 = PDstandardNth33(>33[index]); + CCTK_REAL const PDstandardNth12gt33 = PDstandardNth12(>33[index]); + CCTK_REAL const PDstandardNth13gt33 = PDstandardNth13(>33[index]); + CCTK_REAL const PDstandardNth23gt33 = PDstandardNth23(>33[index]); + CCTK_REAL const PDstandardNth1trK = PDstandardNth1(&trK[index]); + CCTK_REAL const PDstandardNth2trK = PDstandardNth2(&trK[index]); + CCTK_REAL const PDstandardNth3trK = PDstandardNth3(&trK[index]); + CCTK_REAL const PDstandardNth1Xt1 = PDstandardNth1(&Xt1[index]); + CCTK_REAL const PDstandardNth2Xt1 = PDstandardNth2(&Xt1[index]); + CCTK_REAL const PDstandardNth3Xt1 = PDstandardNth3(&Xt1[index]); + CCTK_REAL const PDstandardNth1Xt2 = PDstandardNth1(&Xt2[index]); + CCTK_REAL const PDstandardNth2Xt2 = PDstandardNth2(&Xt2[index]); + CCTK_REAL const PDstandardNth3Xt2 = PDstandardNth3(&Xt2[index]); + CCTK_REAL const PDstandardNth1Xt3 = PDstandardNth1(&Xt3[index]); + CCTK_REAL const PDstandardNth2Xt3 = PDstandardNth2(&Xt3[index]); + CCTK_REAL const PDstandardNth3Xt3 = PDstandardNth3(&Xt3[index]); + + /* Calculate temporaries and grid functions */ + CCTK_REAL detgt = 1; + + CCTK_REAL gtu11 = INV(detgt)*(gt22L*gt33L - SQR(gt23L)); + + CCTK_REAL gtu21 = (gt13L*gt23L - gt12L*gt33L)*INV(detgt); + + CCTK_REAL gtu31 = (-(gt13L*gt22L) + gt12L*gt23L)*INV(detgt); + + CCTK_REAL gtu22 = INV(detgt)*(gt11L*gt33L - SQR(gt13L)); + + CCTK_REAL gtu32 = (gt12L*gt13L - gt11L*gt23L)*INV(detgt); + + CCTK_REAL gtu33 = INV(detgt)*(gt11L*gt22L - SQR(gt12L)); + + CCTK_REAL dgtu111 = -2*(gtu11*gtu21*J11L*PDstandardNth1gt12 + + gtu11*gtu31*J11L*PDstandardNth1gt13 + + gtu21*gtu31*J11L*PDstandardNth1gt23 + + gtu11*gtu21*J21L*PDstandardNth2gt12 + + gtu11*gtu31*J21L*PDstandardNth2gt13 + + gtu21*gtu31*J21L*PDstandardNth2gt23 + + gtu11*gtu21*J31L*PDstandardNth3gt12 + + gtu11*gtu31*J31L*PDstandardNth3gt13 + + gtu21*gtu31*J31L*PDstandardNth3gt23) + (-(J11L*PDstandardNth1gt11) - + J21L*PDstandardNth2gt11 - J31L*PDstandardNth3gt11)*SQR(gtu11) + + (-(J11L*PDstandardNth1gt22) - J21L*PDstandardNth2gt22 - + J31L*PDstandardNth3gt22)*SQR(gtu21) + (-(J11L*PDstandardNth1gt33) - + J21L*PDstandardNth2gt33 - J31L*PDstandardNth3gt33)*SQR(gtu31); + + CCTK_REAL dgtu211 = gtu11*(J11L*(-(gtu21*PDstandardNth1gt11) - + gtu22*PDstandardNth1gt12 - gtu32*PDstandardNth1gt13) + + J21L*(-(gtu21*PDstandardNth2gt11) - gtu22*PDstandardNth2gt12 - + gtu32*PDstandardNth2gt13) + J31L*(-(gtu21*PDstandardNth3gt11) - + gtu22*PDstandardNth3gt12 - gtu32*PDstandardNth3gt13)) + + gtu21*(J11L*(-(gtu31*PDstandardNth1gt13) - gtu22*PDstandardNth1gt22 - + gtu32*PDstandardNth1gt23) + J21L*(-(gtu31*PDstandardNth2gt13) - + gtu22*PDstandardNth2gt22 - gtu32*PDstandardNth2gt23) + + J31L*(-(gtu31*PDstandardNth3gt13) - gtu22*PDstandardNth3gt22 - + gtu32*PDstandardNth3gt23)) + gtu31*(J11L*(-(gtu22*PDstandardNth1gt23) - + gtu32*PDstandardNth1gt33) + J21L*(-(gtu22*PDstandardNth2gt23) - + gtu32*PDstandardNth2gt33) + J31L*(-(gtu22*PDstandardNth3gt23) - + gtu32*PDstandardNth3gt33)) + (-(J11L*PDstandardNth1gt12) - + J21L*PDstandardNth2gt12 - J31L*PDstandardNth3gt12)*SQR(gtu21); + + CCTK_REAL dgtu311 = gtu11*(J11L*(-(gtu32*PDstandardNth1gt12) - + gtu33*PDstandardNth1gt13) + J21L*(-(gtu31*PDstandardNth2gt11) - + gtu32*PDstandardNth2gt12 - gtu33*PDstandardNth2gt13) + + J31L*(-(gtu31*PDstandardNth3gt11) - gtu32*PDstandardNth3gt12 - + gtu33*PDstandardNth3gt13)) + gtu21*(J11L*(-(gtu32*PDstandardNth1gt22) - + gtu33*PDstandardNth1gt23) + J21L*(-(gtu31*PDstandardNth2gt12) - + gtu32*PDstandardNth2gt22 - gtu33*PDstandardNth2gt23) + + J31L*(-(gtu31*PDstandardNth3gt12) - gtu32*PDstandardNth3gt22 - + gtu33*PDstandardNth3gt23)) + gtu31*(J11L*(-(gtu11*PDstandardNth1gt11) - + gtu21*PDstandardNth1gt12 - gtu32*PDstandardNth1gt23 - + gtu33*PDstandardNth1gt33) + J21L*(-(gtu32*PDstandardNth2gt23) - + gtu33*PDstandardNth2gt33) + J31L*(-(gtu32*PDstandardNth3gt23) - + gtu33*PDstandardNth3gt33)) + (-(J11L*PDstandardNth1gt13) - + J21L*PDstandardNth2gt13 - J31L*PDstandardNth3gt13)*SQR(gtu31); + + CCTK_REAL dgtu221 = -2*(gtu21*gtu22*J11L*PDstandardNth1gt12 + + gtu21*gtu32*J11L*PDstandardNth1gt13 + + gtu22*gtu32*J11L*PDstandardNth1gt23 + + gtu21*gtu22*J21L*PDstandardNth2gt12 + + gtu21*gtu32*J21L*PDstandardNth2gt13 + + gtu22*gtu32*J21L*PDstandardNth2gt23 + + gtu21*gtu22*J31L*PDstandardNth3gt12 + + gtu21*gtu32*J31L*PDstandardNth3gt13 + + gtu22*gtu32*J31L*PDstandardNth3gt23) + (-(J11L*PDstandardNth1gt11) - + J21L*PDstandardNth2gt11 - J31L*PDstandardNth3gt11)*SQR(gtu21) + + (-(J11L*PDstandardNth1gt22) - J21L*PDstandardNth2gt22 - + J31L*PDstandardNth3gt22)*SQR(gtu22) + (-(J11L*PDstandardNth1gt33) - + J21L*PDstandardNth2gt33 - J31L*PDstandardNth3gt33)*SQR(gtu32); + + CCTK_REAL dgtu321 = gtu31*(J11L*(-(gtu21*PDstandardNth1gt11) - + gtu22*PDstandardNth1gt12) + J21L*(-(gtu21*PDstandardNth2gt11) - + gtu22*PDstandardNth2gt12) + J31L*(-(gtu21*PDstandardNth3gt11) - + gtu22*PDstandardNth3gt12)) + gtu32*(J11L*(-(gtu21*PDstandardNth1gt12) - + gtu31*PDstandardNth1gt13 - gtu33*PDstandardNth1gt33) + + J21L*(-(gtu21*PDstandardNth2gt12) - gtu31*PDstandardNth2gt13 - + gtu33*PDstandardNth2gt33) + J31L*(-(gtu21*PDstandardNth3gt12) - + gtu31*PDstandardNth3gt13 - gtu33*PDstandardNth3gt33)) + + J11L*(-(gtu22*gtu32*PDstandardNth1gt22) + + gtu33*(-(gtu21*PDstandardNth1gt13) - gtu22*PDstandardNth1gt23) - + PDstandardNth1gt23*SQR(gtu32)) + + J21L*(-(gtu22*gtu32*PDstandardNth2gt22) + + gtu33*(-(gtu21*PDstandardNth2gt13) - gtu22*PDstandardNth2gt23) - + PDstandardNth2gt23*SQR(gtu32)) + + J31L*(-(gtu22*gtu32*PDstandardNth3gt22) + + gtu33*(-(gtu21*PDstandardNth3gt13) - gtu22*PDstandardNth3gt23) - + PDstandardNth3gt23*SQR(gtu32)); + + CCTK_REAL dgtu331 = -2*(gtu31*gtu32*J11L*PDstandardNth1gt12 + + gtu31*gtu33*J11L*PDstandardNth1gt13 + + gtu32*gtu33*J11L*PDstandardNth1gt23 + + gtu31*gtu32*J21L*PDstandardNth2gt12 + + gtu31*gtu33*J21L*PDstandardNth2gt13 + + gtu32*gtu33*J21L*PDstandardNth2gt23 + + gtu31*gtu32*J31L*PDstandardNth3gt12 + + gtu31*gtu33*J31L*PDstandardNth3gt13 + + gtu32*gtu33*J31L*PDstandardNth3gt23) + (-(J11L*PDstandardNth1gt11) - + J21L*PDstandardNth2gt11 - J31L*PDstandardNth3gt11)*SQR(gtu31) + + (-(J11L*PDstandardNth1gt22) - J21L*PDstandardNth2gt22 - + J31L*PDstandardNth3gt22)*SQR(gtu32) + (-(J11L*PDstandardNth1gt33) - + J21L*PDstandardNth2gt33 - J31L*PDstandardNth3gt33)*SQR(gtu33); + + CCTK_REAL dgtu112 = -2*(gtu11*gtu21*J12L*PDstandardNth1gt12 + + gtu11*gtu31*J12L*PDstandardNth1gt13 + + gtu21*gtu31*J12L*PDstandardNth1gt23 + + gtu11*gtu21*J22L*PDstandardNth2gt12 + + gtu11*gtu31*J22L*PDstandardNth2gt13 + + gtu21*gtu31*J22L*PDstandardNth2gt23 + + gtu11*gtu21*J32L*PDstandardNth3gt12 + + gtu11*gtu31*J32L*PDstandardNth3gt13 + + gtu21*gtu31*J32L*PDstandardNth3gt23) + (-(J12L*PDstandardNth1gt11) - + J22L*PDstandardNth2gt11 - J32L*PDstandardNth3gt11)*SQR(gtu11) + + (-(J12L*PDstandardNth1gt22) - J22L*PDstandardNth2gt22 - + J32L*PDstandardNth3gt22)*SQR(gtu21) + (-(J12L*PDstandardNth1gt33) - + J22L*PDstandardNth2gt33 - J32L*PDstandardNth3gt33)*SQR(gtu31); + + CCTK_REAL dgtu212 = gtu11*(J12L*(-(gtu21*PDstandardNth1gt11) - + gtu22*PDstandardNth1gt12 - gtu32*PDstandardNth1gt13) + + J22L*(-(gtu21*PDstandardNth2gt11) - gtu22*PDstandardNth2gt12 - + gtu32*PDstandardNth2gt13) + J32L*(-(gtu21*PDstandardNth3gt11) - + gtu22*PDstandardNth3gt12 - gtu32*PDstandardNth3gt13)) + + gtu21*(J12L*(-(gtu31*PDstandardNth1gt13) - gtu22*PDstandardNth1gt22 - + gtu32*PDstandardNth1gt23) + J22L*(-(gtu31*PDstandardNth2gt13) - + gtu22*PDstandardNth2gt22 - gtu32*PDstandardNth2gt23) + + J32L*(-(gtu31*PDstandardNth3gt13) - gtu22*PDstandardNth3gt22 - + gtu32*PDstandardNth3gt23)) + gtu31*(J12L*(-(gtu22*PDstandardNth1gt23) - + gtu32*PDstandardNth1gt33) + J22L*(-(gtu22*PDstandardNth2gt23) - + gtu32*PDstandardNth2gt33) + J32L*(-(gtu22*PDstandardNth3gt23) - + gtu32*PDstandardNth3gt33)) + (-(J12L*PDstandardNth1gt12) - + J22L*PDstandardNth2gt12 - J32L*PDstandardNth3gt12)*SQR(gtu21); + + CCTK_REAL dgtu312 = gtu11*(J12L*(-(gtu32*PDstandardNth1gt12) - + gtu33*PDstandardNth1gt13) + J22L*(-(gtu31*PDstandardNth2gt11) - + gtu32*PDstandardNth2gt12 - gtu33*PDstandardNth2gt13) + + J32L*(-(gtu31*PDstandardNth3gt11) - gtu32*PDstandardNth3gt12 - + gtu33*PDstandardNth3gt13)) + gtu21*(J12L*(-(gtu32*PDstandardNth1gt22) - + gtu33*PDstandardNth1gt23) + J22L*(-(gtu31*PDstandardNth2gt12) - + gtu32*PDstandardNth2gt22 - gtu33*PDstandardNth2gt23) + + J32L*(-(gtu31*PDstandardNth3gt12) - gtu32*PDstandardNth3gt22 - + gtu33*PDstandardNth3gt23)) + gtu31*(J12L*(-(gtu11*PDstandardNth1gt11) - + gtu21*PDstandardNth1gt12 - gtu32*PDstandardNth1gt23 - + gtu33*PDstandardNth1gt33) + J22L*(-(gtu32*PDstandardNth2gt23) - + gtu33*PDstandardNth2gt33) + J32L*(-(gtu32*PDstandardNth3gt23) - + gtu33*PDstandardNth3gt33)) + (-(J12L*PDstandardNth1gt13) - + J22L*PDstandardNth2gt13 - J32L*PDstandardNth3gt13)*SQR(gtu31); + + CCTK_REAL dgtu222 = -2*(gtu21*gtu22*J12L*PDstandardNth1gt12 + + gtu21*gtu32*J12L*PDstandardNth1gt13 + + gtu22*gtu32*J12L*PDstandardNth1gt23 + + gtu21*gtu22*J22L*PDstandardNth2gt12 + + gtu21*gtu32*J22L*PDstandardNth2gt13 + + gtu22*gtu32*J22L*PDstandardNth2gt23 + + gtu21*gtu22*J32L*PDstandardNth3gt12 + + gtu21*gtu32*J32L*PDstandardNth3gt13 + + gtu22*gtu32*J32L*PDstandardNth3gt23) + (-(J12L*PDstandardNth1gt11) - + J22L*PDstandardNth2gt11 - J32L*PDstandardNth3gt11)*SQR(gtu21) + + (-(J12L*PDstandardNth1gt22) - J22L*PDstandardNth2gt22 - + J32L*PDstandardNth3gt22)*SQR(gtu22) + (-(J12L*PDstandardNth1gt33) - + J22L*PDstandardNth2gt33 - J32L*PDstandardNth3gt33)*SQR(gtu32); + + CCTK_REAL dgtu322 = gtu31*(J12L*(-(gtu21*PDstandardNth1gt11) - + gtu22*PDstandardNth1gt12) + J22L*(-(gtu21*PDstandardNth2gt11) - + gtu22*PDstandardNth2gt12) + J32L*(-(gtu21*PDstandardNth3gt11) - + gtu22*PDstandardNth3gt12)) + gtu32*(J12L*(-(gtu21*PDstandardNth1gt12) - + gtu31*PDstandardNth1gt13 - gtu33*PDstandardNth1gt33) + + J22L*(-(gtu21*PDstandardNth2gt12) - gtu31*PDstandardNth2gt13 - + gtu33*PDstandardNth2gt33) + J32L*(-(gtu21*PDstandardNth3gt12) - + gtu31*PDstandardNth3gt13 - gtu33*PDstandardNth3gt33)) + + J12L*(-(gtu22*gtu32*PDstandardNth1gt22) + + gtu33*(-(gtu21*PDstandardNth1gt13) - gtu22*PDstandardNth1gt23) - + PDstandardNth1gt23*SQR(gtu32)) + + J22L*(-(gtu22*gtu32*PDstandardNth2gt22) + + gtu33*(-(gtu21*PDstandardNth2gt13) - gtu22*PDstandardNth2gt23) - + PDstandardNth2gt23*SQR(gtu32)) + + J32L*(-(gtu22*gtu32*PDstandardNth3gt22) + + gtu33*(-(gtu21*PDstandardNth3gt13) - gtu22*PDstandardNth3gt23) - + PDstandardNth3gt23*SQR(gtu32)); + + CCTK_REAL dgtu332 = -2*(gtu31*gtu32*J12L*PDstandardNth1gt12 + + gtu31*gtu33*J12L*PDstandardNth1gt13 + + gtu32*gtu33*J12L*PDstandardNth1gt23 + + gtu31*gtu32*J22L*PDstandardNth2gt12 + + gtu31*gtu33*J22L*PDstandardNth2gt13 + + gtu32*gtu33*J22L*PDstandardNth2gt23 + + gtu31*gtu32*J32L*PDstandardNth3gt12 + + gtu31*gtu33*J32L*PDstandardNth3gt13 + + gtu32*gtu33*J32L*PDstandardNth3gt23) + (-(J12L*PDstandardNth1gt11) - + J22L*PDstandardNth2gt11 - J32L*PDstandardNth3gt11)*SQR(gtu31) + + (-(J12L*PDstandardNth1gt22) - J22L*PDstandardNth2gt22 - + J32L*PDstandardNth3gt22)*SQR(gtu32) + (-(J12L*PDstandardNth1gt33) - + J22L*PDstandardNth2gt33 - J32L*PDstandardNth3gt33)*SQR(gtu33); + + CCTK_REAL dgtu113 = -2*(gtu11*gtu21*J13L*PDstandardNth1gt12 + + gtu11*gtu31*J13L*PDstandardNth1gt13 + + gtu21*gtu31*J13L*PDstandardNth1gt23 + + gtu11*gtu21*J23L*PDstandardNth2gt12 + + gtu11*gtu31*J23L*PDstandardNth2gt13 + + gtu21*gtu31*J23L*PDstandardNth2gt23 + + gtu11*gtu21*J33L*PDstandardNth3gt12 + + gtu11*gtu31*J33L*PDstandardNth3gt13 + + gtu21*gtu31*J33L*PDstandardNth3gt23) + (-(J13L*PDstandardNth1gt11) - + J23L*PDstandardNth2gt11 - J33L*PDstandardNth3gt11)*SQR(gtu11) + + (-(J13L*PDstandardNth1gt22) - J23L*PDstandardNth2gt22 - + J33L*PDstandardNth3gt22)*SQR(gtu21) + (-(J13L*PDstandardNth1gt33) - + J23L*PDstandardNth2gt33 - J33L*PDstandardNth3gt33)*SQR(gtu31); + + CCTK_REAL dgtu213 = gtu11*(J13L*(-(gtu21*PDstandardNth1gt11) - + gtu22*PDstandardNth1gt12 - gtu32*PDstandardNth1gt13) + + J23L*(-(gtu21*PDstandardNth2gt11) - gtu22*PDstandardNth2gt12 - + gtu32*PDstandardNth2gt13) + J33L*(-(gtu21*PDstandardNth3gt11) - + gtu22*PDstandardNth3gt12 - gtu32*PDstandardNth3gt13)) + + gtu21*(J13L*(-(gtu31*PDstandardNth1gt13) - gtu22*PDstandardNth1gt22 - + gtu32*PDstandardNth1gt23) + J23L*(-(gtu31*PDstandardNth2gt13) - + gtu22*PDstandardNth2gt22 - gtu32*PDstandardNth2gt23) + + J33L*(-(gtu31*PDstandardNth3gt13) - gtu22*PDstandardNth3gt22 - + gtu32*PDstandardNth3gt23)) + gtu31*(J13L*(-(gtu22*PDstandardNth1gt23) - + gtu32*PDstandardNth1gt33) + J23L*(-(gtu22*PDstandardNth2gt23) - + gtu32*PDstandardNth2gt33) + J33L*(-(gtu22*PDstandardNth3gt23) - + gtu32*PDstandardNth3gt33)) + (-(J13L*PDstandardNth1gt12) - + J23L*PDstandardNth2gt12 - J33L*PDstandardNth3gt12)*SQR(gtu21); + + CCTK_REAL dgtu313 = gtu11*(J13L*(-(gtu32*PDstandardNth1gt12) - + gtu33*PDstandardNth1gt13) + J23L*(-(gtu31*PDstandardNth2gt11) - + gtu32*PDstandardNth2gt12 - gtu33*PDstandardNth2gt13) + + J33L*(-(gtu31*PDstandardNth3gt11) - gtu32*PDstandardNth3gt12 - + gtu33*PDstandardNth3gt13)) + gtu21*(J13L*(-(gtu32*PDstandardNth1gt22) - + gtu33*PDstandardNth1gt23) + J23L*(-(gtu31*PDstandardNth2gt12) - + gtu32*PDstandardNth2gt22 - gtu33*PDstandardNth2gt23) + + J33L*(-(gtu31*PDstandardNth3gt12) - gtu32*PDstandardNth3gt22 - + gtu33*PDstandardNth3gt23)) + gtu31*(J13L*(-(gtu11*PDstandardNth1gt11) - + gtu21*PDstandardNth1gt12 - gtu32*PDstandardNth1gt23 - + gtu33*PDstandardNth1gt33) + J23L*(-(gtu32*PDstandardNth2gt23) - + gtu33*PDstandardNth2gt33) + J33L*(-(gtu32*PDstandardNth3gt23) - + gtu33*PDstandardNth3gt33)) + (-(J13L*PDstandardNth1gt13) - + J23L*PDstandardNth2gt13 - J33L*PDstandardNth3gt13)*SQR(gtu31); + + CCTK_REAL dgtu223 = -2*(gtu21*gtu22*J13L*PDstandardNth1gt12 + + gtu21*gtu32*J13L*PDstandardNth1gt13 + + gtu22*gtu32*J13L*PDstandardNth1gt23 + + gtu21*gtu22*J23L*PDstandardNth2gt12 + + gtu21*gtu32*J23L*PDstandardNth2gt13 + + gtu22*gtu32*J23L*PDstandardNth2gt23 + + gtu21*gtu22*J33L*PDstandardNth3gt12 + + gtu21*gtu32*J33L*PDstandardNth3gt13 + + gtu22*gtu32*J33L*PDstandardNth3gt23) + (-(J13L*PDstandardNth1gt11) - + J23L*PDstandardNth2gt11 - J33L*PDstandardNth3gt11)*SQR(gtu21) + + (-(J13L*PDstandardNth1gt22) - J23L*PDstandardNth2gt22 - + J33L*PDstandardNth3gt22)*SQR(gtu22) + (-(J13L*PDstandardNth1gt33) - + J23L*PDstandardNth2gt33 - J33L*PDstandardNth3gt33)*SQR(gtu32); + + CCTK_REAL dgtu323 = gtu31*(J13L*(-(gtu21*PDstandardNth1gt11) - + gtu22*PDstandardNth1gt12) + J23L*(-(gtu21*PDstandardNth2gt11) - + gtu22*PDstandardNth2gt12) + J33L*(-(gtu21*PDstandardNth3gt11) - + gtu22*PDstandardNth3gt12)) + gtu32*(J13L*(-(gtu21*PDstandardNth1gt12) - + gtu31*PDstandardNth1gt13 - gtu33*PDstandardNth1gt33) + + J23L*(-(gtu21*PDstandardNth2gt12) - gtu31*PDstandardNth2gt13 - + gtu33*PDstandardNth2gt33) + J33L*(-(gtu21*PDstandardNth3gt12) - + gtu31*PDstandardNth3gt13 - gtu33*PDstandardNth3gt33)) + + J13L*(-(gtu22*gtu32*PDstandardNth1gt22) + + gtu33*(-(gtu21*PDstandardNth1gt13) - gtu22*PDstandardNth1gt23) - + PDstandardNth1gt23*SQR(gtu32)) + + J23L*(-(gtu22*gtu32*PDstandardNth2gt22) + + gtu33*(-(gtu21*PDstandardNth2gt13) - gtu22*PDstandardNth2gt23) - + PDstandardNth2gt23*SQR(gtu32)) + + J33L*(-(gtu22*gtu32*PDstandardNth3gt22) + + gtu33*(-(gtu21*PDstandardNth3gt13) - gtu22*PDstandardNth3gt23) - + PDstandardNth3gt23*SQR(gtu32)); + + CCTK_REAL dgtu333 = -2*(gtu31*gtu32*J13L*PDstandardNth1gt12 + + gtu31*gtu33*J13L*PDstandardNth1gt13 + + gtu32*gtu33*J13L*PDstandardNth1gt23 + + gtu31*gtu32*J23L*PDstandardNth2gt12 + + gtu31*gtu33*J23L*PDstandardNth2gt13 + + gtu32*gtu33*J23L*PDstandardNth2gt23 + + gtu31*gtu32*J33L*PDstandardNth3gt12 + + gtu31*gtu33*J33L*PDstandardNth3gt13 + + gtu32*gtu33*J33L*PDstandardNth3gt23) + (-(J13L*PDstandardNth1gt11) - + J23L*PDstandardNth2gt11 - J33L*PDstandardNth3gt11)*SQR(gtu31) + + (-(J13L*PDstandardNth1gt22) - J23L*PDstandardNth2gt22 - + J33L*PDstandardNth3gt22)*SQR(gtu32) + (-(J13L*PDstandardNth1gt33) - + J23L*PDstandardNth2gt33 - J33L*PDstandardNth3gt33)*SQR(gtu33); + + CCTK_REAL Gtl111 = 0.5*(J11L*PDstandardNth1gt11 + + J21L*PDstandardNth2gt11 + J31L*PDstandardNth3gt11); + + CCTK_REAL Gtl112 = 0.5*(J12L*PDstandardNth1gt11 + + J22L*PDstandardNth2gt11 + J32L*PDstandardNth3gt11); + + CCTK_REAL Gtl113 = 0.5*(J13L*PDstandardNth1gt11 + + J23L*PDstandardNth2gt11 + J33L*PDstandardNth3gt11); + + CCTK_REAL Gtl122 = J12L*PDstandardNth1gt12 + J22L*PDstandardNth2gt12 + + J32L*PDstandardNth3gt12 - 0.5*(J11L*PDstandardNth1gt22 + + J21L*PDstandardNth2gt22 + J31L*PDstandardNth3gt22); + + CCTK_REAL Gtl123 = 0.5*(J13L*PDstandardNth1gt12 + + J12L*PDstandardNth1gt13 - J11L*PDstandardNth1gt23 + + J23L*PDstandardNth2gt12 + J22L*PDstandardNth2gt13 - + J21L*PDstandardNth2gt23 + J33L*PDstandardNth3gt12 + + J32L*PDstandardNth3gt13 - J31L*PDstandardNth3gt23); + + CCTK_REAL Gtl133 = J13L*PDstandardNth1gt13 + J23L*PDstandardNth2gt13 + + J33L*PDstandardNth3gt13 - 0.5*(J11L*PDstandardNth1gt33 + + J21L*PDstandardNth2gt33 + J31L*PDstandardNth3gt33); + + CCTK_REAL Gtl211 = J11L*PDstandardNth1gt12 + J21L*PDstandardNth2gt12 - + 0.5*(J12L*PDstandardNth1gt11 + J22L*PDstandardNth2gt11 + + J32L*PDstandardNth3gt11) + J31L*PDstandardNth3gt12; + + CCTK_REAL Gtl212 = 0.5*(J11L*PDstandardNth1gt22 + + J21L*PDstandardNth2gt22 + J31L*PDstandardNth3gt22); + + CCTK_REAL Gtl213 = 0.5*(J13L*PDstandardNth1gt12 - + J12L*PDstandardNth1gt13 + J11L*PDstandardNth1gt23 + + J23L*PDstandardNth2gt12 - J22L*PDstandardNth2gt13 + + J21L*PDstandardNth2gt23 + J33L*PDstandardNth3gt12 - + J32L*PDstandardNth3gt13 + J31L*PDstandardNth3gt23); + + CCTK_REAL Gtl222 = 0.5*(J12L*PDstandardNth1gt22 + + J22L*PDstandardNth2gt22 + J32L*PDstandardNth3gt22); + + CCTK_REAL Gtl223 = 0.5*(J13L*PDstandardNth1gt22 + + J23L*PDstandardNth2gt22 + J33L*PDstandardNth3gt22); + + CCTK_REAL Gtl233 = J13L*PDstandardNth1gt23 + J23L*PDstandardNth2gt23 + + J33L*PDstandardNth3gt23 - 0.5*(J12L*PDstandardNth1gt33 + + J22L*PDstandardNth2gt33 + J32L*PDstandardNth3gt33); + + CCTK_REAL Gtl311 = J11L*PDstandardNth1gt13 + J21L*PDstandardNth2gt13 - + 0.5*(J13L*PDstandardNth1gt11 + J23L*PDstandardNth2gt11 + + J33L*PDstandardNth3gt11) + J31L*PDstandardNth3gt13; + + CCTK_REAL Gtl312 = 0.5*(-(J13L*PDstandardNth1gt12) + + J12L*PDstandardNth1gt13 + J11L*PDstandardNth1gt23 - + J23L*PDstandardNth2gt12 + J22L*PDstandardNth2gt13 + + J21L*PDstandardNth2gt23 - J33L*PDstandardNth3gt12 + + J32L*PDstandardNth3gt13 + J31L*PDstandardNth3gt23); + + CCTK_REAL Gtl313 = 0.5*(J11L*PDstandardNth1gt33 + + J21L*PDstandardNth2gt33 + J31L*PDstandardNth3gt33); + + CCTK_REAL Gtl322 = J12L*PDstandardNth1gt23 + J22L*PDstandardNth2gt23 - + 0.5*(J13L*PDstandardNth1gt22 + J23L*PDstandardNth2gt22 + + J33L*PDstandardNth3gt22) + J32L*PDstandardNth3gt23; + + CCTK_REAL Gtl323 = 0.5*(J12L*PDstandardNth1gt33 + + J22L*PDstandardNth2gt33 + J32L*PDstandardNth3gt33); + + CCTK_REAL Gtl333 = 0.5*(J13L*PDstandardNth1gt33 + + J23L*PDstandardNth2gt33 + J33L*PDstandardNth3gt33); + + CCTK_REAL Gtlu111 = Gtl111*gtu11 + Gtl112*gtu21 + Gtl113*gtu31; + + CCTK_REAL Gtlu112 = Gtl111*gtu21 + Gtl112*gtu22 + Gtl113*gtu32; + + CCTK_REAL Gtlu113 = Gtl111*gtu31 + Gtl112*gtu32 + Gtl113*gtu33; + + CCTK_REAL Gtlu121 = Gtl112*gtu11 + Gtl122*gtu21 + Gtl123*gtu31; + + CCTK_REAL Gtlu122 = Gtl112*gtu21 + Gtl122*gtu22 + Gtl123*gtu32; + + CCTK_REAL Gtlu123 = Gtl112*gtu31 + Gtl122*gtu32 + Gtl123*gtu33; + + CCTK_REAL Gtlu131 = Gtl113*gtu11 + Gtl123*gtu21 + Gtl133*gtu31; + + CCTK_REAL Gtlu132 = Gtl113*gtu21 + Gtl123*gtu22 + Gtl133*gtu32; + + CCTK_REAL Gtlu133 = Gtl113*gtu31 + Gtl123*gtu32 + Gtl133*gtu33; + + CCTK_REAL Gtlu211 = Gtl211*gtu11 + Gtl212*gtu21 + Gtl213*gtu31; + + CCTK_REAL Gtlu212 = Gtl211*gtu21 + Gtl212*gtu22 + Gtl213*gtu32; + + CCTK_REAL Gtlu213 = Gtl211*gtu31 + Gtl212*gtu32 + Gtl213*gtu33; + + CCTK_REAL Gtlu221 = Gtl212*gtu11 + Gtl222*gtu21 + Gtl223*gtu31; + + CCTK_REAL Gtlu222 = Gtl212*gtu21 + Gtl222*gtu22 + Gtl223*gtu32; + + CCTK_REAL Gtlu223 = Gtl212*gtu31 + Gtl222*gtu32 + Gtl223*gtu33; + + CCTK_REAL Gtlu231 = Gtl213*gtu11 + Gtl223*gtu21 + Gtl233*gtu31; + + CCTK_REAL Gtlu232 = Gtl213*gtu21 + Gtl223*gtu22 + Gtl233*gtu32; + + CCTK_REAL Gtlu233 = Gtl213*gtu31 + Gtl223*gtu32 + Gtl233*gtu33; + + CCTK_REAL Gtlu311 = Gtl311*gtu11 + Gtl312*gtu21 + Gtl313*gtu31; + + CCTK_REAL Gtlu312 = Gtl311*gtu21 + Gtl312*gtu22 + Gtl313*gtu32; + + CCTK_REAL Gtlu313 = Gtl311*gtu31 + Gtl312*gtu32 + Gtl313*gtu33; + + CCTK_REAL Gtlu321 = Gtl312*gtu11 + Gtl322*gtu21 + Gtl323*gtu31; + + CCTK_REAL Gtlu322 = Gtl312*gtu21 + Gtl322*gtu22 + Gtl323*gtu32; + + CCTK_REAL Gtlu323 = Gtl312*gtu31 + Gtl322*gtu32 + Gtl323*gtu33; + + CCTK_REAL Gtlu331 = Gtl313*gtu11 + Gtl323*gtu21 + Gtl333*gtu31; + + CCTK_REAL Gtlu332 = Gtl313*gtu21 + Gtl323*gtu22 + Gtl333*gtu32; + + CCTK_REAL Gtlu333 = Gtl313*gtu31 + Gtl323*gtu32 + Gtl333*gtu33; + + CCTK_REAL Gt111 = Gtl111*gtu11 + Gtl211*gtu21 + Gtl311*gtu31; + + CCTK_REAL Gt211 = Gtl111*gtu21 + Gtl211*gtu22 + Gtl311*gtu32; + + CCTK_REAL Gt311 = Gtl111*gtu31 + Gtl211*gtu32 + Gtl311*gtu33; + + CCTK_REAL Gt112 = Gtl112*gtu11 + Gtl212*gtu21 + Gtl312*gtu31; + + CCTK_REAL Gt212 = Gtl112*gtu21 + Gtl212*gtu22 + Gtl312*gtu32; + + CCTK_REAL Gt312 = Gtl112*gtu31 + Gtl212*gtu32 + Gtl312*gtu33; + + CCTK_REAL Gt113 = Gtl113*gtu11 + Gtl213*gtu21 + Gtl313*gtu31; + + CCTK_REAL Gt213 = Gtl113*gtu21 + Gtl213*gtu22 + Gtl313*gtu32; + + CCTK_REAL Gt313 = Gtl113*gtu31 + Gtl213*gtu32 + Gtl313*gtu33; + + CCTK_REAL Gt122 = Gtl122*gtu11 + Gtl222*gtu21 + Gtl322*gtu31; + + CCTK_REAL Gt222 = Gtl122*gtu21 + Gtl222*gtu22 + Gtl322*gtu32; + + CCTK_REAL Gt322 = Gtl122*gtu31 + Gtl222*gtu32 + Gtl322*gtu33; + + CCTK_REAL Gt123 = Gtl123*gtu11 + Gtl223*gtu21 + Gtl323*gtu31; + + CCTK_REAL Gt223 = Gtl123*gtu21 + Gtl223*gtu22 + Gtl323*gtu32; + + CCTK_REAL Gt323 = Gtl123*gtu31 + Gtl223*gtu32 + Gtl323*gtu33; + + CCTK_REAL Gt133 = Gtl133*gtu11 + Gtl233*gtu21 + Gtl333*gtu31; + + CCTK_REAL Gt233 = Gtl133*gtu21 + Gtl233*gtu22 + Gtl333*gtu32; + + CCTK_REAL Gt333 = Gtl133*gtu31 + Gtl233*gtu32 + Gtl333*gtu33; + + CCTK_REAL Xtn1 = Gt111*gtu11 + Gt122*gtu22 + 2*(Gt112*gtu21 + + Gt113*gtu31 + Gt123*gtu32) + Gt133*gtu33; + + CCTK_REAL Xtn2 = Gt211*gtu11 + Gt222*gtu22 + 2*(Gt212*gtu21 + + Gt213*gtu31 + Gt223*gtu32) + Gt233*gtu33; + + CCTK_REAL Xtn3 = Gt311*gtu11 + Gt322*gtu22 + 2*(Gt312*gtu21 + + Gt313*gtu31 + Gt323*gtu32) + Gt333*gtu33; + + CCTK_REAL Rt11 = 3*(Gt111*Gtlu111 + Gt112*Gtlu112 + Gt113*Gtlu113) + + 2*(Gt211*Gtlu121 + Gt212*Gtlu122 + Gt213*Gtlu123 + Gt311*Gtlu131 + + Gt312*Gtlu132 + Gt313*Gtlu133) + Gt211*Gtlu211 + Gt212*Gtlu212 + + Gt213*Gtlu213 + Gt311*Gtlu311 + Gt312*Gtlu312 + Gt313*Gtlu313 + + J11L*(gt11L*PDstandardNth1Xt1 + gt12L*PDstandardNth1Xt2 + + gt13L*PDstandardNth1Xt3) + J21L*(gt11L*PDstandardNth2Xt1 + + gt12L*PDstandardNth2Xt2 + gt13L*PDstandardNth2Xt3) + + J31L*(gt11L*PDstandardNth3Xt1 + gt12L*PDstandardNth3Xt2 + + gt13L*PDstandardNth3Xt3) + Gtl111*Xtn1 + Gtl112*Xtn2 + Gtl113*Xtn3 + + 0.5*(-2*(gtu21*(J11L*J12L*PDstandardNth11gt11 + + J12L*J21L*PDstandardNth12gt11 + J11L*J22L*PDstandardNth12gt11 + + J12L*J31L*PDstandardNth13gt11 + J11L*J32L*PDstandardNth13gt11 + + dJ112L*PDstandardNth1gt11 + J21L*J22L*PDstandardNth22gt11 + + J22L*J31L*PDstandardNth23gt11 + J21L*J32L*PDstandardNth23gt11 + + dJ212L*PDstandardNth2gt11 + J31L*J32L*PDstandardNth33gt11 + + dJ312L*PDstandardNth3gt11) + gtu31*(J11L*J13L*PDstandardNth11gt11 + + J13L*J21L*PDstandardNth12gt11 + J11L*J23L*PDstandardNth12gt11 + + J13L*J31L*PDstandardNth13gt11 + J11L*J33L*PDstandardNth13gt11 + + dJ113L*PDstandardNth1gt11 + J21L*J23L*PDstandardNth22gt11 + + J23L*J31L*PDstandardNth23gt11 + J21L*J33L*PDstandardNth23gt11 + + dJ213L*PDstandardNth2gt11 + J31L*J33L*PDstandardNth33gt11 + + dJ313L*PDstandardNth3gt11) + gtu32*(J12L*J13L*PDstandardNth11gt11 + + J13L*J22L*PDstandardNth12gt11 + J12L*J23L*PDstandardNth12gt11 + + J13L*J32L*PDstandardNth13gt11 + J12L*J33L*PDstandardNth13gt11 + + dJ123L*PDstandardNth1gt11 + J22L*J23L*PDstandardNth22gt11 + + J23L*J32L*PDstandardNth23gt11 + J22L*J33L*PDstandardNth23gt11 + + dJ223L*PDstandardNth2gt11 + J32L*J33L*PDstandardNth33gt11 + + dJ323L*PDstandardNth3gt11)) - gtu11*(2*J11L*J21L*PDstandardNth12gt11 + + 2*J11L*J31L*PDstandardNth13gt11 + dJ111L*PDstandardNth1gt11 + + 2*J21L*J31L*PDstandardNth23gt11 + dJ211L*PDstandardNth2gt11 + + dJ311L*PDstandardNth3gt11 + PDstandardNth11gt11*SQR(J11L) + + PDstandardNth22gt11*SQR(J21L) + PDstandardNth33gt11*SQR(J31L)) - + gtu22*(2*J12L*J22L*PDstandardNth12gt11 + + 2*J12L*J32L*PDstandardNth13gt11 + dJ122L*PDstandardNth1gt11 + + 2*J22L*J32L*PDstandardNth23gt11 + dJ222L*PDstandardNth2gt11 + + dJ322L*PDstandardNth3gt11 + PDstandardNth11gt11*SQR(J12L) + + PDstandardNth22gt11*SQR(J22L) + PDstandardNth33gt11*SQR(J32L)) - + gtu33*(2*J13L*J23L*PDstandardNth12gt11 + + 2*J13L*J33L*PDstandardNth13gt11 + dJ133L*PDstandardNth1gt11 + + 2*J23L*J33L*PDstandardNth23gt11 + dJ233L*PDstandardNth2gt11 + + dJ333L*PDstandardNth3gt11 + PDstandardNth11gt11*SQR(J13L) + + PDstandardNth22gt11*SQR(J23L) + PDstandardNth33gt11*SQR(J33L))); + + CCTK_REAL Rt12 = Gt122*Gtlu112 + Gt123*Gtlu113 + (Gt111 + + Gt212)*Gtlu121 + Gt222*Gtlu122 + (Gt113 + Gt223)*Gtlu123 + + Gt322*Gtlu132 + Gt323*Gtlu133 + Gt111*Gtlu211 + Gt112*(Gtlu111 + + Gtlu122 + Gtlu212) + Gt113*Gtlu213 + 2*(Gt211*Gtlu221 + Gt212*Gtlu222 + + Gt213*Gtlu223) + Gt311*(Gtlu231 + Gtlu321) + Gt312*(Gtlu131 + Gtlu232 + + Gtlu322) + Gt313*(Gtlu233 + Gtlu323) + 0.5*((gt12L*J11L + + gt11L*J12L)*PDstandardNth1Xt1 + (gt22L*J11L + + gt12L*J12L)*PDstandardNth1Xt2 + (gt23L*J11L + + gt13L*J12L)*PDstandardNth1Xt3 + (gt12L*J21L + + gt11L*J22L)*PDstandardNth2Xt1 + (gt22L*J21L + + gt12L*J22L)*PDstandardNth2Xt2 + (gt23L*J21L + + gt13L*J22L)*PDstandardNth2Xt3 - 2*(gtu21*(J11L*J12L*PDstandardNth11gt12 + + J12L*J21L*PDstandardNth12gt12 + J11L*J22L*PDstandardNth12gt12 + + J12L*J31L*PDstandardNth13gt12 + J11L*J32L*PDstandardNth13gt12 + + dJ112L*PDstandardNth1gt12 + J21L*J22L*PDstandardNth22gt12 + + J22L*J31L*PDstandardNth23gt12 + J21L*J32L*PDstandardNth23gt12 + + dJ212L*PDstandardNth2gt12 + J31L*J32L*PDstandardNth33gt12 + + dJ312L*PDstandardNth3gt12) + gtu31*(J11L*J13L*PDstandardNth11gt12 + + J13L*J21L*PDstandardNth12gt12 + J11L*J23L*PDstandardNth12gt12 + + J13L*J31L*PDstandardNth13gt12 + J11L*J33L*PDstandardNth13gt12 + + dJ113L*PDstandardNth1gt12 + J21L*J23L*PDstandardNth22gt12 + + J23L*J31L*PDstandardNth23gt12 + J21L*J33L*PDstandardNth23gt12 + + dJ213L*PDstandardNth2gt12 + J31L*J33L*PDstandardNth33gt12 + + dJ313L*PDstandardNth3gt12) + gtu32*(J12L*J13L*PDstandardNth11gt12 + + J13L*J22L*PDstandardNth12gt12 + J12L*J23L*PDstandardNth12gt12 + + J13L*J32L*PDstandardNth13gt12 + J12L*J33L*PDstandardNth13gt12 + + dJ123L*PDstandardNth1gt12 + J22L*J23L*PDstandardNth22gt12 + + J23L*J32L*PDstandardNth23gt12 + J22L*J33L*PDstandardNth23gt12 + + dJ223L*PDstandardNth2gt12 + J32L*J33L*PDstandardNth33gt12 + + dJ323L*PDstandardNth3gt12)) + (gt12L*J31L + + gt11L*J32L)*PDstandardNth3Xt1 + (gt22L*J31L + + gt12L*J32L)*PDstandardNth3Xt2 + (gt23L*J31L + + gt13L*J32L)*PDstandardNth3Xt3 + (Gtl112 + Gtl211)*Xtn1 + (Gtl122 + + Gtl212)*Xtn2 + (Gtl123 + Gtl213)*Xtn3 - + gtu11*(2*J11L*J21L*PDstandardNth12gt12 + + 2*J11L*J31L*PDstandardNth13gt12 + dJ111L*PDstandardNth1gt12 + + 2*J21L*J31L*PDstandardNth23gt12 + dJ211L*PDstandardNth2gt12 + + dJ311L*PDstandardNth3gt12 + PDstandardNth11gt12*SQR(J11L) + + PDstandardNth22gt12*SQR(J21L) + PDstandardNth33gt12*SQR(J31L)) - + gtu22*(2*J12L*J22L*PDstandardNth12gt12 + + 2*J12L*J32L*PDstandardNth13gt12 + dJ122L*PDstandardNth1gt12 + + 2*J22L*J32L*PDstandardNth23gt12 + dJ222L*PDstandardNth2gt12 + + dJ322L*PDstandardNth3gt12 + PDstandardNth11gt12*SQR(J12L) + + PDstandardNth22gt12*SQR(J22L) + PDstandardNth33gt12*SQR(J32L)) - + gtu33*(2*J13L*J23L*PDstandardNth12gt12 + + 2*J13L*J33L*PDstandardNth13gt12 + dJ133L*PDstandardNth1gt12 + + 2*J23L*J33L*PDstandardNth23gt12 + dJ233L*PDstandardNth2gt12 + + dJ333L*PDstandardNth3gt12 + PDstandardNth11gt12*SQR(J13L) + + PDstandardNth22gt12*SQR(J23L) + PDstandardNth33gt12*SQR(J33L))); + + CCTK_REAL Rt13 = Gt123*Gtlu112 + Gt133*Gtlu113 + Gt223*Gtlu122 + + Gt233*Gtlu123 + (Gt111 + Gt313)*Gtlu131 + (Gt112 + Gt323)*Gtlu132 + + Gt333*Gtlu133 + Gt111*Gtlu311 + Gt112*Gtlu312 + Gt113*(Gtlu111 + + Gtlu133 + Gtlu313) + Gt211*(Gtlu231 + Gtlu321) + Gt212*(Gtlu232 + + Gtlu322) + Gt213*(Gtlu121 + Gtlu233 + Gtlu323) + 2*(Gt311*Gtlu331 + + Gt312*Gtlu332 + Gt313*Gtlu333) + 0.5*((gt13L*J11L + + gt11L*J13L)*PDstandardNth1Xt1 + (gt23L*J11L + + gt12L*J13L)*PDstandardNth1Xt2 + (gt33L*J11L + + gt13L*J13L)*PDstandardNth1Xt3 + (gt13L*J21L + + gt11L*J23L)*PDstandardNth2Xt1 + (gt23L*J21L + + gt12L*J23L)*PDstandardNth2Xt2 + (gt33L*J21L + + gt13L*J23L)*PDstandardNth2Xt3 - 2*(gtu21*(J11L*J12L*PDstandardNth11gt13 + + J12L*J21L*PDstandardNth12gt13 + J11L*J22L*PDstandardNth12gt13 + + J12L*J31L*PDstandardNth13gt13 + J11L*J32L*PDstandardNth13gt13 + + dJ112L*PDstandardNth1gt13 + J21L*J22L*PDstandardNth22gt13 + + J22L*J31L*PDstandardNth23gt13 + J21L*J32L*PDstandardNth23gt13 + + dJ212L*PDstandardNth2gt13 + J31L*J32L*PDstandardNth33gt13 + + dJ312L*PDstandardNth3gt13) + gtu31*(J11L*J13L*PDstandardNth11gt13 + + J13L*J21L*PDstandardNth12gt13 + J11L*J23L*PDstandardNth12gt13 + + J13L*J31L*PDstandardNth13gt13 + J11L*J33L*PDstandardNth13gt13 + + dJ113L*PDstandardNth1gt13 + J21L*J23L*PDstandardNth22gt13 + + J23L*J31L*PDstandardNth23gt13 + J21L*J33L*PDstandardNth23gt13 + + dJ213L*PDstandardNth2gt13 + J31L*J33L*PDstandardNth33gt13 + + dJ313L*PDstandardNth3gt13) + gtu32*(J12L*J13L*PDstandardNth11gt13 + + J13L*J22L*PDstandardNth12gt13 + J12L*J23L*PDstandardNth12gt13 + + J13L*J32L*PDstandardNth13gt13 + J12L*J33L*PDstandardNth13gt13 + + dJ123L*PDstandardNth1gt13 + J22L*J23L*PDstandardNth22gt13 + + J23L*J32L*PDstandardNth23gt13 + J22L*J33L*PDstandardNth23gt13 + + dJ223L*PDstandardNth2gt13 + J32L*J33L*PDstandardNth33gt13 + + dJ323L*PDstandardNth3gt13)) + (gt13L*J31L + + gt11L*J33L)*PDstandardNth3Xt1 + (gt23L*J31L + + gt12L*J33L)*PDstandardNth3Xt2 + (gt33L*J31L + + gt13L*J33L)*PDstandardNth3Xt3 + (Gtl113 + Gtl311)*Xtn1 + (Gtl123 + + Gtl312)*Xtn2 + (Gtl133 + Gtl313)*Xtn3 - + gtu11*(2*J11L*J21L*PDstandardNth12gt13 + + 2*J11L*J31L*PDstandardNth13gt13 + dJ111L*PDstandardNth1gt13 + + 2*J21L*J31L*PDstandardNth23gt13 + dJ211L*PDstandardNth2gt13 + + dJ311L*PDstandardNth3gt13 + PDstandardNth11gt13*SQR(J11L) + + PDstandardNth22gt13*SQR(J21L) + PDstandardNth33gt13*SQR(J31L)) - + gtu22*(2*J12L*J22L*PDstandardNth12gt13 + + 2*J12L*J32L*PDstandardNth13gt13 + dJ122L*PDstandardNth1gt13 + + 2*J22L*J32L*PDstandardNth23gt13 + dJ222L*PDstandardNth2gt13 + + dJ322L*PDstandardNth3gt13 + PDstandardNth11gt13*SQR(J12L) + + PDstandardNth22gt13*SQR(J22L) + PDstandardNth33gt13*SQR(J32L)) - + gtu33*(2*J13L*J23L*PDstandardNth12gt13 + + 2*J13L*J33L*PDstandardNth13gt13 + dJ133L*PDstandardNth1gt13 + + 2*J23L*J33L*PDstandardNth23gt13 + dJ233L*PDstandardNth2gt13 + + dJ333L*PDstandardNth3gt13 + PDstandardNth11gt13*SQR(J13L) + + PDstandardNth22gt13*SQR(J23L) + PDstandardNth33gt13*SQR(J33L))); + + CCTK_REAL Rt22 = Gt112*(Gtlu121 + 2*Gtlu211) + Gt122*(Gtlu122 + + 2*Gtlu212) + Gt123*(Gtlu123 + 2*Gtlu213) + 3*(Gt212*Gtlu221 + + Gt222*Gtlu222 + Gt223*Gtlu223) + 2*(Gt312*Gtlu231 + Gt322*Gtlu232 + + Gt323*Gtlu233) + Gt312*Gtlu321 + Gt322*Gtlu322 + Gt323*Gtlu323 + + J12L*(gt12L*PDstandardNth1Xt1 + gt22L*PDstandardNth1Xt2 + + gt23L*PDstandardNth1Xt3) + J22L*(gt12L*PDstandardNth2Xt1 + + gt22L*PDstandardNth2Xt2 + gt23L*PDstandardNth2Xt3) + + J32L*(gt12L*PDstandardNth3Xt1 + gt22L*PDstandardNth3Xt2 + + gt23L*PDstandardNth3Xt3) + Gtl212*Xtn1 + Gtl222*Xtn2 + Gtl223*Xtn3 + + 0.5*(-2*(gtu21*(J11L*J12L*PDstandardNth11gt22 + + J12L*J21L*PDstandardNth12gt22 + J11L*J22L*PDstandardNth12gt22 + + J12L*J31L*PDstandardNth13gt22 + J11L*J32L*PDstandardNth13gt22 + + dJ112L*PDstandardNth1gt22 + J21L*J22L*PDstandardNth22gt22 + + J22L*J31L*PDstandardNth23gt22 + J21L*J32L*PDstandardNth23gt22 + + dJ212L*PDstandardNth2gt22 + J31L*J32L*PDstandardNth33gt22 + + dJ312L*PDstandardNth3gt22) + gtu31*(J11L*J13L*PDstandardNth11gt22 + + J13L*J21L*PDstandardNth12gt22 + J11L*J23L*PDstandardNth12gt22 + + J13L*J31L*PDstandardNth13gt22 + J11L*J33L*PDstandardNth13gt22 + + dJ113L*PDstandardNth1gt22 + J21L*J23L*PDstandardNth22gt22 + + J23L*J31L*PDstandardNth23gt22 + J21L*J33L*PDstandardNth23gt22 + + dJ213L*PDstandardNth2gt22 + J31L*J33L*PDstandardNth33gt22 + + dJ313L*PDstandardNth3gt22) + gtu32*(J12L*J13L*PDstandardNth11gt22 + + J13L*J22L*PDstandardNth12gt22 + J12L*J23L*PDstandardNth12gt22 + + J13L*J32L*PDstandardNth13gt22 + J12L*J33L*PDstandardNth13gt22 + + dJ123L*PDstandardNth1gt22 + J22L*J23L*PDstandardNth22gt22 + + J23L*J32L*PDstandardNth23gt22 + J22L*J33L*PDstandardNth23gt22 + + dJ223L*PDstandardNth2gt22 + J32L*J33L*PDstandardNth33gt22 + + dJ323L*PDstandardNth3gt22)) - gtu11*(2*J11L*J21L*PDstandardNth12gt22 + + 2*J11L*J31L*PDstandardNth13gt22 + dJ111L*PDstandardNth1gt22 + + 2*J21L*J31L*PDstandardNth23gt22 + dJ211L*PDstandardNth2gt22 + + dJ311L*PDstandardNth3gt22 + PDstandardNth11gt22*SQR(J11L) + + PDstandardNth22gt22*SQR(J21L) + PDstandardNth33gt22*SQR(J31L)) - + gtu22*(2*J12L*J22L*PDstandardNth12gt22 + + 2*J12L*J32L*PDstandardNth13gt22 + dJ122L*PDstandardNth1gt22 + + 2*J22L*J32L*PDstandardNth23gt22 + dJ222L*PDstandardNth2gt22 + + dJ322L*PDstandardNth3gt22 + PDstandardNth11gt22*SQR(J12L) + + PDstandardNth22gt22*SQR(J22L) + PDstandardNth33gt22*SQR(J32L)) - + gtu33*(2*J13L*J23L*PDstandardNth12gt22 + + 2*J13L*J33L*PDstandardNth13gt22 + dJ133L*PDstandardNth1gt22 + + 2*J23L*J33L*PDstandardNth23gt22 + dJ233L*PDstandardNth2gt22 + + dJ333L*PDstandardNth3gt22 + PDstandardNth11gt22*SQR(J13L) + + PDstandardNth22gt22*SQR(J23L) + PDstandardNth33gt22*SQR(J33L))); + + CCTK_REAL Rt23 = Gt113*Gtlu211 + Gt133*Gtlu213 + Gt213*Gtlu221 + + Gt233*Gtlu223 + (Gt212 + Gt313)*Gtlu231 + (Gt222 + Gt323)*Gtlu232 + + Gt333*Gtlu233 + Gt112*(Gtlu131 + Gtlu311) + Gt122*(Gtlu132 + Gtlu312) + + Gt123*(Gtlu133 + Gtlu212 + Gtlu313) + Gt212*Gtlu321 + Gt222*Gtlu322 + + Gt223*(Gtlu222 + Gtlu233 + Gtlu323) + 2*(Gt312*Gtlu331 + Gt322*Gtlu332 + + Gt323*Gtlu333) + 0.5*((gt13L*J12L + gt12L*J13L)*PDstandardNth1Xt1 + + (gt23L*J12L + gt22L*J13L)*PDstandardNth1Xt2 + (gt33L*J12L + + gt23L*J13L)*PDstandardNth1Xt3 + (gt13L*J22L + + gt12L*J23L)*PDstandardNth2Xt1 + (gt23L*J22L + + gt22L*J23L)*PDstandardNth2Xt2 + (gt33L*J22L + + gt23L*J23L)*PDstandardNth2Xt3 - 2*(gtu21*(J11L*J12L*PDstandardNth11gt23 + + J12L*J21L*PDstandardNth12gt23 + J11L*J22L*PDstandardNth12gt23 + + J12L*J31L*PDstandardNth13gt23 + J11L*J32L*PDstandardNth13gt23 + + dJ112L*PDstandardNth1gt23 + J21L*J22L*PDstandardNth22gt23 + + J22L*J31L*PDstandardNth23gt23 + J21L*J32L*PDstandardNth23gt23 + + dJ212L*PDstandardNth2gt23 + J31L*J32L*PDstandardNth33gt23 + + dJ312L*PDstandardNth3gt23) + gtu31*(J11L*J13L*PDstandardNth11gt23 + + J13L*J21L*PDstandardNth12gt23 + J11L*J23L*PDstandardNth12gt23 + + J13L*J31L*PDstandardNth13gt23 + J11L*J33L*PDstandardNth13gt23 + + dJ113L*PDstandardNth1gt23 + J21L*J23L*PDstandardNth22gt23 + + J23L*J31L*PDstandardNth23gt23 + J21L*J33L*PDstandardNth23gt23 + + dJ213L*PDstandardNth2gt23 + J31L*J33L*PDstandardNth33gt23 + + dJ313L*PDstandardNth3gt23) + gtu32*(J12L*J13L*PDstandardNth11gt23 + + J13L*J22L*PDstandardNth12gt23 + J12L*J23L*PDstandardNth12gt23 + + J13L*J32L*PDstandardNth13gt23 + J12L*J33L*PDstandardNth13gt23 + + dJ123L*PDstandardNth1gt23 + J22L*J23L*PDstandardNth22gt23 + + J23L*J32L*PDstandardNth23gt23 + J22L*J33L*PDstandardNth23gt23 + + dJ223L*PDstandardNth2gt23 + J32L*J33L*PDstandardNth33gt23 + + dJ323L*PDstandardNth3gt23)) + (gt13L*J32L + + gt12L*J33L)*PDstandardNth3Xt1 + (gt23L*J32L + + gt22L*J33L)*PDstandardNth3Xt2 + (gt33L*J32L + + gt23L*J33L)*PDstandardNth3Xt3 + (Gtl213 + Gtl312)*Xtn1 + (Gtl223 + + Gtl322)*Xtn2 + (Gtl233 + Gtl323)*Xtn3 - + gtu11*(2*J11L*J21L*PDstandardNth12gt23 + + 2*J11L*J31L*PDstandardNth13gt23 + dJ111L*PDstandardNth1gt23 + + 2*J21L*J31L*PDstandardNth23gt23 + dJ211L*PDstandardNth2gt23 + + dJ311L*PDstandardNth3gt23 + PDstandardNth11gt23*SQR(J11L) + + PDstandardNth22gt23*SQR(J21L) + PDstandardNth33gt23*SQR(J31L)) - + gtu22*(2*J12L*J22L*PDstandardNth12gt23 + + 2*J12L*J32L*PDstandardNth13gt23 + dJ122L*PDstandardNth1gt23 + + 2*J22L*J32L*PDstandardNth23gt23 + dJ222L*PDstandardNth2gt23 + + dJ322L*PDstandardNth3gt23 + PDstandardNth11gt23*SQR(J12L) + + PDstandardNth22gt23*SQR(J22L) + PDstandardNth33gt23*SQR(J32L)) - + gtu33*(2*J13L*J23L*PDstandardNth12gt23 + + 2*J13L*J33L*PDstandardNth13gt23 + dJ133L*PDstandardNth1gt23 + + 2*J23L*J33L*PDstandardNth23gt23 + dJ233L*PDstandardNth2gt23 + + dJ333L*PDstandardNth3gt23 + PDstandardNth11gt23*SQR(J13L) + + PDstandardNth22gt23*SQR(J23L) + PDstandardNth33gt23*SQR(J33L))); + + CCTK_REAL Rt33 = Gt113*(Gtlu131 + 2*Gtlu311) + Gt123*(Gtlu132 + + 2*Gtlu312) + Gt133*(Gtlu133 + 2*Gtlu313) + Gt213*(Gtlu231 + 2*Gtlu321) + + Gt223*(Gtlu232 + 2*Gtlu322) + Gt233*(Gtlu233 + 2*Gtlu323) + + 3*(Gt313*Gtlu331 + Gt323*Gtlu332 + Gt333*Gtlu333) + + J13L*(gt13L*PDstandardNth1Xt1 + gt23L*PDstandardNth1Xt2 + + gt33L*PDstandardNth1Xt3) + J23L*(gt13L*PDstandardNth2Xt1 + + gt23L*PDstandardNth2Xt2 + gt33L*PDstandardNth2Xt3) + + J33L*(gt13L*PDstandardNth3Xt1 + gt23L*PDstandardNth3Xt2 + + gt33L*PDstandardNth3Xt3) + Gtl313*Xtn1 + Gtl323*Xtn2 + Gtl333*Xtn3 + + 0.5*(-2*(gtu21*(J11L*J12L*PDstandardNth11gt33 + + J12L*J21L*PDstandardNth12gt33 + J11L*J22L*PDstandardNth12gt33 + + J12L*J31L*PDstandardNth13gt33 + J11L*J32L*PDstandardNth13gt33 + + dJ112L*PDstandardNth1gt33 + J21L*J22L*PDstandardNth22gt33 + + J22L*J31L*PDstandardNth23gt33 + J21L*J32L*PDstandardNth23gt33 + + dJ212L*PDstandardNth2gt33 + J31L*J32L*PDstandardNth33gt33 + + dJ312L*PDstandardNth3gt33) + gtu31*(J11L*J13L*PDstandardNth11gt33 + + J13L*J21L*PDstandardNth12gt33 + J11L*J23L*PDstandardNth12gt33 + + J13L*J31L*PDstandardNth13gt33 + J11L*J33L*PDstandardNth13gt33 + + dJ113L*PDstandardNth1gt33 + J21L*J23L*PDstandardNth22gt33 + + J23L*J31L*PDstandardNth23gt33 + J21L*J33L*PDstandardNth23gt33 + + dJ213L*PDstandardNth2gt33 + J31L*J33L*PDstandardNth33gt33 + + dJ313L*PDstandardNth3gt33) + gtu32*(J12L*J13L*PDstandardNth11gt33 + + J13L*J22L*PDstandardNth12gt33 + J12L*J23L*PDstandardNth12gt33 + + J13L*J32L*PDstandardNth13gt33 + J12L*J33L*PDstandardNth13gt33 + + dJ123L*PDstandardNth1gt33 + J22L*J23L*PDstandardNth22gt33 + + J23L*J32L*PDstandardNth23gt33 + J22L*J33L*PDstandardNth23gt33 + + dJ223L*PDstandardNth2gt33 + J32L*J33L*PDstandardNth33gt33 + + dJ323L*PDstandardNth3gt33)) - gtu11*(2*J11L*J21L*PDstandardNth12gt33 + + 2*J11L*J31L*PDstandardNth13gt33 + dJ111L*PDstandardNth1gt33 + + 2*J21L*J31L*PDstandardNth23gt33 + dJ211L*PDstandardNth2gt33 + + dJ311L*PDstandardNth3gt33 + PDstandardNth11gt33*SQR(J11L) + + PDstandardNth22gt33*SQR(J21L) + PDstandardNth33gt33*SQR(J31L)) - + gtu22*(2*J12L*J22L*PDstandardNth12gt33 + + 2*J12L*J32L*PDstandardNth13gt33 + dJ122L*PDstandardNth1gt33 + + 2*J22L*J32L*PDstandardNth23gt33 + dJ222L*PDstandardNth2gt33 + + dJ322L*PDstandardNth3gt33 + PDstandardNth11gt33*SQR(J12L) + + PDstandardNth22gt33*SQR(J22L) + PDstandardNth33gt33*SQR(J32L)) - + gtu33*(2*J13L*J23L*PDstandardNth12gt33 + + 2*J13L*J33L*PDstandardNth13gt33 + dJ133L*PDstandardNth1gt33 + + 2*J23L*J33L*PDstandardNth23gt33 + dJ233L*PDstandardNth2gt33 + + dJ333L*PDstandardNth3gt33 + PDstandardNth11gt33*SQR(J13L) + + PDstandardNth22gt33*SQR(J23L) + PDstandardNth33gt33*SQR(J33L))); + + CCTK_REAL trRt = gtu11*Rt11 + gtu22*Rt22 + 2*(gtu21*Rt12 + gtu31*Rt13 + + gtu32*Rt23) + gtu33*Rt33; + + CCTK_REAL ephi = + IfThen(ToReal(conformalMethod),INV(sqrt(phiL)),exp(phiL)); + + CCTK_REAL Atm11 = At11L*gtu11 + At12L*gtu21 + At13L*gtu31; + + CCTK_REAL Atm21 = At11L*gtu21 + At12L*gtu22 + At13L*gtu32; + + CCTK_REAL Atm31 = At11L*gtu31 + At12L*gtu32 + At13L*gtu33; + + CCTK_REAL Atm12 = At12L*gtu11 + At22L*gtu21 + At23L*gtu31; + + CCTK_REAL Atm22 = At12L*gtu21 + At22L*gtu22 + At23L*gtu32; + + CCTK_REAL Atm32 = At12L*gtu31 + At22L*gtu32 + At23L*gtu33; + + CCTK_REAL Atm13 = At13L*gtu11 + At23L*gtu21 + At33L*gtu31; + + CCTK_REAL Atm23 = At13L*gtu21 + At23L*gtu22 + At33L*gtu32; + + CCTK_REAL Atm33 = At13L*gtu31 + At23L*gtu32 + At33L*gtu33; + + CCTK_REAL rho = INV(SQR(alphaL))*(eTttL - 2*(beta2L*eTtyL + + beta3L*eTtzL) + 2*(beta1L*(-eTtxL + beta2L*eTxyL + beta3L*eTxzL) + + beta2L*beta3L*eTyzL) + eTxxL*SQR(beta1L) + eTyyL*SQR(beta2L) + + eTzzL*SQR(beta3L)); + + CCTK_REAL S1 = (-eTtxL + beta1L*eTxxL + beta2L*eTxyL + + beta3L*eTxzL)*INV(alphaL); + + CCTK_REAL S2 = (-eTtyL + beta1L*eTxyL + beta2L*eTyyL + + beta3L*eTyzL)*INV(alphaL); + + CCTK_REAL S3 = (-eTtzL + beta1L*eTxzL + beta2L*eTyzL + + beta3L*eTzzL)*INV(alphaL); + + CCTK_REAL MadmL = + 0.01989436788648691697111047042156429525431*(-((Gt111*Gtlu111 + + Gt112*Gtlu112 + Gt113*Gtlu113 + Gt211*Gtlu121 + Gt212*Gtlu122 + + Gt213*Gtlu123 + Gt311*Gtlu131 + Gt312*Gtlu132 + Gt313*Gtlu133)*gtu11) + + (-(Gt122*Gtlu112) - Gt123*Gtlu113 - Gt222*Gtlu122 - Gt223*Gtlu123 - + Gt322*Gtlu132 - Gt323*Gtlu133 - Gt111*Gtlu211 + Gt112*(-Gtlu111 - + Gtlu212) - Gt113*Gtlu213 - Gt211*Gtlu221 + Gt212*(-Gtlu121 - Gtlu222) - + Gt213*Gtlu223 - Gt311*Gtlu231 + Gt312*(-Gtlu131 - Gtlu232) - + Gt313*Gtlu233)*gtu21 - (Gt112*Gtlu211 + Gt122*Gtlu212 + Gt123*Gtlu213 + + Gt212*Gtlu221 + Gt222*Gtlu222 + Gt223*Gtlu223 + Gt312*Gtlu231 + + Gt322*Gtlu232 + Gt323*Gtlu233)*gtu22 + (-(Gt123*Gtlu112) - + Gt133*Gtlu113 - Gt223*Gtlu122 - Gt233*Gtlu123 - Gt323*Gtlu132 - + Gt333*Gtlu133 - Gt111*Gtlu311 - Gt112*Gtlu312 + Gt113*(-Gtlu111 - + Gtlu313) - Gt211*Gtlu321 - Gt212*Gtlu322 + Gt213*(-Gtlu121 - Gtlu323) - + Gt311*Gtlu331 - Gt312*Gtlu332 + Gt313*(-Gtlu131 - Gtlu333))*gtu31 + + (-(Gt113*Gtlu211) - Gt133*Gtlu213 - Gt213*Gtlu221 - Gt233*Gtlu223 - + Gt313*Gtlu231 - Gt333*Gtlu233 - Gt112*Gtlu311 - Gt122*Gtlu312 + + Gt123*(-Gtlu212 - Gtlu313) - Gt212*Gtlu321 - Gt222*Gtlu322 + + Gt223*(-Gtlu222 - Gtlu323) - Gt312*Gtlu331 - Gt322*Gtlu332 + + Gt323*(-Gtlu232 - Gtlu333))*gtu32 - (Gt113*Gtlu311 + Gt123*Gtlu312 + + Gt133*Gtlu313 + Gt213*Gtlu321 + Gt223*Gtlu322 + Gt233*Gtlu323 + + Gt313*Gtlu331 + Gt323*Gtlu332 + Gt333*Gtlu333)*gtu33 + trRt - ephi*trRt + + pow(ephi,5)*(2*Atm12*Atm21 + 2.*Atm13*Atm31 + 2.*Atm23*Atm32 + + 50.26548245743669181540229413247204614715*rho + SQR(Atm11) + SQR(Atm22) + + SQR(Atm33) - 0.6666666666666666666666666666666666666667*SQR(trKL))); + + CCTK_REAL Jadm1L = + 0.01989436788648691697111047042156429525431*(2*Atm23 - 2*Atm32 + + (-(At11L*dgtu113) - 2*At12L*dgtu213 - At22L*dgtu223 - 2*At13L*dgtu313 - + 2*At23L*dgtu323 - At33L*dgtu333 + + 1.33333333333333333333333333333*(J13L*PDstandardNth1trK + + J23L*PDstandardNth2trK + J33L*PDstandardNth3trK) + + 50.26548245743669181540229413247204614715*S3)*yL + (At11L*dgtu112 + + At22L*dgtu222 + 2*(At12L*dgtu212 + At13L*dgtu312 + At23L*dgtu322) + + At33L*dgtu332 - 1.33333333333333333333333333333*(J12L*PDstandardNth1trK + + J22L*PDstandardNth2trK + J32L*PDstandardNth3trK) - + 50.26548245743669181540229413247204614715*S2)*zL)*pow(ephi,6); + + CCTK_REAL Jadm2L = + 0.01989436788648691697111047042156429525431*(-2*Atm13 + 2*Atm31 + + (At11L*dgtu113 + At22L*dgtu223 + 2*(At12L*dgtu213 + At13L*dgtu313 + + At23L*dgtu323) + At33L*dgtu333 - + 1.33333333333333333333333333333*(J13L*PDstandardNth1trK + + J23L*PDstandardNth2trK + J33L*PDstandardNth3trK) - + 50.26548245743669181540229413247204614715*S3)*xL + (-(At11L*dgtu111) - + 2*At12L*dgtu211 - At22L*dgtu221 - 2*At13L*dgtu311 - 2*At23L*dgtu321 - + At33L*dgtu331 + 1.33333333333333333333333333333*(J11L*PDstandardNth1trK + + J21L*PDstandardNth2trK + J31L*PDstandardNth3trK) + + 50.26548245743669181540229413247204614715*S1)*zL)*pow(ephi,6); + + CCTK_REAL Jadm3L = + 0.01989436788648691697111047042156429525431*(2*Atm12 - 2*Atm21 + + (-(At11L*dgtu112) - 2*At12L*dgtu212 - At22L*dgtu222 - 2*At13L*dgtu312 - + 2*At23L*dgtu322 - At33L*dgtu332 + + 1.33333333333333333333333333333*(J12L*PDstandardNth1trK + + J22L*PDstandardNth2trK + J32L*PDstandardNth3trK) + + 50.26548245743669181540229413247204614715*S2)*xL + (At11L*dgtu111 + + At22L*dgtu221 + 2*(At12L*dgtu211 + At13L*dgtu311 + At23L*dgtu321) + + At33L*dgtu331 - 1.33333333333333333333333333333*(J11L*PDstandardNth1trK + + J21L*PDstandardNth2trK + J31L*PDstandardNth3trK) - + 50.26548245743669181540229413247204614715*S1)*yL)*pow(ephi,6); + + + /* Copy local copies back to grid functions */ + Jadm1[index] = Jadm1L; + Jadm2[index] = Jadm2L; + Jadm3[index] = Jadm3L; + Madm[index] = MadmL; + } + LC_ENDLOOP3 (ML_ADMQuantities_MP); +} + +extern "C" void ML_ADMQuantities_MP(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverInterior(cctkGH, &ML_ADMQuantities_MP_Body); +} diff --git a/ML_ADMQuantities_MP/src/RegisterMoL.cc b/ML_ADMQuantities_MP/src/RegisterMoL.cc new file mode 100644 index 0000000..0a2771a --- /dev/null +++ b/ML_ADMQuantities_MP/src/RegisterMoL.cc @@ -0,0 +1,16 @@ +/* File produced by Kranc */ + +#include "cctk.h" +#include "cctk_Arguments.h" +#include "cctk_Parameters.h" + +extern "C" void ML_ADMQuantities_MP_RegisterVars(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT ierr = 0; + + /* Register all the evolved grid functions with MoL */ + return; +} diff --git a/ML_ADMQuantities_MP/src/RegisterSymmetries.cc b/ML_ADMQuantities_MP/src/RegisterSymmetries.cc new file mode 100644 index 0000000..6837434 --- /dev/null +++ b/ML_ADMQuantities_MP/src/RegisterSymmetries.cc @@ -0,0 +1,39 @@ +/* File produced by Kranc */ + +#include "cctk.h" +#include "cctk_Arguments.h" +#include "cctk_Parameters.h" +#include "Symmetry.h" + +extern "C" void ML_ADMQuantities_MP_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_ADMQuantities_MP::Jadm1"); + + sym[0] = 1; + sym[1] = -1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_ADMQuantities_MP::Jadm2"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = -1; + SetCartSymVN(cctkGH, sym, "ML_ADMQuantities_MP::Jadm3"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_ADMQuantities_MP::Madm"); + +} diff --git a/ML_ADMQuantities_MP/src/Startup.cc b/ML_ADMQuantities_MP/src/Startup.cc new file mode 100644 index 0000000..71dec85 --- /dev/null +++ b/ML_ADMQuantities_MP/src/Startup.cc @@ -0,0 +1,10 @@ +/* File produced by Kranc */ + +#include "cctk.h" + +extern "C" int ML_ADMQuantities_MP_Startup(void) +{ + const char * banner = "ML_ADMQuantities_MP"; + CCTK_RegisterBanner(banner); + return 0; +} diff --git a/ML_ADMQuantities_O2/src/Boundaries.cc b/ML_ADMQuantities_O2/src/Boundaries.cc new file mode 100644 index 0000000..ad69ba6 --- /dev/null +++ b/ML_ADMQuantities_O2/src/Boundaries.cc @@ -0,0 +1,41 @@ +/* File produced by Kranc */ + +#include "cctk.h" +#include "cctk_Arguments.h" +#include "cctk_Parameters.h" +#include "cctk_Faces.h" +#include "util_Table.h" +#include "Symmetry.h" + + +/* the boundary treatment is split into 3 steps: */ +/* 1. excision */ +/* 2. symmetries */ +/* 3. "other" boundary conditions, e.g. radiative */ + +/* to simplify scheduling and testing, the 3 steps */ +/* are currently applied in separate functions */ + + +extern "C" void ML_ADMQuantities_O2_CheckBoundaries(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + return; +} + +extern "C" void ML_ADMQuantities_O2_SelectBoundConds(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT ierr = 0; + return; +} + + + +/* template for entries in parameter file: +*/ + diff --git a/ML_ADMQuantities_O2/src/ML_ADMQuantities_O2.cc b/ML_ADMQuantities_O2/src/ML_ADMQuantities_O2.cc new file mode 100644 index 0000000..40ed7d2 --- /dev/null +++ b/ML_ADMQuantities_O2/src/ML_ADMQuantities_O2.cc @@ -0,0 +1,648 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +extern "C" void ML_ADMQuantities_O2_SelectBCs(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT ierr = 0; + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_ADMQuantities_O2::ML_Jadm","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_ADMQuantities_O2::ML_Jadm."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_ADMQuantities_O2::ML_Madm","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_ADMQuantities_O2::ML_Madm."); + return; +} + +static void ML_ADMQuantities_O2_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_ADMQuantities_O2_Body"); + } + + if (cctk_iteration % ML_ADMQuantities_O2_calc_every != ML_ADMQuantities_O2_calc_offset) + { + return; + } + + const char *groups[] = {"grid::coordinates","Grid::coordinates","McLachlan::ML_curv","McLachlan::ML_Gamma","McLachlan::ML_lapse","McLachlan::ML_log_confac","McLachlan::ML_metric","McLachlan::ML_shift","McLachlan::ML_trace_curv","ML_ADMQuantities_O2::ML_Jadm","ML_ADMQuantities_O2::ML_Madm"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_ADMQuantities_O2", 11, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o2dx = 0.5*INV(dx); + CCTK_REAL const p1o2dy = 0.5*INV(dy); + CCTK_REAL const p1o2dz = 0.5*INV(dz); + CCTK_REAL const p1o4dxdy = 0.25*INV(dx)*INV(dy); + CCTK_REAL const p1o4dxdz = 0.25*INV(dx)*INV(dz); + CCTK_REAL const p1o4dydz = 0.25*INV(dy)*INV(dz); + CCTK_REAL const p1odx = INV(dx); + CCTK_REAL const p1odx2 = INV(SQR(dx)); + CCTK_REAL const p1ody = INV(dy); + CCTK_REAL const p1ody2 = INV(SQR(dy)); + CCTK_REAL const p1odz = INV(dz); + CCTK_REAL const p1odz2 = INV(SQR(dz)); + CCTK_REAL const pm1o2dx = -0.5*INV(dx); + CCTK_REAL const pm1o2dy = -0.5*INV(dy); + CCTK_REAL const pm1o2dz = -0.5*INV(dz); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_ADMQuantities_O2, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + CCTK_REAL alphaL = alpha[index]; + CCTK_REAL At11L = At11[index]; + CCTK_REAL At12L = At12[index]; + CCTK_REAL At13L = At13[index]; + CCTK_REAL At22L = At22[index]; + CCTK_REAL At23L = At23[index]; + CCTK_REAL At33L = At33[index]; + CCTK_REAL beta1L = beta1[index]; + CCTK_REAL beta2L = beta2[index]; + CCTK_REAL beta3L = beta3[index]; + CCTK_REAL eTttL = (*stress_energy_state) ? eTtt[index] : ToReal(0.0); + CCTK_REAL eTtxL = (*stress_energy_state) ? eTtx[index] : ToReal(0.0); + CCTK_REAL eTtyL = (*stress_energy_state) ? eTty[index] : ToReal(0.0); + CCTK_REAL eTtzL = (*stress_energy_state) ? eTtz[index] : ToReal(0.0); + CCTK_REAL eTxxL = (*stress_energy_state) ? eTxx[index] : ToReal(0.0); + CCTK_REAL eTxyL = (*stress_energy_state) ? eTxy[index] : ToReal(0.0); + CCTK_REAL eTxzL = (*stress_energy_state) ? eTxz[index] : ToReal(0.0); + CCTK_REAL eTyyL = (*stress_energy_state) ? eTyy[index] : ToReal(0.0); + CCTK_REAL eTyzL = (*stress_energy_state) ? eTyz[index] : ToReal(0.0); + CCTK_REAL eTzzL = (*stress_energy_state) ? eTzz[index] : ToReal(0.0); + CCTK_REAL gt11L = gt11[index]; + CCTK_REAL gt12L = gt12[index]; + CCTK_REAL gt13L = gt13[index]; + CCTK_REAL gt22L = gt22[index]; + CCTK_REAL gt23L = gt23[index]; + CCTK_REAL gt33L = gt33[index]; + CCTK_REAL phiL = phi[index]; + CCTK_REAL trKL = trK[index]; + CCTK_REAL xL = x[index]; + CCTK_REAL Xt1L = Xt1[index]; + CCTK_REAL Xt2L = Xt2[index]; + CCTK_REAL Xt3L = Xt3[index]; + CCTK_REAL yL = y[index]; + CCTK_REAL zL = z[index]; + + /* Include user supplied include files */ + + /* Precompute derivatives */ + CCTK_REAL const PDstandardNth1gt11 = PDstandardNth1(>11[index]); + CCTK_REAL const PDstandardNth2gt11 = PDstandardNth2(>11[index]); + CCTK_REAL const PDstandardNth3gt11 = PDstandardNth3(>11[index]); + CCTK_REAL const PDstandardNth11gt11 = PDstandardNth11(>11[index]); + CCTK_REAL const PDstandardNth22gt11 = PDstandardNth22(>11[index]); + CCTK_REAL const PDstandardNth33gt11 = PDstandardNth33(>11[index]); + CCTK_REAL const PDstandardNth12gt11 = PDstandardNth12(>11[index]); + CCTK_REAL const PDstandardNth13gt11 = PDstandardNth13(>11[index]); + CCTK_REAL const PDstandardNth23gt11 = PDstandardNth23(>11[index]); + CCTK_REAL const PDstandardNth1gt12 = PDstandardNth1(>12[index]); + CCTK_REAL const PDstandardNth2gt12 = PDstandardNth2(>12[index]); + CCTK_REAL const PDstandardNth3gt12 = PDstandardNth3(>12[index]); + CCTK_REAL const PDstandardNth11gt12 = PDstandardNth11(>12[index]); + CCTK_REAL const PDstandardNth22gt12 = PDstandardNth22(>12[index]); + CCTK_REAL const PDstandardNth33gt12 = PDstandardNth33(>12[index]); + CCTK_REAL const PDstandardNth12gt12 = PDstandardNth12(>12[index]); + CCTK_REAL const PDstandardNth13gt12 = PDstandardNth13(>12[index]); + CCTK_REAL const PDstandardNth23gt12 = PDstandardNth23(>12[index]); + CCTK_REAL const PDstandardNth1gt13 = PDstandardNth1(>13[index]); + CCTK_REAL const PDstandardNth2gt13 = PDstandardNth2(>13[index]); + CCTK_REAL const PDstandardNth3gt13 = PDstandardNth3(>13[index]); + CCTK_REAL const PDstandardNth11gt13 = PDstandardNth11(>13[index]); + CCTK_REAL const PDstandardNth22gt13 = PDstandardNth22(>13[index]); + CCTK_REAL const PDstandardNth33gt13 = PDstandardNth33(>13[index]); + CCTK_REAL const PDstandardNth12gt13 = PDstandardNth12(>13[index]); + CCTK_REAL const PDstandardNth13gt13 = PDstandardNth13(>13[index]); + CCTK_REAL const PDstandardNth23gt13 = PDstandardNth23(>13[index]); + CCTK_REAL const PDstandardNth1gt22 = PDstandardNth1(>22[index]); + CCTK_REAL const PDstandardNth2gt22 = PDstandardNth2(>22[index]); + CCTK_REAL const PDstandardNth3gt22 = PDstandardNth3(>22[index]); + CCTK_REAL const PDstandardNth11gt22 = PDstandardNth11(>22[index]); + CCTK_REAL const PDstandardNth22gt22 = PDstandardNth22(>22[index]); + CCTK_REAL const PDstandardNth33gt22 = PDstandardNth33(>22[index]); + CCTK_REAL const PDstandardNth12gt22 = PDstandardNth12(>22[index]); + CCTK_REAL const PDstandardNth13gt22 = PDstandardNth13(>22[index]); + CCTK_REAL const PDstandardNth23gt22 = PDstandardNth23(>22[index]); + CCTK_REAL const PDstandardNth1gt23 = PDstandardNth1(>23[index]); + CCTK_REAL const PDstandardNth2gt23 = PDstandardNth2(>23[index]); + CCTK_REAL const PDstandardNth3gt23 = PDstandardNth3(>23[index]); + CCTK_REAL const PDstandardNth11gt23 = PDstandardNth11(>23[index]); + CCTK_REAL const PDstandardNth22gt23 = PDstandardNth22(>23[index]); + CCTK_REAL const PDstandardNth33gt23 = PDstandardNth33(>23[index]); + CCTK_REAL const PDstandardNth12gt23 = PDstandardNth12(>23[index]); + CCTK_REAL const PDstandardNth13gt23 = PDstandardNth13(>23[index]); + CCTK_REAL const PDstandardNth23gt23 = PDstandardNth23(>23[index]); + CCTK_REAL const PDstandardNth1gt33 = PDstandardNth1(>33[index]); + CCTK_REAL const PDstandardNth2gt33 = PDstandardNth2(>33[index]); + CCTK_REAL const PDstandardNth3gt33 = PDstandardNth3(>33[index]); + CCTK_REAL const PDstandardNth11gt33 = PDstandardNth11(>33[index]); + CCTK_REAL const PDstandardNth22gt33 = PDstandardNth22(>33[index]); + CCTK_REAL const PDstandardNth33gt33 = PDstandardNth33(>33[index]); + CCTK_REAL const PDstandardNth12gt33 = PDstandardNth12(>33[index]); + CCTK_REAL const PDstandardNth13gt33 = PDstandardNth13(>33[index]); + CCTK_REAL const PDstandardNth23gt33 = PDstandardNth23(>33[index]); + CCTK_REAL const PDstandardNth1trK = PDstandardNth1(&trK[index]); + CCTK_REAL const PDstandardNth2trK = PDstandardNth2(&trK[index]); + CCTK_REAL const PDstandardNth3trK = PDstandardNth3(&trK[index]); + CCTK_REAL const PDstandardNth1Xt1 = PDstandardNth1(&Xt1[index]); + CCTK_REAL const PDstandardNth2Xt1 = PDstandardNth2(&Xt1[index]); + CCTK_REAL const PDstandardNth3Xt1 = PDstandardNth3(&Xt1[index]); + CCTK_REAL const PDstandardNth1Xt2 = PDstandardNth1(&Xt2[index]); + CCTK_REAL const PDstandardNth2Xt2 = PDstandardNth2(&Xt2[index]); + CCTK_REAL const PDstandardNth3Xt2 = PDstandardNth3(&Xt2[index]); + CCTK_REAL const PDstandardNth1Xt3 = PDstandardNth1(&Xt3[index]); + CCTK_REAL const PDstandardNth2Xt3 = PDstandardNth2(&Xt3[index]); + CCTK_REAL const PDstandardNth3Xt3 = PDstandardNth3(&Xt3[index]); + + /* Calculate temporaries and grid functions */ + CCTK_REAL detgt = 1; + + CCTK_REAL gtu11 = INV(detgt)*(gt22L*gt33L - SQR(gt23L)); + + CCTK_REAL gtu21 = (gt13L*gt23L - gt12L*gt33L)*INV(detgt); + + CCTK_REAL gtu31 = (-(gt13L*gt22L) + gt12L*gt23L)*INV(detgt); + + CCTK_REAL gtu22 = INV(detgt)*(gt11L*gt33L - SQR(gt13L)); + + CCTK_REAL gtu32 = (gt12L*gt13L - gt11L*gt23L)*INV(detgt); + + CCTK_REAL gtu33 = INV(detgt)*(gt11L*gt22L - SQR(gt12L)); + + CCTK_REAL dgtu111 = -2*(gtu11*gtu21*PDstandardNth1gt12 + + gtu11*gtu31*PDstandardNth1gt13 + gtu21*gtu31*PDstandardNth1gt23) - + PDstandardNth1gt11*SQR(gtu11) - PDstandardNth1gt22*SQR(gtu21) - + PDstandardNth1gt33*SQR(gtu31); + + CCTK_REAL dgtu211 = gtu21*(-(gtu11*PDstandardNth1gt11) - + gtu31*PDstandardNth1gt13 - gtu22*PDstandardNth1gt22) + + gtu32*(-(gtu11*PDstandardNth1gt13) - gtu21*PDstandardNth1gt23) + + gtu31*(-(gtu22*PDstandardNth1gt23) - gtu32*PDstandardNth1gt33) - + PDstandardNth1gt12*(gtu11*gtu22 + SQR(gtu21)); + + CCTK_REAL dgtu311 = -((gtu21*gtu31 + gtu11*gtu32)*PDstandardNth1gt12) + + gtu11*(-(gtu31*PDstandardNth1gt11) - gtu33*PDstandardNth1gt13) + + gtu32*(-(gtu21*PDstandardNth1gt22) - gtu31*PDstandardNth1gt23) + + gtu33*(-(gtu21*PDstandardNth1gt23) - gtu31*PDstandardNth1gt33) - + PDstandardNth1gt13*SQR(gtu31); + + CCTK_REAL dgtu221 = -2*(gtu21*gtu22*PDstandardNth1gt12 + + gtu21*gtu32*PDstandardNth1gt13 + gtu22*gtu32*PDstandardNth1gt23) - + PDstandardNth1gt11*SQR(gtu21) - PDstandardNth1gt22*SQR(gtu22) - + PDstandardNth1gt33*SQR(gtu32); + + CCTK_REAL dgtu321 = -((gtu22*gtu31 + gtu21*gtu32)*PDstandardNth1gt12) + + gtu31*(-(gtu21*PDstandardNth1gt11) - gtu32*PDstandardNth1gt13) + + gtu33*(-(gtu21*PDstandardNth1gt13) - gtu22*PDstandardNth1gt23) + + gtu32*(-(gtu22*PDstandardNth1gt22) - gtu33*PDstandardNth1gt33) - + PDstandardNth1gt23*SQR(gtu32); + + CCTK_REAL dgtu331 = -2*(gtu31*gtu32*PDstandardNth1gt12 + + gtu31*gtu33*PDstandardNth1gt13 + gtu32*gtu33*PDstandardNth1gt23) - + PDstandardNth1gt11*SQR(gtu31) - PDstandardNth1gt22*SQR(gtu32) - + PDstandardNth1gt33*SQR(gtu33); + + CCTK_REAL dgtu112 = -2*(gtu11*gtu21*PDstandardNth2gt12 + + gtu11*gtu31*PDstandardNth2gt13 + gtu21*gtu31*PDstandardNth2gt23) - + PDstandardNth2gt11*SQR(gtu11) - PDstandardNth2gt22*SQR(gtu21) - + PDstandardNth2gt33*SQR(gtu31); + + CCTK_REAL dgtu212 = gtu21*(-(gtu11*PDstandardNth2gt11) - + gtu31*PDstandardNth2gt13 - gtu22*PDstandardNth2gt22) + + gtu32*(-(gtu11*PDstandardNth2gt13) - gtu21*PDstandardNth2gt23) + + gtu31*(-(gtu22*PDstandardNth2gt23) - gtu32*PDstandardNth2gt33) - + PDstandardNth2gt12*(gtu11*gtu22 + SQR(gtu21)); + + CCTK_REAL dgtu312 = -((gtu21*gtu31 + gtu11*gtu32)*PDstandardNth2gt12) + + gtu11*(-(gtu31*PDstandardNth2gt11) - gtu33*PDstandardNth2gt13) + + gtu32*(-(gtu21*PDstandardNth2gt22) - gtu31*PDstandardNth2gt23) + + gtu33*(-(gtu21*PDstandardNth2gt23) - gtu31*PDstandardNth2gt33) - + PDstandardNth2gt13*SQR(gtu31); + + CCTK_REAL dgtu222 = -2*(gtu21*gtu22*PDstandardNth2gt12 + + gtu21*gtu32*PDstandardNth2gt13 + gtu22*gtu32*PDstandardNth2gt23) - + PDstandardNth2gt11*SQR(gtu21) - PDstandardNth2gt22*SQR(gtu22) - + PDstandardNth2gt33*SQR(gtu32); + + CCTK_REAL dgtu322 = -((gtu22*gtu31 + gtu21*gtu32)*PDstandardNth2gt12) + + gtu31*(-(gtu21*PDstandardNth2gt11) - gtu32*PDstandardNth2gt13) + + gtu33*(-(gtu21*PDstandardNth2gt13) - gtu22*PDstandardNth2gt23) + + gtu32*(-(gtu22*PDstandardNth2gt22) - gtu33*PDstandardNth2gt33) - + PDstandardNth2gt23*SQR(gtu32); + + CCTK_REAL dgtu332 = -2*(gtu31*gtu32*PDstandardNth2gt12 + + gtu31*gtu33*PDstandardNth2gt13 + gtu32*gtu33*PDstandardNth2gt23) - + PDstandardNth2gt11*SQR(gtu31) - PDstandardNth2gt22*SQR(gtu32) - + PDstandardNth2gt33*SQR(gtu33); + + CCTK_REAL dgtu113 = -2*(gtu11*gtu21*PDstandardNth3gt12 + + gtu11*gtu31*PDstandardNth3gt13 + gtu21*gtu31*PDstandardNth3gt23) - + PDstandardNth3gt11*SQR(gtu11) - PDstandardNth3gt22*SQR(gtu21) - + PDstandardNth3gt33*SQR(gtu31); + + CCTK_REAL dgtu213 = gtu21*(-(gtu11*PDstandardNth3gt11) - + gtu31*PDstandardNth3gt13 - gtu22*PDstandardNth3gt22) + + gtu32*(-(gtu11*PDstandardNth3gt13) - gtu21*PDstandardNth3gt23) + + gtu31*(-(gtu22*PDstandardNth3gt23) - gtu32*PDstandardNth3gt33) - + PDstandardNth3gt12*(gtu11*gtu22 + SQR(gtu21)); + + CCTK_REAL dgtu313 = -((gtu21*gtu31 + gtu11*gtu32)*PDstandardNth3gt12) + + gtu11*(-(gtu31*PDstandardNth3gt11) - gtu33*PDstandardNth3gt13) + + gtu32*(-(gtu21*PDstandardNth3gt22) - gtu31*PDstandardNth3gt23) + + gtu33*(-(gtu21*PDstandardNth3gt23) - gtu31*PDstandardNth3gt33) - + PDstandardNth3gt13*SQR(gtu31); + + CCTK_REAL dgtu223 = -2*(gtu21*gtu22*PDstandardNth3gt12 + + gtu21*gtu32*PDstandardNth3gt13 + gtu22*gtu32*PDstandardNth3gt23) - + PDstandardNth3gt11*SQR(gtu21) - PDstandardNth3gt22*SQR(gtu22) - + PDstandardNth3gt33*SQR(gtu32); + + CCTK_REAL dgtu323 = -((gtu22*gtu31 + gtu21*gtu32)*PDstandardNth3gt12) + + gtu31*(-(gtu21*PDstandardNth3gt11) - gtu32*PDstandardNth3gt13) + + gtu33*(-(gtu21*PDstandardNth3gt13) - gtu22*PDstandardNth3gt23) + + gtu32*(-(gtu22*PDstandardNth3gt22) - gtu33*PDstandardNth3gt33) - + PDstandardNth3gt23*SQR(gtu32); + + CCTK_REAL dgtu333 = -2*(gtu31*gtu32*PDstandardNth3gt12 + + gtu31*gtu33*PDstandardNth3gt13 + gtu32*gtu33*PDstandardNth3gt23) - + PDstandardNth3gt11*SQR(gtu31) - PDstandardNth3gt22*SQR(gtu32) - + PDstandardNth3gt33*SQR(gtu33); + + CCTK_REAL Gtl111 = 0.5*PDstandardNth1gt11; + + CCTK_REAL Gtl112 = 0.5*PDstandardNth2gt11; + + CCTK_REAL Gtl113 = 0.5*PDstandardNth3gt11; + + CCTK_REAL Gtl122 = -0.5*PDstandardNth1gt22 + PDstandardNth2gt12; + + CCTK_REAL Gtl123 = 0.5*(-PDstandardNth1gt23 + PDstandardNth2gt13 + + PDstandardNth3gt12); + + CCTK_REAL Gtl133 = -0.5*PDstandardNth1gt33 + PDstandardNth3gt13; + + CCTK_REAL Gtl211 = PDstandardNth1gt12 - 0.5*PDstandardNth2gt11; + + CCTK_REAL Gtl212 = 0.5*PDstandardNth1gt22; + + CCTK_REAL Gtl213 = 0.5*(PDstandardNth1gt23 - PDstandardNth2gt13 + + PDstandardNth3gt12); + + CCTK_REAL Gtl222 = 0.5*PDstandardNth2gt22; + + CCTK_REAL Gtl223 = 0.5*PDstandardNth3gt22; + + CCTK_REAL Gtl233 = -0.5*PDstandardNth2gt33 + PDstandardNth3gt23; + + CCTK_REAL Gtl311 = PDstandardNth1gt13 - 0.5*PDstandardNth3gt11; + + CCTK_REAL Gtl312 = 0.5*(PDstandardNth1gt23 + PDstandardNth2gt13 - + PDstandardNth3gt12); + + CCTK_REAL Gtl313 = 0.5*PDstandardNth1gt33; + + CCTK_REAL Gtl322 = PDstandardNth2gt23 - 0.5*PDstandardNth3gt22; + + CCTK_REAL Gtl323 = 0.5*PDstandardNth2gt33; + + CCTK_REAL Gtl333 = 0.5*PDstandardNth3gt33; + + CCTK_REAL Gtlu111 = Gtl111*gtu11 + Gtl112*gtu21 + Gtl113*gtu31; + + CCTK_REAL Gtlu112 = Gtl111*gtu21 + Gtl112*gtu22 + Gtl113*gtu32; + + CCTK_REAL Gtlu113 = Gtl111*gtu31 + Gtl112*gtu32 + Gtl113*gtu33; + + CCTK_REAL Gtlu121 = Gtl112*gtu11 + Gtl122*gtu21 + Gtl123*gtu31; + + CCTK_REAL Gtlu122 = Gtl112*gtu21 + Gtl122*gtu22 + Gtl123*gtu32; + + CCTK_REAL Gtlu123 = Gtl112*gtu31 + Gtl122*gtu32 + Gtl123*gtu33; + + CCTK_REAL Gtlu131 = Gtl113*gtu11 + Gtl123*gtu21 + Gtl133*gtu31; + + CCTK_REAL Gtlu132 = Gtl113*gtu21 + Gtl123*gtu22 + Gtl133*gtu32; + + CCTK_REAL Gtlu133 = Gtl113*gtu31 + Gtl123*gtu32 + Gtl133*gtu33; + + CCTK_REAL Gtlu211 = Gtl211*gtu11 + Gtl212*gtu21 + Gtl213*gtu31; + + CCTK_REAL Gtlu212 = Gtl211*gtu21 + Gtl212*gtu22 + Gtl213*gtu32; + + CCTK_REAL Gtlu213 = Gtl211*gtu31 + Gtl212*gtu32 + Gtl213*gtu33; + + CCTK_REAL Gtlu221 = Gtl212*gtu11 + Gtl222*gtu21 + Gtl223*gtu31; + + CCTK_REAL Gtlu222 = Gtl212*gtu21 + Gtl222*gtu22 + Gtl223*gtu32; + + CCTK_REAL Gtlu223 = Gtl212*gtu31 + Gtl222*gtu32 + Gtl223*gtu33; + + CCTK_REAL Gtlu231 = Gtl213*gtu11 + Gtl223*gtu21 + Gtl233*gtu31; + + CCTK_REAL Gtlu232 = Gtl213*gtu21 + Gtl223*gtu22 + Gtl233*gtu32; + + CCTK_REAL Gtlu233 = Gtl213*gtu31 + Gtl223*gtu32 + Gtl233*gtu33; + + CCTK_REAL Gtlu311 = Gtl311*gtu11 + Gtl312*gtu21 + Gtl313*gtu31; + + CCTK_REAL Gtlu312 = Gtl311*gtu21 + Gtl312*gtu22 + Gtl313*gtu32; + + CCTK_REAL Gtlu313 = Gtl311*gtu31 + Gtl312*gtu32 + Gtl313*gtu33; + + CCTK_REAL Gtlu321 = Gtl312*gtu11 + Gtl322*gtu21 + Gtl323*gtu31; + + CCTK_REAL Gtlu322 = Gtl312*gtu21 + Gtl322*gtu22 + Gtl323*gtu32; + + CCTK_REAL Gtlu323 = Gtl312*gtu31 + Gtl322*gtu32 + Gtl323*gtu33; + + CCTK_REAL Gtlu331 = Gtl313*gtu11 + Gtl323*gtu21 + Gtl333*gtu31; + + CCTK_REAL Gtlu332 = Gtl313*gtu21 + Gtl323*gtu22 + Gtl333*gtu32; + + CCTK_REAL Gtlu333 = Gtl313*gtu31 + Gtl323*gtu32 + Gtl333*gtu33; + + CCTK_REAL Gt111 = Gtl111*gtu11 + Gtl211*gtu21 + Gtl311*gtu31; + + CCTK_REAL Gt211 = Gtl111*gtu21 + Gtl211*gtu22 + Gtl311*gtu32; + + CCTK_REAL Gt311 = Gtl111*gtu31 + Gtl211*gtu32 + Gtl311*gtu33; + + CCTK_REAL Gt112 = Gtl112*gtu11 + Gtl212*gtu21 + Gtl312*gtu31; + + CCTK_REAL Gt212 = Gtl112*gtu21 + Gtl212*gtu22 + Gtl312*gtu32; + + CCTK_REAL Gt312 = Gtl112*gtu31 + Gtl212*gtu32 + Gtl312*gtu33; + + CCTK_REAL Gt113 = Gtl113*gtu11 + Gtl213*gtu21 + Gtl313*gtu31; + + CCTK_REAL Gt213 = Gtl113*gtu21 + Gtl213*gtu22 + Gtl313*gtu32; + + CCTK_REAL Gt313 = Gtl113*gtu31 + Gtl213*gtu32 + Gtl313*gtu33; + + CCTK_REAL Gt122 = Gtl122*gtu11 + Gtl222*gtu21 + Gtl322*gtu31; + + CCTK_REAL Gt222 = Gtl122*gtu21 + Gtl222*gtu22 + Gtl322*gtu32; + + CCTK_REAL Gt322 = Gtl122*gtu31 + Gtl222*gtu32 + Gtl322*gtu33; + + CCTK_REAL Gt123 = Gtl123*gtu11 + Gtl223*gtu21 + Gtl323*gtu31; + + CCTK_REAL Gt223 = Gtl123*gtu21 + Gtl223*gtu22 + Gtl323*gtu32; + + CCTK_REAL Gt323 = Gtl123*gtu31 + Gtl223*gtu32 + Gtl323*gtu33; + + CCTK_REAL Gt133 = Gtl133*gtu11 + Gtl233*gtu21 + Gtl333*gtu31; + + CCTK_REAL Gt233 = Gtl133*gtu21 + Gtl233*gtu22 + Gtl333*gtu32; + + CCTK_REAL Gt333 = Gtl133*gtu31 + Gtl233*gtu32 + Gtl333*gtu33; + + CCTK_REAL Xtn1 = Gt111*gtu11 + Gt122*gtu22 + 2*(Gt112*gtu21 + + Gt113*gtu31 + Gt123*gtu32) + Gt133*gtu33; + + CCTK_REAL Xtn2 = Gt211*gtu11 + Gt222*gtu22 + 2*(Gt212*gtu21 + + Gt213*gtu31 + Gt223*gtu32) + Gt233*gtu33; + + CCTK_REAL Xtn3 = Gt311*gtu11 + Gt322*gtu22 + 2*(Gt312*gtu21 + + Gt313*gtu31 + Gt323*gtu32) + Gt333*gtu33; + + CCTK_REAL Rt11 = 3*(Gt111*Gtlu111 + Gt112*Gtlu112 + Gt113*Gtlu113) + + 2*(Gt211*Gtlu121 + Gt212*Gtlu122 + Gt213*Gtlu123 + Gt311*Gtlu131 + + Gt312*Gtlu132 + Gt313*Gtlu133) + Gt211*Gtlu211 + Gt212*Gtlu212 + + Gt213*Gtlu213 + Gt311*Gtlu311 + Gt312*Gtlu312 + Gt313*Gtlu313 + + gt11L*PDstandardNth1Xt1 + gt12L*PDstandardNth1Xt2 + + gt13L*PDstandardNth1Xt3 + 0.5*(-(gtu11*PDstandardNth11gt11) - + 2*gtu21*PDstandardNth12gt11 - 2*gtu31*PDstandardNth13gt11 - + gtu22*PDstandardNth22gt11 - 2*gtu32*PDstandardNth23gt11 - + gtu33*PDstandardNth33gt11) + Gtl111*Xtn1 + Gtl112*Xtn2 + Gtl113*Xtn3; + + CCTK_REAL Rt12 = 0.5*(4*(Gt211*Gtlu221 + Gt212*Gtlu222 + + Gt213*Gtlu223) + 2*(Gt112*Gtlu111 + Gt122*Gtlu112 + Gt123*Gtlu113 + + Gt111*Gtlu121 + Gt212*Gtlu121 + Gt112*Gtlu122 + Gt222*Gtlu122 + + Gt113*Gtlu123 + Gt223*Gtlu123 + Gt312*Gtlu131 + Gt322*Gtlu132 + + Gt323*Gtlu133 + Gt111*Gtlu211 + Gt112*Gtlu212 + Gt113*Gtlu213 + + Gt311*Gtlu231 + Gt312*Gtlu232 + Gt313*Gtlu233 + Gt311*Gtlu321 + + Gt312*Gtlu322 + Gt313*Gtlu323) - gtu11*PDstandardNth11gt12 - + 2*gtu21*PDstandardNth12gt12 - 2*gtu31*PDstandardNth13gt12 + + gt12L*PDstandardNth1Xt1 + gt22L*PDstandardNth1Xt2 + + gt23L*PDstandardNth1Xt3 - gtu22*PDstandardNth22gt12 - + 2*gtu32*PDstandardNth23gt12 + gt11L*PDstandardNth2Xt1 + + gt12L*PDstandardNth2Xt2 + gt13L*PDstandardNth2Xt3 - + gtu33*PDstandardNth33gt12 + Gtl112*Xtn1 + Gtl211*Xtn1 + Gtl122*Xtn2 + + Gtl212*Xtn2 + Gtl123*Xtn3 + Gtl213*Xtn3); + + CCTK_REAL Rt13 = 0.5*(2*(Gt113*Gtlu111 + Gt123*Gtlu112 + Gt133*Gtlu113 + + Gt213*Gtlu121 + Gt223*Gtlu122 + Gt233*Gtlu123 + Gt111*Gtlu131 + + Gt313*Gtlu131 + Gt112*Gtlu132 + Gt323*Gtlu132 + Gt113*Gtlu133 + + Gt333*Gtlu133 + Gt211*Gtlu231 + Gt212*Gtlu232 + Gt213*Gtlu233 + + Gt111*Gtlu311 + Gt112*Gtlu312 + Gt113*Gtlu313 + Gt211*Gtlu321 + + Gt212*Gtlu322 + Gt213*Gtlu323) + 4*(Gt311*Gtlu331 + Gt312*Gtlu332 + + Gt313*Gtlu333) - gtu11*PDstandardNth11gt13 - + 2*gtu21*PDstandardNth12gt13 - 2*gtu31*PDstandardNth13gt13 + + gt13L*PDstandardNth1Xt1 + gt23L*PDstandardNth1Xt2 + + gt33L*PDstandardNth1Xt3 - gtu22*PDstandardNth22gt13 - + 2*gtu32*PDstandardNth23gt13 - gtu33*PDstandardNth33gt13 + + gt11L*PDstandardNth3Xt1 + gt12L*PDstandardNth3Xt2 + + gt13L*PDstandardNth3Xt3 + Gtl113*Xtn1 + Gtl311*Xtn1 + Gtl123*Xtn2 + + Gtl312*Xtn2 + Gtl133*Xtn3 + Gtl313*Xtn3); + + CCTK_REAL Rt22 = Gt112*(Gtlu121 + 2*Gtlu211) + Gt122*(Gtlu122 + + 2*Gtlu212) + Gt123*(Gtlu123 + 2*Gtlu213) + 3*(Gt212*Gtlu221 + + Gt222*Gtlu222 + Gt223*Gtlu223) + 2*(Gt312*Gtlu231 + Gt322*Gtlu232 + + Gt323*Gtlu233) + Gt312*Gtlu321 + Gt322*Gtlu322 + Gt323*Gtlu323 + + gt12L*PDstandardNth2Xt1 + gt22L*PDstandardNth2Xt2 + + gt23L*PDstandardNth2Xt3 + 0.5*(-(gtu11*PDstandardNth11gt22) - + 2*gtu21*PDstandardNth12gt22 - 2*gtu31*PDstandardNth13gt22 - + gtu22*PDstandardNth22gt22 - 2*gtu32*PDstandardNth23gt22 - + gtu33*PDstandardNth33gt22) + Gtl212*Xtn1 + Gtl222*Xtn2 + Gtl223*Xtn3; + + CCTK_REAL Rt23 = 0.5*(2*(Gt112*Gtlu131 + Gt122*Gtlu132 + Gt123*Gtlu133 + + Gt113*Gtlu211 + Gt123*Gtlu212 + Gt133*Gtlu213 + Gt213*Gtlu221 + + Gt223*Gtlu222 + Gt233*Gtlu223 + Gt212*Gtlu231 + Gt313*Gtlu231 + + Gt222*Gtlu232 + Gt323*Gtlu232 + Gt223*Gtlu233 + Gt333*Gtlu233 + + Gt112*Gtlu311 + Gt122*Gtlu312 + Gt123*Gtlu313 + Gt212*Gtlu321 + + Gt222*Gtlu322 + Gt223*Gtlu323) + 4*(Gt312*Gtlu331 + Gt322*Gtlu332 + + Gt323*Gtlu333) - gtu11*PDstandardNth11gt23 - + 2*gtu21*PDstandardNth12gt23 - 2*gtu31*PDstandardNth13gt23 - + gtu22*PDstandardNth22gt23 - 2*gtu32*PDstandardNth23gt23 + + gt13L*PDstandardNth2Xt1 + gt23L*PDstandardNth2Xt2 + + gt33L*PDstandardNth2Xt3 - gtu33*PDstandardNth33gt23 + + gt12L*PDstandardNth3Xt1 + gt22L*PDstandardNth3Xt2 + + gt23L*PDstandardNth3Xt3 + Gtl213*Xtn1 + Gtl312*Xtn1 + Gtl223*Xtn2 + + Gtl322*Xtn2 + Gtl233*Xtn3 + Gtl323*Xtn3); + + CCTK_REAL Rt33 = Gt113*(Gtlu131 + 2*Gtlu311) + Gt123*(Gtlu132 + + 2*Gtlu312) + Gt133*(Gtlu133 + 2*Gtlu313) + Gt213*(Gtlu231 + 2*Gtlu321) + + Gt223*(Gtlu232 + 2*Gtlu322) + Gt233*(Gtlu233 + 2*Gtlu323) + + 3*(Gt313*Gtlu331 + Gt323*Gtlu332 + Gt333*Gtlu333) + + 0.5*(-(gtu11*PDstandardNth11gt33) - 2*gtu21*PDstandardNth12gt33 - + 2*gtu31*PDstandardNth13gt33 - gtu22*PDstandardNth22gt33 - + 2*gtu32*PDstandardNth23gt33 - gtu33*PDstandardNth33gt33) + + gt13L*PDstandardNth3Xt1 + gt23L*PDstandardNth3Xt2 + + gt33L*PDstandardNth3Xt3 + Gtl313*Xtn1 + Gtl323*Xtn2 + Gtl333*Xtn3; + + CCTK_REAL trRt = gtu11*Rt11 + gtu22*Rt22 + 2*(gtu21*Rt12 + gtu31*Rt13 + + gtu32*Rt23) + gtu33*Rt33; + + CCTK_REAL ephi = + IfThen(ToReal(conformalMethod),INV(sqrt(phiL)),exp(phiL)); + + CCTK_REAL Atm11 = At11L*gtu11 + At12L*gtu21 + At13L*gtu31; + + CCTK_REAL Atm21 = At11L*gtu21 + At12L*gtu22 + At13L*gtu32; + + CCTK_REAL Atm31 = At11L*gtu31 + At12L*gtu32 + At13L*gtu33; + + CCTK_REAL Atm12 = At12L*gtu11 + At22L*gtu21 + At23L*gtu31; + + CCTK_REAL Atm22 = At12L*gtu21 + At22L*gtu22 + At23L*gtu32; + + CCTK_REAL Atm32 = At12L*gtu31 + At22L*gtu32 + At23L*gtu33; + + CCTK_REAL Atm13 = At13L*gtu11 + At23L*gtu21 + At33L*gtu31; + + CCTK_REAL Atm23 = At13L*gtu21 + At23L*gtu22 + At33L*gtu32; + + CCTK_REAL Atm33 = At13L*gtu31 + At23L*gtu32 + At33L*gtu33; + + CCTK_REAL rho = INV(SQR(alphaL))*(eTttL - 2*(beta2L*eTtyL + + beta3L*eTtzL) + 2*(beta1L*(-eTtxL + beta2L*eTxyL + beta3L*eTxzL) + + beta2L*beta3L*eTyzL) + eTxxL*SQR(beta1L) + eTyyL*SQR(beta2L) + + eTzzL*SQR(beta3L)); + + CCTK_REAL S1 = (-eTtxL + beta1L*eTxxL + beta2L*eTxyL + + beta3L*eTxzL)*INV(alphaL); + + CCTK_REAL S2 = (-eTtyL + beta1L*eTxyL + beta2L*eTyyL + + beta3L*eTyzL)*INV(alphaL); + + CCTK_REAL S3 = (-eTtzL + beta1L*eTxzL + beta2L*eTyzL + + beta3L*eTzzL)*INV(alphaL); + + CCTK_REAL MadmL = + 0.01989436788648691697111047042156429525431*(-((Gt111*Gtlu111 + + Gt112*Gtlu112 + Gt113*Gtlu113 + Gt211*Gtlu121 + Gt212*Gtlu122 + + Gt213*Gtlu123 + Gt311*Gtlu131 + Gt312*Gtlu132 + Gt313*Gtlu133)*gtu11) + + (-(Gt122*Gtlu112) - Gt123*Gtlu113 - Gt222*Gtlu122 - Gt223*Gtlu123 - + Gt322*Gtlu132 - Gt323*Gtlu133 - Gt111*Gtlu211 + Gt112*(-Gtlu111 - + Gtlu212) - Gt113*Gtlu213 - Gt211*Gtlu221 + Gt212*(-Gtlu121 - Gtlu222) - + Gt213*Gtlu223 - Gt311*Gtlu231 + Gt312*(-Gtlu131 - Gtlu232) - + Gt313*Gtlu233)*gtu21 - (Gt112*Gtlu211 + Gt122*Gtlu212 + Gt123*Gtlu213 + + Gt212*Gtlu221 + Gt222*Gtlu222 + Gt223*Gtlu223 + Gt312*Gtlu231 + + Gt322*Gtlu232 + Gt323*Gtlu233)*gtu22 + (-(Gt123*Gtlu112) - + Gt133*Gtlu113 - Gt223*Gtlu122 - Gt233*Gtlu123 - Gt323*Gtlu132 - + Gt333*Gtlu133 - Gt111*Gtlu311 - Gt112*Gtlu312 + Gt113*(-Gtlu111 - + Gtlu313) - Gt211*Gtlu321 - Gt212*Gtlu322 + Gt213*(-Gtlu121 - Gtlu323) - + Gt311*Gtlu331 - Gt312*Gtlu332 + Gt313*(-Gtlu131 - Gtlu333))*gtu31 + + (-(Gt113*Gtlu211) - Gt133*Gtlu213 - Gt213*Gtlu221 - Gt233*Gtlu223 - + Gt313*Gtlu231 - Gt333*Gtlu233 - Gt112*Gtlu311 - Gt122*Gtlu312 + + Gt123*(-Gtlu212 - Gtlu313) - Gt212*Gtlu321 - Gt222*Gtlu322 + + Gt223*(-Gtlu222 - Gtlu323) - Gt312*Gtlu331 - Gt322*Gtlu332 + + Gt323*(-Gtlu232 - Gtlu333))*gtu32 - (Gt113*Gtlu311 + Gt123*Gtlu312 + + Gt133*Gtlu313 + Gt213*Gtlu321 + Gt223*Gtlu322 + Gt233*Gtlu323 + + Gt313*Gtlu331 + Gt323*Gtlu332 + Gt333*Gtlu333)*gtu33 + trRt - ephi*trRt + + pow(ephi,5)*(2*Atm12*Atm21 + 2.*Atm13*Atm31 + 2.*Atm23*Atm32 + + 50.26548245743669181540229413247204614715*rho + SQR(Atm11) + SQR(Atm22) + + SQR(Atm33) - 0.6666666666666666666666666666666666666667*SQR(trKL))); + + CCTK_REAL Jadm1L = + 0.01989436788648691697111047042156429525431*(2*Atm23 - 2*Atm32 + + (-(At11L*dgtu113) - 2*At12L*dgtu213 - At22L*dgtu223 - 2*At13L*dgtu313 - + 2*At23L*dgtu323 - At33L*dgtu333 + + 1.33333333333333333333333333333*PDstandardNth3trK + + 50.26548245743669181540229413247204614715*S3)*yL + (At11L*dgtu112 + + At22L*dgtu222 + 2*(At12L*dgtu212 + At13L*dgtu312 + At23L*dgtu322) + + At33L*dgtu332 - 1.33333333333333333333333333333*PDstandardNth2trK - + 50.26548245743669181540229413247204614715*S2)*zL)*pow(ephi,6); + + CCTK_REAL Jadm2L = + 0.01989436788648691697111047042156429525431*(-2*Atm13 + 2*Atm31 + + (At11L*dgtu113 + At22L*dgtu223 + 2*(At12L*dgtu213 + At13L*dgtu313 + + At23L*dgtu323) + At33L*dgtu333 - + 1.33333333333333333333333333333*PDstandardNth3trK - + 50.26548245743669181540229413247204614715*S3)*xL + (-(At11L*dgtu111) - + 2*At12L*dgtu211 - At22L*dgtu221 - 2*At13L*dgtu311 - 2*At23L*dgtu321 - + At33L*dgtu331 + 1.33333333333333333333333333333*PDstandardNth1trK + + 50.26548245743669181540229413247204614715*S1)*zL)*pow(ephi,6); + + CCTK_REAL Jadm3L = + 0.01989436788648691697111047042156429525431*(2*Atm12 - 2*Atm21 + + (-(At11L*dgtu112) - 2*At12L*dgtu212 - At22L*dgtu222 - 2*At13L*dgtu312 - + 2*At23L*dgtu322 - At33L*dgtu332 + + 1.33333333333333333333333333333*PDstandardNth2trK + + 50.26548245743669181540229413247204614715*S2)*xL + (At11L*dgtu111 + + At22L*dgtu221 + 2*(At12L*dgtu211 + At13L*dgtu311 + At23L*dgtu321) + + At33L*dgtu331 - 1.33333333333333333333333333333*PDstandardNth1trK - + 50.26548245743669181540229413247204614715*S1)*yL)*pow(ephi,6); + + + /* Copy local copies back to grid functions */ + Jadm1[index] = Jadm1L; + Jadm2[index] = Jadm2L; + Jadm3[index] = Jadm3L; + Madm[index] = MadmL; + } + LC_ENDLOOP3 (ML_ADMQuantities_O2); +} + +extern "C" void ML_ADMQuantities_O2(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverInterior(cctkGH, &ML_ADMQuantities_O2_Body); +} diff --git a/ML_ADMQuantities_O2/src/RegisterMoL.cc b/ML_ADMQuantities_O2/src/RegisterMoL.cc new file mode 100644 index 0000000..c61f3f8 --- /dev/null +++ b/ML_ADMQuantities_O2/src/RegisterMoL.cc @@ -0,0 +1,16 @@ +/* File produced by Kranc */ + +#include "cctk.h" +#include "cctk_Arguments.h" +#include "cctk_Parameters.h" + +extern "C" void ML_ADMQuantities_O2_RegisterVars(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT ierr = 0; + + /* Register all the evolved grid functions with MoL */ + return; +} diff --git a/ML_ADMQuantities_O2/src/RegisterSymmetries.cc b/ML_ADMQuantities_O2/src/RegisterSymmetries.cc new file mode 100644 index 0000000..6464166 --- /dev/null +++ b/ML_ADMQuantities_O2/src/RegisterSymmetries.cc @@ -0,0 +1,39 @@ +/* File produced by Kranc */ + +#include "cctk.h" +#include "cctk_Arguments.h" +#include "cctk_Parameters.h" +#include "Symmetry.h" + +extern "C" void ML_ADMQuantities_O2_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_ADMQuantities_O2::Jadm1"); + + sym[0] = 1; + sym[1] = -1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_ADMQuantities_O2::Jadm2"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = -1; + SetCartSymVN(cctkGH, sym, "ML_ADMQuantities_O2::Jadm3"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_ADMQuantities_O2::Madm"); + +} diff --git a/ML_ADMQuantities_O2/src/Startup.cc b/ML_ADMQuantities_O2/src/Startup.cc new file mode 100644 index 0000000..781d8f1 --- /dev/null +++ b/ML_ADMQuantities_O2/src/Startup.cc @@ -0,0 +1,10 @@ +/* File produced by Kranc */ + +#include "cctk.h" + +extern "C" int ML_ADMQuantities_O2_Startup(void) +{ + const char * banner = "ML_ADMQuantities_O2"; + CCTK_RegisterBanner(banner); + return 0; +} diff --git a/ML_BSSN/src/Boundaries.cc b/ML_BSSN/src/Boundaries.cc new file mode 100644 index 0000000..a7c5010 --- /dev/null +++ b/ML_BSSN/src/Boundaries.cc @@ -0,0 +1,1809 @@ +/* File produced by Kranc */ + +#include "cctk.h" +#include "cctk_Arguments.h" +#include "cctk_Parameters.h" +#include "cctk_Faces.h" +#include "util_Table.h" +#include "Symmetry.h" + + +/* the boundary treatment is split into 3 steps: */ +/* 1. excision */ +/* 2. symmetries */ +/* 3. "other" boundary conditions, e.g. radiative */ + +/* to simplify scheduling and testing, the 3 steps */ +/* are currently applied in separate functions */ + + +extern "C" void ML_BSSN_CheckBoundaries(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + return; +} + +extern "C" void ML_BSSN_SelectBoundConds(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT ierr = 0; + + if (CCTK_EQUALS(ML_curv_bound, "none" ) || + CCTK_EQUALS(ML_curv_bound, "static") || + CCTK_EQUALS(ML_curv_bound, "flat" ) || + CCTK_EQUALS(ML_curv_bound, "zero" ) ) + { + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN::ML_curv", ML_curv_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register ML_curv_bound BC for ML_BSSN::ML_curv!"); + } + + if (CCTK_EQUALS(ML_dtlapse_bound, "none" ) || + CCTK_EQUALS(ML_dtlapse_bound, "static") || + CCTK_EQUALS(ML_dtlapse_bound, "flat" ) || + CCTK_EQUALS(ML_dtlapse_bound, "zero" ) ) + { + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN::ML_dtlapse", ML_dtlapse_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register ML_dtlapse_bound BC for ML_BSSN::ML_dtlapse!"); + } + + if (CCTK_EQUALS(ML_dtshift_bound, "none" ) || + CCTK_EQUALS(ML_dtshift_bound, "static") || + CCTK_EQUALS(ML_dtshift_bound, "flat" ) || + CCTK_EQUALS(ML_dtshift_bound, "zero" ) ) + { + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN::ML_dtshift", ML_dtshift_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register ML_dtshift_bound BC for ML_BSSN::ML_dtshift!"); + } + + if (CCTK_EQUALS(ML_Gamma_bound, "none" ) || + CCTK_EQUALS(ML_Gamma_bound, "static") || + CCTK_EQUALS(ML_Gamma_bound, "flat" ) || + CCTK_EQUALS(ML_Gamma_bound, "zero" ) ) + { + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN::ML_Gamma", ML_Gamma_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register ML_Gamma_bound BC for ML_BSSN::ML_Gamma!"); + } + + if (CCTK_EQUALS(ML_lapse_bound, "none" ) || + CCTK_EQUALS(ML_lapse_bound, "static") || + CCTK_EQUALS(ML_lapse_bound, "flat" ) || + CCTK_EQUALS(ML_lapse_bound, "zero" ) ) + { + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN::ML_lapse", ML_lapse_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register ML_lapse_bound BC for ML_BSSN::ML_lapse!"); + } + + if (CCTK_EQUALS(ML_log_confac_bound, "none" ) || + CCTK_EQUALS(ML_log_confac_bound, "static") || + CCTK_EQUALS(ML_log_confac_bound, "flat" ) || + CCTK_EQUALS(ML_log_confac_bound, "zero" ) ) + { + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN::ML_log_confac", ML_log_confac_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register ML_log_confac_bound BC for ML_BSSN::ML_log_confac!"); + } + + if (CCTK_EQUALS(ML_metric_bound, "none" ) || + CCTK_EQUALS(ML_metric_bound, "static") || + CCTK_EQUALS(ML_metric_bound, "flat" ) || + CCTK_EQUALS(ML_metric_bound, "zero" ) ) + { + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN::ML_metric", ML_metric_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register ML_metric_bound BC for ML_BSSN::ML_metric!"); + } + + if (CCTK_EQUALS(ML_shift_bound, "none" ) || + CCTK_EQUALS(ML_shift_bound, "static") || + CCTK_EQUALS(ML_shift_bound, "flat" ) || + CCTK_EQUALS(ML_shift_bound, "zero" ) ) + { + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN::ML_shift", ML_shift_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register ML_shift_bound BC for ML_BSSN::ML_shift!"); + } + + if (CCTK_EQUALS(ML_trace_curv_bound, "none" ) || + CCTK_EQUALS(ML_trace_curv_bound, "static") || + CCTK_EQUALS(ML_trace_curv_bound, "flat" ) || + CCTK_EQUALS(ML_trace_curv_bound, "zero" ) ) + { + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN::ML_trace_curv", ML_trace_curv_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register ML_trace_curv_bound BC for ML_BSSN::ML_trace_curv!"); + } + + if (CCTK_EQUALS(At11_bound, "none" ) || + CCTK_EQUALS(At11_bound, "static") || + CCTK_EQUALS(At11_bound, "flat" ) || + CCTK_EQUALS(At11_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN::At11", At11_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register At11_bound BC for ML_BSSN::At11!"); + } + + if (CCTK_EQUALS(At12_bound, "none" ) || + CCTK_EQUALS(At12_bound, "static") || + CCTK_EQUALS(At12_bound, "flat" ) || + CCTK_EQUALS(At12_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN::At12", At12_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register At12_bound BC for ML_BSSN::At12!"); + } + + if (CCTK_EQUALS(At13_bound, "none" ) || + CCTK_EQUALS(At13_bound, "static") || + CCTK_EQUALS(At13_bound, "flat" ) || + CCTK_EQUALS(At13_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN::At13", At13_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register At13_bound BC for ML_BSSN::At13!"); + } + + if (CCTK_EQUALS(At22_bound, "none" ) || + CCTK_EQUALS(At22_bound, "static") || + CCTK_EQUALS(At22_bound, "flat" ) || + CCTK_EQUALS(At22_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN::At22", At22_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register At22_bound BC for ML_BSSN::At22!"); + } + + if (CCTK_EQUALS(At23_bound, "none" ) || + CCTK_EQUALS(At23_bound, "static") || + CCTK_EQUALS(At23_bound, "flat" ) || + CCTK_EQUALS(At23_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN::At23", At23_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register At23_bound BC for ML_BSSN::At23!"); + } + + if (CCTK_EQUALS(At33_bound, "none" ) || + CCTK_EQUALS(At33_bound, "static") || + CCTK_EQUALS(At33_bound, "flat" ) || + CCTK_EQUALS(At33_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN::At33", At33_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register At33_bound BC for ML_BSSN::At33!"); + } + + if (CCTK_EQUALS(A_bound, "none" ) || + CCTK_EQUALS(A_bound, "static") || + CCTK_EQUALS(A_bound, "flat" ) || + CCTK_EQUALS(A_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN::A", A_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register A_bound BC for ML_BSSN::A!"); + } + + if (CCTK_EQUALS(B1_bound, "none" ) || + CCTK_EQUALS(B1_bound, "static") || + CCTK_EQUALS(B1_bound, "flat" ) || + CCTK_EQUALS(B1_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN::B1", B1_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register B1_bound BC for ML_BSSN::B1!"); + } + + if (CCTK_EQUALS(B2_bound, "none" ) || + CCTK_EQUALS(B2_bound, "static") || + CCTK_EQUALS(B2_bound, "flat" ) || + CCTK_EQUALS(B2_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN::B2", B2_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register B2_bound BC for ML_BSSN::B2!"); + } + + if (CCTK_EQUALS(B3_bound, "none" ) || + CCTK_EQUALS(B3_bound, "static") || + CCTK_EQUALS(B3_bound, "flat" ) || + CCTK_EQUALS(B3_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN::B3", B3_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register B3_bound BC for ML_BSSN::B3!"); + } + + if (CCTK_EQUALS(Xt1_bound, "none" ) || + CCTK_EQUALS(Xt1_bound, "static") || + CCTK_EQUALS(Xt1_bound, "flat" ) || + CCTK_EQUALS(Xt1_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN::Xt1", Xt1_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register Xt1_bound BC for ML_BSSN::Xt1!"); + } + + if (CCTK_EQUALS(Xt2_bound, "none" ) || + CCTK_EQUALS(Xt2_bound, "static") || + CCTK_EQUALS(Xt2_bound, "flat" ) || + CCTK_EQUALS(Xt2_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN::Xt2", Xt2_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register Xt2_bound BC for ML_BSSN::Xt2!"); + } + + if (CCTK_EQUALS(Xt3_bound, "none" ) || + CCTK_EQUALS(Xt3_bound, "static") || + CCTK_EQUALS(Xt3_bound, "flat" ) || + CCTK_EQUALS(Xt3_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN::Xt3", Xt3_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register Xt3_bound BC for ML_BSSN::Xt3!"); + } + + if (CCTK_EQUALS(alpha_bound, "none" ) || + CCTK_EQUALS(alpha_bound, "static") || + CCTK_EQUALS(alpha_bound, "flat" ) || + CCTK_EQUALS(alpha_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN::alpha", alpha_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register alpha_bound BC for ML_BSSN::alpha!"); + } + + if (CCTK_EQUALS(phi_bound, "none" ) || + CCTK_EQUALS(phi_bound, "static") || + CCTK_EQUALS(phi_bound, "flat" ) || + CCTK_EQUALS(phi_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN::phi", phi_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register phi_bound BC for ML_BSSN::phi!"); + } + + if (CCTK_EQUALS(gt11_bound, "none" ) || + CCTK_EQUALS(gt11_bound, "static") || + CCTK_EQUALS(gt11_bound, "flat" ) || + CCTK_EQUALS(gt11_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN::gt11", gt11_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register gt11_bound BC for ML_BSSN::gt11!"); + } + + if (CCTK_EQUALS(gt12_bound, "none" ) || + CCTK_EQUALS(gt12_bound, "static") || + CCTK_EQUALS(gt12_bound, "flat" ) || + CCTK_EQUALS(gt12_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN::gt12", gt12_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register gt12_bound BC for ML_BSSN::gt12!"); + } + + if (CCTK_EQUALS(gt13_bound, "none" ) || + CCTK_EQUALS(gt13_bound, "static") || + CCTK_EQUALS(gt13_bound, "flat" ) || + CCTK_EQUALS(gt13_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN::gt13", gt13_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register gt13_bound BC for ML_BSSN::gt13!"); + } + + if (CCTK_EQUALS(gt22_bound, "none" ) || + CCTK_EQUALS(gt22_bound, "static") || + CCTK_EQUALS(gt22_bound, "flat" ) || + CCTK_EQUALS(gt22_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN::gt22", gt22_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register gt22_bound BC for ML_BSSN::gt22!"); + } + + if (CCTK_EQUALS(gt23_bound, "none" ) || + CCTK_EQUALS(gt23_bound, "static") || + CCTK_EQUALS(gt23_bound, "flat" ) || + CCTK_EQUALS(gt23_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN::gt23", gt23_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register gt23_bound BC for ML_BSSN::gt23!"); + } + + if (CCTK_EQUALS(gt33_bound, "none" ) || + CCTK_EQUALS(gt33_bound, "static") || + CCTK_EQUALS(gt33_bound, "flat" ) || + CCTK_EQUALS(gt33_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN::gt33", gt33_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register gt33_bound BC for ML_BSSN::gt33!"); + } + + if (CCTK_EQUALS(beta1_bound, "none" ) || + CCTK_EQUALS(beta1_bound, "static") || + CCTK_EQUALS(beta1_bound, "flat" ) || + CCTK_EQUALS(beta1_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN::beta1", beta1_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register beta1_bound BC for ML_BSSN::beta1!"); + } + + if (CCTK_EQUALS(beta2_bound, "none" ) || + CCTK_EQUALS(beta2_bound, "static") || + CCTK_EQUALS(beta2_bound, "flat" ) || + CCTK_EQUALS(beta2_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN::beta2", beta2_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register beta2_bound BC for ML_BSSN::beta2!"); + } + + if (CCTK_EQUALS(beta3_bound, "none" ) || + CCTK_EQUALS(beta3_bound, "static") || + CCTK_EQUALS(beta3_bound, "flat" ) || + CCTK_EQUALS(beta3_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN::beta3", beta3_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register beta3_bound BC for ML_BSSN::beta3!"); + } + + if (CCTK_EQUALS(trK_bound, "none" ) || + CCTK_EQUALS(trK_bound, "static") || + CCTK_EQUALS(trK_bound, "flat" ) || + CCTK_EQUALS(trK_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN::trK", trK_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register trK_bound BC for ML_BSSN::trK!"); + } + + if (CCTK_EQUALS(ML_curv_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_ML_curv_bound = -1; + if (handle_ML_curv_bound < 0) handle_ML_curv_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_curv_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_curv_bound , ML_curv_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_ML_curv_bound ,ML_curv_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_curv_bound, + "ML_BSSN::ML_curv", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN::ML_curv!"); + + } + + if (CCTK_EQUALS(ML_dtlapse_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_ML_dtlapse_bound = -1; + if (handle_ML_dtlapse_bound < 0) handle_ML_dtlapse_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_dtlapse_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_dtlapse_bound , ML_dtlapse_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_ML_dtlapse_bound ,ML_dtlapse_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_dtlapse_bound, + "ML_BSSN::ML_dtlapse", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN::ML_dtlapse!"); + + } + + if (CCTK_EQUALS(ML_dtshift_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_ML_dtshift_bound = -1; + if (handle_ML_dtshift_bound < 0) handle_ML_dtshift_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_dtshift_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_dtshift_bound , ML_dtshift_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_ML_dtshift_bound ,ML_dtshift_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_dtshift_bound, + "ML_BSSN::ML_dtshift", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN::ML_dtshift!"); + + } + + if (CCTK_EQUALS(ML_Gamma_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_ML_Gamma_bound = -1; + if (handle_ML_Gamma_bound < 0) handle_ML_Gamma_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_Gamma_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_Gamma_bound , ML_Gamma_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_ML_Gamma_bound ,ML_Gamma_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_Gamma_bound, + "ML_BSSN::ML_Gamma", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN::ML_Gamma!"); + + } + + if (CCTK_EQUALS(ML_lapse_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_ML_lapse_bound = -1; + if (handle_ML_lapse_bound < 0) handle_ML_lapse_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_lapse_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_lapse_bound , ML_lapse_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_ML_lapse_bound ,ML_lapse_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_lapse_bound, + "ML_BSSN::ML_lapse", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN::ML_lapse!"); + + } + + if (CCTK_EQUALS(ML_log_confac_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_ML_log_confac_bound = -1; + if (handle_ML_log_confac_bound < 0) handle_ML_log_confac_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_log_confac_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_log_confac_bound , ML_log_confac_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_ML_log_confac_bound ,ML_log_confac_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_log_confac_bound, + "ML_BSSN::ML_log_confac", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN::ML_log_confac!"); + + } + + if (CCTK_EQUALS(ML_metric_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_ML_metric_bound = -1; + if (handle_ML_metric_bound < 0) handle_ML_metric_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_metric_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_metric_bound , ML_metric_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_ML_metric_bound ,ML_metric_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_metric_bound, + "ML_BSSN::ML_metric", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN::ML_metric!"); + + } + + if (CCTK_EQUALS(ML_shift_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_ML_shift_bound = -1; + if (handle_ML_shift_bound < 0) handle_ML_shift_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_shift_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_shift_bound , ML_shift_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_ML_shift_bound ,ML_shift_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_shift_bound, + "ML_BSSN::ML_shift", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN::ML_shift!"); + + } + + if (CCTK_EQUALS(ML_trace_curv_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_ML_trace_curv_bound = -1; + if (handle_ML_trace_curv_bound < 0) handle_ML_trace_curv_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_trace_curv_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_trace_curv_bound , ML_trace_curv_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_ML_trace_curv_bound ,ML_trace_curv_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_trace_curv_bound, + "ML_BSSN::ML_trace_curv", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN::ML_trace_curv!"); + + } + + if (CCTK_EQUALS(At11_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_At11_bound = -1; + if (handle_At11_bound < 0) handle_At11_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_At11_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_At11_bound , At11_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_At11_bound ,At11_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_At11_bound, + "ML_BSSN::At11", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN::At11!"); + + } + + if (CCTK_EQUALS(At12_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_At12_bound = -1; + if (handle_At12_bound < 0) handle_At12_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_At12_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_At12_bound , At12_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_At12_bound ,At12_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_At12_bound, + "ML_BSSN::At12", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN::At12!"); + + } + + if (CCTK_EQUALS(At13_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_At13_bound = -1; + if (handle_At13_bound < 0) handle_At13_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_At13_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_At13_bound , At13_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_At13_bound ,At13_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_At13_bound, + "ML_BSSN::At13", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN::At13!"); + + } + + if (CCTK_EQUALS(At22_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_At22_bound = -1; + if (handle_At22_bound < 0) handle_At22_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_At22_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_At22_bound , At22_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_At22_bound ,At22_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_At22_bound, + "ML_BSSN::At22", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN::At22!"); + + } + + if (CCTK_EQUALS(At23_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_At23_bound = -1; + if (handle_At23_bound < 0) handle_At23_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_At23_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_At23_bound , At23_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_At23_bound ,At23_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_At23_bound, + "ML_BSSN::At23", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN::At23!"); + + } + + if (CCTK_EQUALS(At33_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_At33_bound = -1; + if (handle_At33_bound < 0) handle_At33_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_At33_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_At33_bound , At33_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_At33_bound ,At33_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_At33_bound, + "ML_BSSN::At33", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN::At33!"); + + } + + if (CCTK_EQUALS(A_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_A_bound = -1; + if (handle_A_bound < 0) handle_A_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_A_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_A_bound , A_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_A_bound ,A_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_A_bound, + "ML_BSSN::A", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN::A!"); + + } + + if (CCTK_EQUALS(B1_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_B1_bound = -1; + if (handle_B1_bound < 0) handle_B1_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_B1_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_B1_bound , B1_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_B1_bound ,B1_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_B1_bound, + "ML_BSSN::B1", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN::B1!"); + + } + + if (CCTK_EQUALS(B2_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_B2_bound = -1; + if (handle_B2_bound < 0) handle_B2_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_B2_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_B2_bound , B2_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_B2_bound ,B2_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_B2_bound, + "ML_BSSN::B2", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN::B2!"); + + } + + if (CCTK_EQUALS(B3_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_B3_bound = -1; + if (handle_B3_bound < 0) handle_B3_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_B3_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_B3_bound , B3_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_B3_bound ,B3_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_B3_bound, + "ML_BSSN::B3", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN::B3!"); + + } + + if (CCTK_EQUALS(Xt1_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_Xt1_bound = -1; + if (handle_Xt1_bound < 0) handle_Xt1_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_Xt1_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_Xt1_bound , Xt1_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_Xt1_bound ,Xt1_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_Xt1_bound, + "ML_BSSN::Xt1", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN::Xt1!"); + + } + + if (CCTK_EQUALS(Xt2_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_Xt2_bound = -1; + if (handle_Xt2_bound < 0) handle_Xt2_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_Xt2_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_Xt2_bound , Xt2_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_Xt2_bound ,Xt2_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_Xt2_bound, + "ML_BSSN::Xt2", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN::Xt2!"); + + } + + if (CCTK_EQUALS(Xt3_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_Xt3_bound = -1; + if (handle_Xt3_bound < 0) handle_Xt3_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_Xt3_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_Xt3_bound , Xt3_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_Xt3_bound ,Xt3_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_Xt3_bound, + "ML_BSSN::Xt3", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN::Xt3!"); + + } + + if (CCTK_EQUALS(alpha_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_alpha_bound = -1; + if (handle_alpha_bound < 0) handle_alpha_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_alpha_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_alpha_bound , alpha_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_alpha_bound ,alpha_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_alpha_bound, + "ML_BSSN::alpha", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN::alpha!"); + + } + + if (CCTK_EQUALS(phi_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_phi_bound = -1; + if (handle_phi_bound < 0) handle_phi_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_phi_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_phi_bound , phi_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_phi_bound ,phi_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_phi_bound, + "ML_BSSN::phi", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN::phi!"); + + } + + if (CCTK_EQUALS(gt11_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_gt11_bound = -1; + if (handle_gt11_bound < 0) handle_gt11_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_gt11_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_gt11_bound , gt11_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_gt11_bound ,gt11_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_gt11_bound, + "ML_BSSN::gt11", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN::gt11!"); + + } + + if (CCTK_EQUALS(gt12_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_gt12_bound = -1; + if (handle_gt12_bound < 0) handle_gt12_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_gt12_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_gt12_bound , gt12_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_gt12_bound ,gt12_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_gt12_bound, + "ML_BSSN::gt12", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN::gt12!"); + + } + + if (CCTK_EQUALS(gt13_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_gt13_bound = -1; + if (handle_gt13_bound < 0) handle_gt13_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_gt13_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_gt13_bound , gt13_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_gt13_bound ,gt13_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_gt13_bound, + "ML_BSSN::gt13", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN::gt13!"); + + } + + if (CCTK_EQUALS(gt22_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_gt22_bound = -1; + if (handle_gt22_bound < 0) handle_gt22_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_gt22_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_gt22_bound , gt22_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_gt22_bound ,gt22_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_gt22_bound, + "ML_BSSN::gt22", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN::gt22!"); + + } + + if (CCTK_EQUALS(gt23_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_gt23_bound = -1; + if (handle_gt23_bound < 0) handle_gt23_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_gt23_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_gt23_bound , gt23_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_gt23_bound ,gt23_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_gt23_bound, + "ML_BSSN::gt23", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN::gt23!"); + + } + + if (CCTK_EQUALS(gt33_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_gt33_bound = -1; + if (handle_gt33_bound < 0) handle_gt33_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_gt33_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_gt33_bound , gt33_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_gt33_bound ,gt33_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_gt33_bound, + "ML_BSSN::gt33", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN::gt33!"); + + } + + if (CCTK_EQUALS(beta1_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_beta1_bound = -1; + if (handle_beta1_bound < 0) handle_beta1_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_beta1_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_beta1_bound , beta1_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_beta1_bound ,beta1_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_beta1_bound, + "ML_BSSN::beta1", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN::beta1!"); + + } + + if (CCTK_EQUALS(beta2_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_beta2_bound = -1; + if (handle_beta2_bound < 0) handle_beta2_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_beta2_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_beta2_bound , beta2_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_beta2_bound ,beta2_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_beta2_bound, + "ML_BSSN::beta2", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN::beta2!"); + + } + + if (CCTK_EQUALS(beta3_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_beta3_bound = -1; + if (handle_beta3_bound < 0) handle_beta3_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_beta3_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_beta3_bound , beta3_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_beta3_bound ,beta3_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_beta3_bound, + "ML_BSSN::beta3", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN::beta3!"); + + } + + if (CCTK_EQUALS(trK_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_trK_bound = -1; + if (handle_trK_bound < 0) handle_trK_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_trK_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_trK_bound , trK_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_trK_bound ,trK_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_trK_bound, + "ML_BSSN::trK", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN::trK!"); + + } + + if (CCTK_EQUALS(ML_curv_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_ML_curv_bound = -1; + if (handle_ML_curv_bound < 0) handle_ML_curv_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_curv_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_curv_bound ,ML_curv_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_curv_bound, + "ML_BSSN::ML_curv", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Scalar BC for ML_BSSN::ML_curv!"); + + } + + if (CCTK_EQUALS(ML_dtlapse_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_ML_dtlapse_bound = -1; + if (handle_ML_dtlapse_bound < 0) handle_ML_dtlapse_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_dtlapse_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_dtlapse_bound ,ML_dtlapse_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_dtlapse_bound, + "ML_BSSN::ML_dtlapse", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Scalar BC for ML_BSSN::ML_dtlapse!"); + + } + + if (CCTK_EQUALS(ML_dtshift_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_ML_dtshift_bound = -1; + if (handle_ML_dtshift_bound < 0) handle_ML_dtshift_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_dtshift_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_dtshift_bound ,ML_dtshift_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_dtshift_bound, + "ML_BSSN::ML_dtshift", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Scalar BC for ML_BSSN::ML_dtshift!"); + + } + + if (CCTK_EQUALS(ML_Gamma_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_ML_Gamma_bound = -1; + if (handle_ML_Gamma_bound < 0) handle_ML_Gamma_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_Gamma_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_Gamma_bound ,ML_Gamma_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_Gamma_bound, + "ML_BSSN::ML_Gamma", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Scalar BC for ML_BSSN::ML_Gamma!"); + + } + + if (CCTK_EQUALS(ML_lapse_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_ML_lapse_bound = -1; + if (handle_ML_lapse_bound < 0) handle_ML_lapse_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_lapse_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_lapse_bound ,ML_lapse_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_lapse_bound, + "ML_BSSN::ML_lapse", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Scalar BC for ML_BSSN::ML_lapse!"); + + } + + if (CCTK_EQUALS(ML_log_confac_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_ML_log_confac_bound = -1; + if (handle_ML_log_confac_bound < 0) handle_ML_log_confac_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_log_confac_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_log_confac_bound ,ML_log_confac_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_log_confac_bound, + "ML_BSSN::ML_log_confac", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Scalar BC for ML_BSSN::ML_log_confac!"); + + } + + if (CCTK_EQUALS(ML_metric_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_ML_metric_bound = -1; + if (handle_ML_metric_bound < 0) handle_ML_metric_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_metric_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_metric_bound ,ML_metric_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_metric_bound, + "ML_BSSN::ML_metric", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Scalar BC for ML_BSSN::ML_metric!"); + + } + + if (CCTK_EQUALS(ML_shift_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_ML_shift_bound = -1; + if (handle_ML_shift_bound < 0) handle_ML_shift_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_shift_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_shift_bound ,ML_shift_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_shift_bound, + "ML_BSSN::ML_shift", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Scalar BC for ML_BSSN::ML_shift!"); + + } + + if (CCTK_EQUALS(ML_trace_curv_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_ML_trace_curv_bound = -1; + if (handle_ML_trace_curv_bound < 0) handle_ML_trace_curv_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_trace_curv_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_trace_curv_bound ,ML_trace_curv_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_trace_curv_bound, + "ML_BSSN::ML_trace_curv", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Scalar BC for ML_BSSN::ML_trace_curv!"); + + } + + if (CCTK_EQUALS(At11_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_At11_bound = -1; + if (handle_At11_bound < 0) handle_At11_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_At11_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_At11_bound ,At11_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_At11_bound, + "ML_BSSN::At11", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN::At11!"); + + } + + if (CCTK_EQUALS(At12_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_At12_bound = -1; + if (handle_At12_bound < 0) handle_At12_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_At12_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_At12_bound ,At12_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_At12_bound, + "ML_BSSN::At12", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN::At12!"); + + } + + if (CCTK_EQUALS(At13_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_At13_bound = -1; + if (handle_At13_bound < 0) handle_At13_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_At13_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_At13_bound ,At13_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_At13_bound, + "ML_BSSN::At13", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN::At13!"); + + } + + if (CCTK_EQUALS(At22_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_At22_bound = -1; + if (handle_At22_bound < 0) handle_At22_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_At22_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_At22_bound ,At22_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_At22_bound, + "ML_BSSN::At22", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN::At22!"); + + } + + if (CCTK_EQUALS(At23_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_At23_bound = -1; + if (handle_At23_bound < 0) handle_At23_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_At23_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_At23_bound ,At23_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_At23_bound, + "ML_BSSN::At23", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN::At23!"); + + } + + if (CCTK_EQUALS(At33_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_At33_bound = -1; + if (handle_At33_bound < 0) handle_At33_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_At33_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_At33_bound ,At33_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_At33_bound, + "ML_BSSN::At33", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN::At33!"); + + } + + if (CCTK_EQUALS(A_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_A_bound = -1; + if (handle_A_bound < 0) handle_A_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_A_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_A_bound ,A_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_A_bound, + "ML_BSSN::A", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN::A!"); + + } + + if (CCTK_EQUALS(B1_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_B1_bound = -1; + if (handle_B1_bound < 0) handle_B1_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_B1_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_B1_bound ,B1_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_B1_bound, + "ML_BSSN::B1", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN::B1!"); + + } + + if (CCTK_EQUALS(B2_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_B2_bound = -1; + if (handle_B2_bound < 0) handle_B2_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_B2_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_B2_bound ,B2_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_B2_bound, + "ML_BSSN::B2", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN::B2!"); + + } + + if (CCTK_EQUALS(B3_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_B3_bound = -1; + if (handle_B3_bound < 0) handle_B3_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_B3_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_B3_bound ,B3_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_B3_bound, + "ML_BSSN::B3", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN::B3!"); + + } + + if (CCTK_EQUALS(Xt1_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_Xt1_bound = -1; + if (handle_Xt1_bound < 0) handle_Xt1_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_Xt1_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_Xt1_bound ,Xt1_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_Xt1_bound, + "ML_BSSN::Xt1", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN::Xt1!"); + + } + + if (CCTK_EQUALS(Xt2_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_Xt2_bound = -1; + if (handle_Xt2_bound < 0) handle_Xt2_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_Xt2_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_Xt2_bound ,Xt2_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_Xt2_bound, + "ML_BSSN::Xt2", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN::Xt2!"); + + } + + if (CCTK_EQUALS(Xt3_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_Xt3_bound = -1; + if (handle_Xt3_bound < 0) handle_Xt3_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_Xt3_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_Xt3_bound ,Xt3_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_Xt3_bound, + "ML_BSSN::Xt3", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN::Xt3!"); + + } + + if (CCTK_EQUALS(alpha_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_alpha_bound = -1; + if (handle_alpha_bound < 0) handle_alpha_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_alpha_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_alpha_bound ,alpha_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_alpha_bound, + "ML_BSSN::alpha", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN::alpha!"); + + } + + if (CCTK_EQUALS(phi_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_phi_bound = -1; + if (handle_phi_bound < 0) handle_phi_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_phi_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_phi_bound ,phi_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_phi_bound, + "ML_BSSN::phi", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN::phi!"); + + } + + if (CCTK_EQUALS(gt11_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_gt11_bound = -1; + if (handle_gt11_bound < 0) handle_gt11_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_gt11_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_gt11_bound ,gt11_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_gt11_bound, + "ML_BSSN::gt11", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN::gt11!"); + + } + + if (CCTK_EQUALS(gt12_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_gt12_bound = -1; + if (handle_gt12_bound < 0) handle_gt12_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_gt12_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_gt12_bound ,gt12_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_gt12_bound, + "ML_BSSN::gt12", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN::gt12!"); + + } + + if (CCTK_EQUALS(gt13_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_gt13_bound = -1; + if (handle_gt13_bound < 0) handle_gt13_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_gt13_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_gt13_bound ,gt13_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_gt13_bound, + "ML_BSSN::gt13", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN::gt13!"); + + } + + if (CCTK_EQUALS(gt22_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_gt22_bound = -1; + if (handle_gt22_bound < 0) handle_gt22_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_gt22_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_gt22_bound ,gt22_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_gt22_bound, + "ML_BSSN::gt22", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN::gt22!"); + + } + + if (CCTK_EQUALS(gt23_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_gt23_bound = -1; + if (handle_gt23_bound < 0) handle_gt23_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_gt23_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_gt23_bound ,gt23_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_gt23_bound, + "ML_BSSN::gt23", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN::gt23!"); + + } + + if (CCTK_EQUALS(gt33_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_gt33_bound = -1; + if (handle_gt33_bound < 0) handle_gt33_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_gt33_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_gt33_bound ,gt33_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_gt33_bound, + "ML_BSSN::gt33", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN::gt33!"); + + } + + if (CCTK_EQUALS(beta1_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_beta1_bound = -1; + if (handle_beta1_bound < 0) handle_beta1_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_beta1_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_beta1_bound ,beta1_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_beta1_bound, + "ML_BSSN::beta1", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN::beta1!"); + + } + + if (CCTK_EQUALS(beta2_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_beta2_bound = -1; + if (handle_beta2_bound < 0) handle_beta2_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_beta2_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_beta2_bound ,beta2_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_beta2_bound, + "ML_BSSN::beta2", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN::beta2!"); + + } + + if (CCTK_EQUALS(beta3_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_beta3_bound = -1; + if (handle_beta3_bound < 0) handle_beta3_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_beta3_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_beta3_bound ,beta3_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_beta3_bound, + "ML_BSSN::beta3", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN::beta3!"); + + } + + if (CCTK_EQUALS(trK_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_trK_bound = -1; + if (handle_trK_bound < 0) handle_trK_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_trK_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_trK_bound ,trK_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_trK_bound, + "ML_BSSN::trK", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN::trK!"); + + } + return; +} + + + +/* template for entries in parameter file: +#$bound$#ML_BSSN::ML_curv_bound = "skip" +#$bound$#ML_BSSN::ML_curv_bound_speed = 1.0 +#$bound$#ML_BSSN::ML_curv_bound_limit = 0.0 +#$bound$#ML_BSSN::ML_curv_bound_scalar = 0.0 + +#$bound$#ML_BSSN::ML_dtlapse_bound = "skip" +#$bound$#ML_BSSN::ML_dtlapse_bound_speed = 1.0 +#$bound$#ML_BSSN::ML_dtlapse_bound_limit = 0.0 +#$bound$#ML_BSSN::ML_dtlapse_bound_scalar = 0.0 + +#$bound$#ML_BSSN::ML_dtshift_bound = "skip" +#$bound$#ML_BSSN::ML_dtshift_bound_speed = 1.0 +#$bound$#ML_BSSN::ML_dtshift_bound_limit = 0.0 +#$bound$#ML_BSSN::ML_dtshift_bound_scalar = 0.0 + +#$bound$#ML_BSSN::ML_Gamma_bound = "skip" +#$bound$#ML_BSSN::ML_Gamma_bound_speed = 1.0 +#$bound$#ML_BSSN::ML_Gamma_bound_limit = 0.0 +#$bound$#ML_BSSN::ML_Gamma_bound_scalar = 0.0 + +#$bound$#ML_BSSN::ML_lapse_bound = "skip" +#$bound$#ML_BSSN::ML_lapse_bound_speed = 1.0 +#$bound$#ML_BSSN::ML_lapse_bound_limit = 0.0 +#$bound$#ML_BSSN::ML_lapse_bound_scalar = 0.0 + +#$bound$#ML_BSSN::ML_log_confac_bound = "skip" +#$bound$#ML_BSSN::ML_log_confac_bound_speed = 1.0 +#$bound$#ML_BSSN::ML_log_confac_bound_limit = 0.0 +#$bound$#ML_BSSN::ML_log_confac_bound_scalar = 0.0 + +#$bound$#ML_BSSN::ML_metric_bound = "skip" +#$bound$#ML_BSSN::ML_metric_bound_speed = 1.0 +#$bound$#ML_BSSN::ML_metric_bound_limit = 0.0 +#$bound$#ML_BSSN::ML_metric_bound_scalar = 0.0 + +#$bound$#ML_BSSN::ML_shift_bound = "skip" +#$bound$#ML_BSSN::ML_shift_bound_speed = 1.0 +#$bound$#ML_BSSN::ML_shift_bound_limit = 0.0 +#$bound$#ML_BSSN::ML_shift_bound_scalar = 0.0 + +#$bound$#ML_BSSN::ML_trace_curv_bound = "skip" +#$bound$#ML_BSSN::ML_trace_curv_bound_speed = 1.0 +#$bound$#ML_BSSN::ML_trace_curv_bound_limit = 0.0 +#$bound$#ML_BSSN::ML_trace_curv_bound_scalar = 0.0 + +#$bound$#ML_BSSN::At11_bound = "skip" +#$bound$#ML_BSSN::At11_bound_speed = 1.0 +#$bound$#ML_BSSN::At11_bound_limit = 0.0 +#$bound$#ML_BSSN::At11_bound_scalar = 0.0 + +#$bound$#ML_BSSN::At12_bound = "skip" +#$bound$#ML_BSSN::At12_bound_speed = 1.0 +#$bound$#ML_BSSN::At12_bound_limit = 0.0 +#$bound$#ML_BSSN::At12_bound_scalar = 0.0 + +#$bound$#ML_BSSN::At13_bound = "skip" +#$bound$#ML_BSSN::At13_bound_speed = 1.0 +#$bound$#ML_BSSN::At13_bound_limit = 0.0 +#$bound$#ML_BSSN::At13_bound_scalar = 0.0 + +#$bound$#ML_BSSN::At22_bound = "skip" +#$bound$#ML_BSSN::At22_bound_speed = 1.0 +#$bound$#ML_BSSN::At22_bound_limit = 0.0 +#$bound$#ML_BSSN::At22_bound_scalar = 0.0 + +#$bound$#ML_BSSN::At23_bound = "skip" +#$bound$#ML_BSSN::At23_bound_speed = 1.0 +#$bound$#ML_BSSN::At23_bound_limit = 0.0 +#$bound$#ML_BSSN::At23_bound_scalar = 0.0 + +#$bound$#ML_BSSN::At33_bound = "skip" +#$bound$#ML_BSSN::At33_bound_speed = 1.0 +#$bound$#ML_BSSN::At33_bound_limit = 0.0 +#$bound$#ML_BSSN::At33_bound_scalar = 0.0 + +#$bound$#ML_BSSN::A_bound = "skip" +#$bound$#ML_BSSN::A_bound_speed = 1.0 +#$bound$#ML_BSSN::A_bound_limit = 0.0 +#$bound$#ML_BSSN::A_bound_scalar = 0.0 + +#$bound$#ML_BSSN::B1_bound = "skip" +#$bound$#ML_BSSN::B1_bound_speed = 1.0 +#$bound$#ML_BSSN::B1_bound_limit = 0.0 +#$bound$#ML_BSSN::B1_bound_scalar = 0.0 + +#$bound$#ML_BSSN::B2_bound = "skip" +#$bound$#ML_BSSN::B2_bound_speed = 1.0 +#$bound$#ML_BSSN::B2_bound_limit = 0.0 +#$bound$#ML_BSSN::B2_bound_scalar = 0.0 + +#$bound$#ML_BSSN::B3_bound = "skip" +#$bound$#ML_BSSN::B3_bound_speed = 1.0 +#$bound$#ML_BSSN::B3_bound_limit = 0.0 +#$bound$#ML_BSSN::B3_bound_scalar = 0.0 + +#$bound$#ML_BSSN::Xt1_bound = "skip" +#$bound$#ML_BSSN::Xt1_bound_speed = 1.0 +#$bound$#ML_BSSN::Xt1_bound_limit = 0.0 +#$bound$#ML_BSSN::Xt1_bound_scalar = 0.0 + +#$bound$#ML_BSSN::Xt2_bound = "skip" +#$bound$#ML_BSSN::Xt2_bound_speed = 1.0 +#$bound$#ML_BSSN::Xt2_bound_limit = 0.0 +#$bound$#ML_BSSN::Xt2_bound_scalar = 0.0 + +#$bound$#ML_BSSN::Xt3_bound = "skip" +#$bound$#ML_BSSN::Xt3_bound_speed = 1.0 +#$bound$#ML_BSSN::Xt3_bound_limit = 0.0 +#$bound$#ML_BSSN::Xt3_bound_scalar = 0.0 + +#$bound$#ML_BSSN::alpha_bound = "skip" +#$bound$#ML_BSSN::alpha_bound_speed = 1.0 +#$bound$#ML_BSSN::alpha_bound_limit = 0.0 +#$bound$#ML_BSSN::alpha_bound_scalar = 0.0 + +#$bound$#ML_BSSN::phi_bound = "skip" +#$bound$#ML_BSSN::phi_bound_speed = 1.0 +#$bound$#ML_BSSN::phi_bound_limit = 0.0 +#$bound$#ML_BSSN::phi_bound_scalar = 0.0 + +#$bound$#ML_BSSN::gt11_bound = "skip" +#$bound$#ML_BSSN::gt11_bound_speed = 1.0 +#$bound$#ML_BSSN::gt11_bound_limit = 0.0 +#$bound$#ML_BSSN::gt11_bound_scalar = 0.0 + +#$bound$#ML_BSSN::gt12_bound = "skip" +#$bound$#ML_BSSN::gt12_bound_speed = 1.0 +#$bound$#ML_BSSN::gt12_bound_limit = 0.0 +#$bound$#ML_BSSN::gt12_bound_scalar = 0.0 + +#$bound$#ML_BSSN::gt13_bound = "skip" +#$bound$#ML_BSSN::gt13_bound_speed = 1.0 +#$bound$#ML_BSSN::gt13_bound_limit = 0.0 +#$bound$#ML_BSSN::gt13_bound_scalar = 0.0 + +#$bound$#ML_BSSN::gt22_bound = "skip" +#$bound$#ML_BSSN::gt22_bound_speed = 1.0 +#$bound$#ML_BSSN::gt22_bound_limit = 0.0 +#$bound$#ML_BSSN::gt22_bound_scalar = 0.0 + +#$bound$#ML_BSSN::gt23_bound = "skip" +#$bound$#ML_BSSN::gt23_bound_speed = 1.0 +#$bound$#ML_BSSN::gt23_bound_limit = 0.0 +#$bound$#ML_BSSN::gt23_bound_scalar = 0.0 + +#$bound$#ML_BSSN::gt33_bound = "skip" +#$bound$#ML_BSSN::gt33_bound_speed = 1.0 +#$bound$#ML_BSSN::gt33_bound_limit = 0.0 +#$bound$#ML_BSSN::gt33_bound_scalar = 0.0 + +#$bound$#ML_BSSN::beta1_bound = "skip" +#$bound$#ML_BSSN::beta1_bound_speed = 1.0 +#$bound$#ML_BSSN::beta1_bound_limit = 0.0 +#$bound$#ML_BSSN::beta1_bound_scalar = 0.0 + +#$bound$#ML_BSSN::beta2_bound = "skip" +#$bound$#ML_BSSN::beta2_bound_speed = 1.0 +#$bound$#ML_BSSN::beta2_bound_limit = 0.0 +#$bound$#ML_BSSN::beta2_bound_scalar = 0.0 + +#$bound$#ML_BSSN::beta3_bound = "skip" +#$bound$#ML_BSSN::beta3_bound_speed = 1.0 +#$bound$#ML_BSSN::beta3_bound_limit = 0.0 +#$bound$#ML_BSSN::beta3_bound_scalar = 0.0 + +#$bound$#ML_BSSN::trK_bound = "skip" +#$bound$#ML_BSSN::trK_bound_speed = 1.0 +#$bound$#ML_BSSN::trK_bound_limit = 0.0 +#$bound$#ML_BSSN::trK_bound_scalar = 0.0 + +*/ + diff --git a/ML_BSSN/src/ML_BSSN_Minkowski.cc b/ML_BSSN/src/ML_BSSN_Minkowski.cc new file mode 100644 index 0000000..68f964c --- /dev/null +++ b/ML_BSSN/src/ML_BSSN_Minkowski.cc @@ -0,0 +1,187 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +static void ML_BSSN_Minkowski_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_BSSN_Minkowski_Body"); + } + + if (cctk_iteration % ML_BSSN_Minkowski_calc_every != ML_BSSN_Minkowski_calc_offset) + { + return; + } + + const char *groups[] = {"ML_BSSN::ML_curv","ML_BSSN::ML_dtlapse","ML_BSSN::ML_dtshift","ML_BSSN::ML_Gamma","ML_BSSN::ML_lapse","ML_BSSN::ML_log_confac","ML_BSSN::ML_metric","ML_BSSN::ML_shift","ML_BSSN::ML_trace_curv"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_BSSN_Minkowski", 9, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o12dx = 0.0833333333333333333333333333333*INV(dx); + CCTK_REAL const p1o12dy = 0.0833333333333333333333333333333*INV(dy); + CCTK_REAL const p1o12dz = 0.0833333333333333333333333333333*INV(dz); + CCTK_REAL const p1o144dxdy = 0.00694444444444444444444444444444*INV(dx)*INV(dy); + CCTK_REAL const p1o144dxdz = 0.00694444444444444444444444444444*INV(dx)*INV(dz); + CCTK_REAL const p1o144dydz = 0.00694444444444444444444444444444*INV(dy)*INV(dz); + CCTK_REAL const p1o24dx = 0.0416666666666666666666666666667*INV(dx); + CCTK_REAL const p1o24dy = 0.0416666666666666666666666666667*INV(dy); + CCTK_REAL const p1o24dz = 0.0416666666666666666666666666667*INV(dz); + CCTK_REAL const p1o64dx = 0.015625*INV(dx); + CCTK_REAL const p1o64dy = 0.015625*INV(dy); + CCTK_REAL const p1o64dz = 0.015625*INV(dz); + CCTK_REAL const p1odx = INV(dx); + CCTK_REAL const p1ody = INV(dy); + CCTK_REAL const p1odz = INV(dz); + CCTK_REAL const pm1o12dx2 = -0.0833333333333333333333333333333*INV(SQR(dx)); + CCTK_REAL const pm1o12dy2 = -0.0833333333333333333333333333333*INV(SQR(dy)); + CCTK_REAL const pm1o12dz2 = -0.0833333333333333333333333333333*INV(SQR(dz)); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_BSSN_Minkowski, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + + /* Include user supplied include files */ + + /* Precompute derivatives */ + + /* Calculate temporaries and grid functions */ + CCTK_REAL phiL = IfThen(ToReal(conformalMethod),1,0); + + CCTK_REAL gt11L = 1; + + CCTK_REAL gt12L = 0; + + CCTK_REAL gt13L = 0; + + CCTK_REAL gt22L = 1; + + CCTK_REAL gt23L = 0; + + CCTK_REAL gt33L = 1; + + CCTK_REAL trKL = 0; + + CCTK_REAL At11L = 0; + + CCTK_REAL At12L = 0; + + CCTK_REAL At13L = 0; + + CCTK_REAL At22L = 0; + + CCTK_REAL At23L = 0; + + CCTK_REAL At33L = 0; + + CCTK_REAL Xt1L = 0; + + CCTK_REAL Xt2L = 0; + + CCTK_REAL Xt3L = 0; + + CCTK_REAL alphaL = 1; + + CCTK_REAL AL = 0; + + CCTK_REAL beta1L = 0; + + CCTK_REAL beta2L = 0; + + CCTK_REAL beta3L = 0; + + CCTK_REAL B1L = 0; + + CCTK_REAL B2L = 0; + + CCTK_REAL B3L = 0; + + + /* Copy local copies back to grid functions */ + A[index] = AL; + alpha[index] = alphaL; + At11[index] = At11L; + At12[index] = At12L; + At13[index] = At13L; + At22[index] = At22L; + At23[index] = At23L; + At33[index] = At33L; + B1[index] = B1L; + B2[index] = B2L; + B3[index] = B3L; + beta1[index] = beta1L; + beta2[index] = beta2L; + beta3[index] = beta3L; + gt11[index] = gt11L; + gt12[index] = gt12L; + gt13[index] = gt13L; + gt22[index] = gt22L; + gt23[index] = gt23L; + gt33[index] = gt33L; + phi[index] = phiL; + trK[index] = trKL; + Xt1[index] = Xt1L; + Xt2[index] = Xt2L; + Xt3[index] = Xt3L; + } + LC_ENDLOOP3 (ML_BSSN_Minkowski); +} + +extern "C" void ML_BSSN_Minkowski(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverEverything(cctkGH, &ML_BSSN_Minkowski_Body); +} diff --git a/ML_BSSN/src/ML_BSSN_RHS1.cc b/ML_BSSN/src/ML_BSSN_RHS1.cc new file mode 100644 index 0000000..1e629de --- /dev/null +++ b/ML_BSSN/src/ML_BSSN_RHS1.cc @@ -0,0 +1,846 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +extern "C" void ML_BSSN_RHS1_SelectBCs(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT ierr = 0; + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN::ML_dtlapserhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN::ML_dtlapserhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN::ML_dtshiftrhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN::ML_dtshiftrhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN::ML_Gammarhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN::ML_Gammarhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN::ML_lapserhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN::ML_lapserhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN::ML_log_confacrhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN::ML_log_confacrhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN::ML_metricrhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN::ML_metricrhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN::ML_shiftrhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN::ML_shiftrhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN::ML_trace_curvrhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN::ML_trace_curvrhs."); + return; +} + +static void ML_BSSN_RHS1_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_BSSN_RHS1_Body"); + } + + if (cctk_iteration % ML_BSSN_RHS1_calc_every != ML_BSSN_RHS1_calc_offset) + { + return; + } + + const char *groups[] = {"grid::coordinates","Grid::coordinates","ML_BSSN::ML_curv","ML_BSSN::ML_dtlapse","ML_BSSN::ML_dtlapserhs","ML_BSSN::ML_dtshift","ML_BSSN::ML_dtshiftrhs","ML_BSSN::ML_Gamma","ML_BSSN::ML_Gammarhs","ML_BSSN::ML_lapse","ML_BSSN::ML_lapserhs","ML_BSSN::ML_log_confac","ML_BSSN::ML_log_confacrhs","ML_BSSN::ML_metric","ML_BSSN::ML_metricrhs","ML_BSSN::ML_shift","ML_BSSN::ML_shiftrhs","ML_BSSN::ML_trace_curv","ML_BSSN::ML_trace_curvrhs"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_BSSN_RHS1", 19, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o12dx = 0.0833333333333333333333333333333*INV(dx); + CCTK_REAL const p1o12dy = 0.0833333333333333333333333333333*INV(dy); + CCTK_REAL const p1o12dz = 0.0833333333333333333333333333333*INV(dz); + CCTK_REAL const p1o144dxdy = 0.00694444444444444444444444444444*INV(dx)*INV(dy); + CCTK_REAL const p1o144dxdz = 0.00694444444444444444444444444444*INV(dx)*INV(dz); + CCTK_REAL const p1o144dydz = 0.00694444444444444444444444444444*INV(dy)*INV(dz); + CCTK_REAL const p1o24dx = 0.0416666666666666666666666666667*INV(dx); + CCTK_REAL const p1o24dy = 0.0416666666666666666666666666667*INV(dy); + CCTK_REAL const p1o24dz = 0.0416666666666666666666666666667*INV(dz); + CCTK_REAL const p1o64dx = 0.015625*INV(dx); + CCTK_REAL const p1o64dy = 0.015625*INV(dy); + CCTK_REAL const p1o64dz = 0.015625*INV(dz); + CCTK_REAL const p1odx = INV(dx); + CCTK_REAL const p1ody = INV(dy); + CCTK_REAL const p1odz = INV(dz); + CCTK_REAL const pm1o12dx2 = -0.0833333333333333333333333333333*INV(SQR(dx)); + CCTK_REAL const pm1o12dy2 = -0.0833333333333333333333333333333*INV(SQR(dy)); + CCTK_REAL const pm1o12dz2 = -0.0833333333333333333333333333333*INV(SQR(dz)); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_BSSN_RHS1, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + CCTK_REAL AL = A[index]; + CCTK_REAL alphaL = alpha[index]; + CCTK_REAL At11L = At11[index]; + CCTK_REAL At12L = At12[index]; + CCTK_REAL At13L = At13[index]; + CCTK_REAL At22L = At22[index]; + CCTK_REAL At23L = At23[index]; + CCTK_REAL At33L = At33[index]; + CCTK_REAL B1L = B1[index]; + CCTK_REAL B2L = B2[index]; + CCTK_REAL B3L = B3[index]; + CCTK_REAL beta1L = beta1[index]; + CCTK_REAL beta2L = beta2[index]; + CCTK_REAL beta3L = beta3[index]; + CCTK_REAL eTttL = (*stress_energy_state) ? eTtt[index] : ToReal(0.0); + CCTK_REAL eTtxL = (*stress_energy_state) ? eTtx[index] : ToReal(0.0); + CCTK_REAL eTtyL = (*stress_energy_state) ? eTty[index] : ToReal(0.0); + CCTK_REAL eTtzL = (*stress_energy_state) ? eTtz[index] : ToReal(0.0); + CCTK_REAL eTxxL = (*stress_energy_state) ? eTxx[index] : ToReal(0.0); + CCTK_REAL eTxyL = (*stress_energy_state) ? eTxy[index] : ToReal(0.0); + CCTK_REAL eTxzL = (*stress_energy_state) ? eTxz[index] : ToReal(0.0); + CCTK_REAL eTyyL = (*stress_energy_state) ? eTyy[index] : ToReal(0.0); + CCTK_REAL eTyzL = (*stress_energy_state) ? eTyz[index] : ToReal(0.0); + CCTK_REAL eTzzL = (*stress_energy_state) ? eTzz[index] : ToReal(0.0); + CCTK_REAL gt11L = gt11[index]; + CCTK_REAL gt12L = gt12[index]; + CCTK_REAL gt13L = gt13[index]; + CCTK_REAL gt22L = gt22[index]; + CCTK_REAL gt23L = gt23[index]; + CCTK_REAL gt33L = gt33[index]; + CCTK_REAL phiL = phi[index]; + CCTK_REAL rL = r[index]; + CCTK_REAL trKL = trK[index]; + CCTK_REAL Xt1L = Xt1[index]; + CCTK_REAL Xt2L = Xt2[index]; + CCTK_REAL Xt3L = Xt3[index]; + + /* Include user supplied include files */ + + /* Precompute derivatives */ + CCTK_REAL const PDdissipationNth1A = PDdissipationNth1(&A[index]); + CCTK_REAL const PDdissipationNth2A = PDdissipationNth2(&A[index]); + CCTK_REAL const PDdissipationNth3A = PDdissipationNth3(&A[index]); + CCTK_REAL const PDupwindNthAnti1A = PDupwindNthAnti1(&A[index]); + CCTK_REAL const PDupwindNthSymm1A = PDupwindNthSymm1(&A[index]); + CCTK_REAL const PDupwindNthAnti2A = PDupwindNthAnti2(&A[index]); + CCTK_REAL const PDupwindNthSymm2A = PDupwindNthSymm2(&A[index]); + CCTK_REAL const PDupwindNthAnti3A = PDupwindNthAnti3(&A[index]); + CCTK_REAL const PDupwindNthSymm3A = PDupwindNthSymm3(&A[index]); + CCTK_REAL const PDstandardNth1alpha = PDstandardNth1(&alpha[index]); + CCTK_REAL const PDstandardNth2alpha = PDstandardNth2(&alpha[index]); + CCTK_REAL const PDstandardNth3alpha = PDstandardNth3(&alpha[index]); + CCTK_REAL const PDstandardNth11alpha = PDstandardNth11(&alpha[index]); + CCTK_REAL const PDstandardNth22alpha = PDstandardNth22(&alpha[index]); + CCTK_REAL const PDstandardNth33alpha = PDstandardNth33(&alpha[index]); + CCTK_REAL const PDstandardNth12alpha = PDstandardNth12(&alpha[index]); + CCTK_REAL const PDstandardNth13alpha = PDstandardNth13(&alpha[index]); + CCTK_REAL const PDstandardNth23alpha = PDstandardNth23(&alpha[index]); + CCTK_REAL const PDdissipationNth1alpha = PDdissipationNth1(&alpha[index]); + CCTK_REAL const PDdissipationNth2alpha = PDdissipationNth2(&alpha[index]); + CCTK_REAL const PDdissipationNth3alpha = PDdissipationNth3(&alpha[index]); + CCTK_REAL const PDupwindNthAnti1alpha = PDupwindNthAnti1(&alpha[index]); + CCTK_REAL const PDupwindNthSymm1alpha = PDupwindNthSymm1(&alpha[index]); + CCTK_REAL const PDupwindNthAnti2alpha = PDupwindNthAnti2(&alpha[index]); + CCTK_REAL const PDupwindNthSymm2alpha = PDupwindNthSymm2(&alpha[index]); + CCTK_REAL const PDupwindNthAnti3alpha = PDupwindNthAnti3(&alpha[index]); + CCTK_REAL const PDupwindNthSymm3alpha = PDupwindNthSymm3(&alpha[index]); + CCTK_REAL const PDdissipationNth1B1 = PDdissipationNth1(&B1[index]); + CCTK_REAL const PDdissipationNth2B1 = PDdissipationNth2(&B1[index]); + CCTK_REAL const PDdissipationNth3B1 = PDdissipationNth3(&B1[index]); + CCTK_REAL const PDupwindNthAnti1B1 = PDupwindNthAnti1(&B1[index]); + CCTK_REAL const PDupwindNthSymm1B1 = PDupwindNthSymm1(&B1[index]); + CCTK_REAL const PDupwindNthAnti2B1 = PDupwindNthAnti2(&B1[index]); + CCTK_REAL const PDupwindNthSymm2B1 = PDupwindNthSymm2(&B1[index]); + CCTK_REAL const PDupwindNthAnti3B1 = PDupwindNthAnti3(&B1[index]); + CCTK_REAL const PDupwindNthSymm3B1 = PDupwindNthSymm3(&B1[index]); + CCTK_REAL const PDdissipationNth1B2 = PDdissipationNth1(&B2[index]); + CCTK_REAL const PDdissipationNth2B2 = PDdissipationNth2(&B2[index]); + CCTK_REAL const PDdissipationNth3B2 = PDdissipationNth3(&B2[index]); + CCTK_REAL const PDupwindNthAnti1B2 = PDupwindNthAnti1(&B2[index]); + CCTK_REAL const PDupwindNthSymm1B2 = PDupwindNthSymm1(&B2[index]); + CCTK_REAL const PDupwindNthAnti2B2 = PDupwindNthAnti2(&B2[index]); + CCTK_REAL const PDupwindNthSymm2B2 = PDupwindNthSymm2(&B2[index]); + CCTK_REAL const PDupwindNthAnti3B2 = PDupwindNthAnti3(&B2[index]); + CCTK_REAL const PDupwindNthSymm3B2 = PDupwindNthSymm3(&B2[index]); + CCTK_REAL const PDdissipationNth1B3 = PDdissipationNth1(&B3[index]); + CCTK_REAL const PDdissipationNth2B3 = PDdissipationNth2(&B3[index]); + CCTK_REAL const PDdissipationNth3B3 = PDdissipationNth3(&B3[index]); + CCTK_REAL const PDupwindNthAnti1B3 = PDupwindNthAnti1(&B3[index]); + CCTK_REAL const PDupwindNthSymm1B3 = PDupwindNthSymm1(&B3[index]); + CCTK_REAL const PDupwindNthAnti2B3 = PDupwindNthAnti2(&B3[index]); + CCTK_REAL const PDupwindNthSymm2B3 = PDupwindNthSymm2(&B3[index]); + CCTK_REAL const PDupwindNthAnti3B3 = PDupwindNthAnti3(&B3[index]); + CCTK_REAL const PDupwindNthSymm3B3 = PDupwindNthSymm3(&B3[index]); + CCTK_REAL const PDstandardNth1beta1 = PDstandardNth1(&beta1[index]); + CCTK_REAL const PDstandardNth2beta1 = PDstandardNth2(&beta1[index]); + CCTK_REAL const PDstandardNth3beta1 = PDstandardNth3(&beta1[index]); + CCTK_REAL const PDstandardNth11beta1 = PDstandardNth11(&beta1[index]); + CCTK_REAL const PDstandardNth22beta1 = PDstandardNth22(&beta1[index]); + CCTK_REAL const PDstandardNth33beta1 = PDstandardNth33(&beta1[index]); + CCTK_REAL const PDstandardNth12beta1 = PDstandardNth12(&beta1[index]); + CCTK_REAL const PDstandardNth13beta1 = PDstandardNth13(&beta1[index]); + CCTK_REAL const PDstandardNth23beta1 = PDstandardNth23(&beta1[index]); + CCTK_REAL const PDdissipationNth1beta1 = PDdissipationNth1(&beta1[index]); + CCTK_REAL const PDdissipationNth2beta1 = PDdissipationNth2(&beta1[index]); + CCTK_REAL const PDdissipationNth3beta1 = PDdissipationNth3(&beta1[index]); + CCTK_REAL const PDupwindNthAnti1beta1 = PDupwindNthAnti1(&beta1[index]); + CCTK_REAL const PDupwindNthSymm1beta1 = PDupwindNthSymm1(&beta1[index]); + CCTK_REAL const PDupwindNthAnti2beta1 = PDupwindNthAnti2(&beta1[index]); + CCTK_REAL const PDupwindNthSymm2beta1 = PDupwindNthSymm2(&beta1[index]); + CCTK_REAL const PDupwindNthAnti3beta1 = PDupwindNthAnti3(&beta1[index]); + CCTK_REAL const PDupwindNthSymm3beta1 = PDupwindNthSymm3(&beta1[index]); + CCTK_REAL const PDstandardNth1beta2 = PDstandardNth1(&beta2[index]); + CCTK_REAL const PDstandardNth2beta2 = PDstandardNth2(&beta2[index]); + CCTK_REAL const PDstandardNth3beta2 = PDstandardNth3(&beta2[index]); + CCTK_REAL const PDstandardNth11beta2 = PDstandardNth11(&beta2[index]); + CCTK_REAL const PDstandardNth22beta2 = PDstandardNth22(&beta2[index]); + CCTK_REAL const PDstandardNth33beta2 = PDstandardNth33(&beta2[index]); + CCTK_REAL const PDstandardNth12beta2 = PDstandardNth12(&beta2[index]); + CCTK_REAL const PDstandardNth13beta2 = PDstandardNth13(&beta2[index]); + CCTK_REAL const PDstandardNth23beta2 = PDstandardNth23(&beta2[index]); + CCTK_REAL const PDdissipationNth1beta2 = PDdissipationNth1(&beta2[index]); + CCTK_REAL const PDdissipationNth2beta2 = PDdissipationNth2(&beta2[index]); + CCTK_REAL const PDdissipationNth3beta2 = PDdissipationNth3(&beta2[index]); + CCTK_REAL const PDupwindNthAnti1beta2 = PDupwindNthAnti1(&beta2[index]); + CCTK_REAL const PDupwindNthSymm1beta2 = PDupwindNthSymm1(&beta2[index]); + CCTK_REAL const PDupwindNthAnti2beta2 = PDupwindNthAnti2(&beta2[index]); + CCTK_REAL const PDupwindNthSymm2beta2 = PDupwindNthSymm2(&beta2[index]); + CCTK_REAL const PDupwindNthAnti3beta2 = PDupwindNthAnti3(&beta2[index]); + CCTK_REAL const PDupwindNthSymm3beta2 = PDupwindNthSymm3(&beta2[index]); + CCTK_REAL const PDstandardNth1beta3 = PDstandardNth1(&beta3[index]); + CCTK_REAL const PDstandardNth2beta3 = PDstandardNth2(&beta3[index]); + CCTK_REAL const PDstandardNth3beta3 = PDstandardNth3(&beta3[index]); + CCTK_REAL const PDstandardNth11beta3 = PDstandardNth11(&beta3[index]); + CCTK_REAL const PDstandardNth22beta3 = PDstandardNth22(&beta3[index]); + CCTK_REAL const PDstandardNth33beta3 = PDstandardNth33(&beta3[index]); + CCTK_REAL const PDstandardNth12beta3 = PDstandardNth12(&beta3[index]); + CCTK_REAL const PDstandardNth13beta3 = PDstandardNth13(&beta3[index]); + CCTK_REAL const PDstandardNth23beta3 = PDstandardNth23(&beta3[index]); + CCTK_REAL const PDdissipationNth1beta3 = PDdissipationNth1(&beta3[index]); + CCTK_REAL const PDdissipationNth2beta3 = PDdissipationNth2(&beta3[index]); + CCTK_REAL const PDdissipationNth3beta3 = PDdissipationNth3(&beta3[index]); + CCTK_REAL const PDupwindNthAnti1beta3 = PDupwindNthAnti1(&beta3[index]); + CCTK_REAL const PDupwindNthSymm1beta3 = PDupwindNthSymm1(&beta3[index]); + CCTK_REAL const PDupwindNthAnti2beta3 = PDupwindNthAnti2(&beta3[index]); + CCTK_REAL const PDupwindNthSymm2beta3 = PDupwindNthSymm2(&beta3[index]); + CCTK_REAL const PDupwindNthAnti3beta3 = PDupwindNthAnti3(&beta3[index]); + CCTK_REAL const PDupwindNthSymm3beta3 = PDupwindNthSymm3(&beta3[index]); + CCTK_REAL const PDstandardNth1gt11 = PDstandardNth1(>11[index]); + CCTK_REAL const PDstandardNth2gt11 = PDstandardNth2(>11[index]); + CCTK_REAL const PDstandardNth3gt11 = PDstandardNth3(>11[index]); + CCTK_REAL const PDdissipationNth1gt11 = PDdissipationNth1(>11[index]); + CCTK_REAL const PDdissipationNth2gt11 = PDdissipationNth2(>11[index]); + CCTK_REAL const PDdissipationNth3gt11 = PDdissipationNth3(>11[index]); + CCTK_REAL const PDupwindNthAnti1gt11 = PDupwindNthAnti1(>11[index]); + CCTK_REAL const PDupwindNthSymm1gt11 = PDupwindNthSymm1(>11[index]); + CCTK_REAL const PDupwindNthAnti2gt11 = PDupwindNthAnti2(>11[index]); + CCTK_REAL const PDupwindNthSymm2gt11 = PDupwindNthSymm2(>11[index]); + CCTK_REAL const PDupwindNthAnti3gt11 = PDupwindNthAnti3(>11[index]); + CCTK_REAL const PDupwindNthSymm3gt11 = PDupwindNthSymm3(>11[index]); + CCTK_REAL const PDstandardNth1gt12 = PDstandardNth1(>12[index]); + CCTK_REAL const PDstandardNth2gt12 = PDstandardNth2(>12[index]); + CCTK_REAL const PDstandardNth3gt12 = PDstandardNth3(>12[index]); + CCTK_REAL const PDdissipationNth1gt12 = PDdissipationNth1(>12[index]); + CCTK_REAL const PDdissipationNth2gt12 = PDdissipationNth2(>12[index]); + CCTK_REAL const PDdissipationNth3gt12 = PDdissipationNth3(>12[index]); + CCTK_REAL const PDupwindNthAnti1gt12 = PDupwindNthAnti1(>12[index]); + CCTK_REAL const PDupwindNthSymm1gt12 = PDupwindNthSymm1(>12[index]); + CCTK_REAL const PDupwindNthAnti2gt12 = PDupwindNthAnti2(>12[index]); + CCTK_REAL const PDupwindNthSymm2gt12 = PDupwindNthSymm2(>12[index]); + CCTK_REAL const PDupwindNthAnti3gt12 = PDupwindNthAnti3(>12[index]); + CCTK_REAL const PDupwindNthSymm3gt12 = PDupwindNthSymm3(>12[index]); + CCTK_REAL const PDstandardNth1gt13 = PDstandardNth1(>13[index]); + CCTK_REAL const PDstandardNth2gt13 = PDstandardNth2(>13[index]); + CCTK_REAL const PDstandardNth3gt13 = PDstandardNth3(>13[index]); + CCTK_REAL const PDdissipationNth1gt13 = PDdissipationNth1(>13[index]); + CCTK_REAL const PDdissipationNth2gt13 = PDdissipationNth2(>13[index]); + CCTK_REAL const PDdissipationNth3gt13 = PDdissipationNth3(>13[index]); + CCTK_REAL const PDupwindNthAnti1gt13 = PDupwindNthAnti1(>13[index]); + CCTK_REAL const PDupwindNthSymm1gt13 = PDupwindNthSymm1(>13[index]); + CCTK_REAL const PDupwindNthAnti2gt13 = PDupwindNthAnti2(>13[index]); + CCTK_REAL const PDupwindNthSymm2gt13 = PDupwindNthSymm2(>13[index]); + CCTK_REAL const PDupwindNthAnti3gt13 = PDupwindNthAnti3(>13[index]); + CCTK_REAL const PDupwindNthSymm3gt13 = PDupwindNthSymm3(>13[index]); + CCTK_REAL const PDstandardNth1gt22 = PDstandardNth1(>22[index]); + CCTK_REAL const PDstandardNth2gt22 = PDstandardNth2(>22[index]); + CCTK_REAL const PDstandardNth3gt22 = PDstandardNth3(>22[index]); + CCTK_REAL const PDdissipationNth1gt22 = PDdissipationNth1(>22[index]); + CCTK_REAL const PDdissipationNth2gt22 = PDdissipationNth2(>22[index]); + CCTK_REAL const PDdissipationNth3gt22 = PDdissipationNth3(>22[index]); + CCTK_REAL const PDupwindNthAnti1gt22 = PDupwindNthAnti1(>22[index]); + CCTK_REAL const PDupwindNthSymm1gt22 = PDupwindNthSymm1(>22[index]); + CCTK_REAL const PDupwindNthAnti2gt22 = PDupwindNthAnti2(>22[index]); + CCTK_REAL const PDupwindNthSymm2gt22 = PDupwindNthSymm2(>22[index]); + CCTK_REAL const PDupwindNthAnti3gt22 = PDupwindNthAnti3(>22[index]); + CCTK_REAL const PDupwindNthSymm3gt22 = PDupwindNthSymm3(>22[index]); + CCTK_REAL const PDstandardNth1gt23 = PDstandardNth1(>23[index]); + CCTK_REAL const PDstandardNth2gt23 = PDstandardNth2(>23[index]); + CCTK_REAL const PDstandardNth3gt23 = PDstandardNth3(>23[index]); + CCTK_REAL const PDdissipationNth1gt23 = PDdissipationNth1(>23[index]); + CCTK_REAL const PDdissipationNth2gt23 = PDdissipationNth2(>23[index]); + CCTK_REAL const PDdissipationNth3gt23 = PDdissipationNth3(>23[index]); + CCTK_REAL const PDupwindNthAnti1gt23 = PDupwindNthAnti1(>23[index]); + CCTK_REAL const PDupwindNthSymm1gt23 = PDupwindNthSymm1(>23[index]); + CCTK_REAL const PDupwindNthAnti2gt23 = PDupwindNthAnti2(>23[index]); + CCTK_REAL const PDupwindNthSymm2gt23 = PDupwindNthSymm2(>23[index]); + CCTK_REAL const PDupwindNthAnti3gt23 = PDupwindNthAnti3(>23[index]); + CCTK_REAL const PDupwindNthSymm3gt23 = PDupwindNthSymm3(>23[index]); + CCTK_REAL const PDstandardNth1gt33 = PDstandardNth1(>33[index]); + CCTK_REAL const PDstandardNth2gt33 = PDstandardNth2(>33[index]); + CCTK_REAL const PDstandardNth3gt33 = PDstandardNth3(>33[index]); + CCTK_REAL const PDdissipationNth1gt33 = PDdissipationNth1(>33[index]); + CCTK_REAL const PDdissipationNth2gt33 = PDdissipationNth2(>33[index]); + CCTK_REAL const PDdissipationNth3gt33 = PDdissipationNth3(>33[index]); + CCTK_REAL const PDupwindNthAnti1gt33 = PDupwindNthAnti1(>33[index]); + CCTK_REAL const PDupwindNthSymm1gt33 = PDupwindNthSymm1(>33[index]); + CCTK_REAL const PDupwindNthAnti2gt33 = PDupwindNthAnti2(>33[index]); + CCTK_REAL const PDupwindNthSymm2gt33 = PDupwindNthSymm2(>33[index]); + CCTK_REAL const PDupwindNthAnti3gt33 = PDupwindNthAnti3(>33[index]); + CCTK_REAL const PDupwindNthSymm3gt33 = PDupwindNthSymm3(>33[index]); + CCTK_REAL const PDstandardNth1phi = PDstandardNth1(&phi[index]); + CCTK_REAL const PDstandardNth2phi = PDstandardNth2(&phi[index]); + CCTK_REAL const PDstandardNth3phi = PDstandardNth3(&phi[index]); + CCTK_REAL const PDdissipationNth1phi = PDdissipationNth1(&phi[index]); + CCTK_REAL const PDdissipationNth2phi = PDdissipationNth2(&phi[index]); + CCTK_REAL const PDdissipationNth3phi = PDdissipationNth3(&phi[index]); + CCTK_REAL const PDupwindNthAnti1phi = PDupwindNthAnti1(&phi[index]); + CCTK_REAL const PDupwindNthSymm1phi = PDupwindNthSymm1(&phi[index]); + CCTK_REAL const PDupwindNthAnti2phi = PDupwindNthAnti2(&phi[index]); + CCTK_REAL const PDupwindNthSymm2phi = PDupwindNthSymm2(&phi[index]); + CCTK_REAL const PDupwindNthAnti3phi = PDupwindNthAnti3(&phi[index]); + CCTK_REAL const PDupwindNthSymm3phi = PDupwindNthSymm3(&phi[index]); + CCTK_REAL const PDstandardNth1trK = PDstandardNth1(&trK[index]); + CCTK_REAL const PDstandardNth2trK = PDstandardNth2(&trK[index]); + CCTK_REAL const PDstandardNth3trK = PDstandardNth3(&trK[index]); + CCTK_REAL const PDdissipationNth1trK = PDdissipationNth1(&trK[index]); + CCTK_REAL const PDdissipationNth2trK = PDdissipationNth2(&trK[index]); + CCTK_REAL const PDdissipationNth3trK = PDdissipationNth3(&trK[index]); + CCTK_REAL const PDupwindNthAnti1trK = PDupwindNthAnti1(&trK[index]); + CCTK_REAL const PDupwindNthSymm1trK = PDupwindNthSymm1(&trK[index]); + CCTK_REAL const PDupwindNthAnti2trK = PDupwindNthAnti2(&trK[index]); + CCTK_REAL const PDupwindNthSymm2trK = PDupwindNthSymm2(&trK[index]); + CCTK_REAL const PDupwindNthAnti3trK = PDupwindNthAnti3(&trK[index]); + CCTK_REAL const PDupwindNthSymm3trK = PDupwindNthSymm3(&trK[index]); + CCTK_REAL const PDdissipationNth1Xt1 = PDdissipationNth1(&Xt1[index]); + CCTK_REAL const PDdissipationNth2Xt1 = PDdissipationNth2(&Xt1[index]); + CCTK_REAL const PDdissipationNth3Xt1 = PDdissipationNth3(&Xt1[index]); + CCTK_REAL const PDupwindNthAnti1Xt1 = PDupwindNthAnti1(&Xt1[index]); + CCTK_REAL const PDupwindNthSymm1Xt1 = PDupwindNthSymm1(&Xt1[index]); + CCTK_REAL const PDupwindNthAnti2Xt1 = PDupwindNthAnti2(&Xt1[index]); + CCTK_REAL const PDupwindNthSymm2Xt1 = PDupwindNthSymm2(&Xt1[index]); + CCTK_REAL const PDupwindNthAnti3Xt1 = PDupwindNthAnti3(&Xt1[index]); + CCTK_REAL const PDupwindNthSymm3Xt1 = PDupwindNthSymm3(&Xt1[index]); + CCTK_REAL const PDdissipationNth1Xt2 = PDdissipationNth1(&Xt2[index]); + CCTK_REAL const PDdissipationNth2Xt2 = PDdissipationNth2(&Xt2[index]); + CCTK_REAL const PDdissipationNth3Xt2 = PDdissipationNth3(&Xt2[index]); + CCTK_REAL const PDupwindNthAnti1Xt2 = PDupwindNthAnti1(&Xt2[index]); + CCTK_REAL const PDupwindNthSymm1Xt2 = PDupwindNthSymm1(&Xt2[index]); + CCTK_REAL const PDupwindNthAnti2Xt2 = PDupwindNthAnti2(&Xt2[index]); + CCTK_REAL const PDupwindNthSymm2Xt2 = PDupwindNthSymm2(&Xt2[index]); + CCTK_REAL const PDupwindNthAnti3Xt2 = PDupwindNthAnti3(&Xt2[index]); + CCTK_REAL const PDupwindNthSymm3Xt2 = PDupwindNthSymm3(&Xt2[index]); + CCTK_REAL const PDdissipationNth1Xt3 = PDdissipationNth1(&Xt3[index]); + CCTK_REAL const PDdissipationNth2Xt3 = PDdissipationNth2(&Xt3[index]); + CCTK_REAL const PDdissipationNth3Xt3 = PDdissipationNth3(&Xt3[index]); + CCTK_REAL const PDupwindNthAnti1Xt3 = PDupwindNthAnti1(&Xt3[index]); + CCTK_REAL const PDupwindNthSymm1Xt3 = PDupwindNthSymm1(&Xt3[index]); + CCTK_REAL const PDupwindNthAnti2Xt3 = PDupwindNthAnti2(&Xt3[index]); + CCTK_REAL const PDupwindNthSymm2Xt3 = PDupwindNthSymm2(&Xt3[index]); + CCTK_REAL const PDupwindNthAnti3Xt3 = PDupwindNthAnti3(&Xt3[index]); + CCTK_REAL const PDupwindNthSymm3Xt3 = PDupwindNthSymm3(&Xt3[index]); + + /* Calculate temporaries and grid functions */ + ptrdiff_t dir1 = Sign(beta1L); + + ptrdiff_t dir2 = Sign(beta2L); + + ptrdiff_t dir3 = Sign(beta3L); + + CCTK_REAL epsdiss1 = ToReal(EpsDiss); + + CCTK_REAL epsdiss2 = ToReal(EpsDiss); + + CCTK_REAL epsdiss3 = ToReal(EpsDiss); + + CCTK_REAL detgt = 1; + + CCTK_REAL gtu11 = INV(detgt)*(gt22L*gt33L - SQR(gt23L)); + + CCTK_REAL gtu12 = (gt13L*gt23L - gt12L*gt33L)*INV(detgt); + + CCTK_REAL gtu13 = (-(gt13L*gt22L) + gt12L*gt23L)*INV(detgt); + + CCTK_REAL gtu22 = INV(detgt)*(gt11L*gt33L - SQR(gt13L)); + + CCTK_REAL gtu23 = (gt12L*gt13L - gt11L*gt23L)*INV(detgt); + + CCTK_REAL gtu33 = INV(detgt)*(gt11L*gt22L - SQR(gt12L)); + + CCTK_REAL Gtl111 = 0.5*PDstandardNth1gt11; + + CCTK_REAL Gtl112 = 0.5*PDstandardNth2gt11; + + CCTK_REAL Gtl113 = 0.5*PDstandardNth3gt11; + + CCTK_REAL Gtl122 = -0.5*PDstandardNth1gt22 + PDstandardNth2gt12; + + CCTK_REAL Gtl123 = 0.5*(-PDstandardNth1gt23 + PDstandardNth2gt13 + + PDstandardNth3gt12); + + CCTK_REAL Gtl133 = -0.5*PDstandardNth1gt33 + PDstandardNth3gt13; + + CCTK_REAL Gtl211 = PDstandardNth1gt12 - 0.5*PDstandardNth2gt11; + + CCTK_REAL Gtl212 = 0.5*PDstandardNth1gt22; + + CCTK_REAL Gtl213 = 0.5*(PDstandardNth1gt23 - PDstandardNth2gt13 + + PDstandardNth3gt12); + + CCTK_REAL Gtl222 = 0.5*PDstandardNth2gt22; + + CCTK_REAL Gtl223 = 0.5*PDstandardNth3gt22; + + CCTK_REAL Gtl233 = -0.5*PDstandardNth2gt33 + PDstandardNth3gt23; + + CCTK_REAL Gtl311 = PDstandardNth1gt13 - 0.5*PDstandardNth3gt11; + + CCTK_REAL Gtl312 = 0.5*(PDstandardNth1gt23 + PDstandardNth2gt13 - + PDstandardNth3gt12); + + CCTK_REAL Gtl313 = 0.5*PDstandardNth1gt33; + + CCTK_REAL Gtl322 = PDstandardNth2gt23 - 0.5*PDstandardNth3gt22; + + CCTK_REAL Gtl323 = 0.5*PDstandardNth2gt33; + + CCTK_REAL Gtl333 = 0.5*PDstandardNth3gt33; + + CCTK_REAL Gt111 = Gtl111*gtu11 + Gtl211*gtu12 + Gtl311*gtu13; + + CCTK_REAL Gt211 = Gtl111*gtu12 + Gtl211*gtu22 + Gtl311*gtu23; + + CCTK_REAL Gt311 = Gtl111*gtu13 + Gtl211*gtu23 + Gtl311*gtu33; + + CCTK_REAL Gt112 = Gtl112*gtu11 + Gtl212*gtu12 + Gtl312*gtu13; + + CCTK_REAL Gt212 = Gtl112*gtu12 + Gtl212*gtu22 + Gtl312*gtu23; + + CCTK_REAL Gt312 = Gtl112*gtu13 + Gtl212*gtu23 + Gtl312*gtu33; + + CCTK_REAL Gt113 = Gtl113*gtu11 + Gtl213*gtu12 + Gtl313*gtu13; + + CCTK_REAL Gt213 = Gtl113*gtu12 + Gtl213*gtu22 + Gtl313*gtu23; + + CCTK_REAL Gt313 = Gtl113*gtu13 + Gtl213*gtu23 + Gtl313*gtu33; + + CCTK_REAL Gt122 = Gtl122*gtu11 + Gtl222*gtu12 + Gtl322*gtu13; + + CCTK_REAL Gt222 = Gtl122*gtu12 + Gtl222*gtu22 + Gtl322*gtu23; + + CCTK_REAL Gt322 = Gtl122*gtu13 + Gtl222*gtu23 + Gtl322*gtu33; + + CCTK_REAL Gt123 = Gtl123*gtu11 + Gtl223*gtu12 + Gtl323*gtu13; + + CCTK_REAL Gt223 = Gtl123*gtu12 + Gtl223*gtu22 + Gtl323*gtu23; + + CCTK_REAL Gt323 = Gtl123*gtu13 + Gtl223*gtu23 + Gtl323*gtu33; + + CCTK_REAL Gt133 = Gtl133*gtu11 + Gtl233*gtu12 + Gtl333*gtu13; + + CCTK_REAL Gt233 = Gtl133*gtu12 + Gtl233*gtu22 + Gtl333*gtu23; + + CCTK_REAL Gt333 = Gtl133*gtu13 + Gtl233*gtu23 + Gtl333*gtu33; + + CCTK_REAL Xtn1 = Gt111*gtu11 + Gt122*gtu22 + 2*(Gt112*gtu12 + + Gt113*gtu13 + Gt123*gtu23) + Gt133*gtu33; + + CCTK_REAL Xtn2 = Gt211*gtu11 + Gt222*gtu22 + 2*(Gt212*gtu12 + + Gt213*gtu13 + Gt223*gtu23) + Gt233*gtu33; + + CCTK_REAL Xtn3 = Gt311*gtu11 + Gt322*gtu22 + 2*(Gt312*gtu12 + + Gt313*gtu13 + Gt323*gtu23) + Gt333*gtu33; + + CCTK_REAL fac1 = IfThen(ToReal(conformalMethod),-0.5*INV(phiL),1); + + CCTK_REAL cdphi1 = fac1*PDstandardNth1phi; + + CCTK_REAL cdphi2 = fac1*PDstandardNth2phi; + + CCTK_REAL cdphi3 = fac1*PDstandardNth3phi; + + CCTK_REAL Atm11 = At11L*gtu11 + At12L*gtu12 + At13L*gtu13; + + CCTK_REAL Atm21 = At11L*gtu12 + At12L*gtu22 + At13L*gtu23; + + CCTK_REAL Atm31 = At11L*gtu13 + At12L*gtu23 + At13L*gtu33; + + CCTK_REAL Atm12 = At12L*gtu11 + At22L*gtu12 + At23L*gtu13; + + CCTK_REAL Atm22 = At12L*gtu12 + At22L*gtu22 + At23L*gtu23; + + CCTK_REAL Atm32 = At12L*gtu13 + At22L*gtu23 + At23L*gtu33; + + CCTK_REAL Atm13 = At13L*gtu11 + At23L*gtu12 + At33L*gtu13; + + CCTK_REAL Atm23 = At13L*gtu12 + At23L*gtu22 + At33L*gtu23; + + CCTK_REAL Atm33 = At13L*gtu13 + At23L*gtu23 + At33L*gtu33; + + CCTK_REAL Atu11 = Atm11*gtu11 + Atm12*gtu12 + Atm13*gtu13; + + CCTK_REAL Atu12 = Atm11*gtu12 + Atm12*gtu22 + Atm13*gtu23; + + CCTK_REAL Atu13 = Atm11*gtu13 + Atm12*gtu23 + Atm13*gtu33; + + CCTK_REAL Atu22 = Atm21*gtu12 + Atm22*gtu22 + Atm23*gtu23; + + CCTK_REAL Atu23 = Atm21*gtu13 + Atm22*gtu23 + Atm23*gtu33; + + CCTK_REAL Atu33 = Atm31*gtu13 + Atm32*gtu23 + Atm33*gtu33; + + CCTK_REAL e4phi = + IfThen(ToReal(conformalMethod),INV(SQR(phiL)),exp(4*phiL)); + + CCTK_REAL em4phi = INV(e4phi); + + CCTK_REAL rho = INV(SQR(alphaL))*(eTttL - 2*(beta2L*eTtyL + + beta3L*eTtzL) + 2*(beta1L*(-eTtxL + beta2L*eTxyL + beta3L*eTxzL) + + beta2L*beta3L*eTyzL) + eTxxL*SQR(beta1L) + eTyyL*SQR(beta2L) + + eTzzL*SQR(beta3L)); + + CCTK_REAL S1 = (-eTtxL + beta1L*eTxxL + beta2L*eTxyL + + beta3L*eTxzL)*INV(alphaL); + + CCTK_REAL S2 = (-eTtyL + beta1L*eTxyL + beta2L*eTyyL + + beta3L*eTyzL)*INV(alphaL); + + CCTK_REAL S3 = (-eTtzL + beta1L*eTxzL + beta2L*eTyzL + + beta3L*eTzzL)*INV(alphaL); + + CCTK_REAL trS = em4phi*(eTxxL*gtu11 + eTyyL*gtu22 + 2*(eTxyL*gtu12 + + eTxzL*gtu13 + eTyzL*gtu23) + eTzzL*gtu33); + + CCTK_REAL phirhsL = epsdiss1*PDdissipationNth1phi + + epsdiss2*PDdissipationNth2phi + epsdiss3*PDdissipationNth3phi + + beta1L*PDupwindNthAnti1phi + beta2L*PDupwindNthAnti2phi + + beta3L*PDupwindNthAnti3phi + PDupwindNthSymm1phi*Abs(beta1L) + + PDupwindNthSymm2phi*Abs(beta2L) + PDupwindNthSymm3phi*Abs(beta3L) + + IfThen(ToReal(conformalMethod),phiL*(-0.333333333333333333333333333333*(PDstandardNth1beta1 + + PDstandardNth2beta2 + PDstandardNth3beta3) + + 0.333333333333333333333333333333*alphaL*trKL),0.166666666666666666666666666667*(PDstandardNth1beta1 + + PDstandardNth2beta2 + PDstandardNth3beta3) - + 0.166666666666666666666666666667*alphaL*trKL); + + CCTK_REAL gt11rhsL = -2*alphaL*At11L + epsdiss1*PDdissipationNth1gt11 + + epsdiss2*PDdissipationNth2gt11 + epsdiss3*PDdissipationNth3gt11 + + 2*(gt12L*PDstandardNth1beta2 + gt13L*PDstandardNth1beta3) + + gt11L*(1.33333333333333333333333333333*PDstandardNth1beta1 - + 0.666666666666666666666666666667*(PDstandardNth2beta2 + + PDstandardNth3beta3)) + beta1L*PDupwindNthAnti1gt11 + + beta2L*PDupwindNthAnti2gt11 + beta3L*PDupwindNthAnti3gt11 + + PDupwindNthSymm1gt11*Abs(beta1L) + PDupwindNthSymm2gt11*Abs(beta2L) + + PDupwindNthSymm3gt11*Abs(beta3L); + + CCTK_REAL gt12rhsL = -2*alphaL*At12L + epsdiss1*PDdissipationNth1gt12 + + epsdiss2*PDdissipationNth2gt12 + epsdiss3*PDdissipationNth3gt12 + + gt22L*PDstandardNth1beta2 + gt23L*PDstandardNth1beta3 + + gt11L*PDstandardNth2beta1 + gt13L*PDstandardNth2beta3 + + gt12L*(0.333333333333333333333333333333*(PDstandardNth1beta1 + + PDstandardNth2beta2) - + 0.666666666666666666666666666667*PDstandardNth3beta3) + + beta1L*PDupwindNthAnti1gt12 + beta2L*PDupwindNthAnti2gt12 + + beta3L*PDupwindNthAnti3gt12 + PDupwindNthSymm1gt12*Abs(beta1L) + + PDupwindNthSymm2gt12*Abs(beta2L) + PDupwindNthSymm3gt12*Abs(beta3L); + + CCTK_REAL gt13rhsL = -2*alphaL*At13L + epsdiss1*PDdissipationNth1gt13 + + epsdiss2*PDdissipationNth2gt13 + epsdiss3*PDdissipationNth3gt13 + + gt23L*PDstandardNth1beta2 + gt33L*PDstandardNth1beta3 + + gt11L*PDstandardNth3beta1 + gt12L*PDstandardNth3beta2 + + gt13L*(-0.666666666666666666666666666667*PDstandardNth2beta2 + + 0.333333333333333333333333333333*(PDstandardNth1beta1 + + PDstandardNth3beta3)) + beta1L*PDupwindNthAnti1gt13 + + beta2L*PDupwindNthAnti2gt13 + beta3L*PDupwindNthAnti3gt13 + + PDupwindNthSymm1gt13*Abs(beta1L) + PDupwindNthSymm2gt13*Abs(beta2L) + + PDupwindNthSymm3gt13*Abs(beta3L); + + CCTK_REAL gt22rhsL = -2*alphaL*At22L + epsdiss1*PDdissipationNth1gt22 + + epsdiss2*PDdissipationNth2gt22 + epsdiss3*PDdissipationNth3gt22 + + 2*(gt12L*PDstandardNth2beta1 + gt23L*PDstandardNth2beta3) + + gt22L*(1.33333333333333333333333333333*PDstandardNth2beta2 - + 0.666666666666666666666666666667*(PDstandardNth1beta1 + + PDstandardNth3beta3)) + beta1L*PDupwindNthAnti1gt22 + + beta2L*PDupwindNthAnti2gt22 + beta3L*PDupwindNthAnti3gt22 + + PDupwindNthSymm1gt22*Abs(beta1L) + PDupwindNthSymm2gt22*Abs(beta2L) + + PDupwindNthSymm3gt22*Abs(beta3L); + + CCTK_REAL gt23rhsL = -2*alphaL*At23L + epsdiss1*PDdissipationNth1gt23 + + epsdiss2*PDdissipationNth2gt23 + epsdiss3*PDdissipationNth3gt23 + + gt13L*PDstandardNth2beta1 + gt33L*PDstandardNth2beta3 + + gt12L*PDstandardNth3beta1 + gt22L*PDstandardNth3beta2 + + gt23L*(-0.666666666666666666666666666667*PDstandardNth1beta1 + + 0.333333333333333333333333333333*(PDstandardNth2beta2 + + PDstandardNth3beta3)) + beta1L*PDupwindNthAnti1gt23 + + beta2L*PDupwindNthAnti2gt23 + beta3L*PDupwindNthAnti3gt23 + + PDupwindNthSymm1gt23*Abs(beta1L) + PDupwindNthSymm2gt23*Abs(beta2L) + + PDupwindNthSymm3gt23*Abs(beta3L); + + CCTK_REAL gt33rhsL = -2*alphaL*At33L + epsdiss1*PDdissipationNth1gt33 + + epsdiss2*PDdissipationNth2gt33 + epsdiss3*PDdissipationNth3gt33 + + 2*(gt13L*PDstandardNth3beta1 + gt23L*PDstandardNth3beta2) + + gt33L*(-0.666666666666666666666666666667*(PDstandardNth1beta1 + + PDstandardNth2beta2) + + 1.33333333333333333333333333333*PDstandardNth3beta3) + + beta1L*PDupwindNthAnti1gt33 + beta2L*PDupwindNthAnti2gt33 + + beta3L*PDupwindNthAnti3gt33 + PDupwindNthSymm1gt33*Abs(beta1L) + + PDupwindNthSymm2gt33*Abs(beta2L) + PDupwindNthSymm3gt33*Abs(beta3L); + + CCTK_REAL dotXt1 = + 0.333333333333333333333333333333*(7*(gtu12*PDstandardNth12beta1 + + gtu13*PDstandardNth13beta1) + gtu11*(4*PDstandardNth11beta1 + + PDstandardNth12beta2 + PDstandardNth13beta3) + + gtu12*(PDstandardNth22beta2 + PDstandardNth23beta3) + + gtu13*(PDstandardNth23beta2 + PDstandardNth33beta3) - + 6*(Atu11*PDstandardNth1alpha + Atu12*PDstandardNth2alpha + + Atu13*PDstandardNth3alpha) + 6*(gtu23*PDstandardNth23beta1 + + alphaL*(6*(Atu11*cdphi1 + Atu12*cdphi2 + Atu13*cdphi3) + Atu11*Gt111 + + Atu22*Gt122 + 2*(Atu12*Gt112 + Atu13*Gt113 + Atu23*Gt123) + Atu33*Gt133 + - 0.666666666666666666666666666667*(gtu11*PDstandardNth1trK + + gtu12*PDstandardNth2trK + gtu13*PDstandardNth3trK))) - + 150.7964473723100754462068823974161384415*alphaL*(gtu11*S1 + gtu12*S2 + + gtu13*S3) + (-3*PDstandardNth1beta1 + 2*(PDstandardNth1beta1 + + PDstandardNth2beta2 + PDstandardNth3beta3))*Xtn1 - + 3*(PDstandardNth2beta1*Xtn2 + PDstandardNth3beta1*Xtn3) + + 3*(epsdiss1*PDdissipationNth1Xt1 + epsdiss2*PDdissipationNth2Xt1 + + epsdiss3*PDdissipationNth3Xt1 + gtu22*PDstandardNth22beta1 + + gtu33*PDstandardNth33beta1 + beta1L*PDupwindNthAnti1Xt1 + + beta2L*PDupwindNthAnti2Xt1 + beta3L*PDupwindNthAnti3Xt1 + + PDupwindNthSymm1Xt1*Abs(beta1L) + PDupwindNthSymm2Xt1*Abs(beta2L) + + PDupwindNthSymm3Xt1*Abs(beta3L))); + + CCTK_REAL dotXt2 = + 0.333333333333333333333333333333*(gtu12*(PDstandardNth11beta1 + + 7*PDstandardNth12beta2 + PDstandardNth13beta3) + + gtu22*(PDstandardNth12beta1 + 4*PDstandardNth22beta2 + + PDstandardNth23beta3) + gtu23*(PDstandardNth13beta1 + + 7*PDstandardNth23beta2 + PDstandardNth33beta3) - + 6*(Atu12*PDstandardNth1alpha + Atu22*PDstandardNth2alpha + + Atu23*PDstandardNth3alpha) + 6*(gtu13*PDstandardNth13beta2 + + alphaL*(6*(Atu12*cdphi1 + Atu22*cdphi2 + Atu23*cdphi3) + Atu11*Gt211 + + Atu22*Gt222 + 2*(Atu12*Gt212 + Atu13*Gt213 + Atu23*Gt223) + Atu33*Gt233 + - 0.666666666666666666666666666667*(gtu12*PDstandardNth1trK + + gtu22*PDstandardNth2trK + gtu23*PDstandardNth3trK))) - + 150.7964473723100754462068823974161384415*alphaL*(gtu12*S1 + gtu22*S2 + + gtu23*S3) + 2*(PDstandardNth1beta1 + PDstandardNth2beta2 + + PDstandardNth3beta3)*Xtn2 - 3*(PDstandardNth1beta2*Xtn1 + + PDstandardNth2beta2*Xtn2 + PDstandardNth3beta2*Xtn3) + + 3*(epsdiss1*PDdissipationNth1Xt2 + epsdiss2*PDdissipationNth2Xt2 + + epsdiss3*PDdissipationNth3Xt2 + gtu11*PDstandardNth11beta2 + + gtu33*PDstandardNth33beta2 + beta1L*PDupwindNthAnti1Xt2 + + beta2L*PDupwindNthAnti2Xt2 + beta3L*PDupwindNthAnti3Xt2 + + PDupwindNthSymm1Xt2*Abs(beta1L) + PDupwindNthSymm2Xt2*Abs(beta2L) + + PDupwindNthSymm3Xt2*Abs(beta3L))); + + CCTK_REAL dotXt3 = + 0.333333333333333333333333333333*(gtu13*(PDstandardNth11beta1 + + PDstandardNth12beta2 + 7*PDstandardNth13beta3) + + gtu23*(PDstandardNth12beta1 + PDstandardNth22beta2 + + 7*PDstandardNth23beta3) + gtu33*(PDstandardNth13beta1 + + PDstandardNth23beta2 + 4*PDstandardNth33beta3) - + 6*(Atu13*PDstandardNth1alpha + Atu23*PDstandardNth2alpha + + Atu33*PDstandardNth3alpha) + 6*(gtu12*PDstandardNth12beta3 + + alphaL*(6*(Atu13*cdphi1 + Atu23*cdphi2 + Atu33*cdphi3) + Atu11*Gt311 + + Atu22*Gt322 + 2*(Atu12*Gt312 + Atu13*Gt313 + Atu23*Gt323) + Atu33*Gt333 + - 0.666666666666666666666666666667*(gtu13*PDstandardNth1trK + + gtu23*PDstandardNth2trK + gtu33*PDstandardNth3trK))) - + 150.7964473723100754462068823974161384415*alphaL*(gtu13*S1 + gtu23*S2 + + gtu33*S3) + 2*(PDstandardNth1beta1 + PDstandardNth2beta2 + + PDstandardNth3beta3)*Xtn3 - 3*(PDstandardNth1beta3*Xtn1 + + PDstandardNth2beta3*Xtn2 + PDstandardNth3beta3*Xtn3) + + 3*(epsdiss1*PDdissipationNth1Xt3 + epsdiss2*PDdissipationNth2Xt3 + + epsdiss3*PDdissipationNth3Xt3 + gtu11*PDstandardNth11beta3 + + gtu22*PDstandardNth22beta3 + beta1L*PDupwindNthAnti1Xt3 + + beta2L*PDupwindNthAnti2Xt3 + beta3L*PDupwindNthAnti3Xt3 + + PDupwindNthSymm1Xt3*Abs(beta1L) + PDupwindNthSymm2Xt3*Abs(beta2L) + + PDupwindNthSymm3Xt3*Abs(beta3L))); + + CCTK_REAL Xt1rhsL = dotXt1; + + CCTK_REAL Xt2rhsL = dotXt2; + + CCTK_REAL Xt3rhsL = dotXt3; + + CCTK_REAL dottrK = epsdiss1*PDdissipationNth1trK + + epsdiss2*PDdissipationNth2trK + epsdiss3*PDdissipationNth3trK + + beta1L*PDupwindNthAnti1trK + beta2L*PDupwindNthAnti2trK + + beta3L*PDupwindNthAnti3trK - em4phi*(gtu11*PDstandardNth11alpha + + gtu22*PDstandardNth22alpha + gtu33*(PDstandardNth33alpha + + 2*cdphi3*PDstandardNth3alpha) + 2*(gtu12*PDstandardNth12alpha + + gtu13*(PDstandardNth13alpha + cdphi1*PDstandardNth3alpha) + + gtu23*(PDstandardNth23alpha + cdphi2*PDstandardNth3alpha)) + + PDstandardNth1alpha*(2*(cdphi1*gtu11 + cdphi2*gtu12 + cdphi3*gtu13) - + Xtn1) + PDstandardNth2alpha*(2*(cdphi1*gtu12 + cdphi2*gtu22 + + cdphi3*gtu23) - Xtn2) - PDstandardNth3alpha*Xtn3) + + PDupwindNthSymm1trK*Abs(beta1L) + PDupwindNthSymm2trK*Abs(beta2L) + + PDupwindNthSymm3trK*Abs(beta3L) + alphaL*(2*(Atm12*Atm21 + Atm13*Atm31 + + Atm23*Atm32) + 12.56637061435917295385057353311801153679*(rho + trS) + + SQR(Atm11) + SQR(Atm22) + SQR(Atm33) + + 0.333333333333333333333333333333*SQR(trKL)); + + CCTK_REAL trKrhsL = dottrK; + + CCTK_REAL alpharhsL = epsdiss1*PDdissipationNth1alpha + + epsdiss2*PDdissipationNth2alpha + epsdiss3*PDdissipationNth3alpha - + pow(alphaL,ToReal(harmonicN))*ToReal(harmonicF)*(trKL + (AL - + trKL)*ToReal(LapseACoeff)) + (beta1L*PDupwindNthAnti1alpha + + beta2L*PDupwindNthAnti2alpha + beta3L*PDupwindNthAnti3alpha + + PDupwindNthSymm1alpha*Abs(beta1L) + PDupwindNthSymm2alpha*Abs(beta2L) + + PDupwindNthSymm3alpha*Abs(beta3L))*ToReal(LapseAdvectionCoeff); + + CCTK_REAL ArhsL = epsdiss1*PDdissipationNth1A + + epsdiss2*PDdissipationNth2A + epsdiss3*PDdissipationNth3A + (dottrK - + AL*ToReal(AlphaDriver))*ToReal(LapseACoeff) + (beta1L*PDupwindNthAnti1A + + beta2L*PDupwindNthAnti2A + beta3L*PDupwindNthAnti3A + + PDupwindNthSymm1A*Abs(beta1L) + PDupwindNthSymm2A*Abs(beta2L) + + PDupwindNthSymm3A*Abs(beta3L))*ToReal(LapseAdvectionCoeff); + + CCTK_REAL eta = fmin(1,INV(rL)*ToReal(SpatialBetaDriverRadius)); + + CCTK_REAL theta = fmin(1,exp(1 - + rL*INV(ToReal(SpatialShiftGammaCoeffRadius)))); + + CCTK_REAL beta1rhsL = epsdiss1*PDdissipationNth1beta1 + + epsdiss2*PDdissipationNth2beta1 + epsdiss3*PDdissipationNth3beta1 + + (beta1L*PDupwindNthAnti1beta1 + beta2L*PDupwindNthAnti2beta1 + + beta3L*PDupwindNthAnti3beta1 + PDupwindNthSymm1beta1*Abs(beta1L) + + PDupwindNthSymm2beta1*Abs(beta2L) + + PDupwindNthSymm3beta1*Abs(beta3L))*ToReal(ShiftAdvectionCoeff) + + theta*(Xt1L + beta1L*eta*ToReal(BetaDriver)*(-1 + ToReal(ShiftBCoeff)) + + (B1L - Xt1L)*ToReal(ShiftBCoeff))*ToReal(ShiftGammaCoeff); + + CCTK_REAL beta2rhsL = epsdiss1*PDdissipationNth1beta2 + + epsdiss2*PDdissipationNth2beta2 + epsdiss3*PDdissipationNth3beta2 + + (beta1L*PDupwindNthAnti1beta2 + beta2L*PDupwindNthAnti2beta2 + + beta3L*PDupwindNthAnti3beta2 + PDupwindNthSymm1beta2*Abs(beta1L) + + PDupwindNthSymm2beta2*Abs(beta2L) + + PDupwindNthSymm3beta2*Abs(beta3L))*ToReal(ShiftAdvectionCoeff) + + theta*(Xt2L + beta2L*eta*ToReal(BetaDriver)*(-1 + ToReal(ShiftBCoeff)) + + (B2L - Xt2L)*ToReal(ShiftBCoeff))*ToReal(ShiftGammaCoeff); + + CCTK_REAL beta3rhsL = epsdiss1*PDdissipationNth1beta3 + + epsdiss2*PDdissipationNth2beta3 + epsdiss3*PDdissipationNth3beta3 + + (beta1L*PDupwindNthAnti1beta3 + beta2L*PDupwindNthAnti2beta3 + + beta3L*PDupwindNthAnti3beta3 + PDupwindNthSymm1beta3*Abs(beta1L) + + PDupwindNthSymm2beta3*Abs(beta2L) + + PDupwindNthSymm3beta3*Abs(beta3L))*ToReal(ShiftAdvectionCoeff) + + theta*(Xt3L + beta3L*eta*ToReal(BetaDriver)*(-1 + ToReal(ShiftBCoeff)) + + (B3L - Xt3L)*ToReal(ShiftBCoeff))*ToReal(ShiftGammaCoeff); + + CCTK_REAL B1rhsL = epsdiss1*PDdissipationNth1B1 + + epsdiss2*PDdissipationNth2B1 + epsdiss3*PDdissipationNth3B1 + + (beta1L*(PDupwindNthAnti1B1 - PDupwindNthAnti1Xt1) + + beta2L*(PDupwindNthAnti2B1 - PDupwindNthAnti2Xt1) + + beta3L*(PDupwindNthAnti3B1 - PDupwindNthAnti3Xt1) + (PDupwindNthSymm1B1 + - PDupwindNthSymm1Xt1)*Abs(beta1L) + (PDupwindNthSymm2B1 - + PDupwindNthSymm2Xt1)*Abs(beta2L) + (PDupwindNthSymm3B1 - + PDupwindNthSymm3Xt1)*Abs(beta3L))*ToReal(ShiftAdvectionCoeff) + (dotXt1 + - B1L*eta*ToReal(BetaDriver))*ToReal(ShiftBCoeff); + + CCTK_REAL B2rhsL = epsdiss1*PDdissipationNth1B2 + + epsdiss2*PDdissipationNth2B2 + epsdiss3*PDdissipationNth3B2 + + (beta1L*(PDupwindNthAnti1B2 - PDupwindNthAnti1Xt2) + + beta2L*(PDupwindNthAnti2B2 - PDupwindNthAnti2Xt2) + + beta3L*(PDupwindNthAnti3B2 - PDupwindNthAnti3Xt2) + (PDupwindNthSymm1B2 + - PDupwindNthSymm1Xt2)*Abs(beta1L) + (PDupwindNthSymm2B2 - + PDupwindNthSymm2Xt2)*Abs(beta2L) + (PDupwindNthSymm3B2 - + PDupwindNthSymm3Xt2)*Abs(beta3L))*ToReal(ShiftAdvectionCoeff) + (dotXt2 + - B2L*eta*ToReal(BetaDriver))*ToReal(ShiftBCoeff); + + CCTK_REAL B3rhsL = epsdiss1*PDdissipationNth1B3 + + epsdiss2*PDdissipationNth2B3 + epsdiss3*PDdissipationNth3B3 + + (beta1L*(PDupwindNthAnti1B3 - PDupwindNthAnti1Xt3) + + beta2L*(PDupwindNthAnti2B3 - PDupwindNthAnti2Xt3) + + beta3L*(PDupwindNthAnti3B3 - PDupwindNthAnti3Xt3) + (PDupwindNthSymm1B3 + - PDupwindNthSymm1Xt3)*Abs(beta1L) + (PDupwindNthSymm2B3 - + PDupwindNthSymm2Xt3)*Abs(beta2L) + (PDupwindNthSymm3B3 - + PDupwindNthSymm3Xt3)*Abs(beta3L))*ToReal(ShiftAdvectionCoeff) + (dotXt3 + - B3L*eta*ToReal(BetaDriver))*ToReal(ShiftBCoeff); + + + /* Copy local copies back to grid functions */ + alpharhs[index] = alpharhsL; + Arhs[index] = ArhsL; + B1rhs[index] = B1rhsL; + B2rhs[index] = B2rhsL; + B3rhs[index] = B3rhsL; + beta1rhs[index] = beta1rhsL; + beta2rhs[index] = beta2rhsL; + beta3rhs[index] = beta3rhsL; + gt11rhs[index] = gt11rhsL; + gt12rhs[index] = gt12rhsL; + gt13rhs[index] = gt13rhsL; + gt22rhs[index] = gt22rhsL; + gt23rhs[index] = gt23rhsL; + gt33rhs[index] = gt33rhsL; + phirhs[index] = phirhsL; + trKrhs[index] = trKrhsL; + Xt1rhs[index] = Xt1rhsL; + Xt2rhs[index] = Xt2rhsL; + Xt3rhs[index] = Xt3rhsL; + } + LC_ENDLOOP3 (ML_BSSN_RHS1); +} + +extern "C" void ML_BSSN_RHS1(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverInterior(cctkGH, &ML_BSSN_RHS1_Body); +} diff --git a/ML_BSSN/src/ML_BSSN_RHS2.cc b/ML_BSSN/src/ML_BSSN_RHS2.cc new file mode 100644 index 0000000..0aabf54 --- /dev/null +++ b/ML_BSSN/src/ML_BSSN_RHS2.cc @@ -0,0 +1,794 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +extern "C" void ML_BSSN_RHS2_SelectBCs(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT ierr = 0; + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN::ML_curvrhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN::ML_curvrhs."); + return; +} + +static void ML_BSSN_RHS2_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_BSSN_RHS2_Body"); + } + + if (cctk_iteration % ML_BSSN_RHS2_calc_every != ML_BSSN_RHS2_calc_offset) + { + return; + } + + const char *groups[] = {"ML_BSSN::ML_curv","ML_BSSN::ML_curvrhs","ML_BSSN::ML_Gamma","ML_BSSN::ML_lapse","ML_BSSN::ML_log_confac","ML_BSSN::ML_metric","ML_BSSN::ML_shift","ML_BSSN::ML_trace_curv"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_BSSN_RHS2", 8, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o12dx = 0.0833333333333333333333333333333*INV(dx); + CCTK_REAL const p1o12dy = 0.0833333333333333333333333333333*INV(dy); + CCTK_REAL const p1o12dz = 0.0833333333333333333333333333333*INV(dz); + CCTK_REAL const p1o144dxdy = 0.00694444444444444444444444444444*INV(dx)*INV(dy); + CCTK_REAL const p1o144dxdz = 0.00694444444444444444444444444444*INV(dx)*INV(dz); + CCTK_REAL const p1o144dydz = 0.00694444444444444444444444444444*INV(dy)*INV(dz); + CCTK_REAL const p1o24dx = 0.0416666666666666666666666666667*INV(dx); + CCTK_REAL const p1o24dy = 0.0416666666666666666666666666667*INV(dy); + CCTK_REAL const p1o24dz = 0.0416666666666666666666666666667*INV(dz); + CCTK_REAL const p1o64dx = 0.015625*INV(dx); + CCTK_REAL const p1o64dy = 0.015625*INV(dy); + CCTK_REAL const p1o64dz = 0.015625*INV(dz); + CCTK_REAL const p1odx = INV(dx); + CCTK_REAL const p1ody = INV(dy); + CCTK_REAL const p1odz = INV(dz); + CCTK_REAL const pm1o12dx2 = -0.0833333333333333333333333333333*INV(SQR(dx)); + CCTK_REAL const pm1o12dy2 = -0.0833333333333333333333333333333*INV(SQR(dy)); + CCTK_REAL const pm1o12dz2 = -0.0833333333333333333333333333333*INV(SQR(dz)); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_BSSN_RHS2, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + CCTK_REAL alphaL = alpha[index]; + CCTK_REAL At11L = At11[index]; + CCTK_REAL At12L = At12[index]; + CCTK_REAL At13L = At13[index]; + CCTK_REAL At22L = At22[index]; + CCTK_REAL At23L = At23[index]; + CCTK_REAL At33L = At33[index]; + CCTK_REAL beta1L = beta1[index]; + CCTK_REAL beta2L = beta2[index]; + CCTK_REAL beta3L = beta3[index]; + CCTK_REAL eTxxL = (*stress_energy_state) ? eTxx[index] : ToReal(0.0); + CCTK_REAL eTxyL = (*stress_energy_state) ? eTxy[index] : ToReal(0.0); + CCTK_REAL eTxzL = (*stress_energy_state) ? eTxz[index] : ToReal(0.0); + CCTK_REAL eTyyL = (*stress_energy_state) ? eTyy[index] : ToReal(0.0); + CCTK_REAL eTyzL = (*stress_energy_state) ? eTyz[index] : ToReal(0.0); + CCTK_REAL eTzzL = (*stress_energy_state) ? eTzz[index] : ToReal(0.0); + CCTK_REAL gt11L = gt11[index]; + CCTK_REAL gt12L = gt12[index]; + CCTK_REAL gt13L = gt13[index]; + CCTK_REAL gt22L = gt22[index]; + CCTK_REAL gt23L = gt23[index]; + CCTK_REAL gt33L = gt33[index]; + CCTK_REAL phiL = phi[index]; + CCTK_REAL trKL = trK[index]; + CCTK_REAL Xt1L = Xt1[index]; + CCTK_REAL Xt2L = Xt2[index]; + CCTK_REAL Xt3L = Xt3[index]; + + /* Include user supplied include files */ + + /* Precompute derivatives */ + CCTK_REAL const PDstandardNth1alpha = PDstandardNth1(&alpha[index]); + CCTK_REAL const PDstandardNth2alpha = PDstandardNth2(&alpha[index]); + CCTK_REAL const PDstandardNth3alpha = PDstandardNth3(&alpha[index]); + CCTK_REAL const PDstandardNth11alpha = PDstandardNth11(&alpha[index]); + CCTK_REAL const PDstandardNth22alpha = PDstandardNth22(&alpha[index]); + CCTK_REAL const PDstandardNth33alpha = PDstandardNth33(&alpha[index]); + CCTK_REAL const PDstandardNth12alpha = PDstandardNth12(&alpha[index]); + CCTK_REAL const PDstandardNth13alpha = PDstandardNth13(&alpha[index]); + CCTK_REAL const PDstandardNth23alpha = PDstandardNth23(&alpha[index]); + CCTK_REAL const PDdissipationNth1At11 = PDdissipationNth1(&At11[index]); + CCTK_REAL const PDdissipationNth2At11 = PDdissipationNth2(&At11[index]); + CCTK_REAL const PDdissipationNth3At11 = PDdissipationNth3(&At11[index]); + CCTK_REAL const PDupwindNthAnti1At11 = PDupwindNthAnti1(&At11[index]); + CCTK_REAL const PDupwindNthSymm1At11 = PDupwindNthSymm1(&At11[index]); + CCTK_REAL const PDupwindNthAnti2At11 = PDupwindNthAnti2(&At11[index]); + CCTK_REAL const PDupwindNthSymm2At11 = PDupwindNthSymm2(&At11[index]); + CCTK_REAL const PDupwindNthAnti3At11 = PDupwindNthAnti3(&At11[index]); + CCTK_REAL const PDupwindNthSymm3At11 = PDupwindNthSymm3(&At11[index]); + CCTK_REAL const PDdissipationNth1At12 = PDdissipationNth1(&At12[index]); + CCTK_REAL const PDdissipationNth2At12 = PDdissipationNth2(&At12[index]); + CCTK_REAL const PDdissipationNth3At12 = PDdissipationNth3(&At12[index]); + CCTK_REAL const PDupwindNthAnti1At12 = PDupwindNthAnti1(&At12[index]); + CCTK_REAL const PDupwindNthSymm1At12 = PDupwindNthSymm1(&At12[index]); + CCTK_REAL const PDupwindNthAnti2At12 = PDupwindNthAnti2(&At12[index]); + CCTK_REAL const PDupwindNthSymm2At12 = PDupwindNthSymm2(&At12[index]); + CCTK_REAL const PDupwindNthAnti3At12 = PDupwindNthAnti3(&At12[index]); + CCTK_REAL const PDupwindNthSymm3At12 = PDupwindNthSymm3(&At12[index]); + CCTK_REAL const PDdissipationNth1At13 = PDdissipationNth1(&At13[index]); + CCTK_REAL const PDdissipationNth2At13 = PDdissipationNth2(&At13[index]); + CCTK_REAL const PDdissipationNth3At13 = PDdissipationNth3(&At13[index]); + CCTK_REAL const PDupwindNthAnti1At13 = PDupwindNthAnti1(&At13[index]); + CCTK_REAL const PDupwindNthSymm1At13 = PDupwindNthSymm1(&At13[index]); + CCTK_REAL const PDupwindNthAnti2At13 = PDupwindNthAnti2(&At13[index]); + CCTK_REAL const PDupwindNthSymm2At13 = PDupwindNthSymm2(&At13[index]); + CCTK_REAL const PDupwindNthAnti3At13 = PDupwindNthAnti3(&At13[index]); + CCTK_REAL const PDupwindNthSymm3At13 = PDupwindNthSymm3(&At13[index]); + CCTK_REAL const PDdissipationNth1At22 = PDdissipationNth1(&At22[index]); + CCTK_REAL const PDdissipationNth2At22 = PDdissipationNth2(&At22[index]); + CCTK_REAL const PDdissipationNth3At22 = PDdissipationNth3(&At22[index]); + CCTK_REAL const PDupwindNthAnti1At22 = PDupwindNthAnti1(&At22[index]); + CCTK_REAL const PDupwindNthSymm1At22 = PDupwindNthSymm1(&At22[index]); + CCTK_REAL const PDupwindNthAnti2At22 = PDupwindNthAnti2(&At22[index]); + CCTK_REAL const PDupwindNthSymm2At22 = PDupwindNthSymm2(&At22[index]); + CCTK_REAL const PDupwindNthAnti3At22 = PDupwindNthAnti3(&At22[index]); + CCTK_REAL const PDupwindNthSymm3At22 = PDupwindNthSymm3(&At22[index]); + CCTK_REAL const PDdissipationNth1At23 = PDdissipationNth1(&At23[index]); + CCTK_REAL const PDdissipationNth2At23 = PDdissipationNth2(&At23[index]); + CCTK_REAL const PDdissipationNth3At23 = PDdissipationNth3(&At23[index]); + CCTK_REAL const PDupwindNthAnti1At23 = PDupwindNthAnti1(&At23[index]); + CCTK_REAL const PDupwindNthSymm1At23 = PDupwindNthSymm1(&At23[index]); + CCTK_REAL const PDupwindNthAnti2At23 = PDupwindNthAnti2(&At23[index]); + CCTK_REAL const PDupwindNthSymm2At23 = PDupwindNthSymm2(&At23[index]); + CCTK_REAL const PDupwindNthAnti3At23 = PDupwindNthAnti3(&At23[index]); + CCTK_REAL const PDupwindNthSymm3At23 = PDupwindNthSymm3(&At23[index]); + CCTK_REAL const PDdissipationNth1At33 = PDdissipationNth1(&At33[index]); + CCTK_REAL const PDdissipationNth2At33 = PDdissipationNth2(&At33[index]); + CCTK_REAL const PDdissipationNth3At33 = PDdissipationNth3(&At33[index]); + CCTK_REAL const PDupwindNthAnti1At33 = PDupwindNthAnti1(&At33[index]); + CCTK_REAL const PDupwindNthSymm1At33 = PDupwindNthSymm1(&At33[index]); + CCTK_REAL const PDupwindNthAnti2At33 = PDupwindNthAnti2(&At33[index]); + CCTK_REAL const PDupwindNthSymm2At33 = PDupwindNthSymm2(&At33[index]); + CCTK_REAL const PDupwindNthAnti3At33 = PDupwindNthAnti3(&At33[index]); + CCTK_REAL const PDupwindNthSymm3At33 = PDupwindNthSymm3(&At33[index]); + CCTK_REAL const PDstandardNth1beta1 = PDstandardNth1(&beta1[index]); + CCTK_REAL const PDstandardNth2beta1 = PDstandardNth2(&beta1[index]); + CCTK_REAL const PDstandardNth3beta1 = PDstandardNth3(&beta1[index]); + CCTK_REAL const PDstandardNth1beta2 = PDstandardNth1(&beta2[index]); + CCTK_REAL const PDstandardNth2beta2 = PDstandardNth2(&beta2[index]); + CCTK_REAL const PDstandardNth3beta2 = PDstandardNth3(&beta2[index]); + CCTK_REAL const PDstandardNth1beta3 = PDstandardNth1(&beta3[index]); + CCTK_REAL const PDstandardNth2beta3 = PDstandardNth2(&beta3[index]); + CCTK_REAL const PDstandardNth3beta3 = PDstandardNth3(&beta3[index]); + CCTK_REAL const PDstandardNth1gt11 = PDstandardNth1(>11[index]); + CCTK_REAL const PDstandardNth2gt11 = PDstandardNth2(>11[index]); + CCTK_REAL const PDstandardNth3gt11 = PDstandardNth3(>11[index]); + CCTK_REAL const PDstandardNth11gt11 = PDstandardNth11(>11[index]); + CCTK_REAL const PDstandardNth22gt11 = PDstandardNth22(>11[index]); + CCTK_REAL const PDstandardNth33gt11 = PDstandardNth33(>11[index]); + CCTK_REAL const PDstandardNth12gt11 = PDstandardNth12(>11[index]); + CCTK_REAL const PDstandardNth13gt11 = PDstandardNth13(>11[index]); + CCTK_REAL const PDstandardNth23gt11 = PDstandardNth23(>11[index]); + CCTK_REAL const PDstandardNth1gt12 = PDstandardNth1(>12[index]); + CCTK_REAL const PDstandardNth2gt12 = PDstandardNth2(>12[index]); + CCTK_REAL const PDstandardNth3gt12 = PDstandardNth3(>12[index]); + CCTK_REAL const PDstandardNth11gt12 = PDstandardNth11(>12[index]); + CCTK_REAL const PDstandardNth22gt12 = PDstandardNth22(>12[index]); + CCTK_REAL const PDstandardNth33gt12 = PDstandardNth33(>12[index]); + CCTK_REAL const PDstandardNth12gt12 = PDstandardNth12(>12[index]); + CCTK_REAL const PDstandardNth13gt12 = PDstandardNth13(>12[index]); + CCTK_REAL const PDstandardNth23gt12 = PDstandardNth23(>12[index]); + CCTK_REAL const PDstandardNth1gt13 = PDstandardNth1(>13[index]); + CCTK_REAL const PDstandardNth2gt13 = PDstandardNth2(>13[index]); + CCTK_REAL const PDstandardNth3gt13 = PDstandardNth3(>13[index]); + CCTK_REAL const PDstandardNth11gt13 = PDstandardNth11(>13[index]); + CCTK_REAL const PDstandardNth22gt13 = PDstandardNth22(>13[index]); + CCTK_REAL const PDstandardNth33gt13 = PDstandardNth33(>13[index]); + CCTK_REAL const PDstandardNth12gt13 = PDstandardNth12(>13[index]); + CCTK_REAL const PDstandardNth13gt13 = PDstandardNth13(>13[index]); + CCTK_REAL const PDstandardNth23gt13 = PDstandardNth23(>13[index]); + CCTK_REAL const PDstandardNth1gt22 = PDstandardNth1(>22[index]); + CCTK_REAL const PDstandardNth2gt22 = PDstandardNth2(>22[index]); + CCTK_REAL const PDstandardNth3gt22 = PDstandardNth3(>22[index]); + CCTK_REAL const PDstandardNth11gt22 = PDstandardNth11(>22[index]); + CCTK_REAL const PDstandardNth22gt22 = PDstandardNth22(>22[index]); + CCTK_REAL const PDstandardNth33gt22 = PDstandardNth33(>22[index]); + CCTK_REAL const PDstandardNth12gt22 = PDstandardNth12(>22[index]); + CCTK_REAL const PDstandardNth13gt22 = PDstandardNth13(>22[index]); + CCTK_REAL const PDstandardNth23gt22 = PDstandardNth23(>22[index]); + CCTK_REAL const PDstandardNth1gt23 = PDstandardNth1(>23[index]); + CCTK_REAL const PDstandardNth2gt23 = PDstandardNth2(>23[index]); + CCTK_REAL const PDstandardNth3gt23 = PDstandardNth3(>23[index]); + CCTK_REAL const PDstandardNth11gt23 = PDstandardNth11(>23[index]); + CCTK_REAL const PDstandardNth22gt23 = PDstandardNth22(>23[index]); + CCTK_REAL const PDstandardNth33gt23 = PDstandardNth33(>23[index]); + CCTK_REAL const PDstandardNth12gt23 = PDstandardNth12(>23[index]); + CCTK_REAL const PDstandardNth13gt23 = PDstandardNth13(>23[index]); + CCTK_REAL const PDstandardNth23gt23 = PDstandardNth23(>23[index]); + CCTK_REAL const PDstandardNth1gt33 = PDstandardNth1(>33[index]); + CCTK_REAL const PDstandardNth2gt33 = PDstandardNth2(>33[index]); + CCTK_REAL const PDstandardNth3gt33 = PDstandardNth3(>33[index]); + CCTK_REAL const PDstandardNth11gt33 = PDstandardNth11(>33[index]); + CCTK_REAL const PDstandardNth22gt33 = PDstandardNth22(>33[index]); + CCTK_REAL const PDstandardNth33gt33 = PDstandardNth33(>33[index]); + CCTK_REAL const PDstandardNth12gt33 = PDstandardNth12(>33[index]); + CCTK_REAL const PDstandardNth13gt33 = PDstandardNth13(>33[index]); + CCTK_REAL const PDstandardNth23gt33 = PDstandardNth23(>33[index]); + CCTK_REAL const PDstandardNth1phi = PDstandardNth1(&phi[index]); + CCTK_REAL const PDstandardNth2phi = PDstandardNth2(&phi[index]); + CCTK_REAL const PDstandardNth3phi = PDstandardNth3(&phi[index]); + CCTK_REAL const PDstandardNth11phi = PDstandardNth11(&phi[index]); + CCTK_REAL const PDstandardNth22phi = PDstandardNth22(&phi[index]); + CCTK_REAL const PDstandardNth33phi = PDstandardNth33(&phi[index]); + CCTK_REAL const PDstandardNth12phi = PDstandardNth12(&phi[index]); + CCTK_REAL const PDstandardNth13phi = PDstandardNth13(&phi[index]); + CCTK_REAL const PDstandardNth23phi = PDstandardNth23(&phi[index]); + CCTK_REAL const PDstandardNth1Xt1 = PDstandardNth1(&Xt1[index]); + CCTK_REAL const PDstandardNth2Xt1 = PDstandardNth2(&Xt1[index]); + CCTK_REAL const PDstandardNth3Xt1 = PDstandardNth3(&Xt1[index]); + CCTK_REAL const PDstandardNth1Xt2 = PDstandardNth1(&Xt2[index]); + CCTK_REAL const PDstandardNth2Xt2 = PDstandardNth2(&Xt2[index]); + CCTK_REAL const PDstandardNth3Xt2 = PDstandardNth3(&Xt2[index]); + CCTK_REAL const PDstandardNth1Xt3 = PDstandardNth1(&Xt3[index]); + CCTK_REAL const PDstandardNth2Xt3 = PDstandardNth2(&Xt3[index]); + CCTK_REAL const PDstandardNth3Xt3 = PDstandardNth3(&Xt3[index]); + + /* Calculate temporaries and grid functions */ + ptrdiff_t dir1 = Sign(beta1L); + + ptrdiff_t dir2 = Sign(beta2L); + + ptrdiff_t dir3 = Sign(beta3L); + + CCTK_REAL epsdiss1 = ToReal(EpsDiss); + + CCTK_REAL epsdiss2 = ToReal(EpsDiss); + + CCTK_REAL epsdiss3 = ToReal(EpsDiss); + + CCTK_REAL detgt = 1; + + CCTK_REAL gtu11 = INV(detgt)*(gt22L*gt33L - SQR(gt23L)); + + CCTK_REAL gtu12 = (gt13L*gt23L - gt12L*gt33L)*INV(detgt); + + CCTK_REAL gtu13 = (-(gt13L*gt22L) + gt12L*gt23L)*INV(detgt); + + CCTK_REAL gtu22 = INV(detgt)*(gt11L*gt33L - SQR(gt13L)); + + CCTK_REAL gtu23 = (gt12L*gt13L - gt11L*gt23L)*INV(detgt); + + CCTK_REAL gtu33 = INV(detgt)*(gt11L*gt22L - SQR(gt12L)); + + CCTK_REAL Gtl111 = 0.5*PDstandardNth1gt11; + + CCTK_REAL Gtl112 = 0.5*PDstandardNth2gt11; + + CCTK_REAL Gtl113 = 0.5*PDstandardNth3gt11; + + CCTK_REAL Gtl122 = -0.5*PDstandardNth1gt22 + PDstandardNth2gt12; + + CCTK_REAL Gtl123 = 0.5*(-PDstandardNth1gt23 + PDstandardNth2gt13 + + PDstandardNth3gt12); + + CCTK_REAL Gtl133 = -0.5*PDstandardNth1gt33 + PDstandardNth3gt13; + + CCTK_REAL Gtl211 = PDstandardNth1gt12 - 0.5*PDstandardNth2gt11; + + CCTK_REAL Gtl212 = 0.5*PDstandardNth1gt22; + + CCTK_REAL Gtl213 = 0.5*(PDstandardNth1gt23 - PDstandardNth2gt13 + + PDstandardNth3gt12); + + CCTK_REAL Gtl222 = 0.5*PDstandardNth2gt22; + + CCTK_REAL Gtl223 = 0.5*PDstandardNth3gt22; + + CCTK_REAL Gtl233 = -0.5*PDstandardNth2gt33 + PDstandardNth3gt23; + + CCTK_REAL Gtl311 = PDstandardNth1gt13 - 0.5*PDstandardNth3gt11; + + CCTK_REAL Gtl312 = 0.5*(PDstandardNth1gt23 + PDstandardNth2gt13 - + PDstandardNth3gt12); + + CCTK_REAL Gtl313 = 0.5*PDstandardNth1gt33; + + CCTK_REAL Gtl322 = PDstandardNth2gt23 - 0.5*PDstandardNth3gt22; + + CCTK_REAL Gtl323 = 0.5*PDstandardNth2gt33; + + CCTK_REAL Gtl333 = 0.5*PDstandardNth3gt33; + + CCTK_REAL Gtlu111 = Gtl111*gtu11 + Gtl112*gtu12 + Gtl113*gtu13; + + CCTK_REAL Gtlu112 = Gtl111*gtu12 + Gtl112*gtu22 + Gtl113*gtu23; + + CCTK_REAL Gtlu113 = Gtl111*gtu13 + Gtl112*gtu23 + Gtl113*gtu33; + + CCTK_REAL Gtlu121 = Gtl112*gtu11 + Gtl122*gtu12 + Gtl123*gtu13; + + CCTK_REAL Gtlu122 = Gtl112*gtu12 + Gtl122*gtu22 + Gtl123*gtu23; + + CCTK_REAL Gtlu123 = Gtl112*gtu13 + Gtl122*gtu23 + Gtl123*gtu33; + + CCTK_REAL Gtlu131 = Gtl113*gtu11 + Gtl123*gtu12 + Gtl133*gtu13; + + CCTK_REAL Gtlu132 = Gtl113*gtu12 + Gtl123*gtu22 + Gtl133*gtu23; + + CCTK_REAL Gtlu133 = Gtl113*gtu13 + Gtl123*gtu23 + Gtl133*gtu33; + + CCTK_REAL Gtlu211 = Gtl211*gtu11 + Gtl212*gtu12 + Gtl213*gtu13; + + CCTK_REAL Gtlu212 = Gtl211*gtu12 + Gtl212*gtu22 + Gtl213*gtu23; + + CCTK_REAL Gtlu213 = Gtl211*gtu13 + Gtl212*gtu23 + Gtl213*gtu33; + + CCTK_REAL Gtlu221 = Gtl212*gtu11 + Gtl222*gtu12 + Gtl223*gtu13; + + CCTK_REAL Gtlu222 = Gtl212*gtu12 + Gtl222*gtu22 + Gtl223*gtu23; + + CCTK_REAL Gtlu223 = Gtl212*gtu13 + Gtl222*gtu23 + Gtl223*gtu33; + + CCTK_REAL Gtlu231 = Gtl213*gtu11 + Gtl223*gtu12 + Gtl233*gtu13; + + CCTK_REAL Gtlu232 = Gtl213*gtu12 + Gtl223*gtu22 + Gtl233*gtu23; + + CCTK_REAL Gtlu233 = Gtl213*gtu13 + Gtl223*gtu23 + Gtl233*gtu33; + + CCTK_REAL Gtlu311 = Gtl311*gtu11 + Gtl312*gtu12 + Gtl313*gtu13; + + CCTK_REAL Gtlu312 = Gtl311*gtu12 + Gtl312*gtu22 + Gtl313*gtu23; + + CCTK_REAL Gtlu313 = Gtl311*gtu13 + Gtl312*gtu23 + Gtl313*gtu33; + + CCTK_REAL Gtlu321 = Gtl312*gtu11 + Gtl322*gtu12 + Gtl323*gtu13; + + CCTK_REAL Gtlu322 = Gtl312*gtu12 + Gtl322*gtu22 + Gtl323*gtu23; + + CCTK_REAL Gtlu323 = Gtl312*gtu13 + Gtl322*gtu23 + Gtl323*gtu33; + + CCTK_REAL Gtlu331 = Gtl313*gtu11 + Gtl323*gtu12 + Gtl333*gtu13; + + CCTK_REAL Gtlu332 = Gtl313*gtu12 + Gtl323*gtu22 + Gtl333*gtu23; + + CCTK_REAL Gtlu333 = Gtl313*gtu13 + Gtl323*gtu23 + Gtl333*gtu33; + + CCTK_REAL Gt111 = Gtl111*gtu11 + Gtl211*gtu12 + Gtl311*gtu13; + + CCTK_REAL Gt211 = Gtl111*gtu12 + Gtl211*gtu22 + Gtl311*gtu23; + + CCTK_REAL Gt311 = Gtl111*gtu13 + Gtl211*gtu23 + Gtl311*gtu33; + + CCTK_REAL Gt112 = Gtl112*gtu11 + Gtl212*gtu12 + Gtl312*gtu13; + + CCTK_REAL Gt212 = Gtl112*gtu12 + Gtl212*gtu22 + Gtl312*gtu23; + + CCTK_REAL Gt312 = Gtl112*gtu13 + Gtl212*gtu23 + Gtl312*gtu33; + + CCTK_REAL Gt113 = Gtl113*gtu11 + Gtl213*gtu12 + Gtl313*gtu13; + + CCTK_REAL Gt213 = Gtl113*gtu12 + Gtl213*gtu22 + Gtl313*gtu23; + + CCTK_REAL Gt313 = Gtl113*gtu13 + Gtl213*gtu23 + Gtl313*gtu33; + + CCTK_REAL Gt122 = Gtl122*gtu11 + Gtl222*gtu12 + Gtl322*gtu13; + + CCTK_REAL Gt222 = Gtl122*gtu12 + Gtl222*gtu22 + Gtl322*gtu23; + + CCTK_REAL Gt322 = Gtl122*gtu13 + Gtl222*gtu23 + Gtl322*gtu33; + + CCTK_REAL Gt123 = Gtl123*gtu11 + Gtl223*gtu12 + Gtl323*gtu13; + + CCTK_REAL Gt223 = Gtl123*gtu12 + Gtl223*gtu22 + Gtl323*gtu23; + + CCTK_REAL Gt323 = Gtl123*gtu13 + Gtl223*gtu23 + Gtl323*gtu33; + + CCTK_REAL Gt133 = Gtl133*gtu11 + Gtl233*gtu12 + Gtl333*gtu13; + + CCTK_REAL Gt233 = Gtl133*gtu12 + Gtl233*gtu22 + Gtl333*gtu23; + + CCTK_REAL Gt333 = Gtl133*gtu13 + Gtl233*gtu23 + Gtl333*gtu33; + + CCTK_REAL Xtn1 = Gt111*gtu11 + Gt122*gtu22 + 2*(Gt112*gtu12 + + Gt113*gtu13 + Gt123*gtu23) + Gt133*gtu33; + + CCTK_REAL Xtn2 = Gt211*gtu11 + Gt222*gtu22 + 2*(Gt212*gtu12 + + Gt213*gtu13 + Gt223*gtu23) + Gt233*gtu33; + + CCTK_REAL Xtn3 = Gt311*gtu11 + Gt322*gtu22 + 2*(Gt312*gtu12 + + Gt313*gtu13 + Gt323*gtu23) + Gt333*gtu33; + + CCTK_REAL Rt11 = 3*(Gt111*Gtlu111 + Gt112*Gtlu112 + Gt113*Gtlu113) + + 2*(Gt211*Gtlu121 + Gt212*Gtlu122 + Gt213*Gtlu123 + Gt311*Gtlu131 + + Gt312*Gtlu132 + Gt313*Gtlu133) + Gt211*Gtlu211 + Gt212*Gtlu212 + + Gt213*Gtlu213 + Gt311*Gtlu311 + Gt312*Gtlu312 + Gt313*Gtlu313 + + gt11L*PDstandardNth1Xt1 + gt12L*PDstandardNth1Xt2 + + gt13L*PDstandardNth1Xt3 + 0.5*(-(gtu11*PDstandardNth11gt11) - + 2*gtu12*PDstandardNth12gt11 - 2*gtu13*PDstandardNth13gt11 - + gtu22*PDstandardNth22gt11 - 2*gtu23*PDstandardNth23gt11 - + gtu33*PDstandardNth33gt11) + Gtl111*Xtn1 + Gtl112*Xtn2 + Gtl113*Xtn3; + + CCTK_REAL Rt12 = 0.5*(4*(Gt211*Gtlu221 + Gt212*Gtlu222 + + Gt213*Gtlu223) + 2*(Gt112*Gtlu111 + Gt122*Gtlu112 + Gt123*Gtlu113 + + Gt111*Gtlu121 + Gt212*Gtlu121 + Gt112*Gtlu122 + Gt222*Gtlu122 + + Gt113*Gtlu123 + Gt223*Gtlu123 + Gt312*Gtlu131 + Gt322*Gtlu132 + + Gt323*Gtlu133 + Gt111*Gtlu211 + Gt112*Gtlu212 + Gt113*Gtlu213 + + Gt311*Gtlu231 + Gt312*Gtlu232 + Gt313*Gtlu233 + Gt311*Gtlu321 + + Gt312*Gtlu322 + Gt313*Gtlu323) - gtu11*PDstandardNth11gt12 - + 2*gtu12*PDstandardNth12gt12 - 2*gtu13*PDstandardNth13gt12 + + gt12L*PDstandardNth1Xt1 + gt22L*PDstandardNth1Xt2 + + gt23L*PDstandardNth1Xt3 - gtu22*PDstandardNth22gt12 - + 2*gtu23*PDstandardNth23gt12 + gt11L*PDstandardNth2Xt1 + + gt12L*PDstandardNth2Xt2 + gt13L*PDstandardNth2Xt3 - + gtu33*PDstandardNth33gt12 + Gtl112*Xtn1 + Gtl211*Xtn1 + Gtl122*Xtn2 + + Gtl212*Xtn2 + Gtl123*Xtn3 + Gtl213*Xtn3); + + CCTK_REAL Rt13 = 0.5*(2*(Gt113*Gtlu111 + Gt123*Gtlu112 + Gt133*Gtlu113 + + Gt213*Gtlu121 + Gt223*Gtlu122 + Gt233*Gtlu123 + Gt111*Gtlu131 + + Gt313*Gtlu131 + Gt112*Gtlu132 + Gt323*Gtlu132 + Gt113*Gtlu133 + + Gt333*Gtlu133 + Gt211*Gtlu231 + Gt212*Gtlu232 + Gt213*Gtlu233 + + Gt111*Gtlu311 + Gt112*Gtlu312 + Gt113*Gtlu313 + Gt211*Gtlu321 + + Gt212*Gtlu322 + Gt213*Gtlu323) + 4*(Gt311*Gtlu331 + Gt312*Gtlu332 + + Gt313*Gtlu333) - gtu11*PDstandardNth11gt13 - + 2*gtu12*PDstandardNth12gt13 - 2*gtu13*PDstandardNth13gt13 + + gt13L*PDstandardNth1Xt1 + gt23L*PDstandardNth1Xt2 + + gt33L*PDstandardNth1Xt3 - gtu22*PDstandardNth22gt13 - + 2*gtu23*PDstandardNth23gt13 - gtu33*PDstandardNth33gt13 + + gt11L*PDstandardNth3Xt1 + gt12L*PDstandardNth3Xt2 + + gt13L*PDstandardNth3Xt3 + Gtl113*Xtn1 + Gtl311*Xtn1 + Gtl123*Xtn2 + + Gtl312*Xtn2 + Gtl133*Xtn3 + Gtl313*Xtn3); + + CCTK_REAL Rt22 = Gt112*(Gtlu121 + 2*Gtlu211) + Gt122*(Gtlu122 + + 2*Gtlu212) + Gt123*(Gtlu123 + 2*Gtlu213) + 3*(Gt212*Gtlu221 + + Gt222*Gtlu222 + Gt223*Gtlu223) + 2*(Gt312*Gtlu231 + Gt322*Gtlu232 + + Gt323*Gtlu233) + Gt312*Gtlu321 + Gt322*Gtlu322 + Gt323*Gtlu323 + + gt12L*PDstandardNth2Xt1 + gt22L*PDstandardNth2Xt2 + + gt23L*PDstandardNth2Xt3 + 0.5*(-(gtu11*PDstandardNth11gt22) - + 2*gtu12*PDstandardNth12gt22 - 2*gtu13*PDstandardNth13gt22 - + gtu22*PDstandardNth22gt22 - 2*gtu23*PDstandardNth23gt22 - + gtu33*PDstandardNth33gt22) + Gtl212*Xtn1 + Gtl222*Xtn2 + Gtl223*Xtn3; + + CCTK_REAL Rt23 = 0.5*(2*(Gt112*Gtlu131 + Gt122*Gtlu132 + Gt123*Gtlu133 + + Gt113*Gtlu211 + Gt123*Gtlu212 + Gt133*Gtlu213 + Gt213*Gtlu221 + + Gt223*Gtlu222 + Gt233*Gtlu223 + Gt212*Gtlu231 + Gt313*Gtlu231 + + Gt222*Gtlu232 + Gt323*Gtlu232 + Gt223*Gtlu233 + Gt333*Gtlu233 + + Gt112*Gtlu311 + Gt122*Gtlu312 + Gt123*Gtlu313 + Gt212*Gtlu321 + + Gt222*Gtlu322 + Gt223*Gtlu323) + 4*(Gt312*Gtlu331 + Gt322*Gtlu332 + + Gt323*Gtlu333) - gtu11*PDstandardNth11gt23 - + 2*gtu12*PDstandardNth12gt23 - 2*gtu13*PDstandardNth13gt23 - + gtu22*PDstandardNth22gt23 - 2*gtu23*PDstandardNth23gt23 + + gt13L*PDstandardNth2Xt1 + gt23L*PDstandardNth2Xt2 + + gt33L*PDstandardNth2Xt3 - gtu33*PDstandardNth33gt23 + + gt12L*PDstandardNth3Xt1 + gt22L*PDstandardNth3Xt2 + + gt23L*PDstandardNth3Xt3 + Gtl213*Xtn1 + Gtl312*Xtn1 + Gtl223*Xtn2 + + Gtl322*Xtn2 + Gtl233*Xtn3 + Gtl323*Xtn3); + + CCTK_REAL Rt33 = Gt113*(Gtlu131 + 2*Gtlu311) + Gt123*(Gtlu132 + + 2*Gtlu312) + Gt133*(Gtlu133 + 2*Gtlu313) + Gt213*(Gtlu231 + 2*Gtlu321) + + Gt223*(Gtlu232 + 2*Gtlu322) + Gt233*(Gtlu233 + 2*Gtlu323) + + 3*(Gt313*Gtlu331 + Gt323*Gtlu332 + Gt333*Gtlu333) + + 0.5*(-(gtu11*PDstandardNth11gt33) - 2*gtu12*PDstandardNth12gt33 - + 2*gtu13*PDstandardNth13gt33 - gtu22*PDstandardNth22gt33 - + 2*gtu23*PDstandardNth23gt33 - gtu33*PDstandardNth33gt33) + + gt13L*PDstandardNth3Xt1 + gt23L*PDstandardNth3Xt2 + + gt33L*PDstandardNth3Xt3 + Gtl313*Xtn1 + Gtl323*Xtn2 + Gtl333*Xtn3; + + CCTK_REAL fac1 = IfThen(ToReal(conformalMethod),-0.5*INV(phiL),1); + + CCTK_REAL cdphi1 = fac1*PDstandardNth1phi; + + CCTK_REAL cdphi2 = fac1*PDstandardNth2phi; + + CCTK_REAL cdphi3 = fac1*PDstandardNth3phi; + + CCTK_REAL fac2 = IfThen(ToReal(conformalMethod),0.5*INV(SQR(phiL)),0); + + CCTK_REAL cdphi211 = -(fac1*(-PDstandardNth11phi + + Gt111*PDstandardNth1phi + Gt211*PDstandardNth2phi + + Gt311*PDstandardNth3phi)) + fac2*SQR(PDstandardNth1phi); + + CCTK_REAL cdphi212 = fac2*PDstandardNth1phi*PDstandardNth2phi - + fac1*(-PDstandardNth12phi + Gt112*PDstandardNth1phi + + Gt212*PDstandardNth2phi + Gt312*PDstandardNth3phi); + + CCTK_REAL cdphi213 = fac2*PDstandardNth1phi*PDstandardNth3phi - + fac1*(-PDstandardNth13phi + Gt113*PDstandardNth1phi + + Gt213*PDstandardNth2phi + Gt313*PDstandardNth3phi); + + CCTK_REAL cdphi222 = -(fac1*(Gt122*PDstandardNth1phi - + PDstandardNth22phi + Gt222*PDstandardNth2phi + + Gt322*PDstandardNth3phi)) + fac2*SQR(PDstandardNth2phi); + + CCTK_REAL cdphi223 = fac2*PDstandardNth2phi*PDstandardNth3phi - + fac1*(Gt123*PDstandardNth1phi - PDstandardNth23phi + + Gt223*PDstandardNth2phi + Gt323*PDstandardNth3phi); + + CCTK_REAL cdphi233 = -(fac1*(Gt133*PDstandardNth1phi + + Gt233*PDstandardNth2phi - PDstandardNth33phi + + Gt333*PDstandardNth3phi)) + fac2*SQR(PDstandardNth3phi); + + CCTK_REAL Rphi11 = -2*(cdphi211 + 2*(-1 + gt11L*gtu11)*SQR(cdphi1) + + gt11L*(cdphi211*gtu11 + 4*(cdphi1*(cdphi2*gtu12 + cdphi3*gtu13) + + cdphi2*cdphi3*gtu23) + cdphi233*gtu33 + gtu22*(cdphi222 + + 2*SQR(cdphi2)) + 2*(cdphi212*gtu12 + cdphi213*gtu13 + cdphi223*gtu23 + + gtu33*SQR(cdphi3)))); + + CCTK_REAL Rphi12 = -2*(cdphi212 + cdphi1*(cdphi2*(-2 + 4*gt12L*gtu12) + + 4*cdphi3*gt12L*gtu13) + gt12L*(cdphi211*gtu11 + 4*cdphi2*cdphi3*gtu23 + + 2*(cdphi212*gtu12 + cdphi213*gtu13 + cdphi223*gtu23 + + gtu11*SQR(cdphi1)) + gtu22*(cdphi222 + 2*SQR(cdphi2)) + gtu33*(cdphi233 + + 2*SQR(cdphi3)))); + + CCTK_REAL Rphi13 = -2*(cdphi213 + cdphi1*(4*cdphi2*gt13L*gtu12 + + cdphi3*(-2 + 4*gt13L*gtu13)) + gt13L*(cdphi211*gtu11 + + 4*cdphi2*cdphi3*gtu23 + 2*(cdphi212*gtu12 + cdphi213*gtu13 + + cdphi223*gtu23 + gtu11*SQR(cdphi1)) + gtu22*(cdphi222 + 2*SQR(cdphi2)) + + gtu33*(cdphi233 + 2*SQR(cdphi3)))); + + CCTK_REAL Rphi22 = -2*(cdphi222 + 2*(-1 + gt22L*gtu22)*SQR(cdphi2) + + gt22L*(cdphi222*gtu22 + 4*(cdphi1*cdphi3*gtu13 + cdphi2*(cdphi1*gtu12 + + cdphi3*gtu23)) + cdphi233*gtu33 + gtu11*(cdphi211 + 2*SQR(cdphi1)) + + 2*(cdphi212*gtu12 + cdphi213*gtu13 + cdphi223*gtu23 + + gtu33*SQR(cdphi3)))); + + CCTK_REAL Rphi23 = -2*(cdphi223 + cdphi2*(4*cdphi1*gt23L*gtu12 + + cdphi3*(-2 + 4*gt23L*gtu23)) + gt23L*(4*cdphi1*cdphi3*gtu13 + + cdphi222*gtu22 + gtu11*(cdphi211 + 2*SQR(cdphi1)) + 2*(cdphi212*gtu12 + + cdphi213*gtu13 + cdphi223*gtu23 + gtu22*SQR(cdphi2)) + gtu33*(cdphi233 + + 2*SQR(cdphi3)))); + + CCTK_REAL Rphi33 = -2*(cdphi233 + gt33L*((4*cdphi1*cdphi2 + + 2*cdphi212)*gtu12 + 4*cdphi3*(cdphi1*gtu13 + cdphi2*gtu23) + + 2*(cdphi213*gtu13 + cdphi223*gtu23) + cdphi233*gtu33 + gtu11*(cdphi211 + + 2*SQR(cdphi1)) + gtu22*(cdphi222 + 2*SQR(cdphi2))) + 2*(-1 + + gt33L*gtu33)*SQR(cdphi3)); + + CCTK_REAL Atm11 = At11L*gtu11 + At12L*gtu12 + At13L*gtu13; + + CCTK_REAL Atm21 = At11L*gtu12 + At12L*gtu22 + At13L*gtu23; + + CCTK_REAL Atm31 = At11L*gtu13 + At12L*gtu23 + At13L*gtu33; + + CCTK_REAL Atm12 = At12L*gtu11 + At22L*gtu12 + At23L*gtu13; + + CCTK_REAL Atm22 = At12L*gtu12 + At22L*gtu22 + At23L*gtu23; + + CCTK_REAL Atm32 = At12L*gtu13 + At22L*gtu23 + At23L*gtu33; + + CCTK_REAL Atm13 = At13L*gtu11 + At23L*gtu12 + At33L*gtu13; + + CCTK_REAL Atm23 = At13L*gtu12 + At23L*gtu22 + At33L*gtu23; + + CCTK_REAL Atm33 = At13L*gtu13 + At23L*gtu23 + At33L*gtu33; + + CCTK_REAL e4phi = + IfThen(ToReal(conformalMethod),INV(SQR(phiL)),exp(4*phiL)); + + CCTK_REAL em4phi = INV(e4phi); + + CCTK_REAL g11 = e4phi*gt11L; + + CCTK_REAL g12 = e4phi*gt12L; + + CCTK_REAL g13 = e4phi*gt13L; + + CCTK_REAL g22 = e4phi*gt22L; + + CCTK_REAL g23 = e4phi*gt23L; + + CCTK_REAL g33 = e4phi*gt33L; + + CCTK_REAL gu11 = em4phi*gtu11; + + CCTK_REAL gu12 = em4phi*gtu12; + + CCTK_REAL gu13 = em4phi*gtu13; + + CCTK_REAL gu22 = em4phi*gtu22; + + CCTK_REAL gu23 = em4phi*gtu23; + + CCTK_REAL gu33 = em4phi*gtu33; + + CCTK_REAL R11 = Rphi11 + Rt11; + + CCTK_REAL R12 = Rphi12 + Rt12; + + CCTK_REAL R13 = Rphi13 + Rt13; + + CCTK_REAL R22 = Rphi22 + Rt22; + + CCTK_REAL R23 = Rphi23 + Rt23; + + CCTK_REAL R33 = Rphi33 + Rt33; + + CCTK_REAL trS = em4phi*(eTxxL*gtu11 + eTyyL*gtu22 + 2*(eTxyL*gtu12 + + eTxzL*gtu13 + eTyzL*gtu23) + eTzzL*gtu33); + + CCTK_REAL Ats11 = -PDstandardNth11alpha + (4*cdphi1 + + Gt111)*PDstandardNth1alpha + Gt211*PDstandardNth2alpha + + Gt311*PDstandardNth3alpha + alphaL*R11; + + CCTK_REAL Ats12 = -PDstandardNth12alpha + (2*cdphi2 + + Gt112)*PDstandardNth1alpha + (2*cdphi1 + Gt212)*PDstandardNth2alpha + + Gt312*PDstandardNth3alpha + alphaL*R12; + + CCTK_REAL Ats13 = -PDstandardNth13alpha + (2*cdphi3 + + Gt113)*PDstandardNth1alpha + Gt213*PDstandardNth2alpha + (2*cdphi1 + + Gt313)*PDstandardNth3alpha + alphaL*R13; + + CCTK_REAL Ats22 = Gt122*PDstandardNth1alpha - PDstandardNth22alpha + + (4*cdphi2 + Gt222)*PDstandardNth2alpha + Gt322*PDstandardNth3alpha + + alphaL*R22; + + CCTK_REAL Ats23 = Gt123*PDstandardNth1alpha - PDstandardNth23alpha + + (2*cdphi3 + Gt223)*PDstandardNth2alpha + (2*cdphi2 + + Gt323)*PDstandardNth3alpha + alphaL*R23; + + CCTK_REAL Ats33 = Gt133*PDstandardNth1alpha + + Gt233*PDstandardNth2alpha - PDstandardNth33alpha + (4*cdphi3 + + Gt333)*PDstandardNth3alpha + alphaL*R33; + + CCTK_REAL trAts = Ats11*gu11 + Ats22*gu22 + 2*(Ats12*gu12 + Ats13*gu13 + + Ats23*gu23) + Ats33*gu33; + + CCTK_REAL At11rhsL = -2.*alphaL*(At11L*Atm11 + At12L*Atm21 + + At13L*Atm31) + epsdiss1*PDdissipationNth1At11 + + epsdiss2*PDdissipationNth2At11 + epsdiss3*PDdissipationNth3At11 + + 2.*(At12L*PDstandardNth1beta2 + At13L*PDstandardNth1beta3) + + beta1L*PDupwindNthAnti1At11 + beta2L*PDupwindNthAnti2At11 + + beta3L*PDupwindNthAnti3At11 + + At11L*(1.333333333333333333333333333333333333333*PDstandardNth1beta1 - + 0.6666666666666666666666666666666666666667*(PDstandardNth2beta2 + + PDstandardNth3beta3) + alphaL*trKL) + em4phi*(Ats11 - + 0.3333333333333333333333333333333333333333*g11*trAts + + alphaL*(-25.13274122871834590770114706623602307358*eTxxL + + 8.377580409572781969233715688745341024526*g11*trS)) + + PDupwindNthSymm1At11*Abs(beta1L) + PDupwindNthSymm2At11*Abs(beta2L) + + PDupwindNthSymm3At11*Abs(beta3L); + + CCTK_REAL At12rhsL = -2.*alphaL*(At11L*Atm12 + At12L*Atm22 + + At13L*Atm32) + epsdiss1*PDdissipationNth1At12 + + epsdiss2*PDdissipationNth2At12 + epsdiss3*PDdissipationNth3At12 + + At22L*PDstandardNth1beta2 + At23L*PDstandardNth1beta3 + + At11L*PDstandardNth2beta1 + At13L*PDstandardNth2beta3 + + beta1L*PDupwindNthAnti1At12 + beta2L*PDupwindNthAnti2At12 + + beta3L*PDupwindNthAnti3At12 + + At12L*(0.3333333333333333333333333333333333333333*(PDstandardNth1beta1 + + PDstandardNth2beta2) - + 0.6666666666666666666666666666666666666667*PDstandardNth3beta3 + + alphaL*trKL) + em4phi*(Ats12 - + 0.3333333333333333333333333333333333333333*g12*trAts + + alphaL*(-25.13274122871834590770114706623602307358*eTxyL + + 8.377580409572781969233715688745341024526*g12*trS)) + + PDupwindNthSymm1At12*Abs(beta1L) + PDupwindNthSymm2At12*Abs(beta2L) + + PDupwindNthSymm3At12*Abs(beta3L); + + CCTK_REAL At13rhsL = -2.*alphaL*(At11L*Atm13 + At12L*Atm23 + + At13L*Atm33) + epsdiss1*PDdissipationNth1At13 + + epsdiss2*PDdissipationNth2At13 + epsdiss3*PDdissipationNth3At13 + + At23L*PDstandardNth1beta2 + At33L*PDstandardNth1beta3 + + At11L*PDstandardNth3beta1 + At12L*PDstandardNth3beta2 + + beta1L*PDupwindNthAnti1At13 + beta2L*PDupwindNthAnti2At13 + + beta3L*PDupwindNthAnti3At13 + + At13L*(-0.6666666666666666666666666666666666666667*PDstandardNth2beta2 + + 0.3333333333333333333333333333333333333333*(PDstandardNth1beta1 + + PDstandardNth3beta3) + alphaL*trKL) + em4phi*(Ats13 - + 0.3333333333333333333333333333333333333333*g13*trAts + + alphaL*(-25.13274122871834590770114706623602307358*eTxzL + + 8.377580409572781969233715688745341024526*g13*trS)) + + PDupwindNthSymm1At13*Abs(beta1L) + PDupwindNthSymm2At13*Abs(beta2L) + + PDupwindNthSymm3At13*Abs(beta3L); + + CCTK_REAL At22rhsL = -2.*alphaL*(At12L*Atm12 + At22L*Atm22 + + At23L*Atm32) + epsdiss1*PDdissipationNth1At22 + + epsdiss2*PDdissipationNth2At22 + epsdiss3*PDdissipationNth3At22 + + 2.*(At12L*PDstandardNth2beta1 + At23L*PDstandardNth2beta3) + + beta1L*PDupwindNthAnti1At22 + beta2L*PDupwindNthAnti2At22 + + beta3L*PDupwindNthAnti3At22 + + At22L*(1.333333333333333333333333333333333333333*PDstandardNth2beta2 - + 0.6666666666666666666666666666666666666667*(PDstandardNth1beta1 + + PDstandardNth3beta3) + alphaL*trKL) + em4phi*(Ats22 - + 0.3333333333333333333333333333333333333333*g22*trAts + + alphaL*(-25.13274122871834590770114706623602307358*eTyyL + + 8.377580409572781969233715688745341024526*g22*trS)) + + PDupwindNthSymm1At22*Abs(beta1L) + PDupwindNthSymm2At22*Abs(beta2L) + + PDupwindNthSymm3At22*Abs(beta3L); + + CCTK_REAL At23rhsL = -2.*alphaL*(At12L*Atm13 + At22L*Atm23 + + At23L*Atm33) + epsdiss1*PDdissipationNth1At23 + + epsdiss2*PDdissipationNth2At23 + epsdiss3*PDdissipationNth3At23 + + At13L*PDstandardNth2beta1 + At33L*PDstandardNth2beta3 + + At12L*PDstandardNth3beta1 + At22L*PDstandardNth3beta2 + + beta1L*PDupwindNthAnti1At23 + beta2L*PDupwindNthAnti2At23 + + beta3L*PDupwindNthAnti3At23 + + At23L*(-0.6666666666666666666666666666666666666667*PDstandardNth1beta1 + + 0.3333333333333333333333333333333333333333*(PDstandardNth2beta2 + + PDstandardNth3beta3) + alphaL*trKL) + em4phi*(Ats23 - + 0.3333333333333333333333333333333333333333*g23*trAts + + alphaL*(-25.13274122871834590770114706623602307358*eTyzL + + 8.377580409572781969233715688745341024526*g23*trS)) + + PDupwindNthSymm1At23*Abs(beta1L) + PDupwindNthSymm2At23*Abs(beta2L) + + PDupwindNthSymm3At23*Abs(beta3L); + + CCTK_REAL At33rhsL = -2.*alphaL*(At13L*Atm13 + At23L*Atm23 + + At33L*Atm33) + epsdiss1*PDdissipationNth1At33 + + epsdiss2*PDdissipationNth2At33 + epsdiss3*PDdissipationNth3At33 + + 2.*(At13L*PDstandardNth3beta1 + At23L*PDstandardNth3beta2) + + beta1L*PDupwindNthAnti1At33 + beta2L*PDupwindNthAnti2At33 + + beta3L*PDupwindNthAnti3At33 + + At33L*(-0.6666666666666666666666666666666666666667*(PDstandardNth1beta1 + + PDstandardNth2beta2) + + 1.333333333333333333333333333333333333333*PDstandardNth3beta3 + + alphaL*trKL) + em4phi*(Ats33 - + 0.3333333333333333333333333333333333333333*g33*trAts + + alphaL*(-25.13274122871834590770114706623602307358*eTzzL + + 8.377580409572781969233715688745341024526*g33*trS)) + + PDupwindNthSymm1At33*Abs(beta1L) + PDupwindNthSymm2At33*Abs(beta2L) + + PDupwindNthSymm3At33*Abs(beta3L); + + + /* Copy local copies back to grid functions */ + At11rhs[index] = At11rhsL; + At12rhs[index] = At12rhsL; + At13rhs[index] = At13rhsL; + At22rhs[index] = At22rhsL; + At23rhs[index] = At23rhsL; + At33rhs[index] = At33rhsL; + } + LC_ENDLOOP3 (ML_BSSN_RHS2); +} + +extern "C" void ML_BSSN_RHS2(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverInterior(cctkGH, &ML_BSSN_RHS2_Body); +} diff --git a/ML_BSSN/src/ML_BSSN_RHSStaticBoundary.cc b/ML_BSSN/src/ML_BSSN_RHSStaticBoundary.cc new file mode 100644 index 0000000..26d9f96 --- /dev/null +++ b/ML_BSSN/src/ML_BSSN_RHSStaticBoundary.cc @@ -0,0 +1,223 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +extern "C" void ML_BSSN_RHSStaticBoundary_SelectBCs(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT ierr = 0; + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN::ML_curvrhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN::ML_curvrhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN::ML_dtlapserhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN::ML_dtlapserhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN::ML_dtshiftrhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN::ML_dtshiftrhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN::ML_Gammarhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN::ML_Gammarhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN::ML_lapserhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN::ML_lapserhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN::ML_log_confacrhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN::ML_log_confacrhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN::ML_metricrhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN::ML_metricrhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN::ML_shiftrhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN::ML_shiftrhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN::ML_trace_curvrhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN::ML_trace_curvrhs."); + return; +} + +static void ML_BSSN_RHSStaticBoundary_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_BSSN_RHSStaticBoundary_Body"); + } + + if (cctk_iteration % ML_BSSN_RHSStaticBoundary_calc_every != ML_BSSN_RHSStaticBoundary_calc_offset) + { + return; + } + + const char *groups[] = {"ML_BSSN::ML_curvrhs","ML_BSSN::ML_dtlapserhs","ML_BSSN::ML_dtshiftrhs","ML_BSSN::ML_Gammarhs","ML_BSSN::ML_lapserhs","ML_BSSN::ML_log_confacrhs","ML_BSSN::ML_metricrhs","ML_BSSN::ML_shiftrhs","ML_BSSN::ML_trace_curvrhs"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_BSSN_RHSStaticBoundary", 9, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o12dx = 0.0833333333333333333333333333333*INV(dx); + CCTK_REAL const p1o12dy = 0.0833333333333333333333333333333*INV(dy); + CCTK_REAL const p1o12dz = 0.0833333333333333333333333333333*INV(dz); + CCTK_REAL const p1o144dxdy = 0.00694444444444444444444444444444*INV(dx)*INV(dy); + CCTK_REAL const p1o144dxdz = 0.00694444444444444444444444444444*INV(dx)*INV(dz); + CCTK_REAL const p1o144dydz = 0.00694444444444444444444444444444*INV(dy)*INV(dz); + CCTK_REAL const p1o24dx = 0.0416666666666666666666666666667*INV(dx); + CCTK_REAL const p1o24dy = 0.0416666666666666666666666666667*INV(dy); + CCTK_REAL const p1o24dz = 0.0416666666666666666666666666667*INV(dz); + CCTK_REAL const p1o64dx = 0.015625*INV(dx); + CCTK_REAL const p1o64dy = 0.015625*INV(dy); + CCTK_REAL const p1o64dz = 0.015625*INV(dz); + CCTK_REAL const p1odx = INV(dx); + CCTK_REAL const p1ody = INV(dy); + CCTK_REAL const p1odz = INV(dz); + CCTK_REAL const pm1o12dx2 = -0.0833333333333333333333333333333*INV(SQR(dx)); + CCTK_REAL const pm1o12dy2 = -0.0833333333333333333333333333333*INV(SQR(dy)); + CCTK_REAL const pm1o12dz2 = -0.0833333333333333333333333333333*INV(SQR(dz)); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_BSSN_RHSStaticBoundary, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + + /* Include user supplied include files */ + + /* Precompute derivatives */ + + /* Calculate temporaries and grid functions */ + CCTK_REAL phirhsL = 0; + + CCTK_REAL gt11rhsL = 0; + + CCTK_REAL gt12rhsL = 0; + + CCTK_REAL gt13rhsL = 0; + + CCTK_REAL gt22rhsL = 0; + + CCTK_REAL gt23rhsL = 0; + + CCTK_REAL gt33rhsL = 0; + + CCTK_REAL trKrhsL = 0; + + CCTK_REAL At11rhsL = 0; + + CCTK_REAL At12rhsL = 0; + + CCTK_REAL At13rhsL = 0; + + CCTK_REAL At22rhsL = 0; + + CCTK_REAL At23rhsL = 0; + + CCTK_REAL At33rhsL = 0; + + CCTK_REAL Xt1rhsL = 0; + + CCTK_REAL Xt2rhsL = 0; + + CCTK_REAL Xt3rhsL = 0; + + CCTK_REAL alpharhsL = 0; + + CCTK_REAL ArhsL = 0; + + CCTK_REAL beta1rhsL = 0; + + CCTK_REAL beta2rhsL = 0; + + CCTK_REAL beta3rhsL = 0; + + CCTK_REAL B1rhsL = 0; + + CCTK_REAL B2rhsL = 0; + + CCTK_REAL B3rhsL = 0; + + + /* Copy local copies back to grid functions */ + alpharhs[index] = alpharhsL; + Arhs[index] = ArhsL; + At11rhs[index] = At11rhsL; + At12rhs[index] = At12rhsL; + At13rhs[index] = At13rhsL; + At22rhs[index] = At22rhsL; + At23rhs[index] = At23rhsL; + At33rhs[index] = At33rhsL; + B1rhs[index] = B1rhsL; + B2rhs[index] = B2rhsL; + B3rhs[index] = B3rhsL; + beta1rhs[index] = beta1rhsL; + beta2rhs[index] = beta2rhsL; + beta3rhs[index] = beta3rhsL; + gt11rhs[index] = gt11rhsL; + gt12rhs[index] = gt12rhsL; + gt13rhs[index] = gt13rhsL; + gt22rhs[index] = gt22rhsL; + gt23rhs[index] = gt23rhsL; + gt33rhs[index] = gt33rhsL; + phirhs[index] = phirhsL; + trKrhs[index] = trKrhsL; + Xt1rhs[index] = Xt1rhsL; + Xt2rhs[index] = Xt2rhsL; + Xt3rhs[index] = Xt3rhsL; + } + LC_ENDLOOP3 (ML_BSSN_RHSStaticBoundary); +} + +extern "C" void ML_BSSN_RHSStaticBoundary(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverBoundary(cctkGH, &ML_BSSN_RHSStaticBoundary_Body); +} diff --git a/ML_BSSN/src/ML_BSSN_boundary.cc b/ML_BSSN/src/ML_BSSN_boundary.cc new file mode 100644 index 0000000..48174eb --- /dev/null +++ b/ML_BSSN/src/ML_BSSN_boundary.cc @@ -0,0 +1,223 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +extern "C" void ML_BSSN_boundary_SelectBCs(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT ierr = 0; + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN::ML_curv","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN::ML_curv."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN::ML_dtlapse","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN::ML_dtlapse."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN::ML_dtshift","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN::ML_dtshift."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN::ML_Gamma","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN::ML_Gamma."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN::ML_lapse","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN::ML_lapse."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN::ML_log_confac","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN::ML_log_confac."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN::ML_metric","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN::ML_metric."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN::ML_shift","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN::ML_shift."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN::ML_trace_curv","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN::ML_trace_curv."); + return; +} + +static void ML_BSSN_boundary_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_BSSN_boundary_Body"); + } + + if (cctk_iteration % ML_BSSN_boundary_calc_every != ML_BSSN_boundary_calc_offset) + { + return; + } + + const char *groups[] = {"ML_BSSN::ML_curv","ML_BSSN::ML_dtlapse","ML_BSSN::ML_dtshift","ML_BSSN::ML_Gamma","ML_BSSN::ML_lapse","ML_BSSN::ML_log_confac","ML_BSSN::ML_metric","ML_BSSN::ML_shift","ML_BSSN::ML_trace_curv"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_BSSN_boundary", 9, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o12dx = 0.0833333333333333333333333333333*INV(dx); + CCTK_REAL const p1o12dy = 0.0833333333333333333333333333333*INV(dy); + CCTK_REAL const p1o12dz = 0.0833333333333333333333333333333*INV(dz); + CCTK_REAL const p1o144dxdy = 0.00694444444444444444444444444444*INV(dx)*INV(dy); + CCTK_REAL const p1o144dxdz = 0.00694444444444444444444444444444*INV(dx)*INV(dz); + CCTK_REAL const p1o144dydz = 0.00694444444444444444444444444444*INV(dy)*INV(dz); + CCTK_REAL const p1o24dx = 0.0416666666666666666666666666667*INV(dx); + CCTK_REAL const p1o24dy = 0.0416666666666666666666666666667*INV(dy); + CCTK_REAL const p1o24dz = 0.0416666666666666666666666666667*INV(dz); + CCTK_REAL const p1o64dx = 0.015625*INV(dx); + CCTK_REAL const p1o64dy = 0.015625*INV(dy); + CCTK_REAL const p1o64dz = 0.015625*INV(dz); + CCTK_REAL const p1odx = INV(dx); + CCTK_REAL const p1ody = INV(dy); + CCTK_REAL const p1odz = INV(dz); + CCTK_REAL const pm1o12dx2 = -0.0833333333333333333333333333333*INV(SQR(dx)); + CCTK_REAL const pm1o12dy2 = -0.0833333333333333333333333333333*INV(SQR(dy)); + CCTK_REAL const pm1o12dz2 = -0.0833333333333333333333333333333*INV(SQR(dz)); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_BSSN_boundary, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + + /* Include user supplied include files */ + + /* Precompute derivatives */ + + /* Calculate temporaries and grid functions */ + CCTK_REAL phiL = IfThen(ToReal(conformalMethod),1,0); + + CCTK_REAL gt11L = 1; + + CCTK_REAL gt12L = 0; + + CCTK_REAL gt13L = 0; + + CCTK_REAL gt22L = 1; + + CCTK_REAL gt23L = 0; + + CCTK_REAL gt33L = 1; + + CCTK_REAL trKL = 0; + + CCTK_REAL At11L = 0; + + CCTK_REAL At12L = 0; + + CCTK_REAL At13L = 0; + + CCTK_REAL At22L = 0; + + CCTK_REAL At23L = 0; + + CCTK_REAL At33L = 0; + + CCTK_REAL Xt1L = 0; + + CCTK_REAL Xt2L = 0; + + CCTK_REAL Xt3L = 0; + + CCTK_REAL alphaL = 1; + + CCTK_REAL AL = 0; + + CCTK_REAL beta1L = 0; + + CCTK_REAL beta2L = 0; + + CCTK_REAL beta3L = 0; + + CCTK_REAL B1L = 0; + + CCTK_REAL B2L = 0; + + CCTK_REAL B3L = 0; + + + /* Copy local copies back to grid functions */ + A[index] = AL; + alpha[index] = alphaL; + At11[index] = At11L; + At12[index] = At12L; + At13[index] = At13L; + At22[index] = At22L; + At23[index] = At23L; + At33[index] = At33L; + B1[index] = B1L; + B2[index] = B2L; + B3[index] = B3L; + beta1[index] = beta1L; + beta2[index] = beta2L; + beta3[index] = beta3L; + gt11[index] = gt11L; + gt12[index] = gt12L; + gt13[index] = gt13L; + gt22[index] = gt22L; + gt23[index] = gt23L; + gt33[index] = gt33L; + phi[index] = phiL; + trK[index] = trKL; + Xt1[index] = Xt1L; + Xt2[index] = Xt2L; + Xt3[index] = Xt3L; + } + LC_ENDLOOP3 (ML_BSSN_boundary); +} + +extern "C" void ML_BSSN_boundary(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverBoundaryWithGhosts(cctkGH, &ML_BSSN_boundary_Body); +} diff --git a/ML_BSSN/src/ML_BSSN_constraints1.cc b/ML_BSSN/src/ML_BSSN_constraints1.cc new file mode 100644 index 0000000..571f3b8 --- /dev/null +++ b/ML_BSSN/src/ML_BSSN_constraints1.cc @@ -0,0 +1,585 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +extern "C" void ML_BSSN_constraints1_SelectBCs(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT ierr = 0; + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN::ML_Ham","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN::ML_Ham."); + return; +} + +static void ML_BSSN_constraints1_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_BSSN_constraints1_Body"); + } + + if (cctk_iteration % ML_BSSN_constraints1_calc_every != ML_BSSN_constraints1_calc_offset) + { + return; + } + + const char *groups[] = {"ML_BSSN::ML_curv","ML_BSSN::ML_Gamma","ML_BSSN::ML_Ham","ML_BSSN::ML_lapse","ML_BSSN::ML_log_confac","ML_BSSN::ML_metric","ML_BSSN::ML_shift","ML_BSSN::ML_trace_curv"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_BSSN_constraints1", 8, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o12dx = 0.0833333333333333333333333333333*INV(dx); + CCTK_REAL const p1o12dy = 0.0833333333333333333333333333333*INV(dy); + CCTK_REAL const p1o12dz = 0.0833333333333333333333333333333*INV(dz); + CCTK_REAL const p1o144dxdy = 0.00694444444444444444444444444444*INV(dx)*INV(dy); + CCTK_REAL const p1o144dxdz = 0.00694444444444444444444444444444*INV(dx)*INV(dz); + CCTK_REAL const p1o144dydz = 0.00694444444444444444444444444444*INV(dy)*INV(dz); + CCTK_REAL const p1o24dx = 0.0416666666666666666666666666667*INV(dx); + CCTK_REAL const p1o24dy = 0.0416666666666666666666666666667*INV(dy); + CCTK_REAL const p1o24dz = 0.0416666666666666666666666666667*INV(dz); + CCTK_REAL const p1o64dx = 0.015625*INV(dx); + CCTK_REAL const p1o64dy = 0.015625*INV(dy); + CCTK_REAL const p1o64dz = 0.015625*INV(dz); + CCTK_REAL const p1odx = INV(dx); + CCTK_REAL const p1ody = INV(dy); + CCTK_REAL const p1odz = INV(dz); + CCTK_REAL const pm1o12dx2 = -0.0833333333333333333333333333333*INV(SQR(dx)); + CCTK_REAL const pm1o12dy2 = -0.0833333333333333333333333333333*INV(SQR(dy)); + CCTK_REAL const pm1o12dz2 = -0.0833333333333333333333333333333*INV(SQR(dz)); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_BSSN_constraints1, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + CCTK_REAL alphaL = alpha[index]; + CCTK_REAL At11L = At11[index]; + CCTK_REAL At12L = At12[index]; + CCTK_REAL At13L = At13[index]; + CCTK_REAL At22L = At22[index]; + CCTK_REAL At23L = At23[index]; + CCTK_REAL At33L = At33[index]; + CCTK_REAL beta1L = beta1[index]; + CCTK_REAL beta2L = beta2[index]; + CCTK_REAL beta3L = beta3[index]; + CCTK_REAL eTttL = (*stress_energy_state) ? eTtt[index] : ToReal(0.0); + CCTK_REAL eTtxL = (*stress_energy_state) ? eTtx[index] : ToReal(0.0); + CCTK_REAL eTtyL = (*stress_energy_state) ? eTty[index] : ToReal(0.0); + CCTK_REAL eTtzL = (*stress_energy_state) ? eTtz[index] : ToReal(0.0); + CCTK_REAL eTxxL = (*stress_energy_state) ? eTxx[index] : ToReal(0.0); + CCTK_REAL eTxyL = (*stress_energy_state) ? eTxy[index] : ToReal(0.0); + CCTK_REAL eTxzL = (*stress_energy_state) ? eTxz[index] : ToReal(0.0); + CCTK_REAL eTyyL = (*stress_energy_state) ? eTyy[index] : ToReal(0.0); + CCTK_REAL eTyzL = (*stress_energy_state) ? eTyz[index] : ToReal(0.0); + CCTK_REAL eTzzL = (*stress_energy_state) ? eTzz[index] : ToReal(0.0); + CCTK_REAL gt11L = gt11[index]; + CCTK_REAL gt12L = gt12[index]; + CCTK_REAL gt13L = gt13[index]; + CCTK_REAL gt22L = gt22[index]; + CCTK_REAL gt23L = gt23[index]; + CCTK_REAL gt33L = gt33[index]; + CCTK_REAL phiL = phi[index]; + CCTK_REAL trKL = trK[index]; + CCTK_REAL Xt1L = Xt1[index]; + CCTK_REAL Xt2L = Xt2[index]; + CCTK_REAL Xt3L = Xt3[index]; + + /* Include user supplied include files */ + + /* Precompute derivatives */ + CCTK_REAL const PDstandardNth1gt11 = PDstandardNth1(>11[index]); + CCTK_REAL const PDstandardNth2gt11 = PDstandardNth2(>11[index]); + CCTK_REAL const PDstandardNth3gt11 = PDstandardNth3(>11[index]); + CCTK_REAL const PDstandardNth11gt11 = PDstandardNth11(>11[index]); + CCTK_REAL const PDstandardNth22gt11 = PDstandardNth22(>11[index]); + CCTK_REAL const PDstandardNth33gt11 = PDstandardNth33(>11[index]); + CCTK_REAL const PDstandardNth12gt11 = PDstandardNth12(>11[index]); + CCTK_REAL const PDstandardNth13gt11 = PDstandardNth13(>11[index]); + CCTK_REAL const PDstandardNth23gt11 = PDstandardNth23(>11[index]); + CCTK_REAL const PDstandardNth1gt12 = PDstandardNth1(>12[index]); + CCTK_REAL const PDstandardNth2gt12 = PDstandardNth2(>12[index]); + CCTK_REAL const PDstandardNth3gt12 = PDstandardNth3(>12[index]); + CCTK_REAL const PDstandardNth11gt12 = PDstandardNth11(>12[index]); + CCTK_REAL const PDstandardNth22gt12 = PDstandardNth22(>12[index]); + CCTK_REAL const PDstandardNth33gt12 = PDstandardNth33(>12[index]); + CCTK_REAL const PDstandardNth12gt12 = PDstandardNth12(>12[index]); + CCTK_REAL const PDstandardNth13gt12 = PDstandardNth13(>12[index]); + CCTK_REAL const PDstandardNth23gt12 = PDstandardNth23(>12[index]); + CCTK_REAL const PDstandardNth1gt13 = PDstandardNth1(>13[index]); + CCTK_REAL const PDstandardNth2gt13 = PDstandardNth2(>13[index]); + CCTK_REAL const PDstandardNth3gt13 = PDstandardNth3(>13[index]); + CCTK_REAL const PDstandardNth11gt13 = PDstandardNth11(>13[index]); + CCTK_REAL const PDstandardNth22gt13 = PDstandardNth22(>13[index]); + CCTK_REAL const PDstandardNth33gt13 = PDstandardNth33(>13[index]); + CCTK_REAL const PDstandardNth12gt13 = PDstandardNth12(>13[index]); + CCTK_REAL const PDstandardNth13gt13 = PDstandardNth13(>13[index]); + CCTK_REAL const PDstandardNth23gt13 = PDstandardNth23(>13[index]); + CCTK_REAL const PDstandardNth1gt22 = PDstandardNth1(>22[index]); + CCTK_REAL const PDstandardNth2gt22 = PDstandardNth2(>22[index]); + CCTK_REAL const PDstandardNth3gt22 = PDstandardNth3(>22[index]); + CCTK_REAL const PDstandardNth11gt22 = PDstandardNth11(>22[index]); + CCTK_REAL const PDstandardNth22gt22 = PDstandardNth22(>22[index]); + CCTK_REAL const PDstandardNth33gt22 = PDstandardNth33(>22[index]); + CCTK_REAL const PDstandardNth12gt22 = PDstandardNth12(>22[index]); + CCTK_REAL const PDstandardNth13gt22 = PDstandardNth13(>22[index]); + CCTK_REAL const PDstandardNth23gt22 = PDstandardNth23(>22[index]); + CCTK_REAL const PDstandardNth1gt23 = PDstandardNth1(>23[index]); + CCTK_REAL const PDstandardNth2gt23 = PDstandardNth2(>23[index]); + CCTK_REAL const PDstandardNth3gt23 = PDstandardNth3(>23[index]); + CCTK_REAL const PDstandardNth11gt23 = PDstandardNth11(>23[index]); + CCTK_REAL const PDstandardNth22gt23 = PDstandardNth22(>23[index]); + CCTK_REAL const PDstandardNth33gt23 = PDstandardNth33(>23[index]); + CCTK_REAL const PDstandardNth12gt23 = PDstandardNth12(>23[index]); + CCTK_REAL const PDstandardNth13gt23 = PDstandardNth13(>23[index]); + CCTK_REAL const PDstandardNth23gt23 = PDstandardNth23(>23[index]); + CCTK_REAL const PDstandardNth1gt33 = PDstandardNth1(>33[index]); + CCTK_REAL const PDstandardNth2gt33 = PDstandardNth2(>33[index]); + CCTK_REAL const PDstandardNth3gt33 = PDstandardNth3(>33[index]); + CCTK_REAL const PDstandardNth11gt33 = PDstandardNth11(>33[index]); + CCTK_REAL const PDstandardNth22gt33 = PDstandardNth22(>33[index]); + CCTK_REAL const PDstandardNth33gt33 = PDstandardNth33(>33[index]); + CCTK_REAL const PDstandardNth12gt33 = PDstandardNth12(>33[index]); + CCTK_REAL const PDstandardNth13gt33 = PDstandardNth13(>33[index]); + CCTK_REAL const PDstandardNth23gt33 = PDstandardNth23(>33[index]); + CCTK_REAL const PDstandardNth1phi = PDstandardNth1(&phi[index]); + CCTK_REAL const PDstandardNth2phi = PDstandardNth2(&phi[index]); + CCTK_REAL const PDstandardNth3phi = PDstandardNth3(&phi[index]); + CCTK_REAL const PDstandardNth11phi = PDstandardNth11(&phi[index]); + CCTK_REAL const PDstandardNth22phi = PDstandardNth22(&phi[index]); + CCTK_REAL const PDstandardNth33phi = PDstandardNth33(&phi[index]); + CCTK_REAL const PDstandardNth12phi = PDstandardNth12(&phi[index]); + CCTK_REAL const PDstandardNth13phi = PDstandardNth13(&phi[index]); + CCTK_REAL const PDstandardNth23phi = PDstandardNth23(&phi[index]); + CCTK_REAL const PDstandardNth1Xt1 = PDstandardNth1(&Xt1[index]); + CCTK_REAL const PDstandardNth2Xt1 = PDstandardNth2(&Xt1[index]); + CCTK_REAL const PDstandardNth3Xt1 = PDstandardNth3(&Xt1[index]); + CCTK_REAL const PDstandardNth1Xt2 = PDstandardNth1(&Xt2[index]); + CCTK_REAL const PDstandardNth2Xt2 = PDstandardNth2(&Xt2[index]); + CCTK_REAL const PDstandardNth3Xt2 = PDstandardNth3(&Xt2[index]); + CCTK_REAL const PDstandardNth1Xt3 = PDstandardNth1(&Xt3[index]); + CCTK_REAL const PDstandardNth2Xt3 = PDstandardNth2(&Xt3[index]); + CCTK_REAL const PDstandardNth3Xt3 = PDstandardNth3(&Xt3[index]); + + /* Calculate temporaries and grid functions */ + CCTK_REAL detgt = 1; + + CCTK_REAL gtu11 = INV(detgt)*(gt22L*gt33L - SQR(gt23L)); + + CCTK_REAL gtu12 = (gt13L*gt23L - gt12L*gt33L)*INV(detgt); + + CCTK_REAL gtu13 = (-(gt13L*gt22L) + gt12L*gt23L)*INV(detgt); + + CCTK_REAL gtu22 = INV(detgt)*(gt11L*gt33L - SQR(gt13L)); + + CCTK_REAL gtu23 = (gt12L*gt13L - gt11L*gt23L)*INV(detgt); + + CCTK_REAL gtu33 = INV(detgt)*(gt11L*gt22L - SQR(gt12L)); + + CCTK_REAL Gtl111 = 0.5*PDstandardNth1gt11; + + CCTK_REAL Gtl112 = 0.5*PDstandardNth2gt11; + + CCTK_REAL Gtl113 = 0.5*PDstandardNth3gt11; + + CCTK_REAL Gtl122 = -0.5*PDstandardNth1gt22 + PDstandardNth2gt12; + + CCTK_REAL Gtl123 = 0.5*(-PDstandardNth1gt23 + PDstandardNth2gt13 + + PDstandardNth3gt12); + + CCTK_REAL Gtl133 = -0.5*PDstandardNth1gt33 + PDstandardNth3gt13; + + CCTK_REAL Gtl211 = PDstandardNth1gt12 - 0.5*PDstandardNth2gt11; + + CCTK_REAL Gtl212 = 0.5*PDstandardNth1gt22; + + CCTK_REAL Gtl213 = 0.5*(PDstandardNth1gt23 - PDstandardNth2gt13 + + PDstandardNth3gt12); + + CCTK_REAL Gtl222 = 0.5*PDstandardNth2gt22; + + CCTK_REAL Gtl223 = 0.5*PDstandardNth3gt22; + + CCTK_REAL Gtl233 = -0.5*PDstandardNth2gt33 + PDstandardNth3gt23; + + CCTK_REAL Gtl311 = PDstandardNth1gt13 - 0.5*PDstandardNth3gt11; + + CCTK_REAL Gtl312 = 0.5*(PDstandardNth1gt23 + PDstandardNth2gt13 - + PDstandardNth3gt12); + + CCTK_REAL Gtl313 = 0.5*PDstandardNth1gt33; + + CCTK_REAL Gtl322 = PDstandardNth2gt23 - 0.5*PDstandardNth3gt22; + + CCTK_REAL Gtl323 = 0.5*PDstandardNth2gt33; + + CCTK_REAL Gtl333 = 0.5*PDstandardNth3gt33; + + CCTK_REAL Gtlu111 = Gtl111*gtu11 + Gtl112*gtu12 + Gtl113*gtu13; + + CCTK_REAL Gtlu112 = Gtl111*gtu12 + Gtl112*gtu22 + Gtl113*gtu23; + + CCTK_REAL Gtlu113 = Gtl111*gtu13 + Gtl112*gtu23 + Gtl113*gtu33; + + CCTK_REAL Gtlu121 = Gtl112*gtu11 + Gtl122*gtu12 + Gtl123*gtu13; + + CCTK_REAL Gtlu122 = Gtl112*gtu12 + Gtl122*gtu22 + Gtl123*gtu23; + + CCTK_REAL Gtlu123 = Gtl112*gtu13 + Gtl122*gtu23 + Gtl123*gtu33; + + CCTK_REAL Gtlu131 = Gtl113*gtu11 + Gtl123*gtu12 + Gtl133*gtu13; + + CCTK_REAL Gtlu132 = Gtl113*gtu12 + Gtl123*gtu22 + Gtl133*gtu23; + + CCTK_REAL Gtlu133 = Gtl113*gtu13 + Gtl123*gtu23 + Gtl133*gtu33; + + CCTK_REAL Gtlu211 = Gtl211*gtu11 + Gtl212*gtu12 + Gtl213*gtu13; + + CCTK_REAL Gtlu212 = Gtl211*gtu12 + Gtl212*gtu22 + Gtl213*gtu23; + + CCTK_REAL Gtlu213 = Gtl211*gtu13 + Gtl212*gtu23 + Gtl213*gtu33; + + CCTK_REAL Gtlu221 = Gtl212*gtu11 + Gtl222*gtu12 + Gtl223*gtu13; + + CCTK_REAL Gtlu222 = Gtl212*gtu12 + Gtl222*gtu22 + Gtl223*gtu23; + + CCTK_REAL Gtlu223 = Gtl212*gtu13 + Gtl222*gtu23 + Gtl223*gtu33; + + CCTK_REAL Gtlu231 = Gtl213*gtu11 + Gtl223*gtu12 + Gtl233*gtu13; + + CCTK_REAL Gtlu232 = Gtl213*gtu12 + Gtl223*gtu22 + Gtl233*gtu23; + + CCTK_REAL Gtlu233 = Gtl213*gtu13 + Gtl223*gtu23 + Gtl233*gtu33; + + CCTK_REAL Gtlu311 = Gtl311*gtu11 + Gtl312*gtu12 + Gtl313*gtu13; + + CCTK_REAL Gtlu312 = Gtl311*gtu12 + Gtl312*gtu22 + Gtl313*gtu23; + + CCTK_REAL Gtlu313 = Gtl311*gtu13 + Gtl312*gtu23 + Gtl313*gtu33; + + CCTK_REAL Gtlu321 = Gtl312*gtu11 + Gtl322*gtu12 + Gtl323*gtu13; + + CCTK_REAL Gtlu322 = Gtl312*gtu12 + Gtl322*gtu22 + Gtl323*gtu23; + + CCTK_REAL Gtlu323 = Gtl312*gtu13 + Gtl322*gtu23 + Gtl323*gtu33; + + CCTK_REAL Gtlu331 = Gtl313*gtu11 + Gtl323*gtu12 + Gtl333*gtu13; + + CCTK_REAL Gtlu332 = Gtl313*gtu12 + Gtl323*gtu22 + Gtl333*gtu23; + + CCTK_REAL Gtlu333 = Gtl313*gtu13 + Gtl323*gtu23 + Gtl333*gtu33; + + CCTK_REAL Gt111 = Gtl111*gtu11 + Gtl211*gtu12 + Gtl311*gtu13; + + CCTK_REAL Gt211 = Gtl111*gtu12 + Gtl211*gtu22 + Gtl311*gtu23; + + CCTK_REAL Gt311 = Gtl111*gtu13 + Gtl211*gtu23 + Gtl311*gtu33; + + CCTK_REAL Gt112 = Gtl112*gtu11 + Gtl212*gtu12 + Gtl312*gtu13; + + CCTK_REAL Gt212 = Gtl112*gtu12 + Gtl212*gtu22 + Gtl312*gtu23; + + CCTK_REAL Gt312 = Gtl112*gtu13 + Gtl212*gtu23 + Gtl312*gtu33; + + CCTK_REAL Gt113 = Gtl113*gtu11 + Gtl213*gtu12 + Gtl313*gtu13; + + CCTK_REAL Gt213 = Gtl113*gtu12 + Gtl213*gtu22 + Gtl313*gtu23; + + CCTK_REAL Gt313 = Gtl113*gtu13 + Gtl213*gtu23 + Gtl313*gtu33; + + CCTK_REAL Gt122 = Gtl122*gtu11 + Gtl222*gtu12 + Gtl322*gtu13; + + CCTK_REAL Gt222 = Gtl122*gtu12 + Gtl222*gtu22 + Gtl322*gtu23; + + CCTK_REAL Gt322 = Gtl122*gtu13 + Gtl222*gtu23 + Gtl322*gtu33; + + CCTK_REAL Gt123 = Gtl123*gtu11 + Gtl223*gtu12 + Gtl323*gtu13; + + CCTK_REAL Gt223 = Gtl123*gtu12 + Gtl223*gtu22 + Gtl323*gtu23; + + CCTK_REAL Gt323 = Gtl123*gtu13 + Gtl223*gtu23 + Gtl323*gtu33; + + CCTK_REAL Gt133 = Gtl133*gtu11 + Gtl233*gtu12 + Gtl333*gtu13; + + CCTK_REAL Gt233 = Gtl133*gtu12 + Gtl233*gtu22 + Gtl333*gtu23; + + CCTK_REAL Gt333 = Gtl133*gtu13 + Gtl233*gtu23 + Gtl333*gtu33; + + CCTK_REAL Xtn1 = Gt111*gtu11 + Gt122*gtu22 + 2*(Gt112*gtu12 + + Gt113*gtu13 + Gt123*gtu23) + Gt133*gtu33; + + CCTK_REAL Xtn2 = Gt211*gtu11 + Gt222*gtu22 + 2*(Gt212*gtu12 + + Gt213*gtu13 + Gt223*gtu23) + Gt233*gtu33; + + CCTK_REAL Xtn3 = Gt311*gtu11 + Gt322*gtu22 + 2*(Gt312*gtu12 + + Gt313*gtu13 + Gt323*gtu23) + Gt333*gtu33; + + CCTK_REAL Rt11 = 3*(Gt111*Gtlu111 + Gt112*Gtlu112 + Gt113*Gtlu113) + + 2*(Gt211*Gtlu121 + Gt212*Gtlu122 + Gt213*Gtlu123 + Gt311*Gtlu131 + + Gt312*Gtlu132 + Gt313*Gtlu133) + Gt211*Gtlu211 + Gt212*Gtlu212 + + Gt213*Gtlu213 + Gt311*Gtlu311 + Gt312*Gtlu312 + Gt313*Gtlu313 + + gt11L*PDstandardNth1Xt1 + gt12L*PDstandardNth1Xt2 + + gt13L*PDstandardNth1Xt3 + 0.5*(-(gtu11*PDstandardNth11gt11) - + 2*gtu12*PDstandardNth12gt11 - 2*gtu13*PDstandardNth13gt11 - + gtu22*PDstandardNth22gt11 - 2*gtu23*PDstandardNth23gt11 - + gtu33*PDstandardNth33gt11) + Gtl111*Xtn1 + Gtl112*Xtn2 + Gtl113*Xtn3; + + CCTK_REAL Rt12 = 0.5*(4*(Gt211*Gtlu221 + Gt212*Gtlu222 + + Gt213*Gtlu223) + 2*(Gt112*Gtlu111 + Gt122*Gtlu112 + Gt123*Gtlu113 + + Gt111*Gtlu121 + Gt212*Gtlu121 + Gt112*Gtlu122 + Gt222*Gtlu122 + + Gt113*Gtlu123 + Gt223*Gtlu123 + Gt312*Gtlu131 + Gt322*Gtlu132 + + Gt323*Gtlu133 + Gt111*Gtlu211 + Gt112*Gtlu212 + Gt113*Gtlu213 + + Gt311*Gtlu231 + Gt312*Gtlu232 + Gt313*Gtlu233 + Gt311*Gtlu321 + + Gt312*Gtlu322 + Gt313*Gtlu323) - gtu11*PDstandardNth11gt12 - + 2*gtu12*PDstandardNth12gt12 - 2*gtu13*PDstandardNth13gt12 + + gt12L*PDstandardNth1Xt1 + gt22L*PDstandardNth1Xt2 + + gt23L*PDstandardNth1Xt3 - gtu22*PDstandardNth22gt12 - + 2*gtu23*PDstandardNth23gt12 + gt11L*PDstandardNth2Xt1 + + gt12L*PDstandardNth2Xt2 + gt13L*PDstandardNth2Xt3 - + gtu33*PDstandardNth33gt12 + Gtl112*Xtn1 + Gtl211*Xtn1 + Gtl122*Xtn2 + + Gtl212*Xtn2 + Gtl123*Xtn3 + Gtl213*Xtn3); + + CCTK_REAL Rt13 = 0.5*(2*(Gt113*Gtlu111 + Gt123*Gtlu112 + Gt133*Gtlu113 + + Gt213*Gtlu121 + Gt223*Gtlu122 + Gt233*Gtlu123 + Gt111*Gtlu131 + + Gt313*Gtlu131 + Gt112*Gtlu132 + Gt323*Gtlu132 + Gt113*Gtlu133 + + Gt333*Gtlu133 + Gt211*Gtlu231 + Gt212*Gtlu232 + Gt213*Gtlu233 + + Gt111*Gtlu311 + Gt112*Gtlu312 + Gt113*Gtlu313 + Gt211*Gtlu321 + + Gt212*Gtlu322 + Gt213*Gtlu323) + 4*(Gt311*Gtlu331 + Gt312*Gtlu332 + + Gt313*Gtlu333) - gtu11*PDstandardNth11gt13 - + 2*gtu12*PDstandardNth12gt13 - 2*gtu13*PDstandardNth13gt13 + + gt13L*PDstandardNth1Xt1 + gt23L*PDstandardNth1Xt2 + + gt33L*PDstandardNth1Xt3 - gtu22*PDstandardNth22gt13 - + 2*gtu23*PDstandardNth23gt13 - gtu33*PDstandardNth33gt13 + + gt11L*PDstandardNth3Xt1 + gt12L*PDstandardNth3Xt2 + + gt13L*PDstandardNth3Xt3 + Gtl113*Xtn1 + Gtl311*Xtn1 + Gtl123*Xtn2 + + Gtl312*Xtn2 + Gtl133*Xtn3 + Gtl313*Xtn3); + + CCTK_REAL Rt22 = Gt112*(Gtlu121 + 2*Gtlu211) + Gt122*(Gtlu122 + + 2*Gtlu212) + Gt123*(Gtlu123 + 2*Gtlu213) + 3*(Gt212*Gtlu221 + + Gt222*Gtlu222 + Gt223*Gtlu223) + 2*(Gt312*Gtlu231 + Gt322*Gtlu232 + + Gt323*Gtlu233) + Gt312*Gtlu321 + Gt322*Gtlu322 + Gt323*Gtlu323 + + gt12L*PDstandardNth2Xt1 + gt22L*PDstandardNth2Xt2 + + gt23L*PDstandardNth2Xt3 + 0.5*(-(gtu11*PDstandardNth11gt22) - + 2*gtu12*PDstandardNth12gt22 - 2*gtu13*PDstandardNth13gt22 - + gtu22*PDstandardNth22gt22 - 2*gtu23*PDstandardNth23gt22 - + gtu33*PDstandardNth33gt22) + Gtl212*Xtn1 + Gtl222*Xtn2 + Gtl223*Xtn3; + + CCTK_REAL Rt23 = 0.5*(2*(Gt112*Gtlu131 + Gt122*Gtlu132 + Gt123*Gtlu133 + + Gt113*Gtlu211 + Gt123*Gtlu212 + Gt133*Gtlu213 + Gt213*Gtlu221 + + Gt223*Gtlu222 + Gt233*Gtlu223 + Gt212*Gtlu231 + Gt313*Gtlu231 + + Gt222*Gtlu232 + Gt323*Gtlu232 + Gt223*Gtlu233 + Gt333*Gtlu233 + + Gt112*Gtlu311 + Gt122*Gtlu312 + Gt123*Gtlu313 + Gt212*Gtlu321 + + Gt222*Gtlu322 + Gt223*Gtlu323) + 4*(Gt312*Gtlu331 + Gt322*Gtlu332 + + Gt323*Gtlu333) - gtu11*PDstandardNth11gt23 - + 2*gtu12*PDstandardNth12gt23 - 2*gtu13*PDstandardNth13gt23 - + gtu22*PDstandardNth22gt23 - 2*gtu23*PDstandardNth23gt23 + + gt13L*PDstandardNth2Xt1 + gt23L*PDstandardNth2Xt2 + + gt33L*PDstandardNth2Xt3 - gtu33*PDstandardNth33gt23 + + gt12L*PDstandardNth3Xt1 + gt22L*PDstandardNth3Xt2 + + gt23L*PDstandardNth3Xt3 + Gtl213*Xtn1 + Gtl312*Xtn1 + Gtl223*Xtn2 + + Gtl322*Xtn2 + Gtl233*Xtn3 + Gtl323*Xtn3); + + CCTK_REAL Rt33 = Gt113*(Gtlu131 + 2*Gtlu311) + Gt123*(Gtlu132 + + 2*Gtlu312) + Gt133*(Gtlu133 + 2*Gtlu313) + Gt213*(Gtlu231 + 2*Gtlu321) + + Gt223*(Gtlu232 + 2*Gtlu322) + Gt233*(Gtlu233 + 2*Gtlu323) + + 3*(Gt313*Gtlu331 + Gt323*Gtlu332 + Gt333*Gtlu333) + + 0.5*(-(gtu11*PDstandardNth11gt33) - 2*gtu12*PDstandardNth12gt33 - + 2*gtu13*PDstandardNth13gt33 - gtu22*PDstandardNth22gt33 - + 2*gtu23*PDstandardNth23gt33 - gtu33*PDstandardNth33gt33) + + gt13L*PDstandardNth3Xt1 + gt23L*PDstandardNth3Xt2 + + gt33L*PDstandardNth3Xt3 + Gtl313*Xtn1 + Gtl323*Xtn2 + Gtl333*Xtn3; + + CCTK_REAL fac1 = IfThen(ToReal(conformalMethod),-0.5*INV(phiL),1); + + CCTK_REAL cdphi1 = fac1*PDstandardNth1phi; + + CCTK_REAL cdphi2 = fac1*PDstandardNth2phi; + + CCTK_REAL cdphi3 = fac1*PDstandardNth3phi; + + CCTK_REAL fac2 = IfThen(ToReal(conformalMethod),0.5*INV(SQR(phiL)),0); + + CCTK_REAL cdphi211 = -(fac1*(-PDstandardNth11phi + + Gt111*PDstandardNth1phi + Gt211*PDstandardNth2phi + + Gt311*PDstandardNth3phi)) + fac2*SQR(PDstandardNth1phi); + + CCTK_REAL cdphi212 = fac2*PDstandardNth1phi*PDstandardNth2phi - + fac1*(-PDstandardNth12phi + Gt112*PDstandardNth1phi + + Gt212*PDstandardNth2phi + Gt312*PDstandardNth3phi); + + CCTK_REAL cdphi213 = fac2*PDstandardNth1phi*PDstandardNth3phi - + fac1*(-PDstandardNth13phi + Gt113*PDstandardNth1phi + + Gt213*PDstandardNth2phi + Gt313*PDstandardNth3phi); + + CCTK_REAL cdphi222 = -(fac1*(Gt122*PDstandardNth1phi - + PDstandardNth22phi + Gt222*PDstandardNth2phi + + Gt322*PDstandardNth3phi)) + fac2*SQR(PDstandardNth2phi); + + CCTK_REAL cdphi223 = fac2*PDstandardNth2phi*PDstandardNth3phi - + fac1*(Gt123*PDstandardNth1phi - PDstandardNth23phi + + Gt223*PDstandardNth2phi + Gt323*PDstandardNth3phi); + + CCTK_REAL cdphi233 = -(fac1*(Gt133*PDstandardNth1phi + + Gt233*PDstandardNth2phi - PDstandardNth33phi + + Gt333*PDstandardNth3phi)) + fac2*SQR(PDstandardNth3phi); + + CCTK_REAL Rphi11 = -2*(cdphi211 + 2*(-1 + gt11L*gtu11)*SQR(cdphi1) + + gt11L*(cdphi211*gtu11 + 4*(cdphi1*(cdphi2*gtu12 + cdphi3*gtu13) + + cdphi2*cdphi3*gtu23) + cdphi233*gtu33 + gtu22*(cdphi222 + + 2*SQR(cdphi2)) + 2*(cdphi212*gtu12 + cdphi213*gtu13 + cdphi223*gtu23 + + gtu33*SQR(cdphi3)))); + + CCTK_REAL Rphi12 = -2*(cdphi212 + cdphi1*(cdphi2*(-2 + 4*gt12L*gtu12) + + 4*cdphi3*gt12L*gtu13) + gt12L*(cdphi211*gtu11 + 4*cdphi2*cdphi3*gtu23 + + 2*(cdphi212*gtu12 + cdphi213*gtu13 + cdphi223*gtu23 + + gtu11*SQR(cdphi1)) + gtu22*(cdphi222 + 2*SQR(cdphi2)) + gtu33*(cdphi233 + + 2*SQR(cdphi3)))); + + CCTK_REAL Rphi13 = -2*(cdphi213 + cdphi1*(4*cdphi2*gt13L*gtu12 + + cdphi3*(-2 + 4*gt13L*gtu13)) + gt13L*(cdphi211*gtu11 + + 4*cdphi2*cdphi3*gtu23 + 2*(cdphi212*gtu12 + cdphi213*gtu13 + + cdphi223*gtu23 + gtu11*SQR(cdphi1)) + gtu22*(cdphi222 + 2*SQR(cdphi2)) + + gtu33*(cdphi233 + 2*SQR(cdphi3)))); + + CCTK_REAL Rphi22 = -2*(cdphi222 + 2*(-1 + gt22L*gtu22)*SQR(cdphi2) + + gt22L*(cdphi222*gtu22 + 4*(cdphi1*cdphi3*gtu13 + cdphi2*(cdphi1*gtu12 + + cdphi3*gtu23)) + cdphi233*gtu33 + gtu11*(cdphi211 + 2*SQR(cdphi1)) + + 2*(cdphi212*gtu12 + cdphi213*gtu13 + cdphi223*gtu23 + + gtu33*SQR(cdphi3)))); + + CCTK_REAL Rphi23 = -2*(cdphi223 + cdphi2*(4*cdphi1*gt23L*gtu12 + + cdphi3*(-2 + 4*gt23L*gtu23)) + gt23L*(4*cdphi1*cdphi3*gtu13 + + cdphi222*gtu22 + gtu11*(cdphi211 + 2*SQR(cdphi1)) + 2*(cdphi212*gtu12 + + cdphi213*gtu13 + cdphi223*gtu23 + gtu22*SQR(cdphi2)) + gtu33*(cdphi233 + + 2*SQR(cdphi3)))); + + CCTK_REAL Rphi33 = -2*(cdphi233 + gt33L*((4*cdphi1*cdphi2 + + 2*cdphi212)*gtu12 + 4*cdphi3*(cdphi1*gtu13 + cdphi2*gtu23) + + 2*(cdphi213*gtu13 + cdphi223*gtu23) + cdphi233*gtu33 + gtu11*(cdphi211 + + 2*SQR(cdphi1)) + gtu22*(cdphi222 + 2*SQR(cdphi2))) + 2*(-1 + + gt33L*gtu33)*SQR(cdphi3)); + + CCTK_REAL e4phi = + IfThen(ToReal(conformalMethod),INV(SQR(phiL)),exp(4*phiL)); + + CCTK_REAL em4phi = INV(e4phi); + + CCTK_REAL gu11 = em4phi*gtu11; + + CCTK_REAL gu12 = em4phi*gtu12; + + CCTK_REAL gu13 = em4phi*gtu13; + + CCTK_REAL gu22 = em4phi*gtu22; + + CCTK_REAL gu23 = em4phi*gtu23; + + CCTK_REAL gu33 = em4phi*gtu33; + + CCTK_REAL R11 = Rphi11 + Rt11; + + CCTK_REAL R12 = Rphi12 + Rt12; + + CCTK_REAL R13 = Rphi13 + Rt13; + + CCTK_REAL R22 = Rphi22 + Rt22; + + CCTK_REAL R23 = Rphi23 + Rt23; + + CCTK_REAL R33 = Rphi33 + Rt33; + + CCTK_REAL trR = gu11*R11 + gu22*R22 + 2*(gu12*R12 + gu13*R13 + + gu23*R23) + gu33*R33; + + CCTK_REAL Atm11 = At11L*gtu11 + At12L*gtu12 + At13L*gtu13; + + CCTK_REAL Atm21 = At11L*gtu12 + At12L*gtu22 + At13L*gtu23; + + CCTK_REAL Atm31 = At11L*gtu13 + At12L*gtu23 + At13L*gtu33; + + CCTK_REAL Atm12 = At12L*gtu11 + At22L*gtu12 + At23L*gtu13; + + CCTK_REAL Atm22 = At12L*gtu12 + At22L*gtu22 + At23L*gtu23; + + CCTK_REAL Atm32 = At12L*gtu13 + At22L*gtu23 + At23L*gtu33; + + CCTK_REAL Atm13 = At13L*gtu11 + At23L*gtu12 + At33L*gtu13; + + CCTK_REAL Atm23 = At13L*gtu12 + At23L*gtu22 + At33L*gtu23; + + CCTK_REAL Atm33 = At13L*gtu13 + At23L*gtu23 + At33L*gtu33; + + CCTK_REAL rho = INV(SQR(alphaL))*(eTttL - 2*(beta2L*eTtyL + + beta3L*eTtzL) + 2*(beta1L*(-eTtxL + beta2L*eTxyL + beta3L*eTxzL) + + beta2L*beta3L*eTyzL) + eTxxL*SQR(beta1L) + eTyyL*SQR(beta2L) + + eTzzL*SQR(beta3L)); + + CCTK_REAL HL = -2.*(Atm12*Atm21 + Atm13*Atm31 + Atm23*Atm32) - + 50.26548245743669181540229413247204614715*rho + trR - 1.*(SQR(Atm11) + + SQR(Atm22) + SQR(Atm33)) + + 0.6666666666666666666666666666666666666667*SQR(trKL); + + + /* Copy local copies back to grid functions */ + H[index] = HL; + } + LC_ENDLOOP3 (ML_BSSN_constraints1); +} + +extern "C" void ML_BSSN_constraints1(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverInterior(cctkGH, &ML_BSSN_constraints1_Body); +} diff --git a/ML_BSSN/src/ML_BSSN_constraints2.cc b/ML_BSSN/src/ML_BSSN_constraints2.cc new file mode 100644 index 0000000..9d0eb6c --- /dev/null +++ b/ML_BSSN/src/ML_BSSN_constraints2.cc @@ -0,0 +1,388 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +extern "C" void ML_BSSN_constraints2_SelectBCs(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT ierr = 0; + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN::ML_cons_detg","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN::ML_cons_detg."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN::ML_cons_Gamma","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN::ML_cons_Gamma."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN::ML_cons_traceA","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN::ML_cons_traceA."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN::ML_mom","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN::ML_mom."); + return; +} + +static void ML_BSSN_constraints2_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_BSSN_constraints2_Body"); + } + + if (cctk_iteration % ML_BSSN_constraints2_calc_every != ML_BSSN_constraints2_calc_offset) + { + return; + } + + const char *groups[] = {"ML_BSSN::ML_cons_detg","ML_BSSN::ML_cons_Gamma","ML_BSSN::ML_cons_traceA","ML_BSSN::ML_curv","ML_BSSN::ML_Gamma","ML_BSSN::ML_lapse","ML_BSSN::ML_log_confac","ML_BSSN::ML_metric","ML_BSSN::ML_mom","ML_BSSN::ML_shift","ML_BSSN::ML_trace_curv"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_BSSN_constraints2", 11, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o12dx = 0.0833333333333333333333333333333*INV(dx); + CCTK_REAL const p1o12dy = 0.0833333333333333333333333333333*INV(dy); + CCTK_REAL const p1o12dz = 0.0833333333333333333333333333333*INV(dz); + CCTK_REAL const p1o144dxdy = 0.00694444444444444444444444444444*INV(dx)*INV(dy); + CCTK_REAL const p1o144dxdz = 0.00694444444444444444444444444444*INV(dx)*INV(dz); + CCTK_REAL const p1o144dydz = 0.00694444444444444444444444444444*INV(dy)*INV(dz); + CCTK_REAL const p1o24dx = 0.0416666666666666666666666666667*INV(dx); + CCTK_REAL const p1o24dy = 0.0416666666666666666666666666667*INV(dy); + CCTK_REAL const p1o24dz = 0.0416666666666666666666666666667*INV(dz); + CCTK_REAL const p1o64dx = 0.015625*INV(dx); + CCTK_REAL const p1o64dy = 0.015625*INV(dy); + CCTK_REAL const p1o64dz = 0.015625*INV(dz); + CCTK_REAL const p1odx = INV(dx); + CCTK_REAL const p1ody = INV(dy); + CCTK_REAL const p1odz = INV(dz); + CCTK_REAL const pm1o12dx2 = -0.0833333333333333333333333333333*INV(SQR(dx)); + CCTK_REAL const pm1o12dy2 = -0.0833333333333333333333333333333*INV(SQR(dy)); + CCTK_REAL const pm1o12dz2 = -0.0833333333333333333333333333333*INV(SQR(dz)); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_BSSN_constraints2, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + CCTK_REAL alphaL = alpha[index]; + CCTK_REAL At11L = At11[index]; + CCTK_REAL At12L = At12[index]; + CCTK_REAL At13L = At13[index]; + CCTK_REAL At22L = At22[index]; + CCTK_REAL At23L = At23[index]; + CCTK_REAL At33L = At33[index]; + CCTK_REAL beta1L = beta1[index]; + CCTK_REAL beta2L = beta2[index]; + CCTK_REAL beta3L = beta3[index]; + CCTK_REAL eTtxL = (*stress_energy_state) ? eTtx[index] : ToReal(0.0); + CCTK_REAL eTtyL = (*stress_energy_state) ? eTty[index] : ToReal(0.0); + CCTK_REAL eTtzL = (*stress_energy_state) ? eTtz[index] : ToReal(0.0); + CCTK_REAL eTxxL = (*stress_energy_state) ? eTxx[index] : ToReal(0.0); + CCTK_REAL eTxyL = (*stress_energy_state) ? eTxy[index] : ToReal(0.0); + CCTK_REAL eTxzL = (*stress_energy_state) ? eTxz[index] : ToReal(0.0); + CCTK_REAL eTyyL = (*stress_energy_state) ? eTyy[index] : ToReal(0.0); + CCTK_REAL eTyzL = (*stress_energy_state) ? eTyz[index] : ToReal(0.0); + CCTK_REAL eTzzL = (*stress_energy_state) ? eTzz[index] : ToReal(0.0); + CCTK_REAL gt11L = gt11[index]; + CCTK_REAL gt12L = gt12[index]; + CCTK_REAL gt13L = gt13[index]; + CCTK_REAL gt22L = gt22[index]; + CCTK_REAL gt23L = gt23[index]; + CCTK_REAL gt33L = gt33[index]; + CCTK_REAL phiL = phi[index]; + CCTK_REAL trKL = trK[index]; + CCTK_REAL Xt1L = Xt1[index]; + CCTK_REAL Xt2L = Xt2[index]; + CCTK_REAL Xt3L = Xt3[index]; + + /* Include user supplied include files */ + + /* Precompute derivatives */ + CCTK_REAL const PDstandardNth1At11 = PDstandardNth1(&At11[index]); + CCTK_REAL const PDstandardNth2At11 = PDstandardNth2(&At11[index]); + CCTK_REAL const PDstandardNth3At11 = PDstandardNth3(&At11[index]); + CCTK_REAL const PDstandardNth1At12 = PDstandardNth1(&At12[index]); + CCTK_REAL const PDstandardNth2At12 = PDstandardNth2(&At12[index]); + CCTK_REAL const PDstandardNth3At12 = PDstandardNth3(&At12[index]); + CCTK_REAL const PDstandardNth1At13 = PDstandardNth1(&At13[index]); + CCTK_REAL const PDstandardNth2At13 = PDstandardNth2(&At13[index]); + CCTK_REAL const PDstandardNth3At13 = PDstandardNth3(&At13[index]); + CCTK_REAL const PDstandardNth1At22 = PDstandardNth1(&At22[index]); + CCTK_REAL const PDstandardNth2At22 = PDstandardNth2(&At22[index]); + CCTK_REAL const PDstandardNth3At22 = PDstandardNth3(&At22[index]); + CCTK_REAL const PDstandardNth1At23 = PDstandardNth1(&At23[index]); + CCTK_REAL const PDstandardNth2At23 = PDstandardNth2(&At23[index]); + CCTK_REAL const PDstandardNth3At23 = PDstandardNth3(&At23[index]); + CCTK_REAL const PDstandardNth1At33 = PDstandardNth1(&At33[index]); + CCTK_REAL const PDstandardNth2At33 = PDstandardNth2(&At33[index]); + CCTK_REAL const PDstandardNth3At33 = PDstandardNth3(&At33[index]); + CCTK_REAL const PDstandardNth1gt11 = PDstandardNth1(>11[index]); + CCTK_REAL const PDstandardNth2gt11 = PDstandardNth2(>11[index]); + CCTK_REAL const PDstandardNth3gt11 = PDstandardNth3(>11[index]); + CCTK_REAL const PDstandardNth1gt12 = PDstandardNth1(>12[index]); + CCTK_REAL const PDstandardNth2gt12 = PDstandardNth2(>12[index]); + CCTK_REAL const PDstandardNth3gt12 = PDstandardNth3(>12[index]); + CCTK_REAL const PDstandardNth1gt13 = PDstandardNth1(>13[index]); + CCTK_REAL const PDstandardNth2gt13 = PDstandardNth2(>13[index]); + CCTK_REAL const PDstandardNth3gt13 = PDstandardNth3(>13[index]); + CCTK_REAL const PDstandardNth1gt22 = PDstandardNth1(>22[index]); + CCTK_REAL const PDstandardNth2gt22 = PDstandardNth2(>22[index]); + CCTK_REAL const PDstandardNth3gt22 = PDstandardNth3(>22[index]); + CCTK_REAL const PDstandardNth1gt23 = PDstandardNth1(>23[index]); + CCTK_REAL const PDstandardNth2gt23 = PDstandardNth2(>23[index]); + CCTK_REAL const PDstandardNth3gt23 = PDstandardNth3(>23[index]); + CCTK_REAL const PDstandardNth1gt33 = PDstandardNth1(>33[index]); + CCTK_REAL const PDstandardNth2gt33 = PDstandardNth2(>33[index]); + CCTK_REAL const PDstandardNth3gt33 = PDstandardNth3(>33[index]); + CCTK_REAL const PDstandardNth1phi = PDstandardNth1(&phi[index]); + CCTK_REAL const PDstandardNth2phi = PDstandardNth2(&phi[index]); + CCTK_REAL const PDstandardNth3phi = PDstandardNth3(&phi[index]); + CCTK_REAL const PDstandardNth1trK = PDstandardNth1(&trK[index]); + CCTK_REAL const PDstandardNth2trK = PDstandardNth2(&trK[index]); + CCTK_REAL const PDstandardNth3trK = PDstandardNth3(&trK[index]); + + /* Calculate temporaries and grid functions */ + CCTK_REAL detgt = 1; + + CCTK_REAL gtu11 = INV(detgt)*(gt22L*gt33L - SQR(gt23L)); + + CCTK_REAL gtu12 = (gt13L*gt23L - gt12L*gt33L)*INV(detgt); + + CCTK_REAL gtu13 = (-(gt13L*gt22L) + gt12L*gt23L)*INV(detgt); + + CCTK_REAL gtu22 = INV(detgt)*(gt11L*gt33L - SQR(gt13L)); + + CCTK_REAL gtu23 = (gt12L*gt13L - gt11L*gt23L)*INV(detgt); + + CCTK_REAL gtu33 = INV(detgt)*(gt11L*gt22L - SQR(gt12L)); + + CCTK_REAL Gtl111 = 0.5*PDstandardNth1gt11; + + CCTK_REAL Gtl112 = 0.5*PDstandardNth2gt11; + + CCTK_REAL Gtl113 = 0.5*PDstandardNth3gt11; + + CCTK_REAL Gtl122 = -0.5*PDstandardNth1gt22 + PDstandardNth2gt12; + + CCTK_REAL Gtl123 = 0.5*(-PDstandardNth1gt23 + PDstandardNth2gt13 + + PDstandardNth3gt12); + + CCTK_REAL Gtl133 = -0.5*PDstandardNth1gt33 + PDstandardNth3gt13; + + CCTK_REAL Gtl211 = PDstandardNth1gt12 - 0.5*PDstandardNth2gt11; + + CCTK_REAL Gtl212 = 0.5*PDstandardNth1gt22; + + CCTK_REAL Gtl213 = 0.5*(PDstandardNth1gt23 - PDstandardNth2gt13 + + PDstandardNth3gt12); + + CCTK_REAL Gtl222 = 0.5*PDstandardNth2gt22; + + CCTK_REAL Gtl223 = 0.5*PDstandardNth3gt22; + + CCTK_REAL Gtl233 = -0.5*PDstandardNth2gt33 + PDstandardNth3gt23; + + CCTK_REAL Gtl311 = PDstandardNth1gt13 - 0.5*PDstandardNth3gt11; + + CCTK_REAL Gtl312 = 0.5*(PDstandardNth1gt23 + PDstandardNth2gt13 - + PDstandardNth3gt12); + + CCTK_REAL Gtl313 = 0.5*PDstandardNth1gt33; + + CCTK_REAL Gtl322 = PDstandardNth2gt23 - 0.5*PDstandardNth3gt22; + + CCTK_REAL Gtl323 = 0.5*PDstandardNth2gt33; + + CCTK_REAL Gtl333 = 0.5*PDstandardNth3gt33; + + CCTK_REAL Gt111 = Gtl111*gtu11 + Gtl211*gtu12 + Gtl311*gtu13; + + CCTK_REAL Gt211 = Gtl111*gtu12 + Gtl211*gtu22 + Gtl311*gtu23; + + CCTK_REAL Gt311 = Gtl111*gtu13 + Gtl211*gtu23 + Gtl311*gtu33; + + CCTK_REAL Gt112 = Gtl112*gtu11 + Gtl212*gtu12 + Gtl312*gtu13; + + CCTK_REAL Gt212 = Gtl112*gtu12 + Gtl212*gtu22 + Gtl312*gtu23; + + CCTK_REAL Gt312 = Gtl112*gtu13 + Gtl212*gtu23 + Gtl312*gtu33; + + CCTK_REAL Gt113 = Gtl113*gtu11 + Gtl213*gtu12 + Gtl313*gtu13; + + CCTK_REAL Gt213 = Gtl113*gtu12 + Gtl213*gtu22 + Gtl313*gtu23; + + CCTK_REAL Gt313 = Gtl113*gtu13 + Gtl213*gtu23 + Gtl313*gtu33; + + CCTK_REAL Gt122 = Gtl122*gtu11 + Gtl222*gtu12 + Gtl322*gtu13; + + CCTK_REAL Gt222 = Gtl122*gtu12 + Gtl222*gtu22 + Gtl322*gtu23; + + CCTK_REAL Gt322 = Gtl122*gtu13 + Gtl222*gtu23 + Gtl322*gtu33; + + CCTK_REAL Gt123 = Gtl123*gtu11 + Gtl223*gtu12 + Gtl323*gtu13; + + CCTK_REAL Gt223 = Gtl123*gtu12 + Gtl223*gtu22 + Gtl323*gtu23; + + CCTK_REAL Gt323 = Gtl123*gtu13 + Gtl223*gtu23 + Gtl323*gtu33; + + CCTK_REAL Gt133 = Gtl133*gtu11 + Gtl233*gtu12 + Gtl333*gtu13; + + CCTK_REAL Gt233 = Gtl133*gtu12 + Gtl233*gtu22 + Gtl333*gtu23; + + CCTK_REAL Gt333 = Gtl133*gtu13 + Gtl233*gtu23 + Gtl333*gtu33; + + CCTK_REAL fac1 = IfThen(ToReal(conformalMethod),-0.5*INV(phiL),1); + + CCTK_REAL cdphi1 = fac1*PDstandardNth1phi; + + CCTK_REAL cdphi2 = fac1*PDstandardNth2phi; + + CCTK_REAL cdphi3 = fac1*PDstandardNth3phi; + + CCTK_REAL S1 = (-eTtxL + beta1L*eTxxL + beta2L*eTxyL + + beta3L*eTxzL)*INV(alphaL); + + CCTK_REAL S2 = (-eTtyL + beta1L*eTxyL + beta2L*eTyyL + + beta3L*eTyzL)*INV(alphaL); + + CCTK_REAL S3 = (-eTtzL + beta1L*eTxzL + beta2L*eTyzL + + beta3L*eTzzL)*INV(alphaL); + + CCTK_REAL M1L = -2.*((At12L*Gt211 + At13L*Gt311)*gtu11 + + At11L*Gt123*gtu23) + At12L*((6.*cdphi1 - 1.*Gt111)*gtu12 - + 3.*Gt213*gtu13 + 6.*(cdphi2*gtu22 + cdphi3*gtu23) - 1.*Gt233*gtu33) - + 1.*((At22L*Gt212 + At12L*(Gt112 + Gt222) + At23L*Gt312)*gtu22 + + (At13L*Gt112 + At12L*Gt113 + At23L*Gt212)*gtu23 + (At13L*Gt113 + + At23L*Gt213 + At33L*Gt313)*gtu33) + At11L*((6.*cdphi1 - 2.*Gt111)*gtu11 + + 6.*(cdphi2*gtu12 + cdphi3*gtu13) - 1.*(Gt122*gtu22 + Gt133*gtu33)) + + At13L*((6.*cdphi1 - 1.*Gt111)*gtu13 + 6.*(cdphi2*gtu23 + cdphi3*gtu33) + - 1.*(Gt322*gtu22 + Gt333*gtu33)) + gtu11*PDstandardNth1At11 - + 0.6666666666666666666666666666666666666667*PDstandardNth1trK + + gtu12*(-1.*(At22L*Gt211 + At23L*Gt311) - 3.*(At11L*Gt112 + At12L*Gt212 + + At13L*Gt312) + PDstandardNth1At12 + PDstandardNth2At11) + + gtu22*PDstandardNth2At12 + gtu13*(-1.*(At23L*Gt211 + At33L*Gt311) - + 3.*(At11L*Gt113 + At13L*Gt313) + PDstandardNth1At13 + + PDstandardNth3At11) + gtu23*(-1.*(At22L*Gt213 + At33L*Gt312 + + At23L*Gt313) - 2.*(At12L*Gt223 + At13L*Gt323) + PDstandardNth2At13 + + PDstandardNth3At12) + gtu33*PDstandardNth3At13 - + 25.13274122871834590770114706623602307358*S1; + + CCTK_REAL M2L = At12L*((6.*cdphi1 - 1.*Gt111)*gtu11 + 6.*(cdphi2*gtu12 + + cdphi3*gtu13) - 2.*Gt122*gtu22 - 3.*Gt123*gtu23 - 1.*Gt133*gtu33) + + At22L*((6.*cdphi2 - 2.*Gt222)*gtu22 + 6.*cdphi3*gtu23 - 1.*Gt233*gtu33) + + At23L*(-2.*Gt322*gtu22 - 1.*Gt333*gtu33 + 6.*(cdphi2*gtu23 + + cdphi3*gtu33)) - 1.*((At11L*Gt112 + At22L*Gt211 + At12L*Gt212 + + At23L*Gt311 + At13L*Gt312)*gtu11 + Gt122*(At11L*gtu12 + At13L*gtu23) + + (At23L*Gt223 + At33L*Gt323)*gtu33 + At13L*(Gt112*gtu13 + Gt123*gtu33)) + + gtu11*PDstandardNth1At12 + gtu12*(At22L*(6.*cdphi1 - 3.*Gt212) + + At12L*(-3.*Gt112 - 1.*Gt222) - 3.*At23L*Gt312 - 1.*At13L*Gt322 + + PDstandardNth1At22 + PDstandardNth2At12) + gtu22*PDstandardNth2At22 - + 0.6666666666666666666666666666666666666667*PDstandardNth2trK + + gtu13*(-2.*(At12L*Gt113 + At22L*Gt213) + At23L*(6.*cdphi1 - 1.*Gt212 - + 2.*Gt313) - 1.*(At11L*Gt123 + At12L*Gt223 + At33L*Gt312 + At13L*Gt323) + + PDstandardNth1At23 + PDstandardNth3At12) + gtu23*(-1.*(At23L*Gt222 + + At33L*Gt322) - 3.*(At22L*Gt223 + At23L*Gt323) + PDstandardNth2At23 + + PDstandardNth3At22) + gtu33*PDstandardNth3At23 - + 25.13274122871834590770114706623602307358*S2; + + CCTK_REAL M3L = -1.*((At11L*Gt113 + At23L*Gt211 + At12L*Gt213 + + At33L*Gt311)*gtu11 + (At22L*Gt223 + At33L*Gt322 + At23L*Gt323)*gtu22 + + At12L*(Gt113*gtu12 + Gt123*gtu22) + Gt133*(At11L*gtu13 + At12L*gtu23)) + + At13L*((6.*cdphi1 - 1.*(Gt111 + Gt313))*gtu11 + 6.*(cdphi2*gtu12 + + cdphi3*gtu13) - 1.*Gt122*gtu22 - 3.*Gt123*gtu23 - 2.*Gt133*gtu33) + + At23L*((6.*cdphi2 - 1.*Gt222)*gtu22 + 6.*cdphi3*gtu23 - 2.*Gt233*gtu33) + + gtu11*PDstandardNth1At13 + gtu12*(-2.*(At13L*Gt112 + At33L*Gt312) + + At23L*(6.*cdphi1 - 2.*Gt212 - 1.*Gt313) - 1.*(At11L*Gt123 + At22L*Gt213 + + At12L*Gt223 + At13L*Gt323) + PDstandardNth1At23 + PDstandardNth2At13) + + gtu22*PDstandardNth2At23 + gtu13*(-3.*(At13L*Gt113 + At23L*Gt213) + + At33L*(6.*cdphi1 - 3.*Gt313) - 1.*(At12L*Gt233 + At13L*Gt333) + + PDstandardNth1At33 + PDstandardNth3At13) + gtu23*(-1.*At22L*Gt233 + + At33L*(6.*cdphi2 - 3.*Gt323) + At23L*(-3.*Gt223 - 1.*Gt333) + + PDstandardNth2At33 + PDstandardNth3At23) + gtu33*(At33L*(6.*cdphi3 - + 2.*Gt333) + PDstandardNth3At33) - + 0.6666666666666666666666666666666666666667*PDstandardNth3trK - + 25.13274122871834590770114706623602307358*S3; + + CCTK_REAL cSL = Log(detgt); + + CCTK_REAL cXt1L = Gt111*gtu11 + Gt122*gtu22 + 2*(Gt112*gtu12 + + Gt113*gtu13 + Gt123*gtu23) + Gt133*gtu33 - Xt1L; + + CCTK_REAL cXt2L = Gt211*gtu11 + Gt222*gtu22 + 2*(Gt212*gtu12 + + Gt213*gtu13 + Gt223*gtu23) + Gt233*gtu33 - Xt2L; + + CCTK_REAL cXt3L = Gt311*gtu11 + Gt322*gtu22 + 2*(Gt312*gtu12 + + Gt313*gtu13 + Gt323*gtu23) + Gt333*gtu33 - Xt3L; + + CCTK_REAL cAL = At11L*gtu11 + At22L*gtu22 + 2*(At12L*gtu12 + + At13L*gtu13 + At23L*gtu23) + At33L*gtu33; + + + /* Copy local copies back to grid functions */ + cA[index] = cAL; + cS[index] = cSL; + cXt1[index] = cXt1L; + cXt2[index] = cXt2L; + cXt3[index] = cXt3L; + M1[index] = M1L; + M2[index] = M2L; + M3[index] = M3L; + } + LC_ENDLOOP3 (ML_BSSN_constraints2); +} + +extern "C" void ML_BSSN_constraints2(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverInterior(cctkGH, &ML_BSSN_constraints2_Body); +} diff --git a/ML_BSSN/src/ML_BSSN_convertFromADMBase.cc b/ML_BSSN/src/ML_BSSN_convertFromADMBase.cc new file mode 100644 index 0000000..7330c5c --- /dev/null +++ b/ML_BSSN/src/ML_BSSN_convertFromADMBase.cc @@ -0,0 +1,222 @@ +/* File produced by Kranc */ + +#define KRANC_C + +#include <assert.h> +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include "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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +static void ML_BSSN_convertFromADMBase_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_BSSN_convertFromADMBase_Body"); + } + + if (cctk_iteration % ML_BSSN_convertFromADMBase_calc_every != ML_BSSN_convertFromADMBase_calc_offset) + { + return; + } + + const char *groups[] = {"ADMBase::curv","ADMBase::lapse","ADMBase::metric","ADMBase::shift","ML_BSSN::ML_curv","ML_BSSN::ML_lapse","ML_BSSN::ML_log_confac","ML_BSSN::ML_metric","ML_BSSN::ML_shift","ML_BSSN::ML_trace_curv"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_BSSN_convertFromADMBase", 10, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o12dx = 0.0833333333333333333333333333333*INV(dx); + CCTK_REAL const p1o12dy = 0.0833333333333333333333333333333*INV(dy); + CCTK_REAL const p1o12dz = 0.0833333333333333333333333333333*INV(dz); + CCTK_REAL const p1o144dxdy = 0.00694444444444444444444444444444*INV(dx)*INV(dy); + CCTK_REAL const p1o144dxdz = 0.00694444444444444444444444444444*INV(dx)*INV(dz); + CCTK_REAL const p1o144dydz = 0.00694444444444444444444444444444*INV(dy)*INV(dz); + CCTK_REAL const p1o24dx = 0.0416666666666666666666666666667*INV(dx); + CCTK_REAL const p1o24dy = 0.0416666666666666666666666666667*INV(dy); + CCTK_REAL const p1o24dz = 0.0416666666666666666666666666667*INV(dz); + CCTK_REAL const p1o64dx = 0.015625*INV(dx); + CCTK_REAL const p1o64dy = 0.015625*INV(dy); + CCTK_REAL const p1o64dz = 0.015625*INV(dz); + CCTK_REAL const p1odx = INV(dx); + CCTK_REAL const p1ody = INV(dy); + CCTK_REAL const p1odz = INV(dz); + CCTK_REAL const pm1o12dx2 = -0.0833333333333333333333333333333*INV(SQR(dx)); + CCTK_REAL const pm1o12dy2 = -0.0833333333333333333333333333333*INV(SQR(dy)); + CCTK_REAL const pm1o12dz2 = -0.0833333333333333333333333333333*INV(SQR(dz)); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_BSSN_convertFromADMBase, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + CCTK_REAL alpL = alp[index]; + CCTK_REAL betaxL = betax[index]; + CCTK_REAL betayL = betay[index]; + CCTK_REAL betazL = betaz[index]; + CCTK_REAL gxxL = gxx[index]; + CCTK_REAL gxyL = gxy[index]; + CCTK_REAL gxzL = gxz[index]; + CCTK_REAL gyyL = gyy[index]; + CCTK_REAL gyzL = gyz[index]; + CCTK_REAL gzzL = gzz[index]; + CCTK_REAL kxxL = kxx[index]; + CCTK_REAL kxyL = kxy[index]; + CCTK_REAL kxzL = kxz[index]; + CCTK_REAL kyyL = kyy[index]; + CCTK_REAL kyzL = kyz[index]; + CCTK_REAL kzzL = kzz[index]; + CCTK_REAL phiL = phi[index]; + CCTK_REAL trKL = trK[index]; + + /* Include user supplied include files */ + + /* Precompute derivatives */ + + /* Calculate temporaries and grid functions */ + CCTK_REAL g11 = gxxL; + + CCTK_REAL g12 = gxyL; + + CCTK_REAL g13 = gxzL; + + CCTK_REAL g22 = gyyL; + + CCTK_REAL g23 = gyzL; + + CCTK_REAL g33 = gzzL; + + CCTK_REAL detg = 2*g12*g13*g23 + g33*(g11*g22 - SQR(g12)) - + g22*SQR(g13) - g11*SQR(g23); + + CCTK_REAL gu11 = INV(detg)*(g22*g33 - SQR(g23)); + + CCTK_REAL gu12 = (g13*g23 - g12*g33)*INV(detg); + + CCTK_REAL gu13 = (-(g13*g22) + g12*g23)*INV(detg); + + CCTK_REAL gu22 = INV(detg)*(g11*g33 - SQR(g13)); + + CCTK_REAL gu23 = (g12*g13 - g11*g23)*INV(detg); + + CCTK_REAL gu33 = INV(detg)*(g11*g22 - SQR(g12)); + + phiL = + IfThen(ToReal(conformalMethod),pow(detg,-0.166666666666666666666666666667),0.0833333333333333333333333333333*Log(detg)); + + CCTK_REAL em4phi = + IfThen(ToReal(conformalMethod),SQR(phiL),exp(-4*phiL)); + + CCTK_REAL gt11L = em4phi*g11; + + CCTK_REAL gt12L = em4phi*g12; + + CCTK_REAL gt13L = em4phi*g13; + + CCTK_REAL gt22L = em4phi*g22; + + CCTK_REAL gt23L = em4phi*g23; + + CCTK_REAL gt33L = em4phi*g33; + + trKL = gu11*kxxL + gu22*kyyL + 2*(gu12*kxyL + gu13*kxzL + gu23*kyzL) + + gu33*kzzL; + + CCTK_REAL At11L = em4phi*(kxxL - + 0.333333333333333333333333333333*g11*trKL); + + CCTK_REAL At12L = em4phi*(kxyL - + 0.333333333333333333333333333333*g12*trKL); + + CCTK_REAL At13L = em4phi*(kxzL - + 0.333333333333333333333333333333*g13*trKL); + + CCTK_REAL At22L = em4phi*(kyyL - + 0.333333333333333333333333333333*g22*trKL); + + CCTK_REAL At23L = em4phi*(kyzL - + 0.333333333333333333333333333333*g23*trKL); + + CCTK_REAL At33L = em4phi*(kzzL - + 0.333333333333333333333333333333*g33*trKL); + + CCTK_REAL alphaL = alpL; + + CCTK_REAL beta1L = betaxL; + + CCTK_REAL beta2L = betayL; + + CCTK_REAL beta3L = betazL; + + + /* Copy local copies back to grid functions */ + alpha[index] = alphaL; + At11[index] = At11L; + At12[index] = At12L; + At13[index] = At13L; + At22[index] = At22L; + At23[index] = At23L; + At33[index] = At33L; + beta1[index] = beta1L; + beta2[index] = beta2L; + beta3[index] = beta3L; + gt11[index] = gt11L; + gt12[index] = gt12L; + gt13[index] = gt13L; + gt22[index] = gt22L; + gt23[index] = gt23L; + gt33[index] = gt33L; + phi[index] = phiL; + trK[index] = trKL; + } + LC_ENDLOOP3 (ML_BSSN_convertFromADMBase); +} + +extern "C" void ML_BSSN_convertFromADMBase(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverEverything(cctkGH, &ML_BSSN_convertFromADMBase_Body); +} diff --git a/ML_BSSN/src/ML_BSSN_convertFromADMBaseGamma.cc b/ML_BSSN/src/ML_BSSN_convertFromADMBaseGamma.cc new file mode 100644 index 0000000..a3981b0 --- /dev/null +++ b/ML_BSSN/src/ML_BSSN_convertFromADMBaseGamma.cc @@ -0,0 +1,326 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +extern "C" void ML_BSSN_convertFromADMBaseGamma_SelectBCs(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT ierr = 0; + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN::ML_dtlapse","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN::ML_dtlapse."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN::ML_dtshift","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN::ML_dtshift."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN::ML_Gamma","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN::ML_Gamma."); + return; +} + +static void ML_BSSN_convertFromADMBaseGamma_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_BSSN_convertFromADMBaseGamma_Body"); + } + + if (cctk_iteration % ML_BSSN_convertFromADMBaseGamma_calc_every != ML_BSSN_convertFromADMBaseGamma_calc_offset) + { + return; + } + + const char *groups[] = {"ADMBase::dtlapse","ADMBase::dtshift","grid::coordinates","Grid::coordinates","ML_BSSN::ML_dtlapse","ML_BSSN::ML_dtshift","ML_BSSN::ML_Gamma","ML_BSSN::ML_lapse","ML_BSSN::ML_metric","ML_BSSN::ML_shift"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_BSSN_convertFromADMBaseGamma", 10, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o12dx = 0.0833333333333333333333333333333*INV(dx); + CCTK_REAL const p1o12dy = 0.0833333333333333333333333333333*INV(dy); + CCTK_REAL const p1o12dz = 0.0833333333333333333333333333333*INV(dz); + CCTK_REAL const p1o144dxdy = 0.00694444444444444444444444444444*INV(dx)*INV(dy); + CCTK_REAL const p1o144dxdz = 0.00694444444444444444444444444444*INV(dx)*INV(dz); + CCTK_REAL const p1o144dydz = 0.00694444444444444444444444444444*INV(dy)*INV(dz); + CCTK_REAL const p1o24dx = 0.0416666666666666666666666666667*INV(dx); + CCTK_REAL const p1o24dy = 0.0416666666666666666666666666667*INV(dy); + CCTK_REAL const p1o24dz = 0.0416666666666666666666666666667*INV(dz); + CCTK_REAL const p1o64dx = 0.015625*INV(dx); + CCTK_REAL const p1o64dy = 0.015625*INV(dy); + CCTK_REAL const p1o64dz = 0.015625*INV(dz); + CCTK_REAL const p1odx = INV(dx); + CCTK_REAL const p1ody = INV(dy); + CCTK_REAL const p1odz = INV(dz); + CCTK_REAL const pm1o12dx2 = -0.0833333333333333333333333333333*INV(SQR(dx)); + CCTK_REAL const pm1o12dy2 = -0.0833333333333333333333333333333*INV(SQR(dy)); + CCTK_REAL const pm1o12dz2 = -0.0833333333333333333333333333333*INV(SQR(dz)); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_BSSN_convertFromADMBaseGamma, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + CCTK_REAL alphaL = alpha[index]; + CCTK_REAL beta1L = beta1[index]; + CCTK_REAL beta2L = beta2[index]; + CCTK_REAL beta3L = beta3[index]; + CCTK_REAL dtalpL = dtalp[index]; + CCTK_REAL dtbetaxL = dtbetax[index]; + CCTK_REAL dtbetayL = dtbetay[index]; + CCTK_REAL dtbetazL = dtbetaz[index]; + CCTK_REAL gt11L = gt11[index]; + CCTK_REAL gt12L = gt12[index]; + CCTK_REAL gt13L = gt13[index]; + CCTK_REAL gt22L = gt22[index]; + CCTK_REAL gt23L = gt23[index]; + CCTK_REAL gt33L = gt33[index]; + CCTK_REAL rL = r[index]; + + /* Include user supplied include files */ + + /* Precompute derivatives */ + CCTK_REAL const PDupwindNthAnti1alpha = PDupwindNthAnti1(&alpha[index]); + CCTK_REAL const PDupwindNthSymm1alpha = PDupwindNthSymm1(&alpha[index]); + CCTK_REAL const PDupwindNthAnti2alpha = PDupwindNthAnti2(&alpha[index]); + CCTK_REAL const PDupwindNthSymm2alpha = PDupwindNthSymm2(&alpha[index]); + CCTK_REAL const PDupwindNthAnti3alpha = PDupwindNthAnti3(&alpha[index]); + CCTK_REAL const PDupwindNthSymm3alpha = PDupwindNthSymm3(&alpha[index]); + CCTK_REAL const PDupwindNthAnti1beta1 = PDupwindNthAnti1(&beta1[index]); + CCTK_REAL const PDupwindNthSymm1beta1 = PDupwindNthSymm1(&beta1[index]); + CCTK_REAL const PDupwindNthAnti2beta1 = PDupwindNthAnti2(&beta1[index]); + CCTK_REAL const PDupwindNthSymm2beta1 = PDupwindNthSymm2(&beta1[index]); + CCTK_REAL const PDupwindNthAnti3beta1 = PDupwindNthAnti3(&beta1[index]); + CCTK_REAL const PDupwindNthSymm3beta1 = PDupwindNthSymm3(&beta1[index]); + CCTK_REAL const PDupwindNthAnti1beta2 = PDupwindNthAnti1(&beta2[index]); + CCTK_REAL const PDupwindNthSymm1beta2 = PDupwindNthSymm1(&beta2[index]); + CCTK_REAL const PDupwindNthAnti2beta2 = PDupwindNthAnti2(&beta2[index]); + CCTK_REAL const PDupwindNthSymm2beta2 = PDupwindNthSymm2(&beta2[index]); + CCTK_REAL const PDupwindNthAnti3beta2 = PDupwindNthAnti3(&beta2[index]); + CCTK_REAL const PDupwindNthSymm3beta2 = PDupwindNthSymm3(&beta2[index]); + CCTK_REAL const PDupwindNthAnti1beta3 = PDupwindNthAnti1(&beta3[index]); + CCTK_REAL const PDupwindNthSymm1beta3 = PDupwindNthSymm1(&beta3[index]); + CCTK_REAL const PDupwindNthAnti2beta3 = PDupwindNthAnti2(&beta3[index]); + CCTK_REAL const PDupwindNthSymm2beta3 = PDupwindNthSymm2(&beta3[index]); + CCTK_REAL const PDupwindNthAnti3beta3 = PDupwindNthAnti3(&beta3[index]); + CCTK_REAL const PDupwindNthSymm3beta3 = PDupwindNthSymm3(&beta3[index]); + CCTK_REAL const PDstandardNth1gt11 = PDstandardNth1(>11[index]); + CCTK_REAL const PDstandardNth2gt11 = PDstandardNth2(>11[index]); + CCTK_REAL const PDstandardNth3gt11 = PDstandardNth3(>11[index]); + CCTK_REAL const PDstandardNth1gt12 = PDstandardNth1(>12[index]); + CCTK_REAL const PDstandardNth2gt12 = PDstandardNth2(>12[index]); + CCTK_REAL const PDstandardNth3gt12 = PDstandardNth3(>12[index]); + CCTK_REAL const PDstandardNth1gt13 = PDstandardNth1(>13[index]); + CCTK_REAL const PDstandardNth2gt13 = PDstandardNth2(>13[index]); + CCTK_REAL const PDstandardNth3gt13 = PDstandardNth3(>13[index]); + CCTK_REAL const PDstandardNth1gt22 = PDstandardNth1(>22[index]); + CCTK_REAL const PDstandardNth2gt22 = PDstandardNth2(>22[index]); + CCTK_REAL const PDstandardNth3gt22 = PDstandardNth3(>22[index]); + CCTK_REAL const PDstandardNth1gt23 = PDstandardNth1(>23[index]); + CCTK_REAL const PDstandardNth2gt23 = PDstandardNth2(>23[index]); + CCTK_REAL const PDstandardNth3gt23 = PDstandardNth3(>23[index]); + CCTK_REAL const PDstandardNth1gt33 = PDstandardNth1(>33[index]); + CCTK_REAL const PDstandardNth2gt33 = PDstandardNth2(>33[index]); + CCTK_REAL const PDstandardNth3gt33 = PDstandardNth3(>33[index]); + + /* Calculate temporaries and grid functions */ + ptrdiff_t dir1 = Sign(beta1L); + + ptrdiff_t dir2 = Sign(beta2L); + + ptrdiff_t dir3 = Sign(beta3L); + + CCTK_REAL detgt = 1; + + CCTK_REAL gtu11 = INV(detgt)*(gt22L*gt33L - SQR(gt23L)); + + CCTK_REAL gtu12 = (gt13L*gt23L - gt12L*gt33L)*INV(detgt); + + CCTK_REAL gtu13 = (-(gt13L*gt22L) + gt12L*gt23L)*INV(detgt); + + CCTK_REAL gtu22 = INV(detgt)*(gt11L*gt33L - SQR(gt13L)); + + CCTK_REAL gtu23 = (gt12L*gt13L - gt11L*gt23L)*INV(detgt); + + CCTK_REAL gtu33 = INV(detgt)*(gt11L*gt22L - SQR(gt12L)); + + CCTK_REAL Gt111 = 0.5*(gtu11*PDstandardNth1gt11 + + 2*(gtu12*PDstandardNth1gt12 + gtu13*PDstandardNth1gt13) - + gtu12*PDstandardNth2gt11 - gtu13*PDstandardNth3gt11); + + CCTK_REAL Gt211 = 0.5*(gtu12*PDstandardNth1gt11 + + 2*(gtu22*PDstandardNth1gt12 + gtu23*PDstandardNth1gt13) - + gtu22*PDstandardNth2gt11 - gtu23*PDstandardNth3gt11); + + CCTK_REAL Gt311 = 0.5*(gtu13*PDstandardNth1gt11 + + 2*(gtu23*PDstandardNth1gt12 + gtu33*PDstandardNth1gt13) - + gtu23*PDstandardNth2gt11 - gtu33*PDstandardNth3gt11); + + CCTK_REAL Gt112 = 0.5*(gtu12*PDstandardNth1gt22 + + gtu11*PDstandardNth2gt11 + gtu13*(PDstandardNth1gt23 + + PDstandardNth2gt13 - PDstandardNth3gt12)); + + CCTK_REAL Gt212 = 0.5*(gtu22*PDstandardNth1gt22 + + gtu12*PDstandardNth2gt11 + gtu23*(PDstandardNth1gt23 + + PDstandardNth2gt13 - PDstandardNth3gt12)); + + CCTK_REAL Gt312 = 0.5*(gtu23*PDstandardNth1gt22 + + gtu13*PDstandardNth2gt11 + gtu33*(PDstandardNth1gt23 + + PDstandardNth2gt13 - PDstandardNth3gt12)); + + CCTK_REAL Gt113 = 0.5*(gtu13*PDstandardNth1gt33 + + gtu11*PDstandardNth3gt11 + gtu12*(PDstandardNth1gt23 - + PDstandardNth2gt13 + PDstandardNth3gt12)); + + CCTK_REAL Gt213 = 0.5*(gtu23*PDstandardNth1gt33 + + gtu12*PDstandardNth3gt11 + gtu22*(PDstandardNth1gt23 - + PDstandardNth2gt13 + PDstandardNth3gt12)); + + CCTK_REAL Gt313 = 0.5*(gtu33*PDstandardNth1gt33 + + gtu13*PDstandardNth3gt11 + gtu23*(PDstandardNth1gt23 - + PDstandardNth2gt13 + PDstandardNth3gt12)); + + CCTK_REAL Gt122 = 0.5*(gtu11*(-PDstandardNth1gt22 + + 2*PDstandardNth2gt12) + gtu12*PDstandardNth2gt22 + + gtu13*(2*PDstandardNth2gt23 - PDstandardNth3gt22)); + + CCTK_REAL Gt222 = 0.5*(gtu12*(-PDstandardNth1gt22 + + 2*PDstandardNth2gt12) + gtu22*PDstandardNth2gt22 + + gtu23*(2*PDstandardNth2gt23 - PDstandardNth3gt22)); + + CCTK_REAL Gt322 = 0.5*(gtu13*(-PDstandardNth1gt22 + + 2*PDstandardNth2gt12) + gtu23*PDstandardNth2gt22 + + gtu33*(2*PDstandardNth2gt23 - PDstandardNth3gt22)); + + CCTK_REAL Gt123 = 0.5*(gtu13*PDstandardNth2gt33 + + gtu11*(-PDstandardNth1gt23 + PDstandardNth2gt13 + PDstandardNth3gt12) + + gtu12*PDstandardNth3gt22); + + CCTK_REAL Gt223 = 0.5*(gtu23*PDstandardNth2gt33 + + gtu12*(-PDstandardNth1gt23 + PDstandardNth2gt13 + PDstandardNth3gt12) + + gtu22*PDstandardNth3gt22); + + CCTK_REAL Gt323 = 0.5*(gtu33*PDstandardNth2gt33 + + gtu13*(-PDstandardNth1gt23 + PDstandardNth2gt13 + PDstandardNth3gt12) + + gtu23*PDstandardNth3gt22); + + CCTK_REAL Gt133 = 0.5*(gtu11*(-PDstandardNth1gt33 + + 2*PDstandardNth3gt13) + gtu12*(-PDstandardNth2gt33 + + 2*PDstandardNth3gt23) + gtu13*PDstandardNth3gt33); + + CCTK_REAL Gt233 = 0.5*(gtu12*(-PDstandardNth1gt33 + + 2*PDstandardNth3gt13) + gtu22*(-PDstandardNth2gt33 + + 2*PDstandardNth3gt23) + gtu23*PDstandardNth3gt33); + + CCTK_REAL Gt333 = 0.5*(gtu13*(-PDstandardNth1gt33 + + 2*PDstandardNth3gt13) + gtu23*(-PDstandardNth2gt33 + + 2*PDstandardNth3gt23) + gtu33*PDstandardNth3gt33); + + CCTK_REAL Xt1L = Gt111*gtu11 + Gt122*gtu22 + 2*(Gt112*gtu12 + + Gt113*gtu13 + Gt123*gtu23) + Gt133*gtu33; + + CCTK_REAL Xt2L = Gt211*gtu11 + Gt222*gtu22 + 2*(Gt212*gtu12 + + Gt213*gtu13 + Gt223*gtu23) + Gt233*gtu33; + + CCTK_REAL Xt3L = Gt311*gtu11 + Gt322*gtu22 + 2*(Gt312*gtu12 + + Gt313*gtu13 + Gt323*gtu23) + Gt333*gtu33; + + CCTK_REAL AL = IfThen(ToReal(LapseACoeff) != + 0,-3*INV(ToReal(harmonicF))*pow(alphaL,-ToReal(harmonicN))*(9*dtalpL - + (beta1L*PDupwindNthAnti1alpha + beta2L*PDupwindNthAnti2alpha + + beta3L*PDupwindNthAnti3alpha + PDupwindNthSymm1alpha*Abs(beta1L) + + PDupwindNthSymm2alpha*Abs(beta2L) + + PDupwindNthSymm3alpha*Abs(beta3L))*ToReal(LapseAdvectionCoeff)),0); + + CCTK_REAL theta = fmin(1,exp(1 - + rL*INV(ToReal(SpatialShiftGammaCoeffRadius)))); + + CCTK_REAL B1L = IfThen(ToReal(ShiftBCoeff)*ToReal(ShiftGammaCoeff) != + 0,INV(theta)*INV(ToReal(ShiftGammaCoeff))*(27*dtbetaxL - + 3*(beta1L*PDupwindNthAnti1beta1 + beta2L*PDupwindNthAnti2beta1 + + beta3L*PDupwindNthAnti3beta1 + PDupwindNthSymm1beta1*Abs(beta1L) + + PDupwindNthSymm2beta1*Abs(beta2L) + + PDupwindNthSymm3beta1*Abs(beta3L))*ToReal(ShiftAdvectionCoeff)),0); + + CCTK_REAL B2L = IfThen(ToReal(ShiftBCoeff)*ToReal(ShiftGammaCoeff) != + 0,INV(theta)*INV(ToReal(ShiftGammaCoeff))*(27*dtbetayL - + 3*(beta1L*PDupwindNthAnti1beta2 + beta2L*PDupwindNthAnti2beta2 + + beta3L*PDupwindNthAnti3beta2 + PDupwindNthSymm1beta2*Abs(beta1L) + + PDupwindNthSymm2beta2*Abs(beta2L) + + PDupwindNthSymm3beta2*Abs(beta3L))*ToReal(ShiftAdvectionCoeff)),0); + + CCTK_REAL B3L = IfThen(ToReal(ShiftBCoeff)*ToReal(ShiftGammaCoeff) != + 0,INV(theta)*INV(ToReal(ShiftGammaCoeff))*(27*dtbetazL - + 3*(beta1L*PDupwindNthAnti1beta3 + beta2L*PDupwindNthAnti2beta3 + + beta3L*PDupwindNthAnti3beta3 + PDupwindNthSymm1beta3*Abs(beta1L) + + PDupwindNthSymm2beta3*Abs(beta2L) + + PDupwindNthSymm3beta3*Abs(beta3L))*ToReal(ShiftAdvectionCoeff)),0); + + + /* Copy local copies back to grid functions */ + A[index] = AL; + B1[index] = B1L; + B2[index] = B2L; + B3[index] = B3L; + Xt1[index] = Xt1L; + Xt2[index] = Xt2L; + Xt3[index] = Xt3L; + } + LC_ENDLOOP3 (ML_BSSN_convertFromADMBaseGamma); +} + +extern "C" void ML_BSSN_convertFromADMBaseGamma(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverInterior(cctkGH, &ML_BSSN_convertFromADMBaseGamma_Body); +} diff --git a/ML_BSSN/src/ML_BSSN_convertToADMBase.cc b/ML_BSSN/src/ML_BSSN_convertToADMBase.cc new file mode 100644 index 0000000..c5fdaa6 --- /dev/null +++ b/ML_BSSN/src/ML_BSSN_convertToADMBase.cc @@ -0,0 +1,193 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +static void ML_BSSN_convertToADMBase_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_BSSN_convertToADMBase_Body"); + } + + if (cctk_iteration % ML_BSSN_convertToADMBase_calc_every != ML_BSSN_convertToADMBase_calc_offset) + { + return; + } + + const char *groups[] = {"ADMBase::curv","ADMBase::lapse","ADMBase::metric","ADMBase::shift","ML_BSSN::ML_curv","ML_BSSN::ML_lapse","ML_BSSN::ML_log_confac","ML_BSSN::ML_metric","ML_BSSN::ML_shift","ML_BSSN::ML_trace_curv"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_BSSN_convertToADMBase", 10, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o12dx = 0.0833333333333333333333333333333*INV(dx); + CCTK_REAL const p1o12dy = 0.0833333333333333333333333333333*INV(dy); + CCTK_REAL const p1o12dz = 0.0833333333333333333333333333333*INV(dz); + CCTK_REAL const p1o144dxdy = 0.00694444444444444444444444444444*INV(dx)*INV(dy); + CCTK_REAL const p1o144dxdz = 0.00694444444444444444444444444444*INV(dx)*INV(dz); + CCTK_REAL const p1o144dydz = 0.00694444444444444444444444444444*INV(dy)*INV(dz); + CCTK_REAL const p1o24dx = 0.0416666666666666666666666666667*INV(dx); + CCTK_REAL const p1o24dy = 0.0416666666666666666666666666667*INV(dy); + CCTK_REAL const p1o24dz = 0.0416666666666666666666666666667*INV(dz); + CCTK_REAL const p1o64dx = 0.015625*INV(dx); + CCTK_REAL const p1o64dy = 0.015625*INV(dy); + CCTK_REAL const p1o64dz = 0.015625*INV(dz); + CCTK_REAL const p1odx = INV(dx); + CCTK_REAL const p1ody = INV(dy); + CCTK_REAL const p1odz = INV(dz); + CCTK_REAL const pm1o12dx2 = -0.0833333333333333333333333333333*INV(SQR(dx)); + CCTK_REAL const pm1o12dy2 = -0.0833333333333333333333333333333*INV(SQR(dy)); + CCTK_REAL const pm1o12dz2 = -0.0833333333333333333333333333333*INV(SQR(dz)); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_BSSN_convertToADMBase, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + CCTK_REAL alphaL = alpha[index]; + CCTK_REAL At11L = At11[index]; + CCTK_REAL At12L = At12[index]; + CCTK_REAL At13L = At13[index]; + CCTK_REAL At22L = At22[index]; + CCTK_REAL At23L = At23[index]; + CCTK_REAL At33L = At33[index]; + CCTK_REAL beta1L = beta1[index]; + CCTK_REAL beta2L = beta2[index]; + CCTK_REAL beta3L = beta3[index]; + CCTK_REAL gt11L = gt11[index]; + CCTK_REAL gt12L = gt12[index]; + CCTK_REAL gt13L = gt13[index]; + CCTK_REAL gt22L = gt22[index]; + CCTK_REAL gt23L = gt23[index]; + CCTK_REAL gt33L = gt33[index]; + CCTK_REAL gxxL = gxx[index]; + CCTK_REAL gxyL = gxy[index]; + CCTK_REAL gxzL = gxz[index]; + CCTK_REAL gyyL = gyy[index]; + CCTK_REAL gyzL = gyz[index]; + CCTK_REAL gzzL = gzz[index]; + CCTK_REAL phiL = phi[index]; + CCTK_REAL trKL = trK[index]; + + /* Include user supplied include files */ + + /* Precompute derivatives */ + + /* Calculate temporaries and grid functions */ + CCTK_REAL e4phi = + IfThen(ToReal(conformalMethod),INV(SQR(phiL)),exp(4*phiL)); + + gxxL = e4phi*gt11L; + + gxyL = e4phi*gt12L; + + gxzL = e4phi*gt13L; + + gyyL = e4phi*gt22L; + + gyzL = e4phi*gt23L; + + gzzL = e4phi*gt33L; + + CCTK_REAL kxxL = At11L*e4phi + + 0.333333333333333333333333333333*gxxL*trKL; + + CCTK_REAL kxyL = At12L*e4phi + + 0.333333333333333333333333333333*gxyL*trKL; + + CCTK_REAL kxzL = At13L*e4phi + + 0.333333333333333333333333333333*gxzL*trKL; + + CCTK_REAL kyyL = At22L*e4phi + + 0.333333333333333333333333333333*gyyL*trKL; + + CCTK_REAL kyzL = At23L*e4phi + + 0.333333333333333333333333333333*gyzL*trKL; + + CCTK_REAL kzzL = At33L*e4phi + + 0.333333333333333333333333333333*gzzL*trKL; + + CCTK_REAL alpL = alphaL; + + CCTK_REAL betaxL = beta1L; + + CCTK_REAL betayL = beta2L; + + CCTK_REAL betazL = beta3L; + + + /* Copy local copies back to grid functions */ + alp[index] = alpL; + betax[index] = betaxL; + betay[index] = betayL; + betaz[index] = betazL; + gxx[index] = gxxL; + gxy[index] = gxyL; + gxz[index] = gxzL; + gyy[index] = gyyL; + gyz[index] = gyzL; + gzz[index] = gzzL; + kxx[index] = kxxL; + kxy[index] = kxyL; + kxz[index] = kxzL; + kyy[index] = kyyL; + kyz[index] = kyzL; + kzz[index] = kzzL; + } + LC_ENDLOOP3 (ML_BSSN_convertToADMBase); +} + +extern "C" void ML_BSSN_convertToADMBase(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverEverything(cctkGH, &ML_BSSN_convertToADMBase_Body); +} diff --git a/ML_BSSN/src/ML_BSSN_convertToADMBaseDtLapseShift.cc b/ML_BSSN/src/ML_BSSN_convertToADMBaseDtLapseShift.cc new file mode 100644 index 0000000..710c96b --- /dev/null +++ b/ML_BSSN/src/ML_BSSN_convertToADMBaseDtLapseShift.cc @@ -0,0 +1,207 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +extern "C" void ML_BSSN_convertToADMBaseDtLapseShift_SelectBCs(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT ierr = 0; + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ADMBase::dtlapse","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ADMBase::dtlapse."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ADMBase::dtshift","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ADMBase::dtshift."); + return; +} + +static void ML_BSSN_convertToADMBaseDtLapseShift_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_BSSN_convertToADMBaseDtLapseShift_Body"); + } + + if (cctk_iteration % ML_BSSN_convertToADMBaseDtLapseShift_calc_every != ML_BSSN_convertToADMBaseDtLapseShift_calc_offset) + { + return; + } + + const char *groups[] = {"ADMBase::dtlapse","ADMBase::dtshift","grid::coordinates","Grid::coordinates","ML_BSSN::ML_dtlapse","ML_BSSN::ML_dtshift","ML_BSSN::ML_Gamma","ML_BSSN::ML_lapse","ML_BSSN::ML_shift","ML_BSSN::ML_trace_curv"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_BSSN_convertToADMBaseDtLapseShift", 10, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o12dx = 0.0833333333333333333333333333333*INV(dx); + CCTK_REAL const p1o12dy = 0.0833333333333333333333333333333*INV(dy); + CCTK_REAL const p1o12dz = 0.0833333333333333333333333333333*INV(dz); + CCTK_REAL const p1o144dxdy = 0.00694444444444444444444444444444*INV(dx)*INV(dy); + CCTK_REAL const p1o144dxdz = 0.00694444444444444444444444444444*INV(dx)*INV(dz); + CCTK_REAL const p1o144dydz = 0.00694444444444444444444444444444*INV(dy)*INV(dz); + CCTK_REAL const p1o24dx = 0.0416666666666666666666666666667*INV(dx); + CCTK_REAL const p1o24dy = 0.0416666666666666666666666666667*INV(dy); + CCTK_REAL const p1o24dz = 0.0416666666666666666666666666667*INV(dz); + CCTK_REAL const p1o64dx = 0.015625*INV(dx); + CCTK_REAL const p1o64dy = 0.015625*INV(dy); + CCTK_REAL const p1o64dz = 0.015625*INV(dz); + CCTK_REAL const p1odx = INV(dx); + CCTK_REAL const p1ody = INV(dy); + CCTK_REAL const p1odz = INV(dz); + CCTK_REAL const pm1o12dx2 = -0.0833333333333333333333333333333*INV(SQR(dx)); + CCTK_REAL const pm1o12dy2 = -0.0833333333333333333333333333333*INV(SQR(dy)); + CCTK_REAL const pm1o12dz2 = -0.0833333333333333333333333333333*INV(SQR(dz)); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_BSSN_convertToADMBaseDtLapseShift, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + CCTK_REAL AL = A[index]; + CCTK_REAL alphaL = alpha[index]; + CCTK_REAL B1L = B1[index]; + CCTK_REAL B2L = B2[index]; + CCTK_REAL B3L = B3[index]; + CCTK_REAL beta1L = beta1[index]; + CCTK_REAL beta2L = beta2[index]; + CCTK_REAL beta3L = beta3[index]; + CCTK_REAL rL = r[index]; + CCTK_REAL trKL = trK[index]; + CCTK_REAL Xt1L = Xt1[index]; + CCTK_REAL Xt2L = Xt2[index]; + CCTK_REAL Xt3L = Xt3[index]; + + /* Include user supplied include files */ + + /* Precompute derivatives */ + CCTK_REAL const PDupwindNthAnti1alpha = PDupwindNthAnti1(&alpha[index]); + CCTK_REAL const PDupwindNthSymm1alpha = PDupwindNthSymm1(&alpha[index]); + CCTK_REAL const PDupwindNthAnti2alpha = PDupwindNthAnti2(&alpha[index]); + CCTK_REAL const PDupwindNthSymm2alpha = PDupwindNthSymm2(&alpha[index]); + CCTK_REAL const PDupwindNthAnti3alpha = PDupwindNthAnti3(&alpha[index]); + CCTK_REAL const PDupwindNthSymm3alpha = PDupwindNthSymm3(&alpha[index]); + CCTK_REAL const PDupwindNthAnti1beta1 = PDupwindNthAnti1(&beta1[index]); + CCTK_REAL const PDupwindNthSymm1beta1 = PDupwindNthSymm1(&beta1[index]); + CCTK_REAL const PDupwindNthAnti2beta1 = PDupwindNthAnti2(&beta1[index]); + CCTK_REAL const PDupwindNthSymm2beta1 = PDupwindNthSymm2(&beta1[index]); + CCTK_REAL const PDupwindNthAnti3beta1 = PDupwindNthAnti3(&beta1[index]); + CCTK_REAL const PDupwindNthSymm3beta1 = PDupwindNthSymm3(&beta1[index]); + CCTK_REAL const PDupwindNthAnti1beta2 = PDupwindNthAnti1(&beta2[index]); + CCTK_REAL const PDupwindNthSymm1beta2 = PDupwindNthSymm1(&beta2[index]); + CCTK_REAL const PDupwindNthAnti2beta2 = PDupwindNthAnti2(&beta2[index]); + CCTK_REAL const PDupwindNthSymm2beta2 = PDupwindNthSymm2(&beta2[index]); + CCTK_REAL const PDupwindNthAnti3beta2 = PDupwindNthAnti3(&beta2[index]); + CCTK_REAL const PDupwindNthSymm3beta2 = PDupwindNthSymm3(&beta2[index]); + CCTK_REAL const PDupwindNthAnti1beta3 = PDupwindNthAnti1(&beta3[index]); + CCTK_REAL const PDupwindNthSymm1beta3 = PDupwindNthSymm1(&beta3[index]); + CCTK_REAL const PDupwindNthAnti2beta3 = PDupwindNthAnti2(&beta3[index]); + CCTK_REAL const PDupwindNthSymm2beta3 = PDupwindNthSymm2(&beta3[index]); + CCTK_REAL const PDupwindNthAnti3beta3 = PDupwindNthAnti3(&beta3[index]); + CCTK_REAL const PDupwindNthSymm3beta3 = PDupwindNthSymm3(&beta3[index]); + + /* Calculate temporaries and grid functions */ + ptrdiff_t dir1 = Sign(beta1L); + + ptrdiff_t dir2 = Sign(beta2L); + + ptrdiff_t dir3 = Sign(beta3L); + + CCTK_REAL eta = fmin(1,INV(rL)*ToReal(SpatialBetaDriverRadius)); + + CCTK_REAL theta = fmin(1,exp(1 - + rL*INV(ToReal(SpatialShiftGammaCoeffRadius)))); + + CCTK_REAL dtalpL = + -(pow(alphaL,ToReal(harmonicN))*ToReal(harmonicF)*(trKL + (AL - + trKL)*ToReal(LapseACoeff))) + (beta1L*PDupwindNthAnti1alpha + + beta2L*PDupwindNthAnti2alpha + beta3L*PDupwindNthAnti3alpha + + PDupwindNthSymm1alpha*Abs(beta1L) + PDupwindNthSymm2alpha*Abs(beta2L) + + PDupwindNthSymm3alpha*Abs(beta3L))*ToReal(LapseAdvectionCoeff); + + CCTK_REAL dtbetaxL = (beta1L*PDupwindNthAnti1beta1 + + beta2L*PDupwindNthAnti2beta1 + beta3L*PDupwindNthAnti3beta1 + + PDupwindNthSymm1beta1*Abs(beta1L) + PDupwindNthSymm2beta1*Abs(beta2L) + + PDupwindNthSymm3beta1*Abs(beta3L))*ToReal(ShiftAdvectionCoeff) + + theta*(Xt1L + beta1L*eta*ToReal(BetaDriver)*(-1 + ToReal(ShiftBCoeff)) + + (B1L - Xt1L)*ToReal(ShiftBCoeff))*ToReal(ShiftGammaCoeff); + + CCTK_REAL dtbetayL = (beta1L*PDupwindNthAnti1beta2 + + beta2L*PDupwindNthAnti2beta2 + beta3L*PDupwindNthAnti3beta2 + + PDupwindNthSymm1beta2*Abs(beta1L) + PDupwindNthSymm2beta2*Abs(beta2L) + + PDupwindNthSymm3beta2*Abs(beta3L))*ToReal(ShiftAdvectionCoeff) + + theta*(Xt2L + beta2L*eta*ToReal(BetaDriver)*(-1 + ToReal(ShiftBCoeff)) + + (B2L - Xt2L)*ToReal(ShiftBCoeff))*ToReal(ShiftGammaCoeff); + + CCTK_REAL dtbetazL = (beta1L*PDupwindNthAnti1beta3 + + beta2L*PDupwindNthAnti2beta3 + beta3L*PDupwindNthAnti3beta3 + + PDupwindNthSymm1beta3*Abs(beta1L) + PDupwindNthSymm2beta3*Abs(beta2L) + + PDupwindNthSymm3beta3*Abs(beta3L))*ToReal(ShiftAdvectionCoeff) + + theta*(Xt3L + beta3L*eta*ToReal(BetaDriver)*(-1 + ToReal(ShiftBCoeff)) + + (B3L - Xt3L)*ToReal(ShiftBCoeff))*ToReal(ShiftGammaCoeff); + + + /* Copy local copies back to grid functions */ + dtalp[index] = dtalpL; + dtbetax[index] = dtbetaxL; + dtbetay[index] = dtbetayL; + dtbetaz[index] = dtbetazL; + } + LC_ENDLOOP3 (ML_BSSN_convertToADMBaseDtLapseShift); +} + +extern "C" void ML_BSSN_convertToADMBaseDtLapseShift(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverInterior(cctkGH, &ML_BSSN_convertToADMBaseDtLapseShift_Body); +} diff --git a/ML_BSSN/src/ML_BSSN_convertToADMBaseDtLapseShiftBoundary.cc b/ML_BSSN/src/ML_BSSN_convertToADMBaseDtLapseShiftBoundary.cc new file mode 100644 index 0000000..998a634 --- /dev/null +++ b/ML_BSSN/src/ML_BSSN_convertToADMBaseDtLapseShiftBoundary.cc @@ -0,0 +1,165 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +extern "C" void ML_BSSN_convertToADMBaseDtLapseShiftBoundary_SelectBCs(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT ierr = 0; + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ADMBase::dtlapse","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ADMBase::dtlapse."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ADMBase::dtshift","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ADMBase::dtshift."); + return; +} + +static void ML_BSSN_convertToADMBaseDtLapseShiftBoundary_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_BSSN_convertToADMBaseDtLapseShiftBoundary_Body"); + } + + if (cctk_iteration % ML_BSSN_convertToADMBaseDtLapseShiftBoundary_calc_every != ML_BSSN_convertToADMBaseDtLapseShiftBoundary_calc_offset) + { + return; + } + + const char *groups[] = {"ADMBase::dtlapse","ADMBase::dtshift","grid::coordinates","Grid::coordinates","ML_BSSN::ML_dtlapse","ML_BSSN::ML_dtshift","ML_BSSN::ML_Gamma","ML_BSSN::ML_lapse","ML_BSSN::ML_shift","ML_BSSN::ML_trace_curv"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_BSSN_convertToADMBaseDtLapseShiftBoundary", 10, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o12dx = 0.0833333333333333333333333333333*INV(dx); + CCTK_REAL const p1o12dy = 0.0833333333333333333333333333333*INV(dy); + CCTK_REAL const p1o12dz = 0.0833333333333333333333333333333*INV(dz); + CCTK_REAL const p1o144dxdy = 0.00694444444444444444444444444444*INV(dx)*INV(dy); + CCTK_REAL const p1o144dxdz = 0.00694444444444444444444444444444*INV(dx)*INV(dz); + CCTK_REAL const p1o144dydz = 0.00694444444444444444444444444444*INV(dy)*INV(dz); + CCTK_REAL const p1o24dx = 0.0416666666666666666666666666667*INV(dx); + CCTK_REAL const p1o24dy = 0.0416666666666666666666666666667*INV(dy); + CCTK_REAL const p1o24dz = 0.0416666666666666666666666666667*INV(dz); + CCTK_REAL const p1o64dx = 0.015625*INV(dx); + CCTK_REAL const p1o64dy = 0.015625*INV(dy); + CCTK_REAL const p1o64dz = 0.015625*INV(dz); + CCTK_REAL const p1odx = INV(dx); + CCTK_REAL const p1ody = INV(dy); + CCTK_REAL const p1odz = INV(dz); + CCTK_REAL const pm1o12dx2 = -0.0833333333333333333333333333333*INV(SQR(dx)); + CCTK_REAL const pm1o12dy2 = -0.0833333333333333333333333333333*INV(SQR(dy)); + CCTK_REAL const pm1o12dz2 = -0.0833333333333333333333333333333*INV(SQR(dz)); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_BSSN_convertToADMBaseDtLapseShiftBoundary, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + CCTK_REAL AL = A[index]; + CCTK_REAL alphaL = alpha[index]; + CCTK_REAL B1L = B1[index]; + CCTK_REAL B2L = B2[index]; + CCTK_REAL B3L = B3[index]; + CCTK_REAL beta1L = beta1[index]; + CCTK_REAL beta2L = beta2[index]; + CCTK_REAL beta3L = beta3[index]; + CCTK_REAL rL = r[index]; + CCTK_REAL trKL = trK[index]; + CCTK_REAL Xt1L = Xt1[index]; + CCTK_REAL Xt2L = Xt2[index]; + CCTK_REAL Xt3L = Xt3[index]; + + /* Include user supplied include files */ + + /* Precompute derivatives */ + + /* Calculate temporaries and grid functions */ + CCTK_REAL eta = fmin(1,INV(rL)*ToReal(SpatialBetaDriverRadius)); + + CCTK_REAL theta = fmin(1,exp(1 - + rL*INV(ToReal(SpatialShiftGammaCoeffRadius)))); + + CCTK_REAL dtalpL = + -(pow(alphaL,ToReal(harmonicN))*ToReal(harmonicF)*(trKL + (AL - + trKL)*ToReal(LapseACoeff))); + + CCTK_REAL dtbetaxL = theta*(Xt1L + beta1L*eta*ToReal(BetaDriver)*(-1 + + ToReal(ShiftBCoeff)) + (B1L - + Xt1L)*ToReal(ShiftBCoeff))*ToReal(ShiftGammaCoeff); + + CCTK_REAL dtbetayL = theta*(Xt2L + beta2L*eta*ToReal(BetaDriver)*(-1 + + ToReal(ShiftBCoeff)) + (B2L - + Xt2L)*ToReal(ShiftBCoeff))*ToReal(ShiftGammaCoeff); + + CCTK_REAL dtbetazL = theta*(Xt3L + beta3L*eta*ToReal(BetaDriver)*(-1 + + ToReal(ShiftBCoeff)) + (B3L - + Xt3L)*ToReal(ShiftBCoeff))*ToReal(ShiftGammaCoeff); + + + /* Copy local copies back to grid functions */ + dtalp[index] = dtalpL; + dtbetax[index] = dtbetaxL; + dtbetay[index] = dtbetayL; + dtbetaz[index] = dtbetazL; + } + LC_ENDLOOP3 (ML_BSSN_convertToADMBaseDtLapseShiftBoundary); +} + +extern "C" void ML_BSSN_convertToADMBaseDtLapseShiftBoundary(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverBoundaryWithGhosts(cctkGH, &ML_BSSN_convertToADMBaseDtLapseShiftBoundary_Body); +} diff --git a/ML_BSSN/src/ML_BSSN_convertToADMBaseFakeDtLapseShift.cc b/ML_BSSN/src/ML_BSSN_convertToADMBaseFakeDtLapseShift.cc new file mode 100644 index 0000000..dbbbe36 --- /dev/null +++ b/ML_BSSN/src/ML_BSSN_convertToADMBaseFakeDtLapseShift.cc @@ -0,0 +1,150 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +static void ML_BSSN_convertToADMBaseFakeDtLapseShift_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_BSSN_convertToADMBaseFakeDtLapseShift_Body"); + } + + if (cctk_iteration % ML_BSSN_convertToADMBaseFakeDtLapseShift_calc_every != ML_BSSN_convertToADMBaseFakeDtLapseShift_calc_offset) + { + return; + } + + const char *groups[] = {"ADMBase::dtlapse","ADMBase::dtshift","grid::coordinates","Grid::coordinates","ML_BSSN::ML_dtlapse","ML_BSSN::ML_dtshift","ML_BSSN::ML_Gamma","ML_BSSN::ML_lapse","ML_BSSN::ML_shift","ML_BSSN::ML_trace_curv"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_BSSN_convertToADMBaseFakeDtLapseShift", 10, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o12dx = 0.0833333333333333333333333333333*INV(dx); + CCTK_REAL const p1o12dy = 0.0833333333333333333333333333333*INV(dy); + CCTK_REAL const p1o12dz = 0.0833333333333333333333333333333*INV(dz); + CCTK_REAL const p1o144dxdy = 0.00694444444444444444444444444444*INV(dx)*INV(dy); + CCTK_REAL const p1o144dxdz = 0.00694444444444444444444444444444*INV(dx)*INV(dz); + CCTK_REAL const p1o144dydz = 0.00694444444444444444444444444444*INV(dy)*INV(dz); + CCTK_REAL const p1o24dx = 0.0416666666666666666666666666667*INV(dx); + CCTK_REAL const p1o24dy = 0.0416666666666666666666666666667*INV(dy); + CCTK_REAL const p1o24dz = 0.0416666666666666666666666666667*INV(dz); + CCTK_REAL const p1o64dx = 0.015625*INV(dx); + CCTK_REAL const p1o64dy = 0.015625*INV(dy); + CCTK_REAL const p1o64dz = 0.015625*INV(dz); + CCTK_REAL const p1odx = INV(dx); + CCTK_REAL const p1ody = INV(dy); + CCTK_REAL const p1odz = INV(dz); + CCTK_REAL const pm1o12dx2 = -0.0833333333333333333333333333333*INV(SQR(dx)); + CCTK_REAL const pm1o12dy2 = -0.0833333333333333333333333333333*INV(SQR(dy)); + CCTK_REAL const pm1o12dz2 = -0.0833333333333333333333333333333*INV(SQR(dz)); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_BSSN_convertToADMBaseFakeDtLapseShift, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + CCTK_REAL AL = A[index]; + CCTK_REAL alphaL = alpha[index]; + CCTK_REAL B1L = B1[index]; + CCTK_REAL B2L = B2[index]; + CCTK_REAL B3L = B3[index]; + CCTK_REAL beta1L = beta1[index]; + CCTK_REAL beta2L = beta2[index]; + CCTK_REAL beta3L = beta3[index]; + CCTK_REAL rL = r[index]; + CCTK_REAL trKL = trK[index]; + CCTK_REAL Xt1L = Xt1[index]; + CCTK_REAL Xt2L = Xt2[index]; + CCTK_REAL Xt3L = Xt3[index]; + + /* Include user supplied include files */ + + /* Precompute derivatives */ + + /* Calculate temporaries and grid functions */ + CCTK_REAL eta = fmin(1,INV(rL)*ToReal(SpatialBetaDriverRadius)); + + CCTK_REAL theta = fmin(1,exp(1 - + rL*INV(ToReal(SpatialShiftGammaCoeffRadius)))); + + CCTK_REAL dtalpL = + -(pow(alphaL,ToReal(harmonicN))*ToReal(harmonicF)*(trKL + (AL - + trKL)*ToReal(LapseACoeff))); + + CCTK_REAL dtbetaxL = theta*(Xt1L + beta1L*eta*ToReal(BetaDriver)*(-1 + + ToReal(ShiftBCoeff)) + (B1L - + Xt1L)*ToReal(ShiftBCoeff))*ToReal(ShiftGammaCoeff); + + CCTK_REAL dtbetayL = theta*(Xt2L + beta2L*eta*ToReal(BetaDriver)*(-1 + + ToReal(ShiftBCoeff)) + (B2L - + Xt2L)*ToReal(ShiftBCoeff))*ToReal(ShiftGammaCoeff); + + CCTK_REAL dtbetazL = theta*(Xt3L + beta3L*eta*ToReal(BetaDriver)*(-1 + + ToReal(ShiftBCoeff)) + (B3L - + Xt3L)*ToReal(ShiftBCoeff))*ToReal(ShiftGammaCoeff); + + + /* Copy local copies back to grid functions */ + dtalp[index] = dtalpL; + dtbetax[index] = dtbetaxL; + dtbetay[index] = dtbetayL; + dtbetaz[index] = dtbetazL; + } + LC_ENDLOOP3 (ML_BSSN_convertToADMBaseFakeDtLapseShift); +} + +extern "C" void ML_BSSN_convertToADMBaseFakeDtLapseShift(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverEverything(cctkGH, &ML_BSSN_convertToADMBaseFakeDtLapseShift_Body); +} diff --git a/ML_BSSN/src/ML_BSSN_enforce.cc b/ML_BSSN/src/ML_BSSN_enforce.cc new file mode 100644 index 0000000..54d04bc --- /dev/null +++ b/ML_BSSN/src/ML_BSSN_enforce.cc @@ -0,0 +1,163 @@ +/* File produced by Kranc */ + +#define KRANC_C + +#include <assert.h> +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include "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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +static void ML_BSSN_enforce_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_BSSN_enforce_Body"); + } + + if (cctk_iteration % ML_BSSN_enforce_calc_every != ML_BSSN_enforce_calc_offset) + { + return; + } + + const char *groups[] = {"ML_BSSN::ML_curv","ML_BSSN::ML_lapse","ML_BSSN::ML_metric"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_BSSN_enforce", 3, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o12dx = 0.0833333333333333333333333333333*INV(dx); + CCTK_REAL const p1o12dy = 0.0833333333333333333333333333333*INV(dy); + CCTK_REAL const p1o12dz = 0.0833333333333333333333333333333*INV(dz); + CCTK_REAL const p1o144dxdy = 0.00694444444444444444444444444444*INV(dx)*INV(dy); + CCTK_REAL const p1o144dxdz = 0.00694444444444444444444444444444*INV(dx)*INV(dz); + CCTK_REAL const p1o144dydz = 0.00694444444444444444444444444444*INV(dy)*INV(dz); + CCTK_REAL const p1o24dx = 0.0416666666666666666666666666667*INV(dx); + CCTK_REAL const p1o24dy = 0.0416666666666666666666666666667*INV(dy); + CCTK_REAL const p1o24dz = 0.0416666666666666666666666666667*INV(dz); + CCTK_REAL const p1o64dx = 0.015625*INV(dx); + CCTK_REAL const p1o64dy = 0.015625*INV(dy); + CCTK_REAL const p1o64dz = 0.015625*INV(dz); + CCTK_REAL const p1odx = INV(dx); + CCTK_REAL const p1ody = INV(dy); + CCTK_REAL const p1odz = INV(dz); + CCTK_REAL const pm1o12dx2 = -0.0833333333333333333333333333333*INV(SQR(dx)); + CCTK_REAL const pm1o12dy2 = -0.0833333333333333333333333333333*INV(SQR(dy)); + CCTK_REAL const pm1o12dz2 = -0.0833333333333333333333333333333*INV(SQR(dz)); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_BSSN_enforce, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + CCTK_REAL alphaL = alpha[index]; + CCTK_REAL At11L = At11[index]; + CCTK_REAL At12L = At12[index]; + CCTK_REAL At13L = At13[index]; + CCTK_REAL At22L = At22[index]; + CCTK_REAL At23L = At23[index]; + CCTK_REAL At33L = At33[index]; + CCTK_REAL gt11L = gt11[index]; + CCTK_REAL gt12L = gt12[index]; + CCTK_REAL gt13L = gt13[index]; + CCTK_REAL gt22L = gt22[index]; + CCTK_REAL gt23L = gt23[index]; + CCTK_REAL gt33L = gt33[index]; + + /* Include user supplied include files */ + + /* Precompute derivatives */ + + /* Calculate temporaries and grid functions */ + CCTK_REAL detgt = 1; + + CCTK_REAL gtu11 = INV(detgt)*(gt22L*gt33L - SQR(gt23L)); + + CCTK_REAL gtu12 = (gt13L*gt23L - gt12L*gt33L)*INV(detgt); + + CCTK_REAL gtu13 = (-(gt13L*gt22L) + gt12L*gt23L)*INV(detgt); + + CCTK_REAL gtu22 = INV(detgt)*(gt11L*gt33L - SQR(gt13L)); + + CCTK_REAL gtu23 = (gt12L*gt13L - gt11L*gt23L)*INV(detgt); + + CCTK_REAL gtu33 = INV(detgt)*(gt11L*gt22L - SQR(gt12L)); + + CCTK_REAL trAt = At11L*gtu11 + At22L*gtu22 + 2*(At12L*gtu12 + + At13L*gtu13 + At23L*gtu23) + At33L*gtu33; + + At11L = At11L - 0.333333333333333333333333333333*gt11L*trAt; + + At12L = At12L - 0.333333333333333333333333333333*gt12L*trAt; + + At13L = At13L - 0.333333333333333333333333333333*gt13L*trAt; + + At22L = At22L - 0.333333333333333333333333333333*gt22L*trAt; + + At23L = At23L - 0.333333333333333333333333333333*gt23L*trAt; + + At33L = At33L - 0.333333333333333333333333333333*gt33L*trAt; + + alphaL = fmax(alphaL,ToReal(MinimumLapse)); + + + /* Copy local copies back to grid functions */ + alpha[index] = alphaL; + At11[index] = At11L; + At12[index] = At12L; + At13[index] = At13L; + At22[index] = At22L; + At23[index] = At23L; + At33[index] = At33L; + } + LC_ENDLOOP3 (ML_BSSN_enforce); +} + +extern "C" void ML_BSSN_enforce(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverEverything(cctkGH, &ML_BSSN_enforce_Body); +} diff --git a/ML_BSSN/src/RegisterMoL.cc b/ML_BSSN/src/RegisterMoL.cc new file mode 100644 index 0000000..79b1811 --- /dev/null +++ b/ML_BSSN/src/RegisterMoL.cc @@ -0,0 +1,41 @@ +/* File produced by Kranc */ + +#include "cctk.h" +#include "cctk_Arguments.h" +#include "cctk_Parameters.h" + +extern "C" void ML_BSSN_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_BSSN::At11"), CCTK_VarIndex("ML_BSSN::At11rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN::At12"), CCTK_VarIndex("ML_BSSN::At12rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN::At13"), CCTK_VarIndex("ML_BSSN::At13rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN::At22"), CCTK_VarIndex("ML_BSSN::At22rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN::At23"), CCTK_VarIndex("ML_BSSN::At23rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN::At33"), CCTK_VarIndex("ML_BSSN::At33rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN::A"), CCTK_VarIndex("ML_BSSN::Arhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN::B1"), CCTK_VarIndex("ML_BSSN::B1rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN::B2"), CCTK_VarIndex("ML_BSSN::B2rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN::B3"), CCTK_VarIndex("ML_BSSN::B3rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN::Xt1"), CCTK_VarIndex("ML_BSSN::Xt1rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN::Xt2"), CCTK_VarIndex("ML_BSSN::Xt2rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN::Xt3"), CCTK_VarIndex("ML_BSSN::Xt3rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN::alpha"), CCTK_VarIndex("ML_BSSN::alpharhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN::phi"), CCTK_VarIndex("ML_BSSN::phirhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN::gt11"), CCTK_VarIndex("ML_BSSN::gt11rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN::gt12"), CCTK_VarIndex("ML_BSSN::gt12rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN::gt13"), CCTK_VarIndex("ML_BSSN::gt13rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN::gt22"), CCTK_VarIndex("ML_BSSN::gt22rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN::gt23"), CCTK_VarIndex("ML_BSSN::gt23rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN::gt33"), CCTK_VarIndex("ML_BSSN::gt33rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN::beta1"), CCTK_VarIndex("ML_BSSN::beta1rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN::beta2"), CCTK_VarIndex("ML_BSSN::beta2rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN::beta3"), CCTK_VarIndex("ML_BSSN::beta3rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN::trK"), CCTK_VarIndex("ML_BSSN::trKrhs")); + return; +} diff --git a/ML_BSSN/src/RegisterSymmetries.cc b/ML_BSSN/src/RegisterSymmetries.cc new file mode 100644 index 0000000..6cdcc39 --- /dev/null +++ b/ML_BSSN/src/RegisterSymmetries.cc @@ -0,0 +1,189 @@ +/* File produced by Kranc */ + +#include "cctk.h" +#include "cctk_Arguments.h" +#include "cctk_Parameters.h" +#include "Symmetry.h" + +extern "C" void ML_BSSN_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_BSSN::At11"); + + sym[0] = -1; + sym[1] = -1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN::At12"); + + sym[0] = -1; + sym[1] = 1; + sym[2] = -1; + SetCartSymVN(cctkGH, sym, "ML_BSSN::At13"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN::At22"); + + sym[0] = 1; + sym[1] = -1; + sym[2] = -1; + SetCartSymVN(cctkGH, sym, "ML_BSSN::At23"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN::At33"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN::A"); + + sym[0] = -1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN::B1"); + + sym[0] = 1; + sym[1] = -1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN::B2"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = -1; + SetCartSymVN(cctkGH, sym, "ML_BSSN::B3"); + + sym[0] = -1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN::Xt1"); + + sym[0] = 1; + sym[1] = -1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN::Xt2"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = -1; + SetCartSymVN(cctkGH, sym, "ML_BSSN::Xt3"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN::alpha"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN::phi"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN::gt11"); + + sym[0] = -1; + sym[1] = -1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN::gt12"); + + sym[0] = -1; + sym[1] = 1; + sym[2] = -1; + SetCartSymVN(cctkGH, sym, "ML_BSSN::gt13"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN::gt22"); + + sym[0] = 1; + sym[1] = -1; + sym[2] = -1; + SetCartSymVN(cctkGH, sym, "ML_BSSN::gt23"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN::gt33"); + + sym[0] = -1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN::beta1"); + + sym[0] = 1; + sym[1] = -1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN::beta2"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = -1; + SetCartSymVN(cctkGH, sym, "ML_BSSN::beta3"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN::trK"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN::cS"); + + sym[0] = -1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN::cXt1"); + + sym[0] = 1; + sym[1] = -1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN::cXt2"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = -1; + SetCartSymVN(cctkGH, sym, "ML_BSSN::cXt3"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN::cA"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN::H"); + + sym[0] = -1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN::M1"); + + sym[0] = 1; + sym[1] = -1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN::M2"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = -1; + SetCartSymVN(cctkGH, sym, "ML_BSSN::M3"); + +} diff --git a/ML_BSSN/src/Startup.cc b/ML_BSSN/src/Startup.cc new file mode 100644 index 0000000..3faa6b4 --- /dev/null +++ b/ML_BSSN/src/Startup.cc @@ -0,0 +1,10 @@ +/* File produced by Kranc */ + +#include "cctk.h" + +extern "C" int ML_BSSN_Startup(void) +{ + const char * banner = "ML_BSSN"; + CCTK_RegisterBanner(banner); + return 0; +} diff --git a/ML_BSSN_MP/src/Boundaries.cc b/ML_BSSN_MP/src/Boundaries.cc new file mode 100644 index 0000000..5328301 --- /dev/null +++ b/ML_BSSN_MP/src/Boundaries.cc @@ -0,0 +1,1809 @@ +/* File produced by Kranc */ + +#include "cctk.h" +#include "cctk_Arguments.h" +#include "cctk_Parameters.h" +#include "cctk_Faces.h" +#include "util_Table.h" +#include "Symmetry.h" + + +/* the boundary treatment is split into 3 steps: */ +/* 1. excision */ +/* 2. symmetries */ +/* 3. "other" boundary conditions, e.g. radiative */ + +/* to simplify scheduling and testing, the 3 steps */ +/* are currently applied in separate functions */ + + +extern "C" void ML_BSSN_MP_CheckBoundaries(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + return; +} + +extern "C" void ML_BSSN_MP_SelectBoundConds(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT ierr = 0; + + if (CCTK_EQUALS(ML_curv_bound, "none" ) || + CCTK_EQUALS(ML_curv_bound, "static") || + CCTK_EQUALS(ML_curv_bound, "flat" ) || + CCTK_EQUALS(ML_curv_bound, "zero" ) ) + { + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_MP::ML_curv", ML_curv_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register ML_curv_bound BC for ML_BSSN_MP::ML_curv!"); + } + + if (CCTK_EQUALS(ML_dtlapse_bound, "none" ) || + CCTK_EQUALS(ML_dtlapse_bound, "static") || + CCTK_EQUALS(ML_dtlapse_bound, "flat" ) || + CCTK_EQUALS(ML_dtlapse_bound, "zero" ) ) + { + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_MP::ML_dtlapse", ML_dtlapse_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register ML_dtlapse_bound BC for ML_BSSN_MP::ML_dtlapse!"); + } + + if (CCTK_EQUALS(ML_dtshift_bound, "none" ) || + CCTK_EQUALS(ML_dtshift_bound, "static") || + CCTK_EQUALS(ML_dtshift_bound, "flat" ) || + CCTK_EQUALS(ML_dtshift_bound, "zero" ) ) + { + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_MP::ML_dtshift", ML_dtshift_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register ML_dtshift_bound BC for ML_BSSN_MP::ML_dtshift!"); + } + + if (CCTK_EQUALS(ML_Gamma_bound, "none" ) || + CCTK_EQUALS(ML_Gamma_bound, "static") || + CCTK_EQUALS(ML_Gamma_bound, "flat" ) || + CCTK_EQUALS(ML_Gamma_bound, "zero" ) ) + { + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_MP::ML_Gamma", ML_Gamma_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register ML_Gamma_bound BC for ML_BSSN_MP::ML_Gamma!"); + } + + if (CCTK_EQUALS(ML_lapse_bound, "none" ) || + CCTK_EQUALS(ML_lapse_bound, "static") || + CCTK_EQUALS(ML_lapse_bound, "flat" ) || + CCTK_EQUALS(ML_lapse_bound, "zero" ) ) + { + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_MP::ML_lapse", ML_lapse_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register ML_lapse_bound BC for ML_BSSN_MP::ML_lapse!"); + } + + if (CCTK_EQUALS(ML_log_confac_bound, "none" ) || + CCTK_EQUALS(ML_log_confac_bound, "static") || + CCTK_EQUALS(ML_log_confac_bound, "flat" ) || + CCTK_EQUALS(ML_log_confac_bound, "zero" ) ) + { + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_MP::ML_log_confac", ML_log_confac_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register ML_log_confac_bound BC for ML_BSSN_MP::ML_log_confac!"); + } + + if (CCTK_EQUALS(ML_metric_bound, "none" ) || + CCTK_EQUALS(ML_metric_bound, "static") || + CCTK_EQUALS(ML_metric_bound, "flat" ) || + CCTK_EQUALS(ML_metric_bound, "zero" ) ) + { + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_MP::ML_metric", ML_metric_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register ML_metric_bound BC for ML_BSSN_MP::ML_metric!"); + } + + if (CCTK_EQUALS(ML_shift_bound, "none" ) || + CCTK_EQUALS(ML_shift_bound, "static") || + CCTK_EQUALS(ML_shift_bound, "flat" ) || + CCTK_EQUALS(ML_shift_bound, "zero" ) ) + { + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_MP::ML_shift", ML_shift_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register ML_shift_bound BC for ML_BSSN_MP::ML_shift!"); + } + + if (CCTK_EQUALS(ML_trace_curv_bound, "none" ) || + CCTK_EQUALS(ML_trace_curv_bound, "static") || + CCTK_EQUALS(ML_trace_curv_bound, "flat" ) || + CCTK_EQUALS(ML_trace_curv_bound, "zero" ) ) + { + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_MP::ML_trace_curv", ML_trace_curv_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register ML_trace_curv_bound BC for ML_BSSN_MP::ML_trace_curv!"); + } + + if (CCTK_EQUALS(At11_bound, "none" ) || + CCTK_EQUALS(At11_bound, "static") || + CCTK_EQUALS(At11_bound, "flat" ) || + CCTK_EQUALS(At11_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_MP::At11", At11_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register At11_bound BC for ML_BSSN_MP::At11!"); + } + + if (CCTK_EQUALS(At12_bound, "none" ) || + CCTK_EQUALS(At12_bound, "static") || + CCTK_EQUALS(At12_bound, "flat" ) || + CCTK_EQUALS(At12_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_MP::At12", At12_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register At12_bound BC for ML_BSSN_MP::At12!"); + } + + if (CCTK_EQUALS(At13_bound, "none" ) || + CCTK_EQUALS(At13_bound, "static") || + CCTK_EQUALS(At13_bound, "flat" ) || + CCTK_EQUALS(At13_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_MP::At13", At13_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register At13_bound BC for ML_BSSN_MP::At13!"); + } + + if (CCTK_EQUALS(At22_bound, "none" ) || + CCTK_EQUALS(At22_bound, "static") || + CCTK_EQUALS(At22_bound, "flat" ) || + CCTK_EQUALS(At22_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_MP::At22", At22_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register At22_bound BC for ML_BSSN_MP::At22!"); + } + + if (CCTK_EQUALS(At23_bound, "none" ) || + CCTK_EQUALS(At23_bound, "static") || + CCTK_EQUALS(At23_bound, "flat" ) || + CCTK_EQUALS(At23_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_MP::At23", At23_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register At23_bound BC for ML_BSSN_MP::At23!"); + } + + if (CCTK_EQUALS(At33_bound, "none" ) || + CCTK_EQUALS(At33_bound, "static") || + CCTK_EQUALS(At33_bound, "flat" ) || + CCTK_EQUALS(At33_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_MP::At33", At33_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register At33_bound BC for ML_BSSN_MP::At33!"); + } + + if (CCTK_EQUALS(A_bound, "none" ) || + CCTK_EQUALS(A_bound, "static") || + CCTK_EQUALS(A_bound, "flat" ) || + CCTK_EQUALS(A_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_MP::A", A_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register A_bound BC for ML_BSSN_MP::A!"); + } + + if (CCTK_EQUALS(B1_bound, "none" ) || + CCTK_EQUALS(B1_bound, "static") || + CCTK_EQUALS(B1_bound, "flat" ) || + CCTK_EQUALS(B1_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_MP::B1", B1_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register B1_bound BC for ML_BSSN_MP::B1!"); + } + + if (CCTK_EQUALS(B2_bound, "none" ) || + CCTK_EQUALS(B2_bound, "static") || + CCTK_EQUALS(B2_bound, "flat" ) || + CCTK_EQUALS(B2_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_MP::B2", B2_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register B2_bound BC for ML_BSSN_MP::B2!"); + } + + if (CCTK_EQUALS(B3_bound, "none" ) || + CCTK_EQUALS(B3_bound, "static") || + CCTK_EQUALS(B3_bound, "flat" ) || + CCTK_EQUALS(B3_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_MP::B3", B3_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register B3_bound BC for ML_BSSN_MP::B3!"); + } + + if (CCTK_EQUALS(Xt1_bound, "none" ) || + CCTK_EQUALS(Xt1_bound, "static") || + CCTK_EQUALS(Xt1_bound, "flat" ) || + CCTK_EQUALS(Xt1_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_MP::Xt1", Xt1_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register Xt1_bound BC for ML_BSSN_MP::Xt1!"); + } + + if (CCTK_EQUALS(Xt2_bound, "none" ) || + CCTK_EQUALS(Xt2_bound, "static") || + CCTK_EQUALS(Xt2_bound, "flat" ) || + CCTK_EQUALS(Xt2_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_MP::Xt2", Xt2_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register Xt2_bound BC for ML_BSSN_MP::Xt2!"); + } + + if (CCTK_EQUALS(Xt3_bound, "none" ) || + CCTK_EQUALS(Xt3_bound, "static") || + CCTK_EQUALS(Xt3_bound, "flat" ) || + CCTK_EQUALS(Xt3_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_MP::Xt3", Xt3_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register Xt3_bound BC for ML_BSSN_MP::Xt3!"); + } + + if (CCTK_EQUALS(alpha_bound, "none" ) || + CCTK_EQUALS(alpha_bound, "static") || + CCTK_EQUALS(alpha_bound, "flat" ) || + CCTK_EQUALS(alpha_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_MP::alpha", alpha_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register alpha_bound BC for ML_BSSN_MP::alpha!"); + } + + if (CCTK_EQUALS(phi_bound, "none" ) || + CCTK_EQUALS(phi_bound, "static") || + CCTK_EQUALS(phi_bound, "flat" ) || + CCTK_EQUALS(phi_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_MP::phi", phi_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register phi_bound BC for ML_BSSN_MP::phi!"); + } + + if (CCTK_EQUALS(gt11_bound, "none" ) || + CCTK_EQUALS(gt11_bound, "static") || + CCTK_EQUALS(gt11_bound, "flat" ) || + CCTK_EQUALS(gt11_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_MP::gt11", gt11_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register gt11_bound BC for ML_BSSN_MP::gt11!"); + } + + if (CCTK_EQUALS(gt12_bound, "none" ) || + CCTK_EQUALS(gt12_bound, "static") || + CCTK_EQUALS(gt12_bound, "flat" ) || + CCTK_EQUALS(gt12_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_MP::gt12", gt12_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register gt12_bound BC for ML_BSSN_MP::gt12!"); + } + + if (CCTK_EQUALS(gt13_bound, "none" ) || + CCTK_EQUALS(gt13_bound, "static") || + CCTK_EQUALS(gt13_bound, "flat" ) || + CCTK_EQUALS(gt13_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_MP::gt13", gt13_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register gt13_bound BC for ML_BSSN_MP::gt13!"); + } + + if (CCTK_EQUALS(gt22_bound, "none" ) || + CCTK_EQUALS(gt22_bound, "static") || + CCTK_EQUALS(gt22_bound, "flat" ) || + CCTK_EQUALS(gt22_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_MP::gt22", gt22_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register gt22_bound BC for ML_BSSN_MP::gt22!"); + } + + if (CCTK_EQUALS(gt23_bound, "none" ) || + CCTK_EQUALS(gt23_bound, "static") || + CCTK_EQUALS(gt23_bound, "flat" ) || + CCTK_EQUALS(gt23_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_MP::gt23", gt23_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register gt23_bound BC for ML_BSSN_MP::gt23!"); + } + + if (CCTK_EQUALS(gt33_bound, "none" ) || + CCTK_EQUALS(gt33_bound, "static") || + CCTK_EQUALS(gt33_bound, "flat" ) || + CCTK_EQUALS(gt33_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_MP::gt33", gt33_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register gt33_bound BC for ML_BSSN_MP::gt33!"); + } + + if (CCTK_EQUALS(beta1_bound, "none" ) || + CCTK_EQUALS(beta1_bound, "static") || + CCTK_EQUALS(beta1_bound, "flat" ) || + CCTK_EQUALS(beta1_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_MP::beta1", beta1_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register beta1_bound BC for ML_BSSN_MP::beta1!"); + } + + if (CCTK_EQUALS(beta2_bound, "none" ) || + CCTK_EQUALS(beta2_bound, "static") || + CCTK_EQUALS(beta2_bound, "flat" ) || + CCTK_EQUALS(beta2_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_MP::beta2", beta2_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register beta2_bound BC for ML_BSSN_MP::beta2!"); + } + + if (CCTK_EQUALS(beta3_bound, "none" ) || + CCTK_EQUALS(beta3_bound, "static") || + CCTK_EQUALS(beta3_bound, "flat" ) || + CCTK_EQUALS(beta3_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_MP::beta3", beta3_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register beta3_bound BC for ML_BSSN_MP::beta3!"); + } + + if (CCTK_EQUALS(trK_bound, "none" ) || + CCTK_EQUALS(trK_bound, "static") || + CCTK_EQUALS(trK_bound, "flat" ) || + CCTK_EQUALS(trK_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_MP::trK", trK_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register trK_bound BC for ML_BSSN_MP::trK!"); + } + + if (CCTK_EQUALS(ML_curv_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_ML_curv_bound = -1; + if (handle_ML_curv_bound < 0) handle_ML_curv_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_curv_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_curv_bound , ML_curv_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_ML_curv_bound ,ML_curv_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_curv_bound, + "ML_BSSN_MP::ML_curv", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_MP::ML_curv!"); + + } + + if (CCTK_EQUALS(ML_dtlapse_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_ML_dtlapse_bound = -1; + if (handle_ML_dtlapse_bound < 0) handle_ML_dtlapse_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_dtlapse_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_dtlapse_bound , ML_dtlapse_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_ML_dtlapse_bound ,ML_dtlapse_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_dtlapse_bound, + "ML_BSSN_MP::ML_dtlapse", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_MP::ML_dtlapse!"); + + } + + if (CCTK_EQUALS(ML_dtshift_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_ML_dtshift_bound = -1; + if (handle_ML_dtshift_bound < 0) handle_ML_dtshift_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_dtshift_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_dtshift_bound , ML_dtshift_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_ML_dtshift_bound ,ML_dtshift_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_dtshift_bound, + "ML_BSSN_MP::ML_dtshift", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_MP::ML_dtshift!"); + + } + + if (CCTK_EQUALS(ML_Gamma_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_ML_Gamma_bound = -1; + if (handle_ML_Gamma_bound < 0) handle_ML_Gamma_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_Gamma_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_Gamma_bound , ML_Gamma_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_ML_Gamma_bound ,ML_Gamma_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_Gamma_bound, + "ML_BSSN_MP::ML_Gamma", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_MP::ML_Gamma!"); + + } + + if (CCTK_EQUALS(ML_lapse_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_ML_lapse_bound = -1; + if (handle_ML_lapse_bound < 0) handle_ML_lapse_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_lapse_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_lapse_bound , ML_lapse_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_ML_lapse_bound ,ML_lapse_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_lapse_bound, + "ML_BSSN_MP::ML_lapse", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_MP::ML_lapse!"); + + } + + if (CCTK_EQUALS(ML_log_confac_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_ML_log_confac_bound = -1; + if (handle_ML_log_confac_bound < 0) handle_ML_log_confac_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_log_confac_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_log_confac_bound , ML_log_confac_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_ML_log_confac_bound ,ML_log_confac_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_log_confac_bound, + "ML_BSSN_MP::ML_log_confac", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_MP::ML_log_confac!"); + + } + + if (CCTK_EQUALS(ML_metric_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_ML_metric_bound = -1; + if (handle_ML_metric_bound < 0) handle_ML_metric_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_metric_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_metric_bound , ML_metric_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_ML_metric_bound ,ML_metric_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_metric_bound, + "ML_BSSN_MP::ML_metric", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_MP::ML_metric!"); + + } + + if (CCTK_EQUALS(ML_shift_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_ML_shift_bound = -1; + if (handle_ML_shift_bound < 0) handle_ML_shift_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_shift_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_shift_bound , ML_shift_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_ML_shift_bound ,ML_shift_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_shift_bound, + "ML_BSSN_MP::ML_shift", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_MP::ML_shift!"); + + } + + if (CCTK_EQUALS(ML_trace_curv_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_ML_trace_curv_bound = -1; + if (handle_ML_trace_curv_bound < 0) handle_ML_trace_curv_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_trace_curv_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_trace_curv_bound , ML_trace_curv_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_ML_trace_curv_bound ,ML_trace_curv_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_trace_curv_bound, + "ML_BSSN_MP::ML_trace_curv", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_MP::ML_trace_curv!"); + + } + + if (CCTK_EQUALS(At11_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_At11_bound = -1; + if (handle_At11_bound < 0) handle_At11_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_At11_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_At11_bound , At11_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_At11_bound ,At11_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_At11_bound, + "ML_BSSN_MP::At11", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_MP::At11!"); + + } + + if (CCTK_EQUALS(At12_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_At12_bound = -1; + if (handle_At12_bound < 0) handle_At12_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_At12_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_At12_bound , At12_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_At12_bound ,At12_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_At12_bound, + "ML_BSSN_MP::At12", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_MP::At12!"); + + } + + if (CCTK_EQUALS(At13_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_At13_bound = -1; + if (handle_At13_bound < 0) handle_At13_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_At13_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_At13_bound , At13_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_At13_bound ,At13_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_At13_bound, + "ML_BSSN_MP::At13", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_MP::At13!"); + + } + + if (CCTK_EQUALS(At22_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_At22_bound = -1; + if (handle_At22_bound < 0) handle_At22_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_At22_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_At22_bound , At22_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_At22_bound ,At22_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_At22_bound, + "ML_BSSN_MP::At22", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_MP::At22!"); + + } + + if (CCTK_EQUALS(At23_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_At23_bound = -1; + if (handle_At23_bound < 0) handle_At23_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_At23_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_At23_bound , At23_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_At23_bound ,At23_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_At23_bound, + "ML_BSSN_MP::At23", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_MP::At23!"); + + } + + if (CCTK_EQUALS(At33_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_At33_bound = -1; + if (handle_At33_bound < 0) handle_At33_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_At33_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_At33_bound , At33_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_At33_bound ,At33_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_At33_bound, + "ML_BSSN_MP::At33", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_MP::At33!"); + + } + + if (CCTK_EQUALS(A_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_A_bound = -1; + if (handle_A_bound < 0) handle_A_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_A_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_A_bound , A_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_A_bound ,A_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_A_bound, + "ML_BSSN_MP::A", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_MP::A!"); + + } + + if (CCTK_EQUALS(B1_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_B1_bound = -1; + if (handle_B1_bound < 0) handle_B1_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_B1_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_B1_bound , B1_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_B1_bound ,B1_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_B1_bound, + "ML_BSSN_MP::B1", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_MP::B1!"); + + } + + if (CCTK_EQUALS(B2_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_B2_bound = -1; + if (handle_B2_bound < 0) handle_B2_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_B2_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_B2_bound , B2_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_B2_bound ,B2_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_B2_bound, + "ML_BSSN_MP::B2", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_MP::B2!"); + + } + + if (CCTK_EQUALS(B3_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_B3_bound = -1; + if (handle_B3_bound < 0) handle_B3_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_B3_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_B3_bound , B3_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_B3_bound ,B3_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_B3_bound, + "ML_BSSN_MP::B3", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_MP::B3!"); + + } + + if (CCTK_EQUALS(Xt1_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_Xt1_bound = -1; + if (handle_Xt1_bound < 0) handle_Xt1_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_Xt1_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_Xt1_bound , Xt1_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_Xt1_bound ,Xt1_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_Xt1_bound, + "ML_BSSN_MP::Xt1", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_MP::Xt1!"); + + } + + if (CCTK_EQUALS(Xt2_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_Xt2_bound = -1; + if (handle_Xt2_bound < 0) handle_Xt2_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_Xt2_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_Xt2_bound , Xt2_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_Xt2_bound ,Xt2_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_Xt2_bound, + "ML_BSSN_MP::Xt2", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_MP::Xt2!"); + + } + + if (CCTK_EQUALS(Xt3_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_Xt3_bound = -1; + if (handle_Xt3_bound < 0) handle_Xt3_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_Xt3_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_Xt3_bound , Xt3_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_Xt3_bound ,Xt3_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_Xt3_bound, + "ML_BSSN_MP::Xt3", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_MP::Xt3!"); + + } + + if (CCTK_EQUALS(alpha_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_alpha_bound = -1; + if (handle_alpha_bound < 0) handle_alpha_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_alpha_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_alpha_bound , alpha_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_alpha_bound ,alpha_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_alpha_bound, + "ML_BSSN_MP::alpha", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_MP::alpha!"); + + } + + if (CCTK_EQUALS(phi_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_phi_bound = -1; + if (handle_phi_bound < 0) handle_phi_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_phi_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_phi_bound , phi_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_phi_bound ,phi_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_phi_bound, + "ML_BSSN_MP::phi", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_MP::phi!"); + + } + + if (CCTK_EQUALS(gt11_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_gt11_bound = -1; + if (handle_gt11_bound < 0) handle_gt11_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_gt11_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_gt11_bound , gt11_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_gt11_bound ,gt11_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_gt11_bound, + "ML_BSSN_MP::gt11", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_MP::gt11!"); + + } + + if (CCTK_EQUALS(gt12_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_gt12_bound = -1; + if (handle_gt12_bound < 0) handle_gt12_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_gt12_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_gt12_bound , gt12_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_gt12_bound ,gt12_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_gt12_bound, + "ML_BSSN_MP::gt12", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_MP::gt12!"); + + } + + if (CCTK_EQUALS(gt13_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_gt13_bound = -1; + if (handle_gt13_bound < 0) handle_gt13_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_gt13_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_gt13_bound , gt13_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_gt13_bound ,gt13_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_gt13_bound, + "ML_BSSN_MP::gt13", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_MP::gt13!"); + + } + + if (CCTK_EQUALS(gt22_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_gt22_bound = -1; + if (handle_gt22_bound < 0) handle_gt22_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_gt22_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_gt22_bound , gt22_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_gt22_bound ,gt22_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_gt22_bound, + "ML_BSSN_MP::gt22", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_MP::gt22!"); + + } + + if (CCTK_EQUALS(gt23_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_gt23_bound = -1; + if (handle_gt23_bound < 0) handle_gt23_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_gt23_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_gt23_bound , gt23_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_gt23_bound ,gt23_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_gt23_bound, + "ML_BSSN_MP::gt23", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_MP::gt23!"); + + } + + if (CCTK_EQUALS(gt33_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_gt33_bound = -1; + if (handle_gt33_bound < 0) handle_gt33_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_gt33_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_gt33_bound , gt33_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_gt33_bound ,gt33_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_gt33_bound, + "ML_BSSN_MP::gt33", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_MP::gt33!"); + + } + + if (CCTK_EQUALS(beta1_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_beta1_bound = -1; + if (handle_beta1_bound < 0) handle_beta1_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_beta1_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_beta1_bound , beta1_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_beta1_bound ,beta1_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_beta1_bound, + "ML_BSSN_MP::beta1", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_MP::beta1!"); + + } + + if (CCTK_EQUALS(beta2_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_beta2_bound = -1; + if (handle_beta2_bound < 0) handle_beta2_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_beta2_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_beta2_bound , beta2_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_beta2_bound ,beta2_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_beta2_bound, + "ML_BSSN_MP::beta2", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_MP::beta2!"); + + } + + if (CCTK_EQUALS(beta3_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_beta3_bound = -1; + if (handle_beta3_bound < 0) handle_beta3_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_beta3_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_beta3_bound , beta3_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_beta3_bound ,beta3_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_beta3_bound, + "ML_BSSN_MP::beta3", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_MP::beta3!"); + + } + + if (CCTK_EQUALS(trK_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_trK_bound = -1; + if (handle_trK_bound < 0) handle_trK_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_trK_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_trK_bound , trK_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_trK_bound ,trK_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_trK_bound, + "ML_BSSN_MP::trK", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_MP::trK!"); + + } + + if (CCTK_EQUALS(ML_curv_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_ML_curv_bound = -1; + if (handle_ML_curv_bound < 0) handle_ML_curv_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_curv_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_curv_bound ,ML_curv_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_curv_bound, + "ML_BSSN_MP::ML_curv", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Scalar BC for ML_BSSN_MP::ML_curv!"); + + } + + if (CCTK_EQUALS(ML_dtlapse_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_ML_dtlapse_bound = -1; + if (handle_ML_dtlapse_bound < 0) handle_ML_dtlapse_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_dtlapse_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_dtlapse_bound ,ML_dtlapse_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_dtlapse_bound, + "ML_BSSN_MP::ML_dtlapse", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Scalar BC for ML_BSSN_MP::ML_dtlapse!"); + + } + + if (CCTK_EQUALS(ML_dtshift_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_ML_dtshift_bound = -1; + if (handle_ML_dtshift_bound < 0) handle_ML_dtshift_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_dtshift_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_dtshift_bound ,ML_dtshift_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_dtshift_bound, + "ML_BSSN_MP::ML_dtshift", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Scalar BC for ML_BSSN_MP::ML_dtshift!"); + + } + + if (CCTK_EQUALS(ML_Gamma_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_ML_Gamma_bound = -1; + if (handle_ML_Gamma_bound < 0) handle_ML_Gamma_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_Gamma_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_Gamma_bound ,ML_Gamma_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_Gamma_bound, + "ML_BSSN_MP::ML_Gamma", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Scalar BC for ML_BSSN_MP::ML_Gamma!"); + + } + + if (CCTK_EQUALS(ML_lapse_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_ML_lapse_bound = -1; + if (handle_ML_lapse_bound < 0) handle_ML_lapse_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_lapse_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_lapse_bound ,ML_lapse_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_lapse_bound, + "ML_BSSN_MP::ML_lapse", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Scalar BC for ML_BSSN_MP::ML_lapse!"); + + } + + if (CCTK_EQUALS(ML_log_confac_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_ML_log_confac_bound = -1; + if (handle_ML_log_confac_bound < 0) handle_ML_log_confac_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_log_confac_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_log_confac_bound ,ML_log_confac_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_log_confac_bound, + "ML_BSSN_MP::ML_log_confac", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Scalar BC for ML_BSSN_MP::ML_log_confac!"); + + } + + if (CCTK_EQUALS(ML_metric_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_ML_metric_bound = -1; + if (handle_ML_metric_bound < 0) handle_ML_metric_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_metric_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_metric_bound ,ML_metric_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_metric_bound, + "ML_BSSN_MP::ML_metric", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Scalar BC for ML_BSSN_MP::ML_metric!"); + + } + + if (CCTK_EQUALS(ML_shift_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_ML_shift_bound = -1; + if (handle_ML_shift_bound < 0) handle_ML_shift_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_shift_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_shift_bound ,ML_shift_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_shift_bound, + "ML_BSSN_MP::ML_shift", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Scalar BC for ML_BSSN_MP::ML_shift!"); + + } + + if (CCTK_EQUALS(ML_trace_curv_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_ML_trace_curv_bound = -1; + if (handle_ML_trace_curv_bound < 0) handle_ML_trace_curv_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_trace_curv_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_trace_curv_bound ,ML_trace_curv_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_trace_curv_bound, + "ML_BSSN_MP::ML_trace_curv", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Scalar BC for ML_BSSN_MP::ML_trace_curv!"); + + } + + if (CCTK_EQUALS(At11_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_At11_bound = -1; + if (handle_At11_bound < 0) handle_At11_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_At11_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_At11_bound ,At11_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_At11_bound, + "ML_BSSN_MP::At11", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_MP::At11!"); + + } + + if (CCTK_EQUALS(At12_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_At12_bound = -1; + if (handle_At12_bound < 0) handle_At12_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_At12_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_At12_bound ,At12_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_At12_bound, + "ML_BSSN_MP::At12", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_MP::At12!"); + + } + + if (CCTK_EQUALS(At13_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_At13_bound = -1; + if (handle_At13_bound < 0) handle_At13_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_At13_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_At13_bound ,At13_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_At13_bound, + "ML_BSSN_MP::At13", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_MP::At13!"); + + } + + if (CCTK_EQUALS(At22_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_At22_bound = -1; + if (handle_At22_bound < 0) handle_At22_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_At22_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_At22_bound ,At22_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_At22_bound, + "ML_BSSN_MP::At22", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_MP::At22!"); + + } + + if (CCTK_EQUALS(At23_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_At23_bound = -1; + if (handle_At23_bound < 0) handle_At23_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_At23_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_At23_bound ,At23_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_At23_bound, + "ML_BSSN_MP::At23", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_MP::At23!"); + + } + + if (CCTK_EQUALS(At33_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_At33_bound = -1; + if (handle_At33_bound < 0) handle_At33_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_At33_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_At33_bound ,At33_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_At33_bound, + "ML_BSSN_MP::At33", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_MP::At33!"); + + } + + if (CCTK_EQUALS(A_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_A_bound = -1; + if (handle_A_bound < 0) handle_A_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_A_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_A_bound ,A_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_A_bound, + "ML_BSSN_MP::A", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_MP::A!"); + + } + + if (CCTK_EQUALS(B1_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_B1_bound = -1; + if (handle_B1_bound < 0) handle_B1_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_B1_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_B1_bound ,B1_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_B1_bound, + "ML_BSSN_MP::B1", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_MP::B1!"); + + } + + if (CCTK_EQUALS(B2_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_B2_bound = -1; + if (handle_B2_bound < 0) handle_B2_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_B2_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_B2_bound ,B2_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_B2_bound, + "ML_BSSN_MP::B2", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_MP::B2!"); + + } + + if (CCTK_EQUALS(B3_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_B3_bound = -1; + if (handle_B3_bound < 0) handle_B3_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_B3_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_B3_bound ,B3_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_B3_bound, + "ML_BSSN_MP::B3", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_MP::B3!"); + + } + + if (CCTK_EQUALS(Xt1_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_Xt1_bound = -1; + if (handle_Xt1_bound < 0) handle_Xt1_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_Xt1_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_Xt1_bound ,Xt1_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_Xt1_bound, + "ML_BSSN_MP::Xt1", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_MP::Xt1!"); + + } + + if (CCTK_EQUALS(Xt2_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_Xt2_bound = -1; + if (handle_Xt2_bound < 0) handle_Xt2_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_Xt2_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_Xt2_bound ,Xt2_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_Xt2_bound, + "ML_BSSN_MP::Xt2", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_MP::Xt2!"); + + } + + if (CCTK_EQUALS(Xt3_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_Xt3_bound = -1; + if (handle_Xt3_bound < 0) handle_Xt3_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_Xt3_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_Xt3_bound ,Xt3_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_Xt3_bound, + "ML_BSSN_MP::Xt3", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_MP::Xt3!"); + + } + + if (CCTK_EQUALS(alpha_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_alpha_bound = -1; + if (handle_alpha_bound < 0) handle_alpha_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_alpha_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_alpha_bound ,alpha_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_alpha_bound, + "ML_BSSN_MP::alpha", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_MP::alpha!"); + + } + + if (CCTK_EQUALS(phi_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_phi_bound = -1; + if (handle_phi_bound < 0) handle_phi_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_phi_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_phi_bound ,phi_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_phi_bound, + "ML_BSSN_MP::phi", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_MP::phi!"); + + } + + if (CCTK_EQUALS(gt11_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_gt11_bound = -1; + if (handle_gt11_bound < 0) handle_gt11_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_gt11_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_gt11_bound ,gt11_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_gt11_bound, + "ML_BSSN_MP::gt11", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_MP::gt11!"); + + } + + if (CCTK_EQUALS(gt12_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_gt12_bound = -1; + if (handle_gt12_bound < 0) handle_gt12_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_gt12_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_gt12_bound ,gt12_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_gt12_bound, + "ML_BSSN_MP::gt12", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_MP::gt12!"); + + } + + if (CCTK_EQUALS(gt13_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_gt13_bound = -1; + if (handle_gt13_bound < 0) handle_gt13_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_gt13_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_gt13_bound ,gt13_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_gt13_bound, + "ML_BSSN_MP::gt13", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_MP::gt13!"); + + } + + if (CCTK_EQUALS(gt22_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_gt22_bound = -1; + if (handle_gt22_bound < 0) handle_gt22_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_gt22_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_gt22_bound ,gt22_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_gt22_bound, + "ML_BSSN_MP::gt22", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_MP::gt22!"); + + } + + if (CCTK_EQUALS(gt23_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_gt23_bound = -1; + if (handle_gt23_bound < 0) handle_gt23_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_gt23_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_gt23_bound ,gt23_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_gt23_bound, + "ML_BSSN_MP::gt23", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_MP::gt23!"); + + } + + if (CCTK_EQUALS(gt33_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_gt33_bound = -1; + if (handle_gt33_bound < 0) handle_gt33_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_gt33_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_gt33_bound ,gt33_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_gt33_bound, + "ML_BSSN_MP::gt33", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_MP::gt33!"); + + } + + if (CCTK_EQUALS(beta1_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_beta1_bound = -1; + if (handle_beta1_bound < 0) handle_beta1_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_beta1_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_beta1_bound ,beta1_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_beta1_bound, + "ML_BSSN_MP::beta1", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_MP::beta1!"); + + } + + if (CCTK_EQUALS(beta2_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_beta2_bound = -1; + if (handle_beta2_bound < 0) handle_beta2_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_beta2_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_beta2_bound ,beta2_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_beta2_bound, + "ML_BSSN_MP::beta2", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_MP::beta2!"); + + } + + if (CCTK_EQUALS(beta3_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_beta3_bound = -1; + if (handle_beta3_bound < 0) handle_beta3_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_beta3_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_beta3_bound ,beta3_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_beta3_bound, + "ML_BSSN_MP::beta3", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_MP::beta3!"); + + } + + if (CCTK_EQUALS(trK_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_trK_bound = -1; + if (handle_trK_bound < 0) handle_trK_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_trK_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_trK_bound ,trK_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_trK_bound, + "ML_BSSN_MP::trK", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_MP::trK!"); + + } + return; +} + + + +/* template for entries in parameter file: +#$bound$#ML_BSSN_MP::ML_curv_bound = "skip" +#$bound$#ML_BSSN_MP::ML_curv_bound_speed = 1.0 +#$bound$#ML_BSSN_MP::ML_curv_bound_limit = 0.0 +#$bound$#ML_BSSN_MP::ML_curv_bound_scalar = 0.0 + +#$bound$#ML_BSSN_MP::ML_dtlapse_bound = "skip" +#$bound$#ML_BSSN_MP::ML_dtlapse_bound_speed = 1.0 +#$bound$#ML_BSSN_MP::ML_dtlapse_bound_limit = 0.0 +#$bound$#ML_BSSN_MP::ML_dtlapse_bound_scalar = 0.0 + +#$bound$#ML_BSSN_MP::ML_dtshift_bound = "skip" +#$bound$#ML_BSSN_MP::ML_dtshift_bound_speed = 1.0 +#$bound$#ML_BSSN_MP::ML_dtshift_bound_limit = 0.0 +#$bound$#ML_BSSN_MP::ML_dtshift_bound_scalar = 0.0 + +#$bound$#ML_BSSN_MP::ML_Gamma_bound = "skip" +#$bound$#ML_BSSN_MP::ML_Gamma_bound_speed = 1.0 +#$bound$#ML_BSSN_MP::ML_Gamma_bound_limit = 0.0 +#$bound$#ML_BSSN_MP::ML_Gamma_bound_scalar = 0.0 + +#$bound$#ML_BSSN_MP::ML_lapse_bound = "skip" +#$bound$#ML_BSSN_MP::ML_lapse_bound_speed = 1.0 +#$bound$#ML_BSSN_MP::ML_lapse_bound_limit = 0.0 +#$bound$#ML_BSSN_MP::ML_lapse_bound_scalar = 0.0 + +#$bound$#ML_BSSN_MP::ML_log_confac_bound = "skip" +#$bound$#ML_BSSN_MP::ML_log_confac_bound_speed = 1.0 +#$bound$#ML_BSSN_MP::ML_log_confac_bound_limit = 0.0 +#$bound$#ML_BSSN_MP::ML_log_confac_bound_scalar = 0.0 + +#$bound$#ML_BSSN_MP::ML_metric_bound = "skip" +#$bound$#ML_BSSN_MP::ML_metric_bound_speed = 1.0 +#$bound$#ML_BSSN_MP::ML_metric_bound_limit = 0.0 +#$bound$#ML_BSSN_MP::ML_metric_bound_scalar = 0.0 + +#$bound$#ML_BSSN_MP::ML_shift_bound = "skip" +#$bound$#ML_BSSN_MP::ML_shift_bound_speed = 1.0 +#$bound$#ML_BSSN_MP::ML_shift_bound_limit = 0.0 +#$bound$#ML_BSSN_MP::ML_shift_bound_scalar = 0.0 + +#$bound$#ML_BSSN_MP::ML_trace_curv_bound = "skip" +#$bound$#ML_BSSN_MP::ML_trace_curv_bound_speed = 1.0 +#$bound$#ML_BSSN_MP::ML_trace_curv_bound_limit = 0.0 +#$bound$#ML_BSSN_MP::ML_trace_curv_bound_scalar = 0.0 + +#$bound$#ML_BSSN_MP::At11_bound = "skip" +#$bound$#ML_BSSN_MP::At11_bound_speed = 1.0 +#$bound$#ML_BSSN_MP::At11_bound_limit = 0.0 +#$bound$#ML_BSSN_MP::At11_bound_scalar = 0.0 + +#$bound$#ML_BSSN_MP::At12_bound = "skip" +#$bound$#ML_BSSN_MP::At12_bound_speed = 1.0 +#$bound$#ML_BSSN_MP::At12_bound_limit = 0.0 +#$bound$#ML_BSSN_MP::At12_bound_scalar = 0.0 + +#$bound$#ML_BSSN_MP::At13_bound = "skip" +#$bound$#ML_BSSN_MP::At13_bound_speed = 1.0 +#$bound$#ML_BSSN_MP::At13_bound_limit = 0.0 +#$bound$#ML_BSSN_MP::At13_bound_scalar = 0.0 + +#$bound$#ML_BSSN_MP::At22_bound = "skip" +#$bound$#ML_BSSN_MP::At22_bound_speed = 1.0 +#$bound$#ML_BSSN_MP::At22_bound_limit = 0.0 +#$bound$#ML_BSSN_MP::At22_bound_scalar = 0.0 + +#$bound$#ML_BSSN_MP::At23_bound = "skip" +#$bound$#ML_BSSN_MP::At23_bound_speed = 1.0 +#$bound$#ML_BSSN_MP::At23_bound_limit = 0.0 +#$bound$#ML_BSSN_MP::At23_bound_scalar = 0.0 + +#$bound$#ML_BSSN_MP::At33_bound = "skip" +#$bound$#ML_BSSN_MP::At33_bound_speed = 1.0 +#$bound$#ML_BSSN_MP::At33_bound_limit = 0.0 +#$bound$#ML_BSSN_MP::At33_bound_scalar = 0.0 + +#$bound$#ML_BSSN_MP::A_bound = "skip" +#$bound$#ML_BSSN_MP::A_bound_speed = 1.0 +#$bound$#ML_BSSN_MP::A_bound_limit = 0.0 +#$bound$#ML_BSSN_MP::A_bound_scalar = 0.0 + +#$bound$#ML_BSSN_MP::B1_bound = "skip" +#$bound$#ML_BSSN_MP::B1_bound_speed = 1.0 +#$bound$#ML_BSSN_MP::B1_bound_limit = 0.0 +#$bound$#ML_BSSN_MP::B1_bound_scalar = 0.0 + +#$bound$#ML_BSSN_MP::B2_bound = "skip" +#$bound$#ML_BSSN_MP::B2_bound_speed = 1.0 +#$bound$#ML_BSSN_MP::B2_bound_limit = 0.0 +#$bound$#ML_BSSN_MP::B2_bound_scalar = 0.0 + +#$bound$#ML_BSSN_MP::B3_bound = "skip" +#$bound$#ML_BSSN_MP::B3_bound_speed = 1.0 +#$bound$#ML_BSSN_MP::B3_bound_limit = 0.0 +#$bound$#ML_BSSN_MP::B3_bound_scalar = 0.0 + +#$bound$#ML_BSSN_MP::Xt1_bound = "skip" +#$bound$#ML_BSSN_MP::Xt1_bound_speed = 1.0 +#$bound$#ML_BSSN_MP::Xt1_bound_limit = 0.0 +#$bound$#ML_BSSN_MP::Xt1_bound_scalar = 0.0 + +#$bound$#ML_BSSN_MP::Xt2_bound = "skip" +#$bound$#ML_BSSN_MP::Xt2_bound_speed = 1.0 +#$bound$#ML_BSSN_MP::Xt2_bound_limit = 0.0 +#$bound$#ML_BSSN_MP::Xt2_bound_scalar = 0.0 + +#$bound$#ML_BSSN_MP::Xt3_bound = "skip" +#$bound$#ML_BSSN_MP::Xt3_bound_speed = 1.0 +#$bound$#ML_BSSN_MP::Xt3_bound_limit = 0.0 +#$bound$#ML_BSSN_MP::Xt3_bound_scalar = 0.0 + +#$bound$#ML_BSSN_MP::alpha_bound = "skip" +#$bound$#ML_BSSN_MP::alpha_bound_speed = 1.0 +#$bound$#ML_BSSN_MP::alpha_bound_limit = 0.0 +#$bound$#ML_BSSN_MP::alpha_bound_scalar = 0.0 + +#$bound$#ML_BSSN_MP::phi_bound = "skip" +#$bound$#ML_BSSN_MP::phi_bound_speed = 1.0 +#$bound$#ML_BSSN_MP::phi_bound_limit = 0.0 +#$bound$#ML_BSSN_MP::phi_bound_scalar = 0.0 + +#$bound$#ML_BSSN_MP::gt11_bound = "skip" +#$bound$#ML_BSSN_MP::gt11_bound_speed = 1.0 +#$bound$#ML_BSSN_MP::gt11_bound_limit = 0.0 +#$bound$#ML_BSSN_MP::gt11_bound_scalar = 0.0 + +#$bound$#ML_BSSN_MP::gt12_bound = "skip" +#$bound$#ML_BSSN_MP::gt12_bound_speed = 1.0 +#$bound$#ML_BSSN_MP::gt12_bound_limit = 0.0 +#$bound$#ML_BSSN_MP::gt12_bound_scalar = 0.0 + +#$bound$#ML_BSSN_MP::gt13_bound = "skip" +#$bound$#ML_BSSN_MP::gt13_bound_speed = 1.0 +#$bound$#ML_BSSN_MP::gt13_bound_limit = 0.0 +#$bound$#ML_BSSN_MP::gt13_bound_scalar = 0.0 + +#$bound$#ML_BSSN_MP::gt22_bound = "skip" +#$bound$#ML_BSSN_MP::gt22_bound_speed = 1.0 +#$bound$#ML_BSSN_MP::gt22_bound_limit = 0.0 +#$bound$#ML_BSSN_MP::gt22_bound_scalar = 0.0 + +#$bound$#ML_BSSN_MP::gt23_bound = "skip" +#$bound$#ML_BSSN_MP::gt23_bound_speed = 1.0 +#$bound$#ML_BSSN_MP::gt23_bound_limit = 0.0 +#$bound$#ML_BSSN_MP::gt23_bound_scalar = 0.0 + +#$bound$#ML_BSSN_MP::gt33_bound = "skip" +#$bound$#ML_BSSN_MP::gt33_bound_speed = 1.0 +#$bound$#ML_BSSN_MP::gt33_bound_limit = 0.0 +#$bound$#ML_BSSN_MP::gt33_bound_scalar = 0.0 + +#$bound$#ML_BSSN_MP::beta1_bound = "skip" +#$bound$#ML_BSSN_MP::beta1_bound_speed = 1.0 +#$bound$#ML_BSSN_MP::beta1_bound_limit = 0.0 +#$bound$#ML_BSSN_MP::beta1_bound_scalar = 0.0 + +#$bound$#ML_BSSN_MP::beta2_bound = "skip" +#$bound$#ML_BSSN_MP::beta2_bound_speed = 1.0 +#$bound$#ML_BSSN_MP::beta2_bound_limit = 0.0 +#$bound$#ML_BSSN_MP::beta2_bound_scalar = 0.0 + +#$bound$#ML_BSSN_MP::beta3_bound = "skip" +#$bound$#ML_BSSN_MP::beta3_bound_speed = 1.0 +#$bound$#ML_BSSN_MP::beta3_bound_limit = 0.0 +#$bound$#ML_BSSN_MP::beta3_bound_scalar = 0.0 + +#$bound$#ML_BSSN_MP::trK_bound = "skip" +#$bound$#ML_BSSN_MP::trK_bound_speed = 1.0 +#$bound$#ML_BSSN_MP::trK_bound_limit = 0.0 +#$bound$#ML_BSSN_MP::trK_bound_scalar = 0.0 + +*/ + diff --git a/ML_BSSN_MP/src/ML_BSSN_MP_Minkowski.cc b/ML_BSSN_MP/src/ML_BSSN_MP_Minkowski.cc new file mode 100644 index 0000000..2b1fd5c --- /dev/null +++ b/ML_BSSN_MP/src/ML_BSSN_MP_Minkowski.cc @@ -0,0 +1,187 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +static void ML_BSSN_MP_Minkowski_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_BSSN_MP_Minkowski_Body"); + } + + if (cctk_iteration % ML_BSSN_MP_Minkowski_calc_every != ML_BSSN_MP_Minkowski_calc_offset) + { + return; + } + + const char *groups[] = {"ML_BSSN_MP::ML_curv","ML_BSSN_MP::ML_dtlapse","ML_BSSN_MP::ML_dtshift","ML_BSSN_MP::ML_Gamma","ML_BSSN_MP::ML_lapse","ML_BSSN_MP::ML_log_confac","ML_BSSN_MP::ML_metric","ML_BSSN_MP::ML_shift","ML_BSSN_MP::ML_trace_curv"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_BSSN_MP_Minkowski", 9, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o12dx = 0.0833333333333333333333333333333*INV(dx); + CCTK_REAL const p1o12dy = 0.0833333333333333333333333333333*INV(dy); + CCTK_REAL const p1o12dz = 0.0833333333333333333333333333333*INV(dz); + CCTK_REAL const p1o144dxdy = 0.00694444444444444444444444444444*INV(dx)*INV(dy); + CCTK_REAL const p1o144dxdz = 0.00694444444444444444444444444444*INV(dx)*INV(dz); + CCTK_REAL const p1o144dydz = 0.00694444444444444444444444444444*INV(dy)*INV(dz); + CCTK_REAL const p1o24dx = 0.0416666666666666666666666666667*INV(dx); + CCTK_REAL const p1o24dy = 0.0416666666666666666666666666667*INV(dy); + CCTK_REAL const p1o24dz = 0.0416666666666666666666666666667*INV(dz); + CCTK_REAL const p1o64dx = 0.015625*INV(dx); + CCTK_REAL const p1o64dy = 0.015625*INV(dy); + CCTK_REAL const p1o64dz = 0.015625*INV(dz); + CCTK_REAL const p1odx = INV(dx); + CCTK_REAL const p1ody = INV(dy); + CCTK_REAL const p1odz = INV(dz); + CCTK_REAL const pm1o12dx2 = -0.0833333333333333333333333333333*INV(SQR(dx)); + CCTK_REAL const pm1o12dy2 = -0.0833333333333333333333333333333*INV(SQR(dy)); + CCTK_REAL const pm1o12dz2 = -0.0833333333333333333333333333333*INV(SQR(dz)); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_BSSN_MP_Minkowski, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + + /* Include user supplied include files */ + + /* Precompute derivatives */ + + /* Calculate temporaries and grid functions */ + CCTK_REAL phiL = IfThen(ToReal(conformalMethod),1,0); + + CCTK_REAL gt11L = 1; + + CCTK_REAL gt12L = 0; + + CCTK_REAL gt13L = 0; + + CCTK_REAL gt22L = 1; + + CCTK_REAL gt23L = 0; + + CCTK_REAL gt33L = 1; + + CCTK_REAL trKL = 0; + + CCTK_REAL At11L = 0; + + CCTK_REAL At12L = 0; + + CCTK_REAL At13L = 0; + + CCTK_REAL At22L = 0; + + CCTK_REAL At23L = 0; + + CCTK_REAL At33L = 0; + + CCTK_REAL Xt1L = 0; + + CCTK_REAL Xt2L = 0; + + CCTK_REAL Xt3L = 0; + + CCTK_REAL alphaL = 1; + + CCTK_REAL AL = 0; + + CCTK_REAL beta1L = 0; + + CCTK_REAL beta2L = 0; + + CCTK_REAL beta3L = 0; + + CCTK_REAL B1L = 0; + + CCTK_REAL B2L = 0; + + CCTK_REAL B3L = 0; + + + /* Copy local copies back to grid functions */ + A[index] = AL; + alpha[index] = alphaL; + At11[index] = At11L; + At12[index] = At12L; + At13[index] = At13L; + At22[index] = At22L; + At23[index] = At23L; + At33[index] = At33L; + B1[index] = B1L; + B2[index] = B2L; + B3[index] = B3L; + beta1[index] = beta1L; + beta2[index] = beta2L; + beta3[index] = beta3L; + gt11[index] = gt11L; + gt12[index] = gt12L; + gt13[index] = gt13L; + gt22[index] = gt22L; + gt23[index] = gt23L; + gt33[index] = gt33L; + phi[index] = phiL; + trK[index] = trKL; + Xt1[index] = Xt1L; + Xt2[index] = Xt2L; + Xt3[index] = Xt3L; + } + LC_ENDLOOP3 (ML_BSSN_MP_Minkowski); +} + +extern "C" void ML_BSSN_MP_Minkowski(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverEverything(cctkGH, &ML_BSSN_MP_Minkowski_Body); +} diff --git a/ML_BSSN_MP/src/ML_BSSN_MP_RHS1.cc b/ML_BSSN_MP/src/ML_BSSN_MP_RHS1.cc new file mode 100644 index 0000000..4a9d091 --- /dev/null +++ b/ML_BSSN_MP/src/ML_BSSN_MP_RHS1.cc @@ -0,0 +1,1372 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +extern "C" void ML_BSSN_MP_RHS1_SelectBCs(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT ierr = 0; + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_MP::ML_dtlapserhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_MP::ML_dtlapserhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_MP::ML_dtshiftrhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_MP::ML_dtshiftrhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_MP::ML_Gammarhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_MP::ML_Gammarhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_MP::ML_lapserhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_MP::ML_lapserhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_MP::ML_log_confacrhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_MP::ML_log_confacrhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_MP::ML_metricrhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_MP::ML_metricrhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_MP::ML_shiftrhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_MP::ML_shiftrhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_MP::ML_trace_curvrhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_MP::ML_trace_curvrhs."); + return; +} + +static void ML_BSSN_MP_RHS1_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_BSSN_MP_RHS1_Body"); + } + + if (cctk_iteration % ML_BSSN_MP_RHS1_calc_every != ML_BSSN_MP_RHS1_calc_offset) + { + return; + } + + const char *groups[] = {"Coordinates::jacobian","Coordinates::jacobian2","grid::coordinates","Grid::coordinates","ML_BSSN_MP::ML_curv","ML_BSSN_MP::ML_dtlapse","ML_BSSN_MP::ML_dtlapserhs","ML_BSSN_MP::ML_dtshift","ML_BSSN_MP::ML_dtshiftrhs","ML_BSSN_MP::ML_Gamma","ML_BSSN_MP::ML_Gammarhs","ML_BSSN_MP::ML_lapse","ML_BSSN_MP::ML_lapserhs","ML_BSSN_MP::ML_log_confac","ML_BSSN_MP::ML_log_confacrhs","ML_BSSN_MP::ML_metric","ML_BSSN_MP::ML_metricrhs","ML_BSSN_MP::ML_shift","ML_BSSN_MP::ML_shiftrhs","ML_BSSN_MP::ML_trace_curv","ML_BSSN_MP::ML_trace_curvrhs"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_BSSN_MP_RHS1", 21, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o12dx = 0.0833333333333333333333333333333*INV(dx); + CCTK_REAL const p1o12dy = 0.0833333333333333333333333333333*INV(dy); + CCTK_REAL const p1o12dz = 0.0833333333333333333333333333333*INV(dz); + CCTK_REAL const p1o144dxdy = 0.00694444444444444444444444444444*INV(dx)*INV(dy); + CCTK_REAL const p1o144dxdz = 0.00694444444444444444444444444444*INV(dx)*INV(dz); + CCTK_REAL const p1o144dydz = 0.00694444444444444444444444444444*INV(dy)*INV(dz); + CCTK_REAL const p1o24dx = 0.0416666666666666666666666666667*INV(dx); + CCTK_REAL const p1o24dy = 0.0416666666666666666666666666667*INV(dy); + CCTK_REAL const p1o24dz = 0.0416666666666666666666666666667*INV(dz); + CCTK_REAL const p1o64dx = 0.015625*INV(dx); + CCTK_REAL const p1o64dy = 0.015625*INV(dy); + CCTK_REAL const p1o64dz = 0.015625*INV(dz); + CCTK_REAL const p1odx = INV(dx); + CCTK_REAL const p1ody = INV(dy); + CCTK_REAL const p1odz = INV(dz); + CCTK_REAL const pm1o12dx2 = -0.0833333333333333333333333333333*INV(SQR(dx)); + CCTK_REAL const pm1o12dy2 = -0.0833333333333333333333333333333*INV(SQR(dy)); + CCTK_REAL const pm1o12dz2 = -0.0833333333333333333333333333333*INV(SQR(dz)); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_BSSN_MP_RHS1, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + CCTK_REAL AL = A[index]; + CCTK_REAL alphaL = alpha[index]; + CCTK_REAL At11L = At11[index]; + CCTK_REAL At12L = At12[index]; + CCTK_REAL At13L = At13[index]; + CCTK_REAL At22L = At22[index]; + CCTK_REAL At23L = At23[index]; + CCTK_REAL At33L = At33[index]; + CCTK_REAL B1L = B1[index]; + CCTK_REAL B2L = B2[index]; + CCTK_REAL B3L = B3[index]; + CCTK_REAL beta1L = beta1[index]; + CCTK_REAL beta2L = beta2[index]; + CCTK_REAL beta3L = beta3[index]; + CCTK_REAL dJ111L = dJ111[index]; + CCTK_REAL dJ112L = dJ112[index]; + CCTK_REAL dJ113L = dJ113[index]; + CCTK_REAL dJ122L = dJ122[index]; + CCTK_REAL dJ123L = dJ123[index]; + CCTK_REAL dJ133L = dJ133[index]; + CCTK_REAL dJ211L = dJ211[index]; + CCTK_REAL dJ212L = dJ212[index]; + CCTK_REAL dJ213L = dJ213[index]; + CCTK_REAL dJ222L = dJ222[index]; + CCTK_REAL dJ223L = dJ223[index]; + CCTK_REAL dJ233L = dJ233[index]; + CCTK_REAL dJ311L = dJ311[index]; + CCTK_REAL dJ312L = dJ312[index]; + CCTK_REAL dJ313L = dJ313[index]; + CCTK_REAL dJ322L = dJ322[index]; + CCTK_REAL dJ323L = dJ323[index]; + CCTK_REAL dJ333L = dJ333[index]; + CCTK_REAL eTttL = (*stress_energy_state) ? eTtt[index] : ToReal(0.0); + CCTK_REAL eTtxL = (*stress_energy_state) ? eTtx[index] : ToReal(0.0); + CCTK_REAL eTtyL = (*stress_energy_state) ? eTty[index] : ToReal(0.0); + CCTK_REAL eTtzL = (*stress_energy_state) ? eTtz[index] : ToReal(0.0); + CCTK_REAL eTxxL = (*stress_energy_state) ? eTxx[index] : ToReal(0.0); + CCTK_REAL eTxyL = (*stress_energy_state) ? eTxy[index] : ToReal(0.0); + CCTK_REAL eTxzL = (*stress_energy_state) ? eTxz[index] : ToReal(0.0); + CCTK_REAL eTyyL = (*stress_energy_state) ? eTyy[index] : ToReal(0.0); + CCTK_REAL eTyzL = (*stress_energy_state) ? eTyz[index] : ToReal(0.0); + CCTK_REAL eTzzL = (*stress_energy_state) ? eTzz[index] : ToReal(0.0); + CCTK_REAL gt11L = gt11[index]; + CCTK_REAL gt12L = gt12[index]; + CCTK_REAL gt13L = gt13[index]; + CCTK_REAL gt22L = gt22[index]; + CCTK_REAL gt23L = gt23[index]; + CCTK_REAL gt33L = gt33[index]; + CCTK_REAL J11L = J11[index]; + CCTK_REAL J12L = J12[index]; + CCTK_REAL J13L = J13[index]; + CCTK_REAL J21L = J21[index]; + CCTK_REAL J22L = J22[index]; + CCTK_REAL J23L = J23[index]; + CCTK_REAL J31L = J31[index]; + CCTK_REAL J32L = J32[index]; + CCTK_REAL J33L = J33[index]; + CCTK_REAL phiL = phi[index]; + CCTK_REAL rL = r[index]; + CCTK_REAL trKL = trK[index]; + CCTK_REAL Xt1L = Xt1[index]; + CCTK_REAL Xt2L = Xt2[index]; + CCTK_REAL Xt3L = Xt3[index]; + + /* Include user supplied include files */ + + /* Precompute derivatives */ + CCTK_REAL const PDdissipationNth1A = PDdissipationNth1(&A[index]); + CCTK_REAL const PDdissipationNth2A = PDdissipationNth2(&A[index]); + CCTK_REAL const PDdissipationNth3A = PDdissipationNth3(&A[index]); + CCTK_REAL const PDupwindNthAnti1A = PDupwindNthAnti1(&A[index]); + CCTK_REAL const PDupwindNthSymm1A = PDupwindNthSymm1(&A[index]); + CCTK_REAL const PDupwindNthAnti2A = PDupwindNthAnti2(&A[index]); + CCTK_REAL const PDupwindNthSymm2A = PDupwindNthSymm2(&A[index]); + CCTK_REAL const PDupwindNthAnti3A = PDupwindNthAnti3(&A[index]); + CCTK_REAL const PDupwindNthSymm3A = PDupwindNthSymm3(&A[index]); + CCTK_REAL const PDstandardNth1alpha = PDstandardNth1(&alpha[index]); + CCTK_REAL const PDstandardNth2alpha = PDstandardNth2(&alpha[index]); + CCTK_REAL const PDstandardNth3alpha = PDstandardNth3(&alpha[index]); + CCTK_REAL const PDstandardNth11alpha = PDstandardNth11(&alpha[index]); + CCTK_REAL const PDstandardNth22alpha = PDstandardNth22(&alpha[index]); + CCTK_REAL const PDstandardNth33alpha = PDstandardNth33(&alpha[index]); + CCTK_REAL const PDstandardNth12alpha = PDstandardNth12(&alpha[index]); + CCTK_REAL const PDstandardNth13alpha = PDstandardNth13(&alpha[index]); + CCTK_REAL const PDstandardNth23alpha = PDstandardNth23(&alpha[index]); + CCTK_REAL const PDdissipationNth1alpha = PDdissipationNth1(&alpha[index]); + CCTK_REAL const PDdissipationNth2alpha = PDdissipationNth2(&alpha[index]); + CCTK_REAL const PDdissipationNth3alpha = PDdissipationNth3(&alpha[index]); + CCTK_REAL const PDupwindNthAnti1alpha = PDupwindNthAnti1(&alpha[index]); + CCTK_REAL const PDupwindNthSymm1alpha = PDupwindNthSymm1(&alpha[index]); + CCTK_REAL const PDupwindNthAnti2alpha = PDupwindNthAnti2(&alpha[index]); + CCTK_REAL const PDupwindNthSymm2alpha = PDupwindNthSymm2(&alpha[index]); + CCTK_REAL const PDupwindNthAnti3alpha = PDupwindNthAnti3(&alpha[index]); + CCTK_REAL const PDupwindNthSymm3alpha = PDupwindNthSymm3(&alpha[index]); + CCTK_REAL const PDdissipationNth1B1 = PDdissipationNth1(&B1[index]); + CCTK_REAL const PDdissipationNth2B1 = PDdissipationNth2(&B1[index]); + CCTK_REAL const PDdissipationNth3B1 = PDdissipationNth3(&B1[index]); + CCTK_REAL const PDupwindNthAnti1B1 = PDupwindNthAnti1(&B1[index]); + CCTK_REAL const PDupwindNthSymm1B1 = PDupwindNthSymm1(&B1[index]); + CCTK_REAL const PDupwindNthAnti2B1 = PDupwindNthAnti2(&B1[index]); + CCTK_REAL const PDupwindNthSymm2B1 = PDupwindNthSymm2(&B1[index]); + CCTK_REAL const PDupwindNthAnti3B1 = PDupwindNthAnti3(&B1[index]); + CCTK_REAL const PDupwindNthSymm3B1 = PDupwindNthSymm3(&B1[index]); + CCTK_REAL const PDdissipationNth1B2 = PDdissipationNth1(&B2[index]); + CCTK_REAL const PDdissipationNth2B2 = PDdissipationNth2(&B2[index]); + CCTK_REAL const PDdissipationNth3B2 = PDdissipationNth3(&B2[index]); + CCTK_REAL const PDupwindNthAnti1B2 = PDupwindNthAnti1(&B2[index]); + CCTK_REAL const PDupwindNthSymm1B2 = PDupwindNthSymm1(&B2[index]); + CCTK_REAL const PDupwindNthAnti2B2 = PDupwindNthAnti2(&B2[index]); + CCTK_REAL const PDupwindNthSymm2B2 = PDupwindNthSymm2(&B2[index]); + CCTK_REAL const PDupwindNthAnti3B2 = PDupwindNthAnti3(&B2[index]); + CCTK_REAL const PDupwindNthSymm3B2 = PDupwindNthSymm3(&B2[index]); + CCTK_REAL const PDdissipationNth1B3 = PDdissipationNth1(&B3[index]); + CCTK_REAL const PDdissipationNth2B3 = PDdissipationNth2(&B3[index]); + CCTK_REAL const PDdissipationNth3B3 = PDdissipationNth3(&B3[index]); + CCTK_REAL const PDupwindNthAnti1B3 = PDupwindNthAnti1(&B3[index]); + CCTK_REAL const PDupwindNthSymm1B3 = PDupwindNthSymm1(&B3[index]); + CCTK_REAL const PDupwindNthAnti2B3 = PDupwindNthAnti2(&B3[index]); + CCTK_REAL const PDupwindNthSymm2B3 = PDupwindNthSymm2(&B3[index]); + CCTK_REAL const PDupwindNthAnti3B3 = PDupwindNthAnti3(&B3[index]); + CCTK_REAL const PDupwindNthSymm3B3 = PDupwindNthSymm3(&B3[index]); + CCTK_REAL const PDstandardNth1beta1 = PDstandardNth1(&beta1[index]); + CCTK_REAL const PDstandardNth2beta1 = PDstandardNth2(&beta1[index]); + CCTK_REAL const PDstandardNth3beta1 = PDstandardNth3(&beta1[index]); + CCTK_REAL const PDstandardNth11beta1 = PDstandardNth11(&beta1[index]); + CCTK_REAL const PDstandardNth22beta1 = PDstandardNth22(&beta1[index]); + CCTK_REAL const PDstandardNth33beta1 = PDstandardNth33(&beta1[index]); + CCTK_REAL const PDstandardNth12beta1 = PDstandardNth12(&beta1[index]); + CCTK_REAL const PDstandardNth13beta1 = PDstandardNth13(&beta1[index]); + CCTK_REAL const PDstandardNth23beta1 = PDstandardNth23(&beta1[index]); + CCTK_REAL const PDdissipationNth1beta1 = PDdissipationNth1(&beta1[index]); + CCTK_REAL const PDdissipationNth2beta1 = PDdissipationNth2(&beta1[index]); + CCTK_REAL const PDdissipationNth3beta1 = PDdissipationNth3(&beta1[index]); + CCTK_REAL const PDupwindNthAnti1beta1 = PDupwindNthAnti1(&beta1[index]); + CCTK_REAL const PDupwindNthSymm1beta1 = PDupwindNthSymm1(&beta1[index]); + CCTK_REAL const PDupwindNthAnti2beta1 = PDupwindNthAnti2(&beta1[index]); + CCTK_REAL const PDupwindNthSymm2beta1 = PDupwindNthSymm2(&beta1[index]); + CCTK_REAL const PDupwindNthAnti3beta1 = PDupwindNthAnti3(&beta1[index]); + CCTK_REAL const PDupwindNthSymm3beta1 = PDupwindNthSymm3(&beta1[index]); + CCTK_REAL const PDstandardNth1beta2 = PDstandardNth1(&beta2[index]); + CCTK_REAL const PDstandardNth2beta2 = PDstandardNth2(&beta2[index]); + CCTK_REAL const PDstandardNth3beta2 = PDstandardNth3(&beta2[index]); + CCTK_REAL const PDstandardNth11beta2 = PDstandardNth11(&beta2[index]); + CCTK_REAL const PDstandardNth22beta2 = PDstandardNth22(&beta2[index]); + CCTK_REAL const PDstandardNth33beta2 = PDstandardNth33(&beta2[index]); + CCTK_REAL const PDstandardNth12beta2 = PDstandardNth12(&beta2[index]); + CCTK_REAL const PDstandardNth13beta2 = PDstandardNth13(&beta2[index]); + CCTK_REAL const PDstandardNth23beta2 = PDstandardNth23(&beta2[index]); + CCTK_REAL const PDdissipationNth1beta2 = PDdissipationNth1(&beta2[index]); + CCTK_REAL const PDdissipationNth2beta2 = PDdissipationNth2(&beta2[index]); + CCTK_REAL const PDdissipationNth3beta2 = PDdissipationNth3(&beta2[index]); + CCTK_REAL const PDupwindNthAnti1beta2 = PDupwindNthAnti1(&beta2[index]); + CCTK_REAL const PDupwindNthSymm1beta2 = PDupwindNthSymm1(&beta2[index]); + CCTK_REAL const PDupwindNthAnti2beta2 = PDupwindNthAnti2(&beta2[index]); + CCTK_REAL const PDupwindNthSymm2beta2 = PDupwindNthSymm2(&beta2[index]); + CCTK_REAL const PDupwindNthAnti3beta2 = PDupwindNthAnti3(&beta2[index]); + CCTK_REAL const PDupwindNthSymm3beta2 = PDupwindNthSymm3(&beta2[index]); + CCTK_REAL const PDstandardNth1beta3 = PDstandardNth1(&beta3[index]); + CCTK_REAL const PDstandardNth2beta3 = PDstandardNth2(&beta3[index]); + CCTK_REAL const PDstandardNth3beta3 = PDstandardNth3(&beta3[index]); + CCTK_REAL const PDstandardNth11beta3 = PDstandardNth11(&beta3[index]); + CCTK_REAL const PDstandardNth22beta3 = PDstandardNth22(&beta3[index]); + CCTK_REAL const PDstandardNth33beta3 = PDstandardNth33(&beta3[index]); + CCTK_REAL const PDstandardNth12beta3 = PDstandardNth12(&beta3[index]); + CCTK_REAL const PDstandardNth13beta3 = PDstandardNth13(&beta3[index]); + CCTK_REAL const PDstandardNth23beta3 = PDstandardNth23(&beta3[index]); + CCTK_REAL const PDdissipationNth1beta3 = PDdissipationNth1(&beta3[index]); + CCTK_REAL const PDdissipationNth2beta3 = PDdissipationNth2(&beta3[index]); + CCTK_REAL const PDdissipationNth3beta3 = PDdissipationNth3(&beta3[index]); + CCTK_REAL const PDupwindNthAnti1beta3 = PDupwindNthAnti1(&beta3[index]); + CCTK_REAL const PDupwindNthSymm1beta3 = PDupwindNthSymm1(&beta3[index]); + CCTK_REAL const PDupwindNthAnti2beta3 = PDupwindNthAnti2(&beta3[index]); + CCTK_REAL const PDupwindNthSymm2beta3 = PDupwindNthSymm2(&beta3[index]); + CCTK_REAL const PDupwindNthAnti3beta3 = PDupwindNthAnti3(&beta3[index]); + CCTK_REAL const PDupwindNthSymm3beta3 = PDupwindNthSymm3(&beta3[index]); + CCTK_REAL const PDstandardNth1gt11 = PDstandardNth1(>11[index]); + CCTK_REAL const PDstandardNth2gt11 = PDstandardNth2(>11[index]); + CCTK_REAL const PDstandardNth3gt11 = PDstandardNth3(>11[index]); + CCTK_REAL const PDdissipationNth1gt11 = PDdissipationNth1(>11[index]); + CCTK_REAL const PDdissipationNth2gt11 = PDdissipationNth2(>11[index]); + CCTK_REAL const PDdissipationNth3gt11 = PDdissipationNth3(>11[index]); + CCTK_REAL const PDupwindNthAnti1gt11 = PDupwindNthAnti1(>11[index]); + CCTK_REAL const PDupwindNthSymm1gt11 = PDupwindNthSymm1(>11[index]); + CCTK_REAL const PDupwindNthAnti2gt11 = PDupwindNthAnti2(>11[index]); + CCTK_REAL const PDupwindNthSymm2gt11 = PDupwindNthSymm2(>11[index]); + CCTK_REAL const PDupwindNthAnti3gt11 = PDupwindNthAnti3(>11[index]); + CCTK_REAL const PDupwindNthSymm3gt11 = PDupwindNthSymm3(>11[index]); + CCTK_REAL const PDstandardNth1gt12 = PDstandardNth1(>12[index]); + CCTK_REAL const PDstandardNth2gt12 = PDstandardNth2(>12[index]); + CCTK_REAL const PDstandardNth3gt12 = PDstandardNth3(>12[index]); + CCTK_REAL const PDdissipationNth1gt12 = PDdissipationNth1(>12[index]); + CCTK_REAL const PDdissipationNth2gt12 = PDdissipationNth2(>12[index]); + CCTK_REAL const PDdissipationNth3gt12 = PDdissipationNth3(>12[index]); + CCTK_REAL const PDupwindNthAnti1gt12 = PDupwindNthAnti1(>12[index]); + CCTK_REAL const PDupwindNthSymm1gt12 = PDupwindNthSymm1(>12[index]); + CCTK_REAL const PDupwindNthAnti2gt12 = PDupwindNthAnti2(>12[index]); + CCTK_REAL const PDupwindNthSymm2gt12 = PDupwindNthSymm2(>12[index]); + CCTK_REAL const PDupwindNthAnti3gt12 = PDupwindNthAnti3(>12[index]); + CCTK_REAL const PDupwindNthSymm3gt12 = PDupwindNthSymm3(>12[index]); + CCTK_REAL const PDstandardNth1gt13 = PDstandardNth1(>13[index]); + CCTK_REAL const PDstandardNth2gt13 = PDstandardNth2(>13[index]); + CCTK_REAL const PDstandardNth3gt13 = PDstandardNth3(>13[index]); + CCTK_REAL const PDdissipationNth1gt13 = PDdissipationNth1(>13[index]); + CCTK_REAL const PDdissipationNth2gt13 = PDdissipationNth2(>13[index]); + CCTK_REAL const PDdissipationNth3gt13 = PDdissipationNth3(>13[index]); + CCTK_REAL const PDupwindNthAnti1gt13 = PDupwindNthAnti1(>13[index]); + CCTK_REAL const PDupwindNthSymm1gt13 = PDupwindNthSymm1(>13[index]); + CCTK_REAL const PDupwindNthAnti2gt13 = PDupwindNthAnti2(>13[index]); + CCTK_REAL const PDupwindNthSymm2gt13 = PDupwindNthSymm2(>13[index]); + CCTK_REAL const PDupwindNthAnti3gt13 = PDupwindNthAnti3(>13[index]); + CCTK_REAL const PDupwindNthSymm3gt13 = PDupwindNthSymm3(>13[index]); + CCTK_REAL const PDstandardNth1gt22 = PDstandardNth1(>22[index]); + CCTK_REAL const PDstandardNth2gt22 = PDstandardNth2(>22[index]); + CCTK_REAL const PDstandardNth3gt22 = PDstandardNth3(>22[index]); + CCTK_REAL const PDdissipationNth1gt22 = PDdissipationNth1(>22[index]); + CCTK_REAL const PDdissipationNth2gt22 = PDdissipationNth2(>22[index]); + CCTK_REAL const PDdissipationNth3gt22 = PDdissipationNth3(>22[index]); + CCTK_REAL const PDupwindNthAnti1gt22 = PDupwindNthAnti1(>22[index]); + CCTK_REAL const PDupwindNthSymm1gt22 = PDupwindNthSymm1(>22[index]); + CCTK_REAL const PDupwindNthAnti2gt22 = PDupwindNthAnti2(>22[index]); + CCTK_REAL const PDupwindNthSymm2gt22 = PDupwindNthSymm2(>22[index]); + CCTK_REAL const PDupwindNthAnti3gt22 = PDupwindNthAnti3(>22[index]); + CCTK_REAL const PDupwindNthSymm3gt22 = PDupwindNthSymm3(>22[index]); + CCTK_REAL const PDstandardNth1gt23 = PDstandardNth1(>23[index]); + CCTK_REAL const PDstandardNth2gt23 = PDstandardNth2(>23[index]); + CCTK_REAL const PDstandardNth3gt23 = PDstandardNth3(>23[index]); + CCTK_REAL const PDdissipationNth1gt23 = PDdissipationNth1(>23[index]); + CCTK_REAL const PDdissipationNth2gt23 = PDdissipationNth2(>23[index]); + CCTK_REAL const PDdissipationNth3gt23 = PDdissipationNth3(>23[index]); + CCTK_REAL const PDupwindNthAnti1gt23 = PDupwindNthAnti1(>23[index]); + CCTK_REAL const PDupwindNthSymm1gt23 = PDupwindNthSymm1(>23[index]); + CCTK_REAL const PDupwindNthAnti2gt23 = PDupwindNthAnti2(>23[index]); + CCTK_REAL const PDupwindNthSymm2gt23 = PDupwindNthSymm2(>23[index]); + CCTK_REAL const PDupwindNthAnti3gt23 = PDupwindNthAnti3(>23[index]); + CCTK_REAL const PDupwindNthSymm3gt23 = PDupwindNthSymm3(>23[index]); + CCTK_REAL const PDstandardNth1gt33 = PDstandardNth1(>33[index]); + CCTK_REAL const PDstandardNth2gt33 = PDstandardNth2(>33[index]); + CCTK_REAL const PDstandardNth3gt33 = PDstandardNth3(>33[index]); + CCTK_REAL const PDdissipationNth1gt33 = PDdissipationNth1(>33[index]); + CCTK_REAL const PDdissipationNth2gt33 = PDdissipationNth2(>33[index]); + CCTK_REAL const PDdissipationNth3gt33 = PDdissipationNth3(>33[index]); + CCTK_REAL const PDupwindNthAnti1gt33 = PDupwindNthAnti1(>33[index]); + CCTK_REAL const PDupwindNthSymm1gt33 = PDupwindNthSymm1(>33[index]); + CCTK_REAL const PDupwindNthAnti2gt33 = PDupwindNthAnti2(>33[index]); + CCTK_REAL const PDupwindNthSymm2gt33 = PDupwindNthSymm2(>33[index]); + CCTK_REAL const PDupwindNthAnti3gt33 = PDupwindNthAnti3(>33[index]); + CCTK_REAL const PDupwindNthSymm3gt33 = PDupwindNthSymm3(>33[index]); + CCTK_REAL const PDstandardNth1phi = PDstandardNth1(&phi[index]); + CCTK_REAL const PDstandardNth2phi = PDstandardNth2(&phi[index]); + CCTK_REAL const PDstandardNth3phi = PDstandardNth3(&phi[index]); + CCTK_REAL const PDdissipationNth1phi = PDdissipationNth1(&phi[index]); + CCTK_REAL const PDdissipationNth2phi = PDdissipationNth2(&phi[index]); + CCTK_REAL const PDdissipationNth3phi = PDdissipationNth3(&phi[index]); + CCTK_REAL const PDupwindNthAnti1phi = PDupwindNthAnti1(&phi[index]); + CCTK_REAL const PDupwindNthSymm1phi = PDupwindNthSymm1(&phi[index]); + CCTK_REAL const PDupwindNthAnti2phi = PDupwindNthAnti2(&phi[index]); + CCTK_REAL const PDupwindNthSymm2phi = PDupwindNthSymm2(&phi[index]); + CCTK_REAL const PDupwindNthAnti3phi = PDupwindNthAnti3(&phi[index]); + CCTK_REAL const PDupwindNthSymm3phi = PDupwindNthSymm3(&phi[index]); + CCTK_REAL const PDstandardNth1trK = PDstandardNth1(&trK[index]); + CCTK_REAL const PDstandardNth2trK = PDstandardNth2(&trK[index]); + CCTK_REAL const PDstandardNth3trK = PDstandardNth3(&trK[index]); + CCTK_REAL const PDdissipationNth1trK = PDdissipationNth1(&trK[index]); + CCTK_REAL const PDdissipationNth2trK = PDdissipationNth2(&trK[index]); + CCTK_REAL const PDdissipationNth3trK = PDdissipationNth3(&trK[index]); + CCTK_REAL const PDupwindNthAnti1trK = PDupwindNthAnti1(&trK[index]); + CCTK_REAL const PDupwindNthSymm1trK = PDupwindNthSymm1(&trK[index]); + CCTK_REAL const PDupwindNthAnti2trK = PDupwindNthAnti2(&trK[index]); + CCTK_REAL const PDupwindNthSymm2trK = PDupwindNthSymm2(&trK[index]); + CCTK_REAL const PDupwindNthAnti3trK = PDupwindNthAnti3(&trK[index]); + CCTK_REAL const PDupwindNthSymm3trK = PDupwindNthSymm3(&trK[index]); + CCTK_REAL const PDdissipationNth1Xt1 = PDdissipationNth1(&Xt1[index]); + CCTK_REAL const PDdissipationNth2Xt1 = PDdissipationNth2(&Xt1[index]); + CCTK_REAL const PDdissipationNth3Xt1 = PDdissipationNth3(&Xt1[index]); + CCTK_REAL const PDupwindNthAnti1Xt1 = PDupwindNthAnti1(&Xt1[index]); + CCTK_REAL const PDupwindNthSymm1Xt1 = PDupwindNthSymm1(&Xt1[index]); + CCTK_REAL const PDupwindNthAnti2Xt1 = PDupwindNthAnti2(&Xt1[index]); + CCTK_REAL const PDupwindNthSymm2Xt1 = PDupwindNthSymm2(&Xt1[index]); + CCTK_REAL const PDupwindNthAnti3Xt1 = PDupwindNthAnti3(&Xt1[index]); + CCTK_REAL const PDupwindNthSymm3Xt1 = PDupwindNthSymm3(&Xt1[index]); + CCTK_REAL const PDdissipationNth1Xt2 = PDdissipationNth1(&Xt2[index]); + CCTK_REAL const PDdissipationNth2Xt2 = PDdissipationNth2(&Xt2[index]); + CCTK_REAL const PDdissipationNth3Xt2 = PDdissipationNth3(&Xt2[index]); + CCTK_REAL const PDupwindNthAnti1Xt2 = PDupwindNthAnti1(&Xt2[index]); + CCTK_REAL const PDupwindNthSymm1Xt2 = PDupwindNthSymm1(&Xt2[index]); + CCTK_REAL const PDupwindNthAnti2Xt2 = PDupwindNthAnti2(&Xt2[index]); + CCTK_REAL const PDupwindNthSymm2Xt2 = PDupwindNthSymm2(&Xt2[index]); + CCTK_REAL const PDupwindNthAnti3Xt2 = PDupwindNthAnti3(&Xt2[index]); + CCTK_REAL const PDupwindNthSymm3Xt2 = PDupwindNthSymm3(&Xt2[index]); + CCTK_REAL const PDdissipationNth1Xt3 = PDdissipationNth1(&Xt3[index]); + CCTK_REAL const PDdissipationNth2Xt3 = PDdissipationNth2(&Xt3[index]); + CCTK_REAL const PDdissipationNth3Xt3 = PDdissipationNth3(&Xt3[index]); + CCTK_REAL const PDupwindNthAnti1Xt3 = PDupwindNthAnti1(&Xt3[index]); + CCTK_REAL const PDupwindNthSymm1Xt3 = PDupwindNthSymm1(&Xt3[index]); + CCTK_REAL const PDupwindNthAnti2Xt3 = PDupwindNthAnti2(&Xt3[index]); + CCTK_REAL const PDupwindNthSymm2Xt3 = PDupwindNthSymm2(&Xt3[index]); + CCTK_REAL const PDupwindNthAnti3Xt3 = PDupwindNthAnti3(&Xt3[index]); + CCTK_REAL const PDupwindNthSymm3Xt3 = PDupwindNthSymm3(&Xt3[index]); + + /* Calculate temporaries and grid functions */ + ptrdiff_t dir1 = Sign(beta1L); + + ptrdiff_t dir2 = Sign(beta2L); + + ptrdiff_t dir3 = Sign(beta3L); + + CCTK_REAL epsdiss1 = ToReal(EpsDiss); + + CCTK_REAL epsdiss2 = ToReal(EpsDiss); + + CCTK_REAL epsdiss3 = ToReal(EpsDiss); + + CCTK_REAL detgt = 1; + + CCTK_REAL gtu11 = INV(detgt)*(gt22L*gt33L - SQR(gt23L)); + + CCTK_REAL gtu12 = (gt13L*gt23L - gt12L*gt33L)*INV(detgt); + + CCTK_REAL gtu13 = (-(gt13L*gt22L) + gt12L*gt23L)*INV(detgt); + + CCTK_REAL gtu22 = INV(detgt)*(gt11L*gt33L - SQR(gt13L)); + + CCTK_REAL gtu23 = (gt12L*gt13L - gt11L*gt23L)*INV(detgt); + + CCTK_REAL gtu33 = INV(detgt)*(gt11L*gt22L - SQR(gt12L)); + + CCTK_REAL Gtl111 = 0.5*(J11L*PDstandardNth1gt11 + + J21L*PDstandardNth2gt11 + J31L*PDstandardNth3gt11); + + CCTK_REAL Gtl112 = 0.5*(J12L*PDstandardNth1gt11 + + J22L*PDstandardNth2gt11 + J32L*PDstandardNth3gt11); + + CCTK_REAL Gtl113 = 0.5*(J13L*PDstandardNth1gt11 + + J23L*PDstandardNth2gt11 + J33L*PDstandardNth3gt11); + + CCTK_REAL Gtl122 = J12L*PDstandardNth1gt12 + J22L*PDstandardNth2gt12 + + J32L*PDstandardNth3gt12 - 0.5*(J11L*PDstandardNth1gt22 + + J21L*PDstandardNth2gt22 + J31L*PDstandardNth3gt22); + + CCTK_REAL Gtl123 = 0.5*(J13L*PDstandardNth1gt12 + + J12L*PDstandardNth1gt13 - J11L*PDstandardNth1gt23 + + J23L*PDstandardNth2gt12 + J22L*PDstandardNth2gt13 - + J21L*PDstandardNth2gt23 + J33L*PDstandardNth3gt12 + + J32L*PDstandardNth3gt13 - J31L*PDstandardNth3gt23); + + CCTK_REAL Gtl133 = J13L*PDstandardNth1gt13 + J23L*PDstandardNth2gt13 + + J33L*PDstandardNth3gt13 - 0.5*(J11L*PDstandardNth1gt33 + + J21L*PDstandardNth2gt33 + J31L*PDstandardNth3gt33); + + CCTK_REAL Gtl211 = J11L*PDstandardNth1gt12 + J21L*PDstandardNth2gt12 - + 0.5*(J12L*PDstandardNth1gt11 + J22L*PDstandardNth2gt11 + + J32L*PDstandardNth3gt11) + J31L*PDstandardNth3gt12; + + CCTK_REAL Gtl212 = 0.5*(J11L*PDstandardNth1gt22 + + J21L*PDstandardNth2gt22 + J31L*PDstandardNth3gt22); + + CCTK_REAL Gtl213 = 0.5*(J13L*PDstandardNth1gt12 - + J12L*PDstandardNth1gt13 + J11L*PDstandardNth1gt23 + + J23L*PDstandardNth2gt12 - J22L*PDstandardNth2gt13 + + J21L*PDstandardNth2gt23 + J33L*PDstandardNth3gt12 - + J32L*PDstandardNth3gt13 + J31L*PDstandardNth3gt23); + + CCTK_REAL Gtl222 = 0.5*(J12L*PDstandardNth1gt22 + + J22L*PDstandardNth2gt22 + J32L*PDstandardNth3gt22); + + CCTK_REAL Gtl223 = 0.5*(J13L*PDstandardNth1gt22 + + J23L*PDstandardNth2gt22 + J33L*PDstandardNth3gt22); + + CCTK_REAL Gtl233 = J13L*PDstandardNth1gt23 + J23L*PDstandardNth2gt23 + + J33L*PDstandardNth3gt23 - 0.5*(J12L*PDstandardNth1gt33 + + J22L*PDstandardNth2gt33 + J32L*PDstandardNth3gt33); + + CCTK_REAL Gtl311 = J11L*PDstandardNth1gt13 + J21L*PDstandardNth2gt13 - + 0.5*(J13L*PDstandardNth1gt11 + J23L*PDstandardNth2gt11 + + J33L*PDstandardNth3gt11) + J31L*PDstandardNth3gt13; + + CCTK_REAL Gtl312 = 0.5*(-(J13L*PDstandardNth1gt12) + + J12L*PDstandardNth1gt13 + J11L*PDstandardNth1gt23 - + J23L*PDstandardNth2gt12 + J22L*PDstandardNth2gt13 + + J21L*PDstandardNth2gt23 - J33L*PDstandardNth3gt12 + + J32L*PDstandardNth3gt13 + J31L*PDstandardNth3gt23); + + CCTK_REAL Gtl313 = 0.5*(J11L*PDstandardNth1gt33 + + J21L*PDstandardNth2gt33 + J31L*PDstandardNth3gt33); + + CCTK_REAL Gtl322 = J12L*PDstandardNth1gt23 + J22L*PDstandardNth2gt23 - + 0.5*(J13L*PDstandardNth1gt22 + J23L*PDstandardNth2gt22 + + J33L*PDstandardNth3gt22) + J32L*PDstandardNth3gt23; + + CCTK_REAL Gtl323 = 0.5*(J12L*PDstandardNth1gt33 + + J22L*PDstandardNth2gt33 + J32L*PDstandardNth3gt33); + + CCTK_REAL Gtl333 = 0.5*(J13L*PDstandardNth1gt33 + + J23L*PDstandardNth2gt33 + J33L*PDstandardNth3gt33); + + CCTK_REAL Gt111 = Gtl111*gtu11 + Gtl211*gtu12 + Gtl311*gtu13; + + CCTK_REAL Gt211 = Gtl111*gtu12 + Gtl211*gtu22 + Gtl311*gtu23; + + CCTK_REAL Gt311 = Gtl111*gtu13 + Gtl211*gtu23 + Gtl311*gtu33; + + CCTK_REAL Gt112 = Gtl112*gtu11 + Gtl212*gtu12 + Gtl312*gtu13; + + CCTK_REAL Gt212 = Gtl112*gtu12 + Gtl212*gtu22 + Gtl312*gtu23; + + CCTK_REAL Gt312 = Gtl112*gtu13 + Gtl212*gtu23 + Gtl312*gtu33; + + CCTK_REAL Gt113 = Gtl113*gtu11 + Gtl213*gtu12 + Gtl313*gtu13; + + CCTK_REAL Gt213 = Gtl113*gtu12 + Gtl213*gtu22 + Gtl313*gtu23; + + CCTK_REAL Gt313 = Gtl113*gtu13 + Gtl213*gtu23 + Gtl313*gtu33; + + CCTK_REAL Gt122 = Gtl122*gtu11 + Gtl222*gtu12 + Gtl322*gtu13; + + CCTK_REAL Gt222 = Gtl122*gtu12 + Gtl222*gtu22 + Gtl322*gtu23; + + CCTK_REAL Gt322 = Gtl122*gtu13 + Gtl222*gtu23 + Gtl322*gtu33; + + CCTK_REAL Gt123 = Gtl123*gtu11 + Gtl223*gtu12 + Gtl323*gtu13; + + CCTK_REAL Gt223 = Gtl123*gtu12 + Gtl223*gtu22 + Gtl323*gtu23; + + CCTK_REAL Gt323 = Gtl123*gtu13 + Gtl223*gtu23 + Gtl323*gtu33; + + CCTK_REAL Gt133 = Gtl133*gtu11 + Gtl233*gtu12 + Gtl333*gtu13; + + CCTK_REAL Gt233 = Gtl133*gtu12 + Gtl233*gtu22 + Gtl333*gtu23; + + CCTK_REAL Gt333 = Gtl133*gtu13 + Gtl233*gtu23 + Gtl333*gtu33; + + CCTK_REAL Xtn1 = Gt111*gtu11 + Gt122*gtu22 + 2*(Gt112*gtu12 + + Gt113*gtu13 + Gt123*gtu23) + Gt133*gtu33; + + CCTK_REAL Xtn2 = Gt211*gtu11 + Gt222*gtu22 + 2*(Gt212*gtu12 + + Gt213*gtu13 + Gt223*gtu23) + Gt233*gtu33; + + CCTK_REAL Xtn3 = Gt311*gtu11 + Gt322*gtu22 + 2*(Gt312*gtu12 + + Gt313*gtu13 + Gt323*gtu23) + Gt333*gtu33; + + CCTK_REAL fac1 = IfThen(ToReal(conformalMethod),-0.5*INV(phiL),1); + + CCTK_REAL cdphi1 = fac1*(J11L*PDstandardNth1phi + + J21L*PDstandardNth2phi + J31L*PDstandardNth3phi); + + CCTK_REAL cdphi2 = fac1*(J12L*PDstandardNth1phi + + J22L*PDstandardNth2phi + J32L*PDstandardNth3phi); + + CCTK_REAL cdphi3 = fac1*(J13L*PDstandardNth1phi + + J23L*PDstandardNth2phi + J33L*PDstandardNth3phi); + + CCTK_REAL Atm11 = At11L*gtu11 + At12L*gtu12 + At13L*gtu13; + + CCTK_REAL Atm21 = At11L*gtu12 + At12L*gtu22 + At13L*gtu23; + + CCTK_REAL Atm31 = At11L*gtu13 + At12L*gtu23 + At13L*gtu33; + + CCTK_REAL Atm12 = At12L*gtu11 + At22L*gtu12 + At23L*gtu13; + + CCTK_REAL Atm22 = At12L*gtu12 + At22L*gtu22 + At23L*gtu23; + + CCTK_REAL Atm32 = At12L*gtu13 + At22L*gtu23 + At23L*gtu33; + + CCTK_REAL Atm13 = At13L*gtu11 + At23L*gtu12 + At33L*gtu13; + + CCTK_REAL Atm23 = At13L*gtu12 + At23L*gtu22 + At33L*gtu23; + + CCTK_REAL Atm33 = At13L*gtu13 + At23L*gtu23 + At33L*gtu33; + + CCTK_REAL Atu11 = Atm11*gtu11 + Atm12*gtu12 + Atm13*gtu13; + + CCTK_REAL Atu12 = Atm11*gtu12 + Atm12*gtu22 + Atm13*gtu23; + + CCTK_REAL Atu13 = Atm11*gtu13 + Atm12*gtu23 + Atm13*gtu33; + + CCTK_REAL Atu22 = Atm21*gtu12 + Atm22*gtu22 + Atm23*gtu23; + + CCTK_REAL Atu23 = Atm21*gtu13 + Atm22*gtu23 + Atm23*gtu33; + + CCTK_REAL Atu33 = Atm31*gtu13 + Atm32*gtu23 + Atm33*gtu33; + + CCTK_REAL e4phi = + IfThen(ToReal(conformalMethod),INV(SQR(phiL)),exp(4*phiL)); + + CCTK_REAL em4phi = INV(e4phi); + + CCTK_REAL rho = INV(SQR(alphaL))*(eTttL - 2*(beta2L*eTtyL + + beta3L*eTtzL) + 2*(beta1L*(-eTtxL + beta2L*eTxyL + beta3L*eTxzL) + + beta2L*beta3L*eTyzL) + eTxxL*SQR(beta1L) + eTyyL*SQR(beta2L) + + eTzzL*SQR(beta3L)); + + CCTK_REAL S1 = (-eTtxL + beta1L*eTxxL + beta2L*eTxyL + + beta3L*eTxzL)*INV(alphaL); + + CCTK_REAL S2 = (-eTtyL + beta1L*eTxyL + beta2L*eTyyL + + beta3L*eTyzL)*INV(alphaL); + + CCTK_REAL S3 = (-eTtzL + beta1L*eTxzL + beta2L*eTyzL + + beta3L*eTzzL)*INV(alphaL); + + CCTK_REAL trS = em4phi*(eTxxL*gtu11 + eTyyL*gtu22 + 2*(eTxyL*gtu12 + + eTxzL*gtu13 + eTyzL*gtu23) + eTzzL*gtu33); + + CCTK_REAL phirhsL = (epsdiss1*J11L + epsdiss2*J12L + + epsdiss3*J13L)*PDdissipationNth1phi + (epsdiss1*J21L + epsdiss2*J22L + + epsdiss3*J23L)*PDdissipationNth2phi + (epsdiss1*J31L + epsdiss2*J32L + + epsdiss3*J33L)*PDdissipationNth3phi + (beta1L*J11L + beta2L*J12L + + beta3L*J13L)*PDupwindNthAnti1phi + (beta1L*J21L + beta2L*J22L + + beta3L*J23L)*PDupwindNthAnti2phi + (beta1L*J31L + beta2L*J32L + + beta3L*J33L)*PDupwindNthAnti3phi + (J11L*PDupwindNthSymm1phi + + J21L*PDupwindNthSymm2phi + J31L*PDupwindNthSymm3phi)*Abs(beta1L) + + (J12L*PDupwindNthSymm1phi + J22L*PDupwindNthSymm2phi + + J32L*PDupwindNthSymm3phi)*Abs(beta2L) + (J13L*PDupwindNthSymm1phi + + J23L*PDupwindNthSymm2phi + J33L*PDupwindNthSymm3phi)*Abs(beta3L) + + IfThen(ToReal(conformalMethod),phiL*(-0.333333333333333333333333333333*(J11L*PDstandardNth1beta1 + + J12L*PDstandardNth1beta2 + J13L*PDstandardNth1beta3 + + J21L*PDstandardNth2beta1 + J22L*PDstandardNth2beta2 + + J23L*PDstandardNth2beta3 + J31L*PDstandardNth3beta1 + + J32L*PDstandardNth3beta2 + J33L*PDstandardNth3beta3) + + 0.333333333333333333333333333333*alphaL*trKL),0.166666666666666666666666666667*(J11L*PDstandardNth1beta1 + + J12L*PDstandardNth1beta2 + J13L*PDstandardNth1beta3 + + J21L*PDstandardNth2beta1 + J22L*PDstandardNth2beta2 + + J23L*PDstandardNth2beta3 + J31L*PDstandardNth3beta1 + + J32L*PDstandardNth3beta2 + J33L*PDstandardNth3beta3) - + 0.166666666666666666666666666667*alphaL*trKL); + + CCTK_REAL gt11rhsL = -2*alphaL*At11L + (epsdiss1*J11L + epsdiss2*J12L + + epsdiss3*J13L)*PDdissipationNth1gt11 + (epsdiss1*J21L + epsdiss2*J22L + + epsdiss3*J23L)*PDdissipationNth2gt11 + (epsdiss1*J31L + epsdiss2*J32L + + epsdiss3*J33L)*PDdissipationNth3gt11 - + 0.666666666666666666666666666667*gt11L*(J11L*PDstandardNth1beta1 + + J12L*PDstandardNth1beta2 + J13L*PDstandardNth1beta3 + + J21L*PDstandardNth2beta1 + J22L*PDstandardNth2beta2 + + J23L*PDstandardNth2beta3 + J31L*PDstandardNth3beta1 + + J32L*PDstandardNth3beta2 + J33L*PDstandardNth3beta3) + + 2*(J11L*(gt11L*PDstandardNth1beta1 + gt12L*PDstandardNth1beta2 + + gt13L*PDstandardNth1beta3) + J21L*(gt11L*PDstandardNth2beta1 + + gt12L*PDstandardNth2beta2 + gt13L*PDstandardNth2beta3) + + J31L*(gt11L*PDstandardNth3beta1 + gt12L*PDstandardNth3beta2 + + gt13L*PDstandardNth3beta3)) + (beta1L*J11L + beta2L*J12L + + beta3L*J13L)*PDupwindNthAnti1gt11 + (beta1L*J21L + beta2L*J22L + + beta3L*J23L)*PDupwindNthAnti2gt11 + (beta1L*J31L + beta2L*J32L + + beta3L*J33L)*PDupwindNthAnti3gt11 + (J11L*PDupwindNthSymm1gt11 + + J21L*PDupwindNthSymm2gt11 + J31L*PDupwindNthSymm3gt11)*Abs(beta1L) + + (J12L*PDupwindNthSymm1gt11 + J22L*PDupwindNthSymm2gt11 + + J32L*PDupwindNthSymm3gt11)*Abs(beta2L) + (J13L*PDupwindNthSymm1gt11 + + J23L*PDupwindNthSymm2gt11 + J33L*PDupwindNthSymm3gt11)*Abs(beta3L); + + CCTK_REAL gt12rhsL = -2*alphaL*At12L + (epsdiss1*J11L + epsdiss2*J12L + + epsdiss3*J13L)*PDdissipationNth1gt12 + (epsdiss1*J21L + epsdiss2*J22L + + epsdiss3*J23L)*PDdissipationNth2gt12 + (epsdiss1*J31L + epsdiss2*J32L + + epsdiss3*J33L)*PDdissipationNth3gt12 + (gt12L*J11L + + gt11L*J12L)*PDstandardNth1beta1 + (gt22L*J11L + + gt12L*J12L)*PDstandardNth1beta2 + (gt23L*J11L + + gt13L*J12L)*PDstandardNth1beta3 + (gt12L*J21L + + gt11L*J22L)*PDstandardNth2beta1 + (gt22L*J21L + + gt12L*J22L)*PDstandardNth2beta2 + (gt23L*J21L + + gt13L*J22L)*PDstandardNth2beta3 + (gt12L*J31L + + gt11L*J32L)*PDstandardNth3beta1 + (gt22L*J31L + + gt12L*J32L)*PDstandardNth3beta2 + (gt23L*J31L + + gt13L*J32L)*PDstandardNth3beta3 - + 0.666666666666666666666666666667*gt12L*(J11L*PDstandardNth1beta1 + + J12L*PDstandardNth1beta2 + J13L*PDstandardNth1beta3 + + J21L*PDstandardNth2beta1 + J22L*PDstandardNth2beta2 + + J23L*PDstandardNth2beta3 + J31L*PDstandardNth3beta1 + + J32L*PDstandardNth3beta2 + J33L*PDstandardNth3beta3) + (beta1L*J11L + + beta2L*J12L + beta3L*J13L)*PDupwindNthAnti1gt12 + (beta1L*J21L + + beta2L*J22L + beta3L*J23L)*PDupwindNthAnti2gt12 + (beta1L*J31L + + beta2L*J32L + beta3L*J33L)*PDupwindNthAnti3gt12 + + (J11L*PDupwindNthSymm1gt12 + J21L*PDupwindNthSymm2gt12 + + J31L*PDupwindNthSymm3gt12)*Abs(beta1L) + (J12L*PDupwindNthSymm1gt12 + + J22L*PDupwindNthSymm2gt12 + J32L*PDupwindNthSymm3gt12)*Abs(beta2L) + + (J13L*PDupwindNthSymm1gt12 + J23L*PDupwindNthSymm2gt12 + + J33L*PDupwindNthSymm3gt12)*Abs(beta3L); + + CCTK_REAL gt13rhsL = -2*alphaL*At13L + (epsdiss1*J11L + epsdiss2*J12L + + epsdiss3*J13L)*PDdissipationNth1gt13 + (epsdiss1*J21L + epsdiss2*J22L + + epsdiss3*J23L)*PDdissipationNth2gt13 + (epsdiss1*J31L + epsdiss2*J32L + + epsdiss3*J33L)*PDdissipationNth3gt13 + (gt13L*J11L + + gt11L*J13L)*PDstandardNth1beta1 + (gt23L*J11L + + gt12L*J13L)*PDstandardNth1beta2 + (gt33L*J11L + + gt13L*J13L)*PDstandardNth1beta3 + (gt13L*J21L + + gt11L*J23L)*PDstandardNth2beta1 + (gt23L*J21L + + gt12L*J23L)*PDstandardNth2beta2 + (gt33L*J21L + + gt13L*J23L)*PDstandardNth2beta3 + (gt13L*J31L + + gt11L*J33L)*PDstandardNth3beta1 + (gt23L*J31L + + gt12L*J33L)*PDstandardNth3beta2 + (gt33L*J31L + + gt13L*J33L)*PDstandardNth3beta3 - + 0.666666666666666666666666666667*gt13L*(J11L*PDstandardNth1beta1 + + J12L*PDstandardNth1beta2 + J13L*PDstandardNth1beta3 + + J21L*PDstandardNth2beta1 + J22L*PDstandardNth2beta2 + + J23L*PDstandardNth2beta3 + J31L*PDstandardNth3beta1 + + J32L*PDstandardNth3beta2 + J33L*PDstandardNth3beta3) + (beta1L*J11L + + beta2L*J12L + beta3L*J13L)*PDupwindNthAnti1gt13 + (beta1L*J21L + + beta2L*J22L + beta3L*J23L)*PDupwindNthAnti2gt13 + (beta1L*J31L + + beta2L*J32L + beta3L*J33L)*PDupwindNthAnti3gt13 + + (J11L*PDupwindNthSymm1gt13 + J21L*PDupwindNthSymm2gt13 + + J31L*PDupwindNthSymm3gt13)*Abs(beta1L) + (J12L*PDupwindNthSymm1gt13 + + J22L*PDupwindNthSymm2gt13 + J32L*PDupwindNthSymm3gt13)*Abs(beta2L) + + (J13L*PDupwindNthSymm1gt13 + J23L*PDupwindNthSymm2gt13 + + J33L*PDupwindNthSymm3gt13)*Abs(beta3L); + + CCTK_REAL gt22rhsL = -2*alphaL*At22L + (epsdiss1*J11L + epsdiss2*J12L + + epsdiss3*J13L)*PDdissipationNth1gt22 + (epsdiss1*J21L + epsdiss2*J22L + + epsdiss3*J23L)*PDdissipationNth2gt22 + (epsdiss1*J31L + epsdiss2*J32L + + epsdiss3*J33L)*PDdissipationNth3gt22 - + 0.666666666666666666666666666667*gt22L*(J11L*PDstandardNth1beta1 + + J12L*PDstandardNth1beta2 + J13L*PDstandardNth1beta3 + + J21L*PDstandardNth2beta1 + J22L*PDstandardNth2beta2 + + J23L*PDstandardNth2beta3 + J31L*PDstandardNth3beta1 + + J32L*PDstandardNth3beta2 + J33L*PDstandardNth3beta3) + + 2*(J12L*(gt12L*PDstandardNth1beta1 + gt22L*PDstandardNth1beta2 + + gt23L*PDstandardNth1beta3) + J22L*(gt12L*PDstandardNth2beta1 + + gt22L*PDstandardNth2beta2 + gt23L*PDstandardNth2beta3) + + J32L*(gt12L*PDstandardNth3beta1 + gt22L*PDstandardNth3beta2 + + gt23L*PDstandardNth3beta3)) + (beta1L*J11L + beta2L*J12L + + beta3L*J13L)*PDupwindNthAnti1gt22 + (beta1L*J21L + beta2L*J22L + + beta3L*J23L)*PDupwindNthAnti2gt22 + (beta1L*J31L + beta2L*J32L + + beta3L*J33L)*PDupwindNthAnti3gt22 + (J11L*PDupwindNthSymm1gt22 + + J21L*PDupwindNthSymm2gt22 + J31L*PDupwindNthSymm3gt22)*Abs(beta1L) + + (J12L*PDupwindNthSymm1gt22 + J22L*PDupwindNthSymm2gt22 + + J32L*PDupwindNthSymm3gt22)*Abs(beta2L) + (J13L*PDupwindNthSymm1gt22 + + J23L*PDupwindNthSymm2gt22 + J33L*PDupwindNthSymm3gt22)*Abs(beta3L); + + CCTK_REAL gt23rhsL = -2*alphaL*At23L + (epsdiss1*J11L + epsdiss2*J12L + + epsdiss3*J13L)*PDdissipationNth1gt23 + (epsdiss1*J21L + epsdiss2*J22L + + epsdiss3*J23L)*PDdissipationNth2gt23 + (epsdiss1*J31L + epsdiss2*J32L + + epsdiss3*J33L)*PDdissipationNth3gt23 + (gt13L*J12L + + gt12L*J13L)*PDstandardNth1beta1 + (gt23L*J12L + + gt22L*J13L)*PDstandardNth1beta2 + (gt33L*J12L + + gt23L*J13L)*PDstandardNth1beta3 + (gt13L*J22L + + gt12L*J23L)*PDstandardNth2beta1 + (gt23L*J22L + + gt22L*J23L)*PDstandardNth2beta2 + (gt33L*J22L + + gt23L*J23L)*PDstandardNth2beta3 + (gt13L*J32L + + gt12L*J33L)*PDstandardNth3beta1 + (gt23L*J32L + + gt22L*J33L)*PDstandardNth3beta2 + (gt33L*J32L + + gt23L*J33L)*PDstandardNth3beta3 - + 0.666666666666666666666666666667*gt23L*(J11L*PDstandardNth1beta1 + + J12L*PDstandardNth1beta2 + J13L*PDstandardNth1beta3 + + J21L*PDstandardNth2beta1 + J22L*PDstandardNth2beta2 + + J23L*PDstandardNth2beta3 + J31L*PDstandardNth3beta1 + + J32L*PDstandardNth3beta2 + J33L*PDstandardNth3beta3) + (beta1L*J11L + + beta2L*J12L + beta3L*J13L)*PDupwindNthAnti1gt23 + (beta1L*J21L + + beta2L*J22L + beta3L*J23L)*PDupwindNthAnti2gt23 + (beta1L*J31L + + beta2L*J32L + beta3L*J33L)*PDupwindNthAnti3gt23 + + (J11L*PDupwindNthSymm1gt23 + J21L*PDupwindNthSymm2gt23 + + J31L*PDupwindNthSymm3gt23)*Abs(beta1L) + (J12L*PDupwindNthSymm1gt23 + + J22L*PDupwindNthSymm2gt23 + J32L*PDupwindNthSymm3gt23)*Abs(beta2L) + + (J13L*PDupwindNthSymm1gt23 + J23L*PDupwindNthSymm2gt23 + + J33L*PDupwindNthSymm3gt23)*Abs(beta3L); + + CCTK_REAL gt33rhsL = -2*alphaL*At33L + (epsdiss1*J11L + epsdiss2*J12L + + epsdiss3*J13L)*PDdissipationNth1gt33 + (epsdiss1*J21L + epsdiss2*J22L + + epsdiss3*J23L)*PDdissipationNth2gt33 + (epsdiss1*J31L + epsdiss2*J32L + + epsdiss3*J33L)*PDdissipationNth3gt33 - + 0.666666666666666666666666666667*gt33L*(J11L*PDstandardNth1beta1 + + J12L*PDstandardNth1beta2 + J13L*PDstandardNth1beta3 + + J21L*PDstandardNth2beta1 + J22L*PDstandardNth2beta2 + + J23L*PDstandardNth2beta3 + J31L*PDstandardNth3beta1 + + J32L*PDstandardNth3beta2 + J33L*PDstandardNth3beta3) + + 2*(J13L*(gt13L*PDstandardNth1beta1 + gt23L*PDstandardNth1beta2 + + gt33L*PDstandardNth1beta3) + J23L*(gt13L*PDstandardNth2beta1 + + gt23L*PDstandardNth2beta2 + gt33L*PDstandardNth2beta3) + + J33L*(gt13L*PDstandardNth3beta1 + gt23L*PDstandardNth3beta2 + + gt33L*PDstandardNth3beta3)) + (beta1L*J11L + beta2L*J12L + + beta3L*J13L)*PDupwindNthAnti1gt33 + (beta1L*J21L + beta2L*J22L + + beta3L*J23L)*PDupwindNthAnti2gt33 + (beta1L*J31L + beta2L*J32L + + beta3L*J33L)*PDupwindNthAnti3gt33 + (J11L*PDupwindNthSymm1gt33 + + J21L*PDupwindNthSymm2gt33 + J31L*PDupwindNthSymm3gt33)*Abs(beta1L) + + (J12L*PDupwindNthSymm1gt33 + J22L*PDupwindNthSymm2gt33 + + J32L*PDupwindNthSymm3gt33)*Abs(beta2L) + (J13L*PDupwindNthSymm1gt33 + + J23L*PDupwindNthSymm2gt33 + J33L*PDupwindNthSymm3gt33)*Abs(beta3L); + + CCTK_REAL dotXt1 = (epsdiss1*J11L + epsdiss2*J12L + + epsdiss3*J13L)*PDdissipationNth1Xt1 + (epsdiss1*J21L + epsdiss2*J22L + + epsdiss3*J23L)*PDdissipationNth2Xt1 + (epsdiss1*J31L + epsdiss2*J32L + + epsdiss3*J33L)*PDdissipationNth3Xt1 - 2*((Atu11*J11L + Atu12*J12L + + Atu13*J13L)*PDstandardNth1alpha + (Atu11*J21L + Atu12*J22L + + Atu13*J23L)*PDstandardNth2alpha + (Atu11*J31L + Atu12*J32L + + Atu13*J33L)*PDstandardNth3alpha) + + 2*(gtu12*(J11L*J12L*PDstandardNth11beta1 + + J12L*J21L*PDstandardNth12beta1 + J11L*J22L*PDstandardNth12beta1 + + J12L*J31L*PDstandardNth13beta1 + J11L*J32L*PDstandardNth13beta1 + + dJ112L*PDstandardNth1beta1 + J21L*J22L*PDstandardNth22beta1 + + J22L*J31L*PDstandardNth23beta1 + J21L*J32L*PDstandardNth23beta1 + + dJ212L*PDstandardNth2beta1 + J31L*J32L*PDstandardNth33beta1 + + dJ312L*PDstandardNth3beta1) + gtu13*(J11L*J13L*PDstandardNth11beta1 + + J13L*J21L*PDstandardNth12beta1 + J11L*J23L*PDstandardNth12beta1 + + J13L*J31L*PDstandardNth13beta1 + J11L*J33L*PDstandardNth13beta1 + + dJ113L*PDstandardNth1beta1 + J21L*J23L*PDstandardNth22beta1 + + J23L*J31L*PDstandardNth23beta1 + J21L*J33L*PDstandardNth23beta1 + + dJ213L*PDstandardNth2beta1 + J31L*J33L*PDstandardNth33beta1 + + dJ313L*PDstandardNth3beta1) + gtu23*(J12L*J13L*PDstandardNth11beta1 + + J13L*J22L*PDstandardNth12beta1 + J12L*J23L*PDstandardNth12beta1 + + J13L*J32L*PDstandardNth13beta1 + J12L*J33L*PDstandardNth13beta1 + + dJ123L*PDstandardNth1beta1 + J22L*J23L*PDstandardNth22beta1 + + J23L*J32L*PDstandardNth23beta1 + J22L*J33L*PDstandardNth23beta1 + + dJ223L*PDstandardNth2beta1 + J32L*J33L*PDstandardNth33beta1 + + dJ323L*PDstandardNth3beta1) + alphaL*(6*(Atu11*cdphi1 + Atu12*cdphi2 + + Atu13*cdphi3) + Atu11*Gt111 + 2*Atu12*Gt112 + 2*Atu13*Gt113 + + Atu22*Gt122 + 2*Atu23*Gt123 + Atu33*Gt133 - + 0.666666666666666666666666666667*((gtu11*J11L + gtu12*J12L + + gtu13*J13L)*PDstandardNth1trK + (gtu11*J21L + gtu12*J22L + + gtu13*J23L)*PDstandardNth2trK + (gtu11*J31L + gtu12*J32L + + gtu13*J33L)*PDstandardNth3trK))) + (beta1L*J11L + beta2L*J12L + + beta3L*J13L)*PDupwindNthAnti1Xt1 + (beta1L*J21L + beta2L*J22L + + beta3L*J23L)*PDupwindNthAnti2Xt1 + (beta1L*J31L + beta2L*J32L + + beta3L*J33L)*PDupwindNthAnti3Xt1 - + 50.26548245743669181540229413247204614715*alphaL*(gtu11*S1 + gtu12*S2 + + gtu13*S3) + 0.666666666666666666666666666667*(J11L*PDstandardNth1beta1 + + J12L*PDstandardNth1beta2 + J13L*PDstandardNth1beta3 + + J21L*PDstandardNth2beta1 + J22L*PDstandardNth2beta2 + + J23L*PDstandardNth2beta3 + J31L*PDstandardNth3beta1 + + J32L*PDstandardNth3beta2 + J33L*PDstandardNth3beta3)*Xtn1 - + PDstandardNth1beta1*(J11L*Xtn1 + J12L*Xtn2 + J13L*Xtn3) - + PDstandardNth2beta1*(J21L*Xtn1 + J22L*Xtn2 + J23L*Xtn3) - + PDstandardNth3beta1*(J31L*Xtn1 + J32L*Xtn2 + J33L*Xtn3) + + (J11L*PDupwindNthSymm1Xt1 + J21L*PDupwindNthSymm2Xt1 + + J31L*PDupwindNthSymm3Xt1)*Abs(beta1L) + (J12L*PDupwindNthSymm1Xt1 + + J22L*PDupwindNthSymm2Xt1 + J32L*PDupwindNthSymm3Xt1)*Abs(beta2L) + + (J13L*PDupwindNthSymm1Xt1 + J23L*PDupwindNthSymm2Xt1 + + J33L*PDupwindNthSymm3Xt1)*Abs(beta3L) + + gtu11*(2*J11L*J21L*PDstandardNth12beta1 + + 2*J11L*J31L*PDstandardNth13beta1 + dJ111L*PDstandardNth1beta1 + + 2*J21L*J31L*PDstandardNth23beta1 + dJ211L*PDstandardNth2beta1 + + dJ311L*PDstandardNth3beta1 + PDstandardNth11beta1*SQR(J11L) + + PDstandardNth22beta1*SQR(J21L) + PDstandardNth33beta1*SQR(J31L)) + + gtu22*(2*J12L*J22L*PDstandardNth12beta1 + + 2*J12L*J32L*PDstandardNth13beta1 + dJ122L*PDstandardNth1beta1 + + 2*J22L*J32L*PDstandardNth23beta1 + dJ222L*PDstandardNth2beta1 + + dJ322L*PDstandardNth3beta1 + PDstandardNth11beta1*SQR(J12L) + + PDstandardNth22beta1*SQR(J22L) + PDstandardNth33beta1*SQR(J32L)) + + gtu33*(2*J13L*J23L*PDstandardNth12beta1 + + 2*J13L*J33L*PDstandardNth13beta1 + dJ133L*PDstandardNth1beta1 + + 2*J23L*J33L*PDstandardNth23beta1 + dJ233L*PDstandardNth2beta1 + + dJ333L*PDstandardNth3beta1 + PDstandardNth11beta1*SQR(J13L) + + PDstandardNth22beta1*SQR(J23L) + PDstandardNth33beta1*SQR(J33L)) + + 0.333333333333333333333333333333*(gtu11*(J11L*J12L*PDstandardNth11beta2 + + J11L*J13L*PDstandardNth11beta3 + 2*J11L*J21L*PDstandardNth12beta1 + + J12L*J21L*PDstandardNth12beta2 + J11L*J22L*PDstandardNth12beta2 + + J13L*J21L*PDstandardNth12beta3 + J11L*J23L*PDstandardNth12beta3 + + 2*J11L*J31L*PDstandardNth13beta1 + J12L*J31L*PDstandardNth13beta2 + + J11L*J32L*PDstandardNth13beta2 + J13L*J31L*PDstandardNth13beta3 + + J11L*J33L*PDstandardNth13beta3 + dJ111L*PDstandardNth1beta1 + + dJ112L*PDstandardNth1beta2 + dJ113L*PDstandardNth1beta3 + + J21L*J22L*PDstandardNth22beta2 + J21L*J23L*PDstandardNth22beta3 + + 2*J21L*J31L*PDstandardNth23beta1 + J22L*J31L*PDstandardNth23beta2 + + J21L*J32L*PDstandardNth23beta2 + J23L*J31L*PDstandardNth23beta3 + + J21L*J33L*PDstandardNth23beta3 + dJ211L*PDstandardNth2beta1 + + dJ212L*PDstandardNth2beta2 + dJ213L*PDstandardNth2beta3 + + J31L*J32L*PDstandardNth33beta2 + J31L*J33L*PDstandardNth33beta3 + + dJ311L*PDstandardNth3beta1 + dJ312L*PDstandardNth3beta2 + + dJ313L*PDstandardNth3beta3 + PDstandardNth11beta1*SQR(J11L) + + PDstandardNth22beta1*SQR(J21L) + PDstandardNth33beta1*SQR(J31L)) + + gtu12*(J11L*J12L*PDstandardNth11beta1 + J12L*J13L*PDstandardNth11beta3 + + J12L*J21L*PDstandardNth12beta1 + J11L*J22L*PDstandardNth12beta1 + + 2*J12L*J22L*PDstandardNth12beta2 + J13L*J22L*PDstandardNth12beta3 + + J12L*J23L*PDstandardNth12beta3 + J12L*J31L*PDstandardNth13beta1 + + J11L*J32L*PDstandardNth13beta1 + 2*J12L*J32L*PDstandardNth13beta2 + + J13L*J32L*PDstandardNth13beta3 + J12L*J33L*PDstandardNth13beta3 + + dJ112L*PDstandardNth1beta1 + dJ122L*PDstandardNth1beta2 + + dJ123L*PDstandardNth1beta3 + J21L*J22L*PDstandardNth22beta1 + + J22L*J23L*PDstandardNth22beta3 + J22L*J31L*PDstandardNth23beta1 + + J21L*J32L*PDstandardNth23beta1 + 2*J22L*J32L*PDstandardNth23beta2 + + J23L*J32L*PDstandardNth23beta3 + J22L*J33L*PDstandardNth23beta3 + + dJ212L*PDstandardNth2beta1 + dJ222L*PDstandardNth2beta2 + + dJ223L*PDstandardNth2beta3 + J31L*J32L*PDstandardNth33beta1 + + J32L*J33L*PDstandardNth33beta3 + dJ312L*PDstandardNth3beta1 + + dJ322L*PDstandardNth3beta2 + dJ323L*PDstandardNth3beta3 + + PDstandardNth11beta2*SQR(J12L) + PDstandardNth22beta2*SQR(J22L) + + PDstandardNth33beta2*SQR(J32L)) + gtu13*(J11L*J13L*PDstandardNth11beta1 + + J12L*J13L*PDstandardNth11beta2 + J13L*J21L*PDstandardNth12beta1 + + J11L*J23L*PDstandardNth12beta1 + J13L*J22L*PDstandardNth12beta2 + + J12L*J23L*PDstandardNth12beta2 + 2*J13L*J23L*PDstandardNth12beta3 + + J13L*J31L*PDstandardNth13beta1 + J11L*J33L*PDstandardNth13beta1 + + J13L*J32L*PDstandardNth13beta2 + J12L*J33L*PDstandardNth13beta2 + + 2*J13L*J33L*PDstandardNth13beta3 + dJ113L*PDstandardNth1beta1 + + dJ123L*PDstandardNth1beta2 + dJ133L*PDstandardNth1beta3 + + J21L*J23L*PDstandardNth22beta1 + J22L*J23L*PDstandardNth22beta2 + + J23L*J31L*PDstandardNth23beta1 + J21L*J33L*PDstandardNth23beta1 + + J23L*J32L*PDstandardNth23beta2 + J22L*J33L*PDstandardNth23beta2 + + 2*J23L*J33L*PDstandardNth23beta3 + dJ213L*PDstandardNth2beta1 + + dJ223L*PDstandardNth2beta2 + dJ233L*PDstandardNth2beta3 + + J31L*J33L*PDstandardNth33beta1 + J32L*J33L*PDstandardNth33beta2 + + dJ313L*PDstandardNth3beta1 + dJ323L*PDstandardNth3beta2 + + dJ333L*PDstandardNth3beta3 + PDstandardNth11beta3*SQR(J13L) + + PDstandardNth22beta3*SQR(J23L) + PDstandardNth33beta3*SQR(J33L))); + + CCTK_REAL dotXt2 = (epsdiss1*J11L + epsdiss2*J12L + + epsdiss3*J13L)*PDdissipationNth1Xt2 + (epsdiss1*J21L + epsdiss2*J22L + + epsdiss3*J23L)*PDdissipationNth2Xt2 + (epsdiss1*J31L + epsdiss2*J32L + + epsdiss3*J33L)*PDdissipationNth3Xt2 - 2*((Atu12*J11L + Atu22*J12L + + Atu23*J13L)*PDstandardNth1alpha + (Atu12*J21L + Atu22*J22L + + Atu23*J23L)*PDstandardNth2alpha + (Atu12*J31L + Atu22*J32L + + Atu23*J33L)*PDstandardNth3alpha) + + 2*(gtu12*(J11L*J12L*PDstandardNth11beta2 + + J12L*J21L*PDstandardNth12beta2 + J11L*J22L*PDstandardNth12beta2 + + J12L*J31L*PDstandardNth13beta2 + J11L*J32L*PDstandardNth13beta2 + + dJ112L*PDstandardNth1beta2 + J21L*J22L*PDstandardNth22beta2 + + J22L*J31L*PDstandardNth23beta2 + J21L*J32L*PDstandardNth23beta2 + + dJ212L*PDstandardNth2beta2 + J31L*J32L*PDstandardNth33beta2 + + dJ312L*PDstandardNth3beta2) + gtu13*(J11L*J13L*PDstandardNth11beta2 + + J13L*J21L*PDstandardNth12beta2 + J11L*J23L*PDstandardNth12beta2 + + J13L*J31L*PDstandardNth13beta2 + J11L*J33L*PDstandardNth13beta2 + + dJ113L*PDstandardNth1beta2 + J21L*J23L*PDstandardNth22beta2 + + J23L*J31L*PDstandardNth23beta2 + J21L*J33L*PDstandardNth23beta2 + + dJ213L*PDstandardNth2beta2 + J31L*J33L*PDstandardNth33beta2 + + dJ313L*PDstandardNth3beta2) + gtu23*(J12L*J13L*PDstandardNth11beta2 + + J13L*J22L*PDstandardNth12beta2 + J12L*J23L*PDstandardNth12beta2 + + J13L*J32L*PDstandardNth13beta2 + J12L*J33L*PDstandardNth13beta2 + + dJ123L*PDstandardNth1beta2 + J22L*J23L*PDstandardNth22beta2 + + J23L*J32L*PDstandardNth23beta2 + J22L*J33L*PDstandardNth23beta2 + + dJ223L*PDstandardNth2beta2 + J32L*J33L*PDstandardNth33beta2 + + dJ323L*PDstandardNth3beta2) + alphaL*(6*(Atu12*cdphi1 + Atu22*cdphi2 + + Atu23*cdphi3) + Atu11*Gt211 + 2*Atu12*Gt212 + 2*Atu13*Gt213 + + Atu22*Gt222 + 2*Atu23*Gt223 + Atu33*Gt233 - + 0.666666666666666666666666666667*((gtu12*J11L + gtu22*J12L + + gtu23*J13L)*PDstandardNth1trK + (gtu12*J21L + gtu22*J22L + + gtu23*J23L)*PDstandardNth2trK + (gtu12*J31L + gtu22*J32L + + gtu23*J33L)*PDstandardNth3trK))) + (beta1L*J11L + beta2L*J12L + + beta3L*J13L)*PDupwindNthAnti1Xt2 + (beta1L*J21L + beta2L*J22L + + beta3L*J23L)*PDupwindNthAnti2Xt2 + (beta1L*J31L + beta2L*J32L + + beta3L*J33L)*PDupwindNthAnti3Xt2 - + 50.26548245743669181540229413247204614715*alphaL*(gtu12*S1 + gtu22*S2 + + gtu23*S3) + 0.666666666666666666666666666667*(J11L*PDstandardNth1beta1 + + J12L*PDstandardNth1beta2 + J13L*PDstandardNth1beta3 + + J21L*PDstandardNth2beta1 + J22L*PDstandardNth2beta2 + + J23L*PDstandardNth2beta3 + J31L*PDstandardNth3beta1 + + J32L*PDstandardNth3beta2 + J33L*PDstandardNth3beta3)*Xtn2 - + PDstandardNth1beta2*(J11L*Xtn1 + J12L*Xtn2 + J13L*Xtn3) - + PDstandardNth2beta2*(J21L*Xtn1 + J22L*Xtn2 + J23L*Xtn3) - + PDstandardNth3beta2*(J31L*Xtn1 + J32L*Xtn2 + J33L*Xtn3) + + (J11L*PDupwindNthSymm1Xt2 + J21L*PDupwindNthSymm2Xt2 + + J31L*PDupwindNthSymm3Xt2)*Abs(beta1L) + (J12L*PDupwindNthSymm1Xt2 + + J22L*PDupwindNthSymm2Xt2 + J32L*PDupwindNthSymm3Xt2)*Abs(beta2L) + + (J13L*PDupwindNthSymm1Xt2 + J23L*PDupwindNthSymm2Xt2 + + J33L*PDupwindNthSymm3Xt2)*Abs(beta3L) + + gtu11*(2*J11L*J21L*PDstandardNth12beta2 + + 2*J11L*J31L*PDstandardNth13beta2 + dJ111L*PDstandardNth1beta2 + + 2*J21L*J31L*PDstandardNth23beta2 + dJ211L*PDstandardNth2beta2 + + dJ311L*PDstandardNth3beta2 + PDstandardNth11beta2*SQR(J11L) + + PDstandardNth22beta2*SQR(J21L) + PDstandardNth33beta2*SQR(J31L)) + + gtu22*(2*J12L*J22L*PDstandardNth12beta2 + + 2*J12L*J32L*PDstandardNth13beta2 + dJ122L*PDstandardNth1beta2 + + 2*J22L*J32L*PDstandardNth23beta2 + dJ222L*PDstandardNth2beta2 + + dJ322L*PDstandardNth3beta2 + PDstandardNth11beta2*SQR(J12L) + + PDstandardNth22beta2*SQR(J22L) + PDstandardNth33beta2*SQR(J32L)) + + gtu33*(2*J13L*J23L*PDstandardNth12beta2 + + 2*J13L*J33L*PDstandardNth13beta2 + dJ133L*PDstandardNth1beta2 + + 2*J23L*J33L*PDstandardNth23beta2 + dJ233L*PDstandardNth2beta2 + + dJ333L*PDstandardNth3beta2 + PDstandardNth11beta2*SQR(J13L) + + PDstandardNth22beta2*SQR(J23L) + PDstandardNth33beta2*SQR(J33L)) + + 0.333333333333333333333333333333*(gtu12*(J11L*J12L*PDstandardNth11beta2 + + J11L*J13L*PDstandardNth11beta3 + 2*J11L*J21L*PDstandardNth12beta1 + + J12L*J21L*PDstandardNth12beta2 + J11L*J22L*PDstandardNth12beta2 + + J13L*J21L*PDstandardNth12beta3 + J11L*J23L*PDstandardNth12beta3 + + 2*J11L*J31L*PDstandardNth13beta1 + J12L*J31L*PDstandardNth13beta2 + + J11L*J32L*PDstandardNth13beta2 + J13L*J31L*PDstandardNth13beta3 + + J11L*J33L*PDstandardNth13beta3 + dJ111L*PDstandardNth1beta1 + + dJ112L*PDstandardNth1beta2 + dJ113L*PDstandardNth1beta3 + + J21L*J22L*PDstandardNth22beta2 + J21L*J23L*PDstandardNth22beta3 + + 2*J21L*J31L*PDstandardNth23beta1 + J22L*J31L*PDstandardNth23beta2 + + J21L*J32L*PDstandardNth23beta2 + J23L*J31L*PDstandardNth23beta3 + + J21L*J33L*PDstandardNth23beta3 + dJ211L*PDstandardNth2beta1 + + dJ212L*PDstandardNth2beta2 + dJ213L*PDstandardNth2beta3 + + J31L*J32L*PDstandardNth33beta2 + J31L*J33L*PDstandardNth33beta3 + + dJ311L*PDstandardNth3beta1 + dJ312L*PDstandardNth3beta2 + + dJ313L*PDstandardNth3beta3 + PDstandardNth11beta1*SQR(J11L) + + PDstandardNth22beta1*SQR(J21L) + PDstandardNth33beta1*SQR(J31L)) + + gtu22*(J11L*J12L*PDstandardNth11beta1 + J12L*J13L*PDstandardNth11beta3 + + J12L*J21L*PDstandardNth12beta1 + J11L*J22L*PDstandardNth12beta1 + + 2*J12L*J22L*PDstandardNth12beta2 + J13L*J22L*PDstandardNth12beta3 + + J12L*J23L*PDstandardNth12beta3 + J12L*J31L*PDstandardNth13beta1 + + J11L*J32L*PDstandardNth13beta1 + 2*J12L*J32L*PDstandardNth13beta2 + + J13L*J32L*PDstandardNth13beta3 + J12L*J33L*PDstandardNth13beta3 + + dJ112L*PDstandardNth1beta1 + dJ122L*PDstandardNth1beta2 + + dJ123L*PDstandardNth1beta3 + J21L*J22L*PDstandardNth22beta1 + + J22L*J23L*PDstandardNth22beta3 + J22L*J31L*PDstandardNth23beta1 + + J21L*J32L*PDstandardNth23beta1 + 2*J22L*J32L*PDstandardNth23beta2 + + J23L*J32L*PDstandardNth23beta3 + J22L*J33L*PDstandardNth23beta3 + + dJ212L*PDstandardNth2beta1 + dJ222L*PDstandardNth2beta2 + + dJ223L*PDstandardNth2beta3 + J31L*J32L*PDstandardNth33beta1 + + J32L*J33L*PDstandardNth33beta3 + dJ312L*PDstandardNth3beta1 + + dJ322L*PDstandardNth3beta2 + dJ323L*PDstandardNth3beta3 + + PDstandardNth11beta2*SQR(J12L) + PDstandardNth22beta2*SQR(J22L) + + PDstandardNth33beta2*SQR(J32L)) + gtu23*(J11L*J13L*PDstandardNth11beta1 + + J12L*J13L*PDstandardNth11beta2 + J13L*J21L*PDstandardNth12beta1 + + J11L*J23L*PDstandardNth12beta1 + J13L*J22L*PDstandardNth12beta2 + + J12L*J23L*PDstandardNth12beta2 + 2*J13L*J23L*PDstandardNth12beta3 + + J13L*J31L*PDstandardNth13beta1 + J11L*J33L*PDstandardNth13beta1 + + J13L*J32L*PDstandardNth13beta2 + J12L*J33L*PDstandardNth13beta2 + + 2*J13L*J33L*PDstandardNth13beta3 + dJ113L*PDstandardNth1beta1 + + dJ123L*PDstandardNth1beta2 + dJ133L*PDstandardNth1beta3 + + J21L*J23L*PDstandardNth22beta1 + J22L*J23L*PDstandardNth22beta2 + + J23L*J31L*PDstandardNth23beta1 + J21L*J33L*PDstandardNth23beta1 + + J23L*J32L*PDstandardNth23beta2 + J22L*J33L*PDstandardNth23beta2 + + 2*J23L*J33L*PDstandardNth23beta3 + dJ213L*PDstandardNth2beta1 + + dJ223L*PDstandardNth2beta2 + dJ233L*PDstandardNth2beta3 + + J31L*J33L*PDstandardNth33beta1 + J32L*J33L*PDstandardNth33beta2 + + dJ313L*PDstandardNth3beta1 + dJ323L*PDstandardNth3beta2 + + dJ333L*PDstandardNth3beta3 + PDstandardNth11beta3*SQR(J13L) + + PDstandardNth22beta3*SQR(J23L) + PDstandardNth33beta3*SQR(J33L))); + + CCTK_REAL dotXt3 = (epsdiss1*J11L + epsdiss2*J12L + + epsdiss3*J13L)*PDdissipationNth1Xt3 + (epsdiss1*J21L + epsdiss2*J22L + + epsdiss3*J23L)*PDdissipationNth2Xt3 + (epsdiss1*J31L + epsdiss2*J32L + + epsdiss3*J33L)*PDdissipationNth3Xt3 - 2*((Atu13*J11L + Atu23*J12L + + Atu33*J13L)*PDstandardNth1alpha + (Atu13*J21L + Atu23*J22L + + Atu33*J23L)*PDstandardNth2alpha + (Atu13*J31L + Atu23*J32L + + Atu33*J33L)*PDstandardNth3alpha) + + 2*(gtu12*(J11L*J12L*PDstandardNth11beta3 + + J12L*J21L*PDstandardNth12beta3 + J11L*J22L*PDstandardNth12beta3 + + J12L*J31L*PDstandardNth13beta3 + J11L*J32L*PDstandardNth13beta3 + + dJ112L*PDstandardNth1beta3 + J21L*J22L*PDstandardNth22beta3 + + J22L*J31L*PDstandardNth23beta3 + J21L*J32L*PDstandardNth23beta3 + + dJ212L*PDstandardNth2beta3 + J31L*J32L*PDstandardNth33beta3 + + dJ312L*PDstandardNth3beta3) + gtu13*(J11L*J13L*PDstandardNth11beta3 + + J13L*J21L*PDstandardNth12beta3 + J11L*J23L*PDstandardNth12beta3 + + J13L*J31L*PDstandardNth13beta3 + J11L*J33L*PDstandardNth13beta3 + + dJ113L*PDstandardNth1beta3 + J21L*J23L*PDstandardNth22beta3 + + J23L*J31L*PDstandardNth23beta3 + J21L*J33L*PDstandardNth23beta3 + + dJ213L*PDstandardNth2beta3 + J31L*J33L*PDstandardNth33beta3 + + dJ313L*PDstandardNth3beta3) + gtu23*(J12L*J13L*PDstandardNth11beta3 + + J13L*J22L*PDstandardNth12beta3 + J12L*J23L*PDstandardNth12beta3 + + J13L*J32L*PDstandardNth13beta3 + J12L*J33L*PDstandardNth13beta3 + + dJ123L*PDstandardNth1beta3 + J22L*J23L*PDstandardNth22beta3 + + J23L*J32L*PDstandardNth23beta3 + J22L*J33L*PDstandardNth23beta3 + + dJ223L*PDstandardNth2beta3 + J32L*J33L*PDstandardNth33beta3 + + dJ323L*PDstandardNth3beta3) + alphaL*(6*(Atu13*cdphi1 + Atu23*cdphi2 + + Atu33*cdphi3) + Atu11*Gt311 + 2*Atu12*Gt312 + 2*Atu13*Gt313 + + Atu22*Gt322 + 2*Atu23*Gt323 + Atu33*Gt333 - + 0.666666666666666666666666666667*((gtu13*J11L + gtu23*J12L + + gtu33*J13L)*PDstandardNth1trK + (gtu13*J21L + gtu23*J22L + + gtu33*J23L)*PDstandardNth2trK + (gtu13*J31L + gtu23*J32L + + gtu33*J33L)*PDstandardNth3trK))) + (beta1L*J11L + beta2L*J12L + + beta3L*J13L)*PDupwindNthAnti1Xt3 + (beta1L*J21L + beta2L*J22L + + beta3L*J23L)*PDupwindNthAnti2Xt3 + (beta1L*J31L + beta2L*J32L + + beta3L*J33L)*PDupwindNthAnti3Xt3 - + 50.26548245743669181540229413247204614715*alphaL*(gtu13*S1 + gtu23*S2 + + gtu33*S3) + 0.666666666666666666666666666667*(J11L*PDstandardNth1beta1 + + J12L*PDstandardNth1beta2 + J13L*PDstandardNth1beta3 + + J21L*PDstandardNth2beta1 + J22L*PDstandardNth2beta2 + + J23L*PDstandardNth2beta3 + J31L*PDstandardNth3beta1 + + J32L*PDstandardNth3beta2 + J33L*PDstandardNth3beta3)*Xtn3 - + PDstandardNth1beta3*(J11L*Xtn1 + J12L*Xtn2 + J13L*Xtn3) - + PDstandardNth2beta3*(J21L*Xtn1 + J22L*Xtn2 + J23L*Xtn3) - + PDstandardNth3beta3*(J31L*Xtn1 + J32L*Xtn2 + J33L*Xtn3) + + (J11L*PDupwindNthSymm1Xt3 + J21L*PDupwindNthSymm2Xt3 + + J31L*PDupwindNthSymm3Xt3)*Abs(beta1L) + (J12L*PDupwindNthSymm1Xt3 + + J22L*PDupwindNthSymm2Xt3 + J32L*PDupwindNthSymm3Xt3)*Abs(beta2L) + + (J13L*PDupwindNthSymm1Xt3 + J23L*PDupwindNthSymm2Xt3 + + J33L*PDupwindNthSymm3Xt3)*Abs(beta3L) + + gtu11*(2*J11L*J21L*PDstandardNth12beta3 + + 2*J11L*J31L*PDstandardNth13beta3 + dJ111L*PDstandardNth1beta3 + + 2*J21L*J31L*PDstandardNth23beta3 + dJ211L*PDstandardNth2beta3 + + dJ311L*PDstandardNth3beta3 + PDstandardNth11beta3*SQR(J11L) + + PDstandardNth22beta3*SQR(J21L) + PDstandardNth33beta3*SQR(J31L)) + + gtu22*(2*J12L*J22L*PDstandardNth12beta3 + + 2*J12L*J32L*PDstandardNth13beta3 + dJ122L*PDstandardNth1beta3 + + 2*J22L*J32L*PDstandardNth23beta3 + dJ222L*PDstandardNth2beta3 + + dJ322L*PDstandardNth3beta3 + PDstandardNth11beta3*SQR(J12L) + + PDstandardNth22beta3*SQR(J22L) + PDstandardNth33beta3*SQR(J32L)) + + gtu33*(2*J13L*J23L*PDstandardNth12beta3 + + 2*J13L*J33L*PDstandardNth13beta3 + dJ133L*PDstandardNth1beta3 + + 2*J23L*J33L*PDstandardNth23beta3 + dJ233L*PDstandardNth2beta3 + + dJ333L*PDstandardNth3beta3 + PDstandardNth11beta3*SQR(J13L) + + PDstandardNth22beta3*SQR(J23L) + PDstandardNth33beta3*SQR(J33L)) + + 0.333333333333333333333333333333*(gtu13*(J11L*J12L*PDstandardNth11beta2 + + J11L*J13L*PDstandardNth11beta3 + 2*J11L*J21L*PDstandardNth12beta1 + + J12L*J21L*PDstandardNth12beta2 + J11L*J22L*PDstandardNth12beta2 + + J13L*J21L*PDstandardNth12beta3 + J11L*J23L*PDstandardNth12beta3 + + 2*J11L*J31L*PDstandardNth13beta1 + J12L*J31L*PDstandardNth13beta2 + + J11L*J32L*PDstandardNth13beta2 + J13L*J31L*PDstandardNth13beta3 + + J11L*J33L*PDstandardNth13beta3 + dJ111L*PDstandardNth1beta1 + + dJ112L*PDstandardNth1beta2 + dJ113L*PDstandardNth1beta3 + + J21L*J22L*PDstandardNth22beta2 + J21L*J23L*PDstandardNth22beta3 + + 2*J21L*J31L*PDstandardNth23beta1 + J22L*J31L*PDstandardNth23beta2 + + J21L*J32L*PDstandardNth23beta2 + J23L*J31L*PDstandardNth23beta3 + + J21L*J33L*PDstandardNth23beta3 + dJ211L*PDstandardNth2beta1 + + dJ212L*PDstandardNth2beta2 + dJ213L*PDstandardNth2beta3 + + J31L*J32L*PDstandardNth33beta2 + J31L*J33L*PDstandardNth33beta3 + + dJ311L*PDstandardNth3beta1 + dJ312L*PDstandardNth3beta2 + + dJ313L*PDstandardNth3beta3 + PDstandardNth11beta1*SQR(J11L) + + PDstandardNth22beta1*SQR(J21L) + PDstandardNth33beta1*SQR(J31L)) + + gtu23*(J11L*J12L*PDstandardNth11beta1 + J12L*J13L*PDstandardNth11beta3 + + J12L*J21L*PDstandardNth12beta1 + J11L*J22L*PDstandardNth12beta1 + + 2*J12L*J22L*PDstandardNth12beta2 + J13L*J22L*PDstandardNth12beta3 + + J12L*J23L*PDstandardNth12beta3 + J12L*J31L*PDstandardNth13beta1 + + J11L*J32L*PDstandardNth13beta1 + 2*J12L*J32L*PDstandardNth13beta2 + + J13L*J32L*PDstandardNth13beta3 + J12L*J33L*PDstandardNth13beta3 + + dJ112L*PDstandardNth1beta1 + dJ122L*PDstandardNth1beta2 + + dJ123L*PDstandardNth1beta3 + J21L*J22L*PDstandardNth22beta1 + + J22L*J23L*PDstandardNth22beta3 + J22L*J31L*PDstandardNth23beta1 + + J21L*J32L*PDstandardNth23beta1 + 2*J22L*J32L*PDstandardNth23beta2 + + J23L*J32L*PDstandardNth23beta3 + J22L*J33L*PDstandardNth23beta3 + + dJ212L*PDstandardNth2beta1 + dJ222L*PDstandardNth2beta2 + + dJ223L*PDstandardNth2beta3 + J31L*J32L*PDstandardNth33beta1 + + J32L*J33L*PDstandardNth33beta3 + dJ312L*PDstandardNth3beta1 + + dJ322L*PDstandardNth3beta2 + dJ323L*PDstandardNth3beta3 + + PDstandardNth11beta2*SQR(J12L) + PDstandardNth22beta2*SQR(J22L) + + PDstandardNth33beta2*SQR(J32L)) + gtu33*(J11L*J13L*PDstandardNth11beta1 + + J12L*J13L*PDstandardNth11beta2 + J13L*J21L*PDstandardNth12beta1 + + J11L*J23L*PDstandardNth12beta1 + J13L*J22L*PDstandardNth12beta2 + + J12L*J23L*PDstandardNth12beta2 + 2*J13L*J23L*PDstandardNth12beta3 + + J13L*J31L*PDstandardNth13beta1 + J11L*J33L*PDstandardNth13beta1 + + J13L*J32L*PDstandardNth13beta2 + J12L*J33L*PDstandardNth13beta2 + + 2*J13L*J33L*PDstandardNth13beta3 + dJ113L*PDstandardNth1beta1 + + dJ123L*PDstandardNth1beta2 + dJ133L*PDstandardNth1beta3 + + J21L*J23L*PDstandardNth22beta1 + J22L*J23L*PDstandardNth22beta2 + + J23L*J31L*PDstandardNth23beta1 + J21L*J33L*PDstandardNth23beta1 + + J23L*J32L*PDstandardNth23beta2 + J22L*J33L*PDstandardNth23beta2 + + 2*J23L*J33L*PDstandardNth23beta3 + dJ213L*PDstandardNth2beta1 + + dJ223L*PDstandardNth2beta2 + dJ233L*PDstandardNth2beta3 + + J31L*J33L*PDstandardNth33beta1 + J32L*J33L*PDstandardNth33beta2 + + dJ313L*PDstandardNth3beta1 + dJ323L*PDstandardNth3beta2 + + dJ333L*PDstandardNth3beta3 + PDstandardNth11beta3*SQR(J13L) + + PDstandardNth22beta3*SQR(J23L) + PDstandardNth33beta3*SQR(J33L))); + + CCTK_REAL Xt1rhsL = dotXt1; + + CCTK_REAL Xt2rhsL = dotXt2; + + CCTK_REAL Xt3rhsL = dotXt3; + + CCTK_REAL dottrK = (epsdiss1*J11L + epsdiss2*J12L + + epsdiss3*J13L)*PDdissipationNth1trK + (epsdiss1*J21L + epsdiss2*J22L + + epsdiss3*J23L)*PDdissipationNth2trK + (epsdiss1*J31L + epsdiss2*J32L + + epsdiss3*J33L)*PDdissipationNth3trK + (beta1L*J11L + beta2L*J12L + + beta3L*J13L)*PDupwindNthAnti1trK + (beta1L*J21L + beta2L*J22L + + beta3L*J23L)*PDupwindNthAnti2trK + (beta1L*J31L + beta2L*J32L + + beta3L*J33L)*PDupwindNthAnti3trK + (J11L*PDupwindNthSymm1trK + + J21L*PDupwindNthSymm2trK + J31L*PDupwindNthSymm3trK)*Abs(beta1L) + + (J12L*PDupwindNthSymm1trK + J22L*PDupwindNthSymm2trK + + J32L*PDupwindNthSymm3trK)*Abs(beta2L) + (J13L*PDupwindNthSymm1trK + + J23L*PDupwindNthSymm2trK + J33L*PDupwindNthSymm3trK)*Abs(beta3L) - + em4phi*(2*((gtu12*J11L*J22L + gtu13*(J13L*J21L + + J11L*J23L))*PDstandardNth12alpha + (gtu12*J11L*J32L + gtu13*(J13L*J31L + + J11L*J33L))*PDstandardNth13alpha + J11L*((gtu12*J12L + + gtu13*J13L)*PDstandardNth11alpha + gtu11*(J21L*PDstandardNth12alpha + + J31L*PDstandardNth13alpha)) + J12L*(gtu23*J13L*PDstandardNth11alpha + + gtu12*(J21L*PDstandardNth12alpha + J31L*PDstandardNth13alpha)) + + (gtu11*J21L*J31L + (gtu22*J22L + gtu23*J23L)*J32L + (gtu23*J22L + + gtu33*J23L)*J33L)*PDstandardNth23alpha + J22L*((gtu22*J12L + + gtu23*J13L)*PDstandardNth12alpha + (gtu12*J21L + + gtu23*J23L)*PDstandardNth22alpha + gtu12*J31L*PDstandardNth23alpha) + + J23L*((gtu23*J12L + gtu33*J13L)*PDstandardNth12alpha + + gtu13*(J21L*PDstandardNth22alpha + J31L*PDstandardNth23alpha)) + + (gtu12*(dJ312L + cdphi2*J31L) + cdphi3*(gtu13*J31L + + gtu23*J32L))*PDstandardNth3alpha + J32L*((gtu22*J12L + + gtu23*J13L)*PDstandardNth13alpha + gtu23*J33L*PDstandardNth33alpha + + gtu12*(J21L*PDstandardNth23alpha + J31L*PDstandardNth33alpha) + + cdphi2*gtu22*PDstandardNth3alpha) + J33L*((gtu23*J12L + + gtu33*J13L)*PDstandardNth13alpha + gtu13*(J21L*PDstandardNth23alpha + + J31L*PDstandardNth33alpha) + (cdphi2*gtu23 + + cdphi3*gtu33)*PDstandardNth3alpha)) + + PDstandardNth1alpha*(gtu11*(dJ111L + 2*cdphi1*J11L) + gtu22*(dJ122L + + 2*cdphi2*J12L) + gtu33*(dJ133L + 2*cdphi3*J13L) + 2*(dJ112L*gtu12 + + dJ113L*gtu13 + dJ123L*gtu23 + cdphi2*gtu12*J11L + cdphi3*gtu13*J11L + + cdphi1*gtu12*J12L + cdphi3*gtu23*J12L + cdphi1*gtu13*J13L + + cdphi2*gtu23*J13L) - J11L*Xtn1 - J12L*Xtn2 - J13L*Xtn3) + + PDstandardNth2alpha*(gtu11*(dJ211L + 2*cdphi1*J21L) + gtu22*(dJ222L + + 2*cdphi2*J22L) + gtu33*(dJ233L + 2*cdphi3*J23L) + 2*(dJ212L*gtu12 + + dJ213L*gtu13 + dJ223L*gtu23 + cdphi2*gtu12*J21L + cdphi3*gtu13*J21L + + cdphi1*gtu12*J22L + cdphi3*gtu23*J22L + cdphi1*gtu13*J23L + + cdphi2*gtu23*J23L) - J21L*Xtn1 - J22L*Xtn2 - J23L*Xtn3) + + PDstandardNth3alpha*(dJ322L*gtu22 + dJ333L*gtu33 + gtu11*(dJ311L + + 2*cdphi1*J31L) + 2*(dJ313L*gtu13 + dJ323L*gtu23 + cdphi1*gtu12*J32L + + cdphi1*gtu13*J33L) - J31L*Xtn1 - J32L*Xtn2 - J33L*Xtn3) + + PDstandardNth11alpha*(gtu11*SQR(J11L) + gtu22*SQR(J12L) + + gtu33*SQR(J13L)) + PDstandardNth22alpha*(gtu11*SQR(J21L) + + gtu22*SQR(J22L) + gtu33*SQR(J23L)) + + PDstandardNth33alpha*(gtu11*SQR(J31L) + gtu22*SQR(J32L) + + gtu33*SQR(J33L))) + alphaL*(2*(Atm12*Atm21 + Atm13*Atm31 + Atm23*Atm32) + + 12.56637061435917295385057353311801153679*(rho + trS) + SQR(Atm11) + + SQR(Atm22) + SQR(Atm33) + 0.333333333333333333333333333333*SQR(trKL)); + + CCTK_REAL trKrhsL = dottrK; + + CCTK_REAL alpharhsL = (epsdiss1*J11L + epsdiss2*J12L + + epsdiss3*J13L)*PDdissipationNth1alpha + (epsdiss1*J21L + epsdiss2*J22L + + epsdiss3*J23L)*PDdissipationNth2alpha + (epsdiss1*J31L + + epsdiss2*J32L + epsdiss3*J33L)*PDdissipationNth3alpha - + pow(alphaL,ToReal(harmonicN))*ToReal(harmonicF)*(trKL + (AL - + trKL)*ToReal(LapseACoeff)) + ((beta1L*J11L + beta2L*J12L + + beta3L*J13L)*PDupwindNthAnti1alpha + (beta1L*J21L + beta2L*J22L + + beta3L*J23L)*PDupwindNthAnti2alpha + (beta1L*J31L + beta2L*J32L + + beta3L*J33L)*PDupwindNthAnti3alpha + (J11L*PDupwindNthSymm1alpha + + J21L*PDupwindNthSymm2alpha + J31L*PDupwindNthSymm3alpha)*Abs(beta1L) + + (J12L*PDupwindNthSymm1alpha + J22L*PDupwindNthSymm2alpha + + J32L*PDupwindNthSymm3alpha)*Abs(beta2L) + (J13L*PDupwindNthSymm1alpha + + J23L*PDupwindNthSymm2alpha + + J33L*PDupwindNthSymm3alpha)*Abs(beta3L))*ToReal(LapseAdvectionCoeff); + + CCTK_REAL ArhsL = (epsdiss1*J11L + epsdiss2*J12L + + epsdiss3*J13L)*PDdissipationNth1A + (epsdiss1*J21L + epsdiss2*J22L + + epsdiss3*J23L)*PDdissipationNth2A + (epsdiss1*J31L + epsdiss2*J32L + + epsdiss3*J33L)*PDdissipationNth3A + (dottrK - + AL*ToReal(AlphaDriver))*ToReal(LapseACoeff) + ((beta1L*J11L + + beta2L*J12L + beta3L*J13L)*PDupwindNthAnti1A + (beta1L*J21L + + beta2L*J22L + beta3L*J23L)*PDupwindNthAnti2A + (beta1L*J31L + + beta2L*J32L + beta3L*J33L)*PDupwindNthAnti3A + (J11L*PDupwindNthSymm1A + + J21L*PDupwindNthSymm2A + J31L*PDupwindNthSymm3A)*Abs(beta1L) + + (J12L*PDupwindNthSymm1A + J22L*PDupwindNthSymm2A + + J32L*PDupwindNthSymm3A)*Abs(beta2L) + (J13L*PDupwindNthSymm1A + + J23L*PDupwindNthSymm2A + + J33L*PDupwindNthSymm3A)*Abs(beta3L))*ToReal(LapseAdvectionCoeff); + + CCTK_REAL eta = fmin(1,INV(rL)*ToReal(SpatialBetaDriverRadius)); + + CCTK_REAL theta = fmin(1,exp(1 - + rL*INV(ToReal(SpatialShiftGammaCoeffRadius)))); + + CCTK_REAL beta1rhsL = (epsdiss1*J11L + epsdiss2*J12L + + epsdiss3*J13L)*PDdissipationNth1beta1 + (epsdiss1*J21L + epsdiss2*J22L + + epsdiss3*J23L)*PDdissipationNth2beta1 + (epsdiss1*J31L + + epsdiss2*J32L + epsdiss3*J33L)*PDdissipationNth3beta1 + ((beta1L*J11L + + beta2L*J12L + beta3L*J13L)*PDupwindNthAnti1beta1 + (beta1L*J21L + + beta2L*J22L + beta3L*J23L)*PDupwindNthAnti2beta1 + (beta1L*J31L + + beta2L*J32L + beta3L*J33L)*PDupwindNthAnti3beta1 + + (J11L*PDupwindNthSymm1beta1 + J21L*PDupwindNthSymm2beta1 + + J31L*PDupwindNthSymm3beta1)*Abs(beta1L) + (J12L*PDupwindNthSymm1beta1 + + J22L*PDupwindNthSymm2beta1 + J32L*PDupwindNthSymm3beta1)*Abs(beta2L) + + (J13L*PDupwindNthSymm1beta1 + J23L*PDupwindNthSymm2beta1 + + J33L*PDupwindNthSymm3beta1)*Abs(beta3L))*ToReal(ShiftAdvectionCoeff) + + theta*(Xt1L + beta1L*eta*ToReal(BetaDriver)*(-1 + ToReal(ShiftBCoeff)) + + (B1L - Xt1L)*ToReal(ShiftBCoeff))*ToReal(ShiftGammaCoeff); + + CCTK_REAL beta2rhsL = (epsdiss1*J11L + epsdiss2*J12L + + epsdiss3*J13L)*PDdissipationNth1beta2 + (epsdiss1*J21L + epsdiss2*J22L + + epsdiss3*J23L)*PDdissipationNth2beta2 + (epsdiss1*J31L + + epsdiss2*J32L + epsdiss3*J33L)*PDdissipationNth3beta2 + ((beta1L*J11L + + beta2L*J12L + beta3L*J13L)*PDupwindNthAnti1beta2 + (beta1L*J21L + + beta2L*J22L + beta3L*J23L)*PDupwindNthAnti2beta2 + (beta1L*J31L + + beta2L*J32L + beta3L*J33L)*PDupwindNthAnti3beta2 + + (J11L*PDupwindNthSymm1beta2 + J21L*PDupwindNthSymm2beta2 + + J31L*PDupwindNthSymm3beta2)*Abs(beta1L) + (J12L*PDupwindNthSymm1beta2 + + J22L*PDupwindNthSymm2beta2 + J32L*PDupwindNthSymm3beta2)*Abs(beta2L) + + (J13L*PDupwindNthSymm1beta2 + J23L*PDupwindNthSymm2beta2 + + J33L*PDupwindNthSymm3beta2)*Abs(beta3L))*ToReal(ShiftAdvectionCoeff) + + theta*(Xt2L + beta2L*eta*ToReal(BetaDriver)*(-1 + ToReal(ShiftBCoeff)) + + (B2L - Xt2L)*ToReal(ShiftBCoeff))*ToReal(ShiftGammaCoeff); + + CCTK_REAL beta3rhsL = (epsdiss1*J11L + epsdiss2*J12L + + epsdiss3*J13L)*PDdissipationNth1beta3 + (epsdiss1*J21L + epsdiss2*J22L + + epsdiss3*J23L)*PDdissipationNth2beta3 + (epsdiss1*J31L + + epsdiss2*J32L + epsdiss3*J33L)*PDdissipationNth3beta3 + ((beta1L*J11L + + beta2L*J12L + beta3L*J13L)*PDupwindNthAnti1beta3 + (beta1L*J21L + + beta2L*J22L + beta3L*J23L)*PDupwindNthAnti2beta3 + (beta1L*J31L + + beta2L*J32L + beta3L*J33L)*PDupwindNthAnti3beta3 + + (J11L*PDupwindNthSymm1beta3 + J21L*PDupwindNthSymm2beta3 + + J31L*PDupwindNthSymm3beta3)*Abs(beta1L) + (J12L*PDupwindNthSymm1beta3 + + J22L*PDupwindNthSymm2beta3 + J32L*PDupwindNthSymm3beta3)*Abs(beta2L) + + (J13L*PDupwindNthSymm1beta3 + J23L*PDupwindNthSymm2beta3 + + J33L*PDupwindNthSymm3beta3)*Abs(beta3L))*ToReal(ShiftAdvectionCoeff) + + theta*(Xt3L + beta3L*eta*ToReal(BetaDriver)*(-1 + ToReal(ShiftBCoeff)) + + (B3L - Xt3L)*ToReal(ShiftBCoeff))*ToReal(ShiftGammaCoeff); + + CCTK_REAL B1rhsL = (epsdiss1*J11L + epsdiss2*J12L + + epsdiss3*J13L)*PDdissipationNth1B1 + (epsdiss1*J21L + epsdiss2*J22L + + epsdiss3*J23L)*PDdissipationNth2B1 + (epsdiss1*J31L + epsdiss2*J32L + + epsdiss3*J33L)*PDdissipationNth3B1 + ((beta1L*J11L + beta2L*J12L + + beta3L*J13L)*(PDupwindNthAnti1B1 - PDupwindNthAnti1Xt1) + (beta1L*J21L + + beta2L*J22L + beta3L*J23L)*(PDupwindNthAnti2B1 - PDupwindNthAnti2Xt1) + + (beta1L*J31L + beta2L*J32L + beta3L*J33L)*(PDupwindNthAnti3B1 - + PDupwindNthAnti3Xt1) + (J11L*(PDupwindNthSymm1B1 - PDupwindNthSymm1Xt1) + + J21L*(PDupwindNthSymm2B1 - PDupwindNthSymm2Xt1) + + J31L*(PDupwindNthSymm3B1 - PDupwindNthSymm3Xt1))*Abs(beta1L) + + (J12L*(PDupwindNthSymm1B1 - PDupwindNthSymm1Xt1) + + J22L*(PDupwindNthSymm2B1 - PDupwindNthSymm2Xt1) + + J32L*(PDupwindNthSymm3B1 - PDupwindNthSymm3Xt1))*Abs(beta2L) + + (J13L*(PDupwindNthSymm1B1 - PDupwindNthSymm1Xt1) + + J23L*(PDupwindNthSymm2B1 - PDupwindNthSymm2Xt1) + + J33L*(PDupwindNthSymm3B1 - + PDupwindNthSymm3Xt1))*Abs(beta3L))*ToReal(ShiftAdvectionCoeff) + + (dotXt1 - B1L*eta*ToReal(BetaDriver))*ToReal(ShiftBCoeff); + + CCTK_REAL B2rhsL = (epsdiss1*J11L + epsdiss2*J12L + + epsdiss3*J13L)*PDdissipationNth1B2 + (epsdiss1*J21L + epsdiss2*J22L + + epsdiss3*J23L)*PDdissipationNth2B2 + (epsdiss1*J31L + epsdiss2*J32L + + epsdiss3*J33L)*PDdissipationNth3B2 + ((beta1L*J11L + beta2L*J12L + + beta3L*J13L)*(PDupwindNthAnti1B2 - PDupwindNthAnti1Xt2) + (beta1L*J21L + + beta2L*J22L + beta3L*J23L)*(PDupwindNthAnti2B2 - PDupwindNthAnti2Xt2) + + (beta1L*J31L + beta2L*J32L + beta3L*J33L)*(PDupwindNthAnti3B2 - + PDupwindNthAnti3Xt2) + (J11L*(PDupwindNthSymm1B2 - PDupwindNthSymm1Xt2) + + J21L*(PDupwindNthSymm2B2 - PDupwindNthSymm2Xt2) + + J31L*(PDupwindNthSymm3B2 - PDupwindNthSymm3Xt2))*Abs(beta1L) + + (J12L*(PDupwindNthSymm1B2 - PDupwindNthSymm1Xt2) + + J22L*(PDupwindNthSymm2B2 - PDupwindNthSymm2Xt2) + + J32L*(PDupwindNthSymm3B2 - PDupwindNthSymm3Xt2))*Abs(beta2L) + + (J13L*(PDupwindNthSymm1B2 - PDupwindNthSymm1Xt2) + + J23L*(PDupwindNthSymm2B2 - PDupwindNthSymm2Xt2) + + J33L*(PDupwindNthSymm3B2 - + PDupwindNthSymm3Xt2))*Abs(beta3L))*ToReal(ShiftAdvectionCoeff) + + (dotXt2 - B2L*eta*ToReal(BetaDriver))*ToReal(ShiftBCoeff); + + CCTK_REAL B3rhsL = (epsdiss1*J11L + epsdiss2*J12L + + epsdiss3*J13L)*PDdissipationNth1B3 + (epsdiss1*J21L + epsdiss2*J22L + + epsdiss3*J23L)*PDdissipationNth2B3 + (epsdiss1*J31L + epsdiss2*J32L + + epsdiss3*J33L)*PDdissipationNth3B3 + ((beta1L*J11L + beta2L*J12L + + beta3L*J13L)*(PDupwindNthAnti1B3 - PDupwindNthAnti1Xt3) + (beta1L*J21L + + beta2L*J22L + beta3L*J23L)*(PDupwindNthAnti2B3 - PDupwindNthAnti2Xt3) + + (beta1L*J31L + beta2L*J32L + beta3L*J33L)*(PDupwindNthAnti3B3 - + PDupwindNthAnti3Xt3) + (J11L*(PDupwindNthSymm1B3 - PDupwindNthSymm1Xt3) + + J21L*(PDupwindNthSymm2B3 - PDupwindNthSymm2Xt3) + + J31L*(PDupwindNthSymm3B3 - PDupwindNthSymm3Xt3))*Abs(beta1L) + + (J12L*(PDupwindNthSymm1B3 - PDupwindNthSymm1Xt3) + + J22L*(PDupwindNthSymm2B3 - PDupwindNthSymm2Xt3) + + J32L*(PDupwindNthSymm3B3 - PDupwindNthSymm3Xt3))*Abs(beta2L) + + (J13L*(PDupwindNthSymm1B3 - PDupwindNthSymm1Xt3) + + J23L*(PDupwindNthSymm2B3 - PDupwindNthSymm2Xt3) + + J33L*(PDupwindNthSymm3B3 - + PDupwindNthSymm3Xt3))*Abs(beta3L))*ToReal(ShiftAdvectionCoeff) + + (dotXt3 - B3L*eta*ToReal(BetaDriver))*ToReal(ShiftBCoeff); + + + /* Copy local copies back to grid functions */ + alpharhs[index] = alpharhsL; + Arhs[index] = ArhsL; + B1rhs[index] = B1rhsL; + B2rhs[index] = B2rhsL; + B3rhs[index] = B3rhsL; + beta1rhs[index] = beta1rhsL; + beta2rhs[index] = beta2rhsL; + beta3rhs[index] = beta3rhsL; + gt11rhs[index] = gt11rhsL; + gt12rhs[index] = gt12rhsL; + gt13rhs[index] = gt13rhsL; + gt22rhs[index] = gt22rhsL; + gt23rhs[index] = gt23rhsL; + gt33rhs[index] = gt33rhsL; + phirhs[index] = phirhsL; + trKrhs[index] = trKrhsL; + Xt1rhs[index] = Xt1rhsL; + Xt2rhs[index] = Xt2rhsL; + Xt3rhs[index] = Xt3rhsL; + } + LC_ENDLOOP3 (ML_BSSN_MP_RHS1); +} + +extern "C" void ML_BSSN_MP_RHS1(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverInterior(cctkGH, &ML_BSSN_MP_RHS1_Body); +} diff --git a/ML_BSSN_MP/src/ML_BSSN_MP_RHS2.cc b/ML_BSSN_MP/src/ML_BSSN_MP_RHS2.cc new file mode 100644 index 0000000..a7c009f --- /dev/null +++ b/ML_BSSN_MP/src/ML_BSSN_MP_RHS2.cc @@ -0,0 +1,1214 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +extern "C" void ML_BSSN_MP_RHS2_SelectBCs(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT ierr = 0; + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_MP::ML_curvrhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_MP::ML_curvrhs."); + return; +} + +static void ML_BSSN_MP_RHS2_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_BSSN_MP_RHS2_Body"); + } + + if (cctk_iteration % ML_BSSN_MP_RHS2_calc_every != ML_BSSN_MP_RHS2_calc_offset) + { + return; + } + + const char *groups[] = {"Coordinates::jacobian","Coordinates::jacobian2","ML_BSSN_MP::ML_curv","ML_BSSN_MP::ML_curvrhs","ML_BSSN_MP::ML_Gamma","ML_BSSN_MP::ML_lapse","ML_BSSN_MP::ML_log_confac","ML_BSSN_MP::ML_metric","ML_BSSN_MP::ML_shift","ML_BSSN_MP::ML_trace_curv"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_BSSN_MP_RHS2", 10, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o12dx = 0.0833333333333333333333333333333*INV(dx); + CCTK_REAL const p1o12dy = 0.0833333333333333333333333333333*INV(dy); + CCTK_REAL const p1o12dz = 0.0833333333333333333333333333333*INV(dz); + CCTK_REAL const p1o144dxdy = 0.00694444444444444444444444444444*INV(dx)*INV(dy); + CCTK_REAL const p1o144dxdz = 0.00694444444444444444444444444444*INV(dx)*INV(dz); + CCTK_REAL const p1o144dydz = 0.00694444444444444444444444444444*INV(dy)*INV(dz); + CCTK_REAL const p1o24dx = 0.0416666666666666666666666666667*INV(dx); + CCTK_REAL const p1o24dy = 0.0416666666666666666666666666667*INV(dy); + CCTK_REAL const p1o24dz = 0.0416666666666666666666666666667*INV(dz); + CCTK_REAL const p1o64dx = 0.015625*INV(dx); + CCTK_REAL const p1o64dy = 0.015625*INV(dy); + CCTK_REAL const p1o64dz = 0.015625*INV(dz); + CCTK_REAL const p1odx = INV(dx); + CCTK_REAL const p1ody = INV(dy); + CCTK_REAL const p1odz = INV(dz); + CCTK_REAL const pm1o12dx2 = -0.0833333333333333333333333333333*INV(SQR(dx)); + CCTK_REAL const pm1o12dy2 = -0.0833333333333333333333333333333*INV(SQR(dy)); + CCTK_REAL const pm1o12dz2 = -0.0833333333333333333333333333333*INV(SQR(dz)); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_BSSN_MP_RHS2, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + CCTK_REAL alphaL = alpha[index]; + CCTK_REAL At11L = At11[index]; + CCTK_REAL At12L = At12[index]; + CCTK_REAL At13L = At13[index]; + CCTK_REAL At22L = At22[index]; + CCTK_REAL At23L = At23[index]; + CCTK_REAL At33L = At33[index]; + CCTK_REAL beta1L = beta1[index]; + CCTK_REAL beta2L = beta2[index]; + CCTK_REAL beta3L = beta3[index]; + CCTK_REAL dJ111L = dJ111[index]; + CCTK_REAL dJ112L = dJ112[index]; + CCTK_REAL dJ113L = dJ113[index]; + CCTK_REAL dJ122L = dJ122[index]; + CCTK_REAL dJ123L = dJ123[index]; + CCTK_REAL dJ133L = dJ133[index]; + CCTK_REAL dJ211L = dJ211[index]; + CCTK_REAL dJ212L = dJ212[index]; + CCTK_REAL dJ213L = dJ213[index]; + CCTK_REAL dJ222L = dJ222[index]; + CCTK_REAL dJ223L = dJ223[index]; + CCTK_REAL dJ233L = dJ233[index]; + CCTK_REAL dJ311L = dJ311[index]; + CCTK_REAL dJ312L = dJ312[index]; + CCTK_REAL dJ313L = dJ313[index]; + CCTK_REAL dJ322L = dJ322[index]; + CCTK_REAL dJ323L = dJ323[index]; + CCTK_REAL dJ333L = dJ333[index]; + CCTK_REAL eTxxL = (*stress_energy_state) ? eTxx[index] : ToReal(0.0); + CCTK_REAL eTxyL = (*stress_energy_state) ? eTxy[index] : ToReal(0.0); + CCTK_REAL eTxzL = (*stress_energy_state) ? eTxz[index] : ToReal(0.0); + CCTK_REAL eTyyL = (*stress_energy_state) ? eTyy[index] : ToReal(0.0); + CCTK_REAL eTyzL = (*stress_energy_state) ? eTyz[index] : ToReal(0.0); + CCTK_REAL eTzzL = (*stress_energy_state) ? eTzz[index] : ToReal(0.0); + CCTK_REAL gt11L = gt11[index]; + CCTK_REAL gt12L = gt12[index]; + CCTK_REAL gt13L = gt13[index]; + CCTK_REAL gt22L = gt22[index]; + CCTK_REAL gt23L = gt23[index]; + CCTK_REAL gt33L = gt33[index]; + CCTK_REAL J11L = J11[index]; + CCTK_REAL J12L = J12[index]; + CCTK_REAL J13L = J13[index]; + CCTK_REAL J21L = J21[index]; + CCTK_REAL J22L = J22[index]; + CCTK_REAL J23L = J23[index]; + CCTK_REAL J31L = J31[index]; + CCTK_REAL J32L = J32[index]; + CCTK_REAL J33L = J33[index]; + CCTK_REAL phiL = phi[index]; + CCTK_REAL trKL = trK[index]; + CCTK_REAL Xt1L = Xt1[index]; + CCTK_REAL Xt2L = Xt2[index]; + CCTK_REAL Xt3L = Xt3[index]; + + /* Include user supplied include files */ + + /* Precompute derivatives */ + CCTK_REAL const PDstandardNth1alpha = PDstandardNth1(&alpha[index]); + CCTK_REAL const PDstandardNth2alpha = PDstandardNth2(&alpha[index]); + CCTK_REAL const PDstandardNth3alpha = PDstandardNth3(&alpha[index]); + CCTK_REAL const PDstandardNth11alpha = PDstandardNth11(&alpha[index]); + CCTK_REAL const PDstandardNth22alpha = PDstandardNth22(&alpha[index]); + CCTK_REAL const PDstandardNth33alpha = PDstandardNth33(&alpha[index]); + CCTK_REAL const PDstandardNth12alpha = PDstandardNth12(&alpha[index]); + CCTK_REAL const PDstandardNth13alpha = PDstandardNth13(&alpha[index]); + CCTK_REAL const PDstandardNth23alpha = PDstandardNth23(&alpha[index]); + CCTK_REAL const PDdissipationNth1At11 = PDdissipationNth1(&At11[index]); + CCTK_REAL const PDdissipationNth2At11 = PDdissipationNth2(&At11[index]); + CCTK_REAL const PDdissipationNth3At11 = PDdissipationNth3(&At11[index]); + CCTK_REAL const PDupwindNthAnti1At11 = PDupwindNthAnti1(&At11[index]); + CCTK_REAL const PDupwindNthSymm1At11 = PDupwindNthSymm1(&At11[index]); + CCTK_REAL const PDupwindNthAnti2At11 = PDupwindNthAnti2(&At11[index]); + CCTK_REAL const PDupwindNthSymm2At11 = PDupwindNthSymm2(&At11[index]); + CCTK_REAL const PDupwindNthAnti3At11 = PDupwindNthAnti3(&At11[index]); + CCTK_REAL const PDupwindNthSymm3At11 = PDupwindNthSymm3(&At11[index]); + CCTK_REAL const PDdissipationNth1At12 = PDdissipationNth1(&At12[index]); + CCTK_REAL const PDdissipationNth2At12 = PDdissipationNth2(&At12[index]); + CCTK_REAL const PDdissipationNth3At12 = PDdissipationNth3(&At12[index]); + CCTK_REAL const PDupwindNthAnti1At12 = PDupwindNthAnti1(&At12[index]); + CCTK_REAL const PDupwindNthSymm1At12 = PDupwindNthSymm1(&At12[index]); + CCTK_REAL const PDupwindNthAnti2At12 = PDupwindNthAnti2(&At12[index]); + CCTK_REAL const PDupwindNthSymm2At12 = PDupwindNthSymm2(&At12[index]); + CCTK_REAL const PDupwindNthAnti3At12 = PDupwindNthAnti3(&At12[index]); + CCTK_REAL const PDupwindNthSymm3At12 = PDupwindNthSymm3(&At12[index]); + CCTK_REAL const PDdissipationNth1At13 = PDdissipationNth1(&At13[index]); + CCTK_REAL const PDdissipationNth2At13 = PDdissipationNth2(&At13[index]); + CCTK_REAL const PDdissipationNth3At13 = PDdissipationNth3(&At13[index]); + CCTK_REAL const PDupwindNthAnti1At13 = PDupwindNthAnti1(&At13[index]); + CCTK_REAL const PDupwindNthSymm1At13 = PDupwindNthSymm1(&At13[index]); + CCTK_REAL const PDupwindNthAnti2At13 = PDupwindNthAnti2(&At13[index]); + CCTK_REAL const PDupwindNthSymm2At13 = PDupwindNthSymm2(&At13[index]); + CCTK_REAL const PDupwindNthAnti3At13 = PDupwindNthAnti3(&At13[index]); + CCTK_REAL const PDupwindNthSymm3At13 = PDupwindNthSymm3(&At13[index]); + CCTK_REAL const PDdissipationNth1At22 = PDdissipationNth1(&At22[index]); + CCTK_REAL const PDdissipationNth2At22 = PDdissipationNth2(&At22[index]); + CCTK_REAL const PDdissipationNth3At22 = PDdissipationNth3(&At22[index]); + CCTK_REAL const PDupwindNthAnti1At22 = PDupwindNthAnti1(&At22[index]); + CCTK_REAL const PDupwindNthSymm1At22 = PDupwindNthSymm1(&At22[index]); + CCTK_REAL const PDupwindNthAnti2At22 = PDupwindNthAnti2(&At22[index]); + CCTK_REAL const PDupwindNthSymm2At22 = PDupwindNthSymm2(&At22[index]); + CCTK_REAL const PDupwindNthAnti3At22 = PDupwindNthAnti3(&At22[index]); + CCTK_REAL const PDupwindNthSymm3At22 = PDupwindNthSymm3(&At22[index]); + CCTK_REAL const PDdissipationNth1At23 = PDdissipationNth1(&At23[index]); + CCTK_REAL const PDdissipationNth2At23 = PDdissipationNth2(&At23[index]); + CCTK_REAL const PDdissipationNth3At23 = PDdissipationNth3(&At23[index]); + CCTK_REAL const PDupwindNthAnti1At23 = PDupwindNthAnti1(&At23[index]); + CCTK_REAL const PDupwindNthSymm1At23 = PDupwindNthSymm1(&At23[index]); + CCTK_REAL const PDupwindNthAnti2At23 = PDupwindNthAnti2(&At23[index]); + CCTK_REAL const PDupwindNthSymm2At23 = PDupwindNthSymm2(&At23[index]); + CCTK_REAL const PDupwindNthAnti3At23 = PDupwindNthAnti3(&At23[index]); + CCTK_REAL const PDupwindNthSymm3At23 = PDupwindNthSymm3(&At23[index]); + CCTK_REAL const PDdissipationNth1At33 = PDdissipationNth1(&At33[index]); + CCTK_REAL const PDdissipationNth2At33 = PDdissipationNth2(&At33[index]); + CCTK_REAL const PDdissipationNth3At33 = PDdissipationNth3(&At33[index]); + CCTK_REAL const PDupwindNthAnti1At33 = PDupwindNthAnti1(&At33[index]); + CCTK_REAL const PDupwindNthSymm1At33 = PDupwindNthSymm1(&At33[index]); + CCTK_REAL const PDupwindNthAnti2At33 = PDupwindNthAnti2(&At33[index]); + CCTK_REAL const PDupwindNthSymm2At33 = PDupwindNthSymm2(&At33[index]); + CCTK_REAL const PDupwindNthAnti3At33 = PDupwindNthAnti3(&At33[index]); + CCTK_REAL const PDupwindNthSymm3At33 = PDupwindNthSymm3(&At33[index]); + CCTK_REAL const PDstandardNth1beta1 = PDstandardNth1(&beta1[index]); + CCTK_REAL const PDstandardNth2beta1 = PDstandardNth2(&beta1[index]); + CCTK_REAL const PDstandardNth3beta1 = PDstandardNth3(&beta1[index]); + CCTK_REAL const PDstandardNth1beta2 = PDstandardNth1(&beta2[index]); + CCTK_REAL const PDstandardNth2beta2 = PDstandardNth2(&beta2[index]); + CCTK_REAL const PDstandardNth3beta2 = PDstandardNth3(&beta2[index]); + CCTK_REAL const PDstandardNth1beta3 = PDstandardNth1(&beta3[index]); + CCTK_REAL const PDstandardNth2beta3 = PDstandardNth2(&beta3[index]); + CCTK_REAL const PDstandardNth3beta3 = PDstandardNth3(&beta3[index]); + CCTK_REAL const PDstandardNth1gt11 = PDstandardNth1(>11[index]); + CCTK_REAL const PDstandardNth2gt11 = PDstandardNth2(>11[index]); + CCTK_REAL const PDstandardNth3gt11 = PDstandardNth3(>11[index]); + CCTK_REAL const PDstandardNth11gt11 = PDstandardNth11(>11[index]); + CCTK_REAL const PDstandardNth22gt11 = PDstandardNth22(>11[index]); + CCTK_REAL const PDstandardNth33gt11 = PDstandardNth33(>11[index]); + CCTK_REAL const PDstandardNth12gt11 = PDstandardNth12(>11[index]); + CCTK_REAL const PDstandardNth13gt11 = PDstandardNth13(>11[index]); + CCTK_REAL const PDstandardNth23gt11 = PDstandardNth23(>11[index]); + CCTK_REAL const PDstandardNth1gt12 = PDstandardNth1(>12[index]); + CCTK_REAL const PDstandardNth2gt12 = PDstandardNth2(>12[index]); + CCTK_REAL const PDstandardNth3gt12 = PDstandardNth3(>12[index]); + CCTK_REAL const PDstandardNth11gt12 = PDstandardNth11(>12[index]); + CCTK_REAL const PDstandardNth22gt12 = PDstandardNth22(>12[index]); + CCTK_REAL const PDstandardNth33gt12 = PDstandardNth33(>12[index]); + CCTK_REAL const PDstandardNth12gt12 = PDstandardNth12(>12[index]); + CCTK_REAL const PDstandardNth13gt12 = PDstandardNth13(>12[index]); + CCTK_REAL const PDstandardNth23gt12 = PDstandardNth23(>12[index]); + CCTK_REAL const PDstandardNth1gt13 = PDstandardNth1(>13[index]); + CCTK_REAL const PDstandardNth2gt13 = PDstandardNth2(>13[index]); + CCTK_REAL const PDstandardNth3gt13 = PDstandardNth3(>13[index]); + CCTK_REAL const PDstandardNth11gt13 = PDstandardNth11(>13[index]); + CCTK_REAL const PDstandardNth22gt13 = PDstandardNth22(>13[index]); + CCTK_REAL const PDstandardNth33gt13 = PDstandardNth33(>13[index]); + CCTK_REAL const PDstandardNth12gt13 = PDstandardNth12(>13[index]); + CCTK_REAL const PDstandardNth13gt13 = PDstandardNth13(>13[index]); + CCTK_REAL const PDstandardNth23gt13 = PDstandardNth23(>13[index]); + CCTK_REAL const PDstandardNth1gt22 = PDstandardNth1(>22[index]); + CCTK_REAL const PDstandardNth2gt22 = PDstandardNth2(>22[index]); + CCTK_REAL const PDstandardNth3gt22 = PDstandardNth3(>22[index]); + CCTK_REAL const PDstandardNth11gt22 = PDstandardNth11(>22[index]); + CCTK_REAL const PDstandardNth22gt22 = PDstandardNth22(>22[index]); + CCTK_REAL const PDstandardNth33gt22 = PDstandardNth33(>22[index]); + CCTK_REAL const PDstandardNth12gt22 = PDstandardNth12(>22[index]); + CCTK_REAL const PDstandardNth13gt22 = PDstandardNth13(>22[index]); + CCTK_REAL const PDstandardNth23gt22 = PDstandardNth23(>22[index]); + CCTK_REAL const PDstandardNth1gt23 = PDstandardNth1(>23[index]); + CCTK_REAL const PDstandardNth2gt23 = PDstandardNth2(>23[index]); + CCTK_REAL const PDstandardNth3gt23 = PDstandardNth3(>23[index]); + CCTK_REAL const PDstandardNth11gt23 = PDstandardNth11(>23[index]); + CCTK_REAL const PDstandardNth22gt23 = PDstandardNth22(>23[index]); + CCTK_REAL const PDstandardNth33gt23 = PDstandardNth33(>23[index]); + CCTK_REAL const PDstandardNth12gt23 = PDstandardNth12(>23[index]); + CCTK_REAL const PDstandardNth13gt23 = PDstandardNth13(>23[index]); + CCTK_REAL const PDstandardNth23gt23 = PDstandardNth23(>23[index]); + CCTK_REAL const PDstandardNth1gt33 = PDstandardNth1(>33[index]); + CCTK_REAL const PDstandardNth2gt33 = PDstandardNth2(>33[index]); + CCTK_REAL const PDstandardNth3gt33 = PDstandardNth3(>33[index]); + CCTK_REAL const PDstandardNth11gt33 = PDstandardNth11(>33[index]); + CCTK_REAL const PDstandardNth22gt33 = PDstandardNth22(>33[index]); + CCTK_REAL const PDstandardNth33gt33 = PDstandardNth33(>33[index]); + CCTK_REAL const PDstandardNth12gt33 = PDstandardNth12(>33[index]); + CCTK_REAL const PDstandardNth13gt33 = PDstandardNth13(>33[index]); + CCTK_REAL const PDstandardNth23gt33 = PDstandardNth23(>33[index]); + CCTK_REAL const PDstandardNth1phi = PDstandardNth1(&phi[index]); + CCTK_REAL const PDstandardNth2phi = PDstandardNth2(&phi[index]); + CCTK_REAL const PDstandardNth3phi = PDstandardNth3(&phi[index]); + CCTK_REAL const PDstandardNth11phi = PDstandardNth11(&phi[index]); + CCTK_REAL const PDstandardNth22phi = PDstandardNth22(&phi[index]); + CCTK_REAL const PDstandardNth33phi = PDstandardNth33(&phi[index]); + CCTK_REAL const PDstandardNth12phi = PDstandardNth12(&phi[index]); + CCTK_REAL const PDstandardNth13phi = PDstandardNth13(&phi[index]); + CCTK_REAL const PDstandardNth23phi = PDstandardNth23(&phi[index]); + CCTK_REAL const PDstandardNth1Xt1 = PDstandardNth1(&Xt1[index]); + CCTK_REAL const PDstandardNth2Xt1 = PDstandardNth2(&Xt1[index]); + CCTK_REAL const PDstandardNth3Xt1 = PDstandardNth3(&Xt1[index]); + CCTK_REAL const PDstandardNth1Xt2 = PDstandardNth1(&Xt2[index]); + CCTK_REAL const PDstandardNth2Xt2 = PDstandardNth2(&Xt2[index]); + CCTK_REAL const PDstandardNth3Xt2 = PDstandardNth3(&Xt2[index]); + CCTK_REAL const PDstandardNth1Xt3 = PDstandardNth1(&Xt3[index]); + CCTK_REAL const PDstandardNth2Xt3 = PDstandardNth2(&Xt3[index]); + CCTK_REAL const PDstandardNth3Xt3 = PDstandardNth3(&Xt3[index]); + + /* Calculate temporaries and grid functions */ + ptrdiff_t dir1 = Sign(beta1L); + + ptrdiff_t dir2 = Sign(beta2L); + + ptrdiff_t dir3 = Sign(beta3L); + + CCTK_REAL epsdiss1 = ToReal(EpsDiss); + + CCTK_REAL epsdiss2 = ToReal(EpsDiss); + + CCTK_REAL epsdiss3 = ToReal(EpsDiss); + + CCTK_REAL detgt = 1; + + CCTK_REAL gtu11 = INV(detgt)*(gt22L*gt33L - SQR(gt23L)); + + CCTK_REAL gtu12 = (gt13L*gt23L - gt12L*gt33L)*INV(detgt); + + CCTK_REAL gtu13 = (-(gt13L*gt22L) + gt12L*gt23L)*INV(detgt); + + CCTK_REAL gtu22 = INV(detgt)*(gt11L*gt33L - SQR(gt13L)); + + CCTK_REAL gtu23 = (gt12L*gt13L - gt11L*gt23L)*INV(detgt); + + CCTK_REAL gtu33 = INV(detgt)*(gt11L*gt22L - SQR(gt12L)); + + CCTK_REAL Gtl111 = 0.5*(J11L*PDstandardNth1gt11 + + J21L*PDstandardNth2gt11 + J31L*PDstandardNth3gt11); + + CCTK_REAL Gtl112 = 0.5*(J12L*PDstandardNth1gt11 + + J22L*PDstandardNth2gt11 + J32L*PDstandardNth3gt11); + + CCTK_REAL Gtl113 = 0.5*(J13L*PDstandardNth1gt11 + + J23L*PDstandardNth2gt11 + J33L*PDstandardNth3gt11); + + CCTK_REAL Gtl122 = J12L*PDstandardNth1gt12 + J22L*PDstandardNth2gt12 + + J32L*PDstandardNth3gt12 - 0.5*(J11L*PDstandardNth1gt22 + + J21L*PDstandardNth2gt22 + J31L*PDstandardNth3gt22); + + CCTK_REAL Gtl123 = 0.5*(J13L*PDstandardNth1gt12 + + J12L*PDstandardNth1gt13 - J11L*PDstandardNth1gt23 + + J23L*PDstandardNth2gt12 + J22L*PDstandardNth2gt13 - + J21L*PDstandardNth2gt23 + J33L*PDstandardNth3gt12 + + J32L*PDstandardNth3gt13 - J31L*PDstandardNth3gt23); + + CCTK_REAL Gtl133 = J13L*PDstandardNth1gt13 + J23L*PDstandardNth2gt13 + + J33L*PDstandardNth3gt13 - 0.5*(J11L*PDstandardNth1gt33 + + J21L*PDstandardNth2gt33 + J31L*PDstandardNth3gt33); + + CCTK_REAL Gtl211 = J11L*PDstandardNth1gt12 + J21L*PDstandardNth2gt12 - + 0.5*(J12L*PDstandardNth1gt11 + J22L*PDstandardNth2gt11 + + J32L*PDstandardNth3gt11) + J31L*PDstandardNth3gt12; + + CCTK_REAL Gtl212 = 0.5*(J11L*PDstandardNth1gt22 + + J21L*PDstandardNth2gt22 + J31L*PDstandardNth3gt22); + + CCTK_REAL Gtl213 = 0.5*(J13L*PDstandardNth1gt12 - + J12L*PDstandardNth1gt13 + J11L*PDstandardNth1gt23 + + J23L*PDstandardNth2gt12 - J22L*PDstandardNth2gt13 + + J21L*PDstandardNth2gt23 + J33L*PDstandardNth3gt12 - + J32L*PDstandardNth3gt13 + J31L*PDstandardNth3gt23); + + CCTK_REAL Gtl222 = 0.5*(J12L*PDstandardNth1gt22 + + J22L*PDstandardNth2gt22 + J32L*PDstandardNth3gt22); + + CCTK_REAL Gtl223 = 0.5*(J13L*PDstandardNth1gt22 + + J23L*PDstandardNth2gt22 + J33L*PDstandardNth3gt22); + + CCTK_REAL Gtl233 = J13L*PDstandardNth1gt23 + J23L*PDstandardNth2gt23 + + J33L*PDstandardNth3gt23 - 0.5*(J12L*PDstandardNth1gt33 + + J22L*PDstandardNth2gt33 + J32L*PDstandardNth3gt33); + + CCTK_REAL Gtl311 = J11L*PDstandardNth1gt13 + J21L*PDstandardNth2gt13 - + 0.5*(J13L*PDstandardNth1gt11 + J23L*PDstandardNth2gt11 + + J33L*PDstandardNth3gt11) + J31L*PDstandardNth3gt13; + + CCTK_REAL Gtl312 = 0.5*(-(J13L*PDstandardNth1gt12) + + J12L*PDstandardNth1gt13 + J11L*PDstandardNth1gt23 - + J23L*PDstandardNth2gt12 + J22L*PDstandardNth2gt13 + + J21L*PDstandardNth2gt23 - J33L*PDstandardNth3gt12 + + J32L*PDstandardNth3gt13 + J31L*PDstandardNth3gt23); + + CCTK_REAL Gtl313 = 0.5*(J11L*PDstandardNth1gt33 + + J21L*PDstandardNth2gt33 + J31L*PDstandardNth3gt33); + + CCTK_REAL Gtl322 = J12L*PDstandardNth1gt23 + J22L*PDstandardNth2gt23 - + 0.5*(J13L*PDstandardNth1gt22 + J23L*PDstandardNth2gt22 + + J33L*PDstandardNth3gt22) + J32L*PDstandardNth3gt23; + + CCTK_REAL Gtl323 = 0.5*(J12L*PDstandardNth1gt33 + + J22L*PDstandardNth2gt33 + J32L*PDstandardNth3gt33); + + CCTK_REAL Gtl333 = 0.5*(J13L*PDstandardNth1gt33 + + J23L*PDstandardNth2gt33 + J33L*PDstandardNth3gt33); + + CCTK_REAL Gtlu111 = Gtl111*gtu11 + Gtl112*gtu12 + Gtl113*gtu13; + + CCTK_REAL Gtlu112 = Gtl111*gtu12 + Gtl112*gtu22 + Gtl113*gtu23; + + CCTK_REAL Gtlu113 = Gtl111*gtu13 + Gtl112*gtu23 + Gtl113*gtu33; + + CCTK_REAL Gtlu121 = Gtl112*gtu11 + Gtl122*gtu12 + Gtl123*gtu13; + + CCTK_REAL Gtlu122 = Gtl112*gtu12 + Gtl122*gtu22 + Gtl123*gtu23; + + CCTK_REAL Gtlu123 = Gtl112*gtu13 + Gtl122*gtu23 + Gtl123*gtu33; + + CCTK_REAL Gtlu131 = Gtl113*gtu11 + Gtl123*gtu12 + Gtl133*gtu13; + + CCTK_REAL Gtlu132 = Gtl113*gtu12 + Gtl123*gtu22 + Gtl133*gtu23; + + CCTK_REAL Gtlu133 = Gtl113*gtu13 + Gtl123*gtu23 + Gtl133*gtu33; + + CCTK_REAL Gtlu211 = Gtl211*gtu11 + Gtl212*gtu12 + Gtl213*gtu13; + + CCTK_REAL Gtlu212 = Gtl211*gtu12 + Gtl212*gtu22 + Gtl213*gtu23; + + CCTK_REAL Gtlu213 = Gtl211*gtu13 + Gtl212*gtu23 + Gtl213*gtu33; + + CCTK_REAL Gtlu221 = Gtl212*gtu11 + Gtl222*gtu12 + Gtl223*gtu13; + + CCTK_REAL Gtlu222 = Gtl212*gtu12 + Gtl222*gtu22 + Gtl223*gtu23; + + CCTK_REAL Gtlu223 = Gtl212*gtu13 + Gtl222*gtu23 + Gtl223*gtu33; + + CCTK_REAL Gtlu231 = Gtl213*gtu11 + Gtl223*gtu12 + Gtl233*gtu13; + + CCTK_REAL Gtlu232 = Gtl213*gtu12 + Gtl223*gtu22 + Gtl233*gtu23; + + CCTK_REAL Gtlu233 = Gtl213*gtu13 + Gtl223*gtu23 + Gtl233*gtu33; + + CCTK_REAL Gtlu311 = Gtl311*gtu11 + Gtl312*gtu12 + Gtl313*gtu13; + + CCTK_REAL Gtlu312 = Gtl311*gtu12 + Gtl312*gtu22 + Gtl313*gtu23; + + CCTK_REAL Gtlu313 = Gtl311*gtu13 + Gtl312*gtu23 + Gtl313*gtu33; + + CCTK_REAL Gtlu321 = Gtl312*gtu11 + Gtl322*gtu12 + Gtl323*gtu13; + + CCTK_REAL Gtlu322 = Gtl312*gtu12 + Gtl322*gtu22 + Gtl323*gtu23; + + CCTK_REAL Gtlu323 = Gtl312*gtu13 + Gtl322*gtu23 + Gtl323*gtu33; + + CCTK_REAL Gtlu331 = Gtl313*gtu11 + Gtl323*gtu12 + Gtl333*gtu13; + + CCTK_REAL Gtlu332 = Gtl313*gtu12 + Gtl323*gtu22 + Gtl333*gtu23; + + CCTK_REAL Gtlu333 = Gtl313*gtu13 + Gtl323*gtu23 + Gtl333*gtu33; + + CCTK_REAL Gt111 = Gtl111*gtu11 + Gtl211*gtu12 + Gtl311*gtu13; + + CCTK_REAL Gt211 = Gtl111*gtu12 + Gtl211*gtu22 + Gtl311*gtu23; + + CCTK_REAL Gt311 = Gtl111*gtu13 + Gtl211*gtu23 + Gtl311*gtu33; + + CCTK_REAL Gt112 = Gtl112*gtu11 + Gtl212*gtu12 + Gtl312*gtu13; + + CCTK_REAL Gt212 = Gtl112*gtu12 + Gtl212*gtu22 + Gtl312*gtu23; + + CCTK_REAL Gt312 = Gtl112*gtu13 + Gtl212*gtu23 + Gtl312*gtu33; + + CCTK_REAL Gt113 = Gtl113*gtu11 + Gtl213*gtu12 + Gtl313*gtu13; + + CCTK_REAL Gt213 = Gtl113*gtu12 + Gtl213*gtu22 + Gtl313*gtu23; + + CCTK_REAL Gt313 = Gtl113*gtu13 + Gtl213*gtu23 + Gtl313*gtu33; + + CCTK_REAL Gt122 = Gtl122*gtu11 + Gtl222*gtu12 + Gtl322*gtu13; + + CCTK_REAL Gt222 = Gtl122*gtu12 + Gtl222*gtu22 + Gtl322*gtu23; + + CCTK_REAL Gt322 = Gtl122*gtu13 + Gtl222*gtu23 + Gtl322*gtu33; + + CCTK_REAL Gt123 = Gtl123*gtu11 + Gtl223*gtu12 + Gtl323*gtu13; + + CCTK_REAL Gt223 = Gtl123*gtu12 + Gtl223*gtu22 + Gtl323*gtu23; + + CCTK_REAL Gt323 = Gtl123*gtu13 + Gtl223*gtu23 + Gtl323*gtu33; + + CCTK_REAL Gt133 = Gtl133*gtu11 + Gtl233*gtu12 + Gtl333*gtu13; + + CCTK_REAL Gt233 = Gtl133*gtu12 + Gtl233*gtu22 + Gtl333*gtu23; + + CCTK_REAL Gt333 = Gtl133*gtu13 + Gtl233*gtu23 + Gtl333*gtu33; + + CCTK_REAL Xtn1 = Gt111*gtu11 + Gt122*gtu22 + 2*(Gt112*gtu12 + + Gt113*gtu13 + Gt123*gtu23) + Gt133*gtu33; + + CCTK_REAL Xtn2 = Gt211*gtu11 + Gt222*gtu22 + 2*(Gt212*gtu12 + + Gt213*gtu13 + Gt223*gtu23) + Gt233*gtu33; + + CCTK_REAL Xtn3 = Gt311*gtu11 + Gt322*gtu22 + 2*(Gt312*gtu12 + + Gt313*gtu13 + Gt323*gtu23) + Gt333*gtu33; + + CCTK_REAL Rt11 = 3*(Gt111*Gtlu111 + Gt112*Gtlu112 + Gt113*Gtlu113) + + 2*(Gt211*Gtlu121 + Gt212*Gtlu122 + Gt213*Gtlu123 + Gt311*Gtlu131 + + Gt312*Gtlu132 + Gt313*Gtlu133) + Gt211*Gtlu211 + Gt212*Gtlu212 + + Gt213*Gtlu213 + Gt311*Gtlu311 + Gt312*Gtlu312 + Gt313*Gtlu313 + + J11L*(gt11L*PDstandardNth1Xt1 + gt12L*PDstandardNth1Xt2 + + gt13L*PDstandardNth1Xt3) + J21L*(gt11L*PDstandardNth2Xt1 + + gt12L*PDstandardNth2Xt2 + gt13L*PDstandardNth2Xt3) + + J31L*(gt11L*PDstandardNth3Xt1 + gt12L*PDstandardNth3Xt2 + + gt13L*PDstandardNth3Xt3) + Gtl111*Xtn1 + Gtl112*Xtn2 + Gtl113*Xtn3 + + 0.5*(-2*(gtu12*(J11L*J12L*PDstandardNth11gt11 + + J12L*J21L*PDstandardNth12gt11 + J11L*J22L*PDstandardNth12gt11 + + J12L*J31L*PDstandardNth13gt11 + J11L*J32L*PDstandardNth13gt11 + + dJ112L*PDstandardNth1gt11 + J21L*J22L*PDstandardNth22gt11 + + J22L*J31L*PDstandardNth23gt11 + J21L*J32L*PDstandardNth23gt11 + + dJ212L*PDstandardNth2gt11 + J31L*J32L*PDstandardNth33gt11 + + dJ312L*PDstandardNth3gt11) + gtu13*(J11L*J13L*PDstandardNth11gt11 + + J13L*J21L*PDstandardNth12gt11 + J11L*J23L*PDstandardNth12gt11 + + J13L*J31L*PDstandardNth13gt11 + J11L*J33L*PDstandardNth13gt11 + + dJ113L*PDstandardNth1gt11 + J21L*J23L*PDstandardNth22gt11 + + J23L*J31L*PDstandardNth23gt11 + J21L*J33L*PDstandardNth23gt11 + + dJ213L*PDstandardNth2gt11 + J31L*J33L*PDstandardNth33gt11 + + dJ313L*PDstandardNth3gt11) + gtu23*(J12L*J13L*PDstandardNth11gt11 + + J13L*J22L*PDstandardNth12gt11 + J12L*J23L*PDstandardNth12gt11 + + J13L*J32L*PDstandardNth13gt11 + J12L*J33L*PDstandardNth13gt11 + + dJ123L*PDstandardNth1gt11 + J22L*J23L*PDstandardNth22gt11 + + J23L*J32L*PDstandardNth23gt11 + J22L*J33L*PDstandardNth23gt11 + + dJ223L*PDstandardNth2gt11 + J32L*J33L*PDstandardNth33gt11 + + dJ323L*PDstandardNth3gt11)) - gtu11*(2*J11L*J21L*PDstandardNth12gt11 + + 2*J11L*J31L*PDstandardNth13gt11 + dJ111L*PDstandardNth1gt11 + + 2*J21L*J31L*PDstandardNth23gt11 + dJ211L*PDstandardNth2gt11 + + dJ311L*PDstandardNth3gt11 + PDstandardNth11gt11*SQR(J11L) + + PDstandardNth22gt11*SQR(J21L) + PDstandardNth33gt11*SQR(J31L)) - + gtu22*(2*J12L*J22L*PDstandardNth12gt11 + + 2*J12L*J32L*PDstandardNth13gt11 + dJ122L*PDstandardNth1gt11 + + 2*J22L*J32L*PDstandardNth23gt11 + dJ222L*PDstandardNth2gt11 + + dJ322L*PDstandardNth3gt11 + PDstandardNth11gt11*SQR(J12L) + + PDstandardNth22gt11*SQR(J22L) + PDstandardNth33gt11*SQR(J32L)) - + gtu33*(2*J13L*J23L*PDstandardNth12gt11 + + 2*J13L*J33L*PDstandardNth13gt11 + dJ133L*PDstandardNth1gt11 + + 2*J23L*J33L*PDstandardNth23gt11 + dJ233L*PDstandardNth2gt11 + + dJ333L*PDstandardNth3gt11 + PDstandardNth11gt11*SQR(J13L) + + PDstandardNth22gt11*SQR(J23L) + PDstandardNth33gt11*SQR(J33L))); + + CCTK_REAL Rt12 = Gt122*Gtlu112 + Gt123*Gtlu113 + (Gt111 + + Gt212)*Gtlu121 + Gt222*Gtlu122 + (Gt113 + Gt223)*Gtlu123 + + Gt322*Gtlu132 + Gt323*Gtlu133 + Gt111*Gtlu211 + Gt112*(Gtlu111 + + Gtlu122 + Gtlu212) + Gt113*Gtlu213 + 2*(Gt211*Gtlu221 + Gt212*Gtlu222 + + Gt213*Gtlu223) + Gt311*(Gtlu231 + Gtlu321) + Gt312*(Gtlu131 + Gtlu232 + + Gtlu322) + Gt313*(Gtlu233 + Gtlu323) + 0.5*((gt12L*J11L + + gt11L*J12L)*PDstandardNth1Xt1 + (gt22L*J11L + + gt12L*J12L)*PDstandardNth1Xt2 + (gt23L*J11L + + gt13L*J12L)*PDstandardNth1Xt3 + (gt12L*J21L + + gt11L*J22L)*PDstandardNth2Xt1 + (gt22L*J21L + + gt12L*J22L)*PDstandardNth2Xt2 + (gt23L*J21L + + gt13L*J22L)*PDstandardNth2Xt3 - 2*(gtu12*(J11L*J12L*PDstandardNth11gt12 + + J12L*J21L*PDstandardNth12gt12 + J11L*J22L*PDstandardNth12gt12 + + J12L*J31L*PDstandardNth13gt12 + J11L*J32L*PDstandardNth13gt12 + + dJ112L*PDstandardNth1gt12 + J21L*J22L*PDstandardNth22gt12 + + J22L*J31L*PDstandardNth23gt12 + J21L*J32L*PDstandardNth23gt12 + + dJ212L*PDstandardNth2gt12 + J31L*J32L*PDstandardNth33gt12 + + dJ312L*PDstandardNth3gt12) + gtu13*(J11L*J13L*PDstandardNth11gt12 + + J13L*J21L*PDstandardNth12gt12 + J11L*J23L*PDstandardNth12gt12 + + J13L*J31L*PDstandardNth13gt12 + J11L*J33L*PDstandardNth13gt12 + + dJ113L*PDstandardNth1gt12 + J21L*J23L*PDstandardNth22gt12 + + J23L*J31L*PDstandardNth23gt12 + J21L*J33L*PDstandardNth23gt12 + + dJ213L*PDstandardNth2gt12 + J31L*J33L*PDstandardNth33gt12 + + dJ313L*PDstandardNth3gt12) + gtu23*(J12L*J13L*PDstandardNth11gt12 + + J13L*J22L*PDstandardNth12gt12 + J12L*J23L*PDstandardNth12gt12 + + J13L*J32L*PDstandardNth13gt12 + J12L*J33L*PDstandardNth13gt12 + + dJ123L*PDstandardNth1gt12 + J22L*J23L*PDstandardNth22gt12 + + J23L*J32L*PDstandardNth23gt12 + J22L*J33L*PDstandardNth23gt12 + + dJ223L*PDstandardNth2gt12 + J32L*J33L*PDstandardNth33gt12 + + dJ323L*PDstandardNth3gt12)) + (gt12L*J31L + + gt11L*J32L)*PDstandardNth3Xt1 + (gt22L*J31L + + gt12L*J32L)*PDstandardNth3Xt2 + (gt23L*J31L + + gt13L*J32L)*PDstandardNth3Xt3 + (Gtl112 + Gtl211)*Xtn1 + (Gtl122 + + Gtl212)*Xtn2 + (Gtl123 + Gtl213)*Xtn3 - + gtu11*(2*J11L*J21L*PDstandardNth12gt12 + + 2*J11L*J31L*PDstandardNth13gt12 + dJ111L*PDstandardNth1gt12 + + 2*J21L*J31L*PDstandardNth23gt12 + dJ211L*PDstandardNth2gt12 + + dJ311L*PDstandardNth3gt12 + PDstandardNth11gt12*SQR(J11L) + + PDstandardNth22gt12*SQR(J21L) + PDstandardNth33gt12*SQR(J31L)) - + gtu22*(2*J12L*J22L*PDstandardNth12gt12 + + 2*J12L*J32L*PDstandardNth13gt12 + dJ122L*PDstandardNth1gt12 + + 2*J22L*J32L*PDstandardNth23gt12 + dJ222L*PDstandardNth2gt12 + + dJ322L*PDstandardNth3gt12 + PDstandardNth11gt12*SQR(J12L) + + PDstandardNth22gt12*SQR(J22L) + PDstandardNth33gt12*SQR(J32L)) - + gtu33*(2*J13L*J23L*PDstandardNth12gt12 + + 2*J13L*J33L*PDstandardNth13gt12 + dJ133L*PDstandardNth1gt12 + + 2*J23L*J33L*PDstandardNth23gt12 + dJ233L*PDstandardNth2gt12 + + dJ333L*PDstandardNth3gt12 + PDstandardNth11gt12*SQR(J13L) + + PDstandardNth22gt12*SQR(J23L) + PDstandardNth33gt12*SQR(J33L))); + + CCTK_REAL Rt13 = Gt123*Gtlu112 + Gt133*Gtlu113 + Gt223*Gtlu122 + + Gt233*Gtlu123 + (Gt111 + Gt313)*Gtlu131 + (Gt112 + Gt323)*Gtlu132 + + Gt333*Gtlu133 + Gt111*Gtlu311 + Gt112*Gtlu312 + Gt113*(Gtlu111 + + Gtlu133 + Gtlu313) + Gt211*(Gtlu231 + Gtlu321) + Gt212*(Gtlu232 + + Gtlu322) + Gt213*(Gtlu121 + Gtlu233 + Gtlu323) + 2*(Gt311*Gtlu331 + + Gt312*Gtlu332 + Gt313*Gtlu333) + 0.5*((gt13L*J11L + + gt11L*J13L)*PDstandardNth1Xt1 + (gt23L*J11L + + gt12L*J13L)*PDstandardNth1Xt2 + (gt33L*J11L + + gt13L*J13L)*PDstandardNth1Xt3 + (gt13L*J21L + + gt11L*J23L)*PDstandardNth2Xt1 + (gt23L*J21L + + gt12L*J23L)*PDstandardNth2Xt2 + (gt33L*J21L + + gt13L*J23L)*PDstandardNth2Xt3 - 2*(gtu12*(J11L*J12L*PDstandardNth11gt13 + + J12L*J21L*PDstandardNth12gt13 + J11L*J22L*PDstandardNth12gt13 + + J12L*J31L*PDstandardNth13gt13 + J11L*J32L*PDstandardNth13gt13 + + dJ112L*PDstandardNth1gt13 + J21L*J22L*PDstandardNth22gt13 + + J22L*J31L*PDstandardNth23gt13 + J21L*J32L*PDstandardNth23gt13 + + dJ212L*PDstandardNth2gt13 + J31L*J32L*PDstandardNth33gt13 + + dJ312L*PDstandardNth3gt13) + gtu13*(J11L*J13L*PDstandardNth11gt13 + + J13L*J21L*PDstandardNth12gt13 + J11L*J23L*PDstandardNth12gt13 + + J13L*J31L*PDstandardNth13gt13 + J11L*J33L*PDstandardNth13gt13 + + dJ113L*PDstandardNth1gt13 + J21L*J23L*PDstandardNth22gt13 + + J23L*J31L*PDstandardNth23gt13 + J21L*J33L*PDstandardNth23gt13 + + dJ213L*PDstandardNth2gt13 + J31L*J33L*PDstandardNth33gt13 + + dJ313L*PDstandardNth3gt13) + gtu23*(J12L*J13L*PDstandardNth11gt13 + + J13L*J22L*PDstandardNth12gt13 + J12L*J23L*PDstandardNth12gt13 + + J13L*J32L*PDstandardNth13gt13 + J12L*J33L*PDstandardNth13gt13 + + dJ123L*PDstandardNth1gt13 + J22L*J23L*PDstandardNth22gt13 + + J23L*J32L*PDstandardNth23gt13 + J22L*J33L*PDstandardNth23gt13 + + dJ223L*PDstandardNth2gt13 + J32L*J33L*PDstandardNth33gt13 + + dJ323L*PDstandardNth3gt13)) + (gt13L*J31L + + gt11L*J33L)*PDstandardNth3Xt1 + (gt23L*J31L + + gt12L*J33L)*PDstandardNth3Xt2 + (gt33L*J31L + + gt13L*J33L)*PDstandardNth3Xt3 + (Gtl113 + Gtl311)*Xtn1 + (Gtl123 + + Gtl312)*Xtn2 + (Gtl133 + Gtl313)*Xtn3 - + gtu11*(2*J11L*J21L*PDstandardNth12gt13 + + 2*J11L*J31L*PDstandardNth13gt13 + dJ111L*PDstandardNth1gt13 + + 2*J21L*J31L*PDstandardNth23gt13 + dJ211L*PDstandardNth2gt13 + + dJ311L*PDstandardNth3gt13 + PDstandardNth11gt13*SQR(J11L) + + PDstandardNth22gt13*SQR(J21L) + PDstandardNth33gt13*SQR(J31L)) - + gtu22*(2*J12L*J22L*PDstandardNth12gt13 + + 2*J12L*J32L*PDstandardNth13gt13 + dJ122L*PDstandardNth1gt13 + + 2*J22L*J32L*PDstandardNth23gt13 + dJ222L*PDstandardNth2gt13 + + dJ322L*PDstandardNth3gt13 + PDstandardNth11gt13*SQR(J12L) + + PDstandardNth22gt13*SQR(J22L) + PDstandardNth33gt13*SQR(J32L)) - + gtu33*(2*J13L*J23L*PDstandardNth12gt13 + + 2*J13L*J33L*PDstandardNth13gt13 + dJ133L*PDstandardNth1gt13 + + 2*J23L*J33L*PDstandardNth23gt13 + dJ233L*PDstandardNth2gt13 + + dJ333L*PDstandardNth3gt13 + PDstandardNth11gt13*SQR(J13L) + + PDstandardNth22gt13*SQR(J23L) + PDstandardNth33gt13*SQR(J33L))); + + CCTK_REAL Rt22 = Gt112*(Gtlu121 + 2*Gtlu211) + Gt122*(Gtlu122 + + 2*Gtlu212) + Gt123*(Gtlu123 + 2*Gtlu213) + 3*(Gt212*Gtlu221 + + Gt222*Gtlu222 + Gt223*Gtlu223) + 2*(Gt312*Gtlu231 + Gt322*Gtlu232 + + Gt323*Gtlu233) + Gt312*Gtlu321 + Gt322*Gtlu322 + Gt323*Gtlu323 + + J12L*(gt12L*PDstandardNth1Xt1 + gt22L*PDstandardNth1Xt2 + + gt23L*PDstandardNth1Xt3) + J22L*(gt12L*PDstandardNth2Xt1 + + gt22L*PDstandardNth2Xt2 + gt23L*PDstandardNth2Xt3) + + J32L*(gt12L*PDstandardNth3Xt1 + gt22L*PDstandardNth3Xt2 + + gt23L*PDstandardNth3Xt3) + Gtl212*Xtn1 + Gtl222*Xtn2 + Gtl223*Xtn3 + + 0.5*(-2*(gtu12*(J11L*J12L*PDstandardNth11gt22 + + J12L*J21L*PDstandardNth12gt22 + J11L*J22L*PDstandardNth12gt22 + + J12L*J31L*PDstandardNth13gt22 + J11L*J32L*PDstandardNth13gt22 + + dJ112L*PDstandardNth1gt22 + J21L*J22L*PDstandardNth22gt22 + + J22L*J31L*PDstandardNth23gt22 + J21L*J32L*PDstandardNth23gt22 + + dJ212L*PDstandardNth2gt22 + J31L*J32L*PDstandardNth33gt22 + + dJ312L*PDstandardNth3gt22) + gtu13*(J11L*J13L*PDstandardNth11gt22 + + J13L*J21L*PDstandardNth12gt22 + J11L*J23L*PDstandardNth12gt22 + + J13L*J31L*PDstandardNth13gt22 + J11L*J33L*PDstandardNth13gt22 + + dJ113L*PDstandardNth1gt22 + J21L*J23L*PDstandardNth22gt22 + + J23L*J31L*PDstandardNth23gt22 + J21L*J33L*PDstandardNth23gt22 + + dJ213L*PDstandardNth2gt22 + J31L*J33L*PDstandardNth33gt22 + + dJ313L*PDstandardNth3gt22) + gtu23*(J12L*J13L*PDstandardNth11gt22 + + J13L*J22L*PDstandardNth12gt22 + J12L*J23L*PDstandardNth12gt22 + + J13L*J32L*PDstandardNth13gt22 + J12L*J33L*PDstandardNth13gt22 + + dJ123L*PDstandardNth1gt22 + J22L*J23L*PDstandardNth22gt22 + + J23L*J32L*PDstandardNth23gt22 + J22L*J33L*PDstandardNth23gt22 + + dJ223L*PDstandardNth2gt22 + J32L*J33L*PDstandardNth33gt22 + + dJ323L*PDstandardNth3gt22)) - gtu11*(2*J11L*J21L*PDstandardNth12gt22 + + 2*J11L*J31L*PDstandardNth13gt22 + dJ111L*PDstandardNth1gt22 + + 2*J21L*J31L*PDstandardNth23gt22 + dJ211L*PDstandardNth2gt22 + + dJ311L*PDstandardNth3gt22 + PDstandardNth11gt22*SQR(J11L) + + PDstandardNth22gt22*SQR(J21L) + PDstandardNth33gt22*SQR(J31L)) - + gtu22*(2*J12L*J22L*PDstandardNth12gt22 + + 2*J12L*J32L*PDstandardNth13gt22 + dJ122L*PDstandardNth1gt22 + + 2*J22L*J32L*PDstandardNth23gt22 + dJ222L*PDstandardNth2gt22 + + dJ322L*PDstandardNth3gt22 + PDstandardNth11gt22*SQR(J12L) + + PDstandardNth22gt22*SQR(J22L) + PDstandardNth33gt22*SQR(J32L)) - + gtu33*(2*J13L*J23L*PDstandardNth12gt22 + + 2*J13L*J33L*PDstandardNth13gt22 + dJ133L*PDstandardNth1gt22 + + 2*J23L*J33L*PDstandardNth23gt22 + dJ233L*PDstandardNth2gt22 + + dJ333L*PDstandardNth3gt22 + PDstandardNth11gt22*SQR(J13L) + + PDstandardNth22gt22*SQR(J23L) + PDstandardNth33gt22*SQR(J33L))); + + CCTK_REAL Rt23 = Gt113*Gtlu211 + Gt133*Gtlu213 + Gt213*Gtlu221 + + Gt233*Gtlu223 + (Gt212 + Gt313)*Gtlu231 + (Gt222 + Gt323)*Gtlu232 + + Gt333*Gtlu233 + Gt112*(Gtlu131 + Gtlu311) + Gt122*(Gtlu132 + Gtlu312) + + Gt123*(Gtlu133 + Gtlu212 + Gtlu313) + Gt212*Gtlu321 + Gt222*Gtlu322 + + Gt223*(Gtlu222 + Gtlu233 + Gtlu323) + 2*(Gt312*Gtlu331 + Gt322*Gtlu332 + + Gt323*Gtlu333) + 0.5*((gt13L*J12L + gt12L*J13L)*PDstandardNth1Xt1 + + (gt23L*J12L + gt22L*J13L)*PDstandardNth1Xt2 + (gt33L*J12L + + gt23L*J13L)*PDstandardNth1Xt3 + (gt13L*J22L + + gt12L*J23L)*PDstandardNth2Xt1 + (gt23L*J22L + + gt22L*J23L)*PDstandardNth2Xt2 + (gt33L*J22L + + gt23L*J23L)*PDstandardNth2Xt3 - 2*(gtu12*(J11L*J12L*PDstandardNth11gt23 + + J12L*J21L*PDstandardNth12gt23 + J11L*J22L*PDstandardNth12gt23 + + J12L*J31L*PDstandardNth13gt23 + J11L*J32L*PDstandardNth13gt23 + + dJ112L*PDstandardNth1gt23 + J21L*J22L*PDstandardNth22gt23 + + J22L*J31L*PDstandardNth23gt23 + J21L*J32L*PDstandardNth23gt23 + + dJ212L*PDstandardNth2gt23 + J31L*J32L*PDstandardNth33gt23 + + dJ312L*PDstandardNth3gt23) + gtu13*(J11L*J13L*PDstandardNth11gt23 + + J13L*J21L*PDstandardNth12gt23 + J11L*J23L*PDstandardNth12gt23 + + J13L*J31L*PDstandardNth13gt23 + J11L*J33L*PDstandardNth13gt23 + + dJ113L*PDstandardNth1gt23 + J21L*J23L*PDstandardNth22gt23 + + J23L*J31L*PDstandardNth23gt23 + J21L*J33L*PDstandardNth23gt23 + + dJ213L*PDstandardNth2gt23 + J31L*J33L*PDstandardNth33gt23 + + dJ313L*PDstandardNth3gt23) + gtu23*(J12L*J13L*PDstandardNth11gt23 + + J13L*J22L*PDstandardNth12gt23 + J12L*J23L*PDstandardNth12gt23 + + J13L*J32L*PDstandardNth13gt23 + J12L*J33L*PDstandardNth13gt23 + + dJ123L*PDstandardNth1gt23 + J22L*J23L*PDstandardNth22gt23 + + J23L*J32L*PDstandardNth23gt23 + J22L*J33L*PDstandardNth23gt23 + + dJ223L*PDstandardNth2gt23 + J32L*J33L*PDstandardNth33gt23 + + dJ323L*PDstandardNth3gt23)) + (gt13L*J32L + + gt12L*J33L)*PDstandardNth3Xt1 + (gt23L*J32L + + gt22L*J33L)*PDstandardNth3Xt2 + (gt33L*J32L + + gt23L*J33L)*PDstandardNth3Xt3 + (Gtl213 + Gtl312)*Xtn1 + (Gtl223 + + Gtl322)*Xtn2 + (Gtl233 + Gtl323)*Xtn3 - + gtu11*(2*J11L*J21L*PDstandardNth12gt23 + + 2*J11L*J31L*PDstandardNth13gt23 + dJ111L*PDstandardNth1gt23 + + 2*J21L*J31L*PDstandardNth23gt23 + dJ211L*PDstandardNth2gt23 + + dJ311L*PDstandardNth3gt23 + PDstandardNth11gt23*SQR(J11L) + + PDstandardNth22gt23*SQR(J21L) + PDstandardNth33gt23*SQR(J31L)) - + gtu22*(2*J12L*J22L*PDstandardNth12gt23 + + 2*J12L*J32L*PDstandardNth13gt23 + dJ122L*PDstandardNth1gt23 + + 2*J22L*J32L*PDstandardNth23gt23 + dJ222L*PDstandardNth2gt23 + + dJ322L*PDstandardNth3gt23 + PDstandardNth11gt23*SQR(J12L) + + PDstandardNth22gt23*SQR(J22L) + PDstandardNth33gt23*SQR(J32L)) - + gtu33*(2*J13L*J23L*PDstandardNth12gt23 + + 2*J13L*J33L*PDstandardNth13gt23 + dJ133L*PDstandardNth1gt23 + + 2*J23L*J33L*PDstandardNth23gt23 + dJ233L*PDstandardNth2gt23 + + dJ333L*PDstandardNth3gt23 + PDstandardNth11gt23*SQR(J13L) + + PDstandardNth22gt23*SQR(J23L) + PDstandardNth33gt23*SQR(J33L))); + + CCTK_REAL Rt33 = Gt113*(Gtlu131 + 2*Gtlu311) + Gt123*(Gtlu132 + + 2*Gtlu312) + Gt133*(Gtlu133 + 2*Gtlu313) + Gt213*(Gtlu231 + 2*Gtlu321) + + Gt223*(Gtlu232 + 2*Gtlu322) + Gt233*(Gtlu233 + 2*Gtlu323) + + 3*(Gt313*Gtlu331 + Gt323*Gtlu332 + Gt333*Gtlu333) + + J13L*(gt13L*PDstandardNth1Xt1 + gt23L*PDstandardNth1Xt2 + + gt33L*PDstandardNth1Xt3) + J23L*(gt13L*PDstandardNth2Xt1 + + gt23L*PDstandardNth2Xt2 + gt33L*PDstandardNth2Xt3) + + J33L*(gt13L*PDstandardNth3Xt1 + gt23L*PDstandardNth3Xt2 + + gt33L*PDstandardNth3Xt3) + Gtl313*Xtn1 + Gtl323*Xtn2 + Gtl333*Xtn3 + + 0.5*(-2*(gtu12*(J11L*J12L*PDstandardNth11gt33 + + J12L*J21L*PDstandardNth12gt33 + J11L*J22L*PDstandardNth12gt33 + + J12L*J31L*PDstandardNth13gt33 + J11L*J32L*PDstandardNth13gt33 + + dJ112L*PDstandardNth1gt33 + J21L*J22L*PDstandardNth22gt33 + + J22L*J31L*PDstandardNth23gt33 + J21L*J32L*PDstandardNth23gt33 + + dJ212L*PDstandardNth2gt33 + J31L*J32L*PDstandardNth33gt33 + + dJ312L*PDstandardNth3gt33) + gtu13*(J11L*J13L*PDstandardNth11gt33 + + J13L*J21L*PDstandardNth12gt33 + J11L*J23L*PDstandardNth12gt33 + + J13L*J31L*PDstandardNth13gt33 + J11L*J33L*PDstandardNth13gt33 + + dJ113L*PDstandardNth1gt33 + J21L*J23L*PDstandardNth22gt33 + + J23L*J31L*PDstandardNth23gt33 + J21L*J33L*PDstandardNth23gt33 + + dJ213L*PDstandardNth2gt33 + J31L*J33L*PDstandardNth33gt33 + + dJ313L*PDstandardNth3gt33) + gtu23*(J12L*J13L*PDstandardNth11gt33 + + J13L*J22L*PDstandardNth12gt33 + J12L*J23L*PDstandardNth12gt33 + + J13L*J32L*PDstandardNth13gt33 + J12L*J33L*PDstandardNth13gt33 + + dJ123L*PDstandardNth1gt33 + J22L*J23L*PDstandardNth22gt33 + + J23L*J32L*PDstandardNth23gt33 + J22L*J33L*PDstandardNth23gt33 + + dJ223L*PDstandardNth2gt33 + J32L*J33L*PDstandardNth33gt33 + + dJ323L*PDstandardNth3gt33)) - gtu11*(2*J11L*J21L*PDstandardNth12gt33 + + 2*J11L*J31L*PDstandardNth13gt33 + dJ111L*PDstandardNth1gt33 + + 2*J21L*J31L*PDstandardNth23gt33 + dJ211L*PDstandardNth2gt33 + + dJ311L*PDstandardNth3gt33 + PDstandardNth11gt33*SQR(J11L) + + PDstandardNth22gt33*SQR(J21L) + PDstandardNth33gt33*SQR(J31L)) - + gtu22*(2*J12L*J22L*PDstandardNth12gt33 + + 2*J12L*J32L*PDstandardNth13gt33 + dJ122L*PDstandardNth1gt33 + + 2*J22L*J32L*PDstandardNth23gt33 + dJ222L*PDstandardNth2gt33 + + dJ322L*PDstandardNth3gt33 + PDstandardNth11gt33*SQR(J12L) + + PDstandardNth22gt33*SQR(J22L) + PDstandardNth33gt33*SQR(J32L)) - + gtu33*(2*J13L*J23L*PDstandardNth12gt33 + + 2*J13L*J33L*PDstandardNth13gt33 + dJ133L*PDstandardNth1gt33 + + 2*J23L*J33L*PDstandardNth23gt33 + dJ233L*PDstandardNth2gt33 + + dJ333L*PDstandardNth3gt33 + PDstandardNth11gt33*SQR(J13L) + + PDstandardNth22gt33*SQR(J23L) + PDstandardNth33gt33*SQR(J33L))); + + CCTK_REAL fac1 = IfThen(ToReal(conformalMethod),-0.5*INV(phiL),1); + + CCTK_REAL cdphi1 = fac1*(J11L*PDstandardNth1phi + + J21L*PDstandardNth2phi + J31L*PDstandardNth3phi); + + CCTK_REAL cdphi2 = fac1*(J12L*PDstandardNth1phi + + J22L*PDstandardNth2phi + J32L*PDstandardNth3phi); + + CCTK_REAL cdphi3 = fac1*(J13L*PDstandardNth1phi + + J23L*PDstandardNth2phi + J33L*PDstandardNth3phi); + + CCTK_REAL fac2 = IfThen(ToReal(conformalMethod),0.5*INV(SQR(phiL)),0); + + CCTK_REAL cdphi211 = fac1*((dJ111L - Gt111*J11L - Gt211*J12L - + Gt311*J13L)*PDstandardNth1phi + 2*(J11L*(J21L*PDstandardNth12phi + + J31L*PDstandardNth13phi) + J21L*J31L*PDstandardNth23phi) + (dJ211L - + Gt111*J21L - Gt211*J22L - Gt311*J23L)*PDstandardNth2phi + (dJ311L - + Gt111*J31L - Gt211*J32L - Gt311*J33L)*PDstandardNth3phi + + PDstandardNth11phi*SQR(J11L) + PDstandardNth22phi*SQR(J21L) + + PDstandardNth33phi*SQR(J31L)) + fac2*SQR(J11L*PDstandardNth1phi + + J21L*PDstandardNth2phi + J31L*PDstandardNth3phi); + + CCTK_REAL cdphi212 = fac2*(J11L*PDstandardNth1phi + + J21L*PDstandardNth2phi + + J31L*PDstandardNth3phi)*(J12L*PDstandardNth1phi + + J22L*PDstandardNth2phi + J32L*PDstandardNth3phi) + + fac1*(J12L*(J11L*PDstandardNth11phi + J21L*PDstandardNth12phi + + J31L*PDstandardNth13phi) + J11L*(J22L*PDstandardNth12phi + + J32L*PDstandardNth13phi) + (dJ112L - Gt112*J11L - Gt212*J12L - + Gt312*J13L)*PDstandardNth1phi + J22L*(J21L*PDstandardNth22phi + + J31L*PDstandardNth23phi) + (dJ212L - Gt112*J21L - Gt212*J22L - + Gt312*J23L)*PDstandardNth2phi + J32L*(J21L*PDstandardNth23phi + + J31L*PDstandardNth33phi) + (dJ312L - Gt112*J31L - Gt212*J32L - + Gt312*J33L)*PDstandardNth3phi); + + CCTK_REAL cdphi213 = fac2*(J11L*PDstandardNth1phi + + J21L*PDstandardNth2phi + + J31L*PDstandardNth3phi)*(J13L*PDstandardNth1phi + + J23L*PDstandardNth2phi + J33L*PDstandardNth3phi) + + fac1*(J13L*(J11L*PDstandardNth11phi + J21L*PDstandardNth12phi + + J31L*PDstandardNth13phi) + J11L*(J23L*PDstandardNth12phi + + J33L*PDstandardNth13phi) + (dJ113L - Gt113*J11L - Gt213*J12L - + Gt313*J13L)*PDstandardNth1phi + J23L*(J21L*PDstandardNth22phi + + J31L*PDstandardNth23phi) + (dJ213L - Gt113*J21L - Gt213*J22L - + Gt313*J23L)*PDstandardNth2phi + J33L*(J21L*PDstandardNth23phi + + J31L*PDstandardNth33phi) + (dJ313L - Gt113*J31L - Gt213*J32L - + Gt313*J33L)*PDstandardNth3phi); + + CCTK_REAL cdphi222 = fac1*((dJ122L - Gt122*J11L - Gt222*J12L - + Gt322*J13L)*PDstandardNth1phi + 2*(J12L*(J22L*PDstandardNth12phi + + J32L*PDstandardNth13phi) + J22L*J32L*PDstandardNth23phi) + (dJ222L - + Gt122*J21L - Gt222*J22L - Gt322*J23L)*PDstandardNth2phi + (dJ322L - + Gt122*J31L - Gt222*J32L - Gt322*J33L)*PDstandardNth3phi + + PDstandardNth11phi*SQR(J12L) + PDstandardNth22phi*SQR(J22L) + + PDstandardNth33phi*SQR(J32L)) + fac2*SQR(J12L*PDstandardNth1phi + + J22L*PDstandardNth2phi + J32L*PDstandardNth3phi); + + CCTK_REAL cdphi223 = fac2*(J12L*PDstandardNth1phi + + J22L*PDstandardNth2phi + + J32L*PDstandardNth3phi)*(J13L*PDstandardNth1phi + + J23L*PDstandardNth2phi + J33L*PDstandardNth3phi) + + fac1*(J13L*(J12L*PDstandardNth11phi + J22L*PDstandardNth12phi + + J32L*PDstandardNth13phi) + J12L*(J23L*PDstandardNth12phi + + J33L*PDstandardNth13phi) + (dJ123L - Gt123*J11L - Gt223*J12L - + Gt323*J13L)*PDstandardNth1phi + J23L*(J22L*PDstandardNth22phi + + J32L*PDstandardNth23phi) + (dJ223L - Gt123*J21L - Gt223*J22L - + Gt323*J23L)*PDstandardNth2phi + J33L*(J22L*PDstandardNth23phi + + J32L*PDstandardNth33phi) + (dJ323L - Gt123*J31L - Gt223*J32L - + Gt323*J33L)*PDstandardNth3phi); + + CCTK_REAL cdphi233 = fac1*((dJ133L - Gt133*J11L - Gt233*J12L - + Gt333*J13L)*PDstandardNth1phi + 2*(J13L*(J23L*PDstandardNth12phi + + J33L*PDstandardNth13phi) + J23L*J33L*PDstandardNth23phi) + (dJ233L - + Gt133*J21L - Gt233*J22L - Gt333*J23L)*PDstandardNth2phi + (dJ333L - + Gt133*J31L - Gt233*J32L - Gt333*J33L)*PDstandardNth3phi + + PDstandardNth11phi*SQR(J13L) + PDstandardNth22phi*SQR(J23L) + + PDstandardNth33phi*SQR(J33L)) + fac2*SQR(J13L*PDstandardNth1phi + + J23L*PDstandardNth2phi + J33L*PDstandardNth3phi); + + CCTK_REAL Rphi11 = -2*(cdphi211 + 2*(-1 + gt11L*gtu11)*SQR(cdphi1) + + gt11L*(cdphi211*gtu11 + 4*(cdphi1*(cdphi2*gtu12 + cdphi3*gtu13) + + cdphi2*cdphi3*gtu23) + cdphi233*gtu33 + gtu22*(cdphi222 + + 2*SQR(cdphi2)) + 2*(cdphi212*gtu12 + cdphi213*gtu13 + cdphi223*gtu23 + + gtu33*SQR(cdphi3)))); + + CCTK_REAL Rphi12 = -2*(cdphi212 + cdphi1*(cdphi2*(-2 + 4*gt12L*gtu12) + + 4*cdphi3*gt12L*gtu13) + gt12L*(cdphi211*gtu11 + 4*cdphi2*cdphi3*gtu23 + + 2*(cdphi212*gtu12 + cdphi213*gtu13 + cdphi223*gtu23 + + gtu11*SQR(cdphi1)) + gtu22*(cdphi222 + 2*SQR(cdphi2)) + gtu33*(cdphi233 + + 2*SQR(cdphi3)))); + + CCTK_REAL Rphi13 = -2*(cdphi213 + cdphi1*(4*cdphi2*gt13L*gtu12 + + cdphi3*(-2 + 4*gt13L*gtu13)) + gt13L*(cdphi211*gtu11 + + 4*cdphi2*cdphi3*gtu23 + 2*(cdphi212*gtu12 + cdphi213*gtu13 + + cdphi223*gtu23 + gtu11*SQR(cdphi1)) + gtu22*(cdphi222 + 2*SQR(cdphi2)) + + gtu33*(cdphi233 + 2*SQR(cdphi3)))); + + CCTK_REAL Rphi22 = -2*(cdphi222 + 2*(-1 + gt22L*gtu22)*SQR(cdphi2) + + gt22L*(cdphi222*gtu22 + 4*(cdphi1*cdphi3*gtu13 + cdphi2*(cdphi1*gtu12 + + cdphi3*gtu23)) + cdphi233*gtu33 + gtu11*(cdphi211 + 2*SQR(cdphi1)) + + 2*(cdphi212*gtu12 + cdphi213*gtu13 + cdphi223*gtu23 + + gtu33*SQR(cdphi3)))); + + CCTK_REAL Rphi23 = -2*(cdphi223 + cdphi2*(4*cdphi1*gt23L*gtu12 + + cdphi3*(-2 + 4*gt23L*gtu23)) + gt23L*(4*cdphi1*cdphi3*gtu13 + + cdphi222*gtu22 + gtu11*(cdphi211 + 2*SQR(cdphi1)) + 2*(cdphi212*gtu12 + + cdphi213*gtu13 + cdphi223*gtu23 + gtu22*SQR(cdphi2)) + gtu33*(cdphi233 + + 2*SQR(cdphi3)))); + + CCTK_REAL Rphi33 = -2*(cdphi233 + gt33L*((4*cdphi1*cdphi2 + + 2*cdphi212)*gtu12 + 4*cdphi3*(cdphi1*gtu13 + cdphi2*gtu23) + + 2*(cdphi213*gtu13 + cdphi223*gtu23) + cdphi233*gtu33 + gtu11*(cdphi211 + + 2*SQR(cdphi1)) + gtu22*(cdphi222 + 2*SQR(cdphi2))) + 2*(-1 + + gt33L*gtu33)*SQR(cdphi3)); + + CCTK_REAL Atm11 = At11L*gtu11 + At12L*gtu12 + At13L*gtu13; + + CCTK_REAL Atm21 = At11L*gtu12 + At12L*gtu22 + At13L*gtu23; + + CCTK_REAL Atm31 = At11L*gtu13 + At12L*gtu23 + At13L*gtu33; + + CCTK_REAL Atm12 = At12L*gtu11 + At22L*gtu12 + At23L*gtu13; + + CCTK_REAL Atm22 = At12L*gtu12 + At22L*gtu22 + At23L*gtu23; + + CCTK_REAL Atm32 = At12L*gtu13 + At22L*gtu23 + At23L*gtu33; + + CCTK_REAL Atm13 = At13L*gtu11 + At23L*gtu12 + At33L*gtu13; + + CCTK_REAL Atm23 = At13L*gtu12 + At23L*gtu22 + At33L*gtu23; + + CCTK_REAL Atm33 = At13L*gtu13 + At23L*gtu23 + At33L*gtu33; + + CCTK_REAL e4phi = + IfThen(ToReal(conformalMethod),INV(SQR(phiL)),exp(4*phiL)); + + CCTK_REAL em4phi = INV(e4phi); + + CCTK_REAL g11 = e4phi*gt11L; + + CCTK_REAL g12 = e4phi*gt12L; + + CCTK_REAL g13 = e4phi*gt13L; + + CCTK_REAL g22 = e4phi*gt22L; + + CCTK_REAL g23 = e4phi*gt23L; + + CCTK_REAL g33 = e4phi*gt33L; + + CCTK_REAL gu11 = em4phi*gtu11; + + CCTK_REAL gu12 = em4phi*gtu12; + + CCTK_REAL gu13 = em4phi*gtu13; + + CCTK_REAL gu22 = em4phi*gtu22; + + CCTK_REAL gu23 = em4phi*gtu23; + + CCTK_REAL gu33 = em4phi*gtu33; + + CCTK_REAL R11 = Rphi11 + Rt11; + + CCTK_REAL R12 = Rphi12 + Rt12; + + CCTK_REAL R13 = Rphi13 + Rt13; + + CCTK_REAL R22 = Rphi22 + Rt22; + + CCTK_REAL R23 = Rphi23 + Rt23; + + CCTK_REAL R33 = Rphi33 + Rt33; + + CCTK_REAL trS = em4phi*(eTxxL*gtu11 + eTyyL*gtu22 + 2*(eTxyL*gtu12 + + eTxzL*gtu13 + eTyzL*gtu23) + eTzzL*gtu33); + + CCTK_REAL Ats11 = (-dJ111L + 4*cdphi1*J11L + Gt111*J11L + Gt211*J12L + + Gt311*J13L)*PDstandardNth1alpha - 2*(J11L*J21L*PDstandardNth12alpha + + J11L*J31L*PDstandardNth13alpha + J21L*J31L*PDstandardNth23alpha) + + (-dJ211L + 4*cdphi1*J21L + Gt111*J21L + Gt211*J22L + + Gt311*J23L)*PDstandardNth2alpha + (-dJ311L + 4*cdphi1*J31L + Gt111*J31L + + Gt211*J32L + Gt311*J33L)*PDstandardNth3alpha + alphaL*R11 - + PDstandardNth11alpha*SQR(J11L) - PDstandardNth22alpha*SQR(J21L) - + PDstandardNth33alpha*SQR(J31L); + + CCTK_REAL Ats12 = J12L*(-(J11L*PDstandardNth11alpha) - + J21L*PDstandardNth12alpha - J31L*PDstandardNth13alpha) + + J11L*(-(J22L*PDstandardNth12alpha) - J32L*PDstandardNth13alpha) + + (-dJ112L + 2*cdphi2*J11L + Gt112*J11L + 2*cdphi1*J12L + Gt212*J12L + + Gt312*J13L)*PDstandardNth1alpha + J22L*(-(J21L*PDstandardNth22alpha) - + J31L*PDstandardNth23alpha) + (-dJ212L + 2*cdphi2*J21L + Gt112*J21L + + 2*cdphi1*J22L + Gt212*J22L + Gt312*J23L)*PDstandardNth2alpha + + J32L*(-(J21L*PDstandardNth23alpha) - J31L*PDstandardNth33alpha) + + Gt112*J31L*PDstandardNth3alpha + (-dJ312L + + 2*cdphi2*J31L)*PDstandardNth3alpha + 2*cdphi1*J32L*PDstandardNth3alpha + + Gt212*J32L*PDstandardNth3alpha + Gt312*J33L*PDstandardNth3alpha + + alphaL*R12; + + CCTK_REAL Ats13 = J13L*(-(J11L*PDstandardNth11alpha) - + J21L*PDstandardNth12alpha - J31L*PDstandardNth13alpha) + + J11L*(-(J23L*PDstandardNth12alpha) - J33L*PDstandardNth13alpha) + + (-dJ113L + 2*cdphi3*J11L + Gt113*J11L + Gt213*J12L + 2*cdphi1*J13L + + Gt313*J13L)*PDstandardNth1alpha + J23L*(-(J21L*PDstandardNth22alpha) - + J31L*PDstandardNth23alpha) + (-dJ213L + 2*cdphi3*J21L + Gt113*J21L + + Gt213*J22L + 2*cdphi1*J23L + Gt313*J23L)*PDstandardNth2alpha + + J33L*(-(J21L*PDstandardNth23alpha) - J31L*PDstandardNth33alpha) + + Gt113*J31L*PDstandardNth3alpha + (-dJ313L + + 2*cdphi3*J31L)*PDstandardNth3alpha + Gt213*J32L*PDstandardNth3alpha + + 2*cdphi1*J33L*PDstandardNth3alpha + Gt313*J33L*PDstandardNth3alpha + + alphaL*R13; + + CCTK_REAL Ats22 = (-dJ122L + Gt122*J11L + 4*cdphi2*J12L + Gt222*J12L + + Gt322*J13L)*PDstandardNth1alpha - 2*(J12L*J22L*PDstandardNth12alpha + + J12L*J32L*PDstandardNth13alpha + J22L*J32L*PDstandardNth23alpha) + + (-dJ222L + Gt122*J21L + 4*cdphi2*J22L + Gt222*J22L + + Gt322*J23L)*PDstandardNth2alpha + (-dJ322L + Gt122*J31L + 4*cdphi2*J32L + + Gt222*J32L + Gt322*J33L)*PDstandardNth3alpha + alphaL*R22 - + PDstandardNth11alpha*SQR(J12L) - PDstandardNth22alpha*SQR(J22L) - + PDstandardNth33alpha*SQR(J32L); + + CCTK_REAL Ats23 = J13L*(-(J12L*PDstandardNth11alpha) - + J22L*PDstandardNth12alpha - J32L*PDstandardNth13alpha) + + J12L*(-(J23L*PDstandardNth12alpha) - J33L*PDstandardNth13alpha) + + (-dJ123L + Gt123*J11L + 2*cdphi3*J12L + Gt223*J12L + 2*cdphi2*J13L + + Gt323*J13L)*PDstandardNth1alpha + J23L*(-(J22L*PDstandardNth22alpha) - + J32L*PDstandardNth23alpha) + (-dJ223L + Gt123*J21L + 2*cdphi3*J22L + + Gt223*J22L + 2*cdphi2*J23L + Gt323*J23L)*PDstandardNth2alpha + + J33L*(-(J22L*PDstandardNth23alpha) - J32L*PDstandardNth33alpha) + + (-dJ323L + Gt123*J31L)*PDstandardNth3alpha + + 2*cdphi3*J32L*PDstandardNth3alpha + Gt223*J32L*PDstandardNth3alpha + + 2*cdphi2*J33L*PDstandardNth3alpha + Gt323*J33L*PDstandardNth3alpha + + alphaL*R23; + + CCTK_REAL Ats33 = (-dJ133L + Gt133*J11L + Gt233*J12L + 4*cdphi3*J13L + + Gt333*J13L)*PDstandardNth1alpha - 2*(J13L*J23L*PDstandardNth12alpha + + J13L*J33L*PDstandardNth13alpha + J23L*J33L*PDstandardNth23alpha) + + (-dJ233L + Gt133*J21L + Gt233*J22L + 4*cdphi3*J23L + + Gt333*J23L)*PDstandardNth2alpha + (-dJ333L + Gt133*J31L + Gt233*J32L + + 4*cdphi3*J33L + Gt333*J33L)*PDstandardNth3alpha + alphaL*R33 - + PDstandardNth11alpha*SQR(J13L) - PDstandardNth22alpha*SQR(J23L) - + PDstandardNth33alpha*SQR(J33L); + + CCTK_REAL trAts = Ats11*gu11 + Ats22*gu22 + 2*(Ats12*gu12 + Ats13*gu13 + + Ats23*gu23) + Ats33*gu33; + + CCTK_REAL At11rhsL = (epsdiss1*J11L + epsdiss2*J12L + + epsdiss3*J13L)*PDdissipationNth1At11 + (epsdiss1*J21L + epsdiss2*J22L + + epsdiss3*J23L)*PDdissipationNth2At11 + (epsdiss1*J31L + epsdiss2*J32L + + epsdiss3*J33L)*PDdissipationNth3At11 - + 0.666666666666666666666666666667*At11L*(J11L*PDstandardNth1beta1 + + J12L*PDstandardNth1beta2 + J13L*PDstandardNth1beta3 + + J21L*PDstandardNth2beta1 + J22L*PDstandardNth2beta2 + + J23L*PDstandardNth2beta3 + J31L*PDstandardNth3beta1 + + J32L*PDstandardNth3beta2 + J33L*PDstandardNth3beta3) + + 2*(J11L*(At11L*PDstandardNth1beta1 + At12L*PDstandardNth1beta2 + + At13L*PDstandardNth1beta3) + J21L*(At11L*PDstandardNth2beta1 + + At12L*PDstandardNth2beta2 + At13L*PDstandardNth2beta3) + + J31L*(At11L*PDstandardNth3beta1 + At12L*PDstandardNth3beta2 + + At13L*PDstandardNth3beta3)) + (beta1L*J11L + beta2L*J12L + + beta3L*J13L)*PDupwindNthAnti1At11 + (beta1L*J21L + beta2L*J22L + + beta3L*J23L)*PDupwindNthAnti2At11 + (beta1L*J31L + beta2L*J32L + + beta3L*J33L)*PDupwindNthAnti3At11 + alphaL*(-2*(At11L*Atm11 + + At12L*Atm21 + At13L*Atm31) + At11L*trKL) + em4phi*(Ats11 - + 0.333333333333333333333333333333*g11*trAts - + 25.13274122871834590770114706623602307358*alphaL*(eTxxL - + 0.333333333333333333333333333333*g11*trS)) + (J11L*PDupwindNthSymm1At11 + + J21L*PDupwindNthSymm2At11 + J31L*PDupwindNthSymm3At11)*Abs(beta1L) + + (J12L*PDupwindNthSymm1At11 + J22L*PDupwindNthSymm2At11 + + J32L*PDupwindNthSymm3At11)*Abs(beta2L) + (J13L*PDupwindNthSymm1At11 + + J23L*PDupwindNthSymm2At11 + J33L*PDupwindNthSymm3At11)*Abs(beta3L); + + CCTK_REAL At12rhsL = (epsdiss1*J11L + epsdiss2*J12L + + epsdiss3*J13L)*PDdissipationNth1At12 + (epsdiss1*J21L + epsdiss2*J22L + + epsdiss3*J23L)*PDdissipationNth2At12 + (epsdiss1*J31L + epsdiss2*J32L + + epsdiss3*J33L)*PDdissipationNth3At12 + (At12L*J11L + + At11L*J12L)*PDstandardNth1beta1 + (At22L*J11L + + At12L*J12L)*PDstandardNth1beta2 + (At23L*J11L + + At13L*J12L)*PDstandardNth1beta3 + (At12L*J21L + + At11L*J22L)*PDstandardNth2beta1 + (At22L*J21L + + At12L*J22L)*PDstandardNth2beta2 + (At23L*J21L + + At13L*J22L)*PDstandardNth2beta3 + (At12L*J31L + + At11L*J32L)*PDstandardNth3beta1 + (At22L*J31L + + At12L*J32L)*PDstandardNth3beta2 + (At23L*J31L + + At13L*J32L)*PDstandardNth3beta3 - + 0.666666666666666666666666666667*At12L*(J11L*PDstandardNth1beta1 + + J12L*PDstandardNth1beta2 + J13L*PDstandardNth1beta3 + + J21L*PDstandardNth2beta1 + J22L*PDstandardNth2beta2 + + J23L*PDstandardNth2beta3 + J31L*PDstandardNth3beta1 + + J32L*PDstandardNth3beta2 + J33L*PDstandardNth3beta3) + (beta1L*J11L + + beta2L*J12L + beta3L*J13L)*PDupwindNthAnti1At12 + (beta1L*J21L + + beta2L*J22L + beta3L*J23L)*PDupwindNthAnti2At12 + (beta1L*J31L + + beta2L*J32L + beta3L*J33L)*PDupwindNthAnti3At12 + + alphaL*(-2*(At11L*Atm12 + At12L*Atm22 + At13L*Atm32) + At12L*trKL) + + em4phi*(Ats12 - 0.333333333333333333333333333333*g12*trAts - + 25.13274122871834590770114706623602307358*alphaL*(eTxyL - + 0.333333333333333333333333333333*g12*trS)) + (J11L*PDupwindNthSymm1At12 + + J21L*PDupwindNthSymm2At12 + J31L*PDupwindNthSymm3At12)*Abs(beta1L) + + (J12L*PDupwindNthSymm1At12 + J22L*PDupwindNthSymm2At12 + + J32L*PDupwindNthSymm3At12)*Abs(beta2L) + (J13L*PDupwindNthSymm1At12 + + J23L*PDupwindNthSymm2At12 + J33L*PDupwindNthSymm3At12)*Abs(beta3L); + + CCTK_REAL At13rhsL = (epsdiss1*J11L + epsdiss2*J12L + + epsdiss3*J13L)*PDdissipationNth1At13 + (epsdiss1*J21L + epsdiss2*J22L + + epsdiss3*J23L)*PDdissipationNth2At13 + (epsdiss1*J31L + epsdiss2*J32L + + epsdiss3*J33L)*PDdissipationNth3At13 + (At13L*J11L + + At11L*J13L)*PDstandardNth1beta1 + (At23L*J11L + + At12L*J13L)*PDstandardNth1beta2 + (At33L*J11L + + At13L*J13L)*PDstandardNth1beta3 + (At13L*J21L + + At11L*J23L)*PDstandardNth2beta1 + (At23L*J21L + + At12L*J23L)*PDstandardNth2beta2 + (At33L*J21L + + At13L*J23L)*PDstandardNth2beta3 + (At13L*J31L + + At11L*J33L)*PDstandardNth3beta1 + (At23L*J31L + + At12L*J33L)*PDstandardNth3beta2 + (At33L*J31L + + At13L*J33L)*PDstandardNth3beta3 - + 0.666666666666666666666666666667*At13L*(J11L*PDstandardNth1beta1 + + J12L*PDstandardNth1beta2 + J13L*PDstandardNth1beta3 + + J21L*PDstandardNth2beta1 + J22L*PDstandardNth2beta2 + + J23L*PDstandardNth2beta3 + J31L*PDstandardNth3beta1 + + J32L*PDstandardNth3beta2 + J33L*PDstandardNth3beta3) + (beta1L*J11L + + beta2L*J12L + beta3L*J13L)*PDupwindNthAnti1At13 + (beta1L*J21L + + beta2L*J22L + beta3L*J23L)*PDupwindNthAnti2At13 + (beta1L*J31L + + beta2L*J32L + beta3L*J33L)*PDupwindNthAnti3At13 + + alphaL*(-2*(At11L*Atm13 + At12L*Atm23 + At13L*Atm33) + At13L*trKL) + + em4phi*(Ats13 - 0.333333333333333333333333333333*g13*trAts - + 25.13274122871834590770114706623602307358*alphaL*(eTxzL - + 0.333333333333333333333333333333*g13*trS)) + (J11L*PDupwindNthSymm1At13 + + J21L*PDupwindNthSymm2At13 + J31L*PDupwindNthSymm3At13)*Abs(beta1L) + + (J12L*PDupwindNthSymm1At13 + J22L*PDupwindNthSymm2At13 + + J32L*PDupwindNthSymm3At13)*Abs(beta2L) + (J13L*PDupwindNthSymm1At13 + + J23L*PDupwindNthSymm2At13 + J33L*PDupwindNthSymm3At13)*Abs(beta3L); + + CCTK_REAL At22rhsL = (epsdiss1*J11L + epsdiss2*J12L + + epsdiss3*J13L)*PDdissipationNth1At22 + (epsdiss1*J21L + epsdiss2*J22L + + epsdiss3*J23L)*PDdissipationNth2At22 + (epsdiss1*J31L + epsdiss2*J32L + + epsdiss3*J33L)*PDdissipationNth3At22 - + 0.666666666666666666666666666667*At22L*(J11L*PDstandardNth1beta1 + + J12L*PDstandardNth1beta2 + J13L*PDstandardNth1beta3 + + J21L*PDstandardNth2beta1 + J22L*PDstandardNth2beta2 + + J23L*PDstandardNth2beta3 + J31L*PDstandardNth3beta1 + + J32L*PDstandardNth3beta2 + J33L*PDstandardNth3beta3) + + 2*(J12L*(At12L*PDstandardNth1beta1 + At22L*PDstandardNth1beta2 + + At23L*PDstandardNth1beta3) + J22L*(At12L*PDstandardNth2beta1 + + At22L*PDstandardNth2beta2 + At23L*PDstandardNth2beta3) + + J32L*(At12L*PDstandardNth3beta1 + At22L*PDstandardNth3beta2 + + At23L*PDstandardNth3beta3)) + (beta1L*J11L + beta2L*J12L + + beta3L*J13L)*PDupwindNthAnti1At22 + (beta1L*J21L + beta2L*J22L + + beta3L*J23L)*PDupwindNthAnti2At22 + (beta1L*J31L + beta2L*J32L + + beta3L*J33L)*PDupwindNthAnti3At22 + alphaL*(-2*(At12L*Atm12 + + At22L*Atm22 + At23L*Atm32) + At22L*trKL) + em4phi*(Ats22 - + 0.333333333333333333333333333333*g22*trAts - + 25.13274122871834590770114706623602307358*alphaL*(eTyyL - + 0.333333333333333333333333333333*g22*trS)) + (J11L*PDupwindNthSymm1At22 + + J21L*PDupwindNthSymm2At22 + J31L*PDupwindNthSymm3At22)*Abs(beta1L) + + (J12L*PDupwindNthSymm1At22 + J22L*PDupwindNthSymm2At22 + + J32L*PDupwindNthSymm3At22)*Abs(beta2L) + (J13L*PDupwindNthSymm1At22 + + J23L*PDupwindNthSymm2At22 + J33L*PDupwindNthSymm3At22)*Abs(beta3L); + + CCTK_REAL At23rhsL = (epsdiss1*J11L + epsdiss2*J12L + + epsdiss3*J13L)*PDdissipationNth1At23 + (epsdiss1*J21L + epsdiss2*J22L + + epsdiss3*J23L)*PDdissipationNth2At23 + (epsdiss1*J31L + epsdiss2*J32L + + epsdiss3*J33L)*PDdissipationNth3At23 + (At13L*J12L + + At12L*J13L)*PDstandardNth1beta1 + (At23L*J12L + + At22L*J13L)*PDstandardNth1beta2 + (At33L*J12L + + At23L*J13L)*PDstandardNth1beta3 + (At13L*J22L + + At12L*J23L)*PDstandardNth2beta1 + (At23L*J22L + + At22L*J23L)*PDstandardNth2beta2 + (At33L*J22L + + At23L*J23L)*PDstandardNth2beta3 + (At13L*J32L + + At12L*J33L)*PDstandardNth3beta1 + (At23L*J32L + + At22L*J33L)*PDstandardNth3beta2 + (At33L*J32L + + At23L*J33L)*PDstandardNth3beta3 - + 0.666666666666666666666666666667*At23L*(J11L*PDstandardNth1beta1 + + J12L*PDstandardNth1beta2 + J13L*PDstandardNth1beta3 + + J21L*PDstandardNth2beta1 + J22L*PDstandardNth2beta2 + + J23L*PDstandardNth2beta3 + J31L*PDstandardNth3beta1 + + J32L*PDstandardNth3beta2 + J33L*PDstandardNth3beta3) + (beta1L*J11L + + beta2L*J12L + beta3L*J13L)*PDupwindNthAnti1At23 + (beta1L*J21L + + beta2L*J22L + beta3L*J23L)*PDupwindNthAnti2At23 + (beta1L*J31L + + beta2L*J32L + beta3L*J33L)*PDupwindNthAnti3At23 + + alphaL*(-2*(At12L*Atm13 + At22L*Atm23 + At23L*Atm33) + At23L*trKL) + + em4phi*(Ats23 - 0.333333333333333333333333333333*g23*trAts - + 25.13274122871834590770114706623602307358*alphaL*(eTyzL - + 0.333333333333333333333333333333*g23*trS)) + (J11L*PDupwindNthSymm1At23 + + J21L*PDupwindNthSymm2At23 + J31L*PDupwindNthSymm3At23)*Abs(beta1L) + + (J12L*PDupwindNthSymm1At23 + J22L*PDupwindNthSymm2At23 + + J32L*PDupwindNthSymm3At23)*Abs(beta2L) + (J13L*PDupwindNthSymm1At23 + + J23L*PDupwindNthSymm2At23 + J33L*PDupwindNthSymm3At23)*Abs(beta3L); + + CCTK_REAL At33rhsL = (epsdiss1*J11L + epsdiss2*J12L + + epsdiss3*J13L)*PDdissipationNth1At33 + (epsdiss1*J21L + epsdiss2*J22L + + epsdiss3*J23L)*PDdissipationNth2At33 + (epsdiss1*J31L + epsdiss2*J32L + + epsdiss3*J33L)*PDdissipationNth3At33 - + 0.666666666666666666666666666667*At33L*(J11L*PDstandardNth1beta1 + + J12L*PDstandardNth1beta2 + J13L*PDstandardNth1beta3 + + J21L*PDstandardNth2beta1 + J22L*PDstandardNth2beta2 + + J23L*PDstandardNth2beta3 + J31L*PDstandardNth3beta1 + + J32L*PDstandardNth3beta2 + J33L*PDstandardNth3beta3) + + 2*(J13L*(At13L*PDstandardNth1beta1 + At23L*PDstandardNth1beta2 + + At33L*PDstandardNth1beta3) + J23L*(At13L*PDstandardNth2beta1 + + At23L*PDstandardNth2beta2 + At33L*PDstandardNth2beta3) + + J33L*(At13L*PDstandardNth3beta1 + At23L*PDstandardNth3beta2 + + At33L*PDstandardNth3beta3)) + (beta1L*J11L + beta2L*J12L + + beta3L*J13L)*PDupwindNthAnti1At33 + (beta1L*J21L + beta2L*J22L + + beta3L*J23L)*PDupwindNthAnti2At33 + (beta1L*J31L + beta2L*J32L + + beta3L*J33L)*PDupwindNthAnti3At33 + alphaL*(-2*(At13L*Atm13 + + At23L*Atm23 + At33L*Atm33) + At33L*trKL) + em4phi*(Ats33 - + 0.333333333333333333333333333333*g33*trAts - + 25.13274122871834590770114706623602307358*alphaL*(eTzzL - + 0.333333333333333333333333333333*g33*trS)) + (J11L*PDupwindNthSymm1At33 + + J21L*PDupwindNthSymm2At33 + J31L*PDupwindNthSymm3At33)*Abs(beta1L) + + (J12L*PDupwindNthSymm1At33 + J22L*PDupwindNthSymm2At33 + + J32L*PDupwindNthSymm3At33)*Abs(beta2L) + (J13L*PDupwindNthSymm1At33 + + J23L*PDupwindNthSymm2At33 + J33L*PDupwindNthSymm3At33)*Abs(beta3L); + + + /* Copy local copies back to grid functions */ + At11rhs[index] = At11rhsL; + At12rhs[index] = At12rhsL; + At13rhs[index] = At13rhsL; + At22rhs[index] = At22rhsL; + At23rhs[index] = At23rhsL; + At33rhs[index] = At33rhsL; + } + LC_ENDLOOP3 (ML_BSSN_MP_RHS2); +} + +extern "C" void ML_BSSN_MP_RHS2(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverInterior(cctkGH, &ML_BSSN_MP_RHS2_Body); +} diff --git a/ML_BSSN_MP/src/ML_BSSN_MP_RHSStaticBoundary.cc b/ML_BSSN_MP/src/ML_BSSN_MP_RHSStaticBoundary.cc new file mode 100644 index 0000000..ee6c773 --- /dev/null +++ b/ML_BSSN_MP/src/ML_BSSN_MP_RHSStaticBoundary.cc @@ -0,0 +1,223 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +extern "C" void ML_BSSN_MP_RHSStaticBoundary_SelectBCs(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT ierr = 0; + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_MP::ML_curvrhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_MP::ML_curvrhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_MP::ML_dtlapserhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_MP::ML_dtlapserhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_MP::ML_dtshiftrhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_MP::ML_dtshiftrhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_MP::ML_Gammarhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_MP::ML_Gammarhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_MP::ML_lapserhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_MP::ML_lapserhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_MP::ML_log_confacrhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_MP::ML_log_confacrhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_MP::ML_metricrhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_MP::ML_metricrhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_MP::ML_shiftrhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_MP::ML_shiftrhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_MP::ML_trace_curvrhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_MP::ML_trace_curvrhs."); + return; +} + +static void ML_BSSN_MP_RHSStaticBoundary_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_BSSN_MP_RHSStaticBoundary_Body"); + } + + if (cctk_iteration % ML_BSSN_MP_RHSStaticBoundary_calc_every != ML_BSSN_MP_RHSStaticBoundary_calc_offset) + { + return; + } + + const char *groups[] = {"ML_BSSN_MP::ML_curvrhs","ML_BSSN_MP::ML_dtlapserhs","ML_BSSN_MP::ML_dtshiftrhs","ML_BSSN_MP::ML_Gammarhs","ML_BSSN_MP::ML_lapserhs","ML_BSSN_MP::ML_log_confacrhs","ML_BSSN_MP::ML_metricrhs","ML_BSSN_MP::ML_shiftrhs","ML_BSSN_MP::ML_trace_curvrhs"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_BSSN_MP_RHSStaticBoundary", 9, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o12dx = 0.0833333333333333333333333333333*INV(dx); + CCTK_REAL const p1o12dy = 0.0833333333333333333333333333333*INV(dy); + CCTK_REAL const p1o12dz = 0.0833333333333333333333333333333*INV(dz); + CCTK_REAL const p1o144dxdy = 0.00694444444444444444444444444444*INV(dx)*INV(dy); + CCTK_REAL const p1o144dxdz = 0.00694444444444444444444444444444*INV(dx)*INV(dz); + CCTK_REAL const p1o144dydz = 0.00694444444444444444444444444444*INV(dy)*INV(dz); + CCTK_REAL const p1o24dx = 0.0416666666666666666666666666667*INV(dx); + CCTK_REAL const p1o24dy = 0.0416666666666666666666666666667*INV(dy); + CCTK_REAL const p1o24dz = 0.0416666666666666666666666666667*INV(dz); + CCTK_REAL const p1o64dx = 0.015625*INV(dx); + CCTK_REAL const p1o64dy = 0.015625*INV(dy); + CCTK_REAL const p1o64dz = 0.015625*INV(dz); + CCTK_REAL const p1odx = INV(dx); + CCTK_REAL const p1ody = INV(dy); + CCTK_REAL const p1odz = INV(dz); + CCTK_REAL const pm1o12dx2 = -0.0833333333333333333333333333333*INV(SQR(dx)); + CCTK_REAL const pm1o12dy2 = -0.0833333333333333333333333333333*INV(SQR(dy)); + CCTK_REAL const pm1o12dz2 = -0.0833333333333333333333333333333*INV(SQR(dz)); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_BSSN_MP_RHSStaticBoundary, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + + /* Include user supplied include files */ + + /* Precompute derivatives */ + + /* Calculate temporaries and grid functions */ + CCTK_REAL phirhsL = 0; + + CCTK_REAL gt11rhsL = 0; + + CCTK_REAL gt12rhsL = 0; + + CCTK_REAL gt13rhsL = 0; + + CCTK_REAL gt22rhsL = 0; + + CCTK_REAL gt23rhsL = 0; + + CCTK_REAL gt33rhsL = 0; + + CCTK_REAL trKrhsL = 0; + + CCTK_REAL At11rhsL = 0; + + CCTK_REAL At12rhsL = 0; + + CCTK_REAL At13rhsL = 0; + + CCTK_REAL At22rhsL = 0; + + CCTK_REAL At23rhsL = 0; + + CCTK_REAL At33rhsL = 0; + + CCTK_REAL Xt1rhsL = 0; + + CCTK_REAL Xt2rhsL = 0; + + CCTK_REAL Xt3rhsL = 0; + + CCTK_REAL alpharhsL = 0; + + CCTK_REAL ArhsL = 0; + + CCTK_REAL beta1rhsL = 0; + + CCTK_REAL beta2rhsL = 0; + + CCTK_REAL beta3rhsL = 0; + + CCTK_REAL B1rhsL = 0; + + CCTK_REAL B2rhsL = 0; + + CCTK_REAL B3rhsL = 0; + + + /* Copy local copies back to grid functions */ + alpharhs[index] = alpharhsL; + Arhs[index] = ArhsL; + At11rhs[index] = At11rhsL; + At12rhs[index] = At12rhsL; + At13rhs[index] = At13rhsL; + At22rhs[index] = At22rhsL; + At23rhs[index] = At23rhsL; + At33rhs[index] = At33rhsL; + B1rhs[index] = B1rhsL; + B2rhs[index] = B2rhsL; + B3rhs[index] = B3rhsL; + beta1rhs[index] = beta1rhsL; + beta2rhs[index] = beta2rhsL; + beta3rhs[index] = beta3rhsL; + gt11rhs[index] = gt11rhsL; + gt12rhs[index] = gt12rhsL; + gt13rhs[index] = gt13rhsL; + gt22rhs[index] = gt22rhsL; + gt23rhs[index] = gt23rhsL; + gt33rhs[index] = gt33rhsL; + phirhs[index] = phirhsL; + trKrhs[index] = trKrhsL; + Xt1rhs[index] = Xt1rhsL; + Xt2rhs[index] = Xt2rhsL; + Xt3rhs[index] = Xt3rhsL; + } + LC_ENDLOOP3 (ML_BSSN_MP_RHSStaticBoundary); +} + +extern "C" void ML_BSSN_MP_RHSStaticBoundary(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverBoundary(cctkGH, &ML_BSSN_MP_RHSStaticBoundary_Body); +} diff --git a/ML_BSSN_MP/src/ML_BSSN_MP_boundary.cc b/ML_BSSN_MP/src/ML_BSSN_MP_boundary.cc new file mode 100644 index 0000000..45c3893 --- /dev/null +++ b/ML_BSSN_MP/src/ML_BSSN_MP_boundary.cc @@ -0,0 +1,223 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +extern "C" void ML_BSSN_MP_boundary_SelectBCs(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT ierr = 0; + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_MP::ML_curv","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_MP::ML_curv."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_MP::ML_dtlapse","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_MP::ML_dtlapse."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_MP::ML_dtshift","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_MP::ML_dtshift."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_MP::ML_Gamma","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_MP::ML_Gamma."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_MP::ML_lapse","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_MP::ML_lapse."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_MP::ML_log_confac","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_MP::ML_log_confac."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_MP::ML_metric","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_MP::ML_metric."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_MP::ML_shift","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_MP::ML_shift."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_MP::ML_trace_curv","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_MP::ML_trace_curv."); + return; +} + +static void ML_BSSN_MP_boundary_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_BSSN_MP_boundary_Body"); + } + + if (cctk_iteration % ML_BSSN_MP_boundary_calc_every != ML_BSSN_MP_boundary_calc_offset) + { + return; + } + + const char *groups[] = {"ML_BSSN_MP::ML_curv","ML_BSSN_MP::ML_dtlapse","ML_BSSN_MP::ML_dtshift","ML_BSSN_MP::ML_Gamma","ML_BSSN_MP::ML_lapse","ML_BSSN_MP::ML_log_confac","ML_BSSN_MP::ML_metric","ML_BSSN_MP::ML_shift","ML_BSSN_MP::ML_trace_curv"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_BSSN_MP_boundary", 9, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o12dx = 0.0833333333333333333333333333333*INV(dx); + CCTK_REAL const p1o12dy = 0.0833333333333333333333333333333*INV(dy); + CCTK_REAL const p1o12dz = 0.0833333333333333333333333333333*INV(dz); + CCTK_REAL const p1o144dxdy = 0.00694444444444444444444444444444*INV(dx)*INV(dy); + CCTK_REAL const p1o144dxdz = 0.00694444444444444444444444444444*INV(dx)*INV(dz); + CCTK_REAL const p1o144dydz = 0.00694444444444444444444444444444*INV(dy)*INV(dz); + CCTK_REAL const p1o24dx = 0.0416666666666666666666666666667*INV(dx); + CCTK_REAL const p1o24dy = 0.0416666666666666666666666666667*INV(dy); + CCTK_REAL const p1o24dz = 0.0416666666666666666666666666667*INV(dz); + CCTK_REAL const p1o64dx = 0.015625*INV(dx); + CCTK_REAL const p1o64dy = 0.015625*INV(dy); + CCTK_REAL const p1o64dz = 0.015625*INV(dz); + CCTK_REAL const p1odx = INV(dx); + CCTK_REAL const p1ody = INV(dy); + CCTK_REAL const p1odz = INV(dz); + CCTK_REAL const pm1o12dx2 = -0.0833333333333333333333333333333*INV(SQR(dx)); + CCTK_REAL const pm1o12dy2 = -0.0833333333333333333333333333333*INV(SQR(dy)); + CCTK_REAL const pm1o12dz2 = -0.0833333333333333333333333333333*INV(SQR(dz)); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_BSSN_MP_boundary, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + + /* Include user supplied include files */ + + /* Precompute derivatives */ + + /* Calculate temporaries and grid functions */ + CCTK_REAL phiL = IfThen(ToReal(conformalMethod),1,0); + + CCTK_REAL gt11L = 1; + + CCTK_REAL gt12L = 0; + + CCTK_REAL gt13L = 0; + + CCTK_REAL gt22L = 1; + + CCTK_REAL gt23L = 0; + + CCTK_REAL gt33L = 1; + + CCTK_REAL trKL = 0; + + CCTK_REAL At11L = 0; + + CCTK_REAL At12L = 0; + + CCTK_REAL At13L = 0; + + CCTK_REAL At22L = 0; + + CCTK_REAL At23L = 0; + + CCTK_REAL At33L = 0; + + CCTK_REAL Xt1L = 0; + + CCTK_REAL Xt2L = 0; + + CCTK_REAL Xt3L = 0; + + CCTK_REAL alphaL = 1; + + CCTK_REAL AL = 0; + + CCTK_REAL beta1L = 0; + + CCTK_REAL beta2L = 0; + + CCTK_REAL beta3L = 0; + + CCTK_REAL B1L = 0; + + CCTK_REAL B2L = 0; + + CCTK_REAL B3L = 0; + + + /* Copy local copies back to grid functions */ + A[index] = AL; + alpha[index] = alphaL; + At11[index] = At11L; + At12[index] = At12L; + At13[index] = At13L; + At22[index] = At22L; + At23[index] = At23L; + At33[index] = At33L; + B1[index] = B1L; + B2[index] = B2L; + B3[index] = B3L; + beta1[index] = beta1L; + beta2[index] = beta2L; + beta3[index] = beta3L; + gt11[index] = gt11L; + gt12[index] = gt12L; + gt13[index] = gt13L; + gt22[index] = gt22L; + gt23[index] = gt23L; + gt33[index] = gt33L; + phi[index] = phiL; + trK[index] = trKL; + Xt1[index] = Xt1L; + Xt2[index] = Xt2L; + Xt3[index] = Xt3L; + } + LC_ENDLOOP3 (ML_BSSN_MP_boundary); +} + +extern "C" void ML_BSSN_MP_boundary(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverBoundaryWithGhosts(cctkGH, &ML_BSSN_MP_boundary_Body); +} diff --git a/ML_BSSN_MP/src/ML_BSSN_MP_constraints1.cc b/ML_BSSN_MP/src/ML_BSSN_MP_constraints1.cc new file mode 100644 index 0000000..869e8cc --- /dev/null +++ b/ML_BSSN_MP/src/ML_BSSN_MP_constraints1.cc @@ -0,0 +1,890 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +extern "C" void ML_BSSN_MP_constraints1_SelectBCs(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT ierr = 0; + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_MP::ML_Ham","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_MP::ML_Ham."); + return; +} + +static void ML_BSSN_MP_constraints1_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_BSSN_MP_constraints1_Body"); + } + + if (cctk_iteration % ML_BSSN_MP_constraints1_calc_every != ML_BSSN_MP_constraints1_calc_offset) + { + return; + } + + const char *groups[] = {"Coordinates::jacobian","Coordinates::jacobian2","ML_BSSN_MP::ML_curv","ML_BSSN_MP::ML_Gamma","ML_BSSN_MP::ML_Ham","ML_BSSN_MP::ML_lapse","ML_BSSN_MP::ML_log_confac","ML_BSSN_MP::ML_metric","ML_BSSN_MP::ML_shift","ML_BSSN_MP::ML_trace_curv"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_BSSN_MP_constraints1", 10, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o12dx = 0.0833333333333333333333333333333*INV(dx); + CCTK_REAL const p1o12dy = 0.0833333333333333333333333333333*INV(dy); + CCTK_REAL const p1o12dz = 0.0833333333333333333333333333333*INV(dz); + CCTK_REAL const p1o144dxdy = 0.00694444444444444444444444444444*INV(dx)*INV(dy); + CCTK_REAL const p1o144dxdz = 0.00694444444444444444444444444444*INV(dx)*INV(dz); + CCTK_REAL const p1o144dydz = 0.00694444444444444444444444444444*INV(dy)*INV(dz); + CCTK_REAL const p1o24dx = 0.0416666666666666666666666666667*INV(dx); + CCTK_REAL const p1o24dy = 0.0416666666666666666666666666667*INV(dy); + CCTK_REAL const p1o24dz = 0.0416666666666666666666666666667*INV(dz); + CCTK_REAL const p1o64dx = 0.015625*INV(dx); + CCTK_REAL const p1o64dy = 0.015625*INV(dy); + CCTK_REAL const p1o64dz = 0.015625*INV(dz); + CCTK_REAL const p1odx = INV(dx); + CCTK_REAL const p1ody = INV(dy); + CCTK_REAL const p1odz = INV(dz); + CCTK_REAL const pm1o12dx2 = -0.0833333333333333333333333333333*INV(SQR(dx)); + CCTK_REAL const pm1o12dy2 = -0.0833333333333333333333333333333*INV(SQR(dy)); + CCTK_REAL const pm1o12dz2 = -0.0833333333333333333333333333333*INV(SQR(dz)); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_BSSN_MP_constraints1, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + CCTK_REAL alphaL = alpha[index]; + CCTK_REAL At11L = At11[index]; + CCTK_REAL At12L = At12[index]; + CCTK_REAL At13L = At13[index]; + CCTK_REAL At22L = At22[index]; + CCTK_REAL At23L = At23[index]; + CCTK_REAL At33L = At33[index]; + CCTK_REAL beta1L = beta1[index]; + CCTK_REAL beta2L = beta2[index]; + CCTK_REAL beta3L = beta3[index]; + CCTK_REAL dJ111L = dJ111[index]; + CCTK_REAL dJ112L = dJ112[index]; + CCTK_REAL dJ113L = dJ113[index]; + CCTK_REAL dJ122L = dJ122[index]; + CCTK_REAL dJ123L = dJ123[index]; + CCTK_REAL dJ133L = dJ133[index]; + CCTK_REAL dJ211L = dJ211[index]; + CCTK_REAL dJ212L = dJ212[index]; + CCTK_REAL dJ213L = dJ213[index]; + CCTK_REAL dJ222L = dJ222[index]; + CCTK_REAL dJ223L = dJ223[index]; + CCTK_REAL dJ233L = dJ233[index]; + CCTK_REAL dJ311L = dJ311[index]; + CCTK_REAL dJ312L = dJ312[index]; + CCTK_REAL dJ313L = dJ313[index]; + CCTK_REAL dJ322L = dJ322[index]; + CCTK_REAL dJ323L = dJ323[index]; + CCTK_REAL dJ333L = dJ333[index]; + CCTK_REAL eTttL = (*stress_energy_state) ? eTtt[index] : ToReal(0.0); + CCTK_REAL eTtxL = (*stress_energy_state) ? eTtx[index] : ToReal(0.0); + CCTK_REAL eTtyL = (*stress_energy_state) ? eTty[index] : ToReal(0.0); + CCTK_REAL eTtzL = (*stress_energy_state) ? eTtz[index] : ToReal(0.0); + CCTK_REAL eTxxL = (*stress_energy_state) ? eTxx[index] : ToReal(0.0); + CCTK_REAL eTxyL = (*stress_energy_state) ? eTxy[index] : ToReal(0.0); + CCTK_REAL eTxzL = (*stress_energy_state) ? eTxz[index] : ToReal(0.0); + CCTK_REAL eTyyL = (*stress_energy_state) ? eTyy[index] : ToReal(0.0); + CCTK_REAL eTyzL = (*stress_energy_state) ? eTyz[index] : ToReal(0.0); + CCTK_REAL eTzzL = (*stress_energy_state) ? eTzz[index] : ToReal(0.0); + CCTK_REAL gt11L = gt11[index]; + CCTK_REAL gt12L = gt12[index]; + CCTK_REAL gt13L = gt13[index]; + CCTK_REAL gt22L = gt22[index]; + CCTK_REAL gt23L = gt23[index]; + CCTK_REAL gt33L = gt33[index]; + CCTK_REAL J11L = J11[index]; + CCTK_REAL J12L = J12[index]; + CCTK_REAL J13L = J13[index]; + CCTK_REAL J21L = J21[index]; + CCTK_REAL J22L = J22[index]; + CCTK_REAL J23L = J23[index]; + CCTK_REAL J31L = J31[index]; + CCTK_REAL J32L = J32[index]; + CCTK_REAL J33L = J33[index]; + CCTK_REAL phiL = phi[index]; + CCTK_REAL trKL = trK[index]; + CCTK_REAL Xt1L = Xt1[index]; + CCTK_REAL Xt2L = Xt2[index]; + CCTK_REAL Xt3L = Xt3[index]; + + /* Include user supplied include files */ + + /* Precompute derivatives */ + CCTK_REAL const PDstandardNth1gt11 = PDstandardNth1(>11[index]); + CCTK_REAL const PDstandardNth2gt11 = PDstandardNth2(>11[index]); + CCTK_REAL const PDstandardNth3gt11 = PDstandardNth3(>11[index]); + CCTK_REAL const PDstandardNth11gt11 = PDstandardNth11(>11[index]); + CCTK_REAL const PDstandardNth22gt11 = PDstandardNth22(>11[index]); + CCTK_REAL const PDstandardNth33gt11 = PDstandardNth33(>11[index]); + CCTK_REAL const PDstandardNth12gt11 = PDstandardNth12(>11[index]); + CCTK_REAL const PDstandardNth13gt11 = PDstandardNth13(>11[index]); + CCTK_REAL const PDstandardNth23gt11 = PDstandardNth23(>11[index]); + CCTK_REAL const PDstandardNth1gt12 = PDstandardNth1(>12[index]); + CCTK_REAL const PDstandardNth2gt12 = PDstandardNth2(>12[index]); + CCTK_REAL const PDstandardNth3gt12 = PDstandardNth3(>12[index]); + CCTK_REAL const PDstandardNth11gt12 = PDstandardNth11(>12[index]); + CCTK_REAL const PDstandardNth22gt12 = PDstandardNth22(>12[index]); + CCTK_REAL const PDstandardNth33gt12 = PDstandardNth33(>12[index]); + CCTK_REAL const PDstandardNth12gt12 = PDstandardNth12(>12[index]); + CCTK_REAL const PDstandardNth13gt12 = PDstandardNth13(>12[index]); + CCTK_REAL const PDstandardNth23gt12 = PDstandardNth23(>12[index]); + CCTK_REAL const PDstandardNth1gt13 = PDstandardNth1(>13[index]); + CCTK_REAL const PDstandardNth2gt13 = PDstandardNth2(>13[index]); + CCTK_REAL const PDstandardNth3gt13 = PDstandardNth3(>13[index]); + CCTK_REAL const PDstandardNth11gt13 = PDstandardNth11(>13[index]); + CCTK_REAL const PDstandardNth22gt13 = PDstandardNth22(>13[index]); + CCTK_REAL const PDstandardNth33gt13 = PDstandardNth33(>13[index]); + CCTK_REAL const PDstandardNth12gt13 = PDstandardNth12(>13[index]); + CCTK_REAL const PDstandardNth13gt13 = PDstandardNth13(>13[index]); + CCTK_REAL const PDstandardNth23gt13 = PDstandardNth23(>13[index]); + CCTK_REAL const PDstandardNth1gt22 = PDstandardNth1(>22[index]); + CCTK_REAL const PDstandardNth2gt22 = PDstandardNth2(>22[index]); + CCTK_REAL const PDstandardNth3gt22 = PDstandardNth3(>22[index]); + CCTK_REAL const PDstandardNth11gt22 = PDstandardNth11(>22[index]); + CCTK_REAL const PDstandardNth22gt22 = PDstandardNth22(>22[index]); + CCTK_REAL const PDstandardNth33gt22 = PDstandardNth33(>22[index]); + CCTK_REAL const PDstandardNth12gt22 = PDstandardNth12(>22[index]); + CCTK_REAL const PDstandardNth13gt22 = PDstandardNth13(>22[index]); + CCTK_REAL const PDstandardNth23gt22 = PDstandardNth23(>22[index]); + CCTK_REAL const PDstandardNth1gt23 = PDstandardNth1(>23[index]); + CCTK_REAL const PDstandardNth2gt23 = PDstandardNth2(>23[index]); + CCTK_REAL const PDstandardNth3gt23 = PDstandardNth3(>23[index]); + CCTK_REAL const PDstandardNth11gt23 = PDstandardNth11(>23[index]); + CCTK_REAL const PDstandardNth22gt23 = PDstandardNth22(>23[index]); + CCTK_REAL const PDstandardNth33gt23 = PDstandardNth33(>23[index]); + CCTK_REAL const PDstandardNth12gt23 = PDstandardNth12(>23[index]); + CCTK_REAL const PDstandardNth13gt23 = PDstandardNth13(>23[index]); + CCTK_REAL const PDstandardNth23gt23 = PDstandardNth23(>23[index]); + CCTK_REAL const PDstandardNth1gt33 = PDstandardNth1(>33[index]); + CCTK_REAL const PDstandardNth2gt33 = PDstandardNth2(>33[index]); + CCTK_REAL const PDstandardNth3gt33 = PDstandardNth3(>33[index]); + CCTK_REAL const PDstandardNth11gt33 = PDstandardNth11(>33[index]); + CCTK_REAL const PDstandardNth22gt33 = PDstandardNth22(>33[index]); + CCTK_REAL const PDstandardNth33gt33 = PDstandardNth33(>33[index]); + CCTK_REAL const PDstandardNth12gt33 = PDstandardNth12(>33[index]); + CCTK_REAL const PDstandardNth13gt33 = PDstandardNth13(>33[index]); + CCTK_REAL const PDstandardNth23gt33 = PDstandardNth23(>33[index]); + CCTK_REAL const PDstandardNth1phi = PDstandardNth1(&phi[index]); + CCTK_REAL const PDstandardNth2phi = PDstandardNth2(&phi[index]); + CCTK_REAL const PDstandardNth3phi = PDstandardNth3(&phi[index]); + CCTK_REAL const PDstandardNth11phi = PDstandardNth11(&phi[index]); + CCTK_REAL const PDstandardNth22phi = PDstandardNth22(&phi[index]); + CCTK_REAL const PDstandardNth33phi = PDstandardNth33(&phi[index]); + CCTK_REAL const PDstandardNth12phi = PDstandardNth12(&phi[index]); + CCTK_REAL const PDstandardNth13phi = PDstandardNth13(&phi[index]); + CCTK_REAL const PDstandardNth23phi = PDstandardNth23(&phi[index]); + CCTK_REAL const PDstandardNth1Xt1 = PDstandardNth1(&Xt1[index]); + CCTK_REAL const PDstandardNth2Xt1 = PDstandardNth2(&Xt1[index]); + CCTK_REAL const PDstandardNth3Xt1 = PDstandardNth3(&Xt1[index]); + CCTK_REAL const PDstandardNth1Xt2 = PDstandardNth1(&Xt2[index]); + CCTK_REAL const PDstandardNth2Xt2 = PDstandardNth2(&Xt2[index]); + CCTK_REAL const PDstandardNth3Xt2 = PDstandardNth3(&Xt2[index]); + CCTK_REAL const PDstandardNth1Xt3 = PDstandardNth1(&Xt3[index]); + CCTK_REAL const PDstandardNth2Xt3 = PDstandardNth2(&Xt3[index]); + CCTK_REAL const PDstandardNth3Xt3 = PDstandardNth3(&Xt3[index]); + + /* Calculate temporaries and grid functions */ + CCTK_REAL detgt = 1; + + CCTK_REAL gtu11 = INV(detgt)*(gt22L*gt33L - SQR(gt23L)); + + CCTK_REAL gtu12 = (gt13L*gt23L - gt12L*gt33L)*INV(detgt); + + CCTK_REAL gtu13 = (-(gt13L*gt22L) + gt12L*gt23L)*INV(detgt); + + CCTK_REAL gtu22 = INV(detgt)*(gt11L*gt33L - SQR(gt13L)); + + CCTK_REAL gtu23 = (gt12L*gt13L - gt11L*gt23L)*INV(detgt); + + CCTK_REAL gtu33 = INV(detgt)*(gt11L*gt22L - SQR(gt12L)); + + CCTK_REAL Gtl111 = 0.5*(J11L*PDstandardNth1gt11 + + J21L*PDstandardNth2gt11 + J31L*PDstandardNth3gt11); + + CCTK_REAL Gtl112 = 0.5*(J12L*PDstandardNth1gt11 + + J22L*PDstandardNth2gt11 + J32L*PDstandardNth3gt11); + + CCTK_REAL Gtl113 = 0.5*(J13L*PDstandardNth1gt11 + + J23L*PDstandardNth2gt11 + J33L*PDstandardNth3gt11); + + CCTK_REAL Gtl122 = J12L*PDstandardNth1gt12 + J22L*PDstandardNth2gt12 + + J32L*PDstandardNth3gt12 - 0.5*(J11L*PDstandardNth1gt22 + + J21L*PDstandardNth2gt22 + J31L*PDstandardNth3gt22); + + CCTK_REAL Gtl123 = 0.5*(J13L*PDstandardNth1gt12 + + J12L*PDstandardNth1gt13 - J11L*PDstandardNth1gt23 + + J23L*PDstandardNth2gt12 + J22L*PDstandardNth2gt13 - + J21L*PDstandardNth2gt23 + J33L*PDstandardNth3gt12 + + J32L*PDstandardNth3gt13 - J31L*PDstandardNth3gt23); + + CCTK_REAL Gtl133 = J13L*PDstandardNth1gt13 + J23L*PDstandardNth2gt13 + + J33L*PDstandardNth3gt13 - 0.5*(J11L*PDstandardNth1gt33 + + J21L*PDstandardNth2gt33 + J31L*PDstandardNth3gt33); + + CCTK_REAL Gtl211 = J11L*PDstandardNth1gt12 + J21L*PDstandardNth2gt12 - + 0.5*(J12L*PDstandardNth1gt11 + J22L*PDstandardNth2gt11 + + J32L*PDstandardNth3gt11) + J31L*PDstandardNth3gt12; + + CCTK_REAL Gtl212 = 0.5*(J11L*PDstandardNth1gt22 + + J21L*PDstandardNth2gt22 + J31L*PDstandardNth3gt22); + + CCTK_REAL Gtl213 = 0.5*(J13L*PDstandardNth1gt12 - + J12L*PDstandardNth1gt13 + J11L*PDstandardNth1gt23 + + J23L*PDstandardNth2gt12 - J22L*PDstandardNth2gt13 + + J21L*PDstandardNth2gt23 + J33L*PDstandardNth3gt12 - + J32L*PDstandardNth3gt13 + J31L*PDstandardNth3gt23); + + CCTK_REAL Gtl222 = 0.5*(J12L*PDstandardNth1gt22 + + J22L*PDstandardNth2gt22 + J32L*PDstandardNth3gt22); + + CCTK_REAL Gtl223 = 0.5*(J13L*PDstandardNth1gt22 + + J23L*PDstandardNth2gt22 + J33L*PDstandardNth3gt22); + + CCTK_REAL Gtl233 = J13L*PDstandardNth1gt23 + J23L*PDstandardNth2gt23 + + J33L*PDstandardNth3gt23 - 0.5*(J12L*PDstandardNth1gt33 + + J22L*PDstandardNth2gt33 + J32L*PDstandardNth3gt33); + + CCTK_REAL Gtl311 = J11L*PDstandardNth1gt13 + J21L*PDstandardNth2gt13 - + 0.5*(J13L*PDstandardNth1gt11 + J23L*PDstandardNth2gt11 + + J33L*PDstandardNth3gt11) + J31L*PDstandardNth3gt13; + + CCTK_REAL Gtl312 = 0.5*(-(J13L*PDstandardNth1gt12) + + J12L*PDstandardNth1gt13 + J11L*PDstandardNth1gt23 - + J23L*PDstandardNth2gt12 + J22L*PDstandardNth2gt13 + + J21L*PDstandardNth2gt23 - J33L*PDstandardNth3gt12 + + J32L*PDstandardNth3gt13 + J31L*PDstandardNth3gt23); + + CCTK_REAL Gtl313 = 0.5*(J11L*PDstandardNth1gt33 + + J21L*PDstandardNth2gt33 + J31L*PDstandardNth3gt33); + + CCTK_REAL Gtl322 = J12L*PDstandardNth1gt23 + J22L*PDstandardNth2gt23 - + 0.5*(J13L*PDstandardNth1gt22 + J23L*PDstandardNth2gt22 + + J33L*PDstandardNth3gt22) + J32L*PDstandardNth3gt23; + + CCTK_REAL Gtl323 = 0.5*(J12L*PDstandardNth1gt33 + + J22L*PDstandardNth2gt33 + J32L*PDstandardNth3gt33); + + CCTK_REAL Gtl333 = 0.5*(J13L*PDstandardNth1gt33 + + J23L*PDstandardNth2gt33 + J33L*PDstandardNth3gt33); + + CCTK_REAL Gtlu111 = Gtl111*gtu11 + Gtl112*gtu12 + Gtl113*gtu13; + + CCTK_REAL Gtlu112 = Gtl111*gtu12 + Gtl112*gtu22 + Gtl113*gtu23; + + CCTK_REAL Gtlu113 = Gtl111*gtu13 + Gtl112*gtu23 + Gtl113*gtu33; + + CCTK_REAL Gtlu121 = Gtl112*gtu11 + Gtl122*gtu12 + Gtl123*gtu13; + + CCTK_REAL Gtlu122 = Gtl112*gtu12 + Gtl122*gtu22 + Gtl123*gtu23; + + CCTK_REAL Gtlu123 = Gtl112*gtu13 + Gtl122*gtu23 + Gtl123*gtu33; + + CCTK_REAL Gtlu131 = Gtl113*gtu11 + Gtl123*gtu12 + Gtl133*gtu13; + + CCTK_REAL Gtlu132 = Gtl113*gtu12 + Gtl123*gtu22 + Gtl133*gtu23; + + CCTK_REAL Gtlu133 = Gtl113*gtu13 + Gtl123*gtu23 + Gtl133*gtu33; + + CCTK_REAL Gtlu211 = Gtl211*gtu11 + Gtl212*gtu12 + Gtl213*gtu13; + + CCTK_REAL Gtlu212 = Gtl211*gtu12 + Gtl212*gtu22 + Gtl213*gtu23; + + CCTK_REAL Gtlu213 = Gtl211*gtu13 + Gtl212*gtu23 + Gtl213*gtu33; + + CCTK_REAL Gtlu221 = Gtl212*gtu11 + Gtl222*gtu12 + Gtl223*gtu13; + + CCTK_REAL Gtlu222 = Gtl212*gtu12 + Gtl222*gtu22 + Gtl223*gtu23; + + CCTK_REAL Gtlu223 = Gtl212*gtu13 + Gtl222*gtu23 + Gtl223*gtu33; + + CCTK_REAL Gtlu231 = Gtl213*gtu11 + Gtl223*gtu12 + Gtl233*gtu13; + + CCTK_REAL Gtlu232 = Gtl213*gtu12 + Gtl223*gtu22 + Gtl233*gtu23; + + CCTK_REAL Gtlu233 = Gtl213*gtu13 + Gtl223*gtu23 + Gtl233*gtu33; + + CCTK_REAL Gtlu311 = Gtl311*gtu11 + Gtl312*gtu12 + Gtl313*gtu13; + + CCTK_REAL Gtlu312 = Gtl311*gtu12 + Gtl312*gtu22 + Gtl313*gtu23; + + CCTK_REAL Gtlu313 = Gtl311*gtu13 + Gtl312*gtu23 + Gtl313*gtu33; + + CCTK_REAL Gtlu321 = Gtl312*gtu11 + Gtl322*gtu12 + Gtl323*gtu13; + + CCTK_REAL Gtlu322 = Gtl312*gtu12 + Gtl322*gtu22 + Gtl323*gtu23; + + CCTK_REAL Gtlu323 = Gtl312*gtu13 + Gtl322*gtu23 + Gtl323*gtu33; + + CCTK_REAL Gtlu331 = Gtl313*gtu11 + Gtl323*gtu12 + Gtl333*gtu13; + + CCTK_REAL Gtlu332 = Gtl313*gtu12 + Gtl323*gtu22 + Gtl333*gtu23; + + CCTK_REAL Gtlu333 = Gtl313*gtu13 + Gtl323*gtu23 + Gtl333*gtu33; + + CCTK_REAL Gt111 = Gtl111*gtu11 + Gtl211*gtu12 + Gtl311*gtu13; + + CCTK_REAL Gt211 = Gtl111*gtu12 + Gtl211*gtu22 + Gtl311*gtu23; + + CCTK_REAL Gt311 = Gtl111*gtu13 + Gtl211*gtu23 + Gtl311*gtu33; + + CCTK_REAL Gt112 = Gtl112*gtu11 + Gtl212*gtu12 + Gtl312*gtu13; + + CCTK_REAL Gt212 = Gtl112*gtu12 + Gtl212*gtu22 + Gtl312*gtu23; + + CCTK_REAL Gt312 = Gtl112*gtu13 + Gtl212*gtu23 + Gtl312*gtu33; + + CCTK_REAL Gt113 = Gtl113*gtu11 + Gtl213*gtu12 + Gtl313*gtu13; + + CCTK_REAL Gt213 = Gtl113*gtu12 + Gtl213*gtu22 + Gtl313*gtu23; + + CCTK_REAL Gt313 = Gtl113*gtu13 + Gtl213*gtu23 + Gtl313*gtu33; + + CCTK_REAL Gt122 = Gtl122*gtu11 + Gtl222*gtu12 + Gtl322*gtu13; + + CCTK_REAL Gt222 = Gtl122*gtu12 + Gtl222*gtu22 + Gtl322*gtu23; + + CCTK_REAL Gt322 = Gtl122*gtu13 + Gtl222*gtu23 + Gtl322*gtu33; + + CCTK_REAL Gt123 = Gtl123*gtu11 + Gtl223*gtu12 + Gtl323*gtu13; + + CCTK_REAL Gt223 = Gtl123*gtu12 + Gtl223*gtu22 + Gtl323*gtu23; + + CCTK_REAL Gt323 = Gtl123*gtu13 + Gtl223*gtu23 + Gtl323*gtu33; + + CCTK_REAL Gt133 = Gtl133*gtu11 + Gtl233*gtu12 + Gtl333*gtu13; + + CCTK_REAL Gt233 = Gtl133*gtu12 + Gtl233*gtu22 + Gtl333*gtu23; + + CCTK_REAL Gt333 = Gtl133*gtu13 + Gtl233*gtu23 + Gtl333*gtu33; + + CCTK_REAL Xtn1 = Gt111*gtu11 + Gt122*gtu22 + 2*(Gt112*gtu12 + + Gt113*gtu13 + Gt123*gtu23) + Gt133*gtu33; + + CCTK_REAL Xtn2 = Gt211*gtu11 + Gt222*gtu22 + 2*(Gt212*gtu12 + + Gt213*gtu13 + Gt223*gtu23) + Gt233*gtu33; + + CCTK_REAL Xtn3 = Gt311*gtu11 + Gt322*gtu22 + 2*(Gt312*gtu12 + + Gt313*gtu13 + Gt323*gtu23) + Gt333*gtu33; + + CCTK_REAL Rt11 = 3*(Gt111*Gtlu111 + Gt112*Gtlu112 + Gt113*Gtlu113) + + 2*(Gt211*Gtlu121 + Gt212*Gtlu122 + Gt213*Gtlu123 + Gt311*Gtlu131 + + Gt312*Gtlu132 + Gt313*Gtlu133) + Gt211*Gtlu211 + Gt212*Gtlu212 + + Gt213*Gtlu213 + Gt311*Gtlu311 + Gt312*Gtlu312 + Gt313*Gtlu313 + + J11L*(gt11L*PDstandardNth1Xt1 + gt12L*PDstandardNth1Xt2 + + gt13L*PDstandardNth1Xt3) + J21L*(gt11L*PDstandardNth2Xt1 + + gt12L*PDstandardNth2Xt2 + gt13L*PDstandardNth2Xt3) + + J31L*(gt11L*PDstandardNth3Xt1 + gt12L*PDstandardNth3Xt2 + + gt13L*PDstandardNth3Xt3) + Gtl111*Xtn1 + Gtl112*Xtn2 + Gtl113*Xtn3 + + 0.5*(-2*(gtu12*(J11L*J12L*PDstandardNth11gt11 + + J12L*J21L*PDstandardNth12gt11 + J11L*J22L*PDstandardNth12gt11 + + J12L*J31L*PDstandardNth13gt11 + J11L*J32L*PDstandardNth13gt11 + + dJ112L*PDstandardNth1gt11 + J21L*J22L*PDstandardNth22gt11 + + J22L*J31L*PDstandardNth23gt11 + J21L*J32L*PDstandardNth23gt11 + + dJ212L*PDstandardNth2gt11 + J31L*J32L*PDstandardNth33gt11 + + dJ312L*PDstandardNth3gt11) + gtu13*(J11L*J13L*PDstandardNth11gt11 + + J13L*J21L*PDstandardNth12gt11 + J11L*J23L*PDstandardNth12gt11 + + J13L*J31L*PDstandardNth13gt11 + J11L*J33L*PDstandardNth13gt11 + + dJ113L*PDstandardNth1gt11 + J21L*J23L*PDstandardNth22gt11 + + J23L*J31L*PDstandardNth23gt11 + J21L*J33L*PDstandardNth23gt11 + + dJ213L*PDstandardNth2gt11 + J31L*J33L*PDstandardNth33gt11 + + dJ313L*PDstandardNth3gt11) + gtu23*(J12L*J13L*PDstandardNth11gt11 + + J13L*J22L*PDstandardNth12gt11 + J12L*J23L*PDstandardNth12gt11 + + J13L*J32L*PDstandardNth13gt11 + J12L*J33L*PDstandardNth13gt11 + + dJ123L*PDstandardNth1gt11 + J22L*J23L*PDstandardNth22gt11 + + J23L*J32L*PDstandardNth23gt11 + J22L*J33L*PDstandardNth23gt11 + + dJ223L*PDstandardNth2gt11 + J32L*J33L*PDstandardNth33gt11 + + dJ323L*PDstandardNth3gt11)) - gtu11*(2*J11L*J21L*PDstandardNth12gt11 + + 2*J11L*J31L*PDstandardNth13gt11 + dJ111L*PDstandardNth1gt11 + + 2*J21L*J31L*PDstandardNth23gt11 + dJ211L*PDstandardNth2gt11 + + dJ311L*PDstandardNth3gt11 + PDstandardNth11gt11*SQR(J11L) + + PDstandardNth22gt11*SQR(J21L) + PDstandardNth33gt11*SQR(J31L)) - + gtu22*(2*J12L*J22L*PDstandardNth12gt11 + + 2*J12L*J32L*PDstandardNth13gt11 + dJ122L*PDstandardNth1gt11 + + 2*J22L*J32L*PDstandardNth23gt11 + dJ222L*PDstandardNth2gt11 + + dJ322L*PDstandardNth3gt11 + PDstandardNth11gt11*SQR(J12L) + + PDstandardNth22gt11*SQR(J22L) + PDstandardNth33gt11*SQR(J32L)) - + gtu33*(2*J13L*J23L*PDstandardNth12gt11 + + 2*J13L*J33L*PDstandardNth13gt11 + dJ133L*PDstandardNth1gt11 + + 2*J23L*J33L*PDstandardNth23gt11 + dJ233L*PDstandardNth2gt11 + + dJ333L*PDstandardNth3gt11 + PDstandardNth11gt11*SQR(J13L) + + PDstandardNth22gt11*SQR(J23L) + PDstandardNth33gt11*SQR(J33L))); + + CCTK_REAL Rt12 = Gt122*Gtlu112 + Gt123*Gtlu113 + (Gt111 + + Gt212)*Gtlu121 + Gt222*Gtlu122 + (Gt113 + Gt223)*Gtlu123 + + Gt322*Gtlu132 + Gt323*Gtlu133 + Gt111*Gtlu211 + Gt112*(Gtlu111 + + Gtlu122 + Gtlu212) + Gt113*Gtlu213 + 2*(Gt211*Gtlu221 + Gt212*Gtlu222 + + Gt213*Gtlu223) + Gt311*(Gtlu231 + Gtlu321) + Gt312*(Gtlu131 + Gtlu232 + + Gtlu322) + Gt313*(Gtlu233 + Gtlu323) + 0.5*((gt12L*J11L + + gt11L*J12L)*PDstandardNth1Xt1 + (gt22L*J11L + + gt12L*J12L)*PDstandardNth1Xt2 + (gt23L*J11L + + gt13L*J12L)*PDstandardNth1Xt3 + (gt12L*J21L + + gt11L*J22L)*PDstandardNth2Xt1 + (gt22L*J21L + + gt12L*J22L)*PDstandardNth2Xt2 + (gt23L*J21L + + gt13L*J22L)*PDstandardNth2Xt3 - 2*(gtu12*(J11L*J12L*PDstandardNth11gt12 + + J12L*J21L*PDstandardNth12gt12 + J11L*J22L*PDstandardNth12gt12 + + J12L*J31L*PDstandardNth13gt12 + J11L*J32L*PDstandardNth13gt12 + + dJ112L*PDstandardNth1gt12 + J21L*J22L*PDstandardNth22gt12 + + J22L*J31L*PDstandardNth23gt12 + J21L*J32L*PDstandardNth23gt12 + + dJ212L*PDstandardNth2gt12 + J31L*J32L*PDstandardNth33gt12 + + dJ312L*PDstandardNth3gt12) + gtu13*(J11L*J13L*PDstandardNth11gt12 + + J13L*J21L*PDstandardNth12gt12 + J11L*J23L*PDstandardNth12gt12 + + J13L*J31L*PDstandardNth13gt12 + J11L*J33L*PDstandardNth13gt12 + + dJ113L*PDstandardNth1gt12 + J21L*J23L*PDstandardNth22gt12 + + J23L*J31L*PDstandardNth23gt12 + J21L*J33L*PDstandardNth23gt12 + + dJ213L*PDstandardNth2gt12 + J31L*J33L*PDstandardNth33gt12 + + dJ313L*PDstandardNth3gt12) + gtu23*(J12L*J13L*PDstandardNth11gt12 + + J13L*J22L*PDstandardNth12gt12 + J12L*J23L*PDstandardNth12gt12 + + J13L*J32L*PDstandardNth13gt12 + J12L*J33L*PDstandardNth13gt12 + + dJ123L*PDstandardNth1gt12 + J22L*J23L*PDstandardNth22gt12 + + J23L*J32L*PDstandardNth23gt12 + J22L*J33L*PDstandardNth23gt12 + + dJ223L*PDstandardNth2gt12 + J32L*J33L*PDstandardNth33gt12 + + dJ323L*PDstandardNth3gt12)) + (gt12L*J31L + + gt11L*J32L)*PDstandardNth3Xt1 + (gt22L*J31L + + gt12L*J32L)*PDstandardNth3Xt2 + (gt23L*J31L + + gt13L*J32L)*PDstandardNth3Xt3 + (Gtl112 + Gtl211)*Xtn1 + (Gtl122 + + Gtl212)*Xtn2 + (Gtl123 + Gtl213)*Xtn3 - + gtu11*(2*J11L*J21L*PDstandardNth12gt12 + + 2*J11L*J31L*PDstandardNth13gt12 + dJ111L*PDstandardNth1gt12 + + 2*J21L*J31L*PDstandardNth23gt12 + dJ211L*PDstandardNth2gt12 + + dJ311L*PDstandardNth3gt12 + PDstandardNth11gt12*SQR(J11L) + + PDstandardNth22gt12*SQR(J21L) + PDstandardNth33gt12*SQR(J31L)) - + gtu22*(2*J12L*J22L*PDstandardNth12gt12 + + 2*J12L*J32L*PDstandardNth13gt12 + dJ122L*PDstandardNth1gt12 + + 2*J22L*J32L*PDstandardNth23gt12 + dJ222L*PDstandardNth2gt12 + + dJ322L*PDstandardNth3gt12 + PDstandardNth11gt12*SQR(J12L) + + PDstandardNth22gt12*SQR(J22L) + PDstandardNth33gt12*SQR(J32L)) - + gtu33*(2*J13L*J23L*PDstandardNth12gt12 + + 2*J13L*J33L*PDstandardNth13gt12 + dJ133L*PDstandardNth1gt12 + + 2*J23L*J33L*PDstandardNth23gt12 + dJ233L*PDstandardNth2gt12 + + dJ333L*PDstandardNth3gt12 + PDstandardNth11gt12*SQR(J13L) + + PDstandardNth22gt12*SQR(J23L) + PDstandardNth33gt12*SQR(J33L))); + + CCTK_REAL Rt13 = Gt123*Gtlu112 + Gt133*Gtlu113 + Gt223*Gtlu122 + + Gt233*Gtlu123 + (Gt111 + Gt313)*Gtlu131 + (Gt112 + Gt323)*Gtlu132 + + Gt333*Gtlu133 + Gt111*Gtlu311 + Gt112*Gtlu312 + Gt113*(Gtlu111 + + Gtlu133 + Gtlu313) + Gt211*(Gtlu231 + Gtlu321) + Gt212*(Gtlu232 + + Gtlu322) + Gt213*(Gtlu121 + Gtlu233 + Gtlu323) + 2*(Gt311*Gtlu331 + + Gt312*Gtlu332 + Gt313*Gtlu333) + 0.5*((gt13L*J11L + + gt11L*J13L)*PDstandardNth1Xt1 + (gt23L*J11L + + gt12L*J13L)*PDstandardNth1Xt2 + (gt33L*J11L + + gt13L*J13L)*PDstandardNth1Xt3 + (gt13L*J21L + + gt11L*J23L)*PDstandardNth2Xt1 + (gt23L*J21L + + gt12L*J23L)*PDstandardNth2Xt2 + (gt33L*J21L + + gt13L*J23L)*PDstandardNth2Xt3 - 2*(gtu12*(J11L*J12L*PDstandardNth11gt13 + + J12L*J21L*PDstandardNth12gt13 + J11L*J22L*PDstandardNth12gt13 + + J12L*J31L*PDstandardNth13gt13 + J11L*J32L*PDstandardNth13gt13 + + dJ112L*PDstandardNth1gt13 + J21L*J22L*PDstandardNth22gt13 + + J22L*J31L*PDstandardNth23gt13 + J21L*J32L*PDstandardNth23gt13 + + dJ212L*PDstandardNth2gt13 + J31L*J32L*PDstandardNth33gt13 + + dJ312L*PDstandardNth3gt13) + gtu13*(J11L*J13L*PDstandardNth11gt13 + + J13L*J21L*PDstandardNth12gt13 + J11L*J23L*PDstandardNth12gt13 + + J13L*J31L*PDstandardNth13gt13 + J11L*J33L*PDstandardNth13gt13 + + dJ113L*PDstandardNth1gt13 + J21L*J23L*PDstandardNth22gt13 + + J23L*J31L*PDstandardNth23gt13 + J21L*J33L*PDstandardNth23gt13 + + dJ213L*PDstandardNth2gt13 + J31L*J33L*PDstandardNth33gt13 + + dJ313L*PDstandardNth3gt13) + gtu23*(J12L*J13L*PDstandardNth11gt13 + + J13L*J22L*PDstandardNth12gt13 + J12L*J23L*PDstandardNth12gt13 + + J13L*J32L*PDstandardNth13gt13 + J12L*J33L*PDstandardNth13gt13 + + dJ123L*PDstandardNth1gt13 + J22L*J23L*PDstandardNth22gt13 + + J23L*J32L*PDstandardNth23gt13 + J22L*J33L*PDstandardNth23gt13 + + dJ223L*PDstandardNth2gt13 + J32L*J33L*PDstandardNth33gt13 + + dJ323L*PDstandardNth3gt13)) + (gt13L*J31L + + gt11L*J33L)*PDstandardNth3Xt1 + (gt23L*J31L + + gt12L*J33L)*PDstandardNth3Xt2 + (gt33L*J31L + + gt13L*J33L)*PDstandardNth3Xt3 + (Gtl113 + Gtl311)*Xtn1 + (Gtl123 + + Gtl312)*Xtn2 + (Gtl133 + Gtl313)*Xtn3 - + gtu11*(2*J11L*J21L*PDstandardNth12gt13 + + 2*J11L*J31L*PDstandardNth13gt13 + dJ111L*PDstandardNth1gt13 + + 2*J21L*J31L*PDstandardNth23gt13 + dJ211L*PDstandardNth2gt13 + + dJ311L*PDstandardNth3gt13 + PDstandardNth11gt13*SQR(J11L) + + PDstandardNth22gt13*SQR(J21L) + PDstandardNth33gt13*SQR(J31L)) - + gtu22*(2*J12L*J22L*PDstandardNth12gt13 + + 2*J12L*J32L*PDstandardNth13gt13 + dJ122L*PDstandardNth1gt13 + + 2*J22L*J32L*PDstandardNth23gt13 + dJ222L*PDstandardNth2gt13 + + dJ322L*PDstandardNth3gt13 + PDstandardNth11gt13*SQR(J12L) + + PDstandardNth22gt13*SQR(J22L) + PDstandardNth33gt13*SQR(J32L)) - + gtu33*(2*J13L*J23L*PDstandardNth12gt13 + + 2*J13L*J33L*PDstandardNth13gt13 + dJ133L*PDstandardNth1gt13 + + 2*J23L*J33L*PDstandardNth23gt13 + dJ233L*PDstandardNth2gt13 + + dJ333L*PDstandardNth3gt13 + PDstandardNth11gt13*SQR(J13L) + + PDstandardNth22gt13*SQR(J23L) + PDstandardNth33gt13*SQR(J33L))); + + CCTK_REAL Rt22 = Gt112*(Gtlu121 + 2*Gtlu211) + Gt122*(Gtlu122 + + 2*Gtlu212) + Gt123*(Gtlu123 + 2*Gtlu213) + 3*(Gt212*Gtlu221 + + Gt222*Gtlu222 + Gt223*Gtlu223) + 2*(Gt312*Gtlu231 + Gt322*Gtlu232 + + Gt323*Gtlu233) + Gt312*Gtlu321 + Gt322*Gtlu322 + Gt323*Gtlu323 + + J12L*(gt12L*PDstandardNth1Xt1 + gt22L*PDstandardNth1Xt2 + + gt23L*PDstandardNth1Xt3) + J22L*(gt12L*PDstandardNth2Xt1 + + gt22L*PDstandardNth2Xt2 + gt23L*PDstandardNth2Xt3) + + J32L*(gt12L*PDstandardNth3Xt1 + gt22L*PDstandardNth3Xt2 + + gt23L*PDstandardNth3Xt3) + Gtl212*Xtn1 + Gtl222*Xtn2 + Gtl223*Xtn3 + + 0.5*(-2*(gtu12*(J11L*J12L*PDstandardNth11gt22 + + J12L*J21L*PDstandardNth12gt22 + J11L*J22L*PDstandardNth12gt22 + + J12L*J31L*PDstandardNth13gt22 + J11L*J32L*PDstandardNth13gt22 + + dJ112L*PDstandardNth1gt22 + J21L*J22L*PDstandardNth22gt22 + + J22L*J31L*PDstandardNth23gt22 + J21L*J32L*PDstandardNth23gt22 + + dJ212L*PDstandardNth2gt22 + J31L*J32L*PDstandardNth33gt22 + + dJ312L*PDstandardNth3gt22) + gtu13*(J11L*J13L*PDstandardNth11gt22 + + J13L*J21L*PDstandardNth12gt22 + J11L*J23L*PDstandardNth12gt22 + + J13L*J31L*PDstandardNth13gt22 + J11L*J33L*PDstandardNth13gt22 + + dJ113L*PDstandardNth1gt22 + J21L*J23L*PDstandardNth22gt22 + + J23L*J31L*PDstandardNth23gt22 + J21L*J33L*PDstandardNth23gt22 + + dJ213L*PDstandardNth2gt22 + J31L*J33L*PDstandardNth33gt22 + + dJ313L*PDstandardNth3gt22) + gtu23*(J12L*J13L*PDstandardNth11gt22 + + J13L*J22L*PDstandardNth12gt22 + J12L*J23L*PDstandardNth12gt22 + + J13L*J32L*PDstandardNth13gt22 + J12L*J33L*PDstandardNth13gt22 + + dJ123L*PDstandardNth1gt22 + J22L*J23L*PDstandardNth22gt22 + + J23L*J32L*PDstandardNth23gt22 + J22L*J33L*PDstandardNth23gt22 + + dJ223L*PDstandardNth2gt22 + J32L*J33L*PDstandardNth33gt22 + + dJ323L*PDstandardNth3gt22)) - gtu11*(2*J11L*J21L*PDstandardNth12gt22 + + 2*J11L*J31L*PDstandardNth13gt22 + dJ111L*PDstandardNth1gt22 + + 2*J21L*J31L*PDstandardNth23gt22 + dJ211L*PDstandardNth2gt22 + + dJ311L*PDstandardNth3gt22 + PDstandardNth11gt22*SQR(J11L) + + PDstandardNth22gt22*SQR(J21L) + PDstandardNth33gt22*SQR(J31L)) - + gtu22*(2*J12L*J22L*PDstandardNth12gt22 + + 2*J12L*J32L*PDstandardNth13gt22 + dJ122L*PDstandardNth1gt22 + + 2*J22L*J32L*PDstandardNth23gt22 + dJ222L*PDstandardNth2gt22 + + dJ322L*PDstandardNth3gt22 + PDstandardNth11gt22*SQR(J12L) + + PDstandardNth22gt22*SQR(J22L) + PDstandardNth33gt22*SQR(J32L)) - + gtu33*(2*J13L*J23L*PDstandardNth12gt22 + + 2*J13L*J33L*PDstandardNth13gt22 + dJ133L*PDstandardNth1gt22 + + 2*J23L*J33L*PDstandardNth23gt22 + dJ233L*PDstandardNth2gt22 + + dJ333L*PDstandardNth3gt22 + PDstandardNth11gt22*SQR(J13L) + + PDstandardNth22gt22*SQR(J23L) + PDstandardNth33gt22*SQR(J33L))); + + CCTK_REAL Rt23 = Gt113*Gtlu211 + Gt133*Gtlu213 + Gt213*Gtlu221 + + Gt233*Gtlu223 + (Gt212 + Gt313)*Gtlu231 + (Gt222 + Gt323)*Gtlu232 + + Gt333*Gtlu233 + Gt112*(Gtlu131 + Gtlu311) + Gt122*(Gtlu132 + Gtlu312) + + Gt123*(Gtlu133 + Gtlu212 + Gtlu313) + Gt212*Gtlu321 + Gt222*Gtlu322 + + Gt223*(Gtlu222 + Gtlu233 + Gtlu323) + 2*(Gt312*Gtlu331 + Gt322*Gtlu332 + + Gt323*Gtlu333) + 0.5*((gt13L*J12L + gt12L*J13L)*PDstandardNth1Xt1 + + (gt23L*J12L + gt22L*J13L)*PDstandardNth1Xt2 + (gt33L*J12L + + gt23L*J13L)*PDstandardNth1Xt3 + (gt13L*J22L + + gt12L*J23L)*PDstandardNth2Xt1 + (gt23L*J22L + + gt22L*J23L)*PDstandardNth2Xt2 + (gt33L*J22L + + gt23L*J23L)*PDstandardNth2Xt3 - 2*(gtu12*(J11L*J12L*PDstandardNth11gt23 + + J12L*J21L*PDstandardNth12gt23 + J11L*J22L*PDstandardNth12gt23 + + J12L*J31L*PDstandardNth13gt23 + J11L*J32L*PDstandardNth13gt23 + + dJ112L*PDstandardNth1gt23 + J21L*J22L*PDstandardNth22gt23 + + J22L*J31L*PDstandardNth23gt23 + J21L*J32L*PDstandardNth23gt23 + + dJ212L*PDstandardNth2gt23 + J31L*J32L*PDstandardNth33gt23 + + dJ312L*PDstandardNth3gt23) + gtu13*(J11L*J13L*PDstandardNth11gt23 + + J13L*J21L*PDstandardNth12gt23 + J11L*J23L*PDstandardNth12gt23 + + J13L*J31L*PDstandardNth13gt23 + J11L*J33L*PDstandardNth13gt23 + + dJ113L*PDstandardNth1gt23 + J21L*J23L*PDstandardNth22gt23 + + J23L*J31L*PDstandardNth23gt23 + J21L*J33L*PDstandardNth23gt23 + + dJ213L*PDstandardNth2gt23 + J31L*J33L*PDstandardNth33gt23 + + dJ313L*PDstandardNth3gt23) + gtu23*(J12L*J13L*PDstandardNth11gt23 + + J13L*J22L*PDstandardNth12gt23 + J12L*J23L*PDstandardNth12gt23 + + J13L*J32L*PDstandardNth13gt23 + J12L*J33L*PDstandardNth13gt23 + + dJ123L*PDstandardNth1gt23 + J22L*J23L*PDstandardNth22gt23 + + J23L*J32L*PDstandardNth23gt23 + J22L*J33L*PDstandardNth23gt23 + + dJ223L*PDstandardNth2gt23 + J32L*J33L*PDstandardNth33gt23 + + dJ323L*PDstandardNth3gt23)) + (gt13L*J32L + + gt12L*J33L)*PDstandardNth3Xt1 + (gt23L*J32L + + gt22L*J33L)*PDstandardNth3Xt2 + (gt33L*J32L + + gt23L*J33L)*PDstandardNth3Xt3 + (Gtl213 + Gtl312)*Xtn1 + (Gtl223 + + Gtl322)*Xtn2 + (Gtl233 + Gtl323)*Xtn3 - + gtu11*(2*J11L*J21L*PDstandardNth12gt23 + + 2*J11L*J31L*PDstandardNth13gt23 + dJ111L*PDstandardNth1gt23 + + 2*J21L*J31L*PDstandardNth23gt23 + dJ211L*PDstandardNth2gt23 + + dJ311L*PDstandardNth3gt23 + PDstandardNth11gt23*SQR(J11L) + + PDstandardNth22gt23*SQR(J21L) + PDstandardNth33gt23*SQR(J31L)) - + gtu22*(2*J12L*J22L*PDstandardNth12gt23 + + 2*J12L*J32L*PDstandardNth13gt23 + dJ122L*PDstandardNth1gt23 + + 2*J22L*J32L*PDstandardNth23gt23 + dJ222L*PDstandardNth2gt23 + + dJ322L*PDstandardNth3gt23 + PDstandardNth11gt23*SQR(J12L) + + PDstandardNth22gt23*SQR(J22L) + PDstandardNth33gt23*SQR(J32L)) - + gtu33*(2*J13L*J23L*PDstandardNth12gt23 + + 2*J13L*J33L*PDstandardNth13gt23 + dJ133L*PDstandardNth1gt23 + + 2*J23L*J33L*PDstandardNth23gt23 + dJ233L*PDstandardNth2gt23 + + dJ333L*PDstandardNth3gt23 + PDstandardNth11gt23*SQR(J13L) + + PDstandardNth22gt23*SQR(J23L) + PDstandardNth33gt23*SQR(J33L))); + + CCTK_REAL Rt33 = Gt113*(Gtlu131 + 2*Gtlu311) + Gt123*(Gtlu132 + + 2*Gtlu312) + Gt133*(Gtlu133 + 2*Gtlu313) + Gt213*(Gtlu231 + 2*Gtlu321) + + Gt223*(Gtlu232 + 2*Gtlu322) + Gt233*(Gtlu233 + 2*Gtlu323) + + 3*(Gt313*Gtlu331 + Gt323*Gtlu332 + Gt333*Gtlu333) + + J13L*(gt13L*PDstandardNth1Xt1 + gt23L*PDstandardNth1Xt2 + + gt33L*PDstandardNth1Xt3) + J23L*(gt13L*PDstandardNth2Xt1 + + gt23L*PDstandardNth2Xt2 + gt33L*PDstandardNth2Xt3) + + J33L*(gt13L*PDstandardNth3Xt1 + gt23L*PDstandardNth3Xt2 + + gt33L*PDstandardNth3Xt3) + Gtl313*Xtn1 + Gtl323*Xtn2 + Gtl333*Xtn3 + + 0.5*(-2*(gtu12*(J11L*J12L*PDstandardNth11gt33 + + J12L*J21L*PDstandardNth12gt33 + J11L*J22L*PDstandardNth12gt33 + + J12L*J31L*PDstandardNth13gt33 + J11L*J32L*PDstandardNth13gt33 + + dJ112L*PDstandardNth1gt33 + J21L*J22L*PDstandardNth22gt33 + + J22L*J31L*PDstandardNth23gt33 + J21L*J32L*PDstandardNth23gt33 + + dJ212L*PDstandardNth2gt33 + J31L*J32L*PDstandardNth33gt33 + + dJ312L*PDstandardNth3gt33) + gtu13*(J11L*J13L*PDstandardNth11gt33 + + J13L*J21L*PDstandardNth12gt33 + J11L*J23L*PDstandardNth12gt33 + + J13L*J31L*PDstandardNth13gt33 + J11L*J33L*PDstandardNth13gt33 + + dJ113L*PDstandardNth1gt33 + J21L*J23L*PDstandardNth22gt33 + + J23L*J31L*PDstandardNth23gt33 + J21L*J33L*PDstandardNth23gt33 + + dJ213L*PDstandardNth2gt33 + J31L*J33L*PDstandardNth33gt33 + + dJ313L*PDstandardNth3gt33) + gtu23*(J12L*J13L*PDstandardNth11gt33 + + J13L*J22L*PDstandardNth12gt33 + J12L*J23L*PDstandardNth12gt33 + + J13L*J32L*PDstandardNth13gt33 + J12L*J33L*PDstandardNth13gt33 + + dJ123L*PDstandardNth1gt33 + J22L*J23L*PDstandardNth22gt33 + + J23L*J32L*PDstandardNth23gt33 + J22L*J33L*PDstandardNth23gt33 + + dJ223L*PDstandardNth2gt33 + J32L*J33L*PDstandardNth33gt33 + + dJ323L*PDstandardNth3gt33)) - gtu11*(2*J11L*J21L*PDstandardNth12gt33 + + 2*J11L*J31L*PDstandardNth13gt33 + dJ111L*PDstandardNth1gt33 + + 2*J21L*J31L*PDstandardNth23gt33 + dJ211L*PDstandardNth2gt33 + + dJ311L*PDstandardNth3gt33 + PDstandardNth11gt33*SQR(J11L) + + PDstandardNth22gt33*SQR(J21L) + PDstandardNth33gt33*SQR(J31L)) - + gtu22*(2*J12L*J22L*PDstandardNth12gt33 + + 2*J12L*J32L*PDstandardNth13gt33 + dJ122L*PDstandardNth1gt33 + + 2*J22L*J32L*PDstandardNth23gt33 + dJ222L*PDstandardNth2gt33 + + dJ322L*PDstandardNth3gt33 + PDstandardNth11gt33*SQR(J12L) + + PDstandardNth22gt33*SQR(J22L) + PDstandardNth33gt33*SQR(J32L)) - + gtu33*(2*J13L*J23L*PDstandardNth12gt33 + + 2*J13L*J33L*PDstandardNth13gt33 + dJ133L*PDstandardNth1gt33 + + 2*J23L*J33L*PDstandardNth23gt33 + dJ233L*PDstandardNth2gt33 + + dJ333L*PDstandardNth3gt33 + PDstandardNth11gt33*SQR(J13L) + + PDstandardNth22gt33*SQR(J23L) + PDstandardNth33gt33*SQR(J33L))); + + CCTK_REAL fac1 = IfThen(ToReal(conformalMethod),-0.5*INV(phiL),1); + + CCTK_REAL cdphi1 = fac1*(J11L*PDstandardNth1phi + + J21L*PDstandardNth2phi + J31L*PDstandardNth3phi); + + CCTK_REAL cdphi2 = fac1*(J12L*PDstandardNth1phi + + J22L*PDstandardNth2phi + J32L*PDstandardNth3phi); + + CCTK_REAL cdphi3 = fac1*(J13L*PDstandardNth1phi + + J23L*PDstandardNth2phi + J33L*PDstandardNth3phi); + + CCTK_REAL fac2 = IfThen(ToReal(conformalMethod),0.5*INV(SQR(phiL)),0); + + CCTK_REAL cdphi211 = fac1*((dJ111L - Gt111*J11L - Gt211*J12L - + Gt311*J13L)*PDstandardNth1phi + 2*(J11L*(J21L*PDstandardNth12phi + + J31L*PDstandardNth13phi) + J21L*J31L*PDstandardNth23phi) + (dJ211L - + Gt111*J21L - Gt211*J22L - Gt311*J23L)*PDstandardNth2phi + (dJ311L - + Gt111*J31L - Gt211*J32L - Gt311*J33L)*PDstandardNth3phi + + PDstandardNth11phi*SQR(J11L) + PDstandardNth22phi*SQR(J21L) + + PDstandardNth33phi*SQR(J31L)) + fac2*SQR(J11L*PDstandardNth1phi + + J21L*PDstandardNth2phi + J31L*PDstandardNth3phi); + + CCTK_REAL cdphi212 = fac2*(J11L*PDstandardNth1phi + + J21L*PDstandardNth2phi + + J31L*PDstandardNth3phi)*(J12L*PDstandardNth1phi + + J22L*PDstandardNth2phi + J32L*PDstandardNth3phi) + + fac1*(J12L*(J11L*PDstandardNth11phi + J21L*PDstandardNth12phi + + J31L*PDstandardNth13phi) + J11L*(J22L*PDstandardNth12phi + + J32L*PDstandardNth13phi) + (dJ112L - Gt112*J11L - Gt212*J12L - + Gt312*J13L)*PDstandardNth1phi + J22L*(J21L*PDstandardNth22phi + + J31L*PDstandardNth23phi) + (dJ212L - Gt112*J21L - Gt212*J22L - + Gt312*J23L)*PDstandardNth2phi + J32L*(J21L*PDstandardNth23phi + + J31L*PDstandardNth33phi) + (dJ312L - Gt112*J31L - Gt212*J32L - + Gt312*J33L)*PDstandardNth3phi); + + CCTK_REAL cdphi213 = fac2*(J11L*PDstandardNth1phi + + J21L*PDstandardNth2phi + + J31L*PDstandardNth3phi)*(J13L*PDstandardNth1phi + + J23L*PDstandardNth2phi + J33L*PDstandardNth3phi) + + fac1*(J13L*(J11L*PDstandardNth11phi + J21L*PDstandardNth12phi + + J31L*PDstandardNth13phi) + J11L*(J23L*PDstandardNth12phi + + J33L*PDstandardNth13phi) + (dJ113L - Gt113*J11L - Gt213*J12L - + Gt313*J13L)*PDstandardNth1phi + J23L*(J21L*PDstandardNth22phi + + J31L*PDstandardNth23phi) + (dJ213L - Gt113*J21L - Gt213*J22L - + Gt313*J23L)*PDstandardNth2phi + J33L*(J21L*PDstandardNth23phi + + J31L*PDstandardNth33phi) + (dJ313L - Gt113*J31L - Gt213*J32L - + Gt313*J33L)*PDstandardNth3phi); + + CCTK_REAL cdphi222 = fac1*((dJ122L - Gt122*J11L - Gt222*J12L - + Gt322*J13L)*PDstandardNth1phi + 2*(J12L*(J22L*PDstandardNth12phi + + J32L*PDstandardNth13phi) + J22L*J32L*PDstandardNth23phi) + (dJ222L - + Gt122*J21L - Gt222*J22L - Gt322*J23L)*PDstandardNth2phi + (dJ322L - + Gt122*J31L - Gt222*J32L - Gt322*J33L)*PDstandardNth3phi + + PDstandardNth11phi*SQR(J12L) + PDstandardNth22phi*SQR(J22L) + + PDstandardNth33phi*SQR(J32L)) + fac2*SQR(J12L*PDstandardNth1phi + + J22L*PDstandardNth2phi + J32L*PDstandardNth3phi); + + CCTK_REAL cdphi223 = fac2*(J12L*PDstandardNth1phi + + J22L*PDstandardNth2phi + + J32L*PDstandardNth3phi)*(J13L*PDstandardNth1phi + + J23L*PDstandardNth2phi + J33L*PDstandardNth3phi) + + fac1*(J13L*(J12L*PDstandardNth11phi + J22L*PDstandardNth12phi + + J32L*PDstandardNth13phi) + J12L*(J23L*PDstandardNth12phi + + J33L*PDstandardNth13phi) + (dJ123L - Gt123*J11L - Gt223*J12L - + Gt323*J13L)*PDstandardNth1phi + J23L*(J22L*PDstandardNth22phi + + J32L*PDstandardNth23phi) + (dJ223L - Gt123*J21L - Gt223*J22L - + Gt323*J23L)*PDstandardNth2phi + J33L*(J22L*PDstandardNth23phi + + J32L*PDstandardNth33phi) + (dJ323L - Gt123*J31L - Gt223*J32L - + Gt323*J33L)*PDstandardNth3phi); + + CCTK_REAL cdphi233 = fac1*((dJ133L - Gt133*J11L - Gt233*J12L - + Gt333*J13L)*PDstandardNth1phi + 2*(J13L*(J23L*PDstandardNth12phi + + J33L*PDstandardNth13phi) + J23L*J33L*PDstandardNth23phi) + (dJ233L - + Gt133*J21L - Gt233*J22L - Gt333*J23L)*PDstandardNth2phi + (dJ333L - + Gt133*J31L - Gt233*J32L - Gt333*J33L)*PDstandardNth3phi + + PDstandardNth11phi*SQR(J13L) + PDstandardNth22phi*SQR(J23L) + + PDstandardNth33phi*SQR(J33L)) + fac2*SQR(J13L*PDstandardNth1phi + + J23L*PDstandardNth2phi + J33L*PDstandardNth3phi); + + CCTK_REAL Rphi11 = -2*(cdphi211 + 2*(-1 + gt11L*gtu11)*SQR(cdphi1) + + gt11L*(cdphi211*gtu11 + 4*(cdphi1*(cdphi2*gtu12 + cdphi3*gtu13) + + cdphi2*cdphi3*gtu23) + cdphi233*gtu33 + gtu22*(cdphi222 + + 2*SQR(cdphi2)) + 2*(cdphi212*gtu12 + cdphi213*gtu13 + cdphi223*gtu23 + + gtu33*SQR(cdphi3)))); + + CCTK_REAL Rphi12 = -2*(cdphi212 + cdphi1*(cdphi2*(-2 + 4*gt12L*gtu12) + + 4*cdphi3*gt12L*gtu13) + gt12L*(cdphi211*gtu11 + 4*cdphi2*cdphi3*gtu23 + + 2*(cdphi212*gtu12 + cdphi213*gtu13 + cdphi223*gtu23 + + gtu11*SQR(cdphi1)) + gtu22*(cdphi222 + 2*SQR(cdphi2)) + gtu33*(cdphi233 + + 2*SQR(cdphi3)))); + + CCTK_REAL Rphi13 = -2*(cdphi213 + cdphi1*(4*cdphi2*gt13L*gtu12 + + cdphi3*(-2 + 4*gt13L*gtu13)) + gt13L*(cdphi211*gtu11 + + 4*cdphi2*cdphi3*gtu23 + 2*(cdphi212*gtu12 + cdphi213*gtu13 + + cdphi223*gtu23 + gtu11*SQR(cdphi1)) + gtu22*(cdphi222 + 2*SQR(cdphi2)) + + gtu33*(cdphi233 + 2*SQR(cdphi3)))); + + CCTK_REAL Rphi22 = -2*(cdphi222 + 2*(-1 + gt22L*gtu22)*SQR(cdphi2) + + gt22L*(cdphi222*gtu22 + 4*(cdphi1*cdphi3*gtu13 + cdphi2*(cdphi1*gtu12 + + cdphi3*gtu23)) + cdphi233*gtu33 + gtu11*(cdphi211 + 2*SQR(cdphi1)) + + 2*(cdphi212*gtu12 + cdphi213*gtu13 + cdphi223*gtu23 + + gtu33*SQR(cdphi3)))); + + CCTK_REAL Rphi23 = -2*(cdphi223 + cdphi2*(4*cdphi1*gt23L*gtu12 + + cdphi3*(-2 + 4*gt23L*gtu23)) + gt23L*(4*cdphi1*cdphi3*gtu13 + + cdphi222*gtu22 + gtu11*(cdphi211 + 2*SQR(cdphi1)) + 2*(cdphi212*gtu12 + + cdphi213*gtu13 + cdphi223*gtu23 + gtu22*SQR(cdphi2)) + gtu33*(cdphi233 + + 2*SQR(cdphi3)))); + + CCTK_REAL Rphi33 = -2*(cdphi233 + gt33L*((4*cdphi1*cdphi2 + + 2*cdphi212)*gtu12 + 4*cdphi3*(cdphi1*gtu13 + cdphi2*gtu23) + + 2*(cdphi213*gtu13 + cdphi223*gtu23) + cdphi233*gtu33 + gtu11*(cdphi211 + + 2*SQR(cdphi1)) + gtu22*(cdphi222 + 2*SQR(cdphi2))) + 2*(-1 + + gt33L*gtu33)*SQR(cdphi3)); + + CCTK_REAL e4phi = + IfThen(ToReal(conformalMethod),INV(SQR(phiL)),exp(4*phiL)); + + CCTK_REAL em4phi = INV(e4phi); + + CCTK_REAL gu11 = em4phi*gtu11; + + CCTK_REAL gu12 = em4phi*gtu12; + + CCTK_REAL gu13 = em4phi*gtu13; + + CCTK_REAL gu22 = em4phi*gtu22; + + CCTK_REAL gu23 = em4phi*gtu23; + + CCTK_REAL gu33 = em4phi*gtu33; + + CCTK_REAL R11 = Rphi11 + Rt11; + + CCTK_REAL R12 = Rphi12 + Rt12; + + CCTK_REAL R13 = Rphi13 + Rt13; + + CCTK_REAL R22 = Rphi22 + Rt22; + + CCTK_REAL R23 = Rphi23 + Rt23; + + CCTK_REAL R33 = Rphi33 + Rt33; + + CCTK_REAL trR = gu11*R11 + gu22*R22 + 2*(gu12*R12 + gu13*R13 + + gu23*R23) + gu33*R33; + + CCTK_REAL Atm11 = At11L*gtu11 + At12L*gtu12 + At13L*gtu13; + + CCTK_REAL Atm21 = At11L*gtu12 + At12L*gtu22 + At13L*gtu23; + + CCTK_REAL Atm31 = At11L*gtu13 + At12L*gtu23 + At13L*gtu33; + + CCTK_REAL Atm12 = At12L*gtu11 + At22L*gtu12 + At23L*gtu13; + + CCTK_REAL Atm22 = At12L*gtu12 + At22L*gtu22 + At23L*gtu23; + + CCTK_REAL Atm32 = At12L*gtu13 + At22L*gtu23 + At23L*gtu33; + + CCTK_REAL Atm13 = At13L*gtu11 + At23L*gtu12 + At33L*gtu13; + + CCTK_REAL Atm23 = At13L*gtu12 + At23L*gtu22 + At33L*gtu23; + + CCTK_REAL Atm33 = At13L*gtu13 + At23L*gtu23 + At33L*gtu33; + + CCTK_REAL rho = INV(SQR(alphaL))*(eTttL - 2*(beta2L*eTtyL + + beta3L*eTtzL) + 2*(beta1L*(-eTtxL + beta2L*eTxyL + beta3L*eTxzL) + + beta2L*beta3L*eTyzL) + eTxxL*SQR(beta1L) + eTyyL*SQR(beta2L) + + eTzzL*SQR(beta3L)); + + CCTK_REAL HL = -2.*(Atm12*Atm21 + Atm13*Atm31 + Atm23*Atm32) - + 50.26548245743669181540229413247204614715*rho + trR - 1.*(SQR(Atm11) + + SQR(Atm22) + SQR(Atm33)) + + 0.6666666666666666666666666666666666666667*SQR(trKL); + + + /* Copy local copies back to grid functions */ + H[index] = HL; + } + LC_ENDLOOP3 (ML_BSSN_MP_constraints1); +} + +extern "C" void ML_BSSN_MP_constraints1(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverInterior(cctkGH, &ML_BSSN_MP_constraints1_Body); +} diff --git a/ML_BSSN_MP/src/ML_BSSN_MP_constraints2.cc b/ML_BSSN_MP/src/ML_BSSN_MP_constraints2.cc new file mode 100644 index 0000000..7b5cbaf --- /dev/null +++ b/ML_BSSN_MP/src/ML_BSSN_MP_constraints2.cc @@ -0,0 +1,470 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +extern "C" void ML_BSSN_MP_constraints2_SelectBCs(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT ierr = 0; + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_MP::ML_cons_detg","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_MP::ML_cons_detg."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_MP::ML_cons_Gamma","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_MP::ML_cons_Gamma."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_MP::ML_cons_traceA","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_MP::ML_cons_traceA."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_MP::ML_mom","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_MP::ML_mom."); + return; +} + +static void ML_BSSN_MP_constraints2_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_BSSN_MP_constraints2_Body"); + } + + if (cctk_iteration % ML_BSSN_MP_constraints2_calc_every != ML_BSSN_MP_constraints2_calc_offset) + { + return; + } + + const char *groups[] = {"Coordinates::jacobian","ML_BSSN_MP::ML_cons_detg","ML_BSSN_MP::ML_cons_Gamma","ML_BSSN_MP::ML_cons_traceA","ML_BSSN_MP::ML_curv","ML_BSSN_MP::ML_Gamma","ML_BSSN_MP::ML_lapse","ML_BSSN_MP::ML_log_confac","ML_BSSN_MP::ML_metric","ML_BSSN_MP::ML_mom","ML_BSSN_MP::ML_shift","ML_BSSN_MP::ML_trace_curv"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_BSSN_MP_constraints2", 12, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o12dx = 0.0833333333333333333333333333333*INV(dx); + CCTK_REAL const p1o12dy = 0.0833333333333333333333333333333*INV(dy); + CCTK_REAL const p1o12dz = 0.0833333333333333333333333333333*INV(dz); + CCTK_REAL const p1o144dxdy = 0.00694444444444444444444444444444*INV(dx)*INV(dy); + CCTK_REAL const p1o144dxdz = 0.00694444444444444444444444444444*INV(dx)*INV(dz); + CCTK_REAL const p1o144dydz = 0.00694444444444444444444444444444*INV(dy)*INV(dz); + CCTK_REAL const p1o24dx = 0.0416666666666666666666666666667*INV(dx); + CCTK_REAL const p1o24dy = 0.0416666666666666666666666666667*INV(dy); + CCTK_REAL const p1o24dz = 0.0416666666666666666666666666667*INV(dz); + CCTK_REAL const p1o64dx = 0.015625*INV(dx); + CCTK_REAL const p1o64dy = 0.015625*INV(dy); + CCTK_REAL const p1o64dz = 0.015625*INV(dz); + CCTK_REAL const p1odx = INV(dx); + CCTK_REAL const p1ody = INV(dy); + CCTK_REAL const p1odz = INV(dz); + CCTK_REAL const pm1o12dx2 = -0.0833333333333333333333333333333*INV(SQR(dx)); + CCTK_REAL const pm1o12dy2 = -0.0833333333333333333333333333333*INV(SQR(dy)); + CCTK_REAL const pm1o12dz2 = -0.0833333333333333333333333333333*INV(SQR(dz)); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_BSSN_MP_constraints2, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + CCTK_REAL alphaL = alpha[index]; + CCTK_REAL At11L = At11[index]; + CCTK_REAL At12L = At12[index]; + CCTK_REAL At13L = At13[index]; + CCTK_REAL At22L = At22[index]; + CCTK_REAL At23L = At23[index]; + CCTK_REAL At33L = At33[index]; + CCTK_REAL beta1L = beta1[index]; + CCTK_REAL beta2L = beta2[index]; + CCTK_REAL beta3L = beta3[index]; + CCTK_REAL eTtxL = (*stress_energy_state) ? eTtx[index] : ToReal(0.0); + CCTK_REAL eTtyL = (*stress_energy_state) ? eTty[index] : ToReal(0.0); + CCTK_REAL eTtzL = (*stress_energy_state) ? eTtz[index] : ToReal(0.0); + CCTK_REAL eTxxL = (*stress_energy_state) ? eTxx[index] : ToReal(0.0); + CCTK_REAL eTxyL = (*stress_energy_state) ? eTxy[index] : ToReal(0.0); + CCTK_REAL eTxzL = (*stress_energy_state) ? eTxz[index] : ToReal(0.0); + CCTK_REAL eTyyL = (*stress_energy_state) ? eTyy[index] : ToReal(0.0); + CCTK_REAL eTyzL = (*stress_energy_state) ? eTyz[index] : ToReal(0.0); + CCTK_REAL eTzzL = (*stress_energy_state) ? eTzz[index] : ToReal(0.0); + CCTK_REAL gt11L = gt11[index]; + CCTK_REAL gt12L = gt12[index]; + CCTK_REAL gt13L = gt13[index]; + CCTK_REAL gt22L = gt22[index]; + CCTK_REAL gt23L = gt23[index]; + CCTK_REAL gt33L = gt33[index]; + CCTK_REAL J11L = J11[index]; + CCTK_REAL J12L = J12[index]; + CCTK_REAL J13L = J13[index]; + CCTK_REAL J21L = J21[index]; + CCTK_REAL J22L = J22[index]; + CCTK_REAL J23L = J23[index]; + CCTK_REAL J31L = J31[index]; + CCTK_REAL J32L = J32[index]; + CCTK_REAL J33L = J33[index]; + CCTK_REAL phiL = phi[index]; + CCTK_REAL trKL = trK[index]; + CCTK_REAL Xt1L = Xt1[index]; + CCTK_REAL Xt2L = Xt2[index]; + CCTK_REAL Xt3L = Xt3[index]; + + /* Include user supplied include files */ + + /* Precompute derivatives */ + CCTK_REAL const PDstandardNth1At11 = PDstandardNth1(&At11[index]); + CCTK_REAL const PDstandardNth2At11 = PDstandardNth2(&At11[index]); + CCTK_REAL const PDstandardNth3At11 = PDstandardNth3(&At11[index]); + CCTK_REAL const PDstandardNth1At12 = PDstandardNth1(&At12[index]); + CCTK_REAL const PDstandardNth2At12 = PDstandardNth2(&At12[index]); + CCTK_REAL const PDstandardNth3At12 = PDstandardNth3(&At12[index]); + CCTK_REAL const PDstandardNth1At13 = PDstandardNth1(&At13[index]); + CCTK_REAL const PDstandardNth2At13 = PDstandardNth2(&At13[index]); + CCTK_REAL const PDstandardNth3At13 = PDstandardNth3(&At13[index]); + CCTK_REAL const PDstandardNth1At22 = PDstandardNth1(&At22[index]); + CCTK_REAL const PDstandardNth2At22 = PDstandardNth2(&At22[index]); + CCTK_REAL const PDstandardNth3At22 = PDstandardNth3(&At22[index]); + CCTK_REAL const PDstandardNth1At23 = PDstandardNth1(&At23[index]); + CCTK_REAL const PDstandardNth2At23 = PDstandardNth2(&At23[index]); + CCTK_REAL const PDstandardNth3At23 = PDstandardNth3(&At23[index]); + CCTK_REAL const PDstandardNth1At33 = PDstandardNth1(&At33[index]); + CCTK_REAL const PDstandardNth2At33 = PDstandardNth2(&At33[index]); + CCTK_REAL const PDstandardNth3At33 = PDstandardNth3(&At33[index]); + CCTK_REAL const PDstandardNth1gt11 = PDstandardNth1(>11[index]); + CCTK_REAL const PDstandardNth2gt11 = PDstandardNth2(>11[index]); + CCTK_REAL const PDstandardNth3gt11 = PDstandardNth3(>11[index]); + CCTK_REAL const PDstandardNth1gt12 = PDstandardNth1(>12[index]); + CCTK_REAL const PDstandardNth2gt12 = PDstandardNth2(>12[index]); + CCTK_REAL const PDstandardNth3gt12 = PDstandardNth3(>12[index]); + CCTK_REAL const PDstandardNth1gt13 = PDstandardNth1(>13[index]); + CCTK_REAL const PDstandardNth2gt13 = PDstandardNth2(>13[index]); + CCTK_REAL const PDstandardNth3gt13 = PDstandardNth3(>13[index]); + CCTK_REAL const PDstandardNth1gt22 = PDstandardNth1(>22[index]); + CCTK_REAL const PDstandardNth2gt22 = PDstandardNth2(>22[index]); + CCTK_REAL const PDstandardNth3gt22 = PDstandardNth3(>22[index]); + CCTK_REAL const PDstandardNth1gt23 = PDstandardNth1(>23[index]); + CCTK_REAL const PDstandardNth2gt23 = PDstandardNth2(>23[index]); + CCTK_REAL const PDstandardNth3gt23 = PDstandardNth3(>23[index]); + CCTK_REAL const PDstandardNth1gt33 = PDstandardNth1(>33[index]); + CCTK_REAL const PDstandardNth2gt33 = PDstandardNth2(>33[index]); + CCTK_REAL const PDstandardNth3gt33 = PDstandardNth3(>33[index]); + CCTK_REAL const PDstandardNth1phi = PDstandardNth1(&phi[index]); + CCTK_REAL const PDstandardNth2phi = PDstandardNth2(&phi[index]); + CCTK_REAL const PDstandardNth3phi = PDstandardNth3(&phi[index]); + CCTK_REAL const PDstandardNth1trK = PDstandardNth1(&trK[index]); + CCTK_REAL const PDstandardNth2trK = PDstandardNth2(&trK[index]); + CCTK_REAL const PDstandardNth3trK = PDstandardNth3(&trK[index]); + + /* Calculate temporaries and grid functions */ + CCTK_REAL detgt = 1; + + CCTK_REAL gtu11 = INV(detgt)*(gt22L*gt33L - SQR(gt23L)); + + CCTK_REAL gtu12 = (gt13L*gt23L - gt12L*gt33L)*INV(detgt); + + CCTK_REAL gtu13 = (-(gt13L*gt22L) + gt12L*gt23L)*INV(detgt); + + CCTK_REAL gtu22 = INV(detgt)*(gt11L*gt33L - SQR(gt13L)); + + CCTK_REAL gtu23 = (gt12L*gt13L - gt11L*gt23L)*INV(detgt); + + CCTK_REAL gtu33 = INV(detgt)*(gt11L*gt22L - SQR(gt12L)); + + CCTK_REAL Gtl111 = 0.5*(J11L*PDstandardNth1gt11 + + J21L*PDstandardNth2gt11 + J31L*PDstandardNth3gt11); + + CCTK_REAL Gtl112 = 0.5*(J12L*PDstandardNth1gt11 + + J22L*PDstandardNth2gt11 + J32L*PDstandardNth3gt11); + + CCTK_REAL Gtl113 = 0.5*(J13L*PDstandardNth1gt11 + + J23L*PDstandardNth2gt11 + J33L*PDstandardNth3gt11); + + CCTK_REAL Gtl122 = J12L*PDstandardNth1gt12 + J22L*PDstandardNth2gt12 + + J32L*PDstandardNth3gt12 - 0.5*(J11L*PDstandardNth1gt22 + + J21L*PDstandardNth2gt22 + J31L*PDstandardNth3gt22); + + CCTK_REAL Gtl123 = 0.5*(J13L*PDstandardNth1gt12 + + J12L*PDstandardNth1gt13 - J11L*PDstandardNth1gt23 + + J23L*PDstandardNth2gt12 + J22L*PDstandardNth2gt13 - + J21L*PDstandardNth2gt23 + J33L*PDstandardNth3gt12 + + J32L*PDstandardNth3gt13 - J31L*PDstandardNth3gt23); + + CCTK_REAL Gtl133 = J13L*PDstandardNth1gt13 + J23L*PDstandardNth2gt13 + + J33L*PDstandardNth3gt13 - 0.5*(J11L*PDstandardNth1gt33 + + J21L*PDstandardNth2gt33 + J31L*PDstandardNth3gt33); + + CCTK_REAL Gtl211 = J11L*PDstandardNth1gt12 + J21L*PDstandardNth2gt12 - + 0.5*(J12L*PDstandardNth1gt11 + J22L*PDstandardNth2gt11 + + J32L*PDstandardNth3gt11) + J31L*PDstandardNth3gt12; + + CCTK_REAL Gtl212 = 0.5*(J11L*PDstandardNth1gt22 + + J21L*PDstandardNth2gt22 + J31L*PDstandardNth3gt22); + + CCTK_REAL Gtl213 = 0.5*(J13L*PDstandardNth1gt12 - + J12L*PDstandardNth1gt13 + J11L*PDstandardNth1gt23 + + J23L*PDstandardNth2gt12 - J22L*PDstandardNth2gt13 + + J21L*PDstandardNth2gt23 + J33L*PDstandardNth3gt12 - + J32L*PDstandardNth3gt13 + J31L*PDstandardNth3gt23); + + CCTK_REAL Gtl222 = 0.5*(J12L*PDstandardNth1gt22 + + J22L*PDstandardNth2gt22 + J32L*PDstandardNth3gt22); + + CCTK_REAL Gtl223 = 0.5*(J13L*PDstandardNth1gt22 + + J23L*PDstandardNth2gt22 + J33L*PDstandardNth3gt22); + + CCTK_REAL Gtl233 = J13L*PDstandardNth1gt23 + J23L*PDstandardNth2gt23 + + J33L*PDstandardNth3gt23 - 0.5*(J12L*PDstandardNth1gt33 + + J22L*PDstandardNth2gt33 + J32L*PDstandardNth3gt33); + + CCTK_REAL Gtl311 = J11L*PDstandardNth1gt13 + J21L*PDstandardNth2gt13 - + 0.5*(J13L*PDstandardNth1gt11 + J23L*PDstandardNth2gt11 + + J33L*PDstandardNth3gt11) + J31L*PDstandardNth3gt13; + + CCTK_REAL Gtl312 = 0.5*(-(J13L*PDstandardNth1gt12) + + J12L*PDstandardNth1gt13 + J11L*PDstandardNth1gt23 - + J23L*PDstandardNth2gt12 + J22L*PDstandardNth2gt13 + + J21L*PDstandardNth2gt23 - J33L*PDstandardNth3gt12 + + J32L*PDstandardNth3gt13 + J31L*PDstandardNth3gt23); + + CCTK_REAL Gtl313 = 0.5*(J11L*PDstandardNth1gt33 + + J21L*PDstandardNth2gt33 + J31L*PDstandardNth3gt33); + + CCTK_REAL Gtl322 = J12L*PDstandardNth1gt23 + J22L*PDstandardNth2gt23 - + 0.5*(J13L*PDstandardNth1gt22 + J23L*PDstandardNth2gt22 + + J33L*PDstandardNth3gt22) + J32L*PDstandardNth3gt23; + + CCTK_REAL Gtl323 = 0.5*(J12L*PDstandardNth1gt33 + + J22L*PDstandardNth2gt33 + J32L*PDstandardNth3gt33); + + CCTK_REAL Gtl333 = 0.5*(J13L*PDstandardNth1gt33 + + J23L*PDstandardNth2gt33 + J33L*PDstandardNth3gt33); + + CCTK_REAL Gt111 = Gtl111*gtu11 + Gtl211*gtu12 + Gtl311*gtu13; + + CCTK_REAL Gt211 = Gtl111*gtu12 + Gtl211*gtu22 + Gtl311*gtu23; + + CCTK_REAL Gt311 = Gtl111*gtu13 + Gtl211*gtu23 + Gtl311*gtu33; + + CCTK_REAL Gt112 = Gtl112*gtu11 + Gtl212*gtu12 + Gtl312*gtu13; + + CCTK_REAL Gt212 = Gtl112*gtu12 + Gtl212*gtu22 + Gtl312*gtu23; + + CCTK_REAL Gt312 = Gtl112*gtu13 + Gtl212*gtu23 + Gtl312*gtu33; + + CCTK_REAL Gt113 = Gtl113*gtu11 + Gtl213*gtu12 + Gtl313*gtu13; + + CCTK_REAL Gt213 = Gtl113*gtu12 + Gtl213*gtu22 + Gtl313*gtu23; + + CCTK_REAL Gt313 = Gtl113*gtu13 + Gtl213*gtu23 + Gtl313*gtu33; + + CCTK_REAL Gt122 = Gtl122*gtu11 + Gtl222*gtu12 + Gtl322*gtu13; + + CCTK_REAL Gt222 = Gtl122*gtu12 + Gtl222*gtu22 + Gtl322*gtu23; + + CCTK_REAL Gt322 = Gtl122*gtu13 + Gtl222*gtu23 + Gtl322*gtu33; + + CCTK_REAL Gt123 = Gtl123*gtu11 + Gtl223*gtu12 + Gtl323*gtu13; + + CCTK_REAL Gt223 = Gtl123*gtu12 + Gtl223*gtu22 + Gtl323*gtu23; + + CCTK_REAL Gt323 = Gtl123*gtu13 + Gtl223*gtu23 + Gtl323*gtu33; + + CCTK_REAL Gt133 = Gtl133*gtu11 + Gtl233*gtu12 + Gtl333*gtu13; + + CCTK_REAL Gt233 = Gtl133*gtu12 + Gtl233*gtu22 + Gtl333*gtu23; + + CCTK_REAL Gt333 = Gtl133*gtu13 + Gtl233*gtu23 + Gtl333*gtu33; + + CCTK_REAL fac1 = IfThen(ToReal(conformalMethod),-0.5*INV(phiL),1); + + CCTK_REAL cdphi1 = fac1*(J11L*PDstandardNth1phi + + J21L*PDstandardNth2phi + J31L*PDstandardNth3phi); + + CCTK_REAL cdphi2 = fac1*(J12L*PDstandardNth1phi + + J22L*PDstandardNth2phi + J32L*PDstandardNth3phi); + + CCTK_REAL cdphi3 = fac1*(J13L*PDstandardNth1phi + + J23L*PDstandardNth2phi + J33L*PDstandardNth3phi); + + CCTK_REAL S1 = (-eTtxL + beta1L*eTxxL + beta2L*eTxyL + + beta3L*eTxzL)*INV(alphaL); + + CCTK_REAL S2 = (-eTtyL + beta1L*eTxyL + beta2L*eTyyL + + beta3L*eTyzL)*INV(alphaL); + + CCTK_REAL S3 = (-eTtzL + beta1L*eTxzL + beta2L*eTyzL + + beta3L*eTzzL)*INV(alphaL); + + CCTK_REAL M1L = (-(At22L*Gt212) + At12L*(-Gt112 - Gt222) - + At23L*Gt312)*gtu22 + (6*At13L*cdphi2 - At23L*Gt212 - At33L*Gt312)*gtu23 + + (6*At12L*cdphi3 - At22L*Gt213 - At23L*Gt313)*gtu23 + At12L*((6*cdphi1 + - Gt111)*gtu12 - 3*Gt213*gtu13 + 6*cdphi2*gtu22 - Gt113*gtu23) - + 2*(At12L*Gt211*gtu11 + At13L*Gt311*gtu11 + At11L*Gt123*gtu23) + + (6*At13L*cdphi3 - At23L*Gt213 - At33L*Gt313)*gtu33 + + At13L*(-2*Gt323*gtu23 - Gt113*gtu33) + At11L*(6*cdphi1*gtu11 - + 2*Gt111*gtu11 + 6*cdphi2*gtu12 + 6*cdphi3*gtu13 - Gt122*gtu22 - + Gt133*gtu33) + At12L*(-2*Gt223*gtu23 - Gt233*gtu33) + At13L*((6*cdphi1 + - Gt111)*gtu13 - Gt322*gtu22 - Gt112*gtu23 - Gt333*gtu33) + (gtu11*J11L + + gtu12*J12L + gtu13*J13L)*PDstandardNth1At11 + + gtu22*J12L*PDstandardNth1At12 + gtu23*J13L*PDstandardNth1At12 + + gtu12*(-3*At11L*Gt112 - At22L*Gt211 - 3*At12L*Gt212 - At23L*Gt311 - + 3*At13L*Gt312 + J11L*PDstandardNth1At12) + + gtu23*J12L*PDstandardNth1At13 + gtu33*J13L*PDstandardNth1At13 + + gtu13*(-3*At11L*Gt113 - At23L*Gt211 - At33L*Gt311 - 3*At13L*Gt313 + + J11L*PDstandardNth1At13) - + 0.666666666666666666666666666667*J11L*PDstandardNth1trK + (gtu11*J21L + + gtu12*J22L + gtu13*J23L)*PDstandardNth2At11 + + gtu12*J21L*PDstandardNth2At12 + gtu22*J22L*PDstandardNth2At12 + + gtu23*J23L*PDstandardNth2At12 + gtu13*J21L*PDstandardNth2At13 + + gtu23*J22L*PDstandardNth2At13 + gtu33*J23L*PDstandardNth2At13 - + 0.666666666666666666666666666667*J21L*PDstandardNth2trK + + gtu11*J31L*PDstandardNth3At11 + gtu12*J32L*PDstandardNth3At11 + + gtu13*J33L*PDstandardNth3At11 + gtu12*J31L*PDstandardNth3At12 + + gtu22*J32L*PDstandardNth3At12 + gtu23*J33L*PDstandardNth3At12 + + gtu13*J31L*PDstandardNth3At13 + gtu23*J32L*PDstandardNth3At13 + + gtu33*J33L*PDstandardNth3At13 - + 0.666666666666666666666666666667*J31L*PDstandardNth3trK - + 25.13274122871834590770114706623602307358*S1; + + CCTK_REAL M2L = (-(At11L*Gt112) - At22L*Gt211 - At12L*Gt212 - + At23L*Gt311 - At13L*Gt312)*gtu11 + (6*At22L*cdphi1 - At11L*Gt122)*gtu12 + + (6*At12L*cdphi2 - At13L*Gt322)*gtu12 + (6*At23L*cdphi1 - + At11L*Gt123)*gtu13 + (6*At12L*cdphi3 - At13L*Gt323)*gtu13 + + Gt112*(-3*At12L*gtu12 - At13L*gtu13) + Gt212*(-3*At22L*gtu12 - + At23L*gtu13) + Gt312*(-3*At23L*gtu12 - At33L*gtu13) + At12L*((6*cdphi1 + - Gt111)*gtu11 - Gt222*gtu12 - Gt223*gtu13) + 6*At22L*cdphi2*gtu22 - + 2*At22L*Gt222*gtu22 + 6*At22L*cdphi3*gtu23 - 3*At22L*Gt223*gtu23 + + Gt122*(-2*At12L*gtu22 - At13L*gtu23) + Gt322*(-2*At23L*gtu22 - + At33L*gtu23) + 6*At23L*cdphi3*gtu33 + Gt123*(-3*At12L*gtu23 - + At13L*gtu33) + Gt323*(-3*At23L*gtu23 - At33L*gtu33) + + At12L*(-2*Gt113*gtu13 - Gt133*gtu33) + At23L*(6*cdphi2*gtu23 - + Gt223*gtu33) + At22L*(-2*Gt213*gtu13 - Gt233*gtu33) + + At23L*(-2*Gt313*gtu13 - Gt222*gtu23 - Gt333*gtu33) + (gtu11*J11L + + gtu12*J12L + gtu13*J13L)*PDstandardNth1At12 + + gtu12*J11L*PDstandardNth1At22 + gtu22*J12L*PDstandardNth1At22 + + gtu23*J13L*PDstandardNth1At22 + gtu13*J11L*PDstandardNth1At23 + + gtu23*J12L*PDstandardNth1At23 + gtu33*J13L*PDstandardNth1At23 - + 0.666666666666666666666666666667*J12L*PDstandardNth1trK + (gtu11*J21L + + gtu12*J22L + gtu13*J23L)*PDstandardNth2At12 + + gtu12*J21L*PDstandardNth2At22 + gtu22*J22L*PDstandardNth2At22 + + gtu23*J23L*PDstandardNth2At22 + gtu13*J21L*PDstandardNth2At23 + + gtu23*J22L*PDstandardNth2At23 + gtu33*J23L*PDstandardNth2At23 - + 0.666666666666666666666666666667*J22L*PDstandardNth2trK + + gtu11*J31L*PDstandardNth3At12 + gtu12*J32L*PDstandardNth3At12 + + gtu13*J33L*PDstandardNth3At12 + gtu12*J31L*PDstandardNth3At22 + + gtu22*J32L*PDstandardNth3At22 + gtu23*J33L*PDstandardNth3At22 + + gtu13*J31L*PDstandardNth3At23 + gtu23*J32L*PDstandardNth3At23 + + gtu33*J33L*PDstandardNth3At23 - + 0.666666666666666666666666666667*J32L*PDstandardNth3trK - + 25.13274122871834590770114706623602307358*S2; + + CCTK_REAL M3L = (-(At11L*Gt113) - At23L*Gt211 - At12L*Gt213 - + At33L*Gt311 - At13L*Gt313)*gtu11 + (-2*At13L*Gt112 - At22L*Gt213)*gtu12 + + (6*At23L*cdphi1 + At12L*(-Gt113 - Gt223))*gtu12 + (6*At13L*cdphi2 - + At11L*Gt123 - At23L*Gt313)*gtu12 + (6*At33L*cdphi1 - At11L*Gt133)*gtu13 + + (6*At13L*cdphi3 - At12L*Gt233)*gtu13 - 3*At33L*Gt313*gtu13 + + At13L*((6*cdphi1 - Gt111)*gtu11 - Gt323*gtu12 - Gt333*gtu13) + + (6*At23L*cdphi2 - At12L*Gt123 - At22L*Gt223)*gtu22 + + At13L*(-3*Gt113*gtu13 - Gt122*gtu22) + At33L*(-2*Gt312*gtu12 - + Gt322*gtu22) + At23L*(-3*Gt213*gtu13 - Gt323*gtu22) - + 3*At13L*Gt123*gtu23 + (6*At33L*cdphi2 - At12L*Gt133)*gtu23 - + 3*At23L*Gt223*gtu23 + (6*At23L*cdphi3 - At22L*Gt233)*gtu23 - + 3*At33L*Gt323*gtu23 + At23L*(-2*Gt212*gtu12 - Gt222*gtu22 - + Gt333*gtu23) + 6*At33L*cdphi3*gtu33 - 2*At13L*Gt133*gtu33 - + 2*At23L*Gt233*gtu33 - 2*At33L*Gt333*gtu33 + (gtu11*J11L + gtu12*J12L + + gtu13*J13L)*PDstandardNth1At13 + gtu12*J11L*PDstandardNth1At23 + + gtu22*J12L*PDstandardNth1At23 + gtu23*J13L*PDstandardNth1At23 + + gtu13*J11L*PDstandardNth1At33 + gtu23*J12L*PDstandardNth1At33 + + gtu33*J13L*PDstandardNth1At33 - + 0.666666666666666666666666666667*J13L*PDstandardNth1trK + (gtu11*J21L + + gtu12*J22L + gtu13*J23L)*PDstandardNth2At13 + + gtu12*J21L*PDstandardNth2At23 + gtu22*J22L*PDstandardNth2At23 + + gtu23*J23L*PDstandardNth2At23 + gtu13*J21L*PDstandardNth2At33 + + gtu23*J22L*PDstandardNth2At33 + gtu33*J23L*PDstandardNth2At33 - + 0.666666666666666666666666666667*J23L*PDstandardNth2trK + + gtu11*J31L*PDstandardNth3At13 + gtu12*J32L*PDstandardNth3At13 + + gtu13*J33L*PDstandardNth3At13 + gtu12*J31L*PDstandardNth3At23 + + gtu22*J32L*PDstandardNth3At23 + gtu23*J33L*PDstandardNth3At23 + + gtu13*J31L*PDstandardNth3At33 + gtu23*J32L*PDstandardNth3At33 + + gtu33*J33L*PDstandardNth3At33 - + 0.666666666666666666666666666667*J33L*PDstandardNth3trK - + 25.13274122871834590770114706623602307358*S3; + + CCTK_REAL cSL = Log(detgt); + + CCTK_REAL cXt1L = Gt111*gtu11 + Gt122*gtu22 + 2*(Gt112*gtu12 + + Gt113*gtu13 + Gt123*gtu23) + Gt133*gtu33 - Xt1L; + + CCTK_REAL cXt2L = Gt211*gtu11 + Gt222*gtu22 + 2*(Gt212*gtu12 + + Gt213*gtu13 + Gt223*gtu23) + Gt233*gtu33 - Xt2L; + + CCTK_REAL cXt3L = Gt311*gtu11 + Gt322*gtu22 + 2*(Gt312*gtu12 + + Gt313*gtu13 + Gt323*gtu23) + Gt333*gtu33 - Xt3L; + + CCTK_REAL cAL = At11L*gtu11 + At22L*gtu22 + 2*(At12L*gtu12 + + At13L*gtu13 + At23L*gtu23) + At33L*gtu33; + + + /* Copy local copies back to grid functions */ + cA[index] = cAL; + cS[index] = cSL; + cXt1[index] = cXt1L; + cXt2[index] = cXt2L; + cXt3[index] = cXt3L; + M1[index] = M1L; + M2[index] = M2L; + M3[index] = M3L; + } + LC_ENDLOOP3 (ML_BSSN_MP_constraints2); +} + +extern "C" void ML_BSSN_MP_constraints2(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverInterior(cctkGH, &ML_BSSN_MP_constraints2_Body); +} diff --git a/ML_BSSN_MP/src/ML_BSSN_MP_convertFromADMBase.cc b/ML_BSSN_MP/src/ML_BSSN_MP_convertFromADMBase.cc new file mode 100644 index 0000000..2c1016d --- /dev/null +++ b/ML_BSSN_MP/src/ML_BSSN_MP_convertFromADMBase.cc @@ -0,0 +1,222 @@ +/* File produced by Kranc */ + +#define KRANC_C + +#include <assert.h> +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include "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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +static void ML_BSSN_MP_convertFromADMBase_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_BSSN_MP_convertFromADMBase_Body"); + } + + if (cctk_iteration % ML_BSSN_MP_convertFromADMBase_calc_every != ML_BSSN_MP_convertFromADMBase_calc_offset) + { + return; + } + + const char *groups[] = {"ADMBase::curv","ADMBase::lapse","ADMBase::metric","ADMBase::shift","ML_BSSN_MP::ML_curv","ML_BSSN_MP::ML_lapse","ML_BSSN_MP::ML_log_confac","ML_BSSN_MP::ML_metric","ML_BSSN_MP::ML_shift","ML_BSSN_MP::ML_trace_curv"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_BSSN_MP_convertFromADMBase", 10, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o12dx = 0.0833333333333333333333333333333*INV(dx); + CCTK_REAL const p1o12dy = 0.0833333333333333333333333333333*INV(dy); + CCTK_REAL const p1o12dz = 0.0833333333333333333333333333333*INV(dz); + CCTK_REAL const p1o144dxdy = 0.00694444444444444444444444444444*INV(dx)*INV(dy); + CCTK_REAL const p1o144dxdz = 0.00694444444444444444444444444444*INV(dx)*INV(dz); + CCTK_REAL const p1o144dydz = 0.00694444444444444444444444444444*INV(dy)*INV(dz); + CCTK_REAL const p1o24dx = 0.0416666666666666666666666666667*INV(dx); + CCTK_REAL const p1o24dy = 0.0416666666666666666666666666667*INV(dy); + CCTK_REAL const p1o24dz = 0.0416666666666666666666666666667*INV(dz); + CCTK_REAL const p1o64dx = 0.015625*INV(dx); + CCTK_REAL const p1o64dy = 0.015625*INV(dy); + CCTK_REAL const p1o64dz = 0.015625*INV(dz); + CCTK_REAL const p1odx = INV(dx); + CCTK_REAL const p1ody = INV(dy); + CCTK_REAL const p1odz = INV(dz); + CCTK_REAL const pm1o12dx2 = -0.0833333333333333333333333333333*INV(SQR(dx)); + CCTK_REAL const pm1o12dy2 = -0.0833333333333333333333333333333*INV(SQR(dy)); + CCTK_REAL const pm1o12dz2 = -0.0833333333333333333333333333333*INV(SQR(dz)); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_BSSN_MP_convertFromADMBase, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + CCTK_REAL alpL = alp[index]; + CCTK_REAL betaxL = betax[index]; + CCTK_REAL betayL = betay[index]; + CCTK_REAL betazL = betaz[index]; + CCTK_REAL gxxL = gxx[index]; + CCTK_REAL gxyL = gxy[index]; + CCTK_REAL gxzL = gxz[index]; + CCTK_REAL gyyL = gyy[index]; + CCTK_REAL gyzL = gyz[index]; + CCTK_REAL gzzL = gzz[index]; + CCTK_REAL kxxL = kxx[index]; + CCTK_REAL kxyL = kxy[index]; + CCTK_REAL kxzL = kxz[index]; + CCTK_REAL kyyL = kyy[index]; + CCTK_REAL kyzL = kyz[index]; + CCTK_REAL kzzL = kzz[index]; + CCTK_REAL phiL = phi[index]; + CCTK_REAL trKL = trK[index]; + + /* Include user supplied include files */ + + /* Precompute derivatives */ + + /* Calculate temporaries and grid functions */ + CCTK_REAL g11 = gxxL; + + CCTK_REAL g12 = gxyL; + + CCTK_REAL g13 = gxzL; + + CCTK_REAL g22 = gyyL; + + CCTK_REAL g23 = gyzL; + + CCTK_REAL g33 = gzzL; + + CCTK_REAL detg = 2*g12*g13*g23 + g33*(g11*g22 - SQR(g12)) - + g22*SQR(g13) - g11*SQR(g23); + + CCTK_REAL gu11 = INV(detg)*(g22*g33 - SQR(g23)); + + CCTK_REAL gu12 = (g13*g23 - g12*g33)*INV(detg); + + CCTK_REAL gu13 = (-(g13*g22) + g12*g23)*INV(detg); + + CCTK_REAL gu22 = INV(detg)*(g11*g33 - SQR(g13)); + + CCTK_REAL gu23 = (g12*g13 - g11*g23)*INV(detg); + + CCTK_REAL gu33 = INV(detg)*(g11*g22 - SQR(g12)); + + phiL = + IfThen(ToReal(conformalMethod),pow(detg,-0.166666666666666666666666666667),0.0833333333333333333333333333333*Log(detg)); + + CCTK_REAL em4phi = + IfThen(ToReal(conformalMethod),SQR(phiL),exp(-4*phiL)); + + CCTK_REAL gt11L = em4phi*g11; + + CCTK_REAL gt12L = em4phi*g12; + + CCTK_REAL gt13L = em4phi*g13; + + CCTK_REAL gt22L = em4phi*g22; + + CCTK_REAL gt23L = em4phi*g23; + + CCTK_REAL gt33L = em4phi*g33; + + trKL = gu11*kxxL + gu22*kyyL + 2*(gu12*kxyL + gu13*kxzL + gu23*kyzL) + + gu33*kzzL; + + CCTK_REAL At11L = em4phi*(kxxL - + 0.333333333333333333333333333333*g11*trKL); + + CCTK_REAL At12L = em4phi*(kxyL - + 0.333333333333333333333333333333*g12*trKL); + + CCTK_REAL At13L = em4phi*(kxzL - + 0.333333333333333333333333333333*g13*trKL); + + CCTK_REAL At22L = em4phi*(kyyL - + 0.333333333333333333333333333333*g22*trKL); + + CCTK_REAL At23L = em4phi*(kyzL - + 0.333333333333333333333333333333*g23*trKL); + + CCTK_REAL At33L = em4phi*(kzzL - + 0.333333333333333333333333333333*g33*trKL); + + CCTK_REAL alphaL = alpL; + + CCTK_REAL beta1L = betaxL; + + CCTK_REAL beta2L = betayL; + + CCTK_REAL beta3L = betazL; + + + /* Copy local copies back to grid functions */ + alpha[index] = alphaL; + At11[index] = At11L; + At12[index] = At12L; + At13[index] = At13L; + At22[index] = At22L; + At23[index] = At23L; + At33[index] = At33L; + beta1[index] = beta1L; + beta2[index] = beta2L; + beta3[index] = beta3L; + gt11[index] = gt11L; + gt12[index] = gt12L; + gt13[index] = gt13L; + gt22[index] = gt22L; + gt23[index] = gt23L; + gt33[index] = gt33L; + phi[index] = phiL; + trK[index] = trKL; + } + LC_ENDLOOP3 (ML_BSSN_MP_convertFromADMBase); +} + +extern "C" void ML_BSSN_MP_convertFromADMBase(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverEverything(cctkGH, &ML_BSSN_MP_convertFromADMBase_Body); +} diff --git a/ML_BSSN_MP/src/ML_BSSN_MP_convertFromADMBaseGamma.cc b/ML_BSSN_MP/src/ML_BSSN_MP_convertFromADMBaseGamma.cc new file mode 100644 index 0000000..2d6d4d4 --- /dev/null +++ b/ML_BSSN_MP/src/ML_BSSN_MP_convertFromADMBaseGamma.cc @@ -0,0 +1,438 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +extern "C" void ML_BSSN_MP_convertFromADMBaseGamma_SelectBCs(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT ierr = 0; + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_MP::ML_dtlapse","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_MP::ML_dtlapse."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_MP::ML_dtshift","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_MP::ML_dtshift."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_MP::ML_Gamma","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_MP::ML_Gamma."); + return; +} + +static void ML_BSSN_MP_convertFromADMBaseGamma_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_BSSN_MP_convertFromADMBaseGamma_Body"); + } + + if (cctk_iteration % ML_BSSN_MP_convertFromADMBaseGamma_calc_every != ML_BSSN_MP_convertFromADMBaseGamma_calc_offset) + { + return; + } + + const char *groups[] = {"ADMBase::dtlapse","ADMBase::dtshift","Coordinates::jacobian","grid::coordinates","Grid::coordinates","ML_BSSN_MP::ML_dtlapse","ML_BSSN_MP::ML_dtshift","ML_BSSN_MP::ML_Gamma","ML_BSSN_MP::ML_lapse","ML_BSSN_MP::ML_metric","ML_BSSN_MP::ML_shift"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_BSSN_MP_convertFromADMBaseGamma", 11, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o12dx = 0.0833333333333333333333333333333*INV(dx); + CCTK_REAL const p1o12dy = 0.0833333333333333333333333333333*INV(dy); + CCTK_REAL const p1o12dz = 0.0833333333333333333333333333333*INV(dz); + CCTK_REAL const p1o144dxdy = 0.00694444444444444444444444444444*INV(dx)*INV(dy); + CCTK_REAL const p1o144dxdz = 0.00694444444444444444444444444444*INV(dx)*INV(dz); + CCTK_REAL const p1o144dydz = 0.00694444444444444444444444444444*INV(dy)*INV(dz); + CCTK_REAL const p1o24dx = 0.0416666666666666666666666666667*INV(dx); + CCTK_REAL const p1o24dy = 0.0416666666666666666666666666667*INV(dy); + CCTK_REAL const p1o24dz = 0.0416666666666666666666666666667*INV(dz); + CCTK_REAL const p1o64dx = 0.015625*INV(dx); + CCTK_REAL const p1o64dy = 0.015625*INV(dy); + CCTK_REAL const p1o64dz = 0.015625*INV(dz); + CCTK_REAL const p1odx = INV(dx); + CCTK_REAL const p1ody = INV(dy); + CCTK_REAL const p1odz = INV(dz); + CCTK_REAL const pm1o12dx2 = -0.0833333333333333333333333333333*INV(SQR(dx)); + CCTK_REAL const pm1o12dy2 = -0.0833333333333333333333333333333*INV(SQR(dy)); + CCTK_REAL const pm1o12dz2 = -0.0833333333333333333333333333333*INV(SQR(dz)); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_BSSN_MP_convertFromADMBaseGamma, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + CCTK_REAL alphaL = alpha[index]; + CCTK_REAL beta1L = beta1[index]; + CCTK_REAL beta2L = beta2[index]; + CCTK_REAL beta3L = beta3[index]; + CCTK_REAL dtalpL = dtalp[index]; + CCTK_REAL dtbetaxL = dtbetax[index]; + CCTK_REAL dtbetayL = dtbetay[index]; + CCTK_REAL dtbetazL = dtbetaz[index]; + CCTK_REAL gt11L = gt11[index]; + CCTK_REAL gt12L = gt12[index]; + CCTK_REAL gt13L = gt13[index]; + CCTK_REAL gt22L = gt22[index]; + CCTK_REAL gt23L = gt23[index]; + CCTK_REAL gt33L = gt33[index]; + CCTK_REAL J11L = J11[index]; + CCTK_REAL J12L = J12[index]; + CCTK_REAL J13L = J13[index]; + CCTK_REAL J21L = J21[index]; + CCTK_REAL J22L = J22[index]; + CCTK_REAL J23L = J23[index]; + CCTK_REAL J31L = J31[index]; + CCTK_REAL J32L = J32[index]; + CCTK_REAL J33L = J33[index]; + CCTK_REAL rL = r[index]; + + /* Include user supplied include files */ + + /* Precompute derivatives */ + CCTK_REAL const PDupwindNthAnti1alpha = PDupwindNthAnti1(&alpha[index]); + CCTK_REAL const PDupwindNthSymm1alpha = PDupwindNthSymm1(&alpha[index]); + CCTK_REAL const PDupwindNthAnti2alpha = PDupwindNthAnti2(&alpha[index]); + CCTK_REAL const PDupwindNthSymm2alpha = PDupwindNthSymm2(&alpha[index]); + CCTK_REAL const PDupwindNthAnti3alpha = PDupwindNthAnti3(&alpha[index]); + CCTK_REAL const PDupwindNthSymm3alpha = PDupwindNthSymm3(&alpha[index]); + CCTK_REAL const PDupwindNthAnti1beta1 = PDupwindNthAnti1(&beta1[index]); + CCTK_REAL const PDupwindNthSymm1beta1 = PDupwindNthSymm1(&beta1[index]); + CCTK_REAL const PDupwindNthAnti2beta1 = PDupwindNthAnti2(&beta1[index]); + CCTK_REAL const PDupwindNthSymm2beta1 = PDupwindNthSymm2(&beta1[index]); + CCTK_REAL const PDupwindNthAnti3beta1 = PDupwindNthAnti3(&beta1[index]); + CCTK_REAL const PDupwindNthSymm3beta1 = PDupwindNthSymm3(&beta1[index]); + CCTK_REAL const PDupwindNthAnti1beta2 = PDupwindNthAnti1(&beta2[index]); + CCTK_REAL const PDupwindNthSymm1beta2 = PDupwindNthSymm1(&beta2[index]); + CCTK_REAL const PDupwindNthAnti2beta2 = PDupwindNthAnti2(&beta2[index]); + CCTK_REAL const PDupwindNthSymm2beta2 = PDupwindNthSymm2(&beta2[index]); + CCTK_REAL const PDupwindNthAnti3beta2 = PDupwindNthAnti3(&beta2[index]); + CCTK_REAL const PDupwindNthSymm3beta2 = PDupwindNthSymm3(&beta2[index]); + CCTK_REAL const PDupwindNthAnti1beta3 = PDupwindNthAnti1(&beta3[index]); + CCTK_REAL const PDupwindNthSymm1beta3 = PDupwindNthSymm1(&beta3[index]); + CCTK_REAL const PDupwindNthAnti2beta3 = PDupwindNthAnti2(&beta3[index]); + CCTK_REAL const PDupwindNthSymm2beta3 = PDupwindNthSymm2(&beta3[index]); + CCTK_REAL const PDupwindNthAnti3beta3 = PDupwindNthAnti3(&beta3[index]); + CCTK_REAL const PDupwindNthSymm3beta3 = PDupwindNthSymm3(&beta3[index]); + CCTK_REAL const PDstandardNth1gt11 = PDstandardNth1(>11[index]); + CCTK_REAL const PDstandardNth2gt11 = PDstandardNth2(>11[index]); + CCTK_REAL const PDstandardNth3gt11 = PDstandardNth3(>11[index]); + CCTK_REAL const PDstandardNth1gt12 = PDstandardNth1(>12[index]); + CCTK_REAL const PDstandardNth2gt12 = PDstandardNth2(>12[index]); + CCTK_REAL const PDstandardNth3gt12 = PDstandardNth3(>12[index]); + CCTK_REAL const PDstandardNth1gt13 = PDstandardNth1(>13[index]); + CCTK_REAL const PDstandardNth2gt13 = PDstandardNth2(>13[index]); + CCTK_REAL const PDstandardNth3gt13 = PDstandardNth3(>13[index]); + CCTK_REAL const PDstandardNth1gt22 = PDstandardNth1(>22[index]); + CCTK_REAL const PDstandardNth2gt22 = PDstandardNth2(>22[index]); + CCTK_REAL const PDstandardNth3gt22 = PDstandardNth3(>22[index]); + CCTK_REAL const PDstandardNth1gt23 = PDstandardNth1(>23[index]); + CCTK_REAL const PDstandardNth2gt23 = PDstandardNth2(>23[index]); + CCTK_REAL const PDstandardNth3gt23 = PDstandardNth3(>23[index]); + CCTK_REAL const PDstandardNth1gt33 = PDstandardNth1(>33[index]); + CCTK_REAL const PDstandardNth2gt33 = PDstandardNth2(>33[index]); + CCTK_REAL const PDstandardNth3gt33 = PDstandardNth3(>33[index]); + + /* Calculate temporaries and grid functions */ + ptrdiff_t dir1 = Sign(beta1L); + + ptrdiff_t dir2 = Sign(beta2L); + + ptrdiff_t dir3 = Sign(beta3L); + + CCTK_REAL detgt = 1; + + CCTK_REAL gtu11 = INV(detgt)*(gt22L*gt33L - SQR(gt23L)); + + CCTK_REAL gtu12 = (gt13L*gt23L - gt12L*gt33L)*INV(detgt); + + CCTK_REAL gtu13 = (-(gt13L*gt22L) + gt12L*gt23L)*INV(detgt); + + CCTK_REAL gtu22 = INV(detgt)*(gt11L*gt33L - SQR(gt13L)); + + CCTK_REAL gtu23 = (gt12L*gt13L - gt11L*gt23L)*INV(detgt); + + CCTK_REAL gtu33 = INV(detgt)*(gt11L*gt22L - SQR(gt12L)); + + CCTK_REAL Gt111 = 0.5*((gtu11*J11L - gtu12*J12L - + gtu13*J13L)*PDstandardNth1gt11 + (gtu11*J21L - gtu12*J22L - + gtu13*J23L)*PDstandardNth2gt11 + (gtu11*J31L - gtu12*J32L - + gtu13*J33L)*PDstandardNth3gt11 + 2*(J11L*(gtu12*PDstandardNth1gt12 + + gtu13*PDstandardNth1gt13) + J21L*(gtu12*PDstandardNth2gt12 + + gtu13*PDstandardNth2gt13) + J31L*(gtu12*PDstandardNth3gt12 + + gtu13*PDstandardNth3gt13))); + + CCTK_REAL Gt211 = 0.5*((gtu12*J11L - gtu22*J12L - + gtu23*J13L)*PDstandardNth1gt11 + (gtu12*J21L - gtu22*J22L - + gtu23*J23L)*PDstandardNth2gt11 + (gtu12*J31L - gtu22*J32L - + gtu23*J33L)*PDstandardNth3gt11 + 2*(J11L*(gtu22*PDstandardNth1gt12 + + gtu23*PDstandardNth1gt13) + J21L*(gtu22*PDstandardNth2gt12 + + gtu23*PDstandardNth2gt13) + J31L*(gtu22*PDstandardNth3gt12 + + gtu23*PDstandardNth3gt13))); + + CCTK_REAL Gt311 = 0.5*((gtu13*J11L - gtu23*J12L - + gtu33*J13L)*PDstandardNth1gt11 + (gtu13*J21L - gtu23*J22L - + gtu33*J23L)*PDstandardNth2gt11 + (gtu13*J31L - gtu23*J32L - + gtu33*J33L)*PDstandardNth3gt11 + 2*(J11L*(gtu23*PDstandardNth1gt12 + + gtu33*PDstandardNth1gt13) + J21L*(gtu23*PDstandardNth2gt12 + + gtu33*PDstandardNth2gt13) + J31L*(gtu23*PDstandardNth3gt12 + + gtu33*PDstandardNth3gt13))); + + CCTK_REAL Gt112 = 0.5*(gtu11*(J12L*PDstandardNth1gt11 + + J22L*PDstandardNth2gt11 + J32L*PDstandardNth3gt11) + + gtu12*(J11L*PDstandardNth1gt22 + J21L*PDstandardNth2gt22 + + J31L*PDstandardNth3gt22) + gtu13*(-(J13L*PDstandardNth1gt12) + + J12L*PDstandardNth1gt13 + J11L*PDstandardNth1gt23 - + J23L*PDstandardNth2gt12 + J22L*PDstandardNth2gt13 + + J21L*PDstandardNth2gt23 - J33L*PDstandardNth3gt12 + + J32L*PDstandardNth3gt13 + J31L*PDstandardNth3gt23)); + + CCTK_REAL Gt212 = 0.5*(gtu12*(J12L*PDstandardNth1gt11 + + J22L*PDstandardNth2gt11 + J32L*PDstandardNth3gt11) + + gtu22*(J11L*PDstandardNth1gt22 + J21L*PDstandardNth2gt22 + + J31L*PDstandardNth3gt22) + gtu23*(-(J13L*PDstandardNth1gt12) + + J12L*PDstandardNth1gt13 + J11L*PDstandardNth1gt23 - + J23L*PDstandardNth2gt12 + J22L*PDstandardNth2gt13 + + J21L*PDstandardNth2gt23 - J33L*PDstandardNth3gt12 + + J32L*PDstandardNth3gt13 + J31L*PDstandardNth3gt23)); + + CCTK_REAL Gt312 = 0.5*(gtu13*(J12L*PDstandardNth1gt11 + + J22L*PDstandardNth2gt11 + J32L*PDstandardNth3gt11) + + gtu23*(J11L*PDstandardNth1gt22 + J21L*PDstandardNth2gt22 + + J31L*PDstandardNth3gt22) + gtu33*(-(J13L*PDstandardNth1gt12) + + J12L*PDstandardNth1gt13 + J11L*PDstandardNth1gt23 - + J23L*PDstandardNth2gt12 + J22L*PDstandardNth2gt13 + + J21L*PDstandardNth2gt23 - J33L*PDstandardNth3gt12 + + J32L*PDstandardNth3gt13 + J31L*PDstandardNth3gt23)); + + CCTK_REAL Gt113 = 0.5*(gtu11*(J13L*PDstandardNth1gt11 + + J23L*PDstandardNth2gt11 + J33L*PDstandardNth3gt11) + + gtu12*(J13L*PDstandardNth1gt12 - J12L*PDstandardNth1gt13 + + J11L*PDstandardNth1gt23 + J23L*PDstandardNth2gt12 - + J22L*PDstandardNth2gt13 + J21L*PDstandardNth2gt23 + + J33L*PDstandardNth3gt12 - J32L*PDstandardNth3gt13 + + J31L*PDstandardNth3gt23) + gtu13*(J11L*PDstandardNth1gt33 + + J21L*PDstandardNth2gt33 + J31L*PDstandardNth3gt33)); + + CCTK_REAL Gt213 = 0.5*(gtu12*(J13L*PDstandardNth1gt11 + + J23L*PDstandardNth2gt11 + J33L*PDstandardNth3gt11) + + gtu22*(J13L*PDstandardNth1gt12 - J12L*PDstandardNth1gt13 + + J11L*PDstandardNth1gt23 + J23L*PDstandardNth2gt12 - + J22L*PDstandardNth2gt13 + J21L*PDstandardNth2gt23 + + J33L*PDstandardNth3gt12 - J32L*PDstandardNth3gt13 + + J31L*PDstandardNth3gt23) + gtu23*(J11L*PDstandardNth1gt33 + + J21L*PDstandardNth2gt33 + J31L*PDstandardNth3gt33)); + + CCTK_REAL Gt313 = 0.5*(gtu13*(J13L*PDstandardNth1gt11 + + J23L*PDstandardNth2gt11 + J33L*PDstandardNth3gt11) + + gtu23*(J13L*PDstandardNth1gt12 - J12L*PDstandardNth1gt13 + + J11L*PDstandardNth1gt23 + J23L*PDstandardNth2gt12 - + J22L*PDstandardNth2gt13 + J21L*PDstandardNth2gt23 + + J33L*PDstandardNth3gt12 - J32L*PDstandardNth3gt13 + + J31L*PDstandardNth3gt23) + gtu33*(J11L*PDstandardNth1gt33 + + J21L*PDstandardNth2gt33 + J31L*PDstandardNth3gt33)); + + CCTK_REAL Gt122 = 0.5*(gtu11*(-(J11L*PDstandardNth1gt22) + + 2*(J12L*PDstandardNth1gt12 + J22L*PDstandardNth2gt12) - + J21L*PDstandardNth2gt22 + 2*J32L*PDstandardNth3gt12 - + J31L*PDstandardNth3gt22) + gtu12*(J12L*PDstandardNth1gt22 + + J22L*PDstandardNth2gt22 + J32L*PDstandardNth3gt22) - + gtu13*(J13L*PDstandardNth1gt22 + J23L*PDstandardNth2gt22 + + J33L*PDstandardNth3gt22 - 2*(J12L*PDstandardNth1gt23 + + J22L*PDstandardNth2gt23 + J32L*PDstandardNth3gt23))); + + CCTK_REAL Gt222 = 0.5*(gtu12*(-(J11L*PDstandardNth1gt22) + + 2*(J12L*PDstandardNth1gt12 + J22L*PDstandardNth2gt12) - + J21L*PDstandardNth2gt22 + 2*J32L*PDstandardNth3gt12 - + J31L*PDstandardNth3gt22) + gtu22*(J12L*PDstandardNth1gt22 + + J22L*PDstandardNth2gt22 + J32L*PDstandardNth3gt22) - + gtu23*(J13L*PDstandardNth1gt22 + J23L*PDstandardNth2gt22 + + J33L*PDstandardNth3gt22 - 2*(J12L*PDstandardNth1gt23 + + J22L*PDstandardNth2gt23 + J32L*PDstandardNth3gt23))); + + CCTK_REAL Gt322 = 0.5*(gtu13*(-(J11L*PDstandardNth1gt22) + + 2*(J12L*PDstandardNth1gt12 + J22L*PDstandardNth2gt12) - + J21L*PDstandardNth2gt22 + 2*J32L*PDstandardNth3gt12 - + J31L*PDstandardNth3gt22) + gtu23*(J12L*PDstandardNth1gt22 + + J22L*PDstandardNth2gt22 + J32L*PDstandardNth3gt22) - + gtu33*(J13L*PDstandardNth1gt22 + J23L*PDstandardNth2gt22 + + J33L*PDstandardNth3gt22 - 2*(J12L*PDstandardNth1gt23 + + J22L*PDstandardNth2gt23 + J32L*PDstandardNth3gt23))); + + CCTK_REAL Gt123 = 0.5*(gtu12*(J13L*PDstandardNth1gt22 + + J23L*PDstandardNth2gt22 + J33L*PDstandardNth3gt22) + + gtu11*(J13L*PDstandardNth1gt12 + J12L*PDstandardNth1gt13 - + J11L*PDstandardNth1gt23 + J23L*PDstandardNth2gt12 + + J22L*PDstandardNth2gt13 - J21L*PDstandardNth2gt23 + + J33L*PDstandardNth3gt12 + J32L*PDstandardNth3gt13 - + J31L*PDstandardNth3gt23) + gtu13*(J12L*PDstandardNth1gt33 + + J22L*PDstandardNth2gt33 + J32L*PDstandardNth3gt33)); + + CCTK_REAL Gt223 = 0.5*(gtu22*(J13L*PDstandardNth1gt22 + + J23L*PDstandardNth2gt22 + J33L*PDstandardNth3gt22) + + gtu12*(J13L*PDstandardNth1gt12 + J12L*PDstandardNth1gt13 - + J11L*PDstandardNth1gt23 + J23L*PDstandardNth2gt12 + + J22L*PDstandardNth2gt13 - J21L*PDstandardNth2gt23 + + J33L*PDstandardNth3gt12 + J32L*PDstandardNth3gt13 - + J31L*PDstandardNth3gt23) + gtu23*(J12L*PDstandardNth1gt33 + + J22L*PDstandardNth2gt33 + J32L*PDstandardNth3gt33)); + + CCTK_REAL Gt323 = 0.5*(gtu23*(J13L*PDstandardNth1gt22 + + J23L*PDstandardNth2gt22 + J33L*PDstandardNth3gt22) + + gtu13*(J13L*PDstandardNth1gt12 + J12L*PDstandardNth1gt13 - + J11L*PDstandardNth1gt23 + J23L*PDstandardNth2gt12 + + J22L*PDstandardNth2gt13 - J21L*PDstandardNth2gt23 + + J33L*PDstandardNth3gt12 + J32L*PDstandardNth3gt13 - + J31L*PDstandardNth3gt23) + gtu33*(J12L*PDstandardNth1gt33 + + J22L*PDstandardNth2gt33 + J32L*PDstandardNth3gt33)); + + CCTK_REAL Gt133 = 0.5*(gtu11*(-(J11L*PDstandardNth1gt33) + + 2*(J13L*PDstandardNth1gt13 + J23L*PDstandardNth2gt13) - + J21L*PDstandardNth2gt33 + 2*J33L*PDstandardNth3gt13 - + J31L*PDstandardNth3gt33) + gtu12*(-(J12L*PDstandardNth1gt33) + + 2*(J13L*PDstandardNth1gt23 + J23L*PDstandardNth2gt23) - + J22L*PDstandardNth2gt33 + 2*J33L*PDstandardNth3gt23 - + J32L*PDstandardNth3gt33) + gtu13*(J13L*PDstandardNth1gt33 + + J23L*PDstandardNth2gt33 + J33L*PDstandardNth3gt33)); + + CCTK_REAL Gt233 = 0.5*(gtu12*(-(J11L*PDstandardNth1gt33) + + 2*(J13L*PDstandardNth1gt13 + J23L*PDstandardNth2gt13) - + J21L*PDstandardNth2gt33 + 2*J33L*PDstandardNth3gt13 - + J31L*PDstandardNth3gt33) + gtu22*(-(J12L*PDstandardNth1gt33) + + 2*(J13L*PDstandardNth1gt23 + J23L*PDstandardNth2gt23) - + J22L*PDstandardNth2gt33 + 2*J33L*PDstandardNth3gt23 - + J32L*PDstandardNth3gt33) + gtu23*(J13L*PDstandardNth1gt33 + + J23L*PDstandardNth2gt33 + J33L*PDstandardNth3gt33)); + + CCTK_REAL Gt333 = 0.5*(gtu13*(-(J11L*PDstandardNth1gt33) + + 2*(J13L*PDstandardNth1gt13 + J23L*PDstandardNth2gt13) - + J21L*PDstandardNth2gt33 + 2*J33L*PDstandardNth3gt13 - + J31L*PDstandardNth3gt33) + gtu23*(-(J12L*PDstandardNth1gt33) + + 2*(J13L*PDstandardNth1gt23 + J23L*PDstandardNth2gt23) - + J22L*PDstandardNth2gt33 + 2*J33L*PDstandardNth3gt23 - + J32L*PDstandardNth3gt33) + gtu33*(J13L*PDstandardNth1gt33 + + J23L*PDstandardNth2gt33 + J33L*PDstandardNth3gt33)); + + CCTK_REAL Xt1L = Gt111*gtu11 + Gt122*gtu22 + 2*(Gt112*gtu12 + + Gt113*gtu13 + Gt123*gtu23) + Gt133*gtu33; + + CCTK_REAL Xt2L = Gt211*gtu11 + Gt222*gtu22 + 2*(Gt212*gtu12 + + Gt213*gtu13 + Gt223*gtu23) + Gt233*gtu33; + + CCTK_REAL Xt3L = Gt311*gtu11 + Gt322*gtu22 + 2*(Gt312*gtu12 + + Gt313*gtu13 + Gt323*gtu23) + Gt333*gtu33; + + CCTK_REAL AL = IfThen(ToReal(LapseACoeff) != + 0,3*INV(ToReal(harmonicF))*pow(alphaL,-ToReal(harmonicN))*(-9*dtalpL + + ((beta1L*J11L + beta2L*J12L + beta3L*J13L)*PDupwindNthAnti1alpha + + (beta1L*J21L + beta2L*J22L + beta3L*J23L)*PDupwindNthAnti2alpha + + (beta1L*J31L + beta2L*J32L + beta3L*J33L)*PDupwindNthAnti3alpha + + (J11L*PDupwindNthSymm1alpha + J21L*PDupwindNthSymm2alpha + + J31L*PDupwindNthSymm3alpha)*Abs(beta1L) + (J12L*PDupwindNthSymm1alpha + + J22L*PDupwindNthSymm2alpha + J32L*PDupwindNthSymm3alpha)*Abs(beta2L) + + (J13L*PDupwindNthSymm1alpha + J23L*PDupwindNthSymm2alpha + + J33L*PDupwindNthSymm3alpha)*Abs(beta3L))*ToReal(LapseAdvectionCoeff)),0); + + CCTK_REAL theta = fmin(1,exp(1 - + rL*INV(ToReal(SpatialShiftGammaCoeffRadius)))); + + CCTK_REAL B1L = IfThen(ToReal(ShiftBCoeff)*ToReal(ShiftGammaCoeff) != + 0,INV(theta)*INV(ToReal(ShiftGammaCoeff))*(27*dtbetaxL - + 3*((beta1L*J11L + beta2L*J12L + beta3L*J13L)*PDupwindNthAnti1beta1 + + (beta1L*J21L + beta2L*J22L + beta3L*J23L)*PDupwindNthAnti2beta1 + + (beta1L*J31L + beta2L*J32L + beta3L*J33L)*PDupwindNthAnti3beta1 + + (J11L*PDupwindNthSymm1beta1 + J21L*PDupwindNthSymm2beta1 + + J31L*PDupwindNthSymm3beta1)*Abs(beta1L) + (J12L*PDupwindNthSymm1beta1 + + J22L*PDupwindNthSymm2beta1 + J32L*PDupwindNthSymm3beta1)*Abs(beta2L) + + (J13L*PDupwindNthSymm1beta1 + J23L*PDupwindNthSymm2beta1 + + J33L*PDupwindNthSymm3beta1)*Abs(beta3L))*ToReal(ShiftAdvectionCoeff)),0); + + CCTK_REAL B2L = IfThen(ToReal(ShiftBCoeff)*ToReal(ShiftGammaCoeff) != + 0,INV(theta)*INV(ToReal(ShiftGammaCoeff))*(27*dtbetayL - + 3*((beta1L*J11L + beta2L*J12L + beta3L*J13L)*PDupwindNthAnti1beta2 + + (beta1L*J21L + beta2L*J22L + beta3L*J23L)*PDupwindNthAnti2beta2 + + (beta1L*J31L + beta2L*J32L + beta3L*J33L)*PDupwindNthAnti3beta2 + + (J11L*PDupwindNthSymm1beta2 + J21L*PDupwindNthSymm2beta2 + + J31L*PDupwindNthSymm3beta2)*Abs(beta1L) + (J12L*PDupwindNthSymm1beta2 + + J22L*PDupwindNthSymm2beta2 + J32L*PDupwindNthSymm3beta2)*Abs(beta2L) + + (J13L*PDupwindNthSymm1beta2 + J23L*PDupwindNthSymm2beta2 + + J33L*PDupwindNthSymm3beta2)*Abs(beta3L))*ToReal(ShiftAdvectionCoeff)),0); + + CCTK_REAL B3L = IfThen(ToReal(ShiftBCoeff)*ToReal(ShiftGammaCoeff) != + 0,INV(theta)*INV(ToReal(ShiftGammaCoeff))*(27*dtbetazL - + 3*((beta1L*J11L + beta2L*J12L + beta3L*J13L)*PDupwindNthAnti1beta3 + + (beta1L*J21L + beta2L*J22L + beta3L*J23L)*PDupwindNthAnti2beta3 + + (beta1L*J31L + beta2L*J32L + beta3L*J33L)*PDupwindNthAnti3beta3 + + (J11L*PDupwindNthSymm1beta3 + J21L*PDupwindNthSymm2beta3 + + J31L*PDupwindNthSymm3beta3)*Abs(beta1L) + (J12L*PDupwindNthSymm1beta3 + + J22L*PDupwindNthSymm2beta3 + J32L*PDupwindNthSymm3beta3)*Abs(beta2L) + + (J13L*PDupwindNthSymm1beta3 + J23L*PDupwindNthSymm2beta3 + + J33L*PDupwindNthSymm3beta3)*Abs(beta3L))*ToReal(ShiftAdvectionCoeff)),0); + + + /* Copy local copies back to grid functions */ + A[index] = AL; + B1[index] = B1L; + B2[index] = B2L; + B3[index] = B3L; + Xt1[index] = Xt1L; + Xt2[index] = Xt2L; + Xt3[index] = Xt3L; + } + LC_ENDLOOP3 (ML_BSSN_MP_convertFromADMBaseGamma); +} + +extern "C" void ML_BSSN_MP_convertFromADMBaseGamma(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverInterior(cctkGH, &ML_BSSN_MP_convertFromADMBaseGamma_Body); +} diff --git a/ML_BSSN_MP/src/ML_BSSN_MP_convertToADMBase.cc b/ML_BSSN_MP/src/ML_BSSN_MP_convertToADMBase.cc new file mode 100644 index 0000000..8f0f648 --- /dev/null +++ b/ML_BSSN_MP/src/ML_BSSN_MP_convertToADMBase.cc @@ -0,0 +1,193 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +static void ML_BSSN_MP_convertToADMBase_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_BSSN_MP_convertToADMBase_Body"); + } + + if (cctk_iteration % ML_BSSN_MP_convertToADMBase_calc_every != ML_BSSN_MP_convertToADMBase_calc_offset) + { + return; + } + + const char *groups[] = {"ADMBase::curv","ADMBase::lapse","ADMBase::metric","ADMBase::shift","ML_BSSN_MP::ML_curv","ML_BSSN_MP::ML_lapse","ML_BSSN_MP::ML_log_confac","ML_BSSN_MP::ML_metric","ML_BSSN_MP::ML_shift","ML_BSSN_MP::ML_trace_curv"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_BSSN_MP_convertToADMBase", 10, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o12dx = 0.0833333333333333333333333333333*INV(dx); + CCTK_REAL const p1o12dy = 0.0833333333333333333333333333333*INV(dy); + CCTK_REAL const p1o12dz = 0.0833333333333333333333333333333*INV(dz); + CCTK_REAL const p1o144dxdy = 0.00694444444444444444444444444444*INV(dx)*INV(dy); + CCTK_REAL const p1o144dxdz = 0.00694444444444444444444444444444*INV(dx)*INV(dz); + CCTK_REAL const p1o144dydz = 0.00694444444444444444444444444444*INV(dy)*INV(dz); + CCTK_REAL const p1o24dx = 0.0416666666666666666666666666667*INV(dx); + CCTK_REAL const p1o24dy = 0.0416666666666666666666666666667*INV(dy); + CCTK_REAL const p1o24dz = 0.0416666666666666666666666666667*INV(dz); + CCTK_REAL const p1o64dx = 0.015625*INV(dx); + CCTK_REAL const p1o64dy = 0.015625*INV(dy); + CCTK_REAL const p1o64dz = 0.015625*INV(dz); + CCTK_REAL const p1odx = INV(dx); + CCTK_REAL const p1ody = INV(dy); + CCTK_REAL const p1odz = INV(dz); + CCTK_REAL const pm1o12dx2 = -0.0833333333333333333333333333333*INV(SQR(dx)); + CCTK_REAL const pm1o12dy2 = -0.0833333333333333333333333333333*INV(SQR(dy)); + CCTK_REAL const pm1o12dz2 = -0.0833333333333333333333333333333*INV(SQR(dz)); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_BSSN_MP_convertToADMBase, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + CCTK_REAL alphaL = alpha[index]; + CCTK_REAL At11L = At11[index]; + CCTK_REAL At12L = At12[index]; + CCTK_REAL At13L = At13[index]; + CCTK_REAL At22L = At22[index]; + CCTK_REAL At23L = At23[index]; + CCTK_REAL At33L = At33[index]; + CCTK_REAL beta1L = beta1[index]; + CCTK_REAL beta2L = beta2[index]; + CCTK_REAL beta3L = beta3[index]; + CCTK_REAL gt11L = gt11[index]; + CCTK_REAL gt12L = gt12[index]; + CCTK_REAL gt13L = gt13[index]; + CCTK_REAL gt22L = gt22[index]; + CCTK_REAL gt23L = gt23[index]; + CCTK_REAL gt33L = gt33[index]; + CCTK_REAL gxxL = gxx[index]; + CCTK_REAL gxyL = gxy[index]; + CCTK_REAL gxzL = gxz[index]; + CCTK_REAL gyyL = gyy[index]; + CCTK_REAL gyzL = gyz[index]; + CCTK_REAL gzzL = gzz[index]; + CCTK_REAL phiL = phi[index]; + CCTK_REAL trKL = trK[index]; + + /* Include user supplied include files */ + + /* Precompute derivatives */ + + /* Calculate temporaries and grid functions */ + CCTK_REAL e4phi = + IfThen(ToReal(conformalMethod),INV(SQR(phiL)),exp(4*phiL)); + + gxxL = e4phi*gt11L; + + gxyL = e4phi*gt12L; + + gxzL = e4phi*gt13L; + + gyyL = e4phi*gt22L; + + gyzL = e4phi*gt23L; + + gzzL = e4phi*gt33L; + + CCTK_REAL kxxL = At11L*e4phi + + 0.333333333333333333333333333333*gxxL*trKL; + + CCTK_REAL kxyL = At12L*e4phi + + 0.333333333333333333333333333333*gxyL*trKL; + + CCTK_REAL kxzL = At13L*e4phi + + 0.333333333333333333333333333333*gxzL*trKL; + + CCTK_REAL kyyL = At22L*e4phi + + 0.333333333333333333333333333333*gyyL*trKL; + + CCTK_REAL kyzL = At23L*e4phi + + 0.333333333333333333333333333333*gyzL*trKL; + + CCTK_REAL kzzL = At33L*e4phi + + 0.333333333333333333333333333333*gzzL*trKL; + + CCTK_REAL alpL = alphaL; + + CCTK_REAL betaxL = beta1L; + + CCTK_REAL betayL = beta2L; + + CCTK_REAL betazL = beta3L; + + + /* Copy local copies back to grid functions */ + alp[index] = alpL; + betax[index] = betaxL; + betay[index] = betayL; + betaz[index] = betazL; + gxx[index] = gxxL; + gxy[index] = gxyL; + gxz[index] = gxzL; + gyy[index] = gyyL; + gyz[index] = gyzL; + gzz[index] = gzzL; + kxx[index] = kxxL; + kxy[index] = kxyL; + kxz[index] = kxzL; + kyy[index] = kyyL; + kyz[index] = kyzL; + kzz[index] = kzzL; + } + LC_ENDLOOP3 (ML_BSSN_MP_convertToADMBase); +} + +extern "C" void ML_BSSN_MP_convertToADMBase(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverEverything(cctkGH, &ML_BSSN_MP_convertToADMBase_Body); +} diff --git a/ML_BSSN_MP/src/ML_BSSN_MP_convertToADMBaseDtLapseShift.cc b/ML_BSSN_MP/src/ML_BSSN_MP_convertToADMBaseDtLapseShift.cc new file mode 100644 index 0000000..9a43958 --- /dev/null +++ b/ML_BSSN_MP/src/ML_BSSN_MP_convertToADMBaseDtLapseShift.cc @@ -0,0 +1,236 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +extern "C" void ML_BSSN_MP_convertToADMBaseDtLapseShift_SelectBCs(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT ierr = 0; + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ADMBase::dtlapse","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ADMBase::dtlapse."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ADMBase::dtshift","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ADMBase::dtshift."); + return; +} + +static void ML_BSSN_MP_convertToADMBaseDtLapseShift_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_BSSN_MP_convertToADMBaseDtLapseShift_Body"); + } + + if (cctk_iteration % ML_BSSN_MP_convertToADMBaseDtLapseShift_calc_every != ML_BSSN_MP_convertToADMBaseDtLapseShift_calc_offset) + { + return; + } + + const char *groups[] = {"ADMBase::dtlapse","ADMBase::dtshift","Coordinates::jacobian","grid::coordinates","Grid::coordinates","ML_BSSN_MP::ML_dtlapse","ML_BSSN_MP::ML_dtshift","ML_BSSN_MP::ML_Gamma","ML_BSSN_MP::ML_lapse","ML_BSSN_MP::ML_shift","ML_BSSN_MP::ML_trace_curv"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_BSSN_MP_convertToADMBaseDtLapseShift", 11, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o12dx = 0.0833333333333333333333333333333*INV(dx); + CCTK_REAL const p1o12dy = 0.0833333333333333333333333333333*INV(dy); + CCTK_REAL const p1o12dz = 0.0833333333333333333333333333333*INV(dz); + CCTK_REAL const p1o144dxdy = 0.00694444444444444444444444444444*INV(dx)*INV(dy); + CCTK_REAL const p1o144dxdz = 0.00694444444444444444444444444444*INV(dx)*INV(dz); + CCTK_REAL const p1o144dydz = 0.00694444444444444444444444444444*INV(dy)*INV(dz); + CCTK_REAL const p1o24dx = 0.0416666666666666666666666666667*INV(dx); + CCTK_REAL const p1o24dy = 0.0416666666666666666666666666667*INV(dy); + CCTK_REAL const p1o24dz = 0.0416666666666666666666666666667*INV(dz); + CCTK_REAL const p1o64dx = 0.015625*INV(dx); + CCTK_REAL const p1o64dy = 0.015625*INV(dy); + CCTK_REAL const p1o64dz = 0.015625*INV(dz); + CCTK_REAL const p1odx = INV(dx); + CCTK_REAL const p1ody = INV(dy); + CCTK_REAL const p1odz = INV(dz); + CCTK_REAL const pm1o12dx2 = -0.0833333333333333333333333333333*INV(SQR(dx)); + CCTK_REAL const pm1o12dy2 = -0.0833333333333333333333333333333*INV(SQR(dy)); + CCTK_REAL const pm1o12dz2 = -0.0833333333333333333333333333333*INV(SQR(dz)); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_BSSN_MP_convertToADMBaseDtLapseShift, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + CCTK_REAL AL = A[index]; + CCTK_REAL alphaL = alpha[index]; + CCTK_REAL B1L = B1[index]; + CCTK_REAL B2L = B2[index]; + CCTK_REAL B3L = B3[index]; + CCTK_REAL beta1L = beta1[index]; + CCTK_REAL beta2L = beta2[index]; + CCTK_REAL beta3L = beta3[index]; + CCTK_REAL J11L = J11[index]; + CCTK_REAL J12L = J12[index]; + CCTK_REAL J13L = J13[index]; + CCTK_REAL J21L = J21[index]; + CCTK_REAL J22L = J22[index]; + CCTK_REAL J23L = J23[index]; + CCTK_REAL J31L = J31[index]; + CCTK_REAL J32L = J32[index]; + CCTK_REAL J33L = J33[index]; + CCTK_REAL rL = r[index]; + CCTK_REAL trKL = trK[index]; + CCTK_REAL Xt1L = Xt1[index]; + CCTK_REAL Xt2L = Xt2[index]; + CCTK_REAL Xt3L = Xt3[index]; + + /* Include user supplied include files */ + + /* Precompute derivatives */ + CCTK_REAL const PDupwindNthAnti1alpha = PDupwindNthAnti1(&alpha[index]); + CCTK_REAL const PDupwindNthSymm1alpha = PDupwindNthSymm1(&alpha[index]); + CCTK_REAL const PDupwindNthAnti2alpha = PDupwindNthAnti2(&alpha[index]); + CCTK_REAL const PDupwindNthSymm2alpha = PDupwindNthSymm2(&alpha[index]); + CCTK_REAL const PDupwindNthAnti3alpha = PDupwindNthAnti3(&alpha[index]); + CCTK_REAL const PDupwindNthSymm3alpha = PDupwindNthSymm3(&alpha[index]); + CCTK_REAL const PDupwindNthAnti1beta1 = PDupwindNthAnti1(&beta1[index]); + CCTK_REAL const PDupwindNthSymm1beta1 = PDupwindNthSymm1(&beta1[index]); + CCTK_REAL const PDupwindNthAnti2beta1 = PDupwindNthAnti2(&beta1[index]); + CCTK_REAL const PDupwindNthSymm2beta1 = PDupwindNthSymm2(&beta1[index]); + CCTK_REAL const PDupwindNthAnti3beta1 = PDupwindNthAnti3(&beta1[index]); + CCTK_REAL const PDupwindNthSymm3beta1 = PDupwindNthSymm3(&beta1[index]); + CCTK_REAL const PDupwindNthAnti1beta2 = PDupwindNthAnti1(&beta2[index]); + CCTK_REAL const PDupwindNthSymm1beta2 = PDupwindNthSymm1(&beta2[index]); + CCTK_REAL const PDupwindNthAnti2beta2 = PDupwindNthAnti2(&beta2[index]); + CCTK_REAL const PDupwindNthSymm2beta2 = PDupwindNthSymm2(&beta2[index]); + CCTK_REAL const PDupwindNthAnti3beta2 = PDupwindNthAnti3(&beta2[index]); + CCTK_REAL const PDupwindNthSymm3beta2 = PDupwindNthSymm3(&beta2[index]); + CCTK_REAL const PDupwindNthAnti1beta3 = PDupwindNthAnti1(&beta3[index]); + CCTK_REAL const PDupwindNthSymm1beta3 = PDupwindNthSymm1(&beta3[index]); + CCTK_REAL const PDupwindNthAnti2beta3 = PDupwindNthAnti2(&beta3[index]); + CCTK_REAL const PDupwindNthSymm2beta3 = PDupwindNthSymm2(&beta3[index]); + CCTK_REAL const PDupwindNthAnti3beta3 = PDupwindNthAnti3(&beta3[index]); + CCTK_REAL const PDupwindNthSymm3beta3 = PDupwindNthSymm3(&beta3[index]); + + /* Calculate temporaries and grid functions */ + ptrdiff_t dir1 = Sign(beta1L); + + ptrdiff_t dir2 = Sign(beta2L); + + ptrdiff_t dir3 = Sign(beta3L); + + CCTK_REAL eta = fmin(1,INV(rL)*ToReal(SpatialBetaDriverRadius)); + + CCTK_REAL theta = fmin(1,exp(1 - + rL*INV(ToReal(SpatialShiftGammaCoeffRadius)))); + + CCTK_REAL dtalpL = + -(pow(alphaL,ToReal(harmonicN))*ToReal(harmonicF)*(trKL + (AL - + trKL)*ToReal(LapseACoeff))) + ((beta1L*J11L + beta2L*J12L + + beta3L*J13L)*PDupwindNthAnti1alpha + (beta1L*J21L + beta2L*J22L + + beta3L*J23L)*PDupwindNthAnti2alpha + (beta1L*J31L + beta2L*J32L + + beta3L*J33L)*PDupwindNthAnti3alpha + (J11L*PDupwindNthSymm1alpha + + J21L*PDupwindNthSymm2alpha + J31L*PDupwindNthSymm3alpha)*Abs(beta1L) + + (J12L*PDupwindNthSymm1alpha + J22L*PDupwindNthSymm2alpha + + J32L*PDupwindNthSymm3alpha)*Abs(beta2L) + (J13L*PDupwindNthSymm1alpha + + J23L*PDupwindNthSymm2alpha + + J33L*PDupwindNthSymm3alpha)*Abs(beta3L))*ToReal(LapseAdvectionCoeff); + + CCTK_REAL dtbetaxL = ((beta1L*J11L + beta2L*J12L + + beta3L*J13L)*PDupwindNthAnti1beta1 + (beta1L*J21L + beta2L*J22L + + beta3L*J23L)*PDupwindNthAnti2beta1 + (beta1L*J31L + beta2L*J32L + + beta3L*J33L)*PDupwindNthAnti3beta1 + (J11L*PDupwindNthSymm1beta1 + + J21L*PDupwindNthSymm2beta1 + J31L*PDupwindNthSymm3beta1)*Abs(beta1L) + + (J12L*PDupwindNthSymm1beta1 + J22L*PDupwindNthSymm2beta1 + + J32L*PDupwindNthSymm3beta1)*Abs(beta2L) + (J13L*PDupwindNthSymm1beta1 + + J23L*PDupwindNthSymm2beta1 + + J33L*PDupwindNthSymm3beta1)*Abs(beta3L))*ToReal(ShiftAdvectionCoeff) + + theta*(Xt1L + beta1L*eta*ToReal(BetaDriver)*(-1 + ToReal(ShiftBCoeff)) + + (B1L - Xt1L)*ToReal(ShiftBCoeff))*ToReal(ShiftGammaCoeff); + + CCTK_REAL dtbetayL = ((beta1L*J11L + beta2L*J12L + + beta3L*J13L)*PDupwindNthAnti1beta2 + (beta1L*J21L + beta2L*J22L + + beta3L*J23L)*PDupwindNthAnti2beta2 + (beta1L*J31L + beta2L*J32L + + beta3L*J33L)*PDupwindNthAnti3beta2 + (J11L*PDupwindNthSymm1beta2 + + J21L*PDupwindNthSymm2beta2 + J31L*PDupwindNthSymm3beta2)*Abs(beta1L) + + (J12L*PDupwindNthSymm1beta2 + J22L*PDupwindNthSymm2beta2 + + J32L*PDupwindNthSymm3beta2)*Abs(beta2L) + (J13L*PDupwindNthSymm1beta2 + + J23L*PDupwindNthSymm2beta2 + + J33L*PDupwindNthSymm3beta2)*Abs(beta3L))*ToReal(ShiftAdvectionCoeff) + + theta*(Xt2L + beta2L*eta*ToReal(BetaDriver)*(-1 + ToReal(ShiftBCoeff)) + + (B2L - Xt2L)*ToReal(ShiftBCoeff))*ToReal(ShiftGammaCoeff); + + CCTK_REAL dtbetazL = ((beta1L*J11L + beta2L*J12L + + beta3L*J13L)*PDupwindNthAnti1beta3 + (beta1L*J21L + beta2L*J22L + + beta3L*J23L)*PDupwindNthAnti2beta3 + (beta1L*J31L + beta2L*J32L + + beta3L*J33L)*PDupwindNthAnti3beta3 + (J11L*PDupwindNthSymm1beta3 + + J21L*PDupwindNthSymm2beta3 + J31L*PDupwindNthSymm3beta3)*Abs(beta1L) + + (J12L*PDupwindNthSymm1beta3 + J22L*PDupwindNthSymm2beta3 + + J32L*PDupwindNthSymm3beta3)*Abs(beta2L) + (J13L*PDupwindNthSymm1beta3 + + J23L*PDupwindNthSymm2beta3 + + J33L*PDupwindNthSymm3beta3)*Abs(beta3L))*ToReal(ShiftAdvectionCoeff) + + theta*(Xt3L + beta3L*eta*ToReal(BetaDriver)*(-1 + ToReal(ShiftBCoeff)) + + (B3L - Xt3L)*ToReal(ShiftBCoeff))*ToReal(ShiftGammaCoeff); + + + /* Copy local copies back to grid functions */ + dtalp[index] = dtalpL; + dtbetax[index] = dtbetaxL; + dtbetay[index] = dtbetayL; + dtbetaz[index] = dtbetazL; + } + LC_ENDLOOP3 (ML_BSSN_MP_convertToADMBaseDtLapseShift); +} + +extern "C" void ML_BSSN_MP_convertToADMBaseDtLapseShift(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverInterior(cctkGH, &ML_BSSN_MP_convertToADMBaseDtLapseShift_Body); +} diff --git a/ML_BSSN_MP/src/ML_BSSN_MP_convertToADMBaseDtLapseShiftBoundary.cc b/ML_BSSN_MP/src/ML_BSSN_MP_convertToADMBaseDtLapseShiftBoundary.cc new file mode 100644 index 0000000..f78cffa --- /dev/null +++ b/ML_BSSN_MP/src/ML_BSSN_MP_convertToADMBaseDtLapseShiftBoundary.cc @@ -0,0 +1,165 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +extern "C" void ML_BSSN_MP_convertToADMBaseDtLapseShiftBoundary_SelectBCs(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT ierr = 0; + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ADMBase::dtlapse","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ADMBase::dtlapse."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ADMBase::dtshift","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ADMBase::dtshift."); + return; +} + +static void ML_BSSN_MP_convertToADMBaseDtLapseShiftBoundary_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_BSSN_MP_convertToADMBaseDtLapseShiftBoundary_Body"); + } + + if (cctk_iteration % ML_BSSN_MP_convertToADMBaseDtLapseShiftBoundary_calc_every != ML_BSSN_MP_convertToADMBaseDtLapseShiftBoundary_calc_offset) + { + return; + } + + const char *groups[] = {"ADMBase::dtlapse","ADMBase::dtshift","grid::coordinates","Grid::coordinates","ML_BSSN_MP::ML_dtlapse","ML_BSSN_MP::ML_dtshift","ML_BSSN_MP::ML_Gamma","ML_BSSN_MP::ML_lapse","ML_BSSN_MP::ML_shift","ML_BSSN_MP::ML_trace_curv"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_BSSN_MP_convertToADMBaseDtLapseShiftBoundary", 10, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o12dx = 0.0833333333333333333333333333333*INV(dx); + CCTK_REAL const p1o12dy = 0.0833333333333333333333333333333*INV(dy); + CCTK_REAL const p1o12dz = 0.0833333333333333333333333333333*INV(dz); + CCTK_REAL const p1o144dxdy = 0.00694444444444444444444444444444*INV(dx)*INV(dy); + CCTK_REAL const p1o144dxdz = 0.00694444444444444444444444444444*INV(dx)*INV(dz); + CCTK_REAL const p1o144dydz = 0.00694444444444444444444444444444*INV(dy)*INV(dz); + CCTK_REAL const p1o24dx = 0.0416666666666666666666666666667*INV(dx); + CCTK_REAL const p1o24dy = 0.0416666666666666666666666666667*INV(dy); + CCTK_REAL const p1o24dz = 0.0416666666666666666666666666667*INV(dz); + CCTK_REAL const p1o64dx = 0.015625*INV(dx); + CCTK_REAL const p1o64dy = 0.015625*INV(dy); + CCTK_REAL const p1o64dz = 0.015625*INV(dz); + CCTK_REAL const p1odx = INV(dx); + CCTK_REAL const p1ody = INV(dy); + CCTK_REAL const p1odz = INV(dz); + CCTK_REAL const pm1o12dx2 = -0.0833333333333333333333333333333*INV(SQR(dx)); + CCTK_REAL const pm1o12dy2 = -0.0833333333333333333333333333333*INV(SQR(dy)); + CCTK_REAL const pm1o12dz2 = -0.0833333333333333333333333333333*INV(SQR(dz)); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_BSSN_MP_convertToADMBaseDtLapseShiftBoundary, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + CCTK_REAL AL = A[index]; + CCTK_REAL alphaL = alpha[index]; + CCTK_REAL B1L = B1[index]; + CCTK_REAL B2L = B2[index]; + CCTK_REAL B3L = B3[index]; + CCTK_REAL beta1L = beta1[index]; + CCTK_REAL beta2L = beta2[index]; + CCTK_REAL beta3L = beta3[index]; + CCTK_REAL rL = r[index]; + CCTK_REAL trKL = trK[index]; + CCTK_REAL Xt1L = Xt1[index]; + CCTK_REAL Xt2L = Xt2[index]; + CCTK_REAL Xt3L = Xt3[index]; + + /* Include user supplied include files */ + + /* Precompute derivatives */ + + /* Calculate temporaries and grid functions */ + CCTK_REAL eta = fmin(1,INV(rL)*ToReal(SpatialBetaDriverRadius)); + + CCTK_REAL theta = fmin(1,exp(1 - + rL*INV(ToReal(SpatialShiftGammaCoeffRadius)))); + + CCTK_REAL dtalpL = + -(pow(alphaL,ToReal(harmonicN))*ToReal(harmonicF)*(trKL + (AL - + trKL)*ToReal(LapseACoeff))); + + CCTK_REAL dtbetaxL = theta*(Xt1L + beta1L*eta*ToReal(BetaDriver)*(-1 + + ToReal(ShiftBCoeff)) + (B1L - + Xt1L)*ToReal(ShiftBCoeff))*ToReal(ShiftGammaCoeff); + + CCTK_REAL dtbetayL = theta*(Xt2L + beta2L*eta*ToReal(BetaDriver)*(-1 + + ToReal(ShiftBCoeff)) + (B2L - + Xt2L)*ToReal(ShiftBCoeff))*ToReal(ShiftGammaCoeff); + + CCTK_REAL dtbetazL = theta*(Xt3L + beta3L*eta*ToReal(BetaDriver)*(-1 + + ToReal(ShiftBCoeff)) + (B3L - + Xt3L)*ToReal(ShiftBCoeff))*ToReal(ShiftGammaCoeff); + + + /* Copy local copies back to grid functions */ + dtalp[index] = dtalpL; + dtbetax[index] = dtbetaxL; + dtbetay[index] = dtbetayL; + dtbetaz[index] = dtbetazL; + } + LC_ENDLOOP3 (ML_BSSN_MP_convertToADMBaseDtLapseShiftBoundary); +} + +extern "C" void ML_BSSN_MP_convertToADMBaseDtLapseShiftBoundary(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverBoundaryWithGhosts(cctkGH, &ML_BSSN_MP_convertToADMBaseDtLapseShiftBoundary_Body); +} diff --git a/ML_BSSN_MP/src/ML_BSSN_MP_convertToADMBaseFakeDtLapseShift.cc b/ML_BSSN_MP/src/ML_BSSN_MP_convertToADMBaseFakeDtLapseShift.cc new file mode 100644 index 0000000..2d705f3 --- /dev/null +++ b/ML_BSSN_MP/src/ML_BSSN_MP_convertToADMBaseFakeDtLapseShift.cc @@ -0,0 +1,150 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +static void ML_BSSN_MP_convertToADMBaseFakeDtLapseShift_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_BSSN_MP_convertToADMBaseFakeDtLapseShift_Body"); + } + + if (cctk_iteration % ML_BSSN_MP_convertToADMBaseFakeDtLapseShift_calc_every != ML_BSSN_MP_convertToADMBaseFakeDtLapseShift_calc_offset) + { + return; + } + + const char *groups[] = {"ADMBase::dtlapse","ADMBase::dtshift","grid::coordinates","Grid::coordinates","ML_BSSN_MP::ML_dtlapse","ML_BSSN_MP::ML_dtshift","ML_BSSN_MP::ML_Gamma","ML_BSSN_MP::ML_lapse","ML_BSSN_MP::ML_shift","ML_BSSN_MP::ML_trace_curv"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_BSSN_MP_convertToADMBaseFakeDtLapseShift", 10, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o12dx = 0.0833333333333333333333333333333*INV(dx); + CCTK_REAL const p1o12dy = 0.0833333333333333333333333333333*INV(dy); + CCTK_REAL const p1o12dz = 0.0833333333333333333333333333333*INV(dz); + CCTK_REAL const p1o144dxdy = 0.00694444444444444444444444444444*INV(dx)*INV(dy); + CCTK_REAL const p1o144dxdz = 0.00694444444444444444444444444444*INV(dx)*INV(dz); + CCTK_REAL const p1o144dydz = 0.00694444444444444444444444444444*INV(dy)*INV(dz); + CCTK_REAL const p1o24dx = 0.0416666666666666666666666666667*INV(dx); + CCTK_REAL const p1o24dy = 0.0416666666666666666666666666667*INV(dy); + CCTK_REAL const p1o24dz = 0.0416666666666666666666666666667*INV(dz); + CCTK_REAL const p1o64dx = 0.015625*INV(dx); + CCTK_REAL const p1o64dy = 0.015625*INV(dy); + CCTK_REAL const p1o64dz = 0.015625*INV(dz); + CCTK_REAL const p1odx = INV(dx); + CCTK_REAL const p1ody = INV(dy); + CCTK_REAL const p1odz = INV(dz); + CCTK_REAL const pm1o12dx2 = -0.0833333333333333333333333333333*INV(SQR(dx)); + CCTK_REAL const pm1o12dy2 = -0.0833333333333333333333333333333*INV(SQR(dy)); + CCTK_REAL const pm1o12dz2 = -0.0833333333333333333333333333333*INV(SQR(dz)); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_BSSN_MP_convertToADMBaseFakeDtLapseShift, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + CCTK_REAL AL = A[index]; + CCTK_REAL alphaL = alpha[index]; + CCTK_REAL B1L = B1[index]; + CCTK_REAL B2L = B2[index]; + CCTK_REAL B3L = B3[index]; + CCTK_REAL beta1L = beta1[index]; + CCTK_REAL beta2L = beta2[index]; + CCTK_REAL beta3L = beta3[index]; + CCTK_REAL rL = r[index]; + CCTK_REAL trKL = trK[index]; + CCTK_REAL Xt1L = Xt1[index]; + CCTK_REAL Xt2L = Xt2[index]; + CCTK_REAL Xt3L = Xt3[index]; + + /* Include user supplied include files */ + + /* Precompute derivatives */ + + /* Calculate temporaries and grid functions */ + CCTK_REAL eta = fmin(1,INV(rL)*ToReal(SpatialBetaDriverRadius)); + + CCTK_REAL theta = fmin(1,exp(1 - + rL*INV(ToReal(SpatialShiftGammaCoeffRadius)))); + + CCTK_REAL dtalpL = + -(pow(alphaL,ToReal(harmonicN))*ToReal(harmonicF)*(trKL + (AL - + trKL)*ToReal(LapseACoeff))); + + CCTK_REAL dtbetaxL = theta*(Xt1L + beta1L*eta*ToReal(BetaDriver)*(-1 + + ToReal(ShiftBCoeff)) + (B1L - + Xt1L)*ToReal(ShiftBCoeff))*ToReal(ShiftGammaCoeff); + + CCTK_REAL dtbetayL = theta*(Xt2L + beta2L*eta*ToReal(BetaDriver)*(-1 + + ToReal(ShiftBCoeff)) + (B2L - + Xt2L)*ToReal(ShiftBCoeff))*ToReal(ShiftGammaCoeff); + + CCTK_REAL dtbetazL = theta*(Xt3L + beta3L*eta*ToReal(BetaDriver)*(-1 + + ToReal(ShiftBCoeff)) + (B3L - + Xt3L)*ToReal(ShiftBCoeff))*ToReal(ShiftGammaCoeff); + + + /* Copy local copies back to grid functions */ + dtalp[index] = dtalpL; + dtbetax[index] = dtbetaxL; + dtbetay[index] = dtbetayL; + dtbetaz[index] = dtbetazL; + } + LC_ENDLOOP3 (ML_BSSN_MP_convertToADMBaseFakeDtLapseShift); +} + +extern "C" void ML_BSSN_MP_convertToADMBaseFakeDtLapseShift(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverEverything(cctkGH, &ML_BSSN_MP_convertToADMBaseFakeDtLapseShift_Body); +} diff --git a/ML_BSSN_MP/src/ML_BSSN_MP_enforce.cc b/ML_BSSN_MP/src/ML_BSSN_MP_enforce.cc new file mode 100644 index 0000000..2016b59 --- /dev/null +++ b/ML_BSSN_MP/src/ML_BSSN_MP_enforce.cc @@ -0,0 +1,163 @@ +/* File produced by Kranc */ + +#define KRANC_C + +#include <assert.h> +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include "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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +static void ML_BSSN_MP_enforce_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_BSSN_MP_enforce_Body"); + } + + if (cctk_iteration % ML_BSSN_MP_enforce_calc_every != ML_BSSN_MP_enforce_calc_offset) + { + return; + } + + const char *groups[] = {"ML_BSSN_MP::ML_curv","ML_BSSN_MP::ML_lapse","ML_BSSN_MP::ML_metric"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_BSSN_MP_enforce", 3, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o12dx = 0.0833333333333333333333333333333*INV(dx); + CCTK_REAL const p1o12dy = 0.0833333333333333333333333333333*INV(dy); + CCTK_REAL const p1o12dz = 0.0833333333333333333333333333333*INV(dz); + CCTK_REAL const p1o144dxdy = 0.00694444444444444444444444444444*INV(dx)*INV(dy); + CCTK_REAL const p1o144dxdz = 0.00694444444444444444444444444444*INV(dx)*INV(dz); + CCTK_REAL const p1o144dydz = 0.00694444444444444444444444444444*INV(dy)*INV(dz); + CCTK_REAL const p1o24dx = 0.0416666666666666666666666666667*INV(dx); + CCTK_REAL const p1o24dy = 0.0416666666666666666666666666667*INV(dy); + CCTK_REAL const p1o24dz = 0.0416666666666666666666666666667*INV(dz); + CCTK_REAL const p1o64dx = 0.015625*INV(dx); + CCTK_REAL const p1o64dy = 0.015625*INV(dy); + CCTK_REAL const p1o64dz = 0.015625*INV(dz); + CCTK_REAL const p1odx = INV(dx); + CCTK_REAL const p1ody = INV(dy); + CCTK_REAL const p1odz = INV(dz); + CCTK_REAL const pm1o12dx2 = -0.0833333333333333333333333333333*INV(SQR(dx)); + CCTK_REAL const pm1o12dy2 = -0.0833333333333333333333333333333*INV(SQR(dy)); + CCTK_REAL const pm1o12dz2 = -0.0833333333333333333333333333333*INV(SQR(dz)); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_BSSN_MP_enforce, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + CCTK_REAL alphaL = alpha[index]; + CCTK_REAL At11L = At11[index]; + CCTK_REAL At12L = At12[index]; + CCTK_REAL At13L = At13[index]; + CCTK_REAL At22L = At22[index]; + CCTK_REAL At23L = At23[index]; + CCTK_REAL At33L = At33[index]; + CCTK_REAL gt11L = gt11[index]; + CCTK_REAL gt12L = gt12[index]; + CCTK_REAL gt13L = gt13[index]; + CCTK_REAL gt22L = gt22[index]; + CCTK_REAL gt23L = gt23[index]; + CCTK_REAL gt33L = gt33[index]; + + /* Include user supplied include files */ + + /* Precompute derivatives */ + + /* Calculate temporaries and grid functions */ + CCTK_REAL detgt = 1; + + CCTK_REAL gtu11 = INV(detgt)*(gt22L*gt33L - SQR(gt23L)); + + CCTK_REAL gtu12 = (gt13L*gt23L - gt12L*gt33L)*INV(detgt); + + CCTK_REAL gtu13 = (-(gt13L*gt22L) + gt12L*gt23L)*INV(detgt); + + CCTK_REAL gtu22 = INV(detgt)*(gt11L*gt33L - SQR(gt13L)); + + CCTK_REAL gtu23 = (gt12L*gt13L - gt11L*gt23L)*INV(detgt); + + CCTK_REAL gtu33 = INV(detgt)*(gt11L*gt22L - SQR(gt12L)); + + CCTK_REAL trAt = At11L*gtu11 + At22L*gtu22 + 2*(At12L*gtu12 + + At13L*gtu13 + At23L*gtu23) + At33L*gtu33; + + At11L = At11L - 0.333333333333333333333333333333*gt11L*trAt; + + At12L = At12L - 0.333333333333333333333333333333*gt12L*trAt; + + At13L = At13L - 0.333333333333333333333333333333*gt13L*trAt; + + At22L = At22L - 0.333333333333333333333333333333*gt22L*trAt; + + At23L = At23L - 0.333333333333333333333333333333*gt23L*trAt; + + At33L = At33L - 0.333333333333333333333333333333*gt33L*trAt; + + alphaL = fmax(alphaL,ToReal(MinimumLapse)); + + + /* Copy local copies back to grid functions */ + alpha[index] = alphaL; + At11[index] = At11L; + At12[index] = At12L; + At13[index] = At13L; + At22[index] = At22L; + At23[index] = At23L; + At33[index] = At33L; + } + LC_ENDLOOP3 (ML_BSSN_MP_enforce); +} + +extern "C" void ML_BSSN_MP_enforce(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverEverything(cctkGH, &ML_BSSN_MP_enforce_Body); +} diff --git a/ML_BSSN_MP/src/RegisterMoL.cc b/ML_BSSN_MP/src/RegisterMoL.cc new file mode 100644 index 0000000..dca4646 --- /dev/null +++ b/ML_BSSN_MP/src/RegisterMoL.cc @@ -0,0 +1,41 @@ +/* File produced by Kranc */ + +#include "cctk.h" +#include "cctk_Arguments.h" +#include "cctk_Parameters.h" + +extern "C" void ML_BSSN_MP_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_BSSN_MP::At11"), CCTK_VarIndex("ML_BSSN_MP::At11rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_MP::At12"), CCTK_VarIndex("ML_BSSN_MP::At12rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_MP::At13"), CCTK_VarIndex("ML_BSSN_MP::At13rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_MP::At22"), CCTK_VarIndex("ML_BSSN_MP::At22rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_MP::At23"), CCTK_VarIndex("ML_BSSN_MP::At23rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_MP::At33"), CCTK_VarIndex("ML_BSSN_MP::At33rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_MP::A"), CCTK_VarIndex("ML_BSSN_MP::Arhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_MP::B1"), CCTK_VarIndex("ML_BSSN_MP::B1rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_MP::B2"), CCTK_VarIndex("ML_BSSN_MP::B2rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_MP::B3"), CCTK_VarIndex("ML_BSSN_MP::B3rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_MP::Xt1"), CCTK_VarIndex("ML_BSSN_MP::Xt1rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_MP::Xt2"), CCTK_VarIndex("ML_BSSN_MP::Xt2rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_MP::Xt3"), CCTK_VarIndex("ML_BSSN_MP::Xt3rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_MP::alpha"), CCTK_VarIndex("ML_BSSN_MP::alpharhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_MP::phi"), CCTK_VarIndex("ML_BSSN_MP::phirhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_MP::gt11"), CCTK_VarIndex("ML_BSSN_MP::gt11rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_MP::gt12"), CCTK_VarIndex("ML_BSSN_MP::gt12rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_MP::gt13"), CCTK_VarIndex("ML_BSSN_MP::gt13rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_MP::gt22"), CCTK_VarIndex("ML_BSSN_MP::gt22rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_MP::gt23"), CCTK_VarIndex("ML_BSSN_MP::gt23rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_MP::gt33"), CCTK_VarIndex("ML_BSSN_MP::gt33rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_MP::beta1"), CCTK_VarIndex("ML_BSSN_MP::beta1rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_MP::beta2"), CCTK_VarIndex("ML_BSSN_MP::beta2rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_MP::beta3"), CCTK_VarIndex("ML_BSSN_MP::beta3rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_MP::trK"), CCTK_VarIndex("ML_BSSN_MP::trKrhs")); + return; +} diff --git a/ML_BSSN_MP/src/RegisterSymmetries.cc b/ML_BSSN_MP/src/RegisterSymmetries.cc new file mode 100644 index 0000000..4f9ee29 --- /dev/null +++ b/ML_BSSN_MP/src/RegisterSymmetries.cc @@ -0,0 +1,189 @@ +/* File produced by Kranc */ + +#include "cctk.h" +#include "cctk_Arguments.h" +#include "cctk_Parameters.h" +#include "Symmetry.h" + +extern "C" void ML_BSSN_MP_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_BSSN_MP::At11"); + + sym[0] = -1; + sym[1] = -1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_MP::At12"); + + sym[0] = -1; + sym[1] = 1; + sym[2] = -1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_MP::At13"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_MP::At22"); + + sym[0] = 1; + sym[1] = -1; + sym[2] = -1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_MP::At23"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_MP::At33"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_MP::A"); + + sym[0] = -1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_MP::B1"); + + sym[0] = 1; + sym[1] = -1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_MP::B2"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = -1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_MP::B3"); + + sym[0] = -1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_MP::Xt1"); + + sym[0] = 1; + sym[1] = -1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_MP::Xt2"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = -1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_MP::Xt3"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_MP::alpha"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_MP::phi"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_MP::gt11"); + + sym[0] = -1; + sym[1] = -1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_MP::gt12"); + + sym[0] = -1; + sym[1] = 1; + sym[2] = -1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_MP::gt13"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_MP::gt22"); + + sym[0] = 1; + sym[1] = -1; + sym[2] = -1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_MP::gt23"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_MP::gt33"); + + sym[0] = -1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_MP::beta1"); + + sym[0] = 1; + sym[1] = -1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_MP::beta2"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = -1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_MP::beta3"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_MP::trK"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_MP::cS"); + + sym[0] = -1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_MP::cXt1"); + + sym[0] = 1; + sym[1] = -1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_MP::cXt2"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = -1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_MP::cXt3"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_MP::cA"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_MP::H"); + + sym[0] = -1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_MP::M1"); + + sym[0] = 1; + sym[1] = -1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_MP::M2"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = -1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_MP::M3"); + +} diff --git a/ML_BSSN_MP/src/Startup.cc b/ML_BSSN_MP/src/Startup.cc new file mode 100644 index 0000000..3e145e3 --- /dev/null +++ b/ML_BSSN_MP/src/Startup.cc @@ -0,0 +1,10 @@ +/* File produced by Kranc */ + +#include "cctk.h" + +extern "C" int ML_BSSN_MP_Startup(void) +{ + const char * banner = "ML_BSSN_MP"; + CCTK_RegisterBanner(banner); + return 0; +} diff --git a/ML_BSSN_MP_O8/src/Boundaries.cc b/ML_BSSN_MP_O8/src/Boundaries.cc new file mode 100644 index 0000000..34dc391 --- /dev/null +++ b/ML_BSSN_MP_O8/src/Boundaries.cc @@ -0,0 +1,1809 @@ +/* File produced by Kranc */ + +#include "cctk.h" +#include "cctk_Arguments.h" +#include "cctk_Parameters.h" +#include "cctk_Faces.h" +#include "util_Table.h" +#include "Symmetry.h" + + +/* the boundary treatment is split into 3 steps: */ +/* 1. excision */ +/* 2. symmetries */ +/* 3. "other" boundary conditions, e.g. radiative */ + +/* to simplify scheduling and testing, the 3 steps */ +/* are currently applied in separate functions */ + + +extern "C" void ML_BSSN_MP_O8_CheckBoundaries(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + return; +} + +extern "C" void ML_BSSN_MP_O8_SelectBoundConds(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT ierr = 0; + + if (CCTK_EQUALS(ML_curv_bound, "none" ) || + CCTK_EQUALS(ML_curv_bound, "static") || + CCTK_EQUALS(ML_curv_bound, "flat" ) || + CCTK_EQUALS(ML_curv_bound, "zero" ) ) + { + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_MP_O8::ML_curv", ML_curv_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register ML_curv_bound BC for ML_BSSN_MP_O8::ML_curv!"); + } + + if (CCTK_EQUALS(ML_dtlapse_bound, "none" ) || + CCTK_EQUALS(ML_dtlapse_bound, "static") || + CCTK_EQUALS(ML_dtlapse_bound, "flat" ) || + CCTK_EQUALS(ML_dtlapse_bound, "zero" ) ) + { + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_MP_O8::ML_dtlapse", ML_dtlapse_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register ML_dtlapse_bound BC for ML_BSSN_MP_O8::ML_dtlapse!"); + } + + if (CCTK_EQUALS(ML_dtshift_bound, "none" ) || + CCTK_EQUALS(ML_dtshift_bound, "static") || + CCTK_EQUALS(ML_dtshift_bound, "flat" ) || + CCTK_EQUALS(ML_dtshift_bound, "zero" ) ) + { + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_MP_O8::ML_dtshift", ML_dtshift_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register ML_dtshift_bound BC for ML_BSSN_MP_O8::ML_dtshift!"); + } + + if (CCTK_EQUALS(ML_Gamma_bound, "none" ) || + CCTK_EQUALS(ML_Gamma_bound, "static") || + CCTK_EQUALS(ML_Gamma_bound, "flat" ) || + CCTK_EQUALS(ML_Gamma_bound, "zero" ) ) + { + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_MP_O8::ML_Gamma", ML_Gamma_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register ML_Gamma_bound BC for ML_BSSN_MP_O8::ML_Gamma!"); + } + + if (CCTK_EQUALS(ML_lapse_bound, "none" ) || + CCTK_EQUALS(ML_lapse_bound, "static") || + CCTK_EQUALS(ML_lapse_bound, "flat" ) || + CCTK_EQUALS(ML_lapse_bound, "zero" ) ) + { + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_MP_O8::ML_lapse", ML_lapse_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register ML_lapse_bound BC for ML_BSSN_MP_O8::ML_lapse!"); + } + + if (CCTK_EQUALS(ML_log_confac_bound, "none" ) || + CCTK_EQUALS(ML_log_confac_bound, "static") || + CCTK_EQUALS(ML_log_confac_bound, "flat" ) || + CCTK_EQUALS(ML_log_confac_bound, "zero" ) ) + { + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_MP_O8::ML_log_confac", ML_log_confac_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register ML_log_confac_bound BC for ML_BSSN_MP_O8::ML_log_confac!"); + } + + if (CCTK_EQUALS(ML_metric_bound, "none" ) || + CCTK_EQUALS(ML_metric_bound, "static") || + CCTK_EQUALS(ML_metric_bound, "flat" ) || + CCTK_EQUALS(ML_metric_bound, "zero" ) ) + { + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_MP_O8::ML_metric", ML_metric_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register ML_metric_bound BC for ML_BSSN_MP_O8::ML_metric!"); + } + + if (CCTK_EQUALS(ML_shift_bound, "none" ) || + CCTK_EQUALS(ML_shift_bound, "static") || + CCTK_EQUALS(ML_shift_bound, "flat" ) || + CCTK_EQUALS(ML_shift_bound, "zero" ) ) + { + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_MP_O8::ML_shift", ML_shift_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register ML_shift_bound BC for ML_BSSN_MP_O8::ML_shift!"); + } + + if (CCTK_EQUALS(ML_trace_curv_bound, "none" ) || + CCTK_EQUALS(ML_trace_curv_bound, "static") || + CCTK_EQUALS(ML_trace_curv_bound, "flat" ) || + CCTK_EQUALS(ML_trace_curv_bound, "zero" ) ) + { + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_MP_O8::ML_trace_curv", ML_trace_curv_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register ML_trace_curv_bound BC for ML_BSSN_MP_O8::ML_trace_curv!"); + } + + if (CCTK_EQUALS(At11_bound, "none" ) || + CCTK_EQUALS(At11_bound, "static") || + CCTK_EQUALS(At11_bound, "flat" ) || + CCTK_EQUALS(At11_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_MP_O8::At11", At11_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register At11_bound BC for ML_BSSN_MP_O8::At11!"); + } + + if (CCTK_EQUALS(At12_bound, "none" ) || + CCTK_EQUALS(At12_bound, "static") || + CCTK_EQUALS(At12_bound, "flat" ) || + CCTK_EQUALS(At12_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_MP_O8::At12", At12_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register At12_bound BC for ML_BSSN_MP_O8::At12!"); + } + + if (CCTK_EQUALS(At13_bound, "none" ) || + CCTK_EQUALS(At13_bound, "static") || + CCTK_EQUALS(At13_bound, "flat" ) || + CCTK_EQUALS(At13_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_MP_O8::At13", At13_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register At13_bound BC for ML_BSSN_MP_O8::At13!"); + } + + if (CCTK_EQUALS(At22_bound, "none" ) || + CCTK_EQUALS(At22_bound, "static") || + CCTK_EQUALS(At22_bound, "flat" ) || + CCTK_EQUALS(At22_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_MP_O8::At22", At22_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register At22_bound BC for ML_BSSN_MP_O8::At22!"); + } + + if (CCTK_EQUALS(At23_bound, "none" ) || + CCTK_EQUALS(At23_bound, "static") || + CCTK_EQUALS(At23_bound, "flat" ) || + CCTK_EQUALS(At23_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_MP_O8::At23", At23_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register At23_bound BC for ML_BSSN_MP_O8::At23!"); + } + + if (CCTK_EQUALS(At33_bound, "none" ) || + CCTK_EQUALS(At33_bound, "static") || + CCTK_EQUALS(At33_bound, "flat" ) || + CCTK_EQUALS(At33_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_MP_O8::At33", At33_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register At33_bound BC for ML_BSSN_MP_O8::At33!"); + } + + if (CCTK_EQUALS(A_bound, "none" ) || + CCTK_EQUALS(A_bound, "static") || + CCTK_EQUALS(A_bound, "flat" ) || + CCTK_EQUALS(A_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_MP_O8::A", A_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register A_bound BC for ML_BSSN_MP_O8::A!"); + } + + if (CCTK_EQUALS(B1_bound, "none" ) || + CCTK_EQUALS(B1_bound, "static") || + CCTK_EQUALS(B1_bound, "flat" ) || + CCTK_EQUALS(B1_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_MP_O8::B1", B1_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register B1_bound BC for ML_BSSN_MP_O8::B1!"); + } + + if (CCTK_EQUALS(B2_bound, "none" ) || + CCTK_EQUALS(B2_bound, "static") || + CCTK_EQUALS(B2_bound, "flat" ) || + CCTK_EQUALS(B2_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_MP_O8::B2", B2_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register B2_bound BC for ML_BSSN_MP_O8::B2!"); + } + + if (CCTK_EQUALS(B3_bound, "none" ) || + CCTK_EQUALS(B3_bound, "static") || + CCTK_EQUALS(B3_bound, "flat" ) || + CCTK_EQUALS(B3_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_MP_O8::B3", B3_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register B3_bound BC for ML_BSSN_MP_O8::B3!"); + } + + if (CCTK_EQUALS(Xt1_bound, "none" ) || + CCTK_EQUALS(Xt1_bound, "static") || + CCTK_EQUALS(Xt1_bound, "flat" ) || + CCTK_EQUALS(Xt1_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_MP_O8::Xt1", Xt1_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register Xt1_bound BC for ML_BSSN_MP_O8::Xt1!"); + } + + if (CCTK_EQUALS(Xt2_bound, "none" ) || + CCTK_EQUALS(Xt2_bound, "static") || + CCTK_EQUALS(Xt2_bound, "flat" ) || + CCTK_EQUALS(Xt2_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_MP_O8::Xt2", Xt2_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register Xt2_bound BC for ML_BSSN_MP_O8::Xt2!"); + } + + if (CCTK_EQUALS(Xt3_bound, "none" ) || + CCTK_EQUALS(Xt3_bound, "static") || + CCTK_EQUALS(Xt3_bound, "flat" ) || + CCTK_EQUALS(Xt3_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_MP_O8::Xt3", Xt3_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register Xt3_bound BC for ML_BSSN_MP_O8::Xt3!"); + } + + if (CCTK_EQUALS(alpha_bound, "none" ) || + CCTK_EQUALS(alpha_bound, "static") || + CCTK_EQUALS(alpha_bound, "flat" ) || + CCTK_EQUALS(alpha_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_MP_O8::alpha", alpha_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register alpha_bound BC for ML_BSSN_MP_O8::alpha!"); + } + + if (CCTK_EQUALS(phi_bound, "none" ) || + CCTK_EQUALS(phi_bound, "static") || + CCTK_EQUALS(phi_bound, "flat" ) || + CCTK_EQUALS(phi_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_MP_O8::phi", phi_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register phi_bound BC for ML_BSSN_MP_O8::phi!"); + } + + if (CCTK_EQUALS(gt11_bound, "none" ) || + CCTK_EQUALS(gt11_bound, "static") || + CCTK_EQUALS(gt11_bound, "flat" ) || + CCTK_EQUALS(gt11_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_MP_O8::gt11", gt11_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register gt11_bound BC for ML_BSSN_MP_O8::gt11!"); + } + + if (CCTK_EQUALS(gt12_bound, "none" ) || + CCTK_EQUALS(gt12_bound, "static") || + CCTK_EQUALS(gt12_bound, "flat" ) || + CCTK_EQUALS(gt12_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_MP_O8::gt12", gt12_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register gt12_bound BC for ML_BSSN_MP_O8::gt12!"); + } + + if (CCTK_EQUALS(gt13_bound, "none" ) || + CCTK_EQUALS(gt13_bound, "static") || + CCTK_EQUALS(gt13_bound, "flat" ) || + CCTK_EQUALS(gt13_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_MP_O8::gt13", gt13_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register gt13_bound BC for ML_BSSN_MP_O8::gt13!"); + } + + if (CCTK_EQUALS(gt22_bound, "none" ) || + CCTK_EQUALS(gt22_bound, "static") || + CCTK_EQUALS(gt22_bound, "flat" ) || + CCTK_EQUALS(gt22_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_MP_O8::gt22", gt22_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register gt22_bound BC for ML_BSSN_MP_O8::gt22!"); + } + + if (CCTK_EQUALS(gt23_bound, "none" ) || + CCTK_EQUALS(gt23_bound, "static") || + CCTK_EQUALS(gt23_bound, "flat" ) || + CCTK_EQUALS(gt23_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_MP_O8::gt23", gt23_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register gt23_bound BC for ML_BSSN_MP_O8::gt23!"); + } + + if (CCTK_EQUALS(gt33_bound, "none" ) || + CCTK_EQUALS(gt33_bound, "static") || + CCTK_EQUALS(gt33_bound, "flat" ) || + CCTK_EQUALS(gt33_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_MP_O8::gt33", gt33_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register gt33_bound BC for ML_BSSN_MP_O8::gt33!"); + } + + if (CCTK_EQUALS(beta1_bound, "none" ) || + CCTK_EQUALS(beta1_bound, "static") || + CCTK_EQUALS(beta1_bound, "flat" ) || + CCTK_EQUALS(beta1_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_MP_O8::beta1", beta1_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register beta1_bound BC for ML_BSSN_MP_O8::beta1!"); + } + + if (CCTK_EQUALS(beta2_bound, "none" ) || + CCTK_EQUALS(beta2_bound, "static") || + CCTK_EQUALS(beta2_bound, "flat" ) || + CCTK_EQUALS(beta2_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_MP_O8::beta2", beta2_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register beta2_bound BC for ML_BSSN_MP_O8::beta2!"); + } + + if (CCTK_EQUALS(beta3_bound, "none" ) || + CCTK_EQUALS(beta3_bound, "static") || + CCTK_EQUALS(beta3_bound, "flat" ) || + CCTK_EQUALS(beta3_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_MP_O8::beta3", beta3_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register beta3_bound BC for ML_BSSN_MP_O8::beta3!"); + } + + if (CCTK_EQUALS(trK_bound, "none" ) || + CCTK_EQUALS(trK_bound, "static") || + CCTK_EQUALS(trK_bound, "flat" ) || + CCTK_EQUALS(trK_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_MP_O8::trK", trK_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register trK_bound BC for ML_BSSN_MP_O8::trK!"); + } + + if (CCTK_EQUALS(ML_curv_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_ML_curv_bound = -1; + if (handle_ML_curv_bound < 0) handle_ML_curv_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_curv_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_curv_bound , ML_curv_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_ML_curv_bound ,ML_curv_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_curv_bound, + "ML_BSSN_MP_O8::ML_curv", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_MP_O8::ML_curv!"); + + } + + if (CCTK_EQUALS(ML_dtlapse_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_ML_dtlapse_bound = -1; + if (handle_ML_dtlapse_bound < 0) handle_ML_dtlapse_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_dtlapse_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_dtlapse_bound , ML_dtlapse_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_ML_dtlapse_bound ,ML_dtlapse_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_dtlapse_bound, + "ML_BSSN_MP_O8::ML_dtlapse", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_MP_O8::ML_dtlapse!"); + + } + + if (CCTK_EQUALS(ML_dtshift_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_ML_dtshift_bound = -1; + if (handle_ML_dtshift_bound < 0) handle_ML_dtshift_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_dtshift_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_dtshift_bound , ML_dtshift_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_ML_dtshift_bound ,ML_dtshift_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_dtshift_bound, + "ML_BSSN_MP_O8::ML_dtshift", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_MP_O8::ML_dtshift!"); + + } + + if (CCTK_EQUALS(ML_Gamma_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_ML_Gamma_bound = -1; + if (handle_ML_Gamma_bound < 0) handle_ML_Gamma_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_Gamma_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_Gamma_bound , ML_Gamma_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_ML_Gamma_bound ,ML_Gamma_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_Gamma_bound, + "ML_BSSN_MP_O8::ML_Gamma", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_MP_O8::ML_Gamma!"); + + } + + if (CCTK_EQUALS(ML_lapse_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_ML_lapse_bound = -1; + if (handle_ML_lapse_bound < 0) handle_ML_lapse_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_lapse_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_lapse_bound , ML_lapse_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_ML_lapse_bound ,ML_lapse_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_lapse_bound, + "ML_BSSN_MP_O8::ML_lapse", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_MP_O8::ML_lapse!"); + + } + + if (CCTK_EQUALS(ML_log_confac_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_ML_log_confac_bound = -1; + if (handle_ML_log_confac_bound < 0) handle_ML_log_confac_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_log_confac_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_log_confac_bound , ML_log_confac_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_ML_log_confac_bound ,ML_log_confac_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_log_confac_bound, + "ML_BSSN_MP_O8::ML_log_confac", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_MP_O8::ML_log_confac!"); + + } + + if (CCTK_EQUALS(ML_metric_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_ML_metric_bound = -1; + if (handle_ML_metric_bound < 0) handle_ML_metric_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_metric_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_metric_bound , ML_metric_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_ML_metric_bound ,ML_metric_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_metric_bound, + "ML_BSSN_MP_O8::ML_metric", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_MP_O8::ML_metric!"); + + } + + if (CCTK_EQUALS(ML_shift_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_ML_shift_bound = -1; + if (handle_ML_shift_bound < 0) handle_ML_shift_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_shift_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_shift_bound , ML_shift_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_ML_shift_bound ,ML_shift_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_shift_bound, + "ML_BSSN_MP_O8::ML_shift", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_MP_O8::ML_shift!"); + + } + + if (CCTK_EQUALS(ML_trace_curv_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_ML_trace_curv_bound = -1; + if (handle_ML_trace_curv_bound < 0) handle_ML_trace_curv_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_trace_curv_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_trace_curv_bound , ML_trace_curv_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_ML_trace_curv_bound ,ML_trace_curv_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_trace_curv_bound, + "ML_BSSN_MP_O8::ML_trace_curv", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_MP_O8::ML_trace_curv!"); + + } + + if (CCTK_EQUALS(At11_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_At11_bound = -1; + if (handle_At11_bound < 0) handle_At11_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_At11_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_At11_bound , At11_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_At11_bound ,At11_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_At11_bound, + "ML_BSSN_MP_O8::At11", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_MP_O8::At11!"); + + } + + if (CCTK_EQUALS(At12_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_At12_bound = -1; + if (handle_At12_bound < 0) handle_At12_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_At12_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_At12_bound , At12_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_At12_bound ,At12_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_At12_bound, + "ML_BSSN_MP_O8::At12", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_MP_O8::At12!"); + + } + + if (CCTK_EQUALS(At13_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_At13_bound = -1; + if (handle_At13_bound < 0) handle_At13_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_At13_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_At13_bound , At13_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_At13_bound ,At13_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_At13_bound, + "ML_BSSN_MP_O8::At13", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_MP_O8::At13!"); + + } + + if (CCTK_EQUALS(At22_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_At22_bound = -1; + if (handle_At22_bound < 0) handle_At22_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_At22_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_At22_bound , At22_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_At22_bound ,At22_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_At22_bound, + "ML_BSSN_MP_O8::At22", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_MP_O8::At22!"); + + } + + if (CCTK_EQUALS(At23_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_At23_bound = -1; + if (handle_At23_bound < 0) handle_At23_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_At23_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_At23_bound , At23_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_At23_bound ,At23_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_At23_bound, + "ML_BSSN_MP_O8::At23", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_MP_O8::At23!"); + + } + + if (CCTK_EQUALS(At33_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_At33_bound = -1; + if (handle_At33_bound < 0) handle_At33_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_At33_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_At33_bound , At33_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_At33_bound ,At33_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_At33_bound, + "ML_BSSN_MP_O8::At33", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_MP_O8::At33!"); + + } + + if (CCTK_EQUALS(A_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_A_bound = -1; + if (handle_A_bound < 0) handle_A_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_A_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_A_bound , A_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_A_bound ,A_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_A_bound, + "ML_BSSN_MP_O8::A", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_MP_O8::A!"); + + } + + if (CCTK_EQUALS(B1_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_B1_bound = -1; + if (handle_B1_bound < 0) handle_B1_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_B1_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_B1_bound , B1_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_B1_bound ,B1_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_B1_bound, + "ML_BSSN_MP_O8::B1", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_MP_O8::B1!"); + + } + + if (CCTK_EQUALS(B2_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_B2_bound = -1; + if (handle_B2_bound < 0) handle_B2_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_B2_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_B2_bound , B2_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_B2_bound ,B2_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_B2_bound, + "ML_BSSN_MP_O8::B2", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_MP_O8::B2!"); + + } + + if (CCTK_EQUALS(B3_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_B3_bound = -1; + if (handle_B3_bound < 0) handle_B3_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_B3_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_B3_bound , B3_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_B3_bound ,B3_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_B3_bound, + "ML_BSSN_MP_O8::B3", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_MP_O8::B3!"); + + } + + if (CCTK_EQUALS(Xt1_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_Xt1_bound = -1; + if (handle_Xt1_bound < 0) handle_Xt1_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_Xt1_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_Xt1_bound , Xt1_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_Xt1_bound ,Xt1_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_Xt1_bound, + "ML_BSSN_MP_O8::Xt1", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_MP_O8::Xt1!"); + + } + + if (CCTK_EQUALS(Xt2_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_Xt2_bound = -1; + if (handle_Xt2_bound < 0) handle_Xt2_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_Xt2_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_Xt2_bound , Xt2_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_Xt2_bound ,Xt2_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_Xt2_bound, + "ML_BSSN_MP_O8::Xt2", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_MP_O8::Xt2!"); + + } + + if (CCTK_EQUALS(Xt3_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_Xt3_bound = -1; + if (handle_Xt3_bound < 0) handle_Xt3_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_Xt3_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_Xt3_bound , Xt3_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_Xt3_bound ,Xt3_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_Xt3_bound, + "ML_BSSN_MP_O8::Xt3", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_MP_O8::Xt3!"); + + } + + if (CCTK_EQUALS(alpha_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_alpha_bound = -1; + if (handle_alpha_bound < 0) handle_alpha_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_alpha_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_alpha_bound , alpha_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_alpha_bound ,alpha_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_alpha_bound, + "ML_BSSN_MP_O8::alpha", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_MP_O8::alpha!"); + + } + + if (CCTK_EQUALS(phi_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_phi_bound = -1; + if (handle_phi_bound < 0) handle_phi_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_phi_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_phi_bound , phi_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_phi_bound ,phi_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_phi_bound, + "ML_BSSN_MP_O8::phi", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_MP_O8::phi!"); + + } + + if (CCTK_EQUALS(gt11_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_gt11_bound = -1; + if (handle_gt11_bound < 0) handle_gt11_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_gt11_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_gt11_bound , gt11_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_gt11_bound ,gt11_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_gt11_bound, + "ML_BSSN_MP_O8::gt11", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_MP_O8::gt11!"); + + } + + if (CCTK_EQUALS(gt12_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_gt12_bound = -1; + if (handle_gt12_bound < 0) handle_gt12_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_gt12_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_gt12_bound , gt12_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_gt12_bound ,gt12_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_gt12_bound, + "ML_BSSN_MP_O8::gt12", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_MP_O8::gt12!"); + + } + + if (CCTK_EQUALS(gt13_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_gt13_bound = -1; + if (handle_gt13_bound < 0) handle_gt13_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_gt13_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_gt13_bound , gt13_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_gt13_bound ,gt13_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_gt13_bound, + "ML_BSSN_MP_O8::gt13", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_MP_O8::gt13!"); + + } + + if (CCTK_EQUALS(gt22_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_gt22_bound = -1; + if (handle_gt22_bound < 0) handle_gt22_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_gt22_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_gt22_bound , gt22_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_gt22_bound ,gt22_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_gt22_bound, + "ML_BSSN_MP_O8::gt22", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_MP_O8::gt22!"); + + } + + if (CCTK_EQUALS(gt23_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_gt23_bound = -1; + if (handle_gt23_bound < 0) handle_gt23_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_gt23_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_gt23_bound , gt23_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_gt23_bound ,gt23_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_gt23_bound, + "ML_BSSN_MP_O8::gt23", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_MP_O8::gt23!"); + + } + + if (CCTK_EQUALS(gt33_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_gt33_bound = -1; + if (handle_gt33_bound < 0) handle_gt33_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_gt33_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_gt33_bound , gt33_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_gt33_bound ,gt33_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_gt33_bound, + "ML_BSSN_MP_O8::gt33", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_MP_O8::gt33!"); + + } + + if (CCTK_EQUALS(beta1_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_beta1_bound = -1; + if (handle_beta1_bound < 0) handle_beta1_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_beta1_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_beta1_bound , beta1_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_beta1_bound ,beta1_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_beta1_bound, + "ML_BSSN_MP_O8::beta1", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_MP_O8::beta1!"); + + } + + if (CCTK_EQUALS(beta2_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_beta2_bound = -1; + if (handle_beta2_bound < 0) handle_beta2_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_beta2_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_beta2_bound , beta2_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_beta2_bound ,beta2_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_beta2_bound, + "ML_BSSN_MP_O8::beta2", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_MP_O8::beta2!"); + + } + + if (CCTK_EQUALS(beta3_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_beta3_bound = -1; + if (handle_beta3_bound < 0) handle_beta3_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_beta3_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_beta3_bound , beta3_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_beta3_bound ,beta3_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_beta3_bound, + "ML_BSSN_MP_O8::beta3", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_MP_O8::beta3!"); + + } + + if (CCTK_EQUALS(trK_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_trK_bound = -1; + if (handle_trK_bound < 0) handle_trK_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_trK_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_trK_bound , trK_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_trK_bound ,trK_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_trK_bound, + "ML_BSSN_MP_O8::trK", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_MP_O8::trK!"); + + } + + if (CCTK_EQUALS(ML_curv_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_ML_curv_bound = -1; + if (handle_ML_curv_bound < 0) handle_ML_curv_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_curv_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_curv_bound ,ML_curv_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_curv_bound, + "ML_BSSN_MP_O8::ML_curv", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Scalar BC for ML_BSSN_MP_O8::ML_curv!"); + + } + + if (CCTK_EQUALS(ML_dtlapse_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_ML_dtlapse_bound = -1; + if (handle_ML_dtlapse_bound < 0) handle_ML_dtlapse_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_dtlapse_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_dtlapse_bound ,ML_dtlapse_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_dtlapse_bound, + "ML_BSSN_MP_O8::ML_dtlapse", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Scalar BC for ML_BSSN_MP_O8::ML_dtlapse!"); + + } + + if (CCTK_EQUALS(ML_dtshift_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_ML_dtshift_bound = -1; + if (handle_ML_dtshift_bound < 0) handle_ML_dtshift_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_dtshift_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_dtshift_bound ,ML_dtshift_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_dtshift_bound, + "ML_BSSN_MP_O8::ML_dtshift", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Scalar BC for ML_BSSN_MP_O8::ML_dtshift!"); + + } + + if (CCTK_EQUALS(ML_Gamma_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_ML_Gamma_bound = -1; + if (handle_ML_Gamma_bound < 0) handle_ML_Gamma_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_Gamma_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_Gamma_bound ,ML_Gamma_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_Gamma_bound, + "ML_BSSN_MP_O8::ML_Gamma", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Scalar BC for ML_BSSN_MP_O8::ML_Gamma!"); + + } + + if (CCTK_EQUALS(ML_lapse_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_ML_lapse_bound = -1; + if (handle_ML_lapse_bound < 0) handle_ML_lapse_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_lapse_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_lapse_bound ,ML_lapse_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_lapse_bound, + "ML_BSSN_MP_O8::ML_lapse", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Scalar BC for ML_BSSN_MP_O8::ML_lapse!"); + + } + + if (CCTK_EQUALS(ML_log_confac_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_ML_log_confac_bound = -1; + if (handle_ML_log_confac_bound < 0) handle_ML_log_confac_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_log_confac_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_log_confac_bound ,ML_log_confac_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_log_confac_bound, + "ML_BSSN_MP_O8::ML_log_confac", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Scalar BC for ML_BSSN_MP_O8::ML_log_confac!"); + + } + + if (CCTK_EQUALS(ML_metric_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_ML_metric_bound = -1; + if (handle_ML_metric_bound < 0) handle_ML_metric_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_metric_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_metric_bound ,ML_metric_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_metric_bound, + "ML_BSSN_MP_O8::ML_metric", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Scalar BC for ML_BSSN_MP_O8::ML_metric!"); + + } + + if (CCTK_EQUALS(ML_shift_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_ML_shift_bound = -1; + if (handle_ML_shift_bound < 0) handle_ML_shift_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_shift_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_shift_bound ,ML_shift_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_shift_bound, + "ML_BSSN_MP_O8::ML_shift", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Scalar BC for ML_BSSN_MP_O8::ML_shift!"); + + } + + if (CCTK_EQUALS(ML_trace_curv_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_ML_trace_curv_bound = -1; + if (handle_ML_trace_curv_bound < 0) handle_ML_trace_curv_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_trace_curv_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_trace_curv_bound ,ML_trace_curv_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_trace_curv_bound, + "ML_BSSN_MP_O8::ML_trace_curv", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Scalar BC for ML_BSSN_MP_O8::ML_trace_curv!"); + + } + + if (CCTK_EQUALS(At11_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_At11_bound = -1; + if (handle_At11_bound < 0) handle_At11_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_At11_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_At11_bound ,At11_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_At11_bound, + "ML_BSSN_MP_O8::At11", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_MP_O8::At11!"); + + } + + if (CCTK_EQUALS(At12_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_At12_bound = -1; + if (handle_At12_bound < 0) handle_At12_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_At12_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_At12_bound ,At12_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_At12_bound, + "ML_BSSN_MP_O8::At12", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_MP_O8::At12!"); + + } + + if (CCTK_EQUALS(At13_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_At13_bound = -1; + if (handle_At13_bound < 0) handle_At13_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_At13_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_At13_bound ,At13_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_At13_bound, + "ML_BSSN_MP_O8::At13", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_MP_O8::At13!"); + + } + + if (CCTK_EQUALS(At22_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_At22_bound = -1; + if (handle_At22_bound < 0) handle_At22_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_At22_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_At22_bound ,At22_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_At22_bound, + "ML_BSSN_MP_O8::At22", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_MP_O8::At22!"); + + } + + if (CCTK_EQUALS(At23_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_At23_bound = -1; + if (handle_At23_bound < 0) handle_At23_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_At23_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_At23_bound ,At23_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_At23_bound, + "ML_BSSN_MP_O8::At23", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_MP_O8::At23!"); + + } + + if (CCTK_EQUALS(At33_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_At33_bound = -1; + if (handle_At33_bound < 0) handle_At33_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_At33_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_At33_bound ,At33_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_At33_bound, + "ML_BSSN_MP_O8::At33", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_MP_O8::At33!"); + + } + + if (CCTK_EQUALS(A_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_A_bound = -1; + if (handle_A_bound < 0) handle_A_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_A_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_A_bound ,A_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_A_bound, + "ML_BSSN_MP_O8::A", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_MP_O8::A!"); + + } + + if (CCTK_EQUALS(B1_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_B1_bound = -1; + if (handle_B1_bound < 0) handle_B1_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_B1_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_B1_bound ,B1_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_B1_bound, + "ML_BSSN_MP_O8::B1", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_MP_O8::B1!"); + + } + + if (CCTK_EQUALS(B2_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_B2_bound = -1; + if (handle_B2_bound < 0) handle_B2_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_B2_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_B2_bound ,B2_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_B2_bound, + "ML_BSSN_MP_O8::B2", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_MP_O8::B2!"); + + } + + if (CCTK_EQUALS(B3_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_B3_bound = -1; + if (handle_B3_bound < 0) handle_B3_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_B3_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_B3_bound ,B3_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_B3_bound, + "ML_BSSN_MP_O8::B3", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_MP_O8::B3!"); + + } + + if (CCTK_EQUALS(Xt1_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_Xt1_bound = -1; + if (handle_Xt1_bound < 0) handle_Xt1_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_Xt1_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_Xt1_bound ,Xt1_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_Xt1_bound, + "ML_BSSN_MP_O8::Xt1", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_MP_O8::Xt1!"); + + } + + if (CCTK_EQUALS(Xt2_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_Xt2_bound = -1; + if (handle_Xt2_bound < 0) handle_Xt2_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_Xt2_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_Xt2_bound ,Xt2_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_Xt2_bound, + "ML_BSSN_MP_O8::Xt2", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_MP_O8::Xt2!"); + + } + + if (CCTK_EQUALS(Xt3_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_Xt3_bound = -1; + if (handle_Xt3_bound < 0) handle_Xt3_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_Xt3_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_Xt3_bound ,Xt3_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_Xt3_bound, + "ML_BSSN_MP_O8::Xt3", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_MP_O8::Xt3!"); + + } + + if (CCTK_EQUALS(alpha_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_alpha_bound = -1; + if (handle_alpha_bound < 0) handle_alpha_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_alpha_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_alpha_bound ,alpha_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_alpha_bound, + "ML_BSSN_MP_O8::alpha", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_MP_O8::alpha!"); + + } + + if (CCTK_EQUALS(phi_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_phi_bound = -1; + if (handle_phi_bound < 0) handle_phi_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_phi_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_phi_bound ,phi_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_phi_bound, + "ML_BSSN_MP_O8::phi", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_MP_O8::phi!"); + + } + + if (CCTK_EQUALS(gt11_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_gt11_bound = -1; + if (handle_gt11_bound < 0) handle_gt11_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_gt11_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_gt11_bound ,gt11_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_gt11_bound, + "ML_BSSN_MP_O8::gt11", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_MP_O8::gt11!"); + + } + + if (CCTK_EQUALS(gt12_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_gt12_bound = -1; + if (handle_gt12_bound < 0) handle_gt12_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_gt12_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_gt12_bound ,gt12_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_gt12_bound, + "ML_BSSN_MP_O8::gt12", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_MP_O8::gt12!"); + + } + + if (CCTK_EQUALS(gt13_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_gt13_bound = -1; + if (handle_gt13_bound < 0) handle_gt13_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_gt13_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_gt13_bound ,gt13_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_gt13_bound, + "ML_BSSN_MP_O8::gt13", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_MP_O8::gt13!"); + + } + + if (CCTK_EQUALS(gt22_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_gt22_bound = -1; + if (handle_gt22_bound < 0) handle_gt22_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_gt22_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_gt22_bound ,gt22_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_gt22_bound, + "ML_BSSN_MP_O8::gt22", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_MP_O8::gt22!"); + + } + + if (CCTK_EQUALS(gt23_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_gt23_bound = -1; + if (handle_gt23_bound < 0) handle_gt23_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_gt23_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_gt23_bound ,gt23_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_gt23_bound, + "ML_BSSN_MP_O8::gt23", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_MP_O8::gt23!"); + + } + + if (CCTK_EQUALS(gt33_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_gt33_bound = -1; + if (handle_gt33_bound < 0) handle_gt33_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_gt33_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_gt33_bound ,gt33_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_gt33_bound, + "ML_BSSN_MP_O8::gt33", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_MP_O8::gt33!"); + + } + + if (CCTK_EQUALS(beta1_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_beta1_bound = -1; + if (handle_beta1_bound < 0) handle_beta1_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_beta1_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_beta1_bound ,beta1_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_beta1_bound, + "ML_BSSN_MP_O8::beta1", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_MP_O8::beta1!"); + + } + + if (CCTK_EQUALS(beta2_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_beta2_bound = -1; + if (handle_beta2_bound < 0) handle_beta2_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_beta2_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_beta2_bound ,beta2_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_beta2_bound, + "ML_BSSN_MP_O8::beta2", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_MP_O8::beta2!"); + + } + + if (CCTK_EQUALS(beta3_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_beta3_bound = -1; + if (handle_beta3_bound < 0) handle_beta3_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_beta3_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_beta3_bound ,beta3_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_beta3_bound, + "ML_BSSN_MP_O8::beta3", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_MP_O8::beta3!"); + + } + + if (CCTK_EQUALS(trK_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_trK_bound = -1; + if (handle_trK_bound < 0) handle_trK_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_trK_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_trK_bound ,trK_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_trK_bound, + "ML_BSSN_MP_O8::trK", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_MP_O8::trK!"); + + } + return; +} + + + +/* template for entries in parameter file: +#$bound$#ML_BSSN_MP_O8::ML_curv_bound = "skip" +#$bound$#ML_BSSN_MP_O8::ML_curv_bound_speed = 1.0 +#$bound$#ML_BSSN_MP_O8::ML_curv_bound_limit = 0.0 +#$bound$#ML_BSSN_MP_O8::ML_curv_bound_scalar = 0.0 + +#$bound$#ML_BSSN_MP_O8::ML_dtlapse_bound = "skip" +#$bound$#ML_BSSN_MP_O8::ML_dtlapse_bound_speed = 1.0 +#$bound$#ML_BSSN_MP_O8::ML_dtlapse_bound_limit = 0.0 +#$bound$#ML_BSSN_MP_O8::ML_dtlapse_bound_scalar = 0.0 + +#$bound$#ML_BSSN_MP_O8::ML_dtshift_bound = "skip" +#$bound$#ML_BSSN_MP_O8::ML_dtshift_bound_speed = 1.0 +#$bound$#ML_BSSN_MP_O8::ML_dtshift_bound_limit = 0.0 +#$bound$#ML_BSSN_MP_O8::ML_dtshift_bound_scalar = 0.0 + +#$bound$#ML_BSSN_MP_O8::ML_Gamma_bound = "skip" +#$bound$#ML_BSSN_MP_O8::ML_Gamma_bound_speed = 1.0 +#$bound$#ML_BSSN_MP_O8::ML_Gamma_bound_limit = 0.0 +#$bound$#ML_BSSN_MP_O8::ML_Gamma_bound_scalar = 0.0 + +#$bound$#ML_BSSN_MP_O8::ML_lapse_bound = "skip" +#$bound$#ML_BSSN_MP_O8::ML_lapse_bound_speed = 1.0 +#$bound$#ML_BSSN_MP_O8::ML_lapse_bound_limit = 0.0 +#$bound$#ML_BSSN_MP_O8::ML_lapse_bound_scalar = 0.0 + +#$bound$#ML_BSSN_MP_O8::ML_log_confac_bound = "skip" +#$bound$#ML_BSSN_MP_O8::ML_log_confac_bound_speed = 1.0 +#$bound$#ML_BSSN_MP_O8::ML_log_confac_bound_limit = 0.0 +#$bound$#ML_BSSN_MP_O8::ML_log_confac_bound_scalar = 0.0 + +#$bound$#ML_BSSN_MP_O8::ML_metric_bound = "skip" +#$bound$#ML_BSSN_MP_O8::ML_metric_bound_speed = 1.0 +#$bound$#ML_BSSN_MP_O8::ML_metric_bound_limit = 0.0 +#$bound$#ML_BSSN_MP_O8::ML_metric_bound_scalar = 0.0 + +#$bound$#ML_BSSN_MP_O8::ML_shift_bound = "skip" +#$bound$#ML_BSSN_MP_O8::ML_shift_bound_speed = 1.0 +#$bound$#ML_BSSN_MP_O8::ML_shift_bound_limit = 0.0 +#$bound$#ML_BSSN_MP_O8::ML_shift_bound_scalar = 0.0 + +#$bound$#ML_BSSN_MP_O8::ML_trace_curv_bound = "skip" +#$bound$#ML_BSSN_MP_O8::ML_trace_curv_bound_speed = 1.0 +#$bound$#ML_BSSN_MP_O8::ML_trace_curv_bound_limit = 0.0 +#$bound$#ML_BSSN_MP_O8::ML_trace_curv_bound_scalar = 0.0 + +#$bound$#ML_BSSN_MP_O8::At11_bound = "skip" +#$bound$#ML_BSSN_MP_O8::At11_bound_speed = 1.0 +#$bound$#ML_BSSN_MP_O8::At11_bound_limit = 0.0 +#$bound$#ML_BSSN_MP_O8::At11_bound_scalar = 0.0 + +#$bound$#ML_BSSN_MP_O8::At12_bound = "skip" +#$bound$#ML_BSSN_MP_O8::At12_bound_speed = 1.0 +#$bound$#ML_BSSN_MP_O8::At12_bound_limit = 0.0 +#$bound$#ML_BSSN_MP_O8::At12_bound_scalar = 0.0 + +#$bound$#ML_BSSN_MP_O8::At13_bound = "skip" +#$bound$#ML_BSSN_MP_O8::At13_bound_speed = 1.0 +#$bound$#ML_BSSN_MP_O8::At13_bound_limit = 0.0 +#$bound$#ML_BSSN_MP_O8::At13_bound_scalar = 0.0 + +#$bound$#ML_BSSN_MP_O8::At22_bound = "skip" +#$bound$#ML_BSSN_MP_O8::At22_bound_speed = 1.0 +#$bound$#ML_BSSN_MP_O8::At22_bound_limit = 0.0 +#$bound$#ML_BSSN_MP_O8::At22_bound_scalar = 0.0 + +#$bound$#ML_BSSN_MP_O8::At23_bound = "skip" +#$bound$#ML_BSSN_MP_O8::At23_bound_speed = 1.0 +#$bound$#ML_BSSN_MP_O8::At23_bound_limit = 0.0 +#$bound$#ML_BSSN_MP_O8::At23_bound_scalar = 0.0 + +#$bound$#ML_BSSN_MP_O8::At33_bound = "skip" +#$bound$#ML_BSSN_MP_O8::At33_bound_speed = 1.0 +#$bound$#ML_BSSN_MP_O8::At33_bound_limit = 0.0 +#$bound$#ML_BSSN_MP_O8::At33_bound_scalar = 0.0 + +#$bound$#ML_BSSN_MP_O8::A_bound = "skip" +#$bound$#ML_BSSN_MP_O8::A_bound_speed = 1.0 +#$bound$#ML_BSSN_MP_O8::A_bound_limit = 0.0 +#$bound$#ML_BSSN_MP_O8::A_bound_scalar = 0.0 + +#$bound$#ML_BSSN_MP_O8::B1_bound = "skip" +#$bound$#ML_BSSN_MP_O8::B1_bound_speed = 1.0 +#$bound$#ML_BSSN_MP_O8::B1_bound_limit = 0.0 +#$bound$#ML_BSSN_MP_O8::B1_bound_scalar = 0.0 + +#$bound$#ML_BSSN_MP_O8::B2_bound = "skip" +#$bound$#ML_BSSN_MP_O8::B2_bound_speed = 1.0 +#$bound$#ML_BSSN_MP_O8::B2_bound_limit = 0.0 +#$bound$#ML_BSSN_MP_O8::B2_bound_scalar = 0.0 + +#$bound$#ML_BSSN_MP_O8::B3_bound = "skip" +#$bound$#ML_BSSN_MP_O8::B3_bound_speed = 1.0 +#$bound$#ML_BSSN_MP_O8::B3_bound_limit = 0.0 +#$bound$#ML_BSSN_MP_O8::B3_bound_scalar = 0.0 + +#$bound$#ML_BSSN_MP_O8::Xt1_bound = "skip" +#$bound$#ML_BSSN_MP_O8::Xt1_bound_speed = 1.0 +#$bound$#ML_BSSN_MP_O8::Xt1_bound_limit = 0.0 +#$bound$#ML_BSSN_MP_O8::Xt1_bound_scalar = 0.0 + +#$bound$#ML_BSSN_MP_O8::Xt2_bound = "skip" +#$bound$#ML_BSSN_MP_O8::Xt2_bound_speed = 1.0 +#$bound$#ML_BSSN_MP_O8::Xt2_bound_limit = 0.0 +#$bound$#ML_BSSN_MP_O8::Xt2_bound_scalar = 0.0 + +#$bound$#ML_BSSN_MP_O8::Xt3_bound = "skip" +#$bound$#ML_BSSN_MP_O8::Xt3_bound_speed = 1.0 +#$bound$#ML_BSSN_MP_O8::Xt3_bound_limit = 0.0 +#$bound$#ML_BSSN_MP_O8::Xt3_bound_scalar = 0.0 + +#$bound$#ML_BSSN_MP_O8::alpha_bound = "skip" +#$bound$#ML_BSSN_MP_O8::alpha_bound_speed = 1.0 +#$bound$#ML_BSSN_MP_O8::alpha_bound_limit = 0.0 +#$bound$#ML_BSSN_MP_O8::alpha_bound_scalar = 0.0 + +#$bound$#ML_BSSN_MP_O8::phi_bound = "skip" +#$bound$#ML_BSSN_MP_O8::phi_bound_speed = 1.0 +#$bound$#ML_BSSN_MP_O8::phi_bound_limit = 0.0 +#$bound$#ML_BSSN_MP_O8::phi_bound_scalar = 0.0 + +#$bound$#ML_BSSN_MP_O8::gt11_bound = "skip" +#$bound$#ML_BSSN_MP_O8::gt11_bound_speed = 1.0 +#$bound$#ML_BSSN_MP_O8::gt11_bound_limit = 0.0 +#$bound$#ML_BSSN_MP_O8::gt11_bound_scalar = 0.0 + +#$bound$#ML_BSSN_MP_O8::gt12_bound = "skip" +#$bound$#ML_BSSN_MP_O8::gt12_bound_speed = 1.0 +#$bound$#ML_BSSN_MP_O8::gt12_bound_limit = 0.0 +#$bound$#ML_BSSN_MP_O8::gt12_bound_scalar = 0.0 + +#$bound$#ML_BSSN_MP_O8::gt13_bound = "skip" +#$bound$#ML_BSSN_MP_O8::gt13_bound_speed = 1.0 +#$bound$#ML_BSSN_MP_O8::gt13_bound_limit = 0.0 +#$bound$#ML_BSSN_MP_O8::gt13_bound_scalar = 0.0 + +#$bound$#ML_BSSN_MP_O8::gt22_bound = "skip" +#$bound$#ML_BSSN_MP_O8::gt22_bound_speed = 1.0 +#$bound$#ML_BSSN_MP_O8::gt22_bound_limit = 0.0 +#$bound$#ML_BSSN_MP_O8::gt22_bound_scalar = 0.0 + +#$bound$#ML_BSSN_MP_O8::gt23_bound = "skip" +#$bound$#ML_BSSN_MP_O8::gt23_bound_speed = 1.0 +#$bound$#ML_BSSN_MP_O8::gt23_bound_limit = 0.0 +#$bound$#ML_BSSN_MP_O8::gt23_bound_scalar = 0.0 + +#$bound$#ML_BSSN_MP_O8::gt33_bound = "skip" +#$bound$#ML_BSSN_MP_O8::gt33_bound_speed = 1.0 +#$bound$#ML_BSSN_MP_O8::gt33_bound_limit = 0.0 +#$bound$#ML_BSSN_MP_O8::gt33_bound_scalar = 0.0 + +#$bound$#ML_BSSN_MP_O8::beta1_bound = "skip" +#$bound$#ML_BSSN_MP_O8::beta1_bound_speed = 1.0 +#$bound$#ML_BSSN_MP_O8::beta1_bound_limit = 0.0 +#$bound$#ML_BSSN_MP_O8::beta1_bound_scalar = 0.0 + +#$bound$#ML_BSSN_MP_O8::beta2_bound = "skip" +#$bound$#ML_BSSN_MP_O8::beta2_bound_speed = 1.0 +#$bound$#ML_BSSN_MP_O8::beta2_bound_limit = 0.0 +#$bound$#ML_BSSN_MP_O8::beta2_bound_scalar = 0.0 + +#$bound$#ML_BSSN_MP_O8::beta3_bound = "skip" +#$bound$#ML_BSSN_MP_O8::beta3_bound_speed = 1.0 +#$bound$#ML_BSSN_MP_O8::beta3_bound_limit = 0.0 +#$bound$#ML_BSSN_MP_O8::beta3_bound_scalar = 0.0 + +#$bound$#ML_BSSN_MP_O8::trK_bound = "skip" +#$bound$#ML_BSSN_MP_O8::trK_bound_speed = 1.0 +#$bound$#ML_BSSN_MP_O8::trK_bound_limit = 0.0 +#$bound$#ML_BSSN_MP_O8::trK_bound_scalar = 0.0 + +*/ + diff --git a/ML_BSSN_MP_O8/src/ML_BSSN_MP_O8_Minkowski.cc b/ML_BSSN_MP_O8/src/ML_BSSN_MP_O8_Minkowski.cc new file mode 100644 index 0000000..566f613 --- /dev/null +++ b/ML_BSSN_MP_O8/src/ML_BSSN_MP_O8_Minkowski.cc @@ -0,0 +1,193 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +static void ML_BSSN_MP_O8_Minkowski_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_BSSN_MP_O8_Minkowski_Body"); + } + + if (cctk_iteration % ML_BSSN_MP_O8_Minkowski_calc_every != ML_BSSN_MP_O8_Minkowski_calc_offset) + { + return; + } + + const char *groups[] = {"ML_BSSN_MP_O8::ML_curv","ML_BSSN_MP_O8::ML_dtlapse","ML_BSSN_MP_O8::ML_dtshift","ML_BSSN_MP_O8::ML_Gamma","ML_BSSN_MP_O8::ML_lapse","ML_BSSN_MP_O8::ML_log_confac","ML_BSSN_MP_O8::ML_metric","ML_BSSN_MP_O8::ML_shift","ML_BSSN_MP_O8::ML_trace_curv"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_BSSN_MP_O8_Minkowski", 9, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o1024dx = 0.0009765625*INV(dx); + CCTK_REAL const p1o1024dy = 0.0009765625*INV(dy); + CCTK_REAL const p1o1024dz = 0.0009765625*INV(dz); + CCTK_REAL const p1o1680dx = 0.000595238095238095238095238095238*INV(dx); + CCTK_REAL const p1o1680dy = 0.000595238095238095238095238095238*INV(dy); + CCTK_REAL const p1o1680dz = 0.000595238095238095238095238095238*INV(dz); + CCTK_REAL const p1o5040dx2 = 0.000198412698412698412698412698413*INV(SQR(dx)); + CCTK_REAL const p1o5040dy2 = 0.000198412698412698412698412698413*INV(SQR(dy)); + CCTK_REAL const p1o5040dz2 = 0.000198412698412698412698412698413*INV(SQR(dz)); + CCTK_REAL const p1o560dx = 0.00178571428571428571428571428571*INV(dx); + CCTK_REAL const p1o560dy = 0.00178571428571428571428571428571*INV(dy); + CCTK_REAL const p1o560dz = 0.00178571428571428571428571428571*INV(dz); + CCTK_REAL const p1o705600dxdy = 1.41723356009070294784580498866e-6*INV(dx)*INV(dy); + CCTK_REAL const p1o705600dxdz = 1.41723356009070294784580498866e-6*INV(dx)*INV(dz); + CCTK_REAL const p1o705600dydz = 1.41723356009070294784580498866e-6*INV(dy)*INV(dz); + CCTK_REAL const p1o840dx = 0.00119047619047619047619047619048*INV(dx); + CCTK_REAL const p1o840dy = 0.00119047619047619047619047619048*INV(dy); + CCTK_REAL const p1o840dz = 0.00119047619047619047619047619048*INV(dz); + CCTK_REAL const p1odx = INV(dx); + CCTK_REAL const p1ody = INV(dy); + CCTK_REAL const p1odz = INV(dz); + CCTK_REAL const pm1o840dx = -0.00119047619047619047619047619048*INV(dx); + CCTK_REAL const pm1o840dy = -0.00119047619047619047619047619048*INV(dy); + CCTK_REAL const pm1o840dz = -0.00119047619047619047619047619048*INV(dz); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_BSSN_MP_O8_Minkowski, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + + /* Include user supplied include files */ + + /* Precompute derivatives */ + + /* Calculate temporaries and grid functions */ + CCTK_REAL phiL = IfThen(ToReal(conformalMethod),1,0); + + CCTK_REAL gt11L = 1; + + CCTK_REAL gt12L = 0; + + CCTK_REAL gt13L = 0; + + CCTK_REAL gt22L = 1; + + CCTK_REAL gt23L = 0; + + CCTK_REAL gt33L = 1; + + CCTK_REAL trKL = 0; + + CCTK_REAL At11L = 0; + + CCTK_REAL At12L = 0; + + CCTK_REAL At13L = 0; + + CCTK_REAL At22L = 0; + + CCTK_REAL At23L = 0; + + CCTK_REAL At33L = 0; + + CCTK_REAL Xt1L = 0; + + CCTK_REAL Xt2L = 0; + + CCTK_REAL Xt3L = 0; + + CCTK_REAL alphaL = 1; + + CCTK_REAL AL = 0; + + CCTK_REAL beta1L = 0; + + CCTK_REAL beta2L = 0; + + CCTK_REAL beta3L = 0; + + CCTK_REAL B1L = 0; + + CCTK_REAL B2L = 0; + + CCTK_REAL B3L = 0; + + + /* Copy local copies back to grid functions */ + A[index] = AL; + alpha[index] = alphaL; + At11[index] = At11L; + At12[index] = At12L; + At13[index] = At13L; + At22[index] = At22L; + At23[index] = At23L; + At33[index] = At33L; + B1[index] = B1L; + B2[index] = B2L; + B3[index] = B3L; + beta1[index] = beta1L; + beta2[index] = beta2L; + beta3[index] = beta3L; + gt11[index] = gt11L; + gt12[index] = gt12L; + gt13[index] = gt13L; + gt22[index] = gt22L; + gt23[index] = gt23L; + gt33[index] = gt33L; + phi[index] = phiL; + trK[index] = trKL; + Xt1[index] = Xt1L; + Xt2[index] = Xt2L; + Xt3[index] = Xt3L; + } + LC_ENDLOOP3 (ML_BSSN_MP_O8_Minkowski); +} + +extern "C" void ML_BSSN_MP_O8_Minkowski(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverEverything(cctkGH, &ML_BSSN_MP_O8_Minkowski_Body); +} diff --git a/ML_BSSN_MP_O8/src/ML_BSSN_MP_O8_RHS1.cc b/ML_BSSN_MP_O8/src/ML_BSSN_MP_O8_RHS1.cc new file mode 100644 index 0000000..3a8f0d8 --- /dev/null +++ b/ML_BSSN_MP_O8/src/ML_BSSN_MP_O8_RHS1.cc @@ -0,0 +1,1378 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +extern "C" void ML_BSSN_MP_O8_RHS1_SelectBCs(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT ierr = 0; + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_MP_O8::ML_dtlapserhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_MP_O8::ML_dtlapserhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_MP_O8::ML_dtshiftrhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_MP_O8::ML_dtshiftrhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_MP_O8::ML_Gammarhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_MP_O8::ML_Gammarhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_MP_O8::ML_lapserhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_MP_O8::ML_lapserhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_MP_O8::ML_log_confacrhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_MP_O8::ML_log_confacrhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_MP_O8::ML_metricrhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_MP_O8::ML_metricrhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_MP_O8::ML_shiftrhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_MP_O8::ML_shiftrhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_MP_O8::ML_trace_curvrhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_MP_O8::ML_trace_curvrhs."); + return; +} + +static void ML_BSSN_MP_O8_RHS1_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_BSSN_MP_O8_RHS1_Body"); + } + + if (cctk_iteration % ML_BSSN_MP_O8_RHS1_calc_every != ML_BSSN_MP_O8_RHS1_calc_offset) + { + return; + } + + const char *groups[] = {"Coordinates::jacobian","Coordinates::jacobian2","grid::coordinates","Grid::coordinates","ML_BSSN_MP_O8::ML_curv","ML_BSSN_MP_O8::ML_dtlapse","ML_BSSN_MP_O8::ML_dtlapserhs","ML_BSSN_MP_O8::ML_dtshift","ML_BSSN_MP_O8::ML_dtshiftrhs","ML_BSSN_MP_O8::ML_Gamma","ML_BSSN_MP_O8::ML_Gammarhs","ML_BSSN_MP_O8::ML_lapse","ML_BSSN_MP_O8::ML_lapserhs","ML_BSSN_MP_O8::ML_log_confac","ML_BSSN_MP_O8::ML_log_confacrhs","ML_BSSN_MP_O8::ML_metric","ML_BSSN_MP_O8::ML_metricrhs","ML_BSSN_MP_O8::ML_shift","ML_BSSN_MP_O8::ML_shiftrhs","ML_BSSN_MP_O8::ML_trace_curv","ML_BSSN_MP_O8::ML_trace_curvrhs"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_BSSN_MP_O8_RHS1", 21, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o1024dx = 0.0009765625*INV(dx); + CCTK_REAL const p1o1024dy = 0.0009765625*INV(dy); + CCTK_REAL const p1o1024dz = 0.0009765625*INV(dz); + CCTK_REAL const p1o1680dx = 0.000595238095238095238095238095238*INV(dx); + CCTK_REAL const p1o1680dy = 0.000595238095238095238095238095238*INV(dy); + CCTK_REAL const p1o1680dz = 0.000595238095238095238095238095238*INV(dz); + CCTK_REAL const p1o5040dx2 = 0.000198412698412698412698412698413*INV(SQR(dx)); + CCTK_REAL const p1o5040dy2 = 0.000198412698412698412698412698413*INV(SQR(dy)); + CCTK_REAL const p1o5040dz2 = 0.000198412698412698412698412698413*INV(SQR(dz)); + CCTK_REAL const p1o560dx = 0.00178571428571428571428571428571*INV(dx); + CCTK_REAL const p1o560dy = 0.00178571428571428571428571428571*INV(dy); + CCTK_REAL const p1o560dz = 0.00178571428571428571428571428571*INV(dz); + CCTK_REAL const p1o705600dxdy = 1.41723356009070294784580498866e-6*INV(dx)*INV(dy); + CCTK_REAL const p1o705600dxdz = 1.41723356009070294784580498866e-6*INV(dx)*INV(dz); + CCTK_REAL const p1o705600dydz = 1.41723356009070294784580498866e-6*INV(dy)*INV(dz); + CCTK_REAL const p1o840dx = 0.00119047619047619047619047619048*INV(dx); + CCTK_REAL const p1o840dy = 0.00119047619047619047619047619048*INV(dy); + CCTK_REAL const p1o840dz = 0.00119047619047619047619047619048*INV(dz); + CCTK_REAL const p1odx = INV(dx); + CCTK_REAL const p1ody = INV(dy); + CCTK_REAL const p1odz = INV(dz); + CCTK_REAL const pm1o840dx = -0.00119047619047619047619047619048*INV(dx); + CCTK_REAL const pm1o840dy = -0.00119047619047619047619047619048*INV(dy); + CCTK_REAL const pm1o840dz = -0.00119047619047619047619047619048*INV(dz); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_BSSN_MP_O8_RHS1, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + CCTK_REAL AL = A[index]; + CCTK_REAL alphaL = alpha[index]; + CCTK_REAL At11L = At11[index]; + CCTK_REAL At12L = At12[index]; + CCTK_REAL At13L = At13[index]; + CCTK_REAL At22L = At22[index]; + CCTK_REAL At23L = At23[index]; + CCTK_REAL At33L = At33[index]; + CCTK_REAL B1L = B1[index]; + CCTK_REAL B2L = B2[index]; + CCTK_REAL B3L = B3[index]; + CCTK_REAL beta1L = beta1[index]; + CCTK_REAL beta2L = beta2[index]; + CCTK_REAL beta3L = beta3[index]; + CCTK_REAL dJ111L = dJ111[index]; + CCTK_REAL dJ112L = dJ112[index]; + CCTK_REAL dJ113L = dJ113[index]; + CCTK_REAL dJ122L = dJ122[index]; + CCTK_REAL dJ123L = dJ123[index]; + CCTK_REAL dJ133L = dJ133[index]; + CCTK_REAL dJ211L = dJ211[index]; + CCTK_REAL dJ212L = dJ212[index]; + CCTK_REAL dJ213L = dJ213[index]; + CCTK_REAL dJ222L = dJ222[index]; + CCTK_REAL dJ223L = dJ223[index]; + CCTK_REAL dJ233L = dJ233[index]; + CCTK_REAL dJ311L = dJ311[index]; + CCTK_REAL dJ312L = dJ312[index]; + CCTK_REAL dJ313L = dJ313[index]; + CCTK_REAL dJ322L = dJ322[index]; + CCTK_REAL dJ323L = dJ323[index]; + CCTK_REAL dJ333L = dJ333[index]; + CCTK_REAL eTttL = (*stress_energy_state) ? eTtt[index] : ToReal(0.0); + CCTK_REAL eTtxL = (*stress_energy_state) ? eTtx[index] : ToReal(0.0); + CCTK_REAL eTtyL = (*stress_energy_state) ? eTty[index] : ToReal(0.0); + CCTK_REAL eTtzL = (*stress_energy_state) ? eTtz[index] : ToReal(0.0); + CCTK_REAL eTxxL = (*stress_energy_state) ? eTxx[index] : ToReal(0.0); + CCTK_REAL eTxyL = (*stress_energy_state) ? eTxy[index] : ToReal(0.0); + CCTK_REAL eTxzL = (*stress_energy_state) ? eTxz[index] : ToReal(0.0); + CCTK_REAL eTyyL = (*stress_energy_state) ? eTyy[index] : ToReal(0.0); + CCTK_REAL eTyzL = (*stress_energy_state) ? eTyz[index] : ToReal(0.0); + CCTK_REAL eTzzL = (*stress_energy_state) ? eTzz[index] : ToReal(0.0); + CCTK_REAL gt11L = gt11[index]; + CCTK_REAL gt12L = gt12[index]; + CCTK_REAL gt13L = gt13[index]; + CCTK_REAL gt22L = gt22[index]; + CCTK_REAL gt23L = gt23[index]; + CCTK_REAL gt33L = gt33[index]; + CCTK_REAL J11L = J11[index]; + CCTK_REAL J12L = J12[index]; + CCTK_REAL J13L = J13[index]; + CCTK_REAL J21L = J21[index]; + CCTK_REAL J22L = J22[index]; + CCTK_REAL J23L = J23[index]; + CCTK_REAL J31L = J31[index]; + CCTK_REAL J32L = J32[index]; + CCTK_REAL J33L = J33[index]; + CCTK_REAL phiL = phi[index]; + CCTK_REAL rL = r[index]; + CCTK_REAL trKL = trK[index]; + CCTK_REAL Xt1L = Xt1[index]; + CCTK_REAL Xt2L = Xt2[index]; + CCTK_REAL Xt3L = Xt3[index]; + + /* Include user supplied include files */ + + /* Precompute derivatives */ + CCTK_REAL const PDdissipationNth1A = PDdissipationNth1(&A[index]); + CCTK_REAL const PDdissipationNth2A = PDdissipationNth2(&A[index]); + CCTK_REAL const PDdissipationNth3A = PDdissipationNth3(&A[index]); + CCTK_REAL const PDupwindNthAnti1A = PDupwindNthAnti1(&A[index]); + CCTK_REAL const PDupwindNthSymm1A = PDupwindNthSymm1(&A[index]); + CCTK_REAL const PDupwindNthAnti2A = PDupwindNthAnti2(&A[index]); + CCTK_REAL const PDupwindNthSymm2A = PDupwindNthSymm2(&A[index]); + CCTK_REAL const PDupwindNthAnti3A = PDupwindNthAnti3(&A[index]); + CCTK_REAL const PDupwindNthSymm3A = PDupwindNthSymm3(&A[index]); + CCTK_REAL const PDstandardNth1alpha = PDstandardNth1(&alpha[index]); + CCTK_REAL const PDstandardNth2alpha = PDstandardNth2(&alpha[index]); + CCTK_REAL const PDstandardNth3alpha = PDstandardNth3(&alpha[index]); + CCTK_REAL const PDstandardNth11alpha = PDstandardNth11(&alpha[index]); + CCTK_REAL const PDstandardNth22alpha = PDstandardNth22(&alpha[index]); + CCTK_REAL const PDstandardNth33alpha = PDstandardNth33(&alpha[index]); + CCTK_REAL const PDstandardNth12alpha = PDstandardNth12(&alpha[index]); + CCTK_REAL const PDstandardNth13alpha = PDstandardNth13(&alpha[index]); + CCTK_REAL const PDstandardNth23alpha = PDstandardNth23(&alpha[index]); + CCTK_REAL const PDdissipationNth1alpha = PDdissipationNth1(&alpha[index]); + CCTK_REAL const PDdissipationNth2alpha = PDdissipationNth2(&alpha[index]); + CCTK_REAL const PDdissipationNth3alpha = PDdissipationNth3(&alpha[index]); + CCTK_REAL const PDupwindNthAnti1alpha = PDupwindNthAnti1(&alpha[index]); + CCTK_REAL const PDupwindNthSymm1alpha = PDupwindNthSymm1(&alpha[index]); + CCTK_REAL const PDupwindNthAnti2alpha = PDupwindNthAnti2(&alpha[index]); + CCTK_REAL const PDupwindNthSymm2alpha = PDupwindNthSymm2(&alpha[index]); + CCTK_REAL const PDupwindNthAnti3alpha = PDupwindNthAnti3(&alpha[index]); + CCTK_REAL const PDupwindNthSymm3alpha = PDupwindNthSymm3(&alpha[index]); + CCTK_REAL const PDdissipationNth1B1 = PDdissipationNth1(&B1[index]); + CCTK_REAL const PDdissipationNth2B1 = PDdissipationNth2(&B1[index]); + CCTK_REAL const PDdissipationNth3B1 = PDdissipationNth3(&B1[index]); + CCTK_REAL const PDupwindNthAnti1B1 = PDupwindNthAnti1(&B1[index]); + CCTK_REAL const PDupwindNthSymm1B1 = PDupwindNthSymm1(&B1[index]); + CCTK_REAL const PDupwindNthAnti2B1 = PDupwindNthAnti2(&B1[index]); + CCTK_REAL const PDupwindNthSymm2B1 = PDupwindNthSymm2(&B1[index]); + CCTK_REAL const PDupwindNthAnti3B1 = PDupwindNthAnti3(&B1[index]); + CCTK_REAL const PDupwindNthSymm3B1 = PDupwindNthSymm3(&B1[index]); + CCTK_REAL const PDdissipationNth1B2 = PDdissipationNth1(&B2[index]); + CCTK_REAL const PDdissipationNth2B2 = PDdissipationNth2(&B2[index]); + CCTK_REAL const PDdissipationNth3B2 = PDdissipationNth3(&B2[index]); + CCTK_REAL const PDupwindNthAnti1B2 = PDupwindNthAnti1(&B2[index]); + CCTK_REAL const PDupwindNthSymm1B2 = PDupwindNthSymm1(&B2[index]); + CCTK_REAL const PDupwindNthAnti2B2 = PDupwindNthAnti2(&B2[index]); + CCTK_REAL const PDupwindNthSymm2B2 = PDupwindNthSymm2(&B2[index]); + CCTK_REAL const PDupwindNthAnti3B2 = PDupwindNthAnti3(&B2[index]); + CCTK_REAL const PDupwindNthSymm3B2 = PDupwindNthSymm3(&B2[index]); + CCTK_REAL const PDdissipationNth1B3 = PDdissipationNth1(&B3[index]); + CCTK_REAL const PDdissipationNth2B3 = PDdissipationNth2(&B3[index]); + CCTK_REAL const PDdissipationNth3B3 = PDdissipationNth3(&B3[index]); + CCTK_REAL const PDupwindNthAnti1B3 = PDupwindNthAnti1(&B3[index]); + CCTK_REAL const PDupwindNthSymm1B3 = PDupwindNthSymm1(&B3[index]); + CCTK_REAL const PDupwindNthAnti2B3 = PDupwindNthAnti2(&B3[index]); + CCTK_REAL const PDupwindNthSymm2B3 = PDupwindNthSymm2(&B3[index]); + CCTK_REAL const PDupwindNthAnti3B3 = PDupwindNthAnti3(&B3[index]); + CCTK_REAL const PDupwindNthSymm3B3 = PDupwindNthSymm3(&B3[index]); + CCTK_REAL const PDstandardNth1beta1 = PDstandardNth1(&beta1[index]); + CCTK_REAL const PDstandardNth2beta1 = PDstandardNth2(&beta1[index]); + CCTK_REAL const PDstandardNth3beta1 = PDstandardNth3(&beta1[index]); + CCTK_REAL const PDstandardNth11beta1 = PDstandardNth11(&beta1[index]); + CCTK_REAL const PDstandardNth22beta1 = PDstandardNth22(&beta1[index]); + CCTK_REAL const PDstandardNth33beta1 = PDstandardNth33(&beta1[index]); + CCTK_REAL const PDstandardNth12beta1 = PDstandardNth12(&beta1[index]); + CCTK_REAL const PDstandardNth13beta1 = PDstandardNth13(&beta1[index]); + CCTK_REAL const PDstandardNth23beta1 = PDstandardNth23(&beta1[index]); + CCTK_REAL const PDdissipationNth1beta1 = PDdissipationNth1(&beta1[index]); + CCTK_REAL const PDdissipationNth2beta1 = PDdissipationNth2(&beta1[index]); + CCTK_REAL const PDdissipationNth3beta1 = PDdissipationNth3(&beta1[index]); + CCTK_REAL const PDupwindNthAnti1beta1 = PDupwindNthAnti1(&beta1[index]); + CCTK_REAL const PDupwindNthSymm1beta1 = PDupwindNthSymm1(&beta1[index]); + CCTK_REAL const PDupwindNthAnti2beta1 = PDupwindNthAnti2(&beta1[index]); + CCTK_REAL const PDupwindNthSymm2beta1 = PDupwindNthSymm2(&beta1[index]); + CCTK_REAL const PDupwindNthAnti3beta1 = PDupwindNthAnti3(&beta1[index]); + CCTK_REAL const PDupwindNthSymm3beta1 = PDupwindNthSymm3(&beta1[index]); + CCTK_REAL const PDstandardNth1beta2 = PDstandardNth1(&beta2[index]); + CCTK_REAL const PDstandardNth2beta2 = PDstandardNth2(&beta2[index]); + CCTK_REAL const PDstandardNth3beta2 = PDstandardNth3(&beta2[index]); + CCTK_REAL const PDstandardNth11beta2 = PDstandardNth11(&beta2[index]); + CCTK_REAL const PDstandardNth22beta2 = PDstandardNth22(&beta2[index]); + CCTK_REAL const PDstandardNth33beta2 = PDstandardNth33(&beta2[index]); + CCTK_REAL const PDstandardNth12beta2 = PDstandardNth12(&beta2[index]); + CCTK_REAL const PDstandardNth13beta2 = PDstandardNth13(&beta2[index]); + CCTK_REAL const PDstandardNth23beta2 = PDstandardNth23(&beta2[index]); + CCTK_REAL const PDdissipationNth1beta2 = PDdissipationNth1(&beta2[index]); + CCTK_REAL const PDdissipationNth2beta2 = PDdissipationNth2(&beta2[index]); + CCTK_REAL const PDdissipationNth3beta2 = PDdissipationNth3(&beta2[index]); + CCTK_REAL const PDupwindNthAnti1beta2 = PDupwindNthAnti1(&beta2[index]); + CCTK_REAL const PDupwindNthSymm1beta2 = PDupwindNthSymm1(&beta2[index]); + CCTK_REAL const PDupwindNthAnti2beta2 = PDupwindNthAnti2(&beta2[index]); + CCTK_REAL const PDupwindNthSymm2beta2 = PDupwindNthSymm2(&beta2[index]); + CCTK_REAL const PDupwindNthAnti3beta2 = PDupwindNthAnti3(&beta2[index]); + CCTK_REAL const PDupwindNthSymm3beta2 = PDupwindNthSymm3(&beta2[index]); + CCTK_REAL const PDstandardNth1beta3 = PDstandardNth1(&beta3[index]); + CCTK_REAL const PDstandardNth2beta3 = PDstandardNth2(&beta3[index]); + CCTK_REAL const PDstandardNth3beta3 = PDstandardNth3(&beta3[index]); + CCTK_REAL const PDstandardNth11beta3 = PDstandardNth11(&beta3[index]); + CCTK_REAL const PDstandardNth22beta3 = PDstandardNth22(&beta3[index]); + CCTK_REAL const PDstandardNth33beta3 = PDstandardNth33(&beta3[index]); + CCTK_REAL const PDstandardNth12beta3 = PDstandardNth12(&beta3[index]); + CCTK_REAL const PDstandardNth13beta3 = PDstandardNth13(&beta3[index]); + CCTK_REAL const PDstandardNth23beta3 = PDstandardNth23(&beta3[index]); + CCTK_REAL const PDdissipationNth1beta3 = PDdissipationNth1(&beta3[index]); + CCTK_REAL const PDdissipationNth2beta3 = PDdissipationNth2(&beta3[index]); + CCTK_REAL const PDdissipationNth3beta3 = PDdissipationNth3(&beta3[index]); + CCTK_REAL const PDupwindNthAnti1beta3 = PDupwindNthAnti1(&beta3[index]); + CCTK_REAL const PDupwindNthSymm1beta3 = PDupwindNthSymm1(&beta3[index]); + CCTK_REAL const PDupwindNthAnti2beta3 = PDupwindNthAnti2(&beta3[index]); + CCTK_REAL const PDupwindNthSymm2beta3 = PDupwindNthSymm2(&beta3[index]); + CCTK_REAL const PDupwindNthAnti3beta3 = PDupwindNthAnti3(&beta3[index]); + CCTK_REAL const PDupwindNthSymm3beta3 = PDupwindNthSymm3(&beta3[index]); + CCTK_REAL const PDstandardNth1gt11 = PDstandardNth1(>11[index]); + CCTK_REAL const PDstandardNth2gt11 = PDstandardNth2(>11[index]); + CCTK_REAL const PDstandardNth3gt11 = PDstandardNth3(>11[index]); + CCTK_REAL const PDdissipationNth1gt11 = PDdissipationNth1(>11[index]); + CCTK_REAL const PDdissipationNth2gt11 = PDdissipationNth2(>11[index]); + CCTK_REAL const PDdissipationNth3gt11 = PDdissipationNth3(>11[index]); + CCTK_REAL const PDupwindNthAnti1gt11 = PDupwindNthAnti1(>11[index]); + CCTK_REAL const PDupwindNthSymm1gt11 = PDupwindNthSymm1(>11[index]); + CCTK_REAL const PDupwindNthAnti2gt11 = PDupwindNthAnti2(>11[index]); + CCTK_REAL const PDupwindNthSymm2gt11 = PDupwindNthSymm2(>11[index]); + CCTK_REAL const PDupwindNthAnti3gt11 = PDupwindNthAnti3(>11[index]); + CCTK_REAL const PDupwindNthSymm3gt11 = PDupwindNthSymm3(>11[index]); + CCTK_REAL const PDstandardNth1gt12 = PDstandardNth1(>12[index]); + CCTK_REAL const PDstandardNth2gt12 = PDstandardNth2(>12[index]); + CCTK_REAL const PDstandardNth3gt12 = PDstandardNth3(>12[index]); + CCTK_REAL const PDdissipationNth1gt12 = PDdissipationNth1(>12[index]); + CCTK_REAL const PDdissipationNth2gt12 = PDdissipationNth2(>12[index]); + CCTK_REAL const PDdissipationNth3gt12 = PDdissipationNth3(>12[index]); + CCTK_REAL const PDupwindNthAnti1gt12 = PDupwindNthAnti1(>12[index]); + CCTK_REAL const PDupwindNthSymm1gt12 = PDupwindNthSymm1(>12[index]); + CCTK_REAL const PDupwindNthAnti2gt12 = PDupwindNthAnti2(>12[index]); + CCTK_REAL const PDupwindNthSymm2gt12 = PDupwindNthSymm2(>12[index]); + CCTK_REAL const PDupwindNthAnti3gt12 = PDupwindNthAnti3(>12[index]); + CCTK_REAL const PDupwindNthSymm3gt12 = PDupwindNthSymm3(>12[index]); + CCTK_REAL const PDstandardNth1gt13 = PDstandardNth1(>13[index]); + CCTK_REAL const PDstandardNth2gt13 = PDstandardNth2(>13[index]); + CCTK_REAL const PDstandardNth3gt13 = PDstandardNth3(>13[index]); + CCTK_REAL const PDdissipationNth1gt13 = PDdissipationNth1(>13[index]); + CCTK_REAL const PDdissipationNth2gt13 = PDdissipationNth2(>13[index]); + CCTK_REAL const PDdissipationNth3gt13 = PDdissipationNth3(>13[index]); + CCTK_REAL const PDupwindNthAnti1gt13 = PDupwindNthAnti1(>13[index]); + CCTK_REAL const PDupwindNthSymm1gt13 = PDupwindNthSymm1(>13[index]); + CCTK_REAL const PDupwindNthAnti2gt13 = PDupwindNthAnti2(>13[index]); + CCTK_REAL const PDupwindNthSymm2gt13 = PDupwindNthSymm2(>13[index]); + CCTK_REAL const PDupwindNthAnti3gt13 = PDupwindNthAnti3(>13[index]); + CCTK_REAL const PDupwindNthSymm3gt13 = PDupwindNthSymm3(>13[index]); + CCTK_REAL const PDstandardNth1gt22 = PDstandardNth1(>22[index]); + CCTK_REAL const PDstandardNth2gt22 = PDstandardNth2(>22[index]); + CCTK_REAL const PDstandardNth3gt22 = PDstandardNth3(>22[index]); + CCTK_REAL const PDdissipationNth1gt22 = PDdissipationNth1(>22[index]); + CCTK_REAL const PDdissipationNth2gt22 = PDdissipationNth2(>22[index]); + CCTK_REAL const PDdissipationNth3gt22 = PDdissipationNth3(>22[index]); + CCTK_REAL const PDupwindNthAnti1gt22 = PDupwindNthAnti1(>22[index]); + CCTK_REAL const PDupwindNthSymm1gt22 = PDupwindNthSymm1(>22[index]); + CCTK_REAL const PDupwindNthAnti2gt22 = PDupwindNthAnti2(>22[index]); + CCTK_REAL const PDupwindNthSymm2gt22 = PDupwindNthSymm2(>22[index]); + CCTK_REAL const PDupwindNthAnti3gt22 = PDupwindNthAnti3(>22[index]); + CCTK_REAL const PDupwindNthSymm3gt22 = PDupwindNthSymm3(>22[index]); + CCTK_REAL const PDstandardNth1gt23 = PDstandardNth1(>23[index]); + CCTK_REAL const PDstandardNth2gt23 = PDstandardNth2(>23[index]); + CCTK_REAL const PDstandardNth3gt23 = PDstandardNth3(>23[index]); + CCTK_REAL const PDdissipationNth1gt23 = PDdissipationNth1(>23[index]); + CCTK_REAL const PDdissipationNth2gt23 = PDdissipationNth2(>23[index]); + CCTK_REAL const PDdissipationNth3gt23 = PDdissipationNth3(>23[index]); + CCTK_REAL const PDupwindNthAnti1gt23 = PDupwindNthAnti1(>23[index]); + CCTK_REAL const PDupwindNthSymm1gt23 = PDupwindNthSymm1(>23[index]); + CCTK_REAL const PDupwindNthAnti2gt23 = PDupwindNthAnti2(>23[index]); + CCTK_REAL const PDupwindNthSymm2gt23 = PDupwindNthSymm2(>23[index]); + CCTK_REAL const PDupwindNthAnti3gt23 = PDupwindNthAnti3(>23[index]); + CCTK_REAL const PDupwindNthSymm3gt23 = PDupwindNthSymm3(>23[index]); + CCTK_REAL const PDstandardNth1gt33 = PDstandardNth1(>33[index]); + CCTK_REAL const PDstandardNth2gt33 = PDstandardNth2(>33[index]); + CCTK_REAL const PDstandardNth3gt33 = PDstandardNth3(>33[index]); + CCTK_REAL const PDdissipationNth1gt33 = PDdissipationNth1(>33[index]); + CCTK_REAL const PDdissipationNth2gt33 = PDdissipationNth2(>33[index]); + CCTK_REAL const PDdissipationNth3gt33 = PDdissipationNth3(>33[index]); + CCTK_REAL const PDupwindNthAnti1gt33 = PDupwindNthAnti1(>33[index]); + CCTK_REAL const PDupwindNthSymm1gt33 = PDupwindNthSymm1(>33[index]); + CCTK_REAL const PDupwindNthAnti2gt33 = PDupwindNthAnti2(>33[index]); + CCTK_REAL const PDupwindNthSymm2gt33 = PDupwindNthSymm2(>33[index]); + CCTK_REAL const PDupwindNthAnti3gt33 = PDupwindNthAnti3(>33[index]); + CCTK_REAL const PDupwindNthSymm3gt33 = PDupwindNthSymm3(>33[index]); + CCTK_REAL const PDstandardNth1phi = PDstandardNth1(&phi[index]); + CCTK_REAL const PDstandardNth2phi = PDstandardNth2(&phi[index]); + CCTK_REAL const PDstandardNth3phi = PDstandardNth3(&phi[index]); + CCTK_REAL const PDdissipationNth1phi = PDdissipationNth1(&phi[index]); + CCTK_REAL const PDdissipationNth2phi = PDdissipationNth2(&phi[index]); + CCTK_REAL const PDdissipationNth3phi = PDdissipationNth3(&phi[index]); + CCTK_REAL const PDupwindNthAnti1phi = PDupwindNthAnti1(&phi[index]); + CCTK_REAL const PDupwindNthSymm1phi = PDupwindNthSymm1(&phi[index]); + CCTK_REAL const PDupwindNthAnti2phi = PDupwindNthAnti2(&phi[index]); + CCTK_REAL const PDupwindNthSymm2phi = PDupwindNthSymm2(&phi[index]); + CCTK_REAL const PDupwindNthAnti3phi = PDupwindNthAnti3(&phi[index]); + CCTK_REAL const PDupwindNthSymm3phi = PDupwindNthSymm3(&phi[index]); + CCTK_REAL const PDstandardNth1trK = PDstandardNth1(&trK[index]); + CCTK_REAL const PDstandardNth2trK = PDstandardNth2(&trK[index]); + CCTK_REAL const PDstandardNth3trK = PDstandardNth3(&trK[index]); + CCTK_REAL const PDdissipationNth1trK = PDdissipationNth1(&trK[index]); + CCTK_REAL const PDdissipationNth2trK = PDdissipationNth2(&trK[index]); + CCTK_REAL const PDdissipationNth3trK = PDdissipationNth3(&trK[index]); + CCTK_REAL const PDupwindNthAnti1trK = PDupwindNthAnti1(&trK[index]); + CCTK_REAL const PDupwindNthSymm1trK = PDupwindNthSymm1(&trK[index]); + CCTK_REAL const PDupwindNthAnti2trK = PDupwindNthAnti2(&trK[index]); + CCTK_REAL const PDupwindNthSymm2trK = PDupwindNthSymm2(&trK[index]); + CCTK_REAL const PDupwindNthAnti3trK = PDupwindNthAnti3(&trK[index]); + CCTK_REAL const PDupwindNthSymm3trK = PDupwindNthSymm3(&trK[index]); + CCTK_REAL const PDdissipationNth1Xt1 = PDdissipationNth1(&Xt1[index]); + CCTK_REAL const PDdissipationNth2Xt1 = PDdissipationNth2(&Xt1[index]); + CCTK_REAL const PDdissipationNth3Xt1 = PDdissipationNth3(&Xt1[index]); + CCTK_REAL const PDupwindNthAnti1Xt1 = PDupwindNthAnti1(&Xt1[index]); + CCTK_REAL const PDupwindNthSymm1Xt1 = PDupwindNthSymm1(&Xt1[index]); + CCTK_REAL const PDupwindNthAnti2Xt1 = PDupwindNthAnti2(&Xt1[index]); + CCTK_REAL const PDupwindNthSymm2Xt1 = PDupwindNthSymm2(&Xt1[index]); + CCTK_REAL const PDupwindNthAnti3Xt1 = PDupwindNthAnti3(&Xt1[index]); + CCTK_REAL const PDupwindNthSymm3Xt1 = PDupwindNthSymm3(&Xt1[index]); + CCTK_REAL const PDdissipationNth1Xt2 = PDdissipationNth1(&Xt2[index]); + CCTK_REAL const PDdissipationNth2Xt2 = PDdissipationNth2(&Xt2[index]); + CCTK_REAL const PDdissipationNth3Xt2 = PDdissipationNth3(&Xt2[index]); + CCTK_REAL const PDupwindNthAnti1Xt2 = PDupwindNthAnti1(&Xt2[index]); + CCTK_REAL const PDupwindNthSymm1Xt2 = PDupwindNthSymm1(&Xt2[index]); + CCTK_REAL const PDupwindNthAnti2Xt2 = PDupwindNthAnti2(&Xt2[index]); + CCTK_REAL const PDupwindNthSymm2Xt2 = PDupwindNthSymm2(&Xt2[index]); + CCTK_REAL const PDupwindNthAnti3Xt2 = PDupwindNthAnti3(&Xt2[index]); + CCTK_REAL const PDupwindNthSymm3Xt2 = PDupwindNthSymm3(&Xt2[index]); + CCTK_REAL const PDdissipationNth1Xt3 = PDdissipationNth1(&Xt3[index]); + CCTK_REAL const PDdissipationNth2Xt3 = PDdissipationNth2(&Xt3[index]); + CCTK_REAL const PDdissipationNth3Xt3 = PDdissipationNth3(&Xt3[index]); + CCTK_REAL const PDupwindNthAnti1Xt3 = PDupwindNthAnti1(&Xt3[index]); + CCTK_REAL const PDupwindNthSymm1Xt3 = PDupwindNthSymm1(&Xt3[index]); + CCTK_REAL const PDupwindNthAnti2Xt3 = PDupwindNthAnti2(&Xt3[index]); + CCTK_REAL const PDupwindNthSymm2Xt3 = PDupwindNthSymm2(&Xt3[index]); + CCTK_REAL const PDupwindNthAnti3Xt3 = PDupwindNthAnti3(&Xt3[index]); + CCTK_REAL const PDupwindNthSymm3Xt3 = PDupwindNthSymm3(&Xt3[index]); + + /* Calculate temporaries and grid functions */ + ptrdiff_t dir1 = Sign(beta1L); + + ptrdiff_t dir2 = Sign(beta2L); + + ptrdiff_t dir3 = Sign(beta3L); + + CCTK_REAL epsdiss1 = ToReal(EpsDiss); + + CCTK_REAL epsdiss2 = ToReal(EpsDiss); + + CCTK_REAL epsdiss3 = ToReal(EpsDiss); + + CCTK_REAL detgt = 1; + + CCTK_REAL gtu11 = INV(detgt)*(gt22L*gt33L - SQR(gt23L)); + + CCTK_REAL gtu12 = (gt13L*gt23L - gt12L*gt33L)*INV(detgt); + + CCTK_REAL gtu13 = (-(gt13L*gt22L) + gt12L*gt23L)*INV(detgt); + + CCTK_REAL gtu22 = INV(detgt)*(gt11L*gt33L - SQR(gt13L)); + + CCTK_REAL gtu23 = (gt12L*gt13L - gt11L*gt23L)*INV(detgt); + + CCTK_REAL gtu33 = INV(detgt)*(gt11L*gt22L - SQR(gt12L)); + + CCTK_REAL Gtl111 = 0.5*(J11L*PDstandardNth1gt11 + + J21L*PDstandardNth2gt11 + J31L*PDstandardNth3gt11); + + CCTK_REAL Gtl112 = 0.5*(J12L*PDstandardNth1gt11 + + J22L*PDstandardNth2gt11 + J32L*PDstandardNth3gt11); + + CCTK_REAL Gtl113 = 0.5*(J13L*PDstandardNth1gt11 + + J23L*PDstandardNth2gt11 + J33L*PDstandardNth3gt11); + + CCTK_REAL Gtl122 = J12L*PDstandardNth1gt12 + J22L*PDstandardNth2gt12 + + J32L*PDstandardNth3gt12 - 0.5*(J11L*PDstandardNth1gt22 + + J21L*PDstandardNth2gt22 + J31L*PDstandardNth3gt22); + + CCTK_REAL Gtl123 = 0.5*(J13L*PDstandardNth1gt12 + + J12L*PDstandardNth1gt13 - J11L*PDstandardNth1gt23 + + J23L*PDstandardNth2gt12 + J22L*PDstandardNth2gt13 - + J21L*PDstandardNth2gt23 + J33L*PDstandardNth3gt12 + + J32L*PDstandardNth3gt13 - J31L*PDstandardNth3gt23); + + CCTK_REAL Gtl133 = J13L*PDstandardNth1gt13 + J23L*PDstandardNth2gt13 + + J33L*PDstandardNth3gt13 - 0.5*(J11L*PDstandardNth1gt33 + + J21L*PDstandardNth2gt33 + J31L*PDstandardNth3gt33); + + CCTK_REAL Gtl211 = J11L*PDstandardNth1gt12 + J21L*PDstandardNth2gt12 - + 0.5*(J12L*PDstandardNth1gt11 + J22L*PDstandardNth2gt11 + + J32L*PDstandardNth3gt11) + J31L*PDstandardNth3gt12; + + CCTK_REAL Gtl212 = 0.5*(J11L*PDstandardNth1gt22 + + J21L*PDstandardNth2gt22 + J31L*PDstandardNth3gt22); + + CCTK_REAL Gtl213 = 0.5*(J13L*PDstandardNth1gt12 - + J12L*PDstandardNth1gt13 + J11L*PDstandardNth1gt23 + + J23L*PDstandardNth2gt12 - J22L*PDstandardNth2gt13 + + J21L*PDstandardNth2gt23 + J33L*PDstandardNth3gt12 - + J32L*PDstandardNth3gt13 + J31L*PDstandardNth3gt23); + + CCTK_REAL Gtl222 = 0.5*(J12L*PDstandardNth1gt22 + + J22L*PDstandardNth2gt22 + J32L*PDstandardNth3gt22); + + CCTK_REAL Gtl223 = 0.5*(J13L*PDstandardNth1gt22 + + J23L*PDstandardNth2gt22 + J33L*PDstandardNth3gt22); + + CCTK_REAL Gtl233 = J13L*PDstandardNth1gt23 + J23L*PDstandardNth2gt23 + + J33L*PDstandardNth3gt23 - 0.5*(J12L*PDstandardNth1gt33 + + J22L*PDstandardNth2gt33 + J32L*PDstandardNth3gt33); + + CCTK_REAL Gtl311 = J11L*PDstandardNth1gt13 + J21L*PDstandardNth2gt13 - + 0.5*(J13L*PDstandardNth1gt11 + J23L*PDstandardNth2gt11 + + J33L*PDstandardNth3gt11) + J31L*PDstandardNth3gt13; + + CCTK_REAL Gtl312 = 0.5*(-(J13L*PDstandardNth1gt12) + + J12L*PDstandardNth1gt13 + J11L*PDstandardNth1gt23 - + J23L*PDstandardNth2gt12 + J22L*PDstandardNth2gt13 + + J21L*PDstandardNth2gt23 - J33L*PDstandardNth3gt12 + + J32L*PDstandardNth3gt13 + J31L*PDstandardNth3gt23); + + CCTK_REAL Gtl313 = 0.5*(J11L*PDstandardNth1gt33 + + J21L*PDstandardNth2gt33 + J31L*PDstandardNth3gt33); + + CCTK_REAL Gtl322 = J12L*PDstandardNth1gt23 + J22L*PDstandardNth2gt23 - + 0.5*(J13L*PDstandardNth1gt22 + J23L*PDstandardNth2gt22 + + J33L*PDstandardNth3gt22) + J32L*PDstandardNth3gt23; + + CCTK_REAL Gtl323 = 0.5*(J12L*PDstandardNth1gt33 + + J22L*PDstandardNth2gt33 + J32L*PDstandardNth3gt33); + + CCTK_REAL Gtl333 = 0.5*(J13L*PDstandardNth1gt33 + + J23L*PDstandardNth2gt33 + J33L*PDstandardNth3gt33); + + CCTK_REAL Gt111 = Gtl111*gtu11 + Gtl211*gtu12 + Gtl311*gtu13; + + CCTK_REAL Gt211 = Gtl111*gtu12 + Gtl211*gtu22 + Gtl311*gtu23; + + CCTK_REAL Gt311 = Gtl111*gtu13 + Gtl211*gtu23 + Gtl311*gtu33; + + CCTK_REAL Gt112 = Gtl112*gtu11 + Gtl212*gtu12 + Gtl312*gtu13; + + CCTK_REAL Gt212 = Gtl112*gtu12 + Gtl212*gtu22 + Gtl312*gtu23; + + CCTK_REAL Gt312 = Gtl112*gtu13 + Gtl212*gtu23 + Gtl312*gtu33; + + CCTK_REAL Gt113 = Gtl113*gtu11 + Gtl213*gtu12 + Gtl313*gtu13; + + CCTK_REAL Gt213 = Gtl113*gtu12 + Gtl213*gtu22 + Gtl313*gtu23; + + CCTK_REAL Gt313 = Gtl113*gtu13 + Gtl213*gtu23 + Gtl313*gtu33; + + CCTK_REAL Gt122 = Gtl122*gtu11 + Gtl222*gtu12 + Gtl322*gtu13; + + CCTK_REAL Gt222 = Gtl122*gtu12 + Gtl222*gtu22 + Gtl322*gtu23; + + CCTK_REAL Gt322 = Gtl122*gtu13 + Gtl222*gtu23 + Gtl322*gtu33; + + CCTK_REAL Gt123 = Gtl123*gtu11 + Gtl223*gtu12 + Gtl323*gtu13; + + CCTK_REAL Gt223 = Gtl123*gtu12 + Gtl223*gtu22 + Gtl323*gtu23; + + CCTK_REAL Gt323 = Gtl123*gtu13 + Gtl223*gtu23 + Gtl323*gtu33; + + CCTK_REAL Gt133 = Gtl133*gtu11 + Gtl233*gtu12 + Gtl333*gtu13; + + CCTK_REAL Gt233 = Gtl133*gtu12 + Gtl233*gtu22 + Gtl333*gtu23; + + CCTK_REAL Gt333 = Gtl133*gtu13 + Gtl233*gtu23 + Gtl333*gtu33; + + CCTK_REAL Xtn1 = Gt111*gtu11 + Gt122*gtu22 + 2*(Gt112*gtu12 + + Gt113*gtu13 + Gt123*gtu23) + Gt133*gtu33; + + CCTK_REAL Xtn2 = Gt211*gtu11 + Gt222*gtu22 + 2*(Gt212*gtu12 + + Gt213*gtu13 + Gt223*gtu23) + Gt233*gtu33; + + CCTK_REAL Xtn3 = Gt311*gtu11 + Gt322*gtu22 + 2*(Gt312*gtu12 + + Gt313*gtu13 + Gt323*gtu23) + Gt333*gtu33; + + CCTK_REAL fac1 = IfThen(ToReal(conformalMethod),-0.5*INV(phiL),1); + + CCTK_REAL cdphi1 = fac1*(J11L*PDstandardNth1phi + + J21L*PDstandardNth2phi + J31L*PDstandardNth3phi); + + CCTK_REAL cdphi2 = fac1*(J12L*PDstandardNth1phi + + J22L*PDstandardNth2phi + J32L*PDstandardNth3phi); + + CCTK_REAL cdphi3 = fac1*(J13L*PDstandardNth1phi + + J23L*PDstandardNth2phi + J33L*PDstandardNth3phi); + + CCTK_REAL Atm11 = At11L*gtu11 + At12L*gtu12 + At13L*gtu13; + + CCTK_REAL Atm21 = At11L*gtu12 + At12L*gtu22 + At13L*gtu23; + + CCTK_REAL Atm31 = At11L*gtu13 + At12L*gtu23 + At13L*gtu33; + + CCTK_REAL Atm12 = At12L*gtu11 + At22L*gtu12 + At23L*gtu13; + + CCTK_REAL Atm22 = At12L*gtu12 + At22L*gtu22 + At23L*gtu23; + + CCTK_REAL Atm32 = At12L*gtu13 + At22L*gtu23 + At23L*gtu33; + + CCTK_REAL Atm13 = At13L*gtu11 + At23L*gtu12 + At33L*gtu13; + + CCTK_REAL Atm23 = At13L*gtu12 + At23L*gtu22 + At33L*gtu23; + + CCTK_REAL Atm33 = At13L*gtu13 + At23L*gtu23 + At33L*gtu33; + + CCTK_REAL Atu11 = Atm11*gtu11 + Atm12*gtu12 + Atm13*gtu13; + + CCTK_REAL Atu12 = Atm11*gtu12 + Atm12*gtu22 + Atm13*gtu23; + + CCTK_REAL Atu13 = Atm11*gtu13 + Atm12*gtu23 + Atm13*gtu33; + + CCTK_REAL Atu22 = Atm21*gtu12 + Atm22*gtu22 + Atm23*gtu23; + + CCTK_REAL Atu23 = Atm21*gtu13 + Atm22*gtu23 + Atm23*gtu33; + + CCTK_REAL Atu33 = Atm31*gtu13 + Atm32*gtu23 + Atm33*gtu33; + + CCTK_REAL e4phi = + IfThen(ToReal(conformalMethod),INV(SQR(phiL)),exp(4*phiL)); + + CCTK_REAL em4phi = INV(e4phi); + + CCTK_REAL rho = INV(SQR(alphaL))*(eTttL - 2*(beta2L*eTtyL + + beta3L*eTtzL) + 2*(beta1L*(-eTtxL + beta2L*eTxyL + beta3L*eTxzL) + + beta2L*beta3L*eTyzL) + eTxxL*SQR(beta1L) + eTyyL*SQR(beta2L) + + eTzzL*SQR(beta3L)); + + CCTK_REAL S1 = (-eTtxL + beta1L*eTxxL + beta2L*eTxyL + + beta3L*eTxzL)*INV(alphaL); + + CCTK_REAL S2 = (-eTtyL + beta1L*eTxyL + beta2L*eTyyL + + beta3L*eTyzL)*INV(alphaL); + + CCTK_REAL S3 = (-eTtzL + beta1L*eTxzL + beta2L*eTyzL + + beta3L*eTzzL)*INV(alphaL); + + CCTK_REAL trS = em4phi*(eTxxL*gtu11 + eTyyL*gtu22 + 2*(eTxyL*gtu12 + + eTxzL*gtu13 + eTyzL*gtu23) + eTzzL*gtu33); + + CCTK_REAL phirhsL = (epsdiss1*J11L + epsdiss2*J12L + + epsdiss3*J13L)*PDdissipationNth1phi + (epsdiss1*J21L + epsdiss2*J22L + + epsdiss3*J23L)*PDdissipationNth2phi + (epsdiss1*J31L + epsdiss2*J32L + + epsdiss3*J33L)*PDdissipationNth3phi + (beta1L*J11L + beta2L*J12L + + beta3L*J13L)*PDupwindNthAnti1phi + (beta1L*J21L + beta2L*J22L + + beta3L*J23L)*PDupwindNthAnti2phi + (beta1L*J31L + beta2L*J32L + + beta3L*J33L)*PDupwindNthAnti3phi + (J11L*PDupwindNthSymm1phi + + J21L*PDupwindNthSymm2phi + J31L*PDupwindNthSymm3phi)*Abs(beta1L) + + (J12L*PDupwindNthSymm1phi + J22L*PDupwindNthSymm2phi + + J32L*PDupwindNthSymm3phi)*Abs(beta2L) + (J13L*PDupwindNthSymm1phi + + J23L*PDupwindNthSymm2phi + J33L*PDupwindNthSymm3phi)*Abs(beta3L) + + IfThen(ToReal(conformalMethod),phiL*(-0.333333333333333333333333333333*(J11L*PDstandardNth1beta1 + + J12L*PDstandardNth1beta2 + J13L*PDstandardNth1beta3 + + J21L*PDstandardNth2beta1 + J22L*PDstandardNth2beta2 + + J23L*PDstandardNth2beta3 + J31L*PDstandardNth3beta1 + + J32L*PDstandardNth3beta2 + J33L*PDstandardNth3beta3) + + 0.333333333333333333333333333333*alphaL*trKL),0.166666666666666666666666666667*(J11L*PDstandardNth1beta1 + + J12L*PDstandardNth1beta2 + J13L*PDstandardNth1beta3 + + J21L*PDstandardNth2beta1 + J22L*PDstandardNth2beta2 + + J23L*PDstandardNth2beta3 + J31L*PDstandardNth3beta1 + + J32L*PDstandardNth3beta2 + J33L*PDstandardNth3beta3) - + 0.166666666666666666666666666667*alphaL*trKL); + + CCTK_REAL gt11rhsL = -2*alphaL*At11L + (epsdiss1*J11L + epsdiss2*J12L + + epsdiss3*J13L)*PDdissipationNth1gt11 + (epsdiss1*J21L + epsdiss2*J22L + + epsdiss3*J23L)*PDdissipationNth2gt11 + (epsdiss1*J31L + epsdiss2*J32L + + epsdiss3*J33L)*PDdissipationNth3gt11 - + 0.666666666666666666666666666667*gt11L*(J11L*PDstandardNth1beta1 + + J12L*PDstandardNth1beta2 + J13L*PDstandardNth1beta3 + + J21L*PDstandardNth2beta1 + J22L*PDstandardNth2beta2 + + J23L*PDstandardNth2beta3 + J31L*PDstandardNth3beta1 + + J32L*PDstandardNth3beta2 + J33L*PDstandardNth3beta3) + + 2*(J11L*(gt11L*PDstandardNth1beta1 + gt12L*PDstandardNth1beta2 + + gt13L*PDstandardNth1beta3) + J21L*(gt11L*PDstandardNth2beta1 + + gt12L*PDstandardNth2beta2 + gt13L*PDstandardNth2beta3) + + J31L*(gt11L*PDstandardNth3beta1 + gt12L*PDstandardNth3beta2 + + gt13L*PDstandardNth3beta3)) + (beta1L*J11L + beta2L*J12L + + beta3L*J13L)*PDupwindNthAnti1gt11 + (beta1L*J21L + beta2L*J22L + + beta3L*J23L)*PDupwindNthAnti2gt11 + (beta1L*J31L + beta2L*J32L + + beta3L*J33L)*PDupwindNthAnti3gt11 + (J11L*PDupwindNthSymm1gt11 + + J21L*PDupwindNthSymm2gt11 + J31L*PDupwindNthSymm3gt11)*Abs(beta1L) + + (J12L*PDupwindNthSymm1gt11 + J22L*PDupwindNthSymm2gt11 + + J32L*PDupwindNthSymm3gt11)*Abs(beta2L) + (J13L*PDupwindNthSymm1gt11 + + J23L*PDupwindNthSymm2gt11 + J33L*PDupwindNthSymm3gt11)*Abs(beta3L); + + CCTK_REAL gt12rhsL = -2*alphaL*At12L + (epsdiss1*J11L + epsdiss2*J12L + + epsdiss3*J13L)*PDdissipationNth1gt12 + (epsdiss1*J21L + epsdiss2*J22L + + epsdiss3*J23L)*PDdissipationNth2gt12 + (epsdiss1*J31L + epsdiss2*J32L + + epsdiss3*J33L)*PDdissipationNth3gt12 + (gt12L*J11L + + gt11L*J12L)*PDstandardNth1beta1 + (gt22L*J11L + + gt12L*J12L)*PDstandardNth1beta2 + (gt23L*J11L + + gt13L*J12L)*PDstandardNth1beta3 + (gt12L*J21L + + gt11L*J22L)*PDstandardNth2beta1 + (gt22L*J21L + + gt12L*J22L)*PDstandardNth2beta2 + (gt23L*J21L + + gt13L*J22L)*PDstandardNth2beta3 + (gt12L*J31L + + gt11L*J32L)*PDstandardNth3beta1 + (gt22L*J31L + + gt12L*J32L)*PDstandardNth3beta2 + (gt23L*J31L + + gt13L*J32L)*PDstandardNth3beta3 - + 0.666666666666666666666666666667*gt12L*(J11L*PDstandardNth1beta1 + + J12L*PDstandardNth1beta2 + J13L*PDstandardNth1beta3 + + J21L*PDstandardNth2beta1 + J22L*PDstandardNth2beta2 + + J23L*PDstandardNth2beta3 + J31L*PDstandardNth3beta1 + + J32L*PDstandardNth3beta2 + J33L*PDstandardNth3beta3) + (beta1L*J11L + + beta2L*J12L + beta3L*J13L)*PDupwindNthAnti1gt12 + (beta1L*J21L + + beta2L*J22L + beta3L*J23L)*PDupwindNthAnti2gt12 + (beta1L*J31L + + beta2L*J32L + beta3L*J33L)*PDupwindNthAnti3gt12 + + (J11L*PDupwindNthSymm1gt12 + J21L*PDupwindNthSymm2gt12 + + J31L*PDupwindNthSymm3gt12)*Abs(beta1L) + (J12L*PDupwindNthSymm1gt12 + + J22L*PDupwindNthSymm2gt12 + J32L*PDupwindNthSymm3gt12)*Abs(beta2L) + + (J13L*PDupwindNthSymm1gt12 + J23L*PDupwindNthSymm2gt12 + + J33L*PDupwindNthSymm3gt12)*Abs(beta3L); + + CCTK_REAL gt13rhsL = -2*alphaL*At13L + (epsdiss1*J11L + epsdiss2*J12L + + epsdiss3*J13L)*PDdissipationNth1gt13 + (epsdiss1*J21L + epsdiss2*J22L + + epsdiss3*J23L)*PDdissipationNth2gt13 + (epsdiss1*J31L + epsdiss2*J32L + + epsdiss3*J33L)*PDdissipationNth3gt13 + (gt13L*J11L + + gt11L*J13L)*PDstandardNth1beta1 + (gt23L*J11L + + gt12L*J13L)*PDstandardNth1beta2 + (gt33L*J11L + + gt13L*J13L)*PDstandardNth1beta3 + (gt13L*J21L + + gt11L*J23L)*PDstandardNth2beta1 + (gt23L*J21L + + gt12L*J23L)*PDstandardNth2beta2 + (gt33L*J21L + + gt13L*J23L)*PDstandardNth2beta3 + (gt13L*J31L + + gt11L*J33L)*PDstandardNth3beta1 + (gt23L*J31L + + gt12L*J33L)*PDstandardNth3beta2 + (gt33L*J31L + + gt13L*J33L)*PDstandardNth3beta3 - + 0.666666666666666666666666666667*gt13L*(J11L*PDstandardNth1beta1 + + J12L*PDstandardNth1beta2 + J13L*PDstandardNth1beta3 + + J21L*PDstandardNth2beta1 + J22L*PDstandardNth2beta2 + + J23L*PDstandardNth2beta3 + J31L*PDstandardNth3beta1 + + J32L*PDstandardNth3beta2 + J33L*PDstandardNth3beta3) + (beta1L*J11L + + beta2L*J12L + beta3L*J13L)*PDupwindNthAnti1gt13 + (beta1L*J21L + + beta2L*J22L + beta3L*J23L)*PDupwindNthAnti2gt13 + (beta1L*J31L + + beta2L*J32L + beta3L*J33L)*PDupwindNthAnti3gt13 + + (J11L*PDupwindNthSymm1gt13 + J21L*PDupwindNthSymm2gt13 + + J31L*PDupwindNthSymm3gt13)*Abs(beta1L) + (J12L*PDupwindNthSymm1gt13 + + J22L*PDupwindNthSymm2gt13 + J32L*PDupwindNthSymm3gt13)*Abs(beta2L) + + (J13L*PDupwindNthSymm1gt13 + J23L*PDupwindNthSymm2gt13 + + J33L*PDupwindNthSymm3gt13)*Abs(beta3L); + + CCTK_REAL gt22rhsL = -2*alphaL*At22L + (epsdiss1*J11L + epsdiss2*J12L + + epsdiss3*J13L)*PDdissipationNth1gt22 + (epsdiss1*J21L + epsdiss2*J22L + + epsdiss3*J23L)*PDdissipationNth2gt22 + (epsdiss1*J31L + epsdiss2*J32L + + epsdiss3*J33L)*PDdissipationNth3gt22 - + 0.666666666666666666666666666667*gt22L*(J11L*PDstandardNth1beta1 + + J12L*PDstandardNth1beta2 + J13L*PDstandardNth1beta3 + + J21L*PDstandardNth2beta1 + J22L*PDstandardNth2beta2 + + J23L*PDstandardNth2beta3 + J31L*PDstandardNth3beta1 + + J32L*PDstandardNth3beta2 + J33L*PDstandardNth3beta3) + + 2*(J12L*(gt12L*PDstandardNth1beta1 + gt22L*PDstandardNth1beta2 + + gt23L*PDstandardNth1beta3) + J22L*(gt12L*PDstandardNth2beta1 + + gt22L*PDstandardNth2beta2 + gt23L*PDstandardNth2beta3) + + J32L*(gt12L*PDstandardNth3beta1 + gt22L*PDstandardNth3beta2 + + gt23L*PDstandardNth3beta3)) + (beta1L*J11L + beta2L*J12L + + beta3L*J13L)*PDupwindNthAnti1gt22 + (beta1L*J21L + beta2L*J22L + + beta3L*J23L)*PDupwindNthAnti2gt22 + (beta1L*J31L + beta2L*J32L + + beta3L*J33L)*PDupwindNthAnti3gt22 + (J11L*PDupwindNthSymm1gt22 + + J21L*PDupwindNthSymm2gt22 + J31L*PDupwindNthSymm3gt22)*Abs(beta1L) + + (J12L*PDupwindNthSymm1gt22 + J22L*PDupwindNthSymm2gt22 + + J32L*PDupwindNthSymm3gt22)*Abs(beta2L) + (J13L*PDupwindNthSymm1gt22 + + J23L*PDupwindNthSymm2gt22 + J33L*PDupwindNthSymm3gt22)*Abs(beta3L); + + CCTK_REAL gt23rhsL = -2*alphaL*At23L + (epsdiss1*J11L + epsdiss2*J12L + + epsdiss3*J13L)*PDdissipationNth1gt23 + (epsdiss1*J21L + epsdiss2*J22L + + epsdiss3*J23L)*PDdissipationNth2gt23 + (epsdiss1*J31L + epsdiss2*J32L + + epsdiss3*J33L)*PDdissipationNth3gt23 + (gt13L*J12L + + gt12L*J13L)*PDstandardNth1beta1 + (gt23L*J12L + + gt22L*J13L)*PDstandardNth1beta2 + (gt33L*J12L + + gt23L*J13L)*PDstandardNth1beta3 + (gt13L*J22L + + gt12L*J23L)*PDstandardNth2beta1 + (gt23L*J22L + + gt22L*J23L)*PDstandardNth2beta2 + (gt33L*J22L + + gt23L*J23L)*PDstandardNth2beta3 + (gt13L*J32L + + gt12L*J33L)*PDstandardNth3beta1 + (gt23L*J32L + + gt22L*J33L)*PDstandardNth3beta2 + (gt33L*J32L + + gt23L*J33L)*PDstandardNth3beta3 - + 0.666666666666666666666666666667*gt23L*(J11L*PDstandardNth1beta1 + + J12L*PDstandardNth1beta2 + J13L*PDstandardNth1beta3 + + J21L*PDstandardNth2beta1 + J22L*PDstandardNth2beta2 + + J23L*PDstandardNth2beta3 + J31L*PDstandardNth3beta1 + + J32L*PDstandardNth3beta2 + J33L*PDstandardNth3beta3) + (beta1L*J11L + + beta2L*J12L + beta3L*J13L)*PDupwindNthAnti1gt23 + (beta1L*J21L + + beta2L*J22L + beta3L*J23L)*PDupwindNthAnti2gt23 + (beta1L*J31L + + beta2L*J32L + beta3L*J33L)*PDupwindNthAnti3gt23 + + (J11L*PDupwindNthSymm1gt23 + J21L*PDupwindNthSymm2gt23 + + J31L*PDupwindNthSymm3gt23)*Abs(beta1L) + (J12L*PDupwindNthSymm1gt23 + + J22L*PDupwindNthSymm2gt23 + J32L*PDupwindNthSymm3gt23)*Abs(beta2L) + + (J13L*PDupwindNthSymm1gt23 + J23L*PDupwindNthSymm2gt23 + + J33L*PDupwindNthSymm3gt23)*Abs(beta3L); + + CCTK_REAL gt33rhsL = -2*alphaL*At33L + (epsdiss1*J11L + epsdiss2*J12L + + epsdiss3*J13L)*PDdissipationNth1gt33 + (epsdiss1*J21L + epsdiss2*J22L + + epsdiss3*J23L)*PDdissipationNth2gt33 + (epsdiss1*J31L + epsdiss2*J32L + + epsdiss3*J33L)*PDdissipationNth3gt33 - + 0.666666666666666666666666666667*gt33L*(J11L*PDstandardNth1beta1 + + J12L*PDstandardNth1beta2 + J13L*PDstandardNth1beta3 + + J21L*PDstandardNth2beta1 + J22L*PDstandardNth2beta2 + + J23L*PDstandardNth2beta3 + J31L*PDstandardNth3beta1 + + J32L*PDstandardNth3beta2 + J33L*PDstandardNth3beta3) + + 2*(J13L*(gt13L*PDstandardNth1beta1 + gt23L*PDstandardNth1beta2 + + gt33L*PDstandardNth1beta3) + J23L*(gt13L*PDstandardNth2beta1 + + gt23L*PDstandardNth2beta2 + gt33L*PDstandardNth2beta3) + + J33L*(gt13L*PDstandardNth3beta1 + gt23L*PDstandardNth3beta2 + + gt33L*PDstandardNth3beta3)) + (beta1L*J11L + beta2L*J12L + + beta3L*J13L)*PDupwindNthAnti1gt33 + (beta1L*J21L + beta2L*J22L + + beta3L*J23L)*PDupwindNthAnti2gt33 + (beta1L*J31L + beta2L*J32L + + beta3L*J33L)*PDupwindNthAnti3gt33 + (J11L*PDupwindNthSymm1gt33 + + J21L*PDupwindNthSymm2gt33 + J31L*PDupwindNthSymm3gt33)*Abs(beta1L) + + (J12L*PDupwindNthSymm1gt33 + J22L*PDupwindNthSymm2gt33 + + J32L*PDupwindNthSymm3gt33)*Abs(beta2L) + (J13L*PDupwindNthSymm1gt33 + + J23L*PDupwindNthSymm2gt33 + J33L*PDupwindNthSymm3gt33)*Abs(beta3L); + + CCTK_REAL dotXt1 = (epsdiss1*J11L + epsdiss2*J12L + + epsdiss3*J13L)*PDdissipationNth1Xt1 + (epsdiss1*J21L + epsdiss2*J22L + + epsdiss3*J23L)*PDdissipationNth2Xt1 + (epsdiss1*J31L + epsdiss2*J32L + + epsdiss3*J33L)*PDdissipationNth3Xt1 - 2*((Atu11*J11L + Atu12*J12L + + Atu13*J13L)*PDstandardNth1alpha + (Atu11*J21L + Atu12*J22L + + Atu13*J23L)*PDstandardNth2alpha + (Atu11*J31L + Atu12*J32L + + Atu13*J33L)*PDstandardNth3alpha) + + 2*(gtu12*(J11L*J12L*PDstandardNth11beta1 + + J12L*J21L*PDstandardNth12beta1 + J11L*J22L*PDstandardNth12beta1 + + J12L*J31L*PDstandardNth13beta1 + J11L*J32L*PDstandardNth13beta1 + + dJ112L*PDstandardNth1beta1 + J21L*J22L*PDstandardNth22beta1 + + J22L*J31L*PDstandardNth23beta1 + J21L*J32L*PDstandardNth23beta1 + + dJ212L*PDstandardNth2beta1 + J31L*J32L*PDstandardNth33beta1 + + dJ312L*PDstandardNth3beta1) + gtu13*(J11L*J13L*PDstandardNth11beta1 + + J13L*J21L*PDstandardNth12beta1 + J11L*J23L*PDstandardNth12beta1 + + J13L*J31L*PDstandardNth13beta1 + J11L*J33L*PDstandardNth13beta1 + + dJ113L*PDstandardNth1beta1 + J21L*J23L*PDstandardNth22beta1 + + J23L*J31L*PDstandardNth23beta1 + J21L*J33L*PDstandardNth23beta1 + + dJ213L*PDstandardNth2beta1 + J31L*J33L*PDstandardNth33beta1 + + dJ313L*PDstandardNth3beta1) + gtu23*(J12L*J13L*PDstandardNth11beta1 + + J13L*J22L*PDstandardNth12beta1 + J12L*J23L*PDstandardNth12beta1 + + J13L*J32L*PDstandardNth13beta1 + J12L*J33L*PDstandardNth13beta1 + + dJ123L*PDstandardNth1beta1 + J22L*J23L*PDstandardNth22beta1 + + J23L*J32L*PDstandardNth23beta1 + J22L*J33L*PDstandardNth23beta1 + + dJ223L*PDstandardNth2beta1 + J32L*J33L*PDstandardNth33beta1 + + dJ323L*PDstandardNth3beta1) + alphaL*(6*(Atu11*cdphi1 + Atu12*cdphi2 + + Atu13*cdphi3) + Atu11*Gt111 + 2*Atu12*Gt112 + 2*Atu13*Gt113 + + Atu22*Gt122 + 2*Atu23*Gt123 + Atu33*Gt133 - + 0.666666666666666666666666666667*((gtu11*J11L + gtu12*J12L + + gtu13*J13L)*PDstandardNth1trK + (gtu11*J21L + gtu12*J22L + + gtu13*J23L)*PDstandardNth2trK + (gtu11*J31L + gtu12*J32L + + gtu13*J33L)*PDstandardNth3trK))) + (beta1L*J11L + beta2L*J12L + + beta3L*J13L)*PDupwindNthAnti1Xt1 + (beta1L*J21L + beta2L*J22L + + beta3L*J23L)*PDupwindNthAnti2Xt1 + (beta1L*J31L + beta2L*J32L + + beta3L*J33L)*PDupwindNthAnti3Xt1 - + 50.26548245743669181540229413247204614715*alphaL*(gtu11*S1 + gtu12*S2 + + gtu13*S3) + 0.666666666666666666666666666667*(J11L*PDstandardNth1beta1 + + J12L*PDstandardNth1beta2 + J13L*PDstandardNth1beta3 + + J21L*PDstandardNth2beta1 + J22L*PDstandardNth2beta2 + + J23L*PDstandardNth2beta3 + J31L*PDstandardNth3beta1 + + J32L*PDstandardNth3beta2 + J33L*PDstandardNth3beta3)*Xtn1 - + PDstandardNth1beta1*(J11L*Xtn1 + J12L*Xtn2 + J13L*Xtn3) - + PDstandardNth2beta1*(J21L*Xtn1 + J22L*Xtn2 + J23L*Xtn3) - + PDstandardNth3beta1*(J31L*Xtn1 + J32L*Xtn2 + J33L*Xtn3) + + (J11L*PDupwindNthSymm1Xt1 + J21L*PDupwindNthSymm2Xt1 + + J31L*PDupwindNthSymm3Xt1)*Abs(beta1L) + (J12L*PDupwindNthSymm1Xt1 + + J22L*PDupwindNthSymm2Xt1 + J32L*PDupwindNthSymm3Xt1)*Abs(beta2L) + + (J13L*PDupwindNthSymm1Xt1 + J23L*PDupwindNthSymm2Xt1 + + J33L*PDupwindNthSymm3Xt1)*Abs(beta3L) + + gtu11*(2*J11L*J21L*PDstandardNth12beta1 + + 2*J11L*J31L*PDstandardNth13beta1 + dJ111L*PDstandardNth1beta1 + + 2*J21L*J31L*PDstandardNth23beta1 + dJ211L*PDstandardNth2beta1 + + dJ311L*PDstandardNth3beta1 + PDstandardNth11beta1*SQR(J11L) + + PDstandardNth22beta1*SQR(J21L) + PDstandardNth33beta1*SQR(J31L)) + + gtu22*(2*J12L*J22L*PDstandardNth12beta1 + + 2*J12L*J32L*PDstandardNth13beta1 + dJ122L*PDstandardNth1beta1 + + 2*J22L*J32L*PDstandardNth23beta1 + dJ222L*PDstandardNth2beta1 + + dJ322L*PDstandardNth3beta1 + PDstandardNth11beta1*SQR(J12L) + + PDstandardNth22beta1*SQR(J22L) + PDstandardNth33beta1*SQR(J32L)) + + gtu33*(2*J13L*J23L*PDstandardNth12beta1 + + 2*J13L*J33L*PDstandardNth13beta1 + dJ133L*PDstandardNth1beta1 + + 2*J23L*J33L*PDstandardNth23beta1 + dJ233L*PDstandardNth2beta1 + + dJ333L*PDstandardNth3beta1 + PDstandardNth11beta1*SQR(J13L) + + PDstandardNth22beta1*SQR(J23L) + PDstandardNth33beta1*SQR(J33L)) + + 0.333333333333333333333333333333*(gtu11*(J11L*J12L*PDstandardNth11beta2 + + J11L*J13L*PDstandardNth11beta3 + 2*J11L*J21L*PDstandardNth12beta1 + + J12L*J21L*PDstandardNth12beta2 + J11L*J22L*PDstandardNth12beta2 + + J13L*J21L*PDstandardNth12beta3 + J11L*J23L*PDstandardNth12beta3 + + 2*J11L*J31L*PDstandardNth13beta1 + J12L*J31L*PDstandardNth13beta2 + + J11L*J32L*PDstandardNth13beta2 + J13L*J31L*PDstandardNth13beta3 + + J11L*J33L*PDstandardNth13beta3 + dJ111L*PDstandardNth1beta1 + + dJ112L*PDstandardNth1beta2 + dJ113L*PDstandardNth1beta3 + + J21L*J22L*PDstandardNth22beta2 + J21L*J23L*PDstandardNth22beta3 + + 2*J21L*J31L*PDstandardNth23beta1 + J22L*J31L*PDstandardNth23beta2 + + J21L*J32L*PDstandardNth23beta2 + J23L*J31L*PDstandardNth23beta3 + + J21L*J33L*PDstandardNth23beta3 + dJ211L*PDstandardNth2beta1 + + dJ212L*PDstandardNth2beta2 + dJ213L*PDstandardNth2beta3 + + J31L*J32L*PDstandardNth33beta2 + J31L*J33L*PDstandardNth33beta3 + + dJ311L*PDstandardNth3beta1 + dJ312L*PDstandardNth3beta2 + + dJ313L*PDstandardNth3beta3 + PDstandardNth11beta1*SQR(J11L) + + PDstandardNth22beta1*SQR(J21L) + PDstandardNth33beta1*SQR(J31L)) + + gtu12*(J11L*J12L*PDstandardNth11beta1 + J12L*J13L*PDstandardNth11beta3 + + J12L*J21L*PDstandardNth12beta1 + J11L*J22L*PDstandardNth12beta1 + + 2*J12L*J22L*PDstandardNth12beta2 + J13L*J22L*PDstandardNth12beta3 + + J12L*J23L*PDstandardNth12beta3 + J12L*J31L*PDstandardNth13beta1 + + J11L*J32L*PDstandardNth13beta1 + 2*J12L*J32L*PDstandardNth13beta2 + + J13L*J32L*PDstandardNth13beta3 + J12L*J33L*PDstandardNth13beta3 + + dJ112L*PDstandardNth1beta1 + dJ122L*PDstandardNth1beta2 + + dJ123L*PDstandardNth1beta3 + J21L*J22L*PDstandardNth22beta1 + + J22L*J23L*PDstandardNth22beta3 + J22L*J31L*PDstandardNth23beta1 + + J21L*J32L*PDstandardNth23beta1 + 2*J22L*J32L*PDstandardNth23beta2 + + J23L*J32L*PDstandardNth23beta3 + J22L*J33L*PDstandardNth23beta3 + + dJ212L*PDstandardNth2beta1 + dJ222L*PDstandardNth2beta2 + + dJ223L*PDstandardNth2beta3 + J31L*J32L*PDstandardNth33beta1 + + J32L*J33L*PDstandardNth33beta3 + dJ312L*PDstandardNth3beta1 + + dJ322L*PDstandardNth3beta2 + dJ323L*PDstandardNth3beta3 + + PDstandardNth11beta2*SQR(J12L) + PDstandardNth22beta2*SQR(J22L) + + PDstandardNth33beta2*SQR(J32L)) + gtu13*(J11L*J13L*PDstandardNth11beta1 + + J12L*J13L*PDstandardNth11beta2 + J13L*J21L*PDstandardNth12beta1 + + J11L*J23L*PDstandardNth12beta1 + J13L*J22L*PDstandardNth12beta2 + + J12L*J23L*PDstandardNth12beta2 + 2*J13L*J23L*PDstandardNth12beta3 + + J13L*J31L*PDstandardNth13beta1 + J11L*J33L*PDstandardNth13beta1 + + J13L*J32L*PDstandardNth13beta2 + J12L*J33L*PDstandardNth13beta2 + + 2*J13L*J33L*PDstandardNth13beta3 + dJ113L*PDstandardNth1beta1 + + dJ123L*PDstandardNth1beta2 + dJ133L*PDstandardNth1beta3 + + J21L*J23L*PDstandardNth22beta1 + J22L*J23L*PDstandardNth22beta2 + + J23L*J31L*PDstandardNth23beta1 + J21L*J33L*PDstandardNth23beta1 + + J23L*J32L*PDstandardNth23beta2 + J22L*J33L*PDstandardNth23beta2 + + 2*J23L*J33L*PDstandardNth23beta3 + dJ213L*PDstandardNth2beta1 + + dJ223L*PDstandardNth2beta2 + dJ233L*PDstandardNth2beta3 + + J31L*J33L*PDstandardNth33beta1 + J32L*J33L*PDstandardNth33beta2 + + dJ313L*PDstandardNth3beta1 + dJ323L*PDstandardNth3beta2 + + dJ333L*PDstandardNth3beta3 + PDstandardNth11beta3*SQR(J13L) + + PDstandardNth22beta3*SQR(J23L) + PDstandardNth33beta3*SQR(J33L))); + + CCTK_REAL dotXt2 = (epsdiss1*J11L + epsdiss2*J12L + + epsdiss3*J13L)*PDdissipationNth1Xt2 + (epsdiss1*J21L + epsdiss2*J22L + + epsdiss3*J23L)*PDdissipationNth2Xt2 + (epsdiss1*J31L + epsdiss2*J32L + + epsdiss3*J33L)*PDdissipationNth3Xt2 - 2*((Atu12*J11L + Atu22*J12L + + Atu23*J13L)*PDstandardNth1alpha + (Atu12*J21L + Atu22*J22L + + Atu23*J23L)*PDstandardNth2alpha + (Atu12*J31L + Atu22*J32L + + Atu23*J33L)*PDstandardNth3alpha) + + 2*(gtu12*(J11L*J12L*PDstandardNth11beta2 + + J12L*J21L*PDstandardNth12beta2 + J11L*J22L*PDstandardNth12beta2 + + J12L*J31L*PDstandardNth13beta2 + J11L*J32L*PDstandardNth13beta2 + + dJ112L*PDstandardNth1beta2 + J21L*J22L*PDstandardNth22beta2 + + J22L*J31L*PDstandardNth23beta2 + J21L*J32L*PDstandardNth23beta2 + + dJ212L*PDstandardNth2beta2 + J31L*J32L*PDstandardNth33beta2 + + dJ312L*PDstandardNth3beta2) + gtu13*(J11L*J13L*PDstandardNth11beta2 + + J13L*J21L*PDstandardNth12beta2 + J11L*J23L*PDstandardNth12beta2 + + J13L*J31L*PDstandardNth13beta2 + J11L*J33L*PDstandardNth13beta2 + + dJ113L*PDstandardNth1beta2 + J21L*J23L*PDstandardNth22beta2 + + J23L*J31L*PDstandardNth23beta2 + J21L*J33L*PDstandardNth23beta2 + + dJ213L*PDstandardNth2beta2 + J31L*J33L*PDstandardNth33beta2 + + dJ313L*PDstandardNth3beta2) + gtu23*(J12L*J13L*PDstandardNth11beta2 + + J13L*J22L*PDstandardNth12beta2 + J12L*J23L*PDstandardNth12beta2 + + J13L*J32L*PDstandardNth13beta2 + J12L*J33L*PDstandardNth13beta2 + + dJ123L*PDstandardNth1beta2 + J22L*J23L*PDstandardNth22beta2 + + J23L*J32L*PDstandardNth23beta2 + J22L*J33L*PDstandardNth23beta2 + + dJ223L*PDstandardNth2beta2 + J32L*J33L*PDstandardNth33beta2 + + dJ323L*PDstandardNth3beta2) + alphaL*(6*(Atu12*cdphi1 + Atu22*cdphi2 + + Atu23*cdphi3) + Atu11*Gt211 + 2*Atu12*Gt212 + 2*Atu13*Gt213 + + Atu22*Gt222 + 2*Atu23*Gt223 + Atu33*Gt233 - + 0.666666666666666666666666666667*((gtu12*J11L + gtu22*J12L + + gtu23*J13L)*PDstandardNth1trK + (gtu12*J21L + gtu22*J22L + + gtu23*J23L)*PDstandardNth2trK + (gtu12*J31L + gtu22*J32L + + gtu23*J33L)*PDstandardNth3trK))) + (beta1L*J11L + beta2L*J12L + + beta3L*J13L)*PDupwindNthAnti1Xt2 + (beta1L*J21L + beta2L*J22L + + beta3L*J23L)*PDupwindNthAnti2Xt2 + (beta1L*J31L + beta2L*J32L + + beta3L*J33L)*PDupwindNthAnti3Xt2 - + 50.26548245743669181540229413247204614715*alphaL*(gtu12*S1 + gtu22*S2 + + gtu23*S3) + 0.666666666666666666666666666667*(J11L*PDstandardNth1beta1 + + J12L*PDstandardNth1beta2 + J13L*PDstandardNth1beta3 + + J21L*PDstandardNth2beta1 + J22L*PDstandardNth2beta2 + + J23L*PDstandardNth2beta3 + J31L*PDstandardNth3beta1 + + J32L*PDstandardNth3beta2 + J33L*PDstandardNth3beta3)*Xtn2 - + PDstandardNth1beta2*(J11L*Xtn1 + J12L*Xtn2 + J13L*Xtn3) - + PDstandardNth2beta2*(J21L*Xtn1 + J22L*Xtn2 + J23L*Xtn3) - + PDstandardNth3beta2*(J31L*Xtn1 + J32L*Xtn2 + J33L*Xtn3) + + (J11L*PDupwindNthSymm1Xt2 + J21L*PDupwindNthSymm2Xt2 + + J31L*PDupwindNthSymm3Xt2)*Abs(beta1L) + (J12L*PDupwindNthSymm1Xt2 + + J22L*PDupwindNthSymm2Xt2 + J32L*PDupwindNthSymm3Xt2)*Abs(beta2L) + + (J13L*PDupwindNthSymm1Xt2 + J23L*PDupwindNthSymm2Xt2 + + J33L*PDupwindNthSymm3Xt2)*Abs(beta3L) + + gtu11*(2*J11L*J21L*PDstandardNth12beta2 + + 2*J11L*J31L*PDstandardNth13beta2 + dJ111L*PDstandardNth1beta2 + + 2*J21L*J31L*PDstandardNth23beta2 + dJ211L*PDstandardNth2beta2 + + dJ311L*PDstandardNth3beta2 + PDstandardNth11beta2*SQR(J11L) + + PDstandardNth22beta2*SQR(J21L) + PDstandardNth33beta2*SQR(J31L)) + + gtu22*(2*J12L*J22L*PDstandardNth12beta2 + + 2*J12L*J32L*PDstandardNth13beta2 + dJ122L*PDstandardNth1beta2 + + 2*J22L*J32L*PDstandardNth23beta2 + dJ222L*PDstandardNth2beta2 + + dJ322L*PDstandardNth3beta2 + PDstandardNth11beta2*SQR(J12L) + + PDstandardNth22beta2*SQR(J22L) + PDstandardNth33beta2*SQR(J32L)) + + gtu33*(2*J13L*J23L*PDstandardNth12beta2 + + 2*J13L*J33L*PDstandardNth13beta2 + dJ133L*PDstandardNth1beta2 + + 2*J23L*J33L*PDstandardNth23beta2 + dJ233L*PDstandardNth2beta2 + + dJ333L*PDstandardNth3beta2 + PDstandardNth11beta2*SQR(J13L) + + PDstandardNth22beta2*SQR(J23L) + PDstandardNth33beta2*SQR(J33L)) + + 0.333333333333333333333333333333*(gtu12*(J11L*J12L*PDstandardNth11beta2 + + J11L*J13L*PDstandardNth11beta3 + 2*J11L*J21L*PDstandardNth12beta1 + + J12L*J21L*PDstandardNth12beta2 + J11L*J22L*PDstandardNth12beta2 + + J13L*J21L*PDstandardNth12beta3 + J11L*J23L*PDstandardNth12beta3 + + 2*J11L*J31L*PDstandardNth13beta1 + J12L*J31L*PDstandardNth13beta2 + + J11L*J32L*PDstandardNth13beta2 + J13L*J31L*PDstandardNth13beta3 + + J11L*J33L*PDstandardNth13beta3 + dJ111L*PDstandardNth1beta1 + + dJ112L*PDstandardNth1beta2 + dJ113L*PDstandardNth1beta3 + + J21L*J22L*PDstandardNth22beta2 + J21L*J23L*PDstandardNth22beta3 + + 2*J21L*J31L*PDstandardNth23beta1 + J22L*J31L*PDstandardNth23beta2 + + J21L*J32L*PDstandardNth23beta2 + J23L*J31L*PDstandardNth23beta3 + + J21L*J33L*PDstandardNth23beta3 + dJ211L*PDstandardNth2beta1 + + dJ212L*PDstandardNth2beta2 + dJ213L*PDstandardNth2beta3 + + J31L*J32L*PDstandardNth33beta2 + J31L*J33L*PDstandardNth33beta3 + + dJ311L*PDstandardNth3beta1 + dJ312L*PDstandardNth3beta2 + + dJ313L*PDstandardNth3beta3 + PDstandardNth11beta1*SQR(J11L) + + PDstandardNth22beta1*SQR(J21L) + PDstandardNth33beta1*SQR(J31L)) + + gtu22*(J11L*J12L*PDstandardNth11beta1 + J12L*J13L*PDstandardNth11beta3 + + J12L*J21L*PDstandardNth12beta1 + J11L*J22L*PDstandardNth12beta1 + + 2*J12L*J22L*PDstandardNth12beta2 + J13L*J22L*PDstandardNth12beta3 + + J12L*J23L*PDstandardNth12beta3 + J12L*J31L*PDstandardNth13beta1 + + J11L*J32L*PDstandardNth13beta1 + 2*J12L*J32L*PDstandardNth13beta2 + + J13L*J32L*PDstandardNth13beta3 + J12L*J33L*PDstandardNth13beta3 + + dJ112L*PDstandardNth1beta1 + dJ122L*PDstandardNth1beta2 + + dJ123L*PDstandardNth1beta3 + J21L*J22L*PDstandardNth22beta1 + + J22L*J23L*PDstandardNth22beta3 + J22L*J31L*PDstandardNth23beta1 + + J21L*J32L*PDstandardNth23beta1 + 2*J22L*J32L*PDstandardNth23beta2 + + J23L*J32L*PDstandardNth23beta3 + J22L*J33L*PDstandardNth23beta3 + + dJ212L*PDstandardNth2beta1 + dJ222L*PDstandardNth2beta2 + + dJ223L*PDstandardNth2beta3 + J31L*J32L*PDstandardNth33beta1 + + J32L*J33L*PDstandardNth33beta3 + dJ312L*PDstandardNth3beta1 + + dJ322L*PDstandardNth3beta2 + dJ323L*PDstandardNth3beta3 + + PDstandardNth11beta2*SQR(J12L) + PDstandardNth22beta2*SQR(J22L) + + PDstandardNth33beta2*SQR(J32L)) + gtu23*(J11L*J13L*PDstandardNth11beta1 + + J12L*J13L*PDstandardNth11beta2 + J13L*J21L*PDstandardNth12beta1 + + J11L*J23L*PDstandardNth12beta1 + J13L*J22L*PDstandardNth12beta2 + + J12L*J23L*PDstandardNth12beta2 + 2*J13L*J23L*PDstandardNth12beta3 + + J13L*J31L*PDstandardNth13beta1 + J11L*J33L*PDstandardNth13beta1 + + J13L*J32L*PDstandardNth13beta2 + J12L*J33L*PDstandardNth13beta2 + + 2*J13L*J33L*PDstandardNth13beta3 + dJ113L*PDstandardNth1beta1 + + dJ123L*PDstandardNth1beta2 + dJ133L*PDstandardNth1beta3 + + J21L*J23L*PDstandardNth22beta1 + J22L*J23L*PDstandardNth22beta2 + + J23L*J31L*PDstandardNth23beta1 + J21L*J33L*PDstandardNth23beta1 + + J23L*J32L*PDstandardNth23beta2 + J22L*J33L*PDstandardNth23beta2 + + 2*J23L*J33L*PDstandardNth23beta3 + dJ213L*PDstandardNth2beta1 + + dJ223L*PDstandardNth2beta2 + dJ233L*PDstandardNth2beta3 + + J31L*J33L*PDstandardNth33beta1 + J32L*J33L*PDstandardNth33beta2 + + dJ313L*PDstandardNth3beta1 + dJ323L*PDstandardNth3beta2 + + dJ333L*PDstandardNth3beta3 + PDstandardNth11beta3*SQR(J13L) + + PDstandardNth22beta3*SQR(J23L) + PDstandardNth33beta3*SQR(J33L))); + + CCTK_REAL dotXt3 = (epsdiss1*J11L + epsdiss2*J12L + + epsdiss3*J13L)*PDdissipationNth1Xt3 + (epsdiss1*J21L + epsdiss2*J22L + + epsdiss3*J23L)*PDdissipationNth2Xt3 + (epsdiss1*J31L + epsdiss2*J32L + + epsdiss3*J33L)*PDdissipationNth3Xt3 - 2*((Atu13*J11L + Atu23*J12L + + Atu33*J13L)*PDstandardNth1alpha + (Atu13*J21L + Atu23*J22L + + Atu33*J23L)*PDstandardNth2alpha + (Atu13*J31L + Atu23*J32L + + Atu33*J33L)*PDstandardNth3alpha) + + 2*(gtu12*(J11L*J12L*PDstandardNth11beta3 + + J12L*J21L*PDstandardNth12beta3 + J11L*J22L*PDstandardNth12beta3 + + J12L*J31L*PDstandardNth13beta3 + J11L*J32L*PDstandardNth13beta3 + + dJ112L*PDstandardNth1beta3 + J21L*J22L*PDstandardNth22beta3 + + J22L*J31L*PDstandardNth23beta3 + J21L*J32L*PDstandardNth23beta3 + + dJ212L*PDstandardNth2beta3 + J31L*J32L*PDstandardNth33beta3 + + dJ312L*PDstandardNth3beta3) + gtu13*(J11L*J13L*PDstandardNth11beta3 + + J13L*J21L*PDstandardNth12beta3 + J11L*J23L*PDstandardNth12beta3 + + J13L*J31L*PDstandardNth13beta3 + J11L*J33L*PDstandardNth13beta3 + + dJ113L*PDstandardNth1beta3 + J21L*J23L*PDstandardNth22beta3 + + J23L*J31L*PDstandardNth23beta3 + J21L*J33L*PDstandardNth23beta3 + + dJ213L*PDstandardNth2beta3 + J31L*J33L*PDstandardNth33beta3 + + dJ313L*PDstandardNth3beta3) + gtu23*(J12L*J13L*PDstandardNth11beta3 + + J13L*J22L*PDstandardNth12beta3 + J12L*J23L*PDstandardNth12beta3 + + J13L*J32L*PDstandardNth13beta3 + J12L*J33L*PDstandardNth13beta3 + + dJ123L*PDstandardNth1beta3 + J22L*J23L*PDstandardNth22beta3 + + J23L*J32L*PDstandardNth23beta3 + J22L*J33L*PDstandardNth23beta3 + + dJ223L*PDstandardNth2beta3 + J32L*J33L*PDstandardNth33beta3 + + dJ323L*PDstandardNth3beta3) + alphaL*(6*(Atu13*cdphi1 + Atu23*cdphi2 + + Atu33*cdphi3) + Atu11*Gt311 + 2*Atu12*Gt312 + 2*Atu13*Gt313 + + Atu22*Gt322 + 2*Atu23*Gt323 + Atu33*Gt333 - + 0.666666666666666666666666666667*((gtu13*J11L + gtu23*J12L + + gtu33*J13L)*PDstandardNth1trK + (gtu13*J21L + gtu23*J22L + + gtu33*J23L)*PDstandardNth2trK + (gtu13*J31L + gtu23*J32L + + gtu33*J33L)*PDstandardNth3trK))) + (beta1L*J11L + beta2L*J12L + + beta3L*J13L)*PDupwindNthAnti1Xt3 + (beta1L*J21L + beta2L*J22L + + beta3L*J23L)*PDupwindNthAnti2Xt3 + (beta1L*J31L + beta2L*J32L + + beta3L*J33L)*PDupwindNthAnti3Xt3 - + 50.26548245743669181540229413247204614715*alphaL*(gtu13*S1 + gtu23*S2 + + gtu33*S3) + 0.666666666666666666666666666667*(J11L*PDstandardNth1beta1 + + J12L*PDstandardNth1beta2 + J13L*PDstandardNth1beta3 + + J21L*PDstandardNth2beta1 + J22L*PDstandardNth2beta2 + + J23L*PDstandardNth2beta3 + J31L*PDstandardNth3beta1 + + J32L*PDstandardNth3beta2 + J33L*PDstandardNth3beta3)*Xtn3 - + PDstandardNth1beta3*(J11L*Xtn1 + J12L*Xtn2 + J13L*Xtn3) - + PDstandardNth2beta3*(J21L*Xtn1 + J22L*Xtn2 + J23L*Xtn3) - + PDstandardNth3beta3*(J31L*Xtn1 + J32L*Xtn2 + J33L*Xtn3) + + (J11L*PDupwindNthSymm1Xt3 + J21L*PDupwindNthSymm2Xt3 + + J31L*PDupwindNthSymm3Xt3)*Abs(beta1L) + (J12L*PDupwindNthSymm1Xt3 + + J22L*PDupwindNthSymm2Xt3 + J32L*PDupwindNthSymm3Xt3)*Abs(beta2L) + + (J13L*PDupwindNthSymm1Xt3 + J23L*PDupwindNthSymm2Xt3 + + J33L*PDupwindNthSymm3Xt3)*Abs(beta3L) + + gtu11*(2*J11L*J21L*PDstandardNth12beta3 + + 2*J11L*J31L*PDstandardNth13beta3 + dJ111L*PDstandardNth1beta3 + + 2*J21L*J31L*PDstandardNth23beta3 + dJ211L*PDstandardNth2beta3 + + dJ311L*PDstandardNth3beta3 + PDstandardNth11beta3*SQR(J11L) + + PDstandardNth22beta3*SQR(J21L) + PDstandardNth33beta3*SQR(J31L)) + + gtu22*(2*J12L*J22L*PDstandardNth12beta3 + + 2*J12L*J32L*PDstandardNth13beta3 + dJ122L*PDstandardNth1beta3 + + 2*J22L*J32L*PDstandardNth23beta3 + dJ222L*PDstandardNth2beta3 + + dJ322L*PDstandardNth3beta3 + PDstandardNth11beta3*SQR(J12L) + + PDstandardNth22beta3*SQR(J22L) + PDstandardNth33beta3*SQR(J32L)) + + gtu33*(2*J13L*J23L*PDstandardNth12beta3 + + 2*J13L*J33L*PDstandardNth13beta3 + dJ133L*PDstandardNth1beta3 + + 2*J23L*J33L*PDstandardNth23beta3 + dJ233L*PDstandardNth2beta3 + + dJ333L*PDstandardNth3beta3 + PDstandardNth11beta3*SQR(J13L) + + PDstandardNth22beta3*SQR(J23L) + PDstandardNth33beta3*SQR(J33L)) + + 0.333333333333333333333333333333*(gtu13*(J11L*J12L*PDstandardNth11beta2 + + J11L*J13L*PDstandardNth11beta3 + 2*J11L*J21L*PDstandardNth12beta1 + + J12L*J21L*PDstandardNth12beta2 + J11L*J22L*PDstandardNth12beta2 + + J13L*J21L*PDstandardNth12beta3 + J11L*J23L*PDstandardNth12beta3 + + 2*J11L*J31L*PDstandardNth13beta1 + J12L*J31L*PDstandardNth13beta2 + + J11L*J32L*PDstandardNth13beta2 + J13L*J31L*PDstandardNth13beta3 + + J11L*J33L*PDstandardNth13beta3 + dJ111L*PDstandardNth1beta1 + + dJ112L*PDstandardNth1beta2 + dJ113L*PDstandardNth1beta3 + + J21L*J22L*PDstandardNth22beta2 + J21L*J23L*PDstandardNth22beta3 + + 2*J21L*J31L*PDstandardNth23beta1 + J22L*J31L*PDstandardNth23beta2 + + J21L*J32L*PDstandardNth23beta2 + J23L*J31L*PDstandardNth23beta3 + + J21L*J33L*PDstandardNth23beta3 + dJ211L*PDstandardNth2beta1 + + dJ212L*PDstandardNth2beta2 + dJ213L*PDstandardNth2beta3 + + J31L*J32L*PDstandardNth33beta2 + J31L*J33L*PDstandardNth33beta3 + + dJ311L*PDstandardNth3beta1 + dJ312L*PDstandardNth3beta2 + + dJ313L*PDstandardNth3beta3 + PDstandardNth11beta1*SQR(J11L) + + PDstandardNth22beta1*SQR(J21L) + PDstandardNth33beta1*SQR(J31L)) + + gtu23*(J11L*J12L*PDstandardNth11beta1 + J12L*J13L*PDstandardNth11beta3 + + J12L*J21L*PDstandardNth12beta1 + J11L*J22L*PDstandardNth12beta1 + + 2*J12L*J22L*PDstandardNth12beta2 + J13L*J22L*PDstandardNth12beta3 + + J12L*J23L*PDstandardNth12beta3 + J12L*J31L*PDstandardNth13beta1 + + J11L*J32L*PDstandardNth13beta1 + 2*J12L*J32L*PDstandardNth13beta2 + + J13L*J32L*PDstandardNth13beta3 + J12L*J33L*PDstandardNth13beta3 + + dJ112L*PDstandardNth1beta1 + dJ122L*PDstandardNth1beta2 + + dJ123L*PDstandardNth1beta3 + J21L*J22L*PDstandardNth22beta1 + + J22L*J23L*PDstandardNth22beta3 + J22L*J31L*PDstandardNth23beta1 + + J21L*J32L*PDstandardNth23beta1 + 2*J22L*J32L*PDstandardNth23beta2 + + J23L*J32L*PDstandardNth23beta3 + J22L*J33L*PDstandardNth23beta3 + + dJ212L*PDstandardNth2beta1 + dJ222L*PDstandardNth2beta2 + + dJ223L*PDstandardNth2beta3 + J31L*J32L*PDstandardNth33beta1 + + J32L*J33L*PDstandardNth33beta3 + dJ312L*PDstandardNth3beta1 + + dJ322L*PDstandardNth3beta2 + dJ323L*PDstandardNth3beta3 + + PDstandardNth11beta2*SQR(J12L) + PDstandardNth22beta2*SQR(J22L) + + PDstandardNth33beta2*SQR(J32L)) + gtu33*(J11L*J13L*PDstandardNth11beta1 + + J12L*J13L*PDstandardNth11beta2 + J13L*J21L*PDstandardNth12beta1 + + J11L*J23L*PDstandardNth12beta1 + J13L*J22L*PDstandardNth12beta2 + + J12L*J23L*PDstandardNth12beta2 + 2*J13L*J23L*PDstandardNth12beta3 + + J13L*J31L*PDstandardNth13beta1 + J11L*J33L*PDstandardNth13beta1 + + J13L*J32L*PDstandardNth13beta2 + J12L*J33L*PDstandardNth13beta2 + + 2*J13L*J33L*PDstandardNth13beta3 + dJ113L*PDstandardNth1beta1 + + dJ123L*PDstandardNth1beta2 + dJ133L*PDstandardNth1beta3 + + J21L*J23L*PDstandardNth22beta1 + J22L*J23L*PDstandardNth22beta2 + + J23L*J31L*PDstandardNth23beta1 + J21L*J33L*PDstandardNth23beta1 + + J23L*J32L*PDstandardNth23beta2 + J22L*J33L*PDstandardNth23beta2 + + 2*J23L*J33L*PDstandardNth23beta3 + dJ213L*PDstandardNth2beta1 + + dJ223L*PDstandardNth2beta2 + dJ233L*PDstandardNth2beta3 + + J31L*J33L*PDstandardNth33beta1 + J32L*J33L*PDstandardNth33beta2 + + dJ313L*PDstandardNth3beta1 + dJ323L*PDstandardNth3beta2 + + dJ333L*PDstandardNth3beta3 + PDstandardNth11beta3*SQR(J13L) + + PDstandardNth22beta3*SQR(J23L) + PDstandardNth33beta3*SQR(J33L))); + + CCTK_REAL Xt1rhsL = dotXt1; + + CCTK_REAL Xt2rhsL = dotXt2; + + CCTK_REAL Xt3rhsL = dotXt3; + + CCTK_REAL dottrK = (epsdiss1*J11L + epsdiss2*J12L + + epsdiss3*J13L)*PDdissipationNth1trK + (epsdiss1*J21L + epsdiss2*J22L + + epsdiss3*J23L)*PDdissipationNth2trK + (epsdiss1*J31L + epsdiss2*J32L + + epsdiss3*J33L)*PDdissipationNth3trK + (beta1L*J11L + beta2L*J12L + + beta3L*J13L)*PDupwindNthAnti1trK + (beta1L*J21L + beta2L*J22L + + beta3L*J23L)*PDupwindNthAnti2trK + (beta1L*J31L + beta2L*J32L + + beta3L*J33L)*PDupwindNthAnti3trK + (J11L*PDupwindNthSymm1trK + + J21L*PDupwindNthSymm2trK + J31L*PDupwindNthSymm3trK)*Abs(beta1L) + + (J12L*PDupwindNthSymm1trK + J22L*PDupwindNthSymm2trK + + J32L*PDupwindNthSymm3trK)*Abs(beta2L) + (J13L*PDupwindNthSymm1trK + + J23L*PDupwindNthSymm2trK + J33L*PDupwindNthSymm3trK)*Abs(beta3L) - + em4phi*(2*((gtu12*J11L*J22L + gtu13*(J13L*J21L + + J11L*J23L))*PDstandardNth12alpha + (gtu12*J11L*J32L + gtu13*(J13L*J31L + + J11L*J33L))*PDstandardNth13alpha + J11L*((gtu12*J12L + + gtu13*J13L)*PDstandardNth11alpha + gtu11*(J21L*PDstandardNth12alpha + + J31L*PDstandardNth13alpha)) + J12L*(gtu23*J13L*PDstandardNth11alpha + + gtu12*(J21L*PDstandardNth12alpha + J31L*PDstandardNth13alpha)) + + (gtu11*J21L*J31L + (gtu22*J22L + gtu23*J23L)*J32L + (gtu23*J22L + + gtu33*J23L)*J33L)*PDstandardNth23alpha + J22L*((gtu22*J12L + + gtu23*J13L)*PDstandardNth12alpha + (gtu12*J21L + + gtu23*J23L)*PDstandardNth22alpha + gtu12*J31L*PDstandardNth23alpha) + + J23L*((gtu23*J12L + gtu33*J13L)*PDstandardNth12alpha + + gtu13*(J21L*PDstandardNth22alpha + J31L*PDstandardNth23alpha)) + + (gtu12*(dJ312L + cdphi2*J31L) + cdphi3*(gtu13*J31L + + gtu23*J32L))*PDstandardNth3alpha + J32L*((gtu22*J12L + + gtu23*J13L)*PDstandardNth13alpha + gtu23*J33L*PDstandardNth33alpha + + gtu12*(J21L*PDstandardNth23alpha + J31L*PDstandardNth33alpha) + + cdphi2*gtu22*PDstandardNth3alpha) + J33L*((gtu23*J12L + + gtu33*J13L)*PDstandardNth13alpha + gtu13*(J21L*PDstandardNth23alpha + + J31L*PDstandardNth33alpha) + (cdphi2*gtu23 + + cdphi3*gtu33)*PDstandardNth3alpha)) + + PDstandardNth1alpha*(gtu11*(dJ111L + 2*cdphi1*J11L) + gtu22*(dJ122L + + 2*cdphi2*J12L) + gtu33*(dJ133L + 2*cdphi3*J13L) + 2*(dJ112L*gtu12 + + dJ113L*gtu13 + dJ123L*gtu23 + cdphi2*gtu12*J11L + cdphi3*gtu13*J11L + + cdphi1*gtu12*J12L + cdphi3*gtu23*J12L + cdphi1*gtu13*J13L + + cdphi2*gtu23*J13L) - J11L*Xtn1 - J12L*Xtn2 - J13L*Xtn3) + + PDstandardNth2alpha*(gtu11*(dJ211L + 2*cdphi1*J21L) + gtu22*(dJ222L + + 2*cdphi2*J22L) + gtu33*(dJ233L + 2*cdphi3*J23L) + 2*(dJ212L*gtu12 + + dJ213L*gtu13 + dJ223L*gtu23 + cdphi2*gtu12*J21L + cdphi3*gtu13*J21L + + cdphi1*gtu12*J22L + cdphi3*gtu23*J22L + cdphi1*gtu13*J23L + + cdphi2*gtu23*J23L) - J21L*Xtn1 - J22L*Xtn2 - J23L*Xtn3) + + PDstandardNth3alpha*(dJ322L*gtu22 + dJ333L*gtu33 + gtu11*(dJ311L + + 2*cdphi1*J31L) + 2*(dJ313L*gtu13 + dJ323L*gtu23 + cdphi1*gtu12*J32L + + cdphi1*gtu13*J33L) - J31L*Xtn1 - J32L*Xtn2 - J33L*Xtn3) + + PDstandardNth11alpha*(gtu11*SQR(J11L) + gtu22*SQR(J12L) + + gtu33*SQR(J13L)) + PDstandardNth22alpha*(gtu11*SQR(J21L) + + gtu22*SQR(J22L) + gtu33*SQR(J23L)) + + PDstandardNth33alpha*(gtu11*SQR(J31L) + gtu22*SQR(J32L) + + gtu33*SQR(J33L))) + alphaL*(2*(Atm12*Atm21 + Atm13*Atm31 + Atm23*Atm32) + + 12.56637061435917295385057353311801153679*(rho + trS) + SQR(Atm11) + + SQR(Atm22) + SQR(Atm33) + 0.333333333333333333333333333333*SQR(trKL)); + + CCTK_REAL trKrhsL = dottrK; + + CCTK_REAL alpharhsL = (epsdiss1*J11L + epsdiss2*J12L + + epsdiss3*J13L)*PDdissipationNth1alpha + (epsdiss1*J21L + epsdiss2*J22L + + epsdiss3*J23L)*PDdissipationNth2alpha + (epsdiss1*J31L + + epsdiss2*J32L + epsdiss3*J33L)*PDdissipationNth3alpha - + pow(alphaL,ToReal(harmonicN))*ToReal(harmonicF)*(trKL + (AL - + trKL)*ToReal(LapseACoeff)) + ((beta1L*J11L + beta2L*J12L + + beta3L*J13L)*PDupwindNthAnti1alpha + (beta1L*J21L + beta2L*J22L + + beta3L*J23L)*PDupwindNthAnti2alpha + (beta1L*J31L + beta2L*J32L + + beta3L*J33L)*PDupwindNthAnti3alpha + (J11L*PDupwindNthSymm1alpha + + J21L*PDupwindNthSymm2alpha + J31L*PDupwindNthSymm3alpha)*Abs(beta1L) + + (J12L*PDupwindNthSymm1alpha + J22L*PDupwindNthSymm2alpha + + J32L*PDupwindNthSymm3alpha)*Abs(beta2L) + (J13L*PDupwindNthSymm1alpha + + J23L*PDupwindNthSymm2alpha + + J33L*PDupwindNthSymm3alpha)*Abs(beta3L))*ToReal(LapseAdvectionCoeff); + + CCTK_REAL ArhsL = (epsdiss1*J11L + epsdiss2*J12L + + epsdiss3*J13L)*PDdissipationNth1A + (epsdiss1*J21L + epsdiss2*J22L + + epsdiss3*J23L)*PDdissipationNth2A + (epsdiss1*J31L + epsdiss2*J32L + + epsdiss3*J33L)*PDdissipationNth3A + (dottrK - + AL*ToReal(AlphaDriver))*ToReal(LapseACoeff) + ((beta1L*J11L + + beta2L*J12L + beta3L*J13L)*PDupwindNthAnti1A + (beta1L*J21L + + beta2L*J22L + beta3L*J23L)*PDupwindNthAnti2A + (beta1L*J31L + + beta2L*J32L + beta3L*J33L)*PDupwindNthAnti3A + (J11L*PDupwindNthSymm1A + + J21L*PDupwindNthSymm2A + J31L*PDupwindNthSymm3A)*Abs(beta1L) + + (J12L*PDupwindNthSymm1A + J22L*PDupwindNthSymm2A + + J32L*PDupwindNthSymm3A)*Abs(beta2L) + (J13L*PDupwindNthSymm1A + + J23L*PDupwindNthSymm2A + + J33L*PDupwindNthSymm3A)*Abs(beta3L))*ToReal(LapseAdvectionCoeff); + + CCTK_REAL eta = fmin(1,INV(rL)*ToReal(SpatialBetaDriverRadius)); + + CCTK_REAL theta = fmin(1,exp(1 - + rL*INV(ToReal(SpatialShiftGammaCoeffRadius)))); + + CCTK_REAL beta1rhsL = (epsdiss1*J11L + epsdiss2*J12L + + epsdiss3*J13L)*PDdissipationNth1beta1 + (epsdiss1*J21L + epsdiss2*J22L + + epsdiss3*J23L)*PDdissipationNth2beta1 + (epsdiss1*J31L + + epsdiss2*J32L + epsdiss3*J33L)*PDdissipationNth3beta1 + ((beta1L*J11L + + beta2L*J12L + beta3L*J13L)*PDupwindNthAnti1beta1 + (beta1L*J21L + + beta2L*J22L + beta3L*J23L)*PDupwindNthAnti2beta1 + (beta1L*J31L + + beta2L*J32L + beta3L*J33L)*PDupwindNthAnti3beta1 + + (J11L*PDupwindNthSymm1beta1 + J21L*PDupwindNthSymm2beta1 + + J31L*PDupwindNthSymm3beta1)*Abs(beta1L) + (J12L*PDupwindNthSymm1beta1 + + J22L*PDupwindNthSymm2beta1 + J32L*PDupwindNthSymm3beta1)*Abs(beta2L) + + (J13L*PDupwindNthSymm1beta1 + J23L*PDupwindNthSymm2beta1 + + J33L*PDupwindNthSymm3beta1)*Abs(beta3L))*ToReal(ShiftAdvectionCoeff) + + theta*(Xt1L + beta1L*eta*ToReal(BetaDriver)*(-1 + ToReal(ShiftBCoeff)) + + (B1L - Xt1L)*ToReal(ShiftBCoeff))*ToReal(ShiftGammaCoeff); + + CCTK_REAL beta2rhsL = (epsdiss1*J11L + epsdiss2*J12L + + epsdiss3*J13L)*PDdissipationNth1beta2 + (epsdiss1*J21L + epsdiss2*J22L + + epsdiss3*J23L)*PDdissipationNth2beta2 + (epsdiss1*J31L + + epsdiss2*J32L + epsdiss3*J33L)*PDdissipationNth3beta2 + ((beta1L*J11L + + beta2L*J12L + beta3L*J13L)*PDupwindNthAnti1beta2 + (beta1L*J21L + + beta2L*J22L + beta3L*J23L)*PDupwindNthAnti2beta2 + (beta1L*J31L + + beta2L*J32L + beta3L*J33L)*PDupwindNthAnti3beta2 + + (J11L*PDupwindNthSymm1beta2 + J21L*PDupwindNthSymm2beta2 + + J31L*PDupwindNthSymm3beta2)*Abs(beta1L) + (J12L*PDupwindNthSymm1beta2 + + J22L*PDupwindNthSymm2beta2 + J32L*PDupwindNthSymm3beta2)*Abs(beta2L) + + (J13L*PDupwindNthSymm1beta2 + J23L*PDupwindNthSymm2beta2 + + J33L*PDupwindNthSymm3beta2)*Abs(beta3L))*ToReal(ShiftAdvectionCoeff) + + theta*(Xt2L + beta2L*eta*ToReal(BetaDriver)*(-1 + ToReal(ShiftBCoeff)) + + (B2L - Xt2L)*ToReal(ShiftBCoeff))*ToReal(ShiftGammaCoeff); + + CCTK_REAL beta3rhsL = (epsdiss1*J11L + epsdiss2*J12L + + epsdiss3*J13L)*PDdissipationNth1beta3 + (epsdiss1*J21L + epsdiss2*J22L + + epsdiss3*J23L)*PDdissipationNth2beta3 + (epsdiss1*J31L + + epsdiss2*J32L + epsdiss3*J33L)*PDdissipationNth3beta3 + ((beta1L*J11L + + beta2L*J12L + beta3L*J13L)*PDupwindNthAnti1beta3 + (beta1L*J21L + + beta2L*J22L + beta3L*J23L)*PDupwindNthAnti2beta3 + (beta1L*J31L + + beta2L*J32L + beta3L*J33L)*PDupwindNthAnti3beta3 + + (J11L*PDupwindNthSymm1beta3 + J21L*PDupwindNthSymm2beta3 + + J31L*PDupwindNthSymm3beta3)*Abs(beta1L) + (J12L*PDupwindNthSymm1beta3 + + J22L*PDupwindNthSymm2beta3 + J32L*PDupwindNthSymm3beta3)*Abs(beta2L) + + (J13L*PDupwindNthSymm1beta3 + J23L*PDupwindNthSymm2beta3 + + J33L*PDupwindNthSymm3beta3)*Abs(beta3L))*ToReal(ShiftAdvectionCoeff) + + theta*(Xt3L + beta3L*eta*ToReal(BetaDriver)*(-1 + ToReal(ShiftBCoeff)) + + (B3L - Xt3L)*ToReal(ShiftBCoeff))*ToReal(ShiftGammaCoeff); + + CCTK_REAL B1rhsL = (epsdiss1*J11L + epsdiss2*J12L + + epsdiss3*J13L)*PDdissipationNth1B1 + (epsdiss1*J21L + epsdiss2*J22L + + epsdiss3*J23L)*PDdissipationNth2B1 + (epsdiss1*J31L + epsdiss2*J32L + + epsdiss3*J33L)*PDdissipationNth3B1 + ((beta1L*J11L + beta2L*J12L + + beta3L*J13L)*(PDupwindNthAnti1B1 - PDupwindNthAnti1Xt1) + (beta1L*J21L + + beta2L*J22L + beta3L*J23L)*(PDupwindNthAnti2B1 - PDupwindNthAnti2Xt1) + + (beta1L*J31L + beta2L*J32L + beta3L*J33L)*(PDupwindNthAnti3B1 - + PDupwindNthAnti3Xt1) + (J11L*(PDupwindNthSymm1B1 - PDupwindNthSymm1Xt1) + + J21L*(PDupwindNthSymm2B1 - PDupwindNthSymm2Xt1) + + J31L*(PDupwindNthSymm3B1 - PDupwindNthSymm3Xt1))*Abs(beta1L) + + (J12L*(PDupwindNthSymm1B1 - PDupwindNthSymm1Xt1) + + J22L*(PDupwindNthSymm2B1 - PDupwindNthSymm2Xt1) + + J32L*(PDupwindNthSymm3B1 - PDupwindNthSymm3Xt1))*Abs(beta2L) + + (J13L*(PDupwindNthSymm1B1 - PDupwindNthSymm1Xt1) + + J23L*(PDupwindNthSymm2B1 - PDupwindNthSymm2Xt1) + + J33L*(PDupwindNthSymm3B1 - + PDupwindNthSymm3Xt1))*Abs(beta3L))*ToReal(ShiftAdvectionCoeff) + + (dotXt1 - B1L*eta*ToReal(BetaDriver))*ToReal(ShiftBCoeff); + + CCTK_REAL B2rhsL = (epsdiss1*J11L + epsdiss2*J12L + + epsdiss3*J13L)*PDdissipationNth1B2 + (epsdiss1*J21L + epsdiss2*J22L + + epsdiss3*J23L)*PDdissipationNth2B2 + (epsdiss1*J31L + epsdiss2*J32L + + epsdiss3*J33L)*PDdissipationNth3B2 + ((beta1L*J11L + beta2L*J12L + + beta3L*J13L)*(PDupwindNthAnti1B2 - PDupwindNthAnti1Xt2) + (beta1L*J21L + + beta2L*J22L + beta3L*J23L)*(PDupwindNthAnti2B2 - PDupwindNthAnti2Xt2) + + (beta1L*J31L + beta2L*J32L + beta3L*J33L)*(PDupwindNthAnti3B2 - + PDupwindNthAnti3Xt2) + (J11L*(PDupwindNthSymm1B2 - PDupwindNthSymm1Xt2) + + J21L*(PDupwindNthSymm2B2 - PDupwindNthSymm2Xt2) + + J31L*(PDupwindNthSymm3B2 - PDupwindNthSymm3Xt2))*Abs(beta1L) + + (J12L*(PDupwindNthSymm1B2 - PDupwindNthSymm1Xt2) + + J22L*(PDupwindNthSymm2B2 - PDupwindNthSymm2Xt2) + + J32L*(PDupwindNthSymm3B2 - PDupwindNthSymm3Xt2))*Abs(beta2L) + + (J13L*(PDupwindNthSymm1B2 - PDupwindNthSymm1Xt2) + + J23L*(PDupwindNthSymm2B2 - PDupwindNthSymm2Xt2) + + J33L*(PDupwindNthSymm3B2 - + PDupwindNthSymm3Xt2))*Abs(beta3L))*ToReal(ShiftAdvectionCoeff) + + (dotXt2 - B2L*eta*ToReal(BetaDriver))*ToReal(ShiftBCoeff); + + CCTK_REAL B3rhsL = (epsdiss1*J11L + epsdiss2*J12L + + epsdiss3*J13L)*PDdissipationNth1B3 + (epsdiss1*J21L + epsdiss2*J22L + + epsdiss3*J23L)*PDdissipationNth2B3 + (epsdiss1*J31L + epsdiss2*J32L + + epsdiss3*J33L)*PDdissipationNth3B3 + ((beta1L*J11L + beta2L*J12L + + beta3L*J13L)*(PDupwindNthAnti1B3 - PDupwindNthAnti1Xt3) + (beta1L*J21L + + beta2L*J22L + beta3L*J23L)*(PDupwindNthAnti2B3 - PDupwindNthAnti2Xt3) + + (beta1L*J31L + beta2L*J32L + beta3L*J33L)*(PDupwindNthAnti3B3 - + PDupwindNthAnti3Xt3) + (J11L*(PDupwindNthSymm1B3 - PDupwindNthSymm1Xt3) + + J21L*(PDupwindNthSymm2B3 - PDupwindNthSymm2Xt3) + + J31L*(PDupwindNthSymm3B3 - PDupwindNthSymm3Xt3))*Abs(beta1L) + + (J12L*(PDupwindNthSymm1B3 - PDupwindNthSymm1Xt3) + + J22L*(PDupwindNthSymm2B3 - PDupwindNthSymm2Xt3) + + J32L*(PDupwindNthSymm3B3 - PDupwindNthSymm3Xt3))*Abs(beta2L) + + (J13L*(PDupwindNthSymm1B3 - PDupwindNthSymm1Xt3) + + J23L*(PDupwindNthSymm2B3 - PDupwindNthSymm2Xt3) + + J33L*(PDupwindNthSymm3B3 - + PDupwindNthSymm3Xt3))*Abs(beta3L))*ToReal(ShiftAdvectionCoeff) + + (dotXt3 - B3L*eta*ToReal(BetaDriver))*ToReal(ShiftBCoeff); + + + /* Copy local copies back to grid functions */ + alpharhs[index] = alpharhsL; + Arhs[index] = ArhsL; + B1rhs[index] = B1rhsL; + B2rhs[index] = B2rhsL; + B3rhs[index] = B3rhsL; + beta1rhs[index] = beta1rhsL; + beta2rhs[index] = beta2rhsL; + beta3rhs[index] = beta3rhsL; + gt11rhs[index] = gt11rhsL; + gt12rhs[index] = gt12rhsL; + gt13rhs[index] = gt13rhsL; + gt22rhs[index] = gt22rhsL; + gt23rhs[index] = gt23rhsL; + gt33rhs[index] = gt33rhsL; + phirhs[index] = phirhsL; + trKrhs[index] = trKrhsL; + Xt1rhs[index] = Xt1rhsL; + Xt2rhs[index] = Xt2rhsL; + Xt3rhs[index] = Xt3rhsL; + } + LC_ENDLOOP3 (ML_BSSN_MP_O8_RHS1); +} + +extern "C" void ML_BSSN_MP_O8_RHS1(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverInterior(cctkGH, &ML_BSSN_MP_O8_RHS1_Body); +} diff --git a/ML_BSSN_MP_O8/src/ML_BSSN_MP_O8_RHS2.cc b/ML_BSSN_MP_O8/src/ML_BSSN_MP_O8_RHS2.cc new file mode 100644 index 0000000..775b4af --- /dev/null +++ b/ML_BSSN_MP_O8/src/ML_BSSN_MP_O8_RHS2.cc @@ -0,0 +1,1220 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +extern "C" void ML_BSSN_MP_O8_RHS2_SelectBCs(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT ierr = 0; + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_MP_O8::ML_curvrhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_MP_O8::ML_curvrhs."); + return; +} + +static void ML_BSSN_MP_O8_RHS2_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_BSSN_MP_O8_RHS2_Body"); + } + + if (cctk_iteration % ML_BSSN_MP_O8_RHS2_calc_every != ML_BSSN_MP_O8_RHS2_calc_offset) + { + return; + } + + const char *groups[] = {"Coordinates::jacobian","Coordinates::jacobian2","ML_BSSN_MP_O8::ML_curv","ML_BSSN_MP_O8::ML_curvrhs","ML_BSSN_MP_O8::ML_Gamma","ML_BSSN_MP_O8::ML_lapse","ML_BSSN_MP_O8::ML_log_confac","ML_BSSN_MP_O8::ML_metric","ML_BSSN_MP_O8::ML_shift","ML_BSSN_MP_O8::ML_trace_curv"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_BSSN_MP_O8_RHS2", 10, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o1024dx = 0.0009765625*INV(dx); + CCTK_REAL const p1o1024dy = 0.0009765625*INV(dy); + CCTK_REAL const p1o1024dz = 0.0009765625*INV(dz); + CCTK_REAL const p1o1680dx = 0.000595238095238095238095238095238*INV(dx); + CCTK_REAL const p1o1680dy = 0.000595238095238095238095238095238*INV(dy); + CCTK_REAL const p1o1680dz = 0.000595238095238095238095238095238*INV(dz); + CCTK_REAL const p1o5040dx2 = 0.000198412698412698412698412698413*INV(SQR(dx)); + CCTK_REAL const p1o5040dy2 = 0.000198412698412698412698412698413*INV(SQR(dy)); + CCTK_REAL const p1o5040dz2 = 0.000198412698412698412698412698413*INV(SQR(dz)); + CCTK_REAL const p1o560dx = 0.00178571428571428571428571428571*INV(dx); + CCTK_REAL const p1o560dy = 0.00178571428571428571428571428571*INV(dy); + CCTK_REAL const p1o560dz = 0.00178571428571428571428571428571*INV(dz); + CCTK_REAL const p1o705600dxdy = 1.41723356009070294784580498866e-6*INV(dx)*INV(dy); + CCTK_REAL const p1o705600dxdz = 1.41723356009070294784580498866e-6*INV(dx)*INV(dz); + CCTK_REAL const p1o705600dydz = 1.41723356009070294784580498866e-6*INV(dy)*INV(dz); + CCTK_REAL const p1o840dx = 0.00119047619047619047619047619048*INV(dx); + CCTK_REAL const p1o840dy = 0.00119047619047619047619047619048*INV(dy); + CCTK_REAL const p1o840dz = 0.00119047619047619047619047619048*INV(dz); + CCTK_REAL const p1odx = INV(dx); + CCTK_REAL const p1ody = INV(dy); + CCTK_REAL const p1odz = INV(dz); + CCTK_REAL const pm1o840dx = -0.00119047619047619047619047619048*INV(dx); + CCTK_REAL const pm1o840dy = -0.00119047619047619047619047619048*INV(dy); + CCTK_REAL const pm1o840dz = -0.00119047619047619047619047619048*INV(dz); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_BSSN_MP_O8_RHS2, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + CCTK_REAL alphaL = alpha[index]; + CCTK_REAL At11L = At11[index]; + CCTK_REAL At12L = At12[index]; + CCTK_REAL At13L = At13[index]; + CCTK_REAL At22L = At22[index]; + CCTK_REAL At23L = At23[index]; + CCTK_REAL At33L = At33[index]; + CCTK_REAL beta1L = beta1[index]; + CCTK_REAL beta2L = beta2[index]; + CCTK_REAL beta3L = beta3[index]; + CCTK_REAL dJ111L = dJ111[index]; + CCTK_REAL dJ112L = dJ112[index]; + CCTK_REAL dJ113L = dJ113[index]; + CCTK_REAL dJ122L = dJ122[index]; + CCTK_REAL dJ123L = dJ123[index]; + CCTK_REAL dJ133L = dJ133[index]; + CCTK_REAL dJ211L = dJ211[index]; + CCTK_REAL dJ212L = dJ212[index]; + CCTK_REAL dJ213L = dJ213[index]; + CCTK_REAL dJ222L = dJ222[index]; + CCTK_REAL dJ223L = dJ223[index]; + CCTK_REAL dJ233L = dJ233[index]; + CCTK_REAL dJ311L = dJ311[index]; + CCTK_REAL dJ312L = dJ312[index]; + CCTK_REAL dJ313L = dJ313[index]; + CCTK_REAL dJ322L = dJ322[index]; + CCTK_REAL dJ323L = dJ323[index]; + CCTK_REAL dJ333L = dJ333[index]; + CCTK_REAL eTxxL = (*stress_energy_state) ? eTxx[index] : ToReal(0.0); + CCTK_REAL eTxyL = (*stress_energy_state) ? eTxy[index] : ToReal(0.0); + CCTK_REAL eTxzL = (*stress_energy_state) ? eTxz[index] : ToReal(0.0); + CCTK_REAL eTyyL = (*stress_energy_state) ? eTyy[index] : ToReal(0.0); + CCTK_REAL eTyzL = (*stress_energy_state) ? eTyz[index] : ToReal(0.0); + CCTK_REAL eTzzL = (*stress_energy_state) ? eTzz[index] : ToReal(0.0); + CCTK_REAL gt11L = gt11[index]; + CCTK_REAL gt12L = gt12[index]; + CCTK_REAL gt13L = gt13[index]; + CCTK_REAL gt22L = gt22[index]; + CCTK_REAL gt23L = gt23[index]; + CCTK_REAL gt33L = gt33[index]; + CCTK_REAL J11L = J11[index]; + CCTK_REAL J12L = J12[index]; + CCTK_REAL J13L = J13[index]; + CCTK_REAL J21L = J21[index]; + CCTK_REAL J22L = J22[index]; + CCTK_REAL J23L = J23[index]; + CCTK_REAL J31L = J31[index]; + CCTK_REAL J32L = J32[index]; + CCTK_REAL J33L = J33[index]; + CCTK_REAL phiL = phi[index]; + CCTK_REAL trKL = trK[index]; + CCTK_REAL Xt1L = Xt1[index]; + CCTK_REAL Xt2L = Xt2[index]; + CCTK_REAL Xt3L = Xt3[index]; + + /* Include user supplied include files */ + + /* Precompute derivatives */ + CCTK_REAL const PDstandardNth1alpha = PDstandardNth1(&alpha[index]); + CCTK_REAL const PDstandardNth2alpha = PDstandardNth2(&alpha[index]); + CCTK_REAL const PDstandardNth3alpha = PDstandardNth3(&alpha[index]); + CCTK_REAL const PDstandardNth11alpha = PDstandardNth11(&alpha[index]); + CCTK_REAL const PDstandardNth22alpha = PDstandardNth22(&alpha[index]); + CCTK_REAL const PDstandardNth33alpha = PDstandardNth33(&alpha[index]); + CCTK_REAL const PDstandardNth12alpha = PDstandardNth12(&alpha[index]); + CCTK_REAL const PDstandardNth13alpha = PDstandardNth13(&alpha[index]); + CCTK_REAL const PDstandardNth23alpha = PDstandardNth23(&alpha[index]); + CCTK_REAL const PDdissipationNth1At11 = PDdissipationNth1(&At11[index]); + CCTK_REAL const PDdissipationNth2At11 = PDdissipationNth2(&At11[index]); + CCTK_REAL const PDdissipationNth3At11 = PDdissipationNth3(&At11[index]); + CCTK_REAL const PDupwindNthAnti1At11 = PDupwindNthAnti1(&At11[index]); + CCTK_REAL const PDupwindNthSymm1At11 = PDupwindNthSymm1(&At11[index]); + CCTK_REAL const PDupwindNthAnti2At11 = PDupwindNthAnti2(&At11[index]); + CCTK_REAL const PDupwindNthSymm2At11 = PDupwindNthSymm2(&At11[index]); + CCTK_REAL const PDupwindNthAnti3At11 = PDupwindNthAnti3(&At11[index]); + CCTK_REAL const PDupwindNthSymm3At11 = PDupwindNthSymm3(&At11[index]); + CCTK_REAL const PDdissipationNth1At12 = PDdissipationNth1(&At12[index]); + CCTK_REAL const PDdissipationNth2At12 = PDdissipationNth2(&At12[index]); + CCTK_REAL const PDdissipationNth3At12 = PDdissipationNth3(&At12[index]); + CCTK_REAL const PDupwindNthAnti1At12 = PDupwindNthAnti1(&At12[index]); + CCTK_REAL const PDupwindNthSymm1At12 = PDupwindNthSymm1(&At12[index]); + CCTK_REAL const PDupwindNthAnti2At12 = PDupwindNthAnti2(&At12[index]); + CCTK_REAL const PDupwindNthSymm2At12 = PDupwindNthSymm2(&At12[index]); + CCTK_REAL const PDupwindNthAnti3At12 = PDupwindNthAnti3(&At12[index]); + CCTK_REAL const PDupwindNthSymm3At12 = PDupwindNthSymm3(&At12[index]); + CCTK_REAL const PDdissipationNth1At13 = PDdissipationNth1(&At13[index]); + CCTK_REAL const PDdissipationNth2At13 = PDdissipationNth2(&At13[index]); + CCTK_REAL const PDdissipationNth3At13 = PDdissipationNth3(&At13[index]); + CCTK_REAL const PDupwindNthAnti1At13 = PDupwindNthAnti1(&At13[index]); + CCTK_REAL const PDupwindNthSymm1At13 = PDupwindNthSymm1(&At13[index]); + CCTK_REAL const PDupwindNthAnti2At13 = PDupwindNthAnti2(&At13[index]); + CCTK_REAL const PDupwindNthSymm2At13 = PDupwindNthSymm2(&At13[index]); + CCTK_REAL const PDupwindNthAnti3At13 = PDupwindNthAnti3(&At13[index]); + CCTK_REAL const PDupwindNthSymm3At13 = PDupwindNthSymm3(&At13[index]); + CCTK_REAL const PDdissipationNth1At22 = PDdissipationNth1(&At22[index]); + CCTK_REAL const PDdissipationNth2At22 = PDdissipationNth2(&At22[index]); + CCTK_REAL const PDdissipationNth3At22 = PDdissipationNth3(&At22[index]); + CCTK_REAL const PDupwindNthAnti1At22 = PDupwindNthAnti1(&At22[index]); + CCTK_REAL const PDupwindNthSymm1At22 = PDupwindNthSymm1(&At22[index]); + CCTK_REAL const PDupwindNthAnti2At22 = PDupwindNthAnti2(&At22[index]); + CCTK_REAL const PDupwindNthSymm2At22 = PDupwindNthSymm2(&At22[index]); + CCTK_REAL const PDupwindNthAnti3At22 = PDupwindNthAnti3(&At22[index]); + CCTK_REAL const PDupwindNthSymm3At22 = PDupwindNthSymm3(&At22[index]); + CCTK_REAL const PDdissipationNth1At23 = PDdissipationNth1(&At23[index]); + CCTK_REAL const PDdissipationNth2At23 = PDdissipationNth2(&At23[index]); + CCTK_REAL const PDdissipationNth3At23 = PDdissipationNth3(&At23[index]); + CCTK_REAL const PDupwindNthAnti1At23 = PDupwindNthAnti1(&At23[index]); + CCTK_REAL const PDupwindNthSymm1At23 = PDupwindNthSymm1(&At23[index]); + CCTK_REAL const PDupwindNthAnti2At23 = PDupwindNthAnti2(&At23[index]); + CCTK_REAL const PDupwindNthSymm2At23 = PDupwindNthSymm2(&At23[index]); + CCTK_REAL const PDupwindNthAnti3At23 = PDupwindNthAnti3(&At23[index]); + CCTK_REAL const PDupwindNthSymm3At23 = PDupwindNthSymm3(&At23[index]); + CCTK_REAL const PDdissipationNth1At33 = PDdissipationNth1(&At33[index]); + CCTK_REAL const PDdissipationNth2At33 = PDdissipationNth2(&At33[index]); + CCTK_REAL const PDdissipationNth3At33 = PDdissipationNth3(&At33[index]); + CCTK_REAL const PDupwindNthAnti1At33 = PDupwindNthAnti1(&At33[index]); + CCTK_REAL const PDupwindNthSymm1At33 = PDupwindNthSymm1(&At33[index]); + CCTK_REAL const PDupwindNthAnti2At33 = PDupwindNthAnti2(&At33[index]); + CCTK_REAL const PDupwindNthSymm2At33 = PDupwindNthSymm2(&At33[index]); + CCTK_REAL const PDupwindNthAnti3At33 = PDupwindNthAnti3(&At33[index]); + CCTK_REAL const PDupwindNthSymm3At33 = PDupwindNthSymm3(&At33[index]); + CCTK_REAL const PDstandardNth1beta1 = PDstandardNth1(&beta1[index]); + CCTK_REAL const PDstandardNth2beta1 = PDstandardNth2(&beta1[index]); + CCTK_REAL const PDstandardNth3beta1 = PDstandardNth3(&beta1[index]); + CCTK_REAL const PDstandardNth1beta2 = PDstandardNth1(&beta2[index]); + CCTK_REAL const PDstandardNth2beta2 = PDstandardNth2(&beta2[index]); + CCTK_REAL const PDstandardNth3beta2 = PDstandardNth3(&beta2[index]); + CCTK_REAL const PDstandardNth1beta3 = PDstandardNth1(&beta3[index]); + CCTK_REAL const PDstandardNth2beta3 = PDstandardNth2(&beta3[index]); + CCTK_REAL const PDstandardNth3beta3 = PDstandardNth3(&beta3[index]); + CCTK_REAL const PDstandardNth1gt11 = PDstandardNth1(>11[index]); + CCTK_REAL const PDstandardNth2gt11 = PDstandardNth2(>11[index]); + CCTK_REAL const PDstandardNth3gt11 = PDstandardNth3(>11[index]); + CCTK_REAL const PDstandardNth11gt11 = PDstandardNth11(>11[index]); + CCTK_REAL const PDstandardNth22gt11 = PDstandardNth22(>11[index]); + CCTK_REAL const PDstandardNth33gt11 = PDstandardNth33(>11[index]); + CCTK_REAL const PDstandardNth12gt11 = PDstandardNth12(>11[index]); + CCTK_REAL const PDstandardNth13gt11 = PDstandardNth13(>11[index]); + CCTK_REAL const PDstandardNth23gt11 = PDstandardNth23(>11[index]); + CCTK_REAL const PDstandardNth1gt12 = PDstandardNth1(>12[index]); + CCTK_REAL const PDstandardNth2gt12 = PDstandardNth2(>12[index]); + CCTK_REAL const PDstandardNth3gt12 = PDstandardNth3(>12[index]); + CCTK_REAL const PDstandardNth11gt12 = PDstandardNth11(>12[index]); + CCTK_REAL const PDstandardNth22gt12 = PDstandardNth22(>12[index]); + CCTK_REAL const PDstandardNth33gt12 = PDstandardNth33(>12[index]); + CCTK_REAL const PDstandardNth12gt12 = PDstandardNth12(>12[index]); + CCTK_REAL const PDstandardNth13gt12 = PDstandardNth13(>12[index]); + CCTK_REAL const PDstandardNth23gt12 = PDstandardNth23(>12[index]); + CCTK_REAL const PDstandardNth1gt13 = PDstandardNth1(>13[index]); + CCTK_REAL const PDstandardNth2gt13 = PDstandardNth2(>13[index]); + CCTK_REAL const PDstandardNth3gt13 = PDstandardNth3(>13[index]); + CCTK_REAL const PDstandardNth11gt13 = PDstandardNth11(>13[index]); + CCTK_REAL const PDstandardNth22gt13 = PDstandardNth22(>13[index]); + CCTK_REAL const PDstandardNth33gt13 = PDstandardNth33(>13[index]); + CCTK_REAL const PDstandardNth12gt13 = PDstandardNth12(>13[index]); + CCTK_REAL const PDstandardNth13gt13 = PDstandardNth13(>13[index]); + CCTK_REAL const PDstandardNth23gt13 = PDstandardNth23(>13[index]); + CCTK_REAL const PDstandardNth1gt22 = PDstandardNth1(>22[index]); + CCTK_REAL const PDstandardNth2gt22 = PDstandardNth2(>22[index]); + CCTK_REAL const PDstandardNth3gt22 = PDstandardNth3(>22[index]); + CCTK_REAL const PDstandardNth11gt22 = PDstandardNth11(>22[index]); + CCTK_REAL const PDstandardNth22gt22 = PDstandardNth22(>22[index]); + CCTK_REAL const PDstandardNth33gt22 = PDstandardNth33(>22[index]); + CCTK_REAL const PDstandardNth12gt22 = PDstandardNth12(>22[index]); + CCTK_REAL const PDstandardNth13gt22 = PDstandardNth13(>22[index]); + CCTK_REAL const PDstandardNth23gt22 = PDstandardNth23(>22[index]); + CCTK_REAL const PDstandardNth1gt23 = PDstandardNth1(>23[index]); + CCTK_REAL const PDstandardNth2gt23 = PDstandardNth2(>23[index]); + CCTK_REAL const PDstandardNth3gt23 = PDstandardNth3(>23[index]); + CCTK_REAL const PDstandardNth11gt23 = PDstandardNth11(>23[index]); + CCTK_REAL const PDstandardNth22gt23 = PDstandardNth22(>23[index]); + CCTK_REAL const PDstandardNth33gt23 = PDstandardNth33(>23[index]); + CCTK_REAL const PDstandardNth12gt23 = PDstandardNth12(>23[index]); + CCTK_REAL const PDstandardNth13gt23 = PDstandardNth13(>23[index]); + CCTK_REAL const PDstandardNth23gt23 = PDstandardNth23(>23[index]); + CCTK_REAL const PDstandardNth1gt33 = PDstandardNth1(>33[index]); + CCTK_REAL const PDstandardNth2gt33 = PDstandardNth2(>33[index]); + CCTK_REAL const PDstandardNth3gt33 = PDstandardNth3(>33[index]); + CCTK_REAL const PDstandardNth11gt33 = PDstandardNth11(>33[index]); + CCTK_REAL const PDstandardNth22gt33 = PDstandardNth22(>33[index]); + CCTK_REAL const PDstandardNth33gt33 = PDstandardNth33(>33[index]); + CCTK_REAL const PDstandardNth12gt33 = PDstandardNth12(>33[index]); + CCTK_REAL const PDstandardNth13gt33 = PDstandardNth13(>33[index]); + CCTK_REAL const PDstandardNth23gt33 = PDstandardNth23(>33[index]); + CCTK_REAL const PDstandardNth1phi = PDstandardNth1(&phi[index]); + CCTK_REAL const PDstandardNth2phi = PDstandardNth2(&phi[index]); + CCTK_REAL const PDstandardNth3phi = PDstandardNth3(&phi[index]); + CCTK_REAL const PDstandardNth11phi = PDstandardNth11(&phi[index]); + CCTK_REAL const PDstandardNth22phi = PDstandardNth22(&phi[index]); + CCTK_REAL const PDstandardNth33phi = PDstandardNth33(&phi[index]); + CCTK_REAL const PDstandardNth12phi = PDstandardNth12(&phi[index]); + CCTK_REAL const PDstandardNth13phi = PDstandardNth13(&phi[index]); + CCTK_REAL const PDstandardNth23phi = PDstandardNth23(&phi[index]); + CCTK_REAL const PDstandardNth1Xt1 = PDstandardNth1(&Xt1[index]); + CCTK_REAL const PDstandardNth2Xt1 = PDstandardNth2(&Xt1[index]); + CCTK_REAL const PDstandardNth3Xt1 = PDstandardNth3(&Xt1[index]); + CCTK_REAL const PDstandardNth1Xt2 = PDstandardNth1(&Xt2[index]); + CCTK_REAL const PDstandardNth2Xt2 = PDstandardNth2(&Xt2[index]); + CCTK_REAL const PDstandardNth3Xt2 = PDstandardNth3(&Xt2[index]); + CCTK_REAL const PDstandardNth1Xt3 = PDstandardNth1(&Xt3[index]); + CCTK_REAL const PDstandardNth2Xt3 = PDstandardNth2(&Xt3[index]); + CCTK_REAL const PDstandardNth3Xt3 = PDstandardNth3(&Xt3[index]); + + /* Calculate temporaries and grid functions */ + ptrdiff_t dir1 = Sign(beta1L); + + ptrdiff_t dir2 = Sign(beta2L); + + ptrdiff_t dir3 = Sign(beta3L); + + CCTK_REAL epsdiss1 = ToReal(EpsDiss); + + CCTK_REAL epsdiss2 = ToReal(EpsDiss); + + CCTK_REAL epsdiss3 = ToReal(EpsDiss); + + CCTK_REAL detgt = 1; + + CCTK_REAL gtu11 = INV(detgt)*(gt22L*gt33L - SQR(gt23L)); + + CCTK_REAL gtu12 = (gt13L*gt23L - gt12L*gt33L)*INV(detgt); + + CCTK_REAL gtu13 = (-(gt13L*gt22L) + gt12L*gt23L)*INV(detgt); + + CCTK_REAL gtu22 = INV(detgt)*(gt11L*gt33L - SQR(gt13L)); + + CCTK_REAL gtu23 = (gt12L*gt13L - gt11L*gt23L)*INV(detgt); + + CCTK_REAL gtu33 = INV(detgt)*(gt11L*gt22L - SQR(gt12L)); + + CCTK_REAL Gtl111 = 0.5*(J11L*PDstandardNth1gt11 + + J21L*PDstandardNth2gt11 + J31L*PDstandardNth3gt11); + + CCTK_REAL Gtl112 = 0.5*(J12L*PDstandardNth1gt11 + + J22L*PDstandardNth2gt11 + J32L*PDstandardNth3gt11); + + CCTK_REAL Gtl113 = 0.5*(J13L*PDstandardNth1gt11 + + J23L*PDstandardNth2gt11 + J33L*PDstandardNth3gt11); + + CCTK_REAL Gtl122 = J12L*PDstandardNth1gt12 + J22L*PDstandardNth2gt12 + + J32L*PDstandardNth3gt12 - 0.5*(J11L*PDstandardNth1gt22 + + J21L*PDstandardNth2gt22 + J31L*PDstandardNth3gt22); + + CCTK_REAL Gtl123 = 0.5*(J13L*PDstandardNth1gt12 + + J12L*PDstandardNth1gt13 - J11L*PDstandardNth1gt23 + + J23L*PDstandardNth2gt12 + J22L*PDstandardNth2gt13 - + J21L*PDstandardNth2gt23 + J33L*PDstandardNth3gt12 + + J32L*PDstandardNth3gt13 - J31L*PDstandardNth3gt23); + + CCTK_REAL Gtl133 = J13L*PDstandardNth1gt13 + J23L*PDstandardNth2gt13 + + J33L*PDstandardNth3gt13 - 0.5*(J11L*PDstandardNth1gt33 + + J21L*PDstandardNth2gt33 + J31L*PDstandardNth3gt33); + + CCTK_REAL Gtl211 = J11L*PDstandardNth1gt12 + J21L*PDstandardNth2gt12 - + 0.5*(J12L*PDstandardNth1gt11 + J22L*PDstandardNth2gt11 + + J32L*PDstandardNth3gt11) + J31L*PDstandardNth3gt12; + + CCTK_REAL Gtl212 = 0.5*(J11L*PDstandardNth1gt22 + + J21L*PDstandardNth2gt22 + J31L*PDstandardNth3gt22); + + CCTK_REAL Gtl213 = 0.5*(J13L*PDstandardNth1gt12 - + J12L*PDstandardNth1gt13 + J11L*PDstandardNth1gt23 + + J23L*PDstandardNth2gt12 - J22L*PDstandardNth2gt13 + + J21L*PDstandardNth2gt23 + J33L*PDstandardNth3gt12 - + J32L*PDstandardNth3gt13 + J31L*PDstandardNth3gt23); + + CCTK_REAL Gtl222 = 0.5*(J12L*PDstandardNth1gt22 + + J22L*PDstandardNth2gt22 + J32L*PDstandardNth3gt22); + + CCTK_REAL Gtl223 = 0.5*(J13L*PDstandardNth1gt22 + + J23L*PDstandardNth2gt22 + J33L*PDstandardNth3gt22); + + CCTK_REAL Gtl233 = J13L*PDstandardNth1gt23 + J23L*PDstandardNth2gt23 + + J33L*PDstandardNth3gt23 - 0.5*(J12L*PDstandardNth1gt33 + + J22L*PDstandardNth2gt33 + J32L*PDstandardNth3gt33); + + CCTK_REAL Gtl311 = J11L*PDstandardNth1gt13 + J21L*PDstandardNth2gt13 - + 0.5*(J13L*PDstandardNth1gt11 + J23L*PDstandardNth2gt11 + + J33L*PDstandardNth3gt11) + J31L*PDstandardNth3gt13; + + CCTK_REAL Gtl312 = 0.5*(-(J13L*PDstandardNth1gt12) + + J12L*PDstandardNth1gt13 + J11L*PDstandardNth1gt23 - + J23L*PDstandardNth2gt12 + J22L*PDstandardNth2gt13 + + J21L*PDstandardNth2gt23 - J33L*PDstandardNth3gt12 + + J32L*PDstandardNth3gt13 + J31L*PDstandardNth3gt23); + + CCTK_REAL Gtl313 = 0.5*(J11L*PDstandardNth1gt33 + + J21L*PDstandardNth2gt33 + J31L*PDstandardNth3gt33); + + CCTK_REAL Gtl322 = J12L*PDstandardNth1gt23 + J22L*PDstandardNth2gt23 - + 0.5*(J13L*PDstandardNth1gt22 + J23L*PDstandardNth2gt22 + + J33L*PDstandardNth3gt22) + J32L*PDstandardNth3gt23; + + CCTK_REAL Gtl323 = 0.5*(J12L*PDstandardNth1gt33 + + J22L*PDstandardNth2gt33 + J32L*PDstandardNth3gt33); + + CCTK_REAL Gtl333 = 0.5*(J13L*PDstandardNth1gt33 + + J23L*PDstandardNth2gt33 + J33L*PDstandardNth3gt33); + + CCTK_REAL Gtlu111 = Gtl111*gtu11 + Gtl112*gtu12 + Gtl113*gtu13; + + CCTK_REAL Gtlu112 = Gtl111*gtu12 + Gtl112*gtu22 + Gtl113*gtu23; + + CCTK_REAL Gtlu113 = Gtl111*gtu13 + Gtl112*gtu23 + Gtl113*gtu33; + + CCTK_REAL Gtlu121 = Gtl112*gtu11 + Gtl122*gtu12 + Gtl123*gtu13; + + CCTK_REAL Gtlu122 = Gtl112*gtu12 + Gtl122*gtu22 + Gtl123*gtu23; + + CCTK_REAL Gtlu123 = Gtl112*gtu13 + Gtl122*gtu23 + Gtl123*gtu33; + + CCTK_REAL Gtlu131 = Gtl113*gtu11 + Gtl123*gtu12 + Gtl133*gtu13; + + CCTK_REAL Gtlu132 = Gtl113*gtu12 + Gtl123*gtu22 + Gtl133*gtu23; + + CCTK_REAL Gtlu133 = Gtl113*gtu13 + Gtl123*gtu23 + Gtl133*gtu33; + + CCTK_REAL Gtlu211 = Gtl211*gtu11 + Gtl212*gtu12 + Gtl213*gtu13; + + CCTK_REAL Gtlu212 = Gtl211*gtu12 + Gtl212*gtu22 + Gtl213*gtu23; + + CCTK_REAL Gtlu213 = Gtl211*gtu13 + Gtl212*gtu23 + Gtl213*gtu33; + + CCTK_REAL Gtlu221 = Gtl212*gtu11 + Gtl222*gtu12 + Gtl223*gtu13; + + CCTK_REAL Gtlu222 = Gtl212*gtu12 + Gtl222*gtu22 + Gtl223*gtu23; + + CCTK_REAL Gtlu223 = Gtl212*gtu13 + Gtl222*gtu23 + Gtl223*gtu33; + + CCTK_REAL Gtlu231 = Gtl213*gtu11 + Gtl223*gtu12 + Gtl233*gtu13; + + CCTK_REAL Gtlu232 = Gtl213*gtu12 + Gtl223*gtu22 + Gtl233*gtu23; + + CCTK_REAL Gtlu233 = Gtl213*gtu13 + Gtl223*gtu23 + Gtl233*gtu33; + + CCTK_REAL Gtlu311 = Gtl311*gtu11 + Gtl312*gtu12 + Gtl313*gtu13; + + CCTK_REAL Gtlu312 = Gtl311*gtu12 + Gtl312*gtu22 + Gtl313*gtu23; + + CCTK_REAL Gtlu313 = Gtl311*gtu13 + Gtl312*gtu23 + Gtl313*gtu33; + + CCTK_REAL Gtlu321 = Gtl312*gtu11 + Gtl322*gtu12 + Gtl323*gtu13; + + CCTK_REAL Gtlu322 = Gtl312*gtu12 + Gtl322*gtu22 + Gtl323*gtu23; + + CCTK_REAL Gtlu323 = Gtl312*gtu13 + Gtl322*gtu23 + Gtl323*gtu33; + + CCTK_REAL Gtlu331 = Gtl313*gtu11 + Gtl323*gtu12 + Gtl333*gtu13; + + CCTK_REAL Gtlu332 = Gtl313*gtu12 + Gtl323*gtu22 + Gtl333*gtu23; + + CCTK_REAL Gtlu333 = Gtl313*gtu13 + Gtl323*gtu23 + Gtl333*gtu33; + + CCTK_REAL Gt111 = Gtl111*gtu11 + Gtl211*gtu12 + Gtl311*gtu13; + + CCTK_REAL Gt211 = Gtl111*gtu12 + Gtl211*gtu22 + Gtl311*gtu23; + + CCTK_REAL Gt311 = Gtl111*gtu13 + Gtl211*gtu23 + Gtl311*gtu33; + + CCTK_REAL Gt112 = Gtl112*gtu11 + Gtl212*gtu12 + Gtl312*gtu13; + + CCTK_REAL Gt212 = Gtl112*gtu12 + Gtl212*gtu22 + Gtl312*gtu23; + + CCTK_REAL Gt312 = Gtl112*gtu13 + Gtl212*gtu23 + Gtl312*gtu33; + + CCTK_REAL Gt113 = Gtl113*gtu11 + Gtl213*gtu12 + Gtl313*gtu13; + + CCTK_REAL Gt213 = Gtl113*gtu12 + Gtl213*gtu22 + Gtl313*gtu23; + + CCTK_REAL Gt313 = Gtl113*gtu13 + Gtl213*gtu23 + Gtl313*gtu33; + + CCTK_REAL Gt122 = Gtl122*gtu11 + Gtl222*gtu12 + Gtl322*gtu13; + + CCTK_REAL Gt222 = Gtl122*gtu12 + Gtl222*gtu22 + Gtl322*gtu23; + + CCTK_REAL Gt322 = Gtl122*gtu13 + Gtl222*gtu23 + Gtl322*gtu33; + + CCTK_REAL Gt123 = Gtl123*gtu11 + Gtl223*gtu12 + Gtl323*gtu13; + + CCTK_REAL Gt223 = Gtl123*gtu12 + Gtl223*gtu22 + Gtl323*gtu23; + + CCTK_REAL Gt323 = Gtl123*gtu13 + Gtl223*gtu23 + Gtl323*gtu33; + + CCTK_REAL Gt133 = Gtl133*gtu11 + Gtl233*gtu12 + Gtl333*gtu13; + + CCTK_REAL Gt233 = Gtl133*gtu12 + Gtl233*gtu22 + Gtl333*gtu23; + + CCTK_REAL Gt333 = Gtl133*gtu13 + Gtl233*gtu23 + Gtl333*gtu33; + + CCTK_REAL Xtn1 = Gt111*gtu11 + Gt122*gtu22 + 2*(Gt112*gtu12 + + Gt113*gtu13 + Gt123*gtu23) + Gt133*gtu33; + + CCTK_REAL Xtn2 = Gt211*gtu11 + Gt222*gtu22 + 2*(Gt212*gtu12 + + Gt213*gtu13 + Gt223*gtu23) + Gt233*gtu33; + + CCTK_REAL Xtn3 = Gt311*gtu11 + Gt322*gtu22 + 2*(Gt312*gtu12 + + Gt313*gtu13 + Gt323*gtu23) + Gt333*gtu33; + + CCTK_REAL Rt11 = 3*(Gt111*Gtlu111 + Gt112*Gtlu112 + Gt113*Gtlu113) + + 2*(Gt211*Gtlu121 + Gt212*Gtlu122 + Gt213*Gtlu123 + Gt311*Gtlu131 + + Gt312*Gtlu132 + Gt313*Gtlu133) + Gt211*Gtlu211 + Gt212*Gtlu212 + + Gt213*Gtlu213 + Gt311*Gtlu311 + Gt312*Gtlu312 + Gt313*Gtlu313 + + J11L*(gt11L*PDstandardNth1Xt1 + gt12L*PDstandardNth1Xt2 + + gt13L*PDstandardNth1Xt3) + J21L*(gt11L*PDstandardNth2Xt1 + + gt12L*PDstandardNth2Xt2 + gt13L*PDstandardNth2Xt3) + + J31L*(gt11L*PDstandardNth3Xt1 + gt12L*PDstandardNth3Xt2 + + gt13L*PDstandardNth3Xt3) + Gtl111*Xtn1 + Gtl112*Xtn2 + Gtl113*Xtn3 + + 0.5*(-2*(gtu12*(J11L*J12L*PDstandardNth11gt11 + + J12L*J21L*PDstandardNth12gt11 + J11L*J22L*PDstandardNth12gt11 + + J12L*J31L*PDstandardNth13gt11 + J11L*J32L*PDstandardNth13gt11 + + dJ112L*PDstandardNth1gt11 + J21L*J22L*PDstandardNth22gt11 + + J22L*J31L*PDstandardNth23gt11 + J21L*J32L*PDstandardNth23gt11 + + dJ212L*PDstandardNth2gt11 + J31L*J32L*PDstandardNth33gt11 + + dJ312L*PDstandardNth3gt11) + gtu13*(J11L*J13L*PDstandardNth11gt11 + + J13L*J21L*PDstandardNth12gt11 + J11L*J23L*PDstandardNth12gt11 + + J13L*J31L*PDstandardNth13gt11 + J11L*J33L*PDstandardNth13gt11 + + dJ113L*PDstandardNth1gt11 + J21L*J23L*PDstandardNth22gt11 + + J23L*J31L*PDstandardNth23gt11 + J21L*J33L*PDstandardNth23gt11 + + dJ213L*PDstandardNth2gt11 + J31L*J33L*PDstandardNth33gt11 + + dJ313L*PDstandardNth3gt11) + gtu23*(J12L*J13L*PDstandardNth11gt11 + + J13L*J22L*PDstandardNth12gt11 + J12L*J23L*PDstandardNth12gt11 + + J13L*J32L*PDstandardNth13gt11 + J12L*J33L*PDstandardNth13gt11 + + dJ123L*PDstandardNth1gt11 + J22L*J23L*PDstandardNth22gt11 + + J23L*J32L*PDstandardNth23gt11 + J22L*J33L*PDstandardNth23gt11 + + dJ223L*PDstandardNth2gt11 + J32L*J33L*PDstandardNth33gt11 + + dJ323L*PDstandardNth3gt11)) - gtu11*(2*J11L*J21L*PDstandardNth12gt11 + + 2*J11L*J31L*PDstandardNth13gt11 + dJ111L*PDstandardNth1gt11 + + 2*J21L*J31L*PDstandardNth23gt11 + dJ211L*PDstandardNth2gt11 + + dJ311L*PDstandardNth3gt11 + PDstandardNth11gt11*SQR(J11L) + + PDstandardNth22gt11*SQR(J21L) + PDstandardNth33gt11*SQR(J31L)) - + gtu22*(2*J12L*J22L*PDstandardNth12gt11 + + 2*J12L*J32L*PDstandardNth13gt11 + dJ122L*PDstandardNth1gt11 + + 2*J22L*J32L*PDstandardNth23gt11 + dJ222L*PDstandardNth2gt11 + + dJ322L*PDstandardNth3gt11 + PDstandardNth11gt11*SQR(J12L) + + PDstandardNth22gt11*SQR(J22L) + PDstandardNth33gt11*SQR(J32L)) - + gtu33*(2*J13L*J23L*PDstandardNth12gt11 + + 2*J13L*J33L*PDstandardNth13gt11 + dJ133L*PDstandardNth1gt11 + + 2*J23L*J33L*PDstandardNth23gt11 + dJ233L*PDstandardNth2gt11 + + dJ333L*PDstandardNth3gt11 + PDstandardNth11gt11*SQR(J13L) + + PDstandardNth22gt11*SQR(J23L) + PDstandardNth33gt11*SQR(J33L))); + + CCTK_REAL Rt12 = Gt122*Gtlu112 + Gt123*Gtlu113 + (Gt111 + + Gt212)*Gtlu121 + Gt222*Gtlu122 + (Gt113 + Gt223)*Gtlu123 + + Gt322*Gtlu132 + Gt323*Gtlu133 + Gt111*Gtlu211 + Gt112*(Gtlu111 + + Gtlu122 + Gtlu212) + Gt113*Gtlu213 + 2*(Gt211*Gtlu221 + Gt212*Gtlu222 + + Gt213*Gtlu223) + Gt311*(Gtlu231 + Gtlu321) + Gt312*(Gtlu131 + Gtlu232 + + Gtlu322) + Gt313*(Gtlu233 + Gtlu323) + 0.5*((gt12L*J11L + + gt11L*J12L)*PDstandardNth1Xt1 + (gt22L*J11L + + gt12L*J12L)*PDstandardNth1Xt2 + (gt23L*J11L + + gt13L*J12L)*PDstandardNth1Xt3 + (gt12L*J21L + + gt11L*J22L)*PDstandardNth2Xt1 + (gt22L*J21L + + gt12L*J22L)*PDstandardNth2Xt2 + (gt23L*J21L + + gt13L*J22L)*PDstandardNth2Xt3 - 2*(gtu12*(J11L*J12L*PDstandardNth11gt12 + + J12L*J21L*PDstandardNth12gt12 + J11L*J22L*PDstandardNth12gt12 + + J12L*J31L*PDstandardNth13gt12 + J11L*J32L*PDstandardNth13gt12 + + dJ112L*PDstandardNth1gt12 + J21L*J22L*PDstandardNth22gt12 + + J22L*J31L*PDstandardNth23gt12 + J21L*J32L*PDstandardNth23gt12 + + dJ212L*PDstandardNth2gt12 + J31L*J32L*PDstandardNth33gt12 + + dJ312L*PDstandardNth3gt12) + gtu13*(J11L*J13L*PDstandardNth11gt12 + + J13L*J21L*PDstandardNth12gt12 + J11L*J23L*PDstandardNth12gt12 + + J13L*J31L*PDstandardNth13gt12 + J11L*J33L*PDstandardNth13gt12 + + dJ113L*PDstandardNth1gt12 + J21L*J23L*PDstandardNth22gt12 + + J23L*J31L*PDstandardNth23gt12 + J21L*J33L*PDstandardNth23gt12 + + dJ213L*PDstandardNth2gt12 + J31L*J33L*PDstandardNth33gt12 + + dJ313L*PDstandardNth3gt12) + gtu23*(J12L*J13L*PDstandardNth11gt12 + + J13L*J22L*PDstandardNth12gt12 + J12L*J23L*PDstandardNth12gt12 + + J13L*J32L*PDstandardNth13gt12 + J12L*J33L*PDstandardNth13gt12 + + dJ123L*PDstandardNth1gt12 + J22L*J23L*PDstandardNth22gt12 + + J23L*J32L*PDstandardNth23gt12 + J22L*J33L*PDstandardNth23gt12 + + dJ223L*PDstandardNth2gt12 + J32L*J33L*PDstandardNth33gt12 + + dJ323L*PDstandardNth3gt12)) + (gt12L*J31L + + gt11L*J32L)*PDstandardNth3Xt1 + (gt22L*J31L + + gt12L*J32L)*PDstandardNth3Xt2 + (gt23L*J31L + + gt13L*J32L)*PDstandardNth3Xt3 + (Gtl112 + Gtl211)*Xtn1 + (Gtl122 + + Gtl212)*Xtn2 + (Gtl123 + Gtl213)*Xtn3 - + gtu11*(2*J11L*J21L*PDstandardNth12gt12 + + 2*J11L*J31L*PDstandardNth13gt12 + dJ111L*PDstandardNth1gt12 + + 2*J21L*J31L*PDstandardNth23gt12 + dJ211L*PDstandardNth2gt12 + + dJ311L*PDstandardNth3gt12 + PDstandardNth11gt12*SQR(J11L) + + PDstandardNth22gt12*SQR(J21L) + PDstandardNth33gt12*SQR(J31L)) - + gtu22*(2*J12L*J22L*PDstandardNth12gt12 + + 2*J12L*J32L*PDstandardNth13gt12 + dJ122L*PDstandardNth1gt12 + + 2*J22L*J32L*PDstandardNth23gt12 + dJ222L*PDstandardNth2gt12 + + dJ322L*PDstandardNth3gt12 + PDstandardNth11gt12*SQR(J12L) + + PDstandardNth22gt12*SQR(J22L) + PDstandardNth33gt12*SQR(J32L)) - + gtu33*(2*J13L*J23L*PDstandardNth12gt12 + + 2*J13L*J33L*PDstandardNth13gt12 + dJ133L*PDstandardNth1gt12 + + 2*J23L*J33L*PDstandardNth23gt12 + dJ233L*PDstandardNth2gt12 + + dJ333L*PDstandardNth3gt12 + PDstandardNth11gt12*SQR(J13L) + + PDstandardNth22gt12*SQR(J23L) + PDstandardNth33gt12*SQR(J33L))); + + CCTK_REAL Rt13 = Gt123*Gtlu112 + Gt133*Gtlu113 + Gt223*Gtlu122 + + Gt233*Gtlu123 + (Gt111 + Gt313)*Gtlu131 + (Gt112 + Gt323)*Gtlu132 + + Gt333*Gtlu133 + Gt111*Gtlu311 + Gt112*Gtlu312 + Gt113*(Gtlu111 + + Gtlu133 + Gtlu313) + Gt211*(Gtlu231 + Gtlu321) + Gt212*(Gtlu232 + + Gtlu322) + Gt213*(Gtlu121 + Gtlu233 + Gtlu323) + 2*(Gt311*Gtlu331 + + Gt312*Gtlu332 + Gt313*Gtlu333) + 0.5*((gt13L*J11L + + gt11L*J13L)*PDstandardNth1Xt1 + (gt23L*J11L + + gt12L*J13L)*PDstandardNth1Xt2 + (gt33L*J11L + + gt13L*J13L)*PDstandardNth1Xt3 + (gt13L*J21L + + gt11L*J23L)*PDstandardNth2Xt1 + (gt23L*J21L + + gt12L*J23L)*PDstandardNth2Xt2 + (gt33L*J21L + + gt13L*J23L)*PDstandardNth2Xt3 - 2*(gtu12*(J11L*J12L*PDstandardNth11gt13 + + J12L*J21L*PDstandardNth12gt13 + J11L*J22L*PDstandardNth12gt13 + + J12L*J31L*PDstandardNth13gt13 + J11L*J32L*PDstandardNth13gt13 + + dJ112L*PDstandardNth1gt13 + J21L*J22L*PDstandardNth22gt13 + + J22L*J31L*PDstandardNth23gt13 + J21L*J32L*PDstandardNth23gt13 + + dJ212L*PDstandardNth2gt13 + J31L*J32L*PDstandardNth33gt13 + + dJ312L*PDstandardNth3gt13) + gtu13*(J11L*J13L*PDstandardNth11gt13 + + J13L*J21L*PDstandardNth12gt13 + J11L*J23L*PDstandardNth12gt13 + + J13L*J31L*PDstandardNth13gt13 + J11L*J33L*PDstandardNth13gt13 + + dJ113L*PDstandardNth1gt13 + J21L*J23L*PDstandardNth22gt13 + + J23L*J31L*PDstandardNth23gt13 + J21L*J33L*PDstandardNth23gt13 + + dJ213L*PDstandardNth2gt13 + J31L*J33L*PDstandardNth33gt13 + + dJ313L*PDstandardNth3gt13) + gtu23*(J12L*J13L*PDstandardNth11gt13 + + J13L*J22L*PDstandardNth12gt13 + J12L*J23L*PDstandardNth12gt13 + + J13L*J32L*PDstandardNth13gt13 + J12L*J33L*PDstandardNth13gt13 + + dJ123L*PDstandardNth1gt13 + J22L*J23L*PDstandardNth22gt13 + + J23L*J32L*PDstandardNth23gt13 + J22L*J33L*PDstandardNth23gt13 + + dJ223L*PDstandardNth2gt13 + J32L*J33L*PDstandardNth33gt13 + + dJ323L*PDstandardNth3gt13)) + (gt13L*J31L + + gt11L*J33L)*PDstandardNth3Xt1 + (gt23L*J31L + + gt12L*J33L)*PDstandardNth3Xt2 + (gt33L*J31L + + gt13L*J33L)*PDstandardNth3Xt3 + (Gtl113 + Gtl311)*Xtn1 + (Gtl123 + + Gtl312)*Xtn2 + (Gtl133 + Gtl313)*Xtn3 - + gtu11*(2*J11L*J21L*PDstandardNth12gt13 + + 2*J11L*J31L*PDstandardNth13gt13 + dJ111L*PDstandardNth1gt13 + + 2*J21L*J31L*PDstandardNth23gt13 + dJ211L*PDstandardNth2gt13 + + dJ311L*PDstandardNth3gt13 + PDstandardNth11gt13*SQR(J11L) + + PDstandardNth22gt13*SQR(J21L) + PDstandardNth33gt13*SQR(J31L)) - + gtu22*(2*J12L*J22L*PDstandardNth12gt13 + + 2*J12L*J32L*PDstandardNth13gt13 + dJ122L*PDstandardNth1gt13 + + 2*J22L*J32L*PDstandardNth23gt13 + dJ222L*PDstandardNth2gt13 + + dJ322L*PDstandardNth3gt13 + PDstandardNth11gt13*SQR(J12L) + + PDstandardNth22gt13*SQR(J22L) + PDstandardNth33gt13*SQR(J32L)) - + gtu33*(2*J13L*J23L*PDstandardNth12gt13 + + 2*J13L*J33L*PDstandardNth13gt13 + dJ133L*PDstandardNth1gt13 + + 2*J23L*J33L*PDstandardNth23gt13 + dJ233L*PDstandardNth2gt13 + + dJ333L*PDstandardNth3gt13 + PDstandardNth11gt13*SQR(J13L) + + PDstandardNth22gt13*SQR(J23L) + PDstandardNth33gt13*SQR(J33L))); + + CCTK_REAL Rt22 = Gt112*(Gtlu121 + 2*Gtlu211) + Gt122*(Gtlu122 + + 2*Gtlu212) + Gt123*(Gtlu123 + 2*Gtlu213) + 3*(Gt212*Gtlu221 + + Gt222*Gtlu222 + Gt223*Gtlu223) + 2*(Gt312*Gtlu231 + Gt322*Gtlu232 + + Gt323*Gtlu233) + Gt312*Gtlu321 + Gt322*Gtlu322 + Gt323*Gtlu323 + + J12L*(gt12L*PDstandardNth1Xt1 + gt22L*PDstandardNth1Xt2 + + gt23L*PDstandardNth1Xt3) + J22L*(gt12L*PDstandardNth2Xt1 + + gt22L*PDstandardNth2Xt2 + gt23L*PDstandardNth2Xt3) + + J32L*(gt12L*PDstandardNth3Xt1 + gt22L*PDstandardNth3Xt2 + + gt23L*PDstandardNth3Xt3) + Gtl212*Xtn1 + Gtl222*Xtn2 + Gtl223*Xtn3 + + 0.5*(-2*(gtu12*(J11L*J12L*PDstandardNth11gt22 + + J12L*J21L*PDstandardNth12gt22 + J11L*J22L*PDstandardNth12gt22 + + J12L*J31L*PDstandardNth13gt22 + J11L*J32L*PDstandardNth13gt22 + + dJ112L*PDstandardNth1gt22 + J21L*J22L*PDstandardNth22gt22 + + J22L*J31L*PDstandardNth23gt22 + J21L*J32L*PDstandardNth23gt22 + + dJ212L*PDstandardNth2gt22 + J31L*J32L*PDstandardNth33gt22 + + dJ312L*PDstandardNth3gt22) + gtu13*(J11L*J13L*PDstandardNth11gt22 + + J13L*J21L*PDstandardNth12gt22 + J11L*J23L*PDstandardNth12gt22 + + J13L*J31L*PDstandardNth13gt22 + J11L*J33L*PDstandardNth13gt22 + + dJ113L*PDstandardNth1gt22 + J21L*J23L*PDstandardNth22gt22 + + J23L*J31L*PDstandardNth23gt22 + J21L*J33L*PDstandardNth23gt22 + + dJ213L*PDstandardNth2gt22 + J31L*J33L*PDstandardNth33gt22 + + dJ313L*PDstandardNth3gt22) + gtu23*(J12L*J13L*PDstandardNth11gt22 + + J13L*J22L*PDstandardNth12gt22 + J12L*J23L*PDstandardNth12gt22 + + J13L*J32L*PDstandardNth13gt22 + J12L*J33L*PDstandardNth13gt22 + + dJ123L*PDstandardNth1gt22 + J22L*J23L*PDstandardNth22gt22 + + J23L*J32L*PDstandardNth23gt22 + J22L*J33L*PDstandardNth23gt22 + + dJ223L*PDstandardNth2gt22 + J32L*J33L*PDstandardNth33gt22 + + dJ323L*PDstandardNth3gt22)) - gtu11*(2*J11L*J21L*PDstandardNth12gt22 + + 2*J11L*J31L*PDstandardNth13gt22 + dJ111L*PDstandardNth1gt22 + + 2*J21L*J31L*PDstandardNth23gt22 + dJ211L*PDstandardNth2gt22 + + dJ311L*PDstandardNth3gt22 + PDstandardNth11gt22*SQR(J11L) + + PDstandardNth22gt22*SQR(J21L) + PDstandardNth33gt22*SQR(J31L)) - + gtu22*(2*J12L*J22L*PDstandardNth12gt22 + + 2*J12L*J32L*PDstandardNth13gt22 + dJ122L*PDstandardNth1gt22 + + 2*J22L*J32L*PDstandardNth23gt22 + dJ222L*PDstandardNth2gt22 + + dJ322L*PDstandardNth3gt22 + PDstandardNth11gt22*SQR(J12L) + + PDstandardNth22gt22*SQR(J22L) + PDstandardNth33gt22*SQR(J32L)) - + gtu33*(2*J13L*J23L*PDstandardNth12gt22 + + 2*J13L*J33L*PDstandardNth13gt22 + dJ133L*PDstandardNth1gt22 + + 2*J23L*J33L*PDstandardNth23gt22 + dJ233L*PDstandardNth2gt22 + + dJ333L*PDstandardNth3gt22 + PDstandardNth11gt22*SQR(J13L) + + PDstandardNth22gt22*SQR(J23L) + PDstandardNth33gt22*SQR(J33L))); + + CCTK_REAL Rt23 = Gt113*Gtlu211 + Gt133*Gtlu213 + Gt213*Gtlu221 + + Gt233*Gtlu223 + (Gt212 + Gt313)*Gtlu231 + (Gt222 + Gt323)*Gtlu232 + + Gt333*Gtlu233 + Gt112*(Gtlu131 + Gtlu311) + Gt122*(Gtlu132 + Gtlu312) + + Gt123*(Gtlu133 + Gtlu212 + Gtlu313) + Gt212*Gtlu321 + Gt222*Gtlu322 + + Gt223*(Gtlu222 + Gtlu233 + Gtlu323) + 2*(Gt312*Gtlu331 + Gt322*Gtlu332 + + Gt323*Gtlu333) + 0.5*((gt13L*J12L + gt12L*J13L)*PDstandardNth1Xt1 + + (gt23L*J12L + gt22L*J13L)*PDstandardNth1Xt2 + (gt33L*J12L + + gt23L*J13L)*PDstandardNth1Xt3 + (gt13L*J22L + + gt12L*J23L)*PDstandardNth2Xt1 + (gt23L*J22L + + gt22L*J23L)*PDstandardNth2Xt2 + (gt33L*J22L + + gt23L*J23L)*PDstandardNth2Xt3 - 2*(gtu12*(J11L*J12L*PDstandardNth11gt23 + + J12L*J21L*PDstandardNth12gt23 + J11L*J22L*PDstandardNth12gt23 + + J12L*J31L*PDstandardNth13gt23 + J11L*J32L*PDstandardNth13gt23 + + dJ112L*PDstandardNth1gt23 + J21L*J22L*PDstandardNth22gt23 + + J22L*J31L*PDstandardNth23gt23 + J21L*J32L*PDstandardNth23gt23 + + dJ212L*PDstandardNth2gt23 + J31L*J32L*PDstandardNth33gt23 + + dJ312L*PDstandardNth3gt23) + gtu13*(J11L*J13L*PDstandardNth11gt23 + + J13L*J21L*PDstandardNth12gt23 + J11L*J23L*PDstandardNth12gt23 + + J13L*J31L*PDstandardNth13gt23 + J11L*J33L*PDstandardNth13gt23 + + dJ113L*PDstandardNth1gt23 + J21L*J23L*PDstandardNth22gt23 + + J23L*J31L*PDstandardNth23gt23 + J21L*J33L*PDstandardNth23gt23 + + dJ213L*PDstandardNth2gt23 + J31L*J33L*PDstandardNth33gt23 + + dJ313L*PDstandardNth3gt23) + gtu23*(J12L*J13L*PDstandardNth11gt23 + + J13L*J22L*PDstandardNth12gt23 + J12L*J23L*PDstandardNth12gt23 + + J13L*J32L*PDstandardNth13gt23 + J12L*J33L*PDstandardNth13gt23 + + dJ123L*PDstandardNth1gt23 + J22L*J23L*PDstandardNth22gt23 + + J23L*J32L*PDstandardNth23gt23 + J22L*J33L*PDstandardNth23gt23 + + dJ223L*PDstandardNth2gt23 + J32L*J33L*PDstandardNth33gt23 + + dJ323L*PDstandardNth3gt23)) + (gt13L*J32L + + gt12L*J33L)*PDstandardNth3Xt1 + (gt23L*J32L + + gt22L*J33L)*PDstandardNth3Xt2 + (gt33L*J32L + + gt23L*J33L)*PDstandardNth3Xt3 + (Gtl213 + Gtl312)*Xtn1 + (Gtl223 + + Gtl322)*Xtn2 + (Gtl233 + Gtl323)*Xtn3 - + gtu11*(2*J11L*J21L*PDstandardNth12gt23 + + 2*J11L*J31L*PDstandardNth13gt23 + dJ111L*PDstandardNth1gt23 + + 2*J21L*J31L*PDstandardNth23gt23 + dJ211L*PDstandardNth2gt23 + + dJ311L*PDstandardNth3gt23 + PDstandardNth11gt23*SQR(J11L) + + PDstandardNth22gt23*SQR(J21L) + PDstandardNth33gt23*SQR(J31L)) - + gtu22*(2*J12L*J22L*PDstandardNth12gt23 + + 2*J12L*J32L*PDstandardNth13gt23 + dJ122L*PDstandardNth1gt23 + + 2*J22L*J32L*PDstandardNth23gt23 + dJ222L*PDstandardNth2gt23 + + dJ322L*PDstandardNth3gt23 + PDstandardNth11gt23*SQR(J12L) + + PDstandardNth22gt23*SQR(J22L) + PDstandardNth33gt23*SQR(J32L)) - + gtu33*(2*J13L*J23L*PDstandardNth12gt23 + + 2*J13L*J33L*PDstandardNth13gt23 + dJ133L*PDstandardNth1gt23 + + 2*J23L*J33L*PDstandardNth23gt23 + dJ233L*PDstandardNth2gt23 + + dJ333L*PDstandardNth3gt23 + PDstandardNth11gt23*SQR(J13L) + + PDstandardNth22gt23*SQR(J23L) + PDstandardNth33gt23*SQR(J33L))); + + CCTK_REAL Rt33 = Gt113*(Gtlu131 + 2*Gtlu311) + Gt123*(Gtlu132 + + 2*Gtlu312) + Gt133*(Gtlu133 + 2*Gtlu313) + Gt213*(Gtlu231 + 2*Gtlu321) + + Gt223*(Gtlu232 + 2*Gtlu322) + Gt233*(Gtlu233 + 2*Gtlu323) + + 3*(Gt313*Gtlu331 + Gt323*Gtlu332 + Gt333*Gtlu333) + + J13L*(gt13L*PDstandardNth1Xt1 + gt23L*PDstandardNth1Xt2 + + gt33L*PDstandardNth1Xt3) + J23L*(gt13L*PDstandardNth2Xt1 + + gt23L*PDstandardNth2Xt2 + gt33L*PDstandardNth2Xt3) + + J33L*(gt13L*PDstandardNth3Xt1 + gt23L*PDstandardNth3Xt2 + + gt33L*PDstandardNth3Xt3) + Gtl313*Xtn1 + Gtl323*Xtn2 + Gtl333*Xtn3 + + 0.5*(-2*(gtu12*(J11L*J12L*PDstandardNth11gt33 + + J12L*J21L*PDstandardNth12gt33 + J11L*J22L*PDstandardNth12gt33 + + J12L*J31L*PDstandardNth13gt33 + J11L*J32L*PDstandardNth13gt33 + + dJ112L*PDstandardNth1gt33 + J21L*J22L*PDstandardNth22gt33 + + J22L*J31L*PDstandardNth23gt33 + J21L*J32L*PDstandardNth23gt33 + + dJ212L*PDstandardNth2gt33 + J31L*J32L*PDstandardNth33gt33 + + dJ312L*PDstandardNth3gt33) + gtu13*(J11L*J13L*PDstandardNth11gt33 + + J13L*J21L*PDstandardNth12gt33 + J11L*J23L*PDstandardNth12gt33 + + J13L*J31L*PDstandardNth13gt33 + J11L*J33L*PDstandardNth13gt33 + + dJ113L*PDstandardNth1gt33 + J21L*J23L*PDstandardNth22gt33 + + J23L*J31L*PDstandardNth23gt33 + J21L*J33L*PDstandardNth23gt33 + + dJ213L*PDstandardNth2gt33 + J31L*J33L*PDstandardNth33gt33 + + dJ313L*PDstandardNth3gt33) + gtu23*(J12L*J13L*PDstandardNth11gt33 + + J13L*J22L*PDstandardNth12gt33 + J12L*J23L*PDstandardNth12gt33 + + J13L*J32L*PDstandardNth13gt33 + J12L*J33L*PDstandardNth13gt33 + + dJ123L*PDstandardNth1gt33 + J22L*J23L*PDstandardNth22gt33 + + J23L*J32L*PDstandardNth23gt33 + J22L*J33L*PDstandardNth23gt33 + + dJ223L*PDstandardNth2gt33 + J32L*J33L*PDstandardNth33gt33 + + dJ323L*PDstandardNth3gt33)) - gtu11*(2*J11L*J21L*PDstandardNth12gt33 + + 2*J11L*J31L*PDstandardNth13gt33 + dJ111L*PDstandardNth1gt33 + + 2*J21L*J31L*PDstandardNth23gt33 + dJ211L*PDstandardNth2gt33 + + dJ311L*PDstandardNth3gt33 + PDstandardNth11gt33*SQR(J11L) + + PDstandardNth22gt33*SQR(J21L) + PDstandardNth33gt33*SQR(J31L)) - + gtu22*(2*J12L*J22L*PDstandardNth12gt33 + + 2*J12L*J32L*PDstandardNth13gt33 + dJ122L*PDstandardNth1gt33 + + 2*J22L*J32L*PDstandardNth23gt33 + dJ222L*PDstandardNth2gt33 + + dJ322L*PDstandardNth3gt33 + PDstandardNth11gt33*SQR(J12L) + + PDstandardNth22gt33*SQR(J22L) + PDstandardNth33gt33*SQR(J32L)) - + gtu33*(2*J13L*J23L*PDstandardNth12gt33 + + 2*J13L*J33L*PDstandardNth13gt33 + dJ133L*PDstandardNth1gt33 + + 2*J23L*J33L*PDstandardNth23gt33 + dJ233L*PDstandardNth2gt33 + + dJ333L*PDstandardNth3gt33 + PDstandardNth11gt33*SQR(J13L) + + PDstandardNth22gt33*SQR(J23L) + PDstandardNth33gt33*SQR(J33L))); + + CCTK_REAL fac1 = IfThen(ToReal(conformalMethod),-0.5*INV(phiL),1); + + CCTK_REAL cdphi1 = fac1*(J11L*PDstandardNth1phi + + J21L*PDstandardNth2phi + J31L*PDstandardNth3phi); + + CCTK_REAL cdphi2 = fac1*(J12L*PDstandardNth1phi + + J22L*PDstandardNth2phi + J32L*PDstandardNth3phi); + + CCTK_REAL cdphi3 = fac1*(J13L*PDstandardNth1phi + + J23L*PDstandardNth2phi + J33L*PDstandardNth3phi); + + CCTK_REAL fac2 = IfThen(ToReal(conformalMethod),0.5*INV(SQR(phiL)),0); + + CCTK_REAL cdphi211 = fac1*((dJ111L - Gt111*J11L - Gt211*J12L - + Gt311*J13L)*PDstandardNth1phi + 2*(J11L*(J21L*PDstandardNth12phi + + J31L*PDstandardNth13phi) + J21L*J31L*PDstandardNth23phi) + (dJ211L - + Gt111*J21L - Gt211*J22L - Gt311*J23L)*PDstandardNth2phi + (dJ311L - + Gt111*J31L - Gt211*J32L - Gt311*J33L)*PDstandardNth3phi + + PDstandardNth11phi*SQR(J11L) + PDstandardNth22phi*SQR(J21L) + + PDstandardNth33phi*SQR(J31L)) + fac2*SQR(J11L*PDstandardNth1phi + + J21L*PDstandardNth2phi + J31L*PDstandardNth3phi); + + CCTK_REAL cdphi212 = fac2*(J11L*PDstandardNth1phi + + J21L*PDstandardNth2phi + + J31L*PDstandardNth3phi)*(J12L*PDstandardNth1phi + + J22L*PDstandardNth2phi + J32L*PDstandardNth3phi) + + fac1*(J12L*(J11L*PDstandardNth11phi + J21L*PDstandardNth12phi + + J31L*PDstandardNth13phi) + J11L*(J22L*PDstandardNth12phi + + J32L*PDstandardNth13phi) + (dJ112L - Gt112*J11L - Gt212*J12L - + Gt312*J13L)*PDstandardNth1phi + J22L*(J21L*PDstandardNth22phi + + J31L*PDstandardNth23phi) + (dJ212L - Gt112*J21L - Gt212*J22L - + Gt312*J23L)*PDstandardNth2phi + J32L*(J21L*PDstandardNth23phi + + J31L*PDstandardNth33phi) + (dJ312L - Gt112*J31L - Gt212*J32L - + Gt312*J33L)*PDstandardNth3phi); + + CCTK_REAL cdphi213 = fac2*(J11L*PDstandardNth1phi + + J21L*PDstandardNth2phi + + J31L*PDstandardNth3phi)*(J13L*PDstandardNth1phi + + J23L*PDstandardNth2phi + J33L*PDstandardNth3phi) + + fac1*(J13L*(J11L*PDstandardNth11phi + J21L*PDstandardNth12phi + + J31L*PDstandardNth13phi) + J11L*(J23L*PDstandardNth12phi + + J33L*PDstandardNth13phi) + (dJ113L - Gt113*J11L - Gt213*J12L - + Gt313*J13L)*PDstandardNth1phi + J23L*(J21L*PDstandardNth22phi + + J31L*PDstandardNth23phi) + (dJ213L - Gt113*J21L - Gt213*J22L - + Gt313*J23L)*PDstandardNth2phi + J33L*(J21L*PDstandardNth23phi + + J31L*PDstandardNth33phi) + (dJ313L - Gt113*J31L - Gt213*J32L - + Gt313*J33L)*PDstandardNth3phi); + + CCTK_REAL cdphi222 = fac1*((dJ122L - Gt122*J11L - Gt222*J12L - + Gt322*J13L)*PDstandardNth1phi + 2*(J12L*(J22L*PDstandardNth12phi + + J32L*PDstandardNth13phi) + J22L*J32L*PDstandardNth23phi) + (dJ222L - + Gt122*J21L - Gt222*J22L - Gt322*J23L)*PDstandardNth2phi + (dJ322L - + Gt122*J31L - Gt222*J32L - Gt322*J33L)*PDstandardNth3phi + + PDstandardNth11phi*SQR(J12L) + PDstandardNth22phi*SQR(J22L) + + PDstandardNth33phi*SQR(J32L)) + fac2*SQR(J12L*PDstandardNth1phi + + J22L*PDstandardNth2phi + J32L*PDstandardNth3phi); + + CCTK_REAL cdphi223 = fac2*(J12L*PDstandardNth1phi + + J22L*PDstandardNth2phi + + J32L*PDstandardNth3phi)*(J13L*PDstandardNth1phi + + J23L*PDstandardNth2phi + J33L*PDstandardNth3phi) + + fac1*(J13L*(J12L*PDstandardNth11phi + J22L*PDstandardNth12phi + + J32L*PDstandardNth13phi) + J12L*(J23L*PDstandardNth12phi + + J33L*PDstandardNth13phi) + (dJ123L - Gt123*J11L - Gt223*J12L - + Gt323*J13L)*PDstandardNth1phi + J23L*(J22L*PDstandardNth22phi + + J32L*PDstandardNth23phi) + (dJ223L - Gt123*J21L - Gt223*J22L - + Gt323*J23L)*PDstandardNth2phi + J33L*(J22L*PDstandardNth23phi + + J32L*PDstandardNth33phi) + (dJ323L - Gt123*J31L - Gt223*J32L - + Gt323*J33L)*PDstandardNth3phi); + + CCTK_REAL cdphi233 = fac1*((dJ133L - Gt133*J11L - Gt233*J12L - + Gt333*J13L)*PDstandardNth1phi + 2*(J13L*(J23L*PDstandardNth12phi + + J33L*PDstandardNth13phi) + J23L*J33L*PDstandardNth23phi) + (dJ233L - + Gt133*J21L - Gt233*J22L - Gt333*J23L)*PDstandardNth2phi + (dJ333L - + Gt133*J31L - Gt233*J32L - Gt333*J33L)*PDstandardNth3phi + + PDstandardNth11phi*SQR(J13L) + PDstandardNth22phi*SQR(J23L) + + PDstandardNth33phi*SQR(J33L)) + fac2*SQR(J13L*PDstandardNth1phi + + J23L*PDstandardNth2phi + J33L*PDstandardNth3phi); + + CCTK_REAL Rphi11 = -2*(cdphi211 + 2*(-1 + gt11L*gtu11)*SQR(cdphi1) + + gt11L*(cdphi211*gtu11 + 4*(cdphi1*(cdphi2*gtu12 + cdphi3*gtu13) + + cdphi2*cdphi3*gtu23) + cdphi233*gtu33 + gtu22*(cdphi222 + + 2*SQR(cdphi2)) + 2*(cdphi212*gtu12 + cdphi213*gtu13 + cdphi223*gtu23 + + gtu33*SQR(cdphi3)))); + + CCTK_REAL Rphi12 = -2*(cdphi212 + cdphi1*(cdphi2*(-2 + 4*gt12L*gtu12) + + 4*cdphi3*gt12L*gtu13) + gt12L*(cdphi211*gtu11 + 4*cdphi2*cdphi3*gtu23 + + 2*(cdphi212*gtu12 + cdphi213*gtu13 + cdphi223*gtu23 + + gtu11*SQR(cdphi1)) + gtu22*(cdphi222 + 2*SQR(cdphi2)) + gtu33*(cdphi233 + + 2*SQR(cdphi3)))); + + CCTK_REAL Rphi13 = -2*(cdphi213 + cdphi1*(4*cdphi2*gt13L*gtu12 + + cdphi3*(-2 + 4*gt13L*gtu13)) + gt13L*(cdphi211*gtu11 + + 4*cdphi2*cdphi3*gtu23 + 2*(cdphi212*gtu12 + cdphi213*gtu13 + + cdphi223*gtu23 + gtu11*SQR(cdphi1)) + gtu22*(cdphi222 + 2*SQR(cdphi2)) + + gtu33*(cdphi233 + 2*SQR(cdphi3)))); + + CCTK_REAL Rphi22 = -2*(cdphi222 + 2*(-1 + gt22L*gtu22)*SQR(cdphi2) + + gt22L*(cdphi222*gtu22 + 4*(cdphi1*cdphi3*gtu13 + cdphi2*(cdphi1*gtu12 + + cdphi3*gtu23)) + cdphi233*gtu33 + gtu11*(cdphi211 + 2*SQR(cdphi1)) + + 2*(cdphi212*gtu12 + cdphi213*gtu13 + cdphi223*gtu23 + + gtu33*SQR(cdphi3)))); + + CCTK_REAL Rphi23 = -2*(cdphi223 + cdphi2*(4*cdphi1*gt23L*gtu12 + + cdphi3*(-2 + 4*gt23L*gtu23)) + gt23L*(4*cdphi1*cdphi3*gtu13 + + cdphi222*gtu22 + gtu11*(cdphi211 + 2*SQR(cdphi1)) + 2*(cdphi212*gtu12 + + cdphi213*gtu13 + cdphi223*gtu23 + gtu22*SQR(cdphi2)) + gtu33*(cdphi233 + + 2*SQR(cdphi3)))); + + CCTK_REAL Rphi33 = -2*(cdphi233 + gt33L*((4*cdphi1*cdphi2 + + 2*cdphi212)*gtu12 + 4*cdphi3*(cdphi1*gtu13 + cdphi2*gtu23) + + 2*(cdphi213*gtu13 + cdphi223*gtu23) + cdphi233*gtu33 + gtu11*(cdphi211 + + 2*SQR(cdphi1)) + gtu22*(cdphi222 + 2*SQR(cdphi2))) + 2*(-1 + + gt33L*gtu33)*SQR(cdphi3)); + + CCTK_REAL Atm11 = At11L*gtu11 + At12L*gtu12 + At13L*gtu13; + + CCTK_REAL Atm21 = At11L*gtu12 + At12L*gtu22 + At13L*gtu23; + + CCTK_REAL Atm31 = At11L*gtu13 + At12L*gtu23 + At13L*gtu33; + + CCTK_REAL Atm12 = At12L*gtu11 + At22L*gtu12 + At23L*gtu13; + + CCTK_REAL Atm22 = At12L*gtu12 + At22L*gtu22 + At23L*gtu23; + + CCTK_REAL Atm32 = At12L*gtu13 + At22L*gtu23 + At23L*gtu33; + + CCTK_REAL Atm13 = At13L*gtu11 + At23L*gtu12 + At33L*gtu13; + + CCTK_REAL Atm23 = At13L*gtu12 + At23L*gtu22 + At33L*gtu23; + + CCTK_REAL Atm33 = At13L*gtu13 + At23L*gtu23 + At33L*gtu33; + + CCTK_REAL e4phi = + IfThen(ToReal(conformalMethod),INV(SQR(phiL)),exp(4*phiL)); + + CCTK_REAL em4phi = INV(e4phi); + + CCTK_REAL g11 = e4phi*gt11L; + + CCTK_REAL g12 = e4phi*gt12L; + + CCTK_REAL g13 = e4phi*gt13L; + + CCTK_REAL g22 = e4phi*gt22L; + + CCTK_REAL g23 = e4phi*gt23L; + + CCTK_REAL g33 = e4phi*gt33L; + + CCTK_REAL gu11 = em4phi*gtu11; + + CCTK_REAL gu12 = em4phi*gtu12; + + CCTK_REAL gu13 = em4phi*gtu13; + + CCTK_REAL gu22 = em4phi*gtu22; + + CCTK_REAL gu23 = em4phi*gtu23; + + CCTK_REAL gu33 = em4phi*gtu33; + + CCTK_REAL R11 = Rphi11 + Rt11; + + CCTK_REAL R12 = Rphi12 + Rt12; + + CCTK_REAL R13 = Rphi13 + Rt13; + + CCTK_REAL R22 = Rphi22 + Rt22; + + CCTK_REAL R23 = Rphi23 + Rt23; + + CCTK_REAL R33 = Rphi33 + Rt33; + + CCTK_REAL trS = em4phi*(eTxxL*gtu11 + eTyyL*gtu22 + 2*(eTxyL*gtu12 + + eTxzL*gtu13 + eTyzL*gtu23) + eTzzL*gtu33); + + CCTK_REAL Ats11 = (-dJ111L + 4*cdphi1*J11L + Gt111*J11L + Gt211*J12L + + Gt311*J13L)*PDstandardNth1alpha - 2*(J11L*J21L*PDstandardNth12alpha + + J11L*J31L*PDstandardNth13alpha + J21L*J31L*PDstandardNth23alpha) + + (-dJ211L + 4*cdphi1*J21L + Gt111*J21L + Gt211*J22L + + Gt311*J23L)*PDstandardNth2alpha + (-dJ311L + 4*cdphi1*J31L + Gt111*J31L + + Gt211*J32L + Gt311*J33L)*PDstandardNth3alpha + alphaL*R11 - + PDstandardNth11alpha*SQR(J11L) - PDstandardNth22alpha*SQR(J21L) - + PDstandardNth33alpha*SQR(J31L); + + CCTK_REAL Ats12 = J12L*(-(J11L*PDstandardNth11alpha) - + J21L*PDstandardNth12alpha - J31L*PDstandardNth13alpha) + + J11L*(-(J22L*PDstandardNth12alpha) - J32L*PDstandardNth13alpha) + + (-dJ112L + 2*cdphi2*J11L + Gt112*J11L + 2*cdphi1*J12L + Gt212*J12L + + Gt312*J13L)*PDstandardNth1alpha + J22L*(-(J21L*PDstandardNth22alpha) - + J31L*PDstandardNth23alpha) + (-dJ212L + 2*cdphi2*J21L + Gt112*J21L + + 2*cdphi1*J22L + Gt212*J22L + Gt312*J23L)*PDstandardNth2alpha + + J32L*(-(J21L*PDstandardNth23alpha) - J31L*PDstandardNth33alpha) + + Gt112*J31L*PDstandardNth3alpha + (-dJ312L + + 2*cdphi2*J31L)*PDstandardNth3alpha + 2*cdphi1*J32L*PDstandardNth3alpha + + Gt212*J32L*PDstandardNth3alpha + Gt312*J33L*PDstandardNth3alpha + + alphaL*R12; + + CCTK_REAL Ats13 = J13L*(-(J11L*PDstandardNth11alpha) - + J21L*PDstandardNth12alpha - J31L*PDstandardNth13alpha) + + J11L*(-(J23L*PDstandardNth12alpha) - J33L*PDstandardNth13alpha) + + (-dJ113L + 2*cdphi3*J11L + Gt113*J11L + Gt213*J12L + 2*cdphi1*J13L + + Gt313*J13L)*PDstandardNth1alpha + J23L*(-(J21L*PDstandardNth22alpha) - + J31L*PDstandardNth23alpha) + (-dJ213L + 2*cdphi3*J21L + Gt113*J21L + + Gt213*J22L + 2*cdphi1*J23L + Gt313*J23L)*PDstandardNth2alpha + + J33L*(-(J21L*PDstandardNth23alpha) - J31L*PDstandardNth33alpha) + + Gt113*J31L*PDstandardNth3alpha + (-dJ313L + + 2*cdphi3*J31L)*PDstandardNth3alpha + Gt213*J32L*PDstandardNth3alpha + + 2*cdphi1*J33L*PDstandardNth3alpha + Gt313*J33L*PDstandardNth3alpha + + alphaL*R13; + + CCTK_REAL Ats22 = (-dJ122L + Gt122*J11L + 4*cdphi2*J12L + Gt222*J12L + + Gt322*J13L)*PDstandardNth1alpha - 2*(J12L*J22L*PDstandardNth12alpha + + J12L*J32L*PDstandardNth13alpha + J22L*J32L*PDstandardNth23alpha) + + (-dJ222L + Gt122*J21L + 4*cdphi2*J22L + Gt222*J22L + + Gt322*J23L)*PDstandardNth2alpha + (-dJ322L + Gt122*J31L + 4*cdphi2*J32L + + Gt222*J32L + Gt322*J33L)*PDstandardNth3alpha + alphaL*R22 - + PDstandardNth11alpha*SQR(J12L) - PDstandardNth22alpha*SQR(J22L) - + PDstandardNth33alpha*SQR(J32L); + + CCTK_REAL Ats23 = J13L*(-(J12L*PDstandardNth11alpha) - + J22L*PDstandardNth12alpha - J32L*PDstandardNth13alpha) + + J12L*(-(J23L*PDstandardNth12alpha) - J33L*PDstandardNth13alpha) + + (-dJ123L + Gt123*J11L + 2*cdphi3*J12L + Gt223*J12L + 2*cdphi2*J13L + + Gt323*J13L)*PDstandardNth1alpha + J23L*(-(J22L*PDstandardNth22alpha) - + J32L*PDstandardNth23alpha) + (-dJ223L + Gt123*J21L + 2*cdphi3*J22L + + Gt223*J22L + 2*cdphi2*J23L + Gt323*J23L)*PDstandardNth2alpha + + J33L*(-(J22L*PDstandardNth23alpha) - J32L*PDstandardNth33alpha) + + (-dJ323L + Gt123*J31L)*PDstandardNth3alpha + + 2*cdphi3*J32L*PDstandardNth3alpha + Gt223*J32L*PDstandardNth3alpha + + 2*cdphi2*J33L*PDstandardNth3alpha + Gt323*J33L*PDstandardNth3alpha + + alphaL*R23; + + CCTK_REAL Ats33 = (-dJ133L + Gt133*J11L + Gt233*J12L + 4*cdphi3*J13L + + Gt333*J13L)*PDstandardNth1alpha - 2*(J13L*J23L*PDstandardNth12alpha + + J13L*J33L*PDstandardNth13alpha + J23L*J33L*PDstandardNth23alpha) + + (-dJ233L + Gt133*J21L + Gt233*J22L + 4*cdphi3*J23L + + Gt333*J23L)*PDstandardNth2alpha + (-dJ333L + Gt133*J31L + Gt233*J32L + + 4*cdphi3*J33L + Gt333*J33L)*PDstandardNth3alpha + alphaL*R33 - + PDstandardNth11alpha*SQR(J13L) - PDstandardNth22alpha*SQR(J23L) - + PDstandardNth33alpha*SQR(J33L); + + CCTK_REAL trAts = Ats11*gu11 + Ats22*gu22 + 2*(Ats12*gu12 + Ats13*gu13 + + Ats23*gu23) + Ats33*gu33; + + CCTK_REAL At11rhsL = (epsdiss1*J11L + epsdiss2*J12L + + epsdiss3*J13L)*PDdissipationNth1At11 + (epsdiss1*J21L + epsdiss2*J22L + + epsdiss3*J23L)*PDdissipationNth2At11 + (epsdiss1*J31L + epsdiss2*J32L + + epsdiss3*J33L)*PDdissipationNth3At11 - + 0.666666666666666666666666666667*At11L*(J11L*PDstandardNth1beta1 + + J12L*PDstandardNth1beta2 + J13L*PDstandardNth1beta3 + + J21L*PDstandardNth2beta1 + J22L*PDstandardNth2beta2 + + J23L*PDstandardNth2beta3 + J31L*PDstandardNth3beta1 + + J32L*PDstandardNth3beta2 + J33L*PDstandardNth3beta3) + + 2*(J11L*(At11L*PDstandardNth1beta1 + At12L*PDstandardNth1beta2 + + At13L*PDstandardNth1beta3) + J21L*(At11L*PDstandardNth2beta1 + + At12L*PDstandardNth2beta2 + At13L*PDstandardNth2beta3) + + J31L*(At11L*PDstandardNth3beta1 + At12L*PDstandardNth3beta2 + + At13L*PDstandardNth3beta3)) + (beta1L*J11L + beta2L*J12L + + beta3L*J13L)*PDupwindNthAnti1At11 + (beta1L*J21L + beta2L*J22L + + beta3L*J23L)*PDupwindNthAnti2At11 + (beta1L*J31L + beta2L*J32L + + beta3L*J33L)*PDupwindNthAnti3At11 + alphaL*(-2*(At11L*Atm11 + + At12L*Atm21 + At13L*Atm31) + At11L*trKL) + em4phi*(Ats11 - + 0.333333333333333333333333333333*g11*trAts - + 25.13274122871834590770114706623602307358*alphaL*(eTxxL - + 0.333333333333333333333333333333*g11*trS)) + (J11L*PDupwindNthSymm1At11 + + J21L*PDupwindNthSymm2At11 + J31L*PDupwindNthSymm3At11)*Abs(beta1L) + + (J12L*PDupwindNthSymm1At11 + J22L*PDupwindNthSymm2At11 + + J32L*PDupwindNthSymm3At11)*Abs(beta2L) + (J13L*PDupwindNthSymm1At11 + + J23L*PDupwindNthSymm2At11 + J33L*PDupwindNthSymm3At11)*Abs(beta3L); + + CCTK_REAL At12rhsL = (epsdiss1*J11L + epsdiss2*J12L + + epsdiss3*J13L)*PDdissipationNth1At12 + (epsdiss1*J21L + epsdiss2*J22L + + epsdiss3*J23L)*PDdissipationNth2At12 + (epsdiss1*J31L + epsdiss2*J32L + + epsdiss3*J33L)*PDdissipationNth3At12 + (At12L*J11L + + At11L*J12L)*PDstandardNth1beta1 + (At22L*J11L + + At12L*J12L)*PDstandardNth1beta2 + (At23L*J11L + + At13L*J12L)*PDstandardNth1beta3 + (At12L*J21L + + At11L*J22L)*PDstandardNth2beta1 + (At22L*J21L + + At12L*J22L)*PDstandardNth2beta2 + (At23L*J21L + + At13L*J22L)*PDstandardNth2beta3 + (At12L*J31L + + At11L*J32L)*PDstandardNth3beta1 + (At22L*J31L + + At12L*J32L)*PDstandardNth3beta2 + (At23L*J31L + + At13L*J32L)*PDstandardNth3beta3 - + 0.666666666666666666666666666667*At12L*(J11L*PDstandardNth1beta1 + + J12L*PDstandardNth1beta2 + J13L*PDstandardNth1beta3 + + J21L*PDstandardNth2beta1 + J22L*PDstandardNth2beta2 + + J23L*PDstandardNth2beta3 + J31L*PDstandardNth3beta1 + + J32L*PDstandardNth3beta2 + J33L*PDstandardNth3beta3) + (beta1L*J11L + + beta2L*J12L + beta3L*J13L)*PDupwindNthAnti1At12 + (beta1L*J21L + + beta2L*J22L + beta3L*J23L)*PDupwindNthAnti2At12 + (beta1L*J31L + + beta2L*J32L + beta3L*J33L)*PDupwindNthAnti3At12 + + alphaL*(-2*(At11L*Atm12 + At12L*Atm22 + At13L*Atm32) + At12L*trKL) + + em4phi*(Ats12 - 0.333333333333333333333333333333*g12*trAts - + 25.13274122871834590770114706623602307358*alphaL*(eTxyL - + 0.333333333333333333333333333333*g12*trS)) + (J11L*PDupwindNthSymm1At12 + + J21L*PDupwindNthSymm2At12 + J31L*PDupwindNthSymm3At12)*Abs(beta1L) + + (J12L*PDupwindNthSymm1At12 + J22L*PDupwindNthSymm2At12 + + J32L*PDupwindNthSymm3At12)*Abs(beta2L) + (J13L*PDupwindNthSymm1At12 + + J23L*PDupwindNthSymm2At12 + J33L*PDupwindNthSymm3At12)*Abs(beta3L); + + CCTK_REAL At13rhsL = (epsdiss1*J11L + epsdiss2*J12L + + epsdiss3*J13L)*PDdissipationNth1At13 + (epsdiss1*J21L + epsdiss2*J22L + + epsdiss3*J23L)*PDdissipationNth2At13 + (epsdiss1*J31L + epsdiss2*J32L + + epsdiss3*J33L)*PDdissipationNth3At13 + (At13L*J11L + + At11L*J13L)*PDstandardNth1beta1 + (At23L*J11L + + At12L*J13L)*PDstandardNth1beta2 + (At33L*J11L + + At13L*J13L)*PDstandardNth1beta3 + (At13L*J21L + + At11L*J23L)*PDstandardNth2beta1 + (At23L*J21L + + At12L*J23L)*PDstandardNth2beta2 + (At33L*J21L + + At13L*J23L)*PDstandardNth2beta3 + (At13L*J31L + + At11L*J33L)*PDstandardNth3beta1 + (At23L*J31L + + At12L*J33L)*PDstandardNth3beta2 + (At33L*J31L + + At13L*J33L)*PDstandardNth3beta3 - + 0.666666666666666666666666666667*At13L*(J11L*PDstandardNth1beta1 + + J12L*PDstandardNth1beta2 + J13L*PDstandardNth1beta3 + + J21L*PDstandardNth2beta1 + J22L*PDstandardNth2beta2 + + J23L*PDstandardNth2beta3 + J31L*PDstandardNth3beta1 + + J32L*PDstandardNth3beta2 + J33L*PDstandardNth3beta3) + (beta1L*J11L + + beta2L*J12L + beta3L*J13L)*PDupwindNthAnti1At13 + (beta1L*J21L + + beta2L*J22L + beta3L*J23L)*PDupwindNthAnti2At13 + (beta1L*J31L + + beta2L*J32L + beta3L*J33L)*PDupwindNthAnti3At13 + + alphaL*(-2*(At11L*Atm13 + At12L*Atm23 + At13L*Atm33) + At13L*trKL) + + em4phi*(Ats13 - 0.333333333333333333333333333333*g13*trAts - + 25.13274122871834590770114706623602307358*alphaL*(eTxzL - + 0.333333333333333333333333333333*g13*trS)) + (J11L*PDupwindNthSymm1At13 + + J21L*PDupwindNthSymm2At13 + J31L*PDupwindNthSymm3At13)*Abs(beta1L) + + (J12L*PDupwindNthSymm1At13 + J22L*PDupwindNthSymm2At13 + + J32L*PDupwindNthSymm3At13)*Abs(beta2L) + (J13L*PDupwindNthSymm1At13 + + J23L*PDupwindNthSymm2At13 + J33L*PDupwindNthSymm3At13)*Abs(beta3L); + + CCTK_REAL At22rhsL = (epsdiss1*J11L + epsdiss2*J12L + + epsdiss3*J13L)*PDdissipationNth1At22 + (epsdiss1*J21L + epsdiss2*J22L + + epsdiss3*J23L)*PDdissipationNth2At22 + (epsdiss1*J31L + epsdiss2*J32L + + epsdiss3*J33L)*PDdissipationNth3At22 - + 0.666666666666666666666666666667*At22L*(J11L*PDstandardNth1beta1 + + J12L*PDstandardNth1beta2 + J13L*PDstandardNth1beta3 + + J21L*PDstandardNth2beta1 + J22L*PDstandardNth2beta2 + + J23L*PDstandardNth2beta3 + J31L*PDstandardNth3beta1 + + J32L*PDstandardNth3beta2 + J33L*PDstandardNth3beta3) + + 2*(J12L*(At12L*PDstandardNth1beta1 + At22L*PDstandardNth1beta2 + + At23L*PDstandardNth1beta3) + J22L*(At12L*PDstandardNth2beta1 + + At22L*PDstandardNth2beta2 + At23L*PDstandardNth2beta3) + + J32L*(At12L*PDstandardNth3beta1 + At22L*PDstandardNth3beta2 + + At23L*PDstandardNth3beta3)) + (beta1L*J11L + beta2L*J12L + + beta3L*J13L)*PDupwindNthAnti1At22 + (beta1L*J21L + beta2L*J22L + + beta3L*J23L)*PDupwindNthAnti2At22 + (beta1L*J31L + beta2L*J32L + + beta3L*J33L)*PDupwindNthAnti3At22 + alphaL*(-2*(At12L*Atm12 + + At22L*Atm22 + At23L*Atm32) + At22L*trKL) + em4phi*(Ats22 - + 0.333333333333333333333333333333*g22*trAts - + 25.13274122871834590770114706623602307358*alphaL*(eTyyL - + 0.333333333333333333333333333333*g22*trS)) + (J11L*PDupwindNthSymm1At22 + + J21L*PDupwindNthSymm2At22 + J31L*PDupwindNthSymm3At22)*Abs(beta1L) + + (J12L*PDupwindNthSymm1At22 + J22L*PDupwindNthSymm2At22 + + J32L*PDupwindNthSymm3At22)*Abs(beta2L) + (J13L*PDupwindNthSymm1At22 + + J23L*PDupwindNthSymm2At22 + J33L*PDupwindNthSymm3At22)*Abs(beta3L); + + CCTK_REAL At23rhsL = (epsdiss1*J11L + epsdiss2*J12L + + epsdiss3*J13L)*PDdissipationNth1At23 + (epsdiss1*J21L + epsdiss2*J22L + + epsdiss3*J23L)*PDdissipationNth2At23 + (epsdiss1*J31L + epsdiss2*J32L + + epsdiss3*J33L)*PDdissipationNth3At23 + (At13L*J12L + + At12L*J13L)*PDstandardNth1beta1 + (At23L*J12L + + At22L*J13L)*PDstandardNth1beta2 + (At33L*J12L + + At23L*J13L)*PDstandardNth1beta3 + (At13L*J22L + + At12L*J23L)*PDstandardNth2beta1 + (At23L*J22L + + At22L*J23L)*PDstandardNth2beta2 + (At33L*J22L + + At23L*J23L)*PDstandardNth2beta3 + (At13L*J32L + + At12L*J33L)*PDstandardNth3beta1 + (At23L*J32L + + At22L*J33L)*PDstandardNth3beta2 + (At33L*J32L + + At23L*J33L)*PDstandardNth3beta3 - + 0.666666666666666666666666666667*At23L*(J11L*PDstandardNth1beta1 + + J12L*PDstandardNth1beta2 + J13L*PDstandardNth1beta3 + + J21L*PDstandardNth2beta1 + J22L*PDstandardNth2beta2 + + J23L*PDstandardNth2beta3 + J31L*PDstandardNth3beta1 + + J32L*PDstandardNth3beta2 + J33L*PDstandardNth3beta3) + (beta1L*J11L + + beta2L*J12L + beta3L*J13L)*PDupwindNthAnti1At23 + (beta1L*J21L + + beta2L*J22L + beta3L*J23L)*PDupwindNthAnti2At23 + (beta1L*J31L + + beta2L*J32L + beta3L*J33L)*PDupwindNthAnti3At23 + + alphaL*(-2*(At12L*Atm13 + At22L*Atm23 + At23L*Atm33) + At23L*trKL) + + em4phi*(Ats23 - 0.333333333333333333333333333333*g23*trAts - + 25.13274122871834590770114706623602307358*alphaL*(eTyzL - + 0.333333333333333333333333333333*g23*trS)) + (J11L*PDupwindNthSymm1At23 + + J21L*PDupwindNthSymm2At23 + J31L*PDupwindNthSymm3At23)*Abs(beta1L) + + (J12L*PDupwindNthSymm1At23 + J22L*PDupwindNthSymm2At23 + + J32L*PDupwindNthSymm3At23)*Abs(beta2L) + (J13L*PDupwindNthSymm1At23 + + J23L*PDupwindNthSymm2At23 + J33L*PDupwindNthSymm3At23)*Abs(beta3L); + + CCTK_REAL At33rhsL = (epsdiss1*J11L + epsdiss2*J12L + + epsdiss3*J13L)*PDdissipationNth1At33 + (epsdiss1*J21L + epsdiss2*J22L + + epsdiss3*J23L)*PDdissipationNth2At33 + (epsdiss1*J31L + epsdiss2*J32L + + epsdiss3*J33L)*PDdissipationNth3At33 - + 0.666666666666666666666666666667*At33L*(J11L*PDstandardNth1beta1 + + J12L*PDstandardNth1beta2 + J13L*PDstandardNth1beta3 + + J21L*PDstandardNth2beta1 + J22L*PDstandardNth2beta2 + + J23L*PDstandardNth2beta3 + J31L*PDstandardNth3beta1 + + J32L*PDstandardNth3beta2 + J33L*PDstandardNth3beta3) + + 2*(J13L*(At13L*PDstandardNth1beta1 + At23L*PDstandardNth1beta2 + + At33L*PDstandardNth1beta3) + J23L*(At13L*PDstandardNth2beta1 + + At23L*PDstandardNth2beta2 + At33L*PDstandardNth2beta3) + + J33L*(At13L*PDstandardNth3beta1 + At23L*PDstandardNth3beta2 + + At33L*PDstandardNth3beta3)) + (beta1L*J11L + beta2L*J12L + + beta3L*J13L)*PDupwindNthAnti1At33 + (beta1L*J21L + beta2L*J22L + + beta3L*J23L)*PDupwindNthAnti2At33 + (beta1L*J31L + beta2L*J32L + + beta3L*J33L)*PDupwindNthAnti3At33 + alphaL*(-2*(At13L*Atm13 + + At23L*Atm23 + At33L*Atm33) + At33L*trKL) + em4phi*(Ats33 - + 0.333333333333333333333333333333*g33*trAts - + 25.13274122871834590770114706623602307358*alphaL*(eTzzL - + 0.333333333333333333333333333333*g33*trS)) + (J11L*PDupwindNthSymm1At33 + + J21L*PDupwindNthSymm2At33 + J31L*PDupwindNthSymm3At33)*Abs(beta1L) + + (J12L*PDupwindNthSymm1At33 + J22L*PDupwindNthSymm2At33 + + J32L*PDupwindNthSymm3At33)*Abs(beta2L) + (J13L*PDupwindNthSymm1At33 + + J23L*PDupwindNthSymm2At33 + J33L*PDupwindNthSymm3At33)*Abs(beta3L); + + + /* Copy local copies back to grid functions */ + At11rhs[index] = At11rhsL; + At12rhs[index] = At12rhsL; + At13rhs[index] = At13rhsL; + At22rhs[index] = At22rhsL; + At23rhs[index] = At23rhsL; + At33rhs[index] = At33rhsL; + } + LC_ENDLOOP3 (ML_BSSN_MP_O8_RHS2); +} + +extern "C" void ML_BSSN_MP_O8_RHS2(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverInterior(cctkGH, &ML_BSSN_MP_O8_RHS2_Body); +} diff --git a/ML_BSSN_MP_O8/src/ML_BSSN_MP_O8_RHSStaticBoundary.cc b/ML_BSSN_MP_O8/src/ML_BSSN_MP_O8_RHSStaticBoundary.cc new file mode 100644 index 0000000..1f1b665 --- /dev/null +++ b/ML_BSSN_MP_O8/src/ML_BSSN_MP_O8_RHSStaticBoundary.cc @@ -0,0 +1,229 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +extern "C" void ML_BSSN_MP_O8_RHSStaticBoundary_SelectBCs(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT ierr = 0; + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_MP_O8::ML_curvrhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_MP_O8::ML_curvrhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_MP_O8::ML_dtlapserhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_MP_O8::ML_dtlapserhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_MP_O8::ML_dtshiftrhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_MP_O8::ML_dtshiftrhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_MP_O8::ML_Gammarhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_MP_O8::ML_Gammarhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_MP_O8::ML_lapserhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_MP_O8::ML_lapserhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_MP_O8::ML_log_confacrhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_MP_O8::ML_log_confacrhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_MP_O8::ML_metricrhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_MP_O8::ML_metricrhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_MP_O8::ML_shiftrhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_MP_O8::ML_shiftrhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_MP_O8::ML_trace_curvrhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_MP_O8::ML_trace_curvrhs."); + return; +} + +static void ML_BSSN_MP_O8_RHSStaticBoundary_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_BSSN_MP_O8_RHSStaticBoundary_Body"); + } + + if (cctk_iteration % ML_BSSN_MP_O8_RHSStaticBoundary_calc_every != ML_BSSN_MP_O8_RHSStaticBoundary_calc_offset) + { + return; + } + + const char *groups[] = {"ML_BSSN_MP_O8::ML_curvrhs","ML_BSSN_MP_O8::ML_dtlapserhs","ML_BSSN_MP_O8::ML_dtshiftrhs","ML_BSSN_MP_O8::ML_Gammarhs","ML_BSSN_MP_O8::ML_lapserhs","ML_BSSN_MP_O8::ML_log_confacrhs","ML_BSSN_MP_O8::ML_metricrhs","ML_BSSN_MP_O8::ML_shiftrhs","ML_BSSN_MP_O8::ML_trace_curvrhs"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_BSSN_MP_O8_RHSStaticBoundary", 9, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o1024dx = 0.0009765625*INV(dx); + CCTK_REAL const p1o1024dy = 0.0009765625*INV(dy); + CCTK_REAL const p1o1024dz = 0.0009765625*INV(dz); + CCTK_REAL const p1o1680dx = 0.000595238095238095238095238095238*INV(dx); + CCTK_REAL const p1o1680dy = 0.000595238095238095238095238095238*INV(dy); + CCTK_REAL const p1o1680dz = 0.000595238095238095238095238095238*INV(dz); + CCTK_REAL const p1o5040dx2 = 0.000198412698412698412698412698413*INV(SQR(dx)); + CCTK_REAL const p1o5040dy2 = 0.000198412698412698412698412698413*INV(SQR(dy)); + CCTK_REAL const p1o5040dz2 = 0.000198412698412698412698412698413*INV(SQR(dz)); + CCTK_REAL const p1o560dx = 0.00178571428571428571428571428571*INV(dx); + CCTK_REAL const p1o560dy = 0.00178571428571428571428571428571*INV(dy); + CCTK_REAL const p1o560dz = 0.00178571428571428571428571428571*INV(dz); + CCTK_REAL const p1o705600dxdy = 1.41723356009070294784580498866e-6*INV(dx)*INV(dy); + CCTK_REAL const p1o705600dxdz = 1.41723356009070294784580498866e-6*INV(dx)*INV(dz); + CCTK_REAL const p1o705600dydz = 1.41723356009070294784580498866e-6*INV(dy)*INV(dz); + CCTK_REAL const p1o840dx = 0.00119047619047619047619047619048*INV(dx); + CCTK_REAL const p1o840dy = 0.00119047619047619047619047619048*INV(dy); + CCTK_REAL const p1o840dz = 0.00119047619047619047619047619048*INV(dz); + CCTK_REAL const p1odx = INV(dx); + CCTK_REAL const p1ody = INV(dy); + CCTK_REAL const p1odz = INV(dz); + CCTK_REAL const pm1o840dx = -0.00119047619047619047619047619048*INV(dx); + CCTK_REAL const pm1o840dy = -0.00119047619047619047619047619048*INV(dy); + CCTK_REAL const pm1o840dz = -0.00119047619047619047619047619048*INV(dz); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_BSSN_MP_O8_RHSStaticBoundary, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + + /* Include user supplied include files */ + + /* Precompute derivatives */ + + /* Calculate temporaries and grid functions */ + CCTK_REAL phirhsL = 0; + + CCTK_REAL gt11rhsL = 0; + + CCTK_REAL gt12rhsL = 0; + + CCTK_REAL gt13rhsL = 0; + + CCTK_REAL gt22rhsL = 0; + + CCTK_REAL gt23rhsL = 0; + + CCTK_REAL gt33rhsL = 0; + + CCTK_REAL trKrhsL = 0; + + CCTK_REAL At11rhsL = 0; + + CCTK_REAL At12rhsL = 0; + + CCTK_REAL At13rhsL = 0; + + CCTK_REAL At22rhsL = 0; + + CCTK_REAL At23rhsL = 0; + + CCTK_REAL At33rhsL = 0; + + CCTK_REAL Xt1rhsL = 0; + + CCTK_REAL Xt2rhsL = 0; + + CCTK_REAL Xt3rhsL = 0; + + CCTK_REAL alpharhsL = 0; + + CCTK_REAL ArhsL = 0; + + CCTK_REAL beta1rhsL = 0; + + CCTK_REAL beta2rhsL = 0; + + CCTK_REAL beta3rhsL = 0; + + CCTK_REAL B1rhsL = 0; + + CCTK_REAL B2rhsL = 0; + + CCTK_REAL B3rhsL = 0; + + + /* Copy local copies back to grid functions */ + alpharhs[index] = alpharhsL; + Arhs[index] = ArhsL; + At11rhs[index] = At11rhsL; + At12rhs[index] = At12rhsL; + At13rhs[index] = At13rhsL; + At22rhs[index] = At22rhsL; + At23rhs[index] = At23rhsL; + At33rhs[index] = At33rhsL; + B1rhs[index] = B1rhsL; + B2rhs[index] = B2rhsL; + B3rhs[index] = B3rhsL; + beta1rhs[index] = beta1rhsL; + beta2rhs[index] = beta2rhsL; + beta3rhs[index] = beta3rhsL; + gt11rhs[index] = gt11rhsL; + gt12rhs[index] = gt12rhsL; + gt13rhs[index] = gt13rhsL; + gt22rhs[index] = gt22rhsL; + gt23rhs[index] = gt23rhsL; + gt33rhs[index] = gt33rhsL; + phirhs[index] = phirhsL; + trKrhs[index] = trKrhsL; + Xt1rhs[index] = Xt1rhsL; + Xt2rhs[index] = Xt2rhsL; + Xt3rhs[index] = Xt3rhsL; + } + LC_ENDLOOP3 (ML_BSSN_MP_O8_RHSStaticBoundary); +} + +extern "C" void ML_BSSN_MP_O8_RHSStaticBoundary(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverBoundary(cctkGH, &ML_BSSN_MP_O8_RHSStaticBoundary_Body); +} diff --git a/ML_BSSN_MP_O8/src/ML_BSSN_MP_O8_boundary.cc b/ML_BSSN_MP_O8/src/ML_BSSN_MP_O8_boundary.cc new file mode 100644 index 0000000..86dea7d --- /dev/null +++ b/ML_BSSN_MP_O8/src/ML_BSSN_MP_O8_boundary.cc @@ -0,0 +1,229 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +extern "C" void ML_BSSN_MP_O8_boundary_SelectBCs(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT ierr = 0; + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_MP_O8::ML_curv","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_MP_O8::ML_curv."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_MP_O8::ML_dtlapse","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_MP_O8::ML_dtlapse."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_MP_O8::ML_dtshift","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_MP_O8::ML_dtshift."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_MP_O8::ML_Gamma","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_MP_O8::ML_Gamma."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_MP_O8::ML_lapse","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_MP_O8::ML_lapse."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_MP_O8::ML_log_confac","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_MP_O8::ML_log_confac."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_MP_O8::ML_metric","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_MP_O8::ML_metric."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_MP_O8::ML_shift","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_MP_O8::ML_shift."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_MP_O8::ML_trace_curv","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_MP_O8::ML_trace_curv."); + return; +} + +static void ML_BSSN_MP_O8_boundary_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_BSSN_MP_O8_boundary_Body"); + } + + if (cctk_iteration % ML_BSSN_MP_O8_boundary_calc_every != ML_BSSN_MP_O8_boundary_calc_offset) + { + return; + } + + const char *groups[] = {"ML_BSSN_MP_O8::ML_curv","ML_BSSN_MP_O8::ML_dtlapse","ML_BSSN_MP_O8::ML_dtshift","ML_BSSN_MP_O8::ML_Gamma","ML_BSSN_MP_O8::ML_lapse","ML_BSSN_MP_O8::ML_log_confac","ML_BSSN_MP_O8::ML_metric","ML_BSSN_MP_O8::ML_shift","ML_BSSN_MP_O8::ML_trace_curv"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_BSSN_MP_O8_boundary", 9, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o1024dx = 0.0009765625*INV(dx); + CCTK_REAL const p1o1024dy = 0.0009765625*INV(dy); + CCTK_REAL const p1o1024dz = 0.0009765625*INV(dz); + CCTK_REAL const p1o1680dx = 0.000595238095238095238095238095238*INV(dx); + CCTK_REAL const p1o1680dy = 0.000595238095238095238095238095238*INV(dy); + CCTK_REAL const p1o1680dz = 0.000595238095238095238095238095238*INV(dz); + CCTK_REAL const p1o5040dx2 = 0.000198412698412698412698412698413*INV(SQR(dx)); + CCTK_REAL const p1o5040dy2 = 0.000198412698412698412698412698413*INV(SQR(dy)); + CCTK_REAL const p1o5040dz2 = 0.000198412698412698412698412698413*INV(SQR(dz)); + CCTK_REAL const p1o560dx = 0.00178571428571428571428571428571*INV(dx); + CCTK_REAL const p1o560dy = 0.00178571428571428571428571428571*INV(dy); + CCTK_REAL const p1o560dz = 0.00178571428571428571428571428571*INV(dz); + CCTK_REAL const p1o705600dxdy = 1.41723356009070294784580498866e-6*INV(dx)*INV(dy); + CCTK_REAL const p1o705600dxdz = 1.41723356009070294784580498866e-6*INV(dx)*INV(dz); + CCTK_REAL const p1o705600dydz = 1.41723356009070294784580498866e-6*INV(dy)*INV(dz); + CCTK_REAL const p1o840dx = 0.00119047619047619047619047619048*INV(dx); + CCTK_REAL const p1o840dy = 0.00119047619047619047619047619048*INV(dy); + CCTK_REAL const p1o840dz = 0.00119047619047619047619047619048*INV(dz); + CCTK_REAL const p1odx = INV(dx); + CCTK_REAL const p1ody = INV(dy); + CCTK_REAL const p1odz = INV(dz); + CCTK_REAL const pm1o840dx = -0.00119047619047619047619047619048*INV(dx); + CCTK_REAL const pm1o840dy = -0.00119047619047619047619047619048*INV(dy); + CCTK_REAL const pm1o840dz = -0.00119047619047619047619047619048*INV(dz); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_BSSN_MP_O8_boundary, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + + /* Include user supplied include files */ + + /* Precompute derivatives */ + + /* Calculate temporaries and grid functions */ + CCTK_REAL phiL = IfThen(ToReal(conformalMethod),1,0); + + CCTK_REAL gt11L = 1; + + CCTK_REAL gt12L = 0; + + CCTK_REAL gt13L = 0; + + CCTK_REAL gt22L = 1; + + CCTK_REAL gt23L = 0; + + CCTK_REAL gt33L = 1; + + CCTK_REAL trKL = 0; + + CCTK_REAL At11L = 0; + + CCTK_REAL At12L = 0; + + CCTK_REAL At13L = 0; + + CCTK_REAL At22L = 0; + + CCTK_REAL At23L = 0; + + CCTK_REAL At33L = 0; + + CCTK_REAL Xt1L = 0; + + CCTK_REAL Xt2L = 0; + + CCTK_REAL Xt3L = 0; + + CCTK_REAL alphaL = 1; + + CCTK_REAL AL = 0; + + CCTK_REAL beta1L = 0; + + CCTK_REAL beta2L = 0; + + CCTK_REAL beta3L = 0; + + CCTK_REAL B1L = 0; + + CCTK_REAL B2L = 0; + + CCTK_REAL B3L = 0; + + + /* Copy local copies back to grid functions */ + A[index] = AL; + alpha[index] = alphaL; + At11[index] = At11L; + At12[index] = At12L; + At13[index] = At13L; + At22[index] = At22L; + At23[index] = At23L; + At33[index] = At33L; + B1[index] = B1L; + B2[index] = B2L; + B3[index] = B3L; + beta1[index] = beta1L; + beta2[index] = beta2L; + beta3[index] = beta3L; + gt11[index] = gt11L; + gt12[index] = gt12L; + gt13[index] = gt13L; + gt22[index] = gt22L; + gt23[index] = gt23L; + gt33[index] = gt33L; + phi[index] = phiL; + trK[index] = trKL; + Xt1[index] = Xt1L; + Xt2[index] = Xt2L; + Xt3[index] = Xt3L; + } + LC_ENDLOOP3 (ML_BSSN_MP_O8_boundary); +} + +extern "C" void ML_BSSN_MP_O8_boundary(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverBoundaryWithGhosts(cctkGH, &ML_BSSN_MP_O8_boundary_Body); +} diff --git a/ML_BSSN_MP_O8/src/ML_BSSN_MP_O8_constraints1.cc b/ML_BSSN_MP_O8/src/ML_BSSN_MP_O8_constraints1.cc new file mode 100644 index 0000000..f3bc8db --- /dev/null +++ b/ML_BSSN_MP_O8/src/ML_BSSN_MP_O8_constraints1.cc @@ -0,0 +1,896 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +extern "C" void ML_BSSN_MP_O8_constraints1_SelectBCs(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT ierr = 0; + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_MP_O8::ML_Ham","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_MP_O8::ML_Ham."); + return; +} + +static void ML_BSSN_MP_O8_constraints1_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_BSSN_MP_O8_constraints1_Body"); + } + + if (cctk_iteration % ML_BSSN_MP_O8_constraints1_calc_every != ML_BSSN_MP_O8_constraints1_calc_offset) + { + return; + } + + const char *groups[] = {"Coordinates::jacobian","Coordinates::jacobian2","ML_BSSN_MP_O8::ML_curv","ML_BSSN_MP_O8::ML_Gamma","ML_BSSN_MP_O8::ML_Ham","ML_BSSN_MP_O8::ML_lapse","ML_BSSN_MP_O8::ML_log_confac","ML_BSSN_MP_O8::ML_metric","ML_BSSN_MP_O8::ML_shift","ML_BSSN_MP_O8::ML_trace_curv"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_BSSN_MP_O8_constraints1", 10, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o1024dx = 0.0009765625*INV(dx); + CCTK_REAL const p1o1024dy = 0.0009765625*INV(dy); + CCTK_REAL const p1o1024dz = 0.0009765625*INV(dz); + CCTK_REAL const p1o1680dx = 0.000595238095238095238095238095238*INV(dx); + CCTK_REAL const p1o1680dy = 0.000595238095238095238095238095238*INV(dy); + CCTK_REAL const p1o1680dz = 0.000595238095238095238095238095238*INV(dz); + CCTK_REAL const p1o5040dx2 = 0.000198412698412698412698412698413*INV(SQR(dx)); + CCTK_REAL const p1o5040dy2 = 0.000198412698412698412698412698413*INV(SQR(dy)); + CCTK_REAL const p1o5040dz2 = 0.000198412698412698412698412698413*INV(SQR(dz)); + CCTK_REAL const p1o560dx = 0.00178571428571428571428571428571*INV(dx); + CCTK_REAL const p1o560dy = 0.00178571428571428571428571428571*INV(dy); + CCTK_REAL const p1o560dz = 0.00178571428571428571428571428571*INV(dz); + CCTK_REAL const p1o705600dxdy = 1.41723356009070294784580498866e-6*INV(dx)*INV(dy); + CCTK_REAL const p1o705600dxdz = 1.41723356009070294784580498866e-6*INV(dx)*INV(dz); + CCTK_REAL const p1o705600dydz = 1.41723356009070294784580498866e-6*INV(dy)*INV(dz); + CCTK_REAL const p1o840dx = 0.00119047619047619047619047619048*INV(dx); + CCTK_REAL const p1o840dy = 0.00119047619047619047619047619048*INV(dy); + CCTK_REAL const p1o840dz = 0.00119047619047619047619047619048*INV(dz); + CCTK_REAL const p1odx = INV(dx); + CCTK_REAL const p1ody = INV(dy); + CCTK_REAL const p1odz = INV(dz); + CCTK_REAL const pm1o840dx = -0.00119047619047619047619047619048*INV(dx); + CCTK_REAL const pm1o840dy = -0.00119047619047619047619047619048*INV(dy); + CCTK_REAL const pm1o840dz = -0.00119047619047619047619047619048*INV(dz); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_BSSN_MP_O8_constraints1, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + CCTK_REAL alphaL = alpha[index]; + CCTK_REAL At11L = At11[index]; + CCTK_REAL At12L = At12[index]; + CCTK_REAL At13L = At13[index]; + CCTK_REAL At22L = At22[index]; + CCTK_REAL At23L = At23[index]; + CCTK_REAL At33L = At33[index]; + CCTK_REAL beta1L = beta1[index]; + CCTK_REAL beta2L = beta2[index]; + CCTK_REAL beta3L = beta3[index]; + CCTK_REAL dJ111L = dJ111[index]; + CCTK_REAL dJ112L = dJ112[index]; + CCTK_REAL dJ113L = dJ113[index]; + CCTK_REAL dJ122L = dJ122[index]; + CCTK_REAL dJ123L = dJ123[index]; + CCTK_REAL dJ133L = dJ133[index]; + CCTK_REAL dJ211L = dJ211[index]; + CCTK_REAL dJ212L = dJ212[index]; + CCTK_REAL dJ213L = dJ213[index]; + CCTK_REAL dJ222L = dJ222[index]; + CCTK_REAL dJ223L = dJ223[index]; + CCTK_REAL dJ233L = dJ233[index]; + CCTK_REAL dJ311L = dJ311[index]; + CCTK_REAL dJ312L = dJ312[index]; + CCTK_REAL dJ313L = dJ313[index]; + CCTK_REAL dJ322L = dJ322[index]; + CCTK_REAL dJ323L = dJ323[index]; + CCTK_REAL dJ333L = dJ333[index]; + CCTK_REAL eTttL = (*stress_energy_state) ? eTtt[index] : ToReal(0.0); + CCTK_REAL eTtxL = (*stress_energy_state) ? eTtx[index] : ToReal(0.0); + CCTK_REAL eTtyL = (*stress_energy_state) ? eTty[index] : ToReal(0.0); + CCTK_REAL eTtzL = (*stress_energy_state) ? eTtz[index] : ToReal(0.0); + CCTK_REAL eTxxL = (*stress_energy_state) ? eTxx[index] : ToReal(0.0); + CCTK_REAL eTxyL = (*stress_energy_state) ? eTxy[index] : ToReal(0.0); + CCTK_REAL eTxzL = (*stress_energy_state) ? eTxz[index] : ToReal(0.0); + CCTK_REAL eTyyL = (*stress_energy_state) ? eTyy[index] : ToReal(0.0); + CCTK_REAL eTyzL = (*stress_energy_state) ? eTyz[index] : ToReal(0.0); + CCTK_REAL eTzzL = (*stress_energy_state) ? eTzz[index] : ToReal(0.0); + CCTK_REAL gt11L = gt11[index]; + CCTK_REAL gt12L = gt12[index]; + CCTK_REAL gt13L = gt13[index]; + CCTK_REAL gt22L = gt22[index]; + CCTK_REAL gt23L = gt23[index]; + CCTK_REAL gt33L = gt33[index]; + CCTK_REAL J11L = J11[index]; + CCTK_REAL J12L = J12[index]; + CCTK_REAL J13L = J13[index]; + CCTK_REAL J21L = J21[index]; + CCTK_REAL J22L = J22[index]; + CCTK_REAL J23L = J23[index]; + CCTK_REAL J31L = J31[index]; + CCTK_REAL J32L = J32[index]; + CCTK_REAL J33L = J33[index]; + CCTK_REAL phiL = phi[index]; + CCTK_REAL trKL = trK[index]; + CCTK_REAL Xt1L = Xt1[index]; + CCTK_REAL Xt2L = Xt2[index]; + CCTK_REAL Xt3L = Xt3[index]; + + /* Include user supplied include files */ + + /* Precompute derivatives */ + CCTK_REAL const PDstandardNth1gt11 = PDstandardNth1(>11[index]); + CCTK_REAL const PDstandardNth2gt11 = PDstandardNth2(>11[index]); + CCTK_REAL const PDstandardNth3gt11 = PDstandardNth3(>11[index]); + CCTK_REAL const PDstandardNth11gt11 = PDstandardNth11(>11[index]); + CCTK_REAL const PDstandardNth22gt11 = PDstandardNth22(>11[index]); + CCTK_REAL const PDstandardNth33gt11 = PDstandardNth33(>11[index]); + CCTK_REAL const PDstandardNth12gt11 = PDstandardNth12(>11[index]); + CCTK_REAL const PDstandardNth13gt11 = PDstandardNth13(>11[index]); + CCTK_REAL const PDstandardNth23gt11 = PDstandardNth23(>11[index]); + CCTK_REAL const PDstandardNth1gt12 = PDstandardNth1(>12[index]); + CCTK_REAL const PDstandardNth2gt12 = PDstandardNth2(>12[index]); + CCTK_REAL const PDstandardNth3gt12 = PDstandardNth3(>12[index]); + CCTK_REAL const PDstandardNth11gt12 = PDstandardNth11(>12[index]); + CCTK_REAL const PDstandardNth22gt12 = PDstandardNth22(>12[index]); + CCTK_REAL const PDstandardNth33gt12 = PDstandardNth33(>12[index]); + CCTK_REAL const PDstandardNth12gt12 = PDstandardNth12(>12[index]); + CCTK_REAL const PDstandardNth13gt12 = PDstandardNth13(>12[index]); + CCTK_REAL const PDstandardNth23gt12 = PDstandardNth23(>12[index]); + CCTK_REAL const PDstandardNth1gt13 = PDstandardNth1(>13[index]); + CCTK_REAL const PDstandardNth2gt13 = PDstandardNth2(>13[index]); + CCTK_REAL const PDstandardNth3gt13 = PDstandardNth3(>13[index]); + CCTK_REAL const PDstandardNth11gt13 = PDstandardNth11(>13[index]); + CCTK_REAL const PDstandardNth22gt13 = PDstandardNth22(>13[index]); + CCTK_REAL const PDstandardNth33gt13 = PDstandardNth33(>13[index]); + CCTK_REAL const PDstandardNth12gt13 = PDstandardNth12(>13[index]); + CCTK_REAL const PDstandardNth13gt13 = PDstandardNth13(>13[index]); + CCTK_REAL const PDstandardNth23gt13 = PDstandardNth23(>13[index]); + CCTK_REAL const PDstandardNth1gt22 = PDstandardNth1(>22[index]); + CCTK_REAL const PDstandardNth2gt22 = PDstandardNth2(>22[index]); + CCTK_REAL const PDstandardNth3gt22 = PDstandardNth3(>22[index]); + CCTK_REAL const PDstandardNth11gt22 = PDstandardNth11(>22[index]); + CCTK_REAL const PDstandardNth22gt22 = PDstandardNth22(>22[index]); + CCTK_REAL const PDstandardNth33gt22 = PDstandardNth33(>22[index]); + CCTK_REAL const PDstandardNth12gt22 = PDstandardNth12(>22[index]); + CCTK_REAL const PDstandardNth13gt22 = PDstandardNth13(>22[index]); + CCTK_REAL const PDstandardNth23gt22 = PDstandardNth23(>22[index]); + CCTK_REAL const PDstandardNth1gt23 = PDstandardNth1(>23[index]); + CCTK_REAL const PDstandardNth2gt23 = PDstandardNth2(>23[index]); + CCTK_REAL const PDstandardNth3gt23 = PDstandardNth3(>23[index]); + CCTK_REAL const PDstandardNth11gt23 = PDstandardNth11(>23[index]); + CCTK_REAL const PDstandardNth22gt23 = PDstandardNth22(>23[index]); + CCTK_REAL const PDstandardNth33gt23 = PDstandardNth33(>23[index]); + CCTK_REAL const PDstandardNth12gt23 = PDstandardNth12(>23[index]); + CCTK_REAL const PDstandardNth13gt23 = PDstandardNth13(>23[index]); + CCTK_REAL const PDstandardNth23gt23 = PDstandardNth23(>23[index]); + CCTK_REAL const PDstandardNth1gt33 = PDstandardNth1(>33[index]); + CCTK_REAL const PDstandardNth2gt33 = PDstandardNth2(>33[index]); + CCTK_REAL const PDstandardNth3gt33 = PDstandardNth3(>33[index]); + CCTK_REAL const PDstandardNth11gt33 = PDstandardNth11(>33[index]); + CCTK_REAL const PDstandardNth22gt33 = PDstandardNth22(>33[index]); + CCTK_REAL const PDstandardNth33gt33 = PDstandardNth33(>33[index]); + CCTK_REAL const PDstandardNth12gt33 = PDstandardNth12(>33[index]); + CCTK_REAL const PDstandardNth13gt33 = PDstandardNth13(>33[index]); + CCTK_REAL const PDstandardNth23gt33 = PDstandardNth23(>33[index]); + CCTK_REAL const PDstandardNth1phi = PDstandardNth1(&phi[index]); + CCTK_REAL const PDstandardNth2phi = PDstandardNth2(&phi[index]); + CCTK_REAL const PDstandardNth3phi = PDstandardNth3(&phi[index]); + CCTK_REAL const PDstandardNth11phi = PDstandardNth11(&phi[index]); + CCTK_REAL const PDstandardNth22phi = PDstandardNth22(&phi[index]); + CCTK_REAL const PDstandardNth33phi = PDstandardNth33(&phi[index]); + CCTK_REAL const PDstandardNth12phi = PDstandardNth12(&phi[index]); + CCTK_REAL const PDstandardNth13phi = PDstandardNth13(&phi[index]); + CCTK_REAL const PDstandardNth23phi = PDstandardNth23(&phi[index]); + CCTK_REAL const PDstandardNth1Xt1 = PDstandardNth1(&Xt1[index]); + CCTK_REAL const PDstandardNth2Xt1 = PDstandardNth2(&Xt1[index]); + CCTK_REAL const PDstandardNth3Xt1 = PDstandardNth3(&Xt1[index]); + CCTK_REAL const PDstandardNth1Xt2 = PDstandardNth1(&Xt2[index]); + CCTK_REAL const PDstandardNth2Xt2 = PDstandardNth2(&Xt2[index]); + CCTK_REAL const PDstandardNth3Xt2 = PDstandardNth3(&Xt2[index]); + CCTK_REAL const PDstandardNth1Xt3 = PDstandardNth1(&Xt3[index]); + CCTK_REAL const PDstandardNth2Xt3 = PDstandardNth2(&Xt3[index]); + CCTK_REAL const PDstandardNth3Xt3 = PDstandardNth3(&Xt3[index]); + + /* Calculate temporaries and grid functions */ + CCTK_REAL detgt = 1; + + CCTK_REAL gtu11 = INV(detgt)*(gt22L*gt33L - SQR(gt23L)); + + CCTK_REAL gtu12 = (gt13L*gt23L - gt12L*gt33L)*INV(detgt); + + CCTK_REAL gtu13 = (-(gt13L*gt22L) + gt12L*gt23L)*INV(detgt); + + CCTK_REAL gtu22 = INV(detgt)*(gt11L*gt33L - SQR(gt13L)); + + CCTK_REAL gtu23 = (gt12L*gt13L - gt11L*gt23L)*INV(detgt); + + CCTK_REAL gtu33 = INV(detgt)*(gt11L*gt22L - SQR(gt12L)); + + CCTK_REAL Gtl111 = 0.5*(J11L*PDstandardNth1gt11 + + J21L*PDstandardNth2gt11 + J31L*PDstandardNth3gt11); + + CCTK_REAL Gtl112 = 0.5*(J12L*PDstandardNth1gt11 + + J22L*PDstandardNth2gt11 + J32L*PDstandardNth3gt11); + + CCTK_REAL Gtl113 = 0.5*(J13L*PDstandardNth1gt11 + + J23L*PDstandardNth2gt11 + J33L*PDstandardNth3gt11); + + CCTK_REAL Gtl122 = J12L*PDstandardNth1gt12 + J22L*PDstandardNth2gt12 + + J32L*PDstandardNth3gt12 - 0.5*(J11L*PDstandardNth1gt22 + + J21L*PDstandardNth2gt22 + J31L*PDstandardNth3gt22); + + CCTK_REAL Gtl123 = 0.5*(J13L*PDstandardNth1gt12 + + J12L*PDstandardNth1gt13 - J11L*PDstandardNth1gt23 + + J23L*PDstandardNth2gt12 + J22L*PDstandardNth2gt13 - + J21L*PDstandardNth2gt23 + J33L*PDstandardNth3gt12 + + J32L*PDstandardNth3gt13 - J31L*PDstandardNth3gt23); + + CCTK_REAL Gtl133 = J13L*PDstandardNth1gt13 + J23L*PDstandardNth2gt13 + + J33L*PDstandardNth3gt13 - 0.5*(J11L*PDstandardNth1gt33 + + J21L*PDstandardNth2gt33 + J31L*PDstandardNth3gt33); + + CCTK_REAL Gtl211 = J11L*PDstandardNth1gt12 + J21L*PDstandardNth2gt12 - + 0.5*(J12L*PDstandardNth1gt11 + J22L*PDstandardNth2gt11 + + J32L*PDstandardNth3gt11) + J31L*PDstandardNth3gt12; + + CCTK_REAL Gtl212 = 0.5*(J11L*PDstandardNth1gt22 + + J21L*PDstandardNth2gt22 + J31L*PDstandardNth3gt22); + + CCTK_REAL Gtl213 = 0.5*(J13L*PDstandardNth1gt12 - + J12L*PDstandardNth1gt13 + J11L*PDstandardNth1gt23 + + J23L*PDstandardNth2gt12 - J22L*PDstandardNth2gt13 + + J21L*PDstandardNth2gt23 + J33L*PDstandardNth3gt12 - + J32L*PDstandardNth3gt13 + J31L*PDstandardNth3gt23); + + CCTK_REAL Gtl222 = 0.5*(J12L*PDstandardNth1gt22 + + J22L*PDstandardNth2gt22 + J32L*PDstandardNth3gt22); + + CCTK_REAL Gtl223 = 0.5*(J13L*PDstandardNth1gt22 + + J23L*PDstandardNth2gt22 + J33L*PDstandardNth3gt22); + + CCTK_REAL Gtl233 = J13L*PDstandardNth1gt23 + J23L*PDstandardNth2gt23 + + J33L*PDstandardNth3gt23 - 0.5*(J12L*PDstandardNth1gt33 + + J22L*PDstandardNth2gt33 + J32L*PDstandardNth3gt33); + + CCTK_REAL Gtl311 = J11L*PDstandardNth1gt13 + J21L*PDstandardNth2gt13 - + 0.5*(J13L*PDstandardNth1gt11 + J23L*PDstandardNth2gt11 + + J33L*PDstandardNth3gt11) + J31L*PDstandardNth3gt13; + + CCTK_REAL Gtl312 = 0.5*(-(J13L*PDstandardNth1gt12) + + J12L*PDstandardNth1gt13 + J11L*PDstandardNth1gt23 - + J23L*PDstandardNth2gt12 + J22L*PDstandardNth2gt13 + + J21L*PDstandardNth2gt23 - J33L*PDstandardNth3gt12 + + J32L*PDstandardNth3gt13 + J31L*PDstandardNth3gt23); + + CCTK_REAL Gtl313 = 0.5*(J11L*PDstandardNth1gt33 + + J21L*PDstandardNth2gt33 + J31L*PDstandardNth3gt33); + + CCTK_REAL Gtl322 = J12L*PDstandardNth1gt23 + J22L*PDstandardNth2gt23 - + 0.5*(J13L*PDstandardNth1gt22 + J23L*PDstandardNth2gt22 + + J33L*PDstandardNth3gt22) + J32L*PDstandardNth3gt23; + + CCTK_REAL Gtl323 = 0.5*(J12L*PDstandardNth1gt33 + + J22L*PDstandardNth2gt33 + J32L*PDstandardNth3gt33); + + CCTK_REAL Gtl333 = 0.5*(J13L*PDstandardNth1gt33 + + J23L*PDstandardNth2gt33 + J33L*PDstandardNth3gt33); + + CCTK_REAL Gtlu111 = Gtl111*gtu11 + Gtl112*gtu12 + Gtl113*gtu13; + + CCTK_REAL Gtlu112 = Gtl111*gtu12 + Gtl112*gtu22 + Gtl113*gtu23; + + CCTK_REAL Gtlu113 = Gtl111*gtu13 + Gtl112*gtu23 + Gtl113*gtu33; + + CCTK_REAL Gtlu121 = Gtl112*gtu11 + Gtl122*gtu12 + Gtl123*gtu13; + + CCTK_REAL Gtlu122 = Gtl112*gtu12 + Gtl122*gtu22 + Gtl123*gtu23; + + CCTK_REAL Gtlu123 = Gtl112*gtu13 + Gtl122*gtu23 + Gtl123*gtu33; + + CCTK_REAL Gtlu131 = Gtl113*gtu11 + Gtl123*gtu12 + Gtl133*gtu13; + + CCTK_REAL Gtlu132 = Gtl113*gtu12 + Gtl123*gtu22 + Gtl133*gtu23; + + CCTK_REAL Gtlu133 = Gtl113*gtu13 + Gtl123*gtu23 + Gtl133*gtu33; + + CCTK_REAL Gtlu211 = Gtl211*gtu11 + Gtl212*gtu12 + Gtl213*gtu13; + + CCTK_REAL Gtlu212 = Gtl211*gtu12 + Gtl212*gtu22 + Gtl213*gtu23; + + CCTK_REAL Gtlu213 = Gtl211*gtu13 + Gtl212*gtu23 + Gtl213*gtu33; + + CCTK_REAL Gtlu221 = Gtl212*gtu11 + Gtl222*gtu12 + Gtl223*gtu13; + + CCTK_REAL Gtlu222 = Gtl212*gtu12 + Gtl222*gtu22 + Gtl223*gtu23; + + CCTK_REAL Gtlu223 = Gtl212*gtu13 + Gtl222*gtu23 + Gtl223*gtu33; + + CCTK_REAL Gtlu231 = Gtl213*gtu11 + Gtl223*gtu12 + Gtl233*gtu13; + + CCTK_REAL Gtlu232 = Gtl213*gtu12 + Gtl223*gtu22 + Gtl233*gtu23; + + CCTK_REAL Gtlu233 = Gtl213*gtu13 + Gtl223*gtu23 + Gtl233*gtu33; + + CCTK_REAL Gtlu311 = Gtl311*gtu11 + Gtl312*gtu12 + Gtl313*gtu13; + + CCTK_REAL Gtlu312 = Gtl311*gtu12 + Gtl312*gtu22 + Gtl313*gtu23; + + CCTK_REAL Gtlu313 = Gtl311*gtu13 + Gtl312*gtu23 + Gtl313*gtu33; + + CCTK_REAL Gtlu321 = Gtl312*gtu11 + Gtl322*gtu12 + Gtl323*gtu13; + + CCTK_REAL Gtlu322 = Gtl312*gtu12 + Gtl322*gtu22 + Gtl323*gtu23; + + CCTK_REAL Gtlu323 = Gtl312*gtu13 + Gtl322*gtu23 + Gtl323*gtu33; + + CCTK_REAL Gtlu331 = Gtl313*gtu11 + Gtl323*gtu12 + Gtl333*gtu13; + + CCTK_REAL Gtlu332 = Gtl313*gtu12 + Gtl323*gtu22 + Gtl333*gtu23; + + CCTK_REAL Gtlu333 = Gtl313*gtu13 + Gtl323*gtu23 + Gtl333*gtu33; + + CCTK_REAL Gt111 = Gtl111*gtu11 + Gtl211*gtu12 + Gtl311*gtu13; + + CCTK_REAL Gt211 = Gtl111*gtu12 + Gtl211*gtu22 + Gtl311*gtu23; + + CCTK_REAL Gt311 = Gtl111*gtu13 + Gtl211*gtu23 + Gtl311*gtu33; + + CCTK_REAL Gt112 = Gtl112*gtu11 + Gtl212*gtu12 + Gtl312*gtu13; + + CCTK_REAL Gt212 = Gtl112*gtu12 + Gtl212*gtu22 + Gtl312*gtu23; + + CCTK_REAL Gt312 = Gtl112*gtu13 + Gtl212*gtu23 + Gtl312*gtu33; + + CCTK_REAL Gt113 = Gtl113*gtu11 + Gtl213*gtu12 + Gtl313*gtu13; + + CCTK_REAL Gt213 = Gtl113*gtu12 + Gtl213*gtu22 + Gtl313*gtu23; + + CCTK_REAL Gt313 = Gtl113*gtu13 + Gtl213*gtu23 + Gtl313*gtu33; + + CCTK_REAL Gt122 = Gtl122*gtu11 + Gtl222*gtu12 + Gtl322*gtu13; + + CCTK_REAL Gt222 = Gtl122*gtu12 + Gtl222*gtu22 + Gtl322*gtu23; + + CCTK_REAL Gt322 = Gtl122*gtu13 + Gtl222*gtu23 + Gtl322*gtu33; + + CCTK_REAL Gt123 = Gtl123*gtu11 + Gtl223*gtu12 + Gtl323*gtu13; + + CCTK_REAL Gt223 = Gtl123*gtu12 + Gtl223*gtu22 + Gtl323*gtu23; + + CCTK_REAL Gt323 = Gtl123*gtu13 + Gtl223*gtu23 + Gtl323*gtu33; + + CCTK_REAL Gt133 = Gtl133*gtu11 + Gtl233*gtu12 + Gtl333*gtu13; + + CCTK_REAL Gt233 = Gtl133*gtu12 + Gtl233*gtu22 + Gtl333*gtu23; + + CCTK_REAL Gt333 = Gtl133*gtu13 + Gtl233*gtu23 + Gtl333*gtu33; + + CCTK_REAL Xtn1 = Gt111*gtu11 + Gt122*gtu22 + 2*(Gt112*gtu12 + + Gt113*gtu13 + Gt123*gtu23) + Gt133*gtu33; + + CCTK_REAL Xtn2 = Gt211*gtu11 + Gt222*gtu22 + 2*(Gt212*gtu12 + + Gt213*gtu13 + Gt223*gtu23) + Gt233*gtu33; + + CCTK_REAL Xtn3 = Gt311*gtu11 + Gt322*gtu22 + 2*(Gt312*gtu12 + + Gt313*gtu13 + Gt323*gtu23) + Gt333*gtu33; + + CCTK_REAL Rt11 = 3*(Gt111*Gtlu111 + Gt112*Gtlu112 + Gt113*Gtlu113) + + 2*(Gt211*Gtlu121 + Gt212*Gtlu122 + Gt213*Gtlu123 + Gt311*Gtlu131 + + Gt312*Gtlu132 + Gt313*Gtlu133) + Gt211*Gtlu211 + Gt212*Gtlu212 + + Gt213*Gtlu213 + Gt311*Gtlu311 + Gt312*Gtlu312 + Gt313*Gtlu313 + + J11L*(gt11L*PDstandardNth1Xt1 + gt12L*PDstandardNth1Xt2 + + gt13L*PDstandardNth1Xt3) + J21L*(gt11L*PDstandardNth2Xt1 + + gt12L*PDstandardNth2Xt2 + gt13L*PDstandardNth2Xt3) + + J31L*(gt11L*PDstandardNth3Xt1 + gt12L*PDstandardNth3Xt2 + + gt13L*PDstandardNth3Xt3) + Gtl111*Xtn1 + Gtl112*Xtn2 + Gtl113*Xtn3 + + 0.5*(-2*(gtu12*(J11L*J12L*PDstandardNth11gt11 + + J12L*J21L*PDstandardNth12gt11 + J11L*J22L*PDstandardNth12gt11 + + J12L*J31L*PDstandardNth13gt11 + J11L*J32L*PDstandardNth13gt11 + + dJ112L*PDstandardNth1gt11 + J21L*J22L*PDstandardNth22gt11 + + J22L*J31L*PDstandardNth23gt11 + J21L*J32L*PDstandardNth23gt11 + + dJ212L*PDstandardNth2gt11 + J31L*J32L*PDstandardNth33gt11 + + dJ312L*PDstandardNth3gt11) + gtu13*(J11L*J13L*PDstandardNth11gt11 + + J13L*J21L*PDstandardNth12gt11 + J11L*J23L*PDstandardNth12gt11 + + J13L*J31L*PDstandardNth13gt11 + J11L*J33L*PDstandardNth13gt11 + + dJ113L*PDstandardNth1gt11 + J21L*J23L*PDstandardNth22gt11 + + J23L*J31L*PDstandardNth23gt11 + J21L*J33L*PDstandardNth23gt11 + + dJ213L*PDstandardNth2gt11 + J31L*J33L*PDstandardNth33gt11 + + dJ313L*PDstandardNth3gt11) + gtu23*(J12L*J13L*PDstandardNth11gt11 + + J13L*J22L*PDstandardNth12gt11 + J12L*J23L*PDstandardNth12gt11 + + J13L*J32L*PDstandardNth13gt11 + J12L*J33L*PDstandardNth13gt11 + + dJ123L*PDstandardNth1gt11 + J22L*J23L*PDstandardNth22gt11 + + J23L*J32L*PDstandardNth23gt11 + J22L*J33L*PDstandardNth23gt11 + + dJ223L*PDstandardNth2gt11 + J32L*J33L*PDstandardNth33gt11 + + dJ323L*PDstandardNth3gt11)) - gtu11*(2*J11L*J21L*PDstandardNth12gt11 + + 2*J11L*J31L*PDstandardNth13gt11 + dJ111L*PDstandardNth1gt11 + + 2*J21L*J31L*PDstandardNth23gt11 + dJ211L*PDstandardNth2gt11 + + dJ311L*PDstandardNth3gt11 + PDstandardNth11gt11*SQR(J11L) + + PDstandardNth22gt11*SQR(J21L) + PDstandardNth33gt11*SQR(J31L)) - + gtu22*(2*J12L*J22L*PDstandardNth12gt11 + + 2*J12L*J32L*PDstandardNth13gt11 + dJ122L*PDstandardNth1gt11 + + 2*J22L*J32L*PDstandardNth23gt11 + dJ222L*PDstandardNth2gt11 + + dJ322L*PDstandardNth3gt11 + PDstandardNth11gt11*SQR(J12L) + + PDstandardNth22gt11*SQR(J22L) + PDstandardNth33gt11*SQR(J32L)) - + gtu33*(2*J13L*J23L*PDstandardNth12gt11 + + 2*J13L*J33L*PDstandardNth13gt11 + dJ133L*PDstandardNth1gt11 + + 2*J23L*J33L*PDstandardNth23gt11 + dJ233L*PDstandardNth2gt11 + + dJ333L*PDstandardNth3gt11 + PDstandardNth11gt11*SQR(J13L) + + PDstandardNth22gt11*SQR(J23L) + PDstandardNth33gt11*SQR(J33L))); + + CCTK_REAL Rt12 = Gt122*Gtlu112 + Gt123*Gtlu113 + (Gt111 + + Gt212)*Gtlu121 + Gt222*Gtlu122 + (Gt113 + Gt223)*Gtlu123 + + Gt322*Gtlu132 + Gt323*Gtlu133 + Gt111*Gtlu211 + Gt112*(Gtlu111 + + Gtlu122 + Gtlu212) + Gt113*Gtlu213 + 2*(Gt211*Gtlu221 + Gt212*Gtlu222 + + Gt213*Gtlu223) + Gt311*(Gtlu231 + Gtlu321) + Gt312*(Gtlu131 + Gtlu232 + + Gtlu322) + Gt313*(Gtlu233 + Gtlu323) + 0.5*((gt12L*J11L + + gt11L*J12L)*PDstandardNth1Xt1 + (gt22L*J11L + + gt12L*J12L)*PDstandardNth1Xt2 + (gt23L*J11L + + gt13L*J12L)*PDstandardNth1Xt3 + (gt12L*J21L + + gt11L*J22L)*PDstandardNth2Xt1 + (gt22L*J21L + + gt12L*J22L)*PDstandardNth2Xt2 + (gt23L*J21L + + gt13L*J22L)*PDstandardNth2Xt3 - 2*(gtu12*(J11L*J12L*PDstandardNth11gt12 + + J12L*J21L*PDstandardNth12gt12 + J11L*J22L*PDstandardNth12gt12 + + J12L*J31L*PDstandardNth13gt12 + J11L*J32L*PDstandardNth13gt12 + + dJ112L*PDstandardNth1gt12 + J21L*J22L*PDstandardNth22gt12 + + J22L*J31L*PDstandardNth23gt12 + J21L*J32L*PDstandardNth23gt12 + + dJ212L*PDstandardNth2gt12 + J31L*J32L*PDstandardNth33gt12 + + dJ312L*PDstandardNth3gt12) + gtu13*(J11L*J13L*PDstandardNth11gt12 + + J13L*J21L*PDstandardNth12gt12 + J11L*J23L*PDstandardNth12gt12 + + J13L*J31L*PDstandardNth13gt12 + J11L*J33L*PDstandardNth13gt12 + + dJ113L*PDstandardNth1gt12 + J21L*J23L*PDstandardNth22gt12 + + J23L*J31L*PDstandardNth23gt12 + J21L*J33L*PDstandardNth23gt12 + + dJ213L*PDstandardNth2gt12 + J31L*J33L*PDstandardNth33gt12 + + dJ313L*PDstandardNth3gt12) + gtu23*(J12L*J13L*PDstandardNth11gt12 + + J13L*J22L*PDstandardNth12gt12 + J12L*J23L*PDstandardNth12gt12 + + J13L*J32L*PDstandardNth13gt12 + J12L*J33L*PDstandardNth13gt12 + + dJ123L*PDstandardNth1gt12 + J22L*J23L*PDstandardNth22gt12 + + J23L*J32L*PDstandardNth23gt12 + J22L*J33L*PDstandardNth23gt12 + + dJ223L*PDstandardNth2gt12 + J32L*J33L*PDstandardNth33gt12 + + dJ323L*PDstandardNth3gt12)) + (gt12L*J31L + + gt11L*J32L)*PDstandardNth3Xt1 + (gt22L*J31L + + gt12L*J32L)*PDstandardNth3Xt2 + (gt23L*J31L + + gt13L*J32L)*PDstandardNth3Xt3 + (Gtl112 + Gtl211)*Xtn1 + (Gtl122 + + Gtl212)*Xtn2 + (Gtl123 + Gtl213)*Xtn3 - + gtu11*(2*J11L*J21L*PDstandardNth12gt12 + + 2*J11L*J31L*PDstandardNth13gt12 + dJ111L*PDstandardNth1gt12 + + 2*J21L*J31L*PDstandardNth23gt12 + dJ211L*PDstandardNth2gt12 + + dJ311L*PDstandardNth3gt12 + PDstandardNth11gt12*SQR(J11L) + + PDstandardNth22gt12*SQR(J21L) + PDstandardNth33gt12*SQR(J31L)) - + gtu22*(2*J12L*J22L*PDstandardNth12gt12 + + 2*J12L*J32L*PDstandardNth13gt12 + dJ122L*PDstandardNth1gt12 + + 2*J22L*J32L*PDstandardNth23gt12 + dJ222L*PDstandardNth2gt12 + + dJ322L*PDstandardNth3gt12 + PDstandardNth11gt12*SQR(J12L) + + PDstandardNth22gt12*SQR(J22L) + PDstandardNth33gt12*SQR(J32L)) - + gtu33*(2*J13L*J23L*PDstandardNth12gt12 + + 2*J13L*J33L*PDstandardNth13gt12 + dJ133L*PDstandardNth1gt12 + + 2*J23L*J33L*PDstandardNth23gt12 + dJ233L*PDstandardNth2gt12 + + dJ333L*PDstandardNth3gt12 + PDstandardNth11gt12*SQR(J13L) + + PDstandardNth22gt12*SQR(J23L) + PDstandardNth33gt12*SQR(J33L))); + + CCTK_REAL Rt13 = Gt123*Gtlu112 + Gt133*Gtlu113 + Gt223*Gtlu122 + + Gt233*Gtlu123 + (Gt111 + Gt313)*Gtlu131 + (Gt112 + Gt323)*Gtlu132 + + Gt333*Gtlu133 + Gt111*Gtlu311 + Gt112*Gtlu312 + Gt113*(Gtlu111 + + Gtlu133 + Gtlu313) + Gt211*(Gtlu231 + Gtlu321) + Gt212*(Gtlu232 + + Gtlu322) + Gt213*(Gtlu121 + Gtlu233 + Gtlu323) + 2*(Gt311*Gtlu331 + + Gt312*Gtlu332 + Gt313*Gtlu333) + 0.5*((gt13L*J11L + + gt11L*J13L)*PDstandardNth1Xt1 + (gt23L*J11L + + gt12L*J13L)*PDstandardNth1Xt2 + (gt33L*J11L + + gt13L*J13L)*PDstandardNth1Xt3 + (gt13L*J21L + + gt11L*J23L)*PDstandardNth2Xt1 + (gt23L*J21L + + gt12L*J23L)*PDstandardNth2Xt2 + (gt33L*J21L + + gt13L*J23L)*PDstandardNth2Xt3 - 2*(gtu12*(J11L*J12L*PDstandardNth11gt13 + + J12L*J21L*PDstandardNth12gt13 + J11L*J22L*PDstandardNth12gt13 + + J12L*J31L*PDstandardNth13gt13 + J11L*J32L*PDstandardNth13gt13 + + dJ112L*PDstandardNth1gt13 + J21L*J22L*PDstandardNth22gt13 + + J22L*J31L*PDstandardNth23gt13 + J21L*J32L*PDstandardNth23gt13 + + dJ212L*PDstandardNth2gt13 + J31L*J32L*PDstandardNth33gt13 + + dJ312L*PDstandardNth3gt13) + gtu13*(J11L*J13L*PDstandardNth11gt13 + + J13L*J21L*PDstandardNth12gt13 + J11L*J23L*PDstandardNth12gt13 + + J13L*J31L*PDstandardNth13gt13 + J11L*J33L*PDstandardNth13gt13 + + dJ113L*PDstandardNth1gt13 + J21L*J23L*PDstandardNth22gt13 + + J23L*J31L*PDstandardNth23gt13 + J21L*J33L*PDstandardNth23gt13 + + dJ213L*PDstandardNth2gt13 + J31L*J33L*PDstandardNth33gt13 + + dJ313L*PDstandardNth3gt13) + gtu23*(J12L*J13L*PDstandardNth11gt13 + + J13L*J22L*PDstandardNth12gt13 + J12L*J23L*PDstandardNth12gt13 + + J13L*J32L*PDstandardNth13gt13 + J12L*J33L*PDstandardNth13gt13 + + dJ123L*PDstandardNth1gt13 + J22L*J23L*PDstandardNth22gt13 + + J23L*J32L*PDstandardNth23gt13 + J22L*J33L*PDstandardNth23gt13 + + dJ223L*PDstandardNth2gt13 + J32L*J33L*PDstandardNth33gt13 + + dJ323L*PDstandardNth3gt13)) + (gt13L*J31L + + gt11L*J33L)*PDstandardNth3Xt1 + (gt23L*J31L + + gt12L*J33L)*PDstandardNth3Xt2 + (gt33L*J31L + + gt13L*J33L)*PDstandardNth3Xt3 + (Gtl113 + Gtl311)*Xtn1 + (Gtl123 + + Gtl312)*Xtn2 + (Gtl133 + Gtl313)*Xtn3 - + gtu11*(2*J11L*J21L*PDstandardNth12gt13 + + 2*J11L*J31L*PDstandardNth13gt13 + dJ111L*PDstandardNth1gt13 + + 2*J21L*J31L*PDstandardNth23gt13 + dJ211L*PDstandardNth2gt13 + + dJ311L*PDstandardNth3gt13 + PDstandardNth11gt13*SQR(J11L) + + PDstandardNth22gt13*SQR(J21L) + PDstandardNth33gt13*SQR(J31L)) - + gtu22*(2*J12L*J22L*PDstandardNth12gt13 + + 2*J12L*J32L*PDstandardNth13gt13 + dJ122L*PDstandardNth1gt13 + + 2*J22L*J32L*PDstandardNth23gt13 + dJ222L*PDstandardNth2gt13 + + dJ322L*PDstandardNth3gt13 + PDstandardNth11gt13*SQR(J12L) + + PDstandardNth22gt13*SQR(J22L) + PDstandardNth33gt13*SQR(J32L)) - + gtu33*(2*J13L*J23L*PDstandardNth12gt13 + + 2*J13L*J33L*PDstandardNth13gt13 + dJ133L*PDstandardNth1gt13 + + 2*J23L*J33L*PDstandardNth23gt13 + dJ233L*PDstandardNth2gt13 + + dJ333L*PDstandardNth3gt13 + PDstandardNth11gt13*SQR(J13L) + + PDstandardNth22gt13*SQR(J23L) + PDstandardNth33gt13*SQR(J33L))); + + CCTK_REAL Rt22 = Gt112*(Gtlu121 + 2*Gtlu211) + Gt122*(Gtlu122 + + 2*Gtlu212) + Gt123*(Gtlu123 + 2*Gtlu213) + 3*(Gt212*Gtlu221 + + Gt222*Gtlu222 + Gt223*Gtlu223) + 2*(Gt312*Gtlu231 + Gt322*Gtlu232 + + Gt323*Gtlu233) + Gt312*Gtlu321 + Gt322*Gtlu322 + Gt323*Gtlu323 + + J12L*(gt12L*PDstandardNth1Xt1 + gt22L*PDstandardNth1Xt2 + + gt23L*PDstandardNth1Xt3) + J22L*(gt12L*PDstandardNth2Xt1 + + gt22L*PDstandardNth2Xt2 + gt23L*PDstandardNth2Xt3) + + J32L*(gt12L*PDstandardNth3Xt1 + gt22L*PDstandardNth3Xt2 + + gt23L*PDstandardNth3Xt3) + Gtl212*Xtn1 + Gtl222*Xtn2 + Gtl223*Xtn3 + + 0.5*(-2*(gtu12*(J11L*J12L*PDstandardNth11gt22 + + J12L*J21L*PDstandardNth12gt22 + J11L*J22L*PDstandardNth12gt22 + + J12L*J31L*PDstandardNth13gt22 + J11L*J32L*PDstandardNth13gt22 + + dJ112L*PDstandardNth1gt22 + J21L*J22L*PDstandardNth22gt22 + + J22L*J31L*PDstandardNth23gt22 + J21L*J32L*PDstandardNth23gt22 + + dJ212L*PDstandardNth2gt22 + J31L*J32L*PDstandardNth33gt22 + + dJ312L*PDstandardNth3gt22) + gtu13*(J11L*J13L*PDstandardNth11gt22 + + J13L*J21L*PDstandardNth12gt22 + J11L*J23L*PDstandardNth12gt22 + + J13L*J31L*PDstandardNth13gt22 + J11L*J33L*PDstandardNth13gt22 + + dJ113L*PDstandardNth1gt22 + J21L*J23L*PDstandardNth22gt22 + + J23L*J31L*PDstandardNth23gt22 + J21L*J33L*PDstandardNth23gt22 + + dJ213L*PDstandardNth2gt22 + J31L*J33L*PDstandardNth33gt22 + + dJ313L*PDstandardNth3gt22) + gtu23*(J12L*J13L*PDstandardNth11gt22 + + J13L*J22L*PDstandardNth12gt22 + J12L*J23L*PDstandardNth12gt22 + + J13L*J32L*PDstandardNth13gt22 + J12L*J33L*PDstandardNth13gt22 + + dJ123L*PDstandardNth1gt22 + J22L*J23L*PDstandardNth22gt22 + + J23L*J32L*PDstandardNth23gt22 + J22L*J33L*PDstandardNth23gt22 + + dJ223L*PDstandardNth2gt22 + J32L*J33L*PDstandardNth33gt22 + + dJ323L*PDstandardNth3gt22)) - gtu11*(2*J11L*J21L*PDstandardNth12gt22 + + 2*J11L*J31L*PDstandardNth13gt22 + dJ111L*PDstandardNth1gt22 + + 2*J21L*J31L*PDstandardNth23gt22 + dJ211L*PDstandardNth2gt22 + + dJ311L*PDstandardNth3gt22 + PDstandardNth11gt22*SQR(J11L) + + PDstandardNth22gt22*SQR(J21L) + PDstandardNth33gt22*SQR(J31L)) - + gtu22*(2*J12L*J22L*PDstandardNth12gt22 + + 2*J12L*J32L*PDstandardNth13gt22 + dJ122L*PDstandardNth1gt22 + + 2*J22L*J32L*PDstandardNth23gt22 + dJ222L*PDstandardNth2gt22 + + dJ322L*PDstandardNth3gt22 + PDstandardNth11gt22*SQR(J12L) + + PDstandardNth22gt22*SQR(J22L) + PDstandardNth33gt22*SQR(J32L)) - + gtu33*(2*J13L*J23L*PDstandardNth12gt22 + + 2*J13L*J33L*PDstandardNth13gt22 + dJ133L*PDstandardNth1gt22 + + 2*J23L*J33L*PDstandardNth23gt22 + dJ233L*PDstandardNth2gt22 + + dJ333L*PDstandardNth3gt22 + PDstandardNth11gt22*SQR(J13L) + + PDstandardNth22gt22*SQR(J23L) + PDstandardNth33gt22*SQR(J33L))); + + CCTK_REAL Rt23 = Gt113*Gtlu211 + Gt133*Gtlu213 + Gt213*Gtlu221 + + Gt233*Gtlu223 + (Gt212 + Gt313)*Gtlu231 + (Gt222 + Gt323)*Gtlu232 + + Gt333*Gtlu233 + Gt112*(Gtlu131 + Gtlu311) + Gt122*(Gtlu132 + Gtlu312) + + Gt123*(Gtlu133 + Gtlu212 + Gtlu313) + Gt212*Gtlu321 + Gt222*Gtlu322 + + Gt223*(Gtlu222 + Gtlu233 + Gtlu323) + 2*(Gt312*Gtlu331 + Gt322*Gtlu332 + + Gt323*Gtlu333) + 0.5*((gt13L*J12L + gt12L*J13L)*PDstandardNth1Xt1 + + (gt23L*J12L + gt22L*J13L)*PDstandardNth1Xt2 + (gt33L*J12L + + gt23L*J13L)*PDstandardNth1Xt3 + (gt13L*J22L + + gt12L*J23L)*PDstandardNth2Xt1 + (gt23L*J22L + + gt22L*J23L)*PDstandardNth2Xt2 + (gt33L*J22L + + gt23L*J23L)*PDstandardNth2Xt3 - 2*(gtu12*(J11L*J12L*PDstandardNth11gt23 + + J12L*J21L*PDstandardNth12gt23 + J11L*J22L*PDstandardNth12gt23 + + J12L*J31L*PDstandardNth13gt23 + J11L*J32L*PDstandardNth13gt23 + + dJ112L*PDstandardNth1gt23 + J21L*J22L*PDstandardNth22gt23 + + J22L*J31L*PDstandardNth23gt23 + J21L*J32L*PDstandardNth23gt23 + + dJ212L*PDstandardNth2gt23 + J31L*J32L*PDstandardNth33gt23 + + dJ312L*PDstandardNth3gt23) + gtu13*(J11L*J13L*PDstandardNth11gt23 + + J13L*J21L*PDstandardNth12gt23 + J11L*J23L*PDstandardNth12gt23 + + J13L*J31L*PDstandardNth13gt23 + J11L*J33L*PDstandardNth13gt23 + + dJ113L*PDstandardNth1gt23 + J21L*J23L*PDstandardNth22gt23 + + J23L*J31L*PDstandardNth23gt23 + J21L*J33L*PDstandardNth23gt23 + + dJ213L*PDstandardNth2gt23 + J31L*J33L*PDstandardNth33gt23 + + dJ313L*PDstandardNth3gt23) + gtu23*(J12L*J13L*PDstandardNth11gt23 + + J13L*J22L*PDstandardNth12gt23 + J12L*J23L*PDstandardNth12gt23 + + J13L*J32L*PDstandardNth13gt23 + J12L*J33L*PDstandardNth13gt23 + + dJ123L*PDstandardNth1gt23 + J22L*J23L*PDstandardNth22gt23 + + J23L*J32L*PDstandardNth23gt23 + J22L*J33L*PDstandardNth23gt23 + + dJ223L*PDstandardNth2gt23 + J32L*J33L*PDstandardNth33gt23 + + dJ323L*PDstandardNth3gt23)) + (gt13L*J32L + + gt12L*J33L)*PDstandardNth3Xt1 + (gt23L*J32L + + gt22L*J33L)*PDstandardNth3Xt2 + (gt33L*J32L + + gt23L*J33L)*PDstandardNth3Xt3 + (Gtl213 + Gtl312)*Xtn1 + (Gtl223 + + Gtl322)*Xtn2 + (Gtl233 + Gtl323)*Xtn3 - + gtu11*(2*J11L*J21L*PDstandardNth12gt23 + + 2*J11L*J31L*PDstandardNth13gt23 + dJ111L*PDstandardNth1gt23 + + 2*J21L*J31L*PDstandardNth23gt23 + dJ211L*PDstandardNth2gt23 + + dJ311L*PDstandardNth3gt23 + PDstandardNth11gt23*SQR(J11L) + + PDstandardNth22gt23*SQR(J21L) + PDstandardNth33gt23*SQR(J31L)) - + gtu22*(2*J12L*J22L*PDstandardNth12gt23 + + 2*J12L*J32L*PDstandardNth13gt23 + dJ122L*PDstandardNth1gt23 + + 2*J22L*J32L*PDstandardNth23gt23 + dJ222L*PDstandardNth2gt23 + + dJ322L*PDstandardNth3gt23 + PDstandardNth11gt23*SQR(J12L) + + PDstandardNth22gt23*SQR(J22L) + PDstandardNth33gt23*SQR(J32L)) - + gtu33*(2*J13L*J23L*PDstandardNth12gt23 + + 2*J13L*J33L*PDstandardNth13gt23 + dJ133L*PDstandardNth1gt23 + + 2*J23L*J33L*PDstandardNth23gt23 + dJ233L*PDstandardNth2gt23 + + dJ333L*PDstandardNth3gt23 + PDstandardNth11gt23*SQR(J13L) + + PDstandardNth22gt23*SQR(J23L) + PDstandardNth33gt23*SQR(J33L))); + + CCTK_REAL Rt33 = Gt113*(Gtlu131 + 2*Gtlu311) + Gt123*(Gtlu132 + + 2*Gtlu312) + Gt133*(Gtlu133 + 2*Gtlu313) + Gt213*(Gtlu231 + 2*Gtlu321) + + Gt223*(Gtlu232 + 2*Gtlu322) + Gt233*(Gtlu233 + 2*Gtlu323) + + 3*(Gt313*Gtlu331 + Gt323*Gtlu332 + Gt333*Gtlu333) + + J13L*(gt13L*PDstandardNth1Xt1 + gt23L*PDstandardNth1Xt2 + + gt33L*PDstandardNth1Xt3) + J23L*(gt13L*PDstandardNth2Xt1 + + gt23L*PDstandardNth2Xt2 + gt33L*PDstandardNth2Xt3) + + J33L*(gt13L*PDstandardNth3Xt1 + gt23L*PDstandardNth3Xt2 + + gt33L*PDstandardNth3Xt3) + Gtl313*Xtn1 + Gtl323*Xtn2 + Gtl333*Xtn3 + + 0.5*(-2*(gtu12*(J11L*J12L*PDstandardNth11gt33 + + J12L*J21L*PDstandardNth12gt33 + J11L*J22L*PDstandardNth12gt33 + + J12L*J31L*PDstandardNth13gt33 + J11L*J32L*PDstandardNth13gt33 + + dJ112L*PDstandardNth1gt33 + J21L*J22L*PDstandardNth22gt33 + + J22L*J31L*PDstandardNth23gt33 + J21L*J32L*PDstandardNth23gt33 + + dJ212L*PDstandardNth2gt33 + J31L*J32L*PDstandardNth33gt33 + + dJ312L*PDstandardNth3gt33) + gtu13*(J11L*J13L*PDstandardNth11gt33 + + J13L*J21L*PDstandardNth12gt33 + J11L*J23L*PDstandardNth12gt33 + + J13L*J31L*PDstandardNth13gt33 + J11L*J33L*PDstandardNth13gt33 + + dJ113L*PDstandardNth1gt33 + J21L*J23L*PDstandardNth22gt33 + + J23L*J31L*PDstandardNth23gt33 + J21L*J33L*PDstandardNth23gt33 + + dJ213L*PDstandardNth2gt33 + J31L*J33L*PDstandardNth33gt33 + + dJ313L*PDstandardNth3gt33) + gtu23*(J12L*J13L*PDstandardNth11gt33 + + J13L*J22L*PDstandardNth12gt33 + J12L*J23L*PDstandardNth12gt33 + + J13L*J32L*PDstandardNth13gt33 + J12L*J33L*PDstandardNth13gt33 + + dJ123L*PDstandardNth1gt33 + J22L*J23L*PDstandardNth22gt33 + + J23L*J32L*PDstandardNth23gt33 + J22L*J33L*PDstandardNth23gt33 + + dJ223L*PDstandardNth2gt33 + J32L*J33L*PDstandardNth33gt33 + + dJ323L*PDstandardNth3gt33)) - gtu11*(2*J11L*J21L*PDstandardNth12gt33 + + 2*J11L*J31L*PDstandardNth13gt33 + dJ111L*PDstandardNth1gt33 + + 2*J21L*J31L*PDstandardNth23gt33 + dJ211L*PDstandardNth2gt33 + + dJ311L*PDstandardNth3gt33 + PDstandardNth11gt33*SQR(J11L) + + PDstandardNth22gt33*SQR(J21L) + PDstandardNth33gt33*SQR(J31L)) - + gtu22*(2*J12L*J22L*PDstandardNth12gt33 + + 2*J12L*J32L*PDstandardNth13gt33 + dJ122L*PDstandardNth1gt33 + + 2*J22L*J32L*PDstandardNth23gt33 + dJ222L*PDstandardNth2gt33 + + dJ322L*PDstandardNth3gt33 + PDstandardNth11gt33*SQR(J12L) + + PDstandardNth22gt33*SQR(J22L) + PDstandardNth33gt33*SQR(J32L)) - + gtu33*(2*J13L*J23L*PDstandardNth12gt33 + + 2*J13L*J33L*PDstandardNth13gt33 + dJ133L*PDstandardNth1gt33 + + 2*J23L*J33L*PDstandardNth23gt33 + dJ233L*PDstandardNth2gt33 + + dJ333L*PDstandardNth3gt33 + PDstandardNth11gt33*SQR(J13L) + + PDstandardNth22gt33*SQR(J23L) + PDstandardNth33gt33*SQR(J33L))); + + CCTK_REAL fac1 = IfThen(ToReal(conformalMethod),-0.5*INV(phiL),1); + + CCTK_REAL cdphi1 = fac1*(J11L*PDstandardNth1phi + + J21L*PDstandardNth2phi + J31L*PDstandardNth3phi); + + CCTK_REAL cdphi2 = fac1*(J12L*PDstandardNth1phi + + J22L*PDstandardNth2phi + J32L*PDstandardNth3phi); + + CCTK_REAL cdphi3 = fac1*(J13L*PDstandardNth1phi + + J23L*PDstandardNth2phi + J33L*PDstandardNth3phi); + + CCTK_REAL fac2 = IfThen(ToReal(conformalMethod),0.5*INV(SQR(phiL)),0); + + CCTK_REAL cdphi211 = fac1*((dJ111L - Gt111*J11L - Gt211*J12L - + Gt311*J13L)*PDstandardNth1phi + 2*(J11L*(J21L*PDstandardNth12phi + + J31L*PDstandardNth13phi) + J21L*J31L*PDstandardNth23phi) + (dJ211L - + Gt111*J21L - Gt211*J22L - Gt311*J23L)*PDstandardNth2phi + (dJ311L - + Gt111*J31L - Gt211*J32L - Gt311*J33L)*PDstandardNth3phi + + PDstandardNth11phi*SQR(J11L) + PDstandardNth22phi*SQR(J21L) + + PDstandardNth33phi*SQR(J31L)) + fac2*SQR(J11L*PDstandardNth1phi + + J21L*PDstandardNth2phi + J31L*PDstandardNth3phi); + + CCTK_REAL cdphi212 = fac2*(J11L*PDstandardNth1phi + + J21L*PDstandardNth2phi + + J31L*PDstandardNth3phi)*(J12L*PDstandardNth1phi + + J22L*PDstandardNth2phi + J32L*PDstandardNth3phi) + + fac1*(J12L*(J11L*PDstandardNth11phi + J21L*PDstandardNth12phi + + J31L*PDstandardNth13phi) + J11L*(J22L*PDstandardNth12phi + + J32L*PDstandardNth13phi) + (dJ112L - Gt112*J11L - Gt212*J12L - + Gt312*J13L)*PDstandardNth1phi + J22L*(J21L*PDstandardNth22phi + + J31L*PDstandardNth23phi) + (dJ212L - Gt112*J21L - Gt212*J22L - + Gt312*J23L)*PDstandardNth2phi + J32L*(J21L*PDstandardNth23phi + + J31L*PDstandardNth33phi) + (dJ312L - Gt112*J31L - Gt212*J32L - + Gt312*J33L)*PDstandardNth3phi); + + CCTK_REAL cdphi213 = fac2*(J11L*PDstandardNth1phi + + J21L*PDstandardNth2phi + + J31L*PDstandardNth3phi)*(J13L*PDstandardNth1phi + + J23L*PDstandardNth2phi + J33L*PDstandardNth3phi) + + fac1*(J13L*(J11L*PDstandardNth11phi + J21L*PDstandardNth12phi + + J31L*PDstandardNth13phi) + J11L*(J23L*PDstandardNth12phi + + J33L*PDstandardNth13phi) + (dJ113L - Gt113*J11L - Gt213*J12L - + Gt313*J13L)*PDstandardNth1phi + J23L*(J21L*PDstandardNth22phi + + J31L*PDstandardNth23phi) + (dJ213L - Gt113*J21L - Gt213*J22L - + Gt313*J23L)*PDstandardNth2phi + J33L*(J21L*PDstandardNth23phi + + J31L*PDstandardNth33phi) + (dJ313L - Gt113*J31L - Gt213*J32L - + Gt313*J33L)*PDstandardNth3phi); + + CCTK_REAL cdphi222 = fac1*((dJ122L - Gt122*J11L - Gt222*J12L - + Gt322*J13L)*PDstandardNth1phi + 2*(J12L*(J22L*PDstandardNth12phi + + J32L*PDstandardNth13phi) + J22L*J32L*PDstandardNth23phi) + (dJ222L - + Gt122*J21L - Gt222*J22L - Gt322*J23L)*PDstandardNth2phi + (dJ322L - + Gt122*J31L - Gt222*J32L - Gt322*J33L)*PDstandardNth3phi + + PDstandardNth11phi*SQR(J12L) + PDstandardNth22phi*SQR(J22L) + + PDstandardNth33phi*SQR(J32L)) + fac2*SQR(J12L*PDstandardNth1phi + + J22L*PDstandardNth2phi + J32L*PDstandardNth3phi); + + CCTK_REAL cdphi223 = fac2*(J12L*PDstandardNth1phi + + J22L*PDstandardNth2phi + + J32L*PDstandardNth3phi)*(J13L*PDstandardNth1phi + + J23L*PDstandardNth2phi + J33L*PDstandardNth3phi) + + fac1*(J13L*(J12L*PDstandardNth11phi + J22L*PDstandardNth12phi + + J32L*PDstandardNth13phi) + J12L*(J23L*PDstandardNth12phi + + J33L*PDstandardNth13phi) + (dJ123L - Gt123*J11L - Gt223*J12L - + Gt323*J13L)*PDstandardNth1phi + J23L*(J22L*PDstandardNth22phi + + J32L*PDstandardNth23phi) + (dJ223L - Gt123*J21L - Gt223*J22L - + Gt323*J23L)*PDstandardNth2phi + J33L*(J22L*PDstandardNth23phi + + J32L*PDstandardNth33phi) + (dJ323L - Gt123*J31L - Gt223*J32L - + Gt323*J33L)*PDstandardNth3phi); + + CCTK_REAL cdphi233 = fac1*((dJ133L - Gt133*J11L - Gt233*J12L - + Gt333*J13L)*PDstandardNth1phi + 2*(J13L*(J23L*PDstandardNth12phi + + J33L*PDstandardNth13phi) + J23L*J33L*PDstandardNth23phi) + (dJ233L - + Gt133*J21L - Gt233*J22L - Gt333*J23L)*PDstandardNth2phi + (dJ333L - + Gt133*J31L - Gt233*J32L - Gt333*J33L)*PDstandardNth3phi + + PDstandardNth11phi*SQR(J13L) + PDstandardNth22phi*SQR(J23L) + + PDstandardNth33phi*SQR(J33L)) + fac2*SQR(J13L*PDstandardNth1phi + + J23L*PDstandardNth2phi + J33L*PDstandardNth3phi); + + CCTK_REAL Rphi11 = -2*(cdphi211 + 2*(-1 + gt11L*gtu11)*SQR(cdphi1) + + gt11L*(cdphi211*gtu11 + 4*(cdphi1*(cdphi2*gtu12 + cdphi3*gtu13) + + cdphi2*cdphi3*gtu23) + cdphi233*gtu33 + gtu22*(cdphi222 + + 2*SQR(cdphi2)) + 2*(cdphi212*gtu12 + cdphi213*gtu13 + cdphi223*gtu23 + + gtu33*SQR(cdphi3)))); + + CCTK_REAL Rphi12 = -2*(cdphi212 + cdphi1*(cdphi2*(-2 + 4*gt12L*gtu12) + + 4*cdphi3*gt12L*gtu13) + gt12L*(cdphi211*gtu11 + 4*cdphi2*cdphi3*gtu23 + + 2*(cdphi212*gtu12 + cdphi213*gtu13 + cdphi223*gtu23 + + gtu11*SQR(cdphi1)) + gtu22*(cdphi222 + 2*SQR(cdphi2)) + gtu33*(cdphi233 + + 2*SQR(cdphi3)))); + + CCTK_REAL Rphi13 = -2*(cdphi213 + cdphi1*(4*cdphi2*gt13L*gtu12 + + cdphi3*(-2 + 4*gt13L*gtu13)) + gt13L*(cdphi211*gtu11 + + 4*cdphi2*cdphi3*gtu23 + 2*(cdphi212*gtu12 + cdphi213*gtu13 + + cdphi223*gtu23 + gtu11*SQR(cdphi1)) + gtu22*(cdphi222 + 2*SQR(cdphi2)) + + gtu33*(cdphi233 + 2*SQR(cdphi3)))); + + CCTK_REAL Rphi22 = -2*(cdphi222 + 2*(-1 + gt22L*gtu22)*SQR(cdphi2) + + gt22L*(cdphi222*gtu22 + 4*(cdphi1*cdphi3*gtu13 + cdphi2*(cdphi1*gtu12 + + cdphi3*gtu23)) + cdphi233*gtu33 + gtu11*(cdphi211 + 2*SQR(cdphi1)) + + 2*(cdphi212*gtu12 + cdphi213*gtu13 + cdphi223*gtu23 + + gtu33*SQR(cdphi3)))); + + CCTK_REAL Rphi23 = -2*(cdphi223 + cdphi2*(4*cdphi1*gt23L*gtu12 + + cdphi3*(-2 + 4*gt23L*gtu23)) + gt23L*(4*cdphi1*cdphi3*gtu13 + + cdphi222*gtu22 + gtu11*(cdphi211 + 2*SQR(cdphi1)) + 2*(cdphi212*gtu12 + + cdphi213*gtu13 + cdphi223*gtu23 + gtu22*SQR(cdphi2)) + gtu33*(cdphi233 + + 2*SQR(cdphi3)))); + + CCTK_REAL Rphi33 = -2*(cdphi233 + gt33L*((4*cdphi1*cdphi2 + + 2*cdphi212)*gtu12 + 4*cdphi3*(cdphi1*gtu13 + cdphi2*gtu23) + + 2*(cdphi213*gtu13 + cdphi223*gtu23) + cdphi233*gtu33 + gtu11*(cdphi211 + + 2*SQR(cdphi1)) + gtu22*(cdphi222 + 2*SQR(cdphi2))) + 2*(-1 + + gt33L*gtu33)*SQR(cdphi3)); + + CCTK_REAL e4phi = + IfThen(ToReal(conformalMethod),INV(SQR(phiL)),exp(4*phiL)); + + CCTK_REAL em4phi = INV(e4phi); + + CCTK_REAL gu11 = em4phi*gtu11; + + CCTK_REAL gu12 = em4phi*gtu12; + + CCTK_REAL gu13 = em4phi*gtu13; + + CCTK_REAL gu22 = em4phi*gtu22; + + CCTK_REAL gu23 = em4phi*gtu23; + + CCTK_REAL gu33 = em4phi*gtu33; + + CCTK_REAL R11 = Rphi11 + Rt11; + + CCTK_REAL R12 = Rphi12 + Rt12; + + CCTK_REAL R13 = Rphi13 + Rt13; + + CCTK_REAL R22 = Rphi22 + Rt22; + + CCTK_REAL R23 = Rphi23 + Rt23; + + CCTK_REAL R33 = Rphi33 + Rt33; + + CCTK_REAL trR = gu11*R11 + gu22*R22 + 2*(gu12*R12 + gu13*R13 + + gu23*R23) + gu33*R33; + + CCTK_REAL Atm11 = At11L*gtu11 + At12L*gtu12 + At13L*gtu13; + + CCTK_REAL Atm21 = At11L*gtu12 + At12L*gtu22 + At13L*gtu23; + + CCTK_REAL Atm31 = At11L*gtu13 + At12L*gtu23 + At13L*gtu33; + + CCTK_REAL Atm12 = At12L*gtu11 + At22L*gtu12 + At23L*gtu13; + + CCTK_REAL Atm22 = At12L*gtu12 + At22L*gtu22 + At23L*gtu23; + + CCTK_REAL Atm32 = At12L*gtu13 + At22L*gtu23 + At23L*gtu33; + + CCTK_REAL Atm13 = At13L*gtu11 + At23L*gtu12 + At33L*gtu13; + + CCTK_REAL Atm23 = At13L*gtu12 + At23L*gtu22 + At33L*gtu23; + + CCTK_REAL Atm33 = At13L*gtu13 + At23L*gtu23 + At33L*gtu33; + + CCTK_REAL rho = INV(SQR(alphaL))*(eTttL - 2*(beta2L*eTtyL + + beta3L*eTtzL) + 2*(beta1L*(-eTtxL + beta2L*eTxyL + beta3L*eTxzL) + + beta2L*beta3L*eTyzL) + eTxxL*SQR(beta1L) + eTyyL*SQR(beta2L) + + eTzzL*SQR(beta3L)); + + CCTK_REAL HL = -2.*(Atm12*Atm21 + Atm13*Atm31 + Atm23*Atm32) - + 50.26548245743669181540229413247204614715*rho + trR - 1.*(SQR(Atm11) + + SQR(Atm22) + SQR(Atm33)) + + 0.6666666666666666666666666666666666666667*SQR(trKL); + + + /* Copy local copies back to grid functions */ + H[index] = HL; + } + LC_ENDLOOP3 (ML_BSSN_MP_O8_constraints1); +} + +extern "C" void ML_BSSN_MP_O8_constraints1(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverInterior(cctkGH, &ML_BSSN_MP_O8_constraints1_Body); +} diff --git a/ML_BSSN_MP_O8/src/ML_BSSN_MP_O8_constraints2.cc b/ML_BSSN_MP_O8/src/ML_BSSN_MP_O8_constraints2.cc new file mode 100644 index 0000000..9ae1f8f --- /dev/null +++ b/ML_BSSN_MP_O8/src/ML_BSSN_MP_O8_constraints2.cc @@ -0,0 +1,476 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +extern "C" void ML_BSSN_MP_O8_constraints2_SelectBCs(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT ierr = 0; + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_MP_O8::ML_cons_detg","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_MP_O8::ML_cons_detg."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_MP_O8::ML_cons_Gamma","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_MP_O8::ML_cons_Gamma."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_MP_O8::ML_cons_traceA","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_MP_O8::ML_cons_traceA."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_MP_O8::ML_mom","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_MP_O8::ML_mom."); + return; +} + +static void ML_BSSN_MP_O8_constraints2_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_BSSN_MP_O8_constraints2_Body"); + } + + if (cctk_iteration % ML_BSSN_MP_O8_constraints2_calc_every != ML_BSSN_MP_O8_constraints2_calc_offset) + { + return; + } + + const char *groups[] = {"Coordinates::jacobian","ML_BSSN_MP_O8::ML_cons_detg","ML_BSSN_MP_O8::ML_cons_Gamma","ML_BSSN_MP_O8::ML_cons_traceA","ML_BSSN_MP_O8::ML_curv","ML_BSSN_MP_O8::ML_Gamma","ML_BSSN_MP_O8::ML_lapse","ML_BSSN_MP_O8::ML_log_confac","ML_BSSN_MP_O8::ML_metric","ML_BSSN_MP_O8::ML_mom","ML_BSSN_MP_O8::ML_shift","ML_BSSN_MP_O8::ML_trace_curv"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_BSSN_MP_O8_constraints2", 12, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o1024dx = 0.0009765625*INV(dx); + CCTK_REAL const p1o1024dy = 0.0009765625*INV(dy); + CCTK_REAL const p1o1024dz = 0.0009765625*INV(dz); + CCTK_REAL const p1o1680dx = 0.000595238095238095238095238095238*INV(dx); + CCTK_REAL const p1o1680dy = 0.000595238095238095238095238095238*INV(dy); + CCTK_REAL const p1o1680dz = 0.000595238095238095238095238095238*INV(dz); + CCTK_REAL const p1o5040dx2 = 0.000198412698412698412698412698413*INV(SQR(dx)); + CCTK_REAL const p1o5040dy2 = 0.000198412698412698412698412698413*INV(SQR(dy)); + CCTK_REAL const p1o5040dz2 = 0.000198412698412698412698412698413*INV(SQR(dz)); + CCTK_REAL const p1o560dx = 0.00178571428571428571428571428571*INV(dx); + CCTK_REAL const p1o560dy = 0.00178571428571428571428571428571*INV(dy); + CCTK_REAL const p1o560dz = 0.00178571428571428571428571428571*INV(dz); + CCTK_REAL const p1o705600dxdy = 1.41723356009070294784580498866e-6*INV(dx)*INV(dy); + CCTK_REAL const p1o705600dxdz = 1.41723356009070294784580498866e-6*INV(dx)*INV(dz); + CCTK_REAL const p1o705600dydz = 1.41723356009070294784580498866e-6*INV(dy)*INV(dz); + CCTK_REAL const p1o840dx = 0.00119047619047619047619047619048*INV(dx); + CCTK_REAL const p1o840dy = 0.00119047619047619047619047619048*INV(dy); + CCTK_REAL const p1o840dz = 0.00119047619047619047619047619048*INV(dz); + CCTK_REAL const p1odx = INV(dx); + CCTK_REAL const p1ody = INV(dy); + CCTK_REAL const p1odz = INV(dz); + CCTK_REAL const pm1o840dx = -0.00119047619047619047619047619048*INV(dx); + CCTK_REAL const pm1o840dy = -0.00119047619047619047619047619048*INV(dy); + CCTK_REAL const pm1o840dz = -0.00119047619047619047619047619048*INV(dz); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_BSSN_MP_O8_constraints2, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + CCTK_REAL alphaL = alpha[index]; + CCTK_REAL At11L = At11[index]; + CCTK_REAL At12L = At12[index]; + CCTK_REAL At13L = At13[index]; + CCTK_REAL At22L = At22[index]; + CCTK_REAL At23L = At23[index]; + CCTK_REAL At33L = At33[index]; + CCTK_REAL beta1L = beta1[index]; + CCTK_REAL beta2L = beta2[index]; + CCTK_REAL beta3L = beta3[index]; + CCTK_REAL eTtxL = (*stress_energy_state) ? eTtx[index] : ToReal(0.0); + CCTK_REAL eTtyL = (*stress_energy_state) ? eTty[index] : ToReal(0.0); + CCTK_REAL eTtzL = (*stress_energy_state) ? eTtz[index] : ToReal(0.0); + CCTK_REAL eTxxL = (*stress_energy_state) ? eTxx[index] : ToReal(0.0); + CCTK_REAL eTxyL = (*stress_energy_state) ? eTxy[index] : ToReal(0.0); + CCTK_REAL eTxzL = (*stress_energy_state) ? eTxz[index] : ToReal(0.0); + CCTK_REAL eTyyL = (*stress_energy_state) ? eTyy[index] : ToReal(0.0); + CCTK_REAL eTyzL = (*stress_energy_state) ? eTyz[index] : ToReal(0.0); + CCTK_REAL eTzzL = (*stress_energy_state) ? eTzz[index] : ToReal(0.0); + CCTK_REAL gt11L = gt11[index]; + CCTK_REAL gt12L = gt12[index]; + CCTK_REAL gt13L = gt13[index]; + CCTK_REAL gt22L = gt22[index]; + CCTK_REAL gt23L = gt23[index]; + CCTK_REAL gt33L = gt33[index]; + CCTK_REAL J11L = J11[index]; + CCTK_REAL J12L = J12[index]; + CCTK_REAL J13L = J13[index]; + CCTK_REAL J21L = J21[index]; + CCTK_REAL J22L = J22[index]; + CCTK_REAL J23L = J23[index]; + CCTK_REAL J31L = J31[index]; + CCTK_REAL J32L = J32[index]; + CCTK_REAL J33L = J33[index]; + CCTK_REAL phiL = phi[index]; + CCTK_REAL trKL = trK[index]; + CCTK_REAL Xt1L = Xt1[index]; + CCTK_REAL Xt2L = Xt2[index]; + CCTK_REAL Xt3L = Xt3[index]; + + /* Include user supplied include files */ + + /* Precompute derivatives */ + CCTK_REAL const PDstandardNth1At11 = PDstandardNth1(&At11[index]); + CCTK_REAL const PDstandardNth2At11 = PDstandardNth2(&At11[index]); + CCTK_REAL const PDstandardNth3At11 = PDstandardNth3(&At11[index]); + CCTK_REAL const PDstandardNth1At12 = PDstandardNth1(&At12[index]); + CCTK_REAL const PDstandardNth2At12 = PDstandardNth2(&At12[index]); + CCTK_REAL const PDstandardNth3At12 = PDstandardNth3(&At12[index]); + CCTK_REAL const PDstandardNth1At13 = PDstandardNth1(&At13[index]); + CCTK_REAL const PDstandardNth2At13 = PDstandardNth2(&At13[index]); + CCTK_REAL const PDstandardNth3At13 = PDstandardNth3(&At13[index]); + CCTK_REAL const PDstandardNth1At22 = PDstandardNth1(&At22[index]); + CCTK_REAL const PDstandardNth2At22 = PDstandardNth2(&At22[index]); + CCTK_REAL const PDstandardNth3At22 = PDstandardNth3(&At22[index]); + CCTK_REAL const PDstandardNth1At23 = PDstandardNth1(&At23[index]); + CCTK_REAL const PDstandardNth2At23 = PDstandardNth2(&At23[index]); + CCTK_REAL const PDstandardNth3At23 = PDstandardNth3(&At23[index]); + CCTK_REAL const PDstandardNth1At33 = PDstandardNth1(&At33[index]); + CCTK_REAL const PDstandardNth2At33 = PDstandardNth2(&At33[index]); + CCTK_REAL const PDstandardNth3At33 = PDstandardNth3(&At33[index]); + CCTK_REAL const PDstandardNth1gt11 = PDstandardNth1(>11[index]); + CCTK_REAL const PDstandardNth2gt11 = PDstandardNth2(>11[index]); + CCTK_REAL const PDstandardNth3gt11 = PDstandardNth3(>11[index]); + CCTK_REAL const PDstandardNth1gt12 = PDstandardNth1(>12[index]); + CCTK_REAL const PDstandardNth2gt12 = PDstandardNth2(>12[index]); + CCTK_REAL const PDstandardNth3gt12 = PDstandardNth3(>12[index]); + CCTK_REAL const PDstandardNth1gt13 = PDstandardNth1(>13[index]); + CCTK_REAL const PDstandardNth2gt13 = PDstandardNth2(>13[index]); + CCTK_REAL const PDstandardNth3gt13 = PDstandardNth3(>13[index]); + CCTK_REAL const PDstandardNth1gt22 = PDstandardNth1(>22[index]); + CCTK_REAL const PDstandardNth2gt22 = PDstandardNth2(>22[index]); + CCTK_REAL const PDstandardNth3gt22 = PDstandardNth3(>22[index]); + CCTK_REAL const PDstandardNth1gt23 = PDstandardNth1(>23[index]); + CCTK_REAL const PDstandardNth2gt23 = PDstandardNth2(>23[index]); + CCTK_REAL const PDstandardNth3gt23 = PDstandardNth3(>23[index]); + CCTK_REAL const PDstandardNth1gt33 = PDstandardNth1(>33[index]); + CCTK_REAL const PDstandardNth2gt33 = PDstandardNth2(>33[index]); + CCTK_REAL const PDstandardNth3gt33 = PDstandardNth3(>33[index]); + CCTK_REAL const PDstandardNth1phi = PDstandardNth1(&phi[index]); + CCTK_REAL const PDstandardNth2phi = PDstandardNth2(&phi[index]); + CCTK_REAL const PDstandardNth3phi = PDstandardNth3(&phi[index]); + CCTK_REAL const PDstandardNth1trK = PDstandardNth1(&trK[index]); + CCTK_REAL const PDstandardNth2trK = PDstandardNth2(&trK[index]); + CCTK_REAL const PDstandardNth3trK = PDstandardNth3(&trK[index]); + + /* Calculate temporaries and grid functions */ + CCTK_REAL detgt = 1; + + CCTK_REAL gtu11 = INV(detgt)*(gt22L*gt33L - SQR(gt23L)); + + CCTK_REAL gtu12 = (gt13L*gt23L - gt12L*gt33L)*INV(detgt); + + CCTK_REAL gtu13 = (-(gt13L*gt22L) + gt12L*gt23L)*INV(detgt); + + CCTK_REAL gtu22 = INV(detgt)*(gt11L*gt33L - SQR(gt13L)); + + CCTK_REAL gtu23 = (gt12L*gt13L - gt11L*gt23L)*INV(detgt); + + CCTK_REAL gtu33 = INV(detgt)*(gt11L*gt22L - SQR(gt12L)); + + CCTK_REAL Gtl111 = 0.5*(J11L*PDstandardNth1gt11 + + J21L*PDstandardNth2gt11 + J31L*PDstandardNth3gt11); + + CCTK_REAL Gtl112 = 0.5*(J12L*PDstandardNth1gt11 + + J22L*PDstandardNth2gt11 + J32L*PDstandardNth3gt11); + + CCTK_REAL Gtl113 = 0.5*(J13L*PDstandardNth1gt11 + + J23L*PDstandardNth2gt11 + J33L*PDstandardNth3gt11); + + CCTK_REAL Gtl122 = J12L*PDstandardNth1gt12 + J22L*PDstandardNth2gt12 + + J32L*PDstandardNth3gt12 - 0.5*(J11L*PDstandardNth1gt22 + + J21L*PDstandardNth2gt22 + J31L*PDstandardNth3gt22); + + CCTK_REAL Gtl123 = 0.5*(J13L*PDstandardNth1gt12 + + J12L*PDstandardNth1gt13 - J11L*PDstandardNth1gt23 + + J23L*PDstandardNth2gt12 + J22L*PDstandardNth2gt13 - + J21L*PDstandardNth2gt23 + J33L*PDstandardNth3gt12 + + J32L*PDstandardNth3gt13 - J31L*PDstandardNth3gt23); + + CCTK_REAL Gtl133 = J13L*PDstandardNth1gt13 + J23L*PDstandardNth2gt13 + + J33L*PDstandardNth3gt13 - 0.5*(J11L*PDstandardNth1gt33 + + J21L*PDstandardNth2gt33 + J31L*PDstandardNth3gt33); + + CCTK_REAL Gtl211 = J11L*PDstandardNth1gt12 + J21L*PDstandardNth2gt12 - + 0.5*(J12L*PDstandardNth1gt11 + J22L*PDstandardNth2gt11 + + J32L*PDstandardNth3gt11) + J31L*PDstandardNth3gt12; + + CCTK_REAL Gtl212 = 0.5*(J11L*PDstandardNth1gt22 + + J21L*PDstandardNth2gt22 + J31L*PDstandardNth3gt22); + + CCTK_REAL Gtl213 = 0.5*(J13L*PDstandardNth1gt12 - + J12L*PDstandardNth1gt13 + J11L*PDstandardNth1gt23 + + J23L*PDstandardNth2gt12 - J22L*PDstandardNth2gt13 + + J21L*PDstandardNth2gt23 + J33L*PDstandardNth3gt12 - + J32L*PDstandardNth3gt13 + J31L*PDstandardNth3gt23); + + CCTK_REAL Gtl222 = 0.5*(J12L*PDstandardNth1gt22 + + J22L*PDstandardNth2gt22 + J32L*PDstandardNth3gt22); + + CCTK_REAL Gtl223 = 0.5*(J13L*PDstandardNth1gt22 + + J23L*PDstandardNth2gt22 + J33L*PDstandardNth3gt22); + + CCTK_REAL Gtl233 = J13L*PDstandardNth1gt23 + J23L*PDstandardNth2gt23 + + J33L*PDstandardNth3gt23 - 0.5*(J12L*PDstandardNth1gt33 + + J22L*PDstandardNth2gt33 + J32L*PDstandardNth3gt33); + + CCTK_REAL Gtl311 = J11L*PDstandardNth1gt13 + J21L*PDstandardNth2gt13 - + 0.5*(J13L*PDstandardNth1gt11 + J23L*PDstandardNth2gt11 + + J33L*PDstandardNth3gt11) + J31L*PDstandardNth3gt13; + + CCTK_REAL Gtl312 = 0.5*(-(J13L*PDstandardNth1gt12) + + J12L*PDstandardNth1gt13 + J11L*PDstandardNth1gt23 - + J23L*PDstandardNth2gt12 + J22L*PDstandardNth2gt13 + + J21L*PDstandardNth2gt23 - J33L*PDstandardNth3gt12 + + J32L*PDstandardNth3gt13 + J31L*PDstandardNth3gt23); + + CCTK_REAL Gtl313 = 0.5*(J11L*PDstandardNth1gt33 + + J21L*PDstandardNth2gt33 + J31L*PDstandardNth3gt33); + + CCTK_REAL Gtl322 = J12L*PDstandardNth1gt23 + J22L*PDstandardNth2gt23 - + 0.5*(J13L*PDstandardNth1gt22 + J23L*PDstandardNth2gt22 + + J33L*PDstandardNth3gt22) + J32L*PDstandardNth3gt23; + + CCTK_REAL Gtl323 = 0.5*(J12L*PDstandardNth1gt33 + + J22L*PDstandardNth2gt33 + J32L*PDstandardNth3gt33); + + CCTK_REAL Gtl333 = 0.5*(J13L*PDstandardNth1gt33 + + J23L*PDstandardNth2gt33 + J33L*PDstandardNth3gt33); + + CCTK_REAL Gt111 = Gtl111*gtu11 + Gtl211*gtu12 + Gtl311*gtu13; + + CCTK_REAL Gt211 = Gtl111*gtu12 + Gtl211*gtu22 + Gtl311*gtu23; + + CCTK_REAL Gt311 = Gtl111*gtu13 + Gtl211*gtu23 + Gtl311*gtu33; + + CCTK_REAL Gt112 = Gtl112*gtu11 + Gtl212*gtu12 + Gtl312*gtu13; + + CCTK_REAL Gt212 = Gtl112*gtu12 + Gtl212*gtu22 + Gtl312*gtu23; + + CCTK_REAL Gt312 = Gtl112*gtu13 + Gtl212*gtu23 + Gtl312*gtu33; + + CCTK_REAL Gt113 = Gtl113*gtu11 + Gtl213*gtu12 + Gtl313*gtu13; + + CCTK_REAL Gt213 = Gtl113*gtu12 + Gtl213*gtu22 + Gtl313*gtu23; + + CCTK_REAL Gt313 = Gtl113*gtu13 + Gtl213*gtu23 + Gtl313*gtu33; + + CCTK_REAL Gt122 = Gtl122*gtu11 + Gtl222*gtu12 + Gtl322*gtu13; + + CCTK_REAL Gt222 = Gtl122*gtu12 + Gtl222*gtu22 + Gtl322*gtu23; + + CCTK_REAL Gt322 = Gtl122*gtu13 + Gtl222*gtu23 + Gtl322*gtu33; + + CCTK_REAL Gt123 = Gtl123*gtu11 + Gtl223*gtu12 + Gtl323*gtu13; + + CCTK_REAL Gt223 = Gtl123*gtu12 + Gtl223*gtu22 + Gtl323*gtu23; + + CCTK_REAL Gt323 = Gtl123*gtu13 + Gtl223*gtu23 + Gtl323*gtu33; + + CCTK_REAL Gt133 = Gtl133*gtu11 + Gtl233*gtu12 + Gtl333*gtu13; + + CCTK_REAL Gt233 = Gtl133*gtu12 + Gtl233*gtu22 + Gtl333*gtu23; + + CCTK_REAL Gt333 = Gtl133*gtu13 + Gtl233*gtu23 + Gtl333*gtu33; + + CCTK_REAL fac1 = IfThen(ToReal(conformalMethod),-0.5*INV(phiL),1); + + CCTK_REAL cdphi1 = fac1*(J11L*PDstandardNth1phi + + J21L*PDstandardNth2phi + J31L*PDstandardNth3phi); + + CCTK_REAL cdphi2 = fac1*(J12L*PDstandardNth1phi + + J22L*PDstandardNth2phi + J32L*PDstandardNth3phi); + + CCTK_REAL cdphi3 = fac1*(J13L*PDstandardNth1phi + + J23L*PDstandardNth2phi + J33L*PDstandardNth3phi); + + CCTK_REAL S1 = (-eTtxL + beta1L*eTxxL + beta2L*eTxyL + + beta3L*eTxzL)*INV(alphaL); + + CCTK_REAL S2 = (-eTtyL + beta1L*eTxyL + beta2L*eTyyL + + beta3L*eTyzL)*INV(alphaL); + + CCTK_REAL S3 = (-eTtzL + beta1L*eTxzL + beta2L*eTyzL + + beta3L*eTzzL)*INV(alphaL); + + CCTK_REAL M1L = (-(At22L*Gt212) + At12L*(-Gt112 - Gt222) - + At23L*Gt312)*gtu22 + (6*At13L*cdphi2 - At23L*Gt212 - At33L*Gt312)*gtu23 + + (6*At12L*cdphi3 - At22L*Gt213 - At23L*Gt313)*gtu23 + At12L*((6*cdphi1 + - Gt111)*gtu12 - 3*Gt213*gtu13 + 6*cdphi2*gtu22 - Gt113*gtu23) - + 2*(At12L*Gt211*gtu11 + At13L*Gt311*gtu11 + At11L*Gt123*gtu23) + + (6*At13L*cdphi3 - At23L*Gt213 - At33L*Gt313)*gtu33 + + At13L*(-2*Gt323*gtu23 - Gt113*gtu33) + At11L*(6*cdphi1*gtu11 - + 2*Gt111*gtu11 + 6*cdphi2*gtu12 + 6*cdphi3*gtu13 - Gt122*gtu22 - + Gt133*gtu33) + At12L*(-2*Gt223*gtu23 - Gt233*gtu33) + At13L*((6*cdphi1 + - Gt111)*gtu13 - Gt322*gtu22 - Gt112*gtu23 - Gt333*gtu33) + (gtu11*J11L + + gtu12*J12L + gtu13*J13L)*PDstandardNth1At11 + + gtu22*J12L*PDstandardNth1At12 + gtu23*J13L*PDstandardNth1At12 + + gtu12*(-3*At11L*Gt112 - At22L*Gt211 - 3*At12L*Gt212 - At23L*Gt311 - + 3*At13L*Gt312 + J11L*PDstandardNth1At12) + + gtu23*J12L*PDstandardNth1At13 + gtu33*J13L*PDstandardNth1At13 + + gtu13*(-3*At11L*Gt113 - At23L*Gt211 - At33L*Gt311 - 3*At13L*Gt313 + + J11L*PDstandardNth1At13) - + 0.666666666666666666666666666667*J11L*PDstandardNth1trK + (gtu11*J21L + + gtu12*J22L + gtu13*J23L)*PDstandardNth2At11 + + gtu12*J21L*PDstandardNth2At12 + gtu22*J22L*PDstandardNth2At12 + + gtu23*J23L*PDstandardNth2At12 + gtu13*J21L*PDstandardNth2At13 + + gtu23*J22L*PDstandardNth2At13 + gtu33*J23L*PDstandardNth2At13 - + 0.666666666666666666666666666667*J21L*PDstandardNth2trK + + gtu11*J31L*PDstandardNth3At11 + gtu12*J32L*PDstandardNth3At11 + + gtu13*J33L*PDstandardNth3At11 + gtu12*J31L*PDstandardNth3At12 + + gtu22*J32L*PDstandardNth3At12 + gtu23*J33L*PDstandardNth3At12 + + gtu13*J31L*PDstandardNth3At13 + gtu23*J32L*PDstandardNth3At13 + + gtu33*J33L*PDstandardNth3At13 - + 0.666666666666666666666666666667*J31L*PDstandardNth3trK - + 25.13274122871834590770114706623602307358*S1; + + CCTK_REAL M2L = (-(At11L*Gt112) - At22L*Gt211 - At12L*Gt212 - + At23L*Gt311 - At13L*Gt312)*gtu11 + (6*At22L*cdphi1 - At11L*Gt122)*gtu12 + + (6*At12L*cdphi2 - At13L*Gt322)*gtu12 + (6*At23L*cdphi1 - + At11L*Gt123)*gtu13 + (6*At12L*cdphi3 - At13L*Gt323)*gtu13 + + Gt112*(-3*At12L*gtu12 - At13L*gtu13) + Gt212*(-3*At22L*gtu12 - + At23L*gtu13) + Gt312*(-3*At23L*gtu12 - At33L*gtu13) + At12L*((6*cdphi1 + - Gt111)*gtu11 - Gt222*gtu12 - Gt223*gtu13) + 6*At22L*cdphi2*gtu22 - + 2*At22L*Gt222*gtu22 + 6*At22L*cdphi3*gtu23 - 3*At22L*Gt223*gtu23 + + Gt122*(-2*At12L*gtu22 - At13L*gtu23) + Gt322*(-2*At23L*gtu22 - + At33L*gtu23) + 6*At23L*cdphi3*gtu33 + Gt123*(-3*At12L*gtu23 - + At13L*gtu33) + Gt323*(-3*At23L*gtu23 - At33L*gtu33) + + At12L*(-2*Gt113*gtu13 - Gt133*gtu33) + At23L*(6*cdphi2*gtu23 - + Gt223*gtu33) + At22L*(-2*Gt213*gtu13 - Gt233*gtu33) + + At23L*(-2*Gt313*gtu13 - Gt222*gtu23 - Gt333*gtu33) + (gtu11*J11L + + gtu12*J12L + gtu13*J13L)*PDstandardNth1At12 + + gtu12*J11L*PDstandardNth1At22 + gtu22*J12L*PDstandardNth1At22 + + gtu23*J13L*PDstandardNth1At22 + gtu13*J11L*PDstandardNth1At23 + + gtu23*J12L*PDstandardNth1At23 + gtu33*J13L*PDstandardNth1At23 - + 0.666666666666666666666666666667*J12L*PDstandardNth1trK + (gtu11*J21L + + gtu12*J22L + gtu13*J23L)*PDstandardNth2At12 + + gtu12*J21L*PDstandardNth2At22 + gtu22*J22L*PDstandardNth2At22 + + gtu23*J23L*PDstandardNth2At22 + gtu13*J21L*PDstandardNth2At23 + + gtu23*J22L*PDstandardNth2At23 + gtu33*J23L*PDstandardNth2At23 - + 0.666666666666666666666666666667*J22L*PDstandardNth2trK + + gtu11*J31L*PDstandardNth3At12 + gtu12*J32L*PDstandardNth3At12 + + gtu13*J33L*PDstandardNth3At12 + gtu12*J31L*PDstandardNth3At22 + + gtu22*J32L*PDstandardNth3At22 + gtu23*J33L*PDstandardNth3At22 + + gtu13*J31L*PDstandardNth3At23 + gtu23*J32L*PDstandardNth3At23 + + gtu33*J33L*PDstandardNth3At23 - + 0.666666666666666666666666666667*J32L*PDstandardNth3trK - + 25.13274122871834590770114706623602307358*S2; + + CCTK_REAL M3L = (-(At11L*Gt113) - At23L*Gt211 - At12L*Gt213 - + At33L*Gt311 - At13L*Gt313)*gtu11 + (-2*At13L*Gt112 - At22L*Gt213)*gtu12 + + (6*At23L*cdphi1 + At12L*(-Gt113 - Gt223))*gtu12 + (6*At13L*cdphi2 - + At11L*Gt123 - At23L*Gt313)*gtu12 + (6*At33L*cdphi1 - At11L*Gt133)*gtu13 + + (6*At13L*cdphi3 - At12L*Gt233)*gtu13 - 3*At33L*Gt313*gtu13 + + At13L*((6*cdphi1 - Gt111)*gtu11 - Gt323*gtu12 - Gt333*gtu13) + + (6*At23L*cdphi2 - At12L*Gt123 - At22L*Gt223)*gtu22 + + At13L*(-3*Gt113*gtu13 - Gt122*gtu22) + At33L*(-2*Gt312*gtu12 - + Gt322*gtu22) + At23L*(-3*Gt213*gtu13 - Gt323*gtu22) - + 3*At13L*Gt123*gtu23 + (6*At33L*cdphi2 - At12L*Gt133)*gtu23 - + 3*At23L*Gt223*gtu23 + (6*At23L*cdphi3 - At22L*Gt233)*gtu23 - + 3*At33L*Gt323*gtu23 + At23L*(-2*Gt212*gtu12 - Gt222*gtu22 - + Gt333*gtu23) + 6*At33L*cdphi3*gtu33 - 2*At13L*Gt133*gtu33 - + 2*At23L*Gt233*gtu33 - 2*At33L*Gt333*gtu33 + (gtu11*J11L + gtu12*J12L + + gtu13*J13L)*PDstandardNth1At13 + gtu12*J11L*PDstandardNth1At23 + + gtu22*J12L*PDstandardNth1At23 + gtu23*J13L*PDstandardNth1At23 + + gtu13*J11L*PDstandardNth1At33 + gtu23*J12L*PDstandardNth1At33 + + gtu33*J13L*PDstandardNth1At33 - + 0.666666666666666666666666666667*J13L*PDstandardNth1trK + (gtu11*J21L + + gtu12*J22L + gtu13*J23L)*PDstandardNth2At13 + + gtu12*J21L*PDstandardNth2At23 + gtu22*J22L*PDstandardNth2At23 + + gtu23*J23L*PDstandardNth2At23 + gtu13*J21L*PDstandardNth2At33 + + gtu23*J22L*PDstandardNth2At33 + gtu33*J23L*PDstandardNth2At33 - + 0.666666666666666666666666666667*J23L*PDstandardNth2trK + + gtu11*J31L*PDstandardNth3At13 + gtu12*J32L*PDstandardNth3At13 + + gtu13*J33L*PDstandardNth3At13 + gtu12*J31L*PDstandardNth3At23 + + gtu22*J32L*PDstandardNth3At23 + gtu23*J33L*PDstandardNth3At23 + + gtu13*J31L*PDstandardNth3At33 + gtu23*J32L*PDstandardNth3At33 + + gtu33*J33L*PDstandardNth3At33 - + 0.666666666666666666666666666667*J33L*PDstandardNth3trK - + 25.13274122871834590770114706623602307358*S3; + + CCTK_REAL cSL = Log(detgt); + + CCTK_REAL cXt1L = Gt111*gtu11 + Gt122*gtu22 + 2*(Gt112*gtu12 + + Gt113*gtu13 + Gt123*gtu23) + Gt133*gtu33 - Xt1L; + + CCTK_REAL cXt2L = Gt211*gtu11 + Gt222*gtu22 + 2*(Gt212*gtu12 + + Gt213*gtu13 + Gt223*gtu23) + Gt233*gtu33 - Xt2L; + + CCTK_REAL cXt3L = Gt311*gtu11 + Gt322*gtu22 + 2*(Gt312*gtu12 + + Gt313*gtu13 + Gt323*gtu23) + Gt333*gtu33 - Xt3L; + + CCTK_REAL cAL = At11L*gtu11 + At22L*gtu22 + 2*(At12L*gtu12 + + At13L*gtu13 + At23L*gtu23) + At33L*gtu33; + + + /* Copy local copies back to grid functions */ + cA[index] = cAL; + cS[index] = cSL; + cXt1[index] = cXt1L; + cXt2[index] = cXt2L; + cXt3[index] = cXt3L; + M1[index] = M1L; + M2[index] = M2L; + M3[index] = M3L; + } + LC_ENDLOOP3 (ML_BSSN_MP_O8_constraints2); +} + +extern "C" void ML_BSSN_MP_O8_constraints2(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverInterior(cctkGH, &ML_BSSN_MP_O8_constraints2_Body); +} diff --git a/ML_BSSN_MP_O8/src/ML_BSSN_MP_O8_convertFromADMBase.cc b/ML_BSSN_MP_O8/src/ML_BSSN_MP_O8_convertFromADMBase.cc new file mode 100644 index 0000000..2a08d64 --- /dev/null +++ b/ML_BSSN_MP_O8/src/ML_BSSN_MP_O8_convertFromADMBase.cc @@ -0,0 +1,228 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +static void ML_BSSN_MP_O8_convertFromADMBase_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_BSSN_MP_O8_convertFromADMBase_Body"); + } + + if (cctk_iteration % ML_BSSN_MP_O8_convertFromADMBase_calc_every != ML_BSSN_MP_O8_convertFromADMBase_calc_offset) + { + return; + } + + const char *groups[] = {"ADMBase::curv","ADMBase::lapse","ADMBase::metric","ADMBase::shift","ML_BSSN_MP_O8::ML_curv","ML_BSSN_MP_O8::ML_lapse","ML_BSSN_MP_O8::ML_log_confac","ML_BSSN_MP_O8::ML_metric","ML_BSSN_MP_O8::ML_shift","ML_BSSN_MP_O8::ML_trace_curv"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_BSSN_MP_O8_convertFromADMBase", 10, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o1024dx = 0.0009765625*INV(dx); + CCTK_REAL const p1o1024dy = 0.0009765625*INV(dy); + CCTK_REAL const p1o1024dz = 0.0009765625*INV(dz); + CCTK_REAL const p1o1680dx = 0.000595238095238095238095238095238*INV(dx); + CCTK_REAL const p1o1680dy = 0.000595238095238095238095238095238*INV(dy); + CCTK_REAL const p1o1680dz = 0.000595238095238095238095238095238*INV(dz); + CCTK_REAL const p1o5040dx2 = 0.000198412698412698412698412698413*INV(SQR(dx)); + CCTK_REAL const p1o5040dy2 = 0.000198412698412698412698412698413*INV(SQR(dy)); + CCTK_REAL const p1o5040dz2 = 0.000198412698412698412698412698413*INV(SQR(dz)); + CCTK_REAL const p1o560dx = 0.00178571428571428571428571428571*INV(dx); + CCTK_REAL const p1o560dy = 0.00178571428571428571428571428571*INV(dy); + CCTK_REAL const p1o560dz = 0.00178571428571428571428571428571*INV(dz); + CCTK_REAL const p1o705600dxdy = 1.41723356009070294784580498866e-6*INV(dx)*INV(dy); + CCTK_REAL const p1o705600dxdz = 1.41723356009070294784580498866e-6*INV(dx)*INV(dz); + CCTK_REAL const p1o705600dydz = 1.41723356009070294784580498866e-6*INV(dy)*INV(dz); + CCTK_REAL const p1o840dx = 0.00119047619047619047619047619048*INV(dx); + CCTK_REAL const p1o840dy = 0.00119047619047619047619047619048*INV(dy); + CCTK_REAL const p1o840dz = 0.00119047619047619047619047619048*INV(dz); + CCTK_REAL const p1odx = INV(dx); + CCTK_REAL const p1ody = INV(dy); + CCTK_REAL const p1odz = INV(dz); + CCTK_REAL const pm1o840dx = -0.00119047619047619047619047619048*INV(dx); + CCTK_REAL const pm1o840dy = -0.00119047619047619047619047619048*INV(dy); + CCTK_REAL const pm1o840dz = -0.00119047619047619047619047619048*INV(dz); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_BSSN_MP_O8_convertFromADMBase, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + CCTK_REAL alpL = alp[index]; + CCTK_REAL betaxL = betax[index]; + CCTK_REAL betayL = betay[index]; + CCTK_REAL betazL = betaz[index]; + CCTK_REAL gxxL = gxx[index]; + CCTK_REAL gxyL = gxy[index]; + CCTK_REAL gxzL = gxz[index]; + CCTK_REAL gyyL = gyy[index]; + CCTK_REAL gyzL = gyz[index]; + CCTK_REAL gzzL = gzz[index]; + CCTK_REAL kxxL = kxx[index]; + CCTK_REAL kxyL = kxy[index]; + CCTK_REAL kxzL = kxz[index]; + CCTK_REAL kyyL = kyy[index]; + CCTK_REAL kyzL = kyz[index]; + CCTK_REAL kzzL = kzz[index]; + CCTK_REAL phiL = phi[index]; + CCTK_REAL trKL = trK[index]; + + /* Include user supplied include files */ + + /* Precompute derivatives */ + + /* Calculate temporaries and grid functions */ + CCTK_REAL g11 = gxxL; + + CCTK_REAL g12 = gxyL; + + CCTK_REAL g13 = gxzL; + + CCTK_REAL g22 = gyyL; + + CCTK_REAL g23 = gyzL; + + CCTK_REAL g33 = gzzL; + + CCTK_REAL detg = 2*g12*g13*g23 + g33*(g11*g22 - SQR(g12)) - + g22*SQR(g13) - g11*SQR(g23); + + CCTK_REAL gu11 = INV(detg)*(g22*g33 - SQR(g23)); + + CCTK_REAL gu12 = (g13*g23 - g12*g33)*INV(detg); + + CCTK_REAL gu13 = (-(g13*g22) + g12*g23)*INV(detg); + + CCTK_REAL gu22 = INV(detg)*(g11*g33 - SQR(g13)); + + CCTK_REAL gu23 = (g12*g13 - g11*g23)*INV(detg); + + CCTK_REAL gu33 = INV(detg)*(g11*g22 - SQR(g12)); + + phiL = + IfThen(ToReal(conformalMethod),pow(detg,-0.166666666666666666666666666667),0.0833333333333333333333333333333*Log(detg)); + + CCTK_REAL em4phi = + IfThen(ToReal(conformalMethod),SQR(phiL),exp(-4*phiL)); + + CCTK_REAL gt11L = em4phi*g11; + + CCTK_REAL gt12L = em4phi*g12; + + CCTK_REAL gt13L = em4phi*g13; + + CCTK_REAL gt22L = em4phi*g22; + + CCTK_REAL gt23L = em4phi*g23; + + CCTK_REAL gt33L = em4phi*g33; + + trKL = gu11*kxxL + gu22*kyyL + 2*(gu12*kxyL + gu13*kxzL + gu23*kyzL) + + gu33*kzzL; + + CCTK_REAL At11L = em4phi*(kxxL - + 0.333333333333333333333333333333*g11*trKL); + + CCTK_REAL At12L = em4phi*(kxyL - + 0.333333333333333333333333333333*g12*trKL); + + CCTK_REAL At13L = em4phi*(kxzL - + 0.333333333333333333333333333333*g13*trKL); + + CCTK_REAL At22L = em4phi*(kyyL - + 0.333333333333333333333333333333*g22*trKL); + + CCTK_REAL At23L = em4phi*(kyzL - + 0.333333333333333333333333333333*g23*trKL); + + CCTK_REAL At33L = em4phi*(kzzL - + 0.333333333333333333333333333333*g33*trKL); + + CCTK_REAL alphaL = alpL; + + CCTK_REAL beta1L = betaxL; + + CCTK_REAL beta2L = betayL; + + CCTK_REAL beta3L = betazL; + + + /* Copy local copies back to grid functions */ + alpha[index] = alphaL; + At11[index] = At11L; + At12[index] = At12L; + At13[index] = At13L; + At22[index] = At22L; + At23[index] = At23L; + At33[index] = At33L; + beta1[index] = beta1L; + beta2[index] = beta2L; + beta3[index] = beta3L; + gt11[index] = gt11L; + gt12[index] = gt12L; + gt13[index] = gt13L; + gt22[index] = gt22L; + gt23[index] = gt23L; + gt33[index] = gt33L; + phi[index] = phiL; + trK[index] = trKL; + } + LC_ENDLOOP3 (ML_BSSN_MP_O8_convertFromADMBase); +} + +extern "C" void ML_BSSN_MP_O8_convertFromADMBase(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverEverything(cctkGH, &ML_BSSN_MP_O8_convertFromADMBase_Body); +} diff --git a/ML_BSSN_MP_O8/src/ML_BSSN_MP_O8_convertFromADMBaseGamma.cc b/ML_BSSN_MP_O8/src/ML_BSSN_MP_O8_convertFromADMBaseGamma.cc new file mode 100644 index 0000000..a405eb7 --- /dev/null +++ b/ML_BSSN_MP_O8/src/ML_BSSN_MP_O8_convertFromADMBaseGamma.cc @@ -0,0 +1,444 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +extern "C" void ML_BSSN_MP_O8_convertFromADMBaseGamma_SelectBCs(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT ierr = 0; + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_MP_O8::ML_dtlapse","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_MP_O8::ML_dtlapse."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_MP_O8::ML_dtshift","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_MP_O8::ML_dtshift."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_MP_O8::ML_Gamma","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_MP_O8::ML_Gamma."); + return; +} + +static void ML_BSSN_MP_O8_convertFromADMBaseGamma_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_BSSN_MP_O8_convertFromADMBaseGamma_Body"); + } + + if (cctk_iteration % ML_BSSN_MP_O8_convertFromADMBaseGamma_calc_every != ML_BSSN_MP_O8_convertFromADMBaseGamma_calc_offset) + { + return; + } + + const char *groups[] = {"ADMBase::dtlapse","ADMBase::dtshift","Coordinates::jacobian","grid::coordinates","Grid::coordinates","ML_BSSN_MP_O8::ML_dtlapse","ML_BSSN_MP_O8::ML_dtshift","ML_BSSN_MP_O8::ML_Gamma","ML_BSSN_MP_O8::ML_lapse","ML_BSSN_MP_O8::ML_metric","ML_BSSN_MP_O8::ML_shift"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_BSSN_MP_O8_convertFromADMBaseGamma", 11, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o1024dx = 0.0009765625*INV(dx); + CCTK_REAL const p1o1024dy = 0.0009765625*INV(dy); + CCTK_REAL const p1o1024dz = 0.0009765625*INV(dz); + CCTK_REAL const p1o1680dx = 0.000595238095238095238095238095238*INV(dx); + CCTK_REAL const p1o1680dy = 0.000595238095238095238095238095238*INV(dy); + CCTK_REAL const p1o1680dz = 0.000595238095238095238095238095238*INV(dz); + CCTK_REAL const p1o5040dx2 = 0.000198412698412698412698412698413*INV(SQR(dx)); + CCTK_REAL const p1o5040dy2 = 0.000198412698412698412698412698413*INV(SQR(dy)); + CCTK_REAL const p1o5040dz2 = 0.000198412698412698412698412698413*INV(SQR(dz)); + CCTK_REAL const p1o560dx = 0.00178571428571428571428571428571*INV(dx); + CCTK_REAL const p1o560dy = 0.00178571428571428571428571428571*INV(dy); + CCTK_REAL const p1o560dz = 0.00178571428571428571428571428571*INV(dz); + CCTK_REAL const p1o705600dxdy = 1.41723356009070294784580498866e-6*INV(dx)*INV(dy); + CCTK_REAL const p1o705600dxdz = 1.41723356009070294784580498866e-6*INV(dx)*INV(dz); + CCTK_REAL const p1o705600dydz = 1.41723356009070294784580498866e-6*INV(dy)*INV(dz); + CCTK_REAL const p1o840dx = 0.00119047619047619047619047619048*INV(dx); + CCTK_REAL const p1o840dy = 0.00119047619047619047619047619048*INV(dy); + CCTK_REAL const p1o840dz = 0.00119047619047619047619047619048*INV(dz); + CCTK_REAL const p1odx = INV(dx); + CCTK_REAL const p1ody = INV(dy); + CCTK_REAL const p1odz = INV(dz); + CCTK_REAL const pm1o840dx = -0.00119047619047619047619047619048*INV(dx); + CCTK_REAL const pm1o840dy = -0.00119047619047619047619047619048*INV(dy); + CCTK_REAL const pm1o840dz = -0.00119047619047619047619047619048*INV(dz); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_BSSN_MP_O8_convertFromADMBaseGamma, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + CCTK_REAL alphaL = alpha[index]; + CCTK_REAL beta1L = beta1[index]; + CCTK_REAL beta2L = beta2[index]; + CCTK_REAL beta3L = beta3[index]; + CCTK_REAL dtalpL = dtalp[index]; + CCTK_REAL dtbetaxL = dtbetax[index]; + CCTK_REAL dtbetayL = dtbetay[index]; + CCTK_REAL dtbetazL = dtbetaz[index]; + CCTK_REAL gt11L = gt11[index]; + CCTK_REAL gt12L = gt12[index]; + CCTK_REAL gt13L = gt13[index]; + CCTK_REAL gt22L = gt22[index]; + CCTK_REAL gt23L = gt23[index]; + CCTK_REAL gt33L = gt33[index]; + CCTK_REAL J11L = J11[index]; + CCTK_REAL J12L = J12[index]; + CCTK_REAL J13L = J13[index]; + CCTK_REAL J21L = J21[index]; + CCTK_REAL J22L = J22[index]; + CCTK_REAL J23L = J23[index]; + CCTK_REAL J31L = J31[index]; + CCTK_REAL J32L = J32[index]; + CCTK_REAL J33L = J33[index]; + CCTK_REAL rL = r[index]; + + /* Include user supplied include files */ + + /* Precompute derivatives */ + CCTK_REAL const PDupwindNthAnti1alpha = PDupwindNthAnti1(&alpha[index]); + CCTK_REAL const PDupwindNthSymm1alpha = PDupwindNthSymm1(&alpha[index]); + CCTK_REAL const PDupwindNthAnti2alpha = PDupwindNthAnti2(&alpha[index]); + CCTK_REAL const PDupwindNthSymm2alpha = PDupwindNthSymm2(&alpha[index]); + CCTK_REAL const PDupwindNthAnti3alpha = PDupwindNthAnti3(&alpha[index]); + CCTK_REAL const PDupwindNthSymm3alpha = PDupwindNthSymm3(&alpha[index]); + CCTK_REAL const PDupwindNthAnti1beta1 = PDupwindNthAnti1(&beta1[index]); + CCTK_REAL const PDupwindNthSymm1beta1 = PDupwindNthSymm1(&beta1[index]); + CCTK_REAL const PDupwindNthAnti2beta1 = PDupwindNthAnti2(&beta1[index]); + CCTK_REAL const PDupwindNthSymm2beta1 = PDupwindNthSymm2(&beta1[index]); + CCTK_REAL const PDupwindNthAnti3beta1 = PDupwindNthAnti3(&beta1[index]); + CCTK_REAL const PDupwindNthSymm3beta1 = PDupwindNthSymm3(&beta1[index]); + CCTK_REAL const PDupwindNthAnti1beta2 = PDupwindNthAnti1(&beta2[index]); + CCTK_REAL const PDupwindNthSymm1beta2 = PDupwindNthSymm1(&beta2[index]); + CCTK_REAL const PDupwindNthAnti2beta2 = PDupwindNthAnti2(&beta2[index]); + CCTK_REAL const PDupwindNthSymm2beta2 = PDupwindNthSymm2(&beta2[index]); + CCTK_REAL const PDupwindNthAnti3beta2 = PDupwindNthAnti3(&beta2[index]); + CCTK_REAL const PDupwindNthSymm3beta2 = PDupwindNthSymm3(&beta2[index]); + CCTK_REAL const PDupwindNthAnti1beta3 = PDupwindNthAnti1(&beta3[index]); + CCTK_REAL const PDupwindNthSymm1beta3 = PDupwindNthSymm1(&beta3[index]); + CCTK_REAL const PDupwindNthAnti2beta3 = PDupwindNthAnti2(&beta3[index]); + CCTK_REAL const PDupwindNthSymm2beta3 = PDupwindNthSymm2(&beta3[index]); + CCTK_REAL const PDupwindNthAnti3beta3 = PDupwindNthAnti3(&beta3[index]); + CCTK_REAL const PDupwindNthSymm3beta3 = PDupwindNthSymm3(&beta3[index]); + CCTK_REAL const PDstandardNth1gt11 = PDstandardNth1(>11[index]); + CCTK_REAL const PDstandardNth2gt11 = PDstandardNth2(>11[index]); + CCTK_REAL const PDstandardNth3gt11 = PDstandardNth3(>11[index]); + CCTK_REAL const PDstandardNth1gt12 = PDstandardNth1(>12[index]); + CCTK_REAL const PDstandardNth2gt12 = PDstandardNth2(>12[index]); + CCTK_REAL const PDstandardNth3gt12 = PDstandardNth3(>12[index]); + CCTK_REAL const PDstandardNth1gt13 = PDstandardNth1(>13[index]); + CCTK_REAL const PDstandardNth2gt13 = PDstandardNth2(>13[index]); + CCTK_REAL const PDstandardNth3gt13 = PDstandardNth3(>13[index]); + CCTK_REAL const PDstandardNth1gt22 = PDstandardNth1(>22[index]); + CCTK_REAL const PDstandardNth2gt22 = PDstandardNth2(>22[index]); + CCTK_REAL const PDstandardNth3gt22 = PDstandardNth3(>22[index]); + CCTK_REAL const PDstandardNth1gt23 = PDstandardNth1(>23[index]); + CCTK_REAL const PDstandardNth2gt23 = PDstandardNth2(>23[index]); + CCTK_REAL const PDstandardNth3gt23 = PDstandardNth3(>23[index]); + CCTK_REAL const PDstandardNth1gt33 = PDstandardNth1(>33[index]); + CCTK_REAL const PDstandardNth2gt33 = PDstandardNth2(>33[index]); + CCTK_REAL const PDstandardNth3gt33 = PDstandardNth3(>33[index]); + + /* Calculate temporaries and grid functions */ + ptrdiff_t dir1 = Sign(beta1L); + + ptrdiff_t dir2 = Sign(beta2L); + + ptrdiff_t dir3 = Sign(beta3L); + + CCTK_REAL detgt = 1; + + CCTK_REAL gtu11 = INV(detgt)*(gt22L*gt33L - SQR(gt23L)); + + CCTK_REAL gtu12 = (gt13L*gt23L - gt12L*gt33L)*INV(detgt); + + CCTK_REAL gtu13 = (-(gt13L*gt22L) + gt12L*gt23L)*INV(detgt); + + CCTK_REAL gtu22 = INV(detgt)*(gt11L*gt33L - SQR(gt13L)); + + CCTK_REAL gtu23 = (gt12L*gt13L - gt11L*gt23L)*INV(detgt); + + CCTK_REAL gtu33 = INV(detgt)*(gt11L*gt22L - SQR(gt12L)); + + CCTK_REAL Gt111 = 0.5*((gtu11*J11L - gtu12*J12L - + gtu13*J13L)*PDstandardNth1gt11 + (gtu11*J21L - gtu12*J22L - + gtu13*J23L)*PDstandardNth2gt11 + (gtu11*J31L - gtu12*J32L - + gtu13*J33L)*PDstandardNth3gt11 + 2*(J11L*(gtu12*PDstandardNth1gt12 + + gtu13*PDstandardNth1gt13) + J21L*(gtu12*PDstandardNth2gt12 + + gtu13*PDstandardNth2gt13) + J31L*(gtu12*PDstandardNth3gt12 + + gtu13*PDstandardNth3gt13))); + + CCTK_REAL Gt211 = 0.5*((gtu12*J11L - gtu22*J12L - + gtu23*J13L)*PDstandardNth1gt11 + (gtu12*J21L - gtu22*J22L - + gtu23*J23L)*PDstandardNth2gt11 + (gtu12*J31L - gtu22*J32L - + gtu23*J33L)*PDstandardNth3gt11 + 2*(J11L*(gtu22*PDstandardNth1gt12 + + gtu23*PDstandardNth1gt13) + J21L*(gtu22*PDstandardNth2gt12 + + gtu23*PDstandardNth2gt13) + J31L*(gtu22*PDstandardNth3gt12 + + gtu23*PDstandardNth3gt13))); + + CCTK_REAL Gt311 = 0.5*((gtu13*J11L - gtu23*J12L - + gtu33*J13L)*PDstandardNth1gt11 + (gtu13*J21L - gtu23*J22L - + gtu33*J23L)*PDstandardNth2gt11 + (gtu13*J31L - gtu23*J32L - + gtu33*J33L)*PDstandardNth3gt11 + 2*(J11L*(gtu23*PDstandardNth1gt12 + + gtu33*PDstandardNth1gt13) + J21L*(gtu23*PDstandardNth2gt12 + + gtu33*PDstandardNth2gt13) + J31L*(gtu23*PDstandardNth3gt12 + + gtu33*PDstandardNth3gt13))); + + CCTK_REAL Gt112 = 0.5*(gtu11*(J12L*PDstandardNth1gt11 + + J22L*PDstandardNth2gt11 + J32L*PDstandardNth3gt11) + + gtu12*(J11L*PDstandardNth1gt22 + J21L*PDstandardNth2gt22 + + J31L*PDstandardNth3gt22) + gtu13*(-(J13L*PDstandardNth1gt12) + + J12L*PDstandardNth1gt13 + J11L*PDstandardNth1gt23 - + J23L*PDstandardNth2gt12 + J22L*PDstandardNth2gt13 + + J21L*PDstandardNth2gt23 - J33L*PDstandardNth3gt12 + + J32L*PDstandardNth3gt13 + J31L*PDstandardNth3gt23)); + + CCTK_REAL Gt212 = 0.5*(gtu12*(J12L*PDstandardNth1gt11 + + J22L*PDstandardNth2gt11 + J32L*PDstandardNth3gt11) + + gtu22*(J11L*PDstandardNth1gt22 + J21L*PDstandardNth2gt22 + + J31L*PDstandardNth3gt22) + gtu23*(-(J13L*PDstandardNth1gt12) + + J12L*PDstandardNth1gt13 + J11L*PDstandardNth1gt23 - + J23L*PDstandardNth2gt12 + J22L*PDstandardNth2gt13 + + J21L*PDstandardNth2gt23 - J33L*PDstandardNth3gt12 + + J32L*PDstandardNth3gt13 + J31L*PDstandardNth3gt23)); + + CCTK_REAL Gt312 = 0.5*(gtu13*(J12L*PDstandardNth1gt11 + + J22L*PDstandardNth2gt11 + J32L*PDstandardNth3gt11) + + gtu23*(J11L*PDstandardNth1gt22 + J21L*PDstandardNth2gt22 + + J31L*PDstandardNth3gt22) + gtu33*(-(J13L*PDstandardNth1gt12) + + J12L*PDstandardNth1gt13 + J11L*PDstandardNth1gt23 - + J23L*PDstandardNth2gt12 + J22L*PDstandardNth2gt13 + + J21L*PDstandardNth2gt23 - J33L*PDstandardNth3gt12 + + J32L*PDstandardNth3gt13 + J31L*PDstandardNth3gt23)); + + CCTK_REAL Gt113 = 0.5*(gtu11*(J13L*PDstandardNth1gt11 + + J23L*PDstandardNth2gt11 + J33L*PDstandardNth3gt11) + + gtu12*(J13L*PDstandardNth1gt12 - J12L*PDstandardNth1gt13 + + J11L*PDstandardNth1gt23 + J23L*PDstandardNth2gt12 - + J22L*PDstandardNth2gt13 + J21L*PDstandardNth2gt23 + + J33L*PDstandardNth3gt12 - J32L*PDstandardNth3gt13 + + J31L*PDstandardNth3gt23) + gtu13*(J11L*PDstandardNth1gt33 + + J21L*PDstandardNth2gt33 + J31L*PDstandardNth3gt33)); + + CCTK_REAL Gt213 = 0.5*(gtu12*(J13L*PDstandardNth1gt11 + + J23L*PDstandardNth2gt11 + J33L*PDstandardNth3gt11) + + gtu22*(J13L*PDstandardNth1gt12 - J12L*PDstandardNth1gt13 + + J11L*PDstandardNth1gt23 + J23L*PDstandardNth2gt12 - + J22L*PDstandardNth2gt13 + J21L*PDstandardNth2gt23 + + J33L*PDstandardNth3gt12 - J32L*PDstandardNth3gt13 + + J31L*PDstandardNth3gt23) + gtu23*(J11L*PDstandardNth1gt33 + + J21L*PDstandardNth2gt33 + J31L*PDstandardNth3gt33)); + + CCTK_REAL Gt313 = 0.5*(gtu13*(J13L*PDstandardNth1gt11 + + J23L*PDstandardNth2gt11 + J33L*PDstandardNth3gt11) + + gtu23*(J13L*PDstandardNth1gt12 - J12L*PDstandardNth1gt13 + + J11L*PDstandardNth1gt23 + J23L*PDstandardNth2gt12 - + J22L*PDstandardNth2gt13 + J21L*PDstandardNth2gt23 + + J33L*PDstandardNth3gt12 - J32L*PDstandardNth3gt13 + + J31L*PDstandardNth3gt23) + gtu33*(J11L*PDstandardNth1gt33 + + J21L*PDstandardNth2gt33 + J31L*PDstandardNth3gt33)); + + CCTK_REAL Gt122 = 0.5*(gtu11*(-(J11L*PDstandardNth1gt22) + + 2*(J12L*PDstandardNth1gt12 + J22L*PDstandardNth2gt12) - + J21L*PDstandardNth2gt22 + 2*J32L*PDstandardNth3gt12 - + J31L*PDstandardNth3gt22) + gtu12*(J12L*PDstandardNth1gt22 + + J22L*PDstandardNth2gt22 + J32L*PDstandardNth3gt22) - + gtu13*(J13L*PDstandardNth1gt22 + J23L*PDstandardNth2gt22 + + J33L*PDstandardNth3gt22 - 2*(J12L*PDstandardNth1gt23 + + J22L*PDstandardNth2gt23 + J32L*PDstandardNth3gt23))); + + CCTK_REAL Gt222 = 0.5*(gtu12*(-(J11L*PDstandardNth1gt22) + + 2*(J12L*PDstandardNth1gt12 + J22L*PDstandardNth2gt12) - + J21L*PDstandardNth2gt22 + 2*J32L*PDstandardNth3gt12 - + J31L*PDstandardNth3gt22) + gtu22*(J12L*PDstandardNth1gt22 + + J22L*PDstandardNth2gt22 + J32L*PDstandardNth3gt22) - + gtu23*(J13L*PDstandardNth1gt22 + J23L*PDstandardNth2gt22 + + J33L*PDstandardNth3gt22 - 2*(J12L*PDstandardNth1gt23 + + J22L*PDstandardNth2gt23 + J32L*PDstandardNth3gt23))); + + CCTK_REAL Gt322 = 0.5*(gtu13*(-(J11L*PDstandardNth1gt22) + + 2*(J12L*PDstandardNth1gt12 + J22L*PDstandardNth2gt12) - + J21L*PDstandardNth2gt22 + 2*J32L*PDstandardNth3gt12 - + J31L*PDstandardNth3gt22) + gtu23*(J12L*PDstandardNth1gt22 + + J22L*PDstandardNth2gt22 + J32L*PDstandardNth3gt22) - + gtu33*(J13L*PDstandardNth1gt22 + J23L*PDstandardNth2gt22 + + J33L*PDstandardNth3gt22 - 2*(J12L*PDstandardNth1gt23 + + J22L*PDstandardNth2gt23 + J32L*PDstandardNth3gt23))); + + CCTK_REAL Gt123 = 0.5*(gtu12*(J13L*PDstandardNth1gt22 + + J23L*PDstandardNth2gt22 + J33L*PDstandardNth3gt22) + + gtu11*(J13L*PDstandardNth1gt12 + J12L*PDstandardNth1gt13 - + J11L*PDstandardNth1gt23 + J23L*PDstandardNth2gt12 + + J22L*PDstandardNth2gt13 - J21L*PDstandardNth2gt23 + + J33L*PDstandardNth3gt12 + J32L*PDstandardNth3gt13 - + J31L*PDstandardNth3gt23) + gtu13*(J12L*PDstandardNth1gt33 + + J22L*PDstandardNth2gt33 + J32L*PDstandardNth3gt33)); + + CCTK_REAL Gt223 = 0.5*(gtu22*(J13L*PDstandardNth1gt22 + + J23L*PDstandardNth2gt22 + J33L*PDstandardNth3gt22) + + gtu12*(J13L*PDstandardNth1gt12 + J12L*PDstandardNth1gt13 - + J11L*PDstandardNth1gt23 + J23L*PDstandardNth2gt12 + + J22L*PDstandardNth2gt13 - J21L*PDstandardNth2gt23 + + J33L*PDstandardNth3gt12 + J32L*PDstandardNth3gt13 - + J31L*PDstandardNth3gt23) + gtu23*(J12L*PDstandardNth1gt33 + + J22L*PDstandardNth2gt33 + J32L*PDstandardNth3gt33)); + + CCTK_REAL Gt323 = 0.5*(gtu23*(J13L*PDstandardNth1gt22 + + J23L*PDstandardNth2gt22 + J33L*PDstandardNth3gt22) + + gtu13*(J13L*PDstandardNth1gt12 + J12L*PDstandardNth1gt13 - + J11L*PDstandardNth1gt23 + J23L*PDstandardNth2gt12 + + J22L*PDstandardNth2gt13 - J21L*PDstandardNth2gt23 + + J33L*PDstandardNth3gt12 + J32L*PDstandardNth3gt13 - + J31L*PDstandardNth3gt23) + gtu33*(J12L*PDstandardNth1gt33 + + J22L*PDstandardNth2gt33 + J32L*PDstandardNth3gt33)); + + CCTK_REAL Gt133 = 0.5*(gtu11*(-(J11L*PDstandardNth1gt33) + + 2*(J13L*PDstandardNth1gt13 + J23L*PDstandardNth2gt13) - + J21L*PDstandardNth2gt33 + 2*J33L*PDstandardNth3gt13 - + J31L*PDstandardNth3gt33) + gtu12*(-(J12L*PDstandardNth1gt33) + + 2*(J13L*PDstandardNth1gt23 + J23L*PDstandardNth2gt23) - + J22L*PDstandardNth2gt33 + 2*J33L*PDstandardNth3gt23 - + J32L*PDstandardNth3gt33) + gtu13*(J13L*PDstandardNth1gt33 + + J23L*PDstandardNth2gt33 + J33L*PDstandardNth3gt33)); + + CCTK_REAL Gt233 = 0.5*(gtu12*(-(J11L*PDstandardNth1gt33) + + 2*(J13L*PDstandardNth1gt13 + J23L*PDstandardNth2gt13) - + J21L*PDstandardNth2gt33 + 2*J33L*PDstandardNth3gt13 - + J31L*PDstandardNth3gt33) + gtu22*(-(J12L*PDstandardNth1gt33) + + 2*(J13L*PDstandardNth1gt23 + J23L*PDstandardNth2gt23) - + J22L*PDstandardNth2gt33 + 2*J33L*PDstandardNth3gt23 - + J32L*PDstandardNth3gt33) + gtu23*(J13L*PDstandardNth1gt33 + + J23L*PDstandardNth2gt33 + J33L*PDstandardNth3gt33)); + + CCTK_REAL Gt333 = 0.5*(gtu13*(-(J11L*PDstandardNth1gt33) + + 2*(J13L*PDstandardNth1gt13 + J23L*PDstandardNth2gt13) - + J21L*PDstandardNth2gt33 + 2*J33L*PDstandardNth3gt13 - + J31L*PDstandardNth3gt33) + gtu23*(-(J12L*PDstandardNth1gt33) + + 2*(J13L*PDstandardNth1gt23 + J23L*PDstandardNth2gt23) - + J22L*PDstandardNth2gt33 + 2*J33L*PDstandardNth3gt23 - + J32L*PDstandardNth3gt33) + gtu33*(J13L*PDstandardNth1gt33 + + J23L*PDstandardNth2gt33 + J33L*PDstandardNth3gt33)); + + CCTK_REAL Xt1L = Gt111*gtu11 + Gt122*gtu22 + 2*(Gt112*gtu12 + + Gt113*gtu13 + Gt123*gtu23) + Gt133*gtu33; + + CCTK_REAL Xt2L = Gt211*gtu11 + Gt222*gtu22 + 2*(Gt212*gtu12 + + Gt213*gtu13 + Gt223*gtu23) + Gt233*gtu33; + + CCTK_REAL Xt3L = Gt311*gtu11 + Gt322*gtu22 + 2*(Gt312*gtu12 + + Gt313*gtu13 + Gt323*gtu23) + Gt333*gtu33; + + CCTK_REAL AL = IfThen(ToReal(LapseACoeff) != + 0,3*INV(ToReal(harmonicF))*pow(alphaL,-ToReal(harmonicN))*(-9*dtalpL + + ((beta1L*J11L + beta2L*J12L + beta3L*J13L)*PDupwindNthAnti1alpha + + (beta1L*J21L + beta2L*J22L + beta3L*J23L)*PDupwindNthAnti2alpha + + (beta1L*J31L + beta2L*J32L + beta3L*J33L)*PDupwindNthAnti3alpha + + (J11L*PDupwindNthSymm1alpha + J21L*PDupwindNthSymm2alpha + + J31L*PDupwindNthSymm3alpha)*Abs(beta1L) + (J12L*PDupwindNthSymm1alpha + + J22L*PDupwindNthSymm2alpha + J32L*PDupwindNthSymm3alpha)*Abs(beta2L) + + (J13L*PDupwindNthSymm1alpha + J23L*PDupwindNthSymm2alpha + + J33L*PDupwindNthSymm3alpha)*Abs(beta3L))*ToReal(LapseAdvectionCoeff)),0); + + CCTK_REAL theta = fmin(1,exp(1 - + rL*INV(ToReal(SpatialShiftGammaCoeffRadius)))); + + CCTK_REAL B1L = IfThen(ToReal(ShiftBCoeff)*ToReal(ShiftGammaCoeff) != + 0,INV(theta)*INV(ToReal(ShiftGammaCoeff))*(27*dtbetaxL - + 3*((beta1L*J11L + beta2L*J12L + beta3L*J13L)*PDupwindNthAnti1beta1 + + (beta1L*J21L + beta2L*J22L + beta3L*J23L)*PDupwindNthAnti2beta1 + + (beta1L*J31L + beta2L*J32L + beta3L*J33L)*PDupwindNthAnti3beta1 + + (J11L*PDupwindNthSymm1beta1 + J21L*PDupwindNthSymm2beta1 + + J31L*PDupwindNthSymm3beta1)*Abs(beta1L) + (J12L*PDupwindNthSymm1beta1 + + J22L*PDupwindNthSymm2beta1 + J32L*PDupwindNthSymm3beta1)*Abs(beta2L) + + (J13L*PDupwindNthSymm1beta1 + J23L*PDupwindNthSymm2beta1 + + J33L*PDupwindNthSymm3beta1)*Abs(beta3L))*ToReal(ShiftAdvectionCoeff)),0); + + CCTK_REAL B2L = IfThen(ToReal(ShiftBCoeff)*ToReal(ShiftGammaCoeff) != + 0,INV(theta)*INV(ToReal(ShiftGammaCoeff))*(27*dtbetayL - + 3*((beta1L*J11L + beta2L*J12L + beta3L*J13L)*PDupwindNthAnti1beta2 + + (beta1L*J21L + beta2L*J22L + beta3L*J23L)*PDupwindNthAnti2beta2 + + (beta1L*J31L + beta2L*J32L + beta3L*J33L)*PDupwindNthAnti3beta2 + + (J11L*PDupwindNthSymm1beta2 + J21L*PDupwindNthSymm2beta2 + + J31L*PDupwindNthSymm3beta2)*Abs(beta1L) + (J12L*PDupwindNthSymm1beta2 + + J22L*PDupwindNthSymm2beta2 + J32L*PDupwindNthSymm3beta2)*Abs(beta2L) + + (J13L*PDupwindNthSymm1beta2 + J23L*PDupwindNthSymm2beta2 + + J33L*PDupwindNthSymm3beta2)*Abs(beta3L))*ToReal(ShiftAdvectionCoeff)),0); + + CCTK_REAL B3L = IfThen(ToReal(ShiftBCoeff)*ToReal(ShiftGammaCoeff) != + 0,INV(theta)*INV(ToReal(ShiftGammaCoeff))*(27*dtbetazL - + 3*((beta1L*J11L + beta2L*J12L + beta3L*J13L)*PDupwindNthAnti1beta3 + + (beta1L*J21L + beta2L*J22L + beta3L*J23L)*PDupwindNthAnti2beta3 + + (beta1L*J31L + beta2L*J32L + beta3L*J33L)*PDupwindNthAnti3beta3 + + (J11L*PDupwindNthSymm1beta3 + J21L*PDupwindNthSymm2beta3 + + J31L*PDupwindNthSymm3beta3)*Abs(beta1L) + (J12L*PDupwindNthSymm1beta3 + + J22L*PDupwindNthSymm2beta3 + J32L*PDupwindNthSymm3beta3)*Abs(beta2L) + + (J13L*PDupwindNthSymm1beta3 + J23L*PDupwindNthSymm2beta3 + + J33L*PDupwindNthSymm3beta3)*Abs(beta3L))*ToReal(ShiftAdvectionCoeff)),0); + + + /* Copy local copies back to grid functions */ + A[index] = AL; + B1[index] = B1L; + B2[index] = B2L; + B3[index] = B3L; + Xt1[index] = Xt1L; + Xt2[index] = Xt2L; + Xt3[index] = Xt3L; + } + LC_ENDLOOP3 (ML_BSSN_MP_O8_convertFromADMBaseGamma); +} + +extern "C" void ML_BSSN_MP_O8_convertFromADMBaseGamma(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverInterior(cctkGH, &ML_BSSN_MP_O8_convertFromADMBaseGamma_Body); +} diff --git a/ML_BSSN_MP_O8/src/ML_BSSN_MP_O8_convertToADMBase.cc b/ML_BSSN_MP_O8/src/ML_BSSN_MP_O8_convertToADMBase.cc new file mode 100644 index 0000000..c7f7ebb --- /dev/null +++ b/ML_BSSN_MP_O8/src/ML_BSSN_MP_O8_convertToADMBase.cc @@ -0,0 +1,199 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +static void ML_BSSN_MP_O8_convertToADMBase_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_BSSN_MP_O8_convertToADMBase_Body"); + } + + if (cctk_iteration % ML_BSSN_MP_O8_convertToADMBase_calc_every != ML_BSSN_MP_O8_convertToADMBase_calc_offset) + { + return; + } + + const char *groups[] = {"ADMBase::curv","ADMBase::lapse","ADMBase::metric","ADMBase::shift","ML_BSSN_MP_O8::ML_curv","ML_BSSN_MP_O8::ML_lapse","ML_BSSN_MP_O8::ML_log_confac","ML_BSSN_MP_O8::ML_metric","ML_BSSN_MP_O8::ML_shift","ML_BSSN_MP_O8::ML_trace_curv"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_BSSN_MP_O8_convertToADMBase", 10, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o1024dx = 0.0009765625*INV(dx); + CCTK_REAL const p1o1024dy = 0.0009765625*INV(dy); + CCTK_REAL const p1o1024dz = 0.0009765625*INV(dz); + CCTK_REAL const p1o1680dx = 0.000595238095238095238095238095238*INV(dx); + CCTK_REAL const p1o1680dy = 0.000595238095238095238095238095238*INV(dy); + CCTK_REAL const p1o1680dz = 0.000595238095238095238095238095238*INV(dz); + CCTK_REAL const p1o5040dx2 = 0.000198412698412698412698412698413*INV(SQR(dx)); + CCTK_REAL const p1o5040dy2 = 0.000198412698412698412698412698413*INV(SQR(dy)); + CCTK_REAL const p1o5040dz2 = 0.000198412698412698412698412698413*INV(SQR(dz)); + CCTK_REAL const p1o560dx = 0.00178571428571428571428571428571*INV(dx); + CCTK_REAL const p1o560dy = 0.00178571428571428571428571428571*INV(dy); + CCTK_REAL const p1o560dz = 0.00178571428571428571428571428571*INV(dz); + CCTK_REAL const p1o705600dxdy = 1.41723356009070294784580498866e-6*INV(dx)*INV(dy); + CCTK_REAL const p1o705600dxdz = 1.41723356009070294784580498866e-6*INV(dx)*INV(dz); + CCTK_REAL const p1o705600dydz = 1.41723356009070294784580498866e-6*INV(dy)*INV(dz); + CCTK_REAL const p1o840dx = 0.00119047619047619047619047619048*INV(dx); + CCTK_REAL const p1o840dy = 0.00119047619047619047619047619048*INV(dy); + CCTK_REAL const p1o840dz = 0.00119047619047619047619047619048*INV(dz); + CCTK_REAL const p1odx = INV(dx); + CCTK_REAL const p1ody = INV(dy); + CCTK_REAL const p1odz = INV(dz); + CCTK_REAL const pm1o840dx = -0.00119047619047619047619047619048*INV(dx); + CCTK_REAL const pm1o840dy = -0.00119047619047619047619047619048*INV(dy); + CCTK_REAL const pm1o840dz = -0.00119047619047619047619047619048*INV(dz); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_BSSN_MP_O8_convertToADMBase, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + CCTK_REAL alphaL = alpha[index]; + CCTK_REAL At11L = At11[index]; + CCTK_REAL At12L = At12[index]; + CCTK_REAL At13L = At13[index]; + CCTK_REAL At22L = At22[index]; + CCTK_REAL At23L = At23[index]; + CCTK_REAL At33L = At33[index]; + CCTK_REAL beta1L = beta1[index]; + CCTK_REAL beta2L = beta2[index]; + CCTK_REAL beta3L = beta3[index]; + CCTK_REAL gt11L = gt11[index]; + CCTK_REAL gt12L = gt12[index]; + CCTK_REAL gt13L = gt13[index]; + CCTK_REAL gt22L = gt22[index]; + CCTK_REAL gt23L = gt23[index]; + CCTK_REAL gt33L = gt33[index]; + CCTK_REAL gxxL = gxx[index]; + CCTK_REAL gxyL = gxy[index]; + CCTK_REAL gxzL = gxz[index]; + CCTK_REAL gyyL = gyy[index]; + CCTK_REAL gyzL = gyz[index]; + CCTK_REAL gzzL = gzz[index]; + CCTK_REAL phiL = phi[index]; + CCTK_REAL trKL = trK[index]; + + /* Include user supplied include files */ + + /* Precompute derivatives */ + + /* Calculate temporaries and grid functions */ + CCTK_REAL e4phi = + IfThen(ToReal(conformalMethod),INV(SQR(phiL)),exp(4*phiL)); + + gxxL = e4phi*gt11L; + + gxyL = e4phi*gt12L; + + gxzL = e4phi*gt13L; + + gyyL = e4phi*gt22L; + + gyzL = e4phi*gt23L; + + gzzL = e4phi*gt33L; + + CCTK_REAL kxxL = At11L*e4phi + + 0.333333333333333333333333333333*gxxL*trKL; + + CCTK_REAL kxyL = At12L*e4phi + + 0.333333333333333333333333333333*gxyL*trKL; + + CCTK_REAL kxzL = At13L*e4phi + + 0.333333333333333333333333333333*gxzL*trKL; + + CCTK_REAL kyyL = At22L*e4phi + + 0.333333333333333333333333333333*gyyL*trKL; + + CCTK_REAL kyzL = At23L*e4phi + + 0.333333333333333333333333333333*gyzL*trKL; + + CCTK_REAL kzzL = At33L*e4phi + + 0.333333333333333333333333333333*gzzL*trKL; + + CCTK_REAL alpL = alphaL; + + CCTK_REAL betaxL = beta1L; + + CCTK_REAL betayL = beta2L; + + CCTK_REAL betazL = beta3L; + + + /* Copy local copies back to grid functions */ + alp[index] = alpL; + betax[index] = betaxL; + betay[index] = betayL; + betaz[index] = betazL; + gxx[index] = gxxL; + gxy[index] = gxyL; + gxz[index] = gxzL; + gyy[index] = gyyL; + gyz[index] = gyzL; + gzz[index] = gzzL; + kxx[index] = kxxL; + kxy[index] = kxyL; + kxz[index] = kxzL; + kyy[index] = kyyL; + kyz[index] = kyzL; + kzz[index] = kzzL; + } + LC_ENDLOOP3 (ML_BSSN_MP_O8_convertToADMBase); +} + +extern "C" void ML_BSSN_MP_O8_convertToADMBase(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverEverything(cctkGH, &ML_BSSN_MP_O8_convertToADMBase_Body); +} diff --git a/ML_BSSN_MP_O8/src/ML_BSSN_MP_O8_convertToADMBaseDtLapseShift.cc b/ML_BSSN_MP_O8/src/ML_BSSN_MP_O8_convertToADMBaseDtLapseShift.cc new file mode 100644 index 0000000..5b4fbc3 --- /dev/null +++ b/ML_BSSN_MP_O8/src/ML_BSSN_MP_O8_convertToADMBaseDtLapseShift.cc @@ -0,0 +1,242 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +extern "C" void ML_BSSN_MP_O8_convertToADMBaseDtLapseShift_SelectBCs(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT ierr = 0; + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ADMBase::dtlapse","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ADMBase::dtlapse."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ADMBase::dtshift","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ADMBase::dtshift."); + return; +} + +static void ML_BSSN_MP_O8_convertToADMBaseDtLapseShift_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_BSSN_MP_O8_convertToADMBaseDtLapseShift_Body"); + } + + if (cctk_iteration % ML_BSSN_MP_O8_convertToADMBaseDtLapseShift_calc_every != ML_BSSN_MP_O8_convertToADMBaseDtLapseShift_calc_offset) + { + return; + } + + const char *groups[] = {"ADMBase::dtlapse","ADMBase::dtshift","Coordinates::jacobian","grid::coordinates","Grid::coordinates","ML_BSSN_MP_O8::ML_dtlapse","ML_BSSN_MP_O8::ML_dtshift","ML_BSSN_MP_O8::ML_Gamma","ML_BSSN_MP_O8::ML_lapse","ML_BSSN_MP_O8::ML_shift","ML_BSSN_MP_O8::ML_trace_curv"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_BSSN_MP_O8_convertToADMBaseDtLapseShift", 11, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o1024dx = 0.0009765625*INV(dx); + CCTK_REAL const p1o1024dy = 0.0009765625*INV(dy); + CCTK_REAL const p1o1024dz = 0.0009765625*INV(dz); + CCTK_REAL const p1o1680dx = 0.000595238095238095238095238095238*INV(dx); + CCTK_REAL const p1o1680dy = 0.000595238095238095238095238095238*INV(dy); + CCTK_REAL const p1o1680dz = 0.000595238095238095238095238095238*INV(dz); + CCTK_REAL const p1o5040dx2 = 0.000198412698412698412698412698413*INV(SQR(dx)); + CCTK_REAL const p1o5040dy2 = 0.000198412698412698412698412698413*INV(SQR(dy)); + CCTK_REAL const p1o5040dz2 = 0.000198412698412698412698412698413*INV(SQR(dz)); + CCTK_REAL const p1o560dx = 0.00178571428571428571428571428571*INV(dx); + CCTK_REAL const p1o560dy = 0.00178571428571428571428571428571*INV(dy); + CCTK_REAL const p1o560dz = 0.00178571428571428571428571428571*INV(dz); + CCTK_REAL const p1o705600dxdy = 1.41723356009070294784580498866e-6*INV(dx)*INV(dy); + CCTK_REAL const p1o705600dxdz = 1.41723356009070294784580498866e-6*INV(dx)*INV(dz); + CCTK_REAL const p1o705600dydz = 1.41723356009070294784580498866e-6*INV(dy)*INV(dz); + CCTK_REAL const p1o840dx = 0.00119047619047619047619047619048*INV(dx); + CCTK_REAL const p1o840dy = 0.00119047619047619047619047619048*INV(dy); + CCTK_REAL const p1o840dz = 0.00119047619047619047619047619048*INV(dz); + CCTK_REAL const p1odx = INV(dx); + CCTK_REAL const p1ody = INV(dy); + CCTK_REAL const p1odz = INV(dz); + CCTK_REAL const pm1o840dx = -0.00119047619047619047619047619048*INV(dx); + CCTK_REAL const pm1o840dy = -0.00119047619047619047619047619048*INV(dy); + CCTK_REAL const pm1o840dz = -0.00119047619047619047619047619048*INV(dz); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_BSSN_MP_O8_convertToADMBaseDtLapseShift, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + CCTK_REAL AL = A[index]; + CCTK_REAL alphaL = alpha[index]; + CCTK_REAL B1L = B1[index]; + CCTK_REAL B2L = B2[index]; + CCTK_REAL B3L = B3[index]; + CCTK_REAL beta1L = beta1[index]; + CCTK_REAL beta2L = beta2[index]; + CCTK_REAL beta3L = beta3[index]; + CCTK_REAL J11L = J11[index]; + CCTK_REAL J12L = J12[index]; + CCTK_REAL J13L = J13[index]; + CCTK_REAL J21L = J21[index]; + CCTK_REAL J22L = J22[index]; + CCTK_REAL J23L = J23[index]; + CCTK_REAL J31L = J31[index]; + CCTK_REAL J32L = J32[index]; + CCTK_REAL J33L = J33[index]; + CCTK_REAL rL = r[index]; + CCTK_REAL trKL = trK[index]; + CCTK_REAL Xt1L = Xt1[index]; + CCTK_REAL Xt2L = Xt2[index]; + CCTK_REAL Xt3L = Xt3[index]; + + /* Include user supplied include files */ + + /* Precompute derivatives */ + CCTK_REAL const PDupwindNthAnti1alpha = PDupwindNthAnti1(&alpha[index]); + CCTK_REAL const PDupwindNthSymm1alpha = PDupwindNthSymm1(&alpha[index]); + CCTK_REAL const PDupwindNthAnti2alpha = PDupwindNthAnti2(&alpha[index]); + CCTK_REAL const PDupwindNthSymm2alpha = PDupwindNthSymm2(&alpha[index]); + CCTK_REAL const PDupwindNthAnti3alpha = PDupwindNthAnti3(&alpha[index]); + CCTK_REAL const PDupwindNthSymm3alpha = PDupwindNthSymm3(&alpha[index]); + CCTK_REAL const PDupwindNthAnti1beta1 = PDupwindNthAnti1(&beta1[index]); + CCTK_REAL const PDupwindNthSymm1beta1 = PDupwindNthSymm1(&beta1[index]); + CCTK_REAL const PDupwindNthAnti2beta1 = PDupwindNthAnti2(&beta1[index]); + CCTK_REAL const PDupwindNthSymm2beta1 = PDupwindNthSymm2(&beta1[index]); + CCTK_REAL const PDupwindNthAnti3beta1 = PDupwindNthAnti3(&beta1[index]); + CCTK_REAL const PDupwindNthSymm3beta1 = PDupwindNthSymm3(&beta1[index]); + CCTK_REAL const PDupwindNthAnti1beta2 = PDupwindNthAnti1(&beta2[index]); + CCTK_REAL const PDupwindNthSymm1beta2 = PDupwindNthSymm1(&beta2[index]); + CCTK_REAL const PDupwindNthAnti2beta2 = PDupwindNthAnti2(&beta2[index]); + CCTK_REAL const PDupwindNthSymm2beta2 = PDupwindNthSymm2(&beta2[index]); + CCTK_REAL const PDupwindNthAnti3beta2 = PDupwindNthAnti3(&beta2[index]); + CCTK_REAL const PDupwindNthSymm3beta2 = PDupwindNthSymm3(&beta2[index]); + CCTK_REAL const PDupwindNthAnti1beta3 = PDupwindNthAnti1(&beta3[index]); + CCTK_REAL const PDupwindNthSymm1beta3 = PDupwindNthSymm1(&beta3[index]); + CCTK_REAL const PDupwindNthAnti2beta3 = PDupwindNthAnti2(&beta3[index]); + CCTK_REAL const PDupwindNthSymm2beta3 = PDupwindNthSymm2(&beta3[index]); + CCTK_REAL const PDupwindNthAnti3beta3 = PDupwindNthAnti3(&beta3[index]); + CCTK_REAL const PDupwindNthSymm3beta3 = PDupwindNthSymm3(&beta3[index]); + + /* Calculate temporaries and grid functions */ + ptrdiff_t dir1 = Sign(beta1L); + + ptrdiff_t dir2 = Sign(beta2L); + + ptrdiff_t dir3 = Sign(beta3L); + + CCTK_REAL eta = fmin(1,INV(rL)*ToReal(SpatialBetaDriverRadius)); + + CCTK_REAL theta = fmin(1,exp(1 - + rL*INV(ToReal(SpatialShiftGammaCoeffRadius)))); + + CCTK_REAL dtalpL = + -(pow(alphaL,ToReal(harmonicN))*ToReal(harmonicF)*(trKL + (AL - + trKL)*ToReal(LapseACoeff))) + ((beta1L*J11L + beta2L*J12L + + beta3L*J13L)*PDupwindNthAnti1alpha + (beta1L*J21L + beta2L*J22L + + beta3L*J23L)*PDupwindNthAnti2alpha + (beta1L*J31L + beta2L*J32L + + beta3L*J33L)*PDupwindNthAnti3alpha + (J11L*PDupwindNthSymm1alpha + + J21L*PDupwindNthSymm2alpha + J31L*PDupwindNthSymm3alpha)*Abs(beta1L) + + (J12L*PDupwindNthSymm1alpha + J22L*PDupwindNthSymm2alpha + + J32L*PDupwindNthSymm3alpha)*Abs(beta2L) + (J13L*PDupwindNthSymm1alpha + + J23L*PDupwindNthSymm2alpha + + J33L*PDupwindNthSymm3alpha)*Abs(beta3L))*ToReal(LapseAdvectionCoeff); + + CCTK_REAL dtbetaxL = ((beta1L*J11L + beta2L*J12L + + beta3L*J13L)*PDupwindNthAnti1beta1 + (beta1L*J21L + beta2L*J22L + + beta3L*J23L)*PDupwindNthAnti2beta1 + (beta1L*J31L + beta2L*J32L + + beta3L*J33L)*PDupwindNthAnti3beta1 + (J11L*PDupwindNthSymm1beta1 + + J21L*PDupwindNthSymm2beta1 + J31L*PDupwindNthSymm3beta1)*Abs(beta1L) + + (J12L*PDupwindNthSymm1beta1 + J22L*PDupwindNthSymm2beta1 + + J32L*PDupwindNthSymm3beta1)*Abs(beta2L) + (J13L*PDupwindNthSymm1beta1 + + J23L*PDupwindNthSymm2beta1 + + J33L*PDupwindNthSymm3beta1)*Abs(beta3L))*ToReal(ShiftAdvectionCoeff) + + theta*(Xt1L + beta1L*eta*ToReal(BetaDriver)*(-1 + ToReal(ShiftBCoeff)) + + (B1L - Xt1L)*ToReal(ShiftBCoeff))*ToReal(ShiftGammaCoeff); + + CCTK_REAL dtbetayL = ((beta1L*J11L + beta2L*J12L + + beta3L*J13L)*PDupwindNthAnti1beta2 + (beta1L*J21L + beta2L*J22L + + beta3L*J23L)*PDupwindNthAnti2beta2 + (beta1L*J31L + beta2L*J32L + + beta3L*J33L)*PDupwindNthAnti3beta2 + (J11L*PDupwindNthSymm1beta2 + + J21L*PDupwindNthSymm2beta2 + J31L*PDupwindNthSymm3beta2)*Abs(beta1L) + + (J12L*PDupwindNthSymm1beta2 + J22L*PDupwindNthSymm2beta2 + + J32L*PDupwindNthSymm3beta2)*Abs(beta2L) + (J13L*PDupwindNthSymm1beta2 + + J23L*PDupwindNthSymm2beta2 + + J33L*PDupwindNthSymm3beta2)*Abs(beta3L))*ToReal(ShiftAdvectionCoeff) + + theta*(Xt2L + beta2L*eta*ToReal(BetaDriver)*(-1 + ToReal(ShiftBCoeff)) + + (B2L - Xt2L)*ToReal(ShiftBCoeff))*ToReal(ShiftGammaCoeff); + + CCTK_REAL dtbetazL = ((beta1L*J11L + beta2L*J12L + + beta3L*J13L)*PDupwindNthAnti1beta3 + (beta1L*J21L + beta2L*J22L + + beta3L*J23L)*PDupwindNthAnti2beta3 + (beta1L*J31L + beta2L*J32L + + beta3L*J33L)*PDupwindNthAnti3beta3 + (J11L*PDupwindNthSymm1beta3 + + J21L*PDupwindNthSymm2beta3 + J31L*PDupwindNthSymm3beta3)*Abs(beta1L) + + (J12L*PDupwindNthSymm1beta3 + J22L*PDupwindNthSymm2beta3 + + J32L*PDupwindNthSymm3beta3)*Abs(beta2L) + (J13L*PDupwindNthSymm1beta3 + + J23L*PDupwindNthSymm2beta3 + + J33L*PDupwindNthSymm3beta3)*Abs(beta3L))*ToReal(ShiftAdvectionCoeff) + + theta*(Xt3L + beta3L*eta*ToReal(BetaDriver)*(-1 + ToReal(ShiftBCoeff)) + + (B3L - Xt3L)*ToReal(ShiftBCoeff))*ToReal(ShiftGammaCoeff); + + + /* Copy local copies back to grid functions */ + dtalp[index] = dtalpL; + dtbetax[index] = dtbetaxL; + dtbetay[index] = dtbetayL; + dtbetaz[index] = dtbetazL; + } + LC_ENDLOOP3 (ML_BSSN_MP_O8_convertToADMBaseDtLapseShift); +} + +extern "C" void ML_BSSN_MP_O8_convertToADMBaseDtLapseShift(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverInterior(cctkGH, &ML_BSSN_MP_O8_convertToADMBaseDtLapseShift_Body); +} diff --git a/ML_BSSN_MP_O8/src/ML_BSSN_MP_O8_convertToADMBaseDtLapseShiftBoundary.cc b/ML_BSSN_MP_O8/src/ML_BSSN_MP_O8_convertToADMBaseDtLapseShiftBoundary.cc new file mode 100644 index 0000000..c5987b2 --- /dev/null +++ b/ML_BSSN_MP_O8/src/ML_BSSN_MP_O8_convertToADMBaseDtLapseShiftBoundary.cc @@ -0,0 +1,171 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +extern "C" void ML_BSSN_MP_O8_convertToADMBaseDtLapseShiftBoundary_SelectBCs(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT ierr = 0; + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ADMBase::dtlapse","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ADMBase::dtlapse."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ADMBase::dtshift","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ADMBase::dtshift."); + return; +} + +static void ML_BSSN_MP_O8_convertToADMBaseDtLapseShiftBoundary_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_BSSN_MP_O8_convertToADMBaseDtLapseShiftBoundary_Body"); + } + + if (cctk_iteration % ML_BSSN_MP_O8_convertToADMBaseDtLapseShiftBoundary_calc_every != ML_BSSN_MP_O8_convertToADMBaseDtLapseShiftBoundary_calc_offset) + { + return; + } + + const char *groups[] = {"ADMBase::dtlapse","ADMBase::dtshift","grid::coordinates","Grid::coordinates","ML_BSSN_MP_O8::ML_dtlapse","ML_BSSN_MP_O8::ML_dtshift","ML_BSSN_MP_O8::ML_Gamma","ML_BSSN_MP_O8::ML_lapse","ML_BSSN_MP_O8::ML_shift","ML_BSSN_MP_O8::ML_trace_curv"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_BSSN_MP_O8_convertToADMBaseDtLapseShiftBoundary", 10, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o1024dx = 0.0009765625*INV(dx); + CCTK_REAL const p1o1024dy = 0.0009765625*INV(dy); + CCTK_REAL const p1o1024dz = 0.0009765625*INV(dz); + CCTK_REAL const p1o1680dx = 0.000595238095238095238095238095238*INV(dx); + CCTK_REAL const p1o1680dy = 0.000595238095238095238095238095238*INV(dy); + CCTK_REAL const p1o1680dz = 0.000595238095238095238095238095238*INV(dz); + CCTK_REAL const p1o5040dx2 = 0.000198412698412698412698412698413*INV(SQR(dx)); + CCTK_REAL const p1o5040dy2 = 0.000198412698412698412698412698413*INV(SQR(dy)); + CCTK_REAL const p1o5040dz2 = 0.000198412698412698412698412698413*INV(SQR(dz)); + CCTK_REAL const p1o560dx = 0.00178571428571428571428571428571*INV(dx); + CCTK_REAL const p1o560dy = 0.00178571428571428571428571428571*INV(dy); + CCTK_REAL const p1o560dz = 0.00178571428571428571428571428571*INV(dz); + CCTK_REAL const p1o705600dxdy = 1.41723356009070294784580498866e-6*INV(dx)*INV(dy); + CCTK_REAL const p1o705600dxdz = 1.41723356009070294784580498866e-6*INV(dx)*INV(dz); + CCTK_REAL const p1o705600dydz = 1.41723356009070294784580498866e-6*INV(dy)*INV(dz); + CCTK_REAL const p1o840dx = 0.00119047619047619047619047619048*INV(dx); + CCTK_REAL const p1o840dy = 0.00119047619047619047619047619048*INV(dy); + CCTK_REAL const p1o840dz = 0.00119047619047619047619047619048*INV(dz); + CCTK_REAL const p1odx = INV(dx); + CCTK_REAL const p1ody = INV(dy); + CCTK_REAL const p1odz = INV(dz); + CCTK_REAL const pm1o840dx = -0.00119047619047619047619047619048*INV(dx); + CCTK_REAL const pm1o840dy = -0.00119047619047619047619047619048*INV(dy); + CCTK_REAL const pm1o840dz = -0.00119047619047619047619047619048*INV(dz); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_BSSN_MP_O8_convertToADMBaseDtLapseShiftBoundary, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + CCTK_REAL AL = A[index]; + CCTK_REAL alphaL = alpha[index]; + CCTK_REAL B1L = B1[index]; + CCTK_REAL B2L = B2[index]; + CCTK_REAL B3L = B3[index]; + CCTK_REAL beta1L = beta1[index]; + CCTK_REAL beta2L = beta2[index]; + CCTK_REAL beta3L = beta3[index]; + CCTK_REAL rL = r[index]; + CCTK_REAL trKL = trK[index]; + CCTK_REAL Xt1L = Xt1[index]; + CCTK_REAL Xt2L = Xt2[index]; + CCTK_REAL Xt3L = Xt3[index]; + + /* Include user supplied include files */ + + /* Precompute derivatives */ + + /* Calculate temporaries and grid functions */ + CCTK_REAL eta = fmin(1,INV(rL)*ToReal(SpatialBetaDriverRadius)); + + CCTK_REAL theta = fmin(1,exp(1 - + rL*INV(ToReal(SpatialShiftGammaCoeffRadius)))); + + CCTK_REAL dtalpL = + -(pow(alphaL,ToReal(harmonicN))*ToReal(harmonicF)*(trKL + (AL - + trKL)*ToReal(LapseACoeff))); + + CCTK_REAL dtbetaxL = theta*(Xt1L + beta1L*eta*ToReal(BetaDriver)*(-1 + + ToReal(ShiftBCoeff)) + (B1L - + Xt1L)*ToReal(ShiftBCoeff))*ToReal(ShiftGammaCoeff); + + CCTK_REAL dtbetayL = theta*(Xt2L + beta2L*eta*ToReal(BetaDriver)*(-1 + + ToReal(ShiftBCoeff)) + (B2L - + Xt2L)*ToReal(ShiftBCoeff))*ToReal(ShiftGammaCoeff); + + CCTK_REAL dtbetazL = theta*(Xt3L + beta3L*eta*ToReal(BetaDriver)*(-1 + + ToReal(ShiftBCoeff)) + (B3L - + Xt3L)*ToReal(ShiftBCoeff))*ToReal(ShiftGammaCoeff); + + + /* Copy local copies back to grid functions */ + dtalp[index] = dtalpL; + dtbetax[index] = dtbetaxL; + dtbetay[index] = dtbetayL; + dtbetaz[index] = dtbetazL; + } + LC_ENDLOOP3 (ML_BSSN_MP_O8_convertToADMBaseDtLapseShiftBoundary); +} + +extern "C" void ML_BSSN_MP_O8_convertToADMBaseDtLapseShiftBoundary(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverBoundaryWithGhosts(cctkGH, &ML_BSSN_MP_O8_convertToADMBaseDtLapseShiftBoundary_Body); +} diff --git a/ML_BSSN_MP_O8/src/ML_BSSN_MP_O8_convertToADMBaseFakeDtLapseShift.cc b/ML_BSSN_MP_O8/src/ML_BSSN_MP_O8_convertToADMBaseFakeDtLapseShift.cc new file mode 100644 index 0000000..cfec3f0 --- /dev/null +++ b/ML_BSSN_MP_O8/src/ML_BSSN_MP_O8_convertToADMBaseFakeDtLapseShift.cc @@ -0,0 +1,156 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +static void ML_BSSN_MP_O8_convertToADMBaseFakeDtLapseShift_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_BSSN_MP_O8_convertToADMBaseFakeDtLapseShift_Body"); + } + + if (cctk_iteration % ML_BSSN_MP_O8_convertToADMBaseFakeDtLapseShift_calc_every != ML_BSSN_MP_O8_convertToADMBaseFakeDtLapseShift_calc_offset) + { + return; + } + + const char *groups[] = {"ADMBase::dtlapse","ADMBase::dtshift","grid::coordinates","Grid::coordinates","ML_BSSN_MP_O8::ML_dtlapse","ML_BSSN_MP_O8::ML_dtshift","ML_BSSN_MP_O8::ML_Gamma","ML_BSSN_MP_O8::ML_lapse","ML_BSSN_MP_O8::ML_shift","ML_BSSN_MP_O8::ML_trace_curv"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_BSSN_MP_O8_convertToADMBaseFakeDtLapseShift", 10, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o1024dx = 0.0009765625*INV(dx); + CCTK_REAL const p1o1024dy = 0.0009765625*INV(dy); + CCTK_REAL const p1o1024dz = 0.0009765625*INV(dz); + CCTK_REAL const p1o1680dx = 0.000595238095238095238095238095238*INV(dx); + CCTK_REAL const p1o1680dy = 0.000595238095238095238095238095238*INV(dy); + CCTK_REAL const p1o1680dz = 0.000595238095238095238095238095238*INV(dz); + CCTK_REAL const p1o5040dx2 = 0.000198412698412698412698412698413*INV(SQR(dx)); + CCTK_REAL const p1o5040dy2 = 0.000198412698412698412698412698413*INV(SQR(dy)); + CCTK_REAL const p1o5040dz2 = 0.000198412698412698412698412698413*INV(SQR(dz)); + CCTK_REAL const p1o560dx = 0.00178571428571428571428571428571*INV(dx); + CCTK_REAL const p1o560dy = 0.00178571428571428571428571428571*INV(dy); + CCTK_REAL const p1o560dz = 0.00178571428571428571428571428571*INV(dz); + CCTK_REAL const p1o705600dxdy = 1.41723356009070294784580498866e-6*INV(dx)*INV(dy); + CCTK_REAL const p1o705600dxdz = 1.41723356009070294784580498866e-6*INV(dx)*INV(dz); + CCTK_REAL const p1o705600dydz = 1.41723356009070294784580498866e-6*INV(dy)*INV(dz); + CCTK_REAL const p1o840dx = 0.00119047619047619047619047619048*INV(dx); + CCTK_REAL const p1o840dy = 0.00119047619047619047619047619048*INV(dy); + CCTK_REAL const p1o840dz = 0.00119047619047619047619047619048*INV(dz); + CCTK_REAL const p1odx = INV(dx); + CCTK_REAL const p1ody = INV(dy); + CCTK_REAL const p1odz = INV(dz); + CCTK_REAL const pm1o840dx = -0.00119047619047619047619047619048*INV(dx); + CCTK_REAL const pm1o840dy = -0.00119047619047619047619047619048*INV(dy); + CCTK_REAL const pm1o840dz = -0.00119047619047619047619047619048*INV(dz); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_BSSN_MP_O8_convertToADMBaseFakeDtLapseShift, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + CCTK_REAL AL = A[index]; + CCTK_REAL alphaL = alpha[index]; + CCTK_REAL B1L = B1[index]; + CCTK_REAL B2L = B2[index]; + CCTK_REAL B3L = B3[index]; + CCTK_REAL beta1L = beta1[index]; + CCTK_REAL beta2L = beta2[index]; + CCTK_REAL beta3L = beta3[index]; + CCTK_REAL rL = r[index]; + CCTK_REAL trKL = trK[index]; + CCTK_REAL Xt1L = Xt1[index]; + CCTK_REAL Xt2L = Xt2[index]; + CCTK_REAL Xt3L = Xt3[index]; + + /* Include user supplied include files */ + + /* Precompute derivatives */ + + /* Calculate temporaries and grid functions */ + CCTK_REAL eta = fmin(1,INV(rL)*ToReal(SpatialBetaDriverRadius)); + + CCTK_REAL theta = fmin(1,exp(1 - + rL*INV(ToReal(SpatialShiftGammaCoeffRadius)))); + + CCTK_REAL dtalpL = + -(pow(alphaL,ToReal(harmonicN))*ToReal(harmonicF)*(trKL + (AL - + trKL)*ToReal(LapseACoeff))); + + CCTK_REAL dtbetaxL = theta*(Xt1L + beta1L*eta*ToReal(BetaDriver)*(-1 + + ToReal(ShiftBCoeff)) + (B1L - + Xt1L)*ToReal(ShiftBCoeff))*ToReal(ShiftGammaCoeff); + + CCTK_REAL dtbetayL = theta*(Xt2L + beta2L*eta*ToReal(BetaDriver)*(-1 + + ToReal(ShiftBCoeff)) + (B2L - + Xt2L)*ToReal(ShiftBCoeff))*ToReal(ShiftGammaCoeff); + + CCTK_REAL dtbetazL = theta*(Xt3L + beta3L*eta*ToReal(BetaDriver)*(-1 + + ToReal(ShiftBCoeff)) + (B3L - + Xt3L)*ToReal(ShiftBCoeff))*ToReal(ShiftGammaCoeff); + + + /* Copy local copies back to grid functions */ + dtalp[index] = dtalpL; + dtbetax[index] = dtbetaxL; + dtbetay[index] = dtbetayL; + dtbetaz[index] = dtbetazL; + } + LC_ENDLOOP3 (ML_BSSN_MP_O8_convertToADMBaseFakeDtLapseShift); +} + +extern "C" void ML_BSSN_MP_O8_convertToADMBaseFakeDtLapseShift(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverEverything(cctkGH, &ML_BSSN_MP_O8_convertToADMBaseFakeDtLapseShift_Body); +} diff --git a/ML_BSSN_MP_O8/src/ML_BSSN_MP_O8_enforce.cc b/ML_BSSN_MP_O8/src/ML_BSSN_MP_O8_enforce.cc new file mode 100644 index 0000000..f41bd9b --- /dev/null +++ b/ML_BSSN_MP_O8/src/ML_BSSN_MP_O8_enforce.cc @@ -0,0 +1,169 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +static void ML_BSSN_MP_O8_enforce_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_BSSN_MP_O8_enforce_Body"); + } + + if (cctk_iteration % ML_BSSN_MP_O8_enforce_calc_every != ML_BSSN_MP_O8_enforce_calc_offset) + { + return; + } + + const char *groups[] = {"ML_BSSN_MP_O8::ML_curv","ML_BSSN_MP_O8::ML_lapse","ML_BSSN_MP_O8::ML_metric"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_BSSN_MP_O8_enforce", 3, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o1024dx = 0.0009765625*INV(dx); + CCTK_REAL const p1o1024dy = 0.0009765625*INV(dy); + CCTK_REAL const p1o1024dz = 0.0009765625*INV(dz); + CCTK_REAL const p1o1680dx = 0.000595238095238095238095238095238*INV(dx); + CCTK_REAL const p1o1680dy = 0.000595238095238095238095238095238*INV(dy); + CCTK_REAL const p1o1680dz = 0.000595238095238095238095238095238*INV(dz); + CCTK_REAL const p1o5040dx2 = 0.000198412698412698412698412698413*INV(SQR(dx)); + CCTK_REAL const p1o5040dy2 = 0.000198412698412698412698412698413*INV(SQR(dy)); + CCTK_REAL const p1o5040dz2 = 0.000198412698412698412698412698413*INV(SQR(dz)); + CCTK_REAL const p1o560dx = 0.00178571428571428571428571428571*INV(dx); + CCTK_REAL const p1o560dy = 0.00178571428571428571428571428571*INV(dy); + CCTK_REAL const p1o560dz = 0.00178571428571428571428571428571*INV(dz); + CCTK_REAL const p1o705600dxdy = 1.41723356009070294784580498866e-6*INV(dx)*INV(dy); + CCTK_REAL const p1o705600dxdz = 1.41723356009070294784580498866e-6*INV(dx)*INV(dz); + CCTK_REAL const p1o705600dydz = 1.41723356009070294784580498866e-6*INV(dy)*INV(dz); + CCTK_REAL const p1o840dx = 0.00119047619047619047619047619048*INV(dx); + CCTK_REAL const p1o840dy = 0.00119047619047619047619047619048*INV(dy); + CCTK_REAL const p1o840dz = 0.00119047619047619047619047619048*INV(dz); + CCTK_REAL const p1odx = INV(dx); + CCTK_REAL const p1ody = INV(dy); + CCTK_REAL const p1odz = INV(dz); + CCTK_REAL const pm1o840dx = -0.00119047619047619047619047619048*INV(dx); + CCTK_REAL const pm1o840dy = -0.00119047619047619047619047619048*INV(dy); + CCTK_REAL const pm1o840dz = -0.00119047619047619047619047619048*INV(dz); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_BSSN_MP_O8_enforce, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + CCTK_REAL alphaL = alpha[index]; + CCTK_REAL At11L = At11[index]; + CCTK_REAL At12L = At12[index]; + CCTK_REAL At13L = At13[index]; + CCTK_REAL At22L = At22[index]; + CCTK_REAL At23L = At23[index]; + CCTK_REAL At33L = At33[index]; + CCTK_REAL gt11L = gt11[index]; + CCTK_REAL gt12L = gt12[index]; + CCTK_REAL gt13L = gt13[index]; + CCTK_REAL gt22L = gt22[index]; + CCTK_REAL gt23L = gt23[index]; + CCTK_REAL gt33L = gt33[index]; + + /* Include user supplied include files */ + + /* Precompute derivatives */ + + /* Calculate temporaries and grid functions */ + CCTK_REAL detgt = 1; + + CCTK_REAL gtu11 = INV(detgt)*(gt22L*gt33L - SQR(gt23L)); + + CCTK_REAL gtu12 = (gt13L*gt23L - gt12L*gt33L)*INV(detgt); + + CCTK_REAL gtu13 = (-(gt13L*gt22L) + gt12L*gt23L)*INV(detgt); + + CCTK_REAL gtu22 = INV(detgt)*(gt11L*gt33L - SQR(gt13L)); + + CCTK_REAL gtu23 = (gt12L*gt13L - gt11L*gt23L)*INV(detgt); + + CCTK_REAL gtu33 = INV(detgt)*(gt11L*gt22L - SQR(gt12L)); + + CCTK_REAL trAt = At11L*gtu11 + At22L*gtu22 + 2*(At12L*gtu12 + + At13L*gtu13 + At23L*gtu23) + At33L*gtu33; + + At11L = At11L - 0.333333333333333333333333333333*gt11L*trAt; + + At12L = At12L - 0.333333333333333333333333333333*gt12L*trAt; + + At13L = At13L - 0.333333333333333333333333333333*gt13L*trAt; + + At22L = At22L - 0.333333333333333333333333333333*gt22L*trAt; + + At23L = At23L - 0.333333333333333333333333333333*gt23L*trAt; + + At33L = At33L - 0.333333333333333333333333333333*gt33L*trAt; + + alphaL = fmax(alphaL,ToReal(MinimumLapse)); + + + /* Copy local copies back to grid functions */ + alpha[index] = alphaL; + At11[index] = At11L; + At12[index] = At12L; + At13[index] = At13L; + At22[index] = At22L; + At23[index] = At23L; + At33[index] = At33L; + } + LC_ENDLOOP3 (ML_BSSN_MP_O8_enforce); +} + +extern "C" void ML_BSSN_MP_O8_enforce(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverEverything(cctkGH, &ML_BSSN_MP_O8_enforce_Body); +} diff --git a/ML_BSSN_MP_O8/src/RegisterMoL.cc b/ML_BSSN_MP_O8/src/RegisterMoL.cc new file mode 100644 index 0000000..906588d --- /dev/null +++ b/ML_BSSN_MP_O8/src/RegisterMoL.cc @@ -0,0 +1,41 @@ +/* File produced by Kranc */ + +#include "cctk.h" +#include "cctk_Arguments.h" +#include "cctk_Parameters.h" + +extern "C" void ML_BSSN_MP_O8_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_BSSN_MP_O8::At11"), CCTK_VarIndex("ML_BSSN_MP_O8::At11rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_MP_O8::At12"), CCTK_VarIndex("ML_BSSN_MP_O8::At12rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_MP_O8::At13"), CCTK_VarIndex("ML_BSSN_MP_O8::At13rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_MP_O8::At22"), CCTK_VarIndex("ML_BSSN_MP_O8::At22rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_MP_O8::At23"), CCTK_VarIndex("ML_BSSN_MP_O8::At23rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_MP_O8::At33"), CCTK_VarIndex("ML_BSSN_MP_O8::At33rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_MP_O8::A"), CCTK_VarIndex("ML_BSSN_MP_O8::Arhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_MP_O8::B1"), CCTK_VarIndex("ML_BSSN_MP_O8::B1rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_MP_O8::B2"), CCTK_VarIndex("ML_BSSN_MP_O8::B2rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_MP_O8::B3"), CCTK_VarIndex("ML_BSSN_MP_O8::B3rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_MP_O8::Xt1"), CCTK_VarIndex("ML_BSSN_MP_O8::Xt1rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_MP_O8::Xt2"), CCTK_VarIndex("ML_BSSN_MP_O8::Xt2rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_MP_O8::Xt3"), CCTK_VarIndex("ML_BSSN_MP_O8::Xt3rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_MP_O8::alpha"), CCTK_VarIndex("ML_BSSN_MP_O8::alpharhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_MP_O8::phi"), CCTK_VarIndex("ML_BSSN_MP_O8::phirhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_MP_O8::gt11"), CCTK_VarIndex("ML_BSSN_MP_O8::gt11rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_MP_O8::gt12"), CCTK_VarIndex("ML_BSSN_MP_O8::gt12rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_MP_O8::gt13"), CCTK_VarIndex("ML_BSSN_MP_O8::gt13rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_MP_O8::gt22"), CCTK_VarIndex("ML_BSSN_MP_O8::gt22rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_MP_O8::gt23"), CCTK_VarIndex("ML_BSSN_MP_O8::gt23rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_MP_O8::gt33"), CCTK_VarIndex("ML_BSSN_MP_O8::gt33rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_MP_O8::beta1"), CCTK_VarIndex("ML_BSSN_MP_O8::beta1rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_MP_O8::beta2"), CCTK_VarIndex("ML_BSSN_MP_O8::beta2rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_MP_O8::beta3"), CCTK_VarIndex("ML_BSSN_MP_O8::beta3rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_MP_O8::trK"), CCTK_VarIndex("ML_BSSN_MP_O8::trKrhs")); + return; +} diff --git a/ML_BSSN_MP_O8/src/RegisterSymmetries.cc b/ML_BSSN_MP_O8/src/RegisterSymmetries.cc new file mode 100644 index 0000000..9fc5aa8 --- /dev/null +++ b/ML_BSSN_MP_O8/src/RegisterSymmetries.cc @@ -0,0 +1,189 @@ +/* File produced by Kranc */ + +#include "cctk.h" +#include "cctk_Arguments.h" +#include "cctk_Parameters.h" +#include "Symmetry.h" + +extern "C" void ML_BSSN_MP_O8_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_BSSN_MP_O8::At11"); + + sym[0] = -1; + sym[1] = -1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_MP_O8::At12"); + + sym[0] = -1; + sym[1] = 1; + sym[2] = -1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_MP_O8::At13"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_MP_O8::At22"); + + sym[0] = 1; + sym[1] = -1; + sym[2] = -1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_MP_O8::At23"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_MP_O8::At33"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_MP_O8::A"); + + sym[0] = -1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_MP_O8::B1"); + + sym[0] = 1; + sym[1] = -1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_MP_O8::B2"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = -1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_MP_O8::B3"); + + sym[0] = -1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_MP_O8::Xt1"); + + sym[0] = 1; + sym[1] = -1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_MP_O8::Xt2"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = -1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_MP_O8::Xt3"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_MP_O8::alpha"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_MP_O8::phi"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_MP_O8::gt11"); + + sym[0] = -1; + sym[1] = -1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_MP_O8::gt12"); + + sym[0] = -1; + sym[1] = 1; + sym[2] = -1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_MP_O8::gt13"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_MP_O8::gt22"); + + sym[0] = 1; + sym[1] = -1; + sym[2] = -1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_MP_O8::gt23"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_MP_O8::gt33"); + + sym[0] = -1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_MP_O8::beta1"); + + sym[0] = 1; + sym[1] = -1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_MP_O8::beta2"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = -1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_MP_O8::beta3"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_MP_O8::trK"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_MP_O8::cS"); + + sym[0] = -1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_MP_O8::cXt1"); + + sym[0] = 1; + sym[1] = -1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_MP_O8::cXt2"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = -1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_MP_O8::cXt3"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_MP_O8::cA"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_MP_O8::H"); + + sym[0] = -1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_MP_O8::M1"); + + sym[0] = 1; + sym[1] = -1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_MP_O8::M2"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = -1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_MP_O8::M3"); + +} diff --git a/ML_BSSN_MP_O8/src/Startup.cc b/ML_BSSN_MP_O8/src/Startup.cc new file mode 100644 index 0000000..2e3fa38 --- /dev/null +++ b/ML_BSSN_MP_O8/src/Startup.cc @@ -0,0 +1,10 @@ +/* File produced by Kranc */ + +#include "cctk.h" + +extern "C" int ML_BSSN_MP_O8_Startup(void) +{ + const char * banner = "ML_BSSN_MP_O8"; + CCTK_RegisterBanner(banner); + return 0; +} diff --git a/ML_BSSN_O2/src/Boundaries.cc b/ML_BSSN_O2/src/Boundaries.cc new file mode 100644 index 0000000..e711921 --- /dev/null +++ b/ML_BSSN_O2/src/Boundaries.cc @@ -0,0 +1,1809 @@ +/* File produced by Kranc */ + +#include "cctk.h" +#include "cctk_Arguments.h" +#include "cctk_Parameters.h" +#include "cctk_Faces.h" +#include "util_Table.h" +#include "Symmetry.h" + + +/* the boundary treatment is split into 3 steps: */ +/* 1. excision */ +/* 2. symmetries */ +/* 3. "other" boundary conditions, e.g. radiative */ + +/* to simplify scheduling and testing, the 3 steps */ +/* are currently applied in separate functions */ + + +extern "C" void ML_BSSN_O2_CheckBoundaries(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + return; +} + +extern "C" void ML_BSSN_O2_SelectBoundConds(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT ierr = 0; + + if (CCTK_EQUALS(ML_curv_bound, "none" ) || + CCTK_EQUALS(ML_curv_bound, "static") || + CCTK_EQUALS(ML_curv_bound, "flat" ) || + CCTK_EQUALS(ML_curv_bound, "zero" ) ) + { + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_O2::ML_curv", ML_curv_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register ML_curv_bound BC for ML_BSSN_O2::ML_curv!"); + } + + if (CCTK_EQUALS(ML_dtlapse_bound, "none" ) || + CCTK_EQUALS(ML_dtlapse_bound, "static") || + CCTK_EQUALS(ML_dtlapse_bound, "flat" ) || + CCTK_EQUALS(ML_dtlapse_bound, "zero" ) ) + { + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_O2::ML_dtlapse", ML_dtlapse_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register ML_dtlapse_bound BC for ML_BSSN_O2::ML_dtlapse!"); + } + + if (CCTK_EQUALS(ML_dtshift_bound, "none" ) || + CCTK_EQUALS(ML_dtshift_bound, "static") || + CCTK_EQUALS(ML_dtshift_bound, "flat" ) || + CCTK_EQUALS(ML_dtshift_bound, "zero" ) ) + { + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_O2::ML_dtshift", ML_dtshift_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register ML_dtshift_bound BC for ML_BSSN_O2::ML_dtshift!"); + } + + if (CCTK_EQUALS(ML_Gamma_bound, "none" ) || + CCTK_EQUALS(ML_Gamma_bound, "static") || + CCTK_EQUALS(ML_Gamma_bound, "flat" ) || + CCTK_EQUALS(ML_Gamma_bound, "zero" ) ) + { + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_O2::ML_Gamma", ML_Gamma_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register ML_Gamma_bound BC for ML_BSSN_O2::ML_Gamma!"); + } + + if (CCTK_EQUALS(ML_lapse_bound, "none" ) || + CCTK_EQUALS(ML_lapse_bound, "static") || + CCTK_EQUALS(ML_lapse_bound, "flat" ) || + CCTK_EQUALS(ML_lapse_bound, "zero" ) ) + { + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_O2::ML_lapse", ML_lapse_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register ML_lapse_bound BC for ML_BSSN_O2::ML_lapse!"); + } + + if (CCTK_EQUALS(ML_log_confac_bound, "none" ) || + CCTK_EQUALS(ML_log_confac_bound, "static") || + CCTK_EQUALS(ML_log_confac_bound, "flat" ) || + CCTK_EQUALS(ML_log_confac_bound, "zero" ) ) + { + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_O2::ML_log_confac", ML_log_confac_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register ML_log_confac_bound BC for ML_BSSN_O2::ML_log_confac!"); + } + + if (CCTK_EQUALS(ML_metric_bound, "none" ) || + CCTK_EQUALS(ML_metric_bound, "static") || + CCTK_EQUALS(ML_metric_bound, "flat" ) || + CCTK_EQUALS(ML_metric_bound, "zero" ) ) + { + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_O2::ML_metric", ML_metric_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register ML_metric_bound BC for ML_BSSN_O2::ML_metric!"); + } + + if (CCTK_EQUALS(ML_shift_bound, "none" ) || + CCTK_EQUALS(ML_shift_bound, "static") || + CCTK_EQUALS(ML_shift_bound, "flat" ) || + CCTK_EQUALS(ML_shift_bound, "zero" ) ) + { + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_O2::ML_shift", ML_shift_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register ML_shift_bound BC for ML_BSSN_O2::ML_shift!"); + } + + if (CCTK_EQUALS(ML_trace_curv_bound, "none" ) || + CCTK_EQUALS(ML_trace_curv_bound, "static") || + CCTK_EQUALS(ML_trace_curv_bound, "flat" ) || + CCTK_EQUALS(ML_trace_curv_bound, "zero" ) ) + { + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_O2::ML_trace_curv", ML_trace_curv_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register ML_trace_curv_bound BC for ML_BSSN_O2::ML_trace_curv!"); + } + + if (CCTK_EQUALS(At11_bound, "none" ) || + CCTK_EQUALS(At11_bound, "static") || + CCTK_EQUALS(At11_bound, "flat" ) || + CCTK_EQUALS(At11_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_O2::At11", At11_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register At11_bound BC for ML_BSSN_O2::At11!"); + } + + if (CCTK_EQUALS(At12_bound, "none" ) || + CCTK_EQUALS(At12_bound, "static") || + CCTK_EQUALS(At12_bound, "flat" ) || + CCTK_EQUALS(At12_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_O2::At12", At12_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register At12_bound BC for ML_BSSN_O2::At12!"); + } + + if (CCTK_EQUALS(At13_bound, "none" ) || + CCTK_EQUALS(At13_bound, "static") || + CCTK_EQUALS(At13_bound, "flat" ) || + CCTK_EQUALS(At13_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_O2::At13", At13_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register At13_bound BC for ML_BSSN_O2::At13!"); + } + + if (CCTK_EQUALS(At22_bound, "none" ) || + CCTK_EQUALS(At22_bound, "static") || + CCTK_EQUALS(At22_bound, "flat" ) || + CCTK_EQUALS(At22_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_O2::At22", At22_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register At22_bound BC for ML_BSSN_O2::At22!"); + } + + if (CCTK_EQUALS(At23_bound, "none" ) || + CCTK_EQUALS(At23_bound, "static") || + CCTK_EQUALS(At23_bound, "flat" ) || + CCTK_EQUALS(At23_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_O2::At23", At23_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register At23_bound BC for ML_BSSN_O2::At23!"); + } + + if (CCTK_EQUALS(At33_bound, "none" ) || + CCTK_EQUALS(At33_bound, "static") || + CCTK_EQUALS(At33_bound, "flat" ) || + CCTK_EQUALS(At33_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_O2::At33", At33_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register At33_bound BC for ML_BSSN_O2::At33!"); + } + + if (CCTK_EQUALS(A_bound, "none" ) || + CCTK_EQUALS(A_bound, "static") || + CCTK_EQUALS(A_bound, "flat" ) || + CCTK_EQUALS(A_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_O2::A", A_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register A_bound BC for ML_BSSN_O2::A!"); + } + + if (CCTK_EQUALS(B1_bound, "none" ) || + CCTK_EQUALS(B1_bound, "static") || + CCTK_EQUALS(B1_bound, "flat" ) || + CCTK_EQUALS(B1_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_O2::B1", B1_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register B1_bound BC for ML_BSSN_O2::B1!"); + } + + if (CCTK_EQUALS(B2_bound, "none" ) || + CCTK_EQUALS(B2_bound, "static") || + CCTK_EQUALS(B2_bound, "flat" ) || + CCTK_EQUALS(B2_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_O2::B2", B2_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register B2_bound BC for ML_BSSN_O2::B2!"); + } + + if (CCTK_EQUALS(B3_bound, "none" ) || + CCTK_EQUALS(B3_bound, "static") || + CCTK_EQUALS(B3_bound, "flat" ) || + CCTK_EQUALS(B3_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_O2::B3", B3_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register B3_bound BC for ML_BSSN_O2::B3!"); + } + + if (CCTK_EQUALS(Xt1_bound, "none" ) || + CCTK_EQUALS(Xt1_bound, "static") || + CCTK_EQUALS(Xt1_bound, "flat" ) || + CCTK_EQUALS(Xt1_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_O2::Xt1", Xt1_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register Xt1_bound BC for ML_BSSN_O2::Xt1!"); + } + + if (CCTK_EQUALS(Xt2_bound, "none" ) || + CCTK_EQUALS(Xt2_bound, "static") || + CCTK_EQUALS(Xt2_bound, "flat" ) || + CCTK_EQUALS(Xt2_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_O2::Xt2", Xt2_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register Xt2_bound BC for ML_BSSN_O2::Xt2!"); + } + + if (CCTK_EQUALS(Xt3_bound, "none" ) || + CCTK_EQUALS(Xt3_bound, "static") || + CCTK_EQUALS(Xt3_bound, "flat" ) || + CCTK_EQUALS(Xt3_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_O2::Xt3", Xt3_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register Xt3_bound BC for ML_BSSN_O2::Xt3!"); + } + + if (CCTK_EQUALS(alpha_bound, "none" ) || + CCTK_EQUALS(alpha_bound, "static") || + CCTK_EQUALS(alpha_bound, "flat" ) || + CCTK_EQUALS(alpha_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_O2::alpha", alpha_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register alpha_bound BC for ML_BSSN_O2::alpha!"); + } + + if (CCTK_EQUALS(phi_bound, "none" ) || + CCTK_EQUALS(phi_bound, "static") || + CCTK_EQUALS(phi_bound, "flat" ) || + CCTK_EQUALS(phi_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_O2::phi", phi_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register phi_bound BC for ML_BSSN_O2::phi!"); + } + + if (CCTK_EQUALS(gt11_bound, "none" ) || + CCTK_EQUALS(gt11_bound, "static") || + CCTK_EQUALS(gt11_bound, "flat" ) || + CCTK_EQUALS(gt11_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_O2::gt11", gt11_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register gt11_bound BC for ML_BSSN_O2::gt11!"); + } + + if (CCTK_EQUALS(gt12_bound, "none" ) || + CCTK_EQUALS(gt12_bound, "static") || + CCTK_EQUALS(gt12_bound, "flat" ) || + CCTK_EQUALS(gt12_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_O2::gt12", gt12_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register gt12_bound BC for ML_BSSN_O2::gt12!"); + } + + if (CCTK_EQUALS(gt13_bound, "none" ) || + CCTK_EQUALS(gt13_bound, "static") || + CCTK_EQUALS(gt13_bound, "flat" ) || + CCTK_EQUALS(gt13_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_O2::gt13", gt13_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register gt13_bound BC for ML_BSSN_O2::gt13!"); + } + + if (CCTK_EQUALS(gt22_bound, "none" ) || + CCTK_EQUALS(gt22_bound, "static") || + CCTK_EQUALS(gt22_bound, "flat" ) || + CCTK_EQUALS(gt22_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_O2::gt22", gt22_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register gt22_bound BC for ML_BSSN_O2::gt22!"); + } + + if (CCTK_EQUALS(gt23_bound, "none" ) || + CCTK_EQUALS(gt23_bound, "static") || + CCTK_EQUALS(gt23_bound, "flat" ) || + CCTK_EQUALS(gt23_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_O2::gt23", gt23_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register gt23_bound BC for ML_BSSN_O2::gt23!"); + } + + if (CCTK_EQUALS(gt33_bound, "none" ) || + CCTK_EQUALS(gt33_bound, "static") || + CCTK_EQUALS(gt33_bound, "flat" ) || + CCTK_EQUALS(gt33_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_O2::gt33", gt33_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register gt33_bound BC for ML_BSSN_O2::gt33!"); + } + + if (CCTK_EQUALS(beta1_bound, "none" ) || + CCTK_EQUALS(beta1_bound, "static") || + CCTK_EQUALS(beta1_bound, "flat" ) || + CCTK_EQUALS(beta1_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_O2::beta1", beta1_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register beta1_bound BC for ML_BSSN_O2::beta1!"); + } + + if (CCTK_EQUALS(beta2_bound, "none" ) || + CCTK_EQUALS(beta2_bound, "static") || + CCTK_EQUALS(beta2_bound, "flat" ) || + CCTK_EQUALS(beta2_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_O2::beta2", beta2_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register beta2_bound BC for ML_BSSN_O2::beta2!"); + } + + if (CCTK_EQUALS(beta3_bound, "none" ) || + CCTK_EQUALS(beta3_bound, "static") || + CCTK_EQUALS(beta3_bound, "flat" ) || + CCTK_EQUALS(beta3_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_O2::beta3", beta3_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register beta3_bound BC for ML_BSSN_O2::beta3!"); + } + + if (CCTK_EQUALS(trK_bound, "none" ) || + CCTK_EQUALS(trK_bound, "static") || + CCTK_EQUALS(trK_bound, "flat" ) || + CCTK_EQUALS(trK_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_O2::trK", trK_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register trK_bound BC for ML_BSSN_O2::trK!"); + } + + if (CCTK_EQUALS(ML_curv_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_ML_curv_bound = -1; + if (handle_ML_curv_bound < 0) handle_ML_curv_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_curv_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_curv_bound , ML_curv_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_ML_curv_bound ,ML_curv_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_curv_bound, + "ML_BSSN_O2::ML_curv", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_O2::ML_curv!"); + + } + + if (CCTK_EQUALS(ML_dtlapse_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_ML_dtlapse_bound = -1; + if (handle_ML_dtlapse_bound < 0) handle_ML_dtlapse_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_dtlapse_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_dtlapse_bound , ML_dtlapse_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_ML_dtlapse_bound ,ML_dtlapse_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_dtlapse_bound, + "ML_BSSN_O2::ML_dtlapse", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_O2::ML_dtlapse!"); + + } + + if (CCTK_EQUALS(ML_dtshift_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_ML_dtshift_bound = -1; + if (handle_ML_dtshift_bound < 0) handle_ML_dtshift_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_dtshift_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_dtshift_bound , ML_dtshift_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_ML_dtshift_bound ,ML_dtshift_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_dtshift_bound, + "ML_BSSN_O2::ML_dtshift", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_O2::ML_dtshift!"); + + } + + if (CCTK_EQUALS(ML_Gamma_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_ML_Gamma_bound = -1; + if (handle_ML_Gamma_bound < 0) handle_ML_Gamma_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_Gamma_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_Gamma_bound , ML_Gamma_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_ML_Gamma_bound ,ML_Gamma_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_Gamma_bound, + "ML_BSSN_O2::ML_Gamma", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_O2::ML_Gamma!"); + + } + + if (CCTK_EQUALS(ML_lapse_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_ML_lapse_bound = -1; + if (handle_ML_lapse_bound < 0) handle_ML_lapse_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_lapse_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_lapse_bound , ML_lapse_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_ML_lapse_bound ,ML_lapse_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_lapse_bound, + "ML_BSSN_O2::ML_lapse", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_O2::ML_lapse!"); + + } + + if (CCTK_EQUALS(ML_log_confac_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_ML_log_confac_bound = -1; + if (handle_ML_log_confac_bound < 0) handle_ML_log_confac_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_log_confac_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_log_confac_bound , ML_log_confac_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_ML_log_confac_bound ,ML_log_confac_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_log_confac_bound, + "ML_BSSN_O2::ML_log_confac", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_O2::ML_log_confac!"); + + } + + if (CCTK_EQUALS(ML_metric_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_ML_metric_bound = -1; + if (handle_ML_metric_bound < 0) handle_ML_metric_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_metric_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_metric_bound , ML_metric_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_ML_metric_bound ,ML_metric_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_metric_bound, + "ML_BSSN_O2::ML_metric", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_O2::ML_metric!"); + + } + + if (CCTK_EQUALS(ML_shift_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_ML_shift_bound = -1; + if (handle_ML_shift_bound < 0) handle_ML_shift_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_shift_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_shift_bound , ML_shift_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_ML_shift_bound ,ML_shift_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_shift_bound, + "ML_BSSN_O2::ML_shift", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_O2::ML_shift!"); + + } + + if (CCTK_EQUALS(ML_trace_curv_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_ML_trace_curv_bound = -1; + if (handle_ML_trace_curv_bound < 0) handle_ML_trace_curv_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_trace_curv_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_trace_curv_bound , ML_trace_curv_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_ML_trace_curv_bound ,ML_trace_curv_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_trace_curv_bound, + "ML_BSSN_O2::ML_trace_curv", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_O2::ML_trace_curv!"); + + } + + if (CCTK_EQUALS(At11_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_At11_bound = -1; + if (handle_At11_bound < 0) handle_At11_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_At11_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_At11_bound , At11_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_At11_bound ,At11_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_At11_bound, + "ML_BSSN_O2::At11", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_O2::At11!"); + + } + + if (CCTK_EQUALS(At12_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_At12_bound = -1; + if (handle_At12_bound < 0) handle_At12_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_At12_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_At12_bound , At12_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_At12_bound ,At12_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_At12_bound, + "ML_BSSN_O2::At12", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_O2::At12!"); + + } + + if (CCTK_EQUALS(At13_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_At13_bound = -1; + if (handle_At13_bound < 0) handle_At13_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_At13_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_At13_bound , At13_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_At13_bound ,At13_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_At13_bound, + "ML_BSSN_O2::At13", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_O2::At13!"); + + } + + if (CCTK_EQUALS(At22_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_At22_bound = -1; + if (handle_At22_bound < 0) handle_At22_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_At22_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_At22_bound , At22_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_At22_bound ,At22_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_At22_bound, + "ML_BSSN_O2::At22", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_O2::At22!"); + + } + + if (CCTK_EQUALS(At23_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_At23_bound = -1; + if (handle_At23_bound < 0) handle_At23_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_At23_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_At23_bound , At23_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_At23_bound ,At23_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_At23_bound, + "ML_BSSN_O2::At23", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_O2::At23!"); + + } + + if (CCTK_EQUALS(At33_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_At33_bound = -1; + if (handle_At33_bound < 0) handle_At33_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_At33_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_At33_bound , At33_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_At33_bound ,At33_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_At33_bound, + "ML_BSSN_O2::At33", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_O2::At33!"); + + } + + if (CCTK_EQUALS(A_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_A_bound = -1; + if (handle_A_bound < 0) handle_A_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_A_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_A_bound , A_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_A_bound ,A_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_A_bound, + "ML_BSSN_O2::A", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_O2::A!"); + + } + + if (CCTK_EQUALS(B1_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_B1_bound = -1; + if (handle_B1_bound < 0) handle_B1_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_B1_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_B1_bound , B1_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_B1_bound ,B1_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_B1_bound, + "ML_BSSN_O2::B1", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_O2::B1!"); + + } + + if (CCTK_EQUALS(B2_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_B2_bound = -1; + if (handle_B2_bound < 0) handle_B2_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_B2_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_B2_bound , B2_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_B2_bound ,B2_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_B2_bound, + "ML_BSSN_O2::B2", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_O2::B2!"); + + } + + if (CCTK_EQUALS(B3_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_B3_bound = -1; + if (handle_B3_bound < 0) handle_B3_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_B3_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_B3_bound , B3_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_B3_bound ,B3_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_B3_bound, + "ML_BSSN_O2::B3", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_O2::B3!"); + + } + + if (CCTK_EQUALS(Xt1_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_Xt1_bound = -1; + if (handle_Xt1_bound < 0) handle_Xt1_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_Xt1_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_Xt1_bound , Xt1_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_Xt1_bound ,Xt1_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_Xt1_bound, + "ML_BSSN_O2::Xt1", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_O2::Xt1!"); + + } + + if (CCTK_EQUALS(Xt2_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_Xt2_bound = -1; + if (handle_Xt2_bound < 0) handle_Xt2_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_Xt2_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_Xt2_bound , Xt2_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_Xt2_bound ,Xt2_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_Xt2_bound, + "ML_BSSN_O2::Xt2", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_O2::Xt2!"); + + } + + if (CCTK_EQUALS(Xt3_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_Xt3_bound = -1; + if (handle_Xt3_bound < 0) handle_Xt3_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_Xt3_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_Xt3_bound , Xt3_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_Xt3_bound ,Xt3_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_Xt3_bound, + "ML_BSSN_O2::Xt3", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_O2::Xt3!"); + + } + + if (CCTK_EQUALS(alpha_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_alpha_bound = -1; + if (handle_alpha_bound < 0) handle_alpha_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_alpha_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_alpha_bound , alpha_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_alpha_bound ,alpha_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_alpha_bound, + "ML_BSSN_O2::alpha", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_O2::alpha!"); + + } + + if (CCTK_EQUALS(phi_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_phi_bound = -1; + if (handle_phi_bound < 0) handle_phi_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_phi_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_phi_bound , phi_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_phi_bound ,phi_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_phi_bound, + "ML_BSSN_O2::phi", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_O2::phi!"); + + } + + if (CCTK_EQUALS(gt11_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_gt11_bound = -1; + if (handle_gt11_bound < 0) handle_gt11_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_gt11_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_gt11_bound , gt11_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_gt11_bound ,gt11_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_gt11_bound, + "ML_BSSN_O2::gt11", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_O2::gt11!"); + + } + + if (CCTK_EQUALS(gt12_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_gt12_bound = -1; + if (handle_gt12_bound < 0) handle_gt12_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_gt12_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_gt12_bound , gt12_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_gt12_bound ,gt12_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_gt12_bound, + "ML_BSSN_O2::gt12", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_O2::gt12!"); + + } + + if (CCTK_EQUALS(gt13_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_gt13_bound = -1; + if (handle_gt13_bound < 0) handle_gt13_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_gt13_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_gt13_bound , gt13_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_gt13_bound ,gt13_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_gt13_bound, + "ML_BSSN_O2::gt13", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_O2::gt13!"); + + } + + if (CCTK_EQUALS(gt22_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_gt22_bound = -1; + if (handle_gt22_bound < 0) handle_gt22_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_gt22_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_gt22_bound , gt22_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_gt22_bound ,gt22_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_gt22_bound, + "ML_BSSN_O2::gt22", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_O2::gt22!"); + + } + + if (CCTK_EQUALS(gt23_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_gt23_bound = -1; + if (handle_gt23_bound < 0) handle_gt23_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_gt23_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_gt23_bound , gt23_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_gt23_bound ,gt23_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_gt23_bound, + "ML_BSSN_O2::gt23", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_O2::gt23!"); + + } + + if (CCTK_EQUALS(gt33_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_gt33_bound = -1; + if (handle_gt33_bound < 0) handle_gt33_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_gt33_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_gt33_bound , gt33_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_gt33_bound ,gt33_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_gt33_bound, + "ML_BSSN_O2::gt33", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_O2::gt33!"); + + } + + if (CCTK_EQUALS(beta1_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_beta1_bound = -1; + if (handle_beta1_bound < 0) handle_beta1_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_beta1_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_beta1_bound , beta1_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_beta1_bound ,beta1_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_beta1_bound, + "ML_BSSN_O2::beta1", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_O2::beta1!"); + + } + + if (CCTK_EQUALS(beta2_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_beta2_bound = -1; + if (handle_beta2_bound < 0) handle_beta2_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_beta2_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_beta2_bound , beta2_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_beta2_bound ,beta2_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_beta2_bound, + "ML_BSSN_O2::beta2", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_O2::beta2!"); + + } + + if (CCTK_EQUALS(beta3_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_beta3_bound = -1; + if (handle_beta3_bound < 0) handle_beta3_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_beta3_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_beta3_bound , beta3_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_beta3_bound ,beta3_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_beta3_bound, + "ML_BSSN_O2::beta3", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_O2::beta3!"); + + } + + if (CCTK_EQUALS(trK_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_trK_bound = -1; + if (handle_trK_bound < 0) handle_trK_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_trK_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_trK_bound , trK_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_trK_bound ,trK_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_trK_bound, + "ML_BSSN_O2::trK", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_O2::trK!"); + + } + + if (CCTK_EQUALS(ML_curv_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_ML_curv_bound = -1; + if (handle_ML_curv_bound < 0) handle_ML_curv_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_curv_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_curv_bound ,ML_curv_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_curv_bound, + "ML_BSSN_O2::ML_curv", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Scalar BC for ML_BSSN_O2::ML_curv!"); + + } + + if (CCTK_EQUALS(ML_dtlapse_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_ML_dtlapse_bound = -1; + if (handle_ML_dtlapse_bound < 0) handle_ML_dtlapse_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_dtlapse_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_dtlapse_bound ,ML_dtlapse_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_dtlapse_bound, + "ML_BSSN_O2::ML_dtlapse", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Scalar BC for ML_BSSN_O2::ML_dtlapse!"); + + } + + if (CCTK_EQUALS(ML_dtshift_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_ML_dtshift_bound = -1; + if (handle_ML_dtshift_bound < 0) handle_ML_dtshift_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_dtshift_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_dtshift_bound ,ML_dtshift_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_dtshift_bound, + "ML_BSSN_O2::ML_dtshift", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Scalar BC for ML_BSSN_O2::ML_dtshift!"); + + } + + if (CCTK_EQUALS(ML_Gamma_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_ML_Gamma_bound = -1; + if (handle_ML_Gamma_bound < 0) handle_ML_Gamma_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_Gamma_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_Gamma_bound ,ML_Gamma_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_Gamma_bound, + "ML_BSSN_O2::ML_Gamma", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Scalar BC for ML_BSSN_O2::ML_Gamma!"); + + } + + if (CCTK_EQUALS(ML_lapse_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_ML_lapse_bound = -1; + if (handle_ML_lapse_bound < 0) handle_ML_lapse_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_lapse_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_lapse_bound ,ML_lapse_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_lapse_bound, + "ML_BSSN_O2::ML_lapse", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Scalar BC for ML_BSSN_O2::ML_lapse!"); + + } + + if (CCTK_EQUALS(ML_log_confac_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_ML_log_confac_bound = -1; + if (handle_ML_log_confac_bound < 0) handle_ML_log_confac_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_log_confac_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_log_confac_bound ,ML_log_confac_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_log_confac_bound, + "ML_BSSN_O2::ML_log_confac", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Scalar BC for ML_BSSN_O2::ML_log_confac!"); + + } + + if (CCTK_EQUALS(ML_metric_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_ML_metric_bound = -1; + if (handle_ML_metric_bound < 0) handle_ML_metric_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_metric_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_metric_bound ,ML_metric_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_metric_bound, + "ML_BSSN_O2::ML_metric", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Scalar BC for ML_BSSN_O2::ML_metric!"); + + } + + if (CCTK_EQUALS(ML_shift_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_ML_shift_bound = -1; + if (handle_ML_shift_bound < 0) handle_ML_shift_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_shift_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_shift_bound ,ML_shift_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_shift_bound, + "ML_BSSN_O2::ML_shift", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Scalar BC for ML_BSSN_O2::ML_shift!"); + + } + + if (CCTK_EQUALS(ML_trace_curv_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_ML_trace_curv_bound = -1; + if (handle_ML_trace_curv_bound < 0) handle_ML_trace_curv_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_trace_curv_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_trace_curv_bound ,ML_trace_curv_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_trace_curv_bound, + "ML_BSSN_O2::ML_trace_curv", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Scalar BC for ML_BSSN_O2::ML_trace_curv!"); + + } + + if (CCTK_EQUALS(At11_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_At11_bound = -1; + if (handle_At11_bound < 0) handle_At11_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_At11_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_At11_bound ,At11_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_At11_bound, + "ML_BSSN_O2::At11", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_O2::At11!"); + + } + + if (CCTK_EQUALS(At12_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_At12_bound = -1; + if (handle_At12_bound < 0) handle_At12_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_At12_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_At12_bound ,At12_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_At12_bound, + "ML_BSSN_O2::At12", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_O2::At12!"); + + } + + if (CCTK_EQUALS(At13_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_At13_bound = -1; + if (handle_At13_bound < 0) handle_At13_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_At13_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_At13_bound ,At13_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_At13_bound, + "ML_BSSN_O2::At13", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_O2::At13!"); + + } + + if (CCTK_EQUALS(At22_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_At22_bound = -1; + if (handle_At22_bound < 0) handle_At22_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_At22_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_At22_bound ,At22_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_At22_bound, + "ML_BSSN_O2::At22", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_O2::At22!"); + + } + + if (CCTK_EQUALS(At23_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_At23_bound = -1; + if (handle_At23_bound < 0) handle_At23_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_At23_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_At23_bound ,At23_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_At23_bound, + "ML_BSSN_O2::At23", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_O2::At23!"); + + } + + if (CCTK_EQUALS(At33_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_At33_bound = -1; + if (handle_At33_bound < 0) handle_At33_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_At33_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_At33_bound ,At33_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_At33_bound, + "ML_BSSN_O2::At33", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_O2::At33!"); + + } + + if (CCTK_EQUALS(A_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_A_bound = -1; + if (handle_A_bound < 0) handle_A_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_A_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_A_bound ,A_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_A_bound, + "ML_BSSN_O2::A", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_O2::A!"); + + } + + if (CCTK_EQUALS(B1_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_B1_bound = -1; + if (handle_B1_bound < 0) handle_B1_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_B1_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_B1_bound ,B1_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_B1_bound, + "ML_BSSN_O2::B1", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_O2::B1!"); + + } + + if (CCTK_EQUALS(B2_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_B2_bound = -1; + if (handle_B2_bound < 0) handle_B2_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_B2_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_B2_bound ,B2_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_B2_bound, + "ML_BSSN_O2::B2", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_O2::B2!"); + + } + + if (CCTK_EQUALS(B3_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_B3_bound = -1; + if (handle_B3_bound < 0) handle_B3_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_B3_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_B3_bound ,B3_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_B3_bound, + "ML_BSSN_O2::B3", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_O2::B3!"); + + } + + if (CCTK_EQUALS(Xt1_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_Xt1_bound = -1; + if (handle_Xt1_bound < 0) handle_Xt1_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_Xt1_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_Xt1_bound ,Xt1_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_Xt1_bound, + "ML_BSSN_O2::Xt1", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_O2::Xt1!"); + + } + + if (CCTK_EQUALS(Xt2_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_Xt2_bound = -1; + if (handle_Xt2_bound < 0) handle_Xt2_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_Xt2_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_Xt2_bound ,Xt2_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_Xt2_bound, + "ML_BSSN_O2::Xt2", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_O2::Xt2!"); + + } + + if (CCTK_EQUALS(Xt3_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_Xt3_bound = -1; + if (handle_Xt3_bound < 0) handle_Xt3_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_Xt3_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_Xt3_bound ,Xt3_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_Xt3_bound, + "ML_BSSN_O2::Xt3", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_O2::Xt3!"); + + } + + if (CCTK_EQUALS(alpha_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_alpha_bound = -1; + if (handle_alpha_bound < 0) handle_alpha_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_alpha_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_alpha_bound ,alpha_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_alpha_bound, + "ML_BSSN_O2::alpha", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_O2::alpha!"); + + } + + if (CCTK_EQUALS(phi_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_phi_bound = -1; + if (handle_phi_bound < 0) handle_phi_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_phi_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_phi_bound ,phi_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_phi_bound, + "ML_BSSN_O2::phi", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_O2::phi!"); + + } + + if (CCTK_EQUALS(gt11_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_gt11_bound = -1; + if (handle_gt11_bound < 0) handle_gt11_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_gt11_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_gt11_bound ,gt11_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_gt11_bound, + "ML_BSSN_O2::gt11", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_O2::gt11!"); + + } + + if (CCTK_EQUALS(gt12_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_gt12_bound = -1; + if (handle_gt12_bound < 0) handle_gt12_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_gt12_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_gt12_bound ,gt12_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_gt12_bound, + "ML_BSSN_O2::gt12", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_O2::gt12!"); + + } + + if (CCTK_EQUALS(gt13_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_gt13_bound = -1; + if (handle_gt13_bound < 0) handle_gt13_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_gt13_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_gt13_bound ,gt13_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_gt13_bound, + "ML_BSSN_O2::gt13", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_O2::gt13!"); + + } + + if (CCTK_EQUALS(gt22_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_gt22_bound = -1; + if (handle_gt22_bound < 0) handle_gt22_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_gt22_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_gt22_bound ,gt22_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_gt22_bound, + "ML_BSSN_O2::gt22", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_O2::gt22!"); + + } + + if (CCTK_EQUALS(gt23_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_gt23_bound = -1; + if (handle_gt23_bound < 0) handle_gt23_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_gt23_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_gt23_bound ,gt23_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_gt23_bound, + "ML_BSSN_O2::gt23", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_O2::gt23!"); + + } + + if (CCTK_EQUALS(gt33_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_gt33_bound = -1; + if (handle_gt33_bound < 0) handle_gt33_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_gt33_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_gt33_bound ,gt33_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_gt33_bound, + "ML_BSSN_O2::gt33", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_O2::gt33!"); + + } + + if (CCTK_EQUALS(beta1_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_beta1_bound = -1; + if (handle_beta1_bound < 0) handle_beta1_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_beta1_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_beta1_bound ,beta1_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_beta1_bound, + "ML_BSSN_O2::beta1", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_O2::beta1!"); + + } + + if (CCTK_EQUALS(beta2_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_beta2_bound = -1; + if (handle_beta2_bound < 0) handle_beta2_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_beta2_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_beta2_bound ,beta2_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_beta2_bound, + "ML_BSSN_O2::beta2", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_O2::beta2!"); + + } + + if (CCTK_EQUALS(beta3_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_beta3_bound = -1; + if (handle_beta3_bound < 0) handle_beta3_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_beta3_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_beta3_bound ,beta3_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_beta3_bound, + "ML_BSSN_O2::beta3", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_O2::beta3!"); + + } + + if (CCTK_EQUALS(trK_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_trK_bound = -1; + if (handle_trK_bound < 0) handle_trK_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_trK_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_trK_bound ,trK_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_trK_bound, + "ML_BSSN_O2::trK", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_O2::trK!"); + + } + return; +} + + + +/* template for entries in parameter file: +#$bound$#ML_BSSN_O2::ML_curv_bound = "skip" +#$bound$#ML_BSSN_O2::ML_curv_bound_speed = 1.0 +#$bound$#ML_BSSN_O2::ML_curv_bound_limit = 0.0 +#$bound$#ML_BSSN_O2::ML_curv_bound_scalar = 0.0 + +#$bound$#ML_BSSN_O2::ML_dtlapse_bound = "skip" +#$bound$#ML_BSSN_O2::ML_dtlapse_bound_speed = 1.0 +#$bound$#ML_BSSN_O2::ML_dtlapse_bound_limit = 0.0 +#$bound$#ML_BSSN_O2::ML_dtlapse_bound_scalar = 0.0 + +#$bound$#ML_BSSN_O2::ML_dtshift_bound = "skip" +#$bound$#ML_BSSN_O2::ML_dtshift_bound_speed = 1.0 +#$bound$#ML_BSSN_O2::ML_dtshift_bound_limit = 0.0 +#$bound$#ML_BSSN_O2::ML_dtshift_bound_scalar = 0.0 + +#$bound$#ML_BSSN_O2::ML_Gamma_bound = "skip" +#$bound$#ML_BSSN_O2::ML_Gamma_bound_speed = 1.0 +#$bound$#ML_BSSN_O2::ML_Gamma_bound_limit = 0.0 +#$bound$#ML_BSSN_O2::ML_Gamma_bound_scalar = 0.0 + +#$bound$#ML_BSSN_O2::ML_lapse_bound = "skip" +#$bound$#ML_BSSN_O2::ML_lapse_bound_speed = 1.0 +#$bound$#ML_BSSN_O2::ML_lapse_bound_limit = 0.0 +#$bound$#ML_BSSN_O2::ML_lapse_bound_scalar = 0.0 + +#$bound$#ML_BSSN_O2::ML_log_confac_bound = "skip" +#$bound$#ML_BSSN_O2::ML_log_confac_bound_speed = 1.0 +#$bound$#ML_BSSN_O2::ML_log_confac_bound_limit = 0.0 +#$bound$#ML_BSSN_O2::ML_log_confac_bound_scalar = 0.0 + +#$bound$#ML_BSSN_O2::ML_metric_bound = "skip" +#$bound$#ML_BSSN_O2::ML_metric_bound_speed = 1.0 +#$bound$#ML_BSSN_O2::ML_metric_bound_limit = 0.0 +#$bound$#ML_BSSN_O2::ML_metric_bound_scalar = 0.0 + +#$bound$#ML_BSSN_O2::ML_shift_bound = "skip" +#$bound$#ML_BSSN_O2::ML_shift_bound_speed = 1.0 +#$bound$#ML_BSSN_O2::ML_shift_bound_limit = 0.0 +#$bound$#ML_BSSN_O2::ML_shift_bound_scalar = 0.0 + +#$bound$#ML_BSSN_O2::ML_trace_curv_bound = "skip" +#$bound$#ML_BSSN_O2::ML_trace_curv_bound_speed = 1.0 +#$bound$#ML_BSSN_O2::ML_trace_curv_bound_limit = 0.0 +#$bound$#ML_BSSN_O2::ML_trace_curv_bound_scalar = 0.0 + +#$bound$#ML_BSSN_O2::At11_bound = "skip" +#$bound$#ML_BSSN_O2::At11_bound_speed = 1.0 +#$bound$#ML_BSSN_O2::At11_bound_limit = 0.0 +#$bound$#ML_BSSN_O2::At11_bound_scalar = 0.0 + +#$bound$#ML_BSSN_O2::At12_bound = "skip" +#$bound$#ML_BSSN_O2::At12_bound_speed = 1.0 +#$bound$#ML_BSSN_O2::At12_bound_limit = 0.0 +#$bound$#ML_BSSN_O2::At12_bound_scalar = 0.0 + +#$bound$#ML_BSSN_O2::At13_bound = "skip" +#$bound$#ML_BSSN_O2::At13_bound_speed = 1.0 +#$bound$#ML_BSSN_O2::At13_bound_limit = 0.0 +#$bound$#ML_BSSN_O2::At13_bound_scalar = 0.0 + +#$bound$#ML_BSSN_O2::At22_bound = "skip" +#$bound$#ML_BSSN_O2::At22_bound_speed = 1.0 +#$bound$#ML_BSSN_O2::At22_bound_limit = 0.0 +#$bound$#ML_BSSN_O2::At22_bound_scalar = 0.0 + +#$bound$#ML_BSSN_O2::At23_bound = "skip" +#$bound$#ML_BSSN_O2::At23_bound_speed = 1.0 +#$bound$#ML_BSSN_O2::At23_bound_limit = 0.0 +#$bound$#ML_BSSN_O2::At23_bound_scalar = 0.0 + +#$bound$#ML_BSSN_O2::At33_bound = "skip" +#$bound$#ML_BSSN_O2::At33_bound_speed = 1.0 +#$bound$#ML_BSSN_O2::At33_bound_limit = 0.0 +#$bound$#ML_BSSN_O2::At33_bound_scalar = 0.0 + +#$bound$#ML_BSSN_O2::A_bound = "skip" +#$bound$#ML_BSSN_O2::A_bound_speed = 1.0 +#$bound$#ML_BSSN_O2::A_bound_limit = 0.0 +#$bound$#ML_BSSN_O2::A_bound_scalar = 0.0 + +#$bound$#ML_BSSN_O2::B1_bound = "skip" +#$bound$#ML_BSSN_O2::B1_bound_speed = 1.0 +#$bound$#ML_BSSN_O2::B1_bound_limit = 0.0 +#$bound$#ML_BSSN_O2::B1_bound_scalar = 0.0 + +#$bound$#ML_BSSN_O2::B2_bound = "skip" +#$bound$#ML_BSSN_O2::B2_bound_speed = 1.0 +#$bound$#ML_BSSN_O2::B2_bound_limit = 0.0 +#$bound$#ML_BSSN_O2::B2_bound_scalar = 0.0 + +#$bound$#ML_BSSN_O2::B3_bound = "skip" +#$bound$#ML_BSSN_O2::B3_bound_speed = 1.0 +#$bound$#ML_BSSN_O2::B3_bound_limit = 0.0 +#$bound$#ML_BSSN_O2::B3_bound_scalar = 0.0 + +#$bound$#ML_BSSN_O2::Xt1_bound = "skip" +#$bound$#ML_BSSN_O2::Xt1_bound_speed = 1.0 +#$bound$#ML_BSSN_O2::Xt1_bound_limit = 0.0 +#$bound$#ML_BSSN_O2::Xt1_bound_scalar = 0.0 + +#$bound$#ML_BSSN_O2::Xt2_bound = "skip" +#$bound$#ML_BSSN_O2::Xt2_bound_speed = 1.0 +#$bound$#ML_BSSN_O2::Xt2_bound_limit = 0.0 +#$bound$#ML_BSSN_O2::Xt2_bound_scalar = 0.0 + +#$bound$#ML_BSSN_O2::Xt3_bound = "skip" +#$bound$#ML_BSSN_O2::Xt3_bound_speed = 1.0 +#$bound$#ML_BSSN_O2::Xt3_bound_limit = 0.0 +#$bound$#ML_BSSN_O2::Xt3_bound_scalar = 0.0 + +#$bound$#ML_BSSN_O2::alpha_bound = "skip" +#$bound$#ML_BSSN_O2::alpha_bound_speed = 1.0 +#$bound$#ML_BSSN_O2::alpha_bound_limit = 0.0 +#$bound$#ML_BSSN_O2::alpha_bound_scalar = 0.0 + +#$bound$#ML_BSSN_O2::phi_bound = "skip" +#$bound$#ML_BSSN_O2::phi_bound_speed = 1.0 +#$bound$#ML_BSSN_O2::phi_bound_limit = 0.0 +#$bound$#ML_BSSN_O2::phi_bound_scalar = 0.0 + +#$bound$#ML_BSSN_O2::gt11_bound = "skip" +#$bound$#ML_BSSN_O2::gt11_bound_speed = 1.0 +#$bound$#ML_BSSN_O2::gt11_bound_limit = 0.0 +#$bound$#ML_BSSN_O2::gt11_bound_scalar = 0.0 + +#$bound$#ML_BSSN_O2::gt12_bound = "skip" +#$bound$#ML_BSSN_O2::gt12_bound_speed = 1.0 +#$bound$#ML_BSSN_O2::gt12_bound_limit = 0.0 +#$bound$#ML_BSSN_O2::gt12_bound_scalar = 0.0 + +#$bound$#ML_BSSN_O2::gt13_bound = "skip" +#$bound$#ML_BSSN_O2::gt13_bound_speed = 1.0 +#$bound$#ML_BSSN_O2::gt13_bound_limit = 0.0 +#$bound$#ML_BSSN_O2::gt13_bound_scalar = 0.0 + +#$bound$#ML_BSSN_O2::gt22_bound = "skip" +#$bound$#ML_BSSN_O2::gt22_bound_speed = 1.0 +#$bound$#ML_BSSN_O2::gt22_bound_limit = 0.0 +#$bound$#ML_BSSN_O2::gt22_bound_scalar = 0.0 + +#$bound$#ML_BSSN_O2::gt23_bound = "skip" +#$bound$#ML_BSSN_O2::gt23_bound_speed = 1.0 +#$bound$#ML_BSSN_O2::gt23_bound_limit = 0.0 +#$bound$#ML_BSSN_O2::gt23_bound_scalar = 0.0 + +#$bound$#ML_BSSN_O2::gt33_bound = "skip" +#$bound$#ML_BSSN_O2::gt33_bound_speed = 1.0 +#$bound$#ML_BSSN_O2::gt33_bound_limit = 0.0 +#$bound$#ML_BSSN_O2::gt33_bound_scalar = 0.0 + +#$bound$#ML_BSSN_O2::beta1_bound = "skip" +#$bound$#ML_BSSN_O2::beta1_bound_speed = 1.0 +#$bound$#ML_BSSN_O2::beta1_bound_limit = 0.0 +#$bound$#ML_BSSN_O2::beta1_bound_scalar = 0.0 + +#$bound$#ML_BSSN_O2::beta2_bound = "skip" +#$bound$#ML_BSSN_O2::beta2_bound_speed = 1.0 +#$bound$#ML_BSSN_O2::beta2_bound_limit = 0.0 +#$bound$#ML_BSSN_O2::beta2_bound_scalar = 0.0 + +#$bound$#ML_BSSN_O2::beta3_bound = "skip" +#$bound$#ML_BSSN_O2::beta3_bound_speed = 1.0 +#$bound$#ML_BSSN_O2::beta3_bound_limit = 0.0 +#$bound$#ML_BSSN_O2::beta3_bound_scalar = 0.0 + +#$bound$#ML_BSSN_O2::trK_bound = "skip" +#$bound$#ML_BSSN_O2::trK_bound_speed = 1.0 +#$bound$#ML_BSSN_O2::trK_bound_limit = 0.0 +#$bound$#ML_BSSN_O2::trK_bound_scalar = 0.0 + +*/ + diff --git a/ML_BSSN_O2/src/ML_BSSN_O2_Minkowski.cc b/ML_BSSN_O2/src/ML_BSSN_O2_Minkowski.cc new file mode 100644 index 0000000..b92fbf7 --- /dev/null +++ b/ML_BSSN_O2/src/ML_BSSN_O2_Minkowski.cc @@ -0,0 +1,193 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +static void ML_BSSN_O2_Minkowski_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_BSSN_O2_Minkowski_Body"); + } + + if (cctk_iteration % ML_BSSN_O2_Minkowski_calc_every != ML_BSSN_O2_Minkowski_calc_offset) + { + return; + } + + const char *groups[] = {"ML_BSSN_O2::ML_curv","ML_BSSN_O2::ML_dtlapse","ML_BSSN_O2::ML_dtshift","ML_BSSN_O2::ML_Gamma","ML_BSSN_O2::ML_lapse","ML_BSSN_O2::ML_log_confac","ML_BSSN_O2::ML_metric","ML_BSSN_O2::ML_shift","ML_BSSN_O2::ML_trace_curv"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_BSSN_O2_Minkowski", 9, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o16dx = 0.0625*INV(dx); + CCTK_REAL const p1o16dy = 0.0625*INV(dy); + CCTK_REAL const p1o16dz = 0.0625*INV(dz); + CCTK_REAL const p1o2dx = 0.5*INV(dx); + CCTK_REAL const p1o2dy = 0.5*INV(dy); + CCTK_REAL const p1o2dz = 0.5*INV(dz); + CCTK_REAL const p1o4dx = 0.25*INV(dx); + CCTK_REAL const p1o4dxdy = 0.25*INV(dx)*INV(dy); + CCTK_REAL const p1o4dxdz = 0.25*INV(dx)*INV(dz); + CCTK_REAL const p1o4dy = 0.25*INV(dy); + CCTK_REAL const p1o4dydz = 0.25*INV(dy)*INV(dz); + CCTK_REAL const p1o4dz = 0.25*INV(dz); + CCTK_REAL const p1odx = INV(dx); + CCTK_REAL const p1odx2 = INV(SQR(dx)); + CCTK_REAL const p1ody = INV(dy); + CCTK_REAL const p1ody2 = INV(SQR(dy)); + CCTK_REAL const p1odz = INV(dz); + CCTK_REAL const p1odz2 = INV(SQR(dz)); + CCTK_REAL const pm1o2dx = -0.5*INV(dx); + CCTK_REAL const pm1o2dy = -0.5*INV(dy); + CCTK_REAL const pm1o2dz = -0.5*INV(dz); + CCTK_REAL const pm1o4dx = -0.25*INV(dx); + CCTK_REAL const pm1o4dy = -0.25*INV(dy); + CCTK_REAL const pm1o4dz = -0.25*INV(dz); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_BSSN_O2_Minkowski, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + + /* Include user supplied include files */ + + /* Precompute derivatives */ + + /* Calculate temporaries and grid functions */ + CCTK_REAL phiL = IfThen(ToReal(conformalMethod),1,0); + + CCTK_REAL gt11L = 1; + + CCTK_REAL gt12L = 0; + + CCTK_REAL gt13L = 0; + + CCTK_REAL gt22L = 1; + + CCTK_REAL gt23L = 0; + + CCTK_REAL gt33L = 1; + + CCTK_REAL trKL = 0; + + CCTK_REAL At11L = 0; + + CCTK_REAL At12L = 0; + + CCTK_REAL At13L = 0; + + CCTK_REAL At22L = 0; + + CCTK_REAL At23L = 0; + + CCTK_REAL At33L = 0; + + CCTK_REAL Xt1L = 0; + + CCTK_REAL Xt2L = 0; + + CCTK_REAL Xt3L = 0; + + CCTK_REAL alphaL = 1; + + CCTK_REAL AL = 0; + + CCTK_REAL beta1L = 0; + + CCTK_REAL beta2L = 0; + + CCTK_REAL beta3L = 0; + + CCTK_REAL B1L = 0; + + CCTK_REAL B2L = 0; + + CCTK_REAL B3L = 0; + + + /* Copy local copies back to grid functions */ + A[index] = AL; + alpha[index] = alphaL; + At11[index] = At11L; + At12[index] = At12L; + At13[index] = At13L; + At22[index] = At22L; + At23[index] = At23L; + At33[index] = At33L; + B1[index] = B1L; + B2[index] = B2L; + B3[index] = B3L; + beta1[index] = beta1L; + beta2[index] = beta2L; + beta3[index] = beta3L; + gt11[index] = gt11L; + gt12[index] = gt12L; + gt13[index] = gt13L; + gt22[index] = gt22L; + gt23[index] = gt23L; + gt33[index] = gt33L; + phi[index] = phiL; + trK[index] = trKL; + Xt1[index] = Xt1L; + Xt2[index] = Xt2L; + Xt3[index] = Xt3L; + } + LC_ENDLOOP3 (ML_BSSN_O2_Minkowski); +} + +extern "C" void ML_BSSN_O2_Minkowski(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverEverything(cctkGH, &ML_BSSN_O2_Minkowski_Body); +} diff --git a/ML_BSSN_O2/src/ML_BSSN_O2_RHS1.cc b/ML_BSSN_O2/src/ML_BSSN_O2_RHS1.cc new file mode 100644 index 0000000..bb23697 --- /dev/null +++ b/ML_BSSN_O2/src/ML_BSSN_O2_RHS1.cc @@ -0,0 +1,852 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +extern "C" void ML_BSSN_O2_RHS1_SelectBCs(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT ierr = 0; + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_O2::ML_dtlapserhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_O2::ML_dtlapserhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_O2::ML_dtshiftrhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_O2::ML_dtshiftrhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_O2::ML_Gammarhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_O2::ML_Gammarhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_O2::ML_lapserhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_O2::ML_lapserhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_O2::ML_log_confacrhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_O2::ML_log_confacrhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_O2::ML_metricrhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_O2::ML_metricrhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_O2::ML_shiftrhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_O2::ML_shiftrhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_O2::ML_trace_curvrhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_O2::ML_trace_curvrhs."); + return; +} + +static void ML_BSSN_O2_RHS1_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_BSSN_O2_RHS1_Body"); + } + + if (cctk_iteration % ML_BSSN_O2_RHS1_calc_every != ML_BSSN_O2_RHS1_calc_offset) + { + return; + } + + const char *groups[] = {"grid::coordinates","Grid::coordinates","ML_BSSN_O2::ML_curv","ML_BSSN_O2::ML_dtlapse","ML_BSSN_O2::ML_dtlapserhs","ML_BSSN_O2::ML_dtshift","ML_BSSN_O2::ML_dtshiftrhs","ML_BSSN_O2::ML_Gamma","ML_BSSN_O2::ML_Gammarhs","ML_BSSN_O2::ML_lapse","ML_BSSN_O2::ML_lapserhs","ML_BSSN_O2::ML_log_confac","ML_BSSN_O2::ML_log_confacrhs","ML_BSSN_O2::ML_metric","ML_BSSN_O2::ML_metricrhs","ML_BSSN_O2::ML_shift","ML_BSSN_O2::ML_shiftrhs","ML_BSSN_O2::ML_trace_curv","ML_BSSN_O2::ML_trace_curvrhs"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_BSSN_O2_RHS1", 19, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o16dx = 0.0625*INV(dx); + CCTK_REAL const p1o16dy = 0.0625*INV(dy); + CCTK_REAL const p1o16dz = 0.0625*INV(dz); + CCTK_REAL const p1o2dx = 0.5*INV(dx); + CCTK_REAL const p1o2dy = 0.5*INV(dy); + CCTK_REAL const p1o2dz = 0.5*INV(dz); + CCTK_REAL const p1o4dx = 0.25*INV(dx); + CCTK_REAL const p1o4dxdy = 0.25*INV(dx)*INV(dy); + CCTK_REAL const p1o4dxdz = 0.25*INV(dx)*INV(dz); + CCTK_REAL const p1o4dy = 0.25*INV(dy); + CCTK_REAL const p1o4dydz = 0.25*INV(dy)*INV(dz); + CCTK_REAL const p1o4dz = 0.25*INV(dz); + CCTK_REAL const p1odx = INV(dx); + CCTK_REAL const p1odx2 = INV(SQR(dx)); + CCTK_REAL const p1ody = INV(dy); + CCTK_REAL const p1ody2 = INV(SQR(dy)); + CCTK_REAL const p1odz = INV(dz); + CCTK_REAL const p1odz2 = INV(SQR(dz)); + CCTK_REAL const pm1o2dx = -0.5*INV(dx); + CCTK_REAL const pm1o2dy = -0.5*INV(dy); + CCTK_REAL const pm1o2dz = -0.5*INV(dz); + CCTK_REAL const pm1o4dx = -0.25*INV(dx); + CCTK_REAL const pm1o4dy = -0.25*INV(dy); + CCTK_REAL const pm1o4dz = -0.25*INV(dz); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_BSSN_O2_RHS1, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + CCTK_REAL AL = A[index]; + CCTK_REAL alphaL = alpha[index]; + CCTK_REAL At11L = At11[index]; + CCTK_REAL At12L = At12[index]; + CCTK_REAL At13L = At13[index]; + CCTK_REAL At22L = At22[index]; + CCTK_REAL At23L = At23[index]; + CCTK_REAL At33L = At33[index]; + CCTK_REAL B1L = B1[index]; + CCTK_REAL B2L = B2[index]; + CCTK_REAL B3L = B3[index]; + CCTK_REAL beta1L = beta1[index]; + CCTK_REAL beta2L = beta2[index]; + CCTK_REAL beta3L = beta3[index]; + CCTK_REAL eTttL = (*stress_energy_state) ? eTtt[index] : ToReal(0.0); + CCTK_REAL eTtxL = (*stress_energy_state) ? eTtx[index] : ToReal(0.0); + CCTK_REAL eTtyL = (*stress_energy_state) ? eTty[index] : ToReal(0.0); + CCTK_REAL eTtzL = (*stress_energy_state) ? eTtz[index] : ToReal(0.0); + CCTK_REAL eTxxL = (*stress_energy_state) ? eTxx[index] : ToReal(0.0); + CCTK_REAL eTxyL = (*stress_energy_state) ? eTxy[index] : ToReal(0.0); + CCTK_REAL eTxzL = (*stress_energy_state) ? eTxz[index] : ToReal(0.0); + CCTK_REAL eTyyL = (*stress_energy_state) ? eTyy[index] : ToReal(0.0); + CCTK_REAL eTyzL = (*stress_energy_state) ? eTyz[index] : ToReal(0.0); + CCTK_REAL eTzzL = (*stress_energy_state) ? eTzz[index] : ToReal(0.0); + CCTK_REAL gt11L = gt11[index]; + CCTK_REAL gt12L = gt12[index]; + CCTK_REAL gt13L = gt13[index]; + CCTK_REAL gt22L = gt22[index]; + CCTK_REAL gt23L = gt23[index]; + CCTK_REAL gt33L = gt33[index]; + CCTK_REAL phiL = phi[index]; + CCTK_REAL rL = r[index]; + CCTK_REAL trKL = trK[index]; + CCTK_REAL Xt1L = Xt1[index]; + CCTK_REAL Xt2L = Xt2[index]; + CCTK_REAL Xt3L = Xt3[index]; + + /* Include user supplied include files */ + + /* Precompute derivatives */ + CCTK_REAL const PDdissipationNth1A = PDdissipationNth1(&A[index]); + CCTK_REAL const PDdissipationNth2A = PDdissipationNth2(&A[index]); + CCTK_REAL const PDdissipationNth3A = PDdissipationNth3(&A[index]); + CCTK_REAL const PDupwindNthAnti1A = PDupwindNthAnti1(&A[index]); + CCTK_REAL const PDupwindNthSymm1A = PDupwindNthSymm1(&A[index]); + CCTK_REAL const PDupwindNthAnti2A = PDupwindNthAnti2(&A[index]); + CCTK_REAL const PDupwindNthSymm2A = PDupwindNthSymm2(&A[index]); + CCTK_REAL const PDupwindNthAnti3A = PDupwindNthAnti3(&A[index]); + CCTK_REAL const PDupwindNthSymm3A = PDupwindNthSymm3(&A[index]); + CCTK_REAL const PDstandardNth1alpha = PDstandardNth1(&alpha[index]); + CCTK_REAL const PDstandardNth2alpha = PDstandardNth2(&alpha[index]); + CCTK_REAL const PDstandardNth3alpha = PDstandardNth3(&alpha[index]); + CCTK_REAL const PDstandardNth11alpha = PDstandardNth11(&alpha[index]); + CCTK_REAL const PDstandardNth22alpha = PDstandardNth22(&alpha[index]); + CCTK_REAL const PDstandardNth33alpha = PDstandardNth33(&alpha[index]); + CCTK_REAL const PDstandardNth12alpha = PDstandardNth12(&alpha[index]); + CCTK_REAL const PDstandardNth13alpha = PDstandardNth13(&alpha[index]); + CCTK_REAL const PDstandardNth23alpha = PDstandardNth23(&alpha[index]); + CCTK_REAL const PDdissipationNth1alpha = PDdissipationNth1(&alpha[index]); + CCTK_REAL const PDdissipationNth2alpha = PDdissipationNth2(&alpha[index]); + CCTK_REAL const PDdissipationNth3alpha = PDdissipationNth3(&alpha[index]); + CCTK_REAL const PDupwindNthAnti1alpha = PDupwindNthAnti1(&alpha[index]); + CCTK_REAL const PDupwindNthSymm1alpha = PDupwindNthSymm1(&alpha[index]); + CCTK_REAL const PDupwindNthAnti2alpha = PDupwindNthAnti2(&alpha[index]); + CCTK_REAL const PDupwindNthSymm2alpha = PDupwindNthSymm2(&alpha[index]); + CCTK_REAL const PDupwindNthAnti3alpha = PDupwindNthAnti3(&alpha[index]); + CCTK_REAL const PDupwindNthSymm3alpha = PDupwindNthSymm3(&alpha[index]); + CCTK_REAL const PDdissipationNth1B1 = PDdissipationNth1(&B1[index]); + CCTK_REAL const PDdissipationNth2B1 = PDdissipationNth2(&B1[index]); + CCTK_REAL const PDdissipationNth3B1 = PDdissipationNth3(&B1[index]); + CCTK_REAL const PDupwindNthAnti1B1 = PDupwindNthAnti1(&B1[index]); + CCTK_REAL const PDupwindNthSymm1B1 = PDupwindNthSymm1(&B1[index]); + CCTK_REAL const PDupwindNthAnti2B1 = PDupwindNthAnti2(&B1[index]); + CCTK_REAL const PDupwindNthSymm2B1 = PDupwindNthSymm2(&B1[index]); + CCTK_REAL const PDupwindNthAnti3B1 = PDupwindNthAnti3(&B1[index]); + CCTK_REAL const PDupwindNthSymm3B1 = PDupwindNthSymm3(&B1[index]); + CCTK_REAL const PDdissipationNth1B2 = PDdissipationNth1(&B2[index]); + CCTK_REAL const PDdissipationNth2B2 = PDdissipationNth2(&B2[index]); + CCTK_REAL const PDdissipationNth3B2 = PDdissipationNth3(&B2[index]); + CCTK_REAL const PDupwindNthAnti1B2 = PDupwindNthAnti1(&B2[index]); + CCTK_REAL const PDupwindNthSymm1B2 = PDupwindNthSymm1(&B2[index]); + CCTK_REAL const PDupwindNthAnti2B2 = PDupwindNthAnti2(&B2[index]); + CCTK_REAL const PDupwindNthSymm2B2 = PDupwindNthSymm2(&B2[index]); + CCTK_REAL const PDupwindNthAnti3B2 = PDupwindNthAnti3(&B2[index]); + CCTK_REAL const PDupwindNthSymm3B2 = PDupwindNthSymm3(&B2[index]); + CCTK_REAL const PDdissipationNth1B3 = PDdissipationNth1(&B3[index]); + CCTK_REAL const PDdissipationNth2B3 = PDdissipationNth2(&B3[index]); + CCTK_REAL const PDdissipationNth3B3 = PDdissipationNth3(&B3[index]); + CCTK_REAL const PDupwindNthAnti1B3 = PDupwindNthAnti1(&B3[index]); + CCTK_REAL const PDupwindNthSymm1B3 = PDupwindNthSymm1(&B3[index]); + CCTK_REAL const PDupwindNthAnti2B3 = PDupwindNthAnti2(&B3[index]); + CCTK_REAL const PDupwindNthSymm2B3 = PDupwindNthSymm2(&B3[index]); + CCTK_REAL const PDupwindNthAnti3B3 = PDupwindNthAnti3(&B3[index]); + CCTK_REAL const PDupwindNthSymm3B3 = PDupwindNthSymm3(&B3[index]); + CCTK_REAL const PDstandardNth1beta1 = PDstandardNth1(&beta1[index]); + CCTK_REAL const PDstandardNth2beta1 = PDstandardNth2(&beta1[index]); + CCTK_REAL const PDstandardNth3beta1 = PDstandardNth3(&beta1[index]); + CCTK_REAL const PDstandardNth11beta1 = PDstandardNth11(&beta1[index]); + CCTK_REAL const PDstandardNth22beta1 = PDstandardNth22(&beta1[index]); + CCTK_REAL const PDstandardNth33beta1 = PDstandardNth33(&beta1[index]); + CCTK_REAL const PDstandardNth12beta1 = PDstandardNth12(&beta1[index]); + CCTK_REAL const PDstandardNth13beta1 = PDstandardNth13(&beta1[index]); + CCTK_REAL const PDstandardNth23beta1 = PDstandardNth23(&beta1[index]); + CCTK_REAL const PDdissipationNth1beta1 = PDdissipationNth1(&beta1[index]); + CCTK_REAL const PDdissipationNth2beta1 = PDdissipationNth2(&beta1[index]); + CCTK_REAL const PDdissipationNth3beta1 = PDdissipationNth3(&beta1[index]); + CCTK_REAL const PDupwindNthAnti1beta1 = PDupwindNthAnti1(&beta1[index]); + CCTK_REAL const PDupwindNthSymm1beta1 = PDupwindNthSymm1(&beta1[index]); + CCTK_REAL const PDupwindNthAnti2beta1 = PDupwindNthAnti2(&beta1[index]); + CCTK_REAL const PDupwindNthSymm2beta1 = PDupwindNthSymm2(&beta1[index]); + CCTK_REAL const PDupwindNthAnti3beta1 = PDupwindNthAnti3(&beta1[index]); + CCTK_REAL const PDupwindNthSymm3beta1 = PDupwindNthSymm3(&beta1[index]); + CCTK_REAL const PDstandardNth1beta2 = PDstandardNth1(&beta2[index]); + CCTK_REAL const PDstandardNth2beta2 = PDstandardNth2(&beta2[index]); + CCTK_REAL const PDstandardNth3beta2 = PDstandardNth3(&beta2[index]); + CCTK_REAL const PDstandardNth11beta2 = PDstandardNth11(&beta2[index]); + CCTK_REAL const PDstandardNth22beta2 = PDstandardNth22(&beta2[index]); + CCTK_REAL const PDstandardNth33beta2 = PDstandardNth33(&beta2[index]); + CCTK_REAL const PDstandardNth12beta2 = PDstandardNth12(&beta2[index]); + CCTK_REAL const PDstandardNth13beta2 = PDstandardNth13(&beta2[index]); + CCTK_REAL const PDstandardNth23beta2 = PDstandardNth23(&beta2[index]); + CCTK_REAL const PDdissipationNth1beta2 = PDdissipationNth1(&beta2[index]); + CCTK_REAL const PDdissipationNth2beta2 = PDdissipationNth2(&beta2[index]); + CCTK_REAL const PDdissipationNth3beta2 = PDdissipationNth3(&beta2[index]); + CCTK_REAL const PDupwindNthAnti1beta2 = PDupwindNthAnti1(&beta2[index]); + CCTK_REAL const PDupwindNthSymm1beta2 = PDupwindNthSymm1(&beta2[index]); + CCTK_REAL const PDupwindNthAnti2beta2 = PDupwindNthAnti2(&beta2[index]); + CCTK_REAL const PDupwindNthSymm2beta2 = PDupwindNthSymm2(&beta2[index]); + CCTK_REAL const PDupwindNthAnti3beta2 = PDupwindNthAnti3(&beta2[index]); + CCTK_REAL const PDupwindNthSymm3beta2 = PDupwindNthSymm3(&beta2[index]); + CCTK_REAL const PDstandardNth1beta3 = PDstandardNth1(&beta3[index]); + CCTK_REAL const PDstandardNth2beta3 = PDstandardNth2(&beta3[index]); + CCTK_REAL const PDstandardNth3beta3 = PDstandardNth3(&beta3[index]); + CCTK_REAL const PDstandardNth11beta3 = PDstandardNth11(&beta3[index]); + CCTK_REAL const PDstandardNth22beta3 = PDstandardNth22(&beta3[index]); + CCTK_REAL const PDstandardNth33beta3 = PDstandardNth33(&beta3[index]); + CCTK_REAL const PDstandardNth12beta3 = PDstandardNth12(&beta3[index]); + CCTK_REAL const PDstandardNth13beta3 = PDstandardNth13(&beta3[index]); + CCTK_REAL const PDstandardNth23beta3 = PDstandardNth23(&beta3[index]); + CCTK_REAL const PDdissipationNth1beta3 = PDdissipationNth1(&beta3[index]); + CCTK_REAL const PDdissipationNth2beta3 = PDdissipationNth2(&beta3[index]); + CCTK_REAL const PDdissipationNth3beta3 = PDdissipationNth3(&beta3[index]); + CCTK_REAL const PDupwindNthAnti1beta3 = PDupwindNthAnti1(&beta3[index]); + CCTK_REAL const PDupwindNthSymm1beta3 = PDupwindNthSymm1(&beta3[index]); + CCTK_REAL const PDupwindNthAnti2beta3 = PDupwindNthAnti2(&beta3[index]); + CCTK_REAL const PDupwindNthSymm2beta3 = PDupwindNthSymm2(&beta3[index]); + CCTK_REAL const PDupwindNthAnti3beta3 = PDupwindNthAnti3(&beta3[index]); + CCTK_REAL const PDupwindNthSymm3beta3 = PDupwindNthSymm3(&beta3[index]); + CCTK_REAL const PDstandardNth1gt11 = PDstandardNth1(>11[index]); + CCTK_REAL const PDstandardNth2gt11 = PDstandardNth2(>11[index]); + CCTK_REAL const PDstandardNth3gt11 = PDstandardNth3(>11[index]); + CCTK_REAL const PDdissipationNth1gt11 = PDdissipationNth1(>11[index]); + CCTK_REAL const PDdissipationNth2gt11 = PDdissipationNth2(>11[index]); + CCTK_REAL const PDdissipationNth3gt11 = PDdissipationNth3(>11[index]); + CCTK_REAL const PDupwindNthAnti1gt11 = PDupwindNthAnti1(>11[index]); + CCTK_REAL const PDupwindNthSymm1gt11 = PDupwindNthSymm1(>11[index]); + CCTK_REAL const PDupwindNthAnti2gt11 = PDupwindNthAnti2(>11[index]); + CCTK_REAL const PDupwindNthSymm2gt11 = PDupwindNthSymm2(>11[index]); + CCTK_REAL const PDupwindNthAnti3gt11 = PDupwindNthAnti3(>11[index]); + CCTK_REAL const PDupwindNthSymm3gt11 = PDupwindNthSymm3(>11[index]); + CCTK_REAL const PDstandardNth1gt12 = PDstandardNth1(>12[index]); + CCTK_REAL const PDstandardNth2gt12 = PDstandardNth2(>12[index]); + CCTK_REAL const PDstandardNth3gt12 = PDstandardNth3(>12[index]); + CCTK_REAL const PDdissipationNth1gt12 = PDdissipationNth1(>12[index]); + CCTK_REAL const PDdissipationNth2gt12 = PDdissipationNth2(>12[index]); + CCTK_REAL const PDdissipationNth3gt12 = PDdissipationNth3(>12[index]); + CCTK_REAL const PDupwindNthAnti1gt12 = PDupwindNthAnti1(>12[index]); + CCTK_REAL const PDupwindNthSymm1gt12 = PDupwindNthSymm1(>12[index]); + CCTK_REAL const PDupwindNthAnti2gt12 = PDupwindNthAnti2(>12[index]); + CCTK_REAL const PDupwindNthSymm2gt12 = PDupwindNthSymm2(>12[index]); + CCTK_REAL const PDupwindNthAnti3gt12 = PDupwindNthAnti3(>12[index]); + CCTK_REAL const PDupwindNthSymm3gt12 = PDupwindNthSymm3(>12[index]); + CCTK_REAL const PDstandardNth1gt13 = PDstandardNth1(>13[index]); + CCTK_REAL const PDstandardNth2gt13 = PDstandardNth2(>13[index]); + CCTK_REAL const PDstandardNth3gt13 = PDstandardNth3(>13[index]); + CCTK_REAL const PDdissipationNth1gt13 = PDdissipationNth1(>13[index]); + CCTK_REAL const PDdissipationNth2gt13 = PDdissipationNth2(>13[index]); + CCTK_REAL const PDdissipationNth3gt13 = PDdissipationNth3(>13[index]); + CCTK_REAL const PDupwindNthAnti1gt13 = PDupwindNthAnti1(>13[index]); + CCTK_REAL const PDupwindNthSymm1gt13 = PDupwindNthSymm1(>13[index]); + CCTK_REAL const PDupwindNthAnti2gt13 = PDupwindNthAnti2(>13[index]); + CCTK_REAL const PDupwindNthSymm2gt13 = PDupwindNthSymm2(>13[index]); + CCTK_REAL const PDupwindNthAnti3gt13 = PDupwindNthAnti3(>13[index]); + CCTK_REAL const PDupwindNthSymm3gt13 = PDupwindNthSymm3(>13[index]); + CCTK_REAL const PDstandardNth1gt22 = PDstandardNth1(>22[index]); + CCTK_REAL const PDstandardNth2gt22 = PDstandardNth2(>22[index]); + CCTK_REAL const PDstandardNth3gt22 = PDstandardNth3(>22[index]); + CCTK_REAL const PDdissipationNth1gt22 = PDdissipationNth1(>22[index]); + CCTK_REAL const PDdissipationNth2gt22 = PDdissipationNth2(>22[index]); + CCTK_REAL const PDdissipationNth3gt22 = PDdissipationNth3(>22[index]); + CCTK_REAL const PDupwindNthAnti1gt22 = PDupwindNthAnti1(>22[index]); + CCTK_REAL const PDupwindNthSymm1gt22 = PDupwindNthSymm1(>22[index]); + CCTK_REAL const PDupwindNthAnti2gt22 = PDupwindNthAnti2(>22[index]); + CCTK_REAL const PDupwindNthSymm2gt22 = PDupwindNthSymm2(>22[index]); + CCTK_REAL const PDupwindNthAnti3gt22 = PDupwindNthAnti3(>22[index]); + CCTK_REAL const PDupwindNthSymm3gt22 = PDupwindNthSymm3(>22[index]); + CCTK_REAL const PDstandardNth1gt23 = PDstandardNth1(>23[index]); + CCTK_REAL const PDstandardNth2gt23 = PDstandardNth2(>23[index]); + CCTK_REAL const PDstandardNth3gt23 = PDstandardNth3(>23[index]); + CCTK_REAL const PDdissipationNth1gt23 = PDdissipationNth1(>23[index]); + CCTK_REAL const PDdissipationNth2gt23 = PDdissipationNth2(>23[index]); + CCTK_REAL const PDdissipationNth3gt23 = PDdissipationNth3(>23[index]); + CCTK_REAL const PDupwindNthAnti1gt23 = PDupwindNthAnti1(>23[index]); + CCTK_REAL const PDupwindNthSymm1gt23 = PDupwindNthSymm1(>23[index]); + CCTK_REAL const PDupwindNthAnti2gt23 = PDupwindNthAnti2(>23[index]); + CCTK_REAL const PDupwindNthSymm2gt23 = PDupwindNthSymm2(>23[index]); + CCTK_REAL const PDupwindNthAnti3gt23 = PDupwindNthAnti3(>23[index]); + CCTK_REAL const PDupwindNthSymm3gt23 = PDupwindNthSymm3(>23[index]); + CCTK_REAL const PDstandardNth1gt33 = PDstandardNth1(>33[index]); + CCTK_REAL const PDstandardNth2gt33 = PDstandardNth2(>33[index]); + CCTK_REAL const PDstandardNth3gt33 = PDstandardNth3(>33[index]); + CCTK_REAL const PDdissipationNth1gt33 = PDdissipationNth1(>33[index]); + CCTK_REAL const PDdissipationNth2gt33 = PDdissipationNth2(>33[index]); + CCTK_REAL const PDdissipationNth3gt33 = PDdissipationNth3(>33[index]); + CCTK_REAL const PDupwindNthAnti1gt33 = PDupwindNthAnti1(>33[index]); + CCTK_REAL const PDupwindNthSymm1gt33 = PDupwindNthSymm1(>33[index]); + CCTK_REAL const PDupwindNthAnti2gt33 = PDupwindNthAnti2(>33[index]); + CCTK_REAL const PDupwindNthSymm2gt33 = PDupwindNthSymm2(>33[index]); + CCTK_REAL const PDupwindNthAnti3gt33 = PDupwindNthAnti3(>33[index]); + CCTK_REAL const PDupwindNthSymm3gt33 = PDupwindNthSymm3(>33[index]); + CCTK_REAL const PDstandardNth1phi = PDstandardNth1(&phi[index]); + CCTK_REAL const PDstandardNth2phi = PDstandardNth2(&phi[index]); + CCTK_REAL const PDstandardNth3phi = PDstandardNth3(&phi[index]); + CCTK_REAL const PDdissipationNth1phi = PDdissipationNth1(&phi[index]); + CCTK_REAL const PDdissipationNth2phi = PDdissipationNth2(&phi[index]); + CCTK_REAL const PDdissipationNth3phi = PDdissipationNth3(&phi[index]); + CCTK_REAL const PDupwindNthAnti1phi = PDupwindNthAnti1(&phi[index]); + CCTK_REAL const PDupwindNthSymm1phi = PDupwindNthSymm1(&phi[index]); + CCTK_REAL const PDupwindNthAnti2phi = PDupwindNthAnti2(&phi[index]); + CCTK_REAL const PDupwindNthSymm2phi = PDupwindNthSymm2(&phi[index]); + CCTK_REAL const PDupwindNthAnti3phi = PDupwindNthAnti3(&phi[index]); + CCTK_REAL const PDupwindNthSymm3phi = PDupwindNthSymm3(&phi[index]); + CCTK_REAL const PDstandardNth1trK = PDstandardNth1(&trK[index]); + CCTK_REAL const PDstandardNth2trK = PDstandardNth2(&trK[index]); + CCTK_REAL const PDstandardNth3trK = PDstandardNth3(&trK[index]); + CCTK_REAL const PDdissipationNth1trK = PDdissipationNth1(&trK[index]); + CCTK_REAL const PDdissipationNth2trK = PDdissipationNth2(&trK[index]); + CCTK_REAL const PDdissipationNth3trK = PDdissipationNth3(&trK[index]); + CCTK_REAL const PDupwindNthAnti1trK = PDupwindNthAnti1(&trK[index]); + CCTK_REAL const PDupwindNthSymm1trK = PDupwindNthSymm1(&trK[index]); + CCTK_REAL const PDupwindNthAnti2trK = PDupwindNthAnti2(&trK[index]); + CCTK_REAL const PDupwindNthSymm2trK = PDupwindNthSymm2(&trK[index]); + CCTK_REAL const PDupwindNthAnti3trK = PDupwindNthAnti3(&trK[index]); + CCTK_REAL const PDupwindNthSymm3trK = PDupwindNthSymm3(&trK[index]); + CCTK_REAL const PDdissipationNth1Xt1 = PDdissipationNth1(&Xt1[index]); + CCTK_REAL const PDdissipationNth2Xt1 = PDdissipationNth2(&Xt1[index]); + CCTK_REAL const PDdissipationNth3Xt1 = PDdissipationNth3(&Xt1[index]); + CCTK_REAL const PDupwindNthAnti1Xt1 = PDupwindNthAnti1(&Xt1[index]); + CCTK_REAL const PDupwindNthSymm1Xt1 = PDupwindNthSymm1(&Xt1[index]); + CCTK_REAL const PDupwindNthAnti2Xt1 = PDupwindNthAnti2(&Xt1[index]); + CCTK_REAL const PDupwindNthSymm2Xt1 = PDupwindNthSymm2(&Xt1[index]); + CCTK_REAL const PDupwindNthAnti3Xt1 = PDupwindNthAnti3(&Xt1[index]); + CCTK_REAL const PDupwindNthSymm3Xt1 = PDupwindNthSymm3(&Xt1[index]); + CCTK_REAL const PDdissipationNth1Xt2 = PDdissipationNth1(&Xt2[index]); + CCTK_REAL const PDdissipationNth2Xt2 = PDdissipationNth2(&Xt2[index]); + CCTK_REAL const PDdissipationNth3Xt2 = PDdissipationNth3(&Xt2[index]); + CCTK_REAL const PDupwindNthAnti1Xt2 = PDupwindNthAnti1(&Xt2[index]); + CCTK_REAL const PDupwindNthSymm1Xt2 = PDupwindNthSymm1(&Xt2[index]); + CCTK_REAL const PDupwindNthAnti2Xt2 = PDupwindNthAnti2(&Xt2[index]); + CCTK_REAL const PDupwindNthSymm2Xt2 = PDupwindNthSymm2(&Xt2[index]); + CCTK_REAL const PDupwindNthAnti3Xt2 = PDupwindNthAnti3(&Xt2[index]); + CCTK_REAL const PDupwindNthSymm3Xt2 = PDupwindNthSymm3(&Xt2[index]); + CCTK_REAL const PDdissipationNth1Xt3 = PDdissipationNth1(&Xt3[index]); + CCTK_REAL const PDdissipationNth2Xt3 = PDdissipationNth2(&Xt3[index]); + CCTK_REAL const PDdissipationNth3Xt3 = PDdissipationNth3(&Xt3[index]); + CCTK_REAL const PDupwindNthAnti1Xt3 = PDupwindNthAnti1(&Xt3[index]); + CCTK_REAL const PDupwindNthSymm1Xt3 = PDupwindNthSymm1(&Xt3[index]); + CCTK_REAL const PDupwindNthAnti2Xt3 = PDupwindNthAnti2(&Xt3[index]); + CCTK_REAL const PDupwindNthSymm2Xt3 = PDupwindNthSymm2(&Xt3[index]); + CCTK_REAL const PDupwindNthAnti3Xt3 = PDupwindNthAnti3(&Xt3[index]); + CCTK_REAL const PDupwindNthSymm3Xt3 = PDupwindNthSymm3(&Xt3[index]); + + /* Calculate temporaries and grid functions */ + ptrdiff_t dir1 = Sign(beta1L); + + ptrdiff_t dir2 = Sign(beta2L); + + ptrdiff_t dir3 = Sign(beta3L); + + CCTK_REAL epsdiss1 = ToReal(EpsDiss); + + CCTK_REAL epsdiss2 = ToReal(EpsDiss); + + CCTK_REAL epsdiss3 = ToReal(EpsDiss); + + CCTK_REAL detgt = 1; + + CCTK_REAL gtu11 = INV(detgt)*(gt22L*gt33L - SQR(gt23L)); + + CCTK_REAL gtu12 = (gt13L*gt23L - gt12L*gt33L)*INV(detgt); + + CCTK_REAL gtu13 = (-(gt13L*gt22L) + gt12L*gt23L)*INV(detgt); + + CCTK_REAL gtu22 = INV(detgt)*(gt11L*gt33L - SQR(gt13L)); + + CCTK_REAL gtu23 = (gt12L*gt13L - gt11L*gt23L)*INV(detgt); + + CCTK_REAL gtu33 = INV(detgt)*(gt11L*gt22L - SQR(gt12L)); + + CCTK_REAL Gtl111 = 0.5*PDstandardNth1gt11; + + CCTK_REAL Gtl112 = 0.5*PDstandardNth2gt11; + + CCTK_REAL Gtl113 = 0.5*PDstandardNth3gt11; + + CCTK_REAL Gtl122 = -0.5*PDstandardNth1gt22 + PDstandardNth2gt12; + + CCTK_REAL Gtl123 = 0.5*(-PDstandardNth1gt23 + PDstandardNth2gt13 + + PDstandardNth3gt12); + + CCTK_REAL Gtl133 = -0.5*PDstandardNth1gt33 + PDstandardNth3gt13; + + CCTK_REAL Gtl211 = PDstandardNth1gt12 - 0.5*PDstandardNth2gt11; + + CCTK_REAL Gtl212 = 0.5*PDstandardNth1gt22; + + CCTK_REAL Gtl213 = 0.5*(PDstandardNth1gt23 - PDstandardNth2gt13 + + PDstandardNth3gt12); + + CCTK_REAL Gtl222 = 0.5*PDstandardNth2gt22; + + CCTK_REAL Gtl223 = 0.5*PDstandardNth3gt22; + + CCTK_REAL Gtl233 = -0.5*PDstandardNth2gt33 + PDstandardNth3gt23; + + CCTK_REAL Gtl311 = PDstandardNth1gt13 - 0.5*PDstandardNth3gt11; + + CCTK_REAL Gtl312 = 0.5*(PDstandardNth1gt23 + PDstandardNth2gt13 - + PDstandardNth3gt12); + + CCTK_REAL Gtl313 = 0.5*PDstandardNth1gt33; + + CCTK_REAL Gtl322 = PDstandardNth2gt23 - 0.5*PDstandardNth3gt22; + + CCTK_REAL Gtl323 = 0.5*PDstandardNth2gt33; + + CCTK_REAL Gtl333 = 0.5*PDstandardNth3gt33; + + CCTK_REAL Gt111 = Gtl111*gtu11 + Gtl211*gtu12 + Gtl311*gtu13; + + CCTK_REAL Gt211 = Gtl111*gtu12 + Gtl211*gtu22 + Gtl311*gtu23; + + CCTK_REAL Gt311 = Gtl111*gtu13 + Gtl211*gtu23 + Gtl311*gtu33; + + CCTK_REAL Gt112 = Gtl112*gtu11 + Gtl212*gtu12 + Gtl312*gtu13; + + CCTK_REAL Gt212 = Gtl112*gtu12 + Gtl212*gtu22 + Gtl312*gtu23; + + CCTK_REAL Gt312 = Gtl112*gtu13 + Gtl212*gtu23 + Gtl312*gtu33; + + CCTK_REAL Gt113 = Gtl113*gtu11 + Gtl213*gtu12 + Gtl313*gtu13; + + CCTK_REAL Gt213 = Gtl113*gtu12 + Gtl213*gtu22 + Gtl313*gtu23; + + CCTK_REAL Gt313 = Gtl113*gtu13 + Gtl213*gtu23 + Gtl313*gtu33; + + CCTK_REAL Gt122 = Gtl122*gtu11 + Gtl222*gtu12 + Gtl322*gtu13; + + CCTK_REAL Gt222 = Gtl122*gtu12 + Gtl222*gtu22 + Gtl322*gtu23; + + CCTK_REAL Gt322 = Gtl122*gtu13 + Gtl222*gtu23 + Gtl322*gtu33; + + CCTK_REAL Gt123 = Gtl123*gtu11 + Gtl223*gtu12 + Gtl323*gtu13; + + CCTK_REAL Gt223 = Gtl123*gtu12 + Gtl223*gtu22 + Gtl323*gtu23; + + CCTK_REAL Gt323 = Gtl123*gtu13 + Gtl223*gtu23 + Gtl323*gtu33; + + CCTK_REAL Gt133 = Gtl133*gtu11 + Gtl233*gtu12 + Gtl333*gtu13; + + CCTK_REAL Gt233 = Gtl133*gtu12 + Gtl233*gtu22 + Gtl333*gtu23; + + CCTK_REAL Gt333 = Gtl133*gtu13 + Gtl233*gtu23 + Gtl333*gtu33; + + CCTK_REAL Xtn1 = Gt111*gtu11 + Gt122*gtu22 + 2*(Gt112*gtu12 + + Gt113*gtu13 + Gt123*gtu23) + Gt133*gtu33; + + CCTK_REAL Xtn2 = Gt211*gtu11 + Gt222*gtu22 + 2*(Gt212*gtu12 + + Gt213*gtu13 + Gt223*gtu23) + Gt233*gtu33; + + CCTK_REAL Xtn3 = Gt311*gtu11 + Gt322*gtu22 + 2*(Gt312*gtu12 + + Gt313*gtu13 + Gt323*gtu23) + Gt333*gtu33; + + CCTK_REAL fac1 = IfThen(ToReal(conformalMethod),-0.5*INV(phiL),1); + + CCTK_REAL cdphi1 = fac1*PDstandardNth1phi; + + CCTK_REAL cdphi2 = fac1*PDstandardNth2phi; + + CCTK_REAL cdphi3 = fac1*PDstandardNth3phi; + + CCTK_REAL Atm11 = At11L*gtu11 + At12L*gtu12 + At13L*gtu13; + + CCTK_REAL Atm21 = At11L*gtu12 + At12L*gtu22 + At13L*gtu23; + + CCTK_REAL Atm31 = At11L*gtu13 + At12L*gtu23 + At13L*gtu33; + + CCTK_REAL Atm12 = At12L*gtu11 + At22L*gtu12 + At23L*gtu13; + + CCTK_REAL Atm22 = At12L*gtu12 + At22L*gtu22 + At23L*gtu23; + + CCTK_REAL Atm32 = At12L*gtu13 + At22L*gtu23 + At23L*gtu33; + + CCTK_REAL Atm13 = At13L*gtu11 + At23L*gtu12 + At33L*gtu13; + + CCTK_REAL Atm23 = At13L*gtu12 + At23L*gtu22 + At33L*gtu23; + + CCTK_REAL Atm33 = At13L*gtu13 + At23L*gtu23 + At33L*gtu33; + + CCTK_REAL Atu11 = Atm11*gtu11 + Atm12*gtu12 + Atm13*gtu13; + + CCTK_REAL Atu12 = Atm11*gtu12 + Atm12*gtu22 + Atm13*gtu23; + + CCTK_REAL Atu13 = Atm11*gtu13 + Atm12*gtu23 + Atm13*gtu33; + + CCTK_REAL Atu22 = Atm21*gtu12 + Atm22*gtu22 + Atm23*gtu23; + + CCTK_REAL Atu23 = Atm21*gtu13 + Atm22*gtu23 + Atm23*gtu33; + + CCTK_REAL Atu33 = Atm31*gtu13 + Atm32*gtu23 + Atm33*gtu33; + + CCTK_REAL e4phi = + IfThen(ToReal(conformalMethod),INV(SQR(phiL)),exp(4*phiL)); + + CCTK_REAL em4phi = INV(e4phi); + + CCTK_REAL rho = INV(SQR(alphaL))*(eTttL - 2*(beta2L*eTtyL + + beta3L*eTtzL) + 2*(beta1L*(-eTtxL + beta2L*eTxyL + beta3L*eTxzL) + + beta2L*beta3L*eTyzL) + eTxxL*SQR(beta1L) + eTyyL*SQR(beta2L) + + eTzzL*SQR(beta3L)); + + CCTK_REAL S1 = (-eTtxL + beta1L*eTxxL + beta2L*eTxyL + + beta3L*eTxzL)*INV(alphaL); + + CCTK_REAL S2 = (-eTtyL + beta1L*eTxyL + beta2L*eTyyL + + beta3L*eTyzL)*INV(alphaL); + + CCTK_REAL S3 = (-eTtzL + beta1L*eTxzL + beta2L*eTyzL + + beta3L*eTzzL)*INV(alphaL); + + CCTK_REAL trS = em4phi*(eTxxL*gtu11 + eTyyL*gtu22 + 2*(eTxyL*gtu12 + + eTxzL*gtu13 + eTyzL*gtu23) + eTzzL*gtu33); + + CCTK_REAL phirhsL = epsdiss1*PDdissipationNth1phi + + epsdiss2*PDdissipationNth2phi + epsdiss3*PDdissipationNth3phi + + beta1L*PDupwindNthAnti1phi + beta2L*PDupwindNthAnti2phi + + beta3L*PDupwindNthAnti3phi + PDupwindNthSymm1phi*Abs(beta1L) + + PDupwindNthSymm2phi*Abs(beta2L) + PDupwindNthSymm3phi*Abs(beta3L) + + IfThen(ToReal(conformalMethod),phiL*(-0.333333333333333333333333333333*(PDstandardNth1beta1 + + PDstandardNth2beta2 + PDstandardNth3beta3) + + 0.333333333333333333333333333333*alphaL*trKL),0.166666666666666666666666666667*(PDstandardNth1beta1 + + PDstandardNth2beta2 + PDstandardNth3beta3) - + 0.166666666666666666666666666667*alphaL*trKL); + + CCTK_REAL gt11rhsL = -2*alphaL*At11L + epsdiss1*PDdissipationNth1gt11 + + epsdiss2*PDdissipationNth2gt11 + epsdiss3*PDdissipationNth3gt11 + + 2*(gt12L*PDstandardNth1beta2 + gt13L*PDstandardNth1beta3) + + gt11L*(1.33333333333333333333333333333*PDstandardNth1beta1 - + 0.666666666666666666666666666667*(PDstandardNth2beta2 + + PDstandardNth3beta3)) + beta1L*PDupwindNthAnti1gt11 + + beta2L*PDupwindNthAnti2gt11 + beta3L*PDupwindNthAnti3gt11 + + PDupwindNthSymm1gt11*Abs(beta1L) + PDupwindNthSymm2gt11*Abs(beta2L) + + PDupwindNthSymm3gt11*Abs(beta3L); + + CCTK_REAL gt12rhsL = -2*alphaL*At12L + epsdiss1*PDdissipationNth1gt12 + + epsdiss2*PDdissipationNth2gt12 + epsdiss3*PDdissipationNth3gt12 + + gt22L*PDstandardNth1beta2 + gt23L*PDstandardNth1beta3 + + gt11L*PDstandardNth2beta1 + gt13L*PDstandardNth2beta3 + + gt12L*(0.333333333333333333333333333333*(PDstandardNth1beta1 + + PDstandardNth2beta2) - + 0.666666666666666666666666666667*PDstandardNth3beta3) + + beta1L*PDupwindNthAnti1gt12 + beta2L*PDupwindNthAnti2gt12 + + beta3L*PDupwindNthAnti3gt12 + PDupwindNthSymm1gt12*Abs(beta1L) + + PDupwindNthSymm2gt12*Abs(beta2L) + PDupwindNthSymm3gt12*Abs(beta3L); + + CCTK_REAL gt13rhsL = -2*alphaL*At13L + epsdiss1*PDdissipationNth1gt13 + + epsdiss2*PDdissipationNth2gt13 + epsdiss3*PDdissipationNth3gt13 + + gt23L*PDstandardNth1beta2 + gt33L*PDstandardNth1beta3 + + gt11L*PDstandardNth3beta1 + gt12L*PDstandardNth3beta2 + + gt13L*(-0.666666666666666666666666666667*PDstandardNth2beta2 + + 0.333333333333333333333333333333*(PDstandardNth1beta1 + + PDstandardNth3beta3)) + beta1L*PDupwindNthAnti1gt13 + + beta2L*PDupwindNthAnti2gt13 + beta3L*PDupwindNthAnti3gt13 + + PDupwindNthSymm1gt13*Abs(beta1L) + PDupwindNthSymm2gt13*Abs(beta2L) + + PDupwindNthSymm3gt13*Abs(beta3L); + + CCTK_REAL gt22rhsL = -2*alphaL*At22L + epsdiss1*PDdissipationNth1gt22 + + epsdiss2*PDdissipationNth2gt22 + epsdiss3*PDdissipationNth3gt22 + + 2*(gt12L*PDstandardNth2beta1 + gt23L*PDstandardNth2beta3) + + gt22L*(1.33333333333333333333333333333*PDstandardNth2beta2 - + 0.666666666666666666666666666667*(PDstandardNth1beta1 + + PDstandardNth3beta3)) + beta1L*PDupwindNthAnti1gt22 + + beta2L*PDupwindNthAnti2gt22 + beta3L*PDupwindNthAnti3gt22 + + PDupwindNthSymm1gt22*Abs(beta1L) + PDupwindNthSymm2gt22*Abs(beta2L) + + PDupwindNthSymm3gt22*Abs(beta3L); + + CCTK_REAL gt23rhsL = -2*alphaL*At23L + epsdiss1*PDdissipationNth1gt23 + + epsdiss2*PDdissipationNth2gt23 + epsdiss3*PDdissipationNth3gt23 + + gt13L*PDstandardNth2beta1 + gt33L*PDstandardNth2beta3 + + gt12L*PDstandardNth3beta1 + gt22L*PDstandardNth3beta2 + + gt23L*(-0.666666666666666666666666666667*PDstandardNth1beta1 + + 0.333333333333333333333333333333*(PDstandardNth2beta2 + + PDstandardNth3beta3)) + beta1L*PDupwindNthAnti1gt23 + + beta2L*PDupwindNthAnti2gt23 + beta3L*PDupwindNthAnti3gt23 + + PDupwindNthSymm1gt23*Abs(beta1L) + PDupwindNthSymm2gt23*Abs(beta2L) + + PDupwindNthSymm3gt23*Abs(beta3L); + + CCTK_REAL gt33rhsL = -2*alphaL*At33L + epsdiss1*PDdissipationNth1gt33 + + epsdiss2*PDdissipationNth2gt33 + epsdiss3*PDdissipationNth3gt33 + + 2*(gt13L*PDstandardNth3beta1 + gt23L*PDstandardNth3beta2) + + gt33L*(-0.666666666666666666666666666667*(PDstandardNth1beta1 + + PDstandardNth2beta2) + + 1.33333333333333333333333333333*PDstandardNth3beta3) + + beta1L*PDupwindNthAnti1gt33 + beta2L*PDupwindNthAnti2gt33 + + beta3L*PDupwindNthAnti3gt33 + PDupwindNthSymm1gt33*Abs(beta1L) + + PDupwindNthSymm2gt33*Abs(beta2L) + PDupwindNthSymm3gt33*Abs(beta3L); + + CCTK_REAL dotXt1 = + 0.333333333333333333333333333333*(7*(gtu12*PDstandardNth12beta1 + + gtu13*PDstandardNth13beta1) + gtu11*(4*PDstandardNth11beta1 + + PDstandardNth12beta2 + PDstandardNth13beta3) + + gtu12*(PDstandardNth22beta2 + PDstandardNth23beta3) + + gtu13*(PDstandardNth23beta2 + PDstandardNth33beta3) - + 6*(Atu11*PDstandardNth1alpha + Atu12*PDstandardNth2alpha + + Atu13*PDstandardNth3alpha) + 6*(gtu23*PDstandardNth23beta1 + + alphaL*(6*(Atu11*cdphi1 + Atu12*cdphi2 + Atu13*cdphi3) + Atu11*Gt111 + + Atu22*Gt122 + 2*(Atu12*Gt112 + Atu13*Gt113 + Atu23*Gt123) + Atu33*Gt133 + - 0.666666666666666666666666666667*(gtu11*PDstandardNth1trK + + gtu12*PDstandardNth2trK + gtu13*PDstandardNth3trK))) - + 150.7964473723100754462068823974161384415*alphaL*(gtu11*S1 + gtu12*S2 + + gtu13*S3) + (-3*PDstandardNth1beta1 + 2*(PDstandardNth1beta1 + + PDstandardNth2beta2 + PDstandardNth3beta3))*Xtn1 - + 3*(PDstandardNth2beta1*Xtn2 + PDstandardNth3beta1*Xtn3) + + 3*(epsdiss1*PDdissipationNth1Xt1 + epsdiss2*PDdissipationNth2Xt1 + + epsdiss3*PDdissipationNth3Xt1 + gtu22*PDstandardNth22beta1 + + gtu33*PDstandardNth33beta1 + beta1L*PDupwindNthAnti1Xt1 + + beta2L*PDupwindNthAnti2Xt1 + beta3L*PDupwindNthAnti3Xt1 + + PDupwindNthSymm1Xt1*Abs(beta1L) + PDupwindNthSymm2Xt1*Abs(beta2L) + + PDupwindNthSymm3Xt1*Abs(beta3L))); + + CCTK_REAL dotXt2 = + 0.333333333333333333333333333333*(gtu12*(PDstandardNth11beta1 + + 7*PDstandardNth12beta2 + PDstandardNth13beta3) + + gtu22*(PDstandardNth12beta1 + 4*PDstandardNth22beta2 + + PDstandardNth23beta3) + gtu23*(PDstandardNth13beta1 + + 7*PDstandardNth23beta2 + PDstandardNth33beta3) - + 6*(Atu12*PDstandardNth1alpha + Atu22*PDstandardNth2alpha + + Atu23*PDstandardNth3alpha) + 6*(gtu13*PDstandardNth13beta2 + + alphaL*(6*(Atu12*cdphi1 + Atu22*cdphi2 + Atu23*cdphi3) + Atu11*Gt211 + + Atu22*Gt222 + 2*(Atu12*Gt212 + Atu13*Gt213 + Atu23*Gt223) + Atu33*Gt233 + - 0.666666666666666666666666666667*(gtu12*PDstandardNth1trK + + gtu22*PDstandardNth2trK + gtu23*PDstandardNth3trK))) - + 150.7964473723100754462068823974161384415*alphaL*(gtu12*S1 + gtu22*S2 + + gtu23*S3) + 2*(PDstandardNth1beta1 + PDstandardNth2beta2 + + PDstandardNth3beta3)*Xtn2 - 3*(PDstandardNth1beta2*Xtn1 + + PDstandardNth2beta2*Xtn2 + PDstandardNth3beta2*Xtn3) + + 3*(epsdiss1*PDdissipationNth1Xt2 + epsdiss2*PDdissipationNth2Xt2 + + epsdiss3*PDdissipationNth3Xt2 + gtu11*PDstandardNth11beta2 + + gtu33*PDstandardNth33beta2 + beta1L*PDupwindNthAnti1Xt2 + + beta2L*PDupwindNthAnti2Xt2 + beta3L*PDupwindNthAnti3Xt2 + + PDupwindNthSymm1Xt2*Abs(beta1L) + PDupwindNthSymm2Xt2*Abs(beta2L) + + PDupwindNthSymm3Xt2*Abs(beta3L))); + + CCTK_REAL dotXt3 = + 0.333333333333333333333333333333*(gtu13*(PDstandardNth11beta1 + + PDstandardNth12beta2 + 7*PDstandardNth13beta3) + + gtu23*(PDstandardNth12beta1 + PDstandardNth22beta2 + + 7*PDstandardNth23beta3) + gtu33*(PDstandardNth13beta1 + + PDstandardNth23beta2 + 4*PDstandardNth33beta3) - + 6*(Atu13*PDstandardNth1alpha + Atu23*PDstandardNth2alpha + + Atu33*PDstandardNth3alpha) + 6*(gtu12*PDstandardNth12beta3 + + alphaL*(6*(Atu13*cdphi1 + Atu23*cdphi2 + Atu33*cdphi3) + Atu11*Gt311 + + Atu22*Gt322 + 2*(Atu12*Gt312 + Atu13*Gt313 + Atu23*Gt323) + Atu33*Gt333 + - 0.666666666666666666666666666667*(gtu13*PDstandardNth1trK + + gtu23*PDstandardNth2trK + gtu33*PDstandardNth3trK))) - + 150.7964473723100754462068823974161384415*alphaL*(gtu13*S1 + gtu23*S2 + + gtu33*S3) + 2*(PDstandardNth1beta1 + PDstandardNth2beta2 + + PDstandardNth3beta3)*Xtn3 - 3*(PDstandardNth1beta3*Xtn1 + + PDstandardNth2beta3*Xtn2 + PDstandardNth3beta3*Xtn3) + + 3*(epsdiss1*PDdissipationNth1Xt3 + epsdiss2*PDdissipationNth2Xt3 + + epsdiss3*PDdissipationNth3Xt3 + gtu11*PDstandardNth11beta3 + + gtu22*PDstandardNth22beta3 + beta1L*PDupwindNthAnti1Xt3 + + beta2L*PDupwindNthAnti2Xt3 + beta3L*PDupwindNthAnti3Xt3 + + PDupwindNthSymm1Xt3*Abs(beta1L) + PDupwindNthSymm2Xt3*Abs(beta2L) + + PDupwindNthSymm3Xt3*Abs(beta3L))); + + CCTK_REAL Xt1rhsL = dotXt1; + + CCTK_REAL Xt2rhsL = dotXt2; + + CCTK_REAL Xt3rhsL = dotXt3; + + CCTK_REAL dottrK = epsdiss1*PDdissipationNth1trK + + epsdiss2*PDdissipationNth2trK + epsdiss3*PDdissipationNth3trK + + beta1L*PDupwindNthAnti1trK + beta2L*PDupwindNthAnti2trK + + beta3L*PDupwindNthAnti3trK - em4phi*(gtu11*PDstandardNth11alpha + + gtu22*PDstandardNth22alpha + gtu33*(PDstandardNth33alpha + + 2*cdphi3*PDstandardNth3alpha) + 2*(gtu12*PDstandardNth12alpha + + gtu13*(PDstandardNth13alpha + cdphi1*PDstandardNth3alpha) + + gtu23*(PDstandardNth23alpha + cdphi2*PDstandardNth3alpha)) + + PDstandardNth1alpha*(2*(cdphi1*gtu11 + cdphi2*gtu12 + cdphi3*gtu13) - + Xtn1) + PDstandardNth2alpha*(2*(cdphi1*gtu12 + cdphi2*gtu22 + + cdphi3*gtu23) - Xtn2) - PDstandardNth3alpha*Xtn3) + + PDupwindNthSymm1trK*Abs(beta1L) + PDupwindNthSymm2trK*Abs(beta2L) + + PDupwindNthSymm3trK*Abs(beta3L) + alphaL*(2*(Atm12*Atm21 + Atm13*Atm31 + + Atm23*Atm32) + 12.56637061435917295385057353311801153679*(rho + trS) + + SQR(Atm11) + SQR(Atm22) + SQR(Atm33) + + 0.333333333333333333333333333333*SQR(trKL)); + + CCTK_REAL trKrhsL = dottrK; + + CCTK_REAL alpharhsL = epsdiss1*PDdissipationNth1alpha + + epsdiss2*PDdissipationNth2alpha + epsdiss3*PDdissipationNth3alpha - + pow(alphaL,ToReal(harmonicN))*ToReal(harmonicF)*(trKL + (AL - + trKL)*ToReal(LapseACoeff)) + (beta1L*PDupwindNthAnti1alpha + + beta2L*PDupwindNthAnti2alpha + beta3L*PDupwindNthAnti3alpha + + PDupwindNthSymm1alpha*Abs(beta1L) + PDupwindNthSymm2alpha*Abs(beta2L) + + PDupwindNthSymm3alpha*Abs(beta3L))*ToReal(LapseAdvectionCoeff); + + CCTK_REAL ArhsL = epsdiss1*PDdissipationNth1A + + epsdiss2*PDdissipationNth2A + epsdiss3*PDdissipationNth3A + (dottrK - + AL*ToReal(AlphaDriver))*ToReal(LapseACoeff) + (beta1L*PDupwindNthAnti1A + + beta2L*PDupwindNthAnti2A + beta3L*PDupwindNthAnti3A + + PDupwindNthSymm1A*Abs(beta1L) + PDupwindNthSymm2A*Abs(beta2L) + + PDupwindNthSymm3A*Abs(beta3L))*ToReal(LapseAdvectionCoeff); + + CCTK_REAL eta = fmin(1,INV(rL)*ToReal(SpatialBetaDriverRadius)); + + CCTK_REAL theta = fmin(1,exp(1 - + rL*INV(ToReal(SpatialShiftGammaCoeffRadius)))); + + CCTK_REAL beta1rhsL = epsdiss1*PDdissipationNth1beta1 + + epsdiss2*PDdissipationNth2beta1 + epsdiss3*PDdissipationNth3beta1 + + (beta1L*PDupwindNthAnti1beta1 + beta2L*PDupwindNthAnti2beta1 + + beta3L*PDupwindNthAnti3beta1 + PDupwindNthSymm1beta1*Abs(beta1L) + + PDupwindNthSymm2beta1*Abs(beta2L) + + PDupwindNthSymm3beta1*Abs(beta3L))*ToReal(ShiftAdvectionCoeff) + + theta*(Xt1L + beta1L*eta*ToReal(BetaDriver)*(-1 + ToReal(ShiftBCoeff)) + + (B1L - Xt1L)*ToReal(ShiftBCoeff))*ToReal(ShiftGammaCoeff); + + CCTK_REAL beta2rhsL = epsdiss1*PDdissipationNth1beta2 + + epsdiss2*PDdissipationNth2beta2 + epsdiss3*PDdissipationNth3beta2 + + (beta1L*PDupwindNthAnti1beta2 + beta2L*PDupwindNthAnti2beta2 + + beta3L*PDupwindNthAnti3beta2 + PDupwindNthSymm1beta2*Abs(beta1L) + + PDupwindNthSymm2beta2*Abs(beta2L) + + PDupwindNthSymm3beta2*Abs(beta3L))*ToReal(ShiftAdvectionCoeff) + + theta*(Xt2L + beta2L*eta*ToReal(BetaDriver)*(-1 + ToReal(ShiftBCoeff)) + + (B2L - Xt2L)*ToReal(ShiftBCoeff))*ToReal(ShiftGammaCoeff); + + CCTK_REAL beta3rhsL = epsdiss1*PDdissipationNth1beta3 + + epsdiss2*PDdissipationNth2beta3 + epsdiss3*PDdissipationNth3beta3 + + (beta1L*PDupwindNthAnti1beta3 + beta2L*PDupwindNthAnti2beta3 + + beta3L*PDupwindNthAnti3beta3 + PDupwindNthSymm1beta3*Abs(beta1L) + + PDupwindNthSymm2beta3*Abs(beta2L) + + PDupwindNthSymm3beta3*Abs(beta3L))*ToReal(ShiftAdvectionCoeff) + + theta*(Xt3L + beta3L*eta*ToReal(BetaDriver)*(-1 + ToReal(ShiftBCoeff)) + + (B3L - Xt3L)*ToReal(ShiftBCoeff))*ToReal(ShiftGammaCoeff); + + CCTK_REAL B1rhsL = epsdiss1*PDdissipationNth1B1 + + epsdiss2*PDdissipationNth2B1 + epsdiss3*PDdissipationNth3B1 + + (beta1L*(PDupwindNthAnti1B1 - PDupwindNthAnti1Xt1) + + beta2L*(PDupwindNthAnti2B1 - PDupwindNthAnti2Xt1) + + beta3L*(PDupwindNthAnti3B1 - PDupwindNthAnti3Xt1) + (PDupwindNthSymm1B1 + - PDupwindNthSymm1Xt1)*Abs(beta1L) + (PDupwindNthSymm2B1 - + PDupwindNthSymm2Xt1)*Abs(beta2L) + (PDupwindNthSymm3B1 - + PDupwindNthSymm3Xt1)*Abs(beta3L))*ToReal(ShiftAdvectionCoeff) + (dotXt1 + - B1L*eta*ToReal(BetaDriver))*ToReal(ShiftBCoeff); + + CCTK_REAL B2rhsL = epsdiss1*PDdissipationNth1B2 + + epsdiss2*PDdissipationNth2B2 + epsdiss3*PDdissipationNth3B2 + + (beta1L*(PDupwindNthAnti1B2 - PDupwindNthAnti1Xt2) + + beta2L*(PDupwindNthAnti2B2 - PDupwindNthAnti2Xt2) + + beta3L*(PDupwindNthAnti3B2 - PDupwindNthAnti3Xt2) + (PDupwindNthSymm1B2 + - PDupwindNthSymm1Xt2)*Abs(beta1L) + (PDupwindNthSymm2B2 - + PDupwindNthSymm2Xt2)*Abs(beta2L) + (PDupwindNthSymm3B2 - + PDupwindNthSymm3Xt2)*Abs(beta3L))*ToReal(ShiftAdvectionCoeff) + (dotXt2 + - B2L*eta*ToReal(BetaDriver))*ToReal(ShiftBCoeff); + + CCTK_REAL B3rhsL = epsdiss1*PDdissipationNth1B3 + + epsdiss2*PDdissipationNth2B3 + epsdiss3*PDdissipationNth3B3 + + (beta1L*(PDupwindNthAnti1B3 - PDupwindNthAnti1Xt3) + + beta2L*(PDupwindNthAnti2B3 - PDupwindNthAnti2Xt3) + + beta3L*(PDupwindNthAnti3B3 - PDupwindNthAnti3Xt3) + (PDupwindNthSymm1B3 + - PDupwindNthSymm1Xt3)*Abs(beta1L) + (PDupwindNthSymm2B3 - + PDupwindNthSymm2Xt3)*Abs(beta2L) + (PDupwindNthSymm3B3 - + PDupwindNthSymm3Xt3)*Abs(beta3L))*ToReal(ShiftAdvectionCoeff) + (dotXt3 + - B3L*eta*ToReal(BetaDriver))*ToReal(ShiftBCoeff); + + + /* Copy local copies back to grid functions */ + alpharhs[index] = alpharhsL; + Arhs[index] = ArhsL; + B1rhs[index] = B1rhsL; + B2rhs[index] = B2rhsL; + B3rhs[index] = B3rhsL; + beta1rhs[index] = beta1rhsL; + beta2rhs[index] = beta2rhsL; + beta3rhs[index] = beta3rhsL; + gt11rhs[index] = gt11rhsL; + gt12rhs[index] = gt12rhsL; + gt13rhs[index] = gt13rhsL; + gt22rhs[index] = gt22rhsL; + gt23rhs[index] = gt23rhsL; + gt33rhs[index] = gt33rhsL; + phirhs[index] = phirhsL; + trKrhs[index] = trKrhsL; + Xt1rhs[index] = Xt1rhsL; + Xt2rhs[index] = Xt2rhsL; + Xt3rhs[index] = Xt3rhsL; + } + LC_ENDLOOP3 (ML_BSSN_O2_RHS1); +} + +extern "C" void ML_BSSN_O2_RHS1(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverInterior(cctkGH, &ML_BSSN_O2_RHS1_Body); +} diff --git a/ML_BSSN_O2/src/ML_BSSN_O2_RHS2.cc b/ML_BSSN_O2/src/ML_BSSN_O2_RHS2.cc new file mode 100644 index 0000000..d77749c --- /dev/null +++ b/ML_BSSN_O2/src/ML_BSSN_O2_RHS2.cc @@ -0,0 +1,800 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +extern "C" void ML_BSSN_O2_RHS2_SelectBCs(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT ierr = 0; + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_O2::ML_curvrhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_O2::ML_curvrhs."); + return; +} + +static void ML_BSSN_O2_RHS2_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_BSSN_O2_RHS2_Body"); + } + + if (cctk_iteration % ML_BSSN_O2_RHS2_calc_every != ML_BSSN_O2_RHS2_calc_offset) + { + return; + } + + const char *groups[] = {"ML_BSSN_O2::ML_curv","ML_BSSN_O2::ML_curvrhs","ML_BSSN_O2::ML_Gamma","ML_BSSN_O2::ML_lapse","ML_BSSN_O2::ML_log_confac","ML_BSSN_O2::ML_metric","ML_BSSN_O2::ML_shift","ML_BSSN_O2::ML_trace_curv"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_BSSN_O2_RHS2", 8, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o16dx = 0.0625*INV(dx); + CCTK_REAL const p1o16dy = 0.0625*INV(dy); + CCTK_REAL const p1o16dz = 0.0625*INV(dz); + CCTK_REAL const p1o2dx = 0.5*INV(dx); + CCTK_REAL const p1o2dy = 0.5*INV(dy); + CCTK_REAL const p1o2dz = 0.5*INV(dz); + CCTK_REAL const p1o4dx = 0.25*INV(dx); + CCTK_REAL const p1o4dxdy = 0.25*INV(dx)*INV(dy); + CCTK_REAL const p1o4dxdz = 0.25*INV(dx)*INV(dz); + CCTK_REAL const p1o4dy = 0.25*INV(dy); + CCTK_REAL const p1o4dydz = 0.25*INV(dy)*INV(dz); + CCTK_REAL const p1o4dz = 0.25*INV(dz); + CCTK_REAL const p1odx = INV(dx); + CCTK_REAL const p1odx2 = INV(SQR(dx)); + CCTK_REAL const p1ody = INV(dy); + CCTK_REAL const p1ody2 = INV(SQR(dy)); + CCTK_REAL const p1odz = INV(dz); + CCTK_REAL const p1odz2 = INV(SQR(dz)); + CCTK_REAL const pm1o2dx = -0.5*INV(dx); + CCTK_REAL const pm1o2dy = -0.5*INV(dy); + CCTK_REAL const pm1o2dz = -0.5*INV(dz); + CCTK_REAL const pm1o4dx = -0.25*INV(dx); + CCTK_REAL const pm1o4dy = -0.25*INV(dy); + CCTK_REAL const pm1o4dz = -0.25*INV(dz); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_BSSN_O2_RHS2, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + CCTK_REAL alphaL = alpha[index]; + CCTK_REAL At11L = At11[index]; + CCTK_REAL At12L = At12[index]; + CCTK_REAL At13L = At13[index]; + CCTK_REAL At22L = At22[index]; + CCTK_REAL At23L = At23[index]; + CCTK_REAL At33L = At33[index]; + CCTK_REAL beta1L = beta1[index]; + CCTK_REAL beta2L = beta2[index]; + CCTK_REAL beta3L = beta3[index]; + CCTK_REAL eTxxL = (*stress_energy_state) ? eTxx[index] : ToReal(0.0); + CCTK_REAL eTxyL = (*stress_energy_state) ? eTxy[index] : ToReal(0.0); + CCTK_REAL eTxzL = (*stress_energy_state) ? eTxz[index] : ToReal(0.0); + CCTK_REAL eTyyL = (*stress_energy_state) ? eTyy[index] : ToReal(0.0); + CCTK_REAL eTyzL = (*stress_energy_state) ? eTyz[index] : ToReal(0.0); + CCTK_REAL eTzzL = (*stress_energy_state) ? eTzz[index] : ToReal(0.0); + CCTK_REAL gt11L = gt11[index]; + CCTK_REAL gt12L = gt12[index]; + CCTK_REAL gt13L = gt13[index]; + CCTK_REAL gt22L = gt22[index]; + CCTK_REAL gt23L = gt23[index]; + CCTK_REAL gt33L = gt33[index]; + CCTK_REAL phiL = phi[index]; + CCTK_REAL trKL = trK[index]; + CCTK_REAL Xt1L = Xt1[index]; + CCTK_REAL Xt2L = Xt2[index]; + CCTK_REAL Xt3L = Xt3[index]; + + /* Include user supplied include files */ + + /* Precompute derivatives */ + CCTK_REAL const PDstandardNth1alpha = PDstandardNth1(&alpha[index]); + CCTK_REAL const PDstandardNth2alpha = PDstandardNth2(&alpha[index]); + CCTK_REAL const PDstandardNth3alpha = PDstandardNth3(&alpha[index]); + CCTK_REAL const PDstandardNth11alpha = PDstandardNth11(&alpha[index]); + CCTK_REAL const PDstandardNth22alpha = PDstandardNth22(&alpha[index]); + CCTK_REAL const PDstandardNth33alpha = PDstandardNth33(&alpha[index]); + CCTK_REAL const PDstandardNth12alpha = PDstandardNth12(&alpha[index]); + CCTK_REAL const PDstandardNth13alpha = PDstandardNth13(&alpha[index]); + CCTK_REAL const PDstandardNth23alpha = PDstandardNth23(&alpha[index]); + CCTK_REAL const PDdissipationNth1At11 = PDdissipationNth1(&At11[index]); + CCTK_REAL const PDdissipationNth2At11 = PDdissipationNth2(&At11[index]); + CCTK_REAL const PDdissipationNth3At11 = PDdissipationNth3(&At11[index]); + CCTK_REAL const PDupwindNthAnti1At11 = PDupwindNthAnti1(&At11[index]); + CCTK_REAL const PDupwindNthSymm1At11 = PDupwindNthSymm1(&At11[index]); + CCTK_REAL const PDupwindNthAnti2At11 = PDupwindNthAnti2(&At11[index]); + CCTK_REAL const PDupwindNthSymm2At11 = PDupwindNthSymm2(&At11[index]); + CCTK_REAL const PDupwindNthAnti3At11 = PDupwindNthAnti3(&At11[index]); + CCTK_REAL const PDupwindNthSymm3At11 = PDupwindNthSymm3(&At11[index]); + CCTK_REAL const PDdissipationNth1At12 = PDdissipationNth1(&At12[index]); + CCTK_REAL const PDdissipationNth2At12 = PDdissipationNth2(&At12[index]); + CCTK_REAL const PDdissipationNth3At12 = PDdissipationNth3(&At12[index]); + CCTK_REAL const PDupwindNthAnti1At12 = PDupwindNthAnti1(&At12[index]); + CCTK_REAL const PDupwindNthSymm1At12 = PDupwindNthSymm1(&At12[index]); + CCTK_REAL const PDupwindNthAnti2At12 = PDupwindNthAnti2(&At12[index]); + CCTK_REAL const PDupwindNthSymm2At12 = PDupwindNthSymm2(&At12[index]); + CCTK_REAL const PDupwindNthAnti3At12 = PDupwindNthAnti3(&At12[index]); + CCTK_REAL const PDupwindNthSymm3At12 = PDupwindNthSymm3(&At12[index]); + CCTK_REAL const PDdissipationNth1At13 = PDdissipationNth1(&At13[index]); + CCTK_REAL const PDdissipationNth2At13 = PDdissipationNth2(&At13[index]); + CCTK_REAL const PDdissipationNth3At13 = PDdissipationNth3(&At13[index]); + CCTK_REAL const PDupwindNthAnti1At13 = PDupwindNthAnti1(&At13[index]); + CCTK_REAL const PDupwindNthSymm1At13 = PDupwindNthSymm1(&At13[index]); + CCTK_REAL const PDupwindNthAnti2At13 = PDupwindNthAnti2(&At13[index]); + CCTK_REAL const PDupwindNthSymm2At13 = PDupwindNthSymm2(&At13[index]); + CCTK_REAL const PDupwindNthAnti3At13 = PDupwindNthAnti3(&At13[index]); + CCTK_REAL const PDupwindNthSymm3At13 = PDupwindNthSymm3(&At13[index]); + CCTK_REAL const PDdissipationNth1At22 = PDdissipationNth1(&At22[index]); + CCTK_REAL const PDdissipationNth2At22 = PDdissipationNth2(&At22[index]); + CCTK_REAL const PDdissipationNth3At22 = PDdissipationNth3(&At22[index]); + CCTK_REAL const PDupwindNthAnti1At22 = PDupwindNthAnti1(&At22[index]); + CCTK_REAL const PDupwindNthSymm1At22 = PDupwindNthSymm1(&At22[index]); + CCTK_REAL const PDupwindNthAnti2At22 = PDupwindNthAnti2(&At22[index]); + CCTK_REAL const PDupwindNthSymm2At22 = PDupwindNthSymm2(&At22[index]); + CCTK_REAL const PDupwindNthAnti3At22 = PDupwindNthAnti3(&At22[index]); + CCTK_REAL const PDupwindNthSymm3At22 = PDupwindNthSymm3(&At22[index]); + CCTK_REAL const PDdissipationNth1At23 = PDdissipationNth1(&At23[index]); + CCTK_REAL const PDdissipationNth2At23 = PDdissipationNth2(&At23[index]); + CCTK_REAL const PDdissipationNth3At23 = PDdissipationNth3(&At23[index]); + CCTK_REAL const PDupwindNthAnti1At23 = PDupwindNthAnti1(&At23[index]); + CCTK_REAL const PDupwindNthSymm1At23 = PDupwindNthSymm1(&At23[index]); + CCTK_REAL const PDupwindNthAnti2At23 = PDupwindNthAnti2(&At23[index]); + CCTK_REAL const PDupwindNthSymm2At23 = PDupwindNthSymm2(&At23[index]); + CCTK_REAL const PDupwindNthAnti3At23 = PDupwindNthAnti3(&At23[index]); + CCTK_REAL const PDupwindNthSymm3At23 = PDupwindNthSymm3(&At23[index]); + CCTK_REAL const PDdissipationNth1At33 = PDdissipationNth1(&At33[index]); + CCTK_REAL const PDdissipationNth2At33 = PDdissipationNth2(&At33[index]); + CCTK_REAL const PDdissipationNth3At33 = PDdissipationNth3(&At33[index]); + CCTK_REAL const PDupwindNthAnti1At33 = PDupwindNthAnti1(&At33[index]); + CCTK_REAL const PDupwindNthSymm1At33 = PDupwindNthSymm1(&At33[index]); + CCTK_REAL const PDupwindNthAnti2At33 = PDupwindNthAnti2(&At33[index]); + CCTK_REAL const PDupwindNthSymm2At33 = PDupwindNthSymm2(&At33[index]); + CCTK_REAL const PDupwindNthAnti3At33 = PDupwindNthAnti3(&At33[index]); + CCTK_REAL const PDupwindNthSymm3At33 = PDupwindNthSymm3(&At33[index]); + CCTK_REAL const PDstandardNth1beta1 = PDstandardNth1(&beta1[index]); + CCTK_REAL const PDstandardNth2beta1 = PDstandardNth2(&beta1[index]); + CCTK_REAL const PDstandardNth3beta1 = PDstandardNth3(&beta1[index]); + CCTK_REAL const PDstandardNth1beta2 = PDstandardNth1(&beta2[index]); + CCTK_REAL const PDstandardNth2beta2 = PDstandardNth2(&beta2[index]); + CCTK_REAL const PDstandardNth3beta2 = PDstandardNth3(&beta2[index]); + CCTK_REAL const PDstandardNth1beta3 = PDstandardNth1(&beta3[index]); + CCTK_REAL const PDstandardNth2beta3 = PDstandardNth2(&beta3[index]); + CCTK_REAL const PDstandardNth3beta3 = PDstandardNth3(&beta3[index]); + CCTK_REAL const PDstandardNth1gt11 = PDstandardNth1(>11[index]); + CCTK_REAL const PDstandardNth2gt11 = PDstandardNth2(>11[index]); + CCTK_REAL const PDstandardNth3gt11 = PDstandardNth3(>11[index]); + CCTK_REAL const PDstandardNth11gt11 = PDstandardNth11(>11[index]); + CCTK_REAL const PDstandardNth22gt11 = PDstandardNth22(>11[index]); + CCTK_REAL const PDstandardNth33gt11 = PDstandardNth33(>11[index]); + CCTK_REAL const PDstandardNth12gt11 = PDstandardNth12(>11[index]); + CCTK_REAL const PDstandardNth13gt11 = PDstandardNth13(>11[index]); + CCTK_REAL const PDstandardNth23gt11 = PDstandardNth23(>11[index]); + CCTK_REAL const PDstandardNth1gt12 = PDstandardNth1(>12[index]); + CCTK_REAL const PDstandardNth2gt12 = PDstandardNth2(>12[index]); + CCTK_REAL const PDstandardNth3gt12 = PDstandardNth3(>12[index]); + CCTK_REAL const PDstandardNth11gt12 = PDstandardNth11(>12[index]); + CCTK_REAL const PDstandardNth22gt12 = PDstandardNth22(>12[index]); + CCTK_REAL const PDstandardNth33gt12 = PDstandardNth33(>12[index]); + CCTK_REAL const PDstandardNth12gt12 = PDstandardNth12(>12[index]); + CCTK_REAL const PDstandardNth13gt12 = PDstandardNth13(>12[index]); + CCTK_REAL const PDstandardNth23gt12 = PDstandardNth23(>12[index]); + CCTK_REAL const PDstandardNth1gt13 = PDstandardNth1(>13[index]); + CCTK_REAL const PDstandardNth2gt13 = PDstandardNth2(>13[index]); + CCTK_REAL const PDstandardNth3gt13 = PDstandardNth3(>13[index]); + CCTK_REAL const PDstandardNth11gt13 = PDstandardNth11(>13[index]); + CCTK_REAL const PDstandardNth22gt13 = PDstandardNth22(>13[index]); + CCTK_REAL const PDstandardNth33gt13 = PDstandardNth33(>13[index]); + CCTK_REAL const PDstandardNth12gt13 = PDstandardNth12(>13[index]); + CCTK_REAL const PDstandardNth13gt13 = PDstandardNth13(>13[index]); + CCTK_REAL const PDstandardNth23gt13 = PDstandardNth23(>13[index]); + CCTK_REAL const PDstandardNth1gt22 = PDstandardNth1(>22[index]); + CCTK_REAL const PDstandardNth2gt22 = PDstandardNth2(>22[index]); + CCTK_REAL const PDstandardNth3gt22 = PDstandardNth3(>22[index]); + CCTK_REAL const PDstandardNth11gt22 = PDstandardNth11(>22[index]); + CCTK_REAL const PDstandardNth22gt22 = PDstandardNth22(>22[index]); + CCTK_REAL const PDstandardNth33gt22 = PDstandardNth33(>22[index]); + CCTK_REAL const PDstandardNth12gt22 = PDstandardNth12(>22[index]); + CCTK_REAL const PDstandardNth13gt22 = PDstandardNth13(>22[index]); + CCTK_REAL const PDstandardNth23gt22 = PDstandardNth23(>22[index]); + CCTK_REAL const PDstandardNth1gt23 = PDstandardNth1(>23[index]); + CCTK_REAL const PDstandardNth2gt23 = PDstandardNth2(>23[index]); + CCTK_REAL const PDstandardNth3gt23 = PDstandardNth3(>23[index]); + CCTK_REAL const PDstandardNth11gt23 = PDstandardNth11(>23[index]); + CCTK_REAL const PDstandardNth22gt23 = PDstandardNth22(>23[index]); + CCTK_REAL const PDstandardNth33gt23 = PDstandardNth33(>23[index]); + CCTK_REAL const PDstandardNth12gt23 = PDstandardNth12(>23[index]); + CCTK_REAL const PDstandardNth13gt23 = PDstandardNth13(>23[index]); + CCTK_REAL const PDstandardNth23gt23 = PDstandardNth23(>23[index]); + CCTK_REAL const PDstandardNth1gt33 = PDstandardNth1(>33[index]); + CCTK_REAL const PDstandardNth2gt33 = PDstandardNth2(>33[index]); + CCTK_REAL const PDstandardNth3gt33 = PDstandardNth3(>33[index]); + CCTK_REAL const PDstandardNth11gt33 = PDstandardNth11(>33[index]); + CCTK_REAL const PDstandardNth22gt33 = PDstandardNth22(>33[index]); + CCTK_REAL const PDstandardNth33gt33 = PDstandardNth33(>33[index]); + CCTK_REAL const PDstandardNth12gt33 = PDstandardNth12(>33[index]); + CCTK_REAL const PDstandardNth13gt33 = PDstandardNth13(>33[index]); + CCTK_REAL const PDstandardNth23gt33 = PDstandardNth23(>33[index]); + CCTK_REAL const PDstandardNth1phi = PDstandardNth1(&phi[index]); + CCTK_REAL const PDstandardNth2phi = PDstandardNth2(&phi[index]); + CCTK_REAL const PDstandardNth3phi = PDstandardNth3(&phi[index]); + CCTK_REAL const PDstandardNth11phi = PDstandardNth11(&phi[index]); + CCTK_REAL const PDstandardNth22phi = PDstandardNth22(&phi[index]); + CCTK_REAL const PDstandardNth33phi = PDstandardNth33(&phi[index]); + CCTK_REAL const PDstandardNth12phi = PDstandardNth12(&phi[index]); + CCTK_REAL const PDstandardNth13phi = PDstandardNth13(&phi[index]); + CCTK_REAL const PDstandardNth23phi = PDstandardNth23(&phi[index]); + CCTK_REAL const PDstandardNth1Xt1 = PDstandardNth1(&Xt1[index]); + CCTK_REAL const PDstandardNth2Xt1 = PDstandardNth2(&Xt1[index]); + CCTK_REAL const PDstandardNth3Xt1 = PDstandardNth3(&Xt1[index]); + CCTK_REAL const PDstandardNth1Xt2 = PDstandardNth1(&Xt2[index]); + CCTK_REAL const PDstandardNth2Xt2 = PDstandardNth2(&Xt2[index]); + CCTK_REAL const PDstandardNth3Xt2 = PDstandardNth3(&Xt2[index]); + CCTK_REAL const PDstandardNth1Xt3 = PDstandardNth1(&Xt3[index]); + CCTK_REAL const PDstandardNth2Xt3 = PDstandardNth2(&Xt3[index]); + CCTK_REAL const PDstandardNth3Xt3 = PDstandardNth3(&Xt3[index]); + + /* Calculate temporaries and grid functions */ + ptrdiff_t dir1 = Sign(beta1L); + + ptrdiff_t dir2 = Sign(beta2L); + + ptrdiff_t dir3 = Sign(beta3L); + + CCTK_REAL epsdiss1 = ToReal(EpsDiss); + + CCTK_REAL epsdiss2 = ToReal(EpsDiss); + + CCTK_REAL epsdiss3 = ToReal(EpsDiss); + + CCTK_REAL detgt = 1; + + CCTK_REAL gtu11 = INV(detgt)*(gt22L*gt33L - SQR(gt23L)); + + CCTK_REAL gtu12 = (gt13L*gt23L - gt12L*gt33L)*INV(detgt); + + CCTK_REAL gtu13 = (-(gt13L*gt22L) + gt12L*gt23L)*INV(detgt); + + CCTK_REAL gtu22 = INV(detgt)*(gt11L*gt33L - SQR(gt13L)); + + CCTK_REAL gtu23 = (gt12L*gt13L - gt11L*gt23L)*INV(detgt); + + CCTK_REAL gtu33 = INV(detgt)*(gt11L*gt22L - SQR(gt12L)); + + CCTK_REAL Gtl111 = 0.5*PDstandardNth1gt11; + + CCTK_REAL Gtl112 = 0.5*PDstandardNth2gt11; + + CCTK_REAL Gtl113 = 0.5*PDstandardNth3gt11; + + CCTK_REAL Gtl122 = -0.5*PDstandardNth1gt22 + PDstandardNth2gt12; + + CCTK_REAL Gtl123 = 0.5*(-PDstandardNth1gt23 + PDstandardNth2gt13 + + PDstandardNth3gt12); + + CCTK_REAL Gtl133 = -0.5*PDstandardNth1gt33 + PDstandardNth3gt13; + + CCTK_REAL Gtl211 = PDstandardNth1gt12 - 0.5*PDstandardNth2gt11; + + CCTK_REAL Gtl212 = 0.5*PDstandardNth1gt22; + + CCTK_REAL Gtl213 = 0.5*(PDstandardNth1gt23 - PDstandardNth2gt13 + + PDstandardNth3gt12); + + CCTK_REAL Gtl222 = 0.5*PDstandardNth2gt22; + + CCTK_REAL Gtl223 = 0.5*PDstandardNth3gt22; + + CCTK_REAL Gtl233 = -0.5*PDstandardNth2gt33 + PDstandardNth3gt23; + + CCTK_REAL Gtl311 = PDstandardNth1gt13 - 0.5*PDstandardNth3gt11; + + CCTK_REAL Gtl312 = 0.5*(PDstandardNth1gt23 + PDstandardNth2gt13 - + PDstandardNth3gt12); + + CCTK_REAL Gtl313 = 0.5*PDstandardNth1gt33; + + CCTK_REAL Gtl322 = PDstandardNth2gt23 - 0.5*PDstandardNth3gt22; + + CCTK_REAL Gtl323 = 0.5*PDstandardNth2gt33; + + CCTK_REAL Gtl333 = 0.5*PDstandardNth3gt33; + + CCTK_REAL Gtlu111 = Gtl111*gtu11 + Gtl112*gtu12 + Gtl113*gtu13; + + CCTK_REAL Gtlu112 = Gtl111*gtu12 + Gtl112*gtu22 + Gtl113*gtu23; + + CCTK_REAL Gtlu113 = Gtl111*gtu13 + Gtl112*gtu23 + Gtl113*gtu33; + + CCTK_REAL Gtlu121 = Gtl112*gtu11 + Gtl122*gtu12 + Gtl123*gtu13; + + CCTK_REAL Gtlu122 = Gtl112*gtu12 + Gtl122*gtu22 + Gtl123*gtu23; + + CCTK_REAL Gtlu123 = Gtl112*gtu13 + Gtl122*gtu23 + Gtl123*gtu33; + + CCTK_REAL Gtlu131 = Gtl113*gtu11 + Gtl123*gtu12 + Gtl133*gtu13; + + CCTK_REAL Gtlu132 = Gtl113*gtu12 + Gtl123*gtu22 + Gtl133*gtu23; + + CCTK_REAL Gtlu133 = Gtl113*gtu13 + Gtl123*gtu23 + Gtl133*gtu33; + + CCTK_REAL Gtlu211 = Gtl211*gtu11 + Gtl212*gtu12 + Gtl213*gtu13; + + CCTK_REAL Gtlu212 = Gtl211*gtu12 + Gtl212*gtu22 + Gtl213*gtu23; + + CCTK_REAL Gtlu213 = Gtl211*gtu13 + Gtl212*gtu23 + Gtl213*gtu33; + + CCTK_REAL Gtlu221 = Gtl212*gtu11 + Gtl222*gtu12 + Gtl223*gtu13; + + CCTK_REAL Gtlu222 = Gtl212*gtu12 + Gtl222*gtu22 + Gtl223*gtu23; + + CCTK_REAL Gtlu223 = Gtl212*gtu13 + Gtl222*gtu23 + Gtl223*gtu33; + + CCTK_REAL Gtlu231 = Gtl213*gtu11 + Gtl223*gtu12 + Gtl233*gtu13; + + CCTK_REAL Gtlu232 = Gtl213*gtu12 + Gtl223*gtu22 + Gtl233*gtu23; + + CCTK_REAL Gtlu233 = Gtl213*gtu13 + Gtl223*gtu23 + Gtl233*gtu33; + + CCTK_REAL Gtlu311 = Gtl311*gtu11 + Gtl312*gtu12 + Gtl313*gtu13; + + CCTK_REAL Gtlu312 = Gtl311*gtu12 + Gtl312*gtu22 + Gtl313*gtu23; + + CCTK_REAL Gtlu313 = Gtl311*gtu13 + Gtl312*gtu23 + Gtl313*gtu33; + + CCTK_REAL Gtlu321 = Gtl312*gtu11 + Gtl322*gtu12 + Gtl323*gtu13; + + CCTK_REAL Gtlu322 = Gtl312*gtu12 + Gtl322*gtu22 + Gtl323*gtu23; + + CCTK_REAL Gtlu323 = Gtl312*gtu13 + Gtl322*gtu23 + Gtl323*gtu33; + + CCTK_REAL Gtlu331 = Gtl313*gtu11 + Gtl323*gtu12 + Gtl333*gtu13; + + CCTK_REAL Gtlu332 = Gtl313*gtu12 + Gtl323*gtu22 + Gtl333*gtu23; + + CCTK_REAL Gtlu333 = Gtl313*gtu13 + Gtl323*gtu23 + Gtl333*gtu33; + + CCTK_REAL Gt111 = Gtl111*gtu11 + Gtl211*gtu12 + Gtl311*gtu13; + + CCTK_REAL Gt211 = Gtl111*gtu12 + Gtl211*gtu22 + Gtl311*gtu23; + + CCTK_REAL Gt311 = Gtl111*gtu13 + Gtl211*gtu23 + Gtl311*gtu33; + + CCTK_REAL Gt112 = Gtl112*gtu11 + Gtl212*gtu12 + Gtl312*gtu13; + + CCTK_REAL Gt212 = Gtl112*gtu12 + Gtl212*gtu22 + Gtl312*gtu23; + + CCTK_REAL Gt312 = Gtl112*gtu13 + Gtl212*gtu23 + Gtl312*gtu33; + + CCTK_REAL Gt113 = Gtl113*gtu11 + Gtl213*gtu12 + Gtl313*gtu13; + + CCTK_REAL Gt213 = Gtl113*gtu12 + Gtl213*gtu22 + Gtl313*gtu23; + + CCTK_REAL Gt313 = Gtl113*gtu13 + Gtl213*gtu23 + Gtl313*gtu33; + + CCTK_REAL Gt122 = Gtl122*gtu11 + Gtl222*gtu12 + Gtl322*gtu13; + + CCTK_REAL Gt222 = Gtl122*gtu12 + Gtl222*gtu22 + Gtl322*gtu23; + + CCTK_REAL Gt322 = Gtl122*gtu13 + Gtl222*gtu23 + Gtl322*gtu33; + + CCTK_REAL Gt123 = Gtl123*gtu11 + Gtl223*gtu12 + Gtl323*gtu13; + + CCTK_REAL Gt223 = Gtl123*gtu12 + Gtl223*gtu22 + Gtl323*gtu23; + + CCTK_REAL Gt323 = Gtl123*gtu13 + Gtl223*gtu23 + Gtl323*gtu33; + + CCTK_REAL Gt133 = Gtl133*gtu11 + Gtl233*gtu12 + Gtl333*gtu13; + + CCTK_REAL Gt233 = Gtl133*gtu12 + Gtl233*gtu22 + Gtl333*gtu23; + + CCTK_REAL Gt333 = Gtl133*gtu13 + Gtl233*gtu23 + Gtl333*gtu33; + + CCTK_REAL Xtn1 = Gt111*gtu11 + Gt122*gtu22 + 2*(Gt112*gtu12 + + Gt113*gtu13 + Gt123*gtu23) + Gt133*gtu33; + + CCTK_REAL Xtn2 = Gt211*gtu11 + Gt222*gtu22 + 2*(Gt212*gtu12 + + Gt213*gtu13 + Gt223*gtu23) + Gt233*gtu33; + + CCTK_REAL Xtn3 = Gt311*gtu11 + Gt322*gtu22 + 2*(Gt312*gtu12 + + Gt313*gtu13 + Gt323*gtu23) + Gt333*gtu33; + + CCTK_REAL Rt11 = 3*(Gt111*Gtlu111 + Gt112*Gtlu112 + Gt113*Gtlu113) + + 2*(Gt211*Gtlu121 + Gt212*Gtlu122 + Gt213*Gtlu123 + Gt311*Gtlu131 + + Gt312*Gtlu132 + Gt313*Gtlu133) + Gt211*Gtlu211 + Gt212*Gtlu212 + + Gt213*Gtlu213 + Gt311*Gtlu311 + Gt312*Gtlu312 + Gt313*Gtlu313 + + gt11L*PDstandardNth1Xt1 + gt12L*PDstandardNth1Xt2 + + gt13L*PDstandardNth1Xt3 + 0.5*(-(gtu11*PDstandardNth11gt11) - + 2*gtu12*PDstandardNth12gt11 - 2*gtu13*PDstandardNth13gt11 - + gtu22*PDstandardNth22gt11 - 2*gtu23*PDstandardNth23gt11 - + gtu33*PDstandardNth33gt11) + Gtl111*Xtn1 + Gtl112*Xtn2 + Gtl113*Xtn3; + + CCTK_REAL Rt12 = 0.5*(4*(Gt211*Gtlu221 + Gt212*Gtlu222 + + Gt213*Gtlu223) + 2*(Gt112*Gtlu111 + Gt122*Gtlu112 + Gt123*Gtlu113 + + Gt111*Gtlu121 + Gt212*Gtlu121 + Gt112*Gtlu122 + Gt222*Gtlu122 + + Gt113*Gtlu123 + Gt223*Gtlu123 + Gt312*Gtlu131 + Gt322*Gtlu132 + + Gt323*Gtlu133 + Gt111*Gtlu211 + Gt112*Gtlu212 + Gt113*Gtlu213 + + Gt311*Gtlu231 + Gt312*Gtlu232 + Gt313*Gtlu233 + Gt311*Gtlu321 + + Gt312*Gtlu322 + Gt313*Gtlu323) - gtu11*PDstandardNth11gt12 - + 2*gtu12*PDstandardNth12gt12 - 2*gtu13*PDstandardNth13gt12 + + gt12L*PDstandardNth1Xt1 + gt22L*PDstandardNth1Xt2 + + gt23L*PDstandardNth1Xt3 - gtu22*PDstandardNth22gt12 - + 2*gtu23*PDstandardNth23gt12 + gt11L*PDstandardNth2Xt1 + + gt12L*PDstandardNth2Xt2 + gt13L*PDstandardNth2Xt3 - + gtu33*PDstandardNth33gt12 + Gtl112*Xtn1 + Gtl211*Xtn1 + Gtl122*Xtn2 + + Gtl212*Xtn2 + Gtl123*Xtn3 + Gtl213*Xtn3); + + CCTK_REAL Rt13 = 0.5*(2*(Gt113*Gtlu111 + Gt123*Gtlu112 + Gt133*Gtlu113 + + Gt213*Gtlu121 + Gt223*Gtlu122 + Gt233*Gtlu123 + Gt111*Gtlu131 + + Gt313*Gtlu131 + Gt112*Gtlu132 + Gt323*Gtlu132 + Gt113*Gtlu133 + + Gt333*Gtlu133 + Gt211*Gtlu231 + Gt212*Gtlu232 + Gt213*Gtlu233 + + Gt111*Gtlu311 + Gt112*Gtlu312 + Gt113*Gtlu313 + Gt211*Gtlu321 + + Gt212*Gtlu322 + Gt213*Gtlu323) + 4*(Gt311*Gtlu331 + Gt312*Gtlu332 + + Gt313*Gtlu333) - gtu11*PDstandardNth11gt13 - + 2*gtu12*PDstandardNth12gt13 - 2*gtu13*PDstandardNth13gt13 + + gt13L*PDstandardNth1Xt1 + gt23L*PDstandardNth1Xt2 + + gt33L*PDstandardNth1Xt3 - gtu22*PDstandardNth22gt13 - + 2*gtu23*PDstandardNth23gt13 - gtu33*PDstandardNth33gt13 + + gt11L*PDstandardNth3Xt1 + gt12L*PDstandardNth3Xt2 + + gt13L*PDstandardNth3Xt3 + Gtl113*Xtn1 + Gtl311*Xtn1 + Gtl123*Xtn2 + + Gtl312*Xtn2 + Gtl133*Xtn3 + Gtl313*Xtn3); + + CCTK_REAL Rt22 = Gt112*(Gtlu121 + 2*Gtlu211) + Gt122*(Gtlu122 + + 2*Gtlu212) + Gt123*(Gtlu123 + 2*Gtlu213) + 3*(Gt212*Gtlu221 + + Gt222*Gtlu222 + Gt223*Gtlu223) + 2*(Gt312*Gtlu231 + Gt322*Gtlu232 + + Gt323*Gtlu233) + Gt312*Gtlu321 + Gt322*Gtlu322 + Gt323*Gtlu323 + + gt12L*PDstandardNth2Xt1 + gt22L*PDstandardNth2Xt2 + + gt23L*PDstandardNth2Xt3 + 0.5*(-(gtu11*PDstandardNth11gt22) - + 2*gtu12*PDstandardNth12gt22 - 2*gtu13*PDstandardNth13gt22 - + gtu22*PDstandardNth22gt22 - 2*gtu23*PDstandardNth23gt22 - + gtu33*PDstandardNth33gt22) + Gtl212*Xtn1 + Gtl222*Xtn2 + Gtl223*Xtn3; + + CCTK_REAL Rt23 = 0.5*(2*(Gt112*Gtlu131 + Gt122*Gtlu132 + Gt123*Gtlu133 + + Gt113*Gtlu211 + Gt123*Gtlu212 + Gt133*Gtlu213 + Gt213*Gtlu221 + + Gt223*Gtlu222 + Gt233*Gtlu223 + Gt212*Gtlu231 + Gt313*Gtlu231 + + Gt222*Gtlu232 + Gt323*Gtlu232 + Gt223*Gtlu233 + Gt333*Gtlu233 + + Gt112*Gtlu311 + Gt122*Gtlu312 + Gt123*Gtlu313 + Gt212*Gtlu321 + + Gt222*Gtlu322 + Gt223*Gtlu323) + 4*(Gt312*Gtlu331 + Gt322*Gtlu332 + + Gt323*Gtlu333) - gtu11*PDstandardNth11gt23 - + 2*gtu12*PDstandardNth12gt23 - 2*gtu13*PDstandardNth13gt23 - + gtu22*PDstandardNth22gt23 - 2*gtu23*PDstandardNth23gt23 + + gt13L*PDstandardNth2Xt1 + gt23L*PDstandardNth2Xt2 + + gt33L*PDstandardNth2Xt3 - gtu33*PDstandardNth33gt23 + + gt12L*PDstandardNth3Xt1 + gt22L*PDstandardNth3Xt2 + + gt23L*PDstandardNth3Xt3 + Gtl213*Xtn1 + Gtl312*Xtn1 + Gtl223*Xtn2 + + Gtl322*Xtn2 + Gtl233*Xtn3 + Gtl323*Xtn3); + + CCTK_REAL Rt33 = Gt113*(Gtlu131 + 2*Gtlu311) + Gt123*(Gtlu132 + + 2*Gtlu312) + Gt133*(Gtlu133 + 2*Gtlu313) + Gt213*(Gtlu231 + 2*Gtlu321) + + Gt223*(Gtlu232 + 2*Gtlu322) + Gt233*(Gtlu233 + 2*Gtlu323) + + 3*(Gt313*Gtlu331 + Gt323*Gtlu332 + Gt333*Gtlu333) + + 0.5*(-(gtu11*PDstandardNth11gt33) - 2*gtu12*PDstandardNth12gt33 - + 2*gtu13*PDstandardNth13gt33 - gtu22*PDstandardNth22gt33 - + 2*gtu23*PDstandardNth23gt33 - gtu33*PDstandardNth33gt33) + + gt13L*PDstandardNth3Xt1 + gt23L*PDstandardNth3Xt2 + + gt33L*PDstandardNth3Xt3 + Gtl313*Xtn1 + Gtl323*Xtn2 + Gtl333*Xtn3; + + CCTK_REAL fac1 = IfThen(ToReal(conformalMethod),-0.5*INV(phiL),1); + + CCTK_REAL cdphi1 = fac1*PDstandardNth1phi; + + CCTK_REAL cdphi2 = fac1*PDstandardNth2phi; + + CCTK_REAL cdphi3 = fac1*PDstandardNth3phi; + + CCTK_REAL fac2 = IfThen(ToReal(conformalMethod),0.5*INV(SQR(phiL)),0); + + CCTK_REAL cdphi211 = -(fac1*(-PDstandardNth11phi + + Gt111*PDstandardNth1phi + Gt211*PDstandardNth2phi + + Gt311*PDstandardNth3phi)) + fac2*SQR(PDstandardNth1phi); + + CCTK_REAL cdphi212 = fac2*PDstandardNth1phi*PDstandardNth2phi - + fac1*(-PDstandardNth12phi + Gt112*PDstandardNth1phi + + Gt212*PDstandardNth2phi + Gt312*PDstandardNth3phi); + + CCTK_REAL cdphi213 = fac2*PDstandardNth1phi*PDstandardNth3phi - + fac1*(-PDstandardNth13phi + Gt113*PDstandardNth1phi + + Gt213*PDstandardNth2phi + Gt313*PDstandardNth3phi); + + CCTK_REAL cdphi222 = -(fac1*(Gt122*PDstandardNth1phi - + PDstandardNth22phi + Gt222*PDstandardNth2phi + + Gt322*PDstandardNth3phi)) + fac2*SQR(PDstandardNth2phi); + + CCTK_REAL cdphi223 = fac2*PDstandardNth2phi*PDstandardNth3phi - + fac1*(Gt123*PDstandardNth1phi - PDstandardNth23phi + + Gt223*PDstandardNth2phi + Gt323*PDstandardNth3phi); + + CCTK_REAL cdphi233 = -(fac1*(Gt133*PDstandardNth1phi + + Gt233*PDstandardNth2phi - PDstandardNth33phi + + Gt333*PDstandardNth3phi)) + fac2*SQR(PDstandardNth3phi); + + CCTK_REAL Rphi11 = -2*(cdphi211 + 2*(-1 + gt11L*gtu11)*SQR(cdphi1) + + gt11L*(cdphi211*gtu11 + 4*(cdphi1*(cdphi2*gtu12 + cdphi3*gtu13) + + cdphi2*cdphi3*gtu23) + cdphi233*gtu33 + gtu22*(cdphi222 + + 2*SQR(cdphi2)) + 2*(cdphi212*gtu12 + cdphi213*gtu13 + cdphi223*gtu23 + + gtu33*SQR(cdphi3)))); + + CCTK_REAL Rphi12 = -2*(cdphi212 + cdphi1*(cdphi2*(-2 + 4*gt12L*gtu12) + + 4*cdphi3*gt12L*gtu13) + gt12L*(cdphi211*gtu11 + 4*cdphi2*cdphi3*gtu23 + + 2*(cdphi212*gtu12 + cdphi213*gtu13 + cdphi223*gtu23 + + gtu11*SQR(cdphi1)) + gtu22*(cdphi222 + 2*SQR(cdphi2)) + gtu33*(cdphi233 + + 2*SQR(cdphi3)))); + + CCTK_REAL Rphi13 = -2*(cdphi213 + cdphi1*(4*cdphi2*gt13L*gtu12 + + cdphi3*(-2 + 4*gt13L*gtu13)) + gt13L*(cdphi211*gtu11 + + 4*cdphi2*cdphi3*gtu23 + 2*(cdphi212*gtu12 + cdphi213*gtu13 + + cdphi223*gtu23 + gtu11*SQR(cdphi1)) + gtu22*(cdphi222 + 2*SQR(cdphi2)) + + gtu33*(cdphi233 + 2*SQR(cdphi3)))); + + CCTK_REAL Rphi22 = -2*(cdphi222 + 2*(-1 + gt22L*gtu22)*SQR(cdphi2) + + gt22L*(cdphi222*gtu22 + 4*(cdphi1*cdphi3*gtu13 + cdphi2*(cdphi1*gtu12 + + cdphi3*gtu23)) + cdphi233*gtu33 + gtu11*(cdphi211 + 2*SQR(cdphi1)) + + 2*(cdphi212*gtu12 + cdphi213*gtu13 + cdphi223*gtu23 + + gtu33*SQR(cdphi3)))); + + CCTK_REAL Rphi23 = -2*(cdphi223 + cdphi2*(4*cdphi1*gt23L*gtu12 + + cdphi3*(-2 + 4*gt23L*gtu23)) + gt23L*(4*cdphi1*cdphi3*gtu13 + + cdphi222*gtu22 + gtu11*(cdphi211 + 2*SQR(cdphi1)) + 2*(cdphi212*gtu12 + + cdphi213*gtu13 + cdphi223*gtu23 + gtu22*SQR(cdphi2)) + gtu33*(cdphi233 + + 2*SQR(cdphi3)))); + + CCTK_REAL Rphi33 = -2*(cdphi233 + gt33L*((4*cdphi1*cdphi2 + + 2*cdphi212)*gtu12 + 4*cdphi3*(cdphi1*gtu13 + cdphi2*gtu23) + + 2*(cdphi213*gtu13 + cdphi223*gtu23) + cdphi233*gtu33 + gtu11*(cdphi211 + + 2*SQR(cdphi1)) + gtu22*(cdphi222 + 2*SQR(cdphi2))) + 2*(-1 + + gt33L*gtu33)*SQR(cdphi3)); + + CCTK_REAL Atm11 = At11L*gtu11 + At12L*gtu12 + At13L*gtu13; + + CCTK_REAL Atm21 = At11L*gtu12 + At12L*gtu22 + At13L*gtu23; + + CCTK_REAL Atm31 = At11L*gtu13 + At12L*gtu23 + At13L*gtu33; + + CCTK_REAL Atm12 = At12L*gtu11 + At22L*gtu12 + At23L*gtu13; + + CCTK_REAL Atm22 = At12L*gtu12 + At22L*gtu22 + At23L*gtu23; + + CCTK_REAL Atm32 = At12L*gtu13 + At22L*gtu23 + At23L*gtu33; + + CCTK_REAL Atm13 = At13L*gtu11 + At23L*gtu12 + At33L*gtu13; + + CCTK_REAL Atm23 = At13L*gtu12 + At23L*gtu22 + At33L*gtu23; + + CCTK_REAL Atm33 = At13L*gtu13 + At23L*gtu23 + At33L*gtu33; + + CCTK_REAL e4phi = + IfThen(ToReal(conformalMethod),INV(SQR(phiL)),exp(4*phiL)); + + CCTK_REAL em4phi = INV(e4phi); + + CCTK_REAL g11 = e4phi*gt11L; + + CCTK_REAL g12 = e4phi*gt12L; + + CCTK_REAL g13 = e4phi*gt13L; + + CCTK_REAL g22 = e4phi*gt22L; + + CCTK_REAL g23 = e4phi*gt23L; + + CCTK_REAL g33 = e4phi*gt33L; + + CCTK_REAL gu11 = em4phi*gtu11; + + CCTK_REAL gu12 = em4phi*gtu12; + + CCTK_REAL gu13 = em4phi*gtu13; + + CCTK_REAL gu22 = em4phi*gtu22; + + CCTK_REAL gu23 = em4phi*gtu23; + + CCTK_REAL gu33 = em4phi*gtu33; + + CCTK_REAL R11 = Rphi11 + Rt11; + + CCTK_REAL R12 = Rphi12 + Rt12; + + CCTK_REAL R13 = Rphi13 + Rt13; + + CCTK_REAL R22 = Rphi22 + Rt22; + + CCTK_REAL R23 = Rphi23 + Rt23; + + CCTK_REAL R33 = Rphi33 + Rt33; + + CCTK_REAL trS = em4phi*(eTxxL*gtu11 + eTyyL*gtu22 + 2*(eTxyL*gtu12 + + eTxzL*gtu13 + eTyzL*gtu23) + eTzzL*gtu33); + + CCTK_REAL Ats11 = -PDstandardNth11alpha + (4*cdphi1 + + Gt111)*PDstandardNth1alpha + Gt211*PDstandardNth2alpha + + Gt311*PDstandardNth3alpha + alphaL*R11; + + CCTK_REAL Ats12 = -PDstandardNth12alpha + (2*cdphi2 + + Gt112)*PDstandardNth1alpha + (2*cdphi1 + Gt212)*PDstandardNth2alpha + + Gt312*PDstandardNth3alpha + alphaL*R12; + + CCTK_REAL Ats13 = -PDstandardNth13alpha + (2*cdphi3 + + Gt113)*PDstandardNth1alpha + Gt213*PDstandardNth2alpha + (2*cdphi1 + + Gt313)*PDstandardNth3alpha + alphaL*R13; + + CCTK_REAL Ats22 = Gt122*PDstandardNth1alpha - PDstandardNth22alpha + + (4*cdphi2 + Gt222)*PDstandardNth2alpha + Gt322*PDstandardNth3alpha + + alphaL*R22; + + CCTK_REAL Ats23 = Gt123*PDstandardNth1alpha - PDstandardNth23alpha + + (2*cdphi3 + Gt223)*PDstandardNth2alpha + (2*cdphi2 + + Gt323)*PDstandardNth3alpha + alphaL*R23; + + CCTK_REAL Ats33 = Gt133*PDstandardNth1alpha + + Gt233*PDstandardNth2alpha - PDstandardNth33alpha + (4*cdphi3 + + Gt333)*PDstandardNth3alpha + alphaL*R33; + + CCTK_REAL trAts = Ats11*gu11 + Ats22*gu22 + 2*(Ats12*gu12 + Ats13*gu13 + + Ats23*gu23) + Ats33*gu33; + + CCTK_REAL At11rhsL = -2.*alphaL*(At11L*Atm11 + At12L*Atm21 + + At13L*Atm31) + epsdiss1*PDdissipationNth1At11 + + epsdiss2*PDdissipationNth2At11 + epsdiss3*PDdissipationNth3At11 + + 2.*(At12L*PDstandardNth1beta2 + At13L*PDstandardNth1beta3) + + beta1L*PDupwindNthAnti1At11 + beta2L*PDupwindNthAnti2At11 + + beta3L*PDupwindNthAnti3At11 + + At11L*(1.333333333333333333333333333333333333333*PDstandardNth1beta1 - + 0.6666666666666666666666666666666666666667*(PDstandardNth2beta2 + + PDstandardNth3beta3) + alphaL*trKL) + em4phi*(Ats11 - + 0.3333333333333333333333333333333333333333*g11*trAts + + alphaL*(-25.13274122871834590770114706623602307358*eTxxL + + 8.377580409572781969233715688745341024526*g11*trS)) + + PDupwindNthSymm1At11*Abs(beta1L) + PDupwindNthSymm2At11*Abs(beta2L) + + PDupwindNthSymm3At11*Abs(beta3L); + + CCTK_REAL At12rhsL = -2.*alphaL*(At11L*Atm12 + At12L*Atm22 + + At13L*Atm32) + epsdiss1*PDdissipationNth1At12 + + epsdiss2*PDdissipationNth2At12 + epsdiss3*PDdissipationNth3At12 + + At22L*PDstandardNth1beta2 + At23L*PDstandardNth1beta3 + + At11L*PDstandardNth2beta1 + At13L*PDstandardNth2beta3 + + beta1L*PDupwindNthAnti1At12 + beta2L*PDupwindNthAnti2At12 + + beta3L*PDupwindNthAnti3At12 + + At12L*(0.3333333333333333333333333333333333333333*(PDstandardNth1beta1 + + PDstandardNth2beta2) - + 0.6666666666666666666666666666666666666667*PDstandardNth3beta3 + + alphaL*trKL) + em4phi*(Ats12 - + 0.3333333333333333333333333333333333333333*g12*trAts + + alphaL*(-25.13274122871834590770114706623602307358*eTxyL + + 8.377580409572781969233715688745341024526*g12*trS)) + + PDupwindNthSymm1At12*Abs(beta1L) + PDupwindNthSymm2At12*Abs(beta2L) + + PDupwindNthSymm3At12*Abs(beta3L); + + CCTK_REAL At13rhsL = -2.*alphaL*(At11L*Atm13 + At12L*Atm23 + + At13L*Atm33) + epsdiss1*PDdissipationNth1At13 + + epsdiss2*PDdissipationNth2At13 + epsdiss3*PDdissipationNth3At13 + + At23L*PDstandardNth1beta2 + At33L*PDstandardNth1beta3 + + At11L*PDstandardNth3beta1 + At12L*PDstandardNth3beta2 + + beta1L*PDupwindNthAnti1At13 + beta2L*PDupwindNthAnti2At13 + + beta3L*PDupwindNthAnti3At13 + + At13L*(-0.6666666666666666666666666666666666666667*PDstandardNth2beta2 + + 0.3333333333333333333333333333333333333333*(PDstandardNth1beta1 + + PDstandardNth3beta3) + alphaL*trKL) + em4phi*(Ats13 - + 0.3333333333333333333333333333333333333333*g13*trAts + + alphaL*(-25.13274122871834590770114706623602307358*eTxzL + + 8.377580409572781969233715688745341024526*g13*trS)) + + PDupwindNthSymm1At13*Abs(beta1L) + PDupwindNthSymm2At13*Abs(beta2L) + + PDupwindNthSymm3At13*Abs(beta3L); + + CCTK_REAL At22rhsL = -2.*alphaL*(At12L*Atm12 + At22L*Atm22 + + At23L*Atm32) + epsdiss1*PDdissipationNth1At22 + + epsdiss2*PDdissipationNth2At22 + epsdiss3*PDdissipationNth3At22 + + 2.*(At12L*PDstandardNth2beta1 + At23L*PDstandardNth2beta3) + + beta1L*PDupwindNthAnti1At22 + beta2L*PDupwindNthAnti2At22 + + beta3L*PDupwindNthAnti3At22 + + At22L*(1.333333333333333333333333333333333333333*PDstandardNth2beta2 - + 0.6666666666666666666666666666666666666667*(PDstandardNth1beta1 + + PDstandardNth3beta3) + alphaL*trKL) + em4phi*(Ats22 - + 0.3333333333333333333333333333333333333333*g22*trAts + + alphaL*(-25.13274122871834590770114706623602307358*eTyyL + + 8.377580409572781969233715688745341024526*g22*trS)) + + PDupwindNthSymm1At22*Abs(beta1L) + PDupwindNthSymm2At22*Abs(beta2L) + + PDupwindNthSymm3At22*Abs(beta3L); + + CCTK_REAL At23rhsL = -2.*alphaL*(At12L*Atm13 + At22L*Atm23 + + At23L*Atm33) + epsdiss1*PDdissipationNth1At23 + + epsdiss2*PDdissipationNth2At23 + epsdiss3*PDdissipationNth3At23 + + At13L*PDstandardNth2beta1 + At33L*PDstandardNth2beta3 + + At12L*PDstandardNth3beta1 + At22L*PDstandardNth3beta2 + + beta1L*PDupwindNthAnti1At23 + beta2L*PDupwindNthAnti2At23 + + beta3L*PDupwindNthAnti3At23 + + At23L*(-0.6666666666666666666666666666666666666667*PDstandardNth1beta1 + + 0.3333333333333333333333333333333333333333*(PDstandardNth2beta2 + + PDstandardNth3beta3) + alphaL*trKL) + em4phi*(Ats23 - + 0.3333333333333333333333333333333333333333*g23*trAts + + alphaL*(-25.13274122871834590770114706623602307358*eTyzL + + 8.377580409572781969233715688745341024526*g23*trS)) + + PDupwindNthSymm1At23*Abs(beta1L) + PDupwindNthSymm2At23*Abs(beta2L) + + PDupwindNthSymm3At23*Abs(beta3L); + + CCTK_REAL At33rhsL = -2.*alphaL*(At13L*Atm13 + At23L*Atm23 + + At33L*Atm33) + epsdiss1*PDdissipationNth1At33 + + epsdiss2*PDdissipationNth2At33 + epsdiss3*PDdissipationNth3At33 + + 2.*(At13L*PDstandardNth3beta1 + At23L*PDstandardNth3beta2) + + beta1L*PDupwindNthAnti1At33 + beta2L*PDupwindNthAnti2At33 + + beta3L*PDupwindNthAnti3At33 + + At33L*(-0.6666666666666666666666666666666666666667*(PDstandardNth1beta1 + + PDstandardNth2beta2) + + 1.333333333333333333333333333333333333333*PDstandardNth3beta3 + + alphaL*trKL) + em4phi*(Ats33 - + 0.3333333333333333333333333333333333333333*g33*trAts + + alphaL*(-25.13274122871834590770114706623602307358*eTzzL + + 8.377580409572781969233715688745341024526*g33*trS)) + + PDupwindNthSymm1At33*Abs(beta1L) + PDupwindNthSymm2At33*Abs(beta2L) + + PDupwindNthSymm3At33*Abs(beta3L); + + + /* Copy local copies back to grid functions */ + At11rhs[index] = At11rhsL; + At12rhs[index] = At12rhsL; + At13rhs[index] = At13rhsL; + At22rhs[index] = At22rhsL; + At23rhs[index] = At23rhsL; + At33rhs[index] = At33rhsL; + } + LC_ENDLOOP3 (ML_BSSN_O2_RHS2); +} + +extern "C" void ML_BSSN_O2_RHS2(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverInterior(cctkGH, &ML_BSSN_O2_RHS2_Body); +} diff --git a/ML_BSSN_O2/src/ML_BSSN_O2_RHSStaticBoundary.cc b/ML_BSSN_O2/src/ML_BSSN_O2_RHSStaticBoundary.cc new file mode 100644 index 0000000..81849f3 --- /dev/null +++ b/ML_BSSN_O2/src/ML_BSSN_O2_RHSStaticBoundary.cc @@ -0,0 +1,229 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +extern "C" void ML_BSSN_O2_RHSStaticBoundary_SelectBCs(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT ierr = 0; + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_O2::ML_curvrhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_O2::ML_curvrhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_O2::ML_dtlapserhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_O2::ML_dtlapserhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_O2::ML_dtshiftrhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_O2::ML_dtshiftrhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_O2::ML_Gammarhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_O2::ML_Gammarhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_O2::ML_lapserhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_O2::ML_lapserhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_O2::ML_log_confacrhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_O2::ML_log_confacrhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_O2::ML_metricrhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_O2::ML_metricrhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_O2::ML_shiftrhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_O2::ML_shiftrhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_O2::ML_trace_curvrhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_O2::ML_trace_curvrhs."); + return; +} + +static void ML_BSSN_O2_RHSStaticBoundary_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_BSSN_O2_RHSStaticBoundary_Body"); + } + + if (cctk_iteration % ML_BSSN_O2_RHSStaticBoundary_calc_every != ML_BSSN_O2_RHSStaticBoundary_calc_offset) + { + return; + } + + const char *groups[] = {"ML_BSSN_O2::ML_curvrhs","ML_BSSN_O2::ML_dtlapserhs","ML_BSSN_O2::ML_dtshiftrhs","ML_BSSN_O2::ML_Gammarhs","ML_BSSN_O2::ML_lapserhs","ML_BSSN_O2::ML_log_confacrhs","ML_BSSN_O2::ML_metricrhs","ML_BSSN_O2::ML_shiftrhs","ML_BSSN_O2::ML_trace_curvrhs"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_BSSN_O2_RHSStaticBoundary", 9, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o16dx = 0.0625*INV(dx); + CCTK_REAL const p1o16dy = 0.0625*INV(dy); + CCTK_REAL const p1o16dz = 0.0625*INV(dz); + CCTK_REAL const p1o2dx = 0.5*INV(dx); + CCTK_REAL const p1o2dy = 0.5*INV(dy); + CCTK_REAL const p1o2dz = 0.5*INV(dz); + CCTK_REAL const p1o4dx = 0.25*INV(dx); + CCTK_REAL const p1o4dxdy = 0.25*INV(dx)*INV(dy); + CCTK_REAL const p1o4dxdz = 0.25*INV(dx)*INV(dz); + CCTK_REAL const p1o4dy = 0.25*INV(dy); + CCTK_REAL const p1o4dydz = 0.25*INV(dy)*INV(dz); + CCTK_REAL const p1o4dz = 0.25*INV(dz); + CCTK_REAL const p1odx = INV(dx); + CCTK_REAL const p1odx2 = INV(SQR(dx)); + CCTK_REAL const p1ody = INV(dy); + CCTK_REAL const p1ody2 = INV(SQR(dy)); + CCTK_REAL const p1odz = INV(dz); + CCTK_REAL const p1odz2 = INV(SQR(dz)); + CCTK_REAL const pm1o2dx = -0.5*INV(dx); + CCTK_REAL const pm1o2dy = -0.5*INV(dy); + CCTK_REAL const pm1o2dz = -0.5*INV(dz); + CCTK_REAL const pm1o4dx = -0.25*INV(dx); + CCTK_REAL const pm1o4dy = -0.25*INV(dy); + CCTK_REAL const pm1o4dz = -0.25*INV(dz); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_BSSN_O2_RHSStaticBoundary, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + + /* Include user supplied include files */ + + /* Precompute derivatives */ + + /* Calculate temporaries and grid functions */ + CCTK_REAL phirhsL = 0; + + CCTK_REAL gt11rhsL = 0; + + CCTK_REAL gt12rhsL = 0; + + CCTK_REAL gt13rhsL = 0; + + CCTK_REAL gt22rhsL = 0; + + CCTK_REAL gt23rhsL = 0; + + CCTK_REAL gt33rhsL = 0; + + CCTK_REAL trKrhsL = 0; + + CCTK_REAL At11rhsL = 0; + + CCTK_REAL At12rhsL = 0; + + CCTK_REAL At13rhsL = 0; + + CCTK_REAL At22rhsL = 0; + + CCTK_REAL At23rhsL = 0; + + CCTK_REAL At33rhsL = 0; + + CCTK_REAL Xt1rhsL = 0; + + CCTK_REAL Xt2rhsL = 0; + + CCTK_REAL Xt3rhsL = 0; + + CCTK_REAL alpharhsL = 0; + + CCTK_REAL ArhsL = 0; + + CCTK_REAL beta1rhsL = 0; + + CCTK_REAL beta2rhsL = 0; + + CCTK_REAL beta3rhsL = 0; + + CCTK_REAL B1rhsL = 0; + + CCTK_REAL B2rhsL = 0; + + CCTK_REAL B3rhsL = 0; + + + /* Copy local copies back to grid functions */ + alpharhs[index] = alpharhsL; + Arhs[index] = ArhsL; + At11rhs[index] = At11rhsL; + At12rhs[index] = At12rhsL; + At13rhs[index] = At13rhsL; + At22rhs[index] = At22rhsL; + At23rhs[index] = At23rhsL; + At33rhs[index] = At33rhsL; + B1rhs[index] = B1rhsL; + B2rhs[index] = B2rhsL; + B3rhs[index] = B3rhsL; + beta1rhs[index] = beta1rhsL; + beta2rhs[index] = beta2rhsL; + beta3rhs[index] = beta3rhsL; + gt11rhs[index] = gt11rhsL; + gt12rhs[index] = gt12rhsL; + gt13rhs[index] = gt13rhsL; + gt22rhs[index] = gt22rhsL; + gt23rhs[index] = gt23rhsL; + gt33rhs[index] = gt33rhsL; + phirhs[index] = phirhsL; + trKrhs[index] = trKrhsL; + Xt1rhs[index] = Xt1rhsL; + Xt2rhs[index] = Xt2rhsL; + Xt3rhs[index] = Xt3rhsL; + } + LC_ENDLOOP3 (ML_BSSN_O2_RHSStaticBoundary); +} + +extern "C" void ML_BSSN_O2_RHSStaticBoundary(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverBoundary(cctkGH, &ML_BSSN_O2_RHSStaticBoundary_Body); +} diff --git a/ML_BSSN_O2/src/ML_BSSN_O2_boundary.cc b/ML_BSSN_O2/src/ML_BSSN_O2_boundary.cc new file mode 100644 index 0000000..c013f46 --- /dev/null +++ b/ML_BSSN_O2/src/ML_BSSN_O2_boundary.cc @@ -0,0 +1,229 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +extern "C" void ML_BSSN_O2_boundary_SelectBCs(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT ierr = 0; + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_O2::ML_curv","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_O2::ML_curv."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_O2::ML_dtlapse","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_O2::ML_dtlapse."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_O2::ML_dtshift","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_O2::ML_dtshift."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_O2::ML_Gamma","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_O2::ML_Gamma."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_O2::ML_lapse","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_O2::ML_lapse."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_O2::ML_log_confac","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_O2::ML_log_confac."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_O2::ML_metric","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_O2::ML_metric."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_O2::ML_shift","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_O2::ML_shift."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_O2::ML_trace_curv","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_O2::ML_trace_curv."); + return; +} + +static void ML_BSSN_O2_boundary_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_BSSN_O2_boundary_Body"); + } + + if (cctk_iteration % ML_BSSN_O2_boundary_calc_every != ML_BSSN_O2_boundary_calc_offset) + { + return; + } + + const char *groups[] = {"ML_BSSN_O2::ML_curv","ML_BSSN_O2::ML_dtlapse","ML_BSSN_O2::ML_dtshift","ML_BSSN_O2::ML_Gamma","ML_BSSN_O2::ML_lapse","ML_BSSN_O2::ML_log_confac","ML_BSSN_O2::ML_metric","ML_BSSN_O2::ML_shift","ML_BSSN_O2::ML_trace_curv"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_BSSN_O2_boundary", 9, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o16dx = 0.0625*INV(dx); + CCTK_REAL const p1o16dy = 0.0625*INV(dy); + CCTK_REAL const p1o16dz = 0.0625*INV(dz); + CCTK_REAL const p1o2dx = 0.5*INV(dx); + CCTK_REAL const p1o2dy = 0.5*INV(dy); + CCTK_REAL const p1o2dz = 0.5*INV(dz); + CCTK_REAL const p1o4dx = 0.25*INV(dx); + CCTK_REAL const p1o4dxdy = 0.25*INV(dx)*INV(dy); + CCTK_REAL const p1o4dxdz = 0.25*INV(dx)*INV(dz); + CCTK_REAL const p1o4dy = 0.25*INV(dy); + CCTK_REAL const p1o4dydz = 0.25*INV(dy)*INV(dz); + CCTK_REAL const p1o4dz = 0.25*INV(dz); + CCTK_REAL const p1odx = INV(dx); + CCTK_REAL const p1odx2 = INV(SQR(dx)); + CCTK_REAL const p1ody = INV(dy); + CCTK_REAL const p1ody2 = INV(SQR(dy)); + CCTK_REAL const p1odz = INV(dz); + CCTK_REAL const p1odz2 = INV(SQR(dz)); + CCTK_REAL const pm1o2dx = -0.5*INV(dx); + CCTK_REAL const pm1o2dy = -0.5*INV(dy); + CCTK_REAL const pm1o2dz = -0.5*INV(dz); + CCTK_REAL const pm1o4dx = -0.25*INV(dx); + CCTK_REAL const pm1o4dy = -0.25*INV(dy); + CCTK_REAL const pm1o4dz = -0.25*INV(dz); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_BSSN_O2_boundary, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + + /* Include user supplied include files */ + + /* Precompute derivatives */ + + /* Calculate temporaries and grid functions */ + CCTK_REAL phiL = IfThen(ToReal(conformalMethod),1,0); + + CCTK_REAL gt11L = 1; + + CCTK_REAL gt12L = 0; + + CCTK_REAL gt13L = 0; + + CCTK_REAL gt22L = 1; + + CCTK_REAL gt23L = 0; + + CCTK_REAL gt33L = 1; + + CCTK_REAL trKL = 0; + + CCTK_REAL At11L = 0; + + CCTK_REAL At12L = 0; + + CCTK_REAL At13L = 0; + + CCTK_REAL At22L = 0; + + CCTK_REAL At23L = 0; + + CCTK_REAL At33L = 0; + + CCTK_REAL Xt1L = 0; + + CCTK_REAL Xt2L = 0; + + CCTK_REAL Xt3L = 0; + + CCTK_REAL alphaL = 1; + + CCTK_REAL AL = 0; + + CCTK_REAL beta1L = 0; + + CCTK_REAL beta2L = 0; + + CCTK_REAL beta3L = 0; + + CCTK_REAL B1L = 0; + + CCTK_REAL B2L = 0; + + CCTK_REAL B3L = 0; + + + /* Copy local copies back to grid functions */ + A[index] = AL; + alpha[index] = alphaL; + At11[index] = At11L; + At12[index] = At12L; + At13[index] = At13L; + At22[index] = At22L; + At23[index] = At23L; + At33[index] = At33L; + B1[index] = B1L; + B2[index] = B2L; + B3[index] = B3L; + beta1[index] = beta1L; + beta2[index] = beta2L; + beta3[index] = beta3L; + gt11[index] = gt11L; + gt12[index] = gt12L; + gt13[index] = gt13L; + gt22[index] = gt22L; + gt23[index] = gt23L; + gt33[index] = gt33L; + phi[index] = phiL; + trK[index] = trKL; + Xt1[index] = Xt1L; + Xt2[index] = Xt2L; + Xt3[index] = Xt3L; + } + LC_ENDLOOP3 (ML_BSSN_O2_boundary); +} + +extern "C" void ML_BSSN_O2_boundary(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverBoundaryWithGhosts(cctkGH, &ML_BSSN_O2_boundary_Body); +} diff --git a/ML_BSSN_O2/src/ML_BSSN_O2_constraints1.cc b/ML_BSSN_O2/src/ML_BSSN_O2_constraints1.cc new file mode 100644 index 0000000..3af37b8 --- /dev/null +++ b/ML_BSSN_O2/src/ML_BSSN_O2_constraints1.cc @@ -0,0 +1,591 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +extern "C" void ML_BSSN_O2_constraints1_SelectBCs(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT ierr = 0; + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_O2::ML_Ham","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_O2::ML_Ham."); + return; +} + +static void ML_BSSN_O2_constraints1_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_BSSN_O2_constraints1_Body"); + } + + if (cctk_iteration % ML_BSSN_O2_constraints1_calc_every != ML_BSSN_O2_constraints1_calc_offset) + { + return; + } + + const char *groups[] = {"ML_BSSN_O2::ML_curv","ML_BSSN_O2::ML_Gamma","ML_BSSN_O2::ML_Ham","ML_BSSN_O2::ML_lapse","ML_BSSN_O2::ML_log_confac","ML_BSSN_O2::ML_metric","ML_BSSN_O2::ML_shift","ML_BSSN_O2::ML_trace_curv"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_BSSN_O2_constraints1", 8, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o16dx = 0.0625*INV(dx); + CCTK_REAL const p1o16dy = 0.0625*INV(dy); + CCTK_REAL const p1o16dz = 0.0625*INV(dz); + CCTK_REAL const p1o2dx = 0.5*INV(dx); + CCTK_REAL const p1o2dy = 0.5*INV(dy); + CCTK_REAL const p1o2dz = 0.5*INV(dz); + CCTK_REAL const p1o4dx = 0.25*INV(dx); + CCTK_REAL const p1o4dxdy = 0.25*INV(dx)*INV(dy); + CCTK_REAL const p1o4dxdz = 0.25*INV(dx)*INV(dz); + CCTK_REAL const p1o4dy = 0.25*INV(dy); + CCTK_REAL const p1o4dydz = 0.25*INV(dy)*INV(dz); + CCTK_REAL const p1o4dz = 0.25*INV(dz); + CCTK_REAL const p1odx = INV(dx); + CCTK_REAL const p1odx2 = INV(SQR(dx)); + CCTK_REAL const p1ody = INV(dy); + CCTK_REAL const p1ody2 = INV(SQR(dy)); + CCTK_REAL const p1odz = INV(dz); + CCTK_REAL const p1odz2 = INV(SQR(dz)); + CCTK_REAL const pm1o2dx = -0.5*INV(dx); + CCTK_REAL const pm1o2dy = -0.5*INV(dy); + CCTK_REAL const pm1o2dz = -0.5*INV(dz); + CCTK_REAL const pm1o4dx = -0.25*INV(dx); + CCTK_REAL const pm1o4dy = -0.25*INV(dy); + CCTK_REAL const pm1o4dz = -0.25*INV(dz); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_BSSN_O2_constraints1, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + CCTK_REAL alphaL = alpha[index]; + CCTK_REAL At11L = At11[index]; + CCTK_REAL At12L = At12[index]; + CCTK_REAL At13L = At13[index]; + CCTK_REAL At22L = At22[index]; + CCTK_REAL At23L = At23[index]; + CCTK_REAL At33L = At33[index]; + CCTK_REAL beta1L = beta1[index]; + CCTK_REAL beta2L = beta2[index]; + CCTK_REAL beta3L = beta3[index]; + CCTK_REAL eTttL = (*stress_energy_state) ? eTtt[index] : ToReal(0.0); + CCTK_REAL eTtxL = (*stress_energy_state) ? eTtx[index] : ToReal(0.0); + CCTK_REAL eTtyL = (*stress_energy_state) ? eTty[index] : ToReal(0.0); + CCTK_REAL eTtzL = (*stress_energy_state) ? eTtz[index] : ToReal(0.0); + CCTK_REAL eTxxL = (*stress_energy_state) ? eTxx[index] : ToReal(0.0); + CCTK_REAL eTxyL = (*stress_energy_state) ? eTxy[index] : ToReal(0.0); + CCTK_REAL eTxzL = (*stress_energy_state) ? eTxz[index] : ToReal(0.0); + CCTK_REAL eTyyL = (*stress_energy_state) ? eTyy[index] : ToReal(0.0); + CCTK_REAL eTyzL = (*stress_energy_state) ? eTyz[index] : ToReal(0.0); + CCTK_REAL eTzzL = (*stress_energy_state) ? eTzz[index] : ToReal(0.0); + CCTK_REAL gt11L = gt11[index]; + CCTK_REAL gt12L = gt12[index]; + CCTK_REAL gt13L = gt13[index]; + CCTK_REAL gt22L = gt22[index]; + CCTK_REAL gt23L = gt23[index]; + CCTK_REAL gt33L = gt33[index]; + CCTK_REAL phiL = phi[index]; + CCTK_REAL trKL = trK[index]; + CCTK_REAL Xt1L = Xt1[index]; + CCTK_REAL Xt2L = Xt2[index]; + CCTK_REAL Xt3L = Xt3[index]; + + /* Include user supplied include files */ + + /* Precompute derivatives */ + CCTK_REAL const PDstandardNth1gt11 = PDstandardNth1(>11[index]); + CCTK_REAL const PDstandardNth2gt11 = PDstandardNth2(>11[index]); + CCTK_REAL const PDstandardNth3gt11 = PDstandardNth3(>11[index]); + CCTK_REAL const PDstandardNth11gt11 = PDstandardNth11(>11[index]); + CCTK_REAL const PDstandardNth22gt11 = PDstandardNth22(>11[index]); + CCTK_REAL const PDstandardNth33gt11 = PDstandardNth33(>11[index]); + CCTK_REAL const PDstandardNth12gt11 = PDstandardNth12(>11[index]); + CCTK_REAL const PDstandardNth13gt11 = PDstandardNth13(>11[index]); + CCTK_REAL const PDstandardNth23gt11 = PDstandardNth23(>11[index]); + CCTK_REAL const PDstandardNth1gt12 = PDstandardNth1(>12[index]); + CCTK_REAL const PDstandardNth2gt12 = PDstandardNth2(>12[index]); + CCTK_REAL const PDstandardNth3gt12 = PDstandardNth3(>12[index]); + CCTK_REAL const PDstandardNth11gt12 = PDstandardNth11(>12[index]); + CCTK_REAL const PDstandardNth22gt12 = PDstandardNth22(>12[index]); + CCTK_REAL const PDstandardNth33gt12 = PDstandardNth33(>12[index]); + CCTK_REAL const PDstandardNth12gt12 = PDstandardNth12(>12[index]); + CCTK_REAL const PDstandardNth13gt12 = PDstandardNth13(>12[index]); + CCTK_REAL const PDstandardNth23gt12 = PDstandardNth23(>12[index]); + CCTK_REAL const PDstandardNth1gt13 = PDstandardNth1(>13[index]); + CCTK_REAL const PDstandardNth2gt13 = PDstandardNth2(>13[index]); + CCTK_REAL const PDstandardNth3gt13 = PDstandardNth3(>13[index]); + CCTK_REAL const PDstandardNth11gt13 = PDstandardNth11(>13[index]); + CCTK_REAL const PDstandardNth22gt13 = PDstandardNth22(>13[index]); + CCTK_REAL const PDstandardNth33gt13 = PDstandardNth33(>13[index]); + CCTK_REAL const PDstandardNth12gt13 = PDstandardNth12(>13[index]); + CCTK_REAL const PDstandardNth13gt13 = PDstandardNth13(>13[index]); + CCTK_REAL const PDstandardNth23gt13 = PDstandardNth23(>13[index]); + CCTK_REAL const PDstandardNth1gt22 = PDstandardNth1(>22[index]); + CCTK_REAL const PDstandardNth2gt22 = PDstandardNth2(>22[index]); + CCTK_REAL const PDstandardNth3gt22 = PDstandardNth3(>22[index]); + CCTK_REAL const PDstandardNth11gt22 = PDstandardNth11(>22[index]); + CCTK_REAL const PDstandardNth22gt22 = PDstandardNth22(>22[index]); + CCTK_REAL const PDstandardNth33gt22 = PDstandardNth33(>22[index]); + CCTK_REAL const PDstandardNth12gt22 = PDstandardNth12(>22[index]); + CCTK_REAL const PDstandardNth13gt22 = PDstandardNth13(>22[index]); + CCTK_REAL const PDstandardNth23gt22 = PDstandardNth23(>22[index]); + CCTK_REAL const PDstandardNth1gt23 = PDstandardNth1(>23[index]); + CCTK_REAL const PDstandardNth2gt23 = PDstandardNth2(>23[index]); + CCTK_REAL const PDstandardNth3gt23 = PDstandardNth3(>23[index]); + CCTK_REAL const PDstandardNth11gt23 = PDstandardNth11(>23[index]); + CCTK_REAL const PDstandardNth22gt23 = PDstandardNth22(>23[index]); + CCTK_REAL const PDstandardNth33gt23 = PDstandardNth33(>23[index]); + CCTK_REAL const PDstandardNth12gt23 = PDstandardNth12(>23[index]); + CCTK_REAL const PDstandardNth13gt23 = PDstandardNth13(>23[index]); + CCTK_REAL const PDstandardNth23gt23 = PDstandardNth23(>23[index]); + CCTK_REAL const PDstandardNth1gt33 = PDstandardNth1(>33[index]); + CCTK_REAL const PDstandardNth2gt33 = PDstandardNth2(>33[index]); + CCTK_REAL const PDstandardNth3gt33 = PDstandardNth3(>33[index]); + CCTK_REAL const PDstandardNth11gt33 = PDstandardNth11(>33[index]); + CCTK_REAL const PDstandardNth22gt33 = PDstandardNth22(>33[index]); + CCTK_REAL const PDstandardNth33gt33 = PDstandardNth33(>33[index]); + CCTK_REAL const PDstandardNth12gt33 = PDstandardNth12(>33[index]); + CCTK_REAL const PDstandardNth13gt33 = PDstandardNth13(>33[index]); + CCTK_REAL const PDstandardNth23gt33 = PDstandardNth23(>33[index]); + CCTK_REAL const PDstandardNth1phi = PDstandardNth1(&phi[index]); + CCTK_REAL const PDstandardNth2phi = PDstandardNth2(&phi[index]); + CCTK_REAL const PDstandardNth3phi = PDstandardNth3(&phi[index]); + CCTK_REAL const PDstandardNth11phi = PDstandardNth11(&phi[index]); + CCTK_REAL const PDstandardNth22phi = PDstandardNth22(&phi[index]); + CCTK_REAL const PDstandardNth33phi = PDstandardNth33(&phi[index]); + CCTK_REAL const PDstandardNth12phi = PDstandardNth12(&phi[index]); + CCTK_REAL const PDstandardNth13phi = PDstandardNth13(&phi[index]); + CCTK_REAL const PDstandardNth23phi = PDstandardNth23(&phi[index]); + CCTK_REAL const PDstandardNth1Xt1 = PDstandardNth1(&Xt1[index]); + CCTK_REAL const PDstandardNth2Xt1 = PDstandardNth2(&Xt1[index]); + CCTK_REAL const PDstandardNth3Xt1 = PDstandardNth3(&Xt1[index]); + CCTK_REAL const PDstandardNth1Xt2 = PDstandardNth1(&Xt2[index]); + CCTK_REAL const PDstandardNth2Xt2 = PDstandardNth2(&Xt2[index]); + CCTK_REAL const PDstandardNth3Xt2 = PDstandardNth3(&Xt2[index]); + CCTK_REAL const PDstandardNth1Xt3 = PDstandardNth1(&Xt3[index]); + CCTK_REAL const PDstandardNth2Xt3 = PDstandardNth2(&Xt3[index]); + CCTK_REAL const PDstandardNth3Xt3 = PDstandardNth3(&Xt3[index]); + + /* Calculate temporaries and grid functions */ + CCTK_REAL detgt = 1; + + CCTK_REAL gtu11 = INV(detgt)*(gt22L*gt33L - SQR(gt23L)); + + CCTK_REAL gtu12 = (gt13L*gt23L - gt12L*gt33L)*INV(detgt); + + CCTK_REAL gtu13 = (-(gt13L*gt22L) + gt12L*gt23L)*INV(detgt); + + CCTK_REAL gtu22 = INV(detgt)*(gt11L*gt33L - SQR(gt13L)); + + CCTK_REAL gtu23 = (gt12L*gt13L - gt11L*gt23L)*INV(detgt); + + CCTK_REAL gtu33 = INV(detgt)*(gt11L*gt22L - SQR(gt12L)); + + CCTK_REAL Gtl111 = 0.5*PDstandardNth1gt11; + + CCTK_REAL Gtl112 = 0.5*PDstandardNth2gt11; + + CCTK_REAL Gtl113 = 0.5*PDstandardNth3gt11; + + CCTK_REAL Gtl122 = -0.5*PDstandardNth1gt22 + PDstandardNth2gt12; + + CCTK_REAL Gtl123 = 0.5*(-PDstandardNth1gt23 + PDstandardNth2gt13 + + PDstandardNth3gt12); + + CCTK_REAL Gtl133 = -0.5*PDstandardNth1gt33 + PDstandardNth3gt13; + + CCTK_REAL Gtl211 = PDstandardNth1gt12 - 0.5*PDstandardNth2gt11; + + CCTK_REAL Gtl212 = 0.5*PDstandardNth1gt22; + + CCTK_REAL Gtl213 = 0.5*(PDstandardNth1gt23 - PDstandardNth2gt13 + + PDstandardNth3gt12); + + CCTK_REAL Gtl222 = 0.5*PDstandardNth2gt22; + + CCTK_REAL Gtl223 = 0.5*PDstandardNth3gt22; + + CCTK_REAL Gtl233 = -0.5*PDstandardNth2gt33 + PDstandardNth3gt23; + + CCTK_REAL Gtl311 = PDstandardNth1gt13 - 0.5*PDstandardNth3gt11; + + CCTK_REAL Gtl312 = 0.5*(PDstandardNth1gt23 + PDstandardNth2gt13 - + PDstandardNth3gt12); + + CCTK_REAL Gtl313 = 0.5*PDstandardNth1gt33; + + CCTK_REAL Gtl322 = PDstandardNth2gt23 - 0.5*PDstandardNth3gt22; + + CCTK_REAL Gtl323 = 0.5*PDstandardNth2gt33; + + CCTK_REAL Gtl333 = 0.5*PDstandardNth3gt33; + + CCTK_REAL Gtlu111 = Gtl111*gtu11 + Gtl112*gtu12 + Gtl113*gtu13; + + CCTK_REAL Gtlu112 = Gtl111*gtu12 + Gtl112*gtu22 + Gtl113*gtu23; + + CCTK_REAL Gtlu113 = Gtl111*gtu13 + Gtl112*gtu23 + Gtl113*gtu33; + + CCTK_REAL Gtlu121 = Gtl112*gtu11 + Gtl122*gtu12 + Gtl123*gtu13; + + CCTK_REAL Gtlu122 = Gtl112*gtu12 + Gtl122*gtu22 + Gtl123*gtu23; + + CCTK_REAL Gtlu123 = Gtl112*gtu13 + Gtl122*gtu23 + Gtl123*gtu33; + + CCTK_REAL Gtlu131 = Gtl113*gtu11 + Gtl123*gtu12 + Gtl133*gtu13; + + CCTK_REAL Gtlu132 = Gtl113*gtu12 + Gtl123*gtu22 + Gtl133*gtu23; + + CCTK_REAL Gtlu133 = Gtl113*gtu13 + Gtl123*gtu23 + Gtl133*gtu33; + + CCTK_REAL Gtlu211 = Gtl211*gtu11 + Gtl212*gtu12 + Gtl213*gtu13; + + CCTK_REAL Gtlu212 = Gtl211*gtu12 + Gtl212*gtu22 + Gtl213*gtu23; + + CCTK_REAL Gtlu213 = Gtl211*gtu13 + Gtl212*gtu23 + Gtl213*gtu33; + + CCTK_REAL Gtlu221 = Gtl212*gtu11 + Gtl222*gtu12 + Gtl223*gtu13; + + CCTK_REAL Gtlu222 = Gtl212*gtu12 + Gtl222*gtu22 + Gtl223*gtu23; + + CCTK_REAL Gtlu223 = Gtl212*gtu13 + Gtl222*gtu23 + Gtl223*gtu33; + + CCTK_REAL Gtlu231 = Gtl213*gtu11 + Gtl223*gtu12 + Gtl233*gtu13; + + CCTK_REAL Gtlu232 = Gtl213*gtu12 + Gtl223*gtu22 + Gtl233*gtu23; + + CCTK_REAL Gtlu233 = Gtl213*gtu13 + Gtl223*gtu23 + Gtl233*gtu33; + + CCTK_REAL Gtlu311 = Gtl311*gtu11 + Gtl312*gtu12 + Gtl313*gtu13; + + CCTK_REAL Gtlu312 = Gtl311*gtu12 + Gtl312*gtu22 + Gtl313*gtu23; + + CCTK_REAL Gtlu313 = Gtl311*gtu13 + Gtl312*gtu23 + Gtl313*gtu33; + + CCTK_REAL Gtlu321 = Gtl312*gtu11 + Gtl322*gtu12 + Gtl323*gtu13; + + CCTK_REAL Gtlu322 = Gtl312*gtu12 + Gtl322*gtu22 + Gtl323*gtu23; + + CCTK_REAL Gtlu323 = Gtl312*gtu13 + Gtl322*gtu23 + Gtl323*gtu33; + + CCTK_REAL Gtlu331 = Gtl313*gtu11 + Gtl323*gtu12 + Gtl333*gtu13; + + CCTK_REAL Gtlu332 = Gtl313*gtu12 + Gtl323*gtu22 + Gtl333*gtu23; + + CCTK_REAL Gtlu333 = Gtl313*gtu13 + Gtl323*gtu23 + Gtl333*gtu33; + + CCTK_REAL Gt111 = Gtl111*gtu11 + Gtl211*gtu12 + Gtl311*gtu13; + + CCTK_REAL Gt211 = Gtl111*gtu12 + Gtl211*gtu22 + Gtl311*gtu23; + + CCTK_REAL Gt311 = Gtl111*gtu13 + Gtl211*gtu23 + Gtl311*gtu33; + + CCTK_REAL Gt112 = Gtl112*gtu11 + Gtl212*gtu12 + Gtl312*gtu13; + + CCTK_REAL Gt212 = Gtl112*gtu12 + Gtl212*gtu22 + Gtl312*gtu23; + + CCTK_REAL Gt312 = Gtl112*gtu13 + Gtl212*gtu23 + Gtl312*gtu33; + + CCTK_REAL Gt113 = Gtl113*gtu11 + Gtl213*gtu12 + Gtl313*gtu13; + + CCTK_REAL Gt213 = Gtl113*gtu12 + Gtl213*gtu22 + Gtl313*gtu23; + + CCTK_REAL Gt313 = Gtl113*gtu13 + Gtl213*gtu23 + Gtl313*gtu33; + + CCTK_REAL Gt122 = Gtl122*gtu11 + Gtl222*gtu12 + Gtl322*gtu13; + + CCTK_REAL Gt222 = Gtl122*gtu12 + Gtl222*gtu22 + Gtl322*gtu23; + + CCTK_REAL Gt322 = Gtl122*gtu13 + Gtl222*gtu23 + Gtl322*gtu33; + + CCTK_REAL Gt123 = Gtl123*gtu11 + Gtl223*gtu12 + Gtl323*gtu13; + + CCTK_REAL Gt223 = Gtl123*gtu12 + Gtl223*gtu22 + Gtl323*gtu23; + + CCTK_REAL Gt323 = Gtl123*gtu13 + Gtl223*gtu23 + Gtl323*gtu33; + + CCTK_REAL Gt133 = Gtl133*gtu11 + Gtl233*gtu12 + Gtl333*gtu13; + + CCTK_REAL Gt233 = Gtl133*gtu12 + Gtl233*gtu22 + Gtl333*gtu23; + + CCTK_REAL Gt333 = Gtl133*gtu13 + Gtl233*gtu23 + Gtl333*gtu33; + + CCTK_REAL Xtn1 = Gt111*gtu11 + Gt122*gtu22 + 2*(Gt112*gtu12 + + Gt113*gtu13 + Gt123*gtu23) + Gt133*gtu33; + + CCTK_REAL Xtn2 = Gt211*gtu11 + Gt222*gtu22 + 2*(Gt212*gtu12 + + Gt213*gtu13 + Gt223*gtu23) + Gt233*gtu33; + + CCTK_REAL Xtn3 = Gt311*gtu11 + Gt322*gtu22 + 2*(Gt312*gtu12 + + Gt313*gtu13 + Gt323*gtu23) + Gt333*gtu33; + + CCTK_REAL Rt11 = 3*(Gt111*Gtlu111 + Gt112*Gtlu112 + Gt113*Gtlu113) + + 2*(Gt211*Gtlu121 + Gt212*Gtlu122 + Gt213*Gtlu123 + Gt311*Gtlu131 + + Gt312*Gtlu132 + Gt313*Gtlu133) + Gt211*Gtlu211 + Gt212*Gtlu212 + + Gt213*Gtlu213 + Gt311*Gtlu311 + Gt312*Gtlu312 + Gt313*Gtlu313 + + gt11L*PDstandardNth1Xt1 + gt12L*PDstandardNth1Xt2 + + gt13L*PDstandardNth1Xt3 + 0.5*(-(gtu11*PDstandardNth11gt11) - + 2*gtu12*PDstandardNth12gt11 - 2*gtu13*PDstandardNth13gt11 - + gtu22*PDstandardNth22gt11 - 2*gtu23*PDstandardNth23gt11 - + gtu33*PDstandardNth33gt11) + Gtl111*Xtn1 + Gtl112*Xtn2 + Gtl113*Xtn3; + + CCTK_REAL Rt12 = 0.5*(4*(Gt211*Gtlu221 + Gt212*Gtlu222 + + Gt213*Gtlu223) + 2*(Gt112*Gtlu111 + Gt122*Gtlu112 + Gt123*Gtlu113 + + Gt111*Gtlu121 + Gt212*Gtlu121 + Gt112*Gtlu122 + Gt222*Gtlu122 + + Gt113*Gtlu123 + Gt223*Gtlu123 + Gt312*Gtlu131 + Gt322*Gtlu132 + + Gt323*Gtlu133 + Gt111*Gtlu211 + Gt112*Gtlu212 + Gt113*Gtlu213 + + Gt311*Gtlu231 + Gt312*Gtlu232 + Gt313*Gtlu233 + Gt311*Gtlu321 + + Gt312*Gtlu322 + Gt313*Gtlu323) - gtu11*PDstandardNth11gt12 - + 2*gtu12*PDstandardNth12gt12 - 2*gtu13*PDstandardNth13gt12 + + gt12L*PDstandardNth1Xt1 + gt22L*PDstandardNth1Xt2 + + gt23L*PDstandardNth1Xt3 - gtu22*PDstandardNth22gt12 - + 2*gtu23*PDstandardNth23gt12 + gt11L*PDstandardNth2Xt1 + + gt12L*PDstandardNth2Xt2 + gt13L*PDstandardNth2Xt3 - + gtu33*PDstandardNth33gt12 + Gtl112*Xtn1 + Gtl211*Xtn1 + Gtl122*Xtn2 + + Gtl212*Xtn2 + Gtl123*Xtn3 + Gtl213*Xtn3); + + CCTK_REAL Rt13 = 0.5*(2*(Gt113*Gtlu111 + Gt123*Gtlu112 + Gt133*Gtlu113 + + Gt213*Gtlu121 + Gt223*Gtlu122 + Gt233*Gtlu123 + Gt111*Gtlu131 + + Gt313*Gtlu131 + Gt112*Gtlu132 + Gt323*Gtlu132 + Gt113*Gtlu133 + + Gt333*Gtlu133 + Gt211*Gtlu231 + Gt212*Gtlu232 + Gt213*Gtlu233 + + Gt111*Gtlu311 + Gt112*Gtlu312 + Gt113*Gtlu313 + Gt211*Gtlu321 + + Gt212*Gtlu322 + Gt213*Gtlu323) + 4*(Gt311*Gtlu331 + Gt312*Gtlu332 + + Gt313*Gtlu333) - gtu11*PDstandardNth11gt13 - + 2*gtu12*PDstandardNth12gt13 - 2*gtu13*PDstandardNth13gt13 + + gt13L*PDstandardNth1Xt1 + gt23L*PDstandardNth1Xt2 + + gt33L*PDstandardNth1Xt3 - gtu22*PDstandardNth22gt13 - + 2*gtu23*PDstandardNth23gt13 - gtu33*PDstandardNth33gt13 + + gt11L*PDstandardNth3Xt1 + gt12L*PDstandardNth3Xt2 + + gt13L*PDstandardNth3Xt3 + Gtl113*Xtn1 + Gtl311*Xtn1 + Gtl123*Xtn2 + + Gtl312*Xtn2 + Gtl133*Xtn3 + Gtl313*Xtn3); + + CCTK_REAL Rt22 = Gt112*(Gtlu121 + 2*Gtlu211) + Gt122*(Gtlu122 + + 2*Gtlu212) + Gt123*(Gtlu123 + 2*Gtlu213) + 3*(Gt212*Gtlu221 + + Gt222*Gtlu222 + Gt223*Gtlu223) + 2*(Gt312*Gtlu231 + Gt322*Gtlu232 + + Gt323*Gtlu233) + Gt312*Gtlu321 + Gt322*Gtlu322 + Gt323*Gtlu323 + + gt12L*PDstandardNth2Xt1 + gt22L*PDstandardNth2Xt2 + + gt23L*PDstandardNth2Xt3 + 0.5*(-(gtu11*PDstandardNth11gt22) - + 2*gtu12*PDstandardNth12gt22 - 2*gtu13*PDstandardNth13gt22 - + gtu22*PDstandardNth22gt22 - 2*gtu23*PDstandardNth23gt22 - + gtu33*PDstandardNth33gt22) + Gtl212*Xtn1 + Gtl222*Xtn2 + Gtl223*Xtn3; + + CCTK_REAL Rt23 = 0.5*(2*(Gt112*Gtlu131 + Gt122*Gtlu132 + Gt123*Gtlu133 + + Gt113*Gtlu211 + Gt123*Gtlu212 + Gt133*Gtlu213 + Gt213*Gtlu221 + + Gt223*Gtlu222 + Gt233*Gtlu223 + Gt212*Gtlu231 + Gt313*Gtlu231 + + Gt222*Gtlu232 + Gt323*Gtlu232 + Gt223*Gtlu233 + Gt333*Gtlu233 + + Gt112*Gtlu311 + Gt122*Gtlu312 + Gt123*Gtlu313 + Gt212*Gtlu321 + + Gt222*Gtlu322 + Gt223*Gtlu323) + 4*(Gt312*Gtlu331 + Gt322*Gtlu332 + + Gt323*Gtlu333) - gtu11*PDstandardNth11gt23 - + 2*gtu12*PDstandardNth12gt23 - 2*gtu13*PDstandardNth13gt23 - + gtu22*PDstandardNth22gt23 - 2*gtu23*PDstandardNth23gt23 + + gt13L*PDstandardNth2Xt1 + gt23L*PDstandardNth2Xt2 + + gt33L*PDstandardNth2Xt3 - gtu33*PDstandardNth33gt23 + + gt12L*PDstandardNth3Xt1 + gt22L*PDstandardNth3Xt2 + + gt23L*PDstandardNth3Xt3 + Gtl213*Xtn1 + Gtl312*Xtn1 + Gtl223*Xtn2 + + Gtl322*Xtn2 + Gtl233*Xtn3 + Gtl323*Xtn3); + + CCTK_REAL Rt33 = Gt113*(Gtlu131 + 2*Gtlu311) + Gt123*(Gtlu132 + + 2*Gtlu312) + Gt133*(Gtlu133 + 2*Gtlu313) + Gt213*(Gtlu231 + 2*Gtlu321) + + Gt223*(Gtlu232 + 2*Gtlu322) + Gt233*(Gtlu233 + 2*Gtlu323) + + 3*(Gt313*Gtlu331 + Gt323*Gtlu332 + Gt333*Gtlu333) + + 0.5*(-(gtu11*PDstandardNth11gt33) - 2*gtu12*PDstandardNth12gt33 - + 2*gtu13*PDstandardNth13gt33 - gtu22*PDstandardNth22gt33 - + 2*gtu23*PDstandardNth23gt33 - gtu33*PDstandardNth33gt33) + + gt13L*PDstandardNth3Xt1 + gt23L*PDstandardNth3Xt2 + + gt33L*PDstandardNth3Xt3 + Gtl313*Xtn1 + Gtl323*Xtn2 + Gtl333*Xtn3; + + CCTK_REAL fac1 = IfThen(ToReal(conformalMethod),-0.5*INV(phiL),1); + + CCTK_REAL cdphi1 = fac1*PDstandardNth1phi; + + CCTK_REAL cdphi2 = fac1*PDstandardNth2phi; + + CCTK_REAL cdphi3 = fac1*PDstandardNth3phi; + + CCTK_REAL fac2 = IfThen(ToReal(conformalMethod),0.5*INV(SQR(phiL)),0); + + CCTK_REAL cdphi211 = -(fac1*(-PDstandardNth11phi + + Gt111*PDstandardNth1phi + Gt211*PDstandardNth2phi + + Gt311*PDstandardNth3phi)) + fac2*SQR(PDstandardNth1phi); + + CCTK_REAL cdphi212 = fac2*PDstandardNth1phi*PDstandardNth2phi - + fac1*(-PDstandardNth12phi + Gt112*PDstandardNth1phi + + Gt212*PDstandardNth2phi + Gt312*PDstandardNth3phi); + + CCTK_REAL cdphi213 = fac2*PDstandardNth1phi*PDstandardNth3phi - + fac1*(-PDstandardNth13phi + Gt113*PDstandardNth1phi + + Gt213*PDstandardNth2phi + Gt313*PDstandardNth3phi); + + CCTK_REAL cdphi222 = -(fac1*(Gt122*PDstandardNth1phi - + PDstandardNth22phi + Gt222*PDstandardNth2phi + + Gt322*PDstandardNth3phi)) + fac2*SQR(PDstandardNth2phi); + + CCTK_REAL cdphi223 = fac2*PDstandardNth2phi*PDstandardNth3phi - + fac1*(Gt123*PDstandardNth1phi - PDstandardNth23phi + + Gt223*PDstandardNth2phi + Gt323*PDstandardNth3phi); + + CCTK_REAL cdphi233 = -(fac1*(Gt133*PDstandardNth1phi + + Gt233*PDstandardNth2phi - PDstandardNth33phi + + Gt333*PDstandardNth3phi)) + fac2*SQR(PDstandardNth3phi); + + CCTK_REAL Rphi11 = -2*(cdphi211 + 2*(-1 + gt11L*gtu11)*SQR(cdphi1) + + gt11L*(cdphi211*gtu11 + 4*(cdphi1*(cdphi2*gtu12 + cdphi3*gtu13) + + cdphi2*cdphi3*gtu23) + cdphi233*gtu33 + gtu22*(cdphi222 + + 2*SQR(cdphi2)) + 2*(cdphi212*gtu12 + cdphi213*gtu13 + cdphi223*gtu23 + + gtu33*SQR(cdphi3)))); + + CCTK_REAL Rphi12 = -2*(cdphi212 + cdphi1*(cdphi2*(-2 + 4*gt12L*gtu12) + + 4*cdphi3*gt12L*gtu13) + gt12L*(cdphi211*gtu11 + 4*cdphi2*cdphi3*gtu23 + + 2*(cdphi212*gtu12 + cdphi213*gtu13 + cdphi223*gtu23 + + gtu11*SQR(cdphi1)) + gtu22*(cdphi222 + 2*SQR(cdphi2)) + gtu33*(cdphi233 + + 2*SQR(cdphi3)))); + + CCTK_REAL Rphi13 = -2*(cdphi213 + cdphi1*(4*cdphi2*gt13L*gtu12 + + cdphi3*(-2 + 4*gt13L*gtu13)) + gt13L*(cdphi211*gtu11 + + 4*cdphi2*cdphi3*gtu23 + 2*(cdphi212*gtu12 + cdphi213*gtu13 + + cdphi223*gtu23 + gtu11*SQR(cdphi1)) + gtu22*(cdphi222 + 2*SQR(cdphi2)) + + gtu33*(cdphi233 + 2*SQR(cdphi3)))); + + CCTK_REAL Rphi22 = -2*(cdphi222 + 2*(-1 + gt22L*gtu22)*SQR(cdphi2) + + gt22L*(cdphi222*gtu22 + 4*(cdphi1*cdphi3*gtu13 + cdphi2*(cdphi1*gtu12 + + cdphi3*gtu23)) + cdphi233*gtu33 + gtu11*(cdphi211 + 2*SQR(cdphi1)) + + 2*(cdphi212*gtu12 + cdphi213*gtu13 + cdphi223*gtu23 + + gtu33*SQR(cdphi3)))); + + CCTK_REAL Rphi23 = -2*(cdphi223 + cdphi2*(4*cdphi1*gt23L*gtu12 + + cdphi3*(-2 + 4*gt23L*gtu23)) + gt23L*(4*cdphi1*cdphi3*gtu13 + + cdphi222*gtu22 + gtu11*(cdphi211 + 2*SQR(cdphi1)) + 2*(cdphi212*gtu12 + + cdphi213*gtu13 + cdphi223*gtu23 + gtu22*SQR(cdphi2)) + gtu33*(cdphi233 + + 2*SQR(cdphi3)))); + + CCTK_REAL Rphi33 = -2*(cdphi233 + gt33L*((4*cdphi1*cdphi2 + + 2*cdphi212)*gtu12 + 4*cdphi3*(cdphi1*gtu13 + cdphi2*gtu23) + + 2*(cdphi213*gtu13 + cdphi223*gtu23) + cdphi233*gtu33 + gtu11*(cdphi211 + + 2*SQR(cdphi1)) + gtu22*(cdphi222 + 2*SQR(cdphi2))) + 2*(-1 + + gt33L*gtu33)*SQR(cdphi3)); + + CCTK_REAL e4phi = + IfThen(ToReal(conformalMethod),INV(SQR(phiL)),exp(4*phiL)); + + CCTK_REAL em4phi = INV(e4phi); + + CCTK_REAL gu11 = em4phi*gtu11; + + CCTK_REAL gu12 = em4phi*gtu12; + + CCTK_REAL gu13 = em4phi*gtu13; + + CCTK_REAL gu22 = em4phi*gtu22; + + CCTK_REAL gu23 = em4phi*gtu23; + + CCTK_REAL gu33 = em4phi*gtu33; + + CCTK_REAL R11 = Rphi11 + Rt11; + + CCTK_REAL R12 = Rphi12 + Rt12; + + CCTK_REAL R13 = Rphi13 + Rt13; + + CCTK_REAL R22 = Rphi22 + Rt22; + + CCTK_REAL R23 = Rphi23 + Rt23; + + CCTK_REAL R33 = Rphi33 + Rt33; + + CCTK_REAL trR = gu11*R11 + gu22*R22 + 2*(gu12*R12 + gu13*R13 + + gu23*R23) + gu33*R33; + + CCTK_REAL Atm11 = At11L*gtu11 + At12L*gtu12 + At13L*gtu13; + + CCTK_REAL Atm21 = At11L*gtu12 + At12L*gtu22 + At13L*gtu23; + + CCTK_REAL Atm31 = At11L*gtu13 + At12L*gtu23 + At13L*gtu33; + + CCTK_REAL Atm12 = At12L*gtu11 + At22L*gtu12 + At23L*gtu13; + + CCTK_REAL Atm22 = At12L*gtu12 + At22L*gtu22 + At23L*gtu23; + + CCTK_REAL Atm32 = At12L*gtu13 + At22L*gtu23 + At23L*gtu33; + + CCTK_REAL Atm13 = At13L*gtu11 + At23L*gtu12 + At33L*gtu13; + + CCTK_REAL Atm23 = At13L*gtu12 + At23L*gtu22 + At33L*gtu23; + + CCTK_REAL Atm33 = At13L*gtu13 + At23L*gtu23 + At33L*gtu33; + + CCTK_REAL rho = INV(SQR(alphaL))*(eTttL - 2*(beta2L*eTtyL + + beta3L*eTtzL) + 2*(beta1L*(-eTtxL + beta2L*eTxyL + beta3L*eTxzL) + + beta2L*beta3L*eTyzL) + eTxxL*SQR(beta1L) + eTyyL*SQR(beta2L) + + eTzzL*SQR(beta3L)); + + CCTK_REAL HL = -2.*(Atm12*Atm21 + Atm13*Atm31 + Atm23*Atm32) - + 50.26548245743669181540229413247204614715*rho + trR - 1.*(SQR(Atm11) + + SQR(Atm22) + SQR(Atm33)) + + 0.6666666666666666666666666666666666666667*SQR(trKL); + + + /* Copy local copies back to grid functions */ + H[index] = HL; + } + LC_ENDLOOP3 (ML_BSSN_O2_constraints1); +} + +extern "C" void ML_BSSN_O2_constraints1(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverInterior(cctkGH, &ML_BSSN_O2_constraints1_Body); +} diff --git a/ML_BSSN_O2/src/ML_BSSN_O2_constraints2.cc b/ML_BSSN_O2/src/ML_BSSN_O2_constraints2.cc new file mode 100644 index 0000000..85110e2 --- /dev/null +++ b/ML_BSSN_O2/src/ML_BSSN_O2_constraints2.cc @@ -0,0 +1,394 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +extern "C" void ML_BSSN_O2_constraints2_SelectBCs(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT ierr = 0; + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_O2::ML_cons_detg","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_O2::ML_cons_detg."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_O2::ML_cons_Gamma","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_O2::ML_cons_Gamma."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_O2::ML_cons_traceA","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_O2::ML_cons_traceA."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_O2::ML_mom","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_O2::ML_mom."); + return; +} + +static void ML_BSSN_O2_constraints2_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_BSSN_O2_constraints2_Body"); + } + + if (cctk_iteration % ML_BSSN_O2_constraints2_calc_every != ML_BSSN_O2_constraints2_calc_offset) + { + return; + } + + const char *groups[] = {"ML_BSSN_O2::ML_cons_detg","ML_BSSN_O2::ML_cons_Gamma","ML_BSSN_O2::ML_cons_traceA","ML_BSSN_O2::ML_curv","ML_BSSN_O2::ML_Gamma","ML_BSSN_O2::ML_lapse","ML_BSSN_O2::ML_log_confac","ML_BSSN_O2::ML_metric","ML_BSSN_O2::ML_mom","ML_BSSN_O2::ML_shift","ML_BSSN_O2::ML_trace_curv"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_BSSN_O2_constraints2", 11, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o16dx = 0.0625*INV(dx); + CCTK_REAL const p1o16dy = 0.0625*INV(dy); + CCTK_REAL const p1o16dz = 0.0625*INV(dz); + CCTK_REAL const p1o2dx = 0.5*INV(dx); + CCTK_REAL const p1o2dy = 0.5*INV(dy); + CCTK_REAL const p1o2dz = 0.5*INV(dz); + CCTK_REAL const p1o4dx = 0.25*INV(dx); + CCTK_REAL const p1o4dxdy = 0.25*INV(dx)*INV(dy); + CCTK_REAL const p1o4dxdz = 0.25*INV(dx)*INV(dz); + CCTK_REAL const p1o4dy = 0.25*INV(dy); + CCTK_REAL const p1o4dydz = 0.25*INV(dy)*INV(dz); + CCTK_REAL const p1o4dz = 0.25*INV(dz); + CCTK_REAL const p1odx = INV(dx); + CCTK_REAL const p1odx2 = INV(SQR(dx)); + CCTK_REAL const p1ody = INV(dy); + CCTK_REAL const p1ody2 = INV(SQR(dy)); + CCTK_REAL const p1odz = INV(dz); + CCTK_REAL const p1odz2 = INV(SQR(dz)); + CCTK_REAL const pm1o2dx = -0.5*INV(dx); + CCTK_REAL const pm1o2dy = -0.5*INV(dy); + CCTK_REAL const pm1o2dz = -0.5*INV(dz); + CCTK_REAL const pm1o4dx = -0.25*INV(dx); + CCTK_REAL const pm1o4dy = -0.25*INV(dy); + CCTK_REAL const pm1o4dz = -0.25*INV(dz); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_BSSN_O2_constraints2, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + CCTK_REAL alphaL = alpha[index]; + CCTK_REAL At11L = At11[index]; + CCTK_REAL At12L = At12[index]; + CCTK_REAL At13L = At13[index]; + CCTK_REAL At22L = At22[index]; + CCTK_REAL At23L = At23[index]; + CCTK_REAL At33L = At33[index]; + CCTK_REAL beta1L = beta1[index]; + CCTK_REAL beta2L = beta2[index]; + CCTK_REAL beta3L = beta3[index]; + CCTK_REAL eTtxL = (*stress_energy_state) ? eTtx[index] : ToReal(0.0); + CCTK_REAL eTtyL = (*stress_energy_state) ? eTty[index] : ToReal(0.0); + CCTK_REAL eTtzL = (*stress_energy_state) ? eTtz[index] : ToReal(0.0); + CCTK_REAL eTxxL = (*stress_energy_state) ? eTxx[index] : ToReal(0.0); + CCTK_REAL eTxyL = (*stress_energy_state) ? eTxy[index] : ToReal(0.0); + CCTK_REAL eTxzL = (*stress_energy_state) ? eTxz[index] : ToReal(0.0); + CCTK_REAL eTyyL = (*stress_energy_state) ? eTyy[index] : ToReal(0.0); + CCTK_REAL eTyzL = (*stress_energy_state) ? eTyz[index] : ToReal(0.0); + CCTK_REAL eTzzL = (*stress_energy_state) ? eTzz[index] : ToReal(0.0); + CCTK_REAL gt11L = gt11[index]; + CCTK_REAL gt12L = gt12[index]; + CCTK_REAL gt13L = gt13[index]; + CCTK_REAL gt22L = gt22[index]; + CCTK_REAL gt23L = gt23[index]; + CCTK_REAL gt33L = gt33[index]; + CCTK_REAL phiL = phi[index]; + CCTK_REAL trKL = trK[index]; + CCTK_REAL Xt1L = Xt1[index]; + CCTK_REAL Xt2L = Xt2[index]; + CCTK_REAL Xt3L = Xt3[index]; + + /* Include user supplied include files */ + + /* Precompute derivatives */ + CCTK_REAL const PDstandardNth1At11 = PDstandardNth1(&At11[index]); + CCTK_REAL const PDstandardNth2At11 = PDstandardNth2(&At11[index]); + CCTK_REAL const PDstandardNth3At11 = PDstandardNth3(&At11[index]); + CCTK_REAL const PDstandardNth1At12 = PDstandardNth1(&At12[index]); + CCTK_REAL const PDstandardNth2At12 = PDstandardNth2(&At12[index]); + CCTK_REAL const PDstandardNth3At12 = PDstandardNth3(&At12[index]); + CCTK_REAL const PDstandardNth1At13 = PDstandardNth1(&At13[index]); + CCTK_REAL const PDstandardNth2At13 = PDstandardNth2(&At13[index]); + CCTK_REAL const PDstandardNth3At13 = PDstandardNth3(&At13[index]); + CCTK_REAL const PDstandardNth1At22 = PDstandardNth1(&At22[index]); + CCTK_REAL const PDstandardNth2At22 = PDstandardNth2(&At22[index]); + CCTK_REAL const PDstandardNth3At22 = PDstandardNth3(&At22[index]); + CCTK_REAL const PDstandardNth1At23 = PDstandardNth1(&At23[index]); + CCTK_REAL const PDstandardNth2At23 = PDstandardNth2(&At23[index]); + CCTK_REAL const PDstandardNth3At23 = PDstandardNth3(&At23[index]); + CCTK_REAL const PDstandardNth1At33 = PDstandardNth1(&At33[index]); + CCTK_REAL const PDstandardNth2At33 = PDstandardNth2(&At33[index]); + CCTK_REAL const PDstandardNth3At33 = PDstandardNth3(&At33[index]); + CCTK_REAL const PDstandardNth1gt11 = PDstandardNth1(>11[index]); + CCTK_REAL const PDstandardNth2gt11 = PDstandardNth2(>11[index]); + CCTK_REAL const PDstandardNth3gt11 = PDstandardNth3(>11[index]); + CCTK_REAL const PDstandardNth1gt12 = PDstandardNth1(>12[index]); + CCTK_REAL const PDstandardNth2gt12 = PDstandardNth2(>12[index]); + CCTK_REAL const PDstandardNth3gt12 = PDstandardNth3(>12[index]); + CCTK_REAL const PDstandardNth1gt13 = PDstandardNth1(>13[index]); + CCTK_REAL const PDstandardNth2gt13 = PDstandardNth2(>13[index]); + CCTK_REAL const PDstandardNth3gt13 = PDstandardNth3(>13[index]); + CCTK_REAL const PDstandardNth1gt22 = PDstandardNth1(>22[index]); + CCTK_REAL const PDstandardNth2gt22 = PDstandardNth2(>22[index]); + CCTK_REAL const PDstandardNth3gt22 = PDstandardNth3(>22[index]); + CCTK_REAL const PDstandardNth1gt23 = PDstandardNth1(>23[index]); + CCTK_REAL const PDstandardNth2gt23 = PDstandardNth2(>23[index]); + CCTK_REAL const PDstandardNth3gt23 = PDstandardNth3(>23[index]); + CCTK_REAL const PDstandardNth1gt33 = PDstandardNth1(>33[index]); + CCTK_REAL const PDstandardNth2gt33 = PDstandardNth2(>33[index]); + CCTK_REAL const PDstandardNth3gt33 = PDstandardNth3(>33[index]); + CCTK_REAL const PDstandardNth1phi = PDstandardNth1(&phi[index]); + CCTK_REAL const PDstandardNth2phi = PDstandardNth2(&phi[index]); + CCTK_REAL const PDstandardNth3phi = PDstandardNth3(&phi[index]); + CCTK_REAL const PDstandardNth1trK = PDstandardNth1(&trK[index]); + CCTK_REAL const PDstandardNth2trK = PDstandardNth2(&trK[index]); + CCTK_REAL const PDstandardNth3trK = PDstandardNth3(&trK[index]); + + /* Calculate temporaries and grid functions */ + CCTK_REAL detgt = 1; + + CCTK_REAL gtu11 = INV(detgt)*(gt22L*gt33L - SQR(gt23L)); + + CCTK_REAL gtu12 = (gt13L*gt23L - gt12L*gt33L)*INV(detgt); + + CCTK_REAL gtu13 = (-(gt13L*gt22L) + gt12L*gt23L)*INV(detgt); + + CCTK_REAL gtu22 = INV(detgt)*(gt11L*gt33L - SQR(gt13L)); + + CCTK_REAL gtu23 = (gt12L*gt13L - gt11L*gt23L)*INV(detgt); + + CCTK_REAL gtu33 = INV(detgt)*(gt11L*gt22L - SQR(gt12L)); + + CCTK_REAL Gtl111 = 0.5*PDstandardNth1gt11; + + CCTK_REAL Gtl112 = 0.5*PDstandardNth2gt11; + + CCTK_REAL Gtl113 = 0.5*PDstandardNth3gt11; + + CCTK_REAL Gtl122 = -0.5*PDstandardNth1gt22 + PDstandardNth2gt12; + + CCTK_REAL Gtl123 = 0.5*(-PDstandardNth1gt23 + PDstandardNth2gt13 + + PDstandardNth3gt12); + + CCTK_REAL Gtl133 = -0.5*PDstandardNth1gt33 + PDstandardNth3gt13; + + CCTK_REAL Gtl211 = PDstandardNth1gt12 - 0.5*PDstandardNth2gt11; + + CCTK_REAL Gtl212 = 0.5*PDstandardNth1gt22; + + CCTK_REAL Gtl213 = 0.5*(PDstandardNth1gt23 - PDstandardNth2gt13 + + PDstandardNth3gt12); + + CCTK_REAL Gtl222 = 0.5*PDstandardNth2gt22; + + CCTK_REAL Gtl223 = 0.5*PDstandardNth3gt22; + + CCTK_REAL Gtl233 = -0.5*PDstandardNth2gt33 + PDstandardNth3gt23; + + CCTK_REAL Gtl311 = PDstandardNth1gt13 - 0.5*PDstandardNth3gt11; + + CCTK_REAL Gtl312 = 0.5*(PDstandardNth1gt23 + PDstandardNth2gt13 - + PDstandardNth3gt12); + + CCTK_REAL Gtl313 = 0.5*PDstandardNth1gt33; + + CCTK_REAL Gtl322 = PDstandardNth2gt23 - 0.5*PDstandardNth3gt22; + + CCTK_REAL Gtl323 = 0.5*PDstandardNth2gt33; + + CCTK_REAL Gtl333 = 0.5*PDstandardNth3gt33; + + CCTK_REAL Gt111 = Gtl111*gtu11 + Gtl211*gtu12 + Gtl311*gtu13; + + CCTK_REAL Gt211 = Gtl111*gtu12 + Gtl211*gtu22 + Gtl311*gtu23; + + CCTK_REAL Gt311 = Gtl111*gtu13 + Gtl211*gtu23 + Gtl311*gtu33; + + CCTK_REAL Gt112 = Gtl112*gtu11 + Gtl212*gtu12 + Gtl312*gtu13; + + CCTK_REAL Gt212 = Gtl112*gtu12 + Gtl212*gtu22 + Gtl312*gtu23; + + CCTK_REAL Gt312 = Gtl112*gtu13 + Gtl212*gtu23 + Gtl312*gtu33; + + CCTK_REAL Gt113 = Gtl113*gtu11 + Gtl213*gtu12 + Gtl313*gtu13; + + CCTK_REAL Gt213 = Gtl113*gtu12 + Gtl213*gtu22 + Gtl313*gtu23; + + CCTK_REAL Gt313 = Gtl113*gtu13 + Gtl213*gtu23 + Gtl313*gtu33; + + CCTK_REAL Gt122 = Gtl122*gtu11 + Gtl222*gtu12 + Gtl322*gtu13; + + CCTK_REAL Gt222 = Gtl122*gtu12 + Gtl222*gtu22 + Gtl322*gtu23; + + CCTK_REAL Gt322 = Gtl122*gtu13 + Gtl222*gtu23 + Gtl322*gtu33; + + CCTK_REAL Gt123 = Gtl123*gtu11 + Gtl223*gtu12 + Gtl323*gtu13; + + CCTK_REAL Gt223 = Gtl123*gtu12 + Gtl223*gtu22 + Gtl323*gtu23; + + CCTK_REAL Gt323 = Gtl123*gtu13 + Gtl223*gtu23 + Gtl323*gtu33; + + CCTK_REAL Gt133 = Gtl133*gtu11 + Gtl233*gtu12 + Gtl333*gtu13; + + CCTK_REAL Gt233 = Gtl133*gtu12 + Gtl233*gtu22 + Gtl333*gtu23; + + CCTK_REAL Gt333 = Gtl133*gtu13 + Gtl233*gtu23 + Gtl333*gtu33; + + CCTK_REAL fac1 = IfThen(ToReal(conformalMethod),-0.5*INV(phiL),1); + + CCTK_REAL cdphi1 = fac1*PDstandardNth1phi; + + CCTK_REAL cdphi2 = fac1*PDstandardNth2phi; + + CCTK_REAL cdphi3 = fac1*PDstandardNth3phi; + + CCTK_REAL S1 = (-eTtxL + beta1L*eTxxL + beta2L*eTxyL + + beta3L*eTxzL)*INV(alphaL); + + CCTK_REAL S2 = (-eTtyL + beta1L*eTxyL + beta2L*eTyyL + + beta3L*eTyzL)*INV(alphaL); + + CCTK_REAL S3 = (-eTtzL + beta1L*eTxzL + beta2L*eTyzL + + beta3L*eTzzL)*INV(alphaL); + + CCTK_REAL M1L = -2.*((At12L*Gt211 + At13L*Gt311)*gtu11 + + At11L*Gt123*gtu23) + At12L*((6.*cdphi1 - 1.*Gt111)*gtu12 - + 3.*Gt213*gtu13 + 6.*(cdphi2*gtu22 + cdphi3*gtu23) - 1.*Gt233*gtu33) - + 1.*((At22L*Gt212 + At12L*(Gt112 + Gt222) + At23L*Gt312)*gtu22 + + (At13L*Gt112 + At12L*Gt113 + At23L*Gt212)*gtu23 + (At13L*Gt113 + + At23L*Gt213 + At33L*Gt313)*gtu33) + At11L*((6.*cdphi1 - 2.*Gt111)*gtu11 + + 6.*(cdphi2*gtu12 + cdphi3*gtu13) - 1.*(Gt122*gtu22 + Gt133*gtu33)) + + At13L*((6.*cdphi1 - 1.*Gt111)*gtu13 + 6.*(cdphi2*gtu23 + cdphi3*gtu33) + - 1.*(Gt322*gtu22 + Gt333*gtu33)) + gtu11*PDstandardNth1At11 - + 0.6666666666666666666666666666666666666667*PDstandardNth1trK + + gtu12*(-1.*(At22L*Gt211 + At23L*Gt311) - 3.*(At11L*Gt112 + At12L*Gt212 + + At13L*Gt312) + PDstandardNth1At12 + PDstandardNth2At11) + + gtu22*PDstandardNth2At12 + gtu13*(-1.*(At23L*Gt211 + At33L*Gt311) - + 3.*(At11L*Gt113 + At13L*Gt313) + PDstandardNth1At13 + + PDstandardNth3At11) + gtu23*(-1.*(At22L*Gt213 + At33L*Gt312 + + At23L*Gt313) - 2.*(At12L*Gt223 + At13L*Gt323) + PDstandardNth2At13 + + PDstandardNth3At12) + gtu33*PDstandardNth3At13 - + 25.13274122871834590770114706623602307358*S1; + + CCTK_REAL M2L = At12L*((6.*cdphi1 - 1.*Gt111)*gtu11 + 6.*(cdphi2*gtu12 + + cdphi3*gtu13) - 2.*Gt122*gtu22 - 3.*Gt123*gtu23 - 1.*Gt133*gtu33) + + At22L*((6.*cdphi2 - 2.*Gt222)*gtu22 + 6.*cdphi3*gtu23 - 1.*Gt233*gtu33) + + At23L*(-2.*Gt322*gtu22 - 1.*Gt333*gtu33 + 6.*(cdphi2*gtu23 + + cdphi3*gtu33)) - 1.*((At11L*Gt112 + At22L*Gt211 + At12L*Gt212 + + At23L*Gt311 + At13L*Gt312)*gtu11 + Gt122*(At11L*gtu12 + At13L*gtu23) + + (At23L*Gt223 + At33L*Gt323)*gtu33 + At13L*(Gt112*gtu13 + Gt123*gtu33)) + + gtu11*PDstandardNth1At12 + gtu12*(At22L*(6.*cdphi1 - 3.*Gt212) + + At12L*(-3.*Gt112 - 1.*Gt222) - 3.*At23L*Gt312 - 1.*At13L*Gt322 + + PDstandardNth1At22 + PDstandardNth2At12) + gtu22*PDstandardNth2At22 - + 0.6666666666666666666666666666666666666667*PDstandardNth2trK + + gtu13*(-2.*(At12L*Gt113 + At22L*Gt213) + At23L*(6.*cdphi1 - 1.*Gt212 - + 2.*Gt313) - 1.*(At11L*Gt123 + At12L*Gt223 + At33L*Gt312 + At13L*Gt323) + + PDstandardNth1At23 + PDstandardNth3At12) + gtu23*(-1.*(At23L*Gt222 + + At33L*Gt322) - 3.*(At22L*Gt223 + At23L*Gt323) + PDstandardNth2At23 + + PDstandardNth3At22) + gtu33*PDstandardNth3At23 - + 25.13274122871834590770114706623602307358*S2; + + CCTK_REAL M3L = -1.*((At11L*Gt113 + At23L*Gt211 + At12L*Gt213 + + At33L*Gt311)*gtu11 + (At22L*Gt223 + At33L*Gt322 + At23L*Gt323)*gtu22 + + At12L*(Gt113*gtu12 + Gt123*gtu22) + Gt133*(At11L*gtu13 + At12L*gtu23)) + + At13L*((6.*cdphi1 - 1.*(Gt111 + Gt313))*gtu11 + 6.*(cdphi2*gtu12 + + cdphi3*gtu13) - 1.*Gt122*gtu22 - 3.*Gt123*gtu23 - 2.*Gt133*gtu33) + + At23L*((6.*cdphi2 - 1.*Gt222)*gtu22 + 6.*cdphi3*gtu23 - 2.*Gt233*gtu33) + + gtu11*PDstandardNth1At13 + gtu12*(-2.*(At13L*Gt112 + At33L*Gt312) + + At23L*(6.*cdphi1 - 2.*Gt212 - 1.*Gt313) - 1.*(At11L*Gt123 + At22L*Gt213 + + At12L*Gt223 + At13L*Gt323) + PDstandardNth1At23 + PDstandardNth2At13) + + gtu22*PDstandardNth2At23 + gtu13*(-3.*(At13L*Gt113 + At23L*Gt213) + + At33L*(6.*cdphi1 - 3.*Gt313) - 1.*(At12L*Gt233 + At13L*Gt333) + + PDstandardNth1At33 + PDstandardNth3At13) + gtu23*(-1.*At22L*Gt233 + + At33L*(6.*cdphi2 - 3.*Gt323) + At23L*(-3.*Gt223 - 1.*Gt333) + + PDstandardNth2At33 + PDstandardNth3At23) + gtu33*(At33L*(6.*cdphi3 - + 2.*Gt333) + PDstandardNth3At33) - + 0.6666666666666666666666666666666666666667*PDstandardNth3trK - + 25.13274122871834590770114706623602307358*S3; + + CCTK_REAL cSL = Log(detgt); + + CCTK_REAL cXt1L = Gt111*gtu11 + Gt122*gtu22 + 2*(Gt112*gtu12 + + Gt113*gtu13 + Gt123*gtu23) + Gt133*gtu33 - Xt1L; + + CCTK_REAL cXt2L = Gt211*gtu11 + Gt222*gtu22 + 2*(Gt212*gtu12 + + Gt213*gtu13 + Gt223*gtu23) + Gt233*gtu33 - Xt2L; + + CCTK_REAL cXt3L = Gt311*gtu11 + Gt322*gtu22 + 2*(Gt312*gtu12 + + Gt313*gtu13 + Gt323*gtu23) + Gt333*gtu33 - Xt3L; + + CCTK_REAL cAL = At11L*gtu11 + At22L*gtu22 + 2*(At12L*gtu12 + + At13L*gtu13 + At23L*gtu23) + At33L*gtu33; + + + /* Copy local copies back to grid functions */ + cA[index] = cAL; + cS[index] = cSL; + cXt1[index] = cXt1L; + cXt2[index] = cXt2L; + cXt3[index] = cXt3L; + M1[index] = M1L; + M2[index] = M2L; + M3[index] = M3L; + } + LC_ENDLOOP3 (ML_BSSN_O2_constraints2); +} + +extern "C" void ML_BSSN_O2_constraints2(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverInterior(cctkGH, &ML_BSSN_O2_constraints2_Body); +} diff --git a/ML_BSSN_O2/src/ML_BSSN_O2_convertFromADMBase.cc b/ML_BSSN_O2/src/ML_BSSN_O2_convertFromADMBase.cc new file mode 100644 index 0000000..0dcb315 --- /dev/null +++ b/ML_BSSN_O2/src/ML_BSSN_O2_convertFromADMBase.cc @@ -0,0 +1,228 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +static void ML_BSSN_O2_convertFromADMBase_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_BSSN_O2_convertFromADMBase_Body"); + } + + if (cctk_iteration % ML_BSSN_O2_convertFromADMBase_calc_every != ML_BSSN_O2_convertFromADMBase_calc_offset) + { + return; + } + + const char *groups[] = {"ADMBase::curv","ADMBase::lapse","ADMBase::metric","ADMBase::shift","ML_BSSN_O2::ML_curv","ML_BSSN_O2::ML_lapse","ML_BSSN_O2::ML_log_confac","ML_BSSN_O2::ML_metric","ML_BSSN_O2::ML_shift","ML_BSSN_O2::ML_trace_curv"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_BSSN_O2_convertFromADMBase", 10, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o16dx = 0.0625*INV(dx); + CCTK_REAL const p1o16dy = 0.0625*INV(dy); + CCTK_REAL const p1o16dz = 0.0625*INV(dz); + CCTK_REAL const p1o2dx = 0.5*INV(dx); + CCTK_REAL const p1o2dy = 0.5*INV(dy); + CCTK_REAL const p1o2dz = 0.5*INV(dz); + CCTK_REAL const p1o4dx = 0.25*INV(dx); + CCTK_REAL const p1o4dxdy = 0.25*INV(dx)*INV(dy); + CCTK_REAL const p1o4dxdz = 0.25*INV(dx)*INV(dz); + CCTK_REAL const p1o4dy = 0.25*INV(dy); + CCTK_REAL const p1o4dydz = 0.25*INV(dy)*INV(dz); + CCTK_REAL const p1o4dz = 0.25*INV(dz); + CCTK_REAL const p1odx = INV(dx); + CCTK_REAL const p1odx2 = INV(SQR(dx)); + CCTK_REAL const p1ody = INV(dy); + CCTK_REAL const p1ody2 = INV(SQR(dy)); + CCTK_REAL const p1odz = INV(dz); + CCTK_REAL const p1odz2 = INV(SQR(dz)); + CCTK_REAL const pm1o2dx = -0.5*INV(dx); + CCTK_REAL const pm1o2dy = -0.5*INV(dy); + CCTK_REAL const pm1o2dz = -0.5*INV(dz); + CCTK_REAL const pm1o4dx = -0.25*INV(dx); + CCTK_REAL const pm1o4dy = -0.25*INV(dy); + CCTK_REAL const pm1o4dz = -0.25*INV(dz); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_BSSN_O2_convertFromADMBase, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + CCTK_REAL alpL = alp[index]; + CCTK_REAL betaxL = betax[index]; + CCTK_REAL betayL = betay[index]; + CCTK_REAL betazL = betaz[index]; + CCTK_REAL gxxL = gxx[index]; + CCTK_REAL gxyL = gxy[index]; + CCTK_REAL gxzL = gxz[index]; + CCTK_REAL gyyL = gyy[index]; + CCTK_REAL gyzL = gyz[index]; + CCTK_REAL gzzL = gzz[index]; + CCTK_REAL kxxL = kxx[index]; + CCTK_REAL kxyL = kxy[index]; + CCTK_REAL kxzL = kxz[index]; + CCTK_REAL kyyL = kyy[index]; + CCTK_REAL kyzL = kyz[index]; + CCTK_REAL kzzL = kzz[index]; + CCTK_REAL phiL = phi[index]; + CCTK_REAL trKL = trK[index]; + + /* Include user supplied include files */ + + /* Precompute derivatives */ + + /* Calculate temporaries and grid functions */ + CCTK_REAL g11 = gxxL; + + CCTK_REAL g12 = gxyL; + + CCTK_REAL g13 = gxzL; + + CCTK_REAL g22 = gyyL; + + CCTK_REAL g23 = gyzL; + + CCTK_REAL g33 = gzzL; + + CCTK_REAL detg = 2*g12*g13*g23 + g33*(g11*g22 - SQR(g12)) - + g22*SQR(g13) - g11*SQR(g23); + + CCTK_REAL gu11 = INV(detg)*(g22*g33 - SQR(g23)); + + CCTK_REAL gu12 = (g13*g23 - g12*g33)*INV(detg); + + CCTK_REAL gu13 = (-(g13*g22) + g12*g23)*INV(detg); + + CCTK_REAL gu22 = INV(detg)*(g11*g33 - SQR(g13)); + + CCTK_REAL gu23 = (g12*g13 - g11*g23)*INV(detg); + + CCTK_REAL gu33 = INV(detg)*(g11*g22 - SQR(g12)); + + phiL = + IfThen(ToReal(conformalMethod),pow(detg,-0.166666666666666666666666666667),0.0833333333333333333333333333333*Log(detg)); + + CCTK_REAL em4phi = + IfThen(ToReal(conformalMethod),SQR(phiL),exp(-4*phiL)); + + CCTK_REAL gt11L = em4phi*g11; + + CCTK_REAL gt12L = em4phi*g12; + + CCTK_REAL gt13L = em4phi*g13; + + CCTK_REAL gt22L = em4phi*g22; + + CCTK_REAL gt23L = em4phi*g23; + + CCTK_REAL gt33L = em4phi*g33; + + trKL = gu11*kxxL + gu22*kyyL + 2*(gu12*kxyL + gu13*kxzL + gu23*kyzL) + + gu33*kzzL; + + CCTK_REAL At11L = em4phi*(kxxL - + 0.333333333333333333333333333333*g11*trKL); + + CCTK_REAL At12L = em4phi*(kxyL - + 0.333333333333333333333333333333*g12*trKL); + + CCTK_REAL At13L = em4phi*(kxzL - + 0.333333333333333333333333333333*g13*trKL); + + CCTK_REAL At22L = em4phi*(kyyL - + 0.333333333333333333333333333333*g22*trKL); + + CCTK_REAL At23L = em4phi*(kyzL - + 0.333333333333333333333333333333*g23*trKL); + + CCTK_REAL At33L = em4phi*(kzzL - + 0.333333333333333333333333333333*g33*trKL); + + CCTK_REAL alphaL = alpL; + + CCTK_REAL beta1L = betaxL; + + CCTK_REAL beta2L = betayL; + + CCTK_REAL beta3L = betazL; + + + /* Copy local copies back to grid functions */ + alpha[index] = alphaL; + At11[index] = At11L; + At12[index] = At12L; + At13[index] = At13L; + At22[index] = At22L; + At23[index] = At23L; + At33[index] = At33L; + beta1[index] = beta1L; + beta2[index] = beta2L; + beta3[index] = beta3L; + gt11[index] = gt11L; + gt12[index] = gt12L; + gt13[index] = gt13L; + gt22[index] = gt22L; + gt23[index] = gt23L; + gt33[index] = gt33L; + phi[index] = phiL; + trK[index] = trKL; + } + LC_ENDLOOP3 (ML_BSSN_O2_convertFromADMBase); +} + +extern "C" void ML_BSSN_O2_convertFromADMBase(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverEverything(cctkGH, &ML_BSSN_O2_convertFromADMBase_Body); +} diff --git a/ML_BSSN_O2/src/ML_BSSN_O2_convertFromADMBaseGamma.cc b/ML_BSSN_O2/src/ML_BSSN_O2_convertFromADMBaseGamma.cc new file mode 100644 index 0000000..83c1399 --- /dev/null +++ b/ML_BSSN_O2/src/ML_BSSN_O2_convertFromADMBaseGamma.cc @@ -0,0 +1,332 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +extern "C" void ML_BSSN_O2_convertFromADMBaseGamma_SelectBCs(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT ierr = 0; + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_O2::ML_dtlapse","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_O2::ML_dtlapse."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_O2::ML_dtshift","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_O2::ML_dtshift."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_O2::ML_Gamma","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_O2::ML_Gamma."); + return; +} + +static void ML_BSSN_O2_convertFromADMBaseGamma_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_BSSN_O2_convertFromADMBaseGamma_Body"); + } + + if (cctk_iteration % ML_BSSN_O2_convertFromADMBaseGamma_calc_every != ML_BSSN_O2_convertFromADMBaseGamma_calc_offset) + { + return; + } + + const char *groups[] = {"ADMBase::dtlapse","ADMBase::dtshift","grid::coordinates","Grid::coordinates","ML_BSSN_O2::ML_dtlapse","ML_BSSN_O2::ML_dtshift","ML_BSSN_O2::ML_Gamma","ML_BSSN_O2::ML_lapse","ML_BSSN_O2::ML_metric","ML_BSSN_O2::ML_shift"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_BSSN_O2_convertFromADMBaseGamma", 10, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o16dx = 0.0625*INV(dx); + CCTK_REAL const p1o16dy = 0.0625*INV(dy); + CCTK_REAL const p1o16dz = 0.0625*INV(dz); + CCTK_REAL const p1o2dx = 0.5*INV(dx); + CCTK_REAL const p1o2dy = 0.5*INV(dy); + CCTK_REAL const p1o2dz = 0.5*INV(dz); + CCTK_REAL const p1o4dx = 0.25*INV(dx); + CCTK_REAL const p1o4dxdy = 0.25*INV(dx)*INV(dy); + CCTK_REAL const p1o4dxdz = 0.25*INV(dx)*INV(dz); + CCTK_REAL const p1o4dy = 0.25*INV(dy); + CCTK_REAL const p1o4dydz = 0.25*INV(dy)*INV(dz); + CCTK_REAL const p1o4dz = 0.25*INV(dz); + CCTK_REAL const p1odx = INV(dx); + CCTK_REAL const p1odx2 = INV(SQR(dx)); + CCTK_REAL const p1ody = INV(dy); + CCTK_REAL const p1ody2 = INV(SQR(dy)); + CCTK_REAL const p1odz = INV(dz); + CCTK_REAL const p1odz2 = INV(SQR(dz)); + CCTK_REAL const pm1o2dx = -0.5*INV(dx); + CCTK_REAL const pm1o2dy = -0.5*INV(dy); + CCTK_REAL const pm1o2dz = -0.5*INV(dz); + CCTK_REAL const pm1o4dx = -0.25*INV(dx); + CCTK_REAL const pm1o4dy = -0.25*INV(dy); + CCTK_REAL const pm1o4dz = -0.25*INV(dz); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_BSSN_O2_convertFromADMBaseGamma, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + CCTK_REAL alphaL = alpha[index]; + CCTK_REAL beta1L = beta1[index]; + CCTK_REAL beta2L = beta2[index]; + CCTK_REAL beta3L = beta3[index]; + CCTK_REAL dtalpL = dtalp[index]; + CCTK_REAL dtbetaxL = dtbetax[index]; + CCTK_REAL dtbetayL = dtbetay[index]; + CCTK_REAL dtbetazL = dtbetaz[index]; + CCTK_REAL gt11L = gt11[index]; + CCTK_REAL gt12L = gt12[index]; + CCTK_REAL gt13L = gt13[index]; + CCTK_REAL gt22L = gt22[index]; + CCTK_REAL gt23L = gt23[index]; + CCTK_REAL gt33L = gt33[index]; + CCTK_REAL rL = r[index]; + + /* Include user supplied include files */ + + /* Precompute derivatives */ + CCTK_REAL const PDupwindNthAnti1alpha = PDupwindNthAnti1(&alpha[index]); + CCTK_REAL const PDupwindNthSymm1alpha = PDupwindNthSymm1(&alpha[index]); + CCTK_REAL const PDupwindNthAnti2alpha = PDupwindNthAnti2(&alpha[index]); + CCTK_REAL const PDupwindNthSymm2alpha = PDupwindNthSymm2(&alpha[index]); + CCTK_REAL const PDupwindNthAnti3alpha = PDupwindNthAnti3(&alpha[index]); + CCTK_REAL const PDupwindNthSymm3alpha = PDupwindNthSymm3(&alpha[index]); + CCTK_REAL const PDupwindNthAnti1beta1 = PDupwindNthAnti1(&beta1[index]); + CCTK_REAL const PDupwindNthSymm1beta1 = PDupwindNthSymm1(&beta1[index]); + CCTK_REAL const PDupwindNthAnti2beta1 = PDupwindNthAnti2(&beta1[index]); + CCTK_REAL const PDupwindNthSymm2beta1 = PDupwindNthSymm2(&beta1[index]); + CCTK_REAL const PDupwindNthAnti3beta1 = PDupwindNthAnti3(&beta1[index]); + CCTK_REAL const PDupwindNthSymm3beta1 = PDupwindNthSymm3(&beta1[index]); + CCTK_REAL const PDupwindNthAnti1beta2 = PDupwindNthAnti1(&beta2[index]); + CCTK_REAL const PDupwindNthSymm1beta2 = PDupwindNthSymm1(&beta2[index]); + CCTK_REAL const PDupwindNthAnti2beta2 = PDupwindNthAnti2(&beta2[index]); + CCTK_REAL const PDupwindNthSymm2beta2 = PDupwindNthSymm2(&beta2[index]); + CCTK_REAL const PDupwindNthAnti3beta2 = PDupwindNthAnti3(&beta2[index]); + CCTK_REAL const PDupwindNthSymm3beta2 = PDupwindNthSymm3(&beta2[index]); + CCTK_REAL const PDupwindNthAnti1beta3 = PDupwindNthAnti1(&beta3[index]); + CCTK_REAL const PDupwindNthSymm1beta3 = PDupwindNthSymm1(&beta3[index]); + CCTK_REAL const PDupwindNthAnti2beta3 = PDupwindNthAnti2(&beta3[index]); + CCTK_REAL const PDupwindNthSymm2beta3 = PDupwindNthSymm2(&beta3[index]); + CCTK_REAL const PDupwindNthAnti3beta3 = PDupwindNthAnti3(&beta3[index]); + CCTK_REAL const PDupwindNthSymm3beta3 = PDupwindNthSymm3(&beta3[index]); + CCTK_REAL const PDstandardNth1gt11 = PDstandardNth1(>11[index]); + CCTK_REAL const PDstandardNth2gt11 = PDstandardNth2(>11[index]); + CCTK_REAL const PDstandardNth3gt11 = PDstandardNth3(>11[index]); + CCTK_REAL const PDstandardNth1gt12 = PDstandardNth1(>12[index]); + CCTK_REAL const PDstandardNth2gt12 = PDstandardNth2(>12[index]); + CCTK_REAL const PDstandardNth3gt12 = PDstandardNth3(>12[index]); + CCTK_REAL const PDstandardNth1gt13 = PDstandardNth1(>13[index]); + CCTK_REAL const PDstandardNth2gt13 = PDstandardNth2(>13[index]); + CCTK_REAL const PDstandardNth3gt13 = PDstandardNth3(>13[index]); + CCTK_REAL const PDstandardNth1gt22 = PDstandardNth1(>22[index]); + CCTK_REAL const PDstandardNth2gt22 = PDstandardNth2(>22[index]); + CCTK_REAL const PDstandardNth3gt22 = PDstandardNth3(>22[index]); + CCTK_REAL const PDstandardNth1gt23 = PDstandardNth1(>23[index]); + CCTK_REAL const PDstandardNth2gt23 = PDstandardNth2(>23[index]); + CCTK_REAL const PDstandardNth3gt23 = PDstandardNth3(>23[index]); + CCTK_REAL const PDstandardNth1gt33 = PDstandardNth1(>33[index]); + CCTK_REAL const PDstandardNth2gt33 = PDstandardNth2(>33[index]); + CCTK_REAL const PDstandardNth3gt33 = PDstandardNth3(>33[index]); + + /* Calculate temporaries and grid functions */ + ptrdiff_t dir1 = Sign(beta1L); + + ptrdiff_t dir2 = Sign(beta2L); + + ptrdiff_t dir3 = Sign(beta3L); + + CCTK_REAL detgt = 1; + + CCTK_REAL gtu11 = INV(detgt)*(gt22L*gt33L - SQR(gt23L)); + + CCTK_REAL gtu12 = (gt13L*gt23L - gt12L*gt33L)*INV(detgt); + + CCTK_REAL gtu13 = (-(gt13L*gt22L) + gt12L*gt23L)*INV(detgt); + + CCTK_REAL gtu22 = INV(detgt)*(gt11L*gt33L - SQR(gt13L)); + + CCTK_REAL gtu23 = (gt12L*gt13L - gt11L*gt23L)*INV(detgt); + + CCTK_REAL gtu33 = INV(detgt)*(gt11L*gt22L - SQR(gt12L)); + + CCTK_REAL Gt111 = 0.5*(gtu11*PDstandardNth1gt11 + + 2*(gtu12*PDstandardNth1gt12 + gtu13*PDstandardNth1gt13) - + gtu12*PDstandardNth2gt11 - gtu13*PDstandardNth3gt11); + + CCTK_REAL Gt211 = 0.5*(gtu12*PDstandardNth1gt11 + + 2*(gtu22*PDstandardNth1gt12 + gtu23*PDstandardNth1gt13) - + gtu22*PDstandardNth2gt11 - gtu23*PDstandardNth3gt11); + + CCTK_REAL Gt311 = 0.5*(gtu13*PDstandardNth1gt11 + + 2*(gtu23*PDstandardNth1gt12 + gtu33*PDstandardNth1gt13) - + gtu23*PDstandardNth2gt11 - gtu33*PDstandardNth3gt11); + + CCTK_REAL Gt112 = 0.5*(gtu12*PDstandardNth1gt22 + + gtu11*PDstandardNth2gt11 + gtu13*(PDstandardNth1gt23 + + PDstandardNth2gt13 - PDstandardNth3gt12)); + + CCTK_REAL Gt212 = 0.5*(gtu22*PDstandardNth1gt22 + + gtu12*PDstandardNth2gt11 + gtu23*(PDstandardNth1gt23 + + PDstandardNth2gt13 - PDstandardNth3gt12)); + + CCTK_REAL Gt312 = 0.5*(gtu23*PDstandardNth1gt22 + + gtu13*PDstandardNth2gt11 + gtu33*(PDstandardNth1gt23 + + PDstandardNth2gt13 - PDstandardNth3gt12)); + + CCTK_REAL Gt113 = 0.5*(gtu13*PDstandardNth1gt33 + + gtu11*PDstandardNth3gt11 + gtu12*(PDstandardNth1gt23 - + PDstandardNth2gt13 + PDstandardNth3gt12)); + + CCTK_REAL Gt213 = 0.5*(gtu23*PDstandardNth1gt33 + + gtu12*PDstandardNth3gt11 + gtu22*(PDstandardNth1gt23 - + PDstandardNth2gt13 + PDstandardNth3gt12)); + + CCTK_REAL Gt313 = 0.5*(gtu33*PDstandardNth1gt33 + + gtu13*PDstandardNth3gt11 + gtu23*(PDstandardNth1gt23 - + PDstandardNth2gt13 + PDstandardNth3gt12)); + + CCTK_REAL Gt122 = 0.5*(gtu11*(-PDstandardNth1gt22 + + 2*PDstandardNth2gt12) + gtu12*PDstandardNth2gt22 + + gtu13*(2*PDstandardNth2gt23 - PDstandardNth3gt22)); + + CCTK_REAL Gt222 = 0.5*(gtu12*(-PDstandardNth1gt22 + + 2*PDstandardNth2gt12) + gtu22*PDstandardNth2gt22 + + gtu23*(2*PDstandardNth2gt23 - PDstandardNth3gt22)); + + CCTK_REAL Gt322 = 0.5*(gtu13*(-PDstandardNth1gt22 + + 2*PDstandardNth2gt12) + gtu23*PDstandardNth2gt22 + + gtu33*(2*PDstandardNth2gt23 - PDstandardNth3gt22)); + + CCTK_REAL Gt123 = 0.5*(gtu13*PDstandardNth2gt33 + + gtu11*(-PDstandardNth1gt23 + PDstandardNth2gt13 + PDstandardNth3gt12) + + gtu12*PDstandardNth3gt22); + + CCTK_REAL Gt223 = 0.5*(gtu23*PDstandardNth2gt33 + + gtu12*(-PDstandardNth1gt23 + PDstandardNth2gt13 + PDstandardNth3gt12) + + gtu22*PDstandardNth3gt22); + + CCTK_REAL Gt323 = 0.5*(gtu33*PDstandardNth2gt33 + + gtu13*(-PDstandardNth1gt23 + PDstandardNth2gt13 + PDstandardNth3gt12) + + gtu23*PDstandardNth3gt22); + + CCTK_REAL Gt133 = 0.5*(gtu11*(-PDstandardNth1gt33 + + 2*PDstandardNth3gt13) + gtu12*(-PDstandardNth2gt33 + + 2*PDstandardNth3gt23) + gtu13*PDstandardNth3gt33); + + CCTK_REAL Gt233 = 0.5*(gtu12*(-PDstandardNth1gt33 + + 2*PDstandardNth3gt13) + gtu22*(-PDstandardNth2gt33 + + 2*PDstandardNth3gt23) + gtu23*PDstandardNth3gt33); + + CCTK_REAL Gt333 = 0.5*(gtu13*(-PDstandardNth1gt33 + + 2*PDstandardNth3gt13) + gtu23*(-PDstandardNth2gt33 + + 2*PDstandardNth3gt23) + gtu33*PDstandardNth3gt33); + + CCTK_REAL Xt1L = Gt111*gtu11 + Gt122*gtu22 + 2*(Gt112*gtu12 + + Gt113*gtu13 + Gt123*gtu23) + Gt133*gtu33; + + CCTK_REAL Xt2L = Gt211*gtu11 + Gt222*gtu22 + 2*(Gt212*gtu12 + + Gt213*gtu13 + Gt223*gtu23) + Gt233*gtu33; + + CCTK_REAL Xt3L = Gt311*gtu11 + Gt322*gtu22 + 2*(Gt312*gtu12 + + Gt313*gtu13 + Gt323*gtu23) + Gt333*gtu33; + + CCTK_REAL AL = IfThen(ToReal(LapseACoeff) != + 0,-3*INV(ToReal(harmonicF))*pow(alphaL,-ToReal(harmonicN))*(9*dtalpL - + (beta1L*PDupwindNthAnti1alpha + beta2L*PDupwindNthAnti2alpha + + beta3L*PDupwindNthAnti3alpha + PDupwindNthSymm1alpha*Abs(beta1L) + + PDupwindNthSymm2alpha*Abs(beta2L) + + PDupwindNthSymm3alpha*Abs(beta3L))*ToReal(LapseAdvectionCoeff)),0); + + CCTK_REAL theta = fmin(1,exp(1 - + rL*INV(ToReal(SpatialShiftGammaCoeffRadius)))); + + CCTK_REAL B1L = IfThen(ToReal(ShiftBCoeff)*ToReal(ShiftGammaCoeff) != + 0,INV(theta)*INV(ToReal(ShiftGammaCoeff))*(27*dtbetaxL - + 3*(beta1L*PDupwindNthAnti1beta1 + beta2L*PDupwindNthAnti2beta1 + + beta3L*PDupwindNthAnti3beta1 + PDupwindNthSymm1beta1*Abs(beta1L) + + PDupwindNthSymm2beta1*Abs(beta2L) + + PDupwindNthSymm3beta1*Abs(beta3L))*ToReal(ShiftAdvectionCoeff)),0); + + CCTK_REAL B2L = IfThen(ToReal(ShiftBCoeff)*ToReal(ShiftGammaCoeff) != + 0,INV(theta)*INV(ToReal(ShiftGammaCoeff))*(27*dtbetayL - + 3*(beta1L*PDupwindNthAnti1beta2 + beta2L*PDupwindNthAnti2beta2 + + beta3L*PDupwindNthAnti3beta2 + PDupwindNthSymm1beta2*Abs(beta1L) + + PDupwindNthSymm2beta2*Abs(beta2L) + + PDupwindNthSymm3beta2*Abs(beta3L))*ToReal(ShiftAdvectionCoeff)),0); + + CCTK_REAL B3L = IfThen(ToReal(ShiftBCoeff)*ToReal(ShiftGammaCoeff) != + 0,INV(theta)*INV(ToReal(ShiftGammaCoeff))*(27*dtbetazL - + 3*(beta1L*PDupwindNthAnti1beta3 + beta2L*PDupwindNthAnti2beta3 + + beta3L*PDupwindNthAnti3beta3 + PDupwindNthSymm1beta3*Abs(beta1L) + + PDupwindNthSymm2beta3*Abs(beta2L) + + PDupwindNthSymm3beta3*Abs(beta3L))*ToReal(ShiftAdvectionCoeff)),0); + + + /* Copy local copies back to grid functions */ + A[index] = AL; + B1[index] = B1L; + B2[index] = B2L; + B3[index] = B3L; + Xt1[index] = Xt1L; + Xt2[index] = Xt2L; + Xt3[index] = Xt3L; + } + LC_ENDLOOP3 (ML_BSSN_O2_convertFromADMBaseGamma); +} + +extern "C" void ML_BSSN_O2_convertFromADMBaseGamma(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverInterior(cctkGH, &ML_BSSN_O2_convertFromADMBaseGamma_Body); +} diff --git a/ML_BSSN_O2/src/ML_BSSN_O2_convertToADMBase.cc b/ML_BSSN_O2/src/ML_BSSN_O2_convertToADMBase.cc new file mode 100644 index 0000000..2e75fcd --- /dev/null +++ b/ML_BSSN_O2/src/ML_BSSN_O2_convertToADMBase.cc @@ -0,0 +1,199 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +static void ML_BSSN_O2_convertToADMBase_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_BSSN_O2_convertToADMBase_Body"); + } + + if (cctk_iteration % ML_BSSN_O2_convertToADMBase_calc_every != ML_BSSN_O2_convertToADMBase_calc_offset) + { + return; + } + + const char *groups[] = {"ADMBase::curv","ADMBase::lapse","ADMBase::metric","ADMBase::shift","ML_BSSN_O2::ML_curv","ML_BSSN_O2::ML_lapse","ML_BSSN_O2::ML_log_confac","ML_BSSN_O2::ML_metric","ML_BSSN_O2::ML_shift","ML_BSSN_O2::ML_trace_curv"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_BSSN_O2_convertToADMBase", 10, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o16dx = 0.0625*INV(dx); + CCTK_REAL const p1o16dy = 0.0625*INV(dy); + CCTK_REAL const p1o16dz = 0.0625*INV(dz); + CCTK_REAL const p1o2dx = 0.5*INV(dx); + CCTK_REAL const p1o2dy = 0.5*INV(dy); + CCTK_REAL const p1o2dz = 0.5*INV(dz); + CCTK_REAL const p1o4dx = 0.25*INV(dx); + CCTK_REAL const p1o4dxdy = 0.25*INV(dx)*INV(dy); + CCTK_REAL const p1o4dxdz = 0.25*INV(dx)*INV(dz); + CCTK_REAL const p1o4dy = 0.25*INV(dy); + CCTK_REAL const p1o4dydz = 0.25*INV(dy)*INV(dz); + CCTK_REAL const p1o4dz = 0.25*INV(dz); + CCTK_REAL const p1odx = INV(dx); + CCTK_REAL const p1odx2 = INV(SQR(dx)); + CCTK_REAL const p1ody = INV(dy); + CCTK_REAL const p1ody2 = INV(SQR(dy)); + CCTK_REAL const p1odz = INV(dz); + CCTK_REAL const p1odz2 = INV(SQR(dz)); + CCTK_REAL const pm1o2dx = -0.5*INV(dx); + CCTK_REAL const pm1o2dy = -0.5*INV(dy); + CCTK_REAL const pm1o2dz = -0.5*INV(dz); + CCTK_REAL const pm1o4dx = -0.25*INV(dx); + CCTK_REAL const pm1o4dy = -0.25*INV(dy); + CCTK_REAL const pm1o4dz = -0.25*INV(dz); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_BSSN_O2_convertToADMBase, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + CCTK_REAL alphaL = alpha[index]; + CCTK_REAL At11L = At11[index]; + CCTK_REAL At12L = At12[index]; + CCTK_REAL At13L = At13[index]; + CCTK_REAL At22L = At22[index]; + CCTK_REAL At23L = At23[index]; + CCTK_REAL At33L = At33[index]; + CCTK_REAL beta1L = beta1[index]; + CCTK_REAL beta2L = beta2[index]; + CCTK_REAL beta3L = beta3[index]; + CCTK_REAL gt11L = gt11[index]; + CCTK_REAL gt12L = gt12[index]; + CCTK_REAL gt13L = gt13[index]; + CCTK_REAL gt22L = gt22[index]; + CCTK_REAL gt23L = gt23[index]; + CCTK_REAL gt33L = gt33[index]; + CCTK_REAL gxxL = gxx[index]; + CCTK_REAL gxyL = gxy[index]; + CCTK_REAL gxzL = gxz[index]; + CCTK_REAL gyyL = gyy[index]; + CCTK_REAL gyzL = gyz[index]; + CCTK_REAL gzzL = gzz[index]; + CCTK_REAL phiL = phi[index]; + CCTK_REAL trKL = trK[index]; + + /* Include user supplied include files */ + + /* Precompute derivatives */ + + /* Calculate temporaries and grid functions */ + CCTK_REAL e4phi = + IfThen(ToReal(conformalMethod),INV(SQR(phiL)),exp(4*phiL)); + + gxxL = e4phi*gt11L; + + gxyL = e4phi*gt12L; + + gxzL = e4phi*gt13L; + + gyyL = e4phi*gt22L; + + gyzL = e4phi*gt23L; + + gzzL = e4phi*gt33L; + + CCTK_REAL kxxL = At11L*e4phi + + 0.333333333333333333333333333333*gxxL*trKL; + + CCTK_REAL kxyL = At12L*e4phi + + 0.333333333333333333333333333333*gxyL*trKL; + + CCTK_REAL kxzL = At13L*e4phi + + 0.333333333333333333333333333333*gxzL*trKL; + + CCTK_REAL kyyL = At22L*e4phi + + 0.333333333333333333333333333333*gyyL*trKL; + + CCTK_REAL kyzL = At23L*e4phi + + 0.333333333333333333333333333333*gyzL*trKL; + + CCTK_REAL kzzL = At33L*e4phi + + 0.333333333333333333333333333333*gzzL*trKL; + + CCTK_REAL alpL = alphaL; + + CCTK_REAL betaxL = beta1L; + + CCTK_REAL betayL = beta2L; + + CCTK_REAL betazL = beta3L; + + + /* Copy local copies back to grid functions */ + alp[index] = alpL; + betax[index] = betaxL; + betay[index] = betayL; + betaz[index] = betazL; + gxx[index] = gxxL; + gxy[index] = gxyL; + gxz[index] = gxzL; + gyy[index] = gyyL; + gyz[index] = gyzL; + gzz[index] = gzzL; + kxx[index] = kxxL; + kxy[index] = kxyL; + kxz[index] = kxzL; + kyy[index] = kyyL; + kyz[index] = kyzL; + kzz[index] = kzzL; + } + LC_ENDLOOP3 (ML_BSSN_O2_convertToADMBase); +} + +extern "C" void ML_BSSN_O2_convertToADMBase(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverEverything(cctkGH, &ML_BSSN_O2_convertToADMBase_Body); +} diff --git a/ML_BSSN_O2/src/ML_BSSN_O2_convertToADMBaseDtLapseShift.cc b/ML_BSSN_O2/src/ML_BSSN_O2_convertToADMBaseDtLapseShift.cc new file mode 100644 index 0000000..8290f2f --- /dev/null +++ b/ML_BSSN_O2/src/ML_BSSN_O2_convertToADMBaseDtLapseShift.cc @@ -0,0 +1,213 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +extern "C" void ML_BSSN_O2_convertToADMBaseDtLapseShift_SelectBCs(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT ierr = 0; + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ADMBase::dtlapse","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ADMBase::dtlapse."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ADMBase::dtshift","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ADMBase::dtshift."); + return; +} + +static void ML_BSSN_O2_convertToADMBaseDtLapseShift_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_BSSN_O2_convertToADMBaseDtLapseShift_Body"); + } + + if (cctk_iteration % ML_BSSN_O2_convertToADMBaseDtLapseShift_calc_every != ML_BSSN_O2_convertToADMBaseDtLapseShift_calc_offset) + { + return; + } + + const char *groups[] = {"ADMBase::dtlapse","ADMBase::dtshift","grid::coordinates","Grid::coordinates","ML_BSSN_O2::ML_dtlapse","ML_BSSN_O2::ML_dtshift","ML_BSSN_O2::ML_Gamma","ML_BSSN_O2::ML_lapse","ML_BSSN_O2::ML_shift","ML_BSSN_O2::ML_trace_curv"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_BSSN_O2_convertToADMBaseDtLapseShift", 10, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o16dx = 0.0625*INV(dx); + CCTK_REAL const p1o16dy = 0.0625*INV(dy); + CCTK_REAL const p1o16dz = 0.0625*INV(dz); + CCTK_REAL const p1o2dx = 0.5*INV(dx); + CCTK_REAL const p1o2dy = 0.5*INV(dy); + CCTK_REAL const p1o2dz = 0.5*INV(dz); + CCTK_REAL const p1o4dx = 0.25*INV(dx); + CCTK_REAL const p1o4dxdy = 0.25*INV(dx)*INV(dy); + CCTK_REAL const p1o4dxdz = 0.25*INV(dx)*INV(dz); + CCTK_REAL const p1o4dy = 0.25*INV(dy); + CCTK_REAL const p1o4dydz = 0.25*INV(dy)*INV(dz); + CCTK_REAL const p1o4dz = 0.25*INV(dz); + CCTK_REAL const p1odx = INV(dx); + CCTK_REAL const p1odx2 = INV(SQR(dx)); + CCTK_REAL const p1ody = INV(dy); + CCTK_REAL const p1ody2 = INV(SQR(dy)); + CCTK_REAL const p1odz = INV(dz); + CCTK_REAL const p1odz2 = INV(SQR(dz)); + CCTK_REAL const pm1o2dx = -0.5*INV(dx); + CCTK_REAL const pm1o2dy = -0.5*INV(dy); + CCTK_REAL const pm1o2dz = -0.5*INV(dz); + CCTK_REAL const pm1o4dx = -0.25*INV(dx); + CCTK_REAL const pm1o4dy = -0.25*INV(dy); + CCTK_REAL const pm1o4dz = -0.25*INV(dz); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_BSSN_O2_convertToADMBaseDtLapseShift, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + CCTK_REAL AL = A[index]; + CCTK_REAL alphaL = alpha[index]; + CCTK_REAL B1L = B1[index]; + CCTK_REAL B2L = B2[index]; + CCTK_REAL B3L = B3[index]; + CCTK_REAL beta1L = beta1[index]; + CCTK_REAL beta2L = beta2[index]; + CCTK_REAL beta3L = beta3[index]; + CCTK_REAL rL = r[index]; + CCTK_REAL trKL = trK[index]; + CCTK_REAL Xt1L = Xt1[index]; + CCTK_REAL Xt2L = Xt2[index]; + CCTK_REAL Xt3L = Xt3[index]; + + /* Include user supplied include files */ + + /* Precompute derivatives */ + CCTK_REAL const PDupwindNthAnti1alpha = PDupwindNthAnti1(&alpha[index]); + CCTK_REAL const PDupwindNthSymm1alpha = PDupwindNthSymm1(&alpha[index]); + CCTK_REAL const PDupwindNthAnti2alpha = PDupwindNthAnti2(&alpha[index]); + CCTK_REAL const PDupwindNthSymm2alpha = PDupwindNthSymm2(&alpha[index]); + CCTK_REAL const PDupwindNthAnti3alpha = PDupwindNthAnti3(&alpha[index]); + CCTK_REAL const PDupwindNthSymm3alpha = PDupwindNthSymm3(&alpha[index]); + CCTK_REAL const PDupwindNthAnti1beta1 = PDupwindNthAnti1(&beta1[index]); + CCTK_REAL const PDupwindNthSymm1beta1 = PDupwindNthSymm1(&beta1[index]); + CCTK_REAL const PDupwindNthAnti2beta1 = PDupwindNthAnti2(&beta1[index]); + CCTK_REAL const PDupwindNthSymm2beta1 = PDupwindNthSymm2(&beta1[index]); + CCTK_REAL const PDupwindNthAnti3beta1 = PDupwindNthAnti3(&beta1[index]); + CCTK_REAL const PDupwindNthSymm3beta1 = PDupwindNthSymm3(&beta1[index]); + CCTK_REAL const PDupwindNthAnti1beta2 = PDupwindNthAnti1(&beta2[index]); + CCTK_REAL const PDupwindNthSymm1beta2 = PDupwindNthSymm1(&beta2[index]); + CCTK_REAL const PDupwindNthAnti2beta2 = PDupwindNthAnti2(&beta2[index]); + CCTK_REAL const PDupwindNthSymm2beta2 = PDupwindNthSymm2(&beta2[index]); + CCTK_REAL const PDupwindNthAnti3beta2 = PDupwindNthAnti3(&beta2[index]); + CCTK_REAL const PDupwindNthSymm3beta2 = PDupwindNthSymm3(&beta2[index]); + CCTK_REAL const PDupwindNthAnti1beta3 = PDupwindNthAnti1(&beta3[index]); + CCTK_REAL const PDupwindNthSymm1beta3 = PDupwindNthSymm1(&beta3[index]); + CCTK_REAL const PDupwindNthAnti2beta3 = PDupwindNthAnti2(&beta3[index]); + CCTK_REAL const PDupwindNthSymm2beta3 = PDupwindNthSymm2(&beta3[index]); + CCTK_REAL const PDupwindNthAnti3beta3 = PDupwindNthAnti3(&beta3[index]); + CCTK_REAL const PDupwindNthSymm3beta3 = PDupwindNthSymm3(&beta3[index]); + + /* Calculate temporaries and grid functions */ + ptrdiff_t dir1 = Sign(beta1L); + + ptrdiff_t dir2 = Sign(beta2L); + + ptrdiff_t dir3 = Sign(beta3L); + + CCTK_REAL eta = fmin(1,INV(rL)*ToReal(SpatialBetaDriverRadius)); + + CCTK_REAL theta = fmin(1,exp(1 - + rL*INV(ToReal(SpatialShiftGammaCoeffRadius)))); + + CCTK_REAL dtalpL = + -(pow(alphaL,ToReal(harmonicN))*ToReal(harmonicF)*(trKL + (AL - + trKL)*ToReal(LapseACoeff))) + (beta1L*PDupwindNthAnti1alpha + + beta2L*PDupwindNthAnti2alpha + beta3L*PDupwindNthAnti3alpha + + PDupwindNthSymm1alpha*Abs(beta1L) + PDupwindNthSymm2alpha*Abs(beta2L) + + PDupwindNthSymm3alpha*Abs(beta3L))*ToReal(LapseAdvectionCoeff); + + CCTK_REAL dtbetaxL = (beta1L*PDupwindNthAnti1beta1 + + beta2L*PDupwindNthAnti2beta1 + beta3L*PDupwindNthAnti3beta1 + + PDupwindNthSymm1beta1*Abs(beta1L) + PDupwindNthSymm2beta1*Abs(beta2L) + + PDupwindNthSymm3beta1*Abs(beta3L))*ToReal(ShiftAdvectionCoeff) + + theta*(Xt1L + beta1L*eta*ToReal(BetaDriver)*(-1 + ToReal(ShiftBCoeff)) + + (B1L - Xt1L)*ToReal(ShiftBCoeff))*ToReal(ShiftGammaCoeff); + + CCTK_REAL dtbetayL = (beta1L*PDupwindNthAnti1beta2 + + beta2L*PDupwindNthAnti2beta2 + beta3L*PDupwindNthAnti3beta2 + + PDupwindNthSymm1beta2*Abs(beta1L) + PDupwindNthSymm2beta2*Abs(beta2L) + + PDupwindNthSymm3beta2*Abs(beta3L))*ToReal(ShiftAdvectionCoeff) + + theta*(Xt2L + beta2L*eta*ToReal(BetaDriver)*(-1 + ToReal(ShiftBCoeff)) + + (B2L - Xt2L)*ToReal(ShiftBCoeff))*ToReal(ShiftGammaCoeff); + + CCTK_REAL dtbetazL = (beta1L*PDupwindNthAnti1beta3 + + beta2L*PDupwindNthAnti2beta3 + beta3L*PDupwindNthAnti3beta3 + + PDupwindNthSymm1beta3*Abs(beta1L) + PDupwindNthSymm2beta3*Abs(beta2L) + + PDupwindNthSymm3beta3*Abs(beta3L))*ToReal(ShiftAdvectionCoeff) + + theta*(Xt3L + beta3L*eta*ToReal(BetaDriver)*(-1 + ToReal(ShiftBCoeff)) + + (B3L - Xt3L)*ToReal(ShiftBCoeff))*ToReal(ShiftGammaCoeff); + + + /* Copy local copies back to grid functions */ + dtalp[index] = dtalpL; + dtbetax[index] = dtbetaxL; + dtbetay[index] = dtbetayL; + dtbetaz[index] = dtbetazL; + } + LC_ENDLOOP3 (ML_BSSN_O2_convertToADMBaseDtLapseShift); +} + +extern "C" void ML_BSSN_O2_convertToADMBaseDtLapseShift(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverInterior(cctkGH, &ML_BSSN_O2_convertToADMBaseDtLapseShift_Body); +} diff --git a/ML_BSSN_O2/src/ML_BSSN_O2_convertToADMBaseDtLapseShiftBoundary.cc b/ML_BSSN_O2/src/ML_BSSN_O2_convertToADMBaseDtLapseShiftBoundary.cc new file mode 100644 index 0000000..628a2e5 --- /dev/null +++ b/ML_BSSN_O2/src/ML_BSSN_O2_convertToADMBaseDtLapseShiftBoundary.cc @@ -0,0 +1,171 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +extern "C" void ML_BSSN_O2_convertToADMBaseDtLapseShiftBoundary_SelectBCs(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT ierr = 0; + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ADMBase::dtlapse","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ADMBase::dtlapse."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ADMBase::dtshift","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ADMBase::dtshift."); + return; +} + +static void ML_BSSN_O2_convertToADMBaseDtLapseShiftBoundary_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_BSSN_O2_convertToADMBaseDtLapseShiftBoundary_Body"); + } + + if (cctk_iteration % ML_BSSN_O2_convertToADMBaseDtLapseShiftBoundary_calc_every != ML_BSSN_O2_convertToADMBaseDtLapseShiftBoundary_calc_offset) + { + return; + } + + const char *groups[] = {"ADMBase::dtlapse","ADMBase::dtshift","grid::coordinates","Grid::coordinates","ML_BSSN_O2::ML_dtlapse","ML_BSSN_O2::ML_dtshift","ML_BSSN_O2::ML_Gamma","ML_BSSN_O2::ML_lapse","ML_BSSN_O2::ML_shift","ML_BSSN_O2::ML_trace_curv"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_BSSN_O2_convertToADMBaseDtLapseShiftBoundary", 10, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o16dx = 0.0625*INV(dx); + CCTK_REAL const p1o16dy = 0.0625*INV(dy); + CCTK_REAL const p1o16dz = 0.0625*INV(dz); + CCTK_REAL const p1o2dx = 0.5*INV(dx); + CCTK_REAL const p1o2dy = 0.5*INV(dy); + CCTK_REAL const p1o2dz = 0.5*INV(dz); + CCTK_REAL const p1o4dx = 0.25*INV(dx); + CCTK_REAL const p1o4dxdy = 0.25*INV(dx)*INV(dy); + CCTK_REAL const p1o4dxdz = 0.25*INV(dx)*INV(dz); + CCTK_REAL const p1o4dy = 0.25*INV(dy); + CCTK_REAL const p1o4dydz = 0.25*INV(dy)*INV(dz); + CCTK_REAL const p1o4dz = 0.25*INV(dz); + CCTK_REAL const p1odx = INV(dx); + CCTK_REAL const p1odx2 = INV(SQR(dx)); + CCTK_REAL const p1ody = INV(dy); + CCTK_REAL const p1ody2 = INV(SQR(dy)); + CCTK_REAL const p1odz = INV(dz); + CCTK_REAL const p1odz2 = INV(SQR(dz)); + CCTK_REAL const pm1o2dx = -0.5*INV(dx); + CCTK_REAL const pm1o2dy = -0.5*INV(dy); + CCTK_REAL const pm1o2dz = -0.5*INV(dz); + CCTK_REAL const pm1o4dx = -0.25*INV(dx); + CCTK_REAL const pm1o4dy = -0.25*INV(dy); + CCTK_REAL const pm1o4dz = -0.25*INV(dz); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_BSSN_O2_convertToADMBaseDtLapseShiftBoundary, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + CCTK_REAL AL = A[index]; + CCTK_REAL alphaL = alpha[index]; + CCTK_REAL B1L = B1[index]; + CCTK_REAL B2L = B2[index]; + CCTK_REAL B3L = B3[index]; + CCTK_REAL beta1L = beta1[index]; + CCTK_REAL beta2L = beta2[index]; + CCTK_REAL beta3L = beta3[index]; + CCTK_REAL rL = r[index]; + CCTK_REAL trKL = trK[index]; + CCTK_REAL Xt1L = Xt1[index]; + CCTK_REAL Xt2L = Xt2[index]; + CCTK_REAL Xt3L = Xt3[index]; + + /* Include user supplied include files */ + + /* Precompute derivatives */ + + /* Calculate temporaries and grid functions */ + CCTK_REAL eta = fmin(1,INV(rL)*ToReal(SpatialBetaDriverRadius)); + + CCTK_REAL theta = fmin(1,exp(1 - + rL*INV(ToReal(SpatialShiftGammaCoeffRadius)))); + + CCTK_REAL dtalpL = + -(pow(alphaL,ToReal(harmonicN))*ToReal(harmonicF)*(trKL + (AL - + trKL)*ToReal(LapseACoeff))); + + CCTK_REAL dtbetaxL = theta*(Xt1L + beta1L*eta*ToReal(BetaDriver)*(-1 + + ToReal(ShiftBCoeff)) + (B1L - + Xt1L)*ToReal(ShiftBCoeff))*ToReal(ShiftGammaCoeff); + + CCTK_REAL dtbetayL = theta*(Xt2L + beta2L*eta*ToReal(BetaDriver)*(-1 + + ToReal(ShiftBCoeff)) + (B2L - + Xt2L)*ToReal(ShiftBCoeff))*ToReal(ShiftGammaCoeff); + + CCTK_REAL dtbetazL = theta*(Xt3L + beta3L*eta*ToReal(BetaDriver)*(-1 + + ToReal(ShiftBCoeff)) + (B3L - + Xt3L)*ToReal(ShiftBCoeff))*ToReal(ShiftGammaCoeff); + + + /* Copy local copies back to grid functions */ + dtalp[index] = dtalpL; + dtbetax[index] = dtbetaxL; + dtbetay[index] = dtbetayL; + dtbetaz[index] = dtbetazL; + } + LC_ENDLOOP3 (ML_BSSN_O2_convertToADMBaseDtLapseShiftBoundary); +} + +extern "C" void ML_BSSN_O2_convertToADMBaseDtLapseShiftBoundary(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverBoundaryWithGhosts(cctkGH, &ML_BSSN_O2_convertToADMBaseDtLapseShiftBoundary_Body); +} diff --git a/ML_BSSN_O2/src/ML_BSSN_O2_convertToADMBaseFakeDtLapseShift.cc b/ML_BSSN_O2/src/ML_BSSN_O2_convertToADMBaseFakeDtLapseShift.cc new file mode 100644 index 0000000..76faa9b --- /dev/null +++ b/ML_BSSN_O2/src/ML_BSSN_O2_convertToADMBaseFakeDtLapseShift.cc @@ -0,0 +1,156 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +static void ML_BSSN_O2_convertToADMBaseFakeDtLapseShift_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_BSSN_O2_convertToADMBaseFakeDtLapseShift_Body"); + } + + if (cctk_iteration % ML_BSSN_O2_convertToADMBaseFakeDtLapseShift_calc_every != ML_BSSN_O2_convertToADMBaseFakeDtLapseShift_calc_offset) + { + return; + } + + const char *groups[] = {"ADMBase::dtlapse","ADMBase::dtshift","grid::coordinates","Grid::coordinates","ML_BSSN_O2::ML_dtlapse","ML_BSSN_O2::ML_dtshift","ML_BSSN_O2::ML_Gamma","ML_BSSN_O2::ML_lapse","ML_BSSN_O2::ML_shift","ML_BSSN_O2::ML_trace_curv"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_BSSN_O2_convertToADMBaseFakeDtLapseShift", 10, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o16dx = 0.0625*INV(dx); + CCTK_REAL const p1o16dy = 0.0625*INV(dy); + CCTK_REAL const p1o16dz = 0.0625*INV(dz); + CCTK_REAL const p1o2dx = 0.5*INV(dx); + CCTK_REAL const p1o2dy = 0.5*INV(dy); + CCTK_REAL const p1o2dz = 0.5*INV(dz); + CCTK_REAL const p1o4dx = 0.25*INV(dx); + CCTK_REAL const p1o4dxdy = 0.25*INV(dx)*INV(dy); + CCTK_REAL const p1o4dxdz = 0.25*INV(dx)*INV(dz); + CCTK_REAL const p1o4dy = 0.25*INV(dy); + CCTK_REAL const p1o4dydz = 0.25*INV(dy)*INV(dz); + CCTK_REAL const p1o4dz = 0.25*INV(dz); + CCTK_REAL const p1odx = INV(dx); + CCTK_REAL const p1odx2 = INV(SQR(dx)); + CCTK_REAL const p1ody = INV(dy); + CCTK_REAL const p1ody2 = INV(SQR(dy)); + CCTK_REAL const p1odz = INV(dz); + CCTK_REAL const p1odz2 = INV(SQR(dz)); + CCTK_REAL const pm1o2dx = -0.5*INV(dx); + CCTK_REAL const pm1o2dy = -0.5*INV(dy); + CCTK_REAL const pm1o2dz = -0.5*INV(dz); + CCTK_REAL const pm1o4dx = -0.25*INV(dx); + CCTK_REAL const pm1o4dy = -0.25*INV(dy); + CCTK_REAL const pm1o4dz = -0.25*INV(dz); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_BSSN_O2_convertToADMBaseFakeDtLapseShift, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + CCTK_REAL AL = A[index]; + CCTK_REAL alphaL = alpha[index]; + CCTK_REAL B1L = B1[index]; + CCTK_REAL B2L = B2[index]; + CCTK_REAL B3L = B3[index]; + CCTK_REAL beta1L = beta1[index]; + CCTK_REAL beta2L = beta2[index]; + CCTK_REAL beta3L = beta3[index]; + CCTK_REAL rL = r[index]; + CCTK_REAL trKL = trK[index]; + CCTK_REAL Xt1L = Xt1[index]; + CCTK_REAL Xt2L = Xt2[index]; + CCTK_REAL Xt3L = Xt3[index]; + + /* Include user supplied include files */ + + /* Precompute derivatives */ + + /* Calculate temporaries and grid functions */ + CCTK_REAL eta = fmin(1,INV(rL)*ToReal(SpatialBetaDriverRadius)); + + CCTK_REAL theta = fmin(1,exp(1 - + rL*INV(ToReal(SpatialShiftGammaCoeffRadius)))); + + CCTK_REAL dtalpL = + -(pow(alphaL,ToReal(harmonicN))*ToReal(harmonicF)*(trKL + (AL - + trKL)*ToReal(LapseACoeff))); + + CCTK_REAL dtbetaxL = theta*(Xt1L + beta1L*eta*ToReal(BetaDriver)*(-1 + + ToReal(ShiftBCoeff)) + (B1L - + Xt1L)*ToReal(ShiftBCoeff))*ToReal(ShiftGammaCoeff); + + CCTK_REAL dtbetayL = theta*(Xt2L + beta2L*eta*ToReal(BetaDriver)*(-1 + + ToReal(ShiftBCoeff)) + (B2L - + Xt2L)*ToReal(ShiftBCoeff))*ToReal(ShiftGammaCoeff); + + CCTK_REAL dtbetazL = theta*(Xt3L + beta3L*eta*ToReal(BetaDriver)*(-1 + + ToReal(ShiftBCoeff)) + (B3L - + Xt3L)*ToReal(ShiftBCoeff))*ToReal(ShiftGammaCoeff); + + + /* Copy local copies back to grid functions */ + dtalp[index] = dtalpL; + dtbetax[index] = dtbetaxL; + dtbetay[index] = dtbetayL; + dtbetaz[index] = dtbetazL; + } + LC_ENDLOOP3 (ML_BSSN_O2_convertToADMBaseFakeDtLapseShift); +} + +extern "C" void ML_BSSN_O2_convertToADMBaseFakeDtLapseShift(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverEverything(cctkGH, &ML_BSSN_O2_convertToADMBaseFakeDtLapseShift_Body); +} diff --git a/ML_BSSN_O2/src/ML_BSSN_O2_enforce.cc b/ML_BSSN_O2/src/ML_BSSN_O2_enforce.cc new file mode 100644 index 0000000..5e8e548 --- /dev/null +++ b/ML_BSSN_O2/src/ML_BSSN_O2_enforce.cc @@ -0,0 +1,169 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +static void ML_BSSN_O2_enforce_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_BSSN_O2_enforce_Body"); + } + + if (cctk_iteration % ML_BSSN_O2_enforce_calc_every != ML_BSSN_O2_enforce_calc_offset) + { + return; + } + + const char *groups[] = {"ML_BSSN_O2::ML_curv","ML_BSSN_O2::ML_lapse","ML_BSSN_O2::ML_metric"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_BSSN_O2_enforce", 3, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o16dx = 0.0625*INV(dx); + CCTK_REAL const p1o16dy = 0.0625*INV(dy); + CCTK_REAL const p1o16dz = 0.0625*INV(dz); + CCTK_REAL const p1o2dx = 0.5*INV(dx); + CCTK_REAL const p1o2dy = 0.5*INV(dy); + CCTK_REAL const p1o2dz = 0.5*INV(dz); + CCTK_REAL const p1o4dx = 0.25*INV(dx); + CCTK_REAL const p1o4dxdy = 0.25*INV(dx)*INV(dy); + CCTK_REAL const p1o4dxdz = 0.25*INV(dx)*INV(dz); + CCTK_REAL const p1o4dy = 0.25*INV(dy); + CCTK_REAL const p1o4dydz = 0.25*INV(dy)*INV(dz); + CCTK_REAL const p1o4dz = 0.25*INV(dz); + CCTK_REAL const p1odx = INV(dx); + CCTK_REAL const p1odx2 = INV(SQR(dx)); + CCTK_REAL const p1ody = INV(dy); + CCTK_REAL const p1ody2 = INV(SQR(dy)); + CCTK_REAL const p1odz = INV(dz); + CCTK_REAL const p1odz2 = INV(SQR(dz)); + CCTK_REAL const pm1o2dx = -0.5*INV(dx); + CCTK_REAL const pm1o2dy = -0.5*INV(dy); + CCTK_REAL const pm1o2dz = -0.5*INV(dz); + CCTK_REAL const pm1o4dx = -0.25*INV(dx); + CCTK_REAL const pm1o4dy = -0.25*INV(dy); + CCTK_REAL const pm1o4dz = -0.25*INV(dz); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_BSSN_O2_enforce, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + CCTK_REAL alphaL = alpha[index]; + CCTK_REAL At11L = At11[index]; + CCTK_REAL At12L = At12[index]; + CCTK_REAL At13L = At13[index]; + CCTK_REAL At22L = At22[index]; + CCTK_REAL At23L = At23[index]; + CCTK_REAL At33L = At33[index]; + CCTK_REAL gt11L = gt11[index]; + CCTK_REAL gt12L = gt12[index]; + CCTK_REAL gt13L = gt13[index]; + CCTK_REAL gt22L = gt22[index]; + CCTK_REAL gt23L = gt23[index]; + CCTK_REAL gt33L = gt33[index]; + + /* Include user supplied include files */ + + /* Precompute derivatives */ + + /* Calculate temporaries and grid functions */ + CCTK_REAL detgt = 1; + + CCTK_REAL gtu11 = INV(detgt)*(gt22L*gt33L - SQR(gt23L)); + + CCTK_REAL gtu12 = (gt13L*gt23L - gt12L*gt33L)*INV(detgt); + + CCTK_REAL gtu13 = (-(gt13L*gt22L) + gt12L*gt23L)*INV(detgt); + + CCTK_REAL gtu22 = INV(detgt)*(gt11L*gt33L - SQR(gt13L)); + + CCTK_REAL gtu23 = (gt12L*gt13L - gt11L*gt23L)*INV(detgt); + + CCTK_REAL gtu33 = INV(detgt)*(gt11L*gt22L - SQR(gt12L)); + + CCTK_REAL trAt = At11L*gtu11 + At22L*gtu22 + 2*(At12L*gtu12 + + At13L*gtu13 + At23L*gtu23) + At33L*gtu33; + + At11L = At11L - 0.333333333333333333333333333333*gt11L*trAt; + + At12L = At12L - 0.333333333333333333333333333333*gt12L*trAt; + + At13L = At13L - 0.333333333333333333333333333333*gt13L*trAt; + + At22L = At22L - 0.333333333333333333333333333333*gt22L*trAt; + + At23L = At23L - 0.333333333333333333333333333333*gt23L*trAt; + + At33L = At33L - 0.333333333333333333333333333333*gt33L*trAt; + + alphaL = fmax(alphaL,ToReal(MinimumLapse)); + + + /* Copy local copies back to grid functions */ + alpha[index] = alphaL; + At11[index] = At11L; + At12[index] = At12L; + At13[index] = At13L; + At22[index] = At22L; + At23[index] = At23L; + At33[index] = At33L; + } + LC_ENDLOOP3 (ML_BSSN_O2_enforce); +} + +extern "C" void ML_BSSN_O2_enforce(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverEverything(cctkGH, &ML_BSSN_O2_enforce_Body); +} diff --git a/ML_BSSN_O2/src/RegisterMoL.cc b/ML_BSSN_O2/src/RegisterMoL.cc new file mode 100644 index 0000000..2047965 --- /dev/null +++ b/ML_BSSN_O2/src/RegisterMoL.cc @@ -0,0 +1,41 @@ +/* File produced by Kranc */ + +#include "cctk.h" +#include "cctk_Arguments.h" +#include "cctk_Parameters.h" + +extern "C" void ML_BSSN_O2_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_BSSN_O2::At11"), CCTK_VarIndex("ML_BSSN_O2::At11rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_O2::At12"), CCTK_VarIndex("ML_BSSN_O2::At12rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_O2::At13"), CCTK_VarIndex("ML_BSSN_O2::At13rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_O2::At22"), CCTK_VarIndex("ML_BSSN_O2::At22rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_O2::At23"), CCTK_VarIndex("ML_BSSN_O2::At23rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_O2::At33"), CCTK_VarIndex("ML_BSSN_O2::At33rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_O2::A"), CCTK_VarIndex("ML_BSSN_O2::Arhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_O2::B1"), CCTK_VarIndex("ML_BSSN_O2::B1rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_O2::B2"), CCTK_VarIndex("ML_BSSN_O2::B2rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_O2::B3"), CCTK_VarIndex("ML_BSSN_O2::B3rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_O2::Xt1"), CCTK_VarIndex("ML_BSSN_O2::Xt1rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_O2::Xt2"), CCTK_VarIndex("ML_BSSN_O2::Xt2rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_O2::Xt3"), CCTK_VarIndex("ML_BSSN_O2::Xt3rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_O2::alpha"), CCTK_VarIndex("ML_BSSN_O2::alpharhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_O2::phi"), CCTK_VarIndex("ML_BSSN_O2::phirhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_O2::gt11"), CCTK_VarIndex("ML_BSSN_O2::gt11rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_O2::gt12"), CCTK_VarIndex("ML_BSSN_O2::gt12rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_O2::gt13"), CCTK_VarIndex("ML_BSSN_O2::gt13rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_O2::gt22"), CCTK_VarIndex("ML_BSSN_O2::gt22rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_O2::gt23"), CCTK_VarIndex("ML_BSSN_O2::gt23rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_O2::gt33"), CCTK_VarIndex("ML_BSSN_O2::gt33rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_O2::beta1"), CCTK_VarIndex("ML_BSSN_O2::beta1rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_O2::beta2"), CCTK_VarIndex("ML_BSSN_O2::beta2rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_O2::beta3"), CCTK_VarIndex("ML_BSSN_O2::beta3rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_O2::trK"), CCTK_VarIndex("ML_BSSN_O2::trKrhs")); + return; +} diff --git a/ML_BSSN_O2/src/RegisterSymmetries.cc b/ML_BSSN_O2/src/RegisterSymmetries.cc new file mode 100644 index 0000000..610032d --- /dev/null +++ b/ML_BSSN_O2/src/RegisterSymmetries.cc @@ -0,0 +1,189 @@ +/* File produced by Kranc */ + +#include "cctk.h" +#include "cctk_Arguments.h" +#include "cctk_Parameters.h" +#include "Symmetry.h" + +extern "C" void ML_BSSN_O2_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_BSSN_O2::At11"); + + sym[0] = -1; + sym[1] = -1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_O2::At12"); + + sym[0] = -1; + sym[1] = 1; + sym[2] = -1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_O2::At13"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_O2::At22"); + + sym[0] = 1; + sym[1] = -1; + sym[2] = -1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_O2::At23"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_O2::At33"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_O2::A"); + + sym[0] = -1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_O2::B1"); + + sym[0] = 1; + sym[1] = -1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_O2::B2"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = -1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_O2::B3"); + + sym[0] = -1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_O2::Xt1"); + + sym[0] = 1; + sym[1] = -1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_O2::Xt2"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = -1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_O2::Xt3"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_O2::alpha"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_O2::phi"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_O2::gt11"); + + sym[0] = -1; + sym[1] = -1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_O2::gt12"); + + sym[0] = -1; + sym[1] = 1; + sym[2] = -1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_O2::gt13"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_O2::gt22"); + + sym[0] = 1; + sym[1] = -1; + sym[2] = -1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_O2::gt23"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_O2::gt33"); + + sym[0] = -1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_O2::beta1"); + + sym[0] = 1; + sym[1] = -1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_O2::beta2"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = -1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_O2::beta3"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_O2::trK"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_O2::cS"); + + sym[0] = -1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_O2::cXt1"); + + sym[0] = 1; + sym[1] = -1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_O2::cXt2"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = -1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_O2::cXt3"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_O2::cA"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_O2::H"); + + sym[0] = -1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_O2::M1"); + + sym[0] = 1; + sym[1] = -1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_O2::M2"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = -1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_O2::M3"); + +} diff --git a/ML_BSSN_O2/src/Startup.cc b/ML_BSSN_O2/src/Startup.cc new file mode 100644 index 0000000..1cb1099 --- /dev/null +++ b/ML_BSSN_O2/src/Startup.cc @@ -0,0 +1,10 @@ +/* File produced by Kranc */ + +#include "cctk.h" + +extern "C" int ML_BSSN_O2_Startup(void) +{ + const char * banner = "ML_BSSN_O2"; + CCTK_RegisterBanner(banner); + return 0; +} diff --git a/ML_BSSN_O8/src/Boundaries.cc b/ML_BSSN_O8/src/Boundaries.cc new file mode 100644 index 0000000..b3a2177 --- /dev/null +++ b/ML_BSSN_O8/src/Boundaries.cc @@ -0,0 +1,1809 @@ +/* File produced by Kranc */ + +#include "cctk.h" +#include "cctk_Arguments.h" +#include "cctk_Parameters.h" +#include "cctk_Faces.h" +#include "util_Table.h" +#include "Symmetry.h" + + +/* the boundary treatment is split into 3 steps: */ +/* 1. excision */ +/* 2. symmetries */ +/* 3. "other" boundary conditions, e.g. radiative */ + +/* to simplify scheduling and testing, the 3 steps */ +/* are currently applied in separate functions */ + + +extern "C" void ML_BSSN_O8_CheckBoundaries(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + return; +} + +extern "C" void ML_BSSN_O8_SelectBoundConds(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT ierr = 0; + + if (CCTK_EQUALS(ML_curv_bound, "none" ) || + CCTK_EQUALS(ML_curv_bound, "static") || + CCTK_EQUALS(ML_curv_bound, "flat" ) || + CCTK_EQUALS(ML_curv_bound, "zero" ) ) + { + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_O8::ML_curv", ML_curv_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register ML_curv_bound BC for ML_BSSN_O8::ML_curv!"); + } + + if (CCTK_EQUALS(ML_dtlapse_bound, "none" ) || + CCTK_EQUALS(ML_dtlapse_bound, "static") || + CCTK_EQUALS(ML_dtlapse_bound, "flat" ) || + CCTK_EQUALS(ML_dtlapse_bound, "zero" ) ) + { + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_O8::ML_dtlapse", ML_dtlapse_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register ML_dtlapse_bound BC for ML_BSSN_O8::ML_dtlapse!"); + } + + if (CCTK_EQUALS(ML_dtshift_bound, "none" ) || + CCTK_EQUALS(ML_dtshift_bound, "static") || + CCTK_EQUALS(ML_dtshift_bound, "flat" ) || + CCTK_EQUALS(ML_dtshift_bound, "zero" ) ) + { + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_O8::ML_dtshift", ML_dtshift_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register ML_dtshift_bound BC for ML_BSSN_O8::ML_dtshift!"); + } + + if (CCTK_EQUALS(ML_Gamma_bound, "none" ) || + CCTK_EQUALS(ML_Gamma_bound, "static") || + CCTK_EQUALS(ML_Gamma_bound, "flat" ) || + CCTK_EQUALS(ML_Gamma_bound, "zero" ) ) + { + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_O8::ML_Gamma", ML_Gamma_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register ML_Gamma_bound BC for ML_BSSN_O8::ML_Gamma!"); + } + + if (CCTK_EQUALS(ML_lapse_bound, "none" ) || + CCTK_EQUALS(ML_lapse_bound, "static") || + CCTK_EQUALS(ML_lapse_bound, "flat" ) || + CCTK_EQUALS(ML_lapse_bound, "zero" ) ) + { + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_O8::ML_lapse", ML_lapse_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register ML_lapse_bound BC for ML_BSSN_O8::ML_lapse!"); + } + + if (CCTK_EQUALS(ML_log_confac_bound, "none" ) || + CCTK_EQUALS(ML_log_confac_bound, "static") || + CCTK_EQUALS(ML_log_confac_bound, "flat" ) || + CCTK_EQUALS(ML_log_confac_bound, "zero" ) ) + { + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_O8::ML_log_confac", ML_log_confac_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register ML_log_confac_bound BC for ML_BSSN_O8::ML_log_confac!"); + } + + if (CCTK_EQUALS(ML_metric_bound, "none" ) || + CCTK_EQUALS(ML_metric_bound, "static") || + CCTK_EQUALS(ML_metric_bound, "flat" ) || + CCTK_EQUALS(ML_metric_bound, "zero" ) ) + { + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_O8::ML_metric", ML_metric_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register ML_metric_bound BC for ML_BSSN_O8::ML_metric!"); + } + + if (CCTK_EQUALS(ML_shift_bound, "none" ) || + CCTK_EQUALS(ML_shift_bound, "static") || + CCTK_EQUALS(ML_shift_bound, "flat" ) || + CCTK_EQUALS(ML_shift_bound, "zero" ) ) + { + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_O8::ML_shift", ML_shift_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register ML_shift_bound BC for ML_BSSN_O8::ML_shift!"); + } + + if (CCTK_EQUALS(ML_trace_curv_bound, "none" ) || + CCTK_EQUALS(ML_trace_curv_bound, "static") || + CCTK_EQUALS(ML_trace_curv_bound, "flat" ) || + CCTK_EQUALS(ML_trace_curv_bound, "zero" ) ) + { + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_O8::ML_trace_curv", ML_trace_curv_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register ML_trace_curv_bound BC for ML_BSSN_O8::ML_trace_curv!"); + } + + if (CCTK_EQUALS(At11_bound, "none" ) || + CCTK_EQUALS(At11_bound, "static") || + CCTK_EQUALS(At11_bound, "flat" ) || + CCTK_EQUALS(At11_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_O8::At11", At11_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register At11_bound BC for ML_BSSN_O8::At11!"); + } + + if (CCTK_EQUALS(At12_bound, "none" ) || + CCTK_EQUALS(At12_bound, "static") || + CCTK_EQUALS(At12_bound, "flat" ) || + CCTK_EQUALS(At12_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_O8::At12", At12_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register At12_bound BC for ML_BSSN_O8::At12!"); + } + + if (CCTK_EQUALS(At13_bound, "none" ) || + CCTK_EQUALS(At13_bound, "static") || + CCTK_EQUALS(At13_bound, "flat" ) || + CCTK_EQUALS(At13_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_O8::At13", At13_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register At13_bound BC for ML_BSSN_O8::At13!"); + } + + if (CCTK_EQUALS(At22_bound, "none" ) || + CCTK_EQUALS(At22_bound, "static") || + CCTK_EQUALS(At22_bound, "flat" ) || + CCTK_EQUALS(At22_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_O8::At22", At22_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register At22_bound BC for ML_BSSN_O8::At22!"); + } + + if (CCTK_EQUALS(At23_bound, "none" ) || + CCTK_EQUALS(At23_bound, "static") || + CCTK_EQUALS(At23_bound, "flat" ) || + CCTK_EQUALS(At23_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_O8::At23", At23_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register At23_bound BC for ML_BSSN_O8::At23!"); + } + + if (CCTK_EQUALS(At33_bound, "none" ) || + CCTK_EQUALS(At33_bound, "static") || + CCTK_EQUALS(At33_bound, "flat" ) || + CCTK_EQUALS(At33_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_O8::At33", At33_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register At33_bound BC for ML_BSSN_O8::At33!"); + } + + if (CCTK_EQUALS(A_bound, "none" ) || + CCTK_EQUALS(A_bound, "static") || + CCTK_EQUALS(A_bound, "flat" ) || + CCTK_EQUALS(A_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_O8::A", A_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register A_bound BC for ML_BSSN_O8::A!"); + } + + if (CCTK_EQUALS(B1_bound, "none" ) || + CCTK_EQUALS(B1_bound, "static") || + CCTK_EQUALS(B1_bound, "flat" ) || + CCTK_EQUALS(B1_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_O8::B1", B1_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register B1_bound BC for ML_BSSN_O8::B1!"); + } + + if (CCTK_EQUALS(B2_bound, "none" ) || + CCTK_EQUALS(B2_bound, "static") || + CCTK_EQUALS(B2_bound, "flat" ) || + CCTK_EQUALS(B2_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_O8::B2", B2_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register B2_bound BC for ML_BSSN_O8::B2!"); + } + + if (CCTK_EQUALS(B3_bound, "none" ) || + CCTK_EQUALS(B3_bound, "static") || + CCTK_EQUALS(B3_bound, "flat" ) || + CCTK_EQUALS(B3_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_O8::B3", B3_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register B3_bound BC for ML_BSSN_O8::B3!"); + } + + if (CCTK_EQUALS(Xt1_bound, "none" ) || + CCTK_EQUALS(Xt1_bound, "static") || + CCTK_EQUALS(Xt1_bound, "flat" ) || + CCTK_EQUALS(Xt1_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_O8::Xt1", Xt1_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register Xt1_bound BC for ML_BSSN_O8::Xt1!"); + } + + if (CCTK_EQUALS(Xt2_bound, "none" ) || + CCTK_EQUALS(Xt2_bound, "static") || + CCTK_EQUALS(Xt2_bound, "flat" ) || + CCTK_EQUALS(Xt2_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_O8::Xt2", Xt2_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register Xt2_bound BC for ML_BSSN_O8::Xt2!"); + } + + if (CCTK_EQUALS(Xt3_bound, "none" ) || + CCTK_EQUALS(Xt3_bound, "static") || + CCTK_EQUALS(Xt3_bound, "flat" ) || + CCTK_EQUALS(Xt3_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_O8::Xt3", Xt3_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register Xt3_bound BC for ML_BSSN_O8::Xt3!"); + } + + if (CCTK_EQUALS(alpha_bound, "none" ) || + CCTK_EQUALS(alpha_bound, "static") || + CCTK_EQUALS(alpha_bound, "flat" ) || + CCTK_EQUALS(alpha_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_O8::alpha", alpha_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register alpha_bound BC for ML_BSSN_O8::alpha!"); + } + + if (CCTK_EQUALS(phi_bound, "none" ) || + CCTK_EQUALS(phi_bound, "static") || + CCTK_EQUALS(phi_bound, "flat" ) || + CCTK_EQUALS(phi_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_O8::phi", phi_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register phi_bound BC for ML_BSSN_O8::phi!"); + } + + if (CCTK_EQUALS(gt11_bound, "none" ) || + CCTK_EQUALS(gt11_bound, "static") || + CCTK_EQUALS(gt11_bound, "flat" ) || + CCTK_EQUALS(gt11_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_O8::gt11", gt11_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register gt11_bound BC for ML_BSSN_O8::gt11!"); + } + + if (CCTK_EQUALS(gt12_bound, "none" ) || + CCTK_EQUALS(gt12_bound, "static") || + CCTK_EQUALS(gt12_bound, "flat" ) || + CCTK_EQUALS(gt12_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_O8::gt12", gt12_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register gt12_bound BC for ML_BSSN_O8::gt12!"); + } + + if (CCTK_EQUALS(gt13_bound, "none" ) || + CCTK_EQUALS(gt13_bound, "static") || + CCTK_EQUALS(gt13_bound, "flat" ) || + CCTK_EQUALS(gt13_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_O8::gt13", gt13_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register gt13_bound BC for ML_BSSN_O8::gt13!"); + } + + if (CCTK_EQUALS(gt22_bound, "none" ) || + CCTK_EQUALS(gt22_bound, "static") || + CCTK_EQUALS(gt22_bound, "flat" ) || + CCTK_EQUALS(gt22_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_O8::gt22", gt22_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register gt22_bound BC for ML_BSSN_O8::gt22!"); + } + + if (CCTK_EQUALS(gt23_bound, "none" ) || + CCTK_EQUALS(gt23_bound, "static") || + CCTK_EQUALS(gt23_bound, "flat" ) || + CCTK_EQUALS(gt23_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_O8::gt23", gt23_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register gt23_bound BC for ML_BSSN_O8::gt23!"); + } + + if (CCTK_EQUALS(gt33_bound, "none" ) || + CCTK_EQUALS(gt33_bound, "static") || + CCTK_EQUALS(gt33_bound, "flat" ) || + CCTK_EQUALS(gt33_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_O8::gt33", gt33_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register gt33_bound BC for ML_BSSN_O8::gt33!"); + } + + if (CCTK_EQUALS(beta1_bound, "none" ) || + CCTK_EQUALS(beta1_bound, "static") || + CCTK_EQUALS(beta1_bound, "flat" ) || + CCTK_EQUALS(beta1_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_O8::beta1", beta1_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register beta1_bound BC for ML_BSSN_O8::beta1!"); + } + + if (CCTK_EQUALS(beta2_bound, "none" ) || + CCTK_EQUALS(beta2_bound, "static") || + CCTK_EQUALS(beta2_bound, "flat" ) || + CCTK_EQUALS(beta2_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_O8::beta2", beta2_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register beta2_bound BC for ML_BSSN_O8::beta2!"); + } + + if (CCTK_EQUALS(beta3_bound, "none" ) || + CCTK_EQUALS(beta3_bound, "static") || + CCTK_EQUALS(beta3_bound, "flat" ) || + CCTK_EQUALS(beta3_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_O8::beta3", beta3_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register beta3_bound BC for ML_BSSN_O8::beta3!"); + } + + if (CCTK_EQUALS(trK_bound, "none" ) || + CCTK_EQUALS(trK_bound, "static") || + CCTK_EQUALS(trK_bound, "flat" ) || + CCTK_EQUALS(trK_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_O8::trK", trK_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register trK_bound BC for ML_BSSN_O8::trK!"); + } + + if (CCTK_EQUALS(ML_curv_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_ML_curv_bound = -1; + if (handle_ML_curv_bound < 0) handle_ML_curv_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_curv_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_curv_bound , ML_curv_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_ML_curv_bound ,ML_curv_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_curv_bound, + "ML_BSSN_O8::ML_curv", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_O8::ML_curv!"); + + } + + if (CCTK_EQUALS(ML_dtlapse_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_ML_dtlapse_bound = -1; + if (handle_ML_dtlapse_bound < 0) handle_ML_dtlapse_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_dtlapse_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_dtlapse_bound , ML_dtlapse_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_ML_dtlapse_bound ,ML_dtlapse_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_dtlapse_bound, + "ML_BSSN_O8::ML_dtlapse", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_O8::ML_dtlapse!"); + + } + + if (CCTK_EQUALS(ML_dtshift_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_ML_dtshift_bound = -1; + if (handle_ML_dtshift_bound < 0) handle_ML_dtshift_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_dtshift_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_dtshift_bound , ML_dtshift_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_ML_dtshift_bound ,ML_dtshift_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_dtshift_bound, + "ML_BSSN_O8::ML_dtshift", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_O8::ML_dtshift!"); + + } + + if (CCTK_EQUALS(ML_Gamma_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_ML_Gamma_bound = -1; + if (handle_ML_Gamma_bound < 0) handle_ML_Gamma_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_Gamma_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_Gamma_bound , ML_Gamma_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_ML_Gamma_bound ,ML_Gamma_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_Gamma_bound, + "ML_BSSN_O8::ML_Gamma", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_O8::ML_Gamma!"); + + } + + if (CCTK_EQUALS(ML_lapse_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_ML_lapse_bound = -1; + if (handle_ML_lapse_bound < 0) handle_ML_lapse_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_lapse_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_lapse_bound , ML_lapse_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_ML_lapse_bound ,ML_lapse_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_lapse_bound, + "ML_BSSN_O8::ML_lapse", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_O8::ML_lapse!"); + + } + + if (CCTK_EQUALS(ML_log_confac_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_ML_log_confac_bound = -1; + if (handle_ML_log_confac_bound < 0) handle_ML_log_confac_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_log_confac_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_log_confac_bound , ML_log_confac_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_ML_log_confac_bound ,ML_log_confac_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_log_confac_bound, + "ML_BSSN_O8::ML_log_confac", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_O8::ML_log_confac!"); + + } + + if (CCTK_EQUALS(ML_metric_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_ML_metric_bound = -1; + if (handle_ML_metric_bound < 0) handle_ML_metric_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_metric_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_metric_bound , ML_metric_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_ML_metric_bound ,ML_metric_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_metric_bound, + "ML_BSSN_O8::ML_metric", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_O8::ML_metric!"); + + } + + if (CCTK_EQUALS(ML_shift_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_ML_shift_bound = -1; + if (handle_ML_shift_bound < 0) handle_ML_shift_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_shift_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_shift_bound , ML_shift_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_ML_shift_bound ,ML_shift_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_shift_bound, + "ML_BSSN_O8::ML_shift", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_O8::ML_shift!"); + + } + + if (CCTK_EQUALS(ML_trace_curv_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_ML_trace_curv_bound = -1; + if (handle_ML_trace_curv_bound < 0) handle_ML_trace_curv_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_trace_curv_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_trace_curv_bound , ML_trace_curv_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_ML_trace_curv_bound ,ML_trace_curv_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_trace_curv_bound, + "ML_BSSN_O8::ML_trace_curv", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_O8::ML_trace_curv!"); + + } + + if (CCTK_EQUALS(At11_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_At11_bound = -1; + if (handle_At11_bound < 0) handle_At11_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_At11_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_At11_bound , At11_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_At11_bound ,At11_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_At11_bound, + "ML_BSSN_O8::At11", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_O8::At11!"); + + } + + if (CCTK_EQUALS(At12_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_At12_bound = -1; + if (handle_At12_bound < 0) handle_At12_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_At12_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_At12_bound , At12_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_At12_bound ,At12_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_At12_bound, + "ML_BSSN_O8::At12", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_O8::At12!"); + + } + + if (CCTK_EQUALS(At13_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_At13_bound = -1; + if (handle_At13_bound < 0) handle_At13_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_At13_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_At13_bound , At13_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_At13_bound ,At13_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_At13_bound, + "ML_BSSN_O8::At13", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_O8::At13!"); + + } + + if (CCTK_EQUALS(At22_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_At22_bound = -1; + if (handle_At22_bound < 0) handle_At22_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_At22_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_At22_bound , At22_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_At22_bound ,At22_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_At22_bound, + "ML_BSSN_O8::At22", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_O8::At22!"); + + } + + if (CCTK_EQUALS(At23_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_At23_bound = -1; + if (handle_At23_bound < 0) handle_At23_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_At23_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_At23_bound , At23_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_At23_bound ,At23_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_At23_bound, + "ML_BSSN_O8::At23", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_O8::At23!"); + + } + + if (CCTK_EQUALS(At33_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_At33_bound = -1; + if (handle_At33_bound < 0) handle_At33_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_At33_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_At33_bound , At33_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_At33_bound ,At33_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_At33_bound, + "ML_BSSN_O8::At33", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_O8::At33!"); + + } + + if (CCTK_EQUALS(A_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_A_bound = -1; + if (handle_A_bound < 0) handle_A_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_A_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_A_bound , A_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_A_bound ,A_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_A_bound, + "ML_BSSN_O8::A", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_O8::A!"); + + } + + if (CCTK_EQUALS(B1_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_B1_bound = -1; + if (handle_B1_bound < 0) handle_B1_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_B1_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_B1_bound , B1_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_B1_bound ,B1_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_B1_bound, + "ML_BSSN_O8::B1", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_O8::B1!"); + + } + + if (CCTK_EQUALS(B2_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_B2_bound = -1; + if (handle_B2_bound < 0) handle_B2_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_B2_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_B2_bound , B2_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_B2_bound ,B2_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_B2_bound, + "ML_BSSN_O8::B2", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_O8::B2!"); + + } + + if (CCTK_EQUALS(B3_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_B3_bound = -1; + if (handle_B3_bound < 0) handle_B3_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_B3_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_B3_bound , B3_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_B3_bound ,B3_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_B3_bound, + "ML_BSSN_O8::B3", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_O8::B3!"); + + } + + if (CCTK_EQUALS(Xt1_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_Xt1_bound = -1; + if (handle_Xt1_bound < 0) handle_Xt1_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_Xt1_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_Xt1_bound , Xt1_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_Xt1_bound ,Xt1_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_Xt1_bound, + "ML_BSSN_O8::Xt1", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_O8::Xt1!"); + + } + + if (CCTK_EQUALS(Xt2_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_Xt2_bound = -1; + if (handle_Xt2_bound < 0) handle_Xt2_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_Xt2_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_Xt2_bound , Xt2_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_Xt2_bound ,Xt2_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_Xt2_bound, + "ML_BSSN_O8::Xt2", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_O8::Xt2!"); + + } + + if (CCTK_EQUALS(Xt3_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_Xt3_bound = -1; + if (handle_Xt3_bound < 0) handle_Xt3_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_Xt3_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_Xt3_bound , Xt3_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_Xt3_bound ,Xt3_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_Xt3_bound, + "ML_BSSN_O8::Xt3", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_O8::Xt3!"); + + } + + if (CCTK_EQUALS(alpha_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_alpha_bound = -1; + if (handle_alpha_bound < 0) handle_alpha_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_alpha_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_alpha_bound , alpha_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_alpha_bound ,alpha_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_alpha_bound, + "ML_BSSN_O8::alpha", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_O8::alpha!"); + + } + + if (CCTK_EQUALS(phi_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_phi_bound = -1; + if (handle_phi_bound < 0) handle_phi_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_phi_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_phi_bound , phi_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_phi_bound ,phi_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_phi_bound, + "ML_BSSN_O8::phi", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_O8::phi!"); + + } + + if (CCTK_EQUALS(gt11_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_gt11_bound = -1; + if (handle_gt11_bound < 0) handle_gt11_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_gt11_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_gt11_bound , gt11_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_gt11_bound ,gt11_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_gt11_bound, + "ML_BSSN_O8::gt11", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_O8::gt11!"); + + } + + if (CCTK_EQUALS(gt12_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_gt12_bound = -1; + if (handle_gt12_bound < 0) handle_gt12_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_gt12_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_gt12_bound , gt12_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_gt12_bound ,gt12_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_gt12_bound, + "ML_BSSN_O8::gt12", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_O8::gt12!"); + + } + + if (CCTK_EQUALS(gt13_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_gt13_bound = -1; + if (handle_gt13_bound < 0) handle_gt13_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_gt13_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_gt13_bound , gt13_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_gt13_bound ,gt13_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_gt13_bound, + "ML_BSSN_O8::gt13", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_O8::gt13!"); + + } + + if (CCTK_EQUALS(gt22_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_gt22_bound = -1; + if (handle_gt22_bound < 0) handle_gt22_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_gt22_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_gt22_bound , gt22_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_gt22_bound ,gt22_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_gt22_bound, + "ML_BSSN_O8::gt22", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_O8::gt22!"); + + } + + if (CCTK_EQUALS(gt23_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_gt23_bound = -1; + if (handle_gt23_bound < 0) handle_gt23_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_gt23_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_gt23_bound , gt23_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_gt23_bound ,gt23_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_gt23_bound, + "ML_BSSN_O8::gt23", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_O8::gt23!"); + + } + + if (CCTK_EQUALS(gt33_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_gt33_bound = -1; + if (handle_gt33_bound < 0) handle_gt33_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_gt33_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_gt33_bound , gt33_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_gt33_bound ,gt33_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_gt33_bound, + "ML_BSSN_O8::gt33", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_O8::gt33!"); + + } + + if (CCTK_EQUALS(beta1_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_beta1_bound = -1; + if (handle_beta1_bound < 0) handle_beta1_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_beta1_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_beta1_bound , beta1_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_beta1_bound ,beta1_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_beta1_bound, + "ML_BSSN_O8::beta1", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_O8::beta1!"); + + } + + if (CCTK_EQUALS(beta2_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_beta2_bound = -1; + if (handle_beta2_bound < 0) handle_beta2_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_beta2_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_beta2_bound , beta2_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_beta2_bound ,beta2_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_beta2_bound, + "ML_BSSN_O8::beta2", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_O8::beta2!"); + + } + + if (CCTK_EQUALS(beta3_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_beta3_bound = -1; + if (handle_beta3_bound < 0) handle_beta3_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_beta3_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_beta3_bound , beta3_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_beta3_bound ,beta3_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_beta3_bound, + "ML_BSSN_O8::beta3", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_O8::beta3!"); + + } + + if (CCTK_EQUALS(trK_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_trK_bound = -1; + if (handle_trK_bound < 0) handle_trK_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_trK_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_trK_bound , trK_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_trK_bound ,trK_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_trK_bound, + "ML_BSSN_O8::trK", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_O8::trK!"); + + } + + if (CCTK_EQUALS(ML_curv_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_ML_curv_bound = -1; + if (handle_ML_curv_bound < 0) handle_ML_curv_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_curv_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_curv_bound ,ML_curv_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_curv_bound, + "ML_BSSN_O8::ML_curv", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Scalar BC for ML_BSSN_O8::ML_curv!"); + + } + + if (CCTK_EQUALS(ML_dtlapse_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_ML_dtlapse_bound = -1; + if (handle_ML_dtlapse_bound < 0) handle_ML_dtlapse_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_dtlapse_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_dtlapse_bound ,ML_dtlapse_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_dtlapse_bound, + "ML_BSSN_O8::ML_dtlapse", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Scalar BC for ML_BSSN_O8::ML_dtlapse!"); + + } + + if (CCTK_EQUALS(ML_dtshift_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_ML_dtshift_bound = -1; + if (handle_ML_dtshift_bound < 0) handle_ML_dtshift_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_dtshift_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_dtshift_bound ,ML_dtshift_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_dtshift_bound, + "ML_BSSN_O8::ML_dtshift", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Scalar BC for ML_BSSN_O8::ML_dtshift!"); + + } + + if (CCTK_EQUALS(ML_Gamma_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_ML_Gamma_bound = -1; + if (handle_ML_Gamma_bound < 0) handle_ML_Gamma_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_Gamma_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_Gamma_bound ,ML_Gamma_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_Gamma_bound, + "ML_BSSN_O8::ML_Gamma", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Scalar BC for ML_BSSN_O8::ML_Gamma!"); + + } + + if (CCTK_EQUALS(ML_lapse_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_ML_lapse_bound = -1; + if (handle_ML_lapse_bound < 0) handle_ML_lapse_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_lapse_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_lapse_bound ,ML_lapse_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_lapse_bound, + "ML_BSSN_O8::ML_lapse", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Scalar BC for ML_BSSN_O8::ML_lapse!"); + + } + + if (CCTK_EQUALS(ML_log_confac_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_ML_log_confac_bound = -1; + if (handle_ML_log_confac_bound < 0) handle_ML_log_confac_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_log_confac_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_log_confac_bound ,ML_log_confac_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_log_confac_bound, + "ML_BSSN_O8::ML_log_confac", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Scalar BC for ML_BSSN_O8::ML_log_confac!"); + + } + + if (CCTK_EQUALS(ML_metric_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_ML_metric_bound = -1; + if (handle_ML_metric_bound < 0) handle_ML_metric_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_metric_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_metric_bound ,ML_metric_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_metric_bound, + "ML_BSSN_O8::ML_metric", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Scalar BC for ML_BSSN_O8::ML_metric!"); + + } + + if (CCTK_EQUALS(ML_shift_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_ML_shift_bound = -1; + if (handle_ML_shift_bound < 0) handle_ML_shift_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_shift_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_shift_bound ,ML_shift_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_shift_bound, + "ML_BSSN_O8::ML_shift", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Scalar BC for ML_BSSN_O8::ML_shift!"); + + } + + if (CCTK_EQUALS(ML_trace_curv_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_ML_trace_curv_bound = -1; + if (handle_ML_trace_curv_bound < 0) handle_ML_trace_curv_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_trace_curv_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_trace_curv_bound ,ML_trace_curv_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_trace_curv_bound, + "ML_BSSN_O8::ML_trace_curv", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Scalar BC for ML_BSSN_O8::ML_trace_curv!"); + + } + + if (CCTK_EQUALS(At11_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_At11_bound = -1; + if (handle_At11_bound < 0) handle_At11_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_At11_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_At11_bound ,At11_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_At11_bound, + "ML_BSSN_O8::At11", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_O8::At11!"); + + } + + if (CCTK_EQUALS(At12_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_At12_bound = -1; + if (handle_At12_bound < 0) handle_At12_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_At12_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_At12_bound ,At12_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_At12_bound, + "ML_BSSN_O8::At12", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_O8::At12!"); + + } + + if (CCTK_EQUALS(At13_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_At13_bound = -1; + if (handle_At13_bound < 0) handle_At13_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_At13_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_At13_bound ,At13_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_At13_bound, + "ML_BSSN_O8::At13", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_O8::At13!"); + + } + + if (CCTK_EQUALS(At22_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_At22_bound = -1; + if (handle_At22_bound < 0) handle_At22_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_At22_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_At22_bound ,At22_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_At22_bound, + "ML_BSSN_O8::At22", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_O8::At22!"); + + } + + if (CCTK_EQUALS(At23_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_At23_bound = -1; + if (handle_At23_bound < 0) handle_At23_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_At23_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_At23_bound ,At23_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_At23_bound, + "ML_BSSN_O8::At23", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_O8::At23!"); + + } + + if (CCTK_EQUALS(At33_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_At33_bound = -1; + if (handle_At33_bound < 0) handle_At33_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_At33_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_At33_bound ,At33_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_At33_bound, + "ML_BSSN_O8::At33", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_O8::At33!"); + + } + + if (CCTK_EQUALS(A_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_A_bound = -1; + if (handle_A_bound < 0) handle_A_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_A_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_A_bound ,A_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_A_bound, + "ML_BSSN_O8::A", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_O8::A!"); + + } + + if (CCTK_EQUALS(B1_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_B1_bound = -1; + if (handle_B1_bound < 0) handle_B1_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_B1_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_B1_bound ,B1_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_B1_bound, + "ML_BSSN_O8::B1", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_O8::B1!"); + + } + + if (CCTK_EQUALS(B2_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_B2_bound = -1; + if (handle_B2_bound < 0) handle_B2_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_B2_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_B2_bound ,B2_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_B2_bound, + "ML_BSSN_O8::B2", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_O8::B2!"); + + } + + if (CCTK_EQUALS(B3_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_B3_bound = -1; + if (handle_B3_bound < 0) handle_B3_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_B3_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_B3_bound ,B3_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_B3_bound, + "ML_BSSN_O8::B3", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_O8::B3!"); + + } + + if (CCTK_EQUALS(Xt1_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_Xt1_bound = -1; + if (handle_Xt1_bound < 0) handle_Xt1_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_Xt1_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_Xt1_bound ,Xt1_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_Xt1_bound, + "ML_BSSN_O8::Xt1", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_O8::Xt1!"); + + } + + if (CCTK_EQUALS(Xt2_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_Xt2_bound = -1; + if (handle_Xt2_bound < 0) handle_Xt2_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_Xt2_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_Xt2_bound ,Xt2_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_Xt2_bound, + "ML_BSSN_O8::Xt2", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_O8::Xt2!"); + + } + + if (CCTK_EQUALS(Xt3_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_Xt3_bound = -1; + if (handle_Xt3_bound < 0) handle_Xt3_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_Xt3_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_Xt3_bound ,Xt3_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_Xt3_bound, + "ML_BSSN_O8::Xt3", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_O8::Xt3!"); + + } + + if (CCTK_EQUALS(alpha_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_alpha_bound = -1; + if (handle_alpha_bound < 0) handle_alpha_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_alpha_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_alpha_bound ,alpha_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_alpha_bound, + "ML_BSSN_O8::alpha", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_O8::alpha!"); + + } + + if (CCTK_EQUALS(phi_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_phi_bound = -1; + if (handle_phi_bound < 0) handle_phi_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_phi_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_phi_bound ,phi_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_phi_bound, + "ML_BSSN_O8::phi", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_O8::phi!"); + + } + + if (CCTK_EQUALS(gt11_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_gt11_bound = -1; + if (handle_gt11_bound < 0) handle_gt11_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_gt11_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_gt11_bound ,gt11_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_gt11_bound, + "ML_BSSN_O8::gt11", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_O8::gt11!"); + + } + + if (CCTK_EQUALS(gt12_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_gt12_bound = -1; + if (handle_gt12_bound < 0) handle_gt12_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_gt12_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_gt12_bound ,gt12_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_gt12_bound, + "ML_BSSN_O8::gt12", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_O8::gt12!"); + + } + + if (CCTK_EQUALS(gt13_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_gt13_bound = -1; + if (handle_gt13_bound < 0) handle_gt13_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_gt13_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_gt13_bound ,gt13_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_gt13_bound, + "ML_BSSN_O8::gt13", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_O8::gt13!"); + + } + + if (CCTK_EQUALS(gt22_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_gt22_bound = -1; + if (handle_gt22_bound < 0) handle_gt22_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_gt22_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_gt22_bound ,gt22_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_gt22_bound, + "ML_BSSN_O8::gt22", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_O8::gt22!"); + + } + + if (CCTK_EQUALS(gt23_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_gt23_bound = -1; + if (handle_gt23_bound < 0) handle_gt23_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_gt23_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_gt23_bound ,gt23_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_gt23_bound, + "ML_BSSN_O8::gt23", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_O8::gt23!"); + + } + + if (CCTK_EQUALS(gt33_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_gt33_bound = -1; + if (handle_gt33_bound < 0) handle_gt33_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_gt33_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_gt33_bound ,gt33_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_gt33_bound, + "ML_BSSN_O8::gt33", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_O8::gt33!"); + + } + + if (CCTK_EQUALS(beta1_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_beta1_bound = -1; + if (handle_beta1_bound < 0) handle_beta1_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_beta1_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_beta1_bound ,beta1_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_beta1_bound, + "ML_BSSN_O8::beta1", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_O8::beta1!"); + + } + + if (CCTK_EQUALS(beta2_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_beta2_bound = -1; + if (handle_beta2_bound < 0) handle_beta2_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_beta2_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_beta2_bound ,beta2_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_beta2_bound, + "ML_BSSN_O8::beta2", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_O8::beta2!"); + + } + + if (CCTK_EQUALS(beta3_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_beta3_bound = -1; + if (handle_beta3_bound < 0) handle_beta3_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_beta3_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_beta3_bound ,beta3_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_beta3_bound, + "ML_BSSN_O8::beta3", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_O8::beta3!"); + + } + + if (CCTK_EQUALS(trK_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_trK_bound = -1; + if (handle_trK_bound < 0) handle_trK_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_trK_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_trK_bound ,trK_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_trK_bound, + "ML_BSSN_O8::trK", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_O8::trK!"); + + } + return; +} + + + +/* template for entries in parameter file: +#$bound$#ML_BSSN_O8::ML_curv_bound = "skip" +#$bound$#ML_BSSN_O8::ML_curv_bound_speed = 1.0 +#$bound$#ML_BSSN_O8::ML_curv_bound_limit = 0.0 +#$bound$#ML_BSSN_O8::ML_curv_bound_scalar = 0.0 + +#$bound$#ML_BSSN_O8::ML_dtlapse_bound = "skip" +#$bound$#ML_BSSN_O8::ML_dtlapse_bound_speed = 1.0 +#$bound$#ML_BSSN_O8::ML_dtlapse_bound_limit = 0.0 +#$bound$#ML_BSSN_O8::ML_dtlapse_bound_scalar = 0.0 + +#$bound$#ML_BSSN_O8::ML_dtshift_bound = "skip" +#$bound$#ML_BSSN_O8::ML_dtshift_bound_speed = 1.0 +#$bound$#ML_BSSN_O8::ML_dtshift_bound_limit = 0.0 +#$bound$#ML_BSSN_O8::ML_dtshift_bound_scalar = 0.0 + +#$bound$#ML_BSSN_O8::ML_Gamma_bound = "skip" +#$bound$#ML_BSSN_O8::ML_Gamma_bound_speed = 1.0 +#$bound$#ML_BSSN_O8::ML_Gamma_bound_limit = 0.0 +#$bound$#ML_BSSN_O8::ML_Gamma_bound_scalar = 0.0 + +#$bound$#ML_BSSN_O8::ML_lapse_bound = "skip" +#$bound$#ML_BSSN_O8::ML_lapse_bound_speed = 1.0 +#$bound$#ML_BSSN_O8::ML_lapse_bound_limit = 0.0 +#$bound$#ML_BSSN_O8::ML_lapse_bound_scalar = 0.0 + +#$bound$#ML_BSSN_O8::ML_log_confac_bound = "skip" +#$bound$#ML_BSSN_O8::ML_log_confac_bound_speed = 1.0 +#$bound$#ML_BSSN_O8::ML_log_confac_bound_limit = 0.0 +#$bound$#ML_BSSN_O8::ML_log_confac_bound_scalar = 0.0 + +#$bound$#ML_BSSN_O8::ML_metric_bound = "skip" +#$bound$#ML_BSSN_O8::ML_metric_bound_speed = 1.0 +#$bound$#ML_BSSN_O8::ML_metric_bound_limit = 0.0 +#$bound$#ML_BSSN_O8::ML_metric_bound_scalar = 0.0 + +#$bound$#ML_BSSN_O8::ML_shift_bound = "skip" +#$bound$#ML_BSSN_O8::ML_shift_bound_speed = 1.0 +#$bound$#ML_BSSN_O8::ML_shift_bound_limit = 0.0 +#$bound$#ML_BSSN_O8::ML_shift_bound_scalar = 0.0 + +#$bound$#ML_BSSN_O8::ML_trace_curv_bound = "skip" +#$bound$#ML_BSSN_O8::ML_trace_curv_bound_speed = 1.0 +#$bound$#ML_BSSN_O8::ML_trace_curv_bound_limit = 0.0 +#$bound$#ML_BSSN_O8::ML_trace_curv_bound_scalar = 0.0 + +#$bound$#ML_BSSN_O8::At11_bound = "skip" +#$bound$#ML_BSSN_O8::At11_bound_speed = 1.0 +#$bound$#ML_BSSN_O8::At11_bound_limit = 0.0 +#$bound$#ML_BSSN_O8::At11_bound_scalar = 0.0 + +#$bound$#ML_BSSN_O8::At12_bound = "skip" +#$bound$#ML_BSSN_O8::At12_bound_speed = 1.0 +#$bound$#ML_BSSN_O8::At12_bound_limit = 0.0 +#$bound$#ML_BSSN_O8::At12_bound_scalar = 0.0 + +#$bound$#ML_BSSN_O8::At13_bound = "skip" +#$bound$#ML_BSSN_O8::At13_bound_speed = 1.0 +#$bound$#ML_BSSN_O8::At13_bound_limit = 0.0 +#$bound$#ML_BSSN_O8::At13_bound_scalar = 0.0 + +#$bound$#ML_BSSN_O8::At22_bound = "skip" +#$bound$#ML_BSSN_O8::At22_bound_speed = 1.0 +#$bound$#ML_BSSN_O8::At22_bound_limit = 0.0 +#$bound$#ML_BSSN_O8::At22_bound_scalar = 0.0 + +#$bound$#ML_BSSN_O8::At23_bound = "skip" +#$bound$#ML_BSSN_O8::At23_bound_speed = 1.0 +#$bound$#ML_BSSN_O8::At23_bound_limit = 0.0 +#$bound$#ML_BSSN_O8::At23_bound_scalar = 0.0 + +#$bound$#ML_BSSN_O8::At33_bound = "skip" +#$bound$#ML_BSSN_O8::At33_bound_speed = 1.0 +#$bound$#ML_BSSN_O8::At33_bound_limit = 0.0 +#$bound$#ML_BSSN_O8::At33_bound_scalar = 0.0 + +#$bound$#ML_BSSN_O8::A_bound = "skip" +#$bound$#ML_BSSN_O8::A_bound_speed = 1.0 +#$bound$#ML_BSSN_O8::A_bound_limit = 0.0 +#$bound$#ML_BSSN_O8::A_bound_scalar = 0.0 + +#$bound$#ML_BSSN_O8::B1_bound = "skip" +#$bound$#ML_BSSN_O8::B1_bound_speed = 1.0 +#$bound$#ML_BSSN_O8::B1_bound_limit = 0.0 +#$bound$#ML_BSSN_O8::B1_bound_scalar = 0.0 + +#$bound$#ML_BSSN_O8::B2_bound = "skip" +#$bound$#ML_BSSN_O8::B2_bound_speed = 1.0 +#$bound$#ML_BSSN_O8::B2_bound_limit = 0.0 +#$bound$#ML_BSSN_O8::B2_bound_scalar = 0.0 + +#$bound$#ML_BSSN_O8::B3_bound = "skip" +#$bound$#ML_BSSN_O8::B3_bound_speed = 1.0 +#$bound$#ML_BSSN_O8::B3_bound_limit = 0.0 +#$bound$#ML_BSSN_O8::B3_bound_scalar = 0.0 + +#$bound$#ML_BSSN_O8::Xt1_bound = "skip" +#$bound$#ML_BSSN_O8::Xt1_bound_speed = 1.0 +#$bound$#ML_BSSN_O8::Xt1_bound_limit = 0.0 +#$bound$#ML_BSSN_O8::Xt1_bound_scalar = 0.0 + +#$bound$#ML_BSSN_O8::Xt2_bound = "skip" +#$bound$#ML_BSSN_O8::Xt2_bound_speed = 1.0 +#$bound$#ML_BSSN_O8::Xt2_bound_limit = 0.0 +#$bound$#ML_BSSN_O8::Xt2_bound_scalar = 0.0 + +#$bound$#ML_BSSN_O8::Xt3_bound = "skip" +#$bound$#ML_BSSN_O8::Xt3_bound_speed = 1.0 +#$bound$#ML_BSSN_O8::Xt3_bound_limit = 0.0 +#$bound$#ML_BSSN_O8::Xt3_bound_scalar = 0.0 + +#$bound$#ML_BSSN_O8::alpha_bound = "skip" +#$bound$#ML_BSSN_O8::alpha_bound_speed = 1.0 +#$bound$#ML_BSSN_O8::alpha_bound_limit = 0.0 +#$bound$#ML_BSSN_O8::alpha_bound_scalar = 0.0 + +#$bound$#ML_BSSN_O8::phi_bound = "skip" +#$bound$#ML_BSSN_O8::phi_bound_speed = 1.0 +#$bound$#ML_BSSN_O8::phi_bound_limit = 0.0 +#$bound$#ML_BSSN_O8::phi_bound_scalar = 0.0 + +#$bound$#ML_BSSN_O8::gt11_bound = "skip" +#$bound$#ML_BSSN_O8::gt11_bound_speed = 1.0 +#$bound$#ML_BSSN_O8::gt11_bound_limit = 0.0 +#$bound$#ML_BSSN_O8::gt11_bound_scalar = 0.0 + +#$bound$#ML_BSSN_O8::gt12_bound = "skip" +#$bound$#ML_BSSN_O8::gt12_bound_speed = 1.0 +#$bound$#ML_BSSN_O8::gt12_bound_limit = 0.0 +#$bound$#ML_BSSN_O8::gt12_bound_scalar = 0.0 + +#$bound$#ML_BSSN_O8::gt13_bound = "skip" +#$bound$#ML_BSSN_O8::gt13_bound_speed = 1.0 +#$bound$#ML_BSSN_O8::gt13_bound_limit = 0.0 +#$bound$#ML_BSSN_O8::gt13_bound_scalar = 0.0 + +#$bound$#ML_BSSN_O8::gt22_bound = "skip" +#$bound$#ML_BSSN_O8::gt22_bound_speed = 1.0 +#$bound$#ML_BSSN_O8::gt22_bound_limit = 0.0 +#$bound$#ML_BSSN_O8::gt22_bound_scalar = 0.0 + +#$bound$#ML_BSSN_O8::gt23_bound = "skip" +#$bound$#ML_BSSN_O8::gt23_bound_speed = 1.0 +#$bound$#ML_BSSN_O8::gt23_bound_limit = 0.0 +#$bound$#ML_BSSN_O8::gt23_bound_scalar = 0.0 + +#$bound$#ML_BSSN_O8::gt33_bound = "skip" +#$bound$#ML_BSSN_O8::gt33_bound_speed = 1.0 +#$bound$#ML_BSSN_O8::gt33_bound_limit = 0.0 +#$bound$#ML_BSSN_O8::gt33_bound_scalar = 0.0 + +#$bound$#ML_BSSN_O8::beta1_bound = "skip" +#$bound$#ML_BSSN_O8::beta1_bound_speed = 1.0 +#$bound$#ML_BSSN_O8::beta1_bound_limit = 0.0 +#$bound$#ML_BSSN_O8::beta1_bound_scalar = 0.0 + +#$bound$#ML_BSSN_O8::beta2_bound = "skip" +#$bound$#ML_BSSN_O8::beta2_bound_speed = 1.0 +#$bound$#ML_BSSN_O8::beta2_bound_limit = 0.0 +#$bound$#ML_BSSN_O8::beta2_bound_scalar = 0.0 + +#$bound$#ML_BSSN_O8::beta3_bound = "skip" +#$bound$#ML_BSSN_O8::beta3_bound_speed = 1.0 +#$bound$#ML_BSSN_O8::beta3_bound_limit = 0.0 +#$bound$#ML_BSSN_O8::beta3_bound_scalar = 0.0 + +#$bound$#ML_BSSN_O8::trK_bound = "skip" +#$bound$#ML_BSSN_O8::trK_bound_speed = 1.0 +#$bound$#ML_BSSN_O8::trK_bound_limit = 0.0 +#$bound$#ML_BSSN_O8::trK_bound_scalar = 0.0 + +*/ + diff --git a/ML_BSSN_O8/src/ML_BSSN_O8_Minkowski.cc b/ML_BSSN_O8/src/ML_BSSN_O8_Minkowski.cc new file mode 100644 index 0000000..ada8d44 --- /dev/null +++ b/ML_BSSN_O8/src/ML_BSSN_O8_Minkowski.cc @@ -0,0 +1,193 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +static void ML_BSSN_O8_Minkowski_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_BSSN_O8_Minkowski_Body"); + } + + if (cctk_iteration % ML_BSSN_O8_Minkowski_calc_every != ML_BSSN_O8_Minkowski_calc_offset) + { + return; + } + + const char *groups[] = {"ML_BSSN_O8::ML_curv","ML_BSSN_O8::ML_dtlapse","ML_BSSN_O8::ML_dtshift","ML_BSSN_O8::ML_Gamma","ML_BSSN_O8::ML_lapse","ML_BSSN_O8::ML_log_confac","ML_BSSN_O8::ML_metric","ML_BSSN_O8::ML_shift","ML_BSSN_O8::ML_trace_curv"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_BSSN_O8_Minkowski", 9, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o1024dx = 0.0009765625*INV(dx); + CCTK_REAL const p1o1024dy = 0.0009765625*INV(dy); + CCTK_REAL const p1o1024dz = 0.0009765625*INV(dz); + CCTK_REAL const p1o1680dx = 0.000595238095238095238095238095238*INV(dx); + CCTK_REAL const p1o1680dy = 0.000595238095238095238095238095238*INV(dy); + CCTK_REAL const p1o1680dz = 0.000595238095238095238095238095238*INV(dz); + CCTK_REAL const p1o5040dx2 = 0.000198412698412698412698412698413*INV(SQR(dx)); + CCTK_REAL const p1o5040dy2 = 0.000198412698412698412698412698413*INV(SQR(dy)); + CCTK_REAL const p1o5040dz2 = 0.000198412698412698412698412698413*INV(SQR(dz)); + CCTK_REAL const p1o560dx = 0.00178571428571428571428571428571*INV(dx); + CCTK_REAL const p1o560dy = 0.00178571428571428571428571428571*INV(dy); + CCTK_REAL const p1o560dz = 0.00178571428571428571428571428571*INV(dz); + CCTK_REAL const p1o705600dxdy = 1.41723356009070294784580498866e-6*INV(dx)*INV(dy); + CCTK_REAL const p1o705600dxdz = 1.41723356009070294784580498866e-6*INV(dx)*INV(dz); + CCTK_REAL const p1o705600dydz = 1.41723356009070294784580498866e-6*INV(dy)*INV(dz); + CCTK_REAL const p1o840dx = 0.00119047619047619047619047619048*INV(dx); + CCTK_REAL const p1o840dy = 0.00119047619047619047619047619048*INV(dy); + CCTK_REAL const p1o840dz = 0.00119047619047619047619047619048*INV(dz); + CCTK_REAL const p1odx = INV(dx); + CCTK_REAL const p1ody = INV(dy); + CCTK_REAL const p1odz = INV(dz); + CCTK_REAL const pm1o840dx = -0.00119047619047619047619047619048*INV(dx); + CCTK_REAL const pm1o840dy = -0.00119047619047619047619047619048*INV(dy); + CCTK_REAL const pm1o840dz = -0.00119047619047619047619047619048*INV(dz); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_BSSN_O8_Minkowski, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + + /* Include user supplied include files */ + + /* Precompute derivatives */ + + /* Calculate temporaries and grid functions */ + CCTK_REAL phiL = IfThen(ToReal(conformalMethod),1,0); + + CCTK_REAL gt11L = 1; + + CCTK_REAL gt12L = 0; + + CCTK_REAL gt13L = 0; + + CCTK_REAL gt22L = 1; + + CCTK_REAL gt23L = 0; + + CCTK_REAL gt33L = 1; + + CCTK_REAL trKL = 0; + + CCTK_REAL At11L = 0; + + CCTK_REAL At12L = 0; + + CCTK_REAL At13L = 0; + + CCTK_REAL At22L = 0; + + CCTK_REAL At23L = 0; + + CCTK_REAL At33L = 0; + + CCTK_REAL Xt1L = 0; + + CCTK_REAL Xt2L = 0; + + CCTK_REAL Xt3L = 0; + + CCTK_REAL alphaL = 1; + + CCTK_REAL AL = 0; + + CCTK_REAL beta1L = 0; + + CCTK_REAL beta2L = 0; + + CCTK_REAL beta3L = 0; + + CCTK_REAL B1L = 0; + + CCTK_REAL B2L = 0; + + CCTK_REAL B3L = 0; + + + /* Copy local copies back to grid functions */ + A[index] = AL; + alpha[index] = alphaL; + At11[index] = At11L; + At12[index] = At12L; + At13[index] = At13L; + At22[index] = At22L; + At23[index] = At23L; + At33[index] = At33L; + B1[index] = B1L; + B2[index] = B2L; + B3[index] = B3L; + beta1[index] = beta1L; + beta2[index] = beta2L; + beta3[index] = beta3L; + gt11[index] = gt11L; + gt12[index] = gt12L; + gt13[index] = gt13L; + gt22[index] = gt22L; + gt23[index] = gt23L; + gt33[index] = gt33L; + phi[index] = phiL; + trK[index] = trKL; + Xt1[index] = Xt1L; + Xt2[index] = Xt2L; + Xt3[index] = Xt3L; + } + LC_ENDLOOP3 (ML_BSSN_O8_Minkowski); +} + +extern "C" void ML_BSSN_O8_Minkowski(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverEverything(cctkGH, &ML_BSSN_O8_Minkowski_Body); +} diff --git a/ML_BSSN_O8/src/ML_BSSN_O8_RHS1.cc b/ML_BSSN_O8/src/ML_BSSN_O8_RHS1.cc new file mode 100644 index 0000000..f6d86b7 --- /dev/null +++ b/ML_BSSN_O8/src/ML_BSSN_O8_RHS1.cc @@ -0,0 +1,852 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +extern "C" void ML_BSSN_O8_RHS1_SelectBCs(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT ierr = 0; + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_O8::ML_dtlapserhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_O8::ML_dtlapserhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_O8::ML_dtshiftrhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_O8::ML_dtshiftrhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_O8::ML_Gammarhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_O8::ML_Gammarhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_O8::ML_lapserhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_O8::ML_lapserhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_O8::ML_log_confacrhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_O8::ML_log_confacrhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_O8::ML_metricrhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_O8::ML_metricrhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_O8::ML_shiftrhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_O8::ML_shiftrhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_O8::ML_trace_curvrhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_O8::ML_trace_curvrhs."); + return; +} + +static void ML_BSSN_O8_RHS1_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_BSSN_O8_RHS1_Body"); + } + + if (cctk_iteration % ML_BSSN_O8_RHS1_calc_every != ML_BSSN_O8_RHS1_calc_offset) + { + return; + } + + const char *groups[] = {"grid::coordinates","Grid::coordinates","ML_BSSN_O8::ML_curv","ML_BSSN_O8::ML_dtlapse","ML_BSSN_O8::ML_dtlapserhs","ML_BSSN_O8::ML_dtshift","ML_BSSN_O8::ML_dtshiftrhs","ML_BSSN_O8::ML_Gamma","ML_BSSN_O8::ML_Gammarhs","ML_BSSN_O8::ML_lapse","ML_BSSN_O8::ML_lapserhs","ML_BSSN_O8::ML_log_confac","ML_BSSN_O8::ML_log_confacrhs","ML_BSSN_O8::ML_metric","ML_BSSN_O8::ML_metricrhs","ML_BSSN_O8::ML_shift","ML_BSSN_O8::ML_shiftrhs","ML_BSSN_O8::ML_trace_curv","ML_BSSN_O8::ML_trace_curvrhs"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_BSSN_O8_RHS1", 19, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o1024dx = 0.0009765625*INV(dx); + CCTK_REAL const p1o1024dy = 0.0009765625*INV(dy); + CCTK_REAL const p1o1024dz = 0.0009765625*INV(dz); + CCTK_REAL const p1o1680dx = 0.000595238095238095238095238095238*INV(dx); + CCTK_REAL const p1o1680dy = 0.000595238095238095238095238095238*INV(dy); + CCTK_REAL const p1o1680dz = 0.000595238095238095238095238095238*INV(dz); + CCTK_REAL const p1o5040dx2 = 0.000198412698412698412698412698413*INV(SQR(dx)); + CCTK_REAL const p1o5040dy2 = 0.000198412698412698412698412698413*INV(SQR(dy)); + CCTK_REAL const p1o5040dz2 = 0.000198412698412698412698412698413*INV(SQR(dz)); + CCTK_REAL const p1o560dx = 0.00178571428571428571428571428571*INV(dx); + CCTK_REAL const p1o560dy = 0.00178571428571428571428571428571*INV(dy); + CCTK_REAL const p1o560dz = 0.00178571428571428571428571428571*INV(dz); + CCTK_REAL const p1o705600dxdy = 1.41723356009070294784580498866e-6*INV(dx)*INV(dy); + CCTK_REAL const p1o705600dxdz = 1.41723356009070294784580498866e-6*INV(dx)*INV(dz); + CCTK_REAL const p1o705600dydz = 1.41723356009070294784580498866e-6*INV(dy)*INV(dz); + CCTK_REAL const p1o840dx = 0.00119047619047619047619047619048*INV(dx); + CCTK_REAL const p1o840dy = 0.00119047619047619047619047619048*INV(dy); + CCTK_REAL const p1o840dz = 0.00119047619047619047619047619048*INV(dz); + CCTK_REAL const p1odx = INV(dx); + CCTK_REAL const p1ody = INV(dy); + CCTK_REAL const p1odz = INV(dz); + CCTK_REAL const pm1o840dx = -0.00119047619047619047619047619048*INV(dx); + CCTK_REAL const pm1o840dy = -0.00119047619047619047619047619048*INV(dy); + CCTK_REAL const pm1o840dz = -0.00119047619047619047619047619048*INV(dz); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_BSSN_O8_RHS1, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + CCTK_REAL AL = A[index]; + CCTK_REAL alphaL = alpha[index]; + CCTK_REAL At11L = At11[index]; + CCTK_REAL At12L = At12[index]; + CCTK_REAL At13L = At13[index]; + CCTK_REAL At22L = At22[index]; + CCTK_REAL At23L = At23[index]; + CCTK_REAL At33L = At33[index]; + CCTK_REAL B1L = B1[index]; + CCTK_REAL B2L = B2[index]; + CCTK_REAL B3L = B3[index]; + CCTK_REAL beta1L = beta1[index]; + CCTK_REAL beta2L = beta2[index]; + CCTK_REAL beta3L = beta3[index]; + CCTK_REAL eTttL = (*stress_energy_state) ? eTtt[index] : ToReal(0.0); + CCTK_REAL eTtxL = (*stress_energy_state) ? eTtx[index] : ToReal(0.0); + CCTK_REAL eTtyL = (*stress_energy_state) ? eTty[index] : ToReal(0.0); + CCTK_REAL eTtzL = (*stress_energy_state) ? eTtz[index] : ToReal(0.0); + CCTK_REAL eTxxL = (*stress_energy_state) ? eTxx[index] : ToReal(0.0); + CCTK_REAL eTxyL = (*stress_energy_state) ? eTxy[index] : ToReal(0.0); + CCTK_REAL eTxzL = (*stress_energy_state) ? eTxz[index] : ToReal(0.0); + CCTK_REAL eTyyL = (*stress_energy_state) ? eTyy[index] : ToReal(0.0); + CCTK_REAL eTyzL = (*stress_energy_state) ? eTyz[index] : ToReal(0.0); + CCTK_REAL eTzzL = (*stress_energy_state) ? eTzz[index] : ToReal(0.0); + CCTK_REAL gt11L = gt11[index]; + CCTK_REAL gt12L = gt12[index]; + CCTK_REAL gt13L = gt13[index]; + CCTK_REAL gt22L = gt22[index]; + CCTK_REAL gt23L = gt23[index]; + CCTK_REAL gt33L = gt33[index]; + CCTK_REAL phiL = phi[index]; + CCTK_REAL rL = r[index]; + CCTK_REAL trKL = trK[index]; + CCTK_REAL Xt1L = Xt1[index]; + CCTK_REAL Xt2L = Xt2[index]; + CCTK_REAL Xt3L = Xt3[index]; + + /* Include user supplied include files */ + + /* Precompute derivatives */ + CCTK_REAL const PDdissipationNth1A = PDdissipationNth1(&A[index]); + CCTK_REAL const PDdissipationNth2A = PDdissipationNth2(&A[index]); + CCTK_REAL const PDdissipationNth3A = PDdissipationNth3(&A[index]); + CCTK_REAL const PDupwindNthAnti1A = PDupwindNthAnti1(&A[index]); + CCTK_REAL const PDupwindNthSymm1A = PDupwindNthSymm1(&A[index]); + CCTK_REAL const PDupwindNthAnti2A = PDupwindNthAnti2(&A[index]); + CCTK_REAL const PDupwindNthSymm2A = PDupwindNthSymm2(&A[index]); + CCTK_REAL const PDupwindNthAnti3A = PDupwindNthAnti3(&A[index]); + CCTK_REAL const PDupwindNthSymm3A = PDupwindNthSymm3(&A[index]); + CCTK_REAL const PDstandardNth1alpha = PDstandardNth1(&alpha[index]); + CCTK_REAL const PDstandardNth2alpha = PDstandardNth2(&alpha[index]); + CCTK_REAL const PDstandardNth3alpha = PDstandardNth3(&alpha[index]); + CCTK_REAL const PDstandardNth11alpha = PDstandardNth11(&alpha[index]); + CCTK_REAL const PDstandardNth22alpha = PDstandardNth22(&alpha[index]); + CCTK_REAL const PDstandardNth33alpha = PDstandardNth33(&alpha[index]); + CCTK_REAL const PDstandardNth12alpha = PDstandardNth12(&alpha[index]); + CCTK_REAL const PDstandardNth13alpha = PDstandardNth13(&alpha[index]); + CCTK_REAL const PDstandardNth23alpha = PDstandardNth23(&alpha[index]); + CCTK_REAL const PDdissipationNth1alpha = PDdissipationNth1(&alpha[index]); + CCTK_REAL const PDdissipationNth2alpha = PDdissipationNth2(&alpha[index]); + CCTK_REAL const PDdissipationNth3alpha = PDdissipationNth3(&alpha[index]); + CCTK_REAL const PDupwindNthAnti1alpha = PDupwindNthAnti1(&alpha[index]); + CCTK_REAL const PDupwindNthSymm1alpha = PDupwindNthSymm1(&alpha[index]); + CCTK_REAL const PDupwindNthAnti2alpha = PDupwindNthAnti2(&alpha[index]); + CCTK_REAL const PDupwindNthSymm2alpha = PDupwindNthSymm2(&alpha[index]); + CCTK_REAL const PDupwindNthAnti3alpha = PDupwindNthAnti3(&alpha[index]); + CCTK_REAL const PDupwindNthSymm3alpha = PDupwindNthSymm3(&alpha[index]); + CCTK_REAL const PDdissipationNth1B1 = PDdissipationNth1(&B1[index]); + CCTK_REAL const PDdissipationNth2B1 = PDdissipationNth2(&B1[index]); + CCTK_REAL const PDdissipationNth3B1 = PDdissipationNth3(&B1[index]); + CCTK_REAL const PDupwindNthAnti1B1 = PDupwindNthAnti1(&B1[index]); + CCTK_REAL const PDupwindNthSymm1B1 = PDupwindNthSymm1(&B1[index]); + CCTK_REAL const PDupwindNthAnti2B1 = PDupwindNthAnti2(&B1[index]); + CCTK_REAL const PDupwindNthSymm2B1 = PDupwindNthSymm2(&B1[index]); + CCTK_REAL const PDupwindNthAnti3B1 = PDupwindNthAnti3(&B1[index]); + CCTK_REAL const PDupwindNthSymm3B1 = PDupwindNthSymm3(&B1[index]); + CCTK_REAL const PDdissipationNth1B2 = PDdissipationNth1(&B2[index]); + CCTK_REAL const PDdissipationNth2B2 = PDdissipationNth2(&B2[index]); + CCTK_REAL const PDdissipationNth3B2 = PDdissipationNth3(&B2[index]); + CCTK_REAL const PDupwindNthAnti1B2 = PDupwindNthAnti1(&B2[index]); + CCTK_REAL const PDupwindNthSymm1B2 = PDupwindNthSymm1(&B2[index]); + CCTK_REAL const PDupwindNthAnti2B2 = PDupwindNthAnti2(&B2[index]); + CCTK_REAL const PDupwindNthSymm2B2 = PDupwindNthSymm2(&B2[index]); + CCTK_REAL const PDupwindNthAnti3B2 = PDupwindNthAnti3(&B2[index]); + CCTK_REAL const PDupwindNthSymm3B2 = PDupwindNthSymm3(&B2[index]); + CCTK_REAL const PDdissipationNth1B3 = PDdissipationNth1(&B3[index]); + CCTK_REAL const PDdissipationNth2B3 = PDdissipationNth2(&B3[index]); + CCTK_REAL const PDdissipationNth3B3 = PDdissipationNth3(&B3[index]); + CCTK_REAL const PDupwindNthAnti1B3 = PDupwindNthAnti1(&B3[index]); + CCTK_REAL const PDupwindNthSymm1B3 = PDupwindNthSymm1(&B3[index]); + CCTK_REAL const PDupwindNthAnti2B3 = PDupwindNthAnti2(&B3[index]); + CCTK_REAL const PDupwindNthSymm2B3 = PDupwindNthSymm2(&B3[index]); + CCTK_REAL const PDupwindNthAnti3B3 = PDupwindNthAnti3(&B3[index]); + CCTK_REAL const PDupwindNthSymm3B3 = PDupwindNthSymm3(&B3[index]); + CCTK_REAL const PDstandardNth1beta1 = PDstandardNth1(&beta1[index]); + CCTK_REAL const PDstandardNth2beta1 = PDstandardNth2(&beta1[index]); + CCTK_REAL const PDstandardNth3beta1 = PDstandardNth3(&beta1[index]); + CCTK_REAL const PDstandardNth11beta1 = PDstandardNth11(&beta1[index]); + CCTK_REAL const PDstandardNth22beta1 = PDstandardNth22(&beta1[index]); + CCTK_REAL const PDstandardNth33beta1 = PDstandardNth33(&beta1[index]); + CCTK_REAL const PDstandardNth12beta1 = PDstandardNth12(&beta1[index]); + CCTK_REAL const PDstandardNth13beta1 = PDstandardNth13(&beta1[index]); + CCTK_REAL const PDstandardNth23beta1 = PDstandardNth23(&beta1[index]); + CCTK_REAL const PDdissipationNth1beta1 = PDdissipationNth1(&beta1[index]); + CCTK_REAL const PDdissipationNth2beta1 = PDdissipationNth2(&beta1[index]); + CCTK_REAL const PDdissipationNth3beta1 = PDdissipationNth3(&beta1[index]); + CCTK_REAL const PDupwindNthAnti1beta1 = PDupwindNthAnti1(&beta1[index]); + CCTK_REAL const PDupwindNthSymm1beta1 = PDupwindNthSymm1(&beta1[index]); + CCTK_REAL const PDupwindNthAnti2beta1 = PDupwindNthAnti2(&beta1[index]); + CCTK_REAL const PDupwindNthSymm2beta1 = PDupwindNthSymm2(&beta1[index]); + CCTK_REAL const PDupwindNthAnti3beta1 = PDupwindNthAnti3(&beta1[index]); + CCTK_REAL const PDupwindNthSymm3beta1 = PDupwindNthSymm3(&beta1[index]); + CCTK_REAL const PDstandardNth1beta2 = PDstandardNth1(&beta2[index]); + CCTK_REAL const PDstandardNth2beta2 = PDstandardNth2(&beta2[index]); + CCTK_REAL const PDstandardNth3beta2 = PDstandardNth3(&beta2[index]); + CCTK_REAL const PDstandardNth11beta2 = PDstandardNth11(&beta2[index]); + CCTK_REAL const PDstandardNth22beta2 = PDstandardNth22(&beta2[index]); + CCTK_REAL const PDstandardNth33beta2 = PDstandardNth33(&beta2[index]); + CCTK_REAL const PDstandardNth12beta2 = PDstandardNth12(&beta2[index]); + CCTK_REAL const PDstandardNth13beta2 = PDstandardNth13(&beta2[index]); + CCTK_REAL const PDstandardNth23beta2 = PDstandardNth23(&beta2[index]); + CCTK_REAL const PDdissipationNth1beta2 = PDdissipationNth1(&beta2[index]); + CCTK_REAL const PDdissipationNth2beta2 = PDdissipationNth2(&beta2[index]); + CCTK_REAL const PDdissipationNth3beta2 = PDdissipationNth3(&beta2[index]); + CCTK_REAL const PDupwindNthAnti1beta2 = PDupwindNthAnti1(&beta2[index]); + CCTK_REAL const PDupwindNthSymm1beta2 = PDupwindNthSymm1(&beta2[index]); + CCTK_REAL const PDupwindNthAnti2beta2 = PDupwindNthAnti2(&beta2[index]); + CCTK_REAL const PDupwindNthSymm2beta2 = PDupwindNthSymm2(&beta2[index]); + CCTK_REAL const PDupwindNthAnti3beta2 = PDupwindNthAnti3(&beta2[index]); + CCTK_REAL const PDupwindNthSymm3beta2 = PDupwindNthSymm3(&beta2[index]); + CCTK_REAL const PDstandardNth1beta3 = PDstandardNth1(&beta3[index]); + CCTK_REAL const PDstandardNth2beta3 = PDstandardNth2(&beta3[index]); + CCTK_REAL const PDstandardNth3beta3 = PDstandardNth3(&beta3[index]); + CCTK_REAL const PDstandardNth11beta3 = PDstandardNth11(&beta3[index]); + CCTK_REAL const PDstandardNth22beta3 = PDstandardNth22(&beta3[index]); + CCTK_REAL const PDstandardNth33beta3 = PDstandardNth33(&beta3[index]); + CCTK_REAL const PDstandardNth12beta3 = PDstandardNth12(&beta3[index]); + CCTK_REAL const PDstandardNth13beta3 = PDstandardNth13(&beta3[index]); + CCTK_REAL const PDstandardNth23beta3 = PDstandardNth23(&beta3[index]); + CCTK_REAL const PDdissipationNth1beta3 = PDdissipationNth1(&beta3[index]); + CCTK_REAL const PDdissipationNth2beta3 = PDdissipationNth2(&beta3[index]); + CCTK_REAL const PDdissipationNth3beta3 = PDdissipationNth3(&beta3[index]); + CCTK_REAL const PDupwindNthAnti1beta3 = PDupwindNthAnti1(&beta3[index]); + CCTK_REAL const PDupwindNthSymm1beta3 = PDupwindNthSymm1(&beta3[index]); + CCTK_REAL const PDupwindNthAnti2beta3 = PDupwindNthAnti2(&beta3[index]); + CCTK_REAL const PDupwindNthSymm2beta3 = PDupwindNthSymm2(&beta3[index]); + CCTK_REAL const PDupwindNthAnti3beta3 = PDupwindNthAnti3(&beta3[index]); + CCTK_REAL const PDupwindNthSymm3beta3 = PDupwindNthSymm3(&beta3[index]); + CCTK_REAL const PDstandardNth1gt11 = PDstandardNth1(>11[index]); + CCTK_REAL const PDstandardNth2gt11 = PDstandardNth2(>11[index]); + CCTK_REAL const PDstandardNth3gt11 = PDstandardNth3(>11[index]); + CCTK_REAL const PDdissipationNth1gt11 = PDdissipationNth1(>11[index]); + CCTK_REAL const PDdissipationNth2gt11 = PDdissipationNth2(>11[index]); + CCTK_REAL const PDdissipationNth3gt11 = PDdissipationNth3(>11[index]); + CCTK_REAL const PDupwindNthAnti1gt11 = PDupwindNthAnti1(>11[index]); + CCTK_REAL const PDupwindNthSymm1gt11 = PDupwindNthSymm1(>11[index]); + CCTK_REAL const PDupwindNthAnti2gt11 = PDupwindNthAnti2(>11[index]); + CCTK_REAL const PDupwindNthSymm2gt11 = PDupwindNthSymm2(>11[index]); + CCTK_REAL const PDupwindNthAnti3gt11 = PDupwindNthAnti3(>11[index]); + CCTK_REAL const PDupwindNthSymm3gt11 = PDupwindNthSymm3(>11[index]); + CCTK_REAL const PDstandardNth1gt12 = PDstandardNth1(>12[index]); + CCTK_REAL const PDstandardNth2gt12 = PDstandardNth2(>12[index]); + CCTK_REAL const PDstandardNth3gt12 = PDstandardNth3(>12[index]); + CCTK_REAL const PDdissipationNth1gt12 = PDdissipationNth1(>12[index]); + CCTK_REAL const PDdissipationNth2gt12 = PDdissipationNth2(>12[index]); + CCTK_REAL const PDdissipationNth3gt12 = PDdissipationNth3(>12[index]); + CCTK_REAL const PDupwindNthAnti1gt12 = PDupwindNthAnti1(>12[index]); + CCTK_REAL const PDupwindNthSymm1gt12 = PDupwindNthSymm1(>12[index]); + CCTK_REAL const PDupwindNthAnti2gt12 = PDupwindNthAnti2(>12[index]); + CCTK_REAL const PDupwindNthSymm2gt12 = PDupwindNthSymm2(>12[index]); + CCTK_REAL const PDupwindNthAnti3gt12 = PDupwindNthAnti3(>12[index]); + CCTK_REAL const PDupwindNthSymm3gt12 = PDupwindNthSymm3(>12[index]); + CCTK_REAL const PDstandardNth1gt13 = PDstandardNth1(>13[index]); + CCTK_REAL const PDstandardNth2gt13 = PDstandardNth2(>13[index]); + CCTK_REAL const PDstandardNth3gt13 = PDstandardNth3(>13[index]); + CCTK_REAL const PDdissipationNth1gt13 = PDdissipationNth1(>13[index]); + CCTK_REAL const PDdissipationNth2gt13 = PDdissipationNth2(>13[index]); + CCTK_REAL const PDdissipationNth3gt13 = PDdissipationNth3(>13[index]); + CCTK_REAL const PDupwindNthAnti1gt13 = PDupwindNthAnti1(>13[index]); + CCTK_REAL const PDupwindNthSymm1gt13 = PDupwindNthSymm1(>13[index]); + CCTK_REAL const PDupwindNthAnti2gt13 = PDupwindNthAnti2(>13[index]); + CCTK_REAL const PDupwindNthSymm2gt13 = PDupwindNthSymm2(>13[index]); + CCTK_REAL const PDupwindNthAnti3gt13 = PDupwindNthAnti3(>13[index]); + CCTK_REAL const PDupwindNthSymm3gt13 = PDupwindNthSymm3(>13[index]); + CCTK_REAL const PDstandardNth1gt22 = PDstandardNth1(>22[index]); + CCTK_REAL const PDstandardNth2gt22 = PDstandardNth2(>22[index]); + CCTK_REAL const PDstandardNth3gt22 = PDstandardNth3(>22[index]); + CCTK_REAL const PDdissipationNth1gt22 = PDdissipationNth1(>22[index]); + CCTK_REAL const PDdissipationNth2gt22 = PDdissipationNth2(>22[index]); + CCTK_REAL const PDdissipationNth3gt22 = PDdissipationNth3(>22[index]); + CCTK_REAL const PDupwindNthAnti1gt22 = PDupwindNthAnti1(>22[index]); + CCTK_REAL const PDupwindNthSymm1gt22 = PDupwindNthSymm1(>22[index]); + CCTK_REAL const PDupwindNthAnti2gt22 = PDupwindNthAnti2(>22[index]); + CCTK_REAL const PDupwindNthSymm2gt22 = PDupwindNthSymm2(>22[index]); + CCTK_REAL const PDupwindNthAnti3gt22 = PDupwindNthAnti3(>22[index]); + CCTK_REAL const PDupwindNthSymm3gt22 = PDupwindNthSymm3(>22[index]); + CCTK_REAL const PDstandardNth1gt23 = PDstandardNth1(>23[index]); + CCTK_REAL const PDstandardNth2gt23 = PDstandardNth2(>23[index]); + CCTK_REAL const PDstandardNth3gt23 = PDstandardNth3(>23[index]); + CCTK_REAL const PDdissipationNth1gt23 = PDdissipationNth1(>23[index]); + CCTK_REAL const PDdissipationNth2gt23 = PDdissipationNth2(>23[index]); + CCTK_REAL const PDdissipationNth3gt23 = PDdissipationNth3(>23[index]); + CCTK_REAL const PDupwindNthAnti1gt23 = PDupwindNthAnti1(>23[index]); + CCTK_REAL const PDupwindNthSymm1gt23 = PDupwindNthSymm1(>23[index]); + CCTK_REAL const PDupwindNthAnti2gt23 = PDupwindNthAnti2(>23[index]); + CCTK_REAL const PDupwindNthSymm2gt23 = PDupwindNthSymm2(>23[index]); + CCTK_REAL const PDupwindNthAnti3gt23 = PDupwindNthAnti3(>23[index]); + CCTK_REAL const PDupwindNthSymm3gt23 = PDupwindNthSymm3(>23[index]); + CCTK_REAL const PDstandardNth1gt33 = PDstandardNth1(>33[index]); + CCTK_REAL const PDstandardNth2gt33 = PDstandardNth2(>33[index]); + CCTK_REAL const PDstandardNth3gt33 = PDstandardNth3(>33[index]); + CCTK_REAL const PDdissipationNth1gt33 = PDdissipationNth1(>33[index]); + CCTK_REAL const PDdissipationNth2gt33 = PDdissipationNth2(>33[index]); + CCTK_REAL const PDdissipationNth3gt33 = PDdissipationNth3(>33[index]); + CCTK_REAL const PDupwindNthAnti1gt33 = PDupwindNthAnti1(>33[index]); + CCTK_REAL const PDupwindNthSymm1gt33 = PDupwindNthSymm1(>33[index]); + CCTK_REAL const PDupwindNthAnti2gt33 = PDupwindNthAnti2(>33[index]); + CCTK_REAL const PDupwindNthSymm2gt33 = PDupwindNthSymm2(>33[index]); + CCTK_REAL const PDupwindNthAnti3gt33 = PDupwindNthAnti3(>33[index]); + CCTK_REAL const PDupwindNthSymm3gt33 = PDupwindNthSymm3(>33[index]); + CCTK_REAL const PDstandardNth1phi = PDstandardNth1(&phi[index]); + CCTK_REAL const PDstandardNth2phi = PDstandardNth2(&phi[index]); + CCTK_REAL const PDstandardNth3phi = PDstandardNth3(&phi[index]); + CCTK_REAL const PDdissipationNth1phi = PDdissipationNth1(&phi[index]); + CCTK_REAL const PDdissipationNth2phi = PDdissipationNth2(&phi[index]); + CCTK_REAL const PDdissipationNth3phi = PDdissipationNth3(&phi[index]); + CCTK_REAL const PDupwindNthAnti1phi = PDupwindNthAnti1(&phi[index]); + CCTK_REAL const PDupwindNthSymm1phi = PDupwindNthSymm1(&phi[index]); + CCTK_REAL const PDupwindNthAnti2phi = PDupwindNthAnti2(&phi[index]); + CCTK_REAL const PDupwindNthSymm2phi = PDupwindNthSymm2(&phi[index]); + CCTK_REAL const PDupwindNthAnti3phi = PDupwindNthAnti3(&phi[index]); + CCTK_REAL const PDupwindNthSymm3phi = PDupwindNthSymm3(&phi[index]); + CCTK_REAL const PDstandardNth1trK = PDstandardNth1(&trK[index]); + CCTK_REAL const PDstandardNth2trK = PDstandardNth2(&trK[index]); + CCTK_REAL const PDstandardNth3trK = PDstandardNth3(&trK[index]); + CCTK_REAL const PDdissipationNth1trK = PDdissipationNth1(&trK[index]); + CCTK_REAL const PDdissipationNth2trK = PDdissipationNth2(&trK[index]); + CCTK_REAL const PDdissipationNth3trK = PDdissipationNth3(&trK[index]); + CCTK_REAL const PDupwindNthAnti1trK = PDupwindNthAnti1(&trK[index]); + CCTK_REAL const PDupwindNthSymm1trK = PDupwindNthSymm1(&trK[index]); + CCTK_REAL const PDupwindNthAnti2trK = PDupwindNthAnti2(&trK[index]); + CCTK_REAL const PDupwindNthSymm2trK = PDupwindNthSymm2(&trK[index]); + CCTK_REAL const PDupwindNthAnti3trK = PDupwindNthAnti3(&trK[index]); + CCTK_REAL const PDupwindNthSymm3trK = PDupwindNthSymm3(&trK[index]); + CCTK_REAL const PDdissipationNth1Xt1 = PDdissipationNth1(&Xt1[index]); + CCTK_REAL const PDdissipationNth2Xt1 = PDdissipationNth2(&Xt1[index]); + CCTK_REAL const PDdissipationNth3Xt1 = PDdissipationNth3(&Xt1[index]); + CCTK_REAL const PDupwindNthAnti1Xt1 = PDupwindNthAnti1(&Xt1[index]); + CCTK_REAL const PDupwindNthSymm1Xt1 = PDupwindNthSymm1(&Xt1[index]); + CCTK_REAL const PDupwindNthAnti2Xt1 = PDupwindNthAnti2(&Xt1[index]); + CCTK_REAL const PDupwindNthSymm2Xt1 = PDupwindNthSymm2(&Xt1[index]); + CCTK_REAL const PDupwindNthAnti3Xt1 = PDupwindNthAnti3(&Xt1[index]); + CCTK_REAL const PDupwindNthSymm3Xt1 = PDupwindNthSymm3(&Xt1[index]); + CCTK_REAL const PDdissipationNth1Xt2 = PDdissipationNth1(&Xt2[index]); + CCTK_REAL const PDdissipationNth2Xt2 = PDdissipationNth2(&Xt2[index]); + CCTK_REAL const PDdissipationNth3Xt2 = PDdissipationNth3(&Xt2[index]); + CCTK_REAL const PDupwindNthAnti1Xt2 = PDupwindNthAnti1(&Xt2[index]); + CCTK_REAL const PDupwindNthSymm1Xt2 = PDupwindNthSymm1(&Xt2[index]); + CCTK_REAL const PDupwindNthAnti2Xt2 = PDupwindNthAnti2(&Xt2[index]); + CCTK_REAL const PDupwindNthSymm2Xt2 = PDupwindNthSymm2(&Xt2[index]); + CCTK_REAL const PDupwindNthAnti3Xt2 = PDupwindNthAnti3(&Xt2[index]); + CCTK_REAL const PDupwindNthSymm3Xt2 = PDupwindNthSymm3(&Xt2[index]); + CCTK_REAL const PDdissipationNth1Xt3 = PDdissipationNth1(&Xt3[index]); + CCTK_REAL const PDdissipationNth2Xt3 = PDdissipationNth2(&Xt3[index]); + CCTK_REAL const PDdissipationNth3Xt3 = PDdissipationNth3(&Xt3[index]); + CCTK_REAL const PDupwindNthAnti1Xt3 = PDupwindNthAnti1(&Xt3[index]); + CCTK_REAL const PDupwindNthSymm1Xt3 = PDupwindNthSymm1(&Xt3[index]); + CCTK_REAL const PDupwindNthAnti2Xt3 = PDupwindNthAnti2(&Xt3[index]); + CCTK_REAL const PDupwindNthSymm2Xt3 = PDupwindNthSymm2(&Xt3[index]); + CCTK_REAL const PDupwindNthAnti3Xt3 = PDupwindNthAnti3(&Xt3[index]); + CCTK_REAL const PDupwindNthSymm3Xt3 = PDupwindNthSymm3(&Xt3[index]); + + /* Calculate temporaries and grid functions */ + ptrdiff_t dir1 = Sign(beta1L); + + ptrdiff_t dir2 = Sign(beta2L); + + ptrdiff_t dir3 = Sign(beta3L); + + CCTK_REAL epsdiss1 = ToReal(EpsDiss); + + CCTK_REAL epsdiss2 = ToReal(EpsDiss); + + CCTK_REAL epsdiss3 = ToReal(EpsDiss); + + CCTK_REAL detgt = 1; + + CCTK_REAL gtu11 = INV(detgt)*(gt22L*gt33L - SQR(gt23L)); + + CCTK_REAL gtu12 = (gt13L*gt23L - gt12L*gt33L)*INV(detgt); + + CCTK_REAL gtu13 = (-(gt13L*gt22L) + gt12L*gt23L)*INV(detgt); + + CCTK_REAL gtu22 = INV(detgt)*(gt11L*gt33L - SQR(gt13L)); + + CCTK_REAL gtu23 = (gt12L*gt13L - gt11L*gt23L)*INV(detgt); + + CCTK_REAL gtu33 = INV(detgt)*(gt11L*gt22L - SQR(gt12L)); + + CCTK_REAL Gtl111 = 0.5*PDstandardNth1gt11; + + CCTK_REAL Gtl112 = 0.5*PDstandardNth2gt11; + + CCTK_REAL Gtl113 = 0.5*PDstandardNth3gt11; + + CCTK_REAL Gtl122 = -0.5*PDstandardNth1gt22 + PDstandardNth2gt12; + + CCTK_REAL Gtl123 = 0.5*(-PDstandardNth1gt23 + PDstandardNth2gt13 + + PDstandardNth3gt12); + + CCTK_REAL Gtl133 = -0.5*PDstandardNth1gt33 + PDstandardNth3gt13; + + CCTK_REAL Gtl211 = PDstandardNth1gt12 - 0.5*PDstandardNth2gt11; + + CCTK_REAL Gtl212 = 0.5*PDstandardNth1gt22; + + CCTK_REAL Gtl213 = 0.5*(PDstandardNth1gt23 - PDstandardNth2gt13 + + PDstandardNth3gt12); + + CCTK_REAL Gtl222 = 0.5*PDstandardNth2gt22; + + CCTK_REAL Gtl223 = 0.5*PDstandardNth3gt22; + + CCTK_REAL Gtl233 = -0.5*PDstandardNth2gt33 + PDstandardNth3gt23; + + CCTK_REAL Gtl311 = PDstandardNth1gt13 - 0.5*PDstandardNth3gt11; + + CCTK_REAL Gtl312 = 0.5*(PDstandardNth1gt23 + PDstandardNth2gt13 - + PDstandardNth3gt12); + + CCTK_REAL Gtl313 = 0.5*PDstandardNth1gt33; + + CCTK_REAL Gtl322 = PDstandardNth2gt23 - 0.5*PDstandardNth3gt22; + + CCTK_REAL Gtl323 = 0.5*PDstandardNth2gt33; + + CCTK_REAL Gtl333 = 0.5*PDstandardNth3gt33; + + CCTK_REAL Gt111 = Gtl111*gtu11 + Gtl211*gtu12 + Gtl311*gtu13; + + CCTK_REAL Gt211 = Gtl111*gtu12 + Gtl211*gtu22 + Gtl311*gtu23; + + CCTK_REAL Gt311 = Gtl111*gtu13 + Gtl211*gtu23 + Gtl311*gtu33; + + CCTK_REAL Gt112 = Gtl112*gtu11 + Gtl212*gtu12 + Gtl312*gtu13; + + CCTK_REAL Gt212 = Gtl112*gtu12 + Gtl212*gtu22 + Gtl312*gtu23; + + CCTK_REAL Gt312 = Gtl112*gtu13 + Gtl212*gtu23 + Gtl312*gtu33; + + CCTK_REAL Gt113 = Gtl113*gtu11 + Gtl213*gtu12 + Gtl313*gtu13; + + CCTK_REAL Gt213 = Gtl113*gtu12 + Gtl213*gtu22 + Gtl313*gtu23; + + CCTK_REAL Gt313 = Gtl113*gtu13 + Gtl213*gtu23 + Gtl313*gtu33; + + CCTK_REAL Gt122 = Gtl122*gtu11 + Gtl222*gtu12 + Gtl322*gtu13; + + CCTK_REAL Gt222 = Gtl122*gtu12 + Gtl222*gtu22 + Gtl322*gtu23; + + CCTK_REAL Gt322 = Gtl122*gtu13 + Gtl222*gtu23 + Gtl322*gtu33; + + CCTK_REAL Gt123 = Gtl123*gtu11 + Gtl223*gtu12 + Gtl323*gtu13; + + CCTK_REAL Gt223 = Gtl123*gtu12 + Gtl223*gtu22 + Gtl323*gtu23; + + CCTK_REAL Gt323 = Gtl123*gtu13 + Gtl223*gtu23 + Gtl323*gtu33; + + CCTK_REAL Gt133 = Gtl133*gtu11 + Gtl233*gtu12 + Gtl333*gtu13; + + CCTK_REAL Gt233 = Gtl133*gtu12 + Gtl233*gtu22 + Gtl333*gtu23; + + CCTK_REAL Gt333 = Gtl133*gtu13 + Gtl233*gtu23 + Gtl333*gtu33; + + CCTK_REAL Xtn1 = Gt111*gtu11 + Gt122*gtu22 + 2*(Gt112*gtu12 + + Gt113*gtu13 + Gt123*gtu23) + Gt133*gtu33; + + CCTK_REAL Xtn2 = Gt211*gtu11 + Gt222*gtu22 + 2*(Gt212*gtu12 + + Gt213*gtu13 + Gt223*gtu23) + Gt233*gtu33; + + CCTK_REAL Xtn3 = Gt311*gtu11 + Gt322*gtu22 + 2*(Gt312*gtu12 + + Gt313*gtu13 + Gt323*gtu23) + Gt333*gtu33; + + CCTK_REAL fac1 = IfThen(ToReal(conformalMethod),-0.5*INV(phiL),1); + + CCTK_REAL cdphi1 = fac1*PDstandardNth1phi; + + CCTK_REAL cdphi2 = fac1*PDstandardNth2phi; + + CCTK_REAL cdphi3 = fac1*PDstandardNth3phi; + + CCTK_REAL Atm11 = At11L*gtu11 + At12L*gtu12 + At13L*gtu13; + + CCTK_REAL Atm21 = At11L*gtu12 + At12L*gtu22 + At13L*gtu23; + + CCTK_REAL Atm31 = At11L*gtu13 + At12L*gtu23 + At13L*gtu33; + + CCTK_REAL Atm12 = At12L*gtu11 + At22L*gtu12 + At23L*gtu13; + + CCTK_REAL Atm22 = At12L*gtu12 + At22L*gtu22 + At23L*gtu23; + + CCTK_REAL Atm32 = At12L*gtu13 + At22L*gtu23 + At23L*gtu33; + + CCTK_REAL Atm13 = At13L*gtu11 + At23L*gtu12 + At33L*gtu13; + + CCTK_REAL Atm23 = At13L*gtu12 + At23L*gtu22 + At33L*gtu23; + + CCTK_REAL Atm33 = At13L*gtu13 + At23L*gtu23 + At33L*gtu33; + + CCTK_REAL Atu11 = Atm11*gtu11 + Atm12*gtu12 + Atm13*gtu13; + + CCTK_REAL Atu12 = Atm11*gtu12 + Atm12*gtu22 + Atm13*gtu23; + + CCTK_REAL Atu13 = Atm11*gtu13 + Atm12*gtu23 + Atm13*gtu33; + + CCTK_REAL Atu22 = Atm21*gtu12 + Atm22*gtu22 + Atm23*gtu23; + + CCTK_REAL Atu23 = Atm21*gtu13 + Atm22*gtu23 + Atm23*gtu33; + + CCTK_REAL Atu33 = Atm31*gtu13 + Atm32*gtu23 + Atm33*gtu33; + + CCTK_REAL e4phi = + IfThen(ToReal(conformalMethod),INV(SQR(phiL)),exp(4*phiL)); + + CCTK_REAL em4phi = INV(e4phi); + + CCTK_REAL rho = INV(SQR(alphaL))*(eTttL - 2*(beta2L*eTtyL + + beta3L*eTtzL) + 2*(beta1L*(-eTtxL + beta2L*eTxyL + beta3L*eTxzL) + + beta2L*beta3L*eTyzL) + eTxxL*SQR(beta1L) + eTyyL*SQR(beta2L) + + eTzzL*SQR(beta3L)); + + CCTK_REAL S1 = (-eTtxL + beta1L*eTxxL + beta2L*eTxyL + + beta3L*eTxzL)*INV(alphaL); + + CCTK_REAL S2 = (-eTtyL + beta1L*eTxyL + beta2L*eTyyL + + beta3L*eTyzL)*INV(alphaL); + + CCTK_REAL S3 = (-eTtzL + beta1L*eTxzL + beta2L*eTyzL + + beta3L*eTzzL)*INV(alphaL); + + CCTK_REAL trS = em4phi*(eTxxL*gtu11 + eTyyL*gtu22 + 2*(eTxyL*gtu12 + + eTxzL*gtu13 + eTyzL*gtu23) + eTzzL*gtu33); + + CCTK_REAL phirhsL = epsdiss1*PDdissipationNth1phi + + epsdiss2*PDdissipationNth2phi + epsdiss3*PDdissipationNth3phi + + beta1L*PDupwindNthAnti1phi + beta2L*PDupwindNthAnti2phi + + beta3L*PDupwindNthAnti3phi + PDupwindNthSymm1phi*Abs(beta1L) + + PDupwindNthSymm2phi*Abs(beta2L) + PDupwindNthSymm3phi*Abs(beta3L) + + IfThen(ToReal(conformalMethod),phiL*(-0.333333333333333333333333333333*(PDstandardNth1beta1 + + PDstandardNth2beta2 + PDstandardNth3beta3) + + 0.333333333333333333333333333333*alphaL*trKL),0.166666666666666666666666666667*(PDstandardNth1beta1 + + PDstandardNth2beta2 + PDstandardNth3beta3) - + 0.166666666666666666666666666667*alphaL*trKL); + + CCTK_REAL gt11rhsL = -2*alphaL*At11L + epsdiss1*PDdissipationNth1gt11 + + epsdiss2*PDdissipationNth2gt11 + epsdiss3*PDdissipationNth3gt11 + + 2*(gt12L*PDstandardNth1beta2 + gt13L*PDstandardNth1beta3) + + gt11L*(1.33333333333333333333333333333*PDstandardNth1beta1 - + 0.666666666666666666666666666667*(PDstandardNth2beta2 + + PDstandardNth3beta3)) + beta1L*PDupwindNthAnti1gt11 + + beta2L*PDupwindNthAnti2gt11 + beta3L*PDupwindNthAnti3gt11 + + PDupwindNthSymm1gt11*Abs(beta1L) + PDupwindNthSymm2gt11*Abs(beta2L) + + PDupwindNthSymm3gt11*Abs(beta3L); + + CCTK_REAL gt12rhsL = -2*alphaL*At12L + epsdiss1*PDdissipationNth1gt12 + + epsdiss2*PDdissipationNth2gt12 + epsdiss3*PDdissipationNth3gt12 + + gt22L*PDstandardNth1beta2 + gt23L*PDstandardNth1beta3 + + gt11L*PDstandardNth2beta1 + gt13L*PDstandardNth2beta3 + + gt12L*(0.333333333333333333333333333333*(PDstandardNth1beta1 + + PDstandardNth2beta2) - + 0.666666666666666666666666666667*PDstandardNth3beta3) + + beta1L*PDupwindNthAnti1gt12 + beta2L*PDupwindNthAnti2gt12 + + beta3L*PDupwindNthAnti3gt12 + PDupwindNthSymm1gt12*Abs(beta1L) + + PDupwindNthSymm2gt12*Abs(beta2L) + PDupwindNthSymm3gt12*Abs(beta3L); + + CCTK_REAL gt13rhsL = -2*alphaL*At13L + epsdiss1*PDdissipationNth1gt13 + + epsdiss2*PDdissipationNth2gt13 + epsdiss3*PDdissipationNth3gt13 + + gt23L*PDstandardNth1beta2 + gt33L*PDstandardNth1beta3 + + gt11L*PDstandardNth3beta1 + gt12L*PDstandardNth3beta2 + + gt13L*(-0.666666666666666666666666666667*PDstandardNth2beta2 + + 0.333333333333333333333333333333*(PDstandardNth1beta1 + + PDstandardNth3beta3)) + beta1L*PDupwindNthAnti1gt13 + + beta2L*PDupwindNthAnti2gt13 + beta3L*PDupwindNthAnti3gt13 + + PDupwindNthSymm1gt13*Abs(beta1L) + PDupwindNthSymm2gt13*Abs(beta2L) + + PDupwindNthSymm3gt13*Abs(beta3L); + + CCTK_REAL gt22rhsL = -2*alphaL*At22L + epsdiss1*PDdissipationNth1gt22 + + epsdiss2*PDdissipationNth2gt22 + epsdiss3*PDdissipationNth3gt22 + + 2*(gt12L*PDstandardNth2beta1 + gt23L*PDstandardNth2beta3) + + gt22L*(1.33333333333333333333333333333*PDstandardNth2beta2 - + 0.666666666666666666666666666667*(PDstandardNth1beta1 + + PDstandardNth3beta3)) + beta1L*PDupwindNthAnti1gt22 + + beta2L*PDupwindNthAnti2gt22 + beta3L*PDupwindNthAnti3gt22 + + PDupwindNthSymm1gt22*Abs(beta1L) + PDupwindNthSymm2gt22*Abs(beta2L) + + PDupwindNthSymm3gt22*Abs(beta3L); + + CCTK_REAL gt23rhsL = -2*alphaL*At23L + epsdiss1*PDdissipationNth1gt23 + + epsdiss2*PDdissipationNth2gt23 + epsdiss3*PDdissipationNth3gt23 + + gt13L*PDstandardNth2beta1 + gt33L*PDstandardNth2beta3 + + gt12L*PDstandardNth3beta1 + gt22L*PDstandardNth3beta2 + + gt23L*(-0.666666666666666666666666666667*PDstandardNth1beta1 + + 0.333333333333333333333333333333*(PDstandardNth2beta2 + + PDstandardNth3beta3)) + beta1L*PDupwindNthAnti1gt23 + + beta2L*PDupwindNthAnti2gt23 + beta3L*PDupwindNthAnti3gt23 + + PDupwindNthSymm1gt23*Abs(beta1L) + PDupwindNthSymm2gt23*Abs(beta2L) + + PDupwindNthSymm3gt23*Abs(beta3L); + + CCTK_REAL gt33rhsL = -2*alphaL*At33L + epsdiss1*PDdissipationNth1gt33 + + epsdiss2*PDdissipationNth2gt33 + epsdiss3*PDdissipationNth3gt33 + + 2*(gt13L*PDstandardNth3beta1 + gt23L*PDstandardNth3beta2) + + gt33L*(-0.666666666666666666666666666667*(PDstandardNth1beta1 + + PDstandardNth2beta2) + + 1.33333333333333333333333333333*PDstandardNth3beta3) + + beta1L*PDupwindNthAnti1gt33 + beta2L*PDupwindNthAnti2gt33 + + beta3L*PDupwindNthAnti3gt33 + PDupwindNthSymm1gt33*Abs(beta1L) + + PDupwindNthSymm2gt33*Abs(beta2L) + PDupwindNthSymm3gt33*Abs(beta3L); + + CCTK_REAL dotXt1 = + 0.333333333333333333333333333333*(7*(gtu12*PDstandardNth12beta1 + + gtu13*PDstandardNth13beta1) + gtu11*(4*PDstandardNth11beta1 + + PDstandardNth12beta2 + PDstandardNth13beta3) + + gtu12*(PDstandardNth22beta2 + PDstandardNth23beta3) + + gtu13*(PDstandardNth23beta2 + PDstandardNth33beta3) - + 6*(Atu11*PDstandardNth1alpha + Atu12*PDstandardNth2alpha + + Atu13*PDstandardNth3alpha) + 6*(gtu23*PDstandardNth23beta1 + + alphaL*(6*(Atu11*cdphi1 + Atu12*cdphi2 + Atu13*cdphi3) + Atu11*Gt111 + + Atu22*Gt122 + 2*(Atu12*Gt112 + Atu13*Gt113 + Atu23*Gt123) + Atu33*Gt133 + - 0.666666666666666666666666666667*(gtu11*PDstandardNth1trK + + gtu12*PDstandardNth2trK + gtu13*PDstandardNth3trK))) - + 150.7964473723100754462068823974161384415*alphaL*(gtu11*S1 + gtu12*S2 + + gtu13*S3) + (-3*PDstandardNth1beta1 + 2*(PDstandardNth1beta1 + + PDstandardNth2beta2 + PDstandardNth3beta3))*Xtn1 - + 3*(PDstandardNth2beta1*Xtn2 + PDstandardNth3beta1*Xtn3) + + 3*(epsdiss1*PDdissipationNth1Xt1 + epsdiss2*PDdissipationNth2Xt1 + + epsdiss3*PDdissipationNth3Xt1 + gtu22*PDstandardNth22beta1 + + gtu33*PDstandardNth33beta1 + beta1L*PDupwindNthAnti1Xt1 + + beta2L*PDupwindNthAnti2Xt1 + beta3L*PDupwindNthAnti3Xt1 + + PDupwindNthSymm1Xt1*Abs(beta1L) + PDupwindNthSymm2Xt1*Abs(beta2L) + + PDupwindNthSymm3Xt1*Abs(beta3L))); + + CCTK_REAL dotXt2 = + 0.333333333333333333333333333333*(gtu12*(PDstandardNth11beta1 + + 7*PDstandardNth12beta2 + PDstandardNth13beta3) + + gtu22*(PDstandardNth12beta1 + 4*PDstandardNth22beta2 + + PDstandardNth23beta3) + gtu23*(PDstandardNth13beta1 + + 7*PDstandardNth23beta2 + PDstandardNth33beta3) - + 6*(Atu12*PDstandardNth1alpha + Atu22*PDstandardNth2alpha + + Atu23*PDstandardNth3alpha) + 6*(gtu13*PDstandardNth13beta2 + + alphaL*(6*(Atu12*cdphi1 + Atu22*cdphi2 + Atu23*cdphi3) + Atu11*Gt211 + + Atu22*Gt222 + 2*(Atu12*Gt212 + Atu13*Gt213 + Atu23*Gt223) + Atu33*Gt233 + - 0.666666666666666666666666666667*(gtu12*PDstandardNth1trK + + gtu22*PDstandardNth2trK + gtu23*PDstandardNth3trK))) - + 150.7964473723100754462068823974161384415*alphaL*(gtu12*S1 + gtu22*S2 + + gtu23*S3) + 2*(PDstandardNth1beta1 + PDstandardNth2beta2 + + PDstandardNth3beta3)*Xtn2 - 3*(PDstandardNth1beta2*Xtn1 + + PDstandardNth2beta2*Xtn2 + PDstandardNth3beta2*Xtn3) + + 3*(epsdiss1*PDdissipationNth1Xt2 + epsdiss2*PDdissipationNth2Xt2 + + epsdiss3*PDdissipationNth3Xt2 + gtu11*PDstandardNth11beta2 + + gtu33*PDstandardNth33beta2 + beta1L*PDupwindNthAnti1Xt2 + + beta2L*PDupwindNthAnti2Xt2 + beta3L*PDupwindNthAnti3Xt2 + + PDupwindNthSymm1Xt2*Abs(beta1L) + PDupwindNthSymm2Xt2*Abs(beta2L) + + PDupwindNthSymm3Xt2*Abs(beta3L))); + + CCTK_REAL dotXt3 = + 0.333333333333333333333333333333*(gtu13*(PDstandardNth11beta1 + + PDstandardNth12beta2 + 7*PDstandardNth13beta3) + + gtu23*(PDstandardNth12beta1 + PDstandardNth22beta2 + + 7*PDstandardNth23beta3) + gtu33*(PDstandardNth13beta1 + + PDstandardNth23beta2 + 4*PDstandardNth33beta3) - + 6*(Atu13*PDstandardNth1alpha + Atu23*PDstandardNth2alpha + + Atu33*PDstandardNth3alpha) + 6*(gtu12*PDstandardNth12beta3 + + alphaL*(6*(Atu13*cdphi1 + Atu23*cdphi2 + Atu33*cdphi3) + Atu11*Gt311 + + Atu22*Gt322 + 2*(Atu12*Gt312 + Atu13*Gt313 + Atu23*Gt323) + Atu33*Gt333 + - 0.666666666666666666666666666667*(gtu13*PDstandardNth1trK + + gtu23*PDstandardNth2trK + gtu33*PDstandardNth3trK))) - + 150.7964473723100754462068823974161384415*alphaL*(gtu13*S1 + gtu23*S2 + + gtu33*S3) + 2*(PDstandardNth1beta1 + PDstandardNth2beta2 + + PDstandardNth3beta3)*Xtn3 - 3*(PDstandardNth1beta3*Xtn1 + + PDstandardNth2beta3*Xtn2 + PDstandardNth3beta3*Xtn3) + + 3*(epsdiss1*PDdissipationNth1Xt3 + epsdiss2*PDdissipationNth2Xt3 + + epsdiss3*PDdissipationNth3Xt3 + gtu11*PDstandardNth11beta3 + + gtu22*PDstandardNth22beta3 + beta1L*PDupwindNthAnti1Xt3 + + beta2L*PDupwindNthAnti2Xt3 + beta3L*PDupwindNthAnti3Xt3 + + PDupwindNthSymm1Xt3*Abs(beta1L) + PDupwindNthSymm2Xt3*Abs(beta2L) + + PDupwindNthSymm3Xt3*Abs(beta3L))); + + CCTK_REAL Xt1rhsL = dotXt1; + + CCTK_REAL Xt2rhsL = dotXt2; + + CCTK_REAL Xt3rhsL = dotXt3; + + CCTK_REAL dottrK = epsdiss1*PDdissipationNth1trK + + epsdiss2*PDdissipationNth2trK + epsdiss3*PDdissipationNth3trK + + beta1L*PDupwindNthAnti1trK + beta2L*PDupwindNthAnti2trK + + beta3L*PDupwindNthAnti3trK - em4phi*(gtu11*PDstandardNth11alpha + + gtu22*PDstandardNth22alpha + gtu33*(PDstandardNth33alpha + + 2*cdphi3*PDstandardNth3alpha) + 2*(gtu12*PDstandardNth12alpha + + gtu13*(PDstandardNth13alpha + cdphi1*PDstandardNth3alpha) + + gtu23*(PDstandardNth23alpha + cdphi2*PDstandardNth3alpha)) + + PDstandardNth1alpha*(2*(cdphi1*gtu11 + cdphi2*gtu12 + cdphi3*gtu13) - + Xtn1) + PDstandardNth2alpha*(2*(cdphi1*gtu12 + cdphi2*gtu22 + + cdphi3*gtu23) - Xtn2) - PDstandardNth3alpha*Xtn3) + + PDupwindNthSymm1trK*Abs(beta1L) + PDupwindNthSymm2trK*Abs(beta2L) + + PDupwindNthSymm3trK*Abs(beta3L) + alphaL*(2*(Atm12*Atm21 + Atm13*Atm31 + + Atm23*Atm32) + 12.56637061435917295385057353311801153679*(rho + trS) + + SQR(Atm11) + SQR(Atm22) + SQR(Atm33) + + 0.333333333333333333333333333333*SQR(trKL)); + + CCTK_REAL trKrhsL = dottrK; + + CCTK_REAL alpharhsL = epsdiss1*PDdissipationNth1alpha + + epsdiss2*PDdissipationNth2alpha + epsdiss3*PDdissipationNth3alpha - + pow(alphaL,ToReal(harmonicN))*ToReal(harmonicF)*(trKL + (AL - + trKL)*ToReal(LapseACoeff)) + (beta1L*PDupwindNthAnti1alpha + + beta2L*PDupwindNthAnti2alpha + beta3L*PDupwindNthAnti3alpha + + PDupwindNthSymm1alpha*Abs(beta1L) + PDupwindNthSymm2alpha*Abs(beta2L) + + PDupwindNthSymm3alpha*Abs(beta3L))*ToReal(LapseAdvectionCoeff); + + CCTK_REAL ArhsL = epsdiss1*PDdissipationNth1A + + epsdiss2*PDdissipationNth2A + epsdiss3*PDdissipationNth3A + (dottrK - + AL*ToReal(AlphaDriver))*ToReal(LapseACoeff) + (beta1L*PDupwindNthAnti1A + + beta2L*PDupwindNthAnti2A + beta3L*PDupwindNthAnti3A + + PDupwindNthSymm1A*Abs(beta1L) + PDupwindNthSymm2A*Abs(beta2L) + + PDupwindNthSymm3A*Abs(beta3L))*ToReal(LapseAdvectionCoeff); + + CCTK_REAL eta = fmin(1,INV(rL)*ToReal(SpatialBetaDriverRadius)); + + CCTK_REAL theta = fmin(1,exp(1 - + rL*INV(ToReal(SpatialShiftGammaCoeffRadius)))); + + CCTK_REAL beta1rhsL = epsdiss1*PDdissipationNth1beta1 + + epsdiss2*PDdissipationNth2beta1 + epsdiss3*PDdissipationNth3beta1 + + (beta1L*PDupwindNthAnti1beta1 + beta2L*PDupwindNthAnti2beta1 + + beta3L*PDupwindNthAnti3beta1 + PDupwindNthSymm1beta1*Abs(beta1L) + + PDupwindNthSymm2beta1*Abs(beta2L) + + PDupwindNthSymm3beta1*Abs(beta3L))*ToReal(ShiftAdvectionCoeff) + + theta*(Xt1L + beta1L*eta*ToReal(BetaDriver)*(-1 + ToReal(ShiftBCoeff)) + + (B1L - Xt1L)*ToReal(ShiftBCoeff))*ToReal(ShiftGammaCoeff); + + CCTK_REAL beta2rhsL = epsdiss1*PDdissipationNth1beta2 + + epsdiss2*PDdissipationNth2beta2 + epsdiss3*PDdissipationNth3beta2 + + (beta1L*PDupwindNthAnti1beta2 + beta2L*PDupwindNthAnti2beta2 + + beta3L*PDupwindNthAnti3beta2 + PDupwindNthSymm1beta2*Abs(beta1L) + + PDupwindNthSymm2beta2*Abs(beta2L) + + PDupwindNthSymm3beta2*Abs(beta3L))*ToReal(ShiftAdvectionCoeff) + + theta*(Xt2L + beta2L*eta*ToReal(BetaDriver)*(-1 + ToReal(ShiftBCoeff)) + + (B2L - Xt2L)*ToReal(ShiftBCoeff))*ToReal(ShiftGammaCoeff); + + CCTK_REAL beta3rhsL = epsdiss1*PDdissipationNth1beta3 + + epsdiss2*PDdissipationNth2beta3 + epsdiss3*PDdissipationNth3beta3 + + (beta1L*PDupwindNthAnti1beta3 + beta2L*PDupwindNthAnti2beta3 + + beta3L*PDupwindNthAnti3beta3 + PDupwindNthSymm1beta3*Abs(beta1L) + + PDupwindNthSymm2beta3*Abs(beta2L) + + PDupwindNthSymm3beta3*Abs(beta3L))*ToReal(ShiftAdvectionCoeff) + + theta*(Xt3L + beta3L*eta*ToReal(BetaDriver)*(-1 + ToReal(ShiftBCoeff)) + + (B3L - Xt3L)*ToReal(ShiftBCoeff))*ToReal(ShiftGammaCoeff); + + CCTK_REAL B1rhsL = epsdiss1*PDdissipationNth1B1 + + epsdiss2*PDdissipationNth2B1 + epsdiss3*PDdissipationNth3B1 + + (beta1L*(PDupwindNthAnti1B1 - PDupwindNthAnti1Xt1) + + beta2L*(PDupwindNthAnti2B1 - PDupwindNthAnti2Xt1) + + beta3L*(PDupwindNthAnti3B1 - PDupwindNthAnti3Xt1) + (PDupwindNthSymm1B1 + - PDupwindNthSymm1Xt1)*Abs(beta1L) + (PDupwindNthSymm2B1 - + PDupwindNthSymm2Xt1)*Abs(beta2L) + (PDupwindNthSymm3B1 - + PDupwindNthSymm3Xt1)*Abs(beta3L))*ToReal(ShiftAdvectionCoeff) + (dotXt1 + - B1L*eta*ToReal(BetaDriver))*ToReal(ShiftBCoeff); + + CCTK_REAL B2rhsL = epsdiss1*PDdissipationNth1B2 + + epsdiss2*PDdissipationNth2B2 + epsdiss3*PDdissipationNth3B2 + + (beta1L*(PDupwindNthAnti1B2 - PDupwindNthAnti1Xt2) + + beta2L*(PDupwindNthAnti2B2 - PDupwindNthAnti2Xt2) + + beta3L*(PDupwindNthAnti3B2 - PDupwindNthAnti3Xt2) + (PDupwindNthSymm1B2 + - PDupwindNthSymm1Xt2)*Abs(beta1L) + (PDupwindNthSymm2B2 - + PDupwindNthSymm2Xt2)*Abs(beta2L) + (PDupwindNthSymm3B2 - + PDupwindNthSymm3Xt2)*Abs(beta3L))*ToReal(ShiftAdvectionCoeff) + (dotXt2 + - B2L*eta*ToReal(BetaDriver))*ToReal(ShiftBCoeff); + + CCTK_REAL B3rhsL = epsdiss1*PDdissipationNth1B3 + + epsdiss2*PDdissipationNth2B3 + epsdiss3*PDdissipationNth3B3 + + (beta1L*(PDupwindNthAnti1B3 - PDupwindNthAnti1Xt3) + + beta2L*(PDupwindNthAnti2B3 - PDupwindNthAnti2Xt3) + + beta3L*(PDupwindNthAnti3B3 - PDupwindNthAnti3Xt3) + (PDupwindNthSymm1B3 + - PDupwindNthSymm1Xt3)*Abs(beta1L) + (PDupwindNthSymm2B3 - + PDupwindNthSymm2Xt3)*Abs(beta2L) + (PDupwindNthSymm3B3 - + PDupwindNthSymm3Xt3)*Abs(beta3L))*ToReal(ShiftAdvectionCoeff) + (dotXt3 + - B3L*eta*ToReal(BetaDriver))*ToReal(ShiftBCoeff); + + + /* Copy local copies back to grid functions */ + alpharhs[index] = alpharhsL; + Arhs[index] = ArhsL; + B1rhs[index] = B1rhsL; + B2rhs[index] = B2rhsL; + B3rhs[index] = B3rhsL; + beta1rhs[index] = beta1rhsL; + beta2rhs[index] = beta2rhsL; + beta3rhs[index] = beta3rhsL; + gt11rhs[index] = gt11rhsL; + gt12rhs[index] = gt12rhsL; + gt13rhs[index] = gt13rhsL; + gt22rhs[index] = gt22rhsL; + gt23rhs[index] = gt23rhsL; + gt33rhs[index] = gt33rhsL; + phirhs[index] = phirhsL; + trKrhs[index] = trKrhsL; + Xt1rhs[index] = Xt1rhsL; + Xt2rhs[index] = Xt2rhsL; + Xt3rhs[index] = Xt3rhsL; + } + LC_ENDLOOP3 (ML_BSSN_O8_RHS1); +} + +extern "C" void ML_BSSN_O8_RHS1(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverInterior(cctkGH, &ML_BSSN_O8_RHS1_Body); +} diff --git a/ML_BSSN_O8/src/ML_BSSN_O8_RHS2.cc b/ML_BSSN_O8/src/ML_BSSN_O8_RHS2.cc new file mode 100644 index 0000000..e46b1ee --- /dev/null +++ b/ML_BSSN_O8/src/ML_BSSN_O8_RHS2.cc @@ -0,0 +1,800 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +extern "C" void ML_BSSN_O8_RHS2_SelectBCs(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT ierr = 0; + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_O8::ML_curvrhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_O8::ML_curvrhs."); + return; +} + +static void ML_BSSN_O8_RHS2_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_BSSN_O8_RHS2_Body"); + } + + if (cctk_iteration % ML_BSSN_O8_RHS2_calc_every != ML_BSSN_O8_RHS2_calc_offset) + { + return; + } + + const char *groups[] = {"ML_BSSN_O8::ML_curv","ML_BSSN_O8::ML_curvrhs","ML_BSSN_O8::ML_Gamma","ML_BSSN_O8::ML_lapse","ML_BSSN_O8::ML_log_confac","ML_BSSN_O8::ML_metric","ML_BSSN_O8::ML_shift","ML_BSSN_O8::ML_trace_curv"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_BSSN_O8_RHS2", 8, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o1024dx = 0.0009765625*INV(dx); + CCTK_REAL const p1o1024dy = 0.0009765625*INV(dy); + CCTK_REAL const p1o1024dz = 0.0009765625*INV(dz); + CCTK_REAL const p1o1680dx = 0.000595238095238095238095238095238*INV(dx); + CCTK_REAL const p1o1680dy = 0.000595238095238095238095238095238*INV(dy); + CCTK_REAL const p1o1680dz = 0.000595238095238095238095238095238*INV(dz); + CCTK_REAL const p1o5040dx2 = 0.000198412698412698412698412698413*INV(SQR(dx)); + CCTK_REAL const p1o5040dy2 = 0.000198412698412698412698412698413*INV(SQR(dy)); + CCTK_REAL const p1o5040dz2 = 0.000198412698412698412698412698413*INV(SQR(dz)); + CCTK_REAL const p1o560dx = 0.00178571428571428571428571428571*INV(dx); + CCTK_REAL const p1o560dy = 0.00178571428571428571428571428571*INV(dy); + CCTK_REAL const p1o560dz = 0.00178571428571428571428571428571*INV(dz); + CCTK_REAL const p1o705600dxdy = 1.41723356009070294784580498866e-6*INV(dx)*INV(dy); + CCTK_REAL const p1o705600dxdz = 1.41723356009070294784580498866e-6*INV(dx)*INV(dz); + CCTK_REAL const p1o705600dydz = 1.41723356009070294784580498866e-6*INV(dy)*INV(dz); + CCTK_REAL const p1o840dx = 0.00119047619047619047619047619048*INV(dx); + CCTK_REAL const p1o840dy = 0.00119047619047619047619047619048*INV(dy); + CCTK_REAL const p1o840dz = 0.00119047619047619047619047619048*INV(dz); + CCTK_REAL const p1odx = INV(dx); + CCTK_REAL const p1ody = INV(dy); + CCTK_REAL const p1odz = INV(dz); + CCTK_REAL const pm1o840dx = -0.00119047619047619047619047619048*INV(dx); + CCTK_REAL const pm1o840dy = -0.00119047619047619047619047619048*INV(dy); + CCTK_REAL const pm1o840dz = -0.00119047619047619047619047619048*INV(dz); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_BSSN_O8_RHS2, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + CCTK_REAL alphaL = alpha[index]; + CCTK_REAL At11L = At11[index]; + CCTK_REAL At12L = At12[index]; + CCTK_REAL At13L = At13[index]; + CCTK_REAL At22L = At22[index]; + CCTK_REAL At23L = At23[index]; + CCTK_REAL At33L = At33[index]; + CCTK_REAL beta1L = beta1[index]; + CCTK_REAL beta2L = beta2[index]; + CCTK_REAL beta3L = beta3[index]; + CCTK_REAL eTxxL = (*stress_energy_state) ? eTxx[index] : ToReal(0.0); + CCTK_REAL eTxyL = (*stress_energy_state) ? eTxy[index] : ToReal(0.0); + CCTK_REAL eTxzL = (*stress_energy_state) ? eTxz[index] : ToReal(0.0); + CCTK_REAL eTyyL = (*stress_energy_state) ? eTyy[index] : ToReal(0.0); + CCTK_REAL eTyzL = (*stress_energy_state) ? eTyz[index] : ToReal(0.0); + CCTK_REAL eTzzL = (*stress_energy_state) ? eTzz[index] : ToReal(0.0); + CCTK_REAL gt11L = gt11[index]; + CCTK_REAL gt12L = gt12[index]; + CCTK_REAL gt13L = gt13[index]; + CCTK_REAL gt22L = gt22[index]; + CCTK_REAL gt23L = gt23[index]; + CCTK_REAL gt33L = gt33[index]; + CCTK_REAL phiL = phi[index]; + CCTK_REAL trKL = trK[index]; + CCTK_REAL Xt1L = Xt1[index]; + CCTK_REAL Xt2L = Xt2[index]; + CCTK_REAL Xt3L = Xt3[index]; + + /* Include user supplied include files */ + + /* Precompute derivatives */ + CCTK_REAL const PDstandardNth1alpha = PDstandardNth1(&alpha[index]); + CCTK_REAL const PDstandardNth2alpha = PDstandardNth2(&alpha[index]); + CCTK_REAL const PDstandardNth3alpha = PDstandardNth3(&alpha[index]); + CCTK_REAL const PDstandardNth11alpha = PDstandardNth11(&alpha[index]); + CCTK_REAL const PDstandardNth22alpha = PDstandardNth22(&alpha[index]); + CCTK_REAL const PDstandardNth33alpha = PDstandardNth33(&alpha[index]); + CCTK_REAL const PDstandardNth12alpha = PDstandardNth12(&alpha[index]); + CCTK_REAL const PDstandardNth13alpha = PDstandardNth13(&alpha[index]); + CCTK_REAL const PDstandardNth23alpha = PDstandardNth23(&alpha[index]); + CCTK_REAL const PDdissipationNth1At11 = PDdissipationNth1(&At11[index]); + CCTK_REAL const PDdissipationNth2At11 = PDdissipationNth2(&At11[index]); + CCTK_REAL const PDdissipationNth3At11 = PDdissipationNth3(&At11[index]); + CCTK_REAL const PDupwindNthAnti1At11 = PDupwindNthAnti1(&At11[index]); + CCTK_REAL const PDupwindNthSymm1At11 = PDupwindNthSymm1(&At11[index]); + CCTK_REAL const PDupwindNthAnti2At11 = PDupwindNthAnti2(&At11[index]); + CCTK_REAL const PDupwindNthSymm2At11 = PDupwindNthSymm2(&At11[index]); + CCTK_REAL const PDupwindNthAnti3At11 = PDupwindNthAnti3(&At11[index]); + CCTK_REAL const PDupwindNthSymm3At11 = PDupwindNthSymm3(&At11[index]); + CCTK_REAL const PDdissipationNth1At12 = PDdissipationNth1(&At12[index]); + CCTK_REAL const PDdissipationNth2At12 = PDdissipationNth2(&At12[index]); + CCTK_REAL const PDdissipationNth3At12 = PDdissipationNth3(&At12[index]); + CCTK_REAL const PDupwindNthAnti1At12 = PDupwindNthAnti1(&At12[index]); + CCTK_REAL const PDupwindNthSymm1At12 = PDupwindNthSymm1(&At12[index]); + CCTK_REAL const PDupwindNthAnti2At12 = PDupwindNthAnti2(&At12[index]); + CCTK_REAL const PDupwindNthSymm2At12 = PDupwindNthSymm2(&At12[index]); + CCTK_REAL const PDupwindNthAnti3At12 = PDupwindNthAnti3(&At12[index]); + CCTK_REAL const PDupwindNthSymm3At12 = PDupwindNthSymm3(&At12[index]); + CCTK_REAL const PDdissipationNth1At13 = PDdissipationNth1(&At13[index]); + CCTK_REAL const PDdissipationNth2At13 = PDdissipationNth2(&At13[index]); + CCTK_REAL const PDdissipationNth3At13 = PDdissipationNth3(&At13[index]); + CCTK_REAL const PDupwindNthAnti1At13 = PDupwindNthAnti1(&At13[index]); + CCTK_REAL const PDupwindNthSymm1At13 = PDupwindNthSymm1(&At13[index]); + CCTK_REAL const PDupwindNthAnti2At13 = PDupwindNthAnti2(&At13[index]); + CCTK_REAL const PDupwindNthSymm2At13 = PDupwindNthSymm2(&At13[index]); + CCTK_REAL const PDupwindNthAnti3At13 = PDupwindNthAnti3(&At13[index]); + CCTK_REAL const PDupwindNthSymm3At13 = PDupwindNthSymm3(&At13[index]); + CCTK_REAL const PDdissipationNth1At22 = PDdissipationNth1(&At22[index]); + CCTK_REAL const PDdissipationNth2At22 = PDdissipationNth2(&At22[index]); + CCTK_REAL const PDdissipationNth3At22 = PDdissipationNth3(&At22[index]); + CCTK_REAL const PDupwindNthAnti1At22 = PDupwindNthAnti1(&At22[index]); + CCTK_REAL const PDupwindNthSymm1At22 = PDupwindNthSymm1(&At22[index]); + CCTK_REAL const PDupwindNthAnti2At22 = PDupwindNthAnti2(&At22[index]); + CCTK_REAL const PDupwindNthSymm2At22 = PDupwindNthSymm2(&At22[index]); + CCTK_REAL const PDupwindNthAnti3At22 = PDupwindNthAnti3(&At22[index]); + CCTK_REAL const PDupwindNthSymm3At22 = PDupwindNthSymm3(&At22[index]); + CCTK_REAL const PDdissipationNth1At23 = PDdissipationNth1(&At23[index]); + CCTK_REAL const PDdissipationNth2At23 = PDdissipationNth2(&At23[index]); + CCTK_REAL const PDdissipationNth3At23 = PDdissipationNth3(&At23[index]); + CCTK_REAL const PDupwindNthAnti1At23 = PDupwindNthAnti1(&At23[index]); + CCTK_REAL const PDupwindNthSymm1At23 = PDupwindNthSymm1(&At23[index]); + CCTK_REAL const PDupwindNthAnti2At23 = PDupwindNthAnti2(&At23[index]); + CCTK_REAL const PDupwindNthSymm2At23 = PDupwindNthSymm2(&At23[index]); + CCTK_REAL const PDupwindNthAnti3At23 = PDupwindNthAnti3(&At23[index]); + CCTK_REAL const PDupwindNthSymm3At23 = PDupwindNthSymm3(&At23[index]); + CCTK_REAL const PDdissipationNth1At33 = PDdissipationNth1(&At33[index]); + CCTK_REAL const PDdissipationNth2At33 = PDdissipationNth2(&At33[index]); + CCTK_REAL const PDdissipationNth3At33 = PDdissipationNth3(&At33[index]); + CCTK_REAL const PDupwindNthAnti1At33 = PDupwindNthAnti1(&At33[index]); + CCTK_REAL const PDupwindNthSymm1At33 = PDupwindNthSymm1(&At33[index]); + CCTK_REAL const PDupwindNthAnti2At33 = PDupwindNthAnti2(&At33[index]); + CCTK_REAL const PDupwindNthSymm2At33 = PDupwindNthSymm2(&At33[index]); + CCTK_REAL const PDupwindNthAnti3At33 = PDupwindNthAnti3(&At33[index]); + CCTK_REAL const PDupwindNthSymm3At33 = PDupwindNthSymm3(&At33[index]); + CCTK_REAL const PDstandardNth1beta1 = PDstandardNth1(&beta1[index]); + CCTK_REAL const PDstandardNth2beta1 = PDstandardNth2(&beta1[index]); + CCTK_REAL const PDstandardNth3beta1 = PDstandardNth3(&beta1[index]); + CCTK_REAL const PDstandardNth1beta2 = PDstandardNth1(&beta2[index]); + CCTK_REAL const PDstandardNth2beta2 = PDstandardNth2(&beta2[index]); + CCTK_REAL const PDstandardNth3beta2 = PDstandardNth3(&beta2[index]); + CCTK_REAL const PDstandardNth1beta3 = PDstandardNth1(&beta3[index]); + CCTK_REAL const PDstandardNth2beta3 = PDstandardNth2(&beta3[index]); + CCTK_REAL const PDstandardNth3beta3 = PDstandardNth3(&beta3[index]); + CCTK_REAL const PDstandardNth1gt11 = PDstandardNth1(>11[index]); + CCTK_REAL const PDstandardNth2gt11 = PDstandardNth2(>11[index]); + CCTK_REAL const PDstandardNth3gt11 = PDstandardNth3(>11[index]); + CCTK_REAL const PDstandardNth11gt11 = PDstandardNth11(>11[index]); + CCTK_REAL const PDstandardNth22gt11 = PDstandardNth22(>11[index]); + CCTK_REAL const PDstandardNth33gt11 = PDstandardNth33(>11[index]); + CCTK_REAL const PDstandardNth12gt11 = PDstandardNth12(>11[index]); + CCTK_REAL const PDstandardNth13gt11 = PDstandardNth13(>11[index]); + CCTK_REAL const PDstandardNth23gt11 = PDstandardNth23(>11[index]); + CCTK_REAL const PDstandardNth1gt12 = PDstandardNth1(>12[index]); + CCTK_REAL const PDstandardNth2gt12 = PDstandardNth2(>12[index]); + CCTK_REAL const PDstandardNth3gt12 = PDstandardNth3(>12[index]); + CCTK_REAL const PDstandardNth11gt12 = PDstandardNth11(>12[index]); + CCTK_REAL const PDstandardNth22gt12 = PDstandardNth22(>12[index]); + CCTK_REAL const PDstandardNth33gt12 = PDstandardNth33(>12[index]); + CCTK_REAL const PDstandardNth12gt12 = PDstandardNth12(>12[index]); + CCTK_REAL const PDstandardNth13gt12 = PDstandardNth13(>12[index]); + CCTK_REAL const PDstandardNth23gt12 = PDstandardNth23(>12[index]); + CCTK_REAL const PDstandardNth1gt13 = PDstandardNth1(>13[index]); + CCTK_REAL const PDstandardNth2gt13 = PDstandardNth2(>13[index]); + CCTK_REAL const PDstandardNth3gt13 = PDstandardNth3(>13[index]); + CCTK_REAL const PDstandardNth11gt13 = PDstandardNth11(>13[index]); + CCTK_REAL const PDstandardNth22gt13 = PDstandardNth22(>13[index]); + CCTK_REAL const PDstandardNth33gt13 = PDstandardNth33(>13[index]); + CCTK_REAL const PDstandardNth12gt13 = PDstandardNth12(>13[index]); + CCTK_REAL const PDstandardNth13gt13 = PDstandardNth13(>13[index]); + CCTK_REAL const PDstandardNth23gt13 = PDstandardNth23(>13[index]); + CCTK_REAL const PDstandardNth1gt22 = PDstandardNth1(>22[index]); + CCTK_REAL const PDstandardNth2gt22 = PDstandardNth2(>22[index]); + CCTK_REAL const PDstandardNth3gt22 = PDstandardNth3(>22[index]); + CCTK_REAL const PDstandardNth11gt22 = PDstandardNth11(>22[index]); + CCTK_REAL const PDstandardNth22gt22 = PDstandardNth22(>22[index]); + CCTK_REAL const PDstandardNth33gt22 = PDstandardNth33(>22[index]); + CCTK_REAL const PDstandardNth12gt22 = PDstandardNth12(>22[index]); + CCTK_REAL const PDstandardNth13gt22 = PDstandardNth13(>22[index]); + CCTK_REAL const PDstandardNth23gt22 = PDstandardNth23(>22[index]); + CCTK_REAL const PDstandardNth1gt23 = PDstandardNth1(>23[index]); + CCTK_REAL const PDstandardNth2gt23 = PDstandardNth2(>23[index]); + CCTK_REAL const PDstandardNth3gt23 = PDstandardNth3(>23[index]); + CCTK_REAL const PDstandardNth11gt23 = PDstandardNth11(>23[index]); + CCTK_REAL const PDstandardNth22gt23 = PDstandardNth22(>23[index]); + CCTK_REAL const PDstandardNth33gt23 = PDstandardNth33(>23[index]); + CCTK_REAL const PDstandardNth12gt23 = PDstandardNth12(>23[index]); + CCTK_REAL const PDstandardNth13gt23 = PDstandardNth13(>23[index]); + CCTK_REAL const PDstandardNth23gt23 = PDstandardNth23(>23[index]); + CCTK_REAL const PDstandardNth1gt33 = PDstandardNth1(>33[index]); + CCTK_REAL const PDstandardNth2gt33 = PDstandardNth2(>33[index]); + CCTK_REAL const PDstandardNth3gt33 = PDstandardNth3(>33[index]); + CCTK_REAL const PDstandardNth11gt33 = PDstandardNth11(>33[index]); + CCTK_REAL const PDstandardNth22gt33 = PDstandardNth22(>33[index]); + CCTK_REAL const PDstandardNth33gt33 = PDstandardNth33(>33[index]); + CCTK_REAL const PDstandardNth12gt33 = PDstandardNth12(>33[index]); + CCTK_REAL const PDstandardNth13gt33 = PDstandardNth13(>33[index]); + CCTK_REAL const PDstandardNth23gt33 = PDstandardNth23(>33[index]); + CCTK_REAL const PDstandardNth1phi = PDstandardNth1(&phi[index]); + CCTK_REAL const PDstandardNth2phi = PDstandardNth2(&phi[index]); + CCTK_REAL const PDstandardNth3phi = PDstandardNth3(&phi[index]); + CCTK_REAL const PDstandardNth11phi = PDstandardNth11(&phi[index]); + CCTK_REAL const PDstandardNth22phi = PDstandardNth22(&phi[index]); + CCTK_REAL const PDstandardNth33phi = PDstandardNth33(&phi[index]); + CCTK_REAL const PDstandardNth12phi = PDstandardNth12(&phi[index]); + CCTK_REAL const PDstandardNth13phi = PDstandardNth13(&phi[index]); + CCTK_REAL const PDstandardNth23phi = PDstandardNth23(&phi[index]); + CCTK_REAL const PDstandardNth1Xt1 = PDstandardNth1(&Xt1[index]); + CCTK_REAL const PDstandardNth2Xt1 = PDstandardNth2(&Xt1[index]); + CCTK_REAL const PDstandardNth3Xt1 = PDstandardNth3(&Xt1[index]); + CCTK_REAL const PDstandardNth1Xt2 = PDstandardNth1(&Xt2[index]); + CCTK_REAL const PDstandardNth2Xt2 = PDstandardNth2(&Xt2[index]); + CCTK_REAL const PDstandardNth3Xt2 = PDstandardNth3(&Xt2[index]); + CCTK_REAL const PDstandardNth1Xt3 = PDstandardNth1(&Xt3[index]); + CCTK_REAL const PDstandardNth2Xt3 = PDstandardNth2(&Xt3[index]); + CCTK_REAL const PDstandardNth3Xt3 = PDstandardNth3(&Xt3[index]); + + /* Calculate temporaries and grid functions */ + ptrdiff_t dir1 = Sign(beta1L); + + ptrdiff_t dir2 = Sign(beta2L); + + ptrdiff_t dir3 = Sign(beta3L); + + CCTK_REAL epsdiss1 = ToReal(EpsDiss); + + CCTK_REAL epsdiss2 = ToReal(EpsDiss); + + CCTK_REAL epsdiss3 = ToReal(EpsDiss); + + CCTK_REAL detgt = 1; + + CCTK_REAL gtu11 = INV(detgt)*(gt22L*gt33L - SQR(gt23L)); + + CCTK_REAL gtu12 = (gt13L*gt23L - gt12L*gt33L)*INV(detgt); + + CCTK_REAL gtu13 = (-(gt13L*gt22L) + gt12L*gt23L)*INV(detgt); + + CCTK_REAL gtu22 = INV(detgt)*(gt11L*gt33L - SQR(gt13L)); + + CCTK_REAL gtu23 = (gt12L*gt13L - gt11L*gt23L)*INV(detgt); + + CCTK_REAL gtu33 = INV(detgt)*(gt11L*gt22L - SQR(gt12L)); + + CCTK_REAL Gtl111 = 0.5*PDstandardNth1gt11; + + CCTK_REAL Gtl112 = 0.5*PDstandardNth2gt11; + + CCTK_REAL Gtl113 = 0.5*PDstandardNth3gt11; + + CCTK_REAL Gtl122 = -0.5*PDstandardNth1gt22 + PDstandardNth2gt12; + + CCTK_REAL Gtl123 = 0.5*(-PDstandardNth1gt23 + PDstandardNth2gt13 + + PDstandardNth3gt12); + + CCTK_REAL Gtl133 = -0.5*PDstandardNth1gt33 + PDstandardNth3gt13; + + CCTK_REAL Gtl211 = PDstandardNth1gt12 - 0.5*PDstandardNth2gt11; + + CCTK_REAL Gtl212 = 0.5*PDstandardNth1gt22; + + CCTK_REAL Gtl213 = 0.5*(PDstandardNth1gt23 - PDstandardNth2gt13 + + PDstandardNth3gt12); + + CCTK_REAL Gtl222 = 0.5*PDstandardNth2gt22; + + CCTK_REAL Gtl223 = 0.5*PDstandardNth3gt22; + + CCTK_REAL Gtl233 = -0.5*PDstandardNth2gt33 + PDstandardNth3gt23; + + CCTK_REAL Gtl311 = PDstandardNth1gt13 - 0.5*PDstandardNth3gt11; + + CCTK_REAL Gtl312 = 0.5*(PDstandardNth1gt23 + PDstandardNth2gt13 - + PDstandardNth3gt12); + + CCTK_REAL Gtl313 = 0.5*PDstandardNth1gt33; + + CCTK_REAL Gtl322 = PDstandardNth2gt23 - 0.5*PDstandardNth3gt22; + + CCTK_REAL Gtl323 = 0.5*PDstandardNth2gt33; + + CCTK_REAL Gtl333 = 0.5*PDstandardNth3gt33; + + CCTK_REAL Gtlu111 = Gtl111*gtu11 + Gtl112*gtu12 + Gtl113*gtu13; + + CCTK_REAL Gtlu112 = Gtl111*gtu12 + Gtl112*gtu22 + Gtl113*gtu23; + + CCTK_REAL Gtlu113 = Gtl111*gtu13 + Gtl112*gtu23 + Gtl113*gtu33; + + CCTK_REAL Gtlu121 = Gtl112*gtu11 + Gtl122*gtu12 + Gtl123*gtu13; + + CCTK_REAL Gtlu122 = Gtl112*gtu12 + Gtl122*gtu22 + Gtl123*gtu23; + + CCTK_REAL Gtlu123 = Gtl112*gtu13 + Gtl122*gtu23 + Gtl123*gtu33; + + CCTK_REAL Gtlu131 = Gtl113*gtu11 + Gtl123*gtu12 + Gtl133*gtu13; + + CCTK_REAL Gtlu132 = Gtl113*gtu12 + Gtl123*gtu22 + Gtl133*gtu23; + + CCTK_REAL Gtlu133 = Gtl113*gtu13 + Gtl123*gtu23 + Gtl133*gtu33; + + CCTK_REAL Gtlu211 = Gtl211*gtu11 + Gtl212*gtu12 + Gtl213*gtu13; + + CCTK_REAL Gtlu212 = Gtl211*gtu12 + Gtl212*gtu22 + Gtl213*gtu23; + + CCTK_REAL Gtlu213 = Gtl211*gtu13 + Gtl212*gtu23 + Gtl213*gtu33; + + CCTK_REAL Gtlu221 = Gtl212*gtu11 + Gtl222*gtu12 + Gtl223*gtu13; + + CCTK_REAL Gtlu222 = Gtl212*gtu12 + Gtl222*gtu22 + Gtl223*gtu23; + + CCTK_REAL Gtlu223 = Gtl212*gtu13 + Gtl222*gtu23 + Gtl223*gtu33; + + CCTK_REAL Gtlu231 = Gtl213*gtu11 + Gtl223*gtu12 + Gtl233*gtu13; + + CCTK_REAL Gtlu232 = Gtl213*gtu12 + Gtl223*gtu22 + Gtl233*gtu23; + + CCTK_REAL Gtlu233 = Gtl213*gtu13 + Gtl223*gtu23 + Gtl233*gtu33; + + CCTK_REAL Gtlu311 = Gtl311*gtu11 + Gtl312*gtu12 + Gtl313*gtu13; + + CCTK_REAL Gtlu312 = Gtl311*gtu12 + Gtl312*gtu22 + Gtl313*gtu23; + + CCTK_REAL Gtlu313 = Gtl311*gtu13 + Gtl312*gtu23 + Gtl313*gtu33; + + CCTK_REAL Gtlu321 = Gtl312*gtu11 + Gtl322*gtu12 + Gtl323*gtu13; + + CCTK_REAL Gtlu322 = Gtl312*gtu12 + Gtl322*gtu22 + Gtl323*gtu23; + + CCTK_REAL Gtlu323 = Gtl312*gtu13 + Gtl322*gtu23 + Gtl323*gtu33; + + CCTK_REAL Gtlu331 = Gtl313*gtu11 + Gtl323*gtu12 + Gtl333*gtu13; + + CCTK_REAL Gtlu332 = Gtl313*gtu12 + Gtl323*gtu22 + Gtl333*gtu23; + + CCTK_REAL Gtlu333 = Gtl313*gtu13 + Gtl323*gtu23 + Gtl333*gtu33; + + CCTK_REAL Gt111 = Gtl111*gtu11 + Gtl211*gtu12 + Gtl311*gtu13; + + CCTK_REAL Gt211 = Gtl111*gtu12 + Gtl211*gtu22 + Gtl311*gtu23; + + CCTK_REAL Gt311 = Gtl111*gtu13 + Gtl211*gtu23 + Gtl311*gtu33; + + CCTK_REAL Gt112 = Gtl112*gtu11 + Gtl212*gtu12 + Gtl312*gtu13; + + CCTK_REAL Gt212 = Gtl112*gtu12 + Gtl212*gtu22 + Gtl312*gtu23; + + CCTK_REAL Gt312 = Gtl112*gtu13 + Gtl212*gtu23 + Gtl312*gtu33; + + CCTK_REAL Gt113 = Gtl113*gtu11 + Gtl213*gtu12 + Gtl313*gtu13; + + CCTK_REAL Gt213 = Gtl113*gtu12 + Gtl213*gtu22 + Gtl313*gtu23; + + CCTK_REAL Gt313 = Gtl113*gtu13 + Gtl213*gtu23 + Gtl313*gtu33; + + CCTK_REAL Gt122 = Gtl122*gtu11 + Gtl222*gtu12 + Gtl322*gtu13; + + CCTK_REAL Gt222 = Gtl122*gtu12 + Gtl222*gtu22 + Gtl322*gtu23; + + CCTK_REAL Gt322 = Gtl122*gtu13 + Gtl222*gtu23 + Gtl322*gtu33; + + CCTK_REAL Gt123 = Gtl123*gtu11 + Gtl223*gtu12 + Gtl323*gtu13; + + CCTK_REAL Gt223 = Gtl123*gtu12 + Gtl223*gtu22 + Gtl323*gtu23; + + CCTK_REAL Gt323 = Gtl123*gtu13 + Gtl223*gtu23 + Gtl323*gtu33; + + CCTK_REAL Gt133 = Gtl133*gtu11 + Gtl233*gtu12 + Gtl333*gtu13; + + CCTK_REAL Gt233 = Gtl133*gtu12 + Gtl233*gtu22 + Gtl333*gtu23; + + CCTK_REAL Gt333 = Gtl133*gtu13 + Gtl233*gtu23 + Gtl333*gtu33; + + CCTK_REAL Xtn1 = Gt111*gtu11 + Gt122*gtu22 + 2*(Gt112*gtu12 + + Gt113*gtu13 + Gt123*gtu23) + Gt133*gtu33; + + CCTK_REAL Xtn2 = Gt211*gtu11 + Gt222*gtu22 + 2*(Gt212*gtu12 + + Gt213*gtu13 + Gt223*gtu23) + Gt233*gtu33; + + CCTK_REAL Xtn3 = Gt311*gtu11 + Gt322*gtu22 + 2*(Gt312*gtu12 + + Gt313*gtu13 + Gt323*gtu23) + Gt333*gtu33; + + CCTK_REAL Rt11 = 3*(Gt111*Gtlu111 + Gt112*Gtlu112 + Gt113*Gtlu113) + + 2*(Gt211*Gtlu121 + Gt212*Gtlu122 + Gt213*Gtlu123 + Gt311*Gtlu131 + + Gt312*Gtlu132 + Gt313*Gtlu133) + Gt211*Gtlu211 + Gt212*Gtlu212 + + Gt213*Gtlu213 + Gt311*Gtlu311 + Gt312*Gtlu312 + Gt313*Gtlu313 + + gt11L*PDstandardNth1Xt1 + gt12L*PDstandardNth1Xt2 + + gt13L*PDstandardNth1Xt3 + 0.5*(-(gtu11*PDstandardNth11gt11) - + 2*gtu12*PDstandardNth12gt11 - 2*gtu13*PDstandardNth13gt11 - + gtu22*PDstandardNth22gt11 - 2*gtu23*PDstandardNth23gt11 - + gtu33*PDstandardNth33gt11) + Gtl111*Xtn1 + Gtl112*Xtn2 + Gtl113*Xtn3; + + CCTK_REAL Rt12 = 0.5*(4*(Gt211*Gtlu221 + Gt212*Gtlu222 + + Gt213*Gtlu223) + 2*(Gt112*Gtlu111 + Gt122*Gtlu112 + Gt123*Gtlu113 + + Gt111*Gtlu121 + Gt212*Gtlu121 + Gt112*Gtlu122 + Gt222*Gtlu122 + + Gt113*Gtlu123 + Gt223*Gtlu123 + Gt312*Gtlu131 + Gt322*Gtlu132 + + Gt323*Gtlu133 + Gt111*Gtlu211 + Gt112*Gtlu212 + Gt113*Gtlu213 + + Gt311*Gtlu231 + Gt312*Gtlu232 + Gt313*Gtlu233 + Gt311*Gtlu321 + + Gt312*Gtlu322 + Gt313*Gtlu323) - gtu11*PDstandardNth11gt12 - + 2*gtu12*PDstandardNth12gt12 - 2*gtu13*PDstandardNth13gt12 + + gt12L*PDstandardNth1Xt1 + gt22L*PDstandardNth1Xt2 + + gt23L*PDstandardNth1Xt3 - gtu22*PDstandardNth22gt12 - + 2*gtu23*PDstandardNth23gt12 + gt11L*PDstandardNth2Xt1 + + gt12L*PDstandardNth2Xt2 + gt13L*PDstandardNth2Xt3 - + gtu33*PDstandardNth33gt12 + Gtl112*Xtn1 + Gtl211*Xtn1 + Gtl122*Xtn2 + + Gtl212*Xtn2 + Gtl123*Xtn3 + Gtl213*Xtn3); + + CCTK_REAL Rt13 = 0.5*(2*(Gt113*Gtlu111 + Gt123*Gtlu112 + Gt133*Gtlu113 + + Gt213*Gtlu121 + Gt223*Gtlu122 + Gt233*Gtlu123 + Gt111*Gtlu131 + + Gt313*Gtlu131 + Gt112*Gtlu132 + Gt323*Gtlu132 + Gt113*Gtlu133 + + Gt333*Gtlu133 + Gt211*Gtlu231 + Gt212*Gtlu232 + Gt213*Gtlu233 + + Gt111*Gtlu311 + Gt112*Gtlu312 + Gt113*Gtlu313 + Gt211*Gtlu321 + + Gt212*Gtlu322 + Gt213*Gtlu323) + 4*(Gt311*Gtlu331 + Gt312*Gtlu332 + + Gt313*Gtlu333) - gtu11*PDstandardNth11gt13 - + 2*gtu12*PDstandardNth12gt13 - 2*gtu13*PDstandardNth13gt13 + + gt13L*PDstandardNth1Xt1 + gt23L*PDstandardNth1Xt2 + + gt33L*PDstandardNth1Xt3 - gtu22*PDstandardNth22gt13 - + 2*gtu23*PDstandardNth23gt13 - gtu33*PDstandardNth33gt13 + + gt11L*PDstandardNth3Xt1 + gt12L*PDstandardNth3Xt2 + + gt13L*PDstandardNth3Xt3 + Gtl113*Xtn1 + Gtl311*Xtn1 + Gtl123*Xtn2 + + Gtl312*Xtn2 + Gtl133*Xtn3 + Gtl313*Xtn3); + + CCTK_REAL Rt22 = Gt112*(Gtlu121 + 2*Gtlu211) + Gt122*(Gtlu122 + + 2*Gtlu212) + Gt123*(Gtlu123 + 2*Gtlu213) + 3*(Gt212*Gtlu221 + + Gt222*Gtlu222 + Gt223*Gtlu223) + 2*(Gt312*Gtlu231 + Gt322*Gtlu232 + + Gt323*Gtlu233) + Gt312*Gtlu321 + Gt322*Gtlu322 + Gt323*Gtlu323 + + gt12L*PDstandardNth2Xt1 + gt22L*PDstandardNth2Xt2 + + gt23L*PDstandardNth2Xt3 + 0.5*(-(gtu11*PDstandardNth11gt22) - + 2*gtu12*PDstandardNth12gt22 - 2*gtu13*PDstandardNth13gt22 - + gtu22*PDstandardNth22gt22 - 2*gtu23*PDstandardNth23gt22 - + gtu33*PDstandardNth33gt22) + Gtl212*Xtn1 + Gtl222*Xtn2 + Gtl223*Xtn3; + + CCTK_REAL Rt23 = 0.5*(2*(Gt112*Gtlu131 + Gt122*Gtlu132 + Gt123*Gtlu133 + + Gt113*Gtlu211 + Gt123*Gtlu212 + Gt133*Gtlu213 + Gt213*Gtlu221 + + Gt223*Gtlu222 + Gt233*Gtlu223 + Gt212*Gtlu231 + Gt313*Gtlu231 + + Gt222*Gtlu232 + Gt323*Gtlu232 + Gt223*Gtlu233 + Gt333*Gtlu233 + + Gt112*Gtlu311 + Gt122*Gtlu312 + Gt123*Gtlu313 + Gt212*Gtlu321 + + Gt222*Gtlu322 + Gt223*Gtlu323) + 4*(Gt312*Gtlu331 + Gt322*Gtlu332 + + Gt323*Gtlu333) - gtu11*PDstandardNth11gt23 - + 2*gtu12*PDstandardNth12gt23 - 2*gtu13*PDstandardNth13gt23 - + gtu22*PDstandardNth22gt23 - 2*gtu23*PDstandardNth23gt23 + + gt13L*PDstandardNth2Xt1 + gt23L*PDstandardNth2Xt2 + + gt33L*PDstandardNth2Xt3 - gtu33*PDstandardNth33gt23 + + gt12L*PDstandardNth3Xt1 + gt22L*PDstandardNth3Xt2 + + gt23L*PDstandardNth3Xt3 + Gtl213*Xtn1 + Gtl312*Xtn1 + Gtl223*Xtn2 + + Gtl322*Xtn2 + Gtl233*Xtn3 + Gtl323*Xtn3); + + CCTK_REAL Rt33 = Gt113*(Gtlu131 + 2*Gtlu311) + Gt123*(Gtlu132 + + 2*Gtlu312) + Gt133*(Gtlu133 + 2*Gtlu313) + Gt213*(Gtlu231 + 2*Gtlu321) + + Gt223*(Gtlu232 + 2*Gtlu322) + Gt233*(Gtlu233 + 2*Gtlu323) + + 3*(Gt313*Gtlu331 + Gt323*Gtlu332 + Gt333*Gtlu333) + + 0.5*(-(gtu11*PDstandardNth11gt33) - 2*gtu12*PDstandardNth12gt33 - + 2*gtu13*PDstandardNth13gt33 - gtu22*PDstandardNth22gt33 - + 2*gtu23*PDstandardNth23gt33 - gtu33*PDstandardNth33gt33) + + gt13L*PDstandardNth3Xt1 + gt23L*PDstandardNth3Xt2 + + gt33L*PDstandardNth3Xt3 + Gtl313*Xtn1 + Gtl323*Xtn2 + Gtl333*Xtn3; + + CCTK_REAL fac1 = IfThen(ToReal(conformalMethod),-0.5*INV(phiL),1); + + CCTK_REAL cdphi1 = fac1*PDstandardNth1phi; + + CCTK_REAL cdphi2 = fac1*PDstandardNth2phi; + + CCTK_REAL cdphi3 = fac1*PDstandardNth3phi; + + CCTK_REAL fac2 = IfThen(ToReal(conformalMethod),0.5*INV(SQR(phiL)),0); + + CCTK_REAL cdphi211 = -(fac1*(-PDstandardNth11phi + + Gt111*PDstandardNth1phi + Gt211*PDstandardNth2phi + + Gt311*PDstandardNth3phi)) + fac2*SQR(PDstandardNth1phi); + + CCTK_REAL cdphi212 = fac2*PDstandardNth1phi*PDstandardNth2phi - + fac1*(-PDstandardNth12phi + Gt112*PDstandardNth1phi + + Gt212*PDstandardNth2phi + Gt312*PDstandardNth3phi); + + CCTK_REAL cdphi213 = fac2*PDstandardNth1phi*PDstandardNth3phi - + fac1*(-PDstandardNth13phi + Gt113*PDstandardNth1phi + + Gt213*PDstandardNth2phi + Gt313*PDstandardNth3phi); + + CCTK_REAL cdphi222 = -(fac1*(Gt122*PDstandardNth1phi - + PDstandardNth22phi + Gt222*PDstandardNth2phi + + Gt322*PDstandardNth3phi)) + fac2*SQR(PDstandardNth2phi); + + CCTK_REAL cdphi223 = fac2*PDstandardNth2phi*PDstandardNth3phi - + fac1*(Gt123*PDstandardNth1phi - PDstandardNth23phi + + Gt223*PDstandardNth2phi + Gt323*PDstandardNth3phi); + + CCTK_REAL cdphi233 = -(fac1*(Gt133*PDstandardNth1phi + + Gt233*PDstandardNth2phi - PDstandardNth33phi + + Gt333*PDstandardNth3phi)) + fac2*SQR(PDstandardNth3phi); + + CCTK_REAL Rphi11 = -2*(cdphi211 + 2*(-1 + gt11L*gtu11)*SQR(cdphi1) + + gt11L*(cdphi211*gtu11 + 4*(cdphi1*(cdphi2*gtu12 + cdphi3*gtu13) + + cdphi2*cdphi3*gtu23) + cdphi233*gtu33 + gtu22*(cdphi222 + + 2*SQR(cdphi2)) + 2*(cdphi212*gtu12 + cdphi213*gtu13 + cdphi223*gtu23 + + gtu33*SQR(cdphi3)))); + + CCTK_REAL Rphi12 = -2*(cdphi212 + cdphi1*(cdphi2*(-2 + 4*gt12L*gtu12) + + 4*cdphi3*gt12L*gtu13) + gt12L*(cdphi211*gtu11 + 4*cdphi2*cdphi3*gtu23 + + 2*(cdphi212*gtu12 + cdphi213*gtu13 + cdphi223*gtu23 + + gtu11*SQR(cdphi1)) + gtu22*(cdphi222 + 2*SQR(cdphi2)) + gtu33*(cdphi233 + + 2*SQR(cdphi3)))); + + CCTK_REAL Rphi13 = -2*(cdphi213 + cdphi1*(4*cdphi2*gt13L*gtu12 + + cdphi3*(-2 + 4*gt13L*gtu13)) + gt13L*(cdphi211*gtu11 + + 4*cdphi2*cdphi3*gtu23 + 2*(cdphi212*gtu12 + cdphi213*gtu13 + + cdphi223*gtu23 + gtu11*SQR(cdphi1)) + gtu22*(cdphi222 + 2*SQR(cdphi2)) + + gtu33*(cdphi233 + 2*SQR(cdphi3)))); + + CCTK_REAL Rphi22 = -2*(cdphi222 + 2*(-1 + gt22L*gtu22)*SQR(cdphi2) + + gt22L*(cdphi222*gtu22 + 4*(cdphi1*cdphi3*gtu13 + cdphi2*(cdphi1*gtu12 + + cdphi3*gtu23)) + cdphi233*gtu33 + gtu11*(cdphi211 + 2*SQR(cdphi1)) + + 2*(cdphi212*gtu12 + cdphi213*gtu13 + cdphi223*gtu23 + + gtu33*SQR(cdphi3)))); + + CCTK_REAL Rphi23 = -2*(cdphi223 + cdphi2*(4*cdphi1*gt23L*gtu12 + + cdphi3*(-2 + 4*gt23L*gtu23)) + gt23L*(4*cdphi1*cdphi3*gtu13 + + cdphi222*gtu22 + gtu11*(cdphi211 + 2*SQR(cdphi1)) + 2*(cdphi212*gtu12 + + cdphi213*gtu13 + cdphi223*gtu23 + gtu22*SQR(cdphi2)) + gtu33*(cdphi233 + + 2*SQR(cdphi3)))); + + CCTK_REAL Rphi33 = -2*(cdphi233 + gt33L*((4*cdphi1*cdphi2 + + 2*cdphi212)*gtu12 + 4*cdphi3*(cdphi1*gtu13 + cdphi2*gtu23) + + 2*(cdphi213*gtu13 + cdphi223*gtu23) + cdphi233*gtu33 + gtu11*(cdphi211 + + 2*SQR(cdphi1)) + gtu22*(cdphi222 + 2*SQR(cdphi2))) + 2*(-1 + + gt33L*gtu33)*SQR(cdphi3)); + + CCTK_REAL Atm11 = At11L*gtu11 + At12L*gtu12 + At13L*gtu13; + + CCTK_REAL Atm21 = At11L*gtu12 + At12L*gtu22 + At13L*gtu23; + + CCTK_REAL Atm31 = At11L*gtu13 + At12L*gtu23 + At13L*gtu33; + + CCTK_REAL Atm12 = At12L*gtu11 + At22L*gtu12 + At23L*gtu13; + + CCTK_REAL Atm22 = At12L*gtu12 + At22L*gtu22 + At23L*gtu23; + + CCTK_REAL Atm32 = At12L*gtu13 + At22L*gtu23 + At23L*gtu33; + + CCTK_REAL Atm13 = At13L*gtu11 + At23L*gtu12 + At33L*gtu13; + + CCTK_REAL Atm23 = At13L*gtu12 + At23L*gtu22 + At33L*gtu23; + + CCTK_REAL Atm33 = At13L*gtu13 + At23L*gtu23 + At33L*gtu33; + + CCTK_REAL e4phi = + IfThen(ToReal(conformalMethod),INV(SQR(phiL)),exp(4*phiL)); + + CCTK_REAL em4phi = INV(e4phi); + + CCTK_REAL g11 = e4phi*gt11L; + + CCTK_REAL g12 = e4phi*gt12L; + + CCTK_REAL g13 = e4phi*gt13L; + + CCTK_REAL g22 = e4phi*gt22L; + + CCTK_REAL g23 = e4phi*gt23L; + + CCTK_REAL g33 = e4phi*gt33L; + + CCTK_REAL gu11 = em4phi*gtu11; + + CCTK_REAL gu12 = em4phi*gtu12; + + CCTK_REAL gu13 = em4phi*gtu13; + + CCTK_REAL gu22 = em4phi*gtu22; + + CCTK_REAL gu23 = em4phi*gtu23; + + CCTK_REAL gu33 = em4phi*gtu33; + + CCTK_REAL R11 = Rphi11 + Rt11; + + CCTK_REAL R12 = Rphi12 + Rt12; + + CCTK_REAL R13 = Rphi13 + Rt13; + + CCTK_REAL R22 = Rphi22 + Rt22; + + CCTK_REAL R23 = Rphi23 + Rt23; + + CCTK_REAL R33 = Rphi33 + Rt33; + + CCTK_REAL trS = em4phi*(eTxxL*gtu11 + eTyyL*gtu22 + 2*(eTxyL*gtu12 + + eTxzL*gtu13 + eTyzL*gtu23) + eTzzL*gtu33); + + CCTK_REAL Ats11 = -PDstandardNth11alpha + (4*cdphi1 + + Gt111)*PDstandardNth1alpha + Gt211*PDstandardNth2alpha + + Gt311*PDstandardNth3alpha + alphaL*R11; + + CCTK_REAL Ats12 = -PDstandardNth12alpha + (2*cdphi2 + + Gt112)*PDstandardNth1alpha + (2*cdphi1 + Gt212)*PDstandardNth2alpha + + Gt312*PDstandardNth3alpha + alphaL*R12; + + CCTK_REAL Ats13 = -PDstandardNth13alpha + (2*cdphi3 + + Gt113)*PDstandardNth1alpha + Gt213*PDstandardNth2alpha + (2*cdphi1 + + Gt313)*PDstandardNth3alpha + alphaL*R13; + + CCTK_REAL Ats22 = Gt122*PDstandardNth1alpha - PDstandardNth22alpha + + (4*cdphi2 + Gt222)*PDstandardNth2alpha + Gt322*PDstandardNth3alpha + + alphaL*R22; + + CCTK_REAL Ats23 = Gt123*PDstandardNth1alpha - PDstandardNth23alpha + + (2*cdphi3 + Gt223)*PDstandardNth2alpha + (2*cdphi2 + + Gt323)*PDstandardNth3alpha + alphaL*R23; + + CCTK_REAL Ats33 = Gt133*PDstandardNth1alpha + + Gt233*PDstandardNth2alpha - PDstandardNth33alpha + (4*cdphi3 + + Gt333)*PDstandardNth3alpha + alphaL*R33; + + CCTK_REAL trAts = Ats11*gu11 + Ats22*gu22 + 2*(Ats12*gu12 + Ats13*gu13 + + Ats23*gu23) + Ats33*gu33; + + CCTK_REAL At11rhsL = -2.*alphaL*(At11L*Atm11 + At12L*Atm21 + + At13L*Atm31) + epsdiss1*PDdissipationNth1At11 + + epsdiss2*PDdissipationNth2At11 + epsdiss3*PDdissipationNth3At11 + + 2.*(At12L*PDstandardNth1beta2 + At13L*PDstandardNth1beta3) + + beta1L*PDupwindNthAnti1At11 + beta2L*PDupwindNthAnti2At11 + + beta3L*PDupwindNthAnti3At11 + + At11L*(1.333333333333333333333333333333333333333*PDstandardNth1beta1 - + 0.6666666666666666666666666666666666666667*(PDstandardNth2beta2 + + PDstandardNth3beta3) + alphaL*trKL) + em4phi*(Ats11 - + 0.3333333333333333333333333333333333333333*g11*trAts + + alphaL*(-25.13274122871834590770114706623602307358*eTxxL + + 8.377580409572781969233715688745341024526*g11*trS)) + + PDupwindNthSymm1At11*Abs(beta1L) + PDupwindNthSymm2At11*Abs(beta2L) + + PDupwindNthSymm3At11*Abs(beta3L); + + CCTK_REAL At12rhsL = -2.*alphaL*(At11L*Atm12 + At12L*Atm22 + + At13L*Atm32) + epsdiss1*PDdissipationNth1At12 + + epsdiss2*PDdissipationNth2At12 + epsdiss3*PDdissipationNth3At12 + + At22L*PDstandardNth1beta2 + At23L*PDstandardNth1beta3 + + At11L*PDstandardNth2beta1 + At13L*PDstandardNth2beta3 + + beta1L*PDupwindNthAnti1At12 + beta2L*PDupwindNthAnti2At12 + + beta3L*PDupwindNthAnti3At12 + + At12L*(0.3333333333333333333333333333333333333333*(PDstandardNth1beta1 + + PDstandardNth2beta2) - + 0.6666666666666666666666666666666666666667*PDstandardNth3beta3 + + alphaL*trKL) + em4phi*(Ats12 - + 0.3333333333333333333333333333333333333333*g12*trAts + + alphaL*(-25.13274122871834590770114706623602307358*eTxyL + + 8.377580409572781969233715688745341024526*g12*trS)) + + PDupwindNthSymm1At12*Abs(beta1L) + PDupwindNthSymm2At12*Abs(beta2L) + + PDupwindNthSymm3At12*Abs(beta3L); + + CCTK_REAL At13rhsL = -2.*alphaL*(At11L*Atm13 + At12L*Atm23 + + At13L*Atm33) + epsdiss1*PDdissipationNth1At13 + + epsdiss2*PDdissipationNth2At13 + epsdiss3*PDdissipationNth3At13 + + At23L*PDstandardNth1beta2 + At33L*PDstandardNth1beta3 + + At11L*PDstandardNth3beta1 + At12L*PDstandardNth3beta2 + + beta1L*PDupwindNthAnti1At13 + beta2L*PDupwindNthAnti2At13 + + beta3L*PDupwindNthAnti3At13 + + At13L*(-0.6666666666666666666666666666666666666667*PDstandardNth2beta2 + + 0.3333333333333333333333333333333333333333*(PDstandardNth1beta1 + + PDstandardNth3beta3) + alphaL*trKL) + em4phi*(Ats13 - + 0.3333333333333333333333333333333333333333*g13*trAts + + alphaL*(-25.13274122871834590770114706623602307358*eTxzL + + 8.377580409572781969233715688745341024526*g13*trS)) + + PDupwindNthSymm1At13*Abs(beta1L) + PDupwindNthSymm2At13*Abs(beta2L) + + PDupwindNthSymm3At13*Abs(beta3L); + + CCTK_REAL At22rhsL = -2.*alphaL*(At12L*Atm12 + At22L*Atm22 + + At23L*Atm32) + epsdiss1*PDdissipationNth1At22 + + epsdiss2*PDdissipationNth2At22 + epsdiss3*PDdissipationNth3At22 + + 2.*(At12L*PDstandardNth2beta1 + At23L*PDstandardNth2beta3) + + beta1L*PDupwindNthAnti1At22 + beta2L*PDupwindNthAnti2At22 + + beta3L*PDupwindNthAnti3At22 + + At22L*(1.333333333333333333333333333333333333333*PDstandardNth2beta2 - + 0.6666666666666666666666666666666666666667*(PDstandardNth1beta1 + + PDstandardNth3beta3) + alphaL*trKL) + em4phi*(Ats22 - + 0.3333333333333333333333333333333333333333*g22*trAts + + alphaL*(-25.13274122871834590770114706623602307358*eTyyL + + 8.377580409572781969233715688745341024526*g22*trS)) + + PDupwindNthSymm1At22*Abs(beta1L) + PDupwindNthSymm2At22*Abs(beta2L) + + PDupwindNthSymm3At22*Abs(beta3L); + + CCTK_REAL At23rhsL = -2.*alphaL*(At12L*Atm13 + At22L*Atm23 + + At23L*Atm33) + epsdiss1*PDdissipationNth1At23 + + epsdiss2*PDdissipationNth2At23 + epsdiss3*PDdissipationNth3At23 + + At13L*PDstandardNth2beta1 + At33L*PDstandardNth2beta3 + + At12L*PDstandardNth3beta1 + At22L*PDstandardNth3beta2 + + beta1L*PDupwindNthAnti1At23 + beta2L*PDupwindNthAnti2At23 + + beta3L*PDupwindNthAnti3At23 + + At23L*(-0.6666666666666666666666666666666666666667*PDstandardNth1beta1 + + 0.3333333333333333333333333333333333333333*(PDstandardNth2beta2 + + PDstandardNth3beta3) + alphaL*trKL) + em4phi*(Ats23 - + 0.3333333333333333333333333333333333333333*g23*trAts + + alphaL*(-25.13274122871834590770114706623602307358*eTyzL + + 8.377580409572781969233715688745341024526*g23*trS)) + + PDupwindNthSymm1At23*Abs(beta1L) + PDupwindNthSymm2At23*Abs(beta2L) + + PDupwindNthSymm3At23*Abs(beta3L); + + CCTK_REAL At33rhsL = -2.*alphaL*(At13L*Atm13 + At23L*Atm23 + + At33L*Atm33) + epsdiss1*PDdissipationNth1At33 + + epsdiss2*PDdissipationNth2At33 + epsdiss3*PDdissipationNth3At33 + + 2.*(At13L*PDstandardNth3beta1 + At23L*PDstandardNth3beta2) + + beta1L*PDupwindNthAnti1At33 + beta2L*PDupwindNthAnti2At33 + + beta3L*PDupwindNthAnti3At33 + + At33L*(-0.6666666666666666666666666666666666666667*(PDstandardNth1beta1 + + PDstandardNth2beta2) + + 1.333333333333333333333333333333333333333*PDstandardNth3beta3 + + alphaL*trKL) + em4phi*(Ats33 - + 0.3333333333333333333333333333333333333333*g33*trAts + + alphaL*(-25.13274122871834590770114706623602307358*eTzzL + + 8.377580409572781969233715688745341024526*g33*trS)) + + PDupwindNthSymm1At33*Abs(beta1L) + PDupwindNthSymm2At33*Abs(beta2L) + + PDupwindNthSymm3At33*Abs(beta3L); + + + /* Copy local copies back to grid functions */ + At11rhs[index] = At11rhsL; + At12rhs[index] = At12rhsL; + At13rhs[index] = At13rhsL; + At22rhs[index] = At22rhsL; + At23rhs[index] = At23rhsL; + At33rhs[index] = At33rhsL; + } + LC_ENDLOOP3 (ML_BSSN_O8_RHS2); +} + +extern "C" void ML_BSSN_O8_RHS2(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverInterior(cctkGH, &ML_BSSN_O8_RHS2_Body); +} diff --git a/ML_BSSN_O8/src/ML_BSSN_O8_RHSStaticBoundary.cc b/ML_BSSN_O8/src/ML_BSSN_O8_RHSStaticBoundary.cc new file mode 100644 index 0000000..422ad87 --- /dev/null +++ b/ML_BSSN_O8/src/ML_BSSN_O8_RHSStaticBoundary.cc @@ -0,0 +1,229 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +extern "C" void ML_BSSN_O8_RHSStaticBoundary_SelectBCs(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT ierr = 0; + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_O8::ML_curvrhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_O8::ML_curvrhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_O8::ML_dtlapserhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_O8::ML_dtlapserhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_O8::ML_dtshiftrhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_O8::ML_dtshiftrhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_O8::ML_Gammarhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_O8::ML_Gammarhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_O8::ML_lapserhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_O8::ML_lapserhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_O8::ML_log_confacrhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_O8::ML_log_confacrhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_O8::ML_metricrhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_O8::ML_metricrhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_O8::ML_shiftrhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_O8::ML_shiftrhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_O8::ML_trace_curvrhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_O8::ML_trace_curvrhs."); + return; +} + +static void ML_BSSN_O8_RHSStaticBoundary_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_BSSN_O8_RHSStaticBoundary_Body"); + } + + if (cctk_iteration % ML_BSSN_O8_RHSStaticBoundary_calc_every != ML_BSSN_O8_RHSStaticBoundary_calc_offset) + { + return; + } + + const char *groups[] = {"ML_BSSN_O8::ML_curvrhs","ML_BSSN_O8::ML_dtlapserhs","ML_BSSN_O8::ML_dtshiftrhs","ML_BSSN_O8::ML_Gammarhs","ML_BSSN_O8::ML_lapserhs","ML_BSSN_O8::ML_log_confacrhs","ML_BSSN_O8::ML_metricrhs","ML_BSSN_O8::ML_shiftrhs","ML_BSSN_O8::ML_trace_curvrhs"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_BSSN_O8_RHSStaticBoundary", 9, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o1024dx = 0.0009765625*INV(dx); + CCTK_REAL const p1o1024dy = 0.0009765625*INV(dy); + CCTK_REAL const p1o1024dz = 0.0009765625*INV(dz); + CCTK_REAL const p1o1680dx = 0.000595238095238095238095238095238*INV(dx); + CCTK_REAL const p1o1680dy = 0.000595238095238095238095238095238*INV(dy); + CCTK_REAL const p1o1680dz = 0.000595238095238095238095238095238*INV(dz); + CCTK_REAL const p1o5040dx2 = 0.000198412698412698412698412698413*INV(SQR(dx)); + CCTK_REAL const p1o5040dy2 = 0.000198412698412698412698412698413*INV(SQR(dy)); + CCTK_REAL const p1o5040dz2 = 0.000198412698412698412698412698413*INV(SQR(dz)); + CCTK_REAL const p1o560dx = 0.00178571428571428571428571428571*INV(dx); + CCTK_REAL const p1o560dy = 0.00178571428571428571428571428571*INV(dy); + CCTK_REAL const p1o560dz = 0.00178571428571428571428571428571*INV(dz); + CCTK_REAL const p1o705600dxdy = 1.41723356009070294784580498866e-6*INV(dx)*INV(dy); + CCTK_REAL const p1o705600dxdz = 1.41723356009070294784580498866e-6*INV(dx)*INV(dz); + CCTK_REAL const p1o705600dydz = 1.41723356009070294784580498866e-6*INV(dy)*INV(dz); + CCTK_REAL const p1o840dx = 0.00119047619047619047619047619048*INV(dx); + CCTK_REAL const p1o840dy = 0.00119047619047619047619047619048*INV(dy); + CCTK_REAL const p1o840dz = 0.00119047619047619047619047619048*INV(dz); + CCTK_REAL const p1odx = INV(dx); + CCTK_REAL const p1ody = INV(dy); + CCTK_REAL const p1odz = INV(dz); + CCTK_REAL const pm1o840dx = -0.00119047619047619047619047619048*INV(dx); + CCTK_REAL const pm1o840dy = -0.00119047619047619047619047619048*INV(dy); + CCTK_REAL const pm1o840dz = -0.00119047619047619047619047619048*INV(dz); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_BSSN_O8_RHSStaticBoundary, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + + /* Include user supplied include files */ + + /* Precompute derivatives */ + + /* Calculate temporaries and grid functions */ + CCTK_REAL phirhsL = 0; + + CCTK_REAL gt11rhsL = 0; + + CCTK_REAL gt12rhsL = 0; + + CCTK_REAL gt13rhsL = 0; + + CCTK_REAL gt22rhsL = 0; + + CCTK_REAL gt23rhsL = 0; + + CCTK_REAL gt33rhsL = 0; + + CCTK_REAL trKrhsL = 0; + + CCTK_REAL At11rhsL = 0; + + CCTK_REAL At12rhsL = 0; + + CCTK_REAL At13rhsL = 0; + + CCTK_REAL At22rhsL = 0; + + CCTK_REAL At23rhsL = 0; + + CCTK_REAL At33rhsL = 0; + + CCTK_REAL Xt1rhsL = 0; + + CCTK_REAL Xt2rhsL = 0; + + CCTK_REAL Xt3rhsL = 0; + + CCTK_REAL alpharhsL = 0; + + CCTK_REAL ArhsL = 0; + + CCTK_REAL beta1rhsL = 0; + + CCTK_REAL beta2rhsL = 0; + + CCTK_REAL beta3rhsL = 0; + + CCTK_REAL B1rhsL = 0; + + CCTK_REAL B2rhsL = 0; + + CCTK_REAL B3rhsL = 0; + + + /* Copy local copies back to grid functions */ + alpharhs[index] = alpharhsL; + Arhs[index] = ArhsL; + At11rhs[index] = At11rhsL; + At12rhs[index] = At12rhsL; + At13rhs[index] = At13rhsL; + At22rhs[index] = At22rhsL; + At23rhs[index] = At23rhsL; + At33rhs[index] = At33rhsL; + B1rhs[index] = B1rhsL; + B2rhs[index] = B2rhsL; + B3rhs[index] = B3rhsL; + beta1rhs[index] = beta1rhsL; + beta2rhs[index] = beta2rhsL; + beta3rhs[index] = beta3rhsL; + gt11rhs[index] = gt11rhsL; + gt12rhs[index] = gt12rhsL; + gt13rhs[index] = gt13rhsL; + gt22rhs[index] = gt22rhsL; + gt23rhs[index] = gt23rhsL; + gt33rhs[index] = gt33rhsL; + phirhs[index] = phirhsL; + trKrhs[index] = trKrhsL; + Xt1rhs[index] = Xt1rhsL; + Xt2rhs[index] = Xt2rhsL; + Xt3rhs[index] = Xt3rhsL; + } + LC_ENDLOOP3 (ML_BSSN_O8_RHSStaticBoundary); +} + +extern "C" void ML_BSSN_O8_RHSStaticBoundary(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverBoundary(cctkGH, &ML_BSSN_O8_RHSStaticBoundary_Body); +} diff --git a/ML_BSSN_O8/src/ML_BSSN_O8_boundary.cc b/ML_BSSN_O8/src/ML_BSSN_O8_boundary.cc new file mode 100644 index 0000000..8cf7792 --- /dev/null +++ b/ML_BSSN_O8/src/ML_BSSN_O8_boundary.cc @@ -0,0 +1,229 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +extern "C" void ML_BSSN_O8_boundary_SelectBCs(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT ierr = 0; + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_O8::ML_curv","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_O8::ML_curv."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_O8::ML_dtlapse","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_O8::ML_dtlapse."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_O8::ML_dtshift","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_O8::ML_dtshift."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_O8::ML_Gamma","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_O8::ML_Gamma."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_O8::ML_lapse","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_O8::ML_lapse."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_O8::ML_log_confac","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_O8::ML_log_confac."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_O8::ML_metric","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_O8::ML_metric."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_O8::ML_shift","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_O8::ML_shift."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_O8::ML_trace_curv","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_O8::ML_trace_curv."); + return; +} + +static void ML_BSSN_O8_boundary_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_BSSN_O8_boundary_Body"); + } + + if (cctk_iteration % ML_BSSN_O8_boundary_calc_every != ML_BSSN_O8_boundary_calc_offset) + { + return; + } + + const char *groups[] = {"ML_BSSN_O8::ML_curv","ML_BSSN_O8::ML_dtlapse","ML_BSSN_O8::ML_dtshift","ML_BSSN_O8::ML_Gamma","ML_BSSN_O8::ML_lapse","ML_BSSN_O8::ML_log_confac","ML_BSSN_O8::ML_metric","ML_BSSN_O8::ML_shift","ML_BSSN_O8::ML_trace_curv"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_BSSN_O8_boundary", 9, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o1024dx = 0.0009765625*INV(dx); + CCTK_REAL const p1o1024dy = 0.0009765625*INV(dy); + CCTK_REAL const p1o1024dz = 0.0009765625*INV(dz); + CCTK_REAL const p1o1680dx = 0.000595238095238095238095238095238*INV(dx); + CCTK_REAL const p1o1680dy = 0.000595238095238095238095238095238*INV(dy); + CCTK_REAL const p1o1680dz = 0.000595238095238095238095238095238*INV(dz); + CCTK_REAL const p1o5040dx2 = 0.000198412698412698412698412698413*INV(SQR(dx)); + CCTK_REAL const p1o5040dy2 = 0.000198412698412698412698412698413*INV(SQR(dy)); + CCTK_REAL const p1o5040dz2 = 0.000198412698412698412698412698413*INV(SQR(dz)); + CCTK_REAL const p1o560dx = 0.00178571428571428571428571428571*INV(dx); + CCTK_REAL const p1o560dy = 0.00178571428571428571428571428571*INV(dy); + CCTK_REAL const p1o560dz = 0.00178571428571428571428571428571*INV(dz); + CCTK_REAL const p1o705600dxdy = 1.41723356009070294784580498866e-6*INV(dx)*INV(dy); + CCTK_REAL const p1o705600dxdz = 1.41723356009070294784580498866e-6*INV(dx)*INV(dz); + CCTK_REAL const p1o705600dydz = 1.41723356009070294784580498866e-6*INV(dy)*INV(dz); + CCTK_REAL const p1o840dx = 0.00119047619047619047619047619048*INV(dx); + CCTK_REAL const p1o840dy = 0.00119047619047619047619047619048*INV(dy); + CCTK_REAL const p1o840dz = 0.00119047619047619047619047619048*INV(dz); + CCTK_REAL const p1odx = INV(dx); + CCTK_REAL const p1ody = INV(dy); + CCTK_REAL const p1odz = INV(dz); + CCTK_REAL const pm1o840dx = -0.00119047619047619047619047619048*INV(dx); + CCTK_REAL const pm1o840dy = -0.00119047619047619047619047619048*INV(dy); + CCTK_REAL const pm1o840dz = -0.00119047619047619047619047619048*INV(dz); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_BSSN_O8_boundary, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + + /* Include user supplied include files */ + + /* Precompute derivatives */ + + /* Calculate temporaries and grid functions */ + CCTK_REAL phiL = IfThen(ToReal(conformalMethod),1,0); + + CCTK_REAL gt11L = 1; + + CCTK_REAL gt12L = 0; + + CCTK_REAL gt13L = 0; + + CCTK_REAL gt22L = 1; + + CCTK_REAL gt23L = 0; + + CCTK_REAL gt33L = 1; + + CCTK_REAL trKL = 0; + + CCTK_REAL At11L = 0; + + CCTK_REAL At12L = 0; + + CCTK_REAL At13L = 0; + + CCTK_REAL At22L = 0; + + CCTK_REAL At23L = 0; + + CCTK_REAL At33L = 0; + + CCTK_REAL Xt1L = 0; + + CCTK_REAL Xt2L = 0; + + CCTK_REAL Xt3L = 0; + + CCTK_REAL alphaL = 1; + + CCTK_REAL AL = 0; + + CCTK_REAL beta1L = 0; + + CCTK_REAL beta2L = 0; + + CCTK_REAL beta3L = 0; + + CCTK_REAL B1L = 0; + + CCTK_REAL B2L = 0; + + CCTK_REAL B3L = 0; + + + /* Copy local copies back to grid functions */ + A[index] = AL; + alpha[index] = alphaL; + At11[index] = At11L; + At12[index] = At12L; + At13[index] = At13L; + At22[index] = At22L; + At23[index] = At23L; + At33[index] = At33L; + B1[index] = B1L; + B2[index] = B2L; + B3[index] = B3L; + beta1[index] = beta1L; + beta2[index] = beta2L; + beta3[index] = beta3L; + gt11[index] = gt11L; + gt12[index] = gt12L; + gt13[index] = gt13L; + gt22[index] = gt22L; + gt23[index] = gt23L; + gt33[index] = gt33L; + phi[index] = phiL; + trK[index] = trKL; + Xt1[index] = Xt1L; + Xt2[index] = Xt2L; + Xt3[index] = Xt3L; + } + LC_ENDLOOP3 (ML_BSSN_O8_boundary); +} + +extern "C" void ML_BSSN_O8_boundary(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverBoundaryWithGhosts(cctkGH, &ML_BSSN_O8_boundary_Body); +} diff --git a/ML_BSSN_O8/src/ML_BSSN_O8_constraints1.cc b/ML_BSSN_O8/src/ML_BSSN_O8_constraints1.cc new file mode 100644 index 0000000..c0183f8 --- /dev/null +++ b/ML_BSSN_O8/src/ML_BSSN_O8_constraints1.cc @@ -0,0 +1,591 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +extern "C" void ML_BSSN_O8_constraints1_SelectBCs(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT ierr = 0; + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_O8::ML_Ham","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_O8::ML_Ham."); + return; +} + +static void ML_BSSN_O8_constraints1_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_BSSN_O8_constraints1_Body"); + } + + if (cctk_iteration % ML_BSSN_O8_constraints1_calc_every != ML_BSSN_O8_constraints1_calc_offset) + { + return; + } + + const char *groups[] = {"ML_BSSN_O8::ML_curv","ML_BSSN_O8::ML_Gamma","ML_BSSN_O8::ML_Ham","ML_BSSN_O8::ML_lapse","ML_BSSN_O8::ML_log_confac","ML_BSSN_O8::ML_metric","ML_BSSN_O8::ML_shift","ML_BSSN_O8::ML_trace_curv"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_BSSN_O8_constraints1", 8, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o1024dx = 0.0009765625*INV(dx); + CCTK_REAL const p1o1024dy = 0.0009765625*INV(dy); + CCTK_REAL const p1o1024dz = 0.0009765625*INV(dz); + CCTK_REAL const p1o1680dx = 0.000595238095238095238095238095238*INV(dx); + CCTK_REAL const p1o1680dy = 0.000595238095238095238095238095238*INV(dy); + CCTK_REAL const p1o1680dz = 0.000595238095238095238095238095238*INV(dz); + CCTK_REAL const p1o5040dx2 = 0.000198412698412698412698412698413*INV(SQR(dx)); + CCTK_REAL const p1o5040dy2 = 0.000198412698412698412698412698413*INV(SQR(dy)); + CCTK_REAL const p1o5040dz2 = 0.000198412698412698412698412698413*INV(SQR(dz)); + CCTK_REAL const p1o560dx = 0.00178571428571428571428571428571*INV(dx); + CCTK_REAL const p1o560dy = 0.00178571428571428571428571428571*INV(dy); + CCTK_REAL const p1o560dz = 0.00178571428571428571428571428571*INV(dz); + CCTK_REAL const p1o705600dxdy = 1.41723356009070294784580498866e-6*INV(dx)*INV(dy); + CCTK_REAL const p1o705600dxdz = 1.41723356009070294784580498866e-6*INV(dx)*INV(dz); + CCTK_REAL const p1o705600dydz = 1.41723356009070294784580498866e-6*INV(dy)*INV(dz); + CCTK_REAL const p1o840dx = 0.00119047619047619047619047619048*INV(dx); + CCTK_REAL const p1o840dy = 0.00119047619047619047619047619048*INV(dy); + CCTK_REAL const p1o840dz = 0.00119047619047619047619047619048*INV(dz); + CCTK_REAL const p1odx = INV(dx); + CCTK_REAL const p1ody = INV(dy); + CCTK_REAL const p1odz = INV(dz); + CCTK_REAL const pm1o840dx = -0.00119047619047619047619047619048*INV(dx); + CCTK_REAL const pm1o840dy = -0.00119047619047619047619047619048*INV(dy); + CCTK_REAL const pm1o840dz = -0.00119047619047619047619047619048*INV(dz); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_BSSN_O8_constraints1, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + CCTK_REAL alphaL = alpha[index]; + CCTK_REAL At11L = At11[index]; + CCTK_REAL At12L = At12[index]; + CCTK_REAL At13L = At13[index]; + CCTK_REAL At22L = At22[index]; + CCTK_REAL At23L = At23[index]; + CCTK_REAL At33L = At33[index]; + CCTK_REAL beta1L = beta1[index]; + CCTK_REAL beta2L = beta2[index]; + CCTK_REAL beta3L = beta3[index]; + CCTK_REAL eTttL = (*stress_energy_state) ? eTtt[index] : ToReal(0.0); + CCTK_REAL eTtxL = (*stress_energy_state) ? eTtx[index] : ToReal(0.0); + CCTK_REAL eTtyL = (*stress_energy_state) ? eTty[index] : ToReal(0.0); + CCTK_REAL eTtzL = (*stress_energy_state) ? eTtz[index] : ToReal(0.0); + CCTK_REAL eTxxL = (*stress_energy_state) ? eTxx[index] : ToReal(0.0); + CCTK_REAL eTxyL = (*stress_energy_state) ? eTxy[index] : ToReal(0.0); + CCTK_REAL eTxzL = (*stress_energy_state) ? eTxz[index] : ToReal(0.0); + CCTK_REAL eTyyL = (*stress_energy_state) ? eTyy[index] : ToReal(0.0); + CCTK_REAL eTyzL = (*stress_energy_state) ? eTyz[index] : ToReal(0.0); + CCTK_REAL eTzzL = (*stress_energy_state) ? eTzz[index] : ToReal(0.0); + CCTK_REAL gt11L = gt11[index]; + CCTK_REAL gt12L = gt12[index]; + CCTK_REAL gt13L = gt13[index]; + CCTK_REAL gt22L = gt22[index]; + CCTK_REAL gt23L = gt23[index]; + CCTK_REAL gt33L = gt33[index]; + CCTK_REAL phiL = phi[index]; + CCTK_REAL trKL = trK[index]; + CCTK_REAL Xt1L = Xt1[index]; + CCTK_REAL Xt2L = Xt2[index]; + CCTK_REAL Xt3L = Xt3[index]; + + /* Include user supplied include files */ + + /* Precompute derivatives */ + CCTK_REAL const PDstandardNth1gt11 = PDstandardNth1(>11[index]); + CCTK_REAL const PDstandardNth2gt11 = PDstandardNth2(>11[index]); + CCTK_REAL const PDstandardNth3gt11 = PDstandardNth3(>11[index]); + CCTK_REAL const PDstandardNth11gt11 = PDstandardNth11(>11[index]); + CCTK_REAL const PDstandardNth22gt11 = PDstandardNth22(>11[index]); + CCTK_REAL const PDstandardNth33gt11 = PDstandardNth33(>11[index]); + CCTK_REAL const PDstandardNth12gt11 = PDstandardNth12(>11[index]); + CCTK_REAL const PDstandardNth13gt11 = PDstandardNth13(>11[index]); + CCTK_REAL const PDstandardNth23gt11 = PDstandardNth23(>11[index]); + CCTK_REAL const PDstandardNth1gt12 = PDstandardNth1(>12[index]); + CCTK_REAL const PDstandardNth2gt12 = PDstandardNth2(>12[index]); + CCTK_REAL const PDstandardNth3gt12 = PDstandardNth3(>12[index]); + CCTK_REAL const PDstandardNth11gt12 = PDstandardNth11(>12[index]); + CCTK_REAL const PDstandardNth22gt12 = PDstandardNth22(>12[index]); + CCTK_REAL const PDstandardNth33gt12 = PDstandardNth33(>12[index]); + CCTK_REAL const PDstandardNth12gt12 = PDstandardNth12(>12[index]); + CCTK_REAL const PDstandardNth13gt12 = PDstandardNth13(>12[index]); + CCTK_REAL const PDstandardNth23gt12 = PDstandardNth23(>12[index]); + CCTK_REAL const PDstandardNth1gt13 = PDstandardNth1(>13[index]); + CCTK_REAL const PDstandardNth2gt13 = PDstandardNth2(>13[index]); + CCTK_REAL const PDstandardNth3gt13 = PDstandardNth3(>13[index]); + CCTK_REAL const PDstandardNth11gt13 = PDstandardNth11(>13[index]); + CCTK_REAL const PDstandardNth22gt13 = PDstandardNth22(>13[index]); + CCTK_REAL const PDstandardNth33gt13 = PDstandardNth33(>13[index]); + CCTK_REAL const PDstandardNth12gt13 = PDstandardNth12(>13[index]); + CCTK_REAL const PDstandardNth13gt13 = PDstandardNth13(>13[index]); + CCTK_REAL const PDstandardNth23gt13 = PDstandardNth23(>13[index]); + CCTK_REAL const PDstandardNth1gt22 = PDstandardNth1(>22[index]); + CCTK_REAL const PDstandardNth2gt22 = PDstandardNth2(>22[index]); + CCTK_REAL const PDstandardNth3gt22 = PDstandardNth3(>22[index]); + CCTK_REAL const PDstandardNth11gt22 = PDstandardNth11(>22[index]); + CCTK_REAL const PDstandardNth22gt22 = PDstandardNth22(>22[index]); + CCTK_REAL const PDstandardNth33gt22 = PDstandardNth33(>22[index]); + CCTK_REAL const PDstandardNth12gt22 = PDstandardNth12(>22[index]); + CCTK_REAL const PDstandardNth13gt22 = PDstandardNth13(>22[index]); + CCTK_REAL const PDstandardNth23gt22 = PDstandardNth23(>22[index]); + CCTK_REAL const PDstandardNth1gt23 = PDstandardNth1(>23[index]); + CCTK_REAL const PDstandardNth2gt23 = PDstandardNth2(>23[index]); + CCTK_REAL const PDstandardNth3gt23 = PDstandardNth3(>23[index]); + CCTK_REAL const PDstandardNth11gt23 = PDstandardNth11(>23[index]); + CCTK_REAL const PDstandardNth22gt23 = PDstandardNth22(>23[index]); + CCTK_REAL const PDstandardNth33gt23 = PDstandardNth33(>23[index]); + CCTK_REAL const PDstandardNth12gt23 = PDstandardNth12(>23[index]); + CCTK_REAL const PDstandardNth13gt23 = PDstandardNth13(>23[index]); + CCTK_REAL const PDstandardNth23gt23 = PDstandardNth23(>23[index]); + CCTK_REAL const PDstandardNth1gt33 = PDstandardNth1(>33[index]); + CCTK_REAL const PDstandardNth2gt33 = PDstandardNth2(>33[index]); + CCTK_REAL const PDstandardNth3gt33 = PDstandardNth3(>33[index]); + CCTK_REAL const PDstandardNth11gt33 = PDstandardNth11(>33[index]); + CCTK_REAL const PDstandardNth22gt33 = PDstandardNth22(>33[index]); + CCTK_REAL const PDstandardNth33gt33 = PDstandardNth33(>33[index]); + CCTK_REAL const PDstandardNth12gt33 = PDstandardNth12(>33[index]); + CCTK_REAL const PDstandardNth13gt33 = PDstandardNth13(>33[index]); + CCTK_REAL const PDstandardNth23gt33 = PDstandardNth23(>33[index]); + CCTK_REAL const PDstandardNth1phi = PDstandardNth1(&phi[index]); + CCTK_REAL const PDstandardNth2phi = PDstandardNth2(&phi[index]); + CCTK_REAL const PDstandardNth3phi = PDstandardNth3(&phi[index]); + CCTK_REAL const PDstandardNth11phi = PDstandardNth11(&phi[index]); + CCTK_REAL const PDstandardNth22phi = PDstandardNth22(&phi[index]); + CCTK_REAL const PDstandardNth33phi = PDstandardNth33(&phi[index]); + CCTK_REAL const PDstandardNth12phi = PDstandardNth12(&phi[index]); + CCTK_REAL const PDstandardNth13phi = PDstandardNth13(&phi[index]); + CCTK_REAL const PDstandardNth23phi = PDstandardNth23(&phi[index]); + CCTK_REAL const PDstandardNth1Xt1 = PDstandardNth1(&Xt1[index]); + CCTK_REAL const PDstandardNth2Xt1 = PDstandardNth2(&Xt1[index]); + CCTK_REAL const PDstandardNth3Xt1 = PDstandardNth3(&Xt1[index]); + CCTK_REAL const PDstandardNth1Xt2 = PDstandardNth1(&Xt2[index]); + CCTK_REAL const PDstandardNth2Xt2 = PDstandardNth2(&Xt2[index]); + CCTK_REAL const PDstandardNth3Xt2 = PDstandardNth3(&Xt2[index]); + CCTK_REAL const PDstandardNth1Xt3 = PDstandardNth1(&Xt3[index]); + CCTK_REAL const PDstandardNth2Xt3 = PDstandardNth2(&Xt3[index]); + CCTK_REAL const PDstandardNth3Xt3 = PDstandardNth3(&Xt3[index]); + + /* Calculate temporaries and grid functions */ + CCTK_REAL detgt = 1; + + CCTK_REAL gtu11 = INV(detgt)*(gt22L*gt33L - SQR(gt23L)); + + CCTK_REAL gtu12 = (gt13L*gt23L - gt12L*gt33L)*INV(detgt); + + CCTK_REAL gtu13 = (-(gt13L*gt22L) + gt12L*gt23L)*INV(detgt); + + CCTK_REAL gtu22 = INV(detgt)*(gt11L*gt33L - SQR(gt13L)); + + CCTK_REAL gtu23 = (gt12L*gt13L - gt11L*gt23L)*INV(detgt); + + CCTK_REAL gtu33 = INV(detgt)*(gt11L*gt22L - SQR(gt12L)); + + CCTK_REAL Gtl111 = 0.5*PDstandardNth1gt11; + + CCTK_REAL Gtl112 = 0.5*PDstandardNth2gt11; + + CCTK_REAL Gtl113 = 0.5*PDstandardNth3gt11; + + CCTK_REAL Gtl122 = -0.5*PDstandardNth1gt22 + PDstandardNth2gt12; + + CCTK_REAL Gtl123 = 0.5*(-PDstandardNth1gt23 + PDstandardNth2gt13 + + PDstandardNth3gt12); + + CCTK_REAL Gtl133 = -0.5*PDstandardNth1gt33 + PDstandardNth3gt13; + + CCTK_REAL Gtl211 = PDstandardNth1gt12 - 0.5*PDstandardNth2gt11; + + CCTK_REAL Gtl212 = 0.5*PDstandardNth1gt22; + + CCTK_REAL Gtl213 = 0.5*(PDstandardNth1gt23 - PDstandardNth2gt13 + + PDstandardNth3gt12); + + CCTK_REAL Gtl222 = 0.5*PDstandardNth2gt22; + + CCTK_REAL Gtl223 = 0.5*PDstandardNth3gt22; + + CCTK_REAL Gtl233 = -0.5*PDstandardNth2gt33 + PDstandardNth3gt23; + + CCTK_REAL Gtl311 = PDstandardNth1gt13 - 0.5*PDstandardNth3gt11; + + CCTK_REAL Gtl312 = 0.5*(PDstandardNth1gt23 + PDstandardNth2gt13 - + PDstandardNth3gt12); + + CCTK_REAL Gtl313 = 0.5*PDstandardNth1gt33; + + CCTK_REAL Gtl322 = PDstandardNth2gt23 - 0.5*PDstandardNth3gt22; + + CCTK_REAL Gtl323 = 0.5*PDstandardNth2gt33; + + CCTK_REAL Gtl333 = 0.5*PDstandardNth3gt33; + + CCTK_REAL Gtlu111 = Gtl111*gtu11 + Gtl112*gtu12 + Gtl113*gtu13; + + CCTK_REAL Gtlu112 = Gtl111*gtu12 + Gtl112*gtu22 + Gtl113*gtu23; + + CCTK_REAL Gtlu113 = Gtl111*gtu13 + Gtl112*gtu23 + Gtl113*gtu33; + + CCTK_REAL Gtlu121 = Gtl112*gtu11 + Gtl122*gtu12 + Gtl123*gtu13; + + CCTK_REAL Gtlu122 = Gtl112*gtu12 + Gtl122*gtu22 + Gtl123*gtu23; + + CCTK_REAL Gtlu123 = Gtl112*gtu13 + Gtl122*gtu23 + Gtl123*gtu33; + + CCTK_REAL Gtlu131 = Gtl113*gtu11 + Gtl123*gtu12 + Gtl133*gtu13; + + CCTK_REAL Gtlu132 = Gtl113*gtu12 + Gtl123*gtu22 + Gtl133*gtu23; + + CCTK_REAL Gtlu133 = Gtl113*gtu13 + Gtl123*gtu23 + Gtl133*gtu33; + + CCTK_REAL Gtlu211 = Gtl211*gtu11 + Gtl212*gtu12 + Gtl213*gtu13; + + CCTK_REAL Gtlu212 = Gtl211*gtu12 + Gtl212*gtu22 + Gtl213*gtu23; + + CCTK_REAL Gtlu213 = Gtl211*gtu13 + Gtl212*gtu23 + Gtl213*gtu33; + + CCTK_REAL Gtlu221 = Gtl212*gtu11 + Gtl222*gtu12 + Gtl223*gtu13; + + CCTK_REAL Gtlu222 = Gtl212*gtu12 + Gtl222*gtu22 + Gtl223*gtu23; + + CCTK_REAL Gtlu223 = Gtl212*gtu13 + Gtl222*gtu23 + Gtl223*gtu33; + + CCTK_REAL Gtlu231 = Gtl213*gtu11 + Gtl223*gtu12 + Gtl233*gtu13; + + CCTK_REAL Gtlu232 = Gtl213*gtu12 + Gtl223*gtu22 + Gtl233*gtu23; + + CCTK_REAL Gtlu233 = Gtl213*gtu13 + Gtl223*gtu23 + Gtl233*gtu33; + + CCTK_REAL Gtlu311 = Gtl311*gtu11 + Gtl312*gtu12 + Gtl313*gtu13; + + CCTK_REAL Gtlu312 = Gtl311*gtu12 + Gtl312*gtu22 + Gtl313*gtu23; + + CCTK_REAL Gtlu313 = Gtl311*gtu13 + Gtl312*gtu23 + Gtl313*gtu33; + + CCTK_REAL Gtlu321 = Gtl312*gtu11 + Gtl322*gtu12 + Gtl323*gtu13; + + CCTK_REAL Gtlu322 = Gtl312*gtu12 + Gtl322*gtu22 + Gtl323*gtu23; + + CCTK_REAL Gtlu323 = Gtl312*gtu13 + Gtl322*gtu23 + Gtl323*gtu33; + + CCTK_REAL Gtlu331 = Gtl313*gtu11 + Gtl323*gtu12 + Gtl333*gtu13; + + CCTK_REAL Gtlu332 = Gtl313*gtu12 + Gtl323*gtu22 + Gtl333*gtu23; + + CCTK_REAL Gtlu333 = Gtl313*gtu13 + Gtl323*gtu23 + Gtl333*gtu33; + + CCTK_REAL Gt111 = Gtl111*gtu11 + Gtl211*gtu12 + Gtl311*gtu13; + + CCTK_REAL Gt211 = Gtl111*gtu12 + Gtl211*gtu22 + Gtl311*gtu23; + + CCTK_REAL Gt311 = Gtl111*gtu13 + Gtl211*gtu23 + Gtl311*gtu33; + + CCTK_REAL Gt112 = Gtl112*gtu11 + Gtl212*gtu12 + Gtl312*gtu13; + + CCTK_REAL Gt212 = Gtl112*gtu12 + Gtl212*gtu22 + Gtl312*gtu23; + + CCTK_REAL Gt312 = Gtl112*gtu13 + Gtl212*gtu23 + Gtl312*gtu33; + + CCTK_REAL Gt113 = Gtl113*gtu11 + Gtl213*gtu12 + Gtl313*gtu13; + + CCTK_REAL Gt213 = Gtl113*gtu12 + Gtl213*gtu22 + Gtl313*gtu23; + + CCTK_REAL Gt313 = Gtl113*gtu13 + Gtl213*gtu23 + Gtl313*gtu33; + + CCTK_REAL Gt122 = Gtl122*gtu11 + Gtl222*gtu12 + Gtl322*gtu13; + + CCTK_REAL Gt222 = Gtl122*gtu12 + Gtl222*gtu22 + Gtl322*gtu23; + + CCTK_REAL Gt322 = Gtl122*gtu13 + Gtl222*gtu23 + Gtl322*gtu33; + + CCTK_REAL Gt123 = Gtl123*gtu11 + Gtl223*gtu12 + Gtl323*gtu13; + + CCTK_REAL Gt223 = Gtl123*gtu12 + Gtl223*gtu22 + Gtl323*gtu23; + + CCTK_REAL Gt323 = Gtl123*gtu13 + Gtl223*gtu23 + Gtl323*gtu33; + + CCTK_REAL Gt133 = Gtl133*gtu11 + Gtl233*gtu12 + Gtl333*gtu13; + + CCTK_REAL Gt233 = Gtl133*gtu12 + Gtl233*gtu22 + Gtl333*gtu23; + + CCTK_REAL Gt333 = Gtl133*gtu13 + Gtl233*gtu23 + Gtl333*gtu33; + + CCTK_REAL Xtn1 = Gt111*gtu11 + Gt122*gtu22 + 2*(Gt112*gtu12 + + Gt113*gtu13 + Gt123*gtu23) + Gt133*gtu33; + + CCTK_REAL Xtn2 = Gt211*gtu11 + Gt222*gtu22 + 2*(Gt212*gtu12 + + Gt213*gtu13 + Gt223*gtu23) + Gt233*gtu33; + + CCTK_REAL Xtn3 = Gt311*gtu11 + Gt322*gtu22 + 2*(Gt312*gtu12 + + Gt313*gtu13 + Gt323*gtu23) + Gt333*gtu33; + + CCTK_REAL Rt11 = 3*(Gt111*Gtlu111 + Gt112*Gtlu112 + Gt113*Gtlu113) + + 2*(Gt211*Gtlu121 + Gt212*Gtlu122 + Gt213*Gtlu123 + Gt311*Gtlu131 + + Gt312*Gtlu132 + Gt313*Gtlu133) + Gt211*Gtlu211 + Gt212*Gtlu212 + + Gt213*Gtlu213 + Gt311*Gtlu311 + Gt312*Gtlu312 + Gt313*Gtlu313 + + gt11L*PDstandardNth1Xt1 + gt12L*PDstandardNth1Xt2 + + gt13L*PDstandardNth1Xt3 + 0.5*(-(gtu11*PDstandardNth11gt11) - + 2*gtu12*PDstandardNth12gt11 - 2*gtu13*PDstandardNth13gt11 - + gtu22*PDstandardNth22gt11 - 2*gtu23*PDstandardNth23gt11 - + gtu33*PDstandardNth33gt11) + Gtl111*Xtn1 + Gtl112*Xtn2 + Gtl113*Xtn3; + + CCTK_REAL Rt12 = 0.5*(4*(Gt211*Gtlu221 + Gt212*Gtlu222 + + Gt213*Gtlu223) + 2*(Gt112*Gtlu111 + Gt122*Gtlu112 + Gt123*Gtlu113 + + Gt111*Gtlu121 + Gt212*Gtlu121 + Gt112*Gtlu122 + Gt222*Gtlu122 + + Gt113*Gtlu123 + Gt223*Gtlu123 + Gt312*Gtlu131 + Gt322*Gtlu132 + + Gt323*Gtlu133 + Gt111*Gtlu211 + Gt112*Gtlu212 + Gt113*Gtlu213 + + Gt311*Gtlu231 + Gt312*Gtlu232 + Gt313*Gtlu233 + Gt311*Gtlu321 + + Gt312*Gtlu322 + Gt313*Gtlu323) - gtu11*PDstandardNth11gt12 - + 2*gtu12*PDstandardNth12gt12 - 2*gtu13*PDstandardNth13gt12 + + gt12L*PDstandardNth1Xt1 + gt22L*PDstandardNth1Xt2 + + gt23L*PDstandardNth1Xt3 - gtu22*PDstandardNth22gt12 - + 2*gtu23*PDstandardNth23gt12 + gt11L*PDstandardNth2Xt1 + + gt12L*PDstandardNth2Xt2 + gt13L*PDstandardNth2Xt3 - + gtu33*PDstandardNth33gt12 + Gtl112*Xtn1 + Gtl211*Xtn1 + Gtl122*Xtn2 + + Gtl212*Xtn2 + Gtl123*Xtn3 + Gtl213*Xtn3); + + CCTK_REAL Rt13 = 0.5*(2*(Gt113*Gtlu111 + Gt123*Gtlu112 + Gt133*Gtlu113 + + Gt213*Gtlu121 + Gt223*Gtlu122 + Gt233*Gtlu123 + Gt111*Gtlu131 + + Gt313*Gtlu131 + Gt112*Gtlu132 + Gt323*Gtlu132 + Gt113*Gtlu133 + + Gt333*Gtlu133 + Gt211*Gtlu231 + Gt212*Gtlu232 + Gt213*Gtlu233 + + Gt111*Gtlu311 + Gt112*Gtlu312 + Gt113*Gtlu313 + Gt211*Gtlu321 + + Gt212*Gtlu322 + Gt213*Gtlu323) + 4*(Gt311*Gtlu331 + Gt312*Gtlu332 + + Gt313*Gtlu333) - gtu11*PDstandardNth11gt13 - + 2*gtu12*PDstandardNth12gt13 - 2*gtu13*PDstandardNth13gt13 + + gt13L*PDstandardNth1Xt1 + gt23L*PDstandardNth1Xt2 + + gt33L*PDstandardNth1Xt3 - gtu22*PDstandardNth22gt13 - + 2*gtu23*PDstandardNth23gt13 - gtu33*PDstandardNth33gt13 + + gt11L*PDstandardNth3Xt1 + gt12L*PDstandardNth3Xt2 + + gt13L*PDstandardNth3Xt3 + Gtl113*Xtn1 + Gtl311*Xtn1 + Gtl123*Xtn2 + + Gtl312*Xtn2 + Gtl133*Xtn3 + Gtl313*Xtn3); + + CCTK_REAL Rt22 = Gt112*(Gtlu121 + 2*Gtlu211) + Gt122*(Gtlu122 + + 2*Gtlu212) + Gt123*(Gtlu123 + 2*Gtlu213) + 3*(Gt212*Gtlu221 + + Gt222*Gtlu222 + Gt223*Gtlu223) + 2*(Gt312*Gtlu231 + Gt322*Gtlu232 + + Gt323*Gtlu233) + Gt312*Gtlu321 + Gt322*Gtlu322 + Gt323*Gtlu323 + + gt12L*PDstandardNth2Xt1 + gt22L*PDstandardNth2Xt2 + + gt23L*PDstandardNth2Xt3 + 0.5*(-(gtu11*PDstandardNth11gt22) - + 2*gtu12*PDstandardNth12gt22 - 2*gtu13*PDstandardNth13gt22 - + gtu22*PDstandardNth22gt22 - 2*gtu23*PDstandardNth23gt22 - + gtu33*PDstandardNth33gt22) + Gtl212*Xtn1 + Gtl222*Xtn2 + Gtl223*Xtn3; + + CCTK_REAL Rt23 = 0.5*(2*(Gt112*Gtlu131 + Gt122*Gtlu132 + Gt123*Gtlu133 + + Gt113*Gtlu211 + Gt123*Gtlu212 + Gt133*Gtlu213 + Gt213*Gtlu221 + + Gt223*Gtlu222 + Gt233*Gtlu223 + Gt212*Gtlu231 + Gt313*Gtlu231 + + Gt222*Gtlu232 + Gt323*Gtlu232 + Gt223*Gtlu233 + Gt333*Gtlu233 + + Gt112*Gtlu311 + Gt122*Gtlu312 + Gt123*Gtlu313 + Gt212*Gtlu321 + + Gt222*Gtlu322 + Gt223*Gtlu323) + 4*(Gt312*Gtlu331 + Gt322*Gtlu332 + + Gt323*Gtlu333) - gtu11*PDstandardNth11gt23 - + 2*gtu12*PDstandardNth12gt23 - 2*gtu13*PDstandardNth13gt23 - + gtu22*PDstandardNth22gt23 - 2*gtu23*PDstandardNth23gt23 + + gt13L*PDstandardNth2Xt1 + gt23L*PDstandardNth2Xt2 + + gt33L*PDstandardNth2Xt3 - gtu33*PDstandardNth33gt23 + + gt12L*PDstandardNth3Xt1 + gt22L*PDstandardNth3Xt2 + + gt23L*PDstandardNth3Xt3 + Gtl213*Xtn1 + Gtl312*Xtn1 + Gtl223*Xtn2 + + Gtl322*Xtn2 + Gtl233*Xtn3 + Gtl323*Xtn3); + + CCTK_REAL Rt33 = Gt113*(Gtlu131 + 2*Gtlu311) + Gt123*(Gtlu132 + + 2*Gtlu312) + Gt133*(Gtlu133 + 2*Gtlu313) + Gt213*(Gtlu231 + 2*Gtlu321) + + Gt223*(Gtlu232 + 2*Gtlu322) + Gt233*(Gtlu233 + 2*Gtlu323) + + 3*(Gt313*Gtlu331 + Gt323*Gtlu332 + Gt333*Gtlu333) + + 0.5*(-(gtu11*PDstandardNth11gt33) - 2*gtu12*PDstandardNth12gt33 - + 2*gtu13*PDstandardNth13gt33 - gtu22*PDstandardNth22gt33 - + 2*gtu23*PDstandardNth23gt33 - gtu33*PDstandardNth33gt33) + + gt13L*PDstandardNth3Xt1 + gt23L*PDstandardNth3Xt2 + + gt33L*PDstandardNth3Xt3 + Gtl313*Xtn1 + Gtl323*Xtn2 + Gtl333*Xtn3; + + CCTK_REAL fac1 = IfThen(ToReal(conformalMethod),-0.5*INV(phiL),1); + + CCTK_REAL cdphi1 = fac1*PDstandardNth1phi; + + CCTK_REAL cdphi2 = fac1*PDstandardNth2phi; + + CCTK_REAL cdphi3 = fac1*PDstandardNth3phi; + + CCTK_REAL fac2 = IfThen(ToReal(conformalMethod),0.5*INV(SQR(phiL)),0); + + CCTK_REAL cdphi211 = -(fac1*(-PDstandardNth11phi + + Gt111*PDstandardNth1phi + Gt211*PDstandardNth2phi + + Gt311*PDstandardNth3phi)) + fac2*SQR(PDstandardNth1phi); + + CCTK_REAL cdphi212 = fac2*PDstandardNth1phi*PDstandardNth2phi - + fac1*(-PDstandardNth12phi + Gt112*PDstandardNth1phi + + Gt212*PDstandardNth2phi + Gt312*PDstandardNth3phi); + + CCTK_REAL cdphi213 = fac2*PDstandardNth1phi*PDstandardNth3phi - + fac1*(-PDstandardNth13phi + Gt113*PDstandardNth1phi + + Gt213*PDstandardNth2phi + Gt313*PDstandardNth3phi); + + CCTK_REAL cdphi222 = -(fac1*(Gt122*PDstandardNth1phi - + PDstandardNth22phi + Gt222*PDstandardNth2phi + + Gt322*PDstandardNth3phi)) + fac2*SQR(PDstandardNth2phi); + + CCTK_REAL cdphi223 = fac2*PDstandardNth2phi*PDstandardNth3phi - + fac1*(Gt123*PDstandardNth1phi - PDstandardNth23phi + + Gt223*PDstandardNth2phi + Gt323*PDstandardNth3phi); + + CCTK_REAL cdphi233 = -(fac1*(Gt133*PDstandardNth1phi + + Gt233*PDstandardNth2phi - PDstandardNth33phi + + Gt333*PDstandardNth3phi)) + fac2*SQR(PDstandardNth3phi); + + CCTK_REAL Rphi11 = -2*(cdphi211 + 2*(-1 + gt11L*gtu11)*SQR(cdphi1) + + gt11L*(cdphi211*gtu11 + 4*(cdphi1*(cdphi2*gtu12 + cdphi3*gtu13) + + cdphi2*cdphi3*gtu23) + cdphi233*gtu33 + gtu22*(cdphi222 + + 2*SQR(cdphi2)) + 2*(cdphi212*gtu12 + cdphi213*gtu13 + cdphi223*gtu23 + + gtu33*SQR(cdphi3)))); + + CCTK_REAL Rphi12 = -2*(cdphi212 + cdphi1*(cdphi2*(-2 + 4*gt12L*gtu12) + + 4*cdphi3*gt12L*gtu13) + gt12L*(cdphi211*gtu11 + 4*cdphi2*cdphi3*gtu23 + + 2*(cdphi212*gtu12 + cdphi213*gtu13 + cdphi223*gtu23 + + gtu11*SQR(cdphi1)) + gtu22*(cdphi222 + 2*SQR(cdphi2)) + gtu33*(cdphi233 + + 2*SQR(cdphi3)))); + + CCTK_REAL Rphi13 = -2*(cdphi213 + cdphi1*(4*cdphi2*gt13L*gtu12 + + cdphi3*(-2 + 4*gt13L*gtu13)) + gt13L*(cdphi211*gtu11 + + 4*cdphi2*cdphi3*gtu23 + 2*(cdphi212*gtu12 + cdphi213*gtu13 + + cdphi223*gtu23 + gtu11*SQR(cdphi1)) + gtu22*(cdphi222 + 2*SQR(cdphi2)) + + gtu33*(cdphi233 + 2*SQR(cdphi3)))); + + CCTK_REAL Rphi22 = -2*(cdphi222 + 2*(-1 + gt22L*gtu22)*SQR(cdphi2) + + gt22L*(cdphi222*gtu22 + 4*(cdphi1*cdphi3*gtu13 + cdphi2*(cdphi1*gtu12 + + cdphi3*gtu23)) + cdphi233*gtu33 + gtu11*(cdphi211 + 2*SQR(cdphi1)) + + 2*(cdphi212*gtu12 + cdphi213*gtu13 + cdphi223*gtu23 + + gtu33*SQR(cdphi3)))); + + CCTK_REAL Rphi23 = -2*(cdphi223 + cdphi2*(4*cdphi1*gt23L*gtu12 + + cdphi3*(-2 + 4*gt23L*gtu23)) + gt23L*(4*cdphi1*cdphi3*gtu13 + + cdphi222*gtu22 + gtu11*(cdphi211 + 2*SQR(cdphi1)) + 2*(cdphi212*gtu12 + + cdphi213*gtu13 + cdphi223*gtu23 + gtu22*SQR(cdphi2)) + gtu33*(cdphi233 + + 2*SQR(cdphi3)))); + + CCTK_REAL Rphi33 = -2*(cdphi233 + gt33L*((4*cdphi1*cdphi2 + + 2*cdphi212)*gtu12 + 4*cdphi3*(cdphi1*gtu13 + cdphi2*gtu23) + + 2*(cdphi213*gtu13 + cdphi223*gtu23) + cdphi233*gtu33 + gtu11*(cdphi211 + + 2*SQR(cdphi1)) + gtu22*(cdphi222 + 2*SQR(cdphi2))) + 2*(-1 + + gt33L*gtu33)*SQR(cdphi3)); + + CCTK_REAL e4phi = + IfThen(ToReal(conformalMethod),INV(SQR(phiL)),exp(4*phiL)); + + CCTK_REAL em4phi = INV(e4phi); + + CCTK_REAL gu11 = em4phi*gtu11; + + CCTK_REAL gu12 = em4phi*gtu12; + + CCTK_REAL gu13 = em4phi*gtu13; + + CCTK_REAL gu22 = em4phi*gtu22; + + CCTK_REAL gu23 = em4phi*gtu23; + + CCTK_REAL gu33 = em4phi*gtu33; + + CCTK_REAL R11 = Rphi11 + Rt11; + + CCTK_REAL R12 = Rphi12 + Rt12; + + CCTK_REAL R13 = Rphi13 + Rt13; + + CCTK_REAL R22 = Rphi22 + Rt22; + + CCTK_REAL R23 = Rphi23 + Rt23; + + CCTK_REAL R33 = Rphi33 + Rt33; + + CCTK_REAL trR = gu11*R11 + gu22*R22 + 2*(gu12*R12 + gu13*R13 + + gu23*R23) + gu33*R33; + + CCTK_REAL Atm11 = At11L*gtu11 + At12L*gtu12 + At13L*gtu13; + + CCTK_REAL Atm21 = At11L*gtu12 + At12L*gtu22 + At13L*gtu23; + + CCTK_REAL Atm31 = At11L*gtu13 + At12L*gtu23 + At13L*gtu33; + + CCTK_REAL Atm12 = At12L*gtu11 + At22L*gtu12 + At23L*gtu13; + + CCTK_REAL Atm22 = At12L*gtu12 + At22L*gtu22 + At23L*gtu23; + + CCTK_REAL Atm32 = At12L*gtu13 + At22L*gtu23 + At23L*gtu33; + + CCTK_REAL Atm13 = At13L*gtu11 + At23L*gtu12 + At33L*gtu13; + + CCTK_REAL Atm23 = At13L*gtu12 + At23L*gtu22 + At33L*gtu23; + + CCTK_REAL Atm33 = At13L*gtu13 + At23L*gtu23 + At33L*gtu33; + + CCTK_REAL rho = INV(SQR(alphaL))*(eTttL - 2*(beta2L*eTtyL + + beta3L*eTtzL) + 2*(beta1L*(-eTtxL + beta2L*eTxyL + beta3L*eTxzL) + + beta2L*beta3L*eTyzL) + eTxxL*SQR(beta1L) + eTyyL*SQR(beta2L) + + eTzzL*SQR(beta3L)); + + CCTK_REAL HL = -2.*(Atm12*Atm21 + Atm13*Atm31 + Atm23*Atm32) - + 50.26548245743669181540229413247204614715*rho + trR - 1.*(SQR(Atm11) + + SQR(Atm22) + SQR(Atm33)) + + 0.6666666666666666666666666666666666666667*SQR(trKL); + + + /* Copy local copies back to grid functions */ + H[index] = HL; + } + LC_ENDLOOP3 (ML_BSSN_O8_constraints1); +} + +extern "C" void ML_BSSN_O8_constraints1(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverInterior(cctkGH, &ML_BSSN_O8_constraints1_Body); +} diff --git a/ML_BSSN_O8/src/ML_BSSN_O8_constraints2.cc b/ML_BSSN_O8/src/ML_BSSN_O8_constraints2.cc new file mode 100644 index 0000000..c7aa917 --- /dev/null +++ b/ML_BSSN_O8/src/ML_BSSN_O8_constraints2.cc @@ -0,0 +1,394 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +extern "C" void ML_BSSN_O8_constraints2_SelectBCs(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT ierr = 0; + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_O8::ML_cons_detg","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_O8::ML_cons_detg."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_O8::ML_cons_Gamma","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_O8::ML_cons_Gamma."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_O8::ML_cons_traceA","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_O8::ML_cons_traceA."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_O8::ML_mom","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_O8::ML_mom."); + return; +} + +static void ML_BSSN_O8_constraints2_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_BSSN_O8_constraints2_Body"); + } + + if (cctk_iteration % ML_BSSN_O8_constraints2_calc_every != ML_BSSN_O8_constraints2_calc_offset) + { + return; + } + + const char *groups[] = {"ML_BSSN_O8::ML_cons_detg","ML_BSSN_O8::ML_cons_Gamma","ML_BSSN_O8::ML_cons_traceA","ML_BSSN_O8::ML_curv","ML_BSSN_O8::ML_Gamma","ML_BSSN_O8::ML_lapse","ML_BSSN_O8::ML_log_confac","ML_BSSN_O8::ML_metric","ML_BSSN_O8::ML_mom","ML_BSSN_O8::ML_shift","ML_BSSN_O8::ML_trace_curv"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_BSSN_O8_constraints2", 11, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o1024dx = 0.0009765625*INV(dx); + CCTK_REAL const p1o1024dy = 0.0009765625*INV(dy); + CCTK_REAL const p1o1024dz = 0.0009765625*INV(dz); + CCTK_REAL const p1o1680dx = 0.000595238095238095238095238095238*INV(dx); + CCTK_REAL const p1o1680dy = 0.000595238095238095238095238095238*INV(dy); + CCTK_REAL const p1o1680dz = 0.000595238095238095238095238095238*INV(dz); + CCTK_REAL const p1o5040dx2 = 0.000198412698412698412698412698413*INV(SQR(dx)); + CCTK_REAL const p1o5040dy2 = 0.000198412698412698412698412698413*INV(SQR(dy)); + CCTK_REAL const p1o5040dz2 = 0.000198412698412698412698412698413*INV(SQR(dz)); + CCTK_REAL const p1o560dx = 0.00178571428571428571428571428571*INV(dx); + CCTK_REAL const p1o560dy = 0.00178571428571428571428571428571*INV(dy); + CCTK_REAL const p1o560dz = 0.00178571428571428571428571428571*INV(dz); + CCTK_REAL const p1o705600dxdy = 1.41723356009070294784580498866e-6*INV(dx)*INV(dy); + CCTK_REAL const p1o705600dxdz = 1.41723356009070294784580498866e-6*INV(dx)*INV(dz); + CCTK_REAL const p1o705600dydz = 1.41723356009070294784580498866e-6*INV(dy)*INV(dz); + CCTK_REAL const p1o840dx = 0.00119047619047619047619047619048*INV(dx); + CCTK_REAL const p1o840dy = 0.00119047619047619047619047619048*INV(dy); + CCTK_REAL const p1o840dz = 0.00119047619047619047619047619048*INV(dz); + CCTK_REAL const p1odx = INV(dx); + CCTK_REAL const p1ody = INV(dy); + CCTK_REAL const p1odz = INV(dz); + CCTK_REAL const pm1o840dx = -0.00119047619047619047619047619048*INV(dx); + CCTK_REAL const pm1o840dy = -0.00119047619047619047619047619048*INV(dy); + CCTK_REAL const pm1o840dz = -0.00119047619047619047619047619048*INV(dz); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_BSSN_O8_constraints2, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + CCTK_REAL alphaL = alpha[index]; + CCTK_REAL At11L = At11[index]; + CCTK_REAL At12L = At12[index]; + CCTK_REAL At13L = At13[index]; + CCTK_REAL At22L = At22[index]; + CCTK_REAL At23L = At23[index]; + CCTK_REAL At33L = At33[index]; + CCTK_REAL beta1L = beta1[index]; + CCTK_REAL beta2L = beta2[index]; + CCTK_REAL beta3L = beta3[index]; + CCTK_REAL eTtxL = (*stress_energy_state) ? eTtx[index] : ToReal(0.0); + CCTK_REAL eTtyL = (*stress_energy_state) ? eTty[index] : ToReal(0.0); + CCTK_REAL eTtzL = (*stress_energy_state) ? eTtz[index] : ToReal(0.0); + CCTK_REAL eTxxL = (*stress_energy_state) ? eTxx[index] : ToReal(0.0); + CCTK_REAL eTxyL = (*stress_energy_state) ? eTxy[index] : ToReal(0.0); + CCTK_REAL eTxzL = (*stress_energy_state) ? eTxz[index] : ToReal(0.0); + CCTK_REAL eTyyL = (*stress_energy_state) ? eTyy[index] : ToReal(0.0); + CCTK_REAL eTyzL = (*stress_energy_state) ? eTyz[index] : ToReal(0.0); + CCTK_REAL eTzzL = (*stress_energy_state) ? eTzz[index] : ToReal(0.0); + CCTK_REAL gt11L = gt11[index]; + CCTK_REAL gt12L = gt12[index]; + CCTK_REAL gt13L = gt13[index]; + CCTK_REAL gt22L = gt22[index]; + CCTK_REAL gt23L = gt23[index]; + CCTK_REAL gt33L = gt33[index]; + CCTK_REAL phiL = phi[index]; + CCTK_REAL trKL = trK[index]; + CCTK_REAL Xt1L = Xt1[index]; + CCTK_REAL Xt2L = Xt2[index]; + CCTK_REAL Xt3L = Xt3[index]; + + /* Include user supplied include files */ + + /* Precompute derivatives */ + CCTK_REAL const PDstandardNth1At11 = PDstandardNth1(&At11[index]); + CCTK_REAL const PDstandardNth2At11 = PDstandardNth2(&At11[index]); + CCTK_REAL const PDstandardNth3At11 = PDstandardNth3(&At11[index]); + CCTK_REAL const PDstandardNth1At12 = PDstandardNth1(&At12[index]); + CCTK_REAL const PDstandardNth2At12 = PDstandardNth2(&At12[index]); + CCTK_REAL const PDstandardNth3At12 = PDstandardNth3(&At12[index]); + CCTK_REAL const PDstandardNth1At13 = PDstandardNth1(&At13[index]); + CCTK_REAL const PDstandardNth2At13 = PDstandardNth2(&At13[index]); + CCTK_REAL const PDstandardNth3At13 = PDstandardNth3(&At13[index]); + CCTK_REAL const PDstandardNth1At22 = PDstandardNth1(&At22[index]); + CCTK_REAL const PDstandardNth2At22 = PDstandardNth2(&At22[index]); + CCTK_REAL const PDstandardNth3At22 = PDstandardNth3(&At22[index]); + CCTK_REAL const PDstandardNth1At23 = PDstandardNth1(&At23[index]); + CCTK_REAL const PDstandardNth2At23 = PDstandardNth2(&At23[index]); + CCTK_REAL const PDstandardNth3At23 = PDstandardNth3(&At23[index]); + CCTK_REAL const PDstandardNth1At33 = PDstandardNth1(&At33[index]); + CCTK_REAL const PDstandardNth2At33 = PDstandardNth2(&At33[index]); + CCTK_REAL const PDstandardNth3At33 = PDstandardNth3(&At33[index]); + CCTK_REAL const PDstandardNth1gt11 = PDstandardNth1(>11[index]); + CCTK_REAL const PDstandardNth2gt11 = PDstandardNth2(>11[index]); + CCTK_REAL const PDstandardNth3gt11 = PDstandardNth3(>11[index]); + CCTK_REAL const PDstandardNth1gt12 = PDstandardNth1(>12[index]); + CCTK_REAL const PDstandardNth2gt12 = PDstandardNth2(>12[index]); + CCTK_REAL const PDstandardNth3gt12 = PDstandardNth3(>12[index]); + CCTK_REAL const PDstandardNth1gt13 = PDstandardNth1(>13[index]); + CCTK_REAL const PDstandardNth2gt13 = PDstandardNth2(>13[index]); + CCTK_REAL const PDstandardNth3gt13 = PDstandardNth3(>13[index]); + CCTK_REAL const PDstandardNth1gt22 = PDstandardNth1(>22[index]); + CCTK_REAL const PDstandardNth2gt22 = PDstandardNth2(>22[index]); + CCTK_REAL const PDstandardNth3gt22 = PDstandardNth3(>22[index]); + CCTK_REAL const PDstandardNth1gt23 = PDstandardNth1(>23[index]); + CCTK_REAL const PDstandardNth2gt23 = PDstandardNth2(>23[index]); + CCTK_REAL const PDstandardNth3gt23 = PDstandardNth3(>23[index]); + CCTK_REAL const PDstandardNth1gt33 = PDstandardNth1(>33[index]); + CCTK_REAL const PDstandardNth2gt33 = PDstandardNth2(>33[index]); + CCTK_REAL const PDstandardNth3gt33 = PDstandardNth3(>33[index]); + CCTK_REAL const PDstandardNth1phi = PDstandardNth1(&phi[index]); + CCTK_REAL const PDstandardNth2phi = PDstandardNth2(&phi[index]); + CCTK_REAL const PDstandardNth3phi = PDstandardNth3(&phi[index]); + CCTK_REAL const PDstandardNth1trK = PDstandardNth1(&trK[index]); + CCTK_REAL const PDstandardNth2trK = PDstandardNth2(&trK[index]); + CCTK_REAL const PDstandardNth3trK = PDstandardNth3(&trK[index]); + + /* Calculate temporaries and grid functions */ + CCTK_REAL detgt = 1; + + CCTK_REAL gtu11 = INV(detgt)*(gt22L*gt33L - SQR(gt23L)); + + CCTK_REAL gtu12 = (gt13L*gt23L - gt12L*gt33L)*INV(detgt); + + CCTK_REAL gtu13 = (-(gt13L*gt22L) + gt12L*gt23L)*INV(detgt); + + CCTK_REAL gtu22 = INV(detgt)*(gt11L*gt33L - SQR(gt13L)); + + CCTK_REAL gtu23 = (gt12L*gt13L - gt11L*gt23L)*INV(detgt); + + CCTK_REAL gtu33 = INV(detgt)*(gt11L*gt22L - SQR(gt12L)); + + CCTK_REAL Gtl111 = 0.5*PDstandardNth1gt11; + + CCTK_REAL Gtl112 = 0.5*PDstandardNth2gt11; + + CCTK_REAL Gtl113 = 0.5*PDstandardNth3gt11; + + CCTK_REAL Gtl122 = -0.5*PDstandardNth1gt22 + PDstandardNth2gt12; + + CCTK_REAL Gtl123 = 0.5*(-PDstandardNth1gt23 + PDstandardNth2gt13 + + PDstandardNth3gt12); + + CCTK_REAL Gtl133 = -0.5*PDstandardNth1gt33 + PDstandardNth3gt13; + + CCTK_REAL Gtl211 = PDstandardNth1gt12 - 0.5*PDstandardNth2gt11; + + CCTK_REAL Gtl212 = 0.5*PDstandardNth1gt22; + + CCTK_REAL Gtl213 = 0.5*(PDstandardNth1gt23 - PDstandardNth2gt13 + + PDstandardNth3gt12); + + CCTK_REAL Gtl222 = 0.5*PDstandardNth2gt22; + + CCTK_REAL Gtl223 = 0.5*PDstandardNth3gt22; + + CCTK_REAL Gtl233 = -0.5*PDstandardNth2gt33 + PDstandardNth3gt23; + + CCTK_REAL Gtl311 = PDstandardNth1gt13 - 0.5*PDstandardNth3gt11; + + CCTK_REAL Gtl312 = 0.5*(PDstandardNth1gt23 + PDstandardNth2gt13 - + PDstandardNth3gt12); + + CCTK_REAL Gtl313 = 0.5*PDstandardNth1gt33; + + CCTK_REAL Gtl322 = PDstandardNth2gt23 - 0.5*PDstandardNth3gt22; + + CCTK_REAL Gtl323 = 0.5*PDstandardNth2gt33; + + CCTK_REAL Gtl333 = 0.5*PDstandardNth3gt33; + + CCTK_REAL Gt111 = Gtl111*gtu11 + Gtl211*gtu12 + Gtl311*gtu13; + + CCTK_REAL Gt211 = Gtl111*gtu12 + Gtl211*gtu22 + Gtl311*gtu23; + + CCTK_REAL Gt311 = Gtl111*gtu13 + Gtl211*gtu23 + Gtl311*gtu33; + + CCTK_REAL Gt112 = Gtl112*gtu11 + Gtl212*gtu12 + Gtl312*gtu13; + + CCTK_REAL Gt212 = Gtl112*gtu12 + Gtl212*gtu22 + Gtl312*gtu23; + + CCTK_REAL Gt312 = Gtl112*gtu13 + Gtl212*gtu23 + Gtl312*gtu33; + + CCTK_REAL Gt113 = Gtl113*gtu11 + Gtl213*gtu12 + Gtl313*gtu13; + + CCTK_REAL Gt213 = Gtl113*gtu12 + Gtl213*gtu22 + Gtl313*gtu23; + + CCTK_REAL Gt313 = Gtl113*gtu13 + Gtl213*gtu23 + Gtl313*gtu33; + + CCTK_REAL Gt122 = Gtl122*gtu11 + Gtl222*gtu12 + Gtl322*gtu13; + + CCTK_REAL Gt222 = Gtl122*gtu12 + Gtl222*gtu22 + Gtl322*gtu23; + + CCTK_REAL Gt322 = Gtl122*gtu13 + Gtl222*gtu23 + Gtl322*gtu33; + + CCTK_REAL Gt123 = Gtl123*gtu11 + Gtl223*gtu12 + Gtl323*gtu13; + + CCTK_REAL Gt223 = Gtl123*gtu12 + Gtl223*gtu22 + Gtl323*gtu23; + + CCTK_REAL Gt323 = Gtl123*gtu13 + Gtl223*gtu23 + Gtl323*gtu33; + + CCTK_REAL Gt133 = Gtl133*gtu11 + Gtl233*gtu12 + Gtl333*gtu13; + + CCTK_REAL Gt233 = Gtl133*gtu12 + Gtl233*gtu22 + Gtl333*gtu23; + + CCTK_REAL Gt333 = Gtl133*gtu13 + Gtl233*gtu23 + Gtl333*gtu33; + + CCTK_REAL fac1 = IfThen(ToReal(conformalMethod),-0.5*INV(phiL),1); + + CCTK_REAL cdphi1 = fac1*PDstandardNth1phi; + + CCTK_REAL cdphi2 = fac1*PDstandardNth2phi; + + CCTK_REAL cdphi3 = fac1*PDstandardNth3phi; + + CCTK_REAL S1 = (-eTtxL + beta1L*eTxxL + beta2L*eTxyL + + beta3L*eTxzL)*INV(alphaL); + + CCTK_REAL S2 = (-eTtyL + beta1L*eTxyL + beta2L*eTyyL + + beta3L*eTyzL)*INV(alphaL); + + CCTK_REAL S3 = (-eTtzL + beta1L*eTxzL + beta2L*eTyzL + + beta3L*eTzzL)*INV(alphaL); + + CCTK_REAL M1L = -2.*((At12L*Gt211 + At13L*Gt311)*gtu11 + + At11L*Gt123*gtu23) + At12L*((6.*cdphi1 - 1.*Gt111)*gtu12 - + 3.*Gt213*gtu13 + 6.*(cdphi2*gtu22 + cdphi3*gtu23) - 1.*Gt233*gtu33) - + 1.*((At22L*Gt212 + At12L*(Gt112 + Gt222) + At23L*Gt312)*gtu22 + + (At13L*Gt112 + At12L*Gt113 + At23L*Gt212)*gtu23 + (At13L*Gt113 + + At23L*Gt213 + At33L*Gt313)*gtu33) + At11L*((6.*cdphi1 - 2.*Gt111)*gtu11 + + 6.*(cdphi2*gtu12 + cdphi3*gtu13) - 1.*(Gt122*gtu22 + Gt133*gtu33)) + + At13L*((6.*cdphi1 - 1.*Gt111)*gtu13 + 6.*(cdphi2*gtu23 + cdphi3*gtu33) + - 1.*(Gt322*gtu22 + Gt333*gtu33)) + gtu11*PDstandardNth1At11 - + 0.6666666666666666666666666666666666666667*PDstandardNth1trK + + gtu12*(-1.*(At22L*Gt211 + At23L*Gt311) - 3.*(At11L*Gt112 + At12L*Gt212 + + At13L*Gt312) + PDstandardNth1At12 + PDstandardNth2At11) + + gtu22*PDstandardNth2At12 + gtu13*(-1.*(At23L*Gt211 + At33L*Gt311) - + 3.*(At11L*Gt113 + At13L*Gt313) + PDstandardNth1At13 + + PDstandardNth3At11) + gtu23*(-1.*(At22L*Gt213 + At33L*Gt312 + + At23L*Gt313) - 2.*(At12L*Gt223 + At13L*Gt323) + PDstandardNth2At13 + + PDstandardNth3At12) + gtu33*PDstandardNth3At13 - + 25.13274122871834590770114706623602307358*S1; + + CCTK_REAL M2L = At12L*((6.*cdphi1 - 1.*Gt111)*gtu11 + 6.*(cdphi2*gtu12 + + cdphi3*gtu13) - 2.*Gt122*gtu22 - 3.*Gt123*gtu23 - 1.*Gt133*gtu33) + + At22L*((6.*cdphi2 - 2.*Gt222)*gtu22 + 6.*cdphi3*gtu23 - 1.*Gt233*gtu33) + + At23L*(-2.*Gt322*gtu22 - 1.*Gt333*gtu33 + 6.*(cdphi2*gtu23 + + cdphi3*gtu33)) - 1.*((At11L*Gt112 + At22L*Gt211 + At12L*Gt212 + + At23L*Gt311 + At13L*Gt312)*gtu11 + Gt122*(At11L*gtu12 + At13L*gtu23) + + (At23L*Gt223 + At33L*Gt323)*gtu33 + At13L*(Gt112*gtu13 + Gt123*gtu33)) + + gtu11*PDstandardNth1At12 + gtu12*(At22L*(6.*cdphi1 - 3.*Gt212) + + At12L*(-3.*Gt112 - 1.*Gt222) - 3.*At23L*Gt312 - 1.*At13L*Gt322 + + PDstandardNth1At22 + PDstandardNth2At12) + gtu22*PDstandardNth2At22 - + 0.6666666666666666666666666666666666666667*PDstandardNth2trK + + gtu13*(-2.*(At12L*Gt113 + At22L*Gt213) + At23L*(6.*cdphi1 - 1.*Gt212 - + 2.*Gt313) - 1.*(At11L*Gt123 + At12L*Gt223 + At33L*Gt312 + At13L*Gt323) + + PDstandardNth1At23 + PDstandardNth3At12) + gtu23*(-1.*(At23L*Gt222 + + At33L*Gt322) - 3.*(At22L*Gt223 + At23L*Gt323) + PDstandardNth2At23 + + PDstandardNth3At22) + gtu33*PDstandardNth3At23 - + 25.13274122871834590770114706623602307358*S2; + + CCTK_REAL M3L = -1.*((At11L*Gt113 + At23L*Gt211 + At12L*Gt213 + + At33L*Gt311)*gtu11 + (At22L*Gt223 + At33L*Gt322 + At23L*Gt323)*gtu22 + + At12L*(Gt113*gtu12 + Gt123*gtu22) + Gt133*(At11L*gtu13 + At12L*gtu23)) + + At13L*((6.*cdphi1 - 1.*(Gt111 + Gt313))*gtu11 + 6.*(cdphi2*gtu12 + + cdphi3*gtu13) - 1.*Gt122*gtu22 - 3.*Gt123*gtu23 - 2.*Gt133*gtu33) + + At23L*((6.*cdphi2 - 1.*Gt222)*gtu22 + 6.*cdphi3*gtu23 - 2.*Gt233*gtu33) + + gtu11*PDstandardNth1At13 + gtu12*(-2.*(At13L*Gt112 + At33L*Gt312) + + At23L*(6.*cdphi1 - 2.*Gt212 - 1.*Gt313) - 1.*(At11L*Gt123 + At22L*Gt213 + + At12L*Gt223 + At13L*Gt323) + PDstandardNth1At23 + PDstandardNth2At13) + + gtu22*PDstandardNth2At23 + gtu13*(-3.*(At13L*Gt113 + At23L*Gt213) + + At33L*(6.*cdphi1 - 3.*Gt313) - 1.*(At12L*Gt233 + At13L*Gt333) + + PDstandardNth1At33 + PDstandardNth3At13) + gtu23*(-1.*At22L*Gt233 + + At33L*(6.*cdphi2 - 3.*Gt323) + At23L*(-3.*Gt223 - 1.*Gt333) + + PDstandardNth2At33 + PDstandardNth3At23) + gtu33*(At33L*(6.*cdphi3 - + 2.*Gt333) + PDstandardNth3At33) - + 0.6666666666666666666666666666666666666667*PDstandardNth3trK - + 25.13274122871834590770114706623602307358*S3; + + CCTK_REAL cSL = Log(detgt); + + CCTK_REAL cXt1L = Gt111*gtu11 + Gt122*gtu22 + 2*(Gt112*gtu12 + + Gt113*gtu13 + Gt123*gtu23) + Gt133*gtu33 - Xt1L; + + CCTK_REAL cXt2L = Gt211*gtu11 + Gt222*gtu22 + 2*(Gt212*gtu12 + + Gt213*gtu13 + Gt223*gtu23) + Gt233*gtu33 - Xt2L; + + CCTK_REAL cXt3L = Gt311*gtu11 + Gt322*gtu22 + 2*(Gt312*gtu12 + + Gt313*gtu13 + Gt323*gtu23) + Gt333*gtu33 - Xt3L; + + CCTK_REAL cAL = At11L*gtu11 + At22L*gtu22 + 2*(At12L*gtu12 + + At13L*gtu13 + At23L*gtu23) + At33L*gtu33; + + + /* Copy local copies back to grid functions */ + cA[index] = cAL; + cS[index] = cSL; + cXt1[index] = cXt1L; + cXt2[index] = cXt2L; + cXt3[index] = cXt3L; + M1[index] = M1L; + M2[index] = M2L; + M3[index] = M3L; + } + LC_ENDLOOP3 (ML_BSSN_O8_constraints2); +} + +extern "C" void ML_BSSN_O8_constraints2(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverInterior(cctkGH, &ML_BSSN_O8_constraints2_Body); +} diff --git a/ML_BSSN_O8/src/ML_BSSN_O8_convertFromADMBase.cc b/ML_BSSN_O8/src/ML_BSSN_O8_convertFromADMBase.cc new file mode 100644 index 0000000..f84945e --- /dev/null +++ b/ML_BSSN_O8/src/ML_BSSN_O8_convertFromADMBase.cc @@ -0,0 +1,228 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +static void ML_BSSN_O8_convertFromADMBase_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_BSSN_O8_convertFromADMBase_Body"); + } + + if (cctk_iteration % ML_BSSN_O8_convertFromADMBase_calc_every != ML_BSSN_O8_convertFromADMBase_calc_offset) + { + return; + } + + const char *groups[] = {"ADMBase::curv","ADMBase::lapse","ADMBase::metric","ADMBase::shift","ML_BSSN_O8::ML_curv","ML_BSSN_O8::ML_lapse","ML_BSSN_O8::ML_log_confac","ML_BSSN_O8::ML_metric","ML_BSSN_O8::ML_shift","ML_BSSN_O8::ML_trace_curv"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_BSSN_O8_convertFromADMBase", 10, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o1024dx = 0.0009765625*INV(dx); + CCTK_REAL const p1o1024dy = 0.0009765625*INV(dy); + CCTK_REAL const p1o1024dz = 0.0009765625*INV(dz); + CCTK_REAL const p1o1680dx = 0.000595238095238095238095238095238*INV(dx); + CCTK_REAL const p1o1680dy = 0.000595238095238095238095238095238*INV(dy); + CCTK_REAL const p1o1680dz = 0.000595238095238095238095238095238*INV(dz); + CCTK_REAL const p1o5040dx2 = 0.000198412698412698412698412698413*INV(SQR(dx)); + CCTK_REAL const p1o5040dy2 = 0.000198412698412698412698412698413*INV(SQR(dy)); + CCTK_REAL const p1o5040dz2 = 0.000198412698412698412698412698413*INV(SQR(dz)); + CCTK_REAL const p1o560dx = 0.00178571428571428571428571428571*INV(dx); + CCTK_REAL const p1o560dy = 0.00178571428571428571428571428571*INV(dy); + CCTK_REAL const p1o560dz = 0.00178571428571428571428571428571*INV(dz); + CCTK_REAL const p1o705600dxdy = 1.41723356009070294784580498866e-6*INV(dx)*INV(dy); + CCTK_REAL const p1o705600dxdz = 1.41723356009070294784580498866e-6*INV(dx)*INV(dz); + CCTK_REAL const p1o705600dydz = 1.41723356009070294784580498866e-6*INV(dy)*INV(dz); + CCTK_REAL const p1o840dx = 0.00119047619047619047619047619048*INV(dx); + CCTK_REAL const p1o840dy = 0.00119047619047619047619047619048*INV(dy); + CCTK_REAL const p1o840dz = 0.00119047619047619047619047619048*INV(dz); + CCTK_REAL const p1odx = INV(dx); + CCTK_REAL const p1ody = INV(dy); + CCTK_REAL const p1odz = INV(dz); + CCTK_REAL const pm1o840dx = -0.00119047619047619047619047619048*INV(dx); + CCTK_REAL const pm1o840dy = -0.00119047619047619047619047619048*INV(dy); + CCTK_REAL const pm1o840dz = -0.00119047619047619047619047619048*INV(dz); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_BSSN_O8_convertFromADMBase, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + CCTK_REAL alpL = alp[index]; + CCTK_REAL betaxL = betax[index]; + CCTK_REAL betayL = betay[index]; + CCTK_REAL betazL = betaz[index]; + CCTK_REAL gxxL = gxx[index]; + CCTK_REAL gxyL = gxy[index]; + CCTK_REAL gxzL = gxz[index]; + CCTK_REAL gyyL = gyy[index]; + CCTK_REAL gyzL = gyz[index]; + CCTK_REAL gzzL = gzz[index]; + CCTK_REAL kxxL = kxx[index]; + CCTK_REAL kxyL = kxy[index]; + CCTK_REAL kxzL = kxz[index]; + CCTK_REAL kyyL = kyy[index]; + CCTK_REAL kyzL = kyz[index]; + CCTK_REAL kzzL = kzz[index]; + CCTK_REAL phiL = phi[index]; + CCTK_REAL trKL = trK[index]; + + /* Include user supplied include files */ + + /* Precompute derivatives */ + + /* Calculate temporaries and grid functions */ + CCTK_REAL g11 = gxxL; + + CCTK_REAL g12 = gxyL; + + CCTK_REAL g13 = gxzL; + + CCTK_REAL g22 = gyyL; + + CCTK_REAL g23 = gyzL; + + CCTK_REAL g33 = gzzL; + + CCTK_REAL detg = 2*g12*g13*g23 + g33*(g11*g22 - SQR(g12)) - + g22*SQR(g13) - g11*SQR(g23); + + CCTK_REAL gu11 = INV(detg)*(g22*g33 - SQR(g23)); + + CCTK_REAL gu12 = (g13*g23 - g12*g33)*INV(detg); + + CCTK_REAL gu13 = (-(g13*g22) + g12*g23)*INV(detg); + + CCTK_REAL gu22 = INV(detg)*(g11*g33 - SQR(g13)); + + CCTK_REAL gu23 = (g12*g13 - g11*g23)*INV(detg); + + CCTK_REAL gu33 = INV(detg)*(g11*g22 - SQR(g12)); + + phiL = + IfThen(ToReal(conformalMethod),pow(detg,-0.166666666666666666666666666667),0.0833333333333333333333333333333*Log(detg)); + + CCTK_REAL em4phi = + IfThen(ToReal(conformalMethod),SQR(phiL),exp(-4*phiL)); + + CCTK_REAL gt11L = em4phi*g11; + + CCTK_REAL gt12L = em4phi*g12; + + CCTK_REAL gt13L = em4phi*g13; + + CCTK_REAL gt22L = em4phi*g22; + + CCTK_REAL gt23L = em4phi*g23; + + CCTK_REAL gt33L = em4phi*g33; + + trKL = gu11*kxxL + gu22*kyyL + 2*(gu12*kxyL + gu13*kxzL + gu23*kyzL) + + gu33*kzzL; + + CCTK_REAL At11L = em4phi*(kxxL - + 0.333333333333333333333333333333*g11*trKL); + + CCTK_REAL At12L = em4phi*(kxyL - + 0.333333333333333333333333333333*g12*trKL); + + CCTK_REAL At13L = em4phi*(kxzL - + 0.333333333333333333333333333333*g13*trKL); + + CCTK_REAL At22L = em4phi*(kyyL - + 0.333333333333333333333333333333*g22*trKL); + + CCTK_REAL At23L = em4phi*(kyzL - + 0.333333333333333333333333333333*g23*trKL); + + CCTK_REAL At33L = em4phi*(kzzL - + 0.333333333333333333333333333333*g33*trKL); + + CCTK_REAL alphaL = alpL; + + CCTK_REAL beta1L = betaxL; + + CCTK_REAL beta2L = betayL; + + CCTK_REAL beta3L = betazL; + + + /* Copy local copies back to grid functions */ + alpha[index] = alphaL; + At11[index] = At11L; + At12[index] = At12L; + At13[index] = At13L; + At22[index] = At22L; + At23[index] = At23L; + At33[index] = At33L; + beta1[index] = beta1L; + beta2[index] = beta2L; + beta3[index] = beta3L; + gt11[index] = gt11L; + gt12[index] = gt12L; + gt13[index] = gt13L; + gt22[index] = gt22L; + gt23[index] = gt23L; + gt33[index] = gt33L; + phi[index] = phiL; + trK[index] = trKL; + } + LC_ENDLOOP3 (ML_BSSN_O8_convertFromADMBase); +} + +extern "C" void ML_BSSN_O8_convertFromADMBase(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverEverything(cctkGH, &ML_BSSN_O8_convertFromADMBase_Body); +} diff --git a/ML_BSSN_O8/src/ML_BSSN_O8_convertFromADMBaseGamma.cc b/ML_BSSN_O8/src/ML_BSSN_O8_convertFromADMBaseGamma.cc new file mode 100644 index 0000000..3fb26b0 --- /dev/null +++ b/ML_BSSN_O8/src/ML_BSSN_O8_convertFromADMBaseGamma.cc @@ -0,0 +1,332 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +extern "C" void ML_BSSN_O8_convertFromADMBaseGamma_SelectBCs(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT ierr = 0; + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_O8::ML_dtlapse","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_O8::ML_dtlapse."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_O8::ML_dtshift","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_O8::ML_dtshift."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_O8::ML_Gamma","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_O8::ML_Gamma."); + return; +} + +static void ML_BSSN_O8_convertFromADMBaseGamma_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_BSSN_O8_convertFromADMBaseGamma_Body"); + } + + if (cctk_iteration % ML_BSSN_O8_convertFromADMBaseGamma_calc_every != ML_BSSN_O8_convertFromADMBaseGamma_calc_offset) + { + return; + } + + const char *groups[] = {"ADMBase::dtlapse","ADMBase::dtshift","grid::coordinates","Grid::coordinates","ML_BSSN_O8::ML_dtlapse","ML_BSSN_O8::ML_dtshift","ML_BSSN_O8::ML_Gamma","ML_BSSN_O8::ML_lapse","ML_BSSN_O8::ML_metric","ML_BSSN_O8::ML_shift"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_BSSN_O8_convertFromADMBaseGamma", 10, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o1024dx = 0.0009765625*INV(dx); + CCTK_REAL const p1o1024dy = 0.0009765625*INV(dy); + CCTK_REAL const p1o1024dz = 0.0009765625*INV(dz); + CCTK_REAL const p1o1680dx = 0.000595238095238095238095238095238*INV(dx); + CCTK_REAL const p1o1680dy = 0.000595238095238095238095238095238*INV(dy); + CCTK_REAL const p1o1680dz = 0.000595238095238095238095238095238*INV(dz); + CCTK_REAL const p1o5040dx2 = 0.000198412698412698412698412698413*INV(SQR(dx)); + CCTK_REAL const p1o5040dy2 = 0.000198412698412698412698412698413*INV(SQR(dy)); + CCTK_REAL const p1o5040dz2 = 0.000198412698412698412698412698413*INV(SQR(dz)); + CCTK_REAL const p1o560dx = 0.00178571428571428571428571428571*INV(dx); + CCTK_REAL const p1o560dy = 0.00178571428571428571428571428571*INV(dy); + CCTK_REAL const p1o560dz = 0.00178571428571428571428571428571*INV(dz); + CCTK_REAL const p1o705600dxdy = 1.41723356009070294784580498866e-6*INV(dx)*INV(dy); + CCTK_REAL const p1o705600dxdz = 1.41723356009070294784580498866e-6*INV(dx)*INV(dz); + CCTK_REAL const p1o705600dydz = 1.41723356009070294784580498866e-6*INV(dy)*INV(dz); + CCTK_REAL const p1o840dx = 0.00119047619047619047619047619048*INV(dx); + CCTK_REAL const p1o840dy = 0.00119047619047619047619047619048*INV(dy); + CCTK_REAL const p1o840dz = 0.00119047619047619047619047619048*INV(dz); + CCTK_REAL const p1odx = INV(dx); + CCTK_REAL const p1ody = INV(dy); + CCTK_REAL const p1odz = INV(dz); + CCTK_REAL const pm1o840dx = -0.00119047619047619047619047619048*INV(dx); + CCTK_REAL const pm1o840dy = -0.00119047619047619047619047619048*INV(dy); + CCTK_REAL const pm1o840dz = -0.00119047619047619047619047619048*INV(dz); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_BSSN_O8_convertFromADMBaseGamma, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + CCTK_REAL alphaL = alpha[index]; + CCTK_REAL beta1L = beta1[index]; + CCTK_REAL beta2L = beta2[index]; + CCTK_REAL beta3L = beta3[index]; + CCTK_REAL dtalpL = dtalp[index]; + CCTK_REAL dtbetaxL = dtbetax[index]; + CCTK_REAL dtbetayL = dtbetay[index]; + CCTK_REAL dtbetazL = dtbetaz[index]; + CCTK_REAL gt11L = gt11[index]; + CCTK_REAL gt12L = gt12[index]; + CCTK_REAL gt13L = gt13[index]; + CCTK_REAL gt22L = gt22[index]; + CCTK_REAL gt23L = gt23[index]; + CCTK_REAL gt33L = gt33[index]; + CCTK_REAL rL = r[index]; + + /* Include user supplied include files */ + + /* Precompute derivatives */ + CCTK_REAL const PDupwindNthAnti1alpha = PDupwindNthAnti1(&alpha[index]); + CCTK_REAL const PDupwindNthSymm1alpha = PDupwindNthSymm1(&alpha[index]); + CCTK_REAL const PDupwindNthAnti2alpha = PDupwindNthAnti2(&alpha[index]); + CCTK_REAL const PDupwindNthSymm2alpha = PDupwindNthSymm2(&alpha[index]); + CCTK_REAL const PDupwindNthAnti3alpha = PDupwindNthAnti3(&alpha[index]); + CCTK_REAL const PDupwindNthSymm3alpha = PDupwindNthSymm3(&alpha[index]); + CCTK_REAL const PDupwindNthAnti1beta1 = PDupwindNthAnti1(&beta1[index]); + CCTK_REAL const PDupwindNthSymm1beta1 = PDupwindNthSymm1(&beta1[index]); + CCTK_REAL const PDupwindNthAnti2beta1 = PDupwindNthAnti2(&beta1[index]); + CCTK_REAL const PDupwindNthSymm2beta1 = PDupwindNthSymm2(&beta1[index]); + CCTK_REAL const PDupwindNthAnti3beta1 = PDupwindNthAnti3(&beta1[index]); + CCTK_REAL const PDupwindNthSymm3beta1 = PDupwindNthSymm3(&beta1[index]); + CCTK_REAL const PDupwindNthAnti1beta2 = PDupwindNthAnti1(&beta2[index]); + CCTK_REAL const PDupwindNthSymm1beta2 = PDupwindNthSymm1(&beta2[index]); + CCTK_REAL const PDupwindNthAnti2beta2 = PDupwindNthAnti2(&beta2[index]); + CCTK_REAL const PDupwindNthSymm2beta2 = PDupwindNthSymm2(&beta2[index]); + CCTK_REAL const PDupwindNthAnti3beta2 = PDupwindNthAnti3(&beta2[index]); + CCTK_REAL const PDupwindNthSymm3beta2 = PDupwindNthSymm3(&beta2[index]); + CCTK_REAL const PDupwindNthAnti1beta3 = PDupwindNthAnti1(&beta3[index]); + CCTK_REAL const PDupwindNthSymm1beta3 = PDupwindNthSymm1(&beta3[index]); + CCTK_REAL const PDupwindNthAnti2beta3 = PDupwindNthAnti2(&beta3[index]); + CCTK_REAL const PDupwindNthSymm2beta3 = PDupwindNthSymm2(&beta3[index]); + CCTK_REAL const PDupwindNthAnti3beta3 = PDupwindNthAnti3(&beta3[index]); + CCTK_REAL const PDupwindNthSymm3beta3 = PDupwindNthSymm3(&beta3[index]); + CCTK_REAL const PDstandardNth1gt11 = PDstandardNth1(>11[index]); + CCTK_REAL const PDstandardNth2gt11 = PDstandardNth2(>11[index]); + CCTK_REAL const PDstandardNth3gt11 = PDstandardNth3(>11[index]); + CCTK_REAL const PDstandardNth1gt12 = PDstandardNth1(>12[index]); + CCTK_REAL const PDstandardNth2gt12 = PDstandardNth2(>12[index]); + CCTK_REAL const PDstandardNth3gt12 = PDstandardNth3(>12[index]); + CCTK_REAL const PDstandardNth1gt13 = PDstandardNth1(>13[index]); + CCTK_REAL const PDstandardNth2gt13 = PDstandardNth2(>13[index]); + CCTK_REAL const PDstandardNth3gt13 = PDstandardNth3(>13[index]); + CCTK_REAL const PDstandardNth1gt22 = PDstandardNth1(>22[index]); + CCTK_REAL const PDstandardNth2gt22 = PDstandardNth2(>22[index]); + CCTK_REAL const PDstandardNth3gt22 = PDstandardNth3(>22[index]); + CCTK_REAL const PDstandardNth1gt23 = PDstandardNth1(>23[index]); + CCTK_REAL const PDstandardNth2gt23 = PDstandardNth2(>23[index]); + CCTK_REAL const PDstandardNth3gt23 = PDstandardNth3(>23[index]); + CCTK_REAL const PDstandardNth1gt33 = PDstandardNth1(>33[index]); + CCTK_REAL const PDstandardNth2gt33 = PDstandardNth2(>33[index]); + CCTK_REAL const PDstandardNth3gt33 = PDstandardNth3(>33[index]); + + /* Calculate temporaries and grid functions */ + ptrdiff_t dir1 = Sign(beta1L); + + ptrdiff_t dir2 = Sign(beta2L); + + ptrdiff_t dir3 = Sign(beta3L); + + CCTK_REAL detgt = 1; + + CCTK_REAL gtu11 = INV(detgt)*(gt22L*gt33L - SQR(gt23L)); + + CCTK_REAL gtu12 = (gt13L*gt23L - gt12L*gt33L)*INV(detgt); + + CCTK_REAL gtu13 = (-(gt13L*gt22L) + gt12L*gt23L)*INV(detgt); + + CCTK_REAL gtu22 = INV(detgt)*(gt11L*gt33L - SQR(gt13L)); + + CCTK_REAL gtu23 = (gt12L*gt13L - gt11L*gt23L)*INV(detgt); + + CCTK_REAL gtu33 = INV(detgt)*(gt11L*gt22L - SQR(gt12L)); + + CCTK_REAL Gt111 = 0.5*(gtu11*PDstandardNth1gt11 + + 2*(gtu12*PDstandardNth1gt12 + gtu13*PDstandardNth1gt13) - + gtu12*PDstandardNth2gt11 - gtu13*PDstandardNth3gt11); + + CCTK_REAL Gt211 = 0.5*(gtu12*PDstandardNth1gt11 + + 2*(gtu22*PDstandardNth1gt12 + gtu23*PDstandardNth1gt13) - + gtu22*PDstandardNth2gt11 - gtu23*PDstandardNth3gt11); + + CCTK_REAL Gt311 = 0.5*(gtu13*PDstandardNth1gt11 + + 2*(gtu23*PDstandardNth1gt12 + gtu33*PDstandardNth1gt13) - + gtu23*PDstandardNth2gt11 - gtu33*PDstandardNth3gt11); + + CCTK_REAL Gt112 = 0.5*(gtu12*PDstandardNth1gt22 + + gtu11*PDstandardNth2gt11 + gtu13*(PDstandardNth1gt23 + + PDstandardNth2gt13 - PDstandardNth3gt12)); + + CCTK_REAL Gt212 = 0.5*(gtu22*PDstandardNth1gt22 + + gtu12*PDstandardNth2gt11 + gtu23*(PDstandardNth1gt23 + + PDstandardNth2gt13 - PDstandardNth3gt12)); + + CCTK_REAL Gt312 = 0.5*(gtu23*PDstandardNth1gt22 + + gtu13*PDstandardNth2gt11 + gtu33*(PDstandardNth1gt23 + + PDstandardNth2gt13 - PDstandardNth3gt12)); + + CCTK_REAL Gt113 = 0.5*(gtu13*PDstandardNth1gt33 + + gtu11*PDstandardNth3gt11 + gtu12*(PDstandardNth1gt23 - + PDstandardNth2gt13 + PDstandardNth3gt12)); + + CCTK_REAL Gt213 = 0.5*(gtu23*PDstandardNth1gt33 + + gtu12*PDstandardNth3gt11 + gtu22*(PDstandardNth1gt23 - + PDstandardNth2gt13 + PDstandardNth3gt12)); + + CCTK_REAL Gt313 = 0.5*(gtu33*PDstandardNth1gt33 + + gtu13*PDstandardNth3gt11 + gtu23*(PDstandardNth1gt23 - + PDstandardNth2gt13 + PDstandardNth3gt12)); + + CCTK_REAL Gt122 = 0.5*(gtu11*(-PDstandardNth1gt22 + + 2*PDstandardNth2gt12) + gtu12*PDstandardNth2gt22 + + gtu13*(2*PDstandardNth2gt23 - PDstandardNth3gt22)); + + CCTK_REAL Gt222 = 0.5*(gtu12*(-PDstandardNth1gt22 + + 2*PDstandardNth2gt12) + gtu22*PDstandardNth2gt22 + + gtu23*(2*PDstandardNth2gt23 - PDstandardNth3gt22)); + + CCTK_REAL Gt322 = 0.5*(gtu13*(-PDstandardNth1gt22 + + 2*PDstandardNth2gt12) + gtu23*PDstandardNth2gt22 + + gtu33*(2*PDstandardNth2gt23 - PDstandardNth3gt22)); + + CCTK_REAL Gt123 = 0.5*(gtu13*PDstandardNth2gt33 + + gtu11*(-PDstandardNth1gt23 + PDstandardNth2gt13 + PDstandardNth3gt12) + + gtu12*PDstandardNth3gt22); + + CCTK_REAL Gt223 = 0.5*(gtu23*PDstandardNth2gt33 + + gtu12*(-PDstandardNth1gt23 + PDstandardNth2gt13 + PDstandardNth3gt12) + + gtu22*PDstandardNth3gt22); + + CCTK_REAL Gt323 = 0.5*(gtu33*PDstandardNth2gt33 + + gtu13*(-PDstandardNth1gt23 + PDstandardNth2gt13 + PDstandardNth3gt12) + + gtu23*PDstandardNth3gt22); + + CCTK_REAL Gt133 = 0.5*(gtu11*(-PDstandardNth1gt33 + + 2*PDstandardNth3gt13) + gtu12*(-PDstandardNth2gt33 + + 2*PDstandardNth3gt23) + gtu13*PDstandardNth3gt33); + + CCTK_REAL Gt233 = 0.5*(gtu12*(-PDstandardNth1gt33 + + 2*PDstandardNth3gt13) + gtu22*(-PDstandardNth2gt33 + + 2*PDstandardNth3gt23) + gtu23*PDstandardNth3gt33); + + CCTK_REAL Gt333 = 0.5*(gtu13*(-PDstandardNth1gt33 + + 2*PDstandardNth3gt13) + gtu23*(-PDstandardNth2gt33 + + 2*PDstandardNth3gt23) + gtu33*PDstandardNth3gt33); + + CCTK_REAL Xt1L = Gt111*gtu11 + Gt122*gtu22 + 2*(Gt112*gtu12 + + Gt113*gtu13 + Gt123*gtu23) + Gt133*gtu33; + + CCTK_REAL Xt2L = Gt211*gtu11 + Gt222*gtu22 + 2*(Gt212*gtu12 + + Gt213*gtu13 + Gt223*gtu23) + Gt233*gtu33; + + CCTK_REAL Xt3L = Gt311*gtu11 + Gt322*gtu22 + 2*(Gt312*gtu12 + + Gt313*gtu13 + Gt323*gtu23) + Gt333*gtu33; + + CCTK_REAL AL = IfThen(ToReal(LapseACoeff) != + 0,-3*INV(ToReal(harmonicF))*pow(alphaL,-ToReal(harmonicN))*(9*dtalpL - + (beta1L*PDupwindNthAnti1alpha + beta2L*PDupwindNthAnti2alpha + + beta3L*PDupwindNthAnti3alpha + PDupwindNthSymm1alpha*Abs(beta1L) + + PDupwindNthSymm2alpha*Abs(beta2L) + + PDupwindNthSymm3alpha*Abs(beta3L))*ToReal(LapseAdvectionCoeff)),0); + + CCTK_REAL theta = fmin(1,exp(1 - + rL*INV(ToReal(SpatialShiftGammaCoeffRadius)))); + + CCTK_REAL B1L = IfThen(ToReal(ShiftBCoeff)*ToReal(ShiftGammaCoeff) != + 0,INV(theta)*INV(ToReal(ShiftGammaCoeff))*(27*dtbetaxL - + 3*(beta1L*PDupwindNthAnti1beta1 + beta2L*PDupwindNthAnti2beta1 + + beta3L*PDupwindNthAnti3beta1 + PDupwindNthSymm1beta1*Abs(beta1L) + + PDupwindNthSymm2beta1*Abs(beta2L) + + PDupwindNthSymm3beta1*Abs(beta3L))*ToReal(ShiftAdvectionCoeff)),0); + + CCTK_REAL B2L = IfThen(ToReal(ShiftBCoeff)*ToReal(ShiftGammaCoeff) != + 0,INV(theta)*INV(ToReal(ShiftGammaCoeff))*(27*dtbetayL - + 3*(beta1L*PDupwindNthAnti1beta2 + beta2L*PDupwindNthAnti2beta2 + + beta3L*PDupwindNthAnti3beta2 + PDupwindNthSymm1beta2*Abs(beta1L) + + PDupwindNthSymm2beta2*Abs(beta2L) + + PDupwindNthSymm3beta2*Abs(beta3L))*ToReal(ShiftAdvectionCoeff)),0); + + CCTK_REAL B3L = IfThen(ToReal(ShiftBCoeff)*ToReal(ShiftGammaCoeff) != + 0,INV(theta)*INV(ToReal(ShiftGammaCoeff))*(27*dtbetazL - + 3*(beta1L*PDupwindNthAnti1beta3 + beta2L*PDupwindNthAnti2beta3 + + beta3L*PDupwindNthAnti3beta3 + PDupwindNthSymm1beta3*Abs(beta1L) + + PDupwindNthSymm2beta3*Abs(beta2L) + + PDupwindNthSymm3beta3*Abs(beta3L))*ToReal(ShiftAdvectionCoeff)),0); + + + /* Copy local copies back to grid functions */ + A[index] = AL; + B1[index] = B1L; + B2[index] = B2L; + B3[index] = B3L; + Xt1[index] = Xt1L; + Xt2[index] = Xt2L; + Xt3[index] = Xt3L; + } + LC_ENDLOOP3 (ML_BSSN_O8_convertFromADMBaseGamma); +} + +extern "C" void ML_BSSN_O8_convertFromADMBaseGamma(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverInterior(cctkGH, &ML_BSSN_O8_convertFromADMBaseGamma_Body); +} diff --git a/ML_BSSN_O8/src/ML_BSSN_O8_convertToADMBase.cc b/ML_BSSN_O8/src/ML_BSSN_O8_convertToADMBase.cc new file mode 100644 index 0000000..ad418b7 --- /dev/null +++ b/ML_BSSN_O8/src/ML_BSSN_O8_convertToADMBase.cc @@ -0,0 +1,199 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +static void ML_BSSN_O8_convertToADMBase_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_BSSN_O8_convertToADMBase_Body"); + } + + if (cctk_iteration % ML_BSSN_O8_convertToADMBase_calc_every != ML_BSSN_O8_convertToADMBase_calc_offset) + { + return; + } + + const char *groups[] = {"ADMBase::curv","ADMBase::lapse","ADMBase::metric","ADMBase::shift","ML_BSSN_O8::ML_curv","ML_BSSN_O8::ML_lapse","ML_BSSN_O8::ML_log_confac","ML_BSSN_O8::ML_metric","ML_BSSN_O8::ML_shift","ML_BSSN_O8::ML_trace_curv"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_BSSN_O8_convertToADMBase", 10, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o1024dx = 0.0009765625*INV(dx); + CCTK_REAL const p1o1024dy = 0.0009765625*INV(dy); + CCTK_REAL const p1o1024dz = 0.0009765625*INV(dz); + CCTK_REAL const p1o1680dx = 0.000595238095238095238095238095238*INV(dx); + CCTK_REAL const p1o1680dy = 0.000595238095238095238095238095238*INV(dy); + CCTK_REAL const p1o1680dz = 0.000595238095238095238095238095238*INV(dz); + CCTK_REAL const p1o5040dx2 = 0.000198412698412698412698412698413*INV(SQR(dx)); + CCTK_REAL const p1o5040dy2 = 0.000198412698412698412698412698413*INV(SQR(dy)); + CCTK_REAL const p1o5040dz2 = 0.000198412698412698412698412698413*INV(SQR(dz)); + CCTK_REAL const p1o560dx = 0.00178571428571428571428571428571*INV(dx); + CCTK_REAL const p1o560dy = 0.00178571428571428571428571428571*INV(dy); + CCTK_REAL const p1o560dz = 0.00178571428571428571428571428571*INV(dz); + CCTK_REAL const p1o705600dxdy = 1.41723356009070294784580498866e-6*INV(dx)*INV(dy); + CCTK_REAL const p1o705600dxdz = 1.41723356009070294784580498866e-6*INV(dx)*INV(dz); + CCTK_REAL const p1o705600dydz = 1.41723356009070294784580498866e-6*INV(dy)*INV(dz); + CCTK_REAL const p1o840dx = 0.00119047619047619047619047619048*INV(dx); + CCTK_REAL const p1o840dy = 0.00119047619047619047619047619048*INV(dy); + CCTK_REAL const p1o840dz = 0.00119047619047619047619047619048*INV(dz); + CCTK_REAL const p1odx = INV(dx); + CCTK_REAL const p1ody = INV(dy); + CCTK_REAL const p1odz = INV(dz); + CCTK_REAL const pm1o840dx = -0.00119047619047619047619047619048*INV(dx); + CCTK_REAL const pm1o840dy = -0.00119047619047619047619047619048*INV(dy); + CCTK_REAL const pm1o840dz = -0.00119047619047619047619047619048*INV(dz); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_BSSN_O8_convertToADMBase, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + CCTK_REAL alphaL = alpha[index]; + CCTK_REAL At11L = At11[index]; + CCTK_REAL At12L = At12[index]; + CCTK_REAL At13L = At13[index]; + CCTK_REAL At22L = At22[index]; + CCTK_REAL At23L = At23[index]; + CCTK_REAL At33L = At33[index]; + CCTK_REAL beta1L = beta1[index]; + CCTK_REAL beta2L = beta2[index]; + CCTK_REAL beta3L = beta3[index]; + CCTK_REAL gt11L = gt11[index]; + CCTK_REAL gt12L = gt12[index]; + CCTK_REAL gt13L = gt13[index]; + CCTK_REAL gt22L = gt22[index]; + CCTK_REAL gt23L = gt23[index]; + CCTK_REAL gt33L = gt33[index]; + CCTK_REAL gxxL = gxx[index]; + CCTK_REAL gxyL = gxy[index]; + CCTK_REAL gxzL = gxz[index]; + CCTK_REAL gyyL = gyy[index]; + CCTK_REAL gyzL = gyz[index]; + CCTK_REAL gzzL = gzz[index]; + CCTK_REAL phiL = phi[index]; + CCTK_REAL trKL = trK[index]; + + /* Include user supplied include files */ + + /* Precompute derivatives */ + + /* Calculate temporaries and grid functions */ + CCTK_REAL e4phi = + IfThen(ToReal(conformalMethod),INV(SQR(phiL)),exp(4*phiL)); + + gxxL = e4phi*gt11L; + + gxyL = e4phi*gt12L; + + gxzL = e4phi*gt13L; + + gyyL = e4phi*gt22L; + + gyzL = e4phi*gt23L; + + gzzL = e4phi*gt33L; + + CCTK_REAL kxxL = At11L*e4phi + + 0.333333333333333333333333333333*gxxL*trKL; + + CCTK_REAL kxyL = At12L*e4phi + + 0.333333333333333333333333333333*gxyL*trKL; + + CCTK_REAL kxzL = At13L*e4phi + + 0.333333333333333333333333333333*gxzL*trKL; + + CCTK_REAL kyyL = At22L*e4phi + + 0.333333333333333333333333333333*gyyL*trKL; + + CCTK_REAL kyzL = At23L*e4phi + + 0.333333333333333333333333333333*gyzL*trKL; + + CCTK_REAL kzzL = At33L*e4phi + + 0.333333333333333333333333333333*gzzL*trKL; + + CCTK_REAL alpL = alphaL; + + CCTK_REAL betaxL = beta1L; + + CCTK_REAL betayL = beta2L; + + CCTK_REAL betazL = beta3L; + + + /* Copy local copies back to grid functions */ + alp[index] = alpL; + betax[index] = betaxL; + betay[index] = betayL; + betaz[index] = betazL; + gxx[index] = gxxL; + gxy[index] = gxyL; + gxz[index] = gxzL; + gyy[index] = gyyL; + gyz[index] = gyzL; + gzz[index] = gzzL; + kxx[index] = kxxL; + kxy[index] = kxyL; + kxz[index] = kxzL; + kyy[index] = kyyL; + kyz[index] = kyzL; + kzz[index] = kzzL; + } + LC_ENDLOOP3 (ML_BSSN_O8_convertToADMBase); +} + +extern "C" void ML_BSSN_O8_convertToADMBase(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverEverything(cctkGH, &ML_BSSN_O8_convertToADMBase_Body); +} diff --git a/ML_BSSN_O8/src/ML_BSSN_O8_convertToADMBaseDtLapseShift.cc b/ML_BSSN_O8/src/ML_BSSN_O8_convertToADMBaseDtLapseShift.cc new file mode 100644 index 0000000..1302c8a --- /dev/null +++ b/ML_BSSN_O8/src/ML_BSSN_O8_convertToADMBaseDtLapseShift.cc @@ -0,0 +1,213 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +extern "C" void ML_BSSN_O8_convertToADMBaseDtLapseShift_SelectBCs(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT ierr = 0; + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ADMBase::dtlapse","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ADMBase::dtlapse."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ADMBase::dtshift","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ADMBase::dtshift."); + return; +} + +static void ML_BSSN_O8_convertToADMBaseDtLapseShift_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_BSSN_O8_convertToADMBaseDtLapseShift_Body"); + } + + if (cctk_iteration % ML_BSSN_O8_convertToADMBaseDtLapseShift_calc_every != ML_BSSN_O8_convertToADMBaseDtLapseShift_calc_offset) + { + return; + } + + const char *groups[] = {"ADMBase::dtlapse","ADMBase::dtshift","grid::coordinates","Grid::coordinates","ML_BSSN_O8::ML_dtlapse","ML_BSSN_O8::ML_dtshift","ML_BSSN_O8::ML_Gamma","ML_BSSN_O8::ML_lapse","ML_BSSN_O8::ML_shift","ML_BSSN_O8::ML_trace_curv"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_BSSN_O8_convertToADMBaseDtLapseShift", 10, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o1024dx = 0.0009765625*INV(dx); + CCTK_REAL const p1o1024dy = 0.0009765625*INV(dy); + CCTK_REAL const p1o1024dz = 0.0009765625*INV(dz); + CCTK_REAL const p1o1680dx = 0.000595238095238095238095238095238*INV(dx); + CCTK_REAL const p1o1680dy = 0.000595238095238095238095238095238*INV(dy); + CCTK_REAL const p1o1680dz = 0.000595238095238095238095238095238*INV(dz); + CCTK_REAL const p1o5040dx2 = 0.000198412698412698412698412698413*INV(SQR(dx)); + CCTK_REAL const p1o5040dy2 = 0.000198412698412698412698412698413*INV(SQR(dy)); + CCTK_REAL const p1o5040dz2 = 0.000198412698412698412698412698413*INV(SQR(dz)); + CCTK_REAL const p1o560dx = 0.00178571428571428571428571428571*INV(dx); + CCTK_REAL const p1o560dy = 0.00178571428571428571428571428571*INV(dy); + CCTK_REAL const p1o560dz = 0.00178571428571428571428571428571*INV(dz); + CCTK_REAL const p1o705600dxdy = 1.41723356009070294784580498866e-6*INV(dx)*INV(dy); + CCTK_REAL const p1o705600dxdz = 1.41723356009070294784580498866e-6*INV(dx)*INV(dz); + CCTK_REAL const p1o705600dydz = 1.41723356009070294784580498866e-6*INV(dy)*INV(dz); + CCTK_REAL const p1o840dx = 0.00119047619047619047619047619048*INV(dx); + CCTK_REAL const p1o840dy = 0.00119047619047619047619047619048*INV(dy); + CCTK_REAL const p1o840dz = 0.00119047619047619047619047619048*INV(dz); + CCTK_REAL const p1odx = INV(dx); + CCTK_REAL const p1ody = INV(dy); + CCTK_REAL const p1odz = INV(dz); + CCTK_REAL const pm1o840dx = -0.00119047619047619047619047619048*INV(dx); + CCTK_REAL const pm1o840dy = -0.00119047619047619047619047619048*INV(dy); + CCTK_REAL const pm1o840dz = -0.00119047619047619047619047619048*INV(dz); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_BSSN_O8_convertToADMBaseDtLapseShift, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + CCTK_REAL AL = A[index]; + CCTK_REAL alphaL = alpha[index]; + CCTK_REAL B1L = B1[index]; + CCTK_REAL B2L = B2[index]; + CCTK_REAL B3L = B3[index]; + CCTK_REAL beta1L = beta1[index]; + CCTK_REAL beta2L = beta2[index]; + CCTK_REAL beta3L = beta3[index]; + CCTK_REAL rL = r[index]; + CCTK_REAL trKL = trK[index]; + CCTK_REAL Xt1L = Xt1[index]; + CCTK_REAL Xt2L = Xt2[index]; + CCTK_REAL Xt3L = Xt3[index]; + + /* Include user supplied include files */ + + /* Precompute derivatives */ + CCTK_REAL const PDupwindNthAnti1alpha = PDupwindNthAnti1(&alpha[index]); + CCTK_REAL const PDupwindNthSymm1alpha = PDupwindNthSymm1(&alpha[index]); + CCTK_REAL const PDupwindNthAnti2alpha = PDupwindNthAnti2(&alpha[index]); + CCTK_REAL const PDupwindNthSymm2alpha = PDupwindNthSymm2(&alpha[index]); + CCTK_REAL const PDupwindNthAnti3alpha = PDupwindNthAnti3(&alpha[index]); + CCTK_REAL const PDupwindNthSymm3alpha = PDupwindNthSymm3(&alpha[index]); + CCTK_REAL const PDupwindNthAnti1beta1 = PDupwindNthAnti1(&beta1[index]); + CCTK_REAL const PDupwindNthSymm1beta1 = PDupwindNthSymm1(&beta1[index]); + CCTK_REAL const PDupwindNthAnti2beta1 = PDupwindNthAnti2(&beta1[index]); + CCTK_REAL const PDupwindNthSymm2beta1 = PDupwindNthSymm2(&beta1[index]); + CCTK_REAL const PDupwindNthAnti3beta1 = PDupwindNthAnti3(&beta1[index]); + CCTK_REAL const PDupwindNthSymm3beta1 = PDupwindNthSymm3(&beta1[index]); + CCTK_REAL const PDupwindNthAnti1beta2 = PDupwindNthAnti1(&beta2[index]); + CCTK_REAL const PDupwindNthSymm1beta2 = PDupwindNthSymm1(&beta2[index]); + CCTK_REAL const PDupwindNthAnti2beta2 = PDupwindNthAnti2(&beta2[index]); + CCTK_REAL const PDupwindNthSymm2beta2 = PDupwindNthSymm2(&beta2[index]); + CCTK_REAL const PDupwindNthAnti3beta2 = PDupwindNthAnti3(&beta2[index]); + CCTK_REAL const PDupwindNthSymm3beta2 = PDupwindNthSymm3(&beta2[index]); + CCTK_REAL const PDupwindNthAnti1beta3 = PDupwindNthAnti1(&beta3[index]); + CCTK_REAL const PDupwindNthSymm1beta3 = PDupwindNthSymm1(&beta3[index]); + CCTK_REAL const PDupwindNthAnti2beta3 = PDupwindNthAnti2(&beta3[index]); + CCTK_REAL const PDupwindNthSymm2beta3 = PDupwindNthSymm2(&beta3[index]); + CCTK_REAL const PDupwindNthAnti3beta3 = PDupwindNthAnti3(&beta3[index]); + CCTK_REAL const PDupwindNthSymm3beta3 = PDupwindNthSymm3(&beta3[index]); + + /* Calculate temporaries and grid functions */ + ptrdiff_t dir1 = Sign(beta1L); + + ptrdiff_t dir2 = Sign(beta2L); + + ptrdiff_t dir3 = Sign(beta3L); + + CCTK_REAL eta = fmin(1,INV(rL)*ToReal(SpatialBetaDriverRadius)); + + CCTK_REAL theta = fmin(1,exp(1 - + rL*INV(ToReal(SpatialShiftGammaCoeffRadius)))); + + CCTK_REAL dtalpL = + -(pow(alphaL,ToReal(harmonicN))*ToReal(harmonicF)*(trKL + (AL - + trKL)*ToReal(LapseACoeff))) + (beta1L*PDupwindNthAnti1alpha + + beta2L*PDupwindNthAnti2alpha + beta3L*PDupwindNthAnti3alpha + + PDupwindNthSymm1alpha*Abs(beta1L) + PDupwindNthSymm2alpha*Abs(beta2L) + + PDupwindNthSymm3alpha*Abs(beta3L))*ToReal(LapseAdvectionCoeff); + + CCTK_REAL dtbetaxL = (beta1L*PDupwindNthAnti1beta1 + + beta2L*PDupwindNthAnti2beta1 + beta3L*PDupwindNthAnti3beta1 + + PDupwindNthSymm1beta1*Abs(beta1L) + PDupwindNthSymm2beta1*Abs(beta2L) + + PDupwindNthSymm3beta1*Abs(beta3L))*ToReal(ShiftAdvectionCoeff) + + theta*(Xt1L + beta1L*eta*ToReal(BetaDriver)*(-1 + ToReal(ShiftBCoeff)) + + (B1L - Xt1L)*ToReal(ShiftBCoeff))*ToReal(ShiftGammaCoeff); + + CCTK_REAL dtbetayL = (beta1L*PDupwindNthAnti1beta2 + + beta2L*PDupwindNthAnti2beta2 + beta3L*PDupwindNthAnti3beta2 + + PDupwindNthSymm1beta2*Abs(beta1L) + PDupwindNthSymm2beta2*Abs(beta2L) + + PDupwindNthSymm3beta2*Abs(beta3L))*ToReal(ShiftAdvectionCoeff) + + theta*(Xt2L + beta2L*eta*ToReal(BetaDriver)*(-1 + ToReal(ShiftBCoeff)) + + (B2L - Xt2L)*ToReal(ShiftBCoeff))*ToReal(ShiftGammaCoeff); + + CCTK_REAL dtbetazL = (beta1L*PDupwindNthAnti1beta3 + + beta2L*PDupwindNthAnti2beta3 + beta3L*PDupwindNthAnti3beta3 + + PDupwindNthSymm1beta3*Abs(beta1L) + PDupwindNthSymm2beta3*Abs(beta2L) + + PDupwindNthSymm3beta3*Abs(beta3L))*ToReal(ShiftAdvectionCoeff) + + theta*(Xt3L + beta3L*eta*ToReal(BetaDriver)*(-1 + ToReal(ShiftBCoeff)) + + (B3L - Xt3L)*ToReal(ShiftBCoeff))*ToReal(ShiftGammaCoeff); + + + /* Copy local copies back to grid functions */ + dtalp[index] = dtalpL; + dtbetax[index] = dtbetaxL; + dtbetay[index] = dtbetayL; + dtbetaz[index] = dtbetazL; + } + LC_ENDLOOP3 (ML_BSSN_O8_convertToADMBaseDtLapseShift); +} + +extern "C" void ML_BSSN_O8_convertToADMBaseDtLapseShift(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverInterior(cctkGH, &ML_BSSN_O8_convertToADMBaseDtLapseShift_Body); +} diff --git a/ML_BSSN_O8/src/ML_BSSN_O8_convertToADMBaseDtLapseShiftBoundary.cc b/ML_BSSN_O8/src/ML_BSSN_O8_convertToADMBaseDtLapseShiftBoundary.cc new file mode 100644 index 0000000..c1814bb --- /dev/null +++ b/ML_BSSN_O8/src/ML_BSSN_O8_convertToADMBaseDtLapseShiftBoundary.cc @@ -0,0 +1,171 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +extern "C" void ML_BSSN_O8_convertToADMBaseDtLapseShiftBoundary_SelectBCs(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT ierr = 0; + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ADMBase::dtlapse","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ADMBase::dtlapse."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ADMBase::dtshift","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ADMBase::dtshift."); + return; +} + +static void ML_BSSN_O8_convertToADMBaseDtLapseShiftBoundary_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_BSSN_O8_convertToADMBaseDtLapseShiftBoundary_Body"); + } + + if (cctk_iteration % ML_BSSN_O8_convertToADMBaseDtLapseShiftBoundary_calc_every != ML_BSSN_O8_convertToADMBaseDtLapseShiftBoundary_calc_offset) + { + return; + } + + const char *groups[] = {"ADMBase::dtlapse","ADMBase::dtshift","grid::coordinates","Grid::coordinates","ML_BSSN_O8::ML_dtlapse","ML_BSSN_O8::ML_dtshift","ML_BSSN_O8::ML_Gamma","ML_BSSN_O8::ML_lapse","ML_BSSN_O8::ML_shift","ML_BSSN_O8::ML_trace_curv"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_BSSN_O8_convertToADMBaseDtLapseShiftBoundary", 10, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o1024dx = 0.0009765625*INV(dx); + CCTK_REAL const p1o1024dy = 0.0009765625*INV(dy); + CCTK_REAL const p1o1024dz = 0.0009765625*INV(dz); + CCTK_REAL const p1o1680dx = 0.000595238095238095238095238095238*INV(dx); + CCTK_REAL const p1o1680dy = 0.000595238095238095238095238095238*INV(dy); + CCTK_REAL const p1o1680dz = 0.000595238095238095238095238095238*INV(dz); + CCTK_REAL const p1o5040dx2 = 0.000198412698412698412698412698413*INV(SQR(dx)); + CCTK_REAL const p1o5040dy2 = 0.000198412698412698412698412698413*INV(SQR(dy)); + CCTK_REAL const p1o5040dz2 = 0.000198412698412698412698412698413*INV(SQR(dz)); + CCTK_REAL const p1o560dx = 0.00178571428571428571428571428571*INV(dx); + CCTK_REAL const p1o560dy = 0.00178571428571428571428571428571*INV(dy); + CCTK_REAL const p1o560dz = 0.00178571428571428571428571428571*INV(dz); + CCTK_REAL const p1o705600dxdy = 1.41723356009070294784580498866e-6*INV(dx)*INV(dy); + CCTK_REAL const p1o705600dxdz = 1.41723356009070294784580498866e-6*INV(dx)*INV(dz); + CCTK_REAL const p1o705600dydz = 1.41723356009070294784580498866e-6*INV(dy)*INV(dz); + CCTK_REAL const p1o840dx = 0.00119047619047619047619047619048*INV(dx); + CCTK_REAL const p1o840dy = 0.00119047619047619047619047619048*INV(dy); + CCTK_REAL const p1o840dz = 0.00119047619047619047619047619048*INV(dz); + CCTK_REAL const p1odx = INV(dx); + CCTK_REAL const p1ody = INV(dy); + CCTK_REAL const p1odz = INV(dz); + CCTK_REAL const pm1o840dx = -0.00119047619047619047619047619048*INV(dx); + CCTK_REAL const pm1o840dy = -0.00119047619047619047619047619048*INV(dy); + CCTK_REAL const pm1o840dz = -0.00119047619047619047619047619048*INV(dz); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_BSSN_O8_convertToADMBaseDtLapseShiftBoundary, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + CCTK_REAL AL = A[index]; + CCTK_REAL alphaL = alpha[index]; + CCTK_REAL B1L = B1[index]; + CCTK_REAL B2L = B2[index]; + CCTK_REAL B3L = B3[index]; + CCTK_REAL beta1L = beta1[index]; + CCTK_REAL beta2L = beta2[index]; + CCTK_REAL beta3L = beta3[index]; + CCTK_REAL rL = r[index]; + CCTK_REAL trKL = trK[index]; + CCTK_REAL Xt1L = Xt1[index]; + CCTK_REAL Xt2L = Xt2[index]; + CCTK_REAL Xt3L = Xt3[index]; + + /* Include user supplied include files */ + + /* Precompute derivatives */ + + /* Calculate temporaries and grid functions */ + CCTK_REAL eta = fmin(1,INV(rL)*ToReal(SpatialBetaDriverRadius)); + + CCTK_REAL theta = fmin(1,exp(1 - + rL*INV(ToReal(SpatialShiftGammaCoeffRadius)))); + + CCTK_REAL dtalpL = + -(pow(alphaL,ToReal(harmonicN))*ToReal(harmonicF)*(trKL + (AL - + trKL)*ToReal(LapseACoeff))); + + CCTK_REAL dtbetaxL = theta*(Xt1L + beta1L*eta*ToReal(BetaDriver)*(-1 + + ToReal(ShiftBCoeff)) + (B1L - + Xt1L)*ToReal(ShiftBCoeff))*ToReal(ShiftGammaCoeff); + + CCTK_REAL dtbetayL = theta*(Xt2L + beta2L*eta*ToReal(BetaDriver)*(-1 + + ToReal(ShiftBCoeff)) + (B2L - + Xt2L)*ToReal(ShiftBCoeff))*ToReal(ShiftGammaCoeff); + + CCTK_REAL dtbetazL = theta*(Xt3L + beta3L*eta*ToReal(BetaDriver)*(-1 + + ToReal(ShiftBCoeff)) + (B3L - + Xt3L)*ToReal(ShiftBCoeff))*ToReal(ShiftGammaCoeff); + + + /* Copy local copies back to grid functions */ + dtalp[index] = dtalpL; + dtbetax[index] = dtbetaxL; + dtbetay[index] = dtbetayL; + dtbetaz[index] = dtbetazL; + } + LC_ENDLOOP3 (ML_BSSN_O8_convertToADMBaseDtLapseShiftBoundary); +} + +extern "C" void ML_BSSN_O8_convertToADMBaseDtLapseShiftBoundary(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverBoundaryWithGhosts(cctkGH, &ML_BSSN_O8_convertToADMBaseDtLapseShiftBoundary_Body); +} diff --git a/ML_BSSN_O8/src/ML_BSSN_O8_convertToADMBaseFakeDtLapseShift.cc b/ML_BSSN_O8/src/ML_BSSN_O8_convertToADMBaseFakeDtLapseShift.cc new file mode 100644 index 0000000..054b5e7 --- /dev/null +++ b/ML_BSSN_O8/src/ML_BSSN_O8_convertToADMBaseFakeDtLapseShift.cc @@ -0,0 +1,156 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +static void ML_BSSN_O8_convertToADMBaseFakeDtLapseShift_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_BSSN_O8_convertToADMBaseFakeDtLapseShift_Body"); + } + + if (cctk_iteration % ML_BSSN_O8_convertToADMBaseFakeDtLapseShift_calc_every != ML_BSSN_O8_convertToADMBaseFakeDtLapseShift_calc_offset) + { + return; + } + + const char *groups[] = {"ADMBase::dtlapse","ADMBase::dtshift","grid::coordinates","Grid::coordinates","ML_BSSN_O8::ML_dtlapse","ML_BSSN_O8::ML_dtshift","ML_BSSN_O8::ML_Gamma","ML_BSSN_O8::ML_lapse","ML_BSSN_O8::ML_shift","ML_BSSN_O8::ML_trace_curv"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_BSSN_O8_convertToADMBaseFakeDtLapseShift", 10, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o1024dx = 0.0009765625*INV(dx); + CCTK_REAL const p1o1024dy = 0.0009765625*INV(dy); + CCTK_REAL const p1o1024dz = 0.0009765625*INV(dz); + CCTK_REAL const p1o1680dx = 0.000595238095238095238095238095238*INV(dx); + CCTK_REAL const p1o1680dy = 0.000595238095238095238095238095238*INV(dy); + CCTK_REAL const p1o1680dz = 0.000595238095238095238095238095238*INV(dz); + CCTK_REAL const p1o5040dx2 = 0.000198412698412698412698412698413*INV(SQR(dx)); + CCTK_REAL const p1o5040dy2 = 0.000198412698412698412698412698413*INV(SQR(dy)); + CCTK_REAL const p1o5040dz2 = 0.000198412698412698412698412698413*INV(SQR(dz)); + CCTK_REAL const p1o560dx = 0.00178571428571428571428571428571*INV(dx); + CCTK_REAL const p1o560dy = 0.00178571428571428571428571428571*INV(dy); + CCTK_REAL const p1o560dz = 0.00178571428571428571428571428571*INV(dz); + CCTK_REAL const p1o705600dxdy = 1.41723356009070294784580498866e-6*INV(dx)*INV(dy); + CCTK_REAL const p1o705600dxdz = 1.41723356009070294784580498866e-6*INV(dx)*INV(dz); + CCTK_REAL const p1o705600dydz = 1.41723356009070294784580498866e-6*INV(dy)*INV(dz); + CCTK_REAL const p1o840dx = 0.00119047619047619047619047619048*INV(dx); + CCTK_REAL const p1o840dy = 0.00119047619047619047619047619048*INV(dy); + CCTK_REAL const p1o840dz = 0.00119047619047619047619047619048*INV(dz); + CCTK_REAL const p1odx = INV(dx); + CCTK_REAL const p1ody = INV(dy); + CCTK_REAL const p1odz = INV(dz); + CCTK_REAL const pm1o840dx = -0.00119047619047619047619047619048*INV(dx); + CCTK_REAL const pm1o840dy = -0.00119047619047619047619047619048*INV(dy); + CCTK_REAL const pm1o840dz = -0.00119047619047619047619047619048*INV(dz); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_BSSN_O8_convertToADMBaseFakeDtLapseShift, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + CCTK_REAL AL = A[index]; + CCTK_REAL alphaL = alpha[index]; + CCTK_REAL B1L = B1[index]; + CCTK_REAL B2L = B2[index]; + CCTK_REAL B3L = B3[index]; + CCTK_REAL beta1L = beta1[index]; + CCTK_REAL beta2L = beta2[index]; + CCTK_REAL beta3L = beta3[index]; + CCTK_REAL rL = r[index]; + CCTK_REAL trKL = trK[index]; + CCTK_REAL Xt1L = Xt1[index]; + CCTK_REAL Xt2L = Xt2[index]; + CCTK_REAL Xt3L = Xt3[index]; + + /* Include user supplied include files */ + + /* Precompute derivatives */ + + /* Calculate temporaries and grid functions */ + CCTK_REAL eta = fmin(1,INV(rL)*ToReal(SpatialBetaDriverRadius)); + + CCTK_REAL theta = fmin(1,exp(1 - + rL*INV(ToReal(SpatialShiftGammaCoeffRadius)))); + + CCTK_REAL dtalpL = + -(pow(alphaL,ToReal(harmonicN))*ToReal(harmonicF)*(trKL + (AL - + trKL)*ToReal(LapseACoeff))); + + CCTK_REAL dtbetaxL = theta*(Xt1L + beta1L*eta*ToReal(BetaDriver)*(-1 + + ToReal(ShiftBCoeff)) + (B1L - + Xt1L)*ToReal(ShiftBCoeff))*ToReal(ShiftGammaCoeff); + + CCTK_REAL dtbetayL = theta*(Xt2L + beta2L*eta*ToReal(BetaDriver)*(-1 + + ToReal(ShiftBCoeff)) + (B2L - + Xt2L)*ToReal(ShiftBCoeff))*ToReal(ShiftGammaCoeff); + + CCTK_REAL dtbetazL = theta*(Xt3L + beta3L*eta*ToReal(BetaDriver)*(-1 + + ToReal(ShiftBCoeff)) + (B3L - + Xt3L)*ToReal(ShiftBCoeff))*ToReal(ShiftGammaCoeff); + + + /* Copy local copies back to grid functions */ + dtalp[index] = dtalpL; + dtbetax[index] = dtbetaxL; + dtbetay[index] = dtbetayL; + dtbetaz[index] = dtbetazL; + } + LC_ENDLOOP3 (ML_BSSN_O8_convertToADMBaseFakeDtLapseShift); +} + +extern "C" void ML_BSSN_O8_convertToADMBaseFakeDtLapseShift(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverEverything(cctkGH, &ML_BSSN_O8_convertToADMBaseFakeDtLapseShift_Body); +} diff --git a/ML_BSSN_O8/src/ML_BSSN_O8_enforce.cc b/ML_BSSN_O8/src/ML_BSSN_O8_enforce.cc new file mode 100644 index 0000000..fe373d5 --- /dev/null +++ b/ML_BSSN_O8/src/ML_BSSN_O8_enforce.cc @@ -0,0 +1,169 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +static void ML_BSSN_O8_enforce_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_BSSN_O8_enforce_Body"); + } + + if (cctk_iteration % ML_BSSN_O8_enforce_calc_every != ML_BSSN_O8_enforce_calc_offset) + { + return; + } + + const char *groups[] = {"ML_BSSN_O8::ML_curv","ML_BSSN_O8::ML_lapse","ML_BSSN_O8::ML_metric"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_BSSN_O8_enforce", 3, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o1024dx = 0.0009765625*INV(dx); + CCTK_REAL const p1o1024dy = 0.0009765625*INV(dy); + CCTK_REAL const p1o1024dz = 0.0009765625*INV(dz); + CCTK_REAL const p1o1680dx = 0.000595238095238095238095238095238*INV(dx); + CCTK_REAL const p1o1680dy = 0.000595238095238095238095238095238*INV(dy); + CCTK_REAL const p1o1680dz = 0.000595238095238095238095238095238*INV(dz); + CCTK_REAL const p1o5040dx2 = 0.000198412698412698412698412698413*INV(SQR(dx)); + CCTK_REAL const p1o5040dy2 = 0.000198412698412698412698412698413*INV(SQR(dy)); + CCTK_REAL const p1o5040dz2 = 0.000198412698412698412698412698413*INV(SQR(dz)); + CCTK_REAL const p1o560dx = 0.00178571428571428571428571428571*INV(dx); + CCTK_REAL const p1o560dy = 0.00178571428571428571428571428571*INV(dy); + CCTK_REAL const p1o560dz = 0.00178571428571428571428571428571*INV(dz); + CCTK_REAL const p1o705600dxdy = 1.41723356009070294784580498866e-6*INV(dx)*INV(dy); + CCTK_REAL const p1o705600dxdz = 1.41723356009070294784580498866e-6*INV(dx)*INV(dz); + CCTK_REAL const p1o705600dydz = 1.41723356009070294784580498866e-6*INV(dy)*INV(dz); + CCTK_REAL const p1o840dx = 0.00119047619047619047619047619048*INV(dx); + CCTK_REAL const p1o840dy = 0.00119047619047619047619047619048*INV(dy); + CCTK_REAL const p1o840dz = 0.00119047619047619047619047619048*INV(dz); + CCTK_REAL const p1odx = INV(dx); + CCTK_REAL const p1ody = INV(dy); + CCTK_REAL const p1odz = INV(dz); + CCTK_REAL const pm1o840dx = -0.00119047619047619047619047619048*INV(dx); + CCTK_REAL const pm1o840dy = -0.00119047619047619047619047619048*INV(dy); + CCTK_REAL const pm1o840dz = -0.00119047619047619047619047619048*INV(dz); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_BSSN_O8_enforce, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + CCTK_REAL alphaL = alpha[index]; + CCTK_REAL At11L = At11[index]; + CCTK_REAL At12L = At12[index]; + CCTK_REAL At13L = At13[index]; + CCTK_REAL At22L = At22[index]; + CCTK_REAL At23L = At23[index]; + CCTK_REAL At33L = At33[index]; + CCTK_REAL gt11L = gt11[index]; + CCTK_REAL gt12L = gt12[index]; + CCTK_REAL gt13L = gt13[index]; + CCTK_REAL gt22L = gt22[index]; + CCTK_REAL gt23L = gt23[index]; + CCTK_REAL gt33L = gt33[index]; + + /* Include user supplied include files */ + + /* Precompute derivatives */ + + /* Calculate temporaries and grid functions */ + CCTK_REAL detgt = 1; + + CCTK_REAL gtu11 = INV(detgt)*(gt22L*gt33L - SQR(gt23L)); + + CCTK_REAL gtu12 = (gt13L*gt23L - gt12L*gt33L)*INV(detgt); + + CCTK_REAL gtu13 = (-(gt13L*gt22L) + gt12L*gt23L)*INV(detgt); + + CCTK_REAL gtu22 = INV(detgt)*(gt11L*gt33L - SQR(gt13L)); + + CCTK_REAL gtu23 = (gt12L*gt13L - gt11L*gt23L)*INV(detgt); + + CCTK_REAL gtu33 = INV(detgt)*(gt11L*gt22L - SQR(gt12L)); + + CCTK_REAL trAt = At11L*gtu11 + At22L*gtu22 + 2*(At12L*gtu12 + + At13L*gtu13 + At23L*gtu23) + At33L*gtu33; + + At11L = At11L - 0.333333333333333333333333333333*gt11L*trAt; + + At12L = At12L - 0.333333333333333333333333333333*gt12L*trAt; + + At13L = At13L - 0.333333333333333333333333333333*gt13L*trAt; + + At22L = At22L - 0.333333333333333333333333333333*gt22L*trAt; + + At23L = At23L - 0.333333333333333333333333333333*gt23L*trAt; + + At33L = At33L - 0.333333333333333333333333333333*gt33L*trAt; + + alphaL = fmax(alphaL,ToReal(MinimumLapse)); + + + /* Copy local copies back to grid functions */ + alpha[index] = alphaL; + At11[index] = At11L; + At12[index] = At12L; + At13[index] = At13L; + At22[index] = At22L; + At23[index] = At23L; + At33[index] = At33L; + } + LC_ENDLOOP3 (ML_BSSN_O8_enforce); +} + +extern "C" void ML_BSSN_O8_enforce(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverEverything(cctkGH, &ML_BSSN_O8_enforce_Body); +} diff --git a/ML_BSSN_O8/src/RegisterMoL.cc b/ML_BSSN_O8/src/RegisterMoL.cc new file mode 100644 index 0000000..5845e78 --- /dev/null +++ b/ML_BSSN_O8/src/RegisterMoL.cc @@ -0,0 +1,41 @@ +/* File produced by Kranc */ + +#include "cctk.h" +#include "cctk_Arguments.h" +#include "cctk_Parameters.h" + +extern "C" void ML_BSSN_O8_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_BSSN_O8::At11"), CCTK_VarIndex("ML_BSSN_O8::At11rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_O8::At12"), CCTK_VarIndex("ML_BSSN_O8::At12rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_O8::At13"), CCTK_VarIndex("ML_BSSN_O8::At13rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_O8::At22"), CCTK_VarIndex("ML_BSSN_O8::At22rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_O8::At23"), CCTK_VarIndex("ML_BSSN_O8::At23rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_O8::At33"), CCTK_VarIndex("ML_BSSN_O8::At33rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_O8::A"), CCTK_VarIndex("ML_BSSN_O8::Arhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_O8::B1"), CCTK_VarIndex("ML_BSSN_O8::B1rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_O8::B2"), CCTK_VarIndex("ML_BSSN_O8::B2rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_O8::B3"), CCTK_VarIndex("ML_BSSN_O8::B3rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_O8::Xt1"), CCTK_VarIndex("ML_BSSN_O8::Xt1rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_O8::Xt2"), CCTK_VarIndex("ML_BSSN_O8::Xt2rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_O8::Xt3"), CCTK_VarIndex("ML_BSSN_O8::Xt3rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_O8::alpha"), CCTK_VarIndex("ML_BSSN_O8::alpharhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_O8::phi"), CCTK_VarIndex("ML_BSSN_O8::phirhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_O8::gt11"), CCTK_VarIndex("ML_BSSN_O8::gt11rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_O8::gt12"), CCTK_VarIndex("ML_BSSN_O8::gt12rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_O8::gt13"), CCTK_VarIndex("ML_BSSN_O8::gt13rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_O8::gt22"), CCTK_VarIndex("ML_BSSN_O8::gt22rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_O8::gt23"), CCTK_VarIndex("ML_BSSN_O8::gt23rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_O8::gt33"), CCTK_VarIndex("ML_BSSN_O8::gt33rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_O8::beta1"), CCTK_VarIndex("ML_BSSN_O8::beta1rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_O8::beta2"), CCTK_VarIndex("ML_BSSN_O8::beta2rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_O8::beta3"), CCTK_VarIndex("ML_BSSN_O8::beta3rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_O8::trK"), CCTK_VarIndex("ML_BSSN_O8::trKrhs")); + return; +} diff --git a/ML_BSSN_O8/src/RegisterSymmetries.cc b/ML_BSSN_O8/src/RegisterSymmetries.cc new file mode 100644 index 0000000..5bf0014 --- /dev/null +++ b/ML_BSSN_O8/src/RegisterSymmetries.cc @@ -0,0 +1,189 @@ +/* File produced by Kranc */ + +#include "cctk.h" +#include "cctk_Arguments.h" +#include "cctk_Parameters.h" +#include "Symmetry.h" + +extern "C" void ML_BSSN_O8_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_BSSN_O8::At11"); + + sym[0] = -1; + sym[1] = -1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_O8::At12"); + + sym[0] = -1; + sym[1] = 1; + sym[2] = -1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_O8::At13"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_O8::At22"); + + sym[0] = 1; + sym[1] = -1; + sym[2] = -1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_O8::At23"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_O8::At33"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_O8::A"); + + sym[0] = -1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_O8::B1"); + + sym[0] = 1; + sym[1] = -1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_O8::B2"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = -1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_O8::B3"); + + sym[0] = -1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_O8::Xt1"); + + sym[0] = 1; + sym[1] = -1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_O8::Xt2"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = -1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_O8::Xt3"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_O8::alpha"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_O8::phi"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_O8::gt11"); + + sym[0] = -1; + sym[1] = -1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_O8::gt12"); + + sym[0] = -1; + sym[1] = 1; + sym[2] = -1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_O8::gt13"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_O8::gt22"); + + sym[0] = 1; + sym[1] = -1; + sym[2] = -1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_O8::gt23"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_O8::gt33"); + + sym[0] = -1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_O8::beta1"); + + sym[0] = 1; + sym[1] = -1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_O8::beta2"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = -1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_O8::beta3"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_O8::trK"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_O8::cS"); + + sym[0] = -1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_O8::cXt1"); + + sym[0] = 1; + sym[1] = -1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_O8::cXt2"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = -1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_O8::cXt3"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_O8::cA"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_O8::H"); + + sym[0] = -1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_O8::M1"); + + sym[0] = 1; + sym[1] = -1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_O8::M2"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = -1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_O8::M3"); + +} diff --git a/ML_BSSN_O8/src/Startup.cc b/ML_BSSN_O8/src/Startup.cc new file mode 100644 index 0000000..eccc42c --- /dev/null +++ b/ML_BSSN_O8/src/Startup.cc @@ -0,0 +1,10 @@ +/* File produced by Kranc */ + +#include "cctk.h" + +extern "C" int ML_BSSN_O8_Startup(void) +{ + const char * banner = "ML_BSSN_O8"; + CCTK_RegisterBanner(banner); + return 0; +} diff --git a/ML_BSSN_UPW/src/Boundaries.cc b/ML_BSSN_UPW/src/Boundaries.cc new file mode 100644 index 0000000..e2ceb2c --- /dev/null +++ b/ML_BSSN_UPW/src/Boundaries.cc @@ -0,0 +1,1809 @@ +/* File produced by Kranc */ + +#include "cctk.h" +#include "cctk_Arguments.h" +#include "cctk_Parameters.h" +#include "cctk_Faces.h" +#include "util_Table.h" +#include "Symmetry.h" + + +/* the boundary treatment is split into 3 steps: */ +/* 1. excision */ +/* 2. symmetries */ +/* 3. "other" boundary conditions, e.g. radiative */ + +/* to simplify scheduling and testing, the 3 steps */ +/* are currently applied in separate functions */ + + +extern "C" void ML_BSSN_UPW_CheckBoundaries(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + return; +} + +extern "C" void ML_BSSN_UPW_SelectBoundConds(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT ierr = 0; + + if (CCTK_EQUALS(ML_curv_bound, "none" ) || + CCTK_EQUALS(ML_curv_bound, "static") || + CCTK_EQUALS(ML_curv_bound, "flat" ) || + CCTK_EQUALS(ML_curv_bound, "zero" ) ) + { + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_UPW::ML_curv", ML_curv_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register ML_curv_bound BC for ML_BSSN_UPW::ML_curv!"); + } + + if (CCTK_EQUALS(ML_dtlapse_bound, "none" ) || + CCTK_EQUALS(ML_dtlapse_bound, "static") || + CCTK_EQUALS(ML_dtlapse_bound, "flat" ) || + CCTK_EQUALS(ML_dtlapse_bound, "zero" ) ) + { + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_UPW::ML_dtlapse", ML_dtlapse_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register ML_dtlapse_bound BC for ML_BSSN_UPW::ML_dtlapse!"); + } + + if (CCTK_EQUALS(ML_dtshift_bound, "none" ) || + CCTK_EQUALS(ML_dtshift_bound, "static") || + CCTK_EQUALS(ML_dtshift_bound, "flat" ) || + CCTK_EQUALS(ML_dtshift_bound, "zero" ) ) + { + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_UPW::ML_dtshift", ML_dtshift_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register ML_dtshift_bound BC for ML_BSSN_UPW::ML_dtshift!"); + } + + if (CCTK_EQUALS(ML_Gamma_bound, "none" ) || + CCTK_EQUALS(ML_Gamma_bound, "static") || + CCTK_EQUALS(ML_Gamma_bound, "flat" ) || + CCTK_EQUALS(ML_Gamma_bound, "zero" ) ) + { + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_UPW::ML_Gamma", ML_Gamma_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register ML_Gamma_bound BC for ML_BSSN_UPW::ML_Gamma!"); + } + + if (CCTK_EQUALS(ML_lapse_bound, "none" ) || + CCTK_EQUALS(ML_lapse_bound, "static") || + CCTK_EQUALS(ML_lapse_bound, "flat" ) || + CCTK_EQUALS(ML_lapse_bound, "zero" ) ) + { + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_UPW::ML_lapse", ML_lapse_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register ML_lapse_bound BC for ML_BSSN_UPW::ML_lapse!"); + } + + if (CCTK_EQUALS(ML_log_confac_bound, "none" ) || + CCTK_EQUALS(ML_log_confac_bound, "static") || + CCTK_EQUALS(ML_log_confac_bound, "flat" ) || + CCTK_EQUALS(ML_log_confac_bound, "zero" ) ) + { + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_UPW::ML_log_confac", ML_log_confac_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register ML_log_confac_bound BC for ML_BSSN_UPW::ML_log_confac!"); + } + + if (CCTK_EQUALS(ML_metric_bound, "none" ) || + CCTK_EQUALS(ML_metric_bound, "static") || + CCTK_EQUALS(ML_metric_bound, "flat" ) || + CCTK_EQUALS(ML_metric_bound, "zero" ) ) + { + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_UPW::ML_metric", ML_metric_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register ML_metric_bound BC for ML_BSSN_UPW::ML_metric!"); + } + + if (CCTK_EQUALS(ML_shift_bound, "none" ) || + CCTK_EQUALS(ML_shift_bound, "static") || + CCTK_EQUALS(ML_shift_bound, "flat" ) || + CCTK_EQUALS(ML_shift_bound, "zero" ) ) + { + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_UPW::ML_shift", ML_shift_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register ML_shift_bound BC for ML_BSSN_UPW::ML_shift!"); + } + + if (CCTK_EQUALS(ML_trace_curv_bound, "none" ) || + CCTK_EQUALS(ML_trace_curv_bound, "static") || + CCTK_EQUALS(ML_trace_curv_bound, "flat" ) || + CCTK_EQUALS(ML_trace_curv_bound, "zero" ) ) + { + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_UPW::ML_trace_curv", ML_trace_curv_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register ML_trace_curv_bound BC for ML_BSSN_UPW::ML_trace_curv!"); + } + + if (CCTK_EQUALS(At11_bound, "none" ) || + CCTK_EQUALS(At11_bound, "static") || + CCTK_EQUALS(At11_bound, "flat" ) || + CCTK_EQUALS(At11_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_UPW::At11", At11_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register At11_bound BC for ML_BSSN_UPW::At11!"); + } + + if (CCTK_EQUALS(At12_bound, "none" ) || + CCTK_EQUALS(At12_bound, "static") || + CCTK_EQUALS(At12_bound, "flat" ) || + CCTK_EQUALS(At12_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_UPW::At12", At12_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register At12_bound BC for ML_BSSN_UPW::At12!"); + } + + if (CCTK_EQUALS(At13_bound, "none" ) || + CCTK_EQUALS(At13_bound, "static") || + CCTK_EQUALS(At13_bound, "flat" ) || + CCTK_EQUALS(At13_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_UPW::At13", At13_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register At13_bound BC for ML_BSSN_UPW::At13!"); + } + + if (CCTK_EQUALS(At22_bound, "none" ) || + CCTK_EQUALS(At22_bound, "static") || + CCTK_EQUALS(At22_bound, "flat" ) || + CCTK_EQUALS(At22_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_UPW::At22", At22_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register At22_bound BC for ML_BSSN_UPW::At22!"); + } + + if (CCTK_EQUALS(At23_bound, "none" ) || + CCTK_EQUALS(At23_bound, "static") || + CCTK_EQUALS(At23_bound, "flat" ) || + CCTK_EQUALS(At23_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_UPW::At23", At23_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register At23_bound BC for ML_BSSN_UPW::At23!"); + } + + if (CCTK_EQUALS(At33_bound, "none" ) || + CCTK_EQUALS(At33_bound, "static") || + CCTK_EQUALS(At33_bound, "flat" ) || + CCTK_EQUALS(At33_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_UPW::At33", At33_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register At33_bound BC for ML_BSSN_UPW::At33!"); + } + + if (CCTK_EQUALS(A_bound, "none" ) || + CCTK_EQUALS(A_bound, "static") || + CCTK_EQUALS(A_bound, "flat" ) || + CCTK_EQUALS(A_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_UPW::A", A_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register A_bound BC for ML_BSSN_UPW::A!"); + } + + if (CCTK_EQUALS(B1_bound, "none" ) || + CCTK_EQUALS(B1_bound, "static") || + CCTK_EQUALS(B1_bound, "flat" ) || + CCTK_EQUALS(B1_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_UPW::B1", B1_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register B1_bound BC for ML_BSSN_UPW::B1!"); + } + + if (CCTK_EQUALS(B2_bound, "none" ) || + CCTK_EQUALS(B2_bound, "static") || + CCTK_EQUALS(B2_bound, "flat" ) || + CCTK_EQUALS(B2_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_UPW::B2", B2_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register B2_bound BC for ML_BSSN_UPW::B2!"); + } + + if (CCTK_EQUALS(B3_bound, "none" ) || + CCTK_EQUALS(B3_bound, "static") || + CCTK_EQUALS(B3_bound, "flat" ) || + CCTK_EQUALS(B3_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_UPW::B3", B3_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register B3_bound BC for ML_BSSN_UPW::B3!"); + } + + if (CCTK_EQUALS(Xt1_bound, "none" ) || + CCTK_EQUALS(Xt1_bound, "static") || + CCTK_EQUALS(Xt1_bound, "flat" ) || + CCTK_EQUALS(Xt1_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_UPW::Xt1", Xt1_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register Xt1_bound BC for ML_BSSN_UPW::Xt1!"); + } + + if (CCTK_EQUALS(Xt2_bound, "none" ) || + CCTK_EQUALS(Xt2_bound, "static") || + CCTK_EQUALS(Xt2_bound, "flat" ) || + CCTK_EQUALS(Xt2_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_UPW::Xt2", Xt2_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register Xt2_bound BC for ML_BSSN_UPW::Xt2!"); + } + + if (CCTK_EQUALS(Xt3_bound, "none" ) || + CCTK_EQUALS(Xt3_bound, "static") || + CCTK_EQUALS(Xt3_bound, "flat" ) || + CCTK_EQUALS(Xt3_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_UPW::Xt3", Xt3_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register Xt3_bound BC for ML_BSSN_UPW::Xt3!"); + } + + if (CCTK_EQUALS(alpha_bound, "none" ) || + CCTK_EQUALS(alpha_bound, "static") || + CCTK_EQUALS(alpha_bound, "flat" ) || + CCTK_EQUALS(alpha_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_UPW::alpha", alpha_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register alpha_bound BC for ML_BSSN_UPW::alpha!"); + } + + if (CCTK_EQUALS(phi_bound, "none" ) || + CCTK_EQUALS(phi_bound, "static") || + CCTK_EQUALS(phi_bound, "flat" ) || + CCTK_EQUALS(phi_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_UPW::phi", phi_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register phi_bound BC for ML_BSSN_UPW::phi!"); + } + + if (CCTK_EQUALS(gt11_bound, "none" ) || + CCTK_EQUALS(gt11_bound, "static") || + CCTK_EQUALS(gt11_bound, "flat" ) || + CCTK_EQUALS(gt11_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_UPW::gt11", gt11_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register gt11_bound BC for ML_BSSN_UPW::gt11!"); + } + + if (CCTK_EQUALS(gt12_bound, "none" ) || + CCTK_EQUALS(gt12_bound, "static") || + CCTK_EQUALS(gt12_bound, "flat" ) || + CCTK_EQUALS(gt12_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_UPW::gt12", gt12_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register gt12_bound BC for ML_BSSN_UPW::gt12!"); + } + + if (CCTK_EQUALS(gt13_bound, "none" ) || + CCTK_EQUALS(gt13_bound, "static") || + CCTK_EQUALS(gt13_bound, "flat" ) || + CCTK_EQUALS(gt13_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_UPW::gt13", gt13_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register gt13_bound BC for ML_BSSN_UPW::gt13!"); + } + + if (CCTK_EQUALS(gt22_bound, "none" ) || + CCTK_EQUALS(gt22_bound, "static") || + CCTK_EQUALS(gt22_bound, "flat" ) || + CCTK_EQUALS(gt22_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_UPW::gt22", gt22_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register gt22_bound BC for ML_BSSN_UPW::gt22!"); + } + + if (CCTK_EQUALS(gt23_bound, "none" ) || + CCTK_EQUALS(gt23_bound, "static") || + CCTK_EQUALS(gt23_bound, "flat" ) || + CCTK_EQUALS(gt23_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_UPW::gt23", gt23_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register gt23_bound BC for ML_BSSN_UPW::gt23!"); + } + + if (CCTK_EQUALS(gt33_bound, "none" ) || + CCTK_EQUALS(gt33_bound, "static") || + CCTK_EQUALS(gt33_bound, "flat" ) || + CCTK_EQUALS(gt33_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_UPW::gt33", gt33_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register gt33_bound BC for ML_BSSN_UPW::gt33!"); + } + + if (CCTK_EQUALS(beta1_bound, "none" ) || + CCTK_EQUALS(beta1_bound, "static") || + CCTK_EQUALS(beta1_bound, "flat" ) || + CCTK_EQUALS(beta1_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_UPW::beta1", beta1_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register beta1_bound BC for ML_BSSN_UPW::beta1!"); + } + + if (CCTK_EQUALS(beta2_bound, "none" ) || + CCTK_EQUALS(beta2_bound, "static") || + CCTK_EQUALS(beta2_bound, "flat" ) || + CCTK_EQUALS(beta2_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_UPW::beta2", beta2_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register beta2_bound BC for ML_BSSN_UPW::beta2!"); + } + + if (CCTK_EQUALS(beta3_bound, "none" ) || + CCTK_EQUALS(beta3_bound, "static") || + CCTK_EQUALS(beta3_bound, "flat" ) || + CCTK_EQUALS(beta3_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_UPW::beta3", beta3_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register beta3_bound BC for ML_BSSN_UPW::beta3!"); + } + + if (CCTK_EQUALS(trK_bound, "none" ) || + CCTK_EQUALS(trK_bound, "static") || + CCTK_EQUALS(trK_bound, "flat" ) || + CCTK_EQUALS(trK_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_BSSN_UPW::trK", trK_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register trK_bound BC for ML_BSSN_UPW::trK!"); + } + + if (CCTK_EQUALS(ML_curv_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_ML_curv_bound = -1; + if (handle_ML_curv_bound < 0) handle_ML_curv_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_curv_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_curv_bound , ML_curv_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_ML_curv_bound ,ML_curv_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_curv_bound, + "ML_BSSN_UPW::ML_curv", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_UPW::ML_curv!"); + + } + + if (CCTK_EQUALS(ML_dtlapse_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_ML_dtlapse_bound = -1; + if (handle_ML_dtlapse_bound < 0) handle_ML_dtlapse_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_dtlapse_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_dtlapse_bound , ML_dtlapse_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_ML_dtlapse_bound ,ML_dtlapse_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_dtlapse_bound, + "ML_BSSN_UPW::ML_dtlapse", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_UPW::ML_dtlapse!"); + + } + + if (CCTK_EQUALS(ML_dtshift_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_ML_dtshift_bound = -1; + if (handle_ML_dtshift_bound < 0) handle_ML_dtshift_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_dtshift_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_dtshift_bound , ML_dtshift_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_ML_dtshift_bound ,ML_dtshift_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_dtshift_bound, + "ML_BSSN_UPW::ML_dtshift", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_UPW::ML_dtshift!"); + + } + + if (CCTK_EQUALS(ML_Gamma_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_ML_Gamma_bound = -1; + if (handle_ML_Gamma_bound < 0) handle_ML_Gamma_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_Gamma_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_Gamma_bound , ML_Gamma_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_ML_Gamma_bound ,ML_Gamma_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_Gamma_bound, + "ML_BSSN_UPW::ML_Gamma", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_UPW::ML_Gamma!"); + + } + + if (CCTK_EQUALS(ML_lapse_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_ML_lapse_bound = -1; + if (handle_ML_lapse_bound < 0) handle_ML_lapse_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_lapse_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_lapse_bound , ML_lapse_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_ML_lapse_bound ,ML_lapse_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_lapse_bound, + "ML_BSSN_UPW::ML_lapse", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_UPW::ML_lapse!"); + + } + + if (CCTK_EQUALS(ML_log_confac_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_ML_log_confac_bound = -1; + if (handle_ML_log_confac_bound < 0) handle_ML_log_confac_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_log_confac_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_log_confac_bound , ML_log_confac_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_ML_log_confac_bound ,ML_log_confac_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_log_confac_bound, + "ML_BSSN_UPW::ML_log_confac", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_UPW::ML_log_confac!"); + + } + + if (CCTK_EQUALS(ML_metric_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_ML_metric_bound = -1; + if (handle_ML_metric_bound < 0) handle_ML_metric_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_metric_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_metric_bound , ML_metric_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_ML_metric_bound ,ML_metric_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_metric_bound, + "ML_BSSN_UPW::ML_metric", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_UPW::ML_metric!"); + + } + + if (CCTK_EQUALS(ML_shift_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_ML_shift_bound = -1; + if (handle_ML_shift_bound < 0) handle_ML_shift_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_shift_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_shift_bound , ML_shift_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_ML_shift_bound ,ML_shift_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_shift_bound, + "ML_BSSN_UPW::ML_shift", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_UPW::ML_shift!"); + + } + + if (CCTK_EQUALS(ML_trace_curv_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_ML_trace_curv_bound = -1; + if (handle_ML_trace_curv_bound < 0) handle_ML_trace_curv_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_trace_curv_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_trace_curv_bound , ML_trace_curv_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_ML_trace_curv_bound ,ML_trace_curv_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_trace_curv_bound, + "ML_BSSN_UPW::ML_trace_curv", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_UPW::ML_trace_curv!"); + + } + + if (CCTK_EQUALS(At11_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_At11_bound = -1; + if (handle_At11_bound < 0) handle_At11_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_At11_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_At11_bound , At11_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_At11_bound ,At11_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_At11_bound, + "ML_BSSN_UPW::At11", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_UPW::At11!"); + + } + + if (CCTK_EQUALS(At12_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_At12_bound = -1; + if (handle_At12_bound < 0) handle_At12_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_At12_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_At12_bound , At12_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_At12_bound ,At12_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_At12_bound, + "ML_BSSN_UPW::At12", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_UPW::At12!"); + + } + + if (CCTK_EQUALS(At13_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_At13_bound = -1; + if (handle_At13_bound < 0) handle_At13_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_At13_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_At13_bound , At13_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_At13_bound ,At13_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_At13_bound, + "ML_BSSN_UPW::At13", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_UPW::At13!"); + + } + + if (CCTK_EQUALS(At22_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_At22_bound = -1; + if (handle_At22_bound < 0) handle_At22_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_At22_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_At22_bound , At22_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_At22_bound ,At22_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_At22_bound, + "ML_BSSN_UPW::At22", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_UPW::At22!"); + + } + + if (CCTK_EQUALS(At23_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_At23_bound = -1; + if (handle_At23_bound < 0) handle_At23_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_At23_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_At23_bound , At23_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_At23_bound ,At23_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_At23_bound, + "ML_BSSN_UPW::At23", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_UPW::At23!"); + + } + + if (CCTK_EQUALS(At33_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_At33_bound = -1; + if (handle_At33_bound < 0) handle_At33_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_At33_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_At33_bound , At33_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_At33_bound ,At33_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_At33_bound, + "ML_BSSN_UPW::At33", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_UPW::At33!"); + + } + + if (CCTK_EQUALS(A_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_A_bound = -1; + if (handle_A_bound < 0) handle_A_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_A_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_A_bound , A_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_A_bound ,A_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_A_bound, + "ML_BSSN_UPW::A", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_UPW::A!"); + + } + + if (CCTK_EQUALS(B1_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_B1_bound = -1; + if (handle_B1_bound < 0) handle_B1_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_B1_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_B1_bound , B1_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_B1_bound ,B1_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_B1_bound, + "ML_BSSN_UPW::B1", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_UPW::B1!"); + + } + + if (CCTK_EQUALS(B2_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_B2_bound = -1; + if (handle_B2_bound < 0) handle_B2_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_B2_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_B2_bound , B2_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_B2_bound ,B2_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_B2_bound, + "ML_BSSN_UPW::B2", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_UPW::B2!"); + + } + + if (CCTK_EQUALS(B3_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_B3_bound = -1; + if (handle_B3_bound < 0) handle_B3_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_B3_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_B3_bound , B3_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_B3_bound ,B3_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_B3_bound, + "ML_BSSN_UPW::B3", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_UPW::B3!"); + + } + + if (CCTK_EQUALS(Xt1_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_Xt1_bound = -1; + if (handle_Xt1_bound < 0) handle_Xt1_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_Xt1_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_Xt1_bound , Xt1_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_Xt1_bound ,Xt1_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_Xt1_bound, + "ML_BSSN_UPW::Xt1", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_UPW::Xt1!"); + + } + + if (CCTK_EQUALS(Xt2_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_Xt2_bound = -1; + if (handle_Xt2_bound < 0) handle_Xt2_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_Xt2_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_Xt2_bound , Xt2_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_Xt2_bound ,Xt2_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_Xt2_bound, + "ML_BSSN_UPW::Xt2", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_UPW::Xt2!"); + + } + + if (CCTK_EQUALS(Xt3_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_Xt3_bound = -1; + if (handle_Xt3_bound < 0) handle_Xt3_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_Xt3_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_Xt3_bound , Xt3_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_Xt3_bound ,Xt3_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_Xt3_bound, + "ML_BSSN_UPW::Xt3", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_UPW::Xt3!"); + + } + + if (CCTK_EQUALS(alpha_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_alpha_bound = -1; + if (handle_alpha_bound < 0) handle_alpha_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_alpha_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_alpha_bound , alpha_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_alpha_bound ,alpha_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_alpha_bound, + "ML_BSSN_UPW::alpha", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_UPW::alpha!"); + + } + + if (CCTK_EQUALS(phi_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_phi_bound = -1; + if (handle_phi_bound < 0) handle_phi_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_phi_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_phi_bound , phi_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_phi_bound ,phi_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_phi_bound, + "ML_BSSN_UPW::phi", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_UPW::phi!"); + + } + + if (CCTK_EQUALS(gt11_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_gt11_bound = -1; + if (handle_gt11_bound < 0) handle_gt11_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_gt11_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_gt11_bound , gt11_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_gt11_bound ,gt11_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_gt11_bound, + "ML_BSSN_UPW::gt11", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_UPW::gt11!"); + + } + + if (CCTK_EQUALS(gt12_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_gt12_bound = -1; + if (handle_gt12_bound < 0) handle_gt12_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_gt12_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_gt12_bound , gt12_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_gt12_bound ,gt12_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_gt12_bound, + "ML_BSSN_UPW::gt12", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_UPW::gt12!"); + + } + + if (CCTK_EQUALS(gt13_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_gt13_bound = -1; + if (handle_gt13_bound < 0) handle_gt13_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_gt13_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_gt13_bound , gt13_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_gt13_bound ,gt13_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_gt13_bound, + "ML_BSSN_UPW::gt13", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_UPW::gt13!"); + + } + + if (CCTK_EQUALS(gt22_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_gt22_bound = -1; + if (handle_gt22_bound < 0) handle_gt22_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_gt22_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_gt22_bound , gt22_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_gt22_bound ,gt22_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_gt22_bound, + "ML_BSSN_UPW::gt22", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_UPW::gt22!"); + + } + + if (CCTK_EQUALS(gt23_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_gt23_bound = -1; + if (handle_gt23_bound < 0) handle_gt23_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_gt23_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_gt23_bound , gt23_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_gt23_bound ,gt23_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_gt23_bound, + "ML_BSSN_UPW::gt23", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_UPW::gt23!"); + + } + + if (CCTK_EQUALS(gt33_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_gt33_bound = -1; + if (handle_gt33_bound < 0) handle_gt33_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_gt33_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_gt33_bound , gt33_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_gt33_bound ,gt33_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_gt33_bound, + "ML_BSSN_UPW::gt33", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_UPW::gt33!"); + + } + + if (CCTK_EQUALS(beta1_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_beta1_bound = -1; + if (handle_beta1_bound < 0) handle_beta1_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_beta1_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_beta1_bound , beta1_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_beta1_bound ,beta1_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_beta1_bound, + "ML_BSSN_UPW::beta1", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_UPW::beta1!"); + + } + + if (CCTK_EQUALS(beta2_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_beta2_bound = -1; + if (handle_beta2_bound < 0) handle_beta2_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_beta2_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_beta2_bound , beta2_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_beta2_bound ,beta2_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_beta2_bound, + "ML_BSSN_UPW::beta2", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_UPW::beta2!"); + + } + + if (CCTK_EQUALS(beta3_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_beta3_bound = -1; + if (handle_beta3_bound < 0) handle_beta3_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_beta3_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_beta3_bound , beta3_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_beta3_bound ,beta3_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_beta3_bound, + "ML_BSSN_UPW::beta3", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_UPW::beta3!"); + + } + + if (CCTK_EQUALS(trK_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_trK_bound = -1; + if (handle_trK_bound < 0) handle_trK_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_trK_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_trK_bound , trK_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_trK_bound ,trK_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_trK_bound, + "ML_BSSN_UPW::trK", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_BSSN_UPW::trK!"); + + } + + if (CCTK_EQUALS(ML_curv_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_ML_curv_bound = -1; + if (handle_ML_curv_bound < 0) handle_ML_curv_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_curv_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_curv_bound ,ML_curv_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_curv_bound, + "ML_BSSN_UPW::ML_curv", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Scalar BC for ML_BSSN_UPW::ML_curv!"); + + } + + if (CCTK_EQUALS(ML_dtlapse_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_ML_dtlapse_bound = -1; + if (handle_ML_dtlapse_bound < 0) handle_ML_dtlapse_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_dtlapse_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_dtlapse_bound ,ML_dtlapse_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_dtlapse_bound, + "ML_BSSN_UPW::ML_dtlapse", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Scalar BC for ML_BSSN_UPW::ML_dtlapse!"); + + } + + if (CCTK_EQUALS(ML_dtshift_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_ML_dtshift_bound = -1; + if (handle_ML_dtshift_bound < 0) handle_ML_dtshift_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_dtshift_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_dtshift_bound ,ML_dtshift_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_dtshift_bound, + "ML_BSSN_UPW::ML_dtshift", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Scalar BC for ML_BSSN_UPW::ML_dtshift!"); + + } + + if (CCTK_EQUALS(ML_Gamma_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_ML_Gamma_bound = -1; + if (handle_ML_Gamma_bound < 0) handle_ML_Gamma_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_Gamma_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_Gamma_bound ,ML_Gamma_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_Gamma_bound, + "ML_BSSN_UPW::ML_Gamma", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Scalar BC for ML_BSSN_UPW::ML_Gamma!"); + + } + + if (CCTK_EQUALS(ML_lapse_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_ML_lapse_bound = -1; + if (handle_ML_lapse_bound < 0) handle_ML_lapse_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_lapse_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_lapse_bound ,ML_lapse_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_lapse_bound, + "ML_BSSN_UPW::ML_lapse", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Scalar BC for ML_BSSN_UPW::ML_lapse!"); + + } + + if (CCTK_EQUALS(ML_log_confac_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_ML_log_confac_bound = -1; + if (handle_ML_log_confac_bound < 0) handle_ML_log_confac_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_log_confac_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_log_confac_bound ,ML_log_confac_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_log_confac_bound, + "ML_BSSN_UPW::ML_log_confac", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Scalar BC for ML_BSSN_UPW::ML_log_confac!"); + + } + + if (CCTK_EQUALS(ML_metric_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_ML_metric_bound = -1; + if (handle_ML_metric_bound < 0) handle_ML_metric_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_metric_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_metric_bound ,ML_metric_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_metric_bound, + "ML_BSSN_UPW::ML_metric", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Scalar BC for ML_BSSN_UPW::ML_metric!"); + + } + + if (CCTK_EQUALS(ML_shift_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_ML_shift_bound = -1; + if (handle_ML_shift_bound < 0) handle_ML_shift_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_shift_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_shift_bound ,ML_shift_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_shift_bound, + "ML_BSSN_UPW::ML_shift", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Scalar BC for ML_BSSN_UPW::ML_shift!"); + + } + + if (CCTK_EQUALS(ML_trace_curv_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_ML_trace_curv_bound = -1; + if (handle_ML_trace_curv_bound < 0) handle_ML_trace_curv_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ML_trace_curv_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ML_trace_curv_bound ,ML_trace_curv_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ML_trace_curv_bound, + "ML_BSSN_UPW::ML_trace_curv", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Scalar BC for ML_BSSN_UPW::ML_trace_curv!"); + + } + + if (CCTK_EQUALS(At11_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_At11_bound = -1; + if (handle_At11_bound < 0) handle_At11_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_At11_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_At11_bound ,At11_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_At11_bound, + "ML_BSSN_UPW::At11", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_UPW::At11!"); + + } + + if (CCTK_EQUALS(At12_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_At12_bound = -1; + if (handle_At12_bound < 0) handle_At12_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_At12_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_At12_bound ,At12_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_At12_bound, + "ML_BSSN_UPW::At12", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_UPW::At12!"); + + } + + if (CCTK_EQUALS(At13_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_At13_bound = -1; + if (handle_At13_bound < 0) handle_At13_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_At13_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_At13_bound ,At13_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_At13_bound, + "ML_BSSN_UPW::At13", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_UPW::At13!"); + + } + + if (CCTK_EQUALS(At22_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_At22_bound = -1; + if (handle_At22_bound < 0) handle_At22_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_At22_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_At22_bound ,At22_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_At22_bound, + "ML_BSSN_UPW::At22", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_UPW::At22!"); + + } + + if (CCTK_EQUALS(At23_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_At23_bound = -1; + if (handle_At23_bound < 0) handle_At23_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_At23_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_At23_bound ,At23_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_At23_bound, + "ML_BSSN_UPW::At23", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_UPW::At23!"); + + } + + if (CCTK_EQUALS(At33_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_At33_bound = -1; + if (handle_At33_bound < 0) handle_At33_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_At33_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_At33_bound ,At33_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_At33_bound, + "ML_BSSN_UPW::At33", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_UPW::At33!"); + + } + + if (CCTK_EQUALS(A_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_A_bound = -1; + if (handle_A_bound < 0) handle_A_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_A_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_A_bound ,A_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_A_bound, + "ML_BSSN_UPW::A", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_UPW::A!"); + + } + + if (CCTK_EQUALS(B1_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_B1_bound = -1; + if (handle_B1_bound < 0) handle_B1_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_B1_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_B1_bound ,B1_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_B1_bound, + "ML_BSSN_UPW::B1", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_UPW::B1!"); + + } + + if (CCTK_EQUALS(B2_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_B2_bound = -1; + if (handle_B2_bound < 0) handle_B2_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_B2_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_B2_bound ,B2_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_B2_bound, + "ML_BSSN_UPW::B2", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_UPW::B2!"); + + } + + if (CCTK_EQUALS(B3_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_B3_bound = -1; + if (handle_B3_bound < 0) handle_B3_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_B3_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_B3_bound ,B3_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_B3_bound, + "ML_BSSN_UPW::B3", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_UPW::B3!"); + + } + + if (CCTK_EQUALS(Xt1_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_Xt1_bound = -1; + if (handle_Xt1_bound < 0) handle_Xt1_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_Xt1_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_Xt1_bound ,Xt1_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_Xt1_bound, + "ML_BSSN_UPW::Xt1", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_UPW::Xt1!"); + + } + + if (CCTK_EQUALS(Xt2_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_Xt2_bound = -1; + if (handle_Xt2_bound < 0) handle_Xt2_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_Xt2_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_Xt2_bound ,Xt2_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_Xt2_bound, + "ML_BSSN_UPW::Xt2", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_UPW::Xt2!"); + + } + + if (CCTK_EQUALS(Xt3_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_Xt3_bound = -1; + if (handle_Xt3_bound < 0) handle_Xt3_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_Xt3_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_Xt3_bound ,Xt3_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_Xt3_bound, + "ML_BSSN_UPW::Xt3", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_UPW::Xt3!"); + + } + + if (CCTK_EQUALS(alpha_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_alpha_bound = -1; + if (handle_alpha_bound < 0) handle_alpha_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_alpha_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_alpha_bound ,alpha_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_alpha_bound, + "ML_BSSN_UPW::alpha", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_UPW::alpha!"); + + } + + if (CCTK_EQUALS(phi_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_phi_bound = -1; + if (handle_phi_bound < 0) handle_phi_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_phi_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_phi_bound ,phi_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_phi_bound, + "ML_BSSN_UPW::phi", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_UPW::phi!"); + + } + + if (CCTK_EQUALS(gt11_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_gt11_bound = -1; + if (handle_gt11_bound < 0) handle_gt11_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_gt11_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_gt11_bound ,gt11_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_gt11_bound, + "ML_BSSN_UPW::gt11", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_UPW::gt11!"); + + } + + if (CCTK_EQUALS(gt12_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_gt12_bound = -1; + if (handle_gt12_bound < 0) handle_gt12_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_gt12_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_gt12_bound ,gt12_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_gt12_bound, + "ML_BSSN_UPW::gt12", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_UPW::gt12!"); + + } + + if (CCTK_EQUALS(gt13_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_gt13_bound = -1; + if (handle_gt13_bound < 0) handle_gt13_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_gt13_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_gt13_bound ,gt13_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_gt13_bound, + "ML_BSSN_UPW::gt13", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_UPW::gt13!"); + + } + + if (CCTK_EQUALS(gt22_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_gt22_bound = -1; + if (handle_gt22_bound < 0) handle_gt22_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_gt22_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_gt22_bound ,gt22_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_gt22_bound, + "ML_BSSN_UPW::gt22", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_UPW::gt22!"); + + } + + if (CCTK_EQUALS(gt23_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_gt23_bound = -1; + if (handle_gt23_bound < 0) handle_gt23_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_gt23_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_gt23_bound ,gt23_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_gt23_bound, + "ML_BSSN_UPW::gt23", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_UPW::gt23!"); + + } + + if (CCTK_EQUALS(gt33_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_gt33_bound = -1; + if (handle_gt33_bound < 0) handle_gt33_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_gt33_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_gt33_bound ,gt33_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_gt33_bound, + "ML_BSSN_UPW::gt33", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_UPW::gt33!"); + + } + + if (CCTK_EQUALS(beta1_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_beta1_bound = -1; + if (handle_beta1_bound < 0) handle_beta1_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_beta1_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_beta1_bound ,beta1_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_beta1_bound, + "ML_BSSN_UPW::beta1", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_UPW::beta1!"); + + } + + if (CCTK_EQUALS(beta2_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_beta2_bound = -1; + if (handle_beta2_bound < 0) handle_beta2_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_beta2_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_beta2_bound ,beta2_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_beta2_bound, + "ML_BSSN_UPW::beta2", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_UPW::beta2!"); + + } + + if (CCTK_EQUALS(beta3_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_beta3_bound = -1; + if (handle_beta3_bound < 0) handle_beta3_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_beta3_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_beta3_bound ,beta3_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_beta3_bound, + "ML_BSSN_UPW::beta3", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_UPW::beta3!"); + + } + + if (CCTK_EQUALS(trK_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_trK_bound = -1; + if (handle_trK_bound < 0) handle_trK_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_trK_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_trK_bound ,trK_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_trK_bound, + "ML_BSSN_UPW::trK", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_BSSN_UPW::trK!"); + + } + return; +} + + + +/* template for entries in parameter file: +#$bound$#ML_BSSN_UPW::ML_curv_bound = "skip" +#$bound$#ML_BSSN_UPW::ML_curv_bound_speed = 1.0 +#$bound$#ML_BSSN_UPW::ML_curv_bound_limit = 0.0 +#$bound$#ML_BSSN_UPW::ML_curv_bound_scalar = 0.0 + +#$bound$#ML_BSSN_UPW::ML_dtlapse_bound = "skip" +#$bound$#ML_BSSN_UPW::ML_dtlapse_bound_speed = 1.0 +#$bound$#ML_BSSN_UPW::ML_dtlapse_bound_limit = 0.0 +#$bound$#ML_BSSN_UPW::ML_dtlapse_bound_scalar = 0.0 + +#$bound$#ML_BSSN_UPW::ML_dtshift_bound = "skip" +#$bound$#ML_BSSN_UPW::ML_dtshift_bound_speed = 1.0 +#$bound$#ML_BSSN_UPW::ML_dtshift_bound_limit = 0.0 +#$bound$#ML_BSSN_UPW::ML_dtshift_bound_scalar = 0.0 + +#$bound$#ML_BSSN_UPW::ML_Gamma_bound = "skip" +#$bound$#ML_BSSN_UPW::ML_Gamma_bound_speed = 1.0 +#$bound$#ML_BSSN_UPW::ML_Gamma_bound_limit = 0.0 +#$bound$#ML_BSSN_UPW::ML_Gamma_bound_scalar = 0.0 + +#$bound$#ML_BSSN_UPW::ML_lapse_bound = "skip" +#$bound$#ML_BSSN_UPW::ML_lapse_bound_speed = 1.0 +#$bound$#ML_BSSN_UPW::ML_lapse_bound_limit = 0.0 +#$bound$#ML_BSSN_UPW::ML_lapse_bound_scalar = 0.0 + +#$bound$#ML_BSSN_UPW::ML_log_confac_bound = "skip" +#$bound$#ML_BSSN_UPW::ML_log_confac_bound_speed = 1.0 +#$bound$#ML_BSSN_UPW::ML_log_confac_bound_limit = 0.0 +#$bound$#ML_BSSN_UPW::ML_log_confac_bound_scalar = 0.0 + +#$bound$#ML_BSSN_UPW::ML_metric_bound = "skip" +#$bound$#ML_BSSN_UPW::ML_metric_bound_speed = 1.0 +#$bound$#ML_BSSN_UPW::ML_metric_bound_limit = 0.0 +#$bound$#ML_BSSN_UPW::ML_metric_bound_scalar = 0.0 + +#$bound$#ML_BSSN_UPW::ML_shift_bound = "skip" +#$bound$#ML_BSSN_UPW::ML_shift_bound_speed = 1.0 +#$bound$#ML_BSSN_UPW::ML_shift_bound_limit = 0.0 +#$bound$#ML_BSSN_UPW::ML_shift_bound_scalar = 0.0 + +#$bound$#ML_BSSN_UPW::ML_trace_curv_bound = "skip" +#$bound$#ML_BSSN_UPW::ML_trace_curv_bound_speed = 1.0 +#$bound$#ML_BSSN_UPW::ML_trace_curv_bound_limit = 0.0 +#$bound$#ML_BSSN_UPW::ML_trace_curv_bound_scalar = 0.0 + +#$bound$#ML_BSSN_UPW::At11_bound = "skip" +#$bound$#ML_BSSN_UPW::At11_bound_speed = 1.0 +#$bound$#ML_BSSN_UPW::At11_bound_limit = 0.0 +#$bound$#ML_BSSN_UPW::At11_bound_scalar = 0.0 + +#$bound$#ML_BSSN_UPW::At12_bound = "skip" +#$bound$#ML_BSSN_UPW::At12_bound_speed = 1.0 +#$bound$#ML_BSSN_UPW::At12_bound_limit = 0.0 +#$bound$#ML_BSSN_UPW::At12_bound_scalar = 0.0 + +#$bound$#ML_BSSN_UPW::At13_bound = "skip" +#$bound$#ML_BSSN_UPW::At13_bound_speed = 1.0 +#$bound$#ML_BSSN_UPW::At13_bound_limit = 0.0 +#$bound$#ML_BSSN_UPW::At13_bound_scalar = 0.0 + +#$bound$#ML_BSSN_UPW::At22_bound = "skip" +#$bound$#ML_BSSN_UPW::At22_bound_speed = 1.0 +#$bound$#ML_BSSN_UPW::At22_bound_limit = 0.0 +#$bound$#ML_BSSN_UPW::At22_bound_scalar = 0.0 + +#$bound$#ML_BSSN_UPW::At23_bound = "skip" +#$bound$#ML_BSSN_UPW::At23_bound_speed = 1.0 +#$bound$#ML_BSSN_UPW::At23_bound_limit = 0.0 +#$bound$#ML_BSSN_UPW::At23_bound_scalar = 0.0 + +#$bound$#ML_BSSN_UPW::At33_bound = "skip" +#$bound$#ML_BSSN_UPW::At33_bound_speed = 1.0 +#$bound$#ML_BSSN_UPW::At33_bound_limit = 0.0 +#$bound$#ML_BSSN_UPW::At33_bound_scalar = 0.0 + +#$bound$#ML_BSSN_UPW::A_bound = "skip" +#$bound$#ML_BSSN_UPW::A_bound_speed = 1.0 +#$bound$#ML_BSSN_UPW::A_bound_limit = 0.0 +#$bound$#ML_BSSN_UPW::A_bound_scalar = 0.0 + +#$bound$#ML_BSSN_UPW::B1_bound = "skip" +#$bound$#ML_BSSN_UPW::B1_bound_speed = 1.0 +#$bound$#ML_BSSN_UPW::B1_bound_limit = 0.0 +#$bound$#ML_BSSN_UPW::B1_bound_scalar = 0.0 + +#$bound$#ML_BSSN_UPW::B2_bound = "skip" +#$bound$#ML_BSSN_UPW::B2_bound_speed = 1.0 +#$bound$#ML_BSSN_UPW::B2_bound_limit = 0.0 +#$bound$#ML_BSSN_UPW::B2_bound_scalar = 0.0 + +#$bound$#ML_BSSN_UPW::B3_bound = "skip" +#$bound$#ML_BSSN_UPW::B3_bound_speed = 1.0 +#$bound$#ML_BSSN_UPW::B3_bound_limit = 0.0 +#$bound$#ML_BSSN_UPW::B3_bound_scalar = 0.0 + +#$bound$#ML_BSSN_UPW::Xt1_bound = "skip" +#$bound$#ML_BSSN_UPW::Xt1_bound_speed = 1.0 +#$bound$#ML_BSSN_UPW::Xt1_bound_limit = 0.0 +#$bound$#ML_BSSN_UPW::Xt1_bound_scalar = 0.0 + +#$bound$#ML_BSSN_UPW::Xt2_bound = "skip" +#$bound$#ML_BSSN_UPW::Xt2_bound_speed = 1.0 +#$bound$#ML_BSSN_UPW::Xt2_bound_limit = 0.0 +#$bound$#ML_BSSN_UPW::Xt2_bound_scalar = 0.0 + +#$bound$#ML_BSSN_UPW::Xt3_bound = "skip" +#$bound$#ML_BSSN_UPW::Xt3_bound_speed = 1.0 +#$bound$#ML_BSSN_UPW::Xt3_bound_limit = 0.0 +#$bound$#ML_BSSN_UPW::Xt3_bound_scalar = 0.0 + +#$bound$#ML_BSSN_UPW::alpha_bound = "skip" +#$bound$#ML_BSSN_UPW::alpha_bound_speed = 1.0 +#$bound$#ML_BSSN_UPW::alpha_bound_limit = 0.0 +#$bound$#ML_BSSN_UPW::alpha_bound_scalar = 0.0 + +#$bound$#ML_BSSN_UPW::phi_bound = "skip" +#$bound$#ML_BSSN_UPW::phi_bound_speed = 1.0 +#$bound$#ML_BSSN_UPW::phi_bound_limit = 0.0 +#$bound$#ML_BSSN_UPW::phi_bound_scalar = 0.0 + +#$bound$#ML_BSSN_UPW::gt11_bound = "skip" +#$bound$#ML_BSSN_UPW::gt11_bound_speed = 1.0 +#$bound$#ML_BSSN_UPW::gt11_bound_limit = 0.0 +#$bound$#ML_BSSN_UPW::gt11_bound_scalar = 0.0 + +#$bound$#ML_BSSN_UPW::gt12_bound = "skip" +#$bound$#ML_BSSN_UPW::gt12_bound_speed = 1.0 +#$bound$#ML_BSSN_UPW::gt12_bound_limit = 0.0 +#$bound$#ML_BSSN_UPW::gt12_bound_scalar = 0.0 + +#$bound$#ML_BSSN_UPW::gt13_bound = "skip" +#$bound$#ML_BSSN_UPW::gt13_bound_speed = 1.0 +#$bound$#ML_BSSN_UPW::gt13_bound_limit = 0.0 +#$bound$#ML_BSSN_UPW::gt13_bound_scalar = 0.0 + +#$bound$#ML_BSSN_UPW::gt22_bound = "skip" +#$bound$#ML_BSSN_UPW::gt22_bound_speed = 1.0 +#$bound$#ML_BSSN_UPW::gt22_bound_limit = 0.0 +#$bound$#ML_BSSN_UPW::gt22_bound_scalar = 0.0 + +#$bound$#ML_BSSN_UPW::gt23_bound = "skip" +#$bound$#ML_BSSN_UPW::gt23_bound_speed = 1.0 +#$bound$#ML_BSSN_UPW::gt23_bound_limit = 0.0 +#$bound$#ML_BSSN_UPW::gt23_bound_scalar = 0.0 + +#$bound$#ML_BSSN_UPW::gt33_bound = "skip" +#$bound$#ML_BSSN_UPW::gt33_bound_speed = 1.0 +#$bound$#ML_BSSN_UPW::gt33_bound_limit = 0.0 +#$bound$#ML_BSSN_UPW::gt33_bound_scalar = 0.0 + +#$bound$#ML_BSSN_UPW::beta1_bound = "skip" +#$bound$#ML_BSSN_UPW::beta1_bound_speed = 1.0 +#$bound$#ML_BSSN_UPW::beta1_bound_limit = 0.0 +#$bound$#ML_BSSN_UPW::beta1_bound_scalar = 0.0 + +#$bound$#ML_BSSN_UPW::beta2_bound = "skip" +#$bound$#ML_BSSN_UPW::beta2_bound_speed = 1.0 +#$bound$#ML_BSSN_UPW::beta2_bound_limit = 0.0 +#$bound$#ML_BSSN_UPW::beta2_bound_scalar = 0.0 + +#$bound$#ML_BSSN_UPW::beta3_bound = "skip" +#$bound$#ML_BSSN_UPW::beta3_bound_speed = 1.0 +#$bound$#ML_BSSN_UPW::beta3_bound_limit = 0.0 +#$bound$#ML_BSSN_UPW::beta3_bound_scalar = 0.0 + +#$bound$#ML_BSSN_UPW::trK_bound = "skip" +#$bound$#ML_BSSN_UPW::trK_bound_speed = 1.0 +#$bound$#ML_BSSN_UPW::trK_bound_limit = 0.0 +#$bound$#ML_BSSN_UPW::trK_bound_scalar = 0.0 + +*/ + diff --git a/ML_BSSN_UPW/src/ML_BSSN_UPW_Minkowski.cc b/ML_BSSN_UPW/src/ML_BSSN_UPW_Minkowski.cc new file mode 100644 index 0000000..560a651 --- /dev/null +++ b/ML_BSSN_UPW/src/ML_BSSN_UPW_Minkowski.cc @@ -0,0 +1,187 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +static void ML_BSSN_UPW_Minkowski_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_BSSN_UPW_Minkowski_Body"); + } + + if (cctk_iteration % ML_BSSN_UPW_Minkowski_calc_every != ML_BSSN_UPW_Minkowski_calc_offset) + { + return; + } + + const char *groups[] = {"ML_BSSN_UPW::ML_curv","ML_BSSN_UPW::ML_dtlapse","ML_BSSN_UPW::ML_dtshift","ML_BSSN_UPW::ML_Gamma","ML_BSSN_UPW::ML_lapse","ML_BSSN_UPW::ML_log_confac","ML_BSSN_UPW::ML_metric","ML_BSSN_UPW::ML_shift","ML_BSSN_UPW::ML_trace_curv"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_BSSN_UPW_Minkowski", 9, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o12dx = 0.0833333333333333333333333333333*INV(dx); + CCTK_REAL const p1o12dy = 0.0833333333333333333333333333333*INV(dy); + CCTK_REAL const p1o12dz = 0.0833333333333333333333333333333*INV(dz); + CCTK_REAL const p1o144dxdy = 0.00694444444444444444444444444444*INV(dx)*INV(dy); + CCTK_REAL const p1o144dxdz = 0.00694444444444444444444444444444*INV(dx)*INV(dz); + CCTK_REAL const p1o144dydz = 0.00694444444444444444444444444444*INV(dy)*INV(dz); + CCTK_REAL const p1o24dx = 0.0416666666666666666666666666667*INV(dx); + CCTK_REAL const p1o24dy = 0.0416666666666666666666666666667*INV(dy); + CCTK_REAL const p1o24dz = 0.0416666666666666666666666666667*INV(dz); + CCTK_REAL const p1o64dx = 0.015625*INV(dx); + CCTK_REAL const p1o64dy = 0.015625*INV(dy); + CCTK_REAL const p1o64dz = 0.015625*INV(dz); + CCTK_REAL const p1odx = INV(dx); + CCTK_REAL const p1ody = INV(dy); + CCTK_REAL const p1odz = INV(dz); + CCTK_REAL const pm1o12dx2 = -0.0833333333333333333333333333333*INV(SQR(dx)); + CCTK_REAL const pm1o12dy2 = -0.0833333333333333333333333333333*INV(SQR(dy)); + CCTK_REAL const pm1o12dz2 = -0.0833333333333333333333333333333*INV(SQR(dz)); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_BSSN_UPW_Minkowski, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + + /* Include user supplied include files */ + + /* Precompute derivatives */ + + /* Calculate temporaries and grid functions */ + CCTK_REAL phiL = IfThen(ToReal(conformalMethod),1,0); + + CCTK_REAL gt11L = 1; + + CCTK_REAL gt12L = 0; + + CCTK_REAL gt13L = 0; + + CCTK_REAL gt22L = 1; + + CCTK_REAL gt23L = 0; + + CCTK_REAL gt33L = 1; + + CCTK_REAL trKL = 0; + + CCTK_REAL At11L = 0; + + CCTK_REAL At12L = 0; + + CCTK_REAL At13L = 0; + + CCTK_REAL At22L = 0; + + CCTK_REAL At23L = 0; + + CCTK_REAL At33L = 0; + + CCTK_REAL Xt1L = 0; + + CCTK_REAL Xt2L = 0; + + CCTK_REAL Xt3L = 0; + + CCTK_REAL alphaL = 1; + + CCTK_REAL AL = 0; + + CCTK_REAL beta1L = 0; + + CCTK_REAL beta2L = 0; + + CCTK_REAL beta3L = 0; + + CCTK_REAL B1L = 0; + + CCTK_REAL B2L = 0; + + CCTK_REAL B3L = 0; + + + /* Copy local copies back to grid functions */ + A[index] = AL; + alpha[index] = alphaL; + At11[index] = At11L; + At12[index] = At12L; + At13[index] = At13L; + At22[index] = At22L; + At23[index] = At23L; + At33[index] = At33L; + B1[index] = B1L; + B2[index] = B2L; + B3[index] = B3L; + beta1[index] = beta1L; + beta2[index] = beta2L; + beta3[index] = beta3L; + gt11[index] = gt11L; + gt12[index] = gt12L; + gt13[index] = gt13L; + gt22[index] = gt22L; + gt23[index] = gt23L; + gt33[index] = gt33L; + phi[index] = phiL; + trK[index] = trKL; + Xt1[index] = Xt1L; + Xt2[index] = Xt2L; + Xt3[index] = Xt3L; + } + LC_ENDLOOP3 (ML_BSSN_UPW_Minkowski); +} + +extern "C" void ML_BSSN_UPW_Minkowski(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverEverything(cctkGH, &ML_BSSN_UPW_Minkowski_Body); +} diff --git a/ML_BSSN_UPW/src/ML_BSSN_UPW_RHS1.cc b/ML_BSSN_UPW/src/ML_BSSN_UPW_RHS1.cc new file mode 100644 index 0000000..f8718ac --- /dev/null +++ b/ML_BSSN_UPW/src/ML_BSSN_UPW_RHS1.cc @@ -0,0 +1,714 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +extern "C" void ML_BSSN_UPW_RHS1_SelectBCs(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT ierr = 0; + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_UPW::ML_dtlapserhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_UPW::ML_dtlapserhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_UPW::ML_dtshiftrhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_UPW::ML_dtshiftrhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_UPW::ML_Gammarhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_UPW::ML_Gammarhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_UPW::ML_lapserhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_UPW::ML_lapserhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_UPW::ML_log_confacrhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_UPW::ML_log_confacrhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_UPW::ML_metricrhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_UPW::ML_metricrhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_UPW::ML_shiftrhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_UPW::ML_shiftrhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_UPW::ML_trace_curvrhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_UPW::ML_trace_curvrhs."); + return; +} + +static void ML_BSSN_UPW_RHS1_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_BSSN_UPW_RHS1_Body"); + } + + if (cctk_iteration % ML_BSSN_UPW_RHS1_calc_every != ML_BSSN_UPW_RHS1_calc_offset) + { + return; + } + + const char *groups[] = {"grid::coordinates","Grid::coordinates","ML_BSSN_UPW::ML_curv","ML_BSSN_UPW::ML_dtlapse","ML_BSSN_UPW::ML_dtlapserhs","ML_BSSN_UPW::ML_dtshift","ML_BSSN_UPW::ML_dtshiftrhs","ML_BSSN_UPW::ML_Gamma","ML_BSSN_UPW::ML_Gammarhs","ML_BSSN_UPW::ML_lapse","ML_BSSN_UPW::ML_lapserhs","ML_BSSN_UPW::ML_log_confac","ML_BSSN_UPW::ML_log_confacrhs","ML_BSSN_UPW::ML_metric","ML_BSSN_UPW::ML_metricrhs","ML_BSSN_UPW::ML_shift","ML_BSSN_UPW::ML_shiftrhs","ML_BSSN_UPW::ML_trace_curv","ML_BSSN_UPW::ML_trace_curvrhs"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_BSSN_UPW_RHS1", 19, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o12dx = 0.0833333333333333333333333333333*INV(dx); + CCTK_REAL const p1o12dy = 0.0833333333333333333333333333333*INV(dy); + CCTK_REAL const p1o12dz = 0.0833333333333333333333333333333*INV(dz); + CCTK_REAL const p1o144dxdy = 0.00694444444444444444444444444444*INV(dx)*INV(dy); + CCTK_REAL const p1o144dxdz = 0.00694444444444444444444444444444*INV(dx)*INV(dz); + CCTK_REAL const p1o144dydz = 0.00694444444444444444444444444444*INV(dy)*INV(dz); + CCTK_REAL const p1o24dx = 0.0416666666666666666666666666667*INV(dx); + CCTK_REAL const p1o24dy = 0.0416666666666666666666666666667*INV(dy); + CCTK_REAL const p1o24dz = 0.0416666666666666666666666666667*INV(dz); + CCTK_REAL const p1o64dx = 0.015625*INV(dx); + CCTK_REAL const p1o64dy = 0.015625*INV(dy); + CCTK_REAL const p1o64dz = 0.015625*INV(dz); + CCTK_REAL const p1odx = INV(dx); + CCTK_REAL const p1ody = INV(dy); + CCTK_REAL const p1odz = INV(dz); + CCTK_REAL const pm1o12dx2 = -0.0833333333333333333333333333333*INV(SQR(dx)); + CCTK_REAL const pm1o12dy2 = -0.0833333333333333333333333333333*INV(SQR(dy)); + CCTK_REAL const pm1o12dz2 = -0.0833333333333333333333333333333*INV(SQR(dz)); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_BSSN_UPW_RHS1, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + CCTK_REAL AL = A[index]; + CCTK_REAL alphaL = alpha[index]; + CCTK_REAL At11L = At11[index]; + CCTK_REAL At12L = At12[index]; + CCTK_REAL At13L = At13[index]; + CCTK_REAL At22L = At22[index]; + CCTK_REAL At23L = At23[index]; + CCTK_REAL At33L = At33[index]; + CCTK_REAL B1L = B1[index]; + CCTK_REAL B2L = B2[index]; + CCTK_REAL B3L = B3[index]; + CCTK_REAL beta1L = beta1[index]; + CCTK_REAL beta2L = beta2[index]; + CCTK_REAL beta3L = beta3[index]; + CCTK_REAL eTttL = (*stress_energy_state) ? eTtt[index] : ToReal(0.0); + CCTK_REAL eTtxL = (*stress_energy_state) ? eTtx[index] : ToReal(0.0); + CCTK_REAL eTtyL = (*stress_energy_state) ? eTty[index] : ToReal(0.0); + CCTK_REAL eTtzL = (*stress_energy_state) ? eTtz[index] : ToReal(0.0); + CCTK_REAL eTxxL = (*stress_energy_state) ? eTxx[index] : ToReal(0.0); + CCTK_REAL eTxyL = (*stress_energy_state) ? eTxy[index] : ToReal(0.0); + CCTK_REAL eTxzL = (*stress_energy_state) ? eTxz[index] : ToReal(0.0); + CCTK_REAL eTyyL = (*stress_energy_state) ? eTyy[index] : ToReal(0.0); + CCTK_REAL eTyzL = (*stress_energy_state) ? eTyz[index] : ToReal(0.0); + CCTK_REAL eTzzL = (*stress_energy_state) ? eTzz[index] : ToReal(0.0); + CCTK_REAL gt11L = gt11[index]; + CCTK_REAL gt12L = gt12[index]; + CCTK_REAL gt13L = gt13[index]; + CCTK_REAL gt22L = gt22[index]; + CCTK_REAL gt23L = gt23[index]; + CCTK_REAL gt33L = gt33[index]; + CCTK_REAL phiL = phi[index]; + CCTK_REAL rL = r[index]; + CCTK_REAL trKL = trK[index]; + CCTK_REAL Xt1L = Xt1[index]; + CCTK_REAL Xt2L = Xt2[index]; + CCTK_REAL Xt3L = Xt3[index]; + + /* Include user supplied include files */ + + /* Precompute derivatives */ + CCTK_REAL const PDdissipationNth1A = PDdissipationNth1(&A[index]); + CCTK_REAL const PDdissipationNth2A = PDdissipationNth2(&A[index]); + CCTK_REAL const PDdissipationNth3A = PDdissipationNth3(&A[index]); + CCTK_REAL const PDstandardNth1alpha = PDstandardNth1(&alpha[index]); + CCTK_REAL const PDstandardNth2alpha = PDstandardNth2(&alpha[index]); + CCTK_REAL const PDstandardNth3alpha = PDstandardNth3(&alpha[index]); + CCTK_REAL const PDstandardNth11alpha = PDstandardNth11(&alpha[index]); + CCTK_REAL const PDstandardNth22alpha = PDstandardNth22(&alpha[index]); + CCTK_REAL const PDstandardNth33alpha = PDstandardNth33(&alpha[index]); + CCTK_REAL const PDstandardNth12alpha = PDstandardNth12(&alpha[index]); + CCTK_REAL const PDstandardNth13alpha = PDstandardNth13(&alpha[index]); + CCTK_REAL const PDstandardNth23alpha = PDstandardNth23(&alpha[index]); + CCTK_REAL const PDdissipationNth1alpha = PDdissipationNth1(&alpha[index]); + CCTK_REAL const PDdissipationNth2alpha = PDdissipationNth2(&alpha[index]); + CCTK_REAL const PDdissipationNth3alpha = PDdissipationNth3(&alpha[index]); + CCTK_REAL const PDdissipationNth1B1 = PDdissipationNth1(&B1[index]); + CCTK_REAL const PDdissipationNth2B1 = PDdissipationNth2(&B1[index]); + CCTK_REAL const PDdissipationNth3B1 = PDdissipationNth3(&B1[index]); + CCTK_REAL const PDdissipationNth1B2 = PDdissipationNth1(&B2[index]); + CCTK_REAL const PDdissipationNth2B2 = PDdissipationNth2(&B2[index]); + CCTK_REAL const PDdissipationNth3B2 = PDdissipationNth3(&B2[index]); + CCTK_REAL const PDdissipationNth1B3 = PDdissipationNth1(&B3[index]); + CCTK_REAL const PDdissipationNth2B3 = PDdissipationNth2(&B3[index]); + CCTK_REAL const PDdissipationNth3B3 = PDdissipationNth3(&B3[index]); + CCTK_REAL const PDstandardNth1beta1 = PDstandardNth1(&beta1[index]); + CCTK_REAL const PDstandardNth2beta1 = PDstandardNth2(&beta1[index]); + CCTK_REAL const PDstandardNth3beta1 = PDstandardNth3(&beta1[index]); + CCTK_REAL const PDstandardNth11beta1 = PDstandardNth11(&beta1[index]); + CCTK_REAL const PDstandardNth22beta1 = PDstandardNth22(&beta1[index]); + CCTK_REAL const PDstandardNth33beta1 = PDstandardNth33(&beta1[index]); + CCTK_REAL const PDstandardNth12beta1 = PDstandardNth12(&beta1[index]); + CCTK_REAL const PDstandardNth13beta1 = PDstandardNth13(&beta1[index]); + CCTK_REAL const PDstandardNth23beta1 = PDstandardNth23(&beta1[index]); + CCTK_REAL const PDdissipationNth1beta1 = PDdissipationNth1(&beta1[index]); + CCTK_REAL const PDdissipationNth2beta1 = PDdissipationNth2(&beta1[index]); + CCTK_REAL const PDdissipationNth3beta1 = PDdissipationNth3(&beta1[index]); + CCTK_REAL const PDstandardNth1beta2 = PDstandardNth1(&beta2[index]); + CCTK_REAL const PDstandardNth2beta2 = PDstandardNth2(&beta2[index]); + CCTK_REAL const PDstandardNth3beta2 = PDstandardNth3(&beta2[index]); + CCTK_REAL const PDstandardNth11beta2 = PDstandardNth11(&beta2[index]); + CCTK_REAL const PDstandardNth22beta2 = PDstandardNth22(&beta2[index]); + CCTK_REAL const PDstandardNth33beta2 = PDstandardNth33(&beta2[index]); + CCTK_REAL const PDstandardNth12beta2 = PDstandardNth12(&beta2[index]); + CCTK_REAL const PDstandardNth13beta2 = PDstandardNth13(&beta2[index]); + CCTK_REAL const PDstandardNth23beta2 = PDstandardNth23(&beta2[index]); + CCTK_REAL const PDdissipationNth1beta2 = PDdissipationNth1(&beta2[index]); + CCTK_REAL const PDdissipationNth2beta2 = PDdissipationNth2(&beta2[index]); + CCTK_REAL const PDdissipationNth3beta2 = PDdissipationNth3(&beta2[index]); + CCTK_REAL const PDstandardNth1beta3 = PDstandardNth1(&beta3[index]); + CCTK_REAL const PDstandardNth2beta3 = PDstandardNth2(&beta3[index]); + CCTK_REAL const PDstandardNth3beta3 = PDstandardNth3(&beta3[index]); + CCTK_REAL const PDstandardNth11beta3 = PDstandardNth11(&beta3[index]); + CCTK_REAL const PDstandardNth22beta3 = PDstandardNth22(&beta3[index]); + CCTK_REAL const PDstandardNth33beta3 = PDstandardNth33(&beta3[index]); + CCTK_REAL const PDstandardNth12beta3 = PDstandardNth12(&beta3[index]); + CCTK_REAL const PDstandardNth13beta3 = PDstandardNth13(&beta3[index]); + CCTK_REAL const PDstandardNth23beta3 = PDstandardNth23(&beta3[index]); + CCTK_REAL const PDdissipationNth1beta3 = PDdissipationNth1(&beta3[index]); + CCTK_REAL const PDdissipationNth2beta3 = PDdissipationNth2(&beta3[index]); + CCTK_REAL const PDdissipationNth3beta3 = PDdissipationNth3(&beta3[index]); + CCTK_REAL const PDstandardNth1gt11 = PDstandardNth1(>11[index]); + CCTK_REAL const PDstandardNth2gt11 = PDstandardNth2(>11[index]); + CCTK_REAL const PDstandardNth3gt11 = PDstandardNth3(>11[index]); + CCTK_REAL const PDdissipationNth1gt11 = PDdissipationNth1(>11[index]); + CCTK_REAL const PDdissipationNth2gt11 = PDdissipationNth2(>11[index]); + CCTK_REAL const PDdissipationNth3gt11 = PDdissipationNth3(>11[index]); + CCTK_REAL const PDstandardNth1gt12 = PDstandardNth1(>12[index]); + CCTK_REAL const PDstandardNth2gt12 = PDstandardNth2(>12[index]); + CCTK_REAL const PDstandardNth3gt12 = PDstandardNth3(>12[index]); + CCTK_REAL const PDdissipationNth1gt12 = PDdissipationNth1(>12[index]); + CCTK_REAL const PDdissipationNth2gt12 = PDdissipationNth2(>12[index]); + CCTK_REAL const PDdissipationNth3gt12 = PDdissipationNth3(>12[index]); + CCTK_REAL const PDstandardNth1gt13 = PDstandardNth1(>13[index]); + CCTK_REAL const PDstandardNth2gt13 = PDstandardNth2(>13[index]); + CCTK_REAL const PDstandardNth3gt13 = PDstandardNth3(>13[index]); + CCTK_REAL const PDdissipationNth1gt13 = PDdissipationNth1(>13[index]); + CCTK_REAL const PDdissipationNth2gt13 = PDdissipationNth2(>13[index]); + CCTK_REAL const PDdissipationNth3gt13 = PDdissipationNth3(>13[index]); + CCTK_REAL const PDstandardNth1gt22 = PDstandardNth1(>22[index]); + CCTK_REAL const PDstandardNth2gt22 = PDstandardNth2(>22[index]); + CCTK_REAL const PDstandardNth3gt22 = PDstandardNth3(>22[index]); + CCTK_REAL const PDdissipationNth1gt22 = PDdissipationNth1(>22[index]); + CCTK_REAL const PDdissipationNth2gt22 = PDdissipationNth2(>22[index]); + CCTK_REAL const PDdissipationNth3gt22 = PDdissipationNth3(>22[index]); + CCTK_REAL const PDstandardNth1gt23 = PDstandardNth1(>23[index]); + CCTK_REAL const PDstandardNth2gt23 = PDstandardNth2(>23[index]); + CCTK_REAL const PDstandardNth3gt23 = PDstandardNth3(>23[index]); + CCTK_REAL const PDdissipationNth1gt23 = PDdissipationNth1(>23[index]); + CCTK_REAL const PDdissipationNth2gt23 = PDdissipationNth2(>23[index]); + CCTK_REAL const PDdissipationNth3gt23 = PDdissipationNth3(>23[index]); + CCTK_REAL const PDstandardNth1gt33 = PDstandardNth1(>33[index]); + CCTK_REAL const PDstandardNth2gt33 = PDstandardNth2(>33[index]); + CCTK_REAL const PDstandardNth3gt33 = PDstandardNth3(>33[index]); + CCTK_REAL const PDdissipationNth1gt33 = PDdissipationNth1(>33[index]); + CCTK_REAL const PDdissipationNth2gt33 = PDdissipationNth2(>33[index]); + CCTK_REAL const PDdissipationNth3gt33 = PDdissipationNth3(>33[index]); + CCTK_REAL const PDstandardNth1phi = PDstandardNth1(&phi[index]); + CCTK_REAL const PDstandardNth2phi = PDstandardNth2(&phi[index]); + CCTK_REAL const PDstandardNth3phi = PDstandardNth3(&phi[index]); + CCTK_REAL const PDdissipationNth1phi = PDdissipationNth1(&phi[index]); + CCTK_REAL const PDdissipationNth2phi = PDdissipationNth2(&phi[index]); + CCTK_REAL const PDdissipationNth3phi = PDdissipationNth3(&phi[index]); + CCTK_REAL const PDstandardNth1trK = PDstandardNth1(&trK[index]); + CCTK_REAL const PDstandardNth2trK = PDstandardNth2(&trK[index]); + CCTK_REAL const PDstandardNth3trK = PDstandardNth3(&trK[index]); + CCTK_REAL const PDdissipationNth1trK = PDdissipationNth1(&trK[index]); + CCTK_REAL const PDdissipationNth2trK = PDdissipationNth2(&trK[index]); + CCTK_REAL const PDdissipationNth3trK = PDdissipationNth3(&trK[index]); + CCTK_REAL const PDdissipationNth1Xt1 = PDdissipationNth1(&Xt1[index]); + CCTK_REAL const PDdissipationNth2Xt1 = PDdissipationNth2(&Xt1[index]); + CCTK_REAL const PDdissipationNth3Xt1 = PDdissipationNth3(&Xt1[index]); + CCTK_REAL const PDdissipationNth1Xt2 = PDdissipationNth1(&Xt2[index]); + CCTK_REAL const PDdissipationNth2Xt2 = PDdissipationNth2(&Xt2[index]); + CCTK_REAL const PDdissipationNth3Xt2 = PDdissipationNth3(&Xt2[index]); + CCTK_REAL const PDdissipationNth1Xt3 = PDdissipationNth1(&Xt3[index]); + CCTK_REAL const PDdissipationNth2Xt3 = PDdissipationNth2(&Xt3[index]); + CCTK_REAL const PDdissipationNth3Xt3 = PDdissipationNth3(&Xt3[index]); + + /* Calculate temporaries and grid functions */ + ptrdiff_t dir1 = Sign(beta1L); + + ptrdiff_t dir2 = Sign(beta2L); + + ptrdiff_t dir3 = Sign(beta3L); + + CCTK_REAL epsdiss1 = ToReal(EpsDiss); + + CCTK_REAL epsdiss2 = ToReal(EpsDiss); + + CCTK_REAL epsdiss3 = ToReal(EpsDiss); + + CCTK_REAL detgt = 1; + + CCTK_REAL gtu11 = INV(detgt)*(gt22L*gt33L - SQR(gt23L)); + + CCTK_REAL gtu12 = (gt13L*gt23L - gt12L*gt33L)*INV(detgt); + + CCTK_REAL gtu13 = (-(gt13L*gt22L) + gt12L*gt23L)*INV(detgt); + + CCTK_REAL gtu22 = INV(detgt)*(gt11L*gt33L - SQR(gt13L)); + + CCTK_REAL gtu23 = (gt12L*gt13L - gt11L*gt23L)*INV(detgt); + + CCTK_REAL gtu33 = INV(detgt)*(gt11L*gt22L - SQR(gt12L)); + + CCTK_REAL Gtl111 = 0.5*PDstandardNth1gt11; + + CCTK_REAL Gtl112 = 0.5*PDstandardNth2gt11; + + CCTK_REAL Gtl113 = 0.5*PDstandardNth3gt11; + + CCTK_REAL Gtl122 = -0.5*PDstandardNth1gt22 + PDstandardNth2gt12; + + CCTK_REAL Gtl123 = 0.5*(-PDstandardNth1gt23 + PDstandardNth2gt13 + + PDstandardNth3gt12); + + CCTK_REAL Gtl133 = -0.5*PDstandardNth1gt33 + PDstandardNth3gt13; + + CCTK_REAL Gtl211 = PDstandardNth1gt12 - 0.5*PDstandardNth2gt11; + + CCTK_REAL Gtl212 = 0.5*PDstandardNth1gt22; + + CCTK_REAL Gtl213 = 0.5*(PDstandardNth1gt23 - PDstandardNth2gt13 + + PDstandardNth3gt12); + + CCTK_REAL Gtl222 = 0.5*PDstandardNth2gt22; + + CCTK_REAL Gtl223 = 0.5*PDstandardNth3gt22; + + CCTK_REAL Gtl233 = -0.5*PDstandardNth2gt33 + PDstandardNth3gt23; + + CCTK_REAL Gtl311 = PDstandardNth1gt13 - 0.5*PDstandardNth3gt11; + + CCTK_REAL Gtl312 = 0.5*(PDstandardNth1gt23 + PDstandardNth2gt13 - + PDstandardNth3gt12); + + CCTK_REAL Gtl313 = 0.5*PDstandardNth1gt33; + + CCTK_REAL Gtl322 = PDstandardNth2gt23 - 0.5*PDstandardNth3gt22; + + CCTK_REAL Gtl323 = 0.5*PDstandardNth2gt33; + + CCTK_REAL Gtl333 = 0.5*PDstandardNth3gt33; + + CCTK_REAL Gt111 = Gtl111*gtu11 + Gtl211*gtu12 + Gtl311*gtu13; + + CCTK_REAL Gt211 = Gtl111*gtu12 + Gtl211*gtu22 + Gtl311*gtu23; + + CCTK_REAL Gt311 = Gtl111*gtu13 + Gtl211*gtu23 + Gtl311*gtu33; + + CCTK_REAL Gt112 = Gtl112*gtu11 + Gtl212*gtu12 + Gtl312*gtu13; + + CCTK_REAL Gt212 = Gtl112*gtu12 + Gtl212*gtu22 + Gtl312*gtu23; + + CCTK_REAL Gt312 = Gtl112*gtu13 + Gtl212*gtu23 + Gtl312*gtu33; + + CCTK_REAL Gt113 = Gtl113*gtu11 + Gtl213*gtu12 + Gtl313*gtu13; + + CCTK_REAL Gt213 = Gtl113*gtu12 + Gtl213*gtu22 + Gtl313*gtu23; + + CCTK_REAL Gt313 = Gtl113*gtu13 + Gtl213*gtu23 + Gtl313*gtu33; + + CCTK_REAL Gt122 = Gtl122*gtu11 + Gtl222*gtu12 + Gtl322*gtu13; + + CCTK_REAL Gt222 = Gtl122*gtu12 + Gtl222*gtu22 + Gtl322*gtu23; + + CCTK_REAL Gt322 = Gtl122*gtu13 + Gtl222*gtu23 + Gtl322*gtu33; + + CCTK_REAL Gt123 = Gtl123*gtu11 + Gtl223*gtu12 + Gtl323*gtu13; + + CCTK_REAL Gt223 = Gtl123*gtu12 + Gtl223*gtu22 + Gtl323*gtu23; + + CCTK_REAL Gt323 = Gtl123*gtu13 + Gtl223*gtu23 + Gtl323*gtu33; + + CCTK_REAL Gt133 = Gtl133*gtu11 + Gtl233*gtu12 + Gtl333*gtu13; + + CCTK_REAL Gt233 = Gtl133*gtu12 + Gtl233*gtu22 + Gtl333*gtu23; + + CCTK_REAL Gt333 = Gtl133*gtu13 + Gtl233*gtu23 + Gtl333*gtu33; + + CCTK_REAL Xtn1 = Gt111*gtu11 + Gt122*gtu22 + 2*(Gt112*gtu12 + + Gt113*gtu13 + Gt123*gtu23) + Gt133*gtu33; + + CCTK_REAL Xtn2 = Gt211*gtu11 + Gt222*gtu22 + 2*(Gt212*gtu12 + + Gt213*gtu13 + Gt223*gtu23) + Gt233*gtu33; + + CCTK_REAL Xtn3 = Gt311*gtu11 + Gt322*gtu22 + 2*(Gt312*gtu12 + + Gt313*gtu13 + Gt323*gtu23) + Gt333*gtu33; + + CCTK_REAL fac1 = IfThen(ToReal(conformalMethod),-0.5*INV(phiL),1); + + CCTK_REAL cdphi1 = fac1*PDstandardNth1phi; + + CCTK_REAL cdphi2 = fac1*PDstandardNth2phi; + + CCTK_REAL cdphi3 = fac1*PDstandardNth3phi; + + CCTK_REAL Atm11 = At11L*gtu11 + At12L*gtu12 + At13L*gtu13; + + CCTK_REAL Atm21 = At11L*gtu12 + At12L*gtu22 + At13L*gtu23; + + CCTK_REAL Atm31 = At11L*gtu13 + At12L*gtu23 + At13L*gtu33; + + CCTK_REAL Atm12 = At12L*gtu11 + At22L*gtu12 + At23L*gtu13; + + CCTK_REAL Atm22 = At12L*gtu12 + At22L*gtu22 + At23L*gtu23; + + CCTK_REAL Atm32 = At12L*gtu13 + At22L*gtu23 + At23L*gtu33; + + CCTK_REAL Atm13 = At13L*gtu11 + At23L*gtu12 + At33L*gtu13; + + CCTK_REAL Atm23 = At13L*gtu12 + At23L*gtu22 + At33L*gtu23; + + CCTK_REAL Atm33 = At13L*gtu13 + At23L*gtu23 + At33L*gtu33; + + CCTK_REAL Atu11 = Atm11*gtu11 + Atm12*gtu12 + Atm13*gtu13; + + CCTK_REAL Atu12 = Atm11*gtu12 + Atm12*gtu22 + Atm13*gtu23; + + CCTK_REAL Atu13 = Atm11*gtu13 + Atm12*gtu23 + Atm13*gtu33; + + CCTK_REAL Atu22 = Atm21*gtu12 + Atm22*gtu22 + Atm23*gtu23; + + CCTK_REAL Atu23 = Atm21*gtu13 + Atm22*gtu23 + Atm23*gtu33; + + CCTK_REAL Atu33 = Atm31*gtu13 + Atm32*gtu23 + Atm33*gtu33; + + CCTK_REAL e4phi = + IfThen(ToReal(conformalMethod),INV(SQR(phiL)),exp(4*phiL)); + + CCTK_REAL em4phi = INV(e4phi); + + CCTK_REAL rho = INV(SQR(alphaL))*(eTttL - 2*(beta2L*eTtyL + + beta3L*eTtzL) + 2*(beta1L*(-eTtxL + beta2L*eTxyL + beta3L*eTxzL) + + beta2L*beta3L*eTyzL) + eTxxL*SQR(beta1L) + eTyyL*SQR(beta2L) + + eTzzL*SQR(beta3L)); + + CCTK_REAL S1 = (-eTtxL + beta1L*eTxxL + beta2L*eTxyL + + beta3L*eTxzL)*INV(alphaL); + + CCTK_REAL S2 = (-eTtyL + beta1L*eTxyL + beta2L*eTyyL + + beta3L*eTyzL)*INV(alphaL); + + CCTK_REAL S3 = (-eTtzL + beta1L*eTxzL + beta2L*eTyzL + + beta3L*eTzzL)*INV(alphaL); + + CCTK_REAL trS = em4phi*(eTxxL*gtu11 + eTyyL*gtu22 + 2*(eTxyL*gtu12 + + eTxzL*gtu13 + eTyzL*gtu23) + eTzzL*gtu33); + + CCTK_REAL phirhsL = PDupwindNth1(&phi[index])*beta1L + + PDupwindNth2(&phi[index])*beta2L + PDupwindNth3(&phi[index])*beta3L + + epsdiss1*PDdissipationNth1phi + epsdiss2*PDdissipationNth2phi + + epsdiss3*PDdissipationNth3phi + + IfThen(ToReal(conformalMethod),phiL*(-0.333333333333333333333333333333*(PDstandardNth1beta1 + + PDstandardNth2beta2 + PDstandardNth3beta3) + + 0.333333333333333333333333333333*alphaL*trKL),0.166666666666666666666666666667*(PDstandardNth1beta1 + + PDstandardNth2beta2 + PDstandardNth3beta3) - + 0.166666666666666666666666666667*alphaL*trKL); + + CCTK_REAL gt11rhsL = -2*alphaL*At11L + + PDupwindNth1(>11[index])*beta1L + + PDupwindNth2(>11[index])*beta2L + + PDupwindNth3(>11[index])*beta3L + epsdiss1*PDdissipationNth1gt11 + + epsdiss2*PDdissipationNth2gt11 + epsdiss3*PDdissipationNth3gt11 + + 2*(gt12L*PDstandardNth1beta2 + gt13L*PDstandardNth1beta3) + + gt11L*(1.33333333333333333333333333333*PDstandardNth1beta1 - + 0.666666666666666666666666666667*(PDstandardNth2beta2 + + PDstandardNth3beta3)); + + CCTK_REAL gt12rhsL = -2*alphaL*At12L + + PDupwindNth1(>12[index])*beta1L + + PDupwindNth2(>12[index])*beta2L + + PDupwindNth3(>12[index])*beta3L + epsdiss1*PDdissipationNth1gt12 + + epsdiss2*PDdissipationNth2gt12 + epsdiss3*PDdissipationNth3gt12 + + gt22L*PDstandardNth1beta2 + gt23L*PDstandardNth1beta3 + + gt11L*PDstandardNth2beta1 + gt13L*PDstandardNth2beta3 + + gt12L*(0.333333333333333333333333333333*(PDstandardNth1beta1 + + PDstandardNth2beta2) - + 0.666666666666666666666666666667*PDstandardNth3beta3); + + CCTK_REAL gt13rhsL = -2*alphaL*At13L + + PDupwindNth1(>13[index])*beta1L + + PDupwindNth2(>13[index])*beta2L + + PDupwindNth3(>13[index])*beta3L + epsdiss1*PDdissipationNth1gt13 + + epsdiss2*PDdissipationNth2gt13 + epsdiss3*PDdissipationNth3gt13 + + gt23L*PDstandardNth1beta2 + gt33L*PDstandardNth1beta3 + + gt11L*PDstandardNth3beta1 + gt12L*PDstandardNth3beta2 + + gt13L*(-0.666666666666666666666666666667*PDstandardNth2beta2 + + 0.333333333333333333333333333333*(PDstandardNth1beta1 + + PDstandardNth3beta3)); + + CCTK_REAL gt22rhsL = -2*alphaL*At22L + + PDupwindNth1(>22[index])*beta1L + + PDupwindNth2(>22[index])*beta2L + + PDupwindNth3(>22[index])*beta3L + epsdiss1*PDdissipationNth1gt22 + + epsdiss2*PDdissipationNth2gt22 + epsdiss3*PDdissipationNth3gt22 + + 2*(gt12L*PDstandardNth2beta1 + gt23L*PDstandardNth2beta3) + + gt22L*(1.33333333333333333333333333333*PDstandardNth2beta2 - + 0.666666666666666666666666666667*(PDstandardNth1beta1 + + PDstandardNth3beta3)); + + CCTK_REAL gt23rhsL = -2*alphaL*At23L + + PDupwindNth1(>23[index])*beta1L + + PDupwindNth2(>23[index])*beta2L + + PDupwindNth3(>23[index])*beta3L + epsdiss1*PDdissipationNth1gt23 + + epsdiss2*PDdissipationNth2gt23 + epsdiss3*PDdissipationNth3gt23 + + gt13L*PDstandardNth2beta1 + gt33L*PDstandardNth2beta3 + + gt12L*PDstandardNth3beta1 + gt22L*PDstandardNth3beta2 + + gt23L*(-0.666666666666666666666666666667*PDstandardNth1beta1 + + 0.333333333333333333333333333333*(PDstandardNth2beta2 + + PDstandardNth3beta3)); + + CCTK_REAL gt33rhsL = -2*alphaL*At33L + + PDupwindNth1(>33[index])*beta1L + + PDupwindNth2(>33[index])*beta2L + + PDupwindNth3(>33[index])*beta3L + epsdiss1*PDdissipationNth1gt33 + + epsdiss2*PDdissipationNth2gt33 + epsdiss3*PDdissipationNth3gt33 + + 2*(gt13L*PDstandardNth3beta1 + gt23L*PDstandardNth3beta2) + + gt33L*(-0.666666666666666666666666666667*(PDstandardNth1beta1 + + PDstandardNth2beta2) + + 1.33333333333333333333333333333*PDstandardNth3beta3); + + CCTK_REAL dotXt1 = + 0.333333333333333333333333333333*(7*(gtu12*PDstandardNth12beta1 + + gtu13*PDstandardNth13beta1) + gtu11*(4*PDstandardNth11beta1 + + PDstandardNth12beta2 + PDstandardNth13beta3) + + gtu12*(PDstandardNth22beta2 + PDstandardNth23beta3) + + 3*(PDupwindNth1(&Xt1[index])*beta1L + + PDupwindNth2(&Xt1[index])*beta2L + PDupwindNth3(&Xt1[index])*beta3L + + epsdiss1*PDdissipationNth1Xt1 + epsdiss2*PDdissipationNth2Xt1 + + epsdiss3*PDdissipationNth3Xt1 + gtu22*PDstandardNth22beta1 + + gtu33*PDstandardNth33beta1) + gtu13*(PDstandardNth23beta2 + + PDstandardNth33beta3) - 6*(Atu11*PDstandardNth1alpha + + Atu12*PDstandardNth2alpha + Atu13*PDstandardNth3alpha) + + 6*(gtu23*PDstandardNth23beta1 + alphaL*(6*(Atu11*cdphi1 + Atu12*cdphi2 + + Atu13*cdphi3) + Atu11*Gt111 + Atu22*Gt122 + 2*(Atu12*Gt112 + + Atu13*Gt113 + Atu23*Gt123) + Atu33*Gt133 - + 0.666666666666666666666666666667*(gtu11*PDstandardNth1trK + + gtu12*PDstandardNth2trK + gtu13*PDstandardNth3trK))) - + 150.7964473723100754462068823974161384415*alphaL*(gtu11*S1 + gtu12*S2 + + gtu13*S3) + (-3*PDstandardNth1beta1 + 2*(PDstandardNth1beta1 + + PDstandardNth2beta2 + PDstandardNth3beta3))*Xtn1 - + 3*(PDstandardNth2beta1*Xtn2 + PDstandardNth3beta1*Xtn3)); + + CCTK_REAL dotXt2 = + 0.333333333333333333333333333333*(gtu12*(PDstandardNth11beta1 + + 7*PDstandardNth12beta2 + PDstandardNth13beta3) + + gtu22*(PDstandardNth12beta1 + 4*PDstandardNth22beta2 + + PDstandardNth23beta3) + 3*(PDupwindNth1(&Xt2[index])*beta1L + + PDupwindNth2(&Xt2[index])*beta2L + PDupwindNth3(&Xt2[index])*beta3L + + epsdiss1*PDdissipationNth1Xt2 + epsdiss2*PDdissipationNth2Xt2 + + epsdiss3*PDdissipationNth3Xt2 + gtu11*PDstandardNth11beta2 + + gtu33*PDstandardNth33beta2) + gtu23*(PDstandardNth13beta1 + + 7*PDstandardNth23beta2 + PDstandardNth33beta3) - + 6*(Atu12*PDstandardNth1alpha + Atu22*PDstandardNth2alpha + + Atu23*PDstandardNth3alpha) + 6*(gtu13*PDstandardNth13beta2 + + alphaL*(6*(Atu12*cdphi1 + Atu22*cdphi2 + Atu23*cdphi3) + Atu11*Gt211 + + Atu22*Gt222 + 2*(Atu12*Gt212 + Atu13*Gt213 + Atu23*Gt223) + Atu33*Gt233 + - 0.666666666666666666666666666667*(gtu12*PDstandardNth1trK + + gtu22*PDstandardNth2trK + gtu23*PDstandardNth3trK))) - + 150.7964473723100754462068823974161384415*alphaL*(gtu12*S1 + gtu22*S2 + + gtu23*S3) + 2*(PDstandardNth1beta1 + PDstandardNth2beta2 + + PDstandardNth3beta3)*Xtn2 - 3*(PDstandardNth1beta2*Xtn1 + + PDstandardNth2beta2*Xtn2 + PDstandardNth3beta2*Xtn3)); + + CCTK_REAL dotXt3 = + 0.333333333333333333333333333333*(gtu13*(PDstandardNth11beta1 + + PDstandardNth12beta2 + 7*PDstandardNth13beta3) + + 3*(PDupwindNth1(&Xt3[index])*beta1L + + PDupwindNth2(&Xt3[index])*beta2L + PDupwindNth3(&Xt3[index])*beta3L + + epsdiss1*PDdissipationNth1Xt3 + epsdiss2*PDdissipationNth2Xt3 + + epsdiss3*PDdissipationNth3Xt3 + gtu11*PDstandardNth11beta3 + + gtu22*PDstandardNth22beta3) + gtu23*(PDstandardNth12beta1 + + PDstandardNth22beta2 + 7*PDstandardNth23beta3) + + gtu33*(PDstandardNth13beta1 + PDstandardNth23beta2 + + 4*PDstandardNth33beta3) - 6*(Atu13*PDstandardNth1alpha + + Atu23*PDstandardNth2alpha + Atu33*PDstandardNth3alpha) + + 6*(gtu12*PDstandardNth12beta3 + alphaL*(6*(Atu13*cdphi1 + Atu23*cdphi2 + + Atu33*cdphi3) + Atu11*Gt311 + Atu22*Gt322 + 2*(Atu12*Gt312 + + Atu13*Gt313 + Atu23*Gt323) + Atu33*Gt333 - + 0.666666666666666666666666666667*(gtu13*PDstandardNth1trK + + gtu23*PDstandardNth2trK + gtu33*PDstandardNth3trK))) - + 150.7964473723100754462068823974161384415*alphaL*(gtu13*S1 + gtu23*S2 + + gtu33*S3) + 2*(PDstandardNth1beta1 + PDstandardNth2beta2 + + PDstandardNth3beta3)*Xtn3 - 3*(PDstandardNth1beta3*Xtn1 + + PDstandardNth2beta3*Xtn2 + PDstandardNth3beta3*Xtn3)); + + CCTK_REAL Xt1rhsL = dotXt1; + + CCTK_REAL Xt2rhsL = dotXt2; + + CCTK_REAL Xt3rhsL = dotXt3; + + CCTK_REAL dottrK = PDupwindNth1(&trK[index])*beta1L + + PDupwindNth2(&trK[index])*beta2L + PDupwindNth3(&trK[index])*beta3L + + epsdiss1*PDdissipationNth1trK + epsdiss2*PDdissipationNth2trK + + epsdiss3*PDdissipationNth3trK - em4phi*(gtu11*PDstandardNth11alpha + + gtu22*PDstandardNth22alpha + gtu33*(PDstandardNth33alpha + + 2*cdphi3*PDstandardNth3alpha) + 2*(gtu12*PDstandardNth12alpha + + gtu13*(PDstandardNth13alpha + cdphi1*PDstandardNth3alpha) + + gtu23*(PDstandardNth23alpha + cdphi2*PDstandardNth3alpha)) + + PDstandardNth1alpha*(2*(cdphi1*gtu11 + cdphi2*gtu12 + cdphi3*gtu13) - + Xtn1) + PDstandardNth2alpha*(2*(cdphi1*gtu12 + cdphi2*gtu22 + + cdphi3*gtu23) - Xtn2) - PDstandardNth3alpha*Xtn3) + + alphaL*(2*(Atm12*Atm21 + Atm13*Atm31 + Atm23*Atm32) + + 12.56637061435917295385057353311801153679*(rho + trS) + SQR(Atm11) + + SQR(Atm22) + SQR(Atm33) + 0.333333333333333333333333333333*SQR(trKL)); + + CCTK_REAL trKrhsL = dottrK; + + CCTK_REAL alpharhsL = epsdiss1*PDdissipationNth1alpha + + epsdiss2*PDdissipationNth2alpha + epsdiss3*PDdissipationNth3alpha - + pow(alphaL,ToReal(harmonicN))*ToReal(harmonicF)*(trKL + (AL - + trKL)*ToReal(LapseACoeff)) + (PDupwindNth1(&alpha[index])*beta1L + + PDupwindNth2(&alpha[index])*beta2L + + PDupwindNth3(&alpha[index])*beta3L)*ToReal(LapseAdvectionCoeff); + + CCTK_REAL ArhsL = epsdiss1*PDdissipationNth1A + + epsdiss2*PDdissipationNth2A + epsdiss3*PDdissipationNth3A + (dottrK - + AL*ToReal(AlphaDriver))*ToReal(LapseACoeff) + + (PDupwindNth1(&A[index])*beta1L + PDupwindNth2(&A[index])*beta2L + + PDupwindNth3(&A[index])*beta3L)*ToReal(LapseAdvectionCoeff); + + CCTK_REAL eta = fmin(1,INV(rL)*ToReal(SpatialBetaDriverRadius)); + + CCTK_REAL theta = fmin(1,exp(1 - + rL*INV(ToReal(SpatialShiftGammaCoeffRadius)))); + + CCTK_REAL beta1rhsL = epsdiss1*PDdissipationNth1beta1 + + epsdiss2*PDdissipationNth2beta1 + epsdiss3*PDdissipationNth3beta1 + + (PDupwindNth1(&beta1[index])*beta1L + + PDupwindNth2(&beta1[index])*beta2L + + PDupwindNth3(&beta1[index])*beta3L)*ToReal(ShiftAdvectionCoeff) + + theta*(Xt1L + beta1L*eta*ToReal(BetaDriver)*(-1 + ToReal(ShiftBCoeff)) + + (B1L - Xt1L)*ToReal(ShiftBCoeff))*ToReal(ShiftGammaCoeff); + + CCTK_REAL beta2rhsL = epsdiss1*PDdissipationNth1beta2 + + epsdiss2*PDdissipationNth2beta2 + epsdiss3*PDdissipationNth3beta2 + + (PDupwindNth1(&beta2[index])*beta1L + + PDupwindNth2(&beta2[index])*beta2L + + PDupwindNth3(&beta2[index])*beta3L)*ToReal(ShiftAdvectionCoeff) + + theta*(Xt2L + beta2L*eta*ToReal(BetaDriver)*(-1 + ToReal(ShiftBCoeff)) + + (B2L - Xt2L)*ToReal(ShiftBCoeff))*ToReal(ShiftGammaCoeff); + + CCTK_REAL beta3rhsL = epsdiss1*PDdissipationNth1beta3 + + epsdiss2*PDdissipationNth2beta3 + epsdiss3*PDdissipationNth3beta3 + + (PDupwindNth1(&beta3[index])*beta1L + + PDupwindNth2(&beta3[index])*beta2L + + PDupwindNth3(&beta3[index])*beta3L)*ToReal(ShiftAdvectionCoeff) + + theta*(Xt3L + beta3L*eta*ToReal(BetaDriver)*(-1 + ToReal(ShiftBCoeff)) + + (B3L - Xt3L)*ToReal(ShiftBCoeff))*ToReal(ShiftGammaCoeff); + + CCTK_REAL B1rhsL = epsdiss1*PDdissipationNth1B1 + + epsdiss2*PDdissipationNth2B1 + epsdiss3*PDdissipationNth3B1 + + ((PDupwindNth1(&B1[index]) - PDupwindNth1(&Xt1[index]))*beta1L + + (PDupwindNth2(&B1[index]) - PDupwindNth2(&Xt1[index]))*beta2L + + (PDupwindNth3(&B1[index]) - + PDupwindNth3(&Xt1[index]))*beta3L)*ToReal(ShiftAdvectionCoeff) + + (dotXt1 - B1L*eta*ToReal(BetaDriver))*ToReal(ShiftBCoeff); + + CCTK_REAL B2rhsL = epsdiss1*PDdissipationNth1B2 + + epsdiss2*PDdissipationNth2B2 + epsdiss3*PDdissipationNth3B2 + + ((PDupwindNth1(&B2[index]) - PDupwindNth1(&Xt2[index]))*beta1L + + (PDupwindNth2(&B2[index]) - PDupwindNth2(&Xt2[index]))*beta2L + + (PDupwindNth3(&B2[index]) - + PDupwindNth3(&Xt2[index]))*beta3L)*ToReal(ShiftAdvectionCoeff) + + (dotXt2 - B2L*eta*ToReal(BetaDriver))*ToReal(ShiftBCoeff); + + CCTK_REAL B3rhsL = epsdiss1*PDdissipationNth1B3 + + epsdiss2*PDdissipationNth2B3 + epsdiss3*PDdissipationNth3B3 + + ((PDupwindNth1(&B3[index]) - PDupwindNth1(&Xt3[index]))*beta1L + + (PDupwindNth2(&B3[index]) - PDupwindNth2(&Xt3[index]))*beta2L + + (PDupwindNth3(&B3[index]) - + PDupwindNth3(&Xt3[index]))*beta3L)*ToReal(ShiftAdvectionCoeff) + + (dotXt3 - B3L*eta*ToReal(BetaDriver))*ToReal(ShiftBCoeff); + + + /* Copy local copies back to grid functions */ + alpharhs[index] = alpharhsL; + Arhs[index] = ArhsL; + B1rhs[index] = B1rhsL; + B2rhs[index] = B2rhsL; + B3rhs[index] = B3rhsL; + beta1rhs[index] = beta1rhsL; + beta2rhs[index] = beta2rhsL; + beta3rhs[index] = beta3rhsL; + gt11rhs[index] = gt11rhsL; + gt12rhs[index] = gt12rhsL; + gt13rhs[index] = gt13rhsL; + gt22rhs[index] = gt22rhsL; + gt23rhs[index] = gt23rhsL; + gt33rhs[index] = gt33rhsL; + phirhs[index] = phirhsL; + trKrhs[index] = trKrhsL; + Xt1rhs[index] = Xt1rhsL; + Xt2rhs[index] = Xt2rhsL; + Xt3rhs[index] = Xt3rhsL; + } + LC_ENDLOOP3 (ML_BSSN_UPW_RHS1); +} + +extern "C" void ML_BSSN_UPW_RHS1(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverInterior(cctkGH, &ML_BSSN_UPW_RHS1_Body); +} diff --git a/ML_BSSN_UPW/src/ML_BSSN_UPW_RHS2.cc b/ML_BSSN_UPW/src/ML_BSSN_UPW_RHS2.cc new file mode 100644 index 0000000..2aa052b --- /dev/null +++ b/ML_BSSN_UPW/src/ML_BSSN_UPW_RHS2.cc @@ -0,0 +1,746 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +extern "C" void ML_BSSN_UPW_RHS2_SelectBCs(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT ierr = 0; + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_UPW::ML_curvrhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_UPW::ML_curvrhs."); + return; +} + +static void ML_BSSN_UPW_RHS2_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_BSSN_UPW_RHS2_Body"); + } + + if (cctk_iteration % ML_BSSN_UPW_RHS2_calc_every != ML_BSSN_UPW_RHS2_calc_offset) + { + return; + } + + const char *groups[] = {"ML_BSSN_UPW::ML_curv","ML_BSSN_UPW::ML_curvrhs","ML_BSSN_UPW::ML_Gamma","ML_BSSN_UPW::ML_lapse","ML_BSSN_UPW::ML_log_confac","ML_BSSN_UPW::ML_metric","ML_BSSN_UPW::ML_shift","ML_BSSN_UPW::ML_trace_curv"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_BSSN_UPW_RHS2", 8, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o12dx = 0.0833333333333333333333333333333*INV(dx); + CCTK_REAL const p1o12dy = 0.0833333333333333333333333333333*INV(dy); + CCTK_REAL const p1o12dz = 0.0833333333333333333333333333333*INV(dz); + CCTK_REAL const p1o144dxdy = 0.00694444444444444444444444444444*INV(dx)*INV(dy); + CCTK_REAL const p1o144dxdz = 0.00694444444444444444444444444444*INV(dx)*INV(dz); + CCTK_REAL const p1o144dydz = 0.00694444444444444444444444444444*INV(dy)*INV(dz); + CCTK_REAL const p1o24dx = 0.0416666666666666666666666666667*INV(dx); + CCTK_REAL const p1o24dy = 0.0416666666666666666666666666667*INV(dy); + CCTK_REAL const p1o24dz = 0.0416666666666666666666666666667*INV(dz); + CCTK_REAL const p1o64dx = 0.015625*INV(dx); + CCTK_REAL const p1o64dy = 0.015625*INV(dy); + CCTK_REAL const p1o64dz = 0.015625*INV(dz); + CCTK_REAL const p1odx = INV(dx); + CCTK_REAL const p1ody = INV(dy); + CCTK_REAL const p1odz = INV(dz); + CCTK_REAL const pm1o12dx2 = -0.0833333333333333333333333333333*INV(SQR(dx)); + CCTK_REAL const pm1o12dy2 = -0.0833333333333333333333333333333*INV(SQR(dy)); + CCTK_REAL const pm1o12dz2 = -0.0833333333333333333333333333333*INV(SQR(dz)); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_BSSN_UPW_RHS2, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + CCTK_REAL alphaL = alpha[index]; + CCTK_REAL At11L = At11[index]; + CCTK_REAL At12L = At12[index]; + CCTK_REAL At13L = At13[index]; + CCTK_REAL At22L = At22[index]; + CCTK_REAL At23L = At23[index]; + CCTK_REAL At33L = At33[index]; + CCTK_REAL beta1L = beta1[index]; + CCTK_REAL beta2L = beta2[index]; + CCTK_REAL beta3L = beta3[index]; + CCTK_REAL eTxxL = (*stress_energy_state) ? eTxx[index] : ToReal(0.0); + CCTK_REAL eTxyL = (*stress_energy_state) ? eTxy[index] : ToReal(0.0); + CCTK_REAL eTxzL = (*stress_energy_state) ? eTxz[index] : ToReal(0.0); + CCTK_REAL eTyyL = (*stress_energy_state) ? eTyy[index] : ToReal(0.0); + CCTK_REAL eTyzL = (*stress_energy_state) ? eTyz[index] : ToReal(0.0); + CCTK_REAL eTzzL = (*stress_energy_state) ? eTzz[index] : ToReal(0.0); + CCTK_REAL gt11L = gt11[index]; + CCTK_REAL gt12L = gt12[index]; + CCTK_REAL gt13L = gt13[index]; + CCTK_REAL gt22L = gt22[index]; + CCTK_REAL gt23L = gt23[index]; + CCTK_REAL gt33L = gt33[index]; + CCTK_REAL phiL = phi[index]; + CCTK_REAL trKL = trK[index]; + CCTK_REAL Xt1L = Xt1[index]; + CCTK_REAL Xt2L = Xt2[index]; + CCTK_REAL Xt3L = Xt3[index]; + + /* Include user supplied include files */ + + /* Precompute derivatives */ + CCTK_REAL const PDstandardNth1alpha = PDstandardNth1(&alpha[index]); + CCTK_REAL const PDstandardNth2alpha = PDstandardNth2(&alpha[index]); + CCTK_REAL const PDstandardNth3alpha = PDstandardNth3(&alpha[index]); + CCTK_REAL const PDstandardNth11alpha = PDstandardNth11(&alpha[index]); + CCTK_REAL const PDstandardNth22alpha = PDstandardNth22(&alpha[index]); + CCTK_REAL const PDstandardNth33alpha = PDstandardNth33(&alpha[index]); + CCTK_REAL const PDstandardNth12alpha = PDstandardNth12(&alpha[index]); + CCTK_REAL const PDstandardNth13alpha = PDstandardNth13(&alpha[index]); + CCTK_REAL const PDstandardNth23alpha = PDstandardNth23(&alpha[index]); + CCTK_REAL const PDdissipationNth1At11 = PDdissipationNth1(&At11[index]); + CCTK_REAL const PDdissipationNth2At11 = PDdissipationNth2(&At11[index]); + CCTK_REAL const PDdissipationNth3At11 = PDdissipationNth3(&At11[index]); + CCTK_REAL const PDdissipationNth1At12 = PDdissipationNth1(&At12[index]); + CCTK_REAL const PDdissipationNth2At12 = PDdissipationNth2(&At12[index]); + CCTK_REAL const PDdissipationNth3At12 = PDdissipationNth3(&At12[index]); + CCTK_REAL const PDdissipationNth1At13 = PDdissipationNth1(&At13[index]); + CCTK_REAL const PDdissipationNth2At13 = PDdissipationNth2(&At13[index]); + CCTK_REAL const PDdissipationNth3At13 = PDdissipationNth3(&At13[index]); + CCTK_REAL const PDdissipationNth1At22 = PDdissipationNth1(&At22[index]); + CCTK_REAL const PDdissipationNth2At22 = PDdissipationNth2(&At22[index]); + CCTK_REAL const PDdissipationNth3At22 = PDdissipationNth3(&At22[index]); + CCTK_REAL const PDdissipationNth1At23 = PDdissipationNth1(&At23[index]); + CCTK_REAL const PDdissipationNth2At23 = PDdissipationNth2(&At23[index]); + CCTK_REAL const PDdissipationNth3At23 = PDdissipationNth3(&At23[index]); + CCTK_REAL const PDdissipationNth1At33 = PDdissipationNth1(&At33[index]); + CCTK_REAL const PDdissipationNth2At33 = PDdissipationNth2(&At33[index]); + CCTK_REAL const PDdissipationNth3At33 = PDdissipationNth3(&At33[index]); + CCTK_REAL const PDstandardNth1beta1 = PDstandardNth1(&beta1[index]); + CCTK_REAL const PDstandardNth2beta1 = PDstandardNth2(&beta1[index]); + CCTK_REAL const PDstandardNth3beta1 = PDstandardNth3(&beta1[index]); + CCTK_REAL const PDstandardNth1beta2 = PDstandardNth1(&beta2[index]); + CCTK_REAL const PDstandardNth2beta2 = PDstandardNth2(&beta2[index]); + CCTK_REAL const PDstandardNth3beta2 = PDstandardNth3(&beta2[index]); + CCTK_REAL const PDstandardNth1beta3 = PDstandardNth1(&beta3[index]); + CCTK_REAL const PDstandardNth2beta3 = PDstandardNth2(&beta3[index]); + CCTK_REAL const PDstandardNth3beta3 = PDstandardNth3(&beta3[index]); + CCTK_REAL const PDstandardNth1gt11 = PDstandardNth1(>11[index]); + CCTK_REAL const PDstandardNth2gt11 = PDstandardNth2(>11[index]); + CCTK_REAL const PDstandardNth3gt11 = PDstandardNth3(>11[index]); + CCTK_REAL const PDstandardNth11gt11 = PDstandardNth11(>11[index]); + CCTK_REAL const PDstandardNth22gt11 = PDstandardNth22(>11[index]); + CCTK_REAL const PDstandardNth33gt11 = PDstandardNth33(>11[index]); + CCTK_REAL const PDstandardNth12gt11 = PDstandardNth12(>11[index]); + CCTK_REAL const PDstandardNth13gt11 = PDstandardNth13(>11[index]); + CCTK_REAL const PDstandardNth23gt11 = PDstandardNth23(>11[index]); + CCTK_REAL const PDstandardNth1gt12 = PDstandardNth1(>12[index]); + CCTK_REAL const PDstandardNth2gt12 = PDstandardNth2(>12[index]); + CCTK_REAL const PDstandardNth3gt12 = PDstandardNth3(>12[index]); + CCTK_REAL const PDstandardNth11gt12 = PDstandardNth11(>12[index]); + CCTK_REAL const PDstandardNth22gt12 = PDstandardNth22(>12[index]); + CCTK_REAL const PDstandardNth33gt12 = PDstandardNth33(>12[index]); + CCTK_REAL const PDstandardNth12gt12 = PDstandardNth12(>12[index]); + CCTK_REAL const PDstandardNth13gt12 = PDstandardNth13(>12[index]); + CCTK_REAL const PDstandardNth23gt12 = PDstandardNth23(>12[index]); + CCTK_REAL const PDstandardNth1gt13 = PDstandardNth1(>13[index]); + CCTK_REAL const PDstandardNth2gt13 = PDstandardNth2(>13[index]); + CCTK_REAL const PDstandardNth3gt13 = PDstandardNth3(>13[index]); + CCTK_REAL const PDstandardNth11gt13 = PDstandardNth11(>13[index]); + CCTK_REAL const PDstandardNth22gt13 = PDstandardNth22(>13[index]); + CCTK_REAL const PDstandardNth33gt13 = PDstandardNth33(>13[index]); + CCTK_REAL const PDstandardNth12gt13 = PDstandardNth12(>13[index]); + CCTK_REAL const PDstandardNth13gt13 = PDstandardNth13(>13[index]); + CCTK_REAL const PDstandardNth23gt13 = PDstandardNth23(>13[index]); + CCTK_REAL const PDstandardNth1gt22 = PDstandardNth1(>22[index]); + CCTK_REAL const PDstandardNth2gt22 = PDstandardNth2(>22[index]); + CCTK_REAL const PDstandardNth3gt22 = PDstandardNth3(>22[index]); + CCTK_REAL const PDstandardNth11gt22 = PDstandardNth11(>22[index]); + CCTK_REAL const PDstandardNth22gt22 = PDstandardNth22(>22[index]); + CCTK_REAL const PDstandardNth33gt22 = PDstandardNth33(>22[index]); + CCTK_REAL const PDstandardNth12gt22 = PDstandardNth12(>22[index]); + CCTK_REAL const PDstandardNth13gt22 = PDstandardNth13(>22[index]); + CCTK_REAL const PDstandardNth23gt22 = PDstandardNth23(>22[index]); + CCTK_REAL const PDstandardNth1gt23 = PDstandardNth1(>23[index]); + CCTK_REAL const PDstandardNth2gt23 = PDstandardNth2(>23[index]); + CCTK_REAL const PDstandardNth3gt23 = PDstandardNth3(>23[index]); + CCTK_REAL const PDstandardNth11gt23 = PDstandardNth11(>23[index]); + CCTK_REAL const PDstandardNth22gt23 = PDstandardNth22(>23[index]); + CCTK_REAL const PDstandardNth33gt23 = PDstandardNth33(>23[index]); + CCTK_REAL const PDstandardNth12gt23 = PDstandardNth12(>23[index]); + CCTK_REAL const PDstandardNth13gt23 = PDstandardNth13(>23[index]); + CCTK_REAL const PDstandardNth23gt23 = PDstandardNth23(>23[index]); + CCTK_REAL const PDstandardNth1gt33 = PDstandardNth1(>33[index]); + CCTK_REAL const PDstandardNth2gt33 = PDstandardNth2(>33[index]); + CCTK_REAL const PDstandardNth3gt33 = PDstandardNth3(>33[index]); + CCTK_REAL const PDstandardNth11gt33 = PDstandardNth11(>33[index]); + CCTK_REAL const PDstandardNth22gt33 = PDstandardNth22(>33[index]); + CCTK_REAL const PDstandardNth33gt33 = PDstandardNth33(>33[index]); + CCTK_REAL const PDstandardNth12gt33 = PDstandardNth12(>33[index]); + CCTK_REAL const PDstandardNth13gt33 = PDstandardNth13(>33[index]); + CCTK_REAL const PDstandardNth23gt33 = PDstandardNth23(>33[index]); + CCTK_REAL const PDstandardNth1phi = PDstandardNth1(&phi[index]); + CCTK_REAL const PDstandardNth2phi = PDstandardNth2(&phi[index]); + CCTK_REAL const PDstandardNth3phi = PDstandardNth3(&phi[index]); + CCTK_REAL const PDstandardNth11phi = PDstandardNth11(&phi[index]); + CCTK_REAL const PDstandardNth22phi = PDstandardNth22(&phi[index]); + CCTK_REAL const PDstandardNth33phi = PDstandardNth33(&phi[index]); + CCTK_REAL const PDstandardNth12phi = PDstandardNth12(&phi[index]); + CCTK_REAL const PDstandardNth13phi = PDstandardNth13(&phi[index]); + CCTK_REAL const PDstandardNth23phi = PDstandardNth23(&phi[index]); + CCTK_REAL const PDstandardNth1Xt1 = PDstandardNth1(&Xt1[index]); + CCTK_REAL const PDstandardNth2Xt1 = PDstandardNth2(&Xt1[index]); + CCTK_REAL const PDstandardNth3Xt1 = PDstandardNth3(&Xt1[index]); + CCTK_REAL const PDstandardNth1Xt2 = PDstandardNth1(&Xt2[index]); + CCTK_REAL const PDstandardNth2Xt2 = PDstandardNth2(&Xt2[index]); + CCTK_REAL const PDstandardNth3Xt2 = PDstandardNth3(&Xt2[index]); + CCTK_REAL const PDstandardNth1Xt3 = PDstandardNth1(&Xt3[index]); + CCTK_REAL const PDstandardNth2Xt3 = PDstandardNth2(&Xt3[index]); + CCTK_REAL const PDstandardNth3Xt3 = PDstandardNth3(&Xt3[index]); + + /* Calculate temporaries and grid functions */ + ptrdiff_t dir1 = Sign(beta1L); + + ptrdiff_t dir2 = Sign(beta2L); + + ptrdiff_t dir3 = Sign(beta3L); + + CCTK_REAL epsdiss1 = ToReal(EpsDiss); + + CCTK_REAL epsdiss2 = ToReal(EpsDiss); + + CCTK_REAL epsdiss3 = ToReal(EpsDiss); + + CCTK_REAL detgt = 1; + + CCTK_REAL gtu11 = INV(detgt)*(gt22L*gt33L - SQR(gt23L)); + + CCTK_REAL gtu12 = (gt13L*gt23L - gt12L*gt33L)*INV(detgt); + + CCTK_REAL gtu13 = (-(gt13L*gt22L) + gt12L*gt23L)*INV(detgt); + + CCTK_REAL gtu22 = INV(detgt)*(gt11L*gt33L - SQR(gt13L)); + + CCTK_REAL gtu23 = (gt12L*gt13L - gt11L*gt23L)*INV(detgt); + + CCTK_REAL gtu33 = INV(detgt)*(gt11L*gt22L - SQR(gt12L)); + + CCTK_REAL Gtl111 = 0.5*PDstandardNth1gt11; + + CCTK_REAL Gtl112 = 0.5*PDstandardNth2gt11; + + CCTK_REAL Gtl113 = 0.5*PDstandardNth3gt11; + + CCTK_REAL Gtl122 = -0.5*PDstandardNth1gt22 + PDstandardNth2gt12; + + CCTK_REAL Gtl123 = 0.5*(-PDstandardNth1gt23 + PDstandardNth2gt13 + + PDstandardNth3gt12); + + CCTK_REAL Gtl133 = -0.5*PDstandardNth1gt33 + PDstandardNth3gt13; + + CCTK_REAL Gtl211 = PDstandardNth1gt12 - 0.5*PDstandardNth2gt11; + + CCTK_REAL Gtl212 = 0.5*PDstandardNth1gt22; + + CCTK_REAL Gtl213 = 0.5*(PDstandardNth1gt23 - PDstandardNth2gt13 + + PDstandardNth3gt12); + + CCTK_REAL Gtl222 = 0.5*PDstandardNth2gt22; + + CCTK_REAL Gtl223 = 0.5*PDstandardNth3gt22; + + CCTK_REAL Gtl233 = -0.5*PDstandardNth2gt33 + PDstandardNth3gt23; + + CCTK_REAL Gtl311 = PDstandardNth1gt13 - 0.5*PDstandardNth3gt11; + + CCTK_REAL Gtl312 = 0.5*(PDstandardNth1gt23 + PDstandardNth2gt13 - + PDstandardNth3gt12); + + CCTK_REAL Gtl313 = 0.5*PDstandardNth1gt33; + + CCTK_REAL Gtl322 = PDstandardNth2gt23 - 0.5*PDstandardNth3gt22; + + CCTK_REAL Gtl323 = 0.5*PDstandardNth2gt33; + + CCTK_REAL Gtl333 = 0.5*PDstandardNth3gt33; + + CCTK_REAL Gtlu111 = Gtl111*gtu11 + Gtl112*gtu12 + Gtl113*gtu13; + + CCTK_REAL Gtlu112 = Gtl111*gtu12 + Gtl112*gtu22 + Gtl113*gtu23; + + CCTK_REAL Gtlu113 = Gtl111*gtu13 + Gtl112*gtu23 + Gtl113*gtu33; + + CCTK_REAL Gtlu121 = Gtl112*gtu11 + Gtl122*gtu12 + Gtl123*gtu13; + + CCTK_REAL Gtlu122 = Gtl112*gtu12 + Gtl122*gtu22 + Gtl123*gtu23; + + CCTK_REAL Gtlu123 = Gtl112*gtu13 + Gtl122*gtu23 + Gtl123*gtu33; + + CCTK_REAL Gtlu131 = Gtl113*gtu11 + Gtl123*gtu12 + Gtl133*gtu13; + + CCTK_REAL Gtlu132 = Gtl113*gtu12 + Gtl123*gtu22 + Gtl133*gtu23; + + CCTK_REAL Gtlu133 = Gtl113*gtu13 + Gtl123*gtu23 + Gtl133*gtu33; + + CCTK_REAL Gtlu211 = Gtl211*gtu11 + Gtl212*gtu12 + Gtl213*gtu13; + + CCTK_REAL Gtlu212 = Gtl211*gtu12 + Gtl212*gtu22 + Gtl213*gtu23; + + CCTK_REAL Gtlu213 = Gtl211*gtu13 + Gtl212*gtu23 + Gtl213*gtu33; + + CCTK_REAL Gtlu221 = Gtl212*gtu11 + Gtl222*gtu12 + Gtl223*gtu13; + + CCTK_REAL Gtlu222 = Gtl212*gtu12 + Gtl222*gtu22 + Gtl223*gtu23; + + CCTK_REAL Gtlu223 = Gtl212*gtu13 + Gtl222*gtu23 + Gtl223*gtu33; + + CCTK_REAL Gtlu231 = Gtl213*gtu11 + Gtl223*gtu12 + Gtl233*gtu13; + + CCTK_REAL Gtlu232 = Gtl213*gtu12 + Gtl223*gtu22 + Gtl233*gtu23; + + CCTK_REAL Gtlu233 = Gtl213*gtu13 + Gtl223*gtu23 + Gtl233*gtu33; + + CCTK_REAL Gtlu311 = Gtl311*gtu11 + Gtl312*gtu12 + Gtl313*gtu13; + + CCTK_REAL Gtlu312 = Gtl311*gtu12 + Gtl312*gtu22 + Gtl313*gtu23; + + CCTK_REAL Gtlu313 = Gtl311*gtu13 + Gtl312*gtu23 + Gtl313*gtu33; + + CCTK_REAL Gtlu321 = Gtl312*gtu11 + Gtl322*gtu12 + Gtl323*gtu13; + + CCTK_REAL Gtlu322 = Gtl312*gtu12 + Gtl322*gtu22 + Gtl323*gtu23; + + CCTK_REAL Gtlu323 = Gtl312*gtu13 + Gtl322*gtu23 + Gtl323*gtu33; + + CCTK_REAL Gtlu331 = Gtl313*gtu11 + Gtl323*gtu12 + Gtl333*gtu13; + + CCTK_REAL Gtlu332 = Gtl313*gtu12 + Gtl323*gtu22 + Gtl333*gtu23; + + CCTK_REAL Gtlu333 = Gtl313*gtu13 + Gtl323*gtu23 + Gtl333*gtu33; + + CCTK_REAL Gt111 = Gtl111*gtu11 + Gtl211*gtu12 + Gtl311*gtu13; + + CCTK_REAL Gt211 = Gtl111*gtu12 + Gtl211*gtu22 + Gtl311*gtu23; + + CCTK_REAL Gt311 = Gtl111*gtu13 + Gtl211*gtu23 + Gtl311*gtu33; + + CCTK_REAL Gt112 = Gtl112*gtu11 + Gtl212*gtu12 + Gtl312*gtu13; + + CCTK_REAL Gt212 = Gtl112*gtu12 + Gtl212*gtu22 + Gtl312*gtu23; + + CCTK_REAL Gt312 = Gtl112*gtu13 + Gtl212*gtu23 + Gtl312*gtu33; + + CCTK_REAL Gt113 = Gtl113*gtu11 + Gtl213*gtu12 + Gtl313*gtu13; + + CCTK_REAL Gt213 = Gtl113*gtu12 + Gtl213*gtu22 + Gtl313*gtu23; + + CCTK_REAL Gt313 = Gtl113*gtu13 + Gtl213*gtu23 + Gtl313*gtu33; + + CCTK_REAL Gt122 = Gtl122*gtu11 + Gtl222*gtu12 + Gtl322*gtu13; + + CCTK_REAL Gt222 = Gtl122*gtu12 + Gtl222*gtu22 + Gtl322*gtu23; + + CCTK_REAL Gt322 = Gtl122*gtu13 + Gtl222*gtu23 + Gtl322*gtu33; + + CCTK_REAL Gt123 = Gtl123*gtu11 + Gtl223*gtu12 + Gtl323*gtu13; + + CCTK_REAL Gt223 = Gtl123*gtu12 + Gtl223*gtu22 + Gtl323*gtu23; + + CCTK_REAL Gt323 = Gtl123*gtu13 + Gtl223*gtu23 + Gtl323*gtu33; + + CCTK_REAL Gt133 = Gtl133*gtu11 + Gtl233*gtu12 + Gtl333*gtu13; + + CCTK_REAL Gt233 = Gtl133*gtu12 + Gtl233*gtu22 + Gtl333*gtu23; + + CCTK_REAL Gt333 = Gtl133*gtu13 + Gtl233*gtu23 + Gtl333*gtu33; + + CCTK_REAL Xtn1 = Gt111*gtu11 + Gt122*gtu22 + 2*(Gt112*gtu12 + + Gt113*gtu13 + Gt123*gtu23) + Gt133*gtu33; + + CCTK_REAL Xtn2 = Gt211*gtu11 + Gt222*gtu22 + 2*(Gt212*gtu12 + + Gt213*gtu13 + Gt223*gtu23) + Gt233*gtu33; + + CCTK_REAL Xtn3 = Gt311*gtu11 + Gt322*gtu22 + 2*(Gt312*gtu12 + + Gt313*gtu13 + Gt323*gtu23) + Gt333*gtu33; + + CCTK_REAL Rt11 = 3*(Gt111*Gtlu111 + Gt112*Gtlu112 + Gt113*Gtlu113) + + 2*(Gt211*Gtlu121 + Gt212*Gtlu122 + Gt213*Gtlu123 + Gt311*Gtlu131 + + Gt312*Gtlu132 + Gt313*Gtlu133) + Gt211*Gtlu211 + Gt212*Gtlu212 + + Gt213*Gtlu213 + Gt311*Gtlu311 + Gt312*Gtlu312 + Gt313*Gtlu313 + + gt11L*PDstandardNth1Xt1 + gt12L*PDstandardNth1Xt2 + + gt13L*PDstandardNth1Xt3 + 0.5*(-(gtu11*PDstandardNth11gt11) - + 2*gtu12*PDstandardNth12gt11 - 2*gtu13*PDstandardNth13gt11 - + gtu22*PDstandardNth22gt11 - 2*gtu23*PDstandardNth23gt11 - + gtu33*PDstandardNth33gt11) + Gtl111*Xtn1 + Gtl112*Xtn2 + Gtl113*Xtn3; + + CCTK_REAL Rt12 = 0.5*(4*(Gt211*Gtlu221 + Gt212*Gtlu222 + + Gt213*Gtlu223) + 2*(Gt112*Gtlu111 + Gt122*Gtlu112 + Gt123*Gtlu113 + + Gt111*Gtlu121 + Gt212*Gtlu121 + Gt112*Gtlu122 + Gt222*Gtlu122 + + Gt113*Gtlu123 + Gt223*Gtlu123 + Gt312*Gtlu131 + Gt322*Gtlu132 + + Gt323*Gtlu133 + Gt111*Gtlu211 + Gt112*Gtlu212 + Gt113*Gtlu213 + + Gt311*Gtlu231 + Gt312*Gtlu232 + Gt313*Gtlu233 + Gt311*Gtlu321 + + Gt312*Gtlu322 + Gt313*Gtlu323) - gtu11*PDstandardNth11gt12 - + 2*gtu12*PDstandardNth12gt12 - 2*gtu13*PDstandardNth13gt12 + + gt12L*PDstandardNth1Xt1 + gt22L*PDstandardNth1Xt2 + + gt23L*PDstandardNth1Xt3 - gtu22*PDstandardNth22gt12 - + 2*gtu23*PDstandardNth23gt12 + gt11L*PDstandardNth2Xt1 + + gt12L*PDstandardNth2Xt2 + gt13L*PDstandardNth2Xt3 - + gtu33*PDstandardNth33gt12 + Gtl112*Xtn1 + Gtl211*Xtn1 + Gtl122*Xtn2 + + Gtl212*Xtn2 + Gtl123*Xtn3 + Gtl213*Xtn3); + + CCTK_REAL Rt13 = 0.5*(2*(Gt113*Gtlu111 + Gt123*Gtlu112 + Gt133*Gtlu113 + + Gt213*Gtlu121 + Gt223*Gtlu122 + Gt233*Gtlu123 + Gt111*Gtlu131 + + Gt313*Gtlu131 + Gt112*Gtlu132 + Gt323*Gtlu132 + Gt113*Gtlu133 + + Gt333*Gtlu133 + Gt211*Gtlu231 + Gt212*Gtlu232 + Gt213*Gtlu233 + + Gt111*Gtlu311 + Gt112*Gtlu312 + Gt113*Gtlu313 + Gt211*Gtlu321 + + Gt212*Gtlu322 + Gt213*Gtlu323) + 4*(Gt311*Gtlu331 + Gt312*Gtlu332 + + Gt313*Gtlu333) - gtu11*PDstandardNth11gt13 - + 2*gtu12*PDstandardNth12gt13 - 2*gtu13*PDstandardNth13gt13 + + gt13L*PDstandardNth1Xt1 + gt23L*PDstandardNth1Xt2 + + gt33L*PDstandardNth1Xt3 - gtu22*PDstandardNth22gt13 - + 2*gtu23*PDstandardNth23gt13 - gtu33*PDstandardNth33gt13 + + gt11L*PDstandardNth3Xt1 + gt12L*PDstandardNth3Xt2 + + gt13L*PDstandardNth3Xt3 + Gtl113*Xtn1 + Gtl311*Xtn1 + Gtl123*Xtn2 + + Gtl312*Xtn2 + Gtl133*Xtn3 + Gtl313*Xtn3); + + CCTK_REAL Rt22 = Gt112*(Gtlu121 + 2*Gtlu211) + Gt122*(Gtlu122 + + 2*Gtlu212) + Gt123*(Gtlu123 + 2*Gtlu213) + 3*(Gt212*Gtlu221 + + Gt222*Gtlu222 + Gt223*Gtlu223) + 2*(Gt312*Gtlu231 + Gt322*Gtlu232 + + Gt323*Gtlu233) + Gt312*Gtlu321 + Gt322*Gtlu322 + Gt323*Gtlu323 + + gt12L*PDstandardNth2Xt1 + gt22L*PDstandardNth2Xt2 + + gt23L*PDstandardNth2Xt3 + 0.5*(-(gtu11*PDstandardNth11gt22) - + 2*gtu12*PDstandardNth12gt22 - 2*gtu13*PDstandardNth13gt22 - + gtu22*PDstandardNth22gt22 - 2*gtu23*PDstandardNth23gt22 - + gtu33*PDstandardNth33gt22) + Gtl212*Xtn1 + Gtl222*Xtn2 + Gtl223*Xtn3; + + CCTK_REAL Rt23 = 0.5*(2*(Gt112*Gtlu131 + Gt122*Gtlu132 + Gt123*Gtlu133 + + Gt113*Gtlu211 + Gt123*Gtlu212 + Gt133*Gtlu213 + Gt213*Gtlu221 + + Gt223*Gtlu222 + Gt233*Gtlu223 + Gt212*Gtlu231 + Gt313*Gtlu231 + + Gt222*Gtlu232 + Gt323*Gtlu232 + Gt223*Gtlu233 + Gt333*Gtlu233 + + Gt112*Gtlu311 + Gt122*Gtlu312 + Gt123*Gtlu313 + Gt212*Gtlu321 + + Gt222*Gtlu322 + Gt223*Gtlu323) + 4*(Gt312*Gtlu331 + Gt322*Gtlu332 + + Gt323*Gtlu333) - gtu11*PDstandardNth11gt23 - + 2*gtu12*PDstandardNth12gt23 - 2*gtu13*PDstandardNth13gt23 - + gtu22*PDstandardNth22gt23 - 2*gtu23*PDstandardNth23gt23 + + gt13L*PDstandardNth2Xt1 + gt23L*PDstandardNth2Xt2 + + gt33L*PDstandardNth2Xt3 - gtu33*PDstandardNth33gt23 + + gt12L*PDstandardNth3Xt1 + gt22L*PDstandardNth3Xt2 + + gt23L*PDstandardNth3Xt3 + Gtl213*Xtn1 + Gtl312*Xtn1 + Gtl223*Xtn2 + + Gtl322*Xtn2 + Gtl233*Xtn3 + Gtl323*Xtn3); + + CCTK_REAL Rt33 = Gt113*(Gtlu131 + 2*Gtlu311) + Gt123*(Gtlu132 + + 2*Gtlu312) + Gt133*(Gtlu133 + 2*Gtlu313) + Gt213*(Gtlu231 + 2*Gtlu321) + + Gt223*(Gtlu232 + 2*Gtlu322) + Gt233*(Gtlu233 + 2*Gtlu323) + + 3*(Gt313*Gtlu331 + Gt323*Gtlu332 + Gt333*Gtlu333) + + 0.5*(-(gtu11*PDstandardNth11gt33) - 2*gtu12*PDstandardNth12gt33 - + 2*gtu13*PDstandardNth13gt33 - gtu22*PDstandardNth22gt33 - + 2*gtu23*PDstandardNth23gt33 - gtu33*PDstandardNth33gt33) + + gt13L*PDstandardNth3Xt1 + gt23L*PDstandardNth3Xt2 + + gt33L*PDstandardNth3Xt3 + Gtl313*Xtn1 + Gtl323*Xtn2 + Gtl333*Xtn3; + + CCTK_REAL fac1 = IfThen(ToReal(conformalMethod),-0.5*INV(phiL),1); + + CCTK_REAL cdphi1 = fac1*PDstandardNth1phi; + + CCTK_REAL cdphi2 = fac1*PDstandardNth2phi; + + CCTK_REAL cdphi3 = fac1*PDstandardNth3phi; + + CCTK_REAL fac2 = IfThen(ToReal(conformalMethod),0.5*INV(SQR(phiL)),0); + + CCTK_REAL cdphi211 = -(fac1*(-PDstandardNth11phi + + Gt111*PDstandardNth1phi + Gt211*PDstandardNth2phi + + Gt311*PDstandardNth3phi)) + fac2*SQR(PDstandardNth1phi); + + CCTK_REAL cdphi212 = fac2*PDstandardNth1phi*PDstandardNth2phi - + fac1*(-PDstandardNth12phi + Gt112*PDstandardNth1phi + + Gt212*PDstandardNth2phi + Gt312*PDstandardNth3phi); + + CCTK_REAL cdphi213 = fac2*PDstandardNth1phi*PDstandardNth3phi - + fac1*(-PDstandardNth13phi + Gt113*PDstandardNth1phi + + Gt213*PDstandardNth2phi + Gt313*PDstandardNth3phi); + + CCTK_REAL cdphi222 = -(fac1*(Gt122*PDstandardNth1phi - + PDstandardNth22phi + Gt222*PDstandardNth2phi + + Gt322*PDstandardNth3phi)) + fac2*SQR(PDstandardNth2phi); + + CCTK_REAL cdphi223 = fac2*PDstandardNth2phi*PDstandardNth3phi - + fac1*(Gt123*PDstandardNth1phi - PDstandardNth23phi + + Gt223*PDstandardNth2phi + Gt323*PDstandardNth3phi); + + CCTK_REAL cdphi233 = -(fac1*(Gt133*PDstandardNth1phi + + Gt233*PDstandardNth2phi - PDstandardNth33phi + + Gt333*PDstandardNth3phi)) + fac2*SQR(PDstandardNth3phi); + + CCTK_REAL Rphi11 = -2*(cdphi211 + 2*(-1 + gt11L*gtu11)*SQR(cdphi1) + + gt11L*(cdphi211*gtu11 + 4*(cdphi1*(cdphi2*gtu12 + cdphi3*gtu13) + + cdphi2*cdphi3*gtu23) + cdphi233*gtu33 + gtu22*(cdphi222 + + 2*SQR(cdphi2)) + 2*(cdphi212*gtu12 + cdphi213*gtu13 + cdphi223*gtu23 + + gtu33*SQR(cdphi3)))); + + CCTK_REAL Rphi12 = -2*(cdphi212 + cdphi1*(cdphi2*(-2 + 4*gt12L*gtu12) + + 4*cdphi3*gt12L*gtu13) + gt12L*(cdphi211*gtu11 + 4*cdphi2*cdphi3*gtu23 + + 2*(cdphi212*gtu12 + cdphi213*gtu13 + cdphi223*gtu23 + + gtu11*SQR(cdphi1)) + gtu22*(cdphi222 + 2*SQR(cdphi2)) + gtu33*(cdphi233 + + 2*SQR(cdphi3)))); + + CCTK_REAL Rphi13 = -2*(cdphi213 + cdphi1*(4*cdphi2*gt13L*gtu12 + + cdphi3*(-2 + 4*gt13L*gtu13)) + gt13L*(cdphi211*gtu11 + + 4*cdphi2*cdphi3*gtu23 + 2*(cdphi212*gtu12 + cdphi213*gtu13 + + cdphi223*gtu23 + gtu11*SQR(cdphi1)) + gtu22*(cdphi222 + 2*SQR(cdphi2)) + + gtu33*(cdphi233 + 2*SQR(cdphi3)))); + + CCTK_REAL Rphi22 = -2*(cdphi222 + 2*(-1 + gt22L*gtu22)*SQR(cdphi2) + + gt22L*(cdphi222*gtu22 + 4*(cdphi1*cdphi3*gtu13 + cdphi2*(cdphi1*gtu12 + + cdphi3*gtu23)) + cdphi233*gtu33 + gtu11*(cdphi211 + 2*SQR(cdphi1)) + + 2*(cdphi212*gtu12 + cdphi213*gtu13 + cdphi223*gtu23 + + gtu33*SQR(cdphi3)))); + + CCTK_REAL Rphi23 = -2*(cdphi223 + cdphi2*(4*cdphi1*gt23L*gtu12 + + cdphi3*(-2 + 4*gt23L*gtu23)) + gt23L*(4*cdphi1*cdphi3*gtu13 + + cdphi222*gtu22 + gtu11*(cdphi211 + 2*SQR(cdphi1)) + 2*(cdphi212*gtu12 + + cdphi213*gtu13 + cdphi223*gtu23 + gtu22*SQR(cdphi2)) + gtu33*(cdphi233 + + 2*SQR(cdphi3)))); + + CCTK_REAL Rphi33 = -2*(cdphi233 + gt33L*((4*cdphi1*cdphi2 + + 2*cdphi212)*gtu12 + 4*cdphi3*(cdphi1*gtu13 + cdphi2*gtu23) + + 2*(cdphi213*gtu13 + cdphi223*gtu23) + cdphi233*gtu33 + gtu11*(cdphi211 + + 2*SQR(cdphi1)) + gtu22*(cdphi222 + 2*SQR(cdphi2))) + 2*(-1 + + gt33L*gtu33)*SQR(cdphi3)); + + CCTK_REAL Atm11 = At11L*gtu11 + At12L*gtu12 + At13L*gtu13; + + CCTK_REAL Atm21 = At11L*gtu12 + At12L*gtu22 + At13L*gtu23; + + CCTK_REAL Atm31 = At11L*gtu13 + At12L*gtu23 + At13L*gtu33; + + CCTK_REAL Atm12 = At12L*gtu11 + At22L*gtu12 + At23L*gtu13; + + CCTK_REAL Atm22 = At12L*gtu12 + At22L*gtu22 + At23L*gtu23; + + CCTK_REAL Atm32 = At12L*gtu13 + At22L*gtu23 + At23L*gtu33; + + CCTK_REAL Atm13 = At13L*gtu11 + At23L*gtu12 + At33L*gtu13; + + CCTK_REAL Atm23 = At13L*gtu12 + At23L*gtu22 + At33L*gtu23; + + CCTK_REAL Atm33 = At13L*gtu13 + At23L*gtu23 + At33L*gtu33; + + CCTK_REAL e4phi = + IfThen(ToReal(conformalMethod),INV(SQR(phiL)),exp(4*phiL)); + + CCTK_REAL em4phi = INV(e4phi); + + CCTK_REAL g11 = e4phi*gt11L; + + CCTK_REAL g12 = e4phi*gt12L; + + CCTK_REAL g13 = e4phi*gt13L; + + CCTK_REAL g22 = e4phi*gt22L; + + CCTK_REAL g23 = e4phi*gt23L; + + CCTK_REAL g33 = e4phi*gt33L; + + CCTK_REAL gu11 = em4phi*gtu11; + + CCTK_REAL gu12 = em4phi*gtu12; + + CCTK_REAL gu13 = em4phi*gtu13; + + CCTK_REAL gu22 = em4phi*gtu22; + + CCTK_REAL gu23 = em4phi*gtu23; + + CCTK_REAL gu33 = em4phi*gtu33; + + CCTK_REAL R11 = Rphi11 + Rt11; + + CCTK_REAL R12 = Rphi12 + Rt12; + + CCTK_REAL R13 = Rphi13 + Rt13; + + CCTK_REAL R22 = Rphi22 + Rt22; + + CCTK_REAL R23 = Rphi23 + Rt23; + + CCTK_REAL R33 = Rphi33 + Rt33; + + CCTK_REAL trS = em4phi*(eTxxL*gtu11 + eTyyL*gtu22 + 2*(eTxyL*gtu12 + + eTxzL*gtu13 + eTyzL*gtu23) + eTzzL*gtu33); + + CCTK_REAL Ats11 = -PDstandardNth11alpha + (4*cdphi1 + + Gt111)*PDstandardNth1alpha + Gt211*PDstandardNth2alpha + + Gt311*PDstandardNth3alpha + alphaL*R11; + + CCTK_REAL Ats12 = -PDstandardNth12alpha + (2*cdphi2 + + Gt112)*PDstandardNth1alpha + (2*cdphi1 + Gt212)*PDstandardNth2alpha + + Gt312*PDstandardNth3alpha + alphaL*R12; + + CCTK_REAL Ats13 = -PDstandardNth13alpha + (2*cdphi3 + + Gt113)*PDstandardNth1alpha + Gt213*PDstandardNth2alpha + (2*cdphi1 + + Gt313)*PDstandardNth3alpha + alphaL*R13; + + CCTK_REAL Ats22 = Gt122*PDstandardNth1alpha - PDstandardNth22alpha + + (4*cdphi2 + Gt222)*PDstandardNth2alpha + Gt322*PDstandardNth3alpha + + alphaL*R22; + + CCTK_REAL Ats23 = Gt123*PDstandardNth1alpha - PDstandardNth23alpha + + (2*cdphi3 + Gt223)*PDstandardNth2alpha + (2*cdphi2 + + Gt323)*PDstandardNth3alpha + alphaL*R23; + + CCTK_REAL Ats33 = Gt133*PDstandardNth1alpha + + Gt233*PDstandardNth2alpha - PDstandardNth33alpha + (4*cdphi3 + + Gt333)*PDstandardNth3alpha + alphaL*R33; + + CCTK_REAL trAts = Ats11*gu11 + Ats22*gu22 + 2*(Ats12*gu12 + Ats13*gu13 + + Ats23*gu23) + Ats33*gu33; + + CCTK_REAL At11rhsL = -2.*alphaL*(At11L*Atm11 + At12L*Atm21 + + At13L*Atm31) + PDupwindNth1(&At11[index])*beta1L + + PDupwindNth2(&At11[index])*beta2L + + PDupwindNth3(&At11[index])*beta3L + epsdiss1*PDdissipationNth1At11 + + epsdiss2*PDdissipationNth2At11 + epsdiss3*PDdissipationNth3At11 + + 2.*(At12L*PDstandardNth1beta2 + At13L*PDstandardNth1beta3) + + At11L*(1.333333333333333333333333333333333333333*PDstandardNth1beta1 - + 0.6666666666666666666666666666666666666667*(PDstandardNth2beta2 + + PDstandardNth3beta3) + alphaL*trKL) + em4phi*(Ats11 - + 0.3333333333333333333333333333333333333333*g11*trAts + + alphaL*(-25.13274122871834590770114706623602307358*eTxxL + + 8.377580409572781969233715688745341024526*g11*trS)); + + CCTK_REAL At12rhsL = -2.*alphaL*(At11L*Atm12 + At12L*Atm22 + + At13L*Atm32) + PDupwindNth1(&At12[index])*beta1L + + PDupwindNth2(&At12[index])*beta2L + + PDupwindNth3(&At12[index])*beta3L + epsdiss1*PDdissipationNth1At12 + + epsdiss2*PDdissipationNth2At12 + epsdiss3*PDdissipationNth3At12 + + At22L*PDstandardNth1beta2 + At23L*PDstandardNth1beta3 + + At11L*PDstandardNth2beta1 + At13L*PDstandardNth2beta3 + + At12L*(0.3333333333333333333333333333333333333333*(PDstandardNth1beta1 + + PDstandardNth2beta2) - + 0.6666666666666666666666666666666666666667*PDstandardNth3beta3 + + alphaL*trKL) + em4phi*(Ats12 - + 0.3333333333333333333333333333333333333333*g12*trAts + + alphaL*(-25.13274122871834590770114706623602307358*eTxyL + + 8.377580409572781969233715688745341024526*g12*trS)); + + CCTK_REAL At13rhsL = -2.*alphaL*(At11L*Atm13 + At12L*Atm23 + + At13L*Atm33) + PDupwindNth1(&At13[index])*beta1L + + PDupwindNth2(&At13[index])*beta2L + + PDupwindNth3(&At13[index])*beta3L + epsdiss1*PDdissipationNth1At13 + + epsdiss2*PDdissipationNth2At13 + epsdiss3*PDdissipationNth3At13 + + At23L*PDstandardNth1beta2 + At33L*PDstandardNth1beta3 + + At11L*PDstandardNth3beta1 + At12L*PDstandardNth3beta2 + + At13L*(-0.6666666666666666666666666666666666666667*PDstandardNth2beta2 + + 0.3333333333333333333333333333333333333333*(PDstandardNth1beta1 + + PDstandardNth3beta3) + alphaL*trKL) + em4phi*(Ats13 - + 0.3333333333333333333333333333333333333333*g13*trAts + + alphaL*(-25.13274122871834590770114706623602307358*eTxzL + + 8.377580409572781969233715688745341024526*g13*trS)); + + CCTK_REAL At22rhsL = -2.*alphaL*(At12L*Atm12 + At22L*Atm22 + + At23L*Atm32) + PDupwindNth1(&At22[index])*beta1L + + PDupwindNth2(&At22[index])*beta2L + + PDupwindNth3(&At22[index])*beta3L + epsdiss1*PDdissipationNth1At22 + + epsdiss2*PDdissipationNth2At22 + epsdiss3*PDdissipationNth3At22 + + 2.*(At12L*PDstandardNth2beta1 + At23L*PDstandardNth2beta3) + + At22L*(1.333333333333333333333333333333333333333*PDstandardNth2beta2 - + 0.6666666666666666666666666666666666666667*(PDstandardNth1beta1 + + PDstandardNth3beta3) + alphaL*trKL) + em4phi*(Ats22 - + 0.3333333333333333333333333333333333333333*g22*trAts + + alphaL*(-25.13274122871834590770114706623602307358*eTyyL + + 8.377580409572781969233715688745341024526*g22*trS)); + + CCTK_REAL At23rhsL = -2.*alphaL*(At12L*Atm13 + At22L*Atm23 + + At23L*Atm33) + PDupwindNth1(&At23[index])*beta1L + + PDupwindNth2(&At23[index])*beta2L + + PDupwindNth3(&At23[index])*beta3L + epsdiss1*PDdissipationNth1At23 + + epsdiss2*PDdissipationNth2At23 + epsdiss3*PDdissipationNth3At23 + + At13L*PDstandardNth2beta1 + At33L*PDstandardNth2beta3 + + At12L*PDstandardNth3beta1 + At22L*PDstandardNth3beta2 + + At23L*(-0.6666666666666666666666666666666666666667*PDstandardNth1beta1 + + 0.3333333333333333333333333333333333333333*(PDstandardNth2beta2 + + PDstandardNth3beta3) + alphaL*trKL) + em4phi*(Ats23 - + 0.3333333333333333333333333333333333333333*g23*trAts + + alphaL*(-25.13274122871834590770114706623602307358*eTyzL + + 8.377580409572781969233715688745341024526*g23*trS)); + + CCTK_REAL At33rhsL = -2.*alphaL*(At13L*Atm13 + At23L*Atm23 + + At33L*Atm33) + PDupwindNth1(&At33[index])*beta1L + + PDupwindNth2(&At33[index])*beta2L + + PDupwindNth3(&At33[index])*beta3L + epsdiss1*PDdissipationNth1At33 + + epsdiss2*PDdissipationNth2At33 + epsdiss3*PDdissipationNth3At33 + + 2.*(At13L*PDstandardNth3beta1 + At23L*PDstandardNth3beta2) + + At33L*(-0.6666666666666666666666666666666666666667*(PDstandardNth1beta1 + + PDstandardNth2beta2) + + 1.333333333333333333333333333333333333333*PDstandardNth3beta3 + + alphaL*trKL) + em4phi*(Ats33 - + 0.3333333333333333333333333333333333333333*g33*trAts + + alphaL*(-25.13274122871834590770114706623602307358*eTzzL + + 8.377580409572781969233715688745341024526*g33*trS)); + + + /* Copy local copies back to grid functions */ + At11rhs[index] = At11rhsL; + At12rhs[index] = At12rhsL; + At13rhs[index] = At13rhsL; + At22rhs[index] = At22rhsL; + At23rhs[index] = At23rhsL; + At33rhs[index] = At33rhsL; + } + LC_ENDLOOP3 (ML_BSSN_UPW_RHS2); +} + +extern "C" void ML_BSSN_UPW_RHS2(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverInterior(cctkGH, &ML_BSSN_UPW_RHS2_Body); +} diff --git a/ML_BSSN_UPW/src/ML_BSSN_UPW_RHSStaticBoundary.cc b/ML_BSSN_UPW/src/ML_BSSN_UPW_RHSStaticBoundary.cc new file mode 100644 index 0000000..259c132 --- /dev/null +++ b/ML_BSSN_UPW/src/ML_BSSN_UPW_RHSStaticBoundary.cc @@ -0,0 +1,223 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +extern "C" void ML_BSSN_UPW_RHSStaticBoundary_SelectBCs(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT ierr = 0; + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_UPW::ML_curvrhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_UPW::ML_curvrhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_UPW::ML_dtlapserhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_UPW::ML_dtlapserhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_UPW::ML_dtshiftrhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_UPW::ML_dtshiftrhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_UPW::ML_Gammarhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_UPW::ML_Gammarhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_UPW::ML_lapserhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_UPW::ML_lapserhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_UPW::ML_log_confacrhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_UPW::ML_log_confacrhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_UPW::ML_metricrhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_UPW::ML_metricrhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_UPW::ML_shiftrhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_UPW::ML_shiftrhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_UPW::ML_trace_curvrhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_UPW::ML_trace_curvrhs."); + return; +} + +static void ML_BSSN_UPW_RHSStaticBoundary_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_BSSN_UPW_RHSStaticBoundary_Body"); + } + + if (cctk_iteration % ML_BSSN_UPW_RHSStaticBoundary_calc_every != ML_BSSN_UPW_RHSStaticBoundary_calc_offset) + { + return; + } + + const char *groups[] = {"ML_BSSN_UPW::ML_curvrhs","ML_BSSN_UPW::ML_dtlapserhs","ML_BSSN_UPW::ML_dtshiftrhs","ML_BSSN_UPW::ML_Gammarhs","ML_BSSN_UPW::ML_lapserhs","ML_BSSN_UPW::ML_log_confacrhs","ML_BSSN_UPW::ML_metricrhs","ML_BSSN_UPW::ML_shiftrhs","ML_BSSN_UPW::ML_trace_curvrhs"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_BSSN_UPW_RHSStaticBoundary", 9, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o12dx = 0.0833333333333333333333333333333*INV(dx); + CCTK_REAL const p1o12dy = 0.0833333333333333333333333333333*INV(dy); + CCTK_REAL const p1o12dz = 0.0833333333333333333333333333333*INV(dz); + CCTK_REAL const p1o144dxdy = 0.00694444444444444444444444444444*INV(dx)*INV(dy); + CCTK_REAL const p1o144dxdz = 0.00694444444444444444444444444444*INV(dx)*INV(dz); + CCTK_REAL const p1o144dydz = 0.00694444444444444444444444444444*INV(dy)*INV(dz); + CCTK_REAL const p1o24dx = 0.0416666666666666666666666666667*INV(dx); + CCTK_REAL const p1o24dy = 0.0416666666666666666666666666667*INV(dy); + CCTK_REAL const p1o24dz = 0.0416666666666666666666666666667*INV(dz); + CCTK_REAL const p1o64dx = 0.015625*INV(dx); + CCTK_REAL const p1o64dy = 0.015625*INV(dy); + CCTK_REAL const p1o64dz = 0.015625*INV(dz); + CCTK_REAL const p1odx = INV(dx); + CCTK_REAL const p1ody = INV(dy); + CCTK_REAL const p1odz = INV(dz); + CCTK_REAL const pm1o12dx2 = -0.0833333333333333333333333333333*INV(SQR(dx)); + CCTK_REAL const pm1o12dy2 = -0.0833333333333333333333333333333*INV(SQR(dy)); + CCTK_REAL const pm1o12dz2 = -0.0833333333333333333333333333333*INV(SQR(dz)); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_BSSN_UPW_RHSStaticBoundary, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + + /* Include user supplied include files */ + + /* Precompute derivatives */ + + /* Calculate temporaries and grid functions */ + CCTK_REAL phirhsL = 0; + + CCTK_REAL gt11rhsL = 0; + + CCTK_REAL gt12rhsL = 0; + + CCTK_REAL gt13rhsL = 0; + + CCTK_REAL gt22rhsL = 0; + + CCTK_REAL gt23rhsL = 0; + + CCTK_REAL gt33rhsL = 0; + + CCTK_REAL trKrhsL = 0; + + CCTK_REAL At11rhsL = 0; + + CCTK_REAL At12rhsL = 0; + + CCTK_REAL At13rhsL = 0; + + CCTK_REAL At22rhsL = 0; + + CCTK_REAL At23rhsL = 0; + + CCTK_REAL At33rhsL = 0; + + CCTK_REAL Xt1rhsL = 0; + + CCTK_REAL Xt2rhsL = 0; + + CCTK_REAL Xt3rhsL = 0; + + CCTK_REAL alpharhsL = 0; + + CCTK_REAL ArhsL = 0; + + CCTK_REAL beta1rhsL = 0; + + CCTK_REAL beta2rhsL = 0; + + CCTK_REAL beta3rhsL = 0; + + CCTK_REAL B1rhsL = 0; + + CCTK_REAL B2rhsL = 0; + + CCTK_REAL B3rhsL = 0; + + + /* Copy local copies back to grid functions */ + alpharhs[index] = alpharhsL; + Arhs[index] = ArhsL; + At11rhs[index] = At11rhsL; + At12rhs[index] = At12rhsL; + At13rhs[index] = At13rhsL; + At22rhs[index] = At22rhsL; + At23rhs[index] = At23rhsL; + At33rhs[index] = At33rhsL; + B1rhs[index] = B1rhsL; + B2rhs[index] = B2rhsL; + B3rhs[index] = B3rhsL; + beta1rhs[index] = beta1rhsL; + beta2rhs[index] = beta2rhsL; + beta3rhs[index] = beta3rhsL; + gt11rhs[index] = gt11rhsL; + gt12rhs[index] = gt12rhsL; + gt13rhs[index] = gt13rhsL; + gt22rhs[index] = gt22rhsL; + gt23rhs[index] = gt23rhsL; + gt33rhs[index] = gt33rhsL; + phirhs[index] = phirhsL; + trKrhs[index] = trKrhsL; + Xt1rhs[index] = Xt1rhsL; + Xt2rhs[index] = Xt2rhsL; + Xt3rhs[index] = Xt3rhsL; + } + LC_ENDLOOP3 (ML_BSSN_UPW_RHSStaticBoundary); +} + +extern "C" void ML_BSSN_UPW_RHSStaticBoundary(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverBoundary(cctkGH, &ML_BSSN_UPW_RHSStaticBoundary_Body); +} diff --git a/ML_BSSN_UPW/src/ML_BSSN_UPW_boundary.cc b/ML_BSSN_UPW/src/ML_BSSN_UPW_boundary.cc new file mode 100644 index 0000000..bc7e419 --- /dev/null +++ b/ML_BSSN_UPW/src/ML_BSSN_UPW_boundary.cc @@ -0,0 +1,223 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +extern "C" void ML_BSSN_UPW_boundary_SelectBCs(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT ierr = 0; + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_UPW::ML_curv","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_UPW::ML_curv."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_UPW::ML_dtlapse","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_UPW::ML_dtlapse."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_UPW::ML_dtshift","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_UPW::ML_dtshift."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_UPW::ML_Gamma","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_UPW::ML_Gamma."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_UPW::ML_lapse","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_UPW::ML_lapse."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_UPW::ML_log_confac","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_UPW::ML_log_confac."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_UPW::ML_metric","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_UPW::ML_metric."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_UPW::ML_shift","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_UPW::ML_shift."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_UPW::ML_trace_curv","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_UPW::ML_trace_curv."); + return; +} + +static void ML_BSSN_UPW_boundary_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_BSSN_UPW_boundary_Body"); + } + + if (cctk_iteration % ML_BSSN_UPW_boundary_calc_every != ML_BSSN_UPW_boundary_calc_offset) + { + return; + } + + const char *groups[] = {"ML_BSSN_UPW::ML_curv","ML_BSSN_UPW::ML_dtlapse","ML_BSSN_UPW::ML_dtshift","ML_BSSN_UPW::ML_Gamma","ML_BSSN_UPW::ML_lapse","ML_BSSN_UPW::ML_log_confac","ML_BSSN_UPW::ML_metric","ML_BSSN_UPW::ML_shift","ML_BSSN_UPW::ML_trace_curv"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_BSSN_UPW_boundary", 9, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o12dx = 0.0833333333333333333333333333333*INV(dx); + CCTK_REAL const p1o12dy = 0.0833333333333333333333333333333*INV(dy); + CCTK_REAL const p1o12dz = 0.0833333333333333333333333333333*INV(dz); + CCTK_REAL const p1o144dxdy = 0.00694444444444444444444444444444*INV(dx)*INV(dy); + CCTK_REAL const p1o144dxdz = 0.00694444444444444444444444444444*INV(dx)*INV(dz); + CCTK_REAL const p1o144dydz = 0.00694444444444444444444444444444*INV(dy)*INV(dz); + CCTK_REAL const p1o24dx = 0.0416666666666666666666666666667*INV(dx); + CCTK_REAL const p1o24dy = 0.0416666666666666666666666666667*INV(dy); + CCTK_REAL const p1o24dz = 0.0416666666666666666666666666667*INV(dz); + CCTK_REAL const p1o64dx = 0.015625*INV(dx); + CCTK_REAL const p1o64dy = 0.015625*INV(dy); + CCTK_REAL const p1o64dz = 0.015625*INV(dz); + CCTK_REAL const p1odx = INV(dx); + CCTK_REAL const p1ody = INV(dy); + CCTK_REAL const p1odz = INV(dz); + CCTK_REAL const pm1o12dx2 = -0.0833333333333333333333333333333*INV(SQR(dx)); + CCTK_REAL const pm1o12dy2 = -0.0833333333333333333333333333333*INV(SQR(dy)); + CCTK_REAL const pm1o12dz2 = -0.0833333333333333333333333333333*INV(SQR(dz)); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_BSSN_UPW_boundary, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + + /* Include user supplied include files */ + + /* Precompute derivatives */ + + /* Calculate temporaries and grid functions */ + CCTK_REAL phiL = IfThen(ToReal(conformalMethod),1,0); + + CCTK_REAL gt11L = 1; + + CCTK_REAL gt12L = 0; + + CCTK_REAL gt13L = 0; + + CCTK_REAL gt22L = 1; + + CCTK_REAL gt23L = 0; + + CCTK_REAL gt33L = 1; + + CCTK_REAL trKL = 0; + + CCTK_REAL At11L = 0; + + CCTK_REAL At12L = 0; + + CCTK_REAL At13L = 0; + + CCTK_REAL At22L = 0; + + CCTK_REAL At23L = 0; + + CCTK_REAL At33L = 0; + + CCTK_REAL Xt1L = 0; + + CCTK_REAL Xt2L = 0; + + CCTK_REAL Xt3L = 0; + + CCTK_REAL alphaL = 1; + + CCTK_REAL AL = 0; + + CCTK_REAL beta1L = 0; + + CCTK_REAL beta2L = 0; + + CCTK_REAL beta3L = 0; + + CCTK_REAL B1L = 0; + + CCTK_REAL B2L = 0; + + CCTK_REAL B3L = 0; + + + /* Copy local copies back to grid functions */ + A[index] = AL; + alpha[index] = alphaL; + At11[index] = At11L; + At12[index] = At12L; + At13[index] = At13L; + At22[index] = At22L; + At23[index] = At23L; + At33[index] = At33L; + B1[index] = B1L; + B2[index] = B2L; + B3[index] = B3L; + beta1[index] = beta1L; + beta2[index] = beta2L; + beta3[index] = beta3L; + gt11[index] = gt11L; + gt12[index] = gt12L; + gt13[index] = gt13L; + gt22[index] = gt22L; + gt23[index] = gt23L; + gt33[index] = gt33L; + phi[index] = phiL; + trK[index] = trKL; + Xt1[index] = Xt1L; + Xt2[index] = Xt2L; + Xt3[index] = Xt3L; + } + LC_ENDLOOP3 (ML_BSSN_UPW_boundary); +} + +extern "C" void ML_BSSN_UPW_boundary(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverBoundaryWithGhosts(cctkGH, &ML_BSSN_UPW_boundary_Body); +} diff --git a/ML_BSSN_UPW/src/ML_BSSN_UPW_constraints1.cc b/ML_BSSN_UPW/src/ML_BSSN_UPW_constraints1.cc new file mode 100644 index 0000000..ccf543f --- /dev/null +++ b/ML_BSSN_UPW/src/ML_BSSN_UPW_constraints1.cc @@ -0,0 +1,585 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +extern "C" void ML_BSSN_UPW_constraints1_SelectBCs(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT ierr = 0; + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_UPW::ML_Ham","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_UPW::ML_Ham."); + return; +} + +static void ML_BSSN_UPW_constraints1_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_BSSN_UPW_constraints1_Body"); + } + + if (cctk_iteration % ML_BSSN_UPW_constraints1_calc_every != ML_BSSN_UPW_constraints1_calc_offset) + { + return; + } + + const char *groups[] = {"ML_BSSN_UPW::ML_curv","ML_BSSN_UPW::ML_Gamma","ML_BSSN_UPW::ML_Ham","ML_BSSN_UPW::ML_lapse","ML_BSSN_UPW::ML_log_confac","ML_BSSN_UPW::ML_metric","ML_BSSN_UPW::ML_shift","ML_BSSN_UPW::ML_trace_curv"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_BSSN_UPW_constraints1", 8, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o12dx = 0.0833333333333333333333333333333*INV(dx); + CCTK_REAL const p1o12dy = 0.0833333333333333333333333333333*INV(dy); + CCTK_REAL const p1o12dz = 0.0833333333333333333333333333333*INV(dz); + CCTK_REAL const p1o144dxdy = 0.00694444444444444444444444444444*INV(dx)*INV(dy); + CCTK_REAL const p1o144dxdz = 0.00694444444444444444444444444444*INV(dx)*INV(dz); + CCTK_REAL const p1o144dydz = 0.00694444444444444444444444444444*INV(dy)*INV(dz); + CCTK_REAL const p1o24dx = 0.0416666666666666666666666666667*INV(dx); + CCTK_REAL const p1o24dy = 0.0416666666666666666666666666667*INV(dy); + CCTK_REAL const p1o24dz = 0.0416666666666666666666666666667*INV(dz); + CCTK_REAL const p1o64dx = 0.015625*INV(dx); + CCTK_REAL const p1o64dy = 0.015625*INV(dy); + CCTK_REAL const p1o64dz = 0.015625*INV(dz); + CCTK_REAL const p1odx = INV(dx); + CCTK_REAL const p1ody = INV(dy); + CCTK_REAL const p1odz = INV(dz); + CCTK_REAL const pm1o12dx2 = -0.0833333333333333333333333333333*INV(SQR(dx)); + CCTK_REAL const pm1o12dy2 = -0.0833333333333333333333333333333*INV(SQR(dy)); + CCTK_REAL const pm1o12dz2 = -0.0833333333333333333333333333333*INV(SQR(dz)); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_BSSN_UPW_constraints1, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + CCTK_REAL alphaL = alpha[index]; + CCTK_REAL At11L = At11[index]; + CCTK_REAL At12L = At12[index]; + CCTK_REAL At13L = At13[index]; + CCTK_REAL At22L = At22[index]; + CCTK_REAL At23L = At23[index]; + CCTK_REAL At33L = At33[index]; + CCTK_REAL beta1L = beta1[index]; + CCTK_REAL beta2L = beta2[index]; + CCTK_REAL beta3L = beta3[index]; + CCTK_REAL eTttL = (*stress_energy_state) ? eTtt[index] : ToReal(0.0); + CCTK_REAL eTtxL = (*stress_energy_state) ? eTtx[index] : ToReal(0.0); + CCTK_REAL eTtyL = (*stress_energy_state) ? eTty[index] : ToReal(0.0); + CCTK_REAL eTtzL = (*stress_energy_state) ? eTtz[index] : ToReal(0.0); + CCTK_REAL eTxxL = (*stress_energy_state) ? eTxx[index] : ToReal(0.0); + CCTK_REAL eTxyL = (*stress_energy_state) ? eTxy[index] : ToReal(0.0); + CCTK_REAL eTxzL = (*stress_energy_state) ? eTxz[index] : ToReal(0.0); + CCTK_REAL eTyyL = (*stress_energy_state) ? eTyy[index] : ToReal(0.0); + CCTK_REAL eTyzL = (*stress_energy_state) ? eTyz[index] : ToReal(0.0); + CCTK_REAL eTzzL = (*stress_energy_state) ? eTzz[index] : ToReal(0.0); + CCTK_REAL gt11L = gt11[index]; + CCTK_REAL gt12L = gt12[index]; + CCTK_REAL gt13L = gt13[index]; + CCTK_REAL gt22L = gt22[index]; + CCTK_REAL gt23L = gt23[index]; + CCTK_REAL gt33L = gt33[index]; + CCTK_REAL phiL = phi[index]; + CCTK_REAL trKL = trK[index]; + CCTK_REAL Xt1L = Xt1[index]; + CCTK_REAL Xt2L = Xt2[index]; + CCTK_REAL Xt3L = Xt3[index]; + + /* Include user supplied include files */ + + /* Precompute derivatives */ + CCTK_REAL const PDstandardNth1gt11 = PDstandardNth1(>11[index]); + CCTK_REAL const PDstandardNth2gt11 = PDstandardNth2(>11[index]); + CCTK_REAL const PDstandardNth3gt11 = PDstandardNth3(>11[index]); + CCTK_REAL const PDstandardNth11gt11 = PDstandardNth11(>11[index]); + CCTK_REAL const PDstandardNth22gt11 = PDstandardNth22(>11[index]); + CCTK_REAL const PDstandardNth33gt11 = PDstandardNth33(>11[index]); + CCTK_REAL const PDstandardNth12gt11 = PDstandardNth12(>11[index]); + CCTK_REAL const PDstandardNth13gt11 = PDstandardNth13(>11[index]); + CCTK_REAL const PDstandardNth23gt11 = PDstandardNth23(>11[index]); + CCTK_REAL const PDstandardNth1gt12 = PDstandardNth1(>12[index]); + CCTK_REAL const PDstandardNth2gt12 = PDstandardNth2(>12[index]); + CCTK_REAL const PDstandardNth3gt12 = PDstandardNth3(>12[index]); + CCTK_REAL const PDstandardNth11gt12 = PDstandardNth11(>12[index]); + CCTK_REAL const PDstandardNth22gt12 = PDstandardNth22(>12[index]); + CCTK_REAL const PDstandardNth33gt12 = PDstandardNth33(>12[index]); + CCTK_REAL const PDstandardNth12gt12 = PDstandardNth12(>12[index]); + CCTK_REAL const PDstandardNth13gt12 = PDstandardNth13(>12[index]); + CCTK_REAL const PDstandardNth23gt12 = PDstandardNth23(>12[index]); + CCTK_REAL const PDstandardNth1gt13 = PDstandardNth1(>13[index]); + CCTK_REAL const PDstandardNth2gt13 = PDstandardNth2(>13[index]); + CCTK_REAL const PDstandardNth3gt13 = PDstandardNth3(>13[index]); + CCTK_REAL const PDstandardNth11gt13 = PDstandardNth11(>13[index]); + CCTK_REAL const PDstandardNth22gt13 = PDstandardNth22(>13[index]); + CCTK_REAL const PDstandardNth33gt13 = PDstandardNth33(>13[index]); + CCTK_REAL const PDstandardNth12gt13 = PDstandardNth12(>13[index]); + CCTK_REAL const PDstandardNth13gt13 = PDstandardNth13(>13[index]); + CCTK_REAL const PDstandardNth23gt13 = PDstandardNth23(>13[index]); + CCTK_REAL const PDstandardNth1gt22 = PDstandardNth1(>22[index]); + CCTK_REAL const PDstandardNth2gt22 = PDstandardNth2(>22[index]); + CCTK_REAL const PDstandardNth3gt22 = PDstandardNth3(>22[index]); + CCTK_REAL const PDstandardNth11gt22 = PDstandardNth11(>22[index]); + CCTK_REAL const PDstandardNth22gt22 = PDstandardNth22(>22[index]); + CCTK_REAL const PDstandardNth33gt22 = PDstandardNth33(>22[index]); + CCTK_REAL const PDstandardNth12gt22 = PDstandardNth12(>22[index]); + CCTK_REAL const PDstandardNth13gt22 = PDstandardNth13(>22[index]); + CCTK_REAL const PDstandardNth23gt22 = PDstandardNth23(>22[index]); + CCTK_REAL const PDstandardNth1gt23 = PDstandardNth1(>23[index]); + CCTK_REAL const PDstandardNth2gt23 = PDstandardNth2(>23[index]); + CCTK_REAL const PDstandardNth3gt23 = PDstandardNth3(>23[index]); + CCTK_REAL const PDstandardNth11gt23 = PDstandardNth11(>23[index]); + CCTK_REAL const PDstandardNth22gt23 = PDstandardNth22(>23[index]); + CCTK_REAL const PDstandardNth33gt23 = PDstandardNth33(>23[index]); + CCTK_REAL const PDstandardNth12gt23 = PDstandardNth12(>23[index]); + CCTK_REAL const PDstandardNth13gt23 = PDstandardNth13(>23[index]); + CCTK_REAL const PDstandardNth23gt23 = PDstandardNth23(>23[index]); + CCTK_REAL const PDstandardNth1gt33 = PDstandardNth1(>33[index]); + CCTK_REAL const PDstandardNth2gt33 = PDstandardNth2(>33[index]); + CCTK_REAL const PDstandardNth3gt33 = PDstandardNth3(>33[index]); + CCTK_REAL const PDstandardNth11gt33 = PDstandardNth11(>33[index]); + CCTK_REAL const PDstandardNth22gt33 = PDstandardNth22(>33[index]); + CCTK_REAL const PDstandardNth33gt33 = PDstandardNth33(>33[index]); + CCTK_REAL const PDstandardNth12gt33 = PDstandardNth12(>33[index]); + CCTK_REAL const PDstandardNth13gt33 = PDstandardNth13(>33[index]); + CCTK_REAL const PDstandardNth23gt33 = PDstandardNth23(>33[index]); + CCTK_REAL const PDstandardNth1phi = PDstandardNth1(&phi[index]); + CCTK_REAL const PDstandardNth2phi = PDstandardNth2(&phi[index]); + CCTK_REAL const PDstandardNth3phi = PDstandardNth3(&phi[index]); + CCTK_REAL const PDstandardNth11phi = PDstandardNth11(&phi[index]); + CCTK_REAL const PDstandardNth22phi = PDstandardNth22(&phi[index]); + CCTK_REAL const PDstandardNth33phi = PDstandardNth33(&phi[index]); + CCTK_REAL const PDstandardNth12phi = PDstandardNth12(&phi[index]); + CCTK_REAL const PDstandardNth13phi = PDstandardNth13(&phi[index]); + CCTK_REAL const PDstandardNth23phi = PDstandardNth23(&phi[index]); + CCTK_REAL const PDstandardNth1Xt1 = PDstandardNth1(&Xt1[index]); + CCTK_REAL const PDstandardNth2Xt1 = PDstandardNth2(&Xt1[index]); + CCTK_REAL const PDstandardNth3Xt1 = PDstandardNth3(&Xt1[index]); + CCTK_REAL const PDstandardNth1Xt2 = PDstandardNth1(&Xt2[index]); + CCTK_REAL const PDstandardNth2Xt2 = PDstandardNth2(&Xt2[index]); + CCTK_REAL const PDstandardNth3Xt2 = PDstandardNth3(&Xt2[index]); + CCTK_REAL const PDstandardNth1Xt3 = PDstandardNth1(&Xt3[index]); + CCTK_REAL const PDstandardNth2Xt3 = PDstandardNth2(&Xt3[index]); + CCTK_REAL const PDstandardNth3Xt3 = PDstandardNth3(&Xt3[index]); + + /* Calculate temporaries and grid functions */ + CCTK_REAL detgt = 1; + + CCTK_REAL gtu11 = INV(detgt)*(gt22L*gt33L - SQR(gt23L)); + + CCTK_REAL gtu12 = (gt13L*gt23L - gt12L*gt33L)*INV(detgt); + + CCTK_REAL gtu13 = (-(gt13L*gt22L) + gt12L*gt23L)*INV(detgt); + + CCTK_REAL gtu22 = INV(detgt)*(gt11L*gt33L - SQR(gt13L)); + + CCTK_REAL gtu23 = (gt12L*gt13L - gt11L*gt23L)*INV(detgt); + + CCTK_REAL gtu33 = INV(detgt)*(gt11L*gt22L - SQR(gt12L)); + + CCTK_REAL Gtl111 = 0.5*PDstandardNth1gt11; + + CCTK_REAL Gtl112 = 0.5*PDstandardNth2gt11; + + CCTK_REAL Gtl113 = 0.5*PDstandardNth3gt11; + + CCTK_REAL Gtl122 = -0.5*PDstandardNth1gt22 + PDstandardNth2gt12; + + CCTK_REAL Gtl123 = 0.5*(-PDstandardNth1gt23 + PDstandardNth2gt13 + + PDstandardNth3gt12); + + CCTK_REAL Gtl133 = -0.5*PDstandardNth1gt33 + PDstandardNth3gt13; + + CCTK_REAL Gtl211 = PDstandardNth1gt12 - 0.5*PDstandardNth2gt11; + + CCTK_REAL Gtl212 = 0.5*PDstandardNth1gt22; + + CCTK_REAL Gtl213 = 0.5*(PDstandardNth1gt23 - PDstandardNth2gt13 + + PDstandardNth3gt12); + + CCTK_REAL Gtl222 = 0.5*PDstandardNth2gt22; + + CCTK_REAL Gtl223 = 0.5*PDstandardNth3gt22; + + CCTK_REAL Gtl233 = -0.5*PDstandardNth2gt33 + PDstandardNth3gt23; + + CCTK_REAL Gtl311 = PDstandardNth1gt13 - 0.5*PDstandardNth3gt11; + + CCTK_REAL Gtl312 = 0.5*(PDstandardNth1gt23 + PDstandardNth2gt13 - + PDstandardNth3gt12); + + CCTK_REAL Gtl313 = 0.5*PDstandardNth1gt33; + + CCTK_REAL Gtl322 = PDstandardNth2gt23 - 0.5*PDstandardNth3gt22; + + CCTK_REAL Gtl323 = 0.5*PDstandardNth2gt33; + + CCTK_REAL Gtl333 = 0.5*PDstandardNth3gt33; + + CCTK_REAL Gtlu111 = Gtl111*gtu11 + Gtl112*gtu12 + Gtl113*gtu13; + + CCTK_REAL Gtlu112 = Gtl111*gtu12 + Gtl112*gtu22 + Gtl113*gtu23; + + CCTK_REAL Gtlu113 = Gtl111*gtu13 + Gtl112*gtu23 + Gtl113*gtu33; + + CCTK_REAL Gtlu121 = Gtl112*gtu11 + Gtl122*gtu12 + Gtl123*gtu13; + + CCTK_REAL Gtlu122 = Gtl112*gtu12 + Gtl122*gtu22 + Gtl123*gtu23; + + CCTK_REAL Gtlu123 = Gtl112*gtu13 + Gtl122*gtu23 + Gtl123*gtu33; + + CCTK_REAL Gtlu131 = Gtl113*gtu11 + Gtl123*gtu12 + Gtl133*gtu13; + + CCTK_REAL Gtlu132 = Gtl113*gtu12 + Gtl123*gtu22 + Gtl133*gtu23; + + CCTK_REAL Gtlu133 = Gtl113*gtu13 + Gtl123*gtu23 + Gtl133*gtu33; + + CCTK_REAL Gtlu211 = Gtl211*gtu11 + Gtl212*gtu12 + Gtl213*gtu13; + + CCTK_REAL Gtlu212 = Gtl211*gtu12 + Gtl212*gtu22 + Gtl213*gtu23; + + CCTK_REAL Gtlu213 = Gtl211*gtu13 + Gtl212*gtu23 + Gtl213*gtu33; + + CCTK_REAL Gtlu221 = Gtl212*gtu11 + Gtl222*gtu12 + Gtl223*gtu13; + + CCTK_REAL Gtlu222 = Gtl212*gtu12 + Gtl222*gtu22 + Gtl223*gtu23; + + CCTK_REAL Gtlu223 = Gtl212*gtu13 + Gtl222*gtu23 + Gtl223*gtu33; + + CCTK_REAL Gtlu231 = Gtl213*gtu11 + Gtl223*gtu12 + Gtl233*gtu13; + + CCTK_REAL Gtlu232 = Gtl213*gtu12 + Gtl223*gtu22 + Gtl233*gtu23; + + CCTK_REAL Gtlu233 = Gtl213*gtu13 + Gtl223*gtu23 + Gtl233*gtu33; + + CCTK_REAL Gtlu311 = Gtl311*gtu11 + Gtl312*gtu12 + Gtl313*gtu13; + + CCTK_REAL Gtlu312 = Gtl311*gtu12 + Gtl312*gtu22 + Gtl313*gtu23; + + CCTK_REAL Gtlu313 = Gtl311*gtu13 + Gtl312*gtu23 + Gtl313*gtu33; + + CCTK_REAL Gtlu321 = Gtl312*gtu11 + Gtl322*gtu12 + Gtl323*gtu13; + + CCTK_REAL Gtlu322 = Gtl312*gtu12 + Gtl322*gtu22 + Gtl323*gtu23; + + CCTK_REAL Gtlu323 = Gtl312*gtu13 + Gtl322*gtu23 + Gtl323*gtu33; + + CCTK_REAL Gtlu331 = Gtl313*gtu11 + Gtl323*gtu12 + Gtl333*gtu13; + + CCTK_REAL Gtlu332 = Gtl313*gtu12 + Gtl323*gtu22 + Gtl333*gtu23; + + CCTK_REAL Gtlu333 = Gtl313*gtu13 + Gtl323*gtu23 + Gtl333*gtu33; + + CCTK_REAL Gt111 = Gtl111*gtu11 + Gtl211*gtu12 + Gtl311*gtu13; + + CCTK_REAL Gt211 = Gtl111*gtu12 + Gtl211*gtu22 + Gtl311*gtu23; + + CCTK_REAL Gt311 = Gtl111*gtu13 + Gtl211*gtu23 + Gtl311*gtu33; + + CCTK_REAL Gt112 = Gtl112*gtu11 + Gtl212*gtu12 + Gtl312*gtu13; + + CCTK_REAL Gt212 = Gtl112*gtu12 + Gtl212*gtu22 + Gtl312*gtu23; + + CCTK_REAL Gt312 = Gtl112*gtu13 + Gtl212*gtu23 + Gtl312*gtu33; + + CCTK_REAL Gt113 = Gtl113*gtu11 + Gtl213*gtu12 + Gtl313*gtu13; + + CCTK_REAL Gt213 = Gtl113*gtu12 + Gtl213*gtu22 + Gtl313*gtu23; + + CCTK_REAL Gt313 = Gtl113*gtu13 + Gtl213*gtu23 + Gtl313*gtu33; + + CCTK_REAL Gt122 = Gtl122*gtu11 + Gtl222*gtu12 + Gtl322*gtu13; + + CCTK_REAL Gt222 = Gtl122*gtu12 + Gtl222*gtu22 + Gtl322*gtu23; + + CCTK_REAL Gt322 = Gtl122*gtu13 + Gtl222*gtu23 + Gtl322*gtu33; + + CCTK_REAL Gt123 = Gtl123*gtu11 + Gtl223*gtu12 + Gtl323*gtu13; + + CCTK_REAL Gt223 = Gtl123*gtu12 + Gtl223*gtu22 + Gtl323*gtu23; + + CCTK_REAL Gt323 = Gtl123*gtu13 + Gtl223*gtu23 + Gtl323*gtu33; + + CCTK_REAL Gt133 = Gtl133*gtu11 + Gtl233*gtu12 + Gtl333*gtu13; + + CCTK_REAL Gt233 = Gtl133*gtu12 + Gtl233*gtu22 + Gtl333*gtu23; + + CCTK_REAL Gt333 = Gtl133*gtu13 + Gtl233*gtu23 + Gtl333*gtu33; + + CCTK_REAL Xtn1 = Gt111*gtu11 + Gt122*gtu22 + 2*(Gt112*gtu12 + + Gt113*gtu13 + Gt123*gtu23) + Gt133*gtu33; + + CCTK_REAL Xtn2 = Gt211*gtu11 + Gt222*gtu22 + 2*(Gt212*gtu12 + + Gt213*gtu13 + Gt223*gtu23) + Gt233*gtu33; + + CCTK_REAL Xtn3 = Gt311*gtu11 + Gt322*gtu22 + 2*(Gt312*gtu12 + + Gt313*gtu13 + Gt323*gtu23) + Gt333*gtu33; + + CCTK_REAL Rt11 = 3*(Gt111*Gtlu111 + Gt112*Gtlu112 + Gt113*Gtlu113) + + 2*(Gt211*Gtlu121 + Gt212*Gtlu122 + Gt213*Gtlu123 + Gt311*Gtlu131 + + Gt312*Gtlu132 + Gt313*Gtlu133) + Gt211*Gtlu211 + Gt212*Gtlu212 + + Gt213*Gtlu213 + Gt311*Gtlu311 + Gt312*Gtlu312 + Gt313*Gtlu313 + + gt11L*PDstandardNth1Xt1 + gt12L*PDstandardNth1Xt2 + + gt13L*PDstandardNth1Xt3 + 0.5*(-(gtu11*PDstandardNth11gt11) - + 2*gtu12*PDstandardNth12gt11 - 2*gtu13*PDstandardNth13gt11 - + gtu22*PDstandardNth22gt11 - 2*gtu23*PDstandardNth23gt11 - + gtu33*PDstandardNth33gt11) + Gtl111*Xtn1 + Gtl112*Xtn2 + Gtl113*Xtn3; + + CCTK_REAL Rt12 = 0.5*(4*(Gt211*Gtlu221 + Gt212*Gtlu222 + + Gt213*Gtlu223) + 2*(Gt112*Gtlu111 + Gt122*Gtlu112 + Gt123*Gtlu113 + + Gt111*Gtlu121 + Gt212*Gtlu121 + Gt112*Gtlu122 + Gt222*Gtlu122 + + Gt113*Gtlu123 + Gt223*Gtlu123 + Gt312*Gtlu131 + Gt322*Gtlu132 + + Gt323*Gtlu133 + Gt111*Gtlu211 + Gt112*Gtlu212 + Gt113*Gtlu213 + + Gt311*Gtlu231 + Gt312*Gtlu232 + Gt313*Gtlu233 + Gt311*Gtlu321 + + Gt312*Gtlu322 + Gt313*Gtlu323) - gtu11*PDstandardNth11gt12 - + 2*gtu12*PDstandardNth12gt12 - 2*gtu13*PDstandardNth13gt12 + + gt12L*PDstandardNth1Xt1 + gt22L*PDstandardNth1Xt2 + + gt23L*PDstandardNth1Xt3 - gtu22*PDstandardNth22gt12 - + 2*gtu23*PDstandardNth23gt12 + gt11L*PDstandardNth2Xt1 + + gt12L*PDstandardNth2Xt2 + gt13L*PDstandardNth2Xt3 - + gtu33*PDstandardNth33gt12 + Gtl112*Xtn1 + Gtl211*Xtn1 + Gtl122*Xtn2 + + Gtl212*Xtn2 + Gtl123*Xtn3 + Gtl213*Xtn3); + + CCTK_REAL Rt13 = 0.5*(2*(Gt113*Gtlu111 + Gt123*Gtlu112 + Gt133*Gtlu113 + + Gt213*Gtlu121 + Gt223*Gtlu122 + Gt233*Gtlu123 + Gt111*Gtlu131 + + Gt313*Gtlu131 + Gt112*Gtlu132 + Gt323*Gtlu132 + Gt113*Gtlu133 + + Gt333*Gtlu133 + Gt211*Gtlu231 + Gt212*Gtlu232 + Gt213*Gtlu233 + + Gt111*Gtlu311 + Gt112*Gtlu312 + Gt113*Gtlu313 + Gt211*Gtlu321 + + Gt212*Gtlu322 + Gt213*Gtlu323) + 4*(Gt311*Gtlu331 + Gt312*Gtlu332 + + Gt313*Gtlu333) - gtu11*PDstandardNth11gt13 - + 2*gtu12*PDstandardNth12gt13 - 2*gtu13*PDstandardNth13gt13 + + gt13L*PDstandardNth1Xt1 + gt23L*PDstandardNth1Xt2 + + gt33L*PDstandardNth1Xt3 - gtu22*PDstandardNth22gt13 - + 2*gtu23*PDstandardNth23gt13 - gtu33*PDstandardNth33gt13 + + gt11L*PDstandardNth3Xt1 + gt12L*PDstandardNth3Xt2 + + gt13L*PDstandardNth3Xt3 + Gtl113*Xtn1 + Gtl311*Xtn1 + Gtl123*Xtn2 + + Gtl312*Xtn2 + Gtl133*Xtn3 + Gtl313*Xtn3); + + CCTK_REAL Rt22 = Gt112*(Gtlu121 + 2*Gtlu211) + Gt122*(Gtlu122 + + 2*Gtlu212) + Gt123*(Gtlu123 + 2*Gtlu213) + 3*(Gt212*Gtlu221 + + Gt222*Gtlu222 + Gt223*Gtlu223) + 2*(Gt312*Gtlu231 + Gt322*Gtlu232 + + Gt323*Gtlu233) + Gt312*Gtlu321 + Gt322*Gtlu322 + Gt323*Gtlu323 + + gt12L*PDstandardNth2Xt1 + gt22L*PDstandardNth2Xt2 + + gt23L*PDstandardNth2Xt3 + 0.5*(-(gtu11*PDstandardNth11gt22) - + 2*gtu12*PDstandardNth12gt22 - 2*gtu13*PDstandardNth13gt22 - + gtu22*PDstandardNth22gt22 - 2*gtu23*PDstandardNth23gt22 - + gtu33*PDstandardNth33gt22) + Gtl212*Xtn1 + Gtl222*Xtn2 + Gtl223*Xtn3; + + CCTK_REAL Rt23 = 0.5*(2*(Gt112*Gtlu131 + Gt122*Gtlu132 + Gt123*Gtlu133 + + Gt113*Gtlu211 + Gt123*Gtlu212 + Gt133*Gtlu213 + Gt213*Gtlu221 + + Gt223*Gtlu222 + Gt233*Gtlu223 + Gt212*Gtlu231 + Gt313*Gtlu231 + + Gt222*Gtlu232 + Gt323*Gtlu232 + Gt223*Gtlu233 + Gt333*Gtlu233 + + Gt112*Gtlu311 + Gt122*Gtlu312 + Gt123*Gtlu313 + Gt212*Gtlu321 + + Gt222*Gtlu322 + Gt223*Gtlu323) + 4*(Gt312*Gtlu331 + Gt322*Gtlu332 + + Gt323*Gtlu333) - gtu11*PDstandardNth11gt23 - + 2*gtu12*PDstandardNth12gt23 - 2*gtu13*PDstandardNth13gt23 - + gtu22*PDstandardNth22gt23 - 2*gtu23*PDstandardNth23gt23 + + gt13L*PDstandardNth2Xt1 + gt23L*PDstandardNth2Xt2 + + gt33L*PDstandardNth2Xt3 - gtu33*PDstandardNth33gt23 + + gt12L*PDstandardNth3Xt1 + gt22L*PDstandardNth3Xt2 + + gt23L*PDstandardNth3Xt3 + Gtl213*Xtn1 + Gtl312*Xtn1 + Gtl223*Xtn2 + + Gtl322*Xtn2 + Gtl233*Xtn3 + Gtl323*Xtn3); + + CCTK_REAL Rt33 = Gt113*(Gtlu131 + 2*Gtlu311) + Gt123*(Gtlu132 + + 2*Gtlu312) + Gt133*(Gtlu133 + 2*Gtlu313) + Gt213*(Gtlu231 + 2*Gtlu321) + + Gt223*(Gtlu232 + 2*Gtlu322) + Gt233*(Gtlu233 + 2*Gtlu323) + + 3*(Gt313*Gtlu331 + Gt323*Gtlu332 + Gt333*Gtlu333) + + 0.5*(-(gtu11*PDstandardNth11gt33) - 2*gtu12*PDstandardNth12gt33 - + 2*gtu13*PDstandardNth13gt33 - gtu22*PDstandardNth22gt33 - + 2*gtu23*PDstandardNth23gt33 - gtu33*PDstandardNth33gt33) + + gt13L*PDstandardNth3Xt1 + gt23L*PDstandardNth3Xt2 + + gt33L*PDstandardNth3Xt3 + Gtl313*Xtn1 + Gtl323*Xtn2 + Gtl333*Xtn3; + + CCTK_REAL fac1 = IfThen(ToReal(conformalMethod),-0.5*INV(phiL),1); + + CCTK_REAL cdphi1 = fac1*PDstandardNth1phi; + + CCTK_REAL cdphi2 = fac1*PDstandardNth2phi; + + CCTK_REAL cdphi3 = fac1*PDstandardNth3phi; + + CCTK_REAL fac2 = IfThen(ToReal(conformalMethod),0.5*INV(SQR(phiL)),0); + + CCTK_REAL cdphi211 = -(fac1*(-PDstandardNth11phi + + Gt111*PDstandardNth1phi + Gt211*PDstandardNth2phi + + Gt311*PDstandardNth3phi)) + fac2*SQR(PDstandardNth1phi); + + CCTK_REAL cdphi212 = fac2*PDstandardNth1phi*PDstandardNth2phi - + fac1*(-PDstandardNth12phi + Gt112*PDstandardNth1phi + + Gt212*PDstandardNth2phi + Gt312*PDstandardNth3phi); + + CCTK_REAL cdphi213 = fac2*PDstandardNth1phi*PDstandardNth3phi - + fac1*(-PDstandardNth13phi + Gt113*PDstandardNth1phi + + Gt213*PDstandardNth2phi + Gt313*PDstandardNth3phi); + + CCTK_REAL cdphi222 = -(fac1*(Gt122*PDstandardNth1phi - + PDstandardNth22phi + Gt222*PDstandardNth2phi + + Gt322*PDstandardNth3phi)) + fac2*SQR(PDstandardNth2phi); + + CCTK_REAL cdphi223 = fac2*PDstandardNth2phi*PDstandardNth3phi - + fac1*(Gt123*PDstandardNth1phi - PDstandardNth23phi + + Gt223*PDstandardNth2phi + Gt323*PDstandardNth3phi); + + CCTK_REAL cdphi233 = -(fac1*(Gt133*PDstandardNth1phi + + Gt233*PDstandardNth2phi - PDstandardNth33phi + + Gt333*PDstandardNth3phi)) + fac2*SQR(PDstandardNth3phi); + + CCTK_REAL Rphi11 = -2*(cdphi211 + 2*(-1 + gt11L*gtu11)*SQR(cdphi1) + + gt11L*(cdphi211*gtu11 + 4*(cdphi1*(cdphi2*gtu12 + cdphi3*gtu13) + + cdphi2*cdphi3*gtu23) + cdphi233*gtu33 + gtu22*(cdphi222 + + 2*SQR(cdphi2)) + 2*(cdphi212*gtu12 + cdphi213*gtu13 + cdphi223*gtu23 + + gtu33*SQR(cdphi3)))); + + CCTK_REAL Rphi12 = -2*(cdphi212 + cdphi1*(cdphi2*(-2 + 4*gt12L*gtu12) + + 4*cdphi3*gt12L*gtu13) + gt12L*(cdphi211*gtu11 + 4*cdphi2*cdphi3*gtu23 + + 2*(cdphi212*gtu12 + cdphi213*gtu13 + cdphi223*gtu23 + + gtu11*SQR(cdphi1)) + gtu22*(cdphi222 + 2*SQR(cdphi2)) + gtu33*(cdphi233 + + 2*SQR(cdphi3)))); + + CCTK_REAL Rphi13 = -2*(cdphi213 + cdphi1*(4*cdphi2*gt13L*gtu12 + + cdphi3*(-2 + 4*gt13L*gtu13)) + gt13L*(cdphi211*gtu11 + + 4*cdphi2*cdphi3*gtu23 + 2*(cdphi212*gtu12 + cdphi213*gtu13 + + cdphi223*gtu23 + gtu11*SQR(cdphi1)) + gtu22*(cdphi222 + 2*SQR(cdphi2)) + + gtu33*(cdphi233 + 2*SQR(cdphi3)))); + + CCTK_REAL Rphi22 = -2*(cdphi222 + 2*(-1 + gt22L*gtu22)*SQR(cdphi2) + + gt22L*(cdphi222*gtu22 + 4*(cdphi1*cdphi3*gtu13 + cdphi2*(cdphi1*gtu12 + + cdphi3*gtu23)) + cdphi233*gtu33 + gtu11*(cdphi211 + 2*SQR(cdphi1)) + + 2*(cdphi212*gtu12 + cdphi213*gtu13 + cdphi223*gtu23 + + gtu33*SQR(cdphi3)))); + + CCTK_REAL Rphi23 = -2*(cdphi223 + cdphi2*(4*cdphi1*gt23L*gtu12 + + cdphi3*(-2 + 4*gt23L*gtu23)) + gt23L*(4*cdphi1*cdphi3*gtu13 + + cdphi222*gtu22 + gtu11*(cdphi211 + 2*SQR(cdphi1)) + 2*(cdphi212*gtu12 + + cdphi213*gtu13 + cdphi223*gtu23 + gtu22*SQR(cdphi2)) + gtu33*(cdphi233 + + 2*SQR(cdphi3)))); + + CCTK_REAL Rphi33 = -2*(cdphi233 + gt33L*((4*cdphi1*cdphi2 + + 2*cdphi212)*gtu12 + 4*cdphi3*(cdphi1*gtu13 + cdphi2*gtu23) + + 2*(cdphi213*gtu13 + cdphi223*gtu23) + cdphi233*gtu33 + gtu11*(cdphi211 + + 2*SQR(cdphi1)) + gtu22*(cdphi222 + 2*SQR(cdphi2))) + 2*(-1 + + gt33L*gtu33)*SQR(cdphi3)); + + CCTK_REAL e4phi = + IfThen(ToReal(conformalMethod),INV(SQR(phiL)),exp(4*phiL)); + + CCTK_REAL em4phi = INV(e4phi); + + CCTK_REAL gu11 = em4phi*gtu11; + + CCTK_REAL gu12 = em4phi*gtu12; + + CCTK_REAL gu13 = em4phi*gtu13; + + CCTK_REAL gu22 = em4phi*gtu22; + + CCTK_REAL gu23 = em4phi*gtu23; + + CCTK_REAL gu33 = em4phi*gtu33; + + CCTK_REAL R11 = Rphi11 + Rt11; + + CCTK_REAL R12 = Rphi12 + Rt12; + + CCTK_REAL R13 = Rphi13 + Rt13; + + CCTK_REAL R22 = Rphi22 + Rt22; + + CCTK_REAL R23 = Rphi23 + Rt23; + + CCTK_REAL R33 = Rphi33 + Rt33; + + CCTK_REAL trR = gu11*R11 + gu22*R22 + 2*(gu12*R12 + gu13*R13 + + gu23*R23) + gu33*R33; + + CCTK_REAL Atm11 = At11L*gtu11 + At12L*gtu12 + At13L*gtu13; + + CCTK_REAL Atm21 = At11L*gtu12 + At12L*gtu22 + At13L*gtu23; + + CCTK_REAL Atm31 = At11L*gtu13 + At12L*gtu23 + At13L*gtu33; + + CCTK_REAL Atm12 = At12L*gtu11 + At22L*gtu12 + At23L*gtu13; + + CCTK_REAL Atm22 = At12L*gtu12 + At22L*gtu22 + At23L*gtu23; + + CCTK_REAL Atm32 = At12L*gtu13 + At22L*gtu23 + At23L*gtu33; + + CCTK_REAL Atm13 = At13L*gtu11 + At23L*gtu12 + At33L*gtu13; + + CCTK_REAL Atm23 = At13L*gtu12 + At23L*gtu22 + At33L*gtu23; + + CCTK_REAL Atm33 = At13L*gtu13 + At23L*gtu23 + At33L*gtu33; + + CCTK_REAL rho = INV(SQR(alphaL))*(eTttL - 2*(beta2L*eTtyL + + beta3L*eTtzL) + 2*(beta1L*(-eTtxL + beta2L*eTxyL + beta3L*eTxzL) + + beta2L*beta3L*eTyzL) + eTxxL*SQR(beta1L) + eTyyL*SQR(beta2L) + + eTzzL*SQR(beta3L)); + + CCTK_REAL HL = -2.*(Atm12*Atm21 + Atm13*Atm31 + Atm23*Atm32) - + 50.26548245743669181540229413247204614715*rho + trR - 1.*(SQR(Atm11) + + SQR(Atm22) + SQR(Atm33)) + + 0.6666666666666666666666666666666666666667*SQR(trKL); + + + /* Copy local copies back to grid functions */ + H[index] = HL; + } + LC_ENDLOOP3 (ML_BSSN_UPW_constraints1); +} + +extern "C" void ML_BSSN_UPW_constraints1(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverInterior(cctkGH, &ML_BSSN_UPW_constraints1_Body); +} diff --git a/ML_BSSN_UPW/src/ML_BSSN_UPW_constraints2.cc b/ML_BSSN_UPW/src/ML_BSSN_UPW_constraints2.cc new file mode 100644 index 0000000..aa6f1a0 --- /dev/null +++ b/ML_BSSN_UPW/src/ML_BSSN_UPW_constraints2.cc @@ -0,0 +1,388 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +extern "C" void ML_BSSN_UPW_constraints2_SelectBCs(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT ierr = 0; + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_UPW::ML_cons_detg","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_UPW::ML_cons_detg."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_UPW::ML_cons_Gamma","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_UPW::ML_cons_Gamma."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_UPW::ML_cons_traceA","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_UPW::ML_cons_traceA."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_UPW::ML_mom","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_UPW::ML_mom."); + return; +} + +static void ML_BSSN_UPW_constraints2_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_BSSN_UPW_constraints2_Body"); + } + + if (cctk_iteration % ML_BSSN_UPW_constraints2_calc_every != ML_BSSN_UPW_constraints2_calc_offset) + { + return; + } + + const char *groups[] = {"ML_BSSN_UPW::ML_cons_detg","ML_BSSN_UPW::ML_cons_Gamma","ML_BSSN_UPW::ML_cons_traceA","ML_BSSN_UPW::ML_curv","ML_BSSN_UPW::ML_Gamma","ML_BSSN_UPW::ML_lapse","ML_BSSN_UPW::ML_log_confac","ML_BSSN_UPW::ML_metric","ML_BSSN_UPW::ML_mom","ML_BSSN_UPW::ML_shift","ML_BSSN_UPW::ML_trace_curv"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_BSSN_UPW_constraints2", 11, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o12dx = 0.0833333333333333333333333333333*INV(dx); + CCTK_REAL const p1o12dy = 0.0833333333333333333333333333333*INV(dy); + CCTK_REAL const p1o12dz = 0.0833333333333333333333333333333*INV(dz); + CCTK_REAL const p1o144dxdy = 0.00694444444444444444444444444444*INV(dx)*INV(dy); + CCTK_REAL const p1o144dxdz = 0.00694444444444444444444444444444*INV(dx)*INV(dz); + CCTK_REAL const p1o144dydz = 0.00694444444444444444444444444444*INV(dy)*INV(dz); + CCTK_REAL const p1o24dx = 0.0416666666666666666666666666667*INV(dx); + CCTK_REAL const p1o24dy = 0.0416666666666666666666666666667*INV(dy); + CCTK_REAL const p1o24dz = 0.0416666666666666666666666666667*INV(dz); + CCTK_REAL const p1o64dx = 0.015625*INV(dx); + CCTK_REAL const p1o64dy = 0.015625*INV(dy); + CCTK_REAL const p1o64dz = 0.015625*INV(dz); + CCTK_REAL const p1odx = INV(dx); + CCTK_REAL const p1ody = INV(dy); + CCTK_REAL const p1odz = INV(dz); + CCTK_REAL const pm1o12dx2 = -0.0833333333333333333333333333333*INV(SQR(dx)); + CCTK_REAL const pm1o12dy2 = -0.0833333333333333333333333333333*INV(SQR(dy)); + CCTK_REAL const pm1o12dz2 = -0.0833333333333333333333333333333*INV(SQR(dz)); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_BSSN_UPW_constraints2, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + CCTK_REAL alphaL = alpha[index]; + CCTK_REAL At11L = At11[index]; + CCTK_REAL At12L = At12[index]; + CCTK_REAL At13L = At13[index]; + CCTK_REAL At22L = At22[index]; + CCTK_REAL At23L = At23[index]; + CCTK_REAL At33L = At33[index]; + CCTK_REAL beta1L = beta1[index]; + CCTK_REAL beta2L = beta2[index]; + CCTK_REAL beta3L = beta3[index]; + CCTK_REAL eTtxL = (*stress_energy_state) ? eTtx[index] : ToReal(0.0); + CCTK_REAL eTtyL = (*stress_energy_state) ? eTty[index] : ToReal(0.0); + CCTK_REAL eTtzL = (*stress_energy_state) ? eTtz[index] : ToReal(0.0); + CCTK_REAL eTxxL = (*stress_energy_state) ? eTxx[index] : ToReal(0.0); + CCTK_REAL eTxyL = (*stress_energy_state) ? eTxy[index] : ToReal(0.0); + CCTK_REAL eTxzL = (*stress_energy_state) ? eTxz[index] : ToReal(0.0); + CCTK_REAL eTyyL = (*stress_energy_state) ? eTyy[index] : ToReal(0.0); + CCTK_REAL eTyzL = (*stress_energy_state) ? eTyz[index] : ToReal(0.0); + CCTK_REAL eTzzL = (*stress_energy_state) ? eTzz[index] : ToReal(0.0); + CCTK_REAL gt11L = gt11[index]; + CCTK_REAL gt12L = gt12[index]; + CCTK_REAL gt13L = gt13[index]; + CCTK_REAL gt22L = gt22[index]; + CCTK_REAL gt23L = gt23[index]; + CCTK_REAL gt33L = gt33[index]; + CCTK_REAL phiL = phi[index]; + CCTK_REAL trKL = trK[index]; + CCTK_REAL Xt1L = Xt1[index]; + CCTK_REAL Xt2L = Xt2[index]; + CCTK_REAL Xt3L = Xt3[index]; + + /* Include user supplied include files */ + + /* Precompute derivatives */ + CCTK_REAL const PDstandardNth1At11 = PDstandardNth1(&At11[index]); + CCTK_REAL const PDstandardNth2At11 = PDstandardNth2(&At11[index]); + CCTK_REAL const PDstandardNth3At11 = PDstandardNth3(&At11[index]); + CCTK_REAL const PDstandardNth1At12 = PDstandardNth1(&At12[index]); + CCTK_REAL const PDstandardNth2At12 = PDstandardNth2(&At12[index]); + CCTK_REAL const PDstandardNth3At12 = PDstandardNth3(&At12[index]); + CCTK_REAL const PDstandardNth1At13 = PDstandardNth1(&At13[index]); + CCTK_REAL const PDstandardNth2At13 = PDstandardNth2(&At13[index]); + CCTK_REAL const PDstandardNth3At13 = PDstandardNth3(&At13[index]); + CCTK_REAL const PDstandardNth1At22 = PDstandardNth1(&At22[index]); + CCTK_REAL const PDstandardNth2At22 = PDstandardNth2(&At22[index]); + CCTK_REAL const PDstandardNth3At22 = PDstandardNth3(&At22[index]); + CCTK_REAL const PDstandardNth1At23 = PDstandardNth1(&At23[index]); + CCTK_REAL const PDstandardNth2At23 = PDstandardNth2(&At23[index]); + CCTK_REAL const PDstandardNth3At23 = PDstandardNth3(&At23[index]); + CCTK_REAL const PDstandardNth1At33 = PDstandardNth1(&At33[index]); + CCTK_REAL const PDstandardNth2At33 = PDstandardNth2(&At33[index]); + CCTK_REAL const PDstandardNth3At33 = PDstandardNth3(&At33[index]); + CCTK_REAL const PDstandardNth1gt11 = PDstandardNth1(>11[index]); + CCTK_REAL const PDstandardNth2gt11 = PDstandardNth2(>11[index]); + CCTK_REAL const PDstandardNth3gt11 = PDstandardNth3(>11[index]); + CCTK_REAL const PDstandardNth1gt12 = PDstandardNth1(>12[index]); + CCTK_REAL const PDstandardNth2gt12 = PDstandardNth2(>12[index]); + CCTK_REAL const PDstandardNth3gt12 = PDstandardNth3(>12[index]); + CCTK_REAL const PDstandardNth1gt13 = PDstandardNth1(>13[index]); + CCTK_REAL const PDstandardNth2gt13 = PDstandardNth2(>13[index]); + CCTK_REAL const PDstandardNth3gt13 = PDstandardNth3(>13[index]); + CCTK_REAL const PDstandardNth1gt22 = PDstandardNth1(>22[index]); + CCTK_REAL const PDstandardNth2gt22 = PDstandardNth2(>22[index]); + CCTK_REAL const PDstandardNth3gt22 = PDstandardNth3(>22[index]); + CCTK_REAL const PDstandardNth1gt23 = PDstandardNth1(>23[index]); + CCTK_REAL const PDstandardNth2gt23 = PDstandardNth2(>23[index]); + CCTK_REAL const PDstandardNth3gt23 = PDstandardNth3(>23[index]); + CCTK_REAL const PDstandardNth1gt33 = PDstandardNth1(>33[index]); + CCTK_REAL const PDstandardNth2gt33 = PDstandardNth2(>33[index]); + CCTK_REAL const PDstandardNth3gt33 = PDstandardNth3(>33[index]); + CCTK_REAL const PDstandardNth1phi = PDstandardNth1(&phi[index]); + CCTK_REAL const PDstandardNth2phi = PDstandardNth2(&phi[index]); + CCTK_REAL const PDstandardNth3phi = PDstandardNth3(&phi[index]); + CCTK_REAL const PDstandardNth1trK = PDstandardNth1(&trK[index]); + CCTK_REAL const PDstandardNth2trK = PDstandardNth2(&trK[index]); + CCTK_REAL const PDstandardNth3trK = PDstandardNth3(&trK[index]); + + /* Calculate temporaries and grid functions */ + CCTK_REAL detgt = 1; + + CCTK_REAL gtu11 = INV(detgt)*(gt22L*gt33L - SQR(gt23L)); + + CCTK_REAL gtu12 = (gt13L*gt23L - gt12L*gt33L)*INV(detgt); + + CCTK_REAL gtu13 = (-(gt13L*gt22L) + gt12L*gt23L)*INV(detgt); + + CCTK_REAL gtu22 = INV(detgt)*(gt11L*gt33L - SQR(gt13L)); + + CCTK_REAL gtu23 = (gt12L*gt13L - gt11L*gt23L)*INV(detgt); + + CCTK_REAL gtu33 = INV(detgt)*(gt11L*gt22L - SQR(gt12L)); + + CCTK_REAL Gtl111 = 0.5*PDstandardNth1gt11; + + CCTK_REAL Gtl112 = 0.5*PDstandardNth2gt11; + + CCTK_REAL Gtl113 = 0.5*PDstandardNth3gt11; + + CCTK_REAL Gtl122 = -0.5*PDstandardNth1gt22 + PDstandardNth2gt12; + + CCTK_REAL Gtl123 = 0.5*(-PDstandardNth1gt23 + PDstandardNth2gt13 + + PDstandardNth3gt12); + + CCTK_REAL Gtl133 = -0.5*PDstandardNth1gt33 + PDstandardNth3gt13; + + CCTK_REAL Gtl211 = PDstandardNth1gt12 - 0.5*PDstandardNth2gt11; + + CCTK_REAL Gtl212 = 0.5*PDstandardNth1gt22; + + CCTK_REAL Gtl213 = 0.5*(PDstandardNth1gt23 - PDstandardNth2gt13 + + PDstandardNth3gt12); + + CCTK_REAL Gtl222 = 0.5*PDstandardNth2gt22; + + CCTK_REAL Gtl223 = 0.5*PDstandardNth3gt22; + + CCTK_REAL Gtl233 = -0.5*PDstandardNth2gt33 + PDstandardNth3gt23; + + CCTK_REAL Gtl311 = PDstandardNth1gt13 - 0.5*PDstandardNth3gt11; + + CCTK_REAL Gtl312 = 0.5*(PDstandardNth1gt23 + PDstandardNth2gt13 - + PDstandardNth3gt12); + + CCTK_REAL Gtl313 = 0.5*PDstandardNth1gt33; + + CCTK_REAL Gtl322 = PDstandardNth2gt23 - 0.5*PDstandardNth3gt22; + + CCTK_REAL Gtl323 = 0.5*PDstandardNth2gt33; + + CCTK_REAL Gtl333 = 0.5*PDstandardNth3gt33; + + CCTK_REAL Gt111 = Gtl111*gtu11 + Gtl211*gtu12 + Gtl311*gtu13; + + CCTK_REAL Gt211 = Gtl111*gtu12 + Gtl211*gtu22 + Gtl311*gtu23; + + CCTK_REAL Gt311 = Gtl111*gtu13 + Gtl211*gtu23 + Gtl311*gtu33; + + CCTK_REAL Gt112 = Gtl112*gtu11 + Gtl212*gtu12 + Gtl312*gtu13; + + CCTK_REAL Gt212 = Gtl112*gtu12 + Gtl212*gtu22 + Gtl312*gtu23; + + CCTK_REAL Gt312 = Gtl112*gtu13 + Gtl212*gtu23 + Gtl312*gtu33; + + CCTK_REAL Gt113 = Gtl113*gtu11 + Gtl213*gtu12 + Gtl313*gtu13; + + CCTK_REAL Gt213 = Gtl113*gtu12 + Gtl213*gtu22 + Gtl313*gtu23; + + CCTK_REAL Gt313 = Gtl113*gtu13 + Gtl213*gtu23 + Gtl313*gtu33; + + CCTK_REAL Gt122 = Gtl122*gtu11 + Gtl222*gtu12 + Gtl322*gtu13; + + CCTK_REAL Gt222 = Gtl122*gtu12 + Gtl222*gtu22 + Gtl322*gtu23; + + CCTK_REAL Gt322 = Gtl122*gtu13 + Gtl222*gtu23 + Gtl322*gtu33; + + CCTK_REAL Gt123 = Gtl123*gtu11 + Gtl223*gtu12 + Gtl323*gtu13; + + CCTK_REAL Gt223 = Gtl123*gtu12 + Gtl223*gtu22 + Gtl323*gtu23; + + CCTK_REAL Gt323 = Gtl123*gtu13 + Gtl223*gtu23 + Gtl323*gtu33; + + CCTK_REAL Gt133 = Gtl133*gtu11 + Gtl233*gtu12 + Gtl333*gtu13; + + CCTK_REAL Gt233 = Gtl133*gtu12 + Gtl233*gtu22 + Gtl333*gtu23; + + CCTK_REAL Gt333 = Gtl133*gtu13 + Gtl233*gtu23 + Gtl333*gtu33; + + CCTK_REAL fac1 = IfThen(ToReal(conformalMethod),-0.5*INV(phiL),1); + + CCTK_REAL cdphi1 = fac1*PDstandardNth1phi; + + CCTK_REAL cdphi2 = fac1*PDstandardNth2phi; + + CCTK_REAL cdphi3 = fac1*PDstandardNth3phi; + + CCTK_REAL S1 = (-eTtxL + beta1L*eTxxL + beta2L*eTxyL + + beta3L*eTxzL)*INV(alphaL); + + CCTK_REAL S2 = (-eTtyL + beta1L*eTxyL + beta2L*eTyyL + + beta3L*eTyzL)*INV(alphaL); + + CCTK_REAL S3 = (-eTtzL + beta1L*eTxzL + beta2L*eTyzL + + beta3L*eTzzL)*INV(alphaL); + + CCTK_REAL M1L = -2.*((At12L*Gt211 + At13L*Gt311)*gtu11 + + At11L*Gt123*gtu23) + At12L*((6.*cdphi1 - 1.*Gt111)*gtu12 - + 3.*Gt213*gtu13 + 6.*(cdphi2*gtu22 + cdphi3*gtu23) - 1.*Gt233*gtu33) - + 1.*((At22L*Gt212 + At12L*(Gt112 + Gt222) + At23L*Gt312)*gtu22 + + (At13L*Gt112 + At12L*Gt113 + At23L*Gt212)*gtu23 + (At13L*Gt113 + + At23L*Gt213 + At33L*Gt313)*gtu33) + At11L*((6.*cdphi1 - 2.*Gt111)*gtu11 + + 6.*(cdphi2*gtu12 + cdphi3*gtu13) - 1.*(Gt122*gtu22 + Gt133*gtu33)) + + At13L*((6.*cdphi1 - 1.*Gt111)*gtu13 + 6.*(cdphi2*gtu23 + cdphi3*gtu33) + - 1.*(Gt322*gtu22 + Gt333*gtu33)) + gtu11*PDstandardNth1At11 - + 0.6666666666666666666666666666666666666667*PDstandardNth1trK + + gtu12*(-1.*(At22L*Gt211 + At23L*Gt311) - 3.*(At11L*Gt112 + At12L*Gt212 + + At13L*Gt312) + PDstandardNth1At12 + PDstandardNth2At11) + + gtu22*PDstandardNth2At12 + gtu13*(-1.*(At23L*Gt211 + At33L*Gt311) - + 3.*(At11L*Gt113 + At13L*Gt313) + PDstandardNth1At13 + + PDstandardNth3At11) + gtu23*(-1.*(At22L*Gt213 + At33L*Gt312 + + At23L*Gt313) - 2.*(At12L*Gt223 + At13L*Gt323) + PDstandardNth2At13 + + PDstandardNth3At12) + gtu33*PDstandardNth3At13 - + 25.13274122871834590770114706623602307358*S1; + + CCTK_REAL M2L = At12L*((6.*cdphi1 - 1.*Gt111)*gtu11 + 6.*(cdphi2*gtu12 + + cdphi3*gtu13) - 2.*Gt122*gtu22 - 3.*Gt123*gtu23 - 1.*Gt133*gtu33) + + At22L*((6.*cdphi2 - 2.*Gt222)*gtu22 + 6.*cdphi3*gtu23 - 1.*Gt233*gtu33) + + At23L*(-2.*Gt322*gtu22 - 1.*Gt333*gtu33 + 6.*(cdphi2*gtu23 + + cdphi3*gtu33)) - 1.*((At11L*Gt112 + At22L*Gt211 + At12L*Gt212 + + At23L*Gt311 + At13L*Gt312)*gtu11 + Gt122*(At11L*gtu12 + At13L*gtu23) + + (At23L*Gt223 + At33L*Gt323)*gtu33 + At13L*(Gt112*gtu13 + Gt123*gtu33)) + + gtu11*PDstandardNth1At12 + gtu12*(At22L*(6.*cdphi1 - 3.*Gt212) + + At12L*(-3.*Gt112 - 1.*Gt222) - 3.*At23L*Gt312 - 1.*At13L*Gt322 + + PDstandardNth1At22 + PDstandardNth2At12) + gtu22*PDstandardNth2At22 - + 0.6666666666666666666666666666666666666667*PDstandardNth2trK + + gtu13*(-2.*(At12L*Gt113 + At22L*Gt213) + At23L*(6.*cdphi1 - 1.*Gt212 - + 2.*Gt313) - 1.*(At11L*Gt123 + At12L*Gt223 + At33L*Gt312 + At13L*Gt323) + + PDstandardNth1At23 + PDstandardNth3At12) + gtu23*(-1.*(At23L*Gt222 + + At33L*Gt322) - 3.*(At22L*Gt223 + At23L*Gt323) + PDstandardNth2At23 + + PDstandardNth3At22) + gtu33*PDstandardNth3At23 - + 25.13274122871834590770114706623602307358*S2; + + CCTK_REAL M3L = -1.*((At11L*Gt113 + At23L*Gt211 + At12L*Gt213 + + At33L*Gt311)*gtu11 + (At22L*Gt223 + At33L*Gt322 + At23L*Gt323)*gtu22 + + At12L*(Gt113*gtu12 + Gt123*gtu22) + Gt133*(At11L*gtu13 + At12L*gtu23)) + + At13L*((6.*cdphi1 - 1.*(Gt111 + Gt313))*gtu11 + 6.*(cdphi2*gtu12 + + cdphi3*gtu13) - 1.*Gt122*gtu22 - 3.*Gt123*gtu23 - 2.*Gt133*gtu33) + + At23L*((6.*cdphi2 - 1.*Gt222)*gtu22 + 6.*cdphi3*gtu23 - 2.*Gt233*gtu33) + + gtu11*PDstandardNth1At13 + gtu12*(-2.*(At13L*Gt112 + At33L*Gt312) + + At23L*(6.*cdphi1 - 2.*Gt212 - 1.*Gt313) - 1.*(At11L*Gt123 + At22L*Gt213 + + At12L*Gt223 + At13L*Gt323) + PDstandardNth1At23 + PDstandardNth2At13) + + gtu22*PDstandardNth2At23 + gtu13*(-3.*(At13L*Gt113 + At23L*Gt213) + + At33L*(6.*cdphi1 - 3.*Gt313) - 1.*(At12L*Gt233 + At13L*Gt333) + + PDstandardNth1At33 + PDstandardNth3At13) + gtu23*(-1.*At22L*Gt233 + + At33L*(6.*cdphi2 - 3.*Gt323) + At23L*(-3.*Gt223 - 1.*Gt333) + + PDstandardNth2At33 + PDstandardNth3At23) + gtu33*(At33L*(6.*cdphi3 - + 2.*Gt333) + PDstandardNth3At33) - + 0.6666666666666666666666666666666666666667*PDstandardNth3trK - + 25.13274122871834590770114706623602307358*S3; + + CCTK_REAL cSL = Log(detgt); + + CCTK_REAL cXt1L = Gt111*gtu11 + Gt122*gtu22 + 2*(Gt112*gtu12 + + Gt113*gtu13 + Gt123*gtu23) + Gt133*gtu33 - Xt1L; + + CCTK_REAL cXt2L = Gt211*gtu11 + Gt222*gtu22 + 2*(Gt212*gtu12 + + Gt213*gtu13 + Gt223*gtu23) + Gt233*gtu33 - Xt2L; + + CCTK_REAL cXt3L = Gt311*gtu11 + Gt322*gtu22 + 2*(Gt312*gtu12 + + Gt313*gtu13 + Gt323*gtu23) + Gt333*gtu33 - Xt3L; + + CCTK_REAL cAL = At11L*gtu11 + At22L*gtu22 + 2*(At12L*gtu12 + + At13L*gtu13 + At23L*gtu23) + At33L*gtu33; + + + /* Copy local copies back to grid functions */ + cA[index] = cAL; + cS[index] = cSL; + cXt1[index] = cXt1L; + cXt2[index] = cXt2L; + cXt3[index] = cXt3L; + M1[index] = M1L; + M2[index] = M2L; + M3[index] = M3L; + } + LC_ENDLOOP3 (ML_BSSN_UPW_constraints2); +} + +extern "C" void ML_BSSN_UPW_constraints2(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverInterior(cctkGH, &ML_BSSN_UPW_constraints2_Body); +} diff --git a/ML_BSSN_UPW/src/ML_BSSN_UPW_convertFromADMBase.cc b/ML_BSSN_UPW/src/ML_BSSN_UPW_convertFromADMBase.cc new file mode 100644 index 0000000..965cb8f --- /dev/null +++ b/ML_BSSN_UPW/src/ML_BSSN_UPW_convertFromADMBase.cc @@ -0,0 +1,222 @@ +/* File produced by Kranc */ + +#define KRANC_C + +#include <assert.h> +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include "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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +static void ML_BSSN_UPW_convertFromADMBase_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_BSSN_UPW_convertFromADMBase_Body"); + } + + if (cctk_iteration % ML_BSSN_UPW_convertFromADMBase_calc_every != ML_BSSN_UPW_convertFromADMBase_calc_offset) + { + return; + } + + const char *groups[] = {"ADMBase::curv","ADMBase::lapse","ADMBase::metric","ADMBase::shift","ML_BSSN_UPW::ML_curv","ML_BSSN_UPW::ML_lapse","ML_BSSN_UPW::ML_log_confac","ML_BSSN_UPW::ML_metric","ML_BSSN_UPW::ML_shift","ML_BSSN_UPW::ML_trace_curv"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_BSSN_UPW_convertFromADMBase", 10, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o12dx = 0.0833333333333333333333333333333*INV(dx); + CCTK_REAL const p1o12dy = 0.0833333333333333333333333333333*INV(dy); + CCTK_REAL const p1o12dz = 0.0833333333333333333333333333333*INV(dz); + CCTK_REAL const p1o144dxdy = 0.00694444444444444444444444444444*INV(dx)*INV(dy); + CCTK_REAL const p1o144dxdz = 0.00694444444444444444444444444444*INV(dx)*INV(dz); + CCTK_REAL const p1o144dydz = 0.00694444444444444444444444444444*INV(dy)*INV(dz); + CCTK_REAL const p1o24dx = 0.0416666666666666666666666666667*INV(dx); + CCTK_REAL const p1o24dy = 0.0416666666666666666666666666667*INV(dy); + CCTK_REAL const p1o24dz = 0.0416666666666666666666666666667*INV(dz); + CCTK_REAL const p1o64dx = 0.015625*INV(dx); + CCTK_REAL const p1o64dy = 0.015625*INV(dy); + CCTK_REAL const p1o64dz = 0.015625*INV(dz); + CCTK_REAL const p1odx = INV(dx); + CCTK_REAL const p1ody = INV(dy); + CCTK_REAL const p1odz = INV(dz); + CCTK_REAL const pm1o12dx2 = -0.0833333333333333333333333333333*INV(SQR(dx)); + CCTK_REAL const pm1o12dy2 = -0.0833333333333333333333333333333*INV(SQR(dy)); + CCTK_REAL const pm1o12dz2 = -0.0833333333333333333333333333333*INV(SQR(dz)); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_BSSN_UPW_convertFromADMBase, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + CCTK_REAL alpL = alp[index]; + CCTK_REAL betaxL = betax[index]; + CCTK_REAL betayL = betay[index]; + CCTK_REAL betazL = betaz[index]; + CCTK_REAL gxxL = gxx[index]; + CCTK_REAL gxyL = gxy[index]; + CCTK_REAL gxzL = gxz[index]; + CCTK_REAL gyyL = gyy[index]; + CCTK_REAL gyzL = gyz[index]; + CCTK_REAL gzzL = gzz[index]; + CCTK_REAL kxxL = kxx[index]; + CCTK_REAL kxyL = kxy[index]; + CCTK_REAL kxzL = kxz[index]; + CCTK_REAL kyyL = kyy[index]; + CCTK_REAL kyzL = kyz[index]; + CCTK_REAL kzzL = kzz[index]; + CCTK_REAL phiL = phi[index]; + CCTK_REAL trKL = trK[index]; + + /* Include user supplied include files */ + + /* Precompute derivatives */ + + /* Calculate temporaries and grid functions */ + CCTK_REAL g11 = gxxL; + + CCTK_REAL g12 = gxyL; + + CCTK_REAL g13 = gxzL; + + CCTK_REAL g22 = gyyL; + + CCTK_REAL g23 = gyzL; + + CCTK_REAL g33 = gzzL; + + CCTK_REAL detg = 2*g12*g13*g23 + g33*(g11*g22 - SQR(g12)) - + g22*SQR(g13) - g11*SQR(g23); + + CCTK_REAL gu11 = INV(detg)*(g22*g33 - SQR(g23)); + + CCTK_REAL gu12 = (g13*g23 - g12*g33)*INV(detg); + + CCTK_REAL gu13 = (-(g13*g22) + g12*g23)*INV(detg); + + CCTK_REAL gu22 = INV(detg)*(g11*g33 - SQR(g13)); + + CCTK_REAL gu23 = (g12*g13 - g11*g23)*INV(detg); + + CCTK_REAL gu33 = INV(detg)*(g11*g22 - SQR(g12)); + + phiL = + IfThen(ToReal(conformalMethod),pow(detg,-0.166666666666666666666666666667),0.0833333333333333333333333333333*Log(detg)); + + CCTK_REAL em4phi = + IfThen(ToReal(conformalMethod),SQR(phiL),exp(-4*phiL)); + + CCTK_REAL gt11L = em4phi*g11; + + CCTK_REAL gt12L = em4phi*g12; + + CCTK_REAL gt13L = em4phi*g13; + + CCTK_REAL gt22L = em4phi*g22; + + CCTK_REAL gt23L = em4phi*g23; + + CCTK_REAL gt33L = em4phi*g33; + + trKL = gu11*kxxL + gu22*kyyL + 2*(gu12*kxyL + gu13*kxzL + gu23*kyzL) + + gu33*kzzL; + + CCTK_REAL At11L = em4phi*(kxxL - + 0.333333333333333333333333333333*g11*trKL); + + CCTK_REAL At12L = em4phi*(kxyL - + 0.333333333333333333333333333333*g12*trKL); + + CCTK_REAL At13L = em4phi*(kxzL - + 0.333333333333333333333333333333*g13*trKL); + + CCTK_REAL At22L = em4phi*(kyyL - + 0.333333333333333333333333333333*g22*trKL); + + CCTK_REAL At23L = em4phi*(kyzL - + 0.333333333333333333333333333333*g23*trKL); + + CCTK_REAL At33L = em4phi*(kzzL - + 0.333333333333333333333333333333*g33*trKL); + + CCTK_REAL alphaL = alpL; + + CCTK_REAL beta1L = betaxL; + + CCTK_REAL beta2L = betayL; + + CCTK_REAL beta3L = betazL; + + + /* Copy local copies back to grid functions */ + alpha[index] = alphaL; + At11[index] = At11L; + At12[index] = At12L; + At13[index] = At13L; + At22[index] = At22L; + At23[index] = At23L; + At33[index] = At33L; + beta1[index] = beta1L; + beta2[index] = beta2L; + beta3[index] = beta3L; + gt11[index] = gt11L; + gt12[index] = gt12L; + gt13[index] = gt13L; + gt22[index] = gt22L; + gt23[index] = gt23L; + gt33[index] = gt33L; + phi[index] = phiL; + trK[index] = trKL; + } + LC_ENDLOOP3 (ML_BSSN_UPW_convertFromADMBase); +} + +extern "C" void ML_BSSN_UPW_convertFromADMBase(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverEverything(cctkGH, &ML_BSSN_UPW_convertFromADMBase_Body); +} diff --git a/ML_BSSN_UPW/src/ML_BSSN_UPW_convertFromADMBaseGamma.cc b/ML_BSSN_UPW/src/ML_BSSN_UPW_convertFromADMBaseGamma.cc new file mode 100644 index 0000000..f2b5b8c --- /dev/null +++ b/ML_BSSN_UPW/src/ML_BSSN_UPW_convertFromADMBaseGamma.cc @@ -0,0 +1,298 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +extern "C" void ML_BSSN_UPW_convertFromADMBaseGamma_SelectBCs(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT ierr = 0; + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_UPW::ML_dtlapse","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_UPW::ML_dtlapse."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_UPW::ML_dtshift","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_UPW::ML_dtshift."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_BSSN_UPW::ML_Gamma","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_BSSN_UPW::ML_Gamma."); + return; +} + +static void ML_BSSN_UPW_convertFromADMBaseGamma_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_BSSN_UPW_convertFromADMBaseGamma_Body"); + } + + if (cctk_iteration % ML_BSSN_UPW_convertFromADMBaseGamma_calc_every != ML_BSSN_UPW_convertFromADMBaseGamma_calc_offset) + { + return; + } + + const char *groups[] = {"ADMBase::dtlapse","ADMBase::dtshift","grid::coordinates","Grid::coordinates","ML_BSSN_UPW::ML_dtlapse","ML_BSSN_UPW::ML_dtshift","ML_BSSN_UPW::ML_Gamma","ML_BSSN_UPW::ML_lapse","ML_BSSN_UPW::ML_metric","ML_BSSN_UPW::ML_shift"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_BSSN_UPW_convertFromADMBaseGamma", 10, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o12dx = 0.0833333333333333333333333333333*INV(dx); + CCTK_REAL const p1o12dy = 0.0833333333333333333333333333333*INV(dy); + CCTK_REAL const p1o12dz = 0.0833333333333333333333333333333*INV(dz); + CCTK_REAL const p1o144dxdy = 0.00694444444444444444444444444444*INV(dx)*INV(dy); + CCTK_REAL const p1o144dxdz = 0.00694444444444444444444444444444*INV(dx)*INV(dz); + CCTK_REAL const p1o144dydz = 0.00694444444444444444444444444444*INV(dy)*INV(dz); + CCTK_REAL const p1o24dx = 0.0416666666666666666666666666667*INV(dx); + CCTK_REAL const p1o24dy = 0.0416666666666666666666666666667*INV(dy); + CCTK_REAL const p1o24dz = 0.0416666666666666666666666666667*INV(dz); + CCTK_REAL const p1o64dx = 0.015625*INV(dx); + CCTK_REAL const p1o64dy = 0.015625*INV(dy); + CCTK_REAL const p1o64dz = 0.015625*INV(dz); + CCTK_REAL const p1odx = INV(dx); + CCTK_REAL const p1ody = INV(dy); + CCTK_REAL const p1odz = INV(dz); + CCTK_REAL const pm1o12dx2 = -0.0833333333333333333333333333333*INV(SQR(dx)); + CCTK_REAL const pm1o12dy2 = -0.0833333333333333333333333333333*INV(SQR(dy)); + CCTK_REAL const pm1o12dz2 = -0.0833333333333333333333333333333*INV(SQR(dz)); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_BSSN_UPW_convertFromADMBaseGamma, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + CCTK_REAL alphaL = alpha[index]; + CCTK_REAL beta1L = beta1[index]; + CCTK_REAL beta2L = beta2[index]; + CCTK_REAL beta3L = beta3[index]; + CCTK_REAL dtalpL = dtalp[index]; + CCTK_REAL dtbetaxL = dtbetax[index]; + CCTK_REAL dtbetayL = dtbetay[index]; + CCTK_REAL dtbetazL = dtbetaz[index]; + CCTK_REAL gt11L = gt11[index]; + CCTK_REAL gt12L = gt12[index]; + CCTK_REAL gt13L = gt13[index]; + CCTK_REAL gt22L = gt22[index]; + CCTK_REAL gt23L = gt23[index]; + CCTK_REAL gt33L = gt33[index]; + CCTK_REAL rL = r[index]; + + /* Include user supplied include files */ + + /* Precompute derivatives */ + CCTK_REAL const PDstandardNth1gt11 = PDstandardNth1(>11[index]); + CCTK_REAL const PDstandardNth2gt11 = PDstandardNth2(>11[index]); + CCTK_REAL const PDstandardNth3gt11 = PDstandardNth3(>11[index]); + CCTK_REAL const PDstandardNth1gt12 = PDstandardNth1(>12[index]); + CCTK_REAL const PDstandardNth2gt12 = PDstandardNth2(>12[index]); + CCTK_REAL const PDstandardNth3gt12 = PDstandardNth3(>12[index]); + CCTK_REAL const PDstandardNth1gt13 = PDstandardNth1(>13[index]); + CCTK_REAL const PDstandardNth2gt13 = PDstandardNth2(>13[index]); + CCTK_REAL const PDstandardNth3gt13 = PDstandardNth3(>13[index]); + CCTK_REAL const PDstandardNth1gt22 = PDstandardNth1(>22[index]); + CCTK_REAL const PDstandardNth2gt22 = PDstandardNth2(>22[index]); + CCTK_REAL const PDstandardNth3gt22 = PDstandardNth3(>22[index]); + CCTK_REAL const PDstandardNth1gt23 = PDstandardNth1(>23[index]); + CCTK_REAL const PDstandardNth2gt23 = PDstandardNth2(>23[index]); + CCTK_REAL const PDstandardNth3gt23 = PDstandardNth3(>23[index]); + CCTK_REAL const PDstandardNth1gt33 = PDstandardNth1(>33[index]); + CCTK_REAL const PDstandardNth2gt33 = PDstandardNth2(>33[index]); + CCTK_REAL const PDstandardNth3gt33 = PDstandardNth3(>33[index]); + + /* Calculate temporaries and grid functions */ + ptrdiff_t dir1 = Sign(beta1L); + + ptrdiff_t dir2 = Sign(beta2L); + + ptrdiff_t dir3 = Sign(beta3L); + + CCTK_REAL detgt = 1; + + CCTK_REAL gtu11 = INV(detgt)*(gt22L*gt33L - SQR(gt23L)); + + CCTK_REAL gtu12 = (gt13L*gt23L - gt12L*gt33L)*INV(detgt); + + CCTK_REAL gtu13 = (-(gt13L*gt22L) + gt12L*gt23L)*INV(detgt); + + CCTK_REAL gtu22 = INV(detgt)*(gt11L*gt33L - SQR(gt13L)); + + CCTK_REAL gtu23 = (gt12L*gt13L - gt11L*gt23L)*INV(detgt); + + CCTK_REAL gtu33 = INV(detgt)*(gt11L*gt22L - SQR(gt12L)); + + CCTK_REAL Gt111 = 0.5*(gtu11*PDstandardNth1gt11 + + 2*(gtu12*PDstandardNth1gt12 + gtu13*PDstandardNth1gt13) - + gtu12*PDstandardNth2gt11 - gtu13*PDstandardNth3gt11); + + CCTK_REAL Gt211 = 0.5*(gtu12*PDstandardNth1gt11 + + 2*(gtu22*PDstandardNth1gt12 + gtu23*PDstandardNth1gt13) - + gtu22*PDstandardNth2gt11 - gtu23*PDstandardNth3gt11); + + CCTK_REAL Gt311 = 0.5*(gtu13*PDstandardNth1gt11 + + 2*(gtu23*PDstandardNth1gt12 + gtu33*PDstandardNth1gt13) - + gtu23*PDstandardNth2gt11 - gtu33*PDstandardNth3gt11); + + CCTK_REAL Gt112 = 0.5*(gtu12*PDstandardNth1gt22 + + gtu11*PDstandardNth2gt11 + gtu13*(PDstandardNth1gt23 + + PDstandardNth2gt13 - PDstandardNth3gt12)); + + CCTK_REAL Gt212 = 0.5*(gtu22*PDstandardNth1gt22 + + gtu12*PDstandardNth2gt11 + gtu23*(PDstandardNth1gt23 + + PDstandardNth2gt13 - PDstandardNth3gt12)); + + CCTK_REAL Gt312 = 0.5*(gtu23*PDstandardNth1gt22 + + gtu13*PDstandardNth2gt11 + gtu33*(PDstandardNth1gt23 + + PDstandardNth2gt13 - PDstandardNth3gt12)); + + CCTK_REAL Gt113 = 0.5*(gtu13*PDstandardNth1gt33 + + gtu11*PDstandardNth3gt11 + gtu12*(PDstandardNth1gt23 - + PDstandardNth2gt13 + PDstandardNth3gt12)); + + CCTK_REAL Gt213 = 0.5*(gtu23*PDstandardNth1gt33 + + gtu12*PDstandardNth3gt11 + gtu22*(PDstandardNth1gt23 - + PDstandardNth2gt13 + PDstandardNth3gt12)); + + CCTK_REAL Gt313 = 0.5*(gtu33*PDstandardNth1gt33 + + gtu13*PDstandardNth3gt11 + gtu23*(PDstandardNth1gt23 - + PDstandardNth2gt13 + PDstandardNth3gt12)); + + CCTK_REAL Gt122 = 0.5*(gtu11*(-PDstandardNth1gt22 + + 2*PDstandardNth2gt12) + gtu12*PDstandardNth2gt22 + + gtu13*(2*PDstandardNth2gt23 - PDstandardNth3gt22)); + + CCTK_REAL Gt222 = 0.5*(gtu12*(-PDstandardNth1gt22 + + 2*PDstandardNth2gt12) + gtu22*PDstandardNth2gt22 + + gtu23*(2*PDstandardNth2gt23 - PDstandardNth3gt22)); + + CCTK_REAL Gt322 = 0.5*(gtu13*(-PDstandardNth1gt22 + + 2*PDstandardNth2gt12) + gtu23*PDstandardNth2gt22 + + gtu33*(2*PDstandardNth2gt23 - PDstandardNth3gt22)); + + CCTK_REAL Gt123 = 0.5*(gtu13*PDstandardNth2gt33 + + gtu11*(-PDstandardNth1gt23 + PDstandardNth2gt13 + PDstandardNth3gt12) + + gtu12*PDstandardNth3gt22); + + CCTK_REAL Gt223 = 0.5*(gtu23*PDstandardNth2gt33 + + gtu12*(-PDstandardNth1gt23 + PDstandardNth2gt13 + PDstandardNth3gt12) + + gtu22*PDstandardNth3gt22); + + CCTK_REAL Gt323 = 0.5*(gtu33*PDstandardNth2gt33 + + gtu13*(-PDstandardNth1gt23 + PDstandardNth2gt13 + PDstandardNth3gt12) + + gtu23*PDstandardNth3gt22); + + CCTK_REAL Gt133 = 0.5*(gtu11*(-PDstandardNth1gt33 + + 2*PDstandardNth3gt13) + gtu12*(-PDstandardNth2gt33 + + 2*PDstandardNth3gt23) + gtu13*PDstandardNth3gt33); + + CCTK_REAL Gt233 = 0.5*(gtu12*(-PDstandardNth1gt33 + + 2*PDstandardNth3gt13) + gtu22*(-PDstandardNth2gt33 + + 2*PDstandardNth3gt23) + gtu23*PDstandardNth3gt33); + + CCTK_REAL Gt333 = 0.5*(gtu13*(-PDstandardNth1gt33 + + 2*PDstandardNth3gt13) + gtu23*(-PDstandardNth2gt33 + + 2*PDstandardNth3gt23) + gtu33*PDstandardNth3gt33); + + CCTK_REAL Xt1L = Gt111*gtu11 + Gt122*gtu22 + 2*(Gt112*gtu12 + + Gt113*gtu13 + Gt123*gtu23) + Gt133*gtu33; + + CCTK_REAL Xt2L = Gt211*gtu11 + Gt222*gtu22 + 2*(Gt212*gtu12 + + Gt213*gtu13 + Gt223*gtu23) + Gt233*gtu33; + + CCTK_REAL Xt3L = Gt311*gtu11 + Gt322*gtu22 + 2*(Gt312*gtu12 + + Gt313*gtu13 + Gt323*gtu23) + Gt333*gtu33; + + CCTK_REAL AL = IfThen(ToReal(LapseACoeff) != + 0,-(INV(ToReal(harmonicF))*pow(alphaL,-ToReal(harmonicN))*(9*dtalpL - + (PDupwindNth1(&alpha[index])*beta1L + + PDupwindNth2(&alpha[index])*beta2L + + PDupwindNth3(&alpha[index])*beta3L)*ToReal(LapseAdvectionCoeff))),0); + + CCTK_REAL theta = fmin(1,exp(1 - + rL*INV(ToReal(SpatialShiftGammaCoeffRadius)))); + + CCTK_REAL B1L = IfThen(ToReal(ShiftBCoeff)*ToReal(ShiftGammaCoeff) != + 0,INV(theta)*INV(ToReal(ShiftGammaCoeff))*(9*dtbetaxL - + (PDupwindNth1(&beta1[index])*beta1L + + PDupwindNth2(&beta1[index])*beta2L + + PDupwindNth3(&beta1[index])*beta3L)*ToReal(ShiftAdvectionCoeff)),0); + + CCTK_REAL B2L = IfThen(ToReal(ShiftBCoeff)*ToReal(ShiftGammaCoeff) != + 0,INV(theta)*INV(ToReal(ShiftGammaCoeff))*(9*dtbetayL - + (PDupwindNth1(&beta2[index])*beta1L + + PDupwindNth2(&beta2[index])*beta2L + + PDupwindNth3(&beta2[index])*beta3L)*ToReal(ShiftAdvectionCoeff)),0); + + CCTK_REAL B3L = IfThen(ToReal(ShiftBCoeff)*ToReal(ShiftGammaCoeff) != + 0,INV(theta)*INV(ToReal(ShiftGammaCoeff))*(9*dtbetazL - + (PDupwindNth1(&beta3[index])*beta1L + + PDupwindNth2(&beta3[index])*beta2L + + PDupwindNth3(&beta3[index])*beta3L)*ToReal(ShiftAdvectionCoeff)),0); + + + /* Copy local copies back to grid functions */ + A[index] = AL; + B1[index] = B1L; + B2[index] = B2L; + B3[index] = B3L; + Xt1[index] = Xt1L; + Xt2[index] = Xt2L; + Xt3[index] = Xt3L; + } + LC_ENDLOOP3 (ML_BSSN_UPW_convertFromADMBaseGamma); +} + +extern "C" void ML_BSSN_UPW_convertFromADMBaseGamma(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverInterior(cctkGH, &ML_BSSN_UPW_convertFromADMBaseGamma_Body); +} diff --git a/ML_BSSN_UPW/src/ML_BSSN_UPW_convertToADMBase.cc b/ML_BSSN_UPW/src/ML_BSSN_UPW_convertToADMBase.cc new file mode 100644 index 0000000..2e2af66 --- /dev/null +++ b/ML_BSSN_UPW/src/ML_BSSN_UPW_convertToADMBase.cc @@ -0,0 +1,193 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +static void ML_BSSN_UPW_convertToADMBase_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_BSSN_UPW_convertToADMBase_Body"); + } + + if (cctk_iteration % ML_BSSN_UPW_convertToADMBase_calc_every != ML_BSSN_UPW_convertToADMBase_calc_offset) + { + return; + } + + const char *groups[] = {"ADMBase::curv","ADMBase::lapse","ADMBase::metric","ADMBase::shift","ML_BSSN_UPW::ML_curv","ML_BSSN_UPW::ML_lapse","ML_BSSN_UPW::ML_log_confac","ML_BSSN_UPW::ML_metric","ML_BSSN_UPW::ML_shift","ML_BSSN_UPW::ML_trace_curv"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_BSSN_UPW_convertToADMBase", 10, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o12dx = 0.0833333333333333333333333333333*INV(dx); + CCTK_REAL const p1o12dy = 0.0833333333333333333333333333333*INV(dy); + CCTK_REAL const p1o12dz = 0.0833333333333333333333333333333*INV(dz); + CCTK_REAL const p1o144dxdy = 0.00694444444444444444444444444444*INV(dx)*INV(dy); + CCTK_REAL const p1o144dxdz = 0.00694444444444444444444444444444*INV(dx)*INV(dz); + CCTK_REAL const p1o144dydz = 0.00694444444444444444444444444444*INV(dy)*INV(dz); + CCTK_REAL const p1o24dx = 0.0416666666666666666666666666667*INV(dx); + CCTK_REAL const p1o24dy = 0.0416666666666666666666666666667*INV(dy); + CCTK_REAL const p1o24dz = 0.0416666666666666666666666666667*INV(dz); + CCTK_REAL const p1o64dx = 0.015625*INV(dx); + CCTK_REAL const p1o64dy = 0.015625*INV(dy); + CCTK_REAL const p1o64dz = 0.015625*INV(dz); + CCTK_REAL const p1odx = INV(dx); + CCTK_REAL const p1ody = INV(dy); + CCTK_REAL const p1odz = INV(dz); + CCTK_REAL const pm1o12dx2 = -0.0833333333333333333333333333333*INV(SQR(dx)); + CCTK_REAL const pm1o12dy2 = -0.0833333333333333333333333333333*INV(SQR(dy)); + CCTK_REAL const pm1o12dz2 = -0.0833333333333333333333333333333*INV(SQR(dz)); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_BSSN_UPW_convertToADMBase, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + CCTK_REAL alphaL = alpha[index]; + CCTK_REAL At11L = At11[index]; + CCTK_REAL At12L = At12[index]; + CCTK_REAL At13L = At13[index]; + CCTK_REAL At22L = At22[index]; + CCTK_REAL At23L = At23[index]; + CCTK_REAL At33L = At33[index]; + CCTK_REAL beta1L = beta1[index]; + CCTK_REAL beta2L = beta2[index]; + CCTK_REAL beta3L = beta3[index]; + CCTK_REAL gt11L = gt11[index]; + CCTK_REAL gt12L = gt12[index]; + CCTK_REAL gt13L = gt13[index]; + CCTK_REAL gt22L = gt22[index]; + CCTK_REAL gt23L = gt23[index]; + CCTK_REAL gt33L = gt33[index]; + CCTK_REAL gxxL = gxx[index]; + CCTK_REAL gxyL = gxy[index]; + CCTK_REAL gxzL = gxz[index]; + CCTK_REAL gyyL = gyy[index]; + CCTK_REAL gyzL = gyz[index]; + CCTK_REAL gzzL = gzz[index]; + CCTK_REAL phiL = phi[index]; + CCTK_REAL trKL = trK[index]; + + /* Include user supplied include files */ + + /* Precompute derivatives */ + + /* Calculate temporaries and grid functions */ + CCTK_REAL e4phi = + IfThen(ToReal(conformalMethod),INV(SQR(phiL)),exp(4*phiL)); + + gxxL = e4phi*gt11L; + + gxyL = e4phi*gt12L; + + gxzL = e4phi*gt13L; + + gyyL = e4phi*gt22L; + + gyzL = e4phi*gt23L; + + gzzL = e4phi*gt33L; + + CCTK_REAL kxxL = At11L*e4phi + + 0.333333333333333333333333333333*gxxL*trKL; + + CCTK_REAL kxyL = At12L*e4phi + + 0.333333333333333333333333333333*gxyL*trKL; + + CCTK_REAL kxzL = At13L*e4phi + + 0.333333333333333333333333333333*gxzL*trKL; + + CCTK_REAL kyyL = At22L*e4phi + + 0.333333333333333333333333333333*gyyL*trKL; + + CCTK_REAL kyzL = At23L*e4phi + + 0.333333333333333333333333333333*gyzL*trKL; + + CCTK_REAL kzzL = At33L*e4phi + + 0.333333333333333333333333333333*gzzL*trKL; + + CCTK_REAL alpL = alphaL; + + CCTK_REAL betaxL = beta1L; + + CCTK_REAL betayL = beta2L; + + CCTK_REAL betazL = beta3L; + + + /* Copy local copies back to grid functions */ + alp[index] = alpL; + betax[index] = betaxL; + betay[index] = betayL; + betaz[index] = betazL; + gxx[index] = gxxL; + gxy[index] = gxyL; + gxz[index] = gxzL; + gyy[index] = gyyL; + gyz[index] = gyzL; + gzz[index] = gzzL; + kxx[index] = kxxL; + kxy[index] = kxyL; + kxz[index] = kxzL; + kyy[index] = kyyL; + kyz[index] = kyzL; + kzz[index] = kzzL; + } + LC_ENDLOOP3 (ML_BSSN_UPW_convertToADMBase); +} + +extern "C" void ML_BSSN_UPW_convertToADMBase(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverEverything(cctkGH, &ML_BSSN_UPW_convertToADMBase_Body); +} diff --git a/ML_BSSN_UPW/src/ML_BSSN_UPW_convertToADMBaseDtLapseShift.cc b/ML_BSSN_UPW/src/ML_BSSN_UPW_convertToADMBaseDtLapseShift.cc new file mode 100644 index 0000000..1589aef --- /dev/null +++ b/ML_BSSN_UPW/src/ML_BSSN_UPW_convertToADMBaseDtLapseShift.cc @@ -0,0 +1,179 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +extern "C" void ML_BSSN_UPW_convertToADMBaseDtLapseShift_SelectBCs(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT ierr = 0; + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ADMBase::dtlapse","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ADMBase::dtlapse."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ADMBase::dtshift","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ADMBase::dtshift."); + return; +} + +static void ML_BSSN_UPW_convertToADMBaseDtLapseShift_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_BSSN_UPW_convertToADMBaseDtLapseShift_Body"); + } + + if (cctk_iteration % ML_BSSN_UPW_convertToADMBaseDtLapseShift_calc_every != ML_BSSN_UPW_convertToADMBaseDtLapseShift_calc_offset) + { + return; + } + + const char *groups[] = {"ADMBase::dtlapse","ADMBase::dtshift","grid::coordinates","Grid::coordinates","ML_BSSN_UPW::ML_dtlapse","ML_BSSN_UPW::ML_dtshift","ML_BSSN_UPW::ML_Gamma","ML_BSSN_UPW::ML_lapse","ML_BSSN_UPW::ML_shift","ML_BSSN_UPW::ML_trace_curv"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_BSSN_UPW_convertToADMBaseDtLapseShift", 10, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o12dx = 0.0833333333333333333333333333333*INV(dx); + CCTK_REAL const p1o12dy = 0.0833333333333333333333333333333*INV(dy); + CCTK_REAL const p1o12dz = 0.0833333333333333333333333333333*INV(dz); + CCTK_REAL const p1o144dxdy = 0.00694444444444444444444444444444*INV(dx)*INV(dy); + CCTK_REAL const p1o144dxdz = 0.00694444444444444444444444444444*INV(dx)*INV(dz); + CCTK_REAL const p1o144dydz = 0.00694444444444444444444444444444*INV(dy)*INV(dz); + CCTK_REAL const p1o24dx = 0.0416666666666666666666666666667*INV(dx); + CCTK_REAL const p1o24dy = 0.0416666666666666666666666666667*INV(dy); + CCTK_REAL const p1o24dz = 0.0416666666666666666666666666667*INV(dz); + CCTK_REAL const p1o64dx = 0.015625*INV(dx); + CCTK_REAL const p1o64dy = 0.015625*INV(dy); + CCTK_REAL const p1o64dz = 0.015625*INV(dz); + CCTK_REAL const p1odx = INV(dx); + CCTK_REAL const p1ody = INV(dy); + CCTK_REAL const p1odz = INV(dz); + CCTK_REAL const pm1o12dx2 = -0.0833333333333333333333333333333*INV(SQR(dx)); + CCTK_REAL const pm1o12dy2 = -0.0833333333333333333333333333333*INV(SQR(dy)); + CCTK_REAL const pm1o12dz2 = -0.0833333333333333333333333333333*INV(SQR(dz)); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_BSSN_UPW_convertToADMBaseDtLapseShift, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + CCTK_REAL AL = A[index]; + CCTK_REAL alphaL = alpha[index]; + CCTK_REAL B1L = B1[index]; + CCTK_REAL B2L = B2[index]; + CCTK_REAL B3L = B3[index]; + CCTK_REAL beta1L = beta1[index]; + CCTK_REAL beta2L = beta2[index]; + CCTK_REAL beta3L = beta3[index]; + CCTK_REAL rL = r[index]; + CCTK_REAL trKL = trK[index]; + CCTK_REAL Xt1L = Xt1[index]; + CCTK_REAL Xt2L = Xt2[index]; + CCTK_REAL Xt3L = Xt3[index]; + + /* Include user supplied include files */ + + /* Precompute derivatives */ + + /* Calculate temporaries and grid functions */ + ptrdiff_t dir1 = Sign(beta1L); + + ptrdiff_t dir2 = Sign(beta2L); + + ptrdiff_t dir3 = Sign(beta3L); + + CCTK_REAL eta = fmin(1,INV(rL)*ToReal(SpatialBetaDriverRadius)); + + CCTK_REAL theta = fmin(1,exp(1 - + rL*INV(ToReal(SpatialShiftGammaCoeffRadius)))); + + CCTK_REAL dtalpL = + -(pow(alphaL,ToReal(harmonicN))*ToReal(harmonicF)*(trKL + (AL - + trKL)*ToReal(LapseACoeff))) + (PDupwindNth1(&alpha[index])*beta1L + + PDupwindNth2(&alpha[index])*beta2L + + PDupwindNth3(&alpha[index])*beta3L)*ToReal(LapseAdvectionCoeff); + + CCTK_REAL dtbetaxL = (PDupwindNth1(&beta1[index])*beta1L + + PDupwindNth2(&beta1[index])*beta2L + + PDupwindNth3(&beta1[index])*beta3L)*ToReal(ShiftAdvectionCoeff) + + theta*(Xt1L + beta1L*eta*ToReal(BetaDriver)*(-1 + ToReal(ShiftBCoeff)) + + (B1L - Xt1L)*ToReal(ShiftBCoeff))*ToReal(ShiftGammaCoeff); + + CCTK_REAL dtbetayL = (PDupwindNth1(&beta2[index])*beta1L + + PDupwindNth2(&beta2[index])*beta2L + + PDupwindNth3(&beta2[index])*beta3L)*ToReal(ShiftAdvectionCoeff) + + theta*(Xt2L + beta2L*eta*ToReal(BetaDriver)*(-1 + ToReal(ShiftBCoeff)) + + (B2L - Xt2L)*ToReal(ShiftBCoeff))*ToReal(ShiftGammaCoeff); + + CCTK_REAL dtbetazL = (PDupwindNth1(&beta3[index])*beta1L + + PDupwindNth2(&beta3[index])*beta2L + + PDupwindNth3(&beta3[index])*beta3L)*ToReal(ShiftAdvectionCoeff) + + theta*(Xt3L + beta3L*eta*ToReal(BetaDriver)*(-1 + ToReal(ShiftBCoeff)) + + (B3L - Xt3L)*ToReal(ShiftBCoeff))*ToReal(ShiftGammaCoeff); + + + /* Copy local copies back to grid functions */ + dtalp[index] = dtalpL; + dtbetax[index] = dtbetaxL; + dtbetay[index] = dtbetayL; + dtbetaz[index] = dtbetazL; + } + LC_ENDLOOP3 (ML_BSSN_UPW_convertToADMBaseDtLapseShift); +} + +extern "C" void ML_BSSN_UPW_convertToADMBaseDtLapseShift(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverInterior(cctkGH, &ML_BSSN_UPW_convertToADMBaseDtLapseShift_Body); +} diff --git a/ML_BSSN_UPW/src/ML_BSSN_UPW_convertToADMBaseDtLapseShiftBoundary.cc b/ML_BSSN_UPW/src/ML_BSSN_UPW_convertToADMBaseDtLapseShiftBoundary.cc new file mode 100644 index 0000000..5820c7a --- /dev/null +++ b/ML_BSSN_UPW/src/ML_BSSN_UPW_convertToADMBaseDtLapseShiftBoundary.cc @@ -0,0 +1,165 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +extern "C" void ML_BSSN_UPW_convertToADMBaseDtLapseShiftBoundary_SelectBCs(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT ierr = 0; + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ADMBase::dtlapse","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ADMBase::dtlapse."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ADMBase::dtshift","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ADMBase::dtshift."); + return; +} + +static void ML_BSSN_UPW_convertToADMBaseDtLapseShiftBoundary_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_BSSN_UPW_convertToADMBaseDtLapseShiftBoundary_Body"); + } + + if (cctk_iteration % ML_BSSN_UPW_convertToADMBaseDtLapseShiftBoundary_calc_every != ML_BSSN_UPW_convertToADMBaseDtLapseShiftBoundary_calc_offset) + { + return; + } + + const char *groups[] = {"ADMBase::dtlapse","ADMBase::dtshift","grid::coordinates","Grid::coordinates","ML_BSSN_UPW::ML_dtlapse","ML_BSSN_UPW::ML_dtshift","ML_BSSN_UPW::ML_Gamma","ML_BSSN_UPW::ML_lapse","ML_BSSN_UPW::ML_shift","ML_BSSN_UPW::ML_trace_curv"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_BSSN_UPW_convertToADMBaseDtLapseShiftBoundary", 10, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o12dx = 0.0833333333333333333333333333333*INV(dx); + CCTK_REAL const p1o12dy = 0.0833333333333333333333333333333*INV(dy); + CCTK_REAL const p1o12dz = 0.0833333333333333333333333333333*INV(dz); + CCTK_REAL const p1o144dxdy = 0.00694444444444444444444444444444*INV(dx)*INV(dy); + CCTK_REAL const p1o144dxdz = 0.00694444444444444444444444444444*INV(dx)*INV(dz); + CCTK_REAL const p1o144dydz = 0.00694444444444444444444444444444*INV(dy)*INV(dz); + CCTK_REAL const p1o24dx = 0.0416666666666666666666666666667*INV(dx); + CCTK_REAL const p1o24dy = 0.0416666666666666666666666666667*INV(dy); + CCTK_REAL const p1o24dz = 0.0416666666666666666666666666667*INV(dz); + CCTK_REAL const p1o64dx = 0.015625*INV(dx); + CCTK_REAL const p1o64dy = 0.015625*INV(dy); + CCTK_REAL const p1o64dz = 0.015625*INV(dz); + CCTK_REAL const p1odx = INV(dx); + CCTK_REAL const p1ody = INV(dy); + CCTK_REAL const p1odz = INV(dz); + CCTK_REAL const pm1o12dx2 = -0.0833333333333333333333333333333*INV(SQR(dx)); + CCTK_REAL const pm1o12dy2 = -0.0833333333333333333333333333333*INV(SQR(dy)); + CCTK_REAL const pm1o12dz2 = -0.0833333333333333333333333333333*INV(SQR(dz)); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_BSSN_UPW_convertToADMBaseDtLapseShiftBoundary, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + CCTK_REAL AL = A[index]; + CCTK_REAL alphaL = alpha[index]; + CCTK_REAL B1L = B1[index]; + CCTK_REAL B2L = B2[index]; + CCTK_REAL B3L = B3[index]; + CCTK_REAL beta1L = beta1[index]; + CCTK_REAL beta2L = beta2[index]; + CCTK_REAL beta3L = beta3[index]; + CCTK_REAL rL = r[index]; + CCTK_REAL trKL = trK[index]; + CCTK_REAL Xt1L = Xt1[index]; + CCTK_REAL Xt2L = Xt2[index]; + CCTK_REAL Xt3L = Xt3[index]; + + /* Include user supplied include files */ + + /* Precompute derivatives */ + + /* Calculate temporaries and grid functions */ + CCTK_REAL eta = fmin(1,INV(rL)*ToReal(SpatialBetaDriverRadius)); + + CCTK_REAL theta = fmin(1,exp(1 - + rL*INV(ToReal(SpatialShiftGammaCoeffRadius)))); + + CCTK_REAL dtalpL = + -(pow(alphaL,ToReal(harmonicN))*ToReal(harmonicF)*(trKL + (AL - + trKL)*ToReal(LapseACoeff))); + + CCTK_REAL dtbetaxL = theta*(Xt1L + beta1L*eta*ToReal(BetaDriver)*(-1 + + ToReal(ShiftBCoeff)) + (B1L - + Xt1L)*ToReal(ShiftBCoeff))*ToReal(ShiftGammaCoeff); + + CCTK_REAL dtbetayL = theta*(Xt2L + beta2L*eta*ToReal(BetaDriver)*(-1 + + ToReal(ShiftBCoeff)) + (B2L - + Xt2L)*ToReal(ShiftBCoeff))*ToReal(ShiftGammaCoeff); + + CCTK_REAL dtbetazL = theta*(Xt3L + beta3L*eta*ToReal(BetaDriver)*(-1 + + ToReal(ShiftBCoeff)) + (B3L - + Xt3L)*ToReal(ShiftBCoeff))*ToReal(ShiftGammaCoeff); + + + /* Copy local copies back to grid functions */ + dtalp[index] = dtalpL; + dtbetax[index] = dtbetaxL; + dtbetay[index] = dtbetayL; + dtbetaz[index] = dtbetazL; + } + LC_ENDLOOP3 (ML_BSSN_UPW_convertToADMBaseDtLapseShiftBoundary); +} + +extern "C" void ML_BSSN_UPW_convertToADMBaseDtLapseShiftBoundary(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverBoundaryWithGhosts(cctkGH, &ML_BSSN_UPW_convertToADMBaseDtLapseShiftBoundary_Body); +} diff --git a/ML_BSSN_UPW/src/ML_BSSN_UPW_convertToADMBaseFakeDtLapseShift.cc b/ML_BSSN_UPW/src/ML_BSSN_UPW_convertToADMBaseFakeDtLapseShift.cc new file mode 100644 index 0000000..5aec616 --- /dev/null +++ b/ML_BSSN_UPW/src/ML_BSSN_UPW_convertToADMBaseFakeDtLapseShift.cc @@ -0,0 +1,150 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +static void ML_BSSN_UPW_convertToADMBaseFakeDtLapseShift_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_BSSN_UPW_convertToADMBaseFakeDtLapseShift_Body"); + } + + if (cctk_iteration % ML_BSSN_UPW_convertToADMBaseFakeDtLapseShift_calc_every != ML_BSSN_UPW_convertToADMBaseFakeDtLapseShift_calc_offset) + { + return; + } + + const char *groups[] = {"ADMBase::dtlapse","ADMBase::dtshift","grid::coordinates","Grid::coordinates","ML_BSSN_UPW::ML_dtlapse","ML_BSSN_UPW::ML_dtshift","ML_BSSN_UPW::ML_Gamma","ML_BSSN_UPW::ML_lapse","ML_BSSN_UPW::ML_shift","ML_BSSN_UPW::ML_trace_curv"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_BSSN_UPW_convertToADMBaseFakeDtLapseShift", 10, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o12dx = 0.0833333333333333333333333333333*INV(dx); + CCTK_REAL const p1o12dy = 0.0833333333333333333333333333333*INV(dy); + CCTK_REAL const p1o12dz = 0.0833333333333333333333333333333*INV(dz); + CCTK_REAL const p1o144dxdy = 0.00694444444444444444444444444444*INV(dx)*INV(dy); + CCTK_REAL const p1o144dxdz = 0.00694444444444444444444444444444*INV(dx)*INV(dz); + CCTK_REAL const p1o144dydz = 0.00694444444444444444444444444444*INV(dy)*INV(dz); + CCTK_REAL const p1o24dx = 0.0416666666666666666666666666667*INV(dx); + CCTK_REAL const p1o24dy = 0.0416666666666666666666666666667*INV(dy); + CCTK_REAL const p1o24dz = 0.0416666666666666666666666666667*INV(dz); + CCTK_REAL const p1o64dx = 0.015625*INV(dx); + CCTK_REAL const p1o64dy = 0.015625*INV(dy); + CCTK_REAL const p1o64dz = 0.015625*INV(dz); + CCTK_REAL const p1odx = INV(dx); + CCTK_REAL const p1ody = INV(dy); + CCTK_REAL const p1odz = INV(dz); + CCTK_REAL const pm1o12dx2 = -0.0833333333333333333333333333333*INV(SQR(dx)); + CCTK_REAL const pm1o12dy2 = -0.0833333333333333333333333333333*INV(SQR(dy)); + CCTK_REAL const pm1o12dz2 = -0.0833333333333333333333333333333*INV(SQR(dz)); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_BSSN_UPW_convertToADMBaseFakeDtLapseShift, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + CCTK_REAL AL = A[index]; + CCTK_REAL alphaL = alpha[index]; + CCTK_REAL B1L = B1[index]; + CCTK_REAL B2L = B2[index]; + CCTK_REAL B3L = B3[index]; + CCTK_REAL beta1L = beta1[index]; + CCTK_REAL beta2L = beta2[index]; + CCTK_REAL beta3L = beta3[index]; + CCTK_REAL rL = r[index]; + CCTK_REAL trKL = trK[index]; + CCTK_REAL Xt1L = Xt1[index]; + CCTK_REAL Xt2L = Xt2[index]; + CCTK_REAL Xt3L = Xt3[index]; + + /* Include user supplied include files */ + + /* Precompute derivatives */ + + /* Calculate temporaries and grid functions */ + CCTK_REAL eta = fmin(1,INV(rL)*ToReal(SpatialBetaDriverRadius)); + + CCTK_REAL theta = fmin(1,exp(1 - + rL*INV(ToReal(SpatialShiftGammaCoeffRadius)))); + + CCTK_REAL dtalpL = + -(pow(alphaL,ToReal(harmonicN))*ToReal(harmonicF)*(trKL + (AL - + trKL)*ToReal(LapseACoeff))); + + CCTK_REAL dtbetaxL = theta*(Xt1L + beta1L*eta*ToReal(BetaDriver)*(-1 + + ToReal(ShiftBCoeff)) + (B1L - + Xt1L)*ToReal(ShiftBCoeff))*ToReal(ShiftGammaCoeff); + + CCTK_REAL dtbetayL = theta*(Xt2L + beta2L*eta*ToReal(BetaDriver)*(-1 + + ToReal(ShiftBCoeff)) + (B2L - + Xt2L)*ToReal(ShiftBCoeff))*ToReal(ShiftGammaCoeff); + + CCTK_REAL dtbetazL = theta*(Xt3L + beta3L*eta*ToReal(BetaDriver)*(-1 + + ToReal(ShiftBCoeff)) + (B3L - + Xt3L)*ToReal(ShiftBCoeff))*ToReal(ShiftGammaCoeff); + + + /* Copy local copies back to grid functions */ + dtalp[index] = dtalpL; + dtbetax[index] = dtbetaxL; + dtbetay[index] = dtbetayL; + dtbetaz[index] = dtbetazL; + } + LC_ENDLOOP3 (ML_BSSN_UPW_convertToADMBaseFakeDtLapseShift); +} + +extern "C" void ML_BSSN_UPW_convertToADMBaseFakeDtLapseShift(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverEverything(cctkGH, &ML_BSSN_UPW_convertToADMBaseFakeDtLapseShift_Body); +} diff --git a/ML_BSSN_UPW/src/ML_BSSN_UPW_enforce.cc b/ML_BSSN_UPW/src/ML_BSSN_UPW_enforce.cc new file mode 100644 index 0000000..8808133 --- /dev/null +++ b/ML_BSSN_UPW/src/ML_BSSN_UPW_enforce.cc @@ -0,0 +1,163 @@ +/* File produced by Kranc */ + +#define KRANC_C + +#include <assert.h> +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include "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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +static void ML_BSSN_UPW_enforce_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_BSSN_UPW_enforce_Body"); + } + + if (cctk_iteration % ML_BSSN_UPW_enforce_calc_every != ML_BSSN_UPW_enforce_calc_offset) + { + return; + } + + const char *groups[] = {"ML_BSSN_UPW::ML_curv","ML_BSSN_UPW::ML_lapse","ML_BSSN_UPW::ML_metric"}; + GenericFD_AssertGroupStorage(cctkGH, "ML_BSSN_UPW_enforce", 3, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o12dx = 0.0833333333333333333333333333333*INV(dx); + CCTK_REAL const p1o12dy = 0.0833333333333333333333333333333*INV(dy); + CCTK_REAL const p1o12dz = 0.0833333333333333333333333333333*INV(dz); + CCTK_REAL const p1o144dxdy = 0.00694444444444444444444444444444*INV(dx)*INV(dy); + CCTK_REAL const p1o144dxdz = 0.00694444444444444444444444444444*INV(dx)*INV(dz); + CCTK_REAL const p1o144dydz = 0.00694444444444444444444444444444*INV(dy)*INV(dz); + CCTK_REAL const p1o24dx = 0.0416666666666666666666666666667*INV(dx); + CCTK_REAL const p1o24dy = 0.0416666666666666666666666666667*INV(dy); + CCTK_REAL const p1o24dz = 0.0416666666666666666666666666667*INV(dz); + CCTK_REAL const p1o64dx = 0.015625*INV(dx); + CCTK_REAL const p1o64dy = 0.015625*INV(dy); + CCTK_REAL const p1o64dz = 0.015625*INV(dz); + CCTK_REAL const p1odx = INV(dx); + CCTK_REAL const p1ody = INV(dy); + CCTK_REAL const p1odz = INV(dz); + CCTK_REAL const pm1o12dx2 = -0.0833333333333333333333333333333*INV(SQR(dx)); + CCTK_REAL const pm1o12dy2 = -0.0833333333333333333333333333333*INV(SQR(dy)); + CCTK_REAL const pm1o12dz2 = -0.0833333333333333333333333333333*INV(SQR(dz)); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (ML_BSSN_UPW_enforce, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + CCTK_REAL alphaL = alpha[index]; + CCTK_REAL At11L = At11[index]; + CCTK_REAL At12L = At12[index]; + CCTK_REAL At13L = At13[index]; + CCTK_REAL At22L = At22[index]; + CCTK_REAL At23L = At23[index]; + CCTK_REAL At33L = At33[index]; + CCTK_REAL gt11L = gt11[index]; + CCTK_REAL gt12L = gt12[index]; + CCTK_REAL gt13L = gt13[index]; + CCTK_REAL gt22L = gt22[index]; + CCTK_REAL gt23L = gt23[index]; + CCTK_REAL gt33L = gt33[index]; + + /* Include user supplied include files */ + + /* Precompute derivatives */ + + /* Calculate temporaries and grid functions */ + CCTK_REAL detgt = 1; + + CCTK_REAL gtu11 = INV(detgt)*(gt22L*gt33L - SQR(gt23L)); + + CCTK_REAL gtu12 = (gt13L*gt23L - gt12L*gt33L)*INV(detgt); + + CCTK_REAL gtu13 = (-(gt13L*gt22L) + gt12L*gt23L)*INV(detgt); + + CCTK_REAL gtu22 = INV(detgt)*(gt11L*gt33L - SQR(gt13L)); + + CCTK_REAL gtu23 = (gt12L*gt13L - gt11L*gt23L)*INV(detgt); + + CCTK_REAL gtu33 = INV(detgt)*(gt11L*gt22L - SQR(gt12L)); + + CCTK_REAL trAt = At11L*gtu11 + At22L*gtu22 + 2*(At12L*gtu12 + + At13L*gtu13 + At23L*gtu23) + At33L*gtu33; + + At11L = At11L - 0.333333333333333333333333333333*gt11L*trAt; + + At12L = At12L - 0.333333333333333333333333333333*gt12L*trAt; + + At13L = At13L - 0.333333333333333333333333333333*gt13L*trAt; + + At22L = At22L - 0.333333333333333333333333333333*gt22L*trAt; + + At23L = At23L - 0.333333333333333333333333333333*gt23L*trAt; + + At33L = At33L - 0.333333333333333333333333333333*gt33L*trAt; + + alphaL = fmax(alphaL,ToReal(MinimumLapse)); + + + /* Copy local copies back to grid functions */ + alpha[index] = alphaL; + At11[index] = At11L; + At12[index] = At12L; + At13[index] = At13L; + At22[index] = At22L; + At23[index] = At23L; + At33[index] = At33L; + } + LC_ENDLOOP3 (ML_BSSN_UPW_enforce); +} + +extern "C" void ML_BSSN_UPW_enforce(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverEverything(cctkGH, &ML_BSSN_UPW_enforce_Body); +} diff --git a/ML_BSSN_UPW/src/RegisterMoL.cc b/ML_BSSN_UPW/src/RegisterMoL.cc new file mode 100644 index 0000000..e06ade4 --- /dev/null +++ b/ML_BSSN_UPW/src/RegisterMoL.cc @@ -0,0 +1,41 @@ +/* File produced by Kranc */ + +#include "cctk.h" +#include "cctk_Arguments.h" +#include "cctk_Parameters.h" + +extern "C" void ML_BSSN_UPW_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_BSSN_UPW::At11"), CCTK_VarIndex("ML_BSSN_UPW::At11rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_UPW::At12"), CCTK_VarIndex("ML_BSSN_UPW::At12rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_UPW::At13"), CCTK_VarIndex("ML_BSSN_UPW::At13rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_UPW::At22"), CCTK_VarIndex("ML_BSSN_UPW::At22rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_UPW::At23"), CCTK_VarIndex("ML_BSSN_UPW::At23rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_UPW::At33"), CCTK_VarIndex("ML_BSSN_UPW::At33rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_UPW::A"), CCTK_VarIndex("ML_BSSN_UPW::Arhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_UPW::B1"), CCTK_VarIndex("ML_BSSN_UPW::B1rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_UPW::B2"), CCTK_VarIndex("ML_BSSN_UPW::B2rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_UPW::B3"), CCTK_VarIndex("ML_BSSN_UPW::B3rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_UPW::Xt1"), CCTK_VarIndex("ML_BSSN_UPW::Xt1rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_UPW::Xt2"), CCTK_VarIndex("ML_BSSN_UPW::Xt2rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_UPW::Xt3"), CCTK_VarIndex("ML_BSSN_UPW::Xt3rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_UPW::alpha"), CCTK_VarIndex("ML_BSSN_UPW::alpharhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_UPW::phi"), CCTK_VarIndex("ML_BSSN_UPW::phirhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_UPW::gt11"), CCTK_VarIndex("ML_BSSN_UPW::gt11rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_UPW::gt12"), CCTK_VarIndex("ML_BSSN_UPW::gt12rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_UPW::gt13"), CCTK_VarIndex("ML_BSSN_UPW::gt13rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_UPW::gt22"), CCTK_VarIndex("ML_BSSN_UPW::gt22rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_UPW::gt23"), CCTK_VarIndex("ML_BSSN_UPW::gt23rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_UPW::gt33"), CCTK_VarIndex("ML_BSSN_UPW::gt33rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_UPW::beta1"), CCTK_VarIndex("ML_BSSN_UPW::beta1rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_UPW::beta2"), CCTK_VarIndex("ML_BSSN_UPW::beta2rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_UPW::beta3"), CCTK_VarIndex("ML_BSSN_UPW::beta3rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_BSSN_UPW::trK"), CCTK_VarIndex("ML_BSSN_UPW::trKrhs")); + return; +} diff --git a/ML_BSSN_UPW/src/RegisterSymmetries.cc b/ML_BSSN_UPW/src/RegisterSymmetries.cc new file mode 100644 index 0000000..e63fc15 --- /dev/null +++ b/ML_BSSN_UPW/src/RegisterSymmetries.cc @@ -0,0 +1,189 @@ +/* File produced by Kranc */ + +#include "cctk.h" +#include "cctk_Arguments.h" +#include "cctk_Parameters.h" +#include "Symmetry.h" + +extern "C" void ML_BSSN_UPW_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_BSSN_UPW::At11"); + + sym[0] = -1; + sym[1] = -1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_UPW::At12"); + + sym[0] = -1; + sym[1] = 1; + sym[2] = -1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_UPW::At13"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_UPW::At22"); + + sym[0] = 1; + sym[1] = -1; + sym[2] = -1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_UPW::At23"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_UPW::At33"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_UPW::A"); + + sym[0] = -1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_UPW::B1"); + + sym[0] = 1; + sym[1] = -1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_UPW::B2"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = -1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_UPW::B3"); + + sym[0] = -1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_UPW::Xt1"); + + sym[0] = 1; + sym[1] = -1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_UPW::Xt2"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = -1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_UPW::Xt3"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_UPW::alpha"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_UPW::phi"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_UPW::gt11"); + + sym[0] = -1; + sym[1] = -1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_UPW::gt12"); + + sym[0] = -1; + sym[1] = 1; + sym[2] = -1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_UPW::gt13"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_UPW::gt22"); + + sym[0] = 1; + sym[1] = -1; + sym[2] = -1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_UPW::gt23"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_UPW::gt33"); + + sym[0] = -1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_UPW::beta1"); + + sym[0] = 1; + sym[1] = -1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_UPW::beta2"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = -1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_UPW::beta3"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_UPW::trK"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_UPW::cS"); + + sym[0] = -1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_UPW::cXt1"); + + sym[0] = 1; + sym[1] = -1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_UPW::cXt2"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = -1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_UPW::cXt3"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_UPW::cA"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_UPW::H"); + + sym[0] = -1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_UPW::M1"); + + sym[0] = 1; + sym[1] = -1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_UPW::M2"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = -1; + SetCartSymVN(cctkGH, sym, "ML_BSSN_UPW::M3"); + +} diff --git a/ML_BSSN_UPW/src/Startup.cc b/ML_BSSN_UPW/src/Startup.cc new file mode 100644 index 0000000..bf2d3c1 --- /dev/null +++ b/ML_BSSN_UPW/src/Startup.cc @@ -0,0 +1,10 @@ +/* File produced by Kranc */ + +#include "cctk.h" + +extern "C" int ML_BSSN_UPW_Startup(void) +{ + const char * banner = "ML_BSSN_UPW"; + CCTK_RegisterBanner(banner); + return 0; +} diff --git a/ML_WaveToy/src/Boundaries.cc b/ML_WaveToy/src/Boundaries.cc new file mode 100644 index 0000000..1e5f99e --- /dev/null +++ b/ML_WaveToy/src/Boundaries.cc @@ -0,0 +1,249 @@ +/* File produced by Kranc */ + +#include "cctk.h" +#include "cctk_Arguments.h" +#include "cctk_Parameters.h" +#include "cctk_Faces.h" +#include "util_Table.h" +#include "Symmetry.h" + + +/* the boundary treatment is split into 3 steps: */ +/* 1. excision */ +/* 2. symmetries */ +/* 3. "other" boundary conditions, e.g. radiative */ + +/* to simplify scheduling and testing, the 3 steps */ +/* are currently applied in separate functions */ + + +extern "C" void ML_WaveToy_CheckBoundaries(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + return; +} + +extern "C" void ML_WaveToy_SelectBoundConds(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_WaveToy::WT_rho", WT_rho_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register WT_rho_bound BC for ML_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, + "ML_WaveToy::WT_u", WT_u_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register WT_u_bound BC for ML_WaveToy::WT_u!"); + } + + 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_WaveToy::rho", rho_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register rho_bound BC for ML_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, + "ML_WaveToy::u", u_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register u_bound BC for ML_WaveToy::u!"); + } + + if (CCTK_EQUALS(WT_rho_bound, "radiative")) + { + /* select 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_WaveToy::WT_rho", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_WaveToy::WT_rho!"); + + } + + if (CCTK_EQUALS(WT_u_bound, "radiative")) + { + /* select 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_WaveToy::WT_u", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_WaveToy::WT_u!"); + + } + + if (CCTK_EQUALS(rho_bound, "radiative")) + { + /* select 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_WaveToy::rho", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_WaveToy::rho!"); + + } + + if (CCTK_EQUALS(u_bound, "radiative")) + { + /* select 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_WaveToy::u", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_WaveToy::u!"); + + } + + if (CCTK_EQUALS(WT_rho_bound, "scalar")) + { + /* select 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_WaveToy::WT_rho", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Scalar BC for ML_WaveToy::WT_rho!"); + + } + + if (CCTK_EQUALS(WT_u_bound, "scalar")) + { + /* select 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_WaveToy::WT_u", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Scalar BC for ML_WaveToy::WT_u!"); + + } + + if (CCTK_EQUALS(rho_bound, "scalar")) + { + /* select 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_WaveToy::rho", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_WaveToy::rho!"); + + } + + if (CCTK_EQUALS(u_bound, "scalar")) + { + /* select 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_WaveToy::u", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_WaveToy::u!"); + + } + return; +} + + + +/* template for entries in parameter file: +#$bound$#ML_WaveToy::WT_rho_bound = "skip" +#$bound$#ML_WaveToy::WT_rho_bound_speed = 1.0 +#$bound$#ML_WaveToy::WT_rho_bound_limit = 0.0 +#$bound$#ML_WaveToy::WT_rho_bound_scalar = 0.0 + +#$bound$#ML_WaveToy::WT_u_bound = "skip" +#$bound$#ML_WaveToy::WT_u_bound_speed = 1.0 +#$bound$#ML_WaveToy::WT_u_bound_limit = 0.0 +#$bound$#ML_WaveToy::WT_u_bound_scalar = 0.0 + +#$bound$#ML_WaveToy::rho_bound = "skip" +#$bound$#ML_WaveToy::rho_bound_speed = 1.0 +#$bound$#ML_WaveToy::rho_bound_limit = 0.0 +#$bound$#ML_WaveToy::rho_bound_scalar = 0.0 + +#$bound$#ML_WaveToy::u_bound = "skip" +#$bound$#ML_WaveToy::u_bound_speed = 1.0 +#$bound$#ML_WaveToy::u_bound_limit = 0.0 +#$bound$#ML_WaveToy::u_bound_scalar = 0.0 + +*/ + diff --git a/ML_WaveToy/src/RegisterMoL.cc b/ML_WaveToy/src/RegisterMoL.cc new file mode 100644 index 0000000..21434f5 --- /dev/null +++ b/ML_WaveToy/src/RegisterMoL.cc @@ -0,0 +1,18 @@ +/* File produced by Kranc */ + +#include "cctk.h" +#include "cctk_Arguments.h" +#include "cctk_Parameters.h" + +extern "C" void ML_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("ML_WaveToy::rho"), CCTK_VarIndex("ML_WaveToy::rhorhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_WaveToy::u"), CCTK_VarIndex("ML_WaveToy::urhs")); + return; +} diff --git a/ML_WaveToy/src/RegisterSymmetries.cc b/ML_WaveToy/src/RegisterSymmetries.cc new file mode 100644 index 0000000..ae89b96 --- /dev/null +++ b/ML_WaveToy/src/RegisterSymmetries.cc @@ -0,0 +1,29 @@ +/* File produced by Kranc */ + +#include "cctk.h" +#include "cctk_Arguments.h" +#include "cctk_Parameters.h" +#include "Symmetry.h" + +extern "C" void ML_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, "ML_WaveToy::rho"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_WaveToy::u"); + +} diff --git a/ML_WaveToy/src/Startup.cc b/ML_WaveToy/src/Startup.cc new file mode 100644 index 0000000..5f3d2bd --- /dev/null +++ b/ML_WaveToy/src/Startup.cc @@ -0,0 +1,10 @@ +/* File produced by Kranc */ + +#include "cctk.h" + +extern "C" int ML_WaveToy_Startup(void) +{ + const char * banner = "ML_WaveToy"; + CCTK_RegisterBanner(banner); + return 0; +} diff --git a/ML_WaveToy/src/WT_Gaussian.cc b/ML_WaveToy/src/WT_Gaussian.cc new file mode 100644 index 0000000..f4d0da6 --- /dev/null +++ b/ML_WaveToy/src/WT_Gaussian.cc @@ -0,0 +1,109 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +static void WT_Gaussian_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering WT_Gaussian_Body"); + } + + if (cctk_iteration % WT_Gaussian_calc_every != WT_Gaussian_calc_offset) + { + return; + } + + const char *groups[] = {"ML_WaveToy::WT_rho","ML_WaveToy::WT_u"}; + GenericFD_AssertGroupStorage(cctkGH, "WT_Gaussian", 2, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o12dx = 0.0833333333333333333333333333333*INV(dx); + CCTK_REAL const p1o12dy = 0.0833333333333333333333333333333*INV(dy); + CCTK_REAL const p1o12dz = 0.0833333333333333333333333333333*INV(dz); + CCTK_REAL const p1o144dxdy = 0.00694444444444444444444444444444*INV(dx)*INV(dy); + CCTK_REAL const p1o144dxdz = 0.00694444444444444444444444444444*INV(dx)*INV(dz); + CCTK_REAL const p1o144dydz = 0.00694444444444444444444444444444*INV(dy)*INV(dz); + CCTK_REAL const pm1o12dx2 = -0.0833333333333333333333333333333*INV(SQR(dx)); + CCTK_REAL const pm1o12dy2 = -0.0833333333333333333333333333333*INV(SQR(dy)); + CCTK_REAL const pm1o12dz2 = -0.0833333333333333333333333333333*INV(SQR(dz)); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (WT_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]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + + /* Include user supplied include files */ + + /* Precompute derivatives */ + + /* Calculate temporaries and grid functions */ + CCTK_REAL uL = 0; + + CCTK_REAL rhoL = 0; + + + /* Copy local copies back to grid functions */ + rho[index] = rhoL; + u[index] = uL; + } + LC_ENDLOOP3 (WT_Gaussian); +} + +extern "C" void WT_Gaussian(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverEverything(cctkGH, &WT_Gaussian_Body); +} diff --git a/ML_WaveToy/src/WT_RHS.cc b/ML_WaveToy/src/WT_RHS.cc new file mode 100644 index 0000000..3f1729b --- /dev/null +++ b/ML_WaveToy/src/WT_RHS.cc @@ -0,0 +1,130 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +extern "C" void WT_RHS_SelectBCs(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT ierr = 0; + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_WaveToy::WT_rhorhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_WaveToy::WT_rhorhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_WaveToy::WT_urhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_WaveToy::WT_urhs."); + return; +} + +static void WT_RHS_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering WT_RHS_Body"); + } + + if (cctk_iteration % WT_RHS_calc_every != WT_RHS_calc_offset) + { + return; + } + + const char *groups[] = {"ML_WaveToy::WT_rho","ML_WaveToy::WT_rhorhs","ML_WaveToy::WT_u","ML_WaveToy::WT_urhs"}; + GenericFD_AssertGroupStorage(cctkGH, "WT_RHS", 4, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o12dx = 0.0833333333333333333333333333333*INV(dx); + CCTK_REAL const p1o12dy = 0.0833333333333333333333333333333*INV(dy); + CCTK_REAL const p1o12dz = 0.0833333333333333333333333333333*INV(dz); + CCTK_REAL const p1o144dxdy = 0.00694444444444444444444444444444*INV(dx)*INV(dy); + CCTK_REAL const p1o144dxdz = 0.00694444444444444444444444444444*INV(dx)*INV(dz); + CCTK_REAL const p1o144dydz = 0.00694444444444444444444444444444*INV(dy)*INV(dz); + CCTK_REAL const pm1o12dx2 = -0.0833333333333333333333333333333*INV(SQR(dx)); + CCTK_REAL const pm1o12dy2 = -0.0833333333333333333333333333333*INV(SQR(dy)); + CCTK_REAL const pm1o12dz2 = -0.0833333333333333333333333333333*INV(SQR(dz)); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (WT_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]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + CCTK_REAL rhoL = rho[index]; + CCTK_REAL uL = u[index]; + + /* Include user supplied include files */ + + /* Precompute derivatives */ + CCTK_REAL const PDstandardNth11u = PDstandardNth11(&u[index]); + CCTK_REAL const PDstandardNth22u = PDstandardNth22(&u[index]); + CCTK_REAL const PDstandardNth33u = PDstandardNth33(&u[index]); + + /* Calculate temporaries and grid functions */ + CCTK_REAL urhsL = rhoL; + + CCTK_REAL rhorhsL = PDstandardNth11u + PDstandardNth22u + + PDstandardNth33u; + + + /* Copy local copies back to grid functions */ + rhorhs[index] = rhorhsL; + urhs[index] = urhsL; + } + LC_ENDLOOP3 (WT_RHS); +} + +extern "C" void WT_RHS(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverInterior(cctkGH, &WT_RHS_Body); +} diff --git a/ML_WaveToyFO/src/Boundaries.cc b/ML_WaveToyFO/src/Boundaries.cc new file mode 100644 index 0000000..0e812f1 --- /dev/null +++ b/ML_WaveToyFO/src/Boundaries.cc @@ -0,0 +1,457 @@ +/* File produced by Kranc */ + +#include "cctk.h" +#include "cctk_Arguments.h" +#include "cctk_Parameters.h" +#include "cctk_Faces.h" +#include "util_Table.h" +#include "Symmetry.h" + + +/* the boundary treatment is split into 3 steps: */ +/* 1. excision */ +/* 2. symmetries */ +/* 3. "other" boundary conditions, e.g. radiative */ + +/* to simplify scheduling and testing, the 3 steps */ +/* are currently applied in separate functions */ + + +extern "C" void ML_WaveToyFO_CheckBoundaries(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + return; +} + +extern "C" void ML_WaveToyFO_SelectBoundConds(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")) + { + /* select 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")) + { + /* select 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")) + { + /* select 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")) + { + /* select 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")) + { + /* select 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")) + { + /* select 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")) + { + /* select 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")) + { + /* select 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")) + { + /* select 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")) + { + /* select 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")) + { + /* select 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")) + { + /* select 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")) + { + /* select 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")) + { + /* select 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")) + { + /* select 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")) + { + /* select 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/RegisterMoL.cc b/ML_WaveToyFO/src/RegisterMoL.cc new file mode 100644 index 0000000..dca3254 --- /dev/null +++ b/ML_WaveToyFO/src/RegisterMoL.cc @@ -0,0 +1,21 @@ +/* File produced by Kranc */ + +#include "cctk.h" +#include "cctk_Arguments.h" +#include "cctk_Parameters.h" + +extern "C" 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.cc b/ML_WaveToyFO/src/RegisterSymmetries.cc new file mode 100644 index 0000000..1f1e844 --- /dev/null +++ b/ML_WaveToyFO/src/RegisterSymmetries.cc @@ -0,0 +1,59 @@ +/* File produced by Kranc */ + +#include "cctk.h" +#include "cctk_Arguments.h" +#include "cctk_Parameters.h" +#include "Symmetry.h" + +extern "C" 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.cc b/ML_WaveToyFO/src/Startup.cc new file mode 100644 index 0000000..0775453 --- /dev/null +++ b/ML_WaveToyFO/src/Startup.cc @@ -0,0 +1,10 @@ +/* File produced by Kranc */ + +#include "cctk.h" + +extern "C" int ML_WaveToyFO_Startup(void) +{ + const char * banner = "ML_WaveToyFO"; + CCTK_RegisterBanner(banner); + return 0; +} diff --git a/ML_WaveToyFO/src/WTFO_Gaussian.cc b/ML_WaveToyFO/src/WTFO_Gaussian.cc new file mode 100644 index 0000000..30f3101 --- /dev/null +++ b/ML_WaveToyFO/src/WTFO_Gaussian.cc @@ -0,0 +1,118 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +static void WTFO_Gaussian_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering WTFO_Gaussian_Body"); + } + + if (cctk_iteration % WTFO_Gaussian_calc_every != WTFO_Gaussian_calc_offset) + { + return; + } + + const char *groups[] = {"ML_WaveToyFO::WT_rho","ML_WaveToyFO::WT_u","ML_WaveToyFO::WT_v"}; + GenericFD_AssertGroupStorage(cctkGH, "WTFO_Gaussian", 3, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o12dx = 0.0833333333333333333333333333333*INV(dx); + CCTK_REAL const p1o12dy = 0.0833333333333333333333333333333*INV(dy); + CCTK_REAL const p1o12dz = 0.0833333333333333333333333333333*INV(dz); + CCTK_REAL const p1o144dxdy = 0.00694444444444444444444444444444*INV(dx)*INV(dy); + CCTK_REAL const p1o144dxdz = 0.00694444444444444444444444444444*INV(dx)*INV(dz); + CCTK_REAL const p1o144dydz = 0.00694444444444444444444444444444*INV(dy)*INV(dz); + CCTK_REAL const pm1o12dx2 = -0.0833333333333333333333333333333*INV(SQR(dx)); + CCTK_REAL const pm1o12dy2 = -0.0833333333333333333333333333333*INV(SQR(dy)); + CCTK_REAL const pm1o12dz2 = -0.0833333333333333333333333333333*INV(SQR(dz)); + + /* 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]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + + /* Include user supplied include files */ + + /* Precompute derivatives */ + + /* Calculate temporaries and grid functions */ + CCTK_REAL uL = 0; + + CCTK_REAL v1L = 0; + + CCTK_REAL v2L = 0; + + CCTK_REAL v3L = 0; + + CCTK_REAL rhoL = 0; + + + /* Copy local copies back to grid functions */ + rho[index] = rhoL; + u[index] = uL; + v1[index] = v1L; + v2[index] = v2L; + v3[index] = v3L; + } + LC_ENDLOOP3 (WTFO_Gaussian); +} + +extern "C" 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.cc b/ML_WaveToyFO/src/WTFO_RHS.cc new file mode 100644 index 0000000..208608d --- /dev/null +++ b/ML_WaveToyFO/src/WTFO_RHS.cc @@ -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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +extern "C" void WTFO_RHS_SelectBCs(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT ierr = 0; + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_WaveToyFO::WT_rhorhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_WaveToyFO::WT_rhorhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_WaveToyFO::WT_urhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_WaveToyFO::WT_urhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_WaveToyFO::WT_vrhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_WaveToyFO::WT_vrhs."); + return; +} + +static void WTFO_RHS_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering WTFO_RHS_Body"); + } + + if (cctk_iteration % WTFO_RHS_calc_every != WTFO_RHS_calc_offset) + { + return; + } + + const char *groups[] = {"ML_WaveToyFO::WT_rho","ML_WaveToyFO::WT_rhorhs","ML_WaveToyFO::WT_urhs","ML_WaveToyFO::WT_v","ML_WaveToyFO::WT_vrhs"}; + GenericFD_AssertGroupStorage(cctkGH, "WTFO_RHS", 5, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o12dx = 0.0833333333333333333333333333333*INV(dx); + CCTK_REAL const p1o12dy = 0.0833333333333333333333333333333*INV(dy); + CCTK_REAL const p1o12dz = 0.0833333333333333333333333333333*INV(dz); + CCTK_REAL const p1o144dxdy = 0.00694444444444444444444444444444*INV(dx)*INV(dy); + CCTK_REAL const p1o144dxdz = 0.00694444444444444444444444444444*INV(dx)*INV(dz); + CCTK_REAL const p1o144dydz = 0.00694444444444444444444444444444*INV(dy)*INV(dz); + CCTK_REAL const pm1o12dx2 = -0.0833333333333333333333333333333*INV(SQR(dx)); + CCTK_REAL const pm1o12dy2 = -0.0833333333333333333333333333333*INV(SQR(dy)); + CCTK_REAL const pm1o12dz2 = -0.0833333333333333333333333333333*INV(SQR(dz)); + + /* 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]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + CCTK_REAL rhoL = rho[index]; + CCTK_REAL v1L = v1[index]; + CCTK_REAL v2L = v2[index]; + CCTK_REAL v3L = v3[index]; + + /* Include user supplied include files */ + + /* Precompute derivatives */ + CCTK_REAL const PDstandardNth1rho = PDstandardNth1(&rho[index]); + CCTK_REAL const PDstandardNth2rho = PDstandardNth2(&rho[index]); + CCTK_REAL const PDstandardNth3rho = PDstandardNth3(&rho[index]); + CCTK_REAL const PDstandardNth1v1 = PDstandardNth1(&v1[index]); + CCTK_REAL const PDstandardNth2v2 = PDstandardNth2(&v2[index]); + CCTK_REAL const PDstandardNth3v3 = PDstandardNth3(&v3[index]); + + /* Calculate temporaries and grid functions */ + CCTK_REAL urhsL = rhoL; + + CCTK_REAL rhorhsL = PDstandardNth1v1 + PDstandardNth2v2 + + PDstandardNth3v3; + + CCTK_REAL v1rhsL = PDstandardNth1rho; + + CCTK_REAL v2rhsL = PDstandardNth2rho; + + CCTK_REAL v3rhsL = PDstandardNth3rho; + + + /* Copy local copies back to grid functions */ + rhorhs[index] = rhorhsL; + urhs[index] = urhsL; + v1rhs[index] = v1rhsL; + v2rhs[index] = v2rhsL; + v3rhs[index] = v3rhsL; + } + LC_ENDLOOP3 (WTFO_RHS); +} + +extern "C" 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.cc b/ML_WaveToyFO/src/WTFO_constraints.cc new file mode 100644 index 0000000..46748ad --- /dev/null +++ b/ML_WaveToyFO/src/WTFO_constraints.cc @@ -0,0 +1,133 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +extern "C" void WTFO_constraints_SelectBCs(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT ierr = 0; + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_WaveToyFO::WT_w","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_WaveToyFO::WT_w."); + return; +} + +static void WTFO_constraints_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering WTFO_constraints_Body"); + } + + if (cctk_iteration % WTFO_constraints_calc_every != WTFO_constraints_calc_offset) + { + return; + } + + const char *groups[] = {"ML_WaveToyFO::WT_v","ML_WaveToyFO::WT_w"}; + GenericFD_AssertGroupStorage(cctkGH, "WTFO_constraints", 2, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o12dx = 0.0833333333333333333333333333333*INV(dx); + CCTK_REAL const p1o12dy = 0.0833333333333333333333333333333*INV(dy); + CCTK_REAL const p1o12dz = 0.0833333333333333333333333333333*INV(dz); + CCTK_REAL const p1o144dxdy = 0.00694444444444444444444444444444*INV(dx)*INV(dy); + CCTK_REAL const p1o144dxdz = 0.00694444444444444444444444444444*INV(dx)*INV(dz); + CCTK_REAL const p1o144dydz = 0.00694444444444444444444444444444*INV(dy)*INV(dz); + CCTK_REAL const pm1o12dx2 = -0.0833333333333333333333333333333*INV(SQR(dx)); + CCTK_REAL const pm1o12dy2 = -0.0833333333333333333333333333333*INV(SQR(dy)); + CCTK_REAL const pm1o12dz2 = -0.0833333333333333333333333333333*INV(SQR(dz)); + + /* 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]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + CCTK_REAL v1L = v1[index]; + CCTK_REAL v2L = v2[index]; + CCTK_REAL v3L = v3[index]; + + /* Include user supplied include files */ + + /* Precompute derivatives */ + CCTK_REAL const PDstandardNth2v1 = PDstandardNth2(&v1[index]); + CCTK_REAL const PDstandardNth3v1 = PDstandardNth3(&v1[index]); + CCTK_REAL const PDstandardNth1v2 = PDstandardNth1(&v2[index]); + CCTK_REAL const PDstandardNth3v2 = PDstandardNth3(&v2[index]); + CCTK_REAL const PDstandardNth1v3 = PDstandardNth1(&v3[index]); + CCTK_REAL const PDstandardNth2v3 = PDstandardNth2(&v3[index]); + + /* Calculate temporaries and grid functions */ + CCTK_REAL w1L = -PDstandardNth2v3 + PDstandardNth3v2; + + CCTK_REAL w2L = PDstandardNth1v3 - PDstandardNth3v1; + + CCTK_REAL w3L = -PDstandardNth1v2 + PDstandardNth2v1; + + + /* Copy local copies back to grid functions */ + w1[index] = w1L; + w2[index] = w2L; + w3[index] = w3L; + } + LC_ENDLOOP3 (WTFO_constraints); +} + +extern "C" void WTFO_constraints(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverInterior(cctkGH, &WTFO_constraints_Body); +} diff --git a/ML_hydro/src/Boundaries.cc b/ML_hydro/src/Boundaries.cc new file mode 100644 index 0000000..ff96482 --- /dev/null +++ b/ML_hydro/src/Boundaries.cc @@ -0,0 +1,457 @@ +/* File produced by Kranc */ + +#include "cctk.h" +#include "cctk_Arguments.h" +#include "cctk_Parameters.h" +#include "cctk_Faces.h" +#include "util_Table.h" +#include "Symmetry.h" + + +/* the boundary treatment is split into 3 steps: */ +/* 1. excision */ +/* 2. symmetries */ +/* 3. "other" boundary conditions, e.g. radiative */ + +/* to simplify scheduling and testing, the 3 steps */ +/* are currently applied in separate functions */ + + +extern "C" void ML_hydro_CheckBoundaries(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + return; +} + +extern "C" void ML_hydro_SelectBoundConds(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT ierr = 0; + + if (CCTK_EQUALS(ene_group_bound, "none" ) || + CCTK_EQUALS(ene_group_bound, "static") || + CCTK_EQUALS(ene_group_bound, "flat" ) || + CCTK_EQUALS(ene_group_bound, "zero" ) ) + { + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_hydro::ene_group", ene_group_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register ene_group_bound BC for ML_hydro::ene_group!"); + } + + if (CCTK_EQUALS(mass_group_bound, "none" ) || + CCTK_EQUALS(mass_group_bound, "static") || + CCTK_EQUALS(mass_group_bound, "flat" ) || + CCTK_EQUALS(mass_group_bound, "zero" ) ) + { + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_hydro::mass_group", mass_group_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register mass_group_bound BC for ML_hydro::mass_group!"); + } + + if (CCTK_EQUALS(mom_group_bound, "none" ) || + CCTK_EQUALS(mom_group_bound, "static") || + CCTK_EQUALS(mom_group_bound, "flat" ) || + CCTK_EQUALS(mom_group_bound, "zero" ) ) + { + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_hydro::mom_group", mom_group_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register mom_group_bound BC for ML_hydro::mom_group!"); + } + + if (CCTK_EQUALS(ene_bound, "none" ) || + CCTK_EQUALS(ene_bound, "static") || + CCTK_EQUALS(ene_bound, "flat" ) || + CCTK_EQUALS(ene_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_hydro::ene", ene_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register ene_bound BC for ML_hydro::ene!"); + } + + if (CCTK_EQUALS(mass_bound, "none" ) || + CCTK_EQUALS(mass_bound, "static") || + CCTK_EQUALS(mass_bound, "flat" ) || + CCTK_EQUALS(mass_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_hydro::mass", mass_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register mass_bound BC for ML_hydro::mass!"); + } + + if (CCTK_EQUALS(mom1_bound, "none" ) || + CCTK_EQUALS(mom1_bound, "static") || + CCTK_EQUALS(mom1_bound, "flat" ) || + CCTK_EQUALS(mom1_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_hydro::mom1", mom1_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register mom1_bound BC for ML_hydro::mom1!"); + } + + if (CCTK_EQUALS(mom2_bound, "none" ) || + CCTK_EQUALS(mom2_bound, "static") || + CCTK_EQUALS(mom2_bound, "flat" ) || + CCTK_EQUALS(mom2_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_hydro::mom2", mom2_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register mom2_bound BC for ML_hydro::mom2!"); + } + + if (CCTK_EQUALS(mom3_bound, "none" ) || + CCTK_EQUALS(mom3_bound, "static") || + CCTK_EQUALS(mom3_bound, "flat" ) || + CCTK_EQUALS(mom3_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "ML_hydro::mom3", mom3_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register mom3_bound BC for ML_hydro::mom3!"); + } + + if (CCTK_EQUALS(ene_group_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_ene_group_bound = -1; + if (handle_ene_group_bound < 0) handle_ene_group_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ene_group_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ene_group_bound , ene_group_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_ene_group_bound ,ene_group_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ene_group_bound, + "ML_hydro::ene_group", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_hydro::ene_group!"); + + } + + if (CCTK_EQUALS(mass_group_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_mass_group_bound = -1; + if (handle_mass_group_bound < 0) handle_mass_group_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_mass_group_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_mass_group_bound , mass_group_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_mass_group_bound ,mass_group_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_mass_group_bound, + "ML_hydro::mass_group", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_hydro::mass_group!"); + + } + + if (CCTK_EQUALS(mom_group_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_mom_group_bound = -1; + if (handle_mom_group_bound < 0) handle_mom_group_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_mom_group_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_mom_group_bound , mom_group_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_mom_group_bound ,mom_group_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_mom_group_bound, + "ML_hydro::mom_group", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_hydro::mom_group!"); + + } + + if (CCTK_EQUALS(ene_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_ene_bound = -1; + if (handle_ene_bound < 0) handle_ene_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ene_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ene_bound , ene_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_ene_bound ,ene_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ene_bound, + "ML_hydro::ene", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_hydro::ene!"); + + } + + if (CCTK_EQUALS(mass_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_mass_bound = -1; + if (handle_mass_bound < 0) handle_mass_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_mass_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_mass_bound , mass_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_mass_bound ,mass_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_mass_bound, + "ML_hydro::mass", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_hydro::mass!"); + + } + + if (CCTK_EQUALS(mom1_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_mom1_bound = -1; + if (handle_mom1_bound < 0) handle_mom1_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_mom1_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_mom1_bound , mom1_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_mom1_bound ,mom1_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_mom1_bound, + "ML_hydro::mom1", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_hydro::mom1!"); + + } + + if (CCTK_EQUALS(mom2_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_mom2_bound = -1; + if (handle_mom2_bound < 0) handle_mom2_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_mom2_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_mom2_bound , mom2_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_mom2_bound ,mom2_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_mom2_bound, + "ML_hydro::mom2", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_hydro::mom2!"); + + } + + if (CCTK_EQUALS(mom3_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_mom3_bound = -1; + if (handle_mom3_bound < 0) handle_mom3_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_mom3_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_mom3_bound , mom3_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_mom3_bound ,mom3_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_mom3_bound, + "ML_hydro::mom3", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for ML_hydro::mom3!"); + + } + + if (CCTK_EQUALS(ene_group_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_ene_group_bound = -1; + if (handle_ene_group_bound < 0) handle_ene_group_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ene_group_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ene_group_bound ,ene_group_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ene_group_bound, + "ML_hydro::ene_group", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Scalar BC for ML_hydro::ene_group!"); + + } + + if (CCTK_EQUALS(mass_group_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_mass_group_bound = -1; + if (handle_mass_group_bound < 0) handle_mass_group_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_mass_group_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_mass_group_bound ,mass_group_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_mass_group_bound, + "ML_hydro::mass_group", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Scalar BC for ML_hydro::mass_group!"); + + } + + if (CCTK_EQUALS(mom_group_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_mom_group_bound = -1; + if (handle_mom_group_bound < 0) handle_mom_group_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_mom_group_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_mom_group_bound ,mom_group_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_mom_group_bound, + "ML_hydro::mom_group", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Scalar BC for ML_hydro::mom_group!"); + + } + + if (CCTK_EQUALS(ene_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_ene_bound = -1; + if (handle_ene_bound < 0) handle_ene_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_ene_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_ene_bound ,ene_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_ene_bound, + "ML_hydro::ene", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_hydro::ene!"); + + } + + if (CCTK_EQUALS(mass_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_mass_bound = -1; + if (handle_mass_bound < 0) handle_mass_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_mass_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_mass_bound ,mass_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_mass_bound, + "ML_hydro::mass", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_hydro::mass!"); + + } + + if (CCTK_EQUALS(mom1_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_mom1_bound = -1; + if (handle_mom1_bound < 0) handle_mom1_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_mom1_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_mom1_bound ,mom1_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_mom1_bound, + "ML_hydro::mom1", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_hydro::mom1!"); + + } + + if (CCTK_EQUALS(mom2_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_mom2_bound = -1; + if (handle_mom2_bound < 0) handle_mom2_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_mom2_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_mom2_bound ,mom2_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_mom2_bound, + "ML_hydro::mom2", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_hydro::mom2!"); + + } + + if (CCTK_EQUALS(mom3_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_mom3_bound = -1; + if (handle_mom3_bound < 0) handle_mom3_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_mom3_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_mom3_bound ,mom3_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_mom3_bound, + "ML_hydro::mom3", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for ML_hydro::mom3!"); + + } + return; +} + + + +/* template for entries in parameter file: +#$bound$#ML_hydro::ene_group_bound = "skip" +#$bound$#ML_hydro::ene_group_bound_speed = 1.0 +#$bound$#ML_hydro::ene_group_bound_limit = 0.0 +#$bound$#ML_hydro::ene_group_bound_scalar = 0.0 + +#$bound$#ML_hydro::mass_group_bound = "skip" +#$bound$#ML_hydro::mass_group_bound_speed = 1.0 +#$bound$#ML_hydro::mass_group_bound_limit = 0.0 +#$bound$#ML_hydro::mass_group_bound_scalar = 0.0 + +#$bound$#ML_hydro::mom_group_bound = "skip" +#$bound$#ML_hydro::mom_group_bound_speed = 1.0 +#$bound$#ML_hydro::mom_group_bound_limit = 0.0 +#$bound$#ML_hydro::mom_group_bound_scalar = 0.0 + +#$bound$#ML_hydro::ene_bound = "skip" +#$bound$#ML_hydro::ene_bound_speed = 1.0 +#$bound$#ML_hydro::ene_bound_limit = 0.0 +#$bound$#ML_hydro::ene_bound_scalar = 0.0 + +#$bound$#ML_hydro::mass_bound = "skip" +#$bound$#ML_hydro::mass_bound_speed = 1.0 +#$bound$#ML_hydro::mass_bound_limit = 0.0 +#$bound$#ML_hydro::mass_bound_scalar = 0.0 + +#$bound$#ML_hydro::mom1_bound = "skip" +#$bound$#ML_hydro::mom1_bound_speed = 1.0 +#$bound$#ML_hydro::mom1_bound_limit = 0.0 +#$bound$#ML_hydro::mom1_bound_scalar = 0.0 + +#$bound$#ML_hydro::mom2_bound = "skip" +#$bound$#ML_hydro::mom2_bound_speed = 1.0 +#$bound$#ML_hydro::mom2_bound_limit = 0.0 +#$bound$#ML_hydro::mom2_bound_scalar = 0.0 + +#$bound$#ML_hydro::mom3_bound = "skip" +#$bound$#ML_hydro::mom3_bound_speed = 1.0 +#$bound$#ML_hydro::mom3_bound_limit = 0.0 +#$bound$#ML_hydro::mom3_bound_scalar = 0.0 + +*/ + diff --git a/ML_hydro/src/RegisterMoL.cc b/ML_hydro/src/RegisterMoL.cc new file mode 100644 index 0000000..3f877cb --- /dev/null +++ b/ML_hydro/src/RegisterMoL.cc @@ -0,0 +1,21 @@ +/* File produced by Kranc */ + +#include "cctk.h" +#include "cctk_Arguments.h" +#include "cctk_Parameters.h" + +extern "C" void ML_hydro_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_hydro::ene"), CCTK_VarIndex("ML_hydro::enerhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_hydro::mass"), CCTK_VarIndex("ML_hydro::massrhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_hydro::mom1"), CCTK_VarIndex("ML_hydro::mom1rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_hydro::mom2"), CCTK_VarIndex("ML_hydro::mom2rhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_hydro::mom3"), CCTK_VarIndex("ML_hydro::mom3rhs")); + return; +} diff --git a/ML_hydro/src/RegisterSymmetries.cc b/ML_hydro/src/RegisterSymmetries.cc new file mode 100644 index 0000000..efe3c53 --- /dev/null +++ b/ML_hydro/src/RegisterSymmetries.cc @@ -0,0 +1,154 @@ +/* File produced by Kranc */ + +#include "cctk.h" +#include "cctk_Arguments.h" +#include "cctk_Parameters.h" +#include "Symmetry.h" + +extern "C" void ML_hydro_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_hydro::ene"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_hydro::mass"); + + sym[0] = -1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_hydro::mom1"); + + sym[0] = 1; + sym[1] = -1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_hydro::mom2"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = -1; + SetCartSymVN(cctkGH, sym, "ML_hydro::mom3"); + + sym[0] = -1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_hydro::eneflux1"); + + sym[0] = 1; + sym[1] = -1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_hydro::eneflux2"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = -1; + SetCartSymVN(cctkGH, sym, "ML_hydro::eneflux3"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_hydro::eps"); + + sym[0] = -1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_hydro::massflux1"); + + sym[0] = 1; + sym[1] = -1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_hydro::massflux2"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = -1; + SetCartSymVN(cctkGH, sym, "ML_hydro::massflux3"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_hydro::momflux11"); + + sym[0] = -1; + sym[1] = -1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_hydro::momflux12"); + + sym[0] = -1; + sym[1] = 1; + sym[2] = -1; + SetCartSymVN(cctkGH, sym, "ML_hydro::momflux13"); + + sym[0] = -1; + sym[1] = -1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_hydro::momflux21"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_hydro::momflux22"); + + sym[0] = 1; + sym[1] = -1; + sym[2] = -1; + SetCartSymVN(cctkGH, sym, "ML_hydro::momflux23"); + + sym[0] = -1; + sym[1] = 1; + sym[2] = -1; + SetCartSymVN(cctkGH, sym, "ML_hydro::momflux31"); + + sym[0] = 1; + sym[1] = -1; + sym[2] = -1; + SetCartSymVN(cctkGH, sym, "ML_hydro::momflux32"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_hydro::momflux33"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_hydro::press"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_hydro::rho"); + + sym[0] = -1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_hydro::vel1"); + + sym[0] = 1; + sym[1] = -1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_hydro::vel2"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = -1; + SetCartSymVN(cctkGH, sym, "ML_hydro::vel3"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "ML_hydro::vol"); + +} diff --git a/ML_hydro/src/Startup.cc b/ML_hydro/src/Startup.cc new file mode 100644 index 0000000..deacf63 --- /dev/null +++ b/ML_hydro/src/Startup.cc @@ -0,0 +1,10 @@ +/* File produced by Kranc */ + +#include "cctk.h" + +extern "C" int ML_hydro_Startup(void) +{ + const char * banner = "ML_hydro"; + CCTK_RegisterBanner(banner); + return 0; +} diff --git a/ML_hydro/src/hydro_RHS.cc b/ML_hydro/src/hydro_RHS.cc new file mode 100644 index 0000000..702ad48 --- /dev/null +++ b/ML_hydro/src/hydro_RHS.cc @@ -0,0 +1,171 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +extern "C" void hydro_RHS_SelectBCs(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT ierr = 0; + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_hydro::ene_grouprhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_hydro::ene_grouprhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_hydro::mass_grouprhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_hydro::mass_grouprhs."); + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_hydro::mom_grouprhs","flat"); + if (ierr < 0) + CCTK_WARN(1, "Failed to register flat BC for ML_hydro::mom_grouprhs."); + return; +} + +static void hydro_RHS_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering hydro_RHS_Body"); + } + + if (cctk_iteration % hydro_RHS_calc_every != hydro_RHS_calc_offset) + { + return; + } + + const char *groups[] = {"ML_hydro::eneflux_group","ML_hydro::ene_grouprhs","ML_hydro::massflux_group","ML_hydro::mass_grouprhs","ML_hydro::momflux_group","ML_hydro::mom_grouprhs"}; + GenericFD_AssertGroupStorage(cctkGH, "hydro_RHS", 6, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o2dx = 0.5*INV(dx); + CCTK_REAL const p1o2dy = 0.5*INV(dy); + CCTK_REAL const p1o2dz = 0.5*INV(dz); + CCTK_REAL const p1o4dxdy = 0.25*INV(dx)*INV(dy); + CCTK_REAL const p1o4dxdz = 0.25*INV(dx)*INV(dz); + CCTK_REAL const p1o4dydz = 0.25*INV(dy)*INV(dz); + CCTK_REAL const p1odx2 = INV(SQR(dx)); + CCTK_REAL const p1ody2 = INV(SQR(dy)); + CCTK_REAL const p1odz2 = INV(SQR(dz)); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (hydro_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]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + CCTK_REAL eneflux1L = eneflux1[index]; + CCTK_REAL eneflux2L = eneflux2[index]; + CCTK_REAL eneflux3L = eneflux3[index]; + CCTK_REAL massflux1L = massflux1[index]; + CCTK_REAL massflux2L = massflux2[index]; + CCTK_REAL massflux3L = massflux3[index]; + CCTK_REAL momflux11L = momflux11[index]; + CCTK_REAL momflux12L = momflux12[index]; + CCTK_REAL momflux13L = momflux13[index]; + CCTK_REAL momflux21L = momflux21[index]; + CCTK_REAL momflux22L = momflux22[index]; + CCTK_REAL momflux23L = momflux23[index]; + CCTK_REAL momflux31L = momflux31[index]; + CCTK_REAL momflux32L = momflux32[index]; + CCTK_REAL momflux33L = momflux33[index]; + + /* Include user supplied include files */ + + /* Precompute derivatives */ + CCTK_REAL const PDstandardNth1eneflux1 = PDstandardNth1(&eneflux1[index]); + CCTK_REAL const PDstandardNth2eneflux2 = PDstandardNth2(&eneflux2[index]); + CCTK_REAL const PDstandardNth3eneflux3 = PDstandardNth3(&eneflux3[index]); + CCTK_REAL const PDstandardNth1massflux1 = PDstandardNth1(&massflux1[index]); + CCTK_REAL const PDstandardNth2massflux2 = PDstandardNth2(&massflux2[index]); + CCTK_REAL const PDstandardNth3massflux3 = PDstandardNth3(&massflux3[index]); + CCTK_REAL const PDstandardNth1momflux11 = PDstandardNth1(&momflux11[index]); + CCTK_REAL const PDstandardNth2momflux12 = PDstandardNth2(&momflux12[index]); + CCTK_REAL const PDstandardNth3momflux13 = PDstandardNth3(&momflux13[index]); + CCTK_REAL const PDstandardNth1momflux21 = PDstandardNth1(&momflux21[index]); + CCTK_REAL const PDstandardNth2momflux22 = PDstandardNth2(&momflux22[index]); + CCTK_REAL const PDstandardNth3momflux23 = PDstandardNth3(&momflux23[index]); + CCTK_REAL const PDstandardNth1momflux31 = PDstandardNth1(&momflux31[index]); + CCTK_REAL const PDstandardNth2momflux32 = PDstandardNth2(&momflux32[index]); + CCTK_REAL const PDstandardNth3momflux33 = PDstandardNth3(&momflux33[index]); + + /* Calculate temporaries and grid functions */ + CCTK_REAL massrhsL = -PDstandardNth1massflux1 - + PDstandardNth2massflux2 - PDstandardNth3massflux3; + + CCTK_REAL mom1rhsL = -PDstandardNth1momflux11 - + PDstandardNth2momflux12 - PDstandardNth3momflux13; + + CCTK_REAL mom2rhsL = -PDstandardNth1momflux21 - + PDstandardNth2momflux22 - PDstandardNth3momflux23; + + CCTK_REAL mom3rhsL = -PDstandardNth1momflux31 - + PDstandardNth2momflux32 - PDstandardNth3momflux33; + + CCTK_REAL enerhsL = -PDstandardNth1eneflux1 - PDstandardNth2eneflux2 - + PDstandardNth3eneflux3; + + + /* Copy local copies back to grid functions */ + enerhs[index] = enerhsL; + massrhs[index] = massrhsL; + mom1rhs[index] = mom1rhsL; + mom2rhs[index] = mom2rhsL; + mom3rhs[index] = mom3rhsL; + } + LC_ENDLOOP3 (hydro_RHS); +} + +extern "C" void hydro_RHS(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverInterior(cctkGH, &hydro_RHS_Body); +} diff --git a/ML_hydro/src/hydro_con2prim.cc b/ML_hydro/src/hydro_con2prim.cc new file mode 100644 index 0000000..66805d0 --- /dev/null +++ b/ML_hydro/src/hydro_con2prim.cc @@ -0,0 +1,133 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +static void hydro_con2prim_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering hydro_con2prim_Body"); + } + + if (cctk_iteration % hydro_con2prim_calc_every != hydro_con2prim_calc_offset) + { + return; + } + + const char *groups[] = {"ML_hydro::ene_group","ML_hydro::eps_group","ML_hydro::mass_group","ML_hydro::mom_group","ML_hydro::press_group","ML_hydro::rho_group","ML_hydro::vel_group","ML_hydro::vol_group"}; + GenericFD_AssertGroupStorage(cctkGH, "hydro_con2prim", 8, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o2dx = 0.5*INV(dx); + CCTK_REAL const p1o2dy = 0.5*INV(dy); + CCTK_REAL const p1o2dz = 0.5*INV(dz); + CCTK_REAL const p1o4dxdy = 0.25*INV(dx)*INV(dy); + CCTK_REAL const p1o4dxdz = 0.25*INV(dx)*INV(dz); + CCTK_REAL const p1o4dydz = 0.25*INV(dy)*INV(dz); + CCTK_REAL const p1odx2 = INV(SQR(dx)); + CCTK_REAL const p1ody2 = INV(SQR(dy)); + CCTK_REAL const p1odz2 = INV(SQR(dz)); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (hydro_con2prim, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + CCTK_REAL eneL = ene[index]; + CCTK_REAL epsL = eps[index]; + CCTK_REAL massL = mass[index]; + CCTK_REAL mom1L = mom1[index]; + CCTK_REAL mom2L = mom2[index]; + CCTK_REAL mom3L = mom3[index]; + CCTK_REAL rhoL = rho[index]; + CCTK_REAL vel1L = vel1[index]; + CCTK_REAL vel2L = vel2[index]; + CCTK_REAL vel3L = vel3[index]; + CCTK_REAL volL = vol[index]; + + /* Include user supplied include files */ + + /* Precompute derivatives */ + + /* Calculate temporaries and grid functions */ + rhoL = massL*INV(volL); + + vel1L = mom1L*INV(massL); + + vel2L = mom2L*INV(massL); + + vel3L = mom3L*INV(massL); + + epsL = 0.5*INV(massL)*(2*eneL - massL*(SQR(vel1L) + SQR(vel2L) + + SQR(vel3L))); + + CCTK_REAL pressL = epsL*rhoL*ToReal(Gamma); + + + /* Copy local copies back to grid functions */ + eps[index] = epsL; + press[index] = pressL; + rho[index] = rhoL; + vel1[index] = vel1L; + vel2[index] = vel2L; + vel3[index] = vel3L; + } + LC_ENDLOOP3 (hydro_con2prim); +} + +extern "C" void hydro_con2prim(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverEverything(cctkGH, &hydro_con2prim_Body); +} diff --git a/ML_hydro/src/hydro_prim2con.cc b/ML_hydro/src/hydro_prim2con.cc new file mode 100644 index 0000000..1cd9b72 --- /dev/null +++ b/ML_hydro/src/hydro_prim2con.cc @@ -0,0 +1,129 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +static void hydro_prim2con_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering hydro_prim2con_Body"); + } + + if (cctk_iteration % hydro_prim2con_calc_every != hydro_prim2con_calc_offset) + { + return; + } + + const char *groups[] = {"ML_hydro::ene_group","ML_hydro::eps_group","ML_hydro::mass_group","ML_hydro::mom_group","ML_hydro::rho_group","ML_hydro::vel_group","ML_hydro::vol_group"}; + GenericFD_AssertGroupStorage(cctkGH, "hydro_prim2con", 7, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o2dx = 0.5*INV(dx); + CCTK_REAL const p1o2dy = 0.5*INV(dy); + CCTK_REAL const p1o2dz = 0.5*INV(dz); + CCTK_REAL const p1o4dxdy = 0.25*INV(dx)*INV(dy); + CCTK_REAL const p1o4dxdz = 0.25*INV(dx)*INV(dz); + CCTK_REAL const p1o4dydz = 0.25*INV(dy)*INV(dz); + CCTK_REAL const p1odx2 = INV(SQR(dx)); + CCTK_REAL const p1ody2 = INV(SQR(dy)); + CCTK_REAL const p1odz2 = INV(SQR(dz)); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (hydro_prim2con, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + CCTK_REAL epsL = eps[index]; + CCTK_REAL massL = mass[index]; + CCTK_REAL rhoL = rho[index]; + CCTK_REAL vel1L = vel1[index]; + CCTK_REAL vel2L = vel2[index]; + CCTK_REAL vel3L = vel3[index]; + CCTK_REAL volL = vol[index]; + + /* Include user supplied include files */ + + /* Precompute derivatives */ + + /* Calculate temporaries and grid functions */ + volL = CUB(ToReal(h)); + + massL = rhoL*volL; + + CCTK_REAL mom1L = massL*vel1L; + + CCTK_REAL mom2L = massL*vel2L; + + CCTK_REAL mom3L = massL*vel3L; + + CCTK_REAL eneL = 0.5*massL*(2*epsL + SQR(vel1L) + SQR(vel2L) + + SQR(vel3L)); + + + /* Copy local copies back to grid functions */ + ene[index] = eneL; + mass[index] = massL; + mom1[index] = mom1L; + mom2[index] = mom2L; + mom3[index] = mom3L; + vol[index] = volL; + } + LC_ENDLOOP3 (hydro_prim2con); +} + +extern "C" void hydro_prim2con(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverEverything(cctkGH, &hydro_prim2con_Body); +} diff --git a/ML_hydro/src/hydro_soundWave.cc b/ML_hydro/src/hydro_soundWave.cc new file mode 100644 index 0000000..32a43f8 --- /dev/null +++ b/ML_hydro/src/hydro_soundWave.cc @@ -0,0 +1,119 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +static void hydro_soundWave_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering hydro_soundWave_Body"); + } + + if (cctk_iteration % hydro_soundWave_calc_every != hydro_soundWave_calc_offset) + { + return; + } + + const char *groups[] = {"ML_hydro::eps_group","grid::coordinates","ML_hydro::rho_group","ML_hydro::vel_group"}; + GenericFD_AssertGroupStorage(cctkGH, "hydro_soundWave", 4, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o2dx = 0.5*INV(dx); + CCTK_REAL const p1o2dy = 0.5*INV(dy); + CCTK_REAL const p1o2dz = 0.5*INV(dz); + CCTK_REAL const p1o4dxdy = 0.25*INV(dx)*INV(dy); + CCTK_REAL const p1o4dxdz = 0.25*INV(dx)*INV(dz); + CCTK_REAL const p1o4dydz = 0.25*INV(dy)*INV(dz); + CCTK_REAL const p1odx2 = INV(SQR(dx)); + CCTK_REAL const p1ody2 = INV(SQR(dy)); + CCTK_REAL const p1odz2 = INV(SQR(dz)); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (hydro_soundWave, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + CCTK_REAL xL = x[index]; + + /* Include user supplied include files */ + + /* Precompute derivatives */ + + /* Calculate temporaries and grid functions */ + CCTK_REAL rhoL = 1.; + + CCTK_REAL vel1L = Sin(2*Pi*xL*INV(ToReal(L)))*ToReal(A); + + CCTK_REAL vel2L = Sin(2*Pi*xL*INV(ToReal(L)))*ToReal(A); + + CCTK_REAL vel3L = Sin(2*Pi*xL*INV(ToReal(L)))*ToReal(A); + + CCTK_REAL epsL = 1.; + + + /* Copy local copies back to grid functions */ + eps[index] = epsL; + rho[index] = rhoL; + vel1[index] = vel1L; + vel2[index] = vel2L; + vel3[index] = vel3L; + } + LC_ENDLOOP3 (hydro_soundWave); +} + +extern "C" void hydro_soundWave(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverEverything(cctkGH, &hydro_soundWave_Body); +} diff --git a/ML_hydro/src/hydro_vacuum.cc b/ML_hydro/src/hydro_vacuum.cc new file mode 100644 index 0000000..da42dd5 --- /dev/null +++ b/ML_hydro/src/hydro_vacuum.cc @@ -0,0 +1,118 @@ +/* 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 QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +static void hydro_vacuum_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* Declare finite differencing variables */ + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering hydro_vacuum_Body"); + } + + if (cctk_iteration % hydro_vacuum_calc_every != hydro_vacuum_calc_offset) + { + return; + } + + const char *groups[] = {"ML_hydro::eps_group","ML_hydro::rho_group","ML_hydro::vel_group"}; + GenericFD_AssertGroupStorage(cctkGH, "hydro_vacuum", 3, groups); + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + ptrdiff_t const di = 1; + ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); + ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); + CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); + CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); + CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); + CCTK_REAL const dxi = INV(dx); + CCTK_REAL const dyi = INV(dy); + CCTK_REAL const dzi = INV(dz); + CCTK_REAL const khalf = 0.5; + CCTK_REAL const kthird = 1/3.0; + CCTK_REAL const ktwothird = 2.0/3.0; + CCTK_REAL const kfourthird = 4.0/3.0; + CCTK_REAL const keightthird = 8.0/3.0; + CCTK_REAL const hdxi = 0.5 * dxi; + CCTK_REAL const hdyi = 0.5 * dyi; + CCTK_REAL const hdzi = 0.5 * dzi; + + /* Initialize predefined quantities */ + CCTK_REAL const p1o2dx = 0.5*INV(dx); + CCTK_REAL const p1o2dy = 0.5*INV(dy); + CCTK_REAL const p1o2dz = 0.5*INV(dz); + CCTK_REAL const p1o4dxdy = 0.25*INV(dx)*INV(dy); + CCTK_REAL const p1o4dxdz = 0.25*INV(dx)*INV(dz); + CCTK_REAL const p1o4dydz = 0.25*INV(dy)*INV(dz); + CCTK_REAL const p1odx2 = INV(SQR(dx)); + CCTK_REAL const p1ody2 = INV(SQR(dy)); + CCTK_REAL const p1odz2 = INV(SQR(dz)); + + /* Loop over the grid points */ + #pragma omp parallel + LC_LOOP3 (hydro_vacuum, + i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + ptrdiff_t const index = di*i + dj*j + dk*k; + + /* Assign local copies of grid functions */ + + /* Include user supplied include files */ + + /* Precompute derivatives */ + + /* Calculate temporaries and grid functions */ + CCTK_REAL rhoL = 0; + + CCTK_REAL vel1L = 0; + + CCTK_REAL vel2L = 0; + + CCTK_REAL vel3L = 0; + + CCTK_REAL epsL = 0; + + + /* Copy local copies back to grid functions */ + eps[index] = epsL; + rho[index] = rhoL; + vel1[index] = vel1L; + vel2[index] = vel2L; + vel3[index] = vel3L; + } + LC_ENDLOOP3 (hydro_vacuum); +} + +extern "C" void hydro_vacuum(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + GenericFD_LoopOverEverything(cctkGH, &hydro_vacuum_Body); +} |