aboutsummaryrefslogtreecommitdiff
path: root/Examples/EM
diff options
context:
space:
mode:
Diffstat (limited to 'Examples/EM')
-rw-r--r--Examples/EM/param.ccl6
-rw-r--r--Examples/EM/schedule.ccl47
-rw-r--r--Examples/EM/src/Differencing.h144
-rw-r--r--Examples/EM/src/EM_constraints.cc37
-rw-r--r--Examples/EM/src/EM_energy.cc37
-rw-r--r--Examples/EM/src/EM_evol.cc38
-rw-r--r--Examples/EM/src/EM_initial.cc43
-rw-r--r--Examples/EM/src/make.code.defn2
8 files changed, 114 insertions, 240 deletions
diff --git a/Examples/EM/param.ccl b/Examples/EM/param.ccl
index 4d95cbd..7b16dd2 100644
--- a/Examples/EM/param.ccl
+++ b/Examples/EM/param.ccl
@@ -23,12 +23,6 @@ CCTK_REAL sigma "sigma"
} 0
restricted:
-CCTK_REAL hlleAlpha "hlleAlpha"
-{
- "*:*" :: ""
-} 0
-
-restricted:
CCTK_INT EM_MaxNumEvolvedVars "Number of evolved variables used by this thorn" ACCUMULATOR-BASE=MethodofLines::MoL_Num_Evolved_Vars STEERABLE=RECOVER
{
6:6 :: "Number of evolved variables used by this thorn"
diff --git a/Examples/EM/schedule.ccl b/Examples/EM/schedule.ccl
index 3dfb80d..2ada2aa 100644
--- a/Examples/EM/schedule.ccl
+++ b/Examples/EM/schedule.ccl
@@ -69,12 +69,6 @@ schedule EM_Startup at STARTUP
OPTIONS: meta
} "create banner"
-schedule EM_RegisterVars in MoL_Register
-{
- LANG: C
- OPTIONS: meta
-} "Register Variables for MoL"
-
schedule EM_RegisterSymmetries in SymmetryRegister
{
LANG: C
@@ -84,11 +78,31 @@ schedule EM_RegisterSymmetries in SymmetryRegister
schedule EM_initial at CCTK_INITIAL
{
LANG: C
+ READS: grid::x
+ READS: grid::y
+ WRITES: EM::B1
+ WRITES: EM::B2
+ WRITES: EM::B3
+ WRITES: EM::El1
+ WRITES: EM::El2
+ WRITES: EM::El3
} "EM_initial"
schedule EM_evol in MoL_CalcRHS
{
LANG: C
+ READS: EM::B1
+ READS: EM::B2
+ READS: EM::B3
+ READS: EM::El1
+ READS: EM::El2
+ READS: EM::El3
+ WRITES: EM::B1rhs
+ WRITES: EM::B2rhs
+ WRITES: EM::B3rhs
+ WRITES: EM::El1rhs
+ WRITES: EM::El2rhs
+ WRITES: EM::El3rhs
} "EM_evol"
schedule group EM_constraints_group in MoL_PseudoEvolution
@@ -99,6 +113,14 @@ schedule group EM_constraints_group in MoL_PseudoEvolution
schedule EM_constraints in EM_constraints_group
{
LANG: C
+ READS: EM::B1
+ READS: EM::B2
+ READS: EM::B3
+ READS: EM::El1
+ READS: EM::El2
+ READS: EM::El3
+ WRITES: EM::CB
+ WRITES: EM::CEl
} "EM_constraints"
schedule EM_constraints_SelectBCs in EM_constraints_bc_group
@@ -131,6 +153,13 @@ schedule group EM_energy_group in MoL_PseudoEvolution
schedule EM_energy in EM_energy_group
{
LANG: C
+ READS: EM::B1
+ READS: EM::B2
+ READS: EM::B3
+ READS: EM::El1
+ READS: EM::El2
+ READS: EM::El3
+ WRITES: EM::rho
} "EM_energy"
schedule EM_SelectBoundConds in MoL_PostStep
@@ -147,6 +176,12 @@ schedule EM_CheckBoundaries at BASEGRID
OPTIONS: meta
} "check boundaries treatment"
+schedule EM_RegisterVars in MoL_Register
+{
+ LANG: C
+ OPTIONS: meta
+} "Register Variables for MoL"
+
schedule group ApplyBCs as EM_ApplyBCs in MoL_PostStep after EM_SelectBoundConds
{
# no language specified
diff --git a/Examples/EM/src/Differencing.h b/Examples/EM/src/Differencing.h
index e6b9ac7..93bbe62 100644
--- a/Examples/EM/src/Differencing.h
+++ b/Examples/EM/src/Differencing.h
@@ -286,147 +286,3 @@ static CCTK_REAL PDstandard4th32_impl(CCTK_REAL const* restrict const u, CCTK_RE
}
#endif
-#ifndef KRANC_DIFF_FUNCTIONS
-# define DiffPlus1(u) ((-KRANC_GFOFFSET3D(u,0,0,0) + KRANC_GFOFFSET3D(u,1,0,0))*p1o1)
-#else
-# define DiffPlus1(u) (DiffPlus1_impl(u,p1o1,cdj,cdk))
-static CCTK_REAL DiffPlus1_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o1, ptrdiff_t const cdj, ptrdiff_t const cdk) CCTK_ATTRIBUTE_NOINLINE CCTK_ATTRIBUTE_UNUSED;
-static CCTK_REAL DiffPlus1_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o1, ptrdiff_t const cdj, ptrdiff_t const cdk)
-{
- ptrdiff_t const cdi=sizeof(CCTK_REAL);
- return (-KRANC_GFOFFSET3D(u,0,0,0) + KRANC_GFOFFSET3D(u,1,0,0))*p1o1;
-}
-#endif
-
-#ifndef KRANC_DIFF_FUNCTIONS
-# define DiffPlus2(u) ((-KRANC_GFOFFSET3D(u,0,0,0) + KRANC_GFOFFSET3D(u,0,1,0))*p1o1)
-#else
-# define DiffPlus2(u) (DiffPlus2_impl(u,p1o1,cdj,cdk))
-static CCTK_REAL DiffPlus2_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o1, ptrdiff_t const cdj, ptrdiff_t const cdk) CCTK_ATTRIBUTE_NOINLINE CCTK_ATTRIBUTE_UNUSED;
-static CCTK_REAL DiffPlus2_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o1, ptrdiff_t const cdj, ptrdiff_t const cdk)
-{
- ptrdiff_t const cdi=sizeof(CCTK_REAL);
- return (-KRANC_GFOFFSET3D(u,0,0,0) + KRANC_GFOFFSET3D(u,0,1,0))*p1o1;
-}
-#endif
-
-#ifndef KRANC_DIFF_FUNCTIONS
-# define DiffPlus3(u) ((-KRANC_GFOFFSET3D(u,0,0,0) + KRANC_GFOFFSET3D(u,0,0,1))*p1o1)
-#else
-# define DiffPlus3(u) (DiffPlus3_impl(u,p1o1,cdj,cdk))
-static CCTK_REAL DiffPlus3_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o1, ptrdiff_t const cdj, ptrdiff_t const cdk) CCTK_ATTRIBUTE_NOINLINE CCTK_ATTRIBUTE_UNUSED;
-static CCTK_REAL DiffPlus3_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o1, ptrdiff_t const cdj, ptrdiff_t const cdk)
-{
- ptrdiff_t const cdi=sizeof(CCTK_REAL);
- return (-KRANC_GFOFFSET3D(u,0,0,0) + KRANC_GFOFFSET3D(u,0,0,1))*p1o1;
-}
-#endif
-
-#ifndef KRANC_DIFF_FUNCTIONS
-# define DiffMinus1(u) ((KRANC_GFOFFSET3D(u,0,0,0) - KRANC_GFOFFSET3D(u,-1,0,0))*p1o1)
-#else
-# define DiffMinus1(u) (DiffMinus1_impl(u,p1o1,cdj,cdk))
-static CCTK_REAL DiffMinus1_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o1, ptrdiff_t const cdj, ptrdiff_t const cdk) CCTK_ATTRIBUTE_NOINLINE CCTK_ATTRIBUTE_UNUSED;
-static CCTK_REAL DiffMinus1_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o1, ptrdiff_t const cdj, ptrdiff_t const cdk)
-{
- ptrdiff_t const cdi=sizeof(CCTK_REAL);
- return (KRANC_GFOFFSET3D(u,0,0,0) - KRANC_GFOFFSET3D(u,-1,0,0))*p1o1;
-}
-#endif
-
-#ifndef KRANC_DIFF_FUNCTIONS
-# define DiffMinus2(u) ((KRANC_GFOFFSET3D(u,0,0,0) - KRANC_GFOFFSET3D(u,0,-1,0))*p1o1)
-#else
-# define DiffMinus2(u) (DiffMinus2_impl(u,p1o1,cdj,cdk))
-static CCTK_REAL DiffMinus2_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o1, ptrdiff_t const cdj, ptrdiff_t const cdk) CCTK_ATTRIBUTE_NOINLINE CCTK_ATTRIBUTE_UNUSED;
-static CCTK_REAL DiffMinus2_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o1, ptrdiff_t const cdj, ptrdiff_t const cdk)
-{
- ptrdiff_t const cdi=sizeof(CCTK_REAL);
- return (KRANC_GFOFFSET3D(u,0,0,0) - KRANC_GFOFFSET3D(u,0,-1,0))*p1o1;
-}
-#endif
-
-#ifndef KRANC_DIFF_FUNCTIONS
-# define DiffMinus3(u) ((KRANC_GFOFFSET3D(u,0,0,0) - KRANC_GFOFFSET3D(u,0,0,-1))*p1o1)
-#else
-# define DiffMinus3(u) (DiffMinus3_impl(u,p1o1,cdj,cdk))
-static CCTK_REAL DiffMinus3_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o1, ptrdiff_t const cdj, ptrdiff_t const cdk) CCTK_ATTRIBUTE_NOINLINE CCTK_ATTRIBUTE_UNUSED;
-static CCTK_REAL DiffMinus3_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o1, ptrdiff_t const cdj, ptrdiff_t const cdk)
-{
- ptrdiff_t const cdi=sizeof(CCTK_REAL);
- return (KRANC_GFOFFSET3D(u,0,0,0) - KRANC_GFOFFSET3D(u,0,0,-1))*p1o1;
-}
-#endif
-
-#ifndef KRANC_DIFF_FUNCTIONS
-# define ShiftMinus1(u) (KRANC_GFOFFSET3D(u,-1,0,0)*p1o1)
-#else
-# define ShiftMinus1(u) (ShiftMinus1_impl(u,p1o1,cdj,cdk))
-static CCTK_REAL ShiftMinus1_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o1, ptrdiff_t const cdj, ptrdiff_t const cdk) CCTK_ATTRIBUTE_NOINLINE CCTK_ATTRIBUTE_UNUSED;
-static CCTK_REAL ShiftMinus1_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o1, ptrdiff_t const cdj, ptrdiff_t const cdk)
-{
- ptrdiff_t const cdi=sizeof(CCTK_REAL);
- return KRANC_GFOFFSET3D(u,-1,0,0)*p1o1;
-}
-#endif
-
-#ifndef KRANC_DIFF_FUNCTIONS
-# define ShiftMinus2(u) (KRANC_GFOFFSET3D(u,0,-1,0)*p1o1)
-#else
-# define ShiftMinus2(u) (ShiftMinus2_impl(u,p1o1,cdj,cdk))
-static CCTK_REAL ShiftMinus2_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o1, ptrdiff_t const cdj, ptrdiff_t const cdk) CCTK_ATTRIBUTE_NOINLINE CCTK_ATTRIBUTE_UNUSED;
-static CCTK_REAL ShiftMinus2_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o1, ptrdiff_t const cdj, ptrdiff_t const cdk)
-{
- ptrdiff_t const cdi=sizeof(CCTK_REAL);
- return KRANC_GFOFFSET3D(u,0,-1,0)*p1o1;
-}
-#endif
-
-#ifndef KRANC_DIFF_FUNCTIONS
-# define ShiftMinus3(u) (KRANC_GFOFFSET3D(u,0,0,-1)*p1o1)
-#else
-# define ShiftMinus3(u) (ShiftMinus3_impl(u,p1o1,cdj,cdk))
-static CCTK_REAL ShiftMinus3_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o1, ptrdiff_t const cdj, ptrdiff_t const cdk) CCTK_ATTRIBUTE_NOINLINE CCTK_ATTRIBUTE_UNUSED;
-static CCTK_REAL ShiftMinus3_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o1, ptrdiff_t const cdj, ptrdiff_t const cdk)
-{
- ptrdiff_t const cdi=sizeof(CCTK_REAL);
- return KRANC_GFOFFSET3D(u,0,0,-1)*p1o1;
-}
-#endif
-
-#ifndef KRANC_DIFF_FUNCTIONS
-# define PDplus1(u) ((-KRANC_GFOFFSET3D(u,0,0,0) + KRANC_GFOFFSET3D(u,1,0,0))*p1odx)
-#else
-# define PDplus1(u) (PDplus1_impl(u,p1odx,cdj,cdk))
-static CCTK_REAL PDplus1_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1odx, ptrdiff_t const cdj, ptrdiff_t const cdk) CCTK_ATTRIBUTE_NOINLINE CCTK_ATTRIBUTE_UNUSED;
-static CCTK_REAL PDplus1_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1odx, ptrdiff_t const cdj, ptrdiff_t const cdk)
-{
- ptrdiff_t const cdi=sizeof(CCTK_REAL);
- return (-KRANC_GFOFFSET3D(u,0,0,0) + KRANC_GFOFFSET3D(u,1,0,0))*p1odx;
-}
-#endif
-
-#ifndef KRANC_DIFF_FUNCTIONS
-# define PDplus2(u) ((-KRANC_GFOFFSET3D(u,0,0,0) + KRANC_GFOFFSET3D(u,0,1,0))*p1ody)
-#else
-# define PDplus2(u) (PDplus2_impl(u,p1ody,cdj,cdk))
-static CCTK_REAL PDplus2_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1ody, ptrdiff_t const cdj, ptrdiff_t const cdk) CCTK_ATTRIBUTE_NOINLINE CCTK_ATTRIBUTE_UNUSED;
-static CCTK_REAL PDplus2_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1ody, ptrdiff_t const cdj, ptrdiff_t const cdk)
-{
- ptrdiff_t const cdi=sizeof(CCTK_REAL);
- return (-KRANC_GFOFFSET3D(u,0,0,0) + KRANC_GFOFFSET3D(u,0,1,0))*p1ody;
-}
-#endif
-
-#ifndef KRANC_DIFF_FUNCTIONS
-# define PDplus3(u) ((-KRANC_GFOFFSET3D(u,0,0,0) + KRANC_GFOFFSET3D(u,0,0,1))*p1odz)
-#else
-# define PDplus3(u) (PDplus3_impl(u,p1odz,cdj,cdk))
-static CCTK_REAL PDplus3_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1odz, ptrdiff_t const cdj, ptrdiff_t const cdk) CCTK_ATTRIBUTE_NOINLINE CCTK_ATTRIBUTE_UNUSED;
-static CCTK_REAL PDplus3_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1odz, ptrdiff_t const cdj, ptrdiff_t const cdk)
-{
- ptrdiff_t const cdi=sizeof(CCTK_REAL);
- return (-KRANC_GFOFFSET3D(u,0,0,0) + KRANC_GFOFFSET3D(u,0,0,1))*p1odz;
-}
-#endif
-
diff --git a/Examples/EM/src/EM_constraints.cc b/Examples/EM/src/EM_constraints.cc
index dc40783..a03e93f 100644
--- a/Examples/EM/src/EM_constraints.cc
+++ b/Examples/EM/src/EM_constraints.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 EM_constraints_SelectBCs(CCTK_ARGUMENTS)
{
@@ -40,8 +40,6 @@ static void EM_constraints_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 */
@@ -69,24 +67,20 @@ static void EM_constraints_Body(cGH const * restrict const cctkGH, int const dir
CCTK_REAL const hdzi = 0.5 * dzi;
/* Initialize predefined quantities */
- CCTK_REAL const p1o1 = 1;
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 p1o144dxdy = 0.00694444444444444444444444444444*INV(dx*dy);
+ CCTK_REAL const p1o144dxdz = 0.00694444444444444444444444444444*INV(dx*dz);
+ CCTK_REAL const p1o144dydz = 0.00694444444444444444444444444444*INV(dy*dz);
CCTK_REAL const p1o2dx = 0.5*INV(dx);
CCTK_REAL const p1o2dy = 0.5*INV(dy);
CCTK_REAL const p1o2dz = 0.5*INV(dz);
- CCTK_REAL const p1o4dxdy = 0.25*INV(dx)*INV(dy);
- CCTK_REAL const p1o4dxdz = 0.25*INV(dx)*INV(dz);
- CCTK_REAL const p1o4dydz = 0.25*INV(dy)*INV(dz);
- CCTK_REAL const p1odx = INV(dx);
+ CCTK_REAL const p1o4dxdy = 0.25*INV(dx*dy);
+ CCTK_REAL const p1o4dxdz = 0.25*INV(dx*dz);
+ CCTK_REAL const p1o4dydz = 0.25*INV(dy*dz);
CCTK_REAL const p1odx2 = INV(SQR(dx));
- CCTK_REAL const p1ody = INV(dy);
CCTK_REAL const p1ody2 = INV(SQR(dy));
- CCTK_REAL const p1odz = INV(dz);
CCTK_REAL const p1odz2 = INV(SQR(dz));
CCTK_REAL const pm1o12dx2 = -0.0833333333333333333333333333333*INV(SQR(dx));
CCTK_REAL const pm1o12dy2 = -0.0833333333333333333333333333333*INV(SQR(dy));
@@ -102,9 +96,9 @@ static void EM_constraints_Body(cGH const * restrict const cctkGH, int const dir
/* Loop over the grid points */
#pragma omp parallel
- CCTK_LOOP3 (EM_constraints,
+ CCTK_LOOP3(EM_constraints,
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;
@@ -139,7 +133,7 @@ static void EM_constraints_Body(cGH const * restrict const cctkGH, int const dir
CB[index] = CBL;
CEl[index] = CElL;
}
- CCTK_ENDLOOP3 (EM_constraints);
+ CCTK_ENDLOOP3(EM_constraints);
}
extern "C" void EM_constraints(CCTK_ARGUMENTS)
@@ -158,12 +152,15 @@ extern "C" void EM_constraints(CCTK_ARGUMENTS)
return;
}
- const char *groups[] = {"EM::B_group","EM::constraints","EM::El_group"};
+ const char *const groups[] = {
+ "EM::B_group",
+ "EM::constraints",
+ "EM::El_group"};
GenericFD_AssertGroupStorage(cctkGH, "EM_constraints", 3, groups);
GenericFD_EnsureStencilFits(cctkGH, "EM_constraints", 1, 1, 1);
- GenericFD_LoopOverInterior(cctkGH, &EM_constraints_Body);
+ GenericFD_LoopOverInterior(cctkGH, EM_constraints_Body);
if (verbose > 1)
{
diff --git a/Examples/EM/src/EM_energy.cc b/Examples/EM/src/EM_energy.cc
index b8e1a17..410c9b3 100644
--- a/Examples/EM/src/EM_energy.cc
+++ b/Examples/EM/src/EM_energy.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 EM_energy_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 EM_energy_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 */
@@ -57,24 +55,20 @@ static void EM_energy_Body(cGH const * restrict const cctkGH, int const dir, int
CCTK_REAL const hdzi = 0.5 * dzi;
/* Initialize predefined quantities */
- CCTK_REAL const p1o1 = 1;
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 p1o144dxdy = 0.00694444444444444444444444444444*INV(dx*dy);
+ CCTK_REAL const p1o144dxdz = 0.00694444444444444444444444444444*INV(dx*dz);
+ CCTK_REAL const p1o144dydz = 0.00694444444444444444444444444444*INV(dy*dz);
CCTK_REAL const p1o2dx = 0.5*INV(dx);
CCTK_REAL const p1o2dy = 0.5*INV(dy);
CCTK_REAL const p1o2dz = 0.5*INV(dz);
- CCTK_REAL const p1o4dxdy = 0.25*INV(dx)*INV(dy);
- CCTK_REAL const p1o4dxdz = 0.25*INV(dx)*INV(dz);
- CCTK_REAL const p1o4dydz = 0.25*INV(dy)*INV(dz);
- CCTK_REAL const p1odx = INV(dx);
+ CCTK_REAL const p1o4dxdy = 0.25*INV(dx*dy);
+ CCTK_REAL const p1o4dxdz = 0.25*INV(dx*dz);
+ CCTK_REAL const p1o4dydz = 0.25*INV(dy*dz);
CCTK_REAL const p1odx2 = INV(SQR(dx));
- CCTK_REAL const p1ody = INV(dy);
CCTK_REAL const p1ody2 = INV(SQR(dy));
- CCTK_REAL const p1odz = INV(dz);
CCTK_REAL const p1odz2 = INV(SQR(dz));
CCTK_REAL const pm1o12dx2 = -0.0833333333333333333333333333333*INV(SQR(dx));
CCTK_REAL const pm1o12dy2 = -0.0833333333333333333333333333333*INV(SQR(dy));
@@ -90,9 +84,9 @@ static void EM_energy_Body(cGH const * restrict const cctkGH, int const dir, int
/* Loop over the grid points */
#pragma omp parallel
- CCTK_LOOP3 (EM_energy,
+ CCTK_LOOP3(EM_energy,
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;
@@ -117,7 +111,7 @@ static void EM_energy_Body(cGH const * restrict const cctkGH, int const dir, int
/* Copy local copies back to grid functions */
rho[index] = rhoL;
}
- CCTK_ENDLOOP3 (EM_energy);
+ CCTK_ENDLOOP3(EM_energy);
}
extern "C" void EM_energy(CCTK_ARGUMENTS)
@@ -136,11 +130,14 @@ extern "C" void EM_energy(CCTK_ARGUMENTS)
return;
}
- const char *groups[] = {"EM::B_group","EM::El_group","EM::endens"};
+ const char *const groups[] = {
+ "EM::B_group",
+ "EM::El_group",
+ "EM::endens"};
GenericFD_AssertGroupStorage(cctkGH, "EM_energy", 3, groups);
- GenericFD_LoopOverEverything(cctkGH, &EM_energy_Body);
+ GenericFD_LoopOverEverything(cctkGH, EM_energy_Body);
if (verbose > 1)
{
diff --git a/Examples/EM/src/EM_evol.cc b/Examples/EM/src/EM_evol.cc
index ad67af3..80c756b 100644
--- a/Examples/EM/src/EM_evol.cc
+++ b/Examples/EM/src/EM_evol.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 EM_evol_SelectBCs(CCTK_ARGUMENTS)
{
@@ -43,8 +43,6 @@ static void EM_evol_Body(cGH const * restrict const cctkGH, int const dir, int c
DECLARE_CCTK_PARAMETERS;
- /* Declare finite differencing variables */
-
/* Include user-supplied include files */
/* Initialise finite differencing variables */
@@ -72,24 +70,20 @@ static void EM_evol_Body(cGH const * restrict const cctkGH, int const dir, int c
CCTK_REAL const hdzi = 0.5 * dzi;
/* Initialize predefined quantities */
- CCTK_REAL const p1o1 = 1;
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 p1o144dxdy = 0.00694444444444444444444444444444*INV(dx*dy);
+ CCTK_REAL const p1o144dxdz = 0.00694444444444444444444444444444*INV(dx*dz);
+ CCTK_REAL const p1o144dydz = 0.00694444444444444444444444444444*INV(dy*dz);
CCTK_REAL const p1o2dx = 0.5*INV(dx);
CCTK_REAL const p1o2dy = 0.5*INV(dy);
CCTK_REAL const p1o2dz = 0.5*INV(dz);
- CCTK_REAL const p1o4dxdy = 0.25*INV(dx)*INV(dy);
- CCTK_REAL const p1o4dxdz = 0.25*INV(dx)*INV(dz);
- CCTK_REAL const p1o4dydz = 0.25*INV(dy)*INV(dz);
- CCTK_REAL const p1odx = INV(dx);
+ CCTK_REAL const p1o4dxdy = 0.25*INV(dx*dy);
+ CCTK_REAL const p1o4dxdz = 0.25*INV(dx*dz);
+ CCTK_REAL const p1o4dydz = 0.25*INV(dy*dz);
CCTK_REAL const p1odx2 = INV(SQR(dx));
- CCTK_REAL const p1ody = INV(dy);
CCTK_REAL const p1ody2 = INV(SQR(dy));
- CCTK_REAL const p1odz = INV(dz);
CCTK_REAL const p1odz2 = INV(SQR(dz));
CCTK_REAL const pm1o12dx2 = -0.0833333333333333333333333333333*INV(SQR(dx));
CCTK_REAL const pm1o12dy2 = -0.0833333333333333333333333333333*INV(SQR(dy));
@@ -105,9 +99,9 @@ static void EM_evol_Body(cGH const * restrict const cctkGH, int const dir, int c
/* Loop over the grid points */
#pragma omp parallel
- CCTK_LOOP3 (EM_evol,
+ CCTK_LOOP3(EM_evol,
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;
@@ -158,7 +152,7 @@ static void EM_evol_Body(cGH const * restrict const cctkGH, int const dir, int c
El2rhs[index] = El2rhsL;
El3rhs[index] = El3rhsL;
}
- CCTK_ENDLOOP3 (EM_evol);
+ CCTK_ENDLOOP3(EM_evol);
}
extern "C" void EM_evol(CCTK_ARGUMENTS)
@@ -177,12 +171,16 @@ extern "C" void EM_evol(CCTK_ARGUMENTS)
return;
}
- const char *groups[] = {"EM::B_group","EM::B_grouprhs","EM::El_group","EM::El_grouprhs"};
+ const char *const groups[] = {
+ "EM::B_group",
+ "EM::B_grouprhs",
+ "EM::El_group",
+ "EM::El_grouprhs"};
GenericFD_AssertGroupStorage(cctkGH, "EM_evol", 4, groups);
GenericFD_EnsureStencilFits(cctkGH, "EM_evol", 1, 1, 1);
- GenericFD_LoopOverInterior(cctkGH, &EM_evol_Body);
+ GenericFD_LoopOverInterior(cctkGH, EM_evol_Body);
if (verbose > 1)
{
diff --git a/Examples/EM/src/EM_initial.cc b/Examples/EM/src/EM_initial.cc
index 8d0e0b0..727a18f 100644
--- a/Examples/EM/src/EM_initial.cc
+++ b/Examples/EM/src/EM_initial.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 EM_initial_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 EM_initial_Body(cGH const * restrict const cctkGH, int const dir, in
DECLARE_CCTK_PARAMETERS;
- /* Declare finite differencing variables */
-
/* Include user-supplied include files */
/* Initialise finite differencing variables */
@@ -57,24 +55,20 @@ static void EM_initial_Body(cGH const * restrict const cctkGH, int const dir, in
CCTK_REAL const hdzi = 0.5 * dzi;
/* Initialize predefined quantities */
- CCTK_REAL const p1o1 = 1;
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 p1o144dxdy = 0.00694444444444444444444444444444*INV(dx*dy);
+ CCTK_REAL const p1o144dxdz = 0.00694444444444444444444444444444*INV(dx*dz);
+ CCTK_REAL const p1o144dydz = 0.00694444444444444444444444444444*INV(dy*dz);
CCTK_REAL const p1o2dx = 0.5*INV(dx);
CCTK_REAL const p1o2dy = 0.5*INV(dy);
CCTK_REAL const p1o2dz = 0.5*INV(dz);
- CCTK_REAL const p1o4dxdy = 0.25*INV(dx)*INV(dy);
- CCTK_REAL const p1o4dxdz = 0.25*INV(dx)*INV(dz);
- CCTK_REAL const p1o4dydz = 0.25*INV(dy)*INV(dz);
- CCTK_REAL const p1odx = INV(dx);
+ CCTK_REAL const p1o4dxdy = 0.25*INV(dx*dy);
+ CCTK_REAL const p1o4dxdz = 0.25*INV(dx*dz);
+ CCTK_REAL const p1o4dydz = 0.25*INV(dy*dz);
CCTK_REAL const p1odx2 = INV(SQR(dx));
- CCTK_REAL const p1ody = INV(dy);
CCTK_REAL const p1ody2 = INV(SQR(dy));
- CCTK_REAL const p1odz = INV(dz);
CCTK_REAL const p1odz2 = INV(SQR(dz));
CCTK_REAL const pm1o12dx2 = -0.0833333333333333333333333333333*INV(SQR(dx));
CCTK_REAL const pm1o12dy2 = -0.0833333333333333333333333333333*INV(SQR(dy));
@@ -90,9 +84,9 @@ static void EM_initial_Body(cGH const * restrict const cctkGH, int const dir, in
/* Loop over the grid points */
#pragma omp parallel
- CCTK_LOOP3 (EM_initial,
+ CCTK_LOOP3(EM_initial,
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;
@@ -107,9 +101,9 @@ static void EM_initial_Body(cGH const * restrict const cctkGH, int const dir, in
/* Precompute derivatives */
/* Calculate temporaries and grid functions */
- CCTK_REAL El1L = Cos(2*(xL + yL)*Pi)*ToReal(sigma);
+ CCTK_REAL El1L = cos(2*(xL + yL)*Pi)*ToReal(sigma);
- CCTK_REAL El2L = Cos(2*xL*Pi)*(-1 + ToReal(sigma)) - Cos(2*(xL +
+ CCTK_REAL El2L = cos(2*xL*Pi)*(-1 + ToReal(sigma)) - cos(2*(xL +
yL)*Pi)*ToReal(sigma);
CCTK_REAL El3L = 0;
@@ -118,7 +112,7 @@ static void EM_initial_Body(cGH const * restrict const cctkGH, int const dir, in
CCTK_REAL B2L = 0;
- CCTK_REAL B3L = -(Cos(2*xL*Pi)*(-1 + ToReal(sigma))) + Cos(2*(xL +
+ CCTK_REAL B3L = -(cos(2*xL*Pi)*(-1 + ToReal(sigma))) + cos(2*(xL +
yL)*Pi)*ToReal(sigma);
/* Copy local copies back to grid functions */
@@ -129,7 +123,7 @@ static void EM_initial_Body(cGH const * restrict const cctkGH, int const dir, in
El2[index] = El2L;
El3[index] = El3L;
}
- CCTK_ENDLOOP3 (EM_initial);
+ CCTK_ENDLOOP3(EM_initial);
}
extern "C" void EM_initial(CCTK_ARGUMENTS)
@@ -148,11 +142,14 @@ extern "C" void EM_initial(CCTK_ARGUMENTS)
return;
}
- const char *groups[] = {"EM::B_group","EM::El_group","grid::coordinates"};
+ const char *const groups[] = {
+ "EM::B_group",
+ "EM::El_group",
+ "grid::coordinates"};
GenericFD_AssertGroupStorage(cctkGH, "EM_initial", 3, groups);
- GenericFD_LoopOverEverything(cctkGH, &EM_initial_Body);
+ GenericFD_LoopOverEverything(cctkGH, EM_initial_Body);
if (verbose > 1)
{
diff --git a/Examples/EM/src/make.code.defn b/Examples/EM/src/make.code.defn
index 0d52b41..79facad 100644
--- a/Examples/EM/src/make.code.defn
+++ b/Examples/EM/src/make.code.defn
@@ -1,3 +1,3 @@
# File produced by Kranc
-SRCS = Startup.cc RegisterMoL.cc RegisterSymmetries.cc EM_initial.cc EM_evol.cc EM_constraints.cc EM_energy.cc Boundaries.cc
+SRCS = Startup.cc RegisterSymmetries.cc RegisterMoL.cc EM_initial.cc EM_evol.cc EM_constraints.cc EM_energy.cc Boundaries.cc