aboutsummaryrefslogtreecommitdiff
path: root/Examples/Euler/src
diff options
context:
space:
mode:
Diffstat (limited to 'Examples/Euler/src')
-rw-r--r--Examples/Euler/src/Boundaries.cc457
-rw-r--r--Examples/Euler/src/Differencing.h42
-rw-r--r--Examples/Euler/src/RegisterMoL.cc21
-rw-r--r--Examples/Euler/src/RegisterSymmetries.cc194
-rw-r--r--Examples/Euler/src/Startup.cc10
-rw-r--r--Examples/Euler/src/euler_conserved.cc149
-rw-r--r--Examples/Euler/src/euler_conserved_flux_1.cc170
-rw-r--r--Examples/Euler/src/euler_flux_1.cc208
-rw-r--r--Examples/Euler/src/euler_initial_shock.cc147
-rw-r--r--Examples/Euler/src/euler_primitives.cc149
-rw-r--r--Examples/Euler/src/euler_reconstruct_1.cc231
-rw-r--r--Examples/Euler/src/euler_rhs_1.cc177
-rw-r--r--Examples/Euler/src/euler_zero_rhs.cc143
-rw-r--r--Examples/Euler/src/make.code.defn3
14 files changed, 2101 insertions, 0 deletions
diff --git a/Examples/Euler/src/Boundaries.cc b/Examples/Euler/src/Boundaries.cc
new file mode 100644
index 0000000..136e219
--- /dev/null
+++ b/Examples/Euler/src/Boundaries.cc
@@ -0,0 +1,457 @@
+/* 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 Euler_CheckBoundaries(CCTK_ARGUMENTS)
+{
+ DECLARE_CCTK_ARGUMENTS;
+ DECLARE_CCTK_PARAMETERS;
+
+ return;
+}
+
+extern "C" void Euler_SelectBoundConds(CCTK_ARGUMENTS)
+{
+ DECLARE_CCTK_ARGUMENTS;
+ DECLARE_CCTK_PARAMETERS;
+
+ CCTK_INT ierr = 0;
+
+ if (CCTK_EQUALS(Den_group_bound, "none" ) ||
+ CCTK_EQUALS(Den_group_bound, "static") ||
+ CCTK_EQUALS(Den_group_bound, "flat" ) ||
+ CCTK_EQUALS(Den_group_bound, "zero" ) )
+ {
+ ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, -1,
+ "Euler::Den_group", Den_group_bound);
+ if (ierr < 0)
+ CCTK_WARN(0, "Failed to register Den_group_bound BC for Euler::Den_group!");
+ }
+
+ if (CCTK_EQUALS(En_group_bound, "none" ) ||
+ CCTK_EQUALS(En_group_bound, "static") ||
+ CCTK_EQUALS(En_group_bound, "flat" ) ||
+ CCTK_EQUALS(En_group_bound, "zero" ) )
+ {
+ ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, -1,
+ "Euler::En_group", En_group_bound);
+ if (ierr < 0)
+ CCTK_WARN(0, "Failed to register En_group_bound BC for Euler::En_group!");
+ }
+
+ if (CCTK_EQUALS(S_group_bound, "none" ) ||
+ CCTK_EQUALS(S_group_bound, "static") ||
+ CCTK_EQUALS(S_group_bound, "flat" ) ||
+ CCTK_EQUALS(S_group_bound, "zero" ) )
+ {
+ ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, -1,
+ "Euler::S_group", S_group_bound);
+ if (ierr < 0)
+ CCTK_WARN(0, "Failed to register S_group_bound BC for Euler::S_group!");
+ }
+
+ if (CCTK_EQUALS(Den_bound, "none" ) ||
+ CCTK_EQUALS(Den_bound, "static") ||
+ CCTK_EQUALS(Den_bound, "flat" ) ||
+ CCTK_EQUALS(Den_bound, "zero" ) )
+ {
+ ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1,
+ "Euler::Den", Den_bound);
+ if (ierr < 0)
+ CCTK_WARN(0, "Failed to register Den_bound BC for Euler::Den!");
+ }
+
+ if (CCTK_EQUALS(En_bound, "none" ) ||
+ CCTK_EQUALS(En_bound, "static") ||
+ CCTK_EQUALS(En_bound, "flat" ) ||
+ CCTK_EQUALS(En_bound, "zero" ) )
+ {
+ ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1,
+ "Euler::En", En_bound);
+ if (ierr < 0)
+ CCTK_WARN(0, "Failed to register En_bound BC for Euler::En!");
+ }
+
+ if (CCTK_EQUALS(S1_bound, "none" ) ||
+ CCTK_EQUALS(S1_bound, "static") ||
+ CCTK_EQUALS(S1_bound, "flat" ) ||
+ CCTK_EQUALS(S1_bound, "zero" ) )
+ {
+ ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1,
+ "Euler::S1", S1_bound);
+ if (ierr < 0)
+ CCTK_WARN(0, "Failed to register S1_bound BC for Euler::S1!");
+ }
+
+ if (CCTK_EQUALS(S2_bound, "none" ) ||
+ CCTK_EQUALS(S2_bound, "static") ||
+ CCTK_EQUALS(S2_bound, "flat" ) ||
+ CCTK_EQUALS(S2_bound, "zero" ) )
+ {
+ ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1,
+ "Euler::S2", S2_bound);
+ if (ierr < 0)
+ CCTK_WARN(0, "Failed to register S2_bound BC for Euler::S2!");
+ }
+
+ if (CCTK_EQUALS(S3_bound, "none" ) ||
+ CCTK_EQUALS(S3_bound, "static") ||
+ CCTK_EQUALS(S3_bound, "flat" ) ||
+ CCTK_EQUALS(S3_bound, "zero" ) )
+ {
+ ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, -1,
+ "Euler::S3", S3_bound);
+ if (ierr < 0)
+ CCTK_WARN(0, "Failed to register S3_bound BC for Euler::S3!");
+ }
+
+ if (CCTK_EQUALS(Den_group_bound, "radiative"))
+ {
+ /* select radiation boundary condition */
+ static CCTK_INT handle_Den_group_bound = -1;
+ if (handle_Den_group_bound < 0) handle_Den_group_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE);
+ if (handle_Den_group_bound < 0) CCTK_WARN(0, "could not create table!");
+ if (Util_TableSetReal(handle_Den_group_bound , Den_group_bound_limit, "LIMIT") < 0)
+ CCTK_WARN(0, "could not set LIMIT value in table!");
+ if (Util_TableSetReal(handle_Den_group_bound ,Den_group_bound_speed, "SPEED") < 0)
+ CCTK_WARN(0, "could not set SPEED value in table!");
+
+ ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_Den_group_bound,
+ "Euler::Den_group", "Radiation");
+
+ if (ierr < 0)
+ CCTK_WARN(0, "Failed to register Radiation BC for Euler::Den_group!");
+
+ }
+
+ if (CCTK_EQUALS(En_group_bound, "radiative"))
+ {
+ /* select radiation boundary condition */
+ static CCTK_INT handle_En_group_bound = -1;
+ if (handle_En_group_bound < 0) handle_En_group_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE);
+ if (handle_En_group_bound < 0) CCTK_WARN(0, "could not create table!");
+ if (Util_TableSetReal(handle_En_group_bound , En_group_bound_limit, "LIMIT") < 0)
+ CCTK_WARN(0, "could not set LIMIT value in table!");
+ if (Util_TableSetReal(handle_En_group_bound ,En_group_bound_speed, "SPEED") < 0)
+ CCTK_WARN(0, "could not set SPEED value in table!");
+
+ ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_En_group_bound,
+ "Euler::En_group", "Radiation");
+
+ if (ierr < 0)
+ CCTK_WARN(0, "Failed to register Radiation BC for Euler::En_group!");
+
+ }
+
+ if (CCTK_EQUALS(S_group_bound, "radiative"))
+ {
+ /* select radiation boundary condition */
+ static CCTK_INT handle_S_group_bound = -1;
+ if (handle_S_group_bound < 0) handle_S_group_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE);
+ if (handle_S_group_bound < 0) CCTK_WARN(0, "could not create table!");
+ if (Util_TableSetReal(handle_S_group_bound , S_group_bound_limit, "LIMIT") < 0)
+ CCTK_WARN(0, "could not set LIMIT value in table!");
+ if (Util_TableSetReal(handle_S_group_bound ,S_group_bound_speed, "SPEED") < 0)
+ CCTK_WARN(0, "could not set SPEED value in table!");
+
+ ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_S_group_bound,
+ "Euler::S_group", "Radiation");
+
+ if (ierr < 0)
+ CCTK_WARN(0, "Failed to register Radiation BC for Euler::S_group!");
+
+ }
+
+ if (CCTK_EQUALS(Den_bound, "radiative"))
+ {
+ /* select radiation boundary condition */
+ static CCTK_INT handle_Den_bound = -1;
+ if (handle_Den_bound < 0) handle_Den_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE);
+ if (handle_Den_bound < 0) CCTK_WARN(0, "could not create table!");
+ if (Util_TableSetReal(handle_Den_bound , Den_bound_limit, "LIMIT") < 0)
+ CCTK_WARN(0, "could not set LIMIT value in table!");
+ if (Util_TableSetReal(handle_Den_bound ,Den_bound_speed, "SPEED") < 0)
+ CCTK_WARN(0, "could not set SPEED value in table!");
+
+ ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_Den_bound,
+ "Euler::Den", "Radiation");
+
+ if (ierr < 0)
+ CCTK_WARN(0, "Failed to register Radiation BC for Euler::Den!");
+
+ }
+
+ if (CCTK_EQUALS(En_bound, "radiative"))
+ {
+ /* select radiation boundary condition */
+ static CCTK_INT handle_En_bound = -1;
+ if (handle_En_bound < 0) handle_En_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE);
+ if (handle_En_bound < 0) CCTK_WARN(0, "could not create table!");
+ if (Util_TableSetReal(handle_En_bound , En_bound_limit, "LIMIT") < 0)
+ CCTK_WARN(0, "could not set LIMIT value in table!");
+ if (Util_TableSetReal(handle_En_bound ,En_bound_speed, "SPEED") < 0)
+ CCTK_WARN(0, "could not set SPEED value in table!");
+
+ ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_En_bound,
+ "Euler::En", "Radiation");
+
+ if (ierr < 0)
+ CCTK_WARN(0, "Failed to register Radiation BC for Euler::En!");
+
+ }
+
+ if (CCTK_EQUALS(S1_bound, "radiative"))
+ {
+ /* select radiation boundary condition */
+ static CCTK_INT handle_S1_bound = -1;
+ if (handle_S1_bound < 0) handle_S1_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE);
+ if (handle_S1_bound < 0) CCTK_WARN(0, "could not create table!");
+ if (Util_TableSetReal(handle_S1_bound , S1_bound_limit, "LIMIT") < 0)
+ CCTK_WARN(0, "could not set LIMIT value in table!");
+ if (Util_TableSetReal(handle_S1_bound ,S1_bound_speed, "SPEED") < 0)
+ CCTK_WARN(0, "could not set SPEED value in table!");
+
+ ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_S1_bound,
+ "Euler::S1", "Radiation");
+
+ if (ierr < 0)
+ CCTK_WARN(0, "Failed to register Radiation BC for Euler::S1!");
+
+ }
+
+ if (CCTK_EQUALS(S2_bound, "radiative"))
+ {
+ /* select radiation boundary condition */
+ static CCTK_INT handle_S2_bound = -1;
+ if (handle_S2_bound < 0) handle_S2_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE);
+ if (handle_S2_bound < 0) CCTK_WARN(0, "could not create table!");
+ if (Util_TableSetReal(handle_S2_bound , S2_bound_limit, "LIMIT") < 0)
+ CCTK_WARN(0, "could not set LIMIT value in table!");
+ if (Util_TableSetReal(handle_S2_bound ,S2_bound_speed, "SPEED") < 0)
+ CCTK_WARN(0, "could not set SPEED value in table!");
+
+ ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_S2_bound,
+ "Euler::S2", "Radiation");
+
+ if (ierr < 0)
+ CCTK_WARN(0, "Failed to register Radiation BC for Euler::S2!");
+
+ }
+
+ if (CCTK_EQUALS(S3_bound, "radiative"))
+ {
+ /* select radiation boundary condition */
+ static CCTK_INT handle_S3_bound = -1;
+ if (handle_S3_bound < 0) handle_S3_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE);
+ if (handle_S3_bound < 0) CCTK_WARN(0, "could not create table!");
+ if (Util_TableSetReal(handle_S3_bound , S3_bound_limit, "LIMIT") < 0)
+ CCTK_WARN(0, "could not set LIMIT value in table!");
+ if (Util_TableSetReal(handle_S3_bound ,S3_bound_speed, "SPEED") < 0)
+ CCTK_WARN(0, "could not set SPEED value in table!");
+
+ ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_S3_bound,
+ "Euler::S3", "Radiation");
+
+ if (ierr < 0)
+ CCTK_WARN(0, "Failed to register Radiation BC for Euler::S3!");
+
+ }
+
+ if (CCTK_EQUALS(Den_group_bound, "scalar"))
+ {
+ /* select scalar boundary condition */
+ static CCTK_INT handle_Den_group_bound = -1;
+ if (handle_Den_group_bound < 0) handle_Den_group_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE);
+ if (handle_Den_group_bound < 0) CCTK_WARN(0, "could not create table!");
+ if (Util_TableSetReal(handle_Den_group_bound ,Den_group_bound_scalar, "SCALAR") < 0)
+ CCTK_WARN(0, "could not set SCALAR value in table!");
+
+ ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_Den_group_bound,
+ "Euler::Den_group", "scalar");
+
+ if (ierr < 0)
+ CCTK_WARN(0, "Failed to register Scalar BC for Euler::Den_group!");
+
+ }
+
+ if (CCTK_EQUALS(En_group_bound, "scalar"))
+ {
+ /* select scalar boundary condition */
+ static CCTK_INT handle_En_group_bound = -1;
+ if (handle_En_group_bound < 0) handle_En_group_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE);
+ if (handle_En_group_bound < 0) CCTK_WARN(0, "could not create table!");
+ if (Util_TableSetReal(handle_En_group_bound ,En_group_bound_scalar, "SCALAR") < 0)
+ CCTK_WARN(0, "could not set SCALAR value in table!");
+
+ ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_En_group_bound,
+ "Euler::En_group", "scalar");
+
+ if (ierr < 0)
+ CCTK_WARN(0, "Failed to register Scalar BC for Euler::En_group!");
+
+ }
+
+ if (CCTK_EQUALS(S_group_bound, "scalar"))
+ {
+ /* select scalar boundary condition */
+ static CCTK_INT handle_S_group_bound = -1;
+ if (handle_S_group_bound < 0) handle_S_group_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE);
+ if (handle_S_group_bound < 0) CCTK_WARN(0, "could not create table!");
+ if (Util_TableSetReal(handle_S_group_bound ,S_group_bound_scalar, "SCALAR") < 0)
+ CCTK_WARN(0, "could not set SCALAR value in table!");
+
+ ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, handle_S_group_bound,
+ "Euler::S_group", "scalar");
+
+ if (ierr < 0)
+ CCTK_WARN(0, "Failed to register Scalar BC for Euler::S_group!");
+
+ }
+
+ if (CCTK_EQUALS(Den_bound, "scalar"))
+ {
+ /* select scalar boundary condition */
+ static CCTK_INT handle_Den_bound = -1;
+ if (handle_Den_bound < 0) handle_Den_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE);
+ if (handle_Den_bound < 0) CCTK_WARN(0, "could not create table!");
+ if (Util_TableSetReal(handle_Den_bound ,Den_bound_scalar, "SCALAR") < 0)
+ CCTK_WARN(0, "could not set SCALAR value in table!");
+
+ ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_Den_bound,
+ "Euler::Den", "scalar");
+
+ if (ierr < 0)
+ CCTK_WARN(0, "Error in registering Scalar BC for Euler::Den!");
+
+ }
+
+ if (CCTK_EQUALS(En_bound, "scalar"))
+ {
+ /* select scalar boundary condition */
+ static CCTK_INT handle_En_bound = -1;
+ if (handle_En_bound < 0) handle_En_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE);
+ if (handle_En_bound < 0) CCTK_WARN(0, "could not create table!");
+ if (Util_TableSetReal(handle_En_bound ,En_bound_scalar, "SCALAR") < 0)
+ CCTK_WARN(0, "could not set SCALAR value in table!");
+
+ ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_En_bound,
+ "Euler::En", "scalar");
+
+ if (ierr < 0)
+ CCTK_WARN(0, "Error in registering Scalar BC for Euler::En!");
+
+ }
+
+ if (CCTK_EQUALS(S1_bound, "scalar"))
+ {
+ /* select scalar boundary condition */
+ static CCTK_INT handle_S1_bound = -1;
+ if (handle_S1_bound < 0) handle_S1_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE);
+ if (handle_S1_bound < 0) CCTK_WARN(0, "could not create table!");
+ if (Util_TableSetReal(handle_S1_bound ,S1_bound_scalar, "SCALAR") < 0)
+ CCTK_WARN(0, "could not set SCALAR value in table!");
+
+ ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_S1_bound,
+ "Euler::S1", "scalar");
+
+ if (ierr < 0)
+ CCTK_WARN(0, "Error in registering Scalar BC for Euler::S1!");
+
+ }
+
+ if (CCTK_EQUALS(S2_bound, "scalar"))
+ {
+ /* select scalar boundary condition */
+ static CCTK_INT handle_S2_bound = -1;
+ if (handle_S2_bound < 0) handle_S2_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE);
+ if (handle_S2_bound < 0) CCTK_WARN(0, "could not create table!");
+ if (Util_TableSetReal(handle_S2_bound ,S2_bound_scalar, "SCALAR") < 0)
+ CCTK_WARN(0, "could not set SCALAR value in table!");
+
+ ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_S2_bound,
+ "Euler::S2", "scalar");
+
+ if (ierr < 0)
+ CCTK_WARN(0, "Error in registering Scalar BC for Euler::S2!");
+
+ }
+
+ if (CCTK_EQUALS(S3_bound, "scalar"))
+ {
+ /* select scalar boundary condition */
+ static CCTK_INT handle_S3_bound = -1;
+ if (handle_S3_bound < 0) handle_S3_bound = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE);
+ if (handle_S3_bound < 0) CCTK_WARN(0, "could not create table!");
+ if (Util_TableSetReal(handle_S3_bound ,S3_bound_scalar, "SCALAR") < 0)
+ CCTK_WARN(0, "could not set SCALAR value in table!");
+
+ ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle_S3_bound,
+ "Euler::S3", "scalar");
+
+ if (ierr < 0)
+ CCTK_WARN(0, "Error in registering Scalar BC for Euler::S3!");
+
+ }
+ return;
+}
+
+
+
+/* template for entries in parameter file:
+#$bound$#Euler::Den_group_bound = "skip"
+#$bound$#Euler::Den_group_bound_speed = 1.0
+#$bound$#Euler::Den_group_bound_limit = 0.0
+#$bound$#Euler::Den_group_bound_scalar = 0.0
+
+#$bound$#Euler::En_group_bound = "skip"
+#$bound$#Euler::En_group_bound_speed = 1.0
+#$bound$#Euler::En_group_bound_limit = 0.0
+#$bound$#Euler::En_group_bound_scalar = 0.0
+
+#$bound$#Euler::S_group_bound = "skip"
+#$bound$#Euler::S_group_bound_speed = 1.0
+#$bound$#Euler::S_group_bound_limit = 0.0
+#$bound$#Euler::S_group_bound_scalar = 0.0
+
+#$bound$#Euler::Den_bound = "skip"
+#$bound$#Euler::Den_bound_speed = 1.0
+#$bound$#Euler::Den_bound_limit = 0.0
+#$bound$#Euler::Den_bound_scalar = 0.0
+
+#$bound$#Euler::En_bound = "skip"
+#$bound$#Euler::En_bound_speed = 1.0
+#$bound$#Euler::En_bound_limit = 0.0
+#$bound$#Euler::En_bound_scalar = 0.0
+
+#$bound$#Euler::S1_bound = "skip"
+#$bound$#Euler::S1_bound_speed = 1.0
+#$bound$#Euler::S1_bound_limit = 0.0
+#$bound$#Euler::S1_bound_scalar = 0.0
+
+#$bound$#Euler::S2_bound = "skip"
+#$bound$#Euler::S2_bound_speed = 1.0
+#$bound$#Euler::S2_bound_limit = 0.0
+#$bound$#Euler::S2_bound_scalar = 0.0
+
+#$bound$#Euler::S3_bound = "skip"
+#$bound$#Euler::S3_bound_speed = 1.0
+#$bound$#Euler::S3_bound_limit = 0.0
+#$bound$#Euler::S3_bound_scalar = 0.0
+
+*/
+
diff --git a/Examples/Euler/src/Differencing.h b/Examples/Euler/src/Differencing.h
new file mode 100644
index 0000000..7129217
--- /dev/null
+++ b/Examples/Euler/src/Differencing.h
@@ -0,0 +1,42 @@
+#define PDstandard2nd1(u) (p1o2dx*(-(u)[di*(-1)+dj*(0)+dk*(0)] + (u)[di*(1)+dj*(0)+dk*(0)]))
+#define PDstandard2nd2(u) (p1o2dy*(-(u)[di*(0)+dj*(-1)+dk*(0)] + (u)[di*(0)+dj*(1)+dk*(0)]))
+#define PDstandard2nd3(u) (p1o2dz*(-(u)[di*(0)+dj*(0)+dk*(-1)] + (u)[di*(0)+dj*(0)+dk*(1)]))
+#define PDstandard2nd11(u) (p1odx2*(-2*(u)[di*(0)+dj*(0)+dk*(0)] + (u)[di*(-1)+dj*(0)+dk*(0)] + (u)[di*(1)+dj*(0)+dk*(0)]))
+#define PDstandard2nd22(u) (p1ody2*(-2*(u)[di*(0)+dj*(0)+dk*(0)] + (u)[di*(0)+dj*(-1)+dk*(0)] + (u)[di*(0)+dj*(1)+dk*(0)]))
+#define PDstandard2nd33(u) (p1odz2*(-2*(u)[di*(0)+dj*(0)+dk*(0)] + (u)[di*(0)+dj*(0)+dk*(-1)] + (u)[di*(0)+dj*(0)+dk*(1)]))
+#define PDstandard2nd12(u) (p1o4dxdy*((u)[di*(-1)+dj*(-1)+dk*(0)] - (u)[di*(-1)+dj*(1)+dk*(0)] - (u)[di*(1)+dj*(-1)+dk*(0)] + (u)[di*(1)+dj*(1)+dk*(0)]))
+#define PDstandard2nd13(u) (p1o4dxdz*((u)[di*(-1)+dj*(0)+dk*(-1)] - (u)[di*(-1)+dj*(0)+dk*(1)] - (u)[di*(1)+dj*(0)+dk*(-1)] + (u)[di*(1)+dj*(0)+dk*(1)]))
+#define PDstandard2nd21(u) (p1o4dxdy*((u)[di*(-1)+dj*(-1)+dk*(0)] - (u)[di*(-1)+dj*(1)+dk*(0)] - (u)[di*(1)+dj*(-1)+dk*(0)] + (u)[di*(1)+dj*(1)+dk*(0)]))
+#define PDstandard2nd23(u) (p1o4dydz*((u)[di*(0)+dj*(-1)+dk*(-1)] - (u)[di*(0)+dj*(-1)+dk*(1)] - (u)[di*(0)+dj*(1)+dk*(-1)] + (u)[di*(0)+dj*(1)+dk*(1)]))
+#define PDstandard2nd31(u) (p1o4dxdz*((u)[di*(-1)+dj*(0)+dk*(-1)] - (u)[di*(-1)+dj*(0)+dk*(1)] - (u)[di*(1)+dj*(0)+dk*(-1)] + (u)[di*(1)+dj*(0)+dk*(1)]))
+#define PDstandard2nd32(u) (p1o4dydz*((u)[di*(0)+dj*(-1)+dk*(-1)] - (u)[di*(0)+dj*(-1)+dk*(1)] - (u)[di*(0)+dj*(1)+dk*(-1)] + (u)[di*(0)+dj*(1)+dk*(1)]))
+#define PDstandard4th1(u) (p1o12dx*(-8*(u)[di*(-1)+dj*(0)+dk*(0)] + 8*(u)[di*(1)+dj*(0)+dk*(0)] + (u)[di*(-2)+dj*(0)+dk*(0)] - (u)[di*(2)+dj*(0)+dk*(0)]))
+#define PDstandard4th2(u) (p1o12dy*(-8*(u)[di*(0)+dj*(-1)+dk*(0)] + 8*(u)[di*(0)+dj*(1)+dk*(0)] + (u)[di*(0)+dj*(-2)+dk*(0)] - (u)[di*(0)+dj*(2)+dk*(0)]))
+#define PDstandard4th3(u) (p1o12dz*(-8*(u)[di*(0)+dj*(0)+dk*(-1)] + 8*(u)[di*(0)+dj*(0)+dk*(1)] + (u)[di*(0)+dj*(0)+dk*(-2)] - (u)[di*(0)+dj*(0)+dk*(2)]))
+#define PDstandard4th11(u) (pm1o12dx2*(30*(u)[di*(0)+dj*(0)+dk*(0)] - 16*((u)[di*(-1)+dj*(0)+dk*(0)] + (u)[di*(1)+dj*(0)+dk*(0)]) + (u)[di*(-2)+dj*(0)+dk*(0)] + (u)[di*(2)+dj*(0)+dk*(0)]))
+#define PDstandard4th22(u) (pm1o12dy2*(30*(u)[di*(0)+dj*(0)+dk*(0)] - 16*((u)[di*(0)+dj*(-1)+dk*(0)] + (u)[di*(0)+dj*(1)+dk*(0)]) + (u)[di*(0)+dj*(-2)+dk*(0)] + (u)[di*(0)+dj*(2)+dk*(0)]))
+#define PDstandard4th33(u) (pm1o12dz2*(30*(u)[di*(0)+dj*(0)+dk*(0)] - 16*((u)[di*(0)+dj*(0)+dk*(-1)] + (u)[di*(0)+dj*(0)+dk*(1)]) + (u)[di*(0)+dj*(0)+dk*(-2)] + (u)[di*(0)+dj*(0)+dk*(2)]))
+#define PDstandard4th12(u) (p1o144dxdy*(-64*((u)[di*(-1)+dj*(1)+dk*(0)] + (u)[di*(1)+dj*(-1)+dk*(0)]) + 64*((u)[di*(-1)+dj*(-1)+dk*(0)] + (u)[di*(1)+dj*(1)+dk*(0)]) + 8*((u)[di*(-1)+dj*(2)+dk*(0)] + (u)[di*(1)+dj*(-2)+dk*(0)] + (u)[di*(-2)+dj*(1)+dk*(0)] + (u)[di*(2)+dj*(-1)+dk*(0)]) - 8*((u)[di*(-1)+dj*(-2)+dk*(0)] + (u)[di*(1)+dj*(2)+dk*(0)] + (u)[di*(-2)+dj*(-1)+dk*(0)] + (u)[di*(2)+dj*(1)+dk*(0)]) + (u)[di*(-2)+dj*(-2)+dk*(0)] - (u)[di*(-2)+dj*(2)+dk*(0)] - (u)[di*(2)+dj*(-2)+dk*(0)] + (u)[di*(2)+dj*(2)+dk*(0)]))
+#define PDstandard4th13(u) (p1o144dxdz*(-64*((u)[di*(-1)+dj*(0)+dk*(1)] + (u)[di*(1)+dj*(0)+dk*(-1)]) + 64*((u)[di*(-1)+dj*(0)+dk*(-1)] + (u)[di*(1)+dj*(0)+dk*(1)]) + 8*((u)[di*(-1)+dj*(0)+dk*(2)] + (u)[di*(1)+dj*(0)+dk*(-2)] + (u)[di*(-2)+dj*(0)+dk*(1)] + (u)[di*(2)+dj*(0)+dk*(-1)]) - 8*((u)[di*(-1)+dj*(0)+dk*(-2)] + (u)[di*(1)+dj*(0)+dk*(2)] + (u)[di*(-2)+dj*(0)+dk*(-1)] + (u)[di*(2)+dj*(0)+dk*(1)]) + (u)[di*(-2)+dj*(0)+dk*(-2)] - (u)[di*(-2)+dj*(0)+dk*(2)] - (u)[di*(2)+dj*(0)+dk*(-2)] + (u)[di*(2)+dj*(0)+dk*(2)]))
+#define PDstandard4th21(u) (p1o144dxdy*(-64*((u)[di*(-1)+dj*(1)+dk*(0)] + (u)[di*(1)+dj*(-1)+dk*(0)]) + 64*((u)[di*(-1)+dj*(-1)+dk*(0)] + (u)[di*(1)+dj*(1)+dk*(0)]) + 8*((u)[di*(-1)+dj*(2)+dk*(0)] + (u)[di*(1)+dj*(-2)+dk*(0)] + (u)[di*(-2)+dj*(1)+dk*(0)] + (u)[di*(2)+dj*(-1)+dk*(0)]) - 8*((u)[di*(-1)+dj*(-2)+dk*(0)] + (u)[di*(1)+dj*(2)+dk*(0)] + (u)[di*(-2)+dj*(-1)+dk*(0)] + (u)[di*(2)+dj*(1)+dk*(0)]) + (u)[di*(-2)+dj*(-2)+dk*(0)] - (u)[di*(-2)+dj*(2)+dk*(0)] - (u)[di*(2)+dj*(-2)+dk*(0)] + (u)[di*(2)+dj*(2)+dk*(0)]))
+#define PDstandard4th23(u) (p1o144dydz*(-64*((u)[di*(0)+dj*(-1)+dk*(1)] + (u)[di*(0)+dj*(1)+dk*(-1)]) + 64*((u)[di*(0)+dj*(-1)+dk*(-1)] + (u)[di*(0)+dj*(1)+dk*(1)]) + 8*((u)[di*(0)+dj*(-1)+dk*(2)] + (u)[di*(0)+dj*(1)+dk*(-2)] + (u)[di*(0)+dj*(-2)+dk*(1)] + (u)[di*(0)+dj*(2)+dk*(-1)]) - 8*((u)[di*(0)+dj*(-1)+dk*(-2)] + (u)[di*(0)+dj*(1)+dk*(2)] + (u)[di*(0)+dj*(-2)+dk*(-1)] + (u)[di*(0)+dj*(2)+dk*(1)]) + (u)[di*(0)+dj*(-2)+dk*(-2)] - (u)[di*(0)+dj*(-2)+dk*(2)] - (u)[di*(0)+dj*(2)+dk*(-2)] + (u)[di*(0)+dj*(2)+dk*(2)]))
+#define PDstandard4th31(u) (p1o144dxdz*(-64*((u)[di*(-1)+dj*(0)+dk*(1)] + (u)[di*(1)+dj*(0)+dk*(-1)]) + 64*((u)[di*(-1)+dj*(0)+dk*(-1)] + (u)[di*(1)+dj*(0)+dk*(1)]) + 8*((u)[di*(-1)+dj*(0)+dk*(2)] + (u)[di*(1)+dj*(0)+dk*(-2)] + (u)[di*(-2)+dj*(0)+dk*(1)] + (u)[di*(2)+dj*(0)+dk*(-1)]) - 8*((u)[di*(-1)+dj*(0)+dk*(-2)] + (u)[di*(1)+dj*(0)+dk*(2)] + (u)[di*(-2)+dj*(0)+dk*(-1)] + (u)[di*(2)+dj*(0)+dk*(1)]) + (u)[di*(-2)+dj*(0)+dk*(-2)] - (u)[di*(-2)+dj*(0)+dk*(2)] - (u)[di*(2)+dj*(0)+dk*(-2)] + (u)[di*(2)+dj*(0)+dk*(2)]))
+#define PDstandard4th32(u) (p1o144dydz*(-64*((u)[di*(0)+dj*(-1)+dk*(1)] + (u)[di*(0)+dj*(1)+dk*(-1)]) + 64*((u)[di*(0)+dj*(-1)+dk*(-1)] + (u)[di*(0)+dj*(1)+dk*(1)]) + 8*((u)[di*(0)+dj*(-1)+dk*(2)] + (u)[di*(0)+dj*(1)+dk*(-2)] + (u)[di*(0)+dj*(-2)+dk*(1)] + (u)[di*(0)+dj*(2)+dk*(-1)]) - 8*((u)[di*(0)+dj*(-1)+dk*(-2)] + (u)[di*(0)+dj*(1)+dk*(2)] + (u)[di*(0)+dj*(-2)+dk*(-1)] + (u)[di*(0)+dj*(2)+dk*(1)]) + (u)[di*(0)+dj*(-2)+dk*(-2)] - (u)[di*(0)+dj*(-2)+dk*(2)] - (u)[di*(0)+dj*(2)+dk*(-2)] + (u)[di*(0)+dj*(2)+dk*(2)]))
+#define PDonesided2nd1(u) (pm1o2dx*(3*(u)[di*(0)+dj*(0)+dk*(0)] + (u)[di*(2*dir(1))+dj*(0)+dk*(0)] - 4*(u)[di*(dir(1))+dj*(0)+dk*(0)])*dir(1))
+#define PDonesided2nd2(u) (pm1o2dy*(3*(u)[di*(0)+dj*(0)+dk*(0)] + (u)[di*(0)+dj*(2*dir(2))+dk*(0)] - 4*(u)[di*(0)+dj*(dir(2))+dk*(0)])*dir(2))
+#define PDonesided2nd3(u) (pm1o2dz*(3*(u)[di*(0)+dj*(0)+dk*(0)] + (u)[di*(0)+dj*(0)+dk*(2*dir(3))] - 4*(u)[di*(0)+dj*(0)+dk*(dir(3))])*dir(3))
+#define PDplus1(u) (p1odx*(-(u)[di*(0)+dj*(0)+dk*(0)] + (u)[di*(1)+dj*(0)+dk*(0)]))
+#define PDplus2(u) (p1ody*(-(u)[di*(0)+dj*(0)+dk*(0)] + (u)[di*(0)+dj*(1)+dk*(0)]))
+#define PDplus3(u) (p1odz*(-(u)[di*(0)+dj*(0)+dk*(0)] + (u)[di*(0)+dj*(0)+dk*(1)]))
+#define PDminus1(u) (p1odx*((u)[di*(0)+dj*(0)+dk*(0)] - (u)[di*(-1)+dj*(0)+dk*(0)]))
+#define PDminus2(u) (p1ody*((u)[di*(0)+dj*(0)+dk*(0)] - (u)[di*(0)+dj*(-1)+dk*(0)]))
+#define PDminus3(u) (p1odz*((u)[di*(0)+dj*(0)+dk*(0)] - (u)[di*(0)+dj*(0)+dk*(-1)]))
+#define DiffPlus1(u) (p1o1*(-(u)[di*(0)+dj*(0)+dk*(0)] + (u)[di*(1)+dj*(0)+dk*(0)]))
+#define DiffPlus2(u) (p1o1*(-(u)[di*(0)+dj*(0)+dk*(0)] + (u)[di*(0)+dj*(1)+dk*(0)]))
+#define DiffPlus3(u) (p1o1*(-(u)[di*(0)+dj*(0)+dk*(0)] + (u)[di*(0)+dj*(0)+dk*(1)]))
+#define DiffMinus1(u) (p1o1*((u)[di*(0)+dj*(0)+dk*(0)] - (u)[di*(-1)+dj*(0)+dk*(0)]))
+#define DiffMinus2(u) (p1o1*((u)[di*(0)+dj*(0)+dk*(0)] - (u)[di*(0)+dj*(-1)+dk*(0)]))
+#define DiffMinus3(u) (p1o1*((u)[di*(0)+dj*(0)+dk*(0)] - (u)[di*(0)+dj*(0)+dk*(-1)]))
+#define ShiftMinus1(u) (p1o1*(u)[di*(-1)+dj*(0)+dk*(0)])
+#define ShiftMinus2(u) (p1o1*(u)[di*(0)+dj*(-1)+dk*(0)])
+#define ShiftMinus3(u) (p1o1*(u)[di*(0)+dj*(0)+dk*(-1)])
diff --git a/Examples/Euler/src/RegisterMoL.cc b/Examples/Euler/src/RegisterMoL.cc
new file mode 100644
index 0000000..c6bc9a5
--- /dev/null
+++ b/Examples/Euler/src/RegisterMoL.cc
@@ -0,0 +1,21 @@
+/* File produced by Kranc */
+
+#include "cctk.h"
+#include "cctk_Arguments.h"
+#include "cctk_Parameters.h"
+
+extern "C" void Euler_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("Euler::Den"), CCTK_VarIndex("Euler::Denrhs"));
+ ierr += MoLRegisterEvolved(CCTK_VarIndex("Euler::En"), CCTK_VarIndex("Euler::Enrhs"));
+ ierr += MoLRegisterEvolved(CCTK_VarIndex("Euler::S1"), CCTK_VarIndex("Euler::S1rhs"));
+ ierr += MoLRegisterEvolved(CCTK_VarIndex("Euler::S2"), CCTK_VarIndex("Euler::S2rhs"));
+ ierr += MoLRegisterEvolved(CCTK_VarIndex("Euler::S3"), CCTK_VarIndex("Euler::S3rhs"));
+ return;
+}
diff --git a/Examples/Euler/src/RegisterSymmetries.cc b/Examples/Euler/src/RegisterSymmetries.cc
new file mode 100644
index 0000000..18fc370
--- /dev/null
+++ b/Examples/Euler/src/RegisterSymmetries.cc
@@ -0,0 +1,194 @@
+/* File produced by Kranc */
+
+#include "cctk.h"
+#include "cctk_Arguments.h"
+#include "cctk_Parameters.h"
+#include "Symmetry.h"
+
+extern "C" void Euler_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, "Euler::Den");
+
+ sym[0] = 1;
+ sym[1] = 1;
+ sym[2] = 1;
+ SetCartSymVN(cctkGH, sym, "Euler::En");
+
+ sym[0] = -1;
+ sym[1] = 1;
+ sym[2] = 1;
+ SetCartSymVN(cctkGH, sym, "Euler::S1");
+
+ sym[0] = 1;
+ sym[1] = -1;
+ sym[2] = 1;
+ SetCartSymVN(cctkGH, sym, "Euler::S2");
+
+ sym[0] = 1;
+ sym[1] = 1;
+ sym[2] = -1;
+ SetCartSymVN(cctkGH, sym, "Euler::S3");
+
+ sym[0] = 1;
+ sym[1] = 1;
+ sym[2] = 1;
+ SetCartSymVN(cctkGH, sym, "Euler::DenF");
+
+ sym[0] = 1;
+ sym[1] = 1;
+ sym[2] = 1;
+ SetCartSymVN(cctkGH, sym, "Euler::DenLeft");
+
+ sym[0] = 1;
+ sym[1] = 1;
+ sym[2] = 1;
+ SetCartSymVN(cctkGH, sym, "Euler::DenRight");
+
+ sym[0] = 1;
+ sym[1] = 1;
+ sym[2] = 1;
+ SetCartSymVN(cctkGH, sym, "Euler::EnF");
+
+ sym[0] = 1;
+ sym[1] = 1;
+ sym[2] = 1;
+ SetCartSymVN(cctkGH, sym, "Euler::EnLeft");
+
+ sym[0] = 1;
+ sym[1] = 1;
+ sym[2] = 1;
+ SetCartSymVN(cctkGH, sym, "Euler::EnRight");
+
+ sym[0] = 1;
+ sym[1] = 1;
+ sym[2] = 1;
+ SetCartSymVN(cctkGH, sym, "Euler::p");
+
+ sym[0] = 1;
+ sym[1] = 1;
+ sym[2] = 1;
+ SetCartSymVN(cctkGH, sym, "Euler::pLeft");
+
+ sym[0] = 1;
+ sym[1] = 1;
+ sym[2] = 1;
+ SetCartSymVN(cctkGH, sym, "Euler::pRight");
+
+ sym[0] = 1;
+ sym[1] = 1;
+ sym[2] = 1;
+ SetCartSymVN(cctkGH, sym, "Euler::rho");
+
+ sym[0] = 1;
+ sym[1] = 1;
+ sym[2] = 1;
+ SetCartSymVN(cctkGH, sym, "Euler::rhoLeft");
+
+ sym[0] = 1;
+ sym[1] = 1;
+ sym[2] = 1;
+ SetCartSymVN(cctkGH, sym, "Euler::rhoRight");
+
+ sym[0] = -1;
+ sym[1] = 1;
+ sym[2] = 1;
+ SetCartSymVN(cctkGH, sym, "Euler::SF1");
+
+ sym[0] = 1;
+ sym[1] = -1;
+ sym[2] = 1;
+ SetCartSymVN(cctkGH, sym, "Euler::SF2");
+
+ sym[0] = 1;
+ sym[1] = 1;
+ sym[2] = -1;
+ SetCartSymVN(cctkGH, sym, "Euler::SF3");
+
+ sym[0] = -1;
+ sym[1] = 1;
+ sym[2] = 1;
+ SetCartSymVN(cctkGH, sym, "Euler::SLeft1");
+
+ sym[0] = 1;
+ sym[1] = -1;
+ sym[2] = 1;
+ SetCartSymVN(cctkGH, sym, "Euler::SLeft2");
+
+ sym[0] = 1;
+ sym[1] = 1;
+ sym[2] = -1;
+ SetCartSymVN(cctkGH, sym, "Euler::SLeft3");
+
+ sym[0] = -1;
+ sym[1] = 1;
+ sym[2] = 1;
+ SetCartSymVN(cctkGH, sym, "Euler::SRight1");
+
+ sym[0] = 1;
+ sym[1] = -1;
+ sym[2] = 1;
+ SetCartSymVN(cctkGH, sym, "Euler::SRight2");
+
+ sym[0] = 1;
+ sym[1] = 1;
+ sym[2] = -1;
+ SetCartSymVN(cctkGH, sym, "Euler::SRight3");
+
+ sym[0] = -1;
+ sym[1] = 1;
+ sym[2] = 1;
+ SetCartSymVN(cctkGH, sym, "Euler::v1");
+
+ sym[0] = 1;
+ sym[1] = -1;
+ sym[2] = 1;
+ SetCartSymVN(cctkGH, sym, "Euler::v2");
+
+ sym[0] = 1;
+ sym[1] = 1;
+ sym[2] = -1;
+ SetCartSymVN(cctkGH, sym, "Euler::v3");
+
+ sym[0] = -1;
+ sym[1] = 1;
+ sym[2] = 1;
+ SetCartSymVN(cctkGH, sym, "Euler::vLeft1");
+
+ sym[0] = 1;
+ sym[1] = -1;
+ sym[2] = 1;
+ SetCartSymVN(cctkGH, sym, "Euler::vLeft2");
+
+ sym[0] = 1;
+ sym[1] = 1;
+ sym[2] = -1;
+ SetCartSymVN(cctkGH, sym, "Euler::vLeft3");
+
+ sym[0] = -1;
+ sym[1] = 1;
+ sym[2] = 1;
+ SetCartSymVN(cctkGH, sym, "Euler::vRight1");
+
+ sym[0] = 1;
+ sym[1] = -1;
+ sym[2] = 1;
+ SetCartSymVN(cctkGH, sym, "Euler::vRight2");
+
+ sym[0] = 1;
+ sym[1] = 1;
+ sym[2] = -1;
+ SetCartSymVN(cctkGH, sym, "Euler::vRight3");
+
+}
diff --git a/Examples/Euler/src/Startup.cc b/Examples/Euler/src/Startup.cc
new file mode 100644
index 0000000..88708d0
--- /dev/null
+++ b/Examples/Euler/src/Startup.cc
@@ -0,0 +1,10 @@
+/* File produced by Kranc */
+
+#include "cctk.h"
+
+extern "C" int Euler_Startup(void)
+{
+ const char * banner = "Euler";
+ CCTK_RegisterBanner(banner);
+ return 0;
+}
diff --git a/Examples/Euler/src/euler_conserved.cc b/Examples/Euler/src/euler_conserved.cc
new file mode 100644
index 0000000..4b8252e
--- /dev/null
+++ b/Examples/Euler/src/euler_conserved.cc
@@ -0,0 +1,149 @@
+/* File produced by Kranc */
+
+#define KRANC_C
+
+#include <assert.h>
+#include <math.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "cctk.h"
+#include "cctk_Arguments.h"
+#include "cctk_Parameters.h"
+#include "GenericFD.h"
+#include "Differencing.h"
+
+/* 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))
+
+static void euler_conserved_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[])
+{
+ DECLARE_CCTK_ARGUMENTS;
+ DECLARE_CCTK_PARAMETERS;
+
+
+ /* Declare the variables used for looping over grid points */
+ CCTK_INT i, j, k;
+ // CCTK_INT index = INITVALUE;
+
+ /* Declare finite differencing variables */
+
+ if (verbose > 1)
+ {
+ CCTK_VInfo(CCTK_THORNSTRING,"Entering euler_conserved_Body");
+ }
+
+ if (cctk_iteration % euler_conserved_calc_every != euler_conserved_calc_offset)
+ {
+ return;
+ }
+
+ const char *groups[] = {"Euler::Den_group","Euler::En_group","Euler::p_group","Euler::rho_group","Euler::S_group","Euler::v_group"};
+ GenericFD_AssertGroupStorage(cctkGH, "euler_conserved", 6, groups);
+
+
+ /* 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);
+ 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 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 p1o1 = 1;
+ CCTK_REAL const p1o12dx = 0.0833333333333333333333333333333*INV(dx);
+ CCTK_REAL const p1o12dy = 0.0833333333333333333333333333333*INV(dy);
+ CCTK_REAL const p1o12dz = 0.0833333333333333333333333333333*INV(dz);
+ CCTK_REAL const p1o144dxdy = 0.00694444444444444444444444444444*INV(dx)*INV(dy);
+ CCTK_REAL const p1o144dxdz = 0.00694444444444444444444444444444*INV(dx)*INV(dz);
+ CCTK_REAL const p1o144dydz = 0.00694444444444444444444444444444*INV(dy)*INV(dz);
+ CCTK_REAL const p1o2dx = 0.5*INV(dx);
+ CCTK_REAL const p1o2dy = 0.5*INV(dy);
+ CCTK_REAL const p1o2dz = 0.5*INV(dz);
+ CCTK_REAL const p1o4dxdy = 0.25*INV(dx)*INV(dy);
+ CCTK_REAL const p1o4dxdz = 0.25*INV(dx)*INV(dz);
+ CCTK_REAL const p1o4dydz = 0.25*INV(dy)*INV(dz);
+ CCTK_REAL const p1odx = INV(dx);
+ CCTK_REAL const p1odx2 = INV(SQR(dx));
+ CCTK_REAL const p1ody = INV(dy);
+ CCTK_REAL const p1ody2 = INV(SQR(dy));
+ CCTK_REAL const p1odz = INV(dz);
+ CCTK_REAL const p1odz2 = INV(SQR(dz));
+ CCTK_REAL const pm1o12dx2 = -0.0833333333333333333333333333333*INV(SQR(dx));
+ CCTK_REAL const pm1o12dy2 = -0.0833333333333333333333333333333*INV(SQR(dy));
+ CCTK_REAL const pm1o12dz2 = -0.0833333333333333333333333333333*INV(SQR(dz));
+ CCTK_REAL const pm1o2dx = -0.5*INV(dx);
+ CCTK_REAL const pm1o2dy = -0.5*INV(dy);
+ CCTK_REAL const pm1o2dz = -0.5*INV(dz);
+
+ /* Loop over the grid points */
+ for (k = min[2]; k < max[2]; k++)
+ {
+ for (j = min[1]; j < max[1]; j++)
+ {
+ for (i = min[0]; i < max[0]; i++)
+ {
+ int const index = CCTK_GFINDEX3D(cctkGH,i,j,k) ;
+
+ /* Assign local copies of grid functions */
+
+ CCTK_REAL pL = p[index];
+ CCTK_REAL rhoL = rho[index];
+ CCTK_REAL v1L = v1[index];
+ CCTK_REAL v2L = v2[index];
+ CCTK_REAL v3L = v3[index];
+
+
+ /* Include user supplied include files */
+
+ /* Precompute derivatives */
+
+ /* Calculate temporaries and grid functions */
+ CCTK_REAL DenL = rhoL;
+
+ CCTK_REAL S1L = rhoL*v1L;
+
+ CCTK_REAL S2L = rhoL*v2L;
+
+ CCTK_REAL S3L = rhoL*v3L;
+
+ CCTK_REAL EnL = pL*INV(-1 + ToReal(gamma)) + 0.5*rhoL*(SQR(v1L) +
+ SQR(v2L) + SQR(v3L));
+
+ /* Copy local copies back to grid functions */
+ Den[index] = DenL;
+ En[index] = EnL;
+ S1[index] = S1L;
+ S2[index] = S2L;
+ S3[index] = S3L;
+ }
+ }
+ }
+}
+
+extern "C" void euler_conserved(CCTK_ARGUMENTS)
+{
+ DECLARE_CCTK_ARGUMENTS;
+ DECLARE_CCTK_PARAMETERS;
+
+ GenericFD_LoopOverEverything(cctkGH, &euler_conserved_Body);
+}
diff --git a/Examples/Euler/src/euler_conserved_flux_1.cc b/Examples/Euler/src/euler_conserved_flux_1.cc
new file mode 100644
index 0000000..c6ab4b0
--- /dev/null
+++ b/Examples/Euler/src/euler_conserved_flux_1.cc
@@ -0,0 +1,170 @@
+/* File produced by Kranc */
+
+#define KRANC_C
+
+#include <assert.h>
+#include <math.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "cctk.h"
+#include "cctk_Arguments.h"
+#include "cctk_Parameters.h"
+#include "GenericFD.h"
+#include "Differencing.h"
+
+/* 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))
+
+static void euler_conserved_flux_1_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[])
+{
+ DECLARE_CCTK_ARGUMENTS;
+ DECLARE_CCTK_PARAMETERS;
+
+
+ /* Declare the variables used for looping over grid points */
+ CCTK_INT i, j, k;
+ // CCTK_INT index = INITVALUE;
+
+ /* Declare finite differencing variables */
+
+ if (verbose > 1)
+ {
+ CCTK_VInfo(CCTK_THORNSTRING,"Entering euler_conserved_flux_1_Body");
+ }
+
+ if (cctk_iteration % euler_conserved_flux_1_calc_every != euler_conserved_flux_1_calc_offset)
+ {
+ return;
+ }
+
+ const char *groups[] = {"Euler::DenLeft_group","Euler::DenRight_group","Euler::EnLeft_group","Euler::EnRight_group","Euler::pLeft_group","Euler::pRight_group","Euler::rhoLeft_group","Euler::rhoRight_group","Euler::SLeft_group","Euler::SRight_group","Euler::vLeft_group","Euler::vRight_group"};
+ GenericFD_AssertGroupStorage(cctkGH, "euler_conserved_flux_1", 12, groups);
+
+
+ /* 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);
+ 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 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 p1o1 = 1;
+ CCTK_REAL const p1o12dx = 0.0833333333333333333333333333333*INV(dx);
+ CCTK_REAL const p1o12dy = 0.0833333333333333333333333333333*INV(dy);
+ CCTK_REAL const p1o12dz = 0.0833333333333333333333333333333*INV(dz);
+ CCTK_REAL const p1o144dxdy = 0.00694444444444444444444444444444*INV(dx)*INV(dy);
+ CCTK_REAL const p1o144dxdz = 0.00694444444444444444444444444444*INV(dx)*INV(dz);
+ CCTK_REAL const p1o144dydz = 0.00694444444444444444444444444444*INV(dy)*INV(dz);
+ CCTK_REAL const p1o2dx = 0.5*INV(dx);
+ CCTK_REAL const p1o2dy = 0.5*INV(dy);
+ CCTK_REAL const p1o2dz = 0.5*INV(dz);
+ CCTK_REAL const p1o4dxdy = 0.25*INV(dx)*INV(dy);
+ CCTK_REAL const p1o4dxdz = 0.25*INV(dx)*INV(dz);
+ CCTK_REAL const p1o4dydz = 0.25*INV(dy)*INV(dz);
+ CCTK_REAL const p1odx = INV(dx);
+ CCTK_REAL const p1odx2 = INV(SQR(dx));
+ CCTK_REAL const p1ody = INV(dy);
+ CCTK_REAL const p1ody2 = INV(SQR(dy));
+ CCTK_REAL const p1odz = INV(dz);
+ CCTK_REAL const p1odz2 = INV(SQR(dz));
+ CCTK_REAL const pm1o12dx2 = -0.0833333333333333333333333333333*INV(SQR(dx));
+ CCTK_REAL const pm1o12dy2 = -0.0833333333333333333333333333333*INV(SQR(dy));
+ CCTK_REAL const pm1o12dz2 = -0.0833333333333333333333333333333*INV(SQR(dz));
+ CCTK_REAL const pm1o2dx = -0.5*INV(dx);
+ CCTK_REAL const pm1o2dy = -0.5*INV(dy);
+ CCTK_REAL const pm1o2dz = -0.5*INV(dz);
+
+ /* Loop over the grid points */
+ for (k = min[2]; k < max[2]; k++)
+ {
+ for (j = min[1]; j < max[1]; j++)
+ {
+ for (i = min[0]; i < max[0]; i++)
+ {
+ int const index = CCTK_GFINDEX3D(cctkGH,i,j,k) ;
+
+ /* Assign local copies of grid functions */
+
+ CCTK_REAL pLeftL = pLeft[index];
+ CCTK_REAL pRightL = pRight[index];
+ CCTK_REAL rhoLeftL = rhoLeft[index];
+ CCTK_REAL rhoRightL = rhoRight[index];
+ CCTK_REAL vLeft1L = vLeft1[index];
+ CCTK_REAL vLeft2L = vLeft2[index];
+ CCTK_REAL vLeft3L = vLeft3[index];
+ CCTK_REAL vRight1L = vRight1[index];
+ CCTK_REAL vRight2L = vRight2[index];
+ CCTK_REAL vRight3L = vRight3[index];
+
+
+ /* Include user supplied include files */
+
+ /* Precompute derivatives */
+
+ /* Calculate temporaries and grid functions */
+ CCTK_REAL DenLeftL = rhoLeftL;
+
+ CCTK_REAL DenRightL = rhoRightL;
+
+ CCTK_REAL SLeft1L = rhoLeftL*vLeft1L;
+
+ CCTK_REAL SLeft2L = rhoLeftL*vLeft2L;
+
+ CCTK_REAL SLeft3L = rhoLeftL*vLeft3L;
+
+ CCTK_REAL SRight1L = rhoRightL*vRight1L;
+
+ CCTK_REAL SRight2L = rhoRightL*vRight2L;
+
+ CCTK_REAL SRight3L = rhoRightL*vRight3L;
+
+ CCTK_REAL EnLeftL = pLeftL*INV(-1 + ToReal(gamma)) +
+ 0.5*rhoLeftL*(SQR(vLeft1L) + SQR(vLeft2L) + SQR(vLeft3L));
+
+ CCTK_REAL EnRightL = pRightL*INV(-1 + ToReal(gamma)) +
+ 0.5*rhoRightL*(SQR(vRight1L) + SQR(vRight2L) + SQR(vRight3L));
+
+ /* Copy local copies back to grid functions */
+ DenLeft[index] = DenLeftL;
+ DenRight[index] = DenRightL;
+ EnLeft[index] = EnLeftL;
+ EnRight[index] = EnRightL;
+ SLeft1[index] = SLeft1L;
+ SLeft2[index] = SLeft2L;
+ SLeft3[index] = SLeft3L;
+ SRight1[index] = SRight1L;
+ SRight2[index] = SRight2L;
+ SRight3[index] = SRight3L;
+ }
+ }
+ }
+}
+
+extern "C" void euler_conserved_flux_1(CCTK_ARGUMENTS)
+{
+ DECLARE_CCTK_ARGUMENTS;
+ DECLARE_CCTK_PARAMETERS;
+
+ GenericFD_LoopOverEverything(cctkGH, &euler_conserved_flux_1_Body);
+}
diff --git a/Examples/Euler/src/euler_flux_1.cc b/Examples/Euler/src/euler_flux_1.cc
new file mode 100644
index 0000000..59f4eee
--- /dev/null
+++ b/Examples/Euler/src/euler_flux_1.cc
@@ -0,0 +1,208 @@
+/* File produced by Kranc */
+
+#define KRANC_C
+
+#include <assert.h>
+#include <math.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "cctk.h"
+#include "cctk_Arguments.h"
+#include "cctk_Parameters.h"
+#include "GenericFD.h"
+#include "Differencing.h"
+
+/* 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))
+
+extern "C" void euler_flux_1_SelectBCs(CCTK_ARGUMENTS)
+{
+ DECLARE_CCTK_ARGUMENTS;
+ DECLARE_CCTK_PARAMETERS;
+
+ CCTK_INT ierr = 0;
+ ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "Euler::DenF_group","flat");
+ if (ierr < 0)
+ CCTK_WARN(1, "Failed to register flat BC for Euler::DenF_group.");
+ ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "Euler::EnF_group","flat");
+ if (ierr < 0)
+ CCTK_WARN(1, "Failed to register flat BC for Euler::EnF_group.");
+ ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "Euler::SF_group","flat");
+ if (ierr < 0)
+ CCTK_WARN(1, "Failed to register flat BC for Euler::SF_group.");
+ return;
+}
+
+static void euler_flux_1_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[])
+{
+ DECLARE_CCTK_ARGUMENTS;
+ DECLARE_CCTK_PARAMETERS;
+
+
+ /* Declare the variables used for looping over grid points */
+ CCTK_INT i, j, k;
+ // CCTK_INT index = INITVALUE;
+
+ /* Declare finite differencing variables */
+
+ if (verbose > 1)
+ {
+ CCTK_VInfo(CCTK_THORNSTRING,"Entering euler_flux_1_Body");
+ }
+
+ if (cctk_iteration % euler_flux_1_calc_every != euler_flux_1_calc_offset)
+ {
+ return;
+ }
+
+ const char *groups[] = {"Euler::DenF_group","Euler::DenLeft_group","Euler::DenRight_group","Euler::EnF_group","Euler::EnLeft_group","Euler::EnRight_group","Euler::pLeft_group","Euler::pRight_group","Euler::rhoLeft_group","Euler::rhoRight_group","Euler::SF_group","Euler::SLeft_group","Euler::SRight_group","Euler::vLeft_group","Euler::vRight_group"};
+ GenericFD_AssertGroupStorage(cctkGH, "euler_flux_1", 15, groups);
+
+ GenericFD_EnsureStencilFits(cctkGH, "euler_flux_1", 1, 1, 1);
+
+ /* 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);
+ 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 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 p1o1 = 1;
+ CCTK_REAL const p1o12dx = 0.0833333333333333333333333333333*INV(dx);
+ CCTK_REAL const p1o12dy = 0.0833333333333333333333333333333*INV(dy);
+ CCTK_REAL const p1o12dz = 0.0833333333333333333333333333333*INV(dz);
+ CCTK_REAL const p1o144dxdy = 0.00694444444444444444444444444444*INV(dx)*INV(dy);
+ CCTK_REAL const p1o144dxdz = 0.00694444444444444444444444444444*INV(dx)*INV(dz);
+ CCTK_REAL const p1o144dydz = 0.00694444444444444444444444444444*INV(dy)*INV(dz);
+ CCTK_REAL const p1o2dx = 0.5*INV(dx);
+ CCTK_REAL const p1o2dy = 0.5*INV(dy);
+ CCTK_REAL const p1o2dz = 0.5*INV(dz);
+ CCTK_REAL const p1o4dxdy = 0.25*INV(dx)*INV(dy);
+ CCTK_REAL const p1o4dxdz = 0.25*INV(dx)*INV(dz);
+ CCTK_REAL const p1o4dydz = 0.25*INV(dy)*INV(dz);
+ CCTK_REAL const p1odx = INV(dx);
+ CCTK_REAL const p1odx2 = INV(SQR(dx));
+ CCTK_REAL const p1ody = INV(dy);
+ CCTK_REAL const p1ody2 = INV(SQR(dy));
+ CCTK_REAL const p1odz = INV(dz);
+ CCTK_REAL const p1odz2 = INV(SQR(dz));
+ CCTK_REAL const pm1o12dx2 = -0.0833333333333333333333333333333*INV(SQR(dx));
+ CCTK_REAL const pm1o12dy2 = -0.0833333333333333333333333333333*INV(SQR(dy));
+ CCTK_REAL const pm1o12dz2 = -0.0833333333333333333333333333333*INV(SQR(dz));
+ CCTK_REAL const pm1o2dx = -0.5*INV(dx);
+ CCTK_REAL const pm1o2dy = -0.5*INV(dy);
+ CCTK_REAL const pm1o2dz = -0.5*INV(dz);
+
+ /* Loop over the grid points */
+ for (k = min[2]; k < max[2]; k++)
+ {
+ for (j = min[1]; j < max[1]; j++)
+ {
+ for (i = min[0]; i < max[0]; i++)
+ {
+ int const index = CCTK_GFINDEX3D(cctkGH,i,j,k) ;
+
+ /* Assign local copies of grid functions */
+
+ CCTK_REAL DenLeftL = DenLeft[index];
+ CCTK_REAL DenRightL = DenRight[index];
+ CCTK_REAL EnLeftL = EnLeft[index];
+ CCTK_REAL EnRightL = EnRight[index];
+ CCTK_REAL pLeftL = pLeft[index];
+ CCTK_REAL pRightL = pRight[index];
+ CCTK_REAL rhoLeftL = rhoLeft[index];
+ CCTK_REAL rhoRightL = rhoRight[index];
+ CCTK_REAL SLeft1L = SLeft1[index];
+ CCTK_REAL SLeft2L = SLeft2[index];
+ CCTK_REAL SLeft3L = SLeft3[index];
+ CCTK_REAL SRight1L = SRight1[index];
+ CCTK_REAL SRight2L = SRight2[index];
+ CCTK_REAL SRight3L = SRight3[index];
+ CCTK_REAL vLeft1L = vLeft1[index];
+ CCTK_REAL vLeft2L = vLeft2[index];
+ CCTK_REAL vLeft3L = vLeft3[index];
+ CCTK_REAL vRight1L = vRight1[index];
+ CCTK_REAL vRight2L = vRight2[index];
+ CCTK_REAL vRight3L = vRight3[index];
+
+
+ /* Include user supplied include files */
+
+ /* Precompute derivatives */
+ CCTK_REAL const ShiftMinus1DenRight = ShiftMinus1(&DenRight[index]);
+ CCTK_REAL const ShiftMinus1EnRight = ShiftMinus1(&EnRight[index]);
+ CCTK_REAL const ShiftMinus1pRight = ShiftMinus1(&pRight[index]);
+ CCTK_REAL const ShiftMinus1rhoRight = ShiftMinus1(&rhoRight[index]);
+ CCTK_REAL const ShiftMinus1SRight1 = ShiftMinus1(&SRight1[index]);
+ CCTK_REAL const ShiftMinus1SRight2 = ShiftMinus1(&SRight2[index]);
+ CCTK_REAL const ShiftMinus1SRight3 = ShiftMinus1(&SRight3[index]);
+ CCTK_REAL const ShiftMinus1vRight1 = ShiftMinus1(&vRight1[index]);
+ CCTK_REAL const ShiftMinus1vRight2 = ShiftMinus1(&vRight2[index]);
+ CCTK_REAL const ShiftMinus1vRight3 = ShiftMinus1(&vRight3[index]);
+
+ /* Calculate temporaries and grid functions */
+ CCTK_REAL vRightTemp1 = ShiftMinus1vRight1;
+
+ CCTK_REAL vRightTemp2 = ShiftMinus1vRight2;
+
+ CCTK_REAL vRightTemp3 = ShiftMinus1vRight3;
+
+ CCTK_REAL DenFL = 0.5*(rhoLeftL*vLeft1L +
+ ShiftMinus1rhoRight*vRightTemp1 + (-DenLeftL +
+ ShiftMinus1DenRight)*ToReal(alpha));
+
+ CCTK_REAL SF1L = 0.5*(pLeftL + ShiftMinus1pRight +
+ rhoLeftL*SQR(vLeft1L) + ShiftMinus1rhoRight*SQR(vRightTemp1) +
+ (ShiftMinus1SRight1 - SLeft1L)*ToReal(alpha));
+
+ CCTK_REAL SF2L = 0.5*(rhoLeftL*vLeft1L*vLeft2L +
+ ShiftMinus1rhoRight*vRightTemp1*vRightTemp2 + (ShiftMinus1SRight2 -
+ SLeft2L)*ToReal(alpha));
+
+ CCTK_REAL SF3L = 0.5*(rhoLeftL*vLeft1L*vLeft3L +
+ ShiftMinus1rhoRight*vRightTemp1*vRightTemp3 + (ShiftMinus1SRight3 -
+ SLeft3L)*ToReal(alpha));
+
+ CCTK_REAL EnFL = 0.5*((EnLeftL + pLeftL)*vLeft1L +
+ ShiftMinus1pRight*vRightTemp1 - EnLeftL*ToReal(alpha) +
+ ShiftMinus1EnRight*(vRightTemp1 + ToReal(alpha)));
+
+ /* Copy local copies back to grid functions */
+ DenF[index] = DenFL;
+ EnF[index] = EnFL;
+ SF1[index] = SF1L;
+ SF2[index] = SF2L;
+ SF3[index] = SF3L;
+ }
+ }
+ }
+}
+
+extern "C" void euler_flux_1(CCTK_ARGUMENTS)
+{
+ DECLARE_CCTK_ARGUMENTS;
+ DECLARE_CCTK_PARAMETERS;
+
+ GenericFD_LoopOverInterior(cctkGH, &euler_flux_1_Body);
+}
diff --git a/Examples/Euler/src/euler_initial_shock.cc b/Examples/Euler/src/euler_initial_shock.cc
new file mode 100644
index 0000000..b8fe537
--- /dev/null
+++ b/Examples/Euler/src/euler_initial_shock.cc
@@ -0,0 +1,147 @@
+/* File produced by Kranc */
+
+#define KRANC_C
+
+#include <assert.h>
+#include <math.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "cctk.h"
+#include "cctk_Arguments.h"
+#include "cctk_Parameters.h"
+#include "GenericFD.h"
+#include "Differencing.h"
+
+/* 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))
+
+static void euler_initial_shock_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[])
+{
+ DECLARE_CCTK_ARGUMENTS;
+ DECLARE_CCTK_PARAMETERS;
+
+
+ /* Declare the variables used for looping over grid points */
+ CCTK_INT i, j, k;
+ // CCTK_INT index = INITVALUE;
+
+ /* Declare finite differencing variables */
+
+ if (verbose > 1)
+ {
+ CCTK_VInfo(CCTK_THORNSTRING,"Entering euler_initial_shock_Body");
+ }
+
+ if (cctk_iteration % euler_initial_shock_calc_every != euler_initial_shock_calc_offset)
+ {
+ return;
+ }
+
+ const char *groups[] = {"grid::coordinates","Euler::p_group","Euler::rho_group","Euler::v_group"};
+ GenericFD_AssertGroupStorage(cctkGH, "euler_initial_shock", 4, groups);
+
+
+ /* 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);
+ 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 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 p1o1 = 1;
+ CCTK_REAL const p1o12dx = 0.0833333333333333333333333333333*INV(dx);
+ CCTK_REAL const p1o12dy = 0.0833333333333333333333333333333*INV(dy);
+ CCTK_REAL const p1o12dz = 0.0833333333333333333333333333333*INV(dz);
+ CCTK_REAL const p1o144dxdy = 0.00694444444444444444444444444444*INV(dx)*INV(dy);
+ CCTK_REAL const p1o144dxdz = 0.00694444444444444444444444444444*INV(dx)*INV(dz);
+ CCTK_REAL const p1o144dydz = 0.00694444444444444444444444444444*INV(dy)*INV(dz);
+ CCTK_REAL const p1o2dx = 0.5*INV(dx);
+ CCTK_REAL const p1o2dy = 0.5*INV(dy);
+ CCTK_REAL const p1o2dz = 0.5*INV(dz);
+ CCTK_REAL const p1o4dxdy = 0.25*INV(dx)*INV(dy);
+ CCTK_REAL const p1o4dxdz = 0.25*INV(dx)*INV(dz);
+ CCTK_REAL const p1o4dydz = 0.25*INV(dy)*INV(dz);
+ CCTK_REAL const p1odx = INV(dx);
+ CCTK_REAL const p1odx2 = INV(SQR(dx));
+ CCTK_REAL const p1ody = INV(dy);
+ CCTK_REAL const p1ody2 = INV(SQR(dy));
+ CCTK_REAL const p1odz = INV(dz);
+ CCTK_REAL const p1odz2 = INV(SQR(dz));
+ CCTK_REAL const pm1o12dx2 = -0.0833333333333333333333333333333*INV(SQR(dx));
+ CCTK_REAL const pm1o12dy2 = -0.0833333333333333333333333333333*INV(SQR(dy));
+ CCTK_REAL const pm1o12dz2 = -0.0833333333333333333333333333333*INV(SQR(dz));
+ CCTK_REAL const pm1o2dx = -0.5*INV(dx);
+ CCTK_REAL const pm1o2dy = -0.5*INV(dy);
+ CCTK_REAL const pm1o2dz = -0.5*INV(dz);
+
+ /* Loop over the grid points */
+ for (k = min[2]; k < max[2]; k++)
+ {
+ for (j = min[1]; j < max[1]; j++)
+ {
+ for (i = min[0]; i < max[0]; i++)
+ {
+ int const index = CCTK_GFINDEX3D(cctkGH,i,j,k) ;
+
+ /* Assign local copies of grid functions */
+
+ CCTK_REAL xL = x[index];
+
+
+ /* Include user supplied include files */
+
+ /* Precompute derivatives */
+
+ /* Calculate temporaries and grid functions */
+ CCTK_REAL rhoL = Piecewise(List(List(ToReal(rhoL0),xL < 0.5)),0. +
+ ToReal(rhoR0));
+
+ CCTK_REAL v1L = Piecewise(List(List(ToReal(vL0),xL < 0.5)),0. +
+ ToReal(vR0));
+
+ CCTK_REAL v2L = 0;
+
+ CCTK_REAL v3L = 0;
+
+ CCTK_REAL pL = Piecewise(List(List(ToReal(pL0),xL < 0.5)),0. +
+ ToReal(pR0));
+
+ /* Copy local copies back to grid functions */
+ p[index] = pL;
+ rho[index] = rhoL;
+ v1[index] = v1L;
+ v2[index] = v2L;
+ v3[index] = v3L;
+ }
+ }
+ }
+}
+
+extern "C" void euler_initial_shock(CCTK_ARGUMENTS)
+{
+ DECLARE_CCTK_ARGUMENTS;
+ DECLARE_CCTK_PARAMETERS;
+
+ GenericFD_LoopOverEverything(cctkGH, &euler_initial_shock_Body);
+}
diff --git a/Examples/Euler/src/euler_primitives.cc b/Examples/Euler/src/euler_primitives.cc
new file mode 100644
index 0000000..27d26b9
--- /dev/null
+++ b/Examples/Euler/src/euler_primitives.cc
@@ -0,0 +1,149 @@
+/* File produced by Kranc */
+
+#define KRANC_C
+
+#include <assert.h>
+#include <math.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "cctk.h"
+#include "cctk_Arguments.h"
+#include "cctk_Parameters.h"
+#include "GenericFD.h"
+#include "Differencing.h"
+
+/* 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))
+
+static void euler_primitives_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[])
+{
+ DECLARE_CCTK_ARGUMENTS;
+ DECLARE_CCTK_PARAMETERS;
+
+
+ /* Declare the variables used for looping over grid points */
+ CCTK_INT i, j, k;
+ // CCTK_INT index = INITVALUE;
+
+ /* Declare finite differencing variables */
+
+ if (verbose > 1)
+ {
+ CCTK_VInfo(CCTK_THORNSTRING,"Entering euler_primitives_Body");
+ }
+
+ if (cctk_iteration % euler_primitives_calc_every != euler_primitives_calc_offset)
+ {
+ return;
+ }
+
+ const char *groups[] = {"Euler::Den_group","Euler::En_group","Euler::p_group","Euler::rho_group","Euler::S_group","Euler::v_group"};
+ GenericFD_AssertGroupStorage(cctkGH, "euler_primitives", 6, groups);
+
+
+ /* 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);
+ 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 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 p1o1 = 1;
+ CCTK_REAL const p1o12dx = 0.0833333333333333333333333333333*INV(dx);
+ CCTK_REAL const p1o12dy = 0.0833333333333333333333333333333*INV(dy);
+ CCTK_REAL const p1o12dz = 0.0833333333333333333333333333333*INV(dz);
+ CCTK_REAL const p1o144dxdy = 0.00694444444444444444444444444444*INV(dx)*INV(dy);
+ CCTK_REAL const p1o144dxdz = 0.00694444444444444444444444444444*INV(dx)*INV(dz);
+ CCTK_REAL const p1o144dydz = 0.00694444444444444444444444444444*INV(dy)*INV(dz);
+ CCTK_REAL const p1o2dx = 0.5*INV(dx);
+ CCTK_REAL const p1o2dy = 0.5*INV(dy);
+ CCTK_REAL const p1o2dz = 0.5*INV(dz);
+ CCTK_REAL const p1o4dxdy = 0.25*INV(dx)*INV(dy);
+ CCTK_REAL const p1o4dxdz = 0.25*INV(dx)*INV(dz);
+ CCTK_REAL const p1o4dydz = 0.25*INV(dy)*INV(dz);
+ CCTK_REAL const p1odx = INV(dx);
+ CCTK_REAL const p1odx2 = INV(SQR(dx));
+ CCTK_REAL const p1ody = INV(dy);
+ CCTK_REAL const p1ody2 = INV(SQR(dy));
+ CCTK_REAL const p1odz = INV(dz);
+ CCTK_REAL const p1odz2 = INV(SQR(dz));
+ CCTK_REAL const pm1o12dx2 = -0.0833333333333333333333333333333*INV(SQR(dx));
+ CCTK_REAL const pm1o12dy2 = -0.0833333333333333333333333333333*INV(SQR(dy));
+ CCTK_REAL const pm1o12dz2 = -0.0833333333333333333333333333333*INV(SQR(dz));
+ CCTK_REAL const pm1o2dx = -0.5*INV(dx);
+ CCTK_REAL const pm1o2dy = -0.5*INV(dy);
+ CCTK_REAL const pm1o2dz = -0.5*INV(dz);
+
+ /* Loop over the grid points */
+ for (k = min[2]; k < max[2]; k++)
+ {
+ for (j = min[1]; j < max[1]; j++)
+ {
+ for (i = min[0]; i < max[0]; i++)
+ {
+ int const index = CCTK_GFINDEX3D(cctkGH,i,j,k) ;
+
+ /* Assign local copies of grid functions */
+
+ CCTK_REAL DenL = Den[index];
+ CCTK_REAL EnL = En[index];
+ CCTK_REAL S1L = S1[index];
+ CCTK_REAL S2L = S2[index];
+ CCTK_REAL S3L = S3[index];
+
+
+ /* Include user supplied include files */
+
+ /* Precompute derivatives */
+
+ /* Calculate temporaries and grid functions */
+ CCTK_REAL rhoL = DenL;
+
+ CCTK_REAL v1L = S1L*INV(DenL);
+
+ CCTK_REAL v2L = S2L*INV(DenL);
+
+ CCTK_REAL v3L = S3L*INV(DenL);
+
+ CCTK_REAL pL = (EnL - 0.5*INV(DenL)*(SQR(S1L) + SQR(S2L) +
+ SQR(S3L)))*(-1 + ToReal(gamma));
+
+ /* Copy local copies back to grid functions */
+ p[index] = pL;
+ rho[index] = rhoL;
+ v1[index] = v1L;
+ v2[index] = v2L;
+ v3[index] = v3L;
+ }
+ }
+ }
+}
+
+extern "C" void euler_primitives(CCTK_ARGUMENTS)
+{
+ DECLARE_CCTK_ARGUMENTS;
+ DECLARE_CCTK_PARAMETERS;
+
+ GenericFD_LoopOverEverything(cctkGH, &euler_primitives_Body);
+}
diff --git a/Examples/Euler/src/euler_reconstruct_1.cc b/Examples/Euler/src/euler_reconstruct_1.cc
new file mode 100644
index 0000000..6fa5f9a
--- /dev/null
+++ b/Examples/Euler/src/euler_reconstruct_1.cc
@@ -0,0 +1,231 @@
+/* File produced by Kranc */
+
+#define KRANC_C
+
+#include <assert.h>
+#include <math.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "cctk.h"
+#include "cctk_Arguments.h"
+#include "cctk_Parameters.h"
+#include "GenericFD.h"
+#include "Differencing.h"
+
+/* 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))
+
+extern "C" void euler_reconstruct_1_SelectBCs(CCTK_ARGUMENTS)
+{
+ DECLARE_CCTK_ARGUMENTS;
+ DECLARE_CCTK_PARAMETERS;
+
+ CCTK_INT ierr = 0;
+ ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "Euler::pLeft_group","flat");
+ if (ierr < 0)
+ CCTK_WARN(1, "Failed to register flat BC for Euler::pLeft_group.");
+ ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "Euler::pRight_group","flat");
+ if (ierr < 0)
+ CCTK_WARN(1, "Failed to register flat BC for Euler::pRight_group.");
+ ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "Euler::rhoLeft_group","flat");
+ if (ierr < 0)
+ CCTK_WARN(1, "Failed to register flat BC for Euler::rhoLeft_group.");
+ ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "Euler::rhoRight_group","flat");
+ if (ierr < 0)
+ CCTK_WARN(1, "Failed to register flat BC for Euler::rhoRight_group.");
+ ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "Euler::vLeft_group","flat");
+ if (ierr < 0)
+ CCTK_WARN(1, "Failed to register flat BC for Euler::vLeft_group.");
+ ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "Euler::vRight_group","flat");
+ if (ierr < 0)
+ CCTK_WARN(1, "Failed to register flat BC for Euler::vRight_group.");
+ return;
+}
+
+static void euler_reconstruct_1_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[])
+{
+ DECLARE_CCTK_ARGUMENTS;
+ DECLARE_CCTK_PARAMETERS;
+
+
+ /* Declare the variables used for looping over grid points */
+ CCTK_INT i, j, k;
+ // CCTK_INT index = INITVALUE;
+
+ /* Declare finite differencing variables */
+
+ if (verbose > 1)
+ {
+ CCTK_VInfo(CCTK_THORNSTRING,"Entering euler_reconstruct_1_Body");
+ }
+
+ if (cctk_iteration % euler_reconstruct_1_calc_every != euler_reconstruct_1_calc_offset)
+ {
+ return;
+ }
+
+ const char *groups[] = {"Euler::p_group","Euler::pLeft_group","Euler::pRight_group","Euler::rho_group","Euler::rhoLeft_group","Euler::rhoRight_group","Euler::v_group","Euler::vLeft_group","Euler::vRight_group"};
+ GenericFD_AssertGroupStorage(cctkGH, "euler_reconstruct_1", 9, groups);
+
+ GenericFD_EnsureStencilFits(cctkGH, "euler_reconstruct_1", 1, 1, 1);
+
+ /* 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);
+ 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 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 p1o1 = 1;
+ CCTK_REAL const p1o12dx = 0.0833333333333333333333333333333*INV(dx);
+ CCTK_REAL const p1o12dy = 0.0833333333333333333333333333333*INV(dy);
+ CCTK_REAL const p1o12dz = 0.0833333333333333333333333333333*INV(dz);
+ CCTK_REAL const p1o144dxdy = 0.00694444444444444444444444444444*INV(dx)*INV(dy);
+ CCTK_REAL const p1o144dxdz = 0.00694444444444444444444444444444*INV(dx)*INV(dz);
+ CCTK_REAL const p1o144dydz = 0.00694444444444444444444444444444*INV(dy)*INV(dz);
+ CCTK_REAL const p1o2dx = 0.5*INV(dx);
+ CCTK_REAL const p1o2dy = 0.5*INV(dy);
+ CCTK_REAL const p1o2dz = 0.5*INV(dz);
+ CCTK_REAL const p1o4dxdy = 0.25*INV(dx)*INV(dy);
+ CCTK_REAL const p1o4dxdz = 0.25*INV(dx)*INV(dz);
+ CCTK_REAL const p1o4dydz = 0.25*INV(dy)*INV(dz);
+ CCTK_REAL const p1odx = INV(dx);
+ CCTK_REAL const p1odx2 = INV(SQR(dx));
+ CCTK_REAL const p1ody = INV(dy);
+ CCTK_REAL const p1ody2 = INV(SQR(dy));
+ CCTK_REAL const p1odz = INV(dz);
+ CCTK_REAL const p1odz2 = INV(SQR(dz));
+ CCTK_REAL const pm1o12dx2 = -0.0833333333333333333333333333333*INV(SQR(dx));
+ CCTK_REAL const pm1o12dy2 = -0.0833333333333333333333333333333*INV(SQR(dy));
+ CCTK_REAL const pm1o12dz2 = -0.0833333333333333333333333333333*INV(SQR(dz));
+ CCTK_REAL const pm1o2dx = -0.5*INV(dx);
+ CCTK_REAL const pm1o2dy = -0.5*INV(dy);
+ CCTK_REAL const pm1o2dz = -0.5*INV(dz);
+
+ /* Loop over the grid points */
+ for (k = min[2]; k < max[2]; k++)
+ {
+ for (j = min[1]; j < max[1]; j++)
+ {
+ for (i = min[0]; i < max[0]; i++)
+ {
+ int const index = CCTK_GFINDEX3D(cctkGH,i,j,k) ;
+
+ /* Assign local copies of grid functions */
+
+ CCTK_REAL pL = p[index];
+ CCTK_REAL rhoL = rho[index];
+ CCTK_REAL v1L = v1[index];
+ CCTK_REAL v2L = v2[index];
+ CCTK_REAL v3L = v3[index];
+
+
+ /* Include user supplied include files */
+
+ /* Precompute derivatives */
+ CCTK_REAL const DiffPlus1p = DiffPlus1(&p[index]);
+ CCTK_REAL const DiffMinus1p = DiffMinus1(&p[index]);
+ CCTK_REAL const DiffPlus1rho = DiffPlus1(&rho[index]);
+ CCTK_REAL const DiffMinus1rho = DiffMinus1(&rho[index]);
+ CCTK_REAL const DiffPlus1v1 = DiffPlus1(&v1[index]);
+ CCTK_REAL const DiffMinus1v1 = DiffMinus1(&v1[index]);
+ CCTK_REAL const DiffPlus1v2 = DiffPlus1(&v2[index]);
+ CCTK_REAL const DiffMinus1v2 = DiffMinus1(&v2[index]);
+ CCTK_REAL const DiffPlus1v3 = DiffPlus1(&v3[index]);
+ CCTK_REAL const DiffMinus1v3 = DiffMinus1(&v3[index]);
+
+ /* Calculate temporaries and grid functions */
+ CCTK_REAL slopeL = DiffMinus1rho;
+
+ CCTK_REAL slopeR = DiffPlus1rho;
+
+ CCTK_REAL slope = VanLeer(slopeL,slopeR);
+
+ CCTK_REAL rhoLeftL = rhoL - 0.5*slope;
+
+ CCTK_REAL rhoRightL = rhoL + 0.5*slope;
+
+ slopeL = DiffMinus1v1;
+
+ slopeR = DiffPlus1v1;
+
+ slope = VanLeer(slopeL,slopeR);
+
+ CCTK_REAL vLeft1L = -0.5*slope + v1L;
+
+ CCTK_REAL vRight1L = 0.5*slope + v1L;
+
+ slopeL = DiffMinus1v2;
+
+ slopeR = DiffPlus1v2;
+
+ slope = VanLeer(slopeL,slopeR);
+
+ CCTK_REAL vLeft2L = -0.5*slope + v2L;
+
+ CCTK_REAL vRight2L = 0.5*slope + v2L;
+
+ slopeL = DiffMinus1v3;
+
+ slopeR = DiffPlus1v3;
+
+ slope = VanLeer(slopeL,slopeR);
+
+ CCTK_REAL vLeft3L = -0.5*slope + v3L;
+
+ CCTK_REAL vRight3L = 0.5*slope + v3L;
+
+ slopeL = DiffMinus1p;
+
+ slopeR = DiffPlus1p;
+
+ slope = VanLeer(slopeL,slopeR);
+
+ CCTK_REAL pLeftL = pL - 0.5*slope;
+
+ CCTK_REAL pRightL = pL + 0.5*slope;
+
+ /* Copy local copies back to grid functions */
+ pLeft[index] = pLeftL;
+ pRight[index] = pRightL;
+ rhoLeft[index] = rhoLeftL;
+ rhoRight[index] = rhoRightL;
+ vLeft1[index] = vLeft1L;
+ vLeft2[index] = vLeft2L;
+ vLeft3[index] = vLeft3L;
+ vRight1[index] = vRight1L;
+ vRight2[index] = vRight2L;
+ vRight3[index] = vRight3L;
+ }
+ }
+ }
+}
+
+extern "C" void euler_reconstruct_1(CCTK_ARGUMENTS)
+{
+ DECLARE_CCTK_ARGUMENTS;
+ DECLARE_CCTK_PARAMETERS;
+
+ GenericFD_LoopOverInterior(cctkGH, &euler_reconstruct_1_Body);
+}
diff --git a/Examples/Euler/src/euler_rhs_1.cc b/Examples/Euler/src/euler_rhs_1.cc
new file mode 100644
index 0000000..2467cbb
--- /dev/null
+++ b/Examples/Euler/src/euler_rhs_1.cc
@@ -0,0 +1,177 @@
+/* File produced by Kranc */
+
+#define KRANC_C
+
+#include <assert.h>
+#include <math.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "cctk.h"
+#include "cctk_Arguments.h"
+#include "cctk_Parameters.h"
+#include "GenericFD.h"
+#include "Differencing.h"
+
+/* 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))
+
+extern "C" void euler_rhs_1_SelectBCs(CCTK_ARGUMENTS)
+{
+ DECLARE_CCTK_ARGUMENTS;
+ DECLARE_CCTK_PARAMETERS;
+
+ CCTK_INT ierr = 0;
+ ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "Euler::Den_grouprhs","flat");
+ if (ierr < 0)
+ CCTK_WARN(1, "Failed to register flat BC for Euler::Den_grouprhs.");
+ ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "Euler::En_grouprhs","flat");
+ if (ierr < 0)
+ CCTK_WARN(1, "Failed to register flat BC for Euler::En_grouprhs.");
+ ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "Euler::S_grouprhs","flat");
+ if (ierr < 0)
+ CCTK_WARN(1, "Failed to register flat BC for Euler::S_grouprhs.");
+ return;
+}
+
+static void euler_rhs_1_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[])
+{
+ DECLARE_CCTK_ARGUMENTS;
+ DECLARE_CCTK_PARAMETERS;
+
+
+ /* Declare the variables used for looping over grid points */
+ CCTK_INT i, j, k;
+ // CCTK_INT index = INITVALUE;
+
+ /* Declare finite differencing variables */
+
+ if (verbose > 1)
+ {
+ CCTK_VInfo(CCTK_THORNSTRING,"Entering euler_rhs_1_Body");
+ }
+
+ if (cctk_iteration % euler_rhs_1_calc_every != euler_rhs_1_calc_offset)
+ {
+ return;
+ }
+
+ const char *groups[] = {"Euler::DenF_group","Euler::Den_grouprhs","Euler::EnF_group","Euler::En_grouprhs","Euler::SF_group","Euler::S_grouprhs"};
+ GenericFD_AssertGroupStorage(cctkGH, "euler_rhs_1", 6, groups);
+
+ GenericFD_EnsureStencilFits(cctkGH, "euler_rhs_1", 1, 1, 1);
+
+ /* 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);
+ 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 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 p1o1 = 1;
+ CCTK_REAL const p1o12dx = 0.0833333333333333333333333333333*INV(dx);
+ CCTK_REAL const p1o12dy = 0.0833333333333333333333333333333*INV(dy);
+ CCTK_REAL const p1o12dz = 0.0833333333333333333333333333333*INV(dz);
+ CCTK_REAL const p1o144dxdy = 0.00694444444444444444444444444444*INV(dx)*INV(dy);
+ CCTK_REAL const p1o144dxdz = 0.00694444444444444444444444444444*INV(dx)*INV(dz);
+ CCTK_REAL const p1o144dydz = 0.00694444444444444444444444444444*INV(dy)*INV(dz);
+ CCTK_REAL const p1o2dx = 0.5*INV(dx);
+ CCTK_REAL const p1o2dy = 0.5*INV(dy);
+ CCTK_REAL const p1o2dz = 0.5*INV(dz);
+ CCTK_REAL const p1o4dxdy = 0.25*INV(dx)*INV(dy);
+ CCTK_REAL const p1o4dxdz = 0.25*INV(dx)*INV(dz);
+ CCTK_REAL const p1o4dydz = 0.25*INV(dy)*INV(dz);
+ CCTK_REAL const p1odx = INV(dx);
+ CCTK_REAL const p1odx2 = INV(SQR(dx));
+ CCTK_REAL const p1ody = INV(dy);
+ CCTK_REAL const p1ody2 = INV(SQR(dy));
+ CCTK_REAL const p1odz = INV(dz);
+ CCTK_REAL const p1odz2 = INV(SQR(dz));
+ CCTK_REAL const pm1o12dx2 = -0.0833333333333333333333333333333*INV(SQR(dx));
+ CCTK_REAL const pm1o12dy2 = -0.0833333333333333333333333333333*INV(SQR(dy));
+ CCTK_REAL const pm1o12dz2 = -0.0833333333333333333333333333333*INV(SQR(dz));
+ CCTK_REAL const pm1o2dx = -0.5*INV(dx);
+ CCTK_REAL const pm1o2dy = -0.5*INV(dy);
+ CCTK_REAL const pm1o2dz = -0.5*INV(dz);
+
+ /* Loop over the grid points */
+ for (k = min[2]; k < max[2]; k++)
+ {
+ for (j = min[1]; j < max[1]; j++)
+ {
+ for (i = min[0]; i < max[0]; i++)
+ {
+ int const index = CCTK_GFINDEX3D(cctkGH,i,j,k) ;
+
+ /* Assign local copies of grid functions */
+
+ CCTK_REAL DenFL = DenF[index];
+ CCTK_REAL DenrhsL = Denrhs[index];
+ CCTK_REAL EnFL = EnF[index];
+ CCTK_REAL EnrhsL = Enrhs[index];
+ CCTK_REAL S1rhsL = S1rhs[index];
+ CCTK_REAL S2rhsL = S2rhs[index];
+ CCTK_REAL S3rhsL = S3rhs[index];
+ CCTK_REAL SF1L = SF1[index];
+ CCTK_REAL SF2L = SF2[index];
+ CCTK_REAL SF3L = SF3[index];
+
+
+ /* Include user supplied include files */
+
+ /* Precompute derivatives */
+ CCTK_REAL const PDplus1DenF = PDplus1(&DenF[index]);
+ CCTK_REAL const PDplus1EnF = PDplus1(&EnF[index]);
+ CCTK_REAL const PDplus1SF1 = PDplus1(&SF1[index]);
+ CCTK_REAL const PDplus1SF2 = PDplus1(&SF2[index]);
+ CCTK_REAL const PDplus1SF3 = PDplus1(&SF3[index]);
+
+ /* Calculate temporaries and grid functions */
+ DenrhsL = DenrhsL - PDplus1DenF;
+
+ S1rhsL = -PDplus1SF1 + S1rhsL;
+
+ S2rhsL = -PDplus1SF2 + S2rhsL;
+
+ S3rhsL = -PDplus1SF3 + S3rhsL;
+
+ EnrhsL = EnrhsL - PDplus1EnF;
+
+ /* Copy local copies back to grid functions */
+ Denrhs[index] = DenrhsL;
+ Enrhs[index] = EnrhsL;
+ S1rhs[index] = S1rhsL;
+ S2rhs[index] = S2rhsL;
+ S3rhs[index] = S3rhsL;
+ }
+ }
+ }
+}
+
+extern "C" void euler_rhs_1(CCTK_ARGUMENTS)
+{
+ DECLARE_CCTK_ARGUMENTS;
+ DECLARE_CCTK_PARAMETERS;
+
+ GenericFD_LoopOverInterior(cctkGH, &euler_rhs_1_Body);
+}
diff --git a/Examples/Euler/src/euler_zero_rhs.cc b/Examples/Euler/src/euler_zero_rhs.cc
new file mode 100644
index 0000000..62157f2
--- /dev/null
+++ b/Examples/Euler/src/euler_zero_rhs.cc
@@ -0,0 +1,143 @@
+/* File produced by Kranc */
+
+#define KRANC_C
+
+#include <assert.h>
+#include <math.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "cctk.h"
+#include "cctk_Arguments.h"
+#include "cctk_Parameters.h"
+#include "GenericFD.h"
+#include "Differencing.h"
+
+/* 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))
+
+static void euler_zero_rhs_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const min[3], int const max[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[])
+{
+ DECLARE_CCTK_ARGUMENTS;
+ DECLARE_CCTK_PARAMETERS;
+
+
+ /* Declare the variables used for looping over grid points */
+ CCTK_INT i, j, k;
+ // CCTK_INT index = INITVALUE;
+
+ /* Declare finite differencing variables */
+
+ if (verbose > 1)
+ {
+ CCTK_VInfo(CCTK_THORNSTRING,"Entering euler_zero_rhs_Body");
+ }
+
+ if (cctk_iteration % euler_zero_rhs_calc_every != euler_zero_rhs_calc_offset)
+ {
+ return;
+ }
+
+ const char *groups[] = {"Euler::Den_grouprhs","Euler::En_grouprhs","Euler::S_grouprhs"};
+ GenericFD_AssertGroupStorage(cctkGH, "euler_zero_rhs", 3, groups);
+
+
+ /* 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);
+ 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 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 p1o1 = 1;
+ CCTK_REAL const p1o12dx = 0.0833333333333333333333333333333*INV(dx);
+ CCTK_REAL const p1o12dy = 0.0833333333333333333333333333333*INV(dy);
+ CCTK_REAL const p1o12dz = 0.0833333333333333333333333333333*INV(dz);
+ CCTK_REAL const p1o144dxdy = 0.00694444444444444444444444444444*INV(dx)*INV(dy);
+ CCTK_REAL const p1o144dxdz = 0.00694444444444444444444444444444*INV(dx)*INV(dz);
+ CCTK_REAL const p1o144dydz = 0.00694444444444444444444444444444*INV(dy)*INV(dz);
+ CCTK_REAL const p1o2dx = 0.5*INV(dx);
+ CCTK_REAL const p1o2dy = 0.5*INV(dy);
+ CCTK_REAL const p1o2dz = 0.5*INV(dz);
+ CCTK_REAL const p1o4dxdy = 0.25*INV(dx)*INV(dy);
+ CCTK_REAL const p1o4dxdz = 0.25*INV(dx)*INV(dz);
+ CCTK_REAL const p1o4dydz = 0.25*INV(dy)*INV(dz);
+ CCTK_REAL const p1odx = INV(dx);
+ CCTK_REAL const p1odx2 = INV(SQR(dx));
+ CCTK_REAL const p1ody = INV(dy);
+ CCTK_REAL const p1ody2 = INV(SQR(dy));
+ CCTK_REAL const p1odz = INV(dz);
+ CCTK_REAL const p1odz2 = INV(SQR(dz));
+ CCTK_REAL const pm1o12dx2 = -0.0833333333333333333333333333333*INV(SQR(dx));
+ CCTK_REAL const pm1o12dy2 = -0.0833333333333333333333333333333*INV(SQR(dy));
+ CCTK_REAL const pm1o12dz2 = -0.0833333333333333333333333333333*INV(SQR(dz));
+ CCTK_REAL const pm1o2dx = -0.5*INV(dx);
+ CCTK_REAL const pm1o2dy = -0.5*INV(dy);
+ CCTK_REAL const pm1o2dz = -0.5*INV(dz);
+
+ /* Loop over the grid points */
+ for (k = min[2]; k < max[2]; k++)
+ {
+ for (j = min[1]; j < max[1]; j++)
+ {
+ for (i = min[0]; i < max[0]; i++)
+ {
+ int const index = CCTK_GFINDEX3D(cctkGH,i,j,k) ;
+
+ /* Assign local copies of grid functions */
+
+
+
+ /* Include user supplied include files */
+
+ /* Precompute derivatives */
+
+ /* Calculate temporaries and grid functions */
+ CCTK_REAL DenrhsL = 0;
+
+ CCTK_REAL S1rhsL = 0;
+
+ CCTK_REAL S2rhsL = 0;
+
+ CCTK_REAL S3rhsL = 0;
+
+ CCTK_REAL EnrhsL = 0;
+
+ /* Copy local copies back to grid functions */
+ Denrhs[index] = DenrhsL;
+ Enrhs[index] = EnrhsL;
+ S1rhs[index] = S1rhsL;
+ S2rhs[index] = S2rhsL;
+ S3rhs[index] = S3rhsL;
+ }
+ }
+ }
+}
+
+extern "C" void euler_zero_rhs(CCTK_ARGUMENTS)
+{
+ DECLARE_CCTK_ARGUMENTS;
+ DECLARE_CCTK_PARAMETERS;
+
+ GenericFD_LoopOverEverything(cctkGH, &euler_zero_rhs_Body);
+}
diff --git a/Examples/Euler/src/make.code.defn b/Examples/Euler/src/make.code.defn
new file mode 100644
index 0000000..4081620
--- /dev/null
+++ b/Examples/Euler/src/make.code.defn
@@ -0,0 +1,3 @@
+# File produced by Kranc
+
+SRCS = Startup.cc RegisterMoL.cc RegisterSymmetries.cc euler_initial_shock.cc euler_primitives.cc euler_conserved.cc euler_zero_rhs.cc euler_reconstruct_1.cc euler_conserved_flux_1.cc euler_flux_1.cc euler_rhs_1.cc Boundaries.cc