diff options
Diffstat (limited to 'Examples/SimpleWave')
-rw-r--r-- | Examples/SimpleWave/schedule.ccl | 19 | ||||
-rw-r--r-- | Examples/SimpleWave/src/calc_rhs.cc | 20 | ||||
-rw-r--r-- | Examples/SimpleWave/src/initial_sine.cc | 24 | ||||
-rw-r--r-- | Examples/SimpleWave/src/make.code.defn | 2 |
4 files changed, 36 insertions, 29 deletions
diff --git a/Examples/SimpleWave/schedule.ccl b/Examples/SimpleWave/schedule.ccl index d5e8e4c..853e2ea 100644 --- a/Examples/SimpleWave/schedule.ccl +++ b/Examples/SimpleWave/schedule.ccl @@ -33,12 +33,6 @@ schedule SimpleWave_Startup at STARTUP OPTIONS: meta } "create banner" -schedule SimpleWave_RegisterVars in MoL_Register -{ - LANG: C - OPTIONS: meta -} "Register Variables for MoL" - schedule SimpleWave_RegisterSymmetries in SymmetryRegister { LANG: C @@ -48,11 +42,18 @@ schedule SimpleWave_RegisterSymmetries in SymmetryRegister schedule initial_sine AT INITIAL { LANG: C + READS: grid::x + WRITES: SimpleWave::phi + WRITES: SimpleWave::pi } "initial_sine" schedule calc_rhs in MoL_CalcRHS { LANG: C + READS: SimpleWave::phi + READS: SimpleWave::pi + WRITES: SimpleWave::phirhs + WRITES: SimpleWave::pirhs } "calc_rhs" schedule SimpleWave_SelectBoundConds in MoL_PostStep @@ -68,6 +69,12 @@ schedule SimpleWave_CheckBoundaries at BASEGRID OPTIONS: meta } "check boundaries treatment" +schedule SimpleWave_RegisterVars in MoL_Register +{ + LANG: C + OPTIONS: meta +} "Register Variables for MoL" + schedule group ApplyBCs as SimpleWave_ApplyBCs in MoL_PostStep after SimpleWave_SelectBoundConds { # no language specified diff --git a/Examples/SimpleWave/src/calc_rhs.cc b/Examples/SimpleWave/src/calc_rhs.cc index f2af270..4a5d002 100644 --- a/Examples/SimpleWave/src/calc_rhs.cc +++ b/Examples/SimpleWave/src/calc_rhs.cc @@ -17,10 +17,10 @@ /* Define macros used in calculations */ #define INITVALUE (42) -#define QAD(x) (SQR(SQR(x))) -#define INV(x) ((1.0) / (x)) +#define INV(x) ((CCTK_REAL)1.0 / (x)) #define SQR(x) ((x) * (x)) -#define CUB(x) ((x) * (x) * (x)) +#define CUB(x) ((x) * SQR(x)) +#define QAD(x) (SQR(SQR(x))) extern "C" void calc_rhs_SelectBCs(CCTK_ARGUMENTS) { @@ -40,8 +40,6 @@ static void calc_rhs_Body(cGH const * restrict const cctkGH, int const dir, int DECLARE_CCTK_PARAMETERS; - /* Declare finite differencing variables */ - /* Include user-supplied include files */ /* Initialise finite differencing variables */ @@ -86,9 +84,9 @@ static void calc_rhs_Body(cGH const * restrict const cctkGH, int const dir, int /* Loop over the grid points */ #pragma omp parallel - CCTK_LOOP3 (calc_rhs, + CCTK_LOOP3(calc_rhs, i,j,k, imin[0],imin[1],imin[2], imax[0],imax[1],imax[2], - cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + cctk_ash[0],cctk_ash[1],cctk_ash[2]) { ptrdiff_t const index = di*i + dj*j + dk*k; @@ -115,7 +113,7 @@ static void calc_rhs_Body(cGH const * restrict const cctkGH, int const dir, int phirhs[index] = phirhsL; pirhs[index] = pirhsL; } - CCTK_ENDLOOP3 (calc_rhs); + CCTK_ENDLOOP3(calc_rhs); } extern "C" void calc_rhs(CCTK_ARGUMENTS) @@ -134,12 +132,14 @@ extern "C" void calc_rhs(CCTK_ARGUMENTS) return; } - const char *groups[] = {"SimpleWave::evolved_group","SimpleWave::evolved_grouprhs"}; + const char *const groups[] = { + "SimpleWave::evolved_group", + "SimpleWave::evolved_grouprhs"}; GenericFD_AssertGroupStorage(cctkGH, "calc_rhs", 2, groups); GenericFD_EnsureStencilFits(cctkGH, "calc_rhs", 1, 1, 1); - GenericFD_LoopOverInterior(cctkGH, &calc_rhs_Body); + GenericFD_LoopOverInterior(cctkGH, calc_rhs_Body); if (verbose > 1) { diff --git a/Examples/SimpleWave/src/initial_sine.cc b/Examples/SimpleWave/src/initial_sine.cc index c8a5656..cae7f0a 100644 --- a/Examples/SimpleWave/src/initial_sine.cc +++ b/Examples/SimpleWave/src/initial_sine.cc @@ -17,10 +17,10 @@ /* Define macros used in calculations */ #define INITVALUE (42) -#define QAD(x) (SQR(SQR(x))) -#define INV(x) ((1.0) / (x)) +#define INV(x) ((CCTK_REAL)1.0 / (x)) #define SQR(x) ((x) * (x)) -#define CUB(x) ((x) * (x) * (x)) +#define CUB(x) ((x) * SQR(x)) +#define QAD(x) (SQR(SQR(x))) static void initial_sine_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 imin[3], int const imax[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) { @@ -28,8 +28,6 @@ static void initial_sine_Body(cGH const * restrict const cctkGH, int const dir, DECLARE_CCTK_PARAMETERS; - /* Declare finite differencing variables */ - /* Include user-supplied include files */ /* Initialise finite differencing variables */ @@ -74,9 +72,9 @@ static void initial_sine_Body(cGH const * restrict const cctkGH, int const dir, /* Loop over the grid points */ #pragma omp parallel - CCTK_LOOP3 (initial_sine, + CCTK_LOOP3(initial_sine, i,j,k, imin[0],imin[1],imin[2], imax[0],imax[1],imax[2], - cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + cctk_ash[0],cctk_ash[1],cctk_ash[2]) { ptrdiff_t const index = di*i + dj*j + dk*k; @@ -90,15 +88,15 @@ static void initial_sine_Body(cGH const * restrict const cctkGH, int const dir, /* Precompute derivatives */ /* Calculate temporaries and grid functions */ - CCTK_REAL phiL = Sin(2*Pi*(xL - cctk_time)); + CCTK_REAL phiL = sin(2*Pi*(xL - t)); - CCTK_REAL piL = -2*Pi*Cos(2*Pi*(xL - cctk_time)); + CCTK_REAL piL = -2*Pi*cos(2*Pi*(xL - t)); /* Copy local copies back to grid functions */ phi[index] = phiL; pi[index] = piL; } - CCTK_ENDLOOP3 (initial_sine); + CCTK_ENDLOOP3(initial_sine); } extern "C" void initial_sine(CCTK_ARGUMENTS) @@ -117,11 +115,13 @@ extern "C" void initial_sine(CCTK_ARGUMENTS) return; } - const char *groups[] = {"SimpleWave::evolved_group","grid::coordinates"}; + const char *const groups[] = { + "SimpleWave::evolved_group", + "grid::coordinates"}; GenericFD_AssertGroupStorage(cctkGH, "initial_sine", 2, groups); - GenericFD_LoopOverEverything(cctkGH, &initial_sine_Body); + GenericFD_LoopOverEverything(cctkGH, initial_sine_Body); if (verbose > 1) { diff --git a/Examples/SimpleWave/src/make.code.defn b/Examples/SimpleWave/src/make.code.defn index 535f5d0..3332924 100644 --- a/Examples/SimpleWave/src/make.code.defn +++ b/Examples/SimpleWave/src/make.code.defn @@ -1,3 +1,3 @@ # File produced by Kranc -SRCS = Startup.cc RegisterMoL.cc RegisterSymmetries.cc initial_sine.cc calc_rhs.cc Boundaries.cc +SRCS = Startup.cc RegisterSymmetries.cc RegisterMoL.cc initial_sine.cc calc_rhs.cc Boundaries.cc |