diff options
Diffstat (limited to 'Examples/Euler/src')
-rw-r--r-- | Examples/Euler/src/euler_conserved.cc | 36 | ||||
-rw-r--r-- | Examples/Euler/src/euler_conserved_flux_1.cc | 42 | ||||
-rw-r--r-- | Examples/Euler/src/euler_flux_1.cc | 45 | ||||
-rw-r--r-- | Examples/Euler/src/euler_initial_shock.cc | 34 | ||||
-rw-r--r-- | Examples/Euler/src/euler_primitives.cc | 36 | ||||
-rw-r--r-- | Examples/Euler/src/euler_reconstruct_1.cc | 39 | ||||
-rw-r--r-- | Examples/Euler/src/euler_rhs_1.cc | 36 | ||||
-rw-r--r-- | Examples/Euler/src/euler_zero_rhs.cc | 33 | ||||
-rw-r--r-- | Examples/Euler/src/make.code.defn | 2 |
9 files changed, 174 insertions, 129 deletions
diff --git a/Examples/Euler/src/euler_conserved.cc b/Examples/Euler/src/euler_conserved.cc index bfa9113..7f82841 100644 --- a/Examples/Euler/src/euler_conserved.cc +++ b/Examples/Euler/src/euler_conserved.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 euler_conserved_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 euler_conserved_Body(cGH const * restrict const cctkGH, int const di DECLARE_CCTK_PARAMETERS; - /* Declare finite differencing variables */ - /* Include user-supplied include files */ /* Initialise finite differencing variables */ @@ -61,15 +59,15 @@ static void euler_conserved_Body(cGH const * restrict const cctkGH, int const di 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 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 p1odx = INV(dx); CCTK_REAL const p1odx2 = INV(SQR(dx)); CCTK_REAL const p1ody = INV(dy); @@ -93,9 +91,9 @@ static void euler_conserved_Body(cGH const * restrict const cctkGH, int const di /* Loop over the grid points */ #pragma omp parallel - CCTK_LOOP3 (euler_conserved, + CCTK_LOOP3(euler_conserved, 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; @@ -131,7 +129,7 @@ static void euler_conserved_Body(cGH const * restrict const cctkGH, int const di S2[index] = S2L; S3[index] = S3L; } - CCTK_ENDLOOP3 (euler_conserved); + CCTK_ENDLOOP3(euler_conserved); } extern "C" void euler_conserved(CCTK_ARGUMENTS) @@ -150,11 +148,17 @@ extern "C" void euler_conserved(CCTK_ARGUMENTS) return; } - const char *groups[] = {"Euler::Den_group","Euler::En_group","Euler::p_group","Euler::rho_group","Euler::S_group","Euler::v_group"}; + const char *const groups[] = { + "Euler::Den_group", + "Euler::En_group", + "Euler::p_group", + "Euler::rho_group", + "Euler::S_group", + "Euler::v_group"}; GenericFD_AssertGroupStorage(cctkGH, "euler_conserved", 6, groups); - GenericFD_LoopOverEverything(cctkGH, &euler_conserved_Body); + GenericFD_LoopOverEverything(cctkGH, euler_conserved_Body); if (verbose > 1) { diff --git a/Examples/Euler/src/euler_conserved_flux_1.cc b/Examples/Euler/src/euler_conserved_flux_1.cc index 13cf71b..f0abdd5 100644 --- a/Examples/Euler/src/euler_conserved_flux_1.cc +++ b/Examples/Euler/src/euler_conserved_flux_1.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 euler_conserved_flux_1_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 euler_conserved_flux_1_Body(cGH const * restrict const cctkGH, int c DECLARE_CCTK_PARAMETERS; - /* Declare finite differencing variables */ - /* Include user-supplied include files */ /* Initialise finite differencing variables */ @@ -61,15 +59,15 @@ static void euler_conserved_flux_1_Body(cGH const * restrict const cctkGH, int c 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 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 p1odx = INV(dx); CCTK_REAL const p1odx2 = INV(SQR(dx)); CCTK_REAL const p1ody = INV(dy); @@ -93,9 +91,9 @@ static void euler_conserved_flux_1_Body(cGH const * restrict const cctkGH, int c /* Loop over the grid points */ #pragma omp parallel - CCTK_LOOP3 (euler_conserved_flux_1, + CCTK_LOOP3(euler_conserved_flux_1, 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; @@ -154,7 +152,7 @@ static void euler_conserved_flux_1_Body(cGH const * restrict const cctkGH, int c SRight2[index] = SRight2L; SRight3[index] = SRight3L; } - CCTK_ENDLOOP3 (euler_conserved_flux_1); + CCTK_ENDLOOP3(euler_conserved_flux_1); } extern "C" void euler_conserved_flux_1(CCTK_ARGUMENTS) @@ -173,11 +171,23 @@ extern "C" void euler_conserved_flux_1(CCTK_ARGUMENTS) return; } - const char *groups[] = {"Euler::DenLeft_group","Euler::DenRight_group","Euler::EnLeft_group","Euler::EnRight_group","Euler::pLeft_group","Euler::pRight_group","Euler::rhoLeft_group","Euler::rhoRight_group","Euler::SLeft_group","Euler::SRight_group","Euler::vLeft_group","Euler::vRight_group"}; + const char *const groups[] = { + "Euler::DenLeft_group", + "Euler::DenRight_group", + "Euler::EnLeft_group", + "Euler::EnRight_group", + "Euler::pLeft_group", + "Euler::pRight_group", + "Euler::rhoLeft_group", + "Euler::rhoRight_group", + "Euler::SLeft_group", + "Euler::SRight_group", + "Euler::vLeft_group", + "Euler::vRight_group"}; GenericFD_AssertGroupStorage(cctkGH, "euler_conserved_flux_1", 12, groups); - GenericFD_LoopOverEverything(cctkGH, &euler_conserved_flux_1_Body); + GenericFD_LoopOverEverything(cctkGH, euler_conserved_flux_1_Body); if (verbose > 1) { diff --git a/Examples/Euler/src/euler_flux_1.cc b/Examples/Euler/src/euler_flux_1.cc index 4786a56..4286e42 100644 --- a/Examples/Euler/src/euler_flux_1.cc +++ b/Examples/Euler/src/euler_flux_1.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 euler_flux_1_SelectBCs(CCTK_ARGUMENTS) { @@ -46,8 +46,6 @@ static void euler_flux_1_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 */ @@ -79,15 +77,15 @@ static void euler_flux_1_Body(cGH const * restrict const cctkGH, int const dir, 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 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 p1odx = INV(dx); CCTK_REAL const p1odx2 = INV(SQR(dx)); CCTK_REAL const p1ody = INV(dy); @@ -111,9 +109,9 @@ static void euler_flux_1_Body(cGH const * restrict const cctkGH, int const dir, /* Loop over the grid points */ #pragma omp parallel - CCTK_LOOP3 (euler_flux_1, + CCTK_LOOP3(euler_flux_1, 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; @@ -189,7 +187,7 @@ static void euler_flux_1_Body(cGH const * restrict const cctkGH, int const dir, SF2[index] = SF2L; SF3[index] = SF3L; } - CCTK_ENDLOOP3 (euler_flux_1); + CCTK_ENDLOOP3(euler_flux_1); } extern "C" void euler_flux_1(CCTK_ARGUMENTS) @@ -208,12 +206,27 @@ extern "C" void euler_flux_1(CCTK_ARGUMENTS) return; } - const char *groups[] = {"Euler::DenF_group","Euler::DenLeft_group","Euler::DenRight_group","Euler::EnF_group","Euler::EnLeft_group","Euler::EnRight_group","Euler::pLeft_group","Euler::pRight_group","Euler::rhoLeft_group","Euler::rhoRight_group","Euler::SF_group","Euler::SLeft_group","Euler::SRight_group","Euler::vLeft_group","Euler::vRight_group"}; + const char *const groups[] = { + "Euler::DenF_group", + "Euler::DenLeft_group", + "Euler::DenRight_group", + "Euler::EnF_group", + "Euler::EnLeft_group", + "Euler::EnRight_group", + "Euler::pLeft_group", + "Euler::pRight_group", + "Euler::rhoLeft_group", + "Euler::rhoRight_group", + "Euler::SF_group", + "Euler::SLeft_group", + "Euler::SRight_group", + "Euler::vLeft_group", + "Euler::vRight_group"}; GenericFD_AssertGroupStorage(cctkGH, "euler_flux_1", 15, groups); GenericFD_EnsureStencilFits(cctkGH, "euler_flux_1", 1, 1, 1); - GenericFD_LoopOverInterior(cctkGH, &euler_flux_1_Body); + GenericFD_LoopOverInterior(cctkGH, euler_flux_1_Body); if (verbose > 1) { diff --git a/Examples/Euler/src/euler_initial_shock.cc b/Examples/Euler/src/euler_initial_shock.cc index e1350f0..73af884 100644 --- a/Examples/Euler/src/euler_initial_shock.cc +++ b/Examples/Euler/src/euler_initial_shock.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 euler_initial_shock_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 euler_initial_shock_Body(cGH const * restrict const cctkGH, int cons DECLARE_CCTK_PARAMETERS; - /* Declare finite differencing variables */ - /* Include user-supplied include files */ /* Initialise finite differencing variables */ @@ -61,15 +59,15 @@ static void euler_initial_shock_Body(cGH const * restrict const cctkGH, int cons 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 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 p1odx = INV(dx); CCTK_REAL const p1odx2 = INV(SQR(dx)); CCTK_REAL const p1ody = INV(dy); @@ -93,9 +91,9 @@ static void euler_initial_shock_Body(cGH const * restrict const cctkGH, int cons /* Loop over the grid points */ #pragma omp parallel - CCTK_LOOP3 (euler_initial_shock, + CCTK_LOOP3(euler_initial_shock, 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; @@ -129,7 +127,7 @@ static void euler_initial_shock_Body(cGH const * restrict const cctkGH, int cons v2[index] = v2L; v3[index] = v3L; } - CCTK_ENDLOOP3 (euler_initial_shock); + CCTK_ENDLOOP3(euler_initial_shock); } extern "C" void euler_initial_shock(CCTK_ARGUMENTS) @@ -148,11 +146,15 @@ extern "C" void euler_initial_shock(CCTK_ARGUMENTS) return; } - const char *groups[] = {"grid::coordinates","Euler::p_group","Euler::rho_group","Euler::v_group"}; + const char *const groups[] = { + "grid::coordinates", + "Euler::p_group", + "Euler::rho_group", + "Euler::v_group"}; GenericFD_AssertGroupStorage(cctkGH, "euler_initial_shock", 4, groups); - GenericFD_LoopOverEverything(cctkGH, &euler_initial_shock_Body); + GenericFD_LoopOverEverything(cctkGH, euler_initial_shock_Body); if (verbose > 1) { diff --git a/Examples/Euler/src/euler_primitives.cc b/Examples/Euler/src/euler_primitives.cc index 6f28417..94e0338 100644 --- a/Examples/Euler/src/euler_primitives.cc +++ b/Examples/Euler/src/euler_primitives.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 euler_primitives_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 euler_primitives_Body(cGH const * restrict const cctkGH, int const d DECLARE_CCTK_PARAMETERS; - /* Declare finite differencing variables */ - /* Include user-supplied include files */ /* Initialise finite differencing variables */ @@ -61,15 +59,15 @@ static void euler_primitives_Body(cGH const * restrict const cctkGH, int const d 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 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 p1odx = INV(dx); CCTK_REAL const p1odx2 = INV(SQR(dx)); CCTK_REAL const p1ody = INV(dy); @@ -93,9 +91,9 @@ static void euler_primitives_Body(cGH const * restrict const cctkGH, int const d /* Loop over the grid points */ #pragma omp parallel - CCTK_LOOP3 (euler_primitives, + CCTK_LOOP3(euler_primitives, 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; @@ -131,7 +129,7 @@ static void euler_primitives_Body(cGH const * restrict const cctkGH, int const d v2[index] = v2L; v3[index] = v3L; } - CCTK_ENDLOOP3 (euler_primitives); + CCTK_ENDLOOP3(euler_primitives); } extern "C" void euler_primitives(CCTK_ARGUMENTS) @@ -150,11 +148,17 @@ extern "C" void euler_primitives(CCTK_ARGUMENTS) return; } - const char *groups[] = {"Euler::Den_group","Euler::En_group","Euler::p_group","Euler::rho_group","Euler::S_group","Euler::v_group"}; + const char *const groups[] = { + "Euler::Den_group", + "Euler::En_group", + "Euler::p_group", + "Euler::rho_group", + "Euler::S_group", + "Euler::v_group"}; GenericFD_AssertGroupStorage(cctkGH, "euler_primitives", 6, groups); - GenericFD_LoopOverEverything(cctkGH, &euler_primitives_Body); + GenericFD_LoopOverEverything(cctkGH, euler_primitives_Body); if (verbose > 1) { diff --git a/Examples/Euler/src/euler_reconstruct_1.cc b/Examples/Euler/src/euler_reconstruct_1.cc index 976472d..604cb0a 100644 --- a/Examples/Euler/src/euler_reconstruct_1.cc +++ b/Examples/Euler/src/euler_reconstruct_1.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 euler_reconstruct_1_SelectBCs(CCTK_ARGUMENTS) { @@ -55,8 +55,6 @@ static void euler_reconstruct_1_Body(cGH const * restrict const cctkGH, int cons DECLARE_CCTK_PARAMETERS; - /* Declare finite differencing variables */ - /* Include user-supplied include files */ /* Initialise finite differencing variables */ @@ -88,15 +86,15 @@ static void euler_reconstruct_1_Body(cGH const * restrict const cctkGH, int cons 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 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 p1odx = INV(dx); CCTK_REAL const p1odx2 = INV(SQR(dx)); CCTK_REAL const p1ody = INV(dy); @@ -120,9 +118,9 @@ static void euler_reconstruct_1_Body(cGH const * restrict const cctkGH, int cons /* Loop over the grid points */ #pragma omp parallel - CCTK_LOOP3 (euler_reconstruct_1, + CCTK_LOOP3(euler_reconstruct_1, 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; @@ -212,7 +210,7 @@ static void euler_reconstruct_1_Body(cGH const * restrict const cctkGH, int cons vRight2[index] = vRight2L; vRight3[index] = vRight3L; } - CCTK_ENDLOOP3 (euler_reconstruct_1); + CCTK_ENDLOOP3(euler_reconstruct_1); } extern "C" void euler_reconstruct_1(CCTK_ARGUMENTS) @@ -231,12 +229,21 @@ extern "C" void euler_reconstruct_1(CCTK_ARGUMENTS) return; } - const char *groups[] = {"Euler::p_group","Euler::pLeft_group","Euler::pRight_group","Euler::rho_group","Euler::rhoLeft_group","Euler::rhoRight_group","Euler::v_group","Euler::vLeft_group","Euler::vRight_group"}; + const char *const groups[] = { + "Euler::p_group", + "Euler::pLeft_group", + "Euler::pRight_group", + "Euler::rho_group", + "Euler::rhoLeft_group", + "Euler::rhoRight_group", + "Euler::v_group", + "Euler::vLeft_group", + "Euler::vRight_group"}; GenericFD_AssertGroupStorage(cctkGH, "euler_reconstruct_1", 9, groups); GenericFD_EnsureStencilFits(cctkGH, "euler_reconstruct_1", 1, 1, 1); - GenericFD_LoopOverInterior(cctkGH, &euler_reconstruct_1_Body); + GenericFD_LoopOverInterior(cctkGH, euler_reconstruct_1_Body); if (verbose > 1) { diff --git a/Examples/Euler/src/euler_rhs_1.cc b/Examples/Euler/src/euler_rhs_1.cc index fa611a2..a2fa763 100644 --- a/Examples/Euler/src/euler_rhs_1.cc +++ b/Examples/Euler/src/euler_rhs_1.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 euler_rhs_1_SelectBCs(CCTK_ARGUMENTS) { @@ -46,8 +46,6 @@ static void euler_rhs_1_Body(cGH const * restrict const cctkGH, int const dir, i DECLARE_CCTK_PARAMETERS; - /* Declare finite differencing variables */ - /* Include user-supplied include files */ /* Initialise finite differencing variables */ @@ -79,15 +77,15 @@ static void euler_rhs_1_Body(cGH const * restrict const cctkGH, int const dir, i 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 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 p1odx = INV(dx); CCTK_REAL const p1odx2 = INV(SQR(dx)); CCTK_REAL const p1ody = INV(dy); @@ -111,9 +109,9 @@ static void euler_rhs_1_Body(cGH const * restrict const cctkGH, int const dir, i /* Loop over the grid points */ #pragma omp parallel - CCTK_LOOP3 (euler_rhs_1, + CCTK_LOOP3(euler_rhs_1, 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 +156,7 @@ static void euler_rhs_1_Body(cGH const * restrict const cctkGH, int const dir, i S2rhs[index] = S2rhsL; S3rhs[index] = S3rhsL; } - CCTK_ENDLOOP3 (euler_rhs_1); + CCTK_ENDLOOP3(euler_rhs_1); } extern "C" void euler_rhs_1(CCTK_ARGUMENTS) @@ -177,12 +175,18 @@ extern "C" void euler_rhs_1(CCTK_ARGUMENTS) return; } - const char *groups[] = {"Euler::DenF_group","Euler::Den_grouprhs","Euler::EnF_group","Euler::En_grouprhs","Euler::SF_group","Euler::S_grouprhs"}; + const char *const groups[] = { + "Euler::DenF_group", + "Euler::Den_grouprhs", + "Euler::EnF_group", + "Euler::En_grouprhs", + "Euler::SF_group", + "Euler::S_grouprhs"}; GenericFD_AssertGroupStorage(cctkGH, "euler_rhs_1", 6, groups); GenericFD_EnsureStencilFits(cctkGH, "euler_rhs_1", 1, 1, 1); - GenericFD_LoopOverInterior(cctkGH, &euler_rhs_1_Body); + GenericFD_LoopOverInterior(cctkGH, euler_rhs_1_Body); if (verbose > 1) { diff --git a/Examples/Euler/src/euler_zero_rhs.cc b/Examples/Euler/src/euler_zero_rhs.cc index b5371b0..caabc05 100644 --- a/Examples/Euler/src/euler_zero_rhs.cc +++ b/Examples/Euler/src/euler_zero_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))) static void euler_zero_rhs_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const imin[3], int const imax[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) { @@ -28,8 +28,6 @@ static void euler_zero_rhs_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 */ @@ -61,15 +59,15 @@ static void euler_zero_rhs_Body(cGH const * restrict const cctkGH, int const dir 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 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 p1odx = INV(dx); CCTK_REAL const p1odx2 = INV(SQR(dx)); CCTK_REAL const p1ody = INV(dy); @@ -93,9 +91,9 @@ static void euler_zero_rhs_Body(cGH const * restrict const cctkGH, int const dir /* Loop over the grid points */ #pragma omp parallel - CCTK_LOOP3 (euler_zero_rhs, + CCTK_LOOP3(euler_zero_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; @@ -125,7 +123,7 @@ static void euler_zero_rhs_Body(cGH const * restrict const cctkGH, int const dir S2rhs[index] = S2rhsL; S3rhs[index] = S3rhsL; } - CCTK_ENDLOOP3 (euler_zero_rhs); + CCTK_ENDLOOP3(euler_zero_rhs); } extern "C" void euler_zero_rhs(CCTK_ARGUMENTS) @@ -144,11 +142,14 @@ extern "C" void euler_zero_rhs(CCTK_ARGUMENTS) return; } - const char *groups[] = {"Euler::Den_grouprhs","Euler::En_grouprhs","Euler::S_grouprhs"}; + const char *const groups[] = { + "Euler::Den_grouprhs", + "Euler::En_grouprhs", + "Euler::S_grouprhs"}; GenericFD_AssertGroupStorage(cctkGH, "euler_zero_rhs", 3, groups); - GenericFD_LoopOverEverything(cctkGH, &euler_zero_rhs_Body); + GenericFD_LoopOverEverything(cctkGH, euler_zero_rhs_Body); if (verbose > 1) { diff --git a/Examples/Euler/src/make.code.defn b/Examples/Euler/src/make.code.defn index 4081620..48ce643 100644 --- a/Examples/Euler/src/make.code.defn +++ b/Examples/Euler/src/make.code.defn @@ -1,3 +1,3 @@ # File produced by Kranc -SRCS = Startup.cc RegisterMoL.cc RegisterSymmetries.cc euler_initial_shock.cc euler_primitives.cc euler_conserved.cc euler_zero_rhs.cc euler_reconstruct_1.cc euler_conserved_flux_1.cc euler_flux_1.cc euler_rhs_1.cc Boundaries.cc +SRCS = Startup.cc RegisterSymmetries.cc RegisterMoL.cc euler_initial_shock.cc euler_primitives.cc euler_conserved.cc euler_zero_rhs.cc euler_reconstruct_1.cc euler_conserved_flux_1.cc euler_flux_1.cc euler_rhs_1.cc Boundaries.cc |