diff options
Diffstat (limited to 'ML_hydro/src')
-rw-r--r-- | ML_hydro/src/Differencing.h | 48 | ||||
-rw-r--r-- | ML_hydro/src/RegisterMoL.cc | 2 | ||||
-rw-r--r-- | ML_hydro/src/hydro_RHS.cc | 49 | ||||
-rw-r--r-- | ML_hydro/src/hydro_con2prim.cc | 47 | ||||
-rw-r--r-- | ML_hydro/src/hydro_prim2con.cc | 47 | ||||
-rw-r--r-- | ML_hydro/src/hydro_soundWave.cc | 47 | ||||
-rw-r--r-- | ML_hydro/src/hydro_vacuum.cc | 47 |
7 files changed, 182 insertions, 105 deletions
diff --git a/ML_hydro/src/Differencing.h b/ML_hydro/src/Differencing.h index 63cadac..6e7b849 100644 --- a/ML_hydro/src/Differencing.h +++ b/ML_hydro/src/Differencing.h @@ -1,144 +1,144 @@ #ifndef KRANC_DIFF_FUNCTIONS -# define PDstandardNth1(u) ((-(*(CCTK_REAL const*)&((char const*)(u))[cdi*(-1)+cdj*(0)+cdk*(0)]) + (*(CCTK_REAL const*)&((char const*)(u))[cdi*(1)+cdj*(0)+cdk*(0)]))*p1o2dx) +# define PDstandardNth1(u) ((-KRANC_GFOFFSET3D(u,-1,0,0) + KRANC_GFOFFSET3D(u,1,0,0))*p1o2dx) #else # define PDstandardNth1(u) (PDstandardNth1_impl(u,p1o2dx,cdj,cdk)) static CCTK_REAL PDstandardNth1_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o2dx, ptrdiff_t const cdj, ptrdiff_t const cdk) CCTK_ATTRIBUTE_NOINLINE CCTK_ATTRIBUTE_UNUSED; static CCTK_REAL PDstandardNth1_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o2dx, ptrdiff_t const cdj, ptrdiff_t const cdk) { ptrdiff_t const cdi=sizeof(CCTK_REAL); - return (-(*(CCTK_REAL const*)&((char const*)(u))[cdi*(-1)+cdj*(0)+cdk*(0)]) + (*(CCTK_REAL const*)&((char const*)(u))[cdi*(1)+cdj*(0)+cdk*(0)]))*p1o2dx; + return (-KRANC_GFOFFSET3D(u,-1,0,0) + KRANC_GFOFFSET3D(u,1,0,0))*p1o2dx; } #endif #ifndef KRANC_DIFF_FUNCTIONS -# define PDstandardNth2(u) ((-(*(CCTK_REAL const*)&((char const*)(u))[cdi*(0)+cdj*(-1)+cdk*(0)]) + (*(CCTK_REAL const*)&((char const*)(u))[cdi*(0)+cdj*(1)+cdk*(0)]))*p1o2dy) +# define PDstandardNth2(u) ((-KRANC_GFOFFSET3D(u,0,-1,0) + KRANC_GFOFFSET3D(u,0,1,0))*p1o2dy) #else # define PDstandardNth2(u) (PDstandardNth2_impl(u,p1o2dy,cdj,cdk)) static CCTK_REAL PDstandardNth2_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o2dy, ptrdiff_t const cdj, ptrdiff_t const cdk) CCTK_ATTRIBUTE_NOINLINE CCTK_ATTRIBUTE_UNUSED; static CCTK_REAL PDstandardNth2_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o2dy, ptrdiff_t const cdj, ptrdiff_t const cdk) { ptrdiff_t const cdi=sizeof(CCTK_REAL); - return (-(*(CCTK_REAL const*)&((char const*)(u))[cdi*(0)+cdj*(-1)+cdk*(0)]) + (*(CCTK_REAL const*)&((char const*)(u))[cdi*(0)+cdj*(1)+cdk*(0)]))*p1o2dy; + return (-KRANC_GFOFFSET3D(u,0,-1,0) + KRANC_GFOFFSET3D(u,0,1,0))*p1o2dy; } #endif #ifndef KRANC_DIFF_FUNCTIONS -# define PDstandardNth3(u) ((-(*(CCTK_REAL const*)&((char const*)(u))[cdi*(0)+cdj*(0)+cdk*(-1)]) + (*(CCTK_REAL const*)&((char const*)(u))[cdi*(0)+cdj*(0)+cdk*(1)]))*p1o2dz) +# define PDstandardNth3(u) ((-KRANC_GFOFFSET3D(u,0,0,-1) + KRANC_GFOFFSET3D(u,0,0,1))*p1o2dz) #else # define PDstandardNth3(u) (PDstandardNth3_impl(u,p1o2dz,cdj,cdk)) static CCTK_REAL PDstandardNth3_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o2dz, ptrdiff_t const cdj, ptrdiff_t const cdk) CCTK_ATTRIBUTE_NOINLINE CCTK_ATTRIBUTE_UNUSED; static CCTK_REAL PDstandardNth3_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o2dz, ptrdiff_t const cdj, ptrdiff_t const cdk) { ptrdiff_t const cdi=sizeof(CCTK_REAL); - return (-(*(CCTK_REAL const*)&((char const*)(u))[cdi*(0)+cdj*(0)+cdk*(-1)]) + (*(CCTK_REAL const*)&((char const*)(u))[cdi*(0)+cdj*(0)+cdk*(1)]))*p1o2dz; + return (-KRANC_GFOFFSET3D(u,0,0,-1) + KRANC_GFOFFSET3D(u,0,0,1))*p1o2dz; } #endif #ifndef KRANC_DIFF_FUNCTIONS -# define PDstandardNth11(u) ((-2*(*(CCTK_REAL const*)&((char const*)(u))[cdi*(0)+cdj*(0)+cdk*(0)]) + (*(CCTK_REAL const*)&((char const*)(u))[cdi*(-1)+cdj*(0)+cdk*(0)]) + (*(CCTK_REAL const*)&((char const*)(u))[cdi*(1)+cdj*(0)+cdk*(0)]))*p1odx2) +# define PDstandardNth11(u) ((-2*KRANC_GFOFFSET3D(u,0,0,0) + KRANC_GFOFFSET3D(u,-1,0,0) + KRANC_GFOFFSET3D(u,1,0,0))*p1odx2) #else # define PDstandardNth11(u) (PDstandardNth11_impl(u,p1odx2,cdj,cdk)) static CCTK_REAL PDstandardNth11_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1odx2, ptrdiff_t const cdj, ptrdiff_t const cdk) CCTK_ATTRIBUTE_NOINLINE CCTK_ATTRIBUTE_UNUSED; static CCTK_REAL PDstandardNth11_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1odx2, ptrdiff_t const cdj, ptrdiff_t const cdk) { ptrdiff_t const cdi=sizeof(CCTK_REAL); - return (-2*(*(CCTK_REAL const*)&((char const*)(u))[cdi*(0)+cdj*(0)+cdk*(0)]) + (*(CCTK_REAL const*)&((char const*)(u))[cdi*(-1)+cdj*(0)+cdk*(0)]) + (*(CCTK_REAL const*)&((char const*)(u))[cdi*(1)+cdj*(0)+cdk*(0)]))*p1odx2; + return (-2*KRANC_GFOFFSET3D(u,0,0,0) + KRANC_GFOFFSET3D(u,-1,0,0) + KRANC_GFOFFSET3D(u,1,0,0))*p1odx2; } #endif #ifndef KRANC_DIFF_FUNCTIONS -# define PDstandardNth22(u) ((-2*(*(CCTK_REAL const*)&((char const*)(u))[cdi*(0)+cdj*(0)+cdk*(0)]) + (*(CCTK_REAL const*)&((char const*)(u))[cdi*(0)+cdj*(-1)+cdk*(0)]) + (*(CCTK_REAL const*)&((char const*)(u))[cdi*(0)+cdj*(1)+cdk*(0)]))*p1ody2) +# define PDstandardNth22(u) ((-2*KRANC_GFOFFSET3D(u,0,0,0) + KRANC_GFOFFSET3D(u,0,-1,0) + KRANC_GFOFFSET3D(u,0,1,0))*p1ody2) #else # define PDstandardNth22(u) (PDstandardNth22_impl(u,p1ody2,cdj,cdk)) static CCTK_REAL PDstandardNth22_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1ody2, ptrdiff_t const cdj, ptrdiff_t const cdk) CCTK_ATTRIBUTE_NOINLINE CCTK_ATTRIBUTE_UNUSED; static CCTK_REAL PDstandardNth22_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1ody2, ptrdiff_t const cdj, ptrdiff_t const cdk) { ptrdiff_t const cdi=sizeof(CCTK_REAL); - return (-2*(*(CCTK_REAL const*)&((char const*)(u))[cdi*(0)+cdj*(0)+cdk*(0)]) + (*(CCTK_REAL const*)&((char const*)(u))[cdi*(0)+cdj*(-1)+cdk*(0)]) + (*(CCTK_REAL const*)&((char const*)(u))[cdi*(0)+cdj*(1)+cdk*(0)]))*p1ody2; + return (-2*KRANC_GFOFFSET3D(u,0,0,0) + KRANC_GFOFFSET3D(u,0,-1,0) + KRANC_GFOFFSET3D(u,0,1,0))*p1ody2; } #endif #ifndef KRANC_DIFF_FUNCTIONS -# define PDstandardNth33(u) ((-2*(*(CCTK_REAL const*)&((char const*)(u))[cdi*(0)+cdj*(0)+cdk*(0)]) + (*(CCTK_REAL const*)&((char const*)(u))[cdi*(0)+cdj*(0)+cdk*(-1)]) + (*(CCTK_REAL const*)&((char const*)(u))[cdi*(0)+cdj*(0)+cdk*(1)]))*p1odz2) +# define PDstandardNth33(u) ((-2*KRANC_GFOFFSET3D(u,0,0,0) + KRANC_GFOFFSET3D(u,0,0,-1) + KRANC_GFOFFSET3D(u,0,0,1))*p1odz2) #else # define PDstandardNth33(u) (PDstandardNth33_impl(u,p1odz2,cdj,cdk)) static CCTK_REAL PDstandardNth33_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1odz2, ptrdiff_t const cdj, ptrdiff_t const cdk) CCTK_ATTRIBUTE_NOINLINE CCTK_ATTRIBUTE_UNUSED; static CCTK_REAL PDstandardNth33_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1odz2, ptrdiff_t const cdj, ptrdiff_t const cdk) { ptrdiff_t const cdi=sizeof(CCTK_REAL); - return (-2*(*(CCTK_REAL const*)&((char const*)(u))[cdi*(0)+cdj*(0)+cdk*(0)]) + (*(CCTK_REAL const*)&((char const*)(u))[cdi*(0)+cdj*(0)+cdk*(-1)]) + (*(CCTK_REAL const*)&((char const*)(u))[cdi*(0)+cdj*(0)+cdk*(1)]))*p1odz2; + return (-2*KRANC_GFOFFSET3D(u,0,0,0) + KRANC_GFOFFSET3D(u,0,0,-1) + KRANC_GFOFFSET3D(u,0,0,1))*p1odz2; } #endif #ifndef KRANC_DIFF_FUNCTIONS -# define PDstandardNth12(u) (((*(CCTK_REAL const*)&((char const*)(u))[cdi*(-1)+cdj*(-1)+cdk*(0)]) - (*(CCTK_REAL const*)&((char const*)(u))[cdi*(-1)+cdj*(1)+cdk*(0)]) - (*(CCTK_REAL const*)&((char const*)(u))[cdi*(1)+cdj*(-1)+cdk*(0)]) + (*(CCTK_REAL const*)&((char const*)(u))[cdi*(1)+cdj*(1)+cdk*(0)]))*p1o4dxdy) +# define PDstandardNth12(u) ((KRANC_GFOFFSET3D(u,-1,-1,0) - KRANC_GFOFFSET3D(u,-1,1,0) - KRANC_GFOFFSET3D(u,1,-1,0) + KRANC_GFOFFSET3D(u,1,1,0))*p1o4dxdy) #else # define PDstandardNth12(u) (PDstandardNth12_impl(u,p1o4dxdy,cdj,cdk)) static CCTK_REAL PDstandardNth12_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o4dxdy, ptrdiff_t const cdj, ptrdiff_t const cdk) CCTK_ATTRIBUTE_NOINLINE CCTK_ATTRIBUTE_UNUSED; static CCTK_REAL PDstandardNth12_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o4dxdy, ptrdiff_t const cdj, ptrdiff_t const cdk) { ptrdiff_t const cdi=sizeof(CCTK_REAL); - return ((*(CCTK_REAL const*)&((char const*)(u))[cdi*(-1)+cdj*(-1)+cdk*(0)]) - (*(CCTK_REAL const*)&((char const*)(u))[cdi*(-1)+cdj*(1)+cdk*(0)]) - (*(CCTK_REAL const*)&((char const*)(u))[cdi*(1)+cdj*(-1)+cdk*(0)]) + (*(CCTK_REAL const*)&((char const*)(u))[cdi*(1)+cdj*(1)+cdk*(0)]))*p1o4dxdy; + return (KRANC_GFOFFSET3D(u,-1,-1,0) - KRANC_GFOFFSET3D(u,-1,1,0) - KRANC_GFOFFSET3D(u,1,-1,0) + KRANC_GFOFFSET3D(u,1,1,0))*p1o4dxdy; } #endif #ifndef KRANC_DIFF_FUNCTIONS -# define PDstandardNth13(u) (((*(CCTK_REAL const*)&((char const*)(u))[cdi*(-1)+cdj*(0)+cdk*(-1)]) - (*(CCTK_REAL const*)&((char const*)(u))[cdi*(-1)+cdj*(0)+cdk*(1)]) - (*(CCTK_REAL const*)&((char const*)(u))[cdi*(1)+cdj*(0)+cdk*(-1)]) + (*(CCTK_REAL const*)&((char const*)(u))[cdi*(1)+cdj*(0)+cdk*(1)]))*p1o4dxdz) +# define PDstandardNth13(u) ((KRANC_GFOFFSET3D(u,-1,0,-1) - KRANC_GFOFFSET3D(u,-1,0,1) - KRANC_GFOFFSET3D(u,1,0,-1) + KRANC_GFOFFSET3D(u,1,0,1))*p1o4dxdz) #else # define PDstandardNth13(u) (PDstandardNth13_impl(u,p1o4dxdz,cdj,cdk)) static CCTK_REAL PDstandardNth13_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o4dxdz, ptrdiff_t const cdj, ptrdiff_t const cdk) CCTK_ATTRIBUTE_NOINLINE CCTK_ATTRIBUTE_UNUSED; static CCTK_REAL PDstandardNth13_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o4dxdz, ptrdiff_t const cdj, ptrdiff_t const cdk) { ptrdiff_t const cdi=sizeof(CCTK_REAL); - return ((*(CCTK_REAL const*)&((char const*)(u))[cdi*(-1)+cdj*(0)+cdk*(-1)]) - (*(CCTK_REAL const*)&((char const*)(u))[cdi*(-1)+cdj*(0)+cdk*(1)]) - (*(CCTK_REAL const*)&((char const*)(u))[cdi*(1)+cdj*(0)+cdk*(-1)]) + (*(CCTK_REAL const*)&((char const*)(u))[cdi*(1)+cdj*(0)+cdk*(1)]))*p1o4dxdz; + return (KRANC_GFOFFSET3D(u,-1,0,-1) - KRANC_GFOFFSET3D(u,-1,0,1) - KRANC_GFOFFSET3D(u,1,0,-1) + KRANC_GFOFFSET3D(u,1,0,1))*p1o4dxdz; } #endif #ifndef KRANC_DIFF_FUNCTIONS -# define PDstandardNth21(u) (((*(CCTK_REAL const*)&((char const*)(u))[cdi*(-1)+cdj*(-1)+cdk*(0)]) - (*(CCTK_REAL const*)&((char const*)(u))[cdi*(-1)+cdj*(1)+cdk*(0)]) - (*(CCTK_REAL const*)&((char const*)(u))[cdi*(1)+cdj*(-1)+cdk*(0)]) + (*(CCTK_REAL const*)&((char const*)(u))[cdi*(1)+cdj*(1)+cdk*(0)]))*p1o4dxdy) +# define PDstandardNth21(u) ((KRANC_GFOFFSET3D(u,-1,-1,0) - KRANC_GFOFFSET3D(u,-1,1,0) - KRANC_GFOFFSET3D(u,1,-1,0) + KRANC_GFOFFSET3D(u,1,1,0))*p1o4dxdy) #else # define PDstandardNth21(u) (PDstandardNth21_impl(u,p1o4dxdy,cdj,cdk)) static CCTK_REAL PDstandardNth21_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o4dxdy, ptrdiff_t const cdj, ptrdiff_t const cdk) CCTK_ATTRIBUTE_NOINLINE CCTK_ATTRIBUTE_UNUSED; static CCTK_REAL PDstandardNth21_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o4dxdy, ptrdiff_t const cdj, ptrdiff_t const cdk) { ptrdiff_t const cdi=sizeof(CCTK_REAL); - return ((*(CCTK_REAL const*)&((char const*)(u))[cdi*(-1)+cdj*(-1)+cdk*(0)]) - (*(CCTK_REAL const*)&((char const*)(u))[cdi*(-1)+cdj*(1)+cdk*(0)]) - (*(CCTK_REAL const*)&((char const*)(u))[cdi*(1)+cdj*(-1)+cdk*(0)]) + (*(CCTK_REAL const*)&((char const*)(u))[cdi*(1)+cdj*(1)+cdk*(0)]))*p1o4dxdy; + return (KRANC_GFOFFSET3D(u,-1,-1,0) - KRANC_GFOFFSET3D(u,-1,1,0) - KRANC_GFOFFSET3D(u,1,-1,0) + KRANC_GFOFFSET3D(u,1,1,0))*p1o4dxdy; } #endif #ifndef KRANC_DIFF_FUNCTIONS -# define PDstandardNth23(u) (((*(CCTK_REAL const*)&((char const*)(u))[cdi*(0)+cdj*(-1)+cdk*(-1)]) - (*(CCTK_REAL const*)&((char const*)(u))[cdi*(0)+cdj*(-1)+cdk*(1)]) - (*(CCTK_REAL const*)&((char const*)(u))[cdi*(0)+cdj*(1)+cdk*(-1)]) + (*(CCTK_REAL const*)&((char const*)(u))[cdi*(0)+cdj*(1)+cdk*(1)]))*p1o4dydz) +# define PDstandardNth23(u) ((KRANC_GFOFFSET3D(u,0,-1,-1) - KRANC_GFOFFSET3D(u,0,-1,1) - KRANC_GFOFFSET3D(u,0,1,-1) + KRANC_GFOFFSET3D(u,0,1,1))*p1o4dydz) #else # define PDstandardNth23(u) (PDstandardNth23_impl(u,p1o4dydz,cdj,cdk)) static CCTK_REAL PDstandardNth23_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o4dydz, ptrdiff_t const cdj, ptrdiff_t const cdk) CCTK_ATTRIBUTE_NOINLINE CCTK_ATTRIBUTE_UNUSED; static CCTK_REAL PDstandardNth23_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o4dydz, ptrdiff_t const cdj, ptrdiff_t const cdk) { ptrdiff_t const cdi=sizeof(CCTK_REAL); - return ((*(CCTK_REAL const*)&((char const*)(u))[cdi*(0)+cdj*(-1)+cdk*(-1)]) - (*(CCTK_REAL const*)&((char const*)(u))[cdi*(0)+cdj*(-1)+cdk*(1)]) - (*(CCTK_REAL const*)&((char const*)(u))[cdi*(0)+cdj*(1)+cdk*(-1)]) + (*(CCTK_REAL const*)&((char const*)(u))[cdi*(0)+cdj*(1)+cdk*(1)]))*p1o4dydz; + return (KRANC_GFOFFSET3D(u,0,-1,-1) - KRANC_GFOFFSET3D(u,0,-1,1) - KRANC_GFOFFSET3D(u,0,1,-1) + KRANC_GFOFFSET3D(u,0,1,1))*p1o4dydz; } #endif #ifndef KRANC_DIFF_FUNCTIONS -# define PDstandardNth31(u) (((*(CCTK_REAL const*)&((char const*)(u))[cdi*(-1)+cdj*(0)+cdk*(-1)]) - (*(CCTK_REAL const*)&((char const*)(u))[cdi*(-1)+cdj*(0)+cdk*(1)]) - (*(CCTK_REAL const*)&((char const*)(u))[cdi*(1)+cdj*(0)+cdk*(-1)]) + (*(CCTK_REAL const*)&((char const*)(u))[cdi*(1)+cdj*(0)+cdk*(1)]))*p1o4dxdz) +# define PDstandardNth31(u) ((KRANC_GFOFFSET3D(u,-1,0,-1) - KRANC_GFOFFSET3D(u,-1,0,1) - KRANC_GFOFFSET3D(u,1,0,-1) + KRANC_GFOFFSET3D(u,1,0,1))*p1o4dxdz) #else # define PDstandardNth31(u) (PDstandardNth31_impl(u,p1o4dxdz,cdj,cdk)) static CCTK_REAL PDstandardNth31_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o4dxdz, ptrdiff_t const cdj, ptrdiff_t const cdk) CCTK_ATTRIBUTE_NOINLINE CCTK_ATTRIBUTE_UNUSED; static CCTK_REAL PDstandardNth31_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o4dxdz, ptrdiff_t const cdj, ptrdiff_t const cdk) { ptrdiff_t const cdi=sizeof(CCTK_REAL); - return ((*(CCTK_REAL const*)&((char const*)(u))[cdi*(-1)+cdj*(0)+cdk*(-1)]) - (*(CCTK_REAL const*)&((char const*)(u))[cdi*(-1)+cdj*(0)+cdk*(1)]) - (*(CCTK_REAL const*)&((char const*)(u))[cdi*(1)+cdj*(0)+cdk*(-1)]) + (*(CCTK_REAL const*)&((char const*)(u))[cdi*(1)+cdj*(0)+cdk*(1)]))*p1o4dxdz; + return (KRANC_GFOFFSET3D(u,-1,0,-1) - KRANC_GFOFFSET3D(u,-1,0,1) - KRANC_GFOFFSET3D(u,1,0,-1) + KRANC_GFOFFSET3D(u,1,0,1))*p1o4dxdz; } #endif #ifndef KRANC_DIFF_FUNCTIONS -# define PDstandardNth32(u) (((*(CCTK_REAL const*)&((char const*)(u))[cdi*(0)+cdj*(-1)+cdk*(-1)]) - (*(CCTK_REAL const*)&((char const*)(u))[cdi*(0)+cdj*(-1)+cdk*(1)]) - (*(CCTK_REAL const*)&((char const*)(u))[cdi*(0)+cdj*(1)+cdk*(-1)]) + (*(CCTK_REAL const*)&((char const*)(u))[cdi*(0)+cdj*(1)+cdk*(1)]))*p1o4dydz) +# define PDstandardNth32(u) ((KRANC_GFOFFSET3D(u,0,-1,-1) - KRANC_GFOFFSET3D(u,0,-1,1) - KRANC_GFOFFSET3D(u,0,1,-1) + KRANC_GFOFFSET3D(u,0,1,1))*p1o4dydz) #else # define PDstandardNth32(u) (PDstandardNth32_impl(u,p1o4dydz,cdj,cdk)) static CCTK_REAL PDstandardNth32_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o4dydz, ptrdiff_t const cdj, ptrdiff_t const cdk) CCTK_ATTRIBUTE_NOINLINE CCTK_ATTRIBUTE_UNUSED; static CCTK_REAL PDstandardNth32_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o4dydz, ptrdiff_t const cdj, ptrdiff_t const cdk) { ptrdiff_t const cdi=sizeof(CCTK_REAL); - return ((*(CCTK_REAL const*)&((char const*)(u))[cdi*(0)+cdj*(-1)+cdk*(-1)]) - (*(CCTK_REAL const*)&((char const*)(u))[cdi*(0)+cdj*(-1)+cdk*(1)]) - (*(CCTK_REAL const*)&((char const*)(u))[cdi*(0)+cdj*(1)+cdk*(-1)]) + (*(CCTK_REAL const*)&((char const*)(u))[cdi*(0)+cdj*(1)+cdk*(1)]))*p1o4dydz; + return (KRANC_GFOFFSET3D(u,0,-1,-1) - KRANC_GFOFFSET3D(u,0,-1,1) - KRANC_GFOFFSET3D(u,0,1,-1) + KRANC_GFOFFSET3D(u,0,1,1))*p1o4dydz; } #endif diff --git a/ML_hydro/src/RegisterMoL.cc b/ML_hydro/src/RegisterMoL.cc index 3f877cb..15b0ebc 100644 --- a/ML_hydro/src/RegisterMoL.cc +++ b/ML_hydro/src/RegisterMoL.cc @@ -17,5 +17,7 @@ extern "C" void ML_hydro_RegisterVars(CCTK_ARGUMENTS) ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_hydro::mom1"), CCTK_VarIndex("ML_hydro::mom1rhs")); ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_hydro::mom2"), CCTK_VarIndex("ML_hydro::mom2rhs")); ierr += MoLRegisterEvolved(CCTK_VarIndex("ML_hydro::mom3"), CCTK_VarIndex("ML_hydro::mom3rhs")); + + /* Register all the evolved Array functions with MoL */ return; } diff --git a/ML_hydro/src/hydro_RHS.cc b/ML_hydro/src/hydro_RHS.cc index cdbebfd..c4d92bf 100644 --- a/ML_hydro/src/hydro_RHS.cc +++ b/ML_hydro/src/hydro_RHS.cc @@ -39,7 +39,7 @@ extern "C" void hydro_RHS_SelectBCs(CCTK_ARGUMENTS) return; } -static void hydro_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 min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]) +static void hydro_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[]) { DECLARE_CCTK_ARGUMENTS; DECLARE_CCTK_PARAMETERS; @@ -47,21 +47,6 @@ static void hydro_RHS_Body(cGH const * restrict const cctkGH, int const dir, int /* Declare finite differencing variables */ - if (verbose > 1) - { - CCTK_VInfo(CCTK_THORNSTRING,"Entering hydro_RHS_Body"); - } - - if (cctk_iteration % hydro_RHS_calc_every != hydro_RHS_calc_offset) - { - return; - } - - const char *groups[] = {"ML_hydro::eneflux_group","ML_hydro::ene_grouprhs","ML_hydro::massflux_group","ML_hydro::mass_grouprhs","ML_hydro::momflux_group","ML_hydro::mom_grouprhs"}; - GenericFD_AssertGroupStorage(cctkGH, "hydro_RHS", 6, groups); - - GenericFD_EnsureStencilFits(cctkGH, "hydro_RHS", 1, 1, 1); - /* Include user-supplied include files */ /* Initialise finite differencing variables */ @@ -75,6 +60,7 @@ static void hydro_RHS_Body(cGH const * restrict const cctkGH, int const dir, int CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); CCTK_REAL const dt = ToReal(CCTK_DELTA_TIME); + CCTK_REAL const t = ToReal(cctk_time); CCTK_REAL const dxi = INV(dx); CCTK_REAL const dyi = INV(dy); CCTK_REAL const dzi = INV(dz); @@ -98,10 +84,18 @@ static void hydro_RHS_Body(cGH const * restrict const cctkGH, int const dir, int CCTK_REAL const p1ody2 = INV(SQR(dy)); CCTK_REAL const p1odz2 = INV(SQR(dz)); + /* Assign local copies of arrays functions */ + + + + /* Calculate temporaries and arrays functions */ + + /* Copy local copies back to grid functions */ + /* Loop over the grid points */ #pragma omp parallel LC_LOOP3 (hydro_RHS, - i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + i,j,k, imin[0],imin[1],imin[2], imax[0],imax[1],imax[2], cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) { ptrdiff_t const index = di*i + dj*j + dk*k; @@ -175,5 +169,26 @@ extern "C" void hydro_RHS(CCTK_ARGUMENTS) DECLARE_CCTK_ARGUMENTS; DECLARE_CCTK_PARAMETERS; + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering hydro_RHS_Body"); + } + + if (cctk_iteration % hydro_RHS_calc_every != hydro_RHS_calc_offset) + { + return; + } + + const char *groups[] = {"ML_hydro::eneflux_group","ML_hydro::ene_grouprhs","ML_hydro::massflux_group","ML_hydro::mass_grouprhs","ML_hydro::momflux_group","ML_hydro::mom_grouprhs"}; + GenericFD_AssertGroupStorage(cctkGH, "hydro_RHS", 6, groups); + + GenericFD_EnsureStencilFits(cctkGH, "hydro_RHS", 1, 1, 1); + GenericFD_LoopOverInterior(cctkGH, &hydro_RHS_Body); + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Leaving hydro_RHS_Body"); + } } diff --git a/ML_hydro/src/hydro_con2prim.cc b/ML_hydro/src/hydro_con2prim.cc index d944588..f9e9188 100644 --- a/ML_hydro/src/hydro_con2prim.cc +++ b/ML_hydro/src/hydro_con2prim.cc @@ -21,7 +21,7 @@ #define SQR(x) ((x) * (x)) #define CUB(x) ((x) * (x) * (x)) -static void hydro_con2prim_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[]) +static void hydro_con2prim_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[]) { DECLARE_CCTK_ARGUMENTS; DECLARE_CCTK_PARAMETERS; @@ -29,20 +29,6 @@ static void hydro_con2prim_Body(cGH const * restrict const cctkGH, int const dir /* Declare finite differencing variables */ - if (verbose > 1) - { - CCTK_VInfo(CCTK_THORNSTRING,"Entering hydro_con2prim_Body"); - } - - if (cctk_iteration % hydro_con2prim_calc_every != hydro_con2prim_calc_offset) - { - return; - } - - const char *groups[] = {"ML_hydro::ene_group","ML_hydro::eps_group","ML_hydro::mass_group","ML_hydro::mom_group","ML_hydro::press_group","ML_hydro::rho_group","ML_hydro::vel_group","ML_hydro::vol_group"}; - GenericFD_AssertGroupStorage(cctkGH, "hydro_con2prim", 8, groups); - - /* Include user-supplied include files */ /* Initialise finite differencing variables */ @@ -56,6 +42,7 @@ static void hydro_con2prim_Body(cGH const * restrict const cctkGH, int const dir CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); CCTK_REAL const dt = ToReal(CCTK_DELTA_TIME); + CCTK_REAL const t = ToReal(cctk_time); CCTK_REAL const dxi = INV(dx); CCTK_REAL const dyi = INV(dy); CCTK_REAL const dzi = INV(dz); @@ -79,10 +66,18 @@ static void hydro_con2prim_Body(cGH const * restrict const cctkGH, int const dir CCTK_REAL const p1ody2 = INV(SQR(dy)); CCTK_REAL const p1odz2 = INV(SQR(dz)); + /* Assign local copies of arrays functions */ + + + + /* Calculate temporaries and arrays functions */ + + /* Copy local copies back to grid functions */ + /* Loop over the grid points */ #pragma omp parallel LC_LOOP3 (hydro_con2prim, - i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + i,j,k, imin[0],imin[1],imin[2], imax[0],imax[1],imax[2], cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) { ptrdiff_t const index = di*i + dj*j + dk*k; @@ -136,5 +131,25 @@ extern "C" void hydro_con2prim(CCTK_ARGUMENTS) DECLARE_CCTK_ARGUMENTS; DECLARE_CCTK_PARAMETERS; + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering hydro_con2prim_Body"); + } + + if (cctk_iteration % hydro_con2prim_calc_every != hydro_con2prim_calc_offset) + { + return; + } + + const char *groups[] = {"ML_hydro::ene_group","ML_hydro::eps_group","ML_hydro::mass_group","ML_hydro::mom_group","ML_hydro::press_group","ML_hydro::rho_group","ML_hydro::vel_group","ML_hydro::vol_group"}; + GenericFD_AssertGroupStorage(cctkGH, "hydro_con2prim", 8, groups); + + GenericFD_LoopOverEverything(cctkGH, &hydro_con2prim_Body); + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Leaving hydro_con2prim_Body"); + } } diff --git a/ML_hydro/src/hydro_prim2con.cc b/ML_hydro/src/hydro_prim2con.cc index 9ad684d..7c33d60 100644 --- a/ML_hydro/src/hydro_prim2con.cc +++ b/ML_hydro/src/hydro_prim2con.cc @@ -21,7 +21,7 @@ #define SQR(x) ((x) * (x)) #define CUB(x) ((x) * (x) * (x)) -static void hydro_prim2con_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[]) +static void hydro_prim2con_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[]) { DECLARE_CCTK_ARGUMENTS; DECLARE_CCTK_PARAMETERS; @@ -29,20 +29,6 @@ static void hydro_prim2con_Body(cGH const * restrict const cctkGH, int const dir /* Declare finite differencing variables */ - if (verbose > 1) - { - CCTK_VInfo(CCTK_THORNSTRING,"Entering hydro_prim2con_Body"); - } - - if (cctk_iteration % hydro_prim2con_calc_every != hydro_prim2con_calc_offset) - { - return; - } - - const char *groups[] = {"ML_hydro::ene_group","ML_hydro::eps_group","ML_hydro::mass_group","ML_hydro::mom_group","ML_hydro::rho_group","ML_hydro::vel_group","ML_hydro::vol_group"}; - GenericFD_AssertGroupStorage(cctkGH, "hydro_prim2con", 7, groups); - - /* Include user-supplied include files */ /* Initialise finite differencing variables */ @@ -56,6 +42,7 @@ static void hydro_prim2con_Body(cGH const * restrict const cctkGH, int const dir CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); CCTK_REAL const dt = ToReal(CCTK_DELTA_TIME); + CCTK_REAL const t = ToReal(cctk_time); CCTK_REAL const dxi = INV(dx); CCTK_REAL const dyi = INV(dy); CCTK_REAL const dzi = INV(dz); @@ -79,10 +66,18 @@ static void hydro_prim2con_Body(cGH const * restrict const cctkGH, int const dir CCTK_REAL const p1ody2 = INV(SQR(dy)); CCTK_REAL const p1odz2 = INV(SQR(dz)); + /* Assign local copies of arrays functions */ + + + + /* Calculate temporaries and arrays functions */ + + /* Copy local copies back to grid functions */ + /* Loop over the grid points */ #pragma omp parallel LC_LOOP3 (hydro_prim2con, - i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + i,j,k, imin[0],imin[1],imin[2], imax[0],imax[1],imax[2], cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) { ptrdiff_t const index = di*i + dj*j + dk*k; @@ -132,5 +127,25 @@ extern "C" void hydro_prim2con(CCTK_ARGUMENTS) DECLARE_CCTK_ARGUMENTS; DECLARE_CCTK_PARAMETERS; + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering hydro_prim2con_Body"); + } + + if (cctk_iteration % hydro_prim2con_calc_every != hydro_prim2con_calc_offset) + { + return; + } + + const char *groups[] = {"ML_hydro::ene_group","ML_hydro::eps_group","ML_hydro::mass_group","ML_hydro::mom_group","ML_hydro::rho_group","ML_hydro::vel_group","ML_hydro::vol_group"}; + GenericFD_AssertGroupStorage(cctkGH, "hydro_prim2con", 7, groups); + + GenericFD_LoopOverEverything(cctkGH, &hydro_prim2con_Body); + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Leaving hydro_prim2con_Body"); + } } diff --git a/ML_hydro/src/hydro_soundWave.cc b/ML_hydro/src/hydro_soundWave.cc index 6f25303..ca8be3d 100644 --- a/ML_hydro/src/hydro_soundWave.cc +++ b/ML_hydro/src/hydro_soundWave.cc @@ -21,7 +21,7 @@ #define SQR(x) ((x) * (x)) #define CUB(x) ((x) * (x) * (x)) -static void hydro_soundWave_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[]) +static void hydro_soundWave_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[]) { DECLARE_CCTK_ARGUMENTS; DECLARE_CCTK_PARAMETERS; @@ -29,20 +29,6 @@ static void hydro_soundWave_Body(cGH const * restrict const cctkGH, int const di /* Declare finite differencing variables */ - if (verbose > 1) - { - CCTK_VInfo(CCTK_THORNSTRING,"Entering hydro_soundWave_Body"); - } - - if (cctk_iteration % hydro_soundWave_calc_every != hydro_soundWave_calc_offset) - { - return; - } - - const char *groups[] = {"ML_hydro::eps_group","grid::coordinates","ML_hydro::rho_group","ML_hydro::vel_group"}; - GenericFD_AssertGroupStorage(cctkGH, "hydro_soundWave", 4, groups); - - /* Include user-supplied include files */ /* Initialise finite differencing variables */ @@ -56,6 +42,7 @@ static void hydro_soundWave_Body(cGH const * restrict const cctkGH, int const di CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); CCTK_REAL const dt = ToReal(CCTK_DELTA_TIME); + CCTK_REAL const t = ToReal(cctk_time); CCTK_REAL const dxi = INV(dx); CCTK_REAL const dyi = INV(dy); CCTK_REAL const dzi = INV(dz); @@ -79,10 +66,18 @@ static void hydro_soundWave_Body(cGH const * restrict const cctkGH, int const di CCTK_REAL const p1ody2 = INV(SQR(dy)); CCTK_REAL const p1odz2 = INV(SQR(dz)); + /* Assign local copies of arrays functions */ + + + + /* Calculate temporaries and arrays functions */ + + /* Copy local copies back to grid functions */ + /* Loop over the grid points */ #pragma omp parallel LC_LOOP3 (hydro_soundWave, - i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + i,j,k, imin[0],imin[1],imin[2], imax[0],imax[1],imax[2], cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) { ptrdiff_t const index = di*i + dj*j + dk*k; @@ -122,5 +117,25 @@ extern "C" void hydro_soundWave(CCTK_ARGUMENTS) DECLARE_CCTK_ARGUMENTS; DECLARE_CCTK_PARAMETERS; + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering hydro_soundWave_Body"); + } + + if (cctk_iteration % hydro_soundWave_calc_every != hydro_soundWave_calc_offset) + { + return; + } + + const char *groups[] = {"ML_hydro::eps_group","grid::coordinates","ML_hydro::rho_group","ML_hydro::vel_group"}; + GenericFD_AssertGroupStorage(cctkGH, "hydro_soundWave", 4, groups); + + GenericFD_LoopOverEverything(cctkGH, &hydro_soundWave_Body); + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Leaving hydro_soundWave_Body"); + } } diff --git a/ML_hydro/src/hydro_vacuum.cc b/ML_hydro/src/hydro_vacuum.cc index ea14bf0..f2299c6 100644 --- a/ML_hydro/src/hydro_vacuum.cc +++ b/ML_hydro/src/hydro_vacuum.cc @@ -21,7 +21,7 @@ #define SQR(x) ((x) * (x)) #define CUB(x) ((x) * (x) * (x)) -static void hydro_vacuum_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[]) +static void hydro_vacuum_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[]) { DECLARE_CCTK_ARGUMENTS; DECLARE_CCTK_PARAMETERS; @@ -29,20 +29,6 @@ static void hydro_vacuum_Body(cGH const * restrict const cctkGH, int const dir, /* Declare finite differencing variables */ - if (verbose > 1) - { - CCTK_VInfo(CCTK_THORNSTRING,"Entering hydro_vacuum_Body"); - } - - if (cctk_iteration % hydro_vacuum_calc_every != hydro_vacuum_calc_offset) - { - return; - } - - const char *groups[] = {"ML_hydro::eps_group","ML_hydro::rho_group","ML_hydro::vel_group"}; - GenericFD_AssertGroupStorage(cctkGH, "hydro_vacuum", 3, groups); - - /* Include user-supplied include files */ /* Initialise finite differencing variables */ @@ -56,6 +42,7 @@ static void hydro_vacuum_Body(cGH const * restrict const cctkGH, int const dir, CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1)); CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2)); CCTK_REAL const dt = ToReal(CCTK_DELTA_TIME); + CCTK_REAL const t = ToReal(cctk_time); CCTK_REAL const dxi = INV(dx); CCTK_REAL const dyi = INV(dy); CCTK_REAL const dzi = INV(dz); @@ -79,10 +66,18 @@ static void hydro_vacuum_Body(cGH const * restrict const cctkGH, int const dir, CCTK_REAL const p1ody2 = INV(SQR(dy)); CCTK_REAL const p1odz2 = INV(SQR(dz)); + /* Assign local copies of arrays functions */ + + + + /* Calculate temporaries and arrays functions */ + + /* Copy local copies back to grid functions */ + /* Loop over the grid points */ #pragma omp parallel LC_LOOP3 (hydro_vacuum, - i,j,k, min[0],min[1],min[2], max[0],max[1],max[2], + i,j,k, imin[0],imin[1],imin[2], imax[0],imax[1],imax[2], cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) { ptrdiff_t const index = di*i + dj*j + dk*k; @@ -121,5 +116,25 @@ extern "C" void hydro_vacuum(CCTK_ARGUMENTS) DECLARE_CCTK_ARGUMENTS; DECLARE_CCTK_PARAMETERS; + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Entering hydro_vacuum_Body"); + } + + if (cctk_iteration % hydro_vacuum_calc_every != hydro_vacuum_calc_offset) + { + return; + } + + const char *groups[] = {"ML_hydro::eps_group","ML_hydro::rho_group","ML_hydro::vel_group"}; + GenericFD_AssertGroupStorage(cctkGH, "hydro_vacuum", 3, groups); + + GenericFD_LoopOverEverything(cctkGH, &hydro_vacuum_Body); + + if (verbose > 1) + { + CCTK_VInfo(CCTK_THORNSTRING,"Leaving hydro_vacuum_Body"); + } } |