diff options
author | Erik Schnetter <schnetter@cct.lsu.edu> | 2011-04-03 15:52:06 -0400 |
---|---|---|
committer | Erik Schnetter <schnetter@cct.lsu.edu> | 2011-04-03 15:52:06 -0400 |
commit | 5dbceebfbc51ed8a947211bd448d546d7aad3b12 (patch) | |
tree | 2935660d1cd0028ec9b145291c107d31191d0d5c /ML_BSSN | |
parent | bd50b6459efb30787b3e523810e636d7d589cc26 (diff) |
Update auto-generated code as generated by the current version of Kranc
Diffstat (limited to 'ML_BSSN')
-rw-r--r-- | ML_BSSN/src/Boundaries.cc | 1809 | ||||
-rw-r--r-- | ML_BSSN/src/ML_BSSN_Minkowski.cc | 187 | ||||
-rw-r--r-- | ML_BSSN/src/ML_BSSN_RHS1.cc | 846 | ||||
-rw-r--r-- | ML_BSSN/src/ML_BSSN_RHS2.cc | 794 | ||||
-rw-r--r-- | ML_BSSN/src/ML_BSSN_RHSStaticBoundary.cc | 223 | ||||
-rw-r--r-- | ML_BSSN/src/ML_BSSN_boundary.cc | 223 | ||||
-rw-r--r-- | ML_BSSN/src/ML_BSSN_constraints1.cc | 585 | ||||
-rw-r--r-- | ML_BSSN/src/ML_BSSN_constraints2.cc | 388 | ||||
-rw-r--r-- | ML_BSSN/src/ML_BSSN_convertFromADMBase.cc | 222 | ||||
-rw-r--r-- | ML_BSSN/src/ML_BSSN_convertFromADMBaseGamma.cc | 326 | ||||
-rw-r--r-- | ML_BSSN/src/ML_BSSN_convertToADMBase.cc | 193 | ||||
-rw-r--r-- | ML_BSSN/src/ML_BSSN_convertToADMBaseDtLapseShift.cc | 207 | ||||
-rw-r--r-- | ML_BSSN/src/ML_BSSN_convertToADMBaseDtLapseShiftBoundary.cc | 165 | ||||
-rw-r--r-- | ML_BSSN/src/ML_BSSN_convertToADMBaseFakeDtLapseShift.cc | 150 | ||||
-rw-r--r-- | ML_BSSN/src/ML_BSSN_enforce.cc | 163 | ||||
-rw-r--r-- | ML_BSSN/src/RegisterMoL.cc | 41 | ||||
-rw-r--r-- | ML_BSSN/src/RegisterSymmetries.cc | 189 | ||||
-rw-r--r-- | ML_BSSN/src/Startup.cc | 10 |
18 files changed, 6721 insertions, 0 deletions
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; +} |