From 22bc3a7bc6bb2356c1ec72d1845e9d4e502e34ca Mon Sep 17 00:00:00 2001 From: Ian Hinder Date: Wed, 21 Mar 2012 22:00:33 +0100 Subject: Generate WaveCaKernelScript thorn --- Examples/WaveCaKernelScript/cakernel.ccl | 81 ++++++ Examples/WaveCaKernelScript/configuration.ccl | 7 + Examples/WaveCaKernelScript/interface.ccl | 63 +++++ Examples/WaveCaKernelScript/param.ccl | 210 +++++++++++++++ Examples/WaveCaKernelScript/schedule.ccl | 118 +++++++++ Examples/WaveCaKernelScript/src/Boundaries.cc | 249 ++++++++++++++++++ .../src/CaKernel__calc_bound_rhs.code | 100 +++++++ .../WaveCaKernelScript/src/CaKernel__calc_rhs.code | 97 +++++++ .../src/CaKernel__initial_gaussian_calc.code | 98 +++++++ Examples/WaveCaKernelScript/src/Differencing.h | 288 +++++++++++++++++++++ Examples/WaveCaKernelScript/src/RegisterMoL.cc | 20 ++ .../WaveCaKernelScript/src/RegisterSymmetries.cc | 29 +++ Examples/WaveCaKernelScript/src/Startup.cc | 10 + Examples/WaveCaKernelScript/src/make.code.defn | 3 + 14 files changed, 1373 insertions(+) create mode 100644 Examples/WaveCaKernelScript/cakernel.ccl create mode 100644 Examples/WaveCaKernelScript/configuration.ccl create mode 100644 Examples/WaveCaKernelScript/interface.ccl create mode 100644 Examples/WaveCaKernelScript/param.ccl create mode 100644 Examples/WaveCaKernelScript/schedule.ccl create mode 100644 Examples/WaveCaKernelScript/src/Boundaries.cc create mode 100644 Examples/WaveCaKernelScript/src/CaKernel__calc_bound_rhs.code create mode 100644 Examples/WaveCaKernelScript/src/CaKernel__calc_rhs.code create mode 100644 Examples/WaveCaKernelScript/src/CaKernel__initial_gaussian_calc.code create mode 100644 Examples/WaveCaKernelScript/src/Differencing.h create mode 100644 Examples/WaveCaKernelScript/src/RegisterMoL.cc create mode 100644 Examples/WaveCaKernelScript/src/RegisterSymmetries.cc create mode 100644 Examples/WaveCaKernelScript/src/Startup.cc create mode 100644 Examples/WaveCaKernelScript/src/make.code.defn (limited to 'Examples') diff --git a/Examples/WaveCaKernelScript/cakernel.ccl b/Examples/WaveCaKernelScript/cakernel.ccl new file mode 100644 index 0000000..4359133 --- /dev/null +++ b/Examples/WaveCaKernelScript/cakernel.ccl @@ -0,0 +1,81 @@ +CCTK_CUDA_KERNEL initial_gaussian_calc TYPE=gpu_cuda/3dblock TILE="8,8,8" SHARECODE=yes STENCIL="0,0,0,0,0,0" +{ + CCTK_CUDA_KERNEL_VARIABLE cached=no intent=out + { + phi + } + "phi" + + CCTK_CUDA_KERNEL_VARIABLE cached=no intent=out + { + pi + } + "pi" + + CCTK_CUDA_KERNEL_VARIABLE cached=no intent=in + { + x + } + "x" + + CCTK_CUDA_KERNEL_PARAMETER + { + fdOrder + } + "fdOrder" +} + +CCTK_CUDA_KERNEL calc_rhs TYPE=gpu_cuda/3dblock TILE="8,8,8" SHARECODE=yes STENCIL="0,0,0,0,0,0" +{ + CCTK_CUDA_KERNEL_VARIABLE cached=no intent=out + { + phirhs + } + "phirhs" + + CCTK_CUDA_KERNEL_VARIABLE cached=no intent=in + { + pi + } + "pi" + + CCTK_CUDA_KERNEL_VARIABLE cached=no intent=out + { + pirhs + } + "pirhs" + + CCTK_CUDA_KERNEL_PARAMETER + { + fdOrder + } + "fdOrder" +} + +CCTK_CUDA_KERNEL calc_bound_rhs TYPE=gpu_cuda/3dblock TILE="8,8,8" SHARECODE=yes STENCIL="0,0,0,0,0,0" +{ + CCTK_CUDA_KERNEL_VARIABLE cached=no intent=out + { + phirhs + } + "phirhs" + + CCTK_CUDA_KERNEL_VARIABLE cached=no intent=out + { + pirhs + } + "pirhs" + + CCTK_CUDA_KERNEL_VARIABLE cached=no intent=in + { + x + } + "x" + + CCTK_CUDA_KERNEL_PARAMETER + { + fdOrder + } + "fdOrder" +} + diff --git a/Examples/WaveCaKernelScript/configuration.ccl b/Examples/WaveCaKernelScript/configuration.ccl new file mode 100644 index 0000000..46dbde5 --- /dev/null +++ b/Examples/WaveCaKernelScript/configuration.ccl @@ -0,0 +1,7 @@ +# File produced by Kranc + +REQUIRES GenericFD +OPTIONAL LoopControl +{ +} +REQUIRES CUDA \ No newline at end of file diff --git a/Examples/WaveCaKernelScript/interface.ccl b/Examples/WaveCaKernelScript/interface.ccl new file mode 100644 index 0000000..270f05f --- /dev/null +++ b/Examples/WaveCaKernelScript/interface.ccl @@ -0,0 +1,63 @@ +# File produced by Kranc + +implements: WaveCaKernelScript + +inherits: Grid GenericFD Boundary + + + +USES INCLUDE: GenericFD.h +USES INCLUDE: Symmetry.h +USES INCLUDE: sbp_calc_coeffs.h +USES INCLUDE: Boundary.h +USES INCLUDE: loopcontrol.h + +CCTK_INT FUNCTION MoLRegisterEvolved(CCTK_INT IN EvolvedIndex, CCTK_INT IN RHSIndex) +USES FUNCTION MoLRegisterEvolved + +SUBROUTINE Diff_coeff(CCTK_POINTER_TO_CONST IN cctkGH, CCTK_INT IN dir, CCTK_INT IN nsize, CCTK_INT OUT ARRAY imin, CCTK_INT OUT ARRAY imax, CCTK_REAL OUT ARRAY q, CCTK_INT IN table_handle) +USES FUNCTION Diff_coeff + +CCTK_INT FUNCTION MultiPatch_GetMap(CCTK_POINTER_TO_CONST IN cctkGH) +USES FUNCTION MultiPatch_GetMap + +CCTK_INT FUNCTION Boundary_SelectGroupForBC(CCTK_POINTER_TO_CONST IN GH, CCTK_INT IN faces, CCTK_INT IN boundary_width, CCTK_INT IN table_handle, CCTK_STRING IN group_name, CCTK_STRING IN bc_name) +USES FUNCTION Boundary_SelectGroupForBC + +CCTK_INT FUNCTION Boundary_SelectVarForBC(CCTK_POINTER_TO_CONST IN GH, CCTK_INT IN faces, CCTK_INT IN boundary_width, CCTK_INT IN table_handle, CCTK_STRING IN var_name, CCTK_STRING IN bc_name) +USES FUNCTION Boundary_SelectVarForBC + +public: +CCTK_REAL phi_group type=GF timelevels=3 tags='tensortypealias="Scalar" tensorweight=0' +{ + phi +} "phi_group" + +public: +CCTK_REAL pi_group type=GF timelevels=3 tags='tensortypealias="Scalar" tensorweight=0' +{ + pi +} "pi_group" + +public: +CCTK_REAL phi_grouprhs type=GF timelevels=3 tags='tensortypealias="Scalar" tensorweight=0' +{ + phirhs +} "phi_grouprhs" + +public: +CCTK_REAL pi_grouprhs type=GF timelevels=3 tags='tensortypealias="Scalar" tensorweight=0' +{ + pirhs +} "pi_grouprhs" + +# These functions are provided by the CaKernel thorn + +CCTK_INT FUNCTION Device_RegisterMem(CCTK_POINTER IN cctkGH, CCTK_INT IN vi, CCTK_INT IN num_tls) +REQUIRES FUNCTION Device_RegisterMem + +CCTK_INT FUNCTION Device_UnRegisterMem(CCTK_POINTER IN cctkGH, CCTK_INT IN vi) +REQUIRES FUNCTION Device_UnRegisterMem + +CCTK_POINTER FUNCTION Device_GetVarI (CCTK_POINTER IN cctkGH, CCTK_INT IN vi, CCTK_INT IN num_tls) +REQUIRES FUNCTION Device_GetVarI diff --git a/Examples/WaveCaKernelScript/param.ccl b/Examples/WaveCaKernelScript/param.ccl new file mode 100644 index 0000000..570b8ad --- /dev/null +++ b/Examples/WaveCaKernelScript/param.ccl @@ -0,0 +1,210 @@ +# File produced by Kranc + + +shares: GenericFD + + + +shares: MethodOfLines + +USES CCTK_INT MoL_Num_Evolved_Vars +USES CCTK_INT MoL_Num_ArrayEvolved_Vars + +restricted: +CCTK_INT verbose "verbose" STEERABLE=ALWAYS +{ + *:* :: "" +} 0 + +restricted: +CCTK_INT fdOrder "fdOrder" +{ + *:* :: "" +} 2 + +restricted: +CCTK_INT WaveCaKernelScript_MaxNumEvolvedVars "Number of evolved variables used by this thorn" ACCUMULATOR-BASE=MethodofLines::MoL_Num_Evolved_Vars STEERABLE=RECOVER +{ + 2:2 :: "Number of evolved variables used by this thorn" +} 2 + +restricted: +CCTK_INT WaveCaKernelScript_MaxNumArrayEvolvedVars "Number of Array evolved variables used by this thorn" ACCUMULATOR-BASE=MethodofLines::MoL_Num_ArrayEvolved_Vars STEERABLE=RECOVER +{ + 0:0 :: "Number of Array evolved variables used by this thorn" +} 0 + +restricted: +CCTK_INT timelevels "Number of active timelevels" STEERABLE=RECOVER +{ + 0:3 :: "" +} 3 + +restricted: +CCTK_INT rhs_timelevels "Number of active RHS timelevels" STEERABLE=RECOVER +{ + 0:3 :: "" +} 1 + +restricted: +CCTK_INT other_timelevels "Number of active timelevels for non-evolved grid functions" STEERABLE=RECOVER +{ + 0:3 :: "" +} 1 + +restricted: +CCTK_INT initial_gaussian_calc_calc_every "initial_gaussian_calc_calc_every" STEERABLE=ALWAYS +{ + *:* :: "" +} 1 + +restricted: +CCTK_INT calc_rhs_calc_every "calc_rhs_calc_every" STEERABLE=ALWAYS +{ + *:* :: "" +} 1 + +restricted: +CCTK_INT calc_bound_rhs_calc_every "calc_bound_rhs_calc_every" STEERABLE=ALWAYS +{ + *:* :: "" +} 1 + +restricted: +CCTK_INT initial_gaussian_calc_calc_offset "initial_gaussian_calc_calc_offset" STEERABLE=ALWAYS +{ + *:* :: "" +} 0 + +restricted: +CCTK_INT calc_rhs_calc_offset "calc_rhs_calc_offset" STEERABLE=ALWAYS +{ + *:* :: "" +} 0 + +restricted: +CCTK_INT calc_bound_rhs_calc_offset "calc_bound_rhs_calc_offset" STEERABLE=ALWAYS +{ + *:* :: "" +} 0 + +private: +KEYWORD phi_bound "Boundary condition to implement" STEERABLE=ALWAYS +{ + "flat" :: "Flat boundary condition" + "none" :: "No boundary condition" + "static" :: "Boundaries held fixed" + "radiative" :: "Radiation boundary condition" + "scalar" :: "Dirichlet boundary condition" + "newrad" :: "Improved radiative boundary condition" + "skip" :: "skip boundary condition code" +} "skip" + +private: +KEYWORD pi_bound "Boundary condition to implement" STEERABLE=ALWAYS +{ + "flat" :: "Flat boundary condition" + "none" :: "No boundary condition" + "static" :: "Boundaries held fixed" + "radiative" :: "Radiation boundary condition" + "scalar" :: "Dirichlet boundary condition" + "newrad" :: "Improved radiative boundary condition" + "skip" :: "skip boundary condition code" +} "skip" + +private: +KEYWORD phi_group_bound "Boundary condition to implement" STEERABLE=ALWAYS +{ + "flat" :: "Flat boundary condition" + "none" :: "No boundary condition" + "static" :: "Boundaries held fixed" + "radiative" :: "Radiation boundary condition" + "scalar" :: "Dirichlet boundary condition" + "newrad" :: "Improved radiative boundary condition" + "skip" :: "skip boundary condition code" +} "none" + +private: +KEYWORD pi_group_bound "Boundary condition to implement" STEERABLE=ALWAYS +{ + "flat" :: "Flat boundary condition" + "none" :: "No boundary condition" + "static" :: "Boundaries held fixed" + "radiative" :: "Radiation boundary condition" + "scalar" :: "Dirichlet boundary condition" + "newrad" :: "Improved radiative boundary condition" + "skip" :: "skip boundary condition code" +} "none" + +private: +CCTK_REAL phi_bound_speed "characteristic speed at boundary" STEERABLE=ALWAYS +{ + "0:*" :: "outgoing characteristic speed > 0" +} 1. + +private: +CCTK_REAL pi_bound_speed "characteristic speed at boundary" STEERABLE=ALWAYS +{ + "0:*" :: "outgoing characteristic speed > 0" +} 1. + +private: +CCTK_REAL phi_group_bound_speed "characteristic speed at boundary" STEERABLE=ALWAYS +{ + "0:*" :: "outgoing characteristic speed > 0" +} 1. + +private: +CCTK_REAL pi_group_bound_speed "characteristic speed at boundary" STEERABLE=ALWAYS +{ + "0:*" :: "outgoing characteristic speed > 0" +} 1. + +private: +CCTK_REAL phi_bound_limit "limit value for r -> infinity" STEERABLE=ALWAYS +{ + "*:*" :: "value of limit value is unrestricted" +} 0. + +private: +CCTK_REAL pi_bound_limit "limit value for r -> infinity" STEERABLE=ALWAYS +{ + "*:*" :: "value of limit value is unrestricted" +} 0. + +private: +CCTK_REAL phi_group_bound_limit "limit value for r -> infinity" STEERABLE=ALWAYS +{ + "*:*" :: "value of limit value is unrestricted" +} 0. + +private: +CCTK_REAL pi_group_bound_limit "limit value for r -> infinity" STEERABLE=ALWAYS +{ + "*:*" :: "value of limit value is unrestricted" +} 0. + +private: +CCTK_REAL phi_bound_scalar "Dirichlet boundary value" STEERABLE=ALWAYS +{ + "*:*" :: "unrestricted" +} 0. + +private: +CCTK_REAL pi_bound_scalar "Dirichlet boundary value" STEERABLE=ALWAYS +{ + "*:*" :: "unrestricted" +} 0. + +private: +CCTK_REAL phi_group_bound_scalar "Dirichlet boundary value" STEERABLE=ALWAYS +{ + "*:*" :: "unrestricted" +} 0. + +private: +CCTK_REAL pi_group_bound_scalar "Dirichlet boundary value" STEERABLE=ALWAYS +{ + "*:*" :: "unrestricted" +} 0. + diff --git a/Examples/WaveCaKernelScript/schedule.ccl b/Examples/WaveCaKernelScript/schedule.ccl new file mode 100644 index 0000000..989f7ec --- /dev/null +++ b/Examples/WaveCaKernelScript/schedule.ccl @@ -0,0 +1,118 @@ +# File produced by Kranc + + +if (timelevels == 1) +{ + STORAGE: phi_group[1] +} +if (timelevels == 2) +{ + STORAGE: phi_group[2] +} +if (timelevels == 3) +{ + STORAGE: phi_group[3] +} + +if (timelevels == 1) +{ + STORAGE: pi_group[1] +} +if (timelevels == 2) +{ + STORAGE: pi_group[2] +} +if (timelevels == 3) +{ + STORAGE: pi_group[3] +} + +if (rhs_timelevels == 1) +{ + STORAGE: phi_grouprhs[1] +} +if (rhs_timelevels == 2) +{ + STORAGE: phi_grouprhs[2] +} +if (rhs_timelevels == 3) +{ + STORAGE: phi_grouprhs[3] +} + +if (rhs_timelevels == 1) +{ + STORAGE: pi_grouprhs[1] +} +if (rhs_timelevels == 2) +{ + STORAGE: pi_grouprhs[2] +} +if (rhs_timelevels == 3) +{ + STORAGE: pi_grouprhs[3] +} + +schedule WaveCaKernelScript_Startup at STARTUP +{ + LANG: C + OPTIONS: meta +} "create banner" + +schedule WaveCaKernelScript_RegisterSymmetries in SymmetryRegister +{ + LANG: C + OPTIONS: meta +} "register symmetries" + +schedule CAKERNEL_Launch_initial_gaussian_calc at initial +{ + LANG: C + TAGS: Device=1 + READS: grid::coordinates + WRITES: WaveCaKernelScript::phi_group + WRITES: WaveCaKernelScript::pi_group +} "initial_gaussian_calc" + +schedule CAKERNEL_Launch_calc_rhs in MoL_CalcRHS +{ + LANG: C + TAGS: Device=1 + READS: WaveCaKernelScript::pi_group + WRITES: WaveCaKernelScript::phi_grouprhs + WRITES: WaveCaKernelScript::pi_grouprhs +} "calc_rhs" + +schedule CAKERNEL_Launch_calc_bound_rhs in MoL_RHSBoundaries +{ + LANG: C + TAGS: Device=1 + READS: grid::coordinates + WRITES: WaveCaKernelScript::phi_grouprhs + WRITES: WaveCaKernelScript::pi_grouprhs +} "calc_bound_rhs" + +schedule WaveCaKernelScript_SelectBoundConds in MoL_PostStep +{ + LANG: C + OPTIONS: level + SYNC: phi_group + SYNC: pi_group +} "select boundary conditions" + +schedule WaveCaKernelScript_CheckBoundaries at BASEGRID +{ + LANG: C + OPTIONS: meta +} "check boundaries treatment" + +schedule WaveCaKernelScript_RegisterVars in MoL_Register +{ + LANG: C + OPTIONS: meta +} "Register Variables for MoL" + +schedule group ApplyBCs as WaveCaKernelScript_ApplyBCs in MoL_PostStep after WaveCaKernelScript_SelectBoundConds +{ + # no language specified +} "Apply boundary conditions controlled by thorn Boundary" diff --git a/Examples/WaveCaKernelScript/src/Boundaries.cc b/Examples/WaveCaKernelScript/src/Boundaries.cc new file mode 100644 index 0000000..8f231ab --- /dev/null +++ b/Examples/WaveCaKernelScript/src/Boundaries.cc @@ -0,0 +1,249 @@ +/* File produced by Kranc */ + +#include "cctk.h" +#include "cctk_Arguments.h" +#include "cctk_Parameters.h" +#include "cctk_Faces.h" +#include "util_Table.h" +#include "Symmetry.h" + + +/* the boundary treatment is split into 3 steps: */ +/* 1. excision */ +/* 2. symmetries */ +/* 3. "other" boundary conditions, e.g. radiative */ + +/* to simplify scheduling and testing, the 3 steps */ +/* are currently applied in separate functions */ + + +extern "C" void WaveCaKernelScript_CheckBoundaries(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + return; +} + +extern "C" void WaveCaKernelScript_SelectBoundConds(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT ierr = 0; + + if (CCTK_EQUALS(phi_group_bound, "none" ) || + CCTK_EQUALS(phi_group_bound, "static") || + CCTK_EQUALS(phi_group_bound, "flat" ) || + CCTK_EQUALS(phi_group_bound, "zero" ) ) + { + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "WaveCaKernelScript::phi_group", phi_group_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register phi_group_bound BC for WaveCaKernelScript::phi_group!"); + } + + if (CCTK_EQUALS(pi_group_bound, "none" ) || + CCTK_EQUALS(pi_group_bound, "static") || + CCTK_EQUALS(pi_group_bound, "flat" ) || + CCTK_EQUALS(pi_group_bound, "zero" ) ) + { + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "WaveCaKernelScript::pi_group", pi_group_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register pi_group_bound BC for WaveCaKernelScript::pi_group!"); + } + + if (CCTK_EQUALS(phi_bound, "none" ) || + CCTK_EQUALS(phi_bound, "static") || + CCTK_EQUALS(phi_bound, "flat" ) || + CCTK_EQUALS(phi_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "WaveCaKernelScript::phi", phi_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register phi_bound BC for WaveCaKernelScript::phi!"); + } + + if (CCTK_EQUALS(pi_bound, "none" ) || + CCTK_EQUALS(pi_bound, "static") || + CCTK_EQUALS(pi_bound, "flat" ) || + CCTK_EQUALS(pi_bound, "zero" ) ) + { + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1, + "WaveCaKernelScript::pi", pi_bound); + if (ierr < 0) + CCTK_WARN(0, "Failed to register pi_bound BC for WaveCaKernelScript::pi!"); + } + + if (CCTK_EQUALS(phi_group_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_phi_group_bound = -1; + if (handle_phi_group_bound < 0) handle_phi_group_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_phi_group_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_phi_group_bound , phi_group_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_phi_group_bound ,phi_group_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_phi_group_bound, + "WaveCaKernelScript::phi_group", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for WaveCaKernelScript::phi_group!"); + + } + + if (CCTK_EQUALS(pi_group_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_pi_group_bound = -1; + if (handle_pi_group_bound < 0) handle_pi_group_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_pi_group_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_pi_group_bound , pi_group_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_pi_group_bound ,pi_group_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_pi_group_bound, + "WaveCaKernelScript::pi_group", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for WaveCaKernelScript::pi_group!"); + + } + + if (CCTK_EQUALS(phi_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_phi_bound = -1; + if (handle_phi_bound < 0) handle_phi_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_phi_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_phi_bound , phi_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_phi_bound ,phi_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_phi_bound, + "WaveCaKernelScript::phi", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for WaveCaKernelScript::phi!"); + + } + + if (CCTK_EQUALS(pi_bound, "radiative")) + { + /* select radiation boundary condition */ + static CCTK_INT handle_pi_bound = -1; + if (handle_pi_bound < 0) handle_pi_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_pi_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_pi_bound , pi_bound_limit, "LIMIT") < 0) + CCTK_WARN(0, "could not set LIMIT value in table!"); + if (Util_TableSetReal(handle_pi_bound ,pi_bound_speed, "SPEED") < 0) + CCTK_WARN(0, "could not set SPEED value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_pi_bound, + "WaveCaKernelScript::pi", "Radiation"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Radiation BC for WaveCaKernelScript::pi!"); + + } + + if (CCTK_EQUALS(phi_group_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_phi_group_bound = -1; + if (handle_phi_group_bound < 0) handle_phi_group_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_phi_group_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_phi_group_bound ,phi_group_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_phi_group_bound, + "WaveCaKernelScript::phi_group", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Scalar BC for WaveCaKernelScript::phi_group!"); + + } + + if (CCTK_EQUALS(pi_group_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_pi_group_bound = -1; + if (handle_pi_group_bound < 0) handle_pi_group_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_pi_group_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_pi_group_bound ,pi_group_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_pi_group_bound, + "WaveCaKernelScript::pi_group", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Failed to register Scalar BC for WaveCaKernelScript::pi_group!"); + + } + + if (CCTK_EQUALS(phi_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_phi_bound = -1; + if (handle_phi_bound < 0) handle_phi_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_phi_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_phi_bound ,phi_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_phi_bound, + "WaveCaKernelScript::phi", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for WaveCaKernelScript::phi!"); + + } + + if (CCTK_EQUALS(pi_bound, "scalar")) + { + /* select scalar boundary condition */ + static CCTK_INT handle_pi_bound = -1; + if (handle_pi_bound < 0) handle_pi_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); + if (handle_pi_bound < 0) CCTK_WARN(0, "could not create table!"); + if (Util_TableSetReal(handle_pi_bound ,pi_bound_scalar, "SCALAR") < 0) + CCTK_WARN(0, "could not set SCALAR value in table!"); + + ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_pi_bound, + "WaveCaKernelScript::pi", "scalar"); + + if (ierr < 0) + CCTK_WARN(0, "Error in registering Scalar BC for WaveCaKernelScript::pi!"); + + } + return; +} + + + +/* template for entries in parameter file: +#$bound$#WaveCaKernelScript::phi_group_bound = "skip" +#$bound$#WaveCaKernelScript::phi_group_bound_speed = 1.0 +#$bound$#WaveCaKernelScript::phi_group_bound_limit = 0.0 +#$bound$#WaveCaKernelScript::phi_group_bound_scalar = 0.0 + +#$bound$#WaveCaKernelScript::pi_group_bound = "skip" +#$bound$#WaveCaKernelScript::pi_group_bound_speed = 1.0 +#$bound$#WaveCaKernelScript::pi_group_bound_limit = 0.0 +#$bound$#WaveCaKernelScript::pi_group_bound_scalar = 0.0 + +#$bound$#WaveCaKernelScript::phi_bound = "skip" +#$bound$#WaveCaKernelScript::phi_bound_speed = 1.0 +#$bound$#WaveCaKernelScript::phi_bound_limit = 0.0 +#$bound$#WaveCaKernelScript::phi_bound_scalar = 0.0 + +#$bound$#WaveCaKernelScript::pi_bound = "skip" +#$bound$#WaveCaKernelScript::pi_bound_speed = 1.0 +#$bound$#WaveCaKernelScript::pi_bound_limit = 0.0 +#$bound$#WaveCaKernelScript::pi_bound_scalar = 0.0 + +*/ + diff --git a/Examples/WaveCaKernelScript/src/CaKernel__calc_bound_rhs.code b/Examples/WaveCaKernelScript/src/CaKernel__calc_bound_rhs.code new file mode 100644 index 0000000..fa8b6ae --- /dev/null +++ b/Examples/WaveCaKernelScript/src/CaKernel__calc_bound_rhs.code @@ -0,0 +1,100 @@ +#undef KRANC_DIFF_FUNCTIONS +#define KRANC_C +#include "Differencing.h" +#include "GenericFD.h" + +#undef KRANC_GFOFFSET3D +#define KRANC_GFOFFSET3D(u,i,j,k) I3D(u,i,j,k) + + +/* Define macros used in calculations */ +#define INITVALUE (42) +#define QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +CAKERNEL_calc_bound_rhs_Begin + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + CCTK_REAL const dx = params.cagh_dx; + CCTK_REAL const dy = params.cagh_dy; + CCTK_REAL const dz = params.cagh_dz; + CCTK_REAL const dt = params.cagh_dt; + CCTK_REAL const t = params.cagh_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 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*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*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 p1ody2 = INV(SQR(dy)); + 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)); + CCTK_REAL const pm1o12dz2 = -0.0833333333333333333333333333333*INV(SQR(dz)); + + /* Assign local copies of arrays functions */ + + + + /* Calculate temporaries and arrays functions */ + + /* Copy local copies back to grid functions */ + CAKERNEL_calc_bound_rhs_Computations_Begin + + /* Assign local copies of grid functions */ + + CCTK_REAL xL = I3D(x,0,0,0); + + + /* Include user supplied include files */ + + /* Precompute derivatives */ + + switch(fdOrder) + { + case 2: + break; + + case 4: + break; + } + + /* Calculate temporaries and grid functions */ + CCTK_REAL phirhsL = 199.99999999999997*(xL + t)*exp(-100.*SQR(xL + + t)); + + CCTK_REAL pirhsL = exp(-99.99999999999999*SQR(xL + + t))*(-199.99999999999997 + 79999.99999999997*xL*t + + 39999.999999999985*(SQR(xL) + SQR(t))); + + /* Copy local copies back to grid functions */ + I3D(phirhs,0,0,0) = phirhsL; + I3D(pirhs,0,0,0) = pirhsL; + + CAKERNEL_calc_bound_rhs_Computations_End + +CAKERNEL_calc_bound_rhs_End diff --git a/Examples/WaveCaKernelScript/src/CaKernel__calc_rhs.code b/Examples/WaveCaKernelScript/src/CaKernel__calc_rhs.code new file mode 100644 index 0000000..78a0089 --- /dev/null +++ b/Examples/WaveCaKernelScript/src/CaKernel__calc_rhs.code @@ -0,0 +1,97 @@ +#undef KRANC_DIFF_FUNCTIONS +#define KRANC_C +#include "Differencing.h" +#include "GenericFD.h" + +#undef KRANC_GFOFFSET3D +#define KRANC_GFOFFSET3D(u,i,j,k) I3D(u,i,j,k) + + +/* Define macros used in calculations */ +#define INITVALUE (42) +#define QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +CAKERNEL_calc_rhs_Begin + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + CCTK_REAL const dx = params.cagh_dx; + CCTK_REAL const dy = params.cagh_dy; + CCTK_REAL const dz = params.cagh_dz; + CCTK_REAL const dt = params.cagh_dt; + CCTK_REAL const t = params.cagh_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 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*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*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 p1ody2 = INV(SQR(dy)); + 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)); + CCTK_REAL const pm1o12dz2 = -0.0833333333333333333333333333333*INV(SQR(dz)); + + /* Assign local copies of arrays functions */ + + + + /* Calculate temporaries and arrays functions */ + + /* Copy local copies back to grid functions */ + CAKERNEL_calc_rhs_Computations_Begin + + /* Assign local copies of grid functions */ + + CCTK_REAL piL = I3D(pi,0,0,0); + + + /* Include user supplied include files */ + + /* Precompute derivatives */ + + switch(fdOrder) + { + case 2: + break; + + case 4: + break; + } + + /* Calculate temporaries and grid functions */ + CCTK_REAL phirhsL = piL; + + CCTK_REAL pirhsL = 0; + + /* Copy local copies back to grid functions */ + I3D(phirhs,0,0,0) = phirhsL; + I3D(pirhs,0,0,0) = pirhsL; + + CAKERNEL_calc_rhs_Computations_End + +CAKERNEL_calc_rhs_End diff --git a/Examples/WaveCaKernelScript/src/CaKernel__initial_gaussian_calc.code b/Examples/WaveCaKernelScript/src/CaKernel__initial_gaussian_calc.code new file mode 100644 index 0000000..e5851eb --- /dev/null +++ b/Examples/WaveCaKernelScript/src/CaKernel__initial_gaussian_calc.code @@ -0,0 +1,98 @@ +#undef KRANC_DIFF_FUNCTIONS +#define KRANC_C +#include "Differencing.h" +#include "GenericFD.h" + +#undef KRANC_GFOFFSET3D +#define KRANC_GFOFFSET3D(u,i,j,k) I3D(u,i,j,k) + + +/* Define macros used in calculations */ +#define INITVALUE (42) +#define QAD(x) (SQR(SQR(x))) +#define INV(x) ((1.0) / (x)) +#define SQR(x) ((x) * (x)) +#define CUB(x) ((x) * (x) * (x)) + +CAKERNEL_initial_gaussian_calc_Begin + + /* Include user-supplied include files */ + + /* Initialise finite differencing variables */ + CCTK_REAL const dx = params.cagh_dx; + CCTK_REAL const dy = params.cagh_dy; + CCTK_REAL const dz = params.cagh_dz; + CCTK_REAL const dt = params.cagh_dt; + CCTK_REAL const t = params.cagh_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 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*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*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 p1ody2 = INV(SQR(dy)); + 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)); + CCTK_REAL const pm1o12dz2 = -0.0833333333333333333333333333333*INV(SQR(dz)); + + /* Assign local copies of arrays functions */ + + + + /* Calculate temporaries and arrays functions */ + + /* Copy local copies back to grid functions */ + CAKERNEL_initial_gaussian_calc_Computations_Begin + + /* Assign local copies of grid functions */ + + CCTK_REAL xL = I3D(x,0,0,0); + + + /* Include user supplied include files */ + + /* Precompute derivatives */ + + switch(fdOrder) + { + case 2: + break; + + case 4: + break; + } + + /* Calculate temporaries and grid functions */ + CCTK_REAL phiL = exp(-100.*SQR(xL + t)); + + CCTK_REAL piL = -199.99999999999997*(xL + t)*exp(-100.*SQR(xL + + t)); + + /* Copy local copies back to grid functions */ + I3D(phi,0,0,0) = phiL; + I3D(pi,0,0,0) = piL; + + CAKERNEL_initial_gaussian_calc_Computations_End + +CAKERNEL_initial_gaussian_calc_End diff --git a/Examples/WaveCaKernelScript/src/Differencing.h b/Examples/WaveCaKernelScript/src/Differencing.h new file mode 100644 index 0000000..98de1a1 --- /dev/null +++ b/Examples/WaveCaKernelScript/src/Differencing.h @@ -0,0 +1,288 @@ +#ifndef KRANC_DIFF_FUNCTIONS +# define PDstandardfdOrder21(u) ((-KRANC_GFOFFSET3D(u,-1,0,0) + KRANC_GFOFFSET3D(u,1,0,0))*p1o2dx) +#else +# define PDstandardfdOrder21(u) (PDstandardfdOrder21_impl(u,p1o2dx,cdj,cdk)) +static CCTK_REAL PDstandardfdOrder21_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 PDstandardfdOrder21_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 (-KRANC_GFOFFSET3D(u,-1,0,0) + KRANC_GFOFFSET3D(u,1,0,0))*p1o2dx; +} +#endif + +#ifndef KRANC_DIFF_FUNCTIONS +# define PDstandardfdOrder22(u) ((-KRANC_GFOFFSET3D(u,0,-1,0) + KRANC_GFOFFSET3D(u,0,1,0))*p1o2dy) +#else +# define PDstandardfdOrder22(u) (PDstandardfdOrder22_impl(u,p1o2dy,cdj,cdk)) +static CCTK_REAL PDstandardfdOrder22_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 PDstandardfdOrder22_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 (-KRANC_GFOFFSET3D(u,0,-1,0) + KRANC_GFOFFSET3D(u,0,1,0))*p1o2dy; +} +#endif + +#ifndef KRANC_DIFF_FUNCTIONS +# define PDstandardfdOrder23(u) ((-KRANC_GFOFFSET3D(u,0,0,-1) + KRANC_GFOFFSET3D(u,0,0,1))*p1o2dz) +#else +# define PDstandardfdOrder23(u) (PDstandardfdOrder23_impl(u,p1o2dz,cdj,cdk)) +static CCTK_REAL PDstandardfdOrder23_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 PDstandardfdOrder23_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 (-KRANC_GFOFFSET3D(u,0,0,-1) + KRANC_GFOFFSET3D(u,0,0,1))*p1o2dz; +} +#endif + +#ifndef KRANC_DIFF_FUNCTIONS +# define PDstandardfdOrder41(u) ((-8*KRANC_GFOFFSET3D(u,-1,0,0) + 8*KRANC_GFOFFSET3D(u,1,0,0) + KRANC_GFOFFSET3D(u,-2,0,0) - KRANC_GFOFFSET3D(u,2,0,0))*p1o12dx) +#else +# define PDstandardfdOrder41(u) (PDstandardfdOrder41_impl(u,p1o12dx,cdj,cdk)) +static CCTK_REAL PDstandardfdOrder41_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o12dx, ptrdiff_t const cdj, ptrdiff_t const cdk) CCTK_ATTRIBUTE_NOINLINE CCTK_ATTRIBUTE_UNUSED; +static CCTK_REAL PDstandardfdOrder41_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o12dx, ptrdiff_t const cdj, ptrdiff_t const cdk) +{ + ptrdiff_t const cdi=sizeof(CCTK_REAL); + return (-8*KRANC_GFOFFSET3D(u,-1,0,0) + 8*KRANC_GFOFFSET3D(u,1,0,0) + KRANC_GFOFFSET3D(u,-2,0,0) - KRANC_GFOFFSET3D(u,2,0,0))*p1o12dx; +} +#endif + +#ifndef KRANC_DIFF_FUNCTIONS +# define PDstandardfdOrder42(u) ((-8*KRANC_GFOFFSET3D(u,0,-1,0) + 8*KRANC_GFOFFSET3D(u,0,1,0) + KRANC_GFOFFSET3D(u,0,-2,0) - KRANC_GFOFFSET3D(u,0,2,0))*p1o12dy) +#else +# define PDstandardfdOrder42(u) (PDstandardfdOrder42_impl(u,p1o12dy,cdj,cdk)) +static CCTK_REAL PDstandardfdOrder42_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o12dy, ptrdiff_t const cdj, ptrdiff_t const cdk) CCTK_ATTRIBUTE_NOINLINE CCTK_ATTRIBUTE_UNUSED; +static CCTK_REAL PDstandardfdOrder42_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o12dy, ptrdiff_t const cdj, ptrdiff_t const cdk) +{ + ptrdiff_t const cdi=sizeof(CCTK_REAL); + return (-8*KRANC_GFOFFSET3D(u,0,-1,0) + 8*KRANC_GFOFFSET3D(u,0,1,0) + KRANC_GFOFFSET3D(u,0,-2,0) - KRANC_GFOFFSET3D(u,0,2,0))*p1o12dy; +} +#endif + +#ifndef KRANC_DIFF_FUNCTIONS +# define PDstandardfdOrder43(u) ((-8*KRANC_GFOFFSET3D(u,0,0,-1) + 8*KRANC_GFOFFSET3D(u,0,0,1) + KRANC_GFOFFSET3D(u,0,0,-2) - KRANC_GFOFFSET3D(u,0,0,2))*p1o12dz) +#else +# define PDstandardfdOrder43(u) (PDstandardfdOrder43_impl(u,p1o12dz,cdj,cdk)) +static CCTK_REAL PDstandardfdOrder43_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o12dz, ptrdiff_t const cdj, ptrdiff_t const cdk) CCTK_ATTRIBUTE_NOINLINE CCTK_ATTRIBUTE_UNUSED; +static CCTK_REAL PDstandardfdOrder43_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o12dz, ptrdiff_t const cdj, ptrdiff_t const cdk) +{ + ptrdiff_t const cdi=sizeof(CCTK_REAL); + return (-8*KRANC_GFOFFSET3D(u,0,0,-1) + 8*KRANC_GFOFFSET3D(u,0,0,1) + KRANC_GFOFFSET3D(u,0,0,-2) - KRANC_GFOFFSET3D(u,0,0,2))*p1o12dz; +} +#endif + +#ifndef KRANC_DIFF_FUNCTIONS +# define PDstandardfdOrder211(u) ((-2*KRANC_GFOFFSET3D(u,0,0,0) + KRANC_GFOFFSET3D(u,-1,0,0) + KRANC_GFOFFSET3D(u,1,0,0))*p1odx2) +#else +# define PDstandardfdOrder211(u) (PDstandardfdOrder211_impl(u,p1odx2,cdj,cdk)) +static CCTK_REAL PDstandardfdOrder211_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 PDstandardfdOrder211_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*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 PDstandardfdOrder222(u) ((-2*KRANC_GFOFFSET3D(u,0,0,0) + KRANC_GFOFFSET3D(u,0,-1,0) + KRANC_GFOFFSET3D(u,0,1,0))*p1ody2) +#else +# define PDstandardfdOrder222(u) (PDstandardfdOrder222_impl(u,p1ody2,cdj,cdk)) +static CCTK_REAL PDstandardfdOrder222_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 PDstandardfdOrder222_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*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 PDstandardfdOrder233(u) ((-2*KRANC_GFOFFSET3D(u,0,0,0) + KRANC_GFOFFSET3D(u,0,0,-1) + KRANC_GFOFFSET3D(u,0,0,1))*p1odz2) +#else +# define PDstandardfdOrder233(u) (PDstandardfdOrder233_impl(u,p1odz2,cdj,cdk)) +static CCTK_REAL PDstandardfdOrder233_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 PDstandardfdOrder233_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*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 PDstandardfdOrder411(u) ((30*KRANC_GFOFFSET3D(u,0,0,0) - 16*(KRANC_GFOFFSET3D(u,-1,0,0) + KRANC_GFOFFSET3D(u,1,0,0)) + KRANC_GFOFFSET3D(u,-2,0,0) + KRANC_GFOFFSET3D(u,2,0,0))*pm1o12dx2) +#else +# define PDstandardfdOrder411(u) (PDstandardfdOrder411_impl(u,pm1o12dx2,cdj,cdk)) +static CCTK_REAL PDstandardfdOrder411_impl(CCTK_REAL const* restrict const u, CCTK_REAL const pm1o12dx2, ptrdiff_t const cdj, ptrdiff_t const cdk) CCTK_ATTRIBUTE_NOINLINE CCTK_ATTRIBUTE_UNUSED; +static CCTK_REAL PDstandardfdOrder411_impl(CCTK_REAL const* restrict const u, CCTK_REAL const pm1o12dx2, ptrdiff_t const cdj, ptrdiff_t const cdk) +{ + ptrdiff_t const cdi=sizeof(CCTK_REAL); + return (30*KRANC_GFOFFSET3D(u,0,0,0) - 16*(KRANC_GFOFFSET3D(u,-1,0,0) + KRANC_GFOFFSET3D(u,1,0,0)) + KRANC_GFOFFSET3D(u,-2,0,0) + KRANC_GFOFFSET3D(u,2,0,0))*pm1o12dx2; +} +#endif + +#ifndef KRANC_DIFF_FUNCTIONS +# define PDstandardfdOrder422(u) ((30*KRANC_GFOFFSET3D(u,0,0,0) - 16*(KRANC_GFOFFSET3D(u,0,-1,0) + KRANC_GFOFFSET3D(u,0,1,0)) + KRANC_GFOFFSET3D(u,0,-2,0) + KRANC_GFOFFSET3D(u,0,2,0))*pm1o12dy2) +#else +# define PDstandardfdOrder422(u) (PDstandardfdOrder422_impl(u,pm1o12dy2,cdj,cdk)) +static CCTK_REAL PDstandardfdOrder422_impl(CCTK_REAL const* restrict const u, CCTK_REAL const pm1o12dy2, ptrdiff_t const cdj, ptrdiff_t const cdk) CCTK_ATTRIBUTE_NOINLINE CCTK_ATTRIBUTE_UNUSED; +static CCTK_REAL PDstandardfdOrder422_impl(CCTK_REAL const* restrict const u, CCTK_REAL const pm1o12dy2, ptrdiff_t const cdj, ptrdiff_t const cdk) +{ + ptrdiff_t const cdi=sizeof(CCTK_REAL); + return (30*KRANC_GFOFFSET3D(u,0,0,0) - 16*(KRANC_GFOFFSET3D(u,0,-1,0) + KRANC_GFOFFSET3D(u,0,1,0)) + KRANC_GFOFFSET3D(u,0,-2,0) + KRANC_GFOFFSET3D(u,0,2,0))*pm1o12dy2; +} +#endif + +#ifndef KRANC_DIFF_FUNCTIONS +# define PDstandardfdOrder433(u) ((30*KRANC_GFOFFSET3D(u,0,0,0) - 16*(KRANC_GFOFFSET3D(u,0,0,-1) + KRANC_GFOFFSET3D(u,0,0,1)) + KRANC_GFOFFSET3D(u,0,0,-2) + KRANC_GFOFFSET3D(u,0,0,2))*pm1o12dz2) +#else +# define PDstandardfdOrder433(u) (PDstandardfdOrder433_impl(u,pm1o12dz2,cdj,cdk)) +static CCTK_REAL PDstandardfdOrder433_impl(CCTK_REAL const* restrict const u, CCTK_REAL const pm1o12dz2, ptrdiff_t const cdj, ptrdiff_t const cdk) CCTK_ATTRIBUTE_NOINLINE CCTK_ATTRIBUTE_UNUSED; +static CCTK_REAL PDstandardfdOrder433_impl(CCTK_REAL const* restrict const u, CCTK_REAL const pm1o12dz2, ptrdiff_t const cdj, ptrdiff_t const cdk) +{ + ptrdiff_t const cdi=sizeof(CCTK_REAL); + return (30*KRANC_GFOFFSET3D(u,0,0,0) - 16*(KRANC_GFOFFSET3D(u,0,0,-1) + KRANC_GFOFFSET3D(u,0,0,1)) + KRANC_GFOFFSET3D(u,0,0,-2) + KRANC_GFOFFSET3D(u,0,0,2))*pm1o12dz2; +} +#endif + +#ifndef KRANC_DIFF_FUNCTIONS +# define PDstandardfdOrder212(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 PDstandardfdOrder212(u) (PDstandardfdOrder212_impl(u,p1o4dxdy,cdj,cdk)) +static CCTK_REAL PDstandardfdOrder212_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 PDstandardfdOrder212_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 (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 PDstandardfdOrder213(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 PDstandardfdOrder213(u) (PDstandardfdOrder213_impl(u,p1o4dxdz,cdj,cdk)) +static CCTK_REAL PDstandardfdOrder213_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 PDstandardfdOrder213_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 (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 PDstandardfdOrder221(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 PDstandardfdOrder221(u) (PDstandardfdOrder221_impl(u,p1o4dxdy,cdj,cdk)) +static CCTK_REAL PDstandardfdOrder221_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 PDstandardfdOrder221_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 (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 PDstandardfdOrder223(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 PDstandardfdOrder223(u) (PDstandardfdOrder223_impl(u,p1o4dydz,cdj,cdk)) +static CCTK_REAL PDstandardfdOrder223_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 PDstandardfdOrder223_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 (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 PDstandardfdOrder231(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 PDstandardfdOrder231(u) (PDstandardfdOrder231_impl(u,p1o4dxdz,cdj,cdk)) +static CCTK_REAL PDstandardfdOrder231_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 PDstandardfdOrder231_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 (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 PDstandardfdOrder232(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 PDstandardfdOrder232(u) (PDstandardfdOrder232_impl(u,p1o4dydz,cdj,cdk)) +static CCTK_REAL PDstandardfdOrder232_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 PDstandardfdOrder232_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 (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 PDstandardfdOrder412(u) ((-64*(KRANC_GFOFFSET3D(u,-1,1,0) + KRANC_GFOFFSET3D(u,1,-1,0)) + 64*(KRANC_GFOFFSET3D(u,-1,-1,0) + KRANC_GFOFFSET3D(u,1,1,0)) + 8*(KRANC_GFOFFSET3D(u,-1,2,0) + KRANC_GFOFFSET3D(u,1,-2,0) + KRANC_GFOFFSET3D(u,-2,1,0) + KRANC_GFOFFSET3D(u,2,-1,0)) - 8*(KRANC_GFOFFSET3D(u,-1,-2,0) + KRANC_GFOFFSET3D(u,1,2,0) + KRANC_GFOFFSET3D(u,-2,-1,0) + KRANC_GFOFFSET3D(u,2,1,0)) + KRANC_GFOFFSET3D(u,-2,-2,0) - KRANC_GFOFFSET3D(u,-2,2,0) - KRANC_GFOFFSET3D(u,2,-2,0) + KRANC_GFOFFSET3D(u,2,2,0))*p1o144dxdy) +#else +# define PDstandardfdOrder412(u) (PDstandardfdOrder412_impl(u,p1o144dxdy,cdj,cdk)) +static CCTK_REAL PDstandardfdOrder412_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o144dxdy, ptrdiff_t const cdj, ptrdiff_t const cdk) CCTK_ATTRIBUTE_NOINLINE CCTK_ATTRIBUTE_UNUSED; +static CCTK_REAL PDstandardfdOrder412_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o144dxdy, ptrdiff_t const cdj, ptrdiff_t const cdk) +{ + ptrdiff_t const cdi=sizeof(CCTK_REAL); + return (-64*(KRANC_GFOFFSET3D(u,-1,1,0) + KRANC_GFOFFSET3D(u,1,-1,0)) + 64*(KRANC_GFOFFSET3D(u,-1,-1,0) + KRANC_GFOFFSET3D(u,1,1,0)) + 8*(KRANC_GFOFFSET3D(u,-1,2,0) + KRANC_GFOFFSET3D(u,1,-2,0) + KRANC_GFOFFSET3D(u,-2,1,0) + KRANC_GFOFFSET3D(u,2,-1,0)) - 8*(KRANC_GFOFFSET3D(u,-1,-2,0) + KRANC_GFOFFSET3D(u,1,2,0) + KRANC_GFOFFSET3D(u,-2,-1,0) + KRANC_GFOFFSET3D(u,2,1,0)) + KRANC_GFOFFSET3D(u,-2,-2,0) - KRANC_GFOFFSET3D(u,-2,2,0) - KRANC_GFOFFSET3D(u,2,-2,0) + KRANC_GFOFFSET3D(u,2,2,0))*p1o144dxdy; +} +#endif + +#ifndef KRANC_DIFF_FUNCTIONS +# define PDstandardfdOrder413(u) ((-64*(KRANC_GFOFFSET3D(u,-1,0,1) + KRANC_GFOFFSET3D(u,1,0,-1)) + 64*(KRANC_GFOFFSET3D(u,-1,0,-1) + KRANC_GFOFFSET3D(u,1,0,1)) + 8*(KRANC_GFOFFSET3D(u,-1,0,2) + KRANC_GFOFFSET3D(u,1,0,-2) + KRANC_GFOFFSET3D(u,-2,0,1) + KRANC_GFOFFSET3D(u,2,0,-1)) - 8*(KRANC_GFOFFSET3D(u,-1,0,-2) + KRANC_GFOFFSET3D(u,1,0,2) + KRANC_GFOFFSET3D(u,-2,0,-1) + KRANC_GFOFFSET3D(u,2,0,1)) + KRANC_GFOFFSET3D(u,-2,0,-2) - KRANC_GFOFFSET3D(u,-2,0,2) - KRANC_GFOFFSET3D(u,2,0,-2) + KRANC_GFOFFSET3D(u,2,0,2))*p1o144dxdz) +#else +# define PDstandardfdOrder413(u) (PDstandardfdOrder413_impl(u,p1o144dxdz,cdj,cdk)) +static CCTK_REAL PDstandardfdOrder413_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o144dxdz, ptrdiff_t const cdj, ptrdiff_t const cdk) CCTK_ATTRIBUTE_NOINLINE CCTK_ATTRIBUTE_UNUSED; +static CCTK_REAL PDstandardfdOrder413_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o144dxdz, ptrdiff_t const cdj, ptrdiff_t const cdk) +{ + ptrdiff_t const cdi=sizeof(CCTK_REAL); + return (-64*(KRANC_GFOFFSET3D(u,-1,0,1) + KRANC_GFOFFSET3D(u,1,0,-1)) + 64*(KRANC_GFOFFSET3D(u,-1,0,-1) + KRANC_GFOFFSET3D(u,1,0,1)) + 8*(KRANC_GFOFFSET3D(u,-1,0,2) + KRANC_GFOFFSET3D(u,1,0,-2) + KRANC_GFOFFSET3D(u,-2,0,1) + KRANC_GFOFFSET3D(u,2,0,-1)) - 8*(KRANC_GFOFFSET3D(u,-1,0,-2) + KRANC_GFOFFSET3D(u,1,0,2) + KRANC_GFOFFSET3D(u,-2,0,-1) + KRANC_GFOFFSET3D(u,2,0,1)) + KRANC_GFOFFSET3D(u,-2,0,-2) - KRANC_GFOFFSET3D(u,-2,0,2) - KRANC_GFOFFSET3D(u,2,0,-2) + KRANC_GFOFFSET3D(u,2,0,2))*p1o144dxdz; +} +#endif + +#ifndef KRANC_DIFF_FUNCTIONS +# define PDstandardfdOrder421(u) ((-64*(KRANC_GFOFFSET3D(u,-1,1,0) + KRANC_GFOFFSET3D(u,1,-1,0)) + 64*(KRANC_GFOFFSET3D(u,-1,-1,0) + KRANC_GFOFFSET3D(u,1,1,0)) + 8*(KRANC_GFOFFSET3D(u,-1,2,0) + KRANC_GFOFFSET3D(u,1,-2,0) + KRANC_GFOFFSET3D(u,-2,1,0) + KRANC_GFOFFSET3D(u,2,-1,0)) - 8*(KRANC_GFOFFSET3D(u,-1,-2,0) + KRANC_GFOFFSET3D(u,1,2,0) + KRANC_GFOFFSET3D(u,-2,-1,0) + KRANC_GFOFFSET3D(u,2,1,0)) + KRANC_GFOFFSET3D(u,-2,-2,0) - KRANC_GFOFFSET3D(u,-2,2,0) - KRANC_GFOFFSET3D(u,2,-2,0) + KRANC_GFOFFSET3D(u,2,2,0))*p1o144dxdy) +#else +# define PDstandardfdOrder421(u) (PDstandardfdOrder421_impl(u,p1o144dxdy,cdj,cdk)) +static CCTK_REAL PDstandardfdOrder421_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o144dxdy, ptrdiff_t const cdj, ptrdiff_t const cdk) CCTK_ATTRIBUTE_NOINLINE CCTK_ATTRIBUTE_UNUSED; +static CCTK_REAL PDstandardfdOrder421_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o144dxdy, ptrdiff_t const cdj, ptrdiff_t const cdk) +{ + ptrdiff_t const cdi=sizeof(CCTK_REAL); + return (-64*(KRANC_GFOFFSET3D(u,-1,1,0) + KRANC_GFOFFSET3D(u,1,-1,0)) + 64*(KRANC_GFOFFSET3D(u,-1,-1,0) + KRANC_GFOFFSET3D(u,1,1,0)) + 8*(KRANC_GFOFFSET3D(u,-1,2,0) + KRANC_GFOFFSET3D(u,1,-2,0) + KRANC_GFOFFSET3D(u,-2,1,0) + KRANC_GFOFFSET3D(u,2,-1,0)) - 8*(KRANC_GFOFFSET3D(u,-1,-2,0) + KRANC_GFOFFSET3D(u,1,2,0) + KRANC_GFOFFSET3D(u,-2,-1,0) + KRANC_GFOFFSET3D(u,2,1,0)) + KRANC_GFOFFSET3D(u,-2,-2,0) - KRANC_GFOFFSET3D(u,-2,2,0) - KRANC_GFOFFSET3D(u,2,-2,0) + KRANC_GFOFFSET3D(u,2,2,0))*p1o144dxdy; +} +#endif + +#ifndef KRANC_DIFF_FUNCTIONS +# define PDstandardfdOrder423(u) ((-64*(KRANC_GFOFFSET3D(u,0,-1,1) + KRANC_GFOFFSET3D(u,0,1,-1)) + 64*(KRANC_GFOFFSET3D(u,0,-1,-1) + KRANC_GFOFFSET3D(u,0,1,1)) + 8*(KRANC_GFOFFSET3D(u,0,-1,2) + KRANC_GFOFFSET3D(u,0,1,-2) + KRANC_GFOFFSET3D(u,0,-2,1) + KRANC_GFOFFSET3D(u,0,2,-1)) - 8*(KRANC_GFOFFSET3D(u,0,-1,-2) + KRANC_GFOFFSET3D(u,0,1,2) + KRANC_GFOFFSET3D(u,0,-2,-1) + KRANC_GFOFFSET3D(u,0,2,1)) + KRANC_GFOFFSET3D(u,0,-2,-2) - KRANC_GFOFFSET3D(u,0,-2,2) - KRANC_GFOFFSET3D(u,0,2,-2) + KRANC_GFOFFSET3D(u,0,2,2))*p1o144dydz) +#else +# define PDstandardfdOrder423(u) (PDstandardfdOrder423_impl(u,p1o144dydz,cdj,cdk)) +static CCTK_REAL PDstandardfdOrder423_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o144dydz, ptrdiff_t const cdj, ptrdiff_t const cdk) CCTK_ATTRIBUTE_NOINLINE CCTK_ATTRIBUTE_UNUSED; +static CCTK_REAL PDstandardfdOrder423_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o144dydz, ptrdiff_t const cdj, ptrdiff_t const cdk) +{ + ptrdiff_t const cdi=sizeof(CCTK_REAL); + return (-64*(KRANC_GFOFFSET3D(u,0,-1,1) + KRANC_GFOFFSET3D(u,0,1,-1)) + 64*(KRANC_GFOFFSET3D(u,0,-1,-1) + KRANC_GFOFFSET3D(u,0,1,1)) + 8*(KRANC_GFOFFSET3D(u,0,-1,2) + KRANC_GFOFFSET3D(u,0,1,-2) + KRANC_GFOFFSET3D(u,0,-2,1) + KRANC_GFOFFSET3D(u,0,2,-1)) - 8*(KRANC_GFOFFSET3D(u,0,-1,-2) + KRANC_GFOFFSET3D(u,0,1,2) + KRANC_GFOFFSET3D(u,0,-2,-1) + KRANC_GFOFFSET3D(u,0,2,1)) + KRANC_GFOFFSET3D(u,0,-2,-2) - KRANC_GFOFFSET3D(u,0,-2,2) - KRANC_GFOFFSET3D(u,0,2,-2) + KRANC_GFOFFSET3D(u,0,2,2))*p1o144dydz; +} +#endif + +#ifndef KRANC_DIFF_FUNCTIONS +# define PDstandardfdOrder431(u) ((-64*(KRANC_GFOFFSET3D(u,-1,0,1) + KRANC_GFOFFSET3D(u,1,0,-1)) + 64*(KRANC_GFOFFSET3D(u,-1,0,-1) + KRANC_GFOFFSET3D(u,1,0,1)) + 8*(KRANC_GFOFFSET3D(u,-1,0,2) + KRANC_GFOFFSET3D(u,1,0,-2) + KRANC_GFOFFSET3D(u,-2,0,1) + KRANC_GFOFFSET3D(u,2,0,-1)) - 8*(KRANC_GFOFFSET3D(u,-1,0,-2) + KRANC_GFOFFSET3D(u,1,0,2) + KRANC_GFOFFSET3D(u,-2,0,-1) + KRANC_GFOFFSET3D(u,2,0,1)) + KRANC_GFOFFSET3D(u,-2,0,-2) - KRANC_GFOFFSET3D(u,-2,0,2) - KRANC_GFOFFSET3D(u,2,0,-2) + KRANC_GFOFFSET3D(u,2,0,2))*p1o144dxdz) +#else +# define PDstandardfdOrder431(u) (PDstandardfdOrder431_impl(u,p1o144dxdz,cdj,cdk)) +static CCTK_REAL PDstandardfdOrder431_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o144dxdz, ptrdiff_t const cdj, ptrdiff_t const cdk) CCTK_ATTRIBUTE_NOINLINE CCTK_ATTRIBUTE_UNUSED; +static CCTK_REAL PDstandardfdOrder431_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o144dxdz, ptrdiff_t const cdj, ptrdiff_t const cdk) +{ + ptrdiff_t const cdi=sizeof(CCTK_REAL); + return (-64*(KRANC_GFOFFSET3D(u,-1,0,1) + KRANC_GFOFFSET3D(u,1,0,-1)) + 64*(KRANC_GFOFFSET3D(u,-1,0,-1) + KRANC_GFOFFSET3D(u,1,0,1)) + 8*(KRANC_GFOFFSET3D(u,-1,0,2) + KRANC_GFOFFSET3D(u,1,0,-2) + KRANC_GFOFFSET3D(u,-2,0,1) + KRANC_GFOFFSET3D(u,2,0,-1)) - 8*(KRANC_GFOFFSET3D(u,-1,0,-2) + KRANC_GFOFFSET3D(u,1,0,2) + KRANC_GFOFFSET3D(u,-2,0,-1) + KRANC_GFOFFSET3D(u,2,0,1)) + KRANC_GFOFFSET3D(u,-2,0,-2) - KRANC_GFOFFSET3D(u,-2,0,2) - KRANC_GFOFFSET3D(u,2,0,-2) + KRANC_GFOFFSET3D(u,2,0,2))*p1o144dxdz; +} +#endif + +#ifndef KRANC_DIFF_FUNCTIONS +# define PDstandardfdOrder432(u) ((-64*(KRANC_GFOFFSET3D(u,0,-1,1) + KRANC_GFOFFSET3D(u,0,1,-1)) + 64*(KRANC_GFOFFSET3D(u,0,-1,-1) + KRANC_GFOFFSET3D(u,0,1,1)) + 8*(KRANC_GFOFFSET3D(u,0,-1,2) + KRANC_GFOFFSET3D(u,0,1,-2) + KRANC_GFOFFSET3D(u,0,-2,1) + KRANC_GFOFFSET3D(u,0,2,-1)) - 8*(KRANC_GFOFFSET3D(u,0,-1,-2) + KRANC_GFOFFSET3D(u,0,1,2) + KRANC_GFOFFSET3D(u,0,-2,-1) + KRANC_GFOFFSET3D(u,0,2,1)) + KRANC_GFOFFSET3D(u,0,-2,-2) - KRANC_GFOFFSET3D(u,0,-2,2) - KRANC_GFOFFSET3D(u,0,2,-2) + KRANC_GFOFFSET3D(u,0,2,2))*p1o144dydz) +#else +# define PDstandardfdOrder432(u) (PDstandardfdOrder432_impl(u,p1o144dydz,cdj,cdk)) +static CCTK_REAL PDstandardfdOrder432_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o144dydz, ptrdiff_t const cdj, ptrdiff_t const cdk) CCTK_ATTRIBUTE_NOINLINE CCTK_ATTRIBUTE_UNUSED; +static CCTK_REAL PDstandardfdOrder432_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o144dydz, ptrdiff_t const cdj, ptrdiff_t const cdk) +{ + ptrdiff_t const cdi=sizeof(CCTK_REAL); + return (-64*(KRANC_GFOFFSET3D(u,0,-1,1) + KRANC_GFOFFSET3D(u,0,1,-1)) + 64*(KRANC_GFOFFSET3D(u,0,-1,-1) + KRANC_GFOFFSET3D(u,0,1,1)) + 8*(KRANC_GFOFFSET3D(u,0,-1,2) + KRANC_GFOFFSET3D(u,0,1,-2) + KRANC_GFOFFSET3D(u,0,-2,1) + KRANC_GFOFFSET3D(u,0,2,-1)) - 8*(KRANC_GFOFFSET3D(u,0,-1,-2) + KRANC_GFOFFSET3D(u,0,1,2) + KRANC_GFOFFSET3D(u,0,-2,-1) + KRANC_GFOFFSET3D(u,0,2,1)) + KRANC_GFOFFSET3D(u,0,-2,-2) - KRANC_GFOFFSET3D(u,0,-2,2) - KRANC_GFOFFSET3D(u,0,2,-2) + KRANC_GFOFFSET3D(u,0,2,2))*p1o144dydz; +} +#endif + diff --git a/Examples/WaveCaKernelScript/src/RegisterMoL.cc b/Examples/WaveCaKernelScript/src/RegisterMoL.cc new file mode 100644 index 0000000..30742ce --- /dev/null +++ b/Examples/WaveCaKernelScript/src/RegisterMoL.cc @@ -0,0 +1,20 @@ +/* File produced by Kranc */ + +#include "cctk.h" +#include "cctk_Arguments.h" +#include "cctk_Parameters.h" + +extern "C" void WaveCaKernelScript_RegisterVars(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT ierr = 0; + + /* Register all the evolved grid functions with MoL */ + ierr += MoLRegisterEvolved(CCTK_VarIndex("WaveCaKernelScript::phi"), CCTK_VarIndex("WaveCaKernelScript::phirhs")); + ierr += MoLRegisterEvolved(CCTK_VarIndex("WaveCaKernelScript::pi"), CCTK_VarIndex("WaveCaKernelScript::pirhs")); + + /* Register all the evolved Array functions with MoL */ + return; +} diff --git a/Examples/WaveCaKernelScript/src/RegisterSymmetries.cc b/Examples/WaveCaKernelScript/src/RegisterSymmetries.cc new file mode 100644 index 0000000..37b8edb --- /dev/null +++ b/Examples/WaveCaKernelScript/src/RegisterSymmetries.cc @@ -0,0 +1,29 @@ +/* File produced by Kranc */ + +#include "cctk.h" +#include "cctk_Arguments.h" +#include "cctk_Parameters.h" +#include "Symmetry.h" + +extern "C" void WaveCaKernelScript_RegisterSymmetries(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + + /* array holding symmetry definitions */ + CCTK_INT sym[3]; + + + /* Register symmetries of grid functions */ + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "WaveCaKernelScript::phi"); + + sym[0] = 1; + sym[1] = 1; + sym[2] = 1; + SetCartSymVN(cctkGH, sym, "WaveCaKernelScript::pi"); + +} diff --git a/Examples/WaveCaKernelScript/src/Startup.cc b/Examples/WaveCaKernelScript/src/Startup.cc new file mode 100644 index 0000000..02b0b93 --- /dev/null +++ b/Examples/WaveCaKernelScript/src/Startup.cc @@ -0,0 +1,10 @@ +/* File produced by Kranc */ + +#include "cctk.h" + +extern "C" int WaveCaKernelScript_Startup(void) +{ + const char * banner = "WaveCaKernelScript"; + CCTK_RegisterBanner(banner); + return 0; +} diff --git a/Examples/WaveCaKernelScript/src/make.code.defn b/Examples/WaveCaKernelScript/src/make.code.defn new file mode 100644 index 0000000..b3329bd --- /dev/null +++ b/Examples/WaveCaKernelScript/src/make.code.defn @@ -0,0 +1,3 @@ +# File produced by Kranc + +SRCS = Startup.cc RegisterSymmetries.cc RegisterMoL.cc Boundaries.cc -- cgit v1.2.3