#include "GenericFD.h" #include "Differencing.h" #define CCTK_GFINDEX3D(u,i,j,k) I3D(u,i,j,k) CAKERNEL_rk1_Begin_s /* Declare finite differencing variables */ /* Include user-supplied include files */ /* Initialise finite differencing variables */ ptrdiff_t const di = 1; ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); ptrdiff_t const cdi = sizeof(CCTK_REAL) * di; ptrdiff_t const cdj = sizeof(CCTK_REAL) * dj; ptrdiff_t const cdk = sizeof(CCTK_REAL) * dk; CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0)); 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); CCTK_REAL const khalf = 0.5; CCTK_REAL const kthird = 1/3.0; CCTK_REAL const ktwothird = 2.0/3.0; CCTK_REAL const kfourthird = 4.0/3.0; CCTK_REAL const keightthird = 8.0/3.0; CCTK_REAL const hdxi = 0.5 * dxi; CCTK_REAL const hdyi = 0.5 * dyi; CCTK_REAL const hdzi = 0.5 * dzi; /* Initialize predefined quantities */ 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 p1odx2 = INV(SQR(dx)); 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 */ CAKERNEL_rk1_Computations_Begin_s /* Assign local copies of grid functions */ CCTK_REAL phiL = I3D(phi,0,0,0); CCTK_REAL phirhsL = I3D(phirhs,0,0,0); CCTK_REAL piL = I3D(pi,0,0,0); CCTK_REAL pirhsL = I3D(pirhs,0,0,0); /* Include user supplied include files */ /* Precompute derivatives */ /* Calculate temporaries and grid functions */ phiL = Rule(phiL + phirhsL*piL*dt,piL + pirhsL*dt); /* Copy local copies back to grid functions */ I3D(phi,0,0,0) = phiL; CAKERNEL_rk1_Computations_End_s CAKERNEL_rk1_End_s