From a52abf35db4c68c5e28e8ce9b00b394c4ea382ee Mon Sep 17 00:00:00 2001 From: Erik Schnetter Date: Fri, 4 Sep 2009 18:50:58 -0500 Subject: Add new RHS boundary condition NewRad, implemented in the thorn LSUThorns/NewRad. --- ML_BSSN_Helper/interface.ccl | 29 ++++++++++++++- ML_BSSN_Helper/param.ccl | 11 ++++++ ML_BSSN_Helper/schedule.ccl | 27 ++++++++++++++ ML_BSSN_Helper/src/ExtrapolateGammas.c | 29 +++++++++++++++ ML_BSSN_Helper/src/NewRad.c | 67 ++++++++++++++++++++++++++++++++++ ML_BSSN_Helper/src/make.code.defn | 2 +- 6 files changed, 163 insertions(+), 2 deletions(-) create mode 100644 ML_BSSN_Helper/src/ExtrapolateGammas.c create mode 100644 ML_BSSN_Helper/src/NewRad.c (limited to 'ML_BSSN_Helper') diff --git a/ML_BSSN_Helper/interface.ccl b/ML_BSSN_Helper/interface.ccl index 8ad9ba2..4c57f29 100644 --- a/ML_BSSN_Helper/interface.ccl +++ b/ML_BSSN_Helper/interface.ccl @@ -6,5 +6,32 @@ USES INCLUDE: Symmetry.h -CCTK_INT FUNCTION Boundary_SelectGroupForBC(CCTK_POINTER_TO_CONST IN GH, CCTK_INT IN faces, CCTK_INT IN boundary_width, CCTK_INT IN table_handle, CCTK_STRING IN group_name, CCTK_STRING IN bc_name) +CCTK_INT FUNCTION MoLRegisterConstrainedGroup \ + (CCTK_INT IN ConstrainedIndex) +USES FUNCTION MoLRegisterConstrainedGroup + +CCTK_INT FUNCTION \ + Boundary_SelectGroupForBC \ + (CCTK_POINTER_TO_CONST IN cctkGH, \ + CCTK_INT IN faces, \ + CCTK_INT IN boundary_width, \ + CCTK_INT IN table_handle, \ + CCTK_STRING IN group_name, \ + CCTK_STRING IN bc_name) USES FUNCTION Boundary_SelectGroupForBC + +CCTK_INT FUNCTION \ + ExtrapolateGammas \ + (CCTK_POINTER_TO_CONST IN cctkGH, \ + CCTK_REAL ARRAY INOUT var) +USES FUNCTION ExtrapolateGammas + +CCTK_INT FUNCTION \ + NewRad_Apply \ + (CCTK_POINTER_TO_CONST IN cctkGH, \ + CCTK_REAL ARRAY IN var, \ + CCTK_REAL ARRAY INOUT rhs, \ + CCTK_REAL IN var0, \ + CCTK_REAL IN v0, \ + CCTK_INT IN radpower) +USES FUNCTION NewRad_Apply diff --git a/ML_BSSN_Helper/param.ccl b/ML_BSSN_Helper/param.ccl index 605ea7a..338d0a2 100644 --- a/ML_BSSN_Helper/param.ccl +++ b/ML_BSSN_Helper/param.ccl @@ -1,3 +1,7 @@ +SHARES: Boundary + +USES CCTK_INT radpower + SHARES: MethodofLines USES CCTK_INT MoL_Num_Constrained_Vars @@ -15,6 +19,13 @@ SHARES: ML_BSSN USES CCTK_INT timelevels USES KEYWORD calculate_ADMBase_variables_at +USES CCTK_REAL harmonicF + +EXTENDS KEYWORD my_rhs_boundary_condition +{ + "NewRad" :: "NewRad" +} + PRIVATE: CCTK_INT ML_BSSN_MaxNumConstrainedVars "Number of constrained variables used by this thorn" ACCUMULATOR-BASE=MethodofLines::MoL_Num_Constrained_Vars diff --git a/ML_BSSN_Helper/schedule.ccl b/ML_BSSN_Helper/schedule.ccl index a2134a1..48bea28 100644 --- a/ML_BSSN_Helper/schedule.ccl +++ b/ML_BSSN_Helper/schedule.ccl @@ -62,6 +62,33 @@ if (CCTK_EQUALS (evolution_method, "ML_BSSN")) { + if (CCTK_EQUALS (my_rhs_boundary_condition, "NewRad")) + { + SCHEDULE ML_BSSN_ExtrapolateGammas AT initial AFTER ML_BSSN_convertFromADMBaseGamma + { + LANG: C + SYNC: ML_Gamma + SYNC: ML_dtlapse + SYNC: ML_dtshift + } "Extrapolate Gammas and time derivatives of lapse and shift" + + SCHEDULE ML_BSSN_NewRad IN ML_BSSN_evolCalcGroup AFTER ML_BSSN_RHS + { + LANG: C + SYNC: ML_curvrhs + SYNC: ML_dtlapserhs + SYNC: ML_dtshiftrhs + SYNC: ML_Gammarhs + SYNC: ML_lapserhs + SYNC: ML_log_confacrhs + SYNC: ML_metricrhs + SYNC: ML_shiftrhs + SYNC: ML_trace_curvrhs + } "Apply NewRad boundary conditions to RHS" + } + + + SCHEDULE GROUP ML_BSSN_convertToADMBaseGroup IN ML_BSSN_convertToADMBaseGroupWrapper { } "Calculate ADM variables" diff --git a/ML_BSSN_Helper/src/ExtrapolateGammas.c b/ML_BSSN_Helper/src/ExtrapolateGammas.c new file mode 100644 index 0000000..4e52e8f --- /dev/null +++ b/ML_BSSN_Helper/src/ExtrapolateGammas.c @@ -0,0 +1,29 @@ +#include +#include + +static void +extrap (cGH const * restrict cctkGH, + CCTK_REAL * restrict var); + +void +ML_BSSN_ExtrapolateGammas (CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + + extrap (cctkGH, Xt1); + extrap (cctkGH, Xt2); + extrap (cctkGH, Xt3); + + extrap (cctkGH, A); + + extrap (cctkGH, B1); + extrap (cctkGH, B2); + extrap (cctkGH, B3); +} + +static void +extrap (cGH const * restrict const cctkGH, + CCTK_REAL * restrict const var) +{ + ExtrapolateGammas (cctkGH, var); +} diff --git a/ML_BSSN_Helper/src/NewRad.c b/ML_BSSN_Helper/src/NewRad.c new file mode 100644 index 0000000..9c576a1 --- /dev/null +++ b/ML_BSSN_Helper/src/NewRad.c @@ -0,0 +1,67 @@ +#include + +#include +#include +#include + +static void +newrad (cGH const * restrict cctkGH, + CCTK_REAL const * restrict var, + CCTK_REAL * restrict rhs, + CCTK_REAL var0, + CCTK_REAL v0); + +void +ML_BSSN_NewRad (CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_REAL const v0 = sqrt (harmonicF); + + newrad (cctkGH, phi , phirhs , 0.0, v0 ); + + newrad (cctkGH, gt11 , gt11rhs , 1.0, 1.0); + newrad (cctkGH, gt12 , gt12rhs , 0.0, 1.0); + newrad (cctkGH, gt13 , gt13rhs , 0.0, 1.0); + newrad (cctkGH, gt22 , gt22rhs , 1.0, 1.0); + newrad (cctkGH, gt23 , gt23rhs , 0.0, 1.0); + newrad (cctkGH, gt33 , gt33rhs , 1.0, 1.0); + + newrad (cctkGH, Xt1 , Xt1rhs , 0.0, 1.0); + newrad (cctkGH, Xt2 , Xt2rhs , 0.0, 1.0); + newrad (cctkGH, Xt3 , Xt3rhs , 0.0, 1.0); + + newrad (cctkGH, trK , trKrhs , 0.0, v0 ); + + newrad (cctkGH, At11 , At11rhs , 0.0, 1.0); + newrad (cctkGH, At12 , At12rhs , 0.0, 1.0); + newrad (cctkGH, At13 , At13rhs , 0.0, 1.0); + newrad (cctkGH, At22 , At22rhs , 0.0, 1.0); + newrad (cctkGH, At23 , At23rhs , 0.0, 1.0); + newrad (cctkGH, At33 , At33rhs , 0.0, 1.0); + + newrad (cctkGH, alpha, alpharhs, 1.0, v0 ); + + newrad (cctkGH, A , Arhs , 0.0, v0 ); + + newrad (cctkGH, beta1, beta1rhs, 0.0, 1.0); + newrad (cctkGH, beta2, beta2rhs, 0.0, 1.0); + newrad (cctkGH, beta3, beta3rhs, 0.0, 1.0); + + newrad (cctkGH, B1 , B1rhs , 0.0, 1.0); + newrad (cctkGH, B2 , B2rhs , 0.0, 1.0); + newrad (cctkGH, B3 , B3rhs , 0.0, 1.0); +} + +static void +newrad (cGH const * restrict const cctkGH, + CCTK_REAL const * restrict const var, + CCTK_REAL * restrict const rhs, + CCTK_REAL const var0, + CCTK_REAL const v0) +{ + DECLARE_CCTK_PARAMETERS; + + NewRad_Apply (cctkGH, var, rhs, var0, v0, radpower); +} diff --git a/ML_BSSN_Helper/src/make.code.defn b/ML_BSSN_Helper/src/make.code.defn index dcfe66e..7cc4e72 100644 --- a/ML_BSSN_Helper/src/make.code.defn +++ b/ML_BSSN_Helper/src/make.code.defn @@ -1,3 +1,3 @@ # -*-Makefile-*- -SRCS = RegisterConstrained.c RegisterSlicing.c SelectBCsADMBase.c UnsetCheckpointTags.c +SRCS = ExtrapolateGammas.c NewRad.c RegisterConstrained.c RegisterSlicing.c SelectBCsADMBase.c UnsetCheckpointTags.c # CopyADMBase.c -- cgit v1.2.3