aboutsummaryrefslogtreecommitdiff
path: root/Examples/EulerAuto/src
diff options
context:
space:
mode:
Diffstat (limited to 'Examples/EulerAuto/src')
-rw-r--r--Examples/EulerAuto/src/Boundaries.cc457
-rw-r--r--Examples/EulerAuto/src/Differencing.h12
-rw-r--r--Examples/EulerAuto/src/RegisterMoL.cc21
-rw-r--r--Examples/EulerAuto/src/RegisterSymmetries.cc194
-rw-r--r--Examples/EulerAuto/src/Startup.cc10
-rw-r--r--Examples/EulerAuto/src/eulerauto_cons_calc_conserved.cc128
-rw-r--r--Examples/EulerAuto/src/eulerauto_cons_calc_flux_1.cc206
-rw-r--r--Examples/EulerAuto/src/eulerauto_cons_calc_flux_2.cc206
-rw-r--r--Examples/EulerAuto/src/eulerauto_cons_calc_flux_3.cc206
-rw-r--r--Examples/EulerAuto/src/eulerauto_cons_calc_intercell_conserved_1.cc149
-rw-r--r--Examples/EulerAuto/src/eulerauto_cons_calc_intercell_conserved_2.cc149
-rw-r--r--Examples/EulerAuto/src/eulerauto_cons_calc_intercell_conserved_3.cc149
-rw-r--r--Examples/EulerAuto/src/eulerauto_cons_calc_primitives.cc128
-rw-r--r--Examples/EulerAuto/src/eulerauto_cons_calc_reconstruct_1.cc207
-rw-r--r--Examples/EulerAuto/src/eulerauto_cons_calc_reconstruct_2.cc207
-rw-r--r--Examples/EulerAuto/src/eulerauto_cons_calc_reconstruct_3.cc207
-rw-r--r--Examples/EulerAuto/src/eulerauto_cons_calc_rhs_1.cc156
-rw-r--r--Examples/EulerAuto/src/eulerauto_cons_calc_rhs_2.cc156
-rw-r--r--Examples/EulerAuto/src/eulerauto_cons_calc_rhs_3.cc156
-rw-r--r--Examples/EulerAuto/src/eulerauto_cons_calc_zero_rhs.cc142
-rw-r--r--Examples/EulerAuto/src/eulerauto_initial_shock.cc126
-rw-r--r--Examples/EulerAuto/src/make.code.defn3
22 files changed, 3375 insertions, 0 deletions
diff --git a/Examples/EulerAuto/src/Boundaries.cc b/Examples/EulerAuto/src/Boundaries.cc
new file mode 100644
index 0000000..8d3fdb0
--- /dev/null
+++ b/Examples/EulerAuto/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 EulerAuto_CheckBoundaries(CCTK_ARGUMENTS)
+{
+ DECLARE_CCTK_ARGUMENTS;
+ DECLARE_CCTK_PARAMETERS;
+
+ return;
+}
+
+extern "C" void EulerAuto_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,
+ "EulerAuto::Den_group", Den_group_bound);
+ if (ierr < 0)
+ CCTK_WARN(0, "Failed to register Den_group_bound BC for EulerAuto::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,
+ "EulerAuto::En_group", En_group_bound);
+ if (ierr < 0)
+ CCTK_WARN(0, "Failed to register En_group_bound BC for EulerAuto::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,
+ "EulerAuto::S_group", S_group_bound);
+ if (ierr < 0)
+ CCTK_WARN(0, "Failed to register S_group_bound BC for EulerAuto::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,
+ "EulerAuto::Den", Den_bound);
+ if (ierr < 0)
+ CCTK_WARN(0, "Failed to register Den_bound BC for EulerAuto::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,
+ "EulerAuto::En", En_bound);
+ if (ierr < 0)
+ CCTK_WARN(0, "Failed to register En_bound BC for EulerAuto::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,
+ "EulerAuto::S1", S1_bound);
+ if (ierr < 0)
+ CCTK_WARN(0, "Failed to register S1_bound BC for EulerAuto::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,
+ "EulerAuto::S2", S2_bound);
+ if (ierr < 0)
+ CCTK_WARN(0, "Failed to register S2_bound BC for EulerAuto::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,
+ "EulerAuto::S3", S3_bound);
+ if (ierr < 0)
+ CCTK_WARN(0, "Failed to register S3_bound BC for EulerAuto::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,
+ "EulerAuto::Den_group", "Radiation");
+
+ if (ierr < 0)
+ CCTK_WARN(0, "Failed to register Radiation BC for EulerAuto::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,
+ "EulerAuto::En_group", "Radiation");
+
+ if (ierr < 0)
+ CCTK_WARN(0, "Failed to register Radiation BC for EulerAuto::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,
+ "EulerAuto::S_group", "Radiation");
+
+ if (ierr < 0)
+ CCTK_WARN(0, "Failed to register Radiation BC for EulerAuto::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,
+ "EulerAuto::Den", "Radiation");
+
+ if (ierr < 0)
+ CCTK_WARN(0, "Failed to register Radiation BC for EulerAuto::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,
+ "EulerAuto::En", "Radiation");
+
+ if (ierr < 0)
+ CCTK_WARN(0, "Failed to register Radiation BC for EulerAuto::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,
+ "EulerAuto::S1", "Radiation");
+
+ if (ierr < 0)
+ CCTK_WARN(0, "Failed to register Radiation BC for EulerAuto::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,
+ "EulerAuto::S2", "Radiation");
+
+ if (ierr < 0)
+ CCTK_WARN(0, "Failed to register Radiation BC for EulerAuto::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,
+ "EulerAuto::S3", "Radiation");
+
+ if (ierr < 0)
+ CCTK_WARN(0, "Failed to register Radiation BC for EulerAuto::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,
+ "EulerAuto::Den_group", "scalar");
+
+ if (ierr < 0)
+ CCTK_WARN(0, "Failed to register Scalar BC for EulerAuto::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,
+ "EulerAuto::En_group", "scalar");
+
+ if (ierr < 0)
+ CCTK_WARN(0, "Failed to register Scalar BC for EulerAuto::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,
+ "EulerAuto::S_group", "scalar");
+
+ if (ierr < 0)
+ CCTK_WARN(0, "Failed to register Scalar BC for EulerAuto::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,
+ "EulerAuto::Den", "scalar");
+
+ if (ierr < 0)
+ CCTK_WARN(0, "Error in registering Scalar BC for EulerAuto::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,
+ "EulerAuto::En", "scalar");
+
+ if (ierr < 0)
+ CCTK_WARN(0, "Error in registering Scalar BC for EulerAuto::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,
+ "EulerAuto::S1", "scalar");
+
+ if (ierr < 0)
+ CCTK_WARN(0, "Error in registering Scalar BC for EulerAuto::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,
+ "EulerAuto::S2", "scalar");
+
+ if (ierr < 0)
+ CCTK_WARN(0, "Error in registering Scalar BC for EulerAuto::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,
+ "EulerAuto::S3", "scalar");
+
+ if (ierr < 0)
+ CCTK_WARN(0, "Error in registering Scalar BC for EulerAuto::S3!");
+
+ }
+ return;
+}
+
+
+
+/* template for entries in parameter file:
+#$bound$#EulerAuto::Den_group_bound = "skip"
+#$bound$#EulerAuto::Den_group_bound_speed = 1.0
+#$bound$#EulerAuto::Den_group_bound_limit = 0.0
+#$bound$#EulerAuto::Den_group_bound_scalar = 0.0
+
+#$bound$#EulerAuto::En_group_bound = "skip"
+#$bound$#EulerAuto::En_group_bound_speed = 1.0
+#$bound$#EulerAuto::En_group_bound_limit = 0.0
+#$bound$#EulerAuto::En_group_bound_scalar = 0.0
+
+#$bound$#EulerAuto::S_group_bound = "skip"
+#$bound$#EulerAuto::S_group_bound_speed = 1.0
+#$bound$#EulerAuto::S_group_bound_limit = 0.0
+#$bound$#EulerAuto::S_group_bound_scalar = 0.0
+
+#$bound$#EulerAuto::Den_bound = "skip"
+#$bound$#EulerAuto::Den_bound_speed = 1.0
+#$bound$#EulerAuto::Den_bound_limit = 0.0
+#$bound$#EulerAuto::Den_bound_scalar = 0.0
+
+#$bound$#EulerAuto::En_bound = "skip"
+#$bound$#EulerAuto::En_bound_speed = 1.0
+#$bound$#EulerAuto::En_bound_limit = 0.0
+#$bound$#EulerAuto::En_bound_scalar = 0.0
+
+#$bound$#EulerAuto::S1_bound = "skip"
+#$bound$#EulerAuto::S1_bound_speed = 1.0
+#$bound$#EulerAuto::S1_bound_limit = 0.0
+#$bound$#EulerAuto::S1_bound_scalar = 0.0
+
+#$bound$#EulerAuto::S2_bound = "skip"
+#$bound$#EulerAuto::S2_bound_speed = 1.0
+#$bound$#EulerAuto::S2_bound_limit = 0.0
+#$bound$#EulerAuto::S2_bound_scalar = 0.0
+
+#$bound$#EulerAuto::S3_bound = "skip"
+#$bound$#EulerAuto::S3_bound_speed = 1.0
+#$bound$#EulerAuto::S3_bound_limit = 0.0
+#$bound$#EulerAuto::S3_bound_scalar = 0.0
+
+*/
+
diff --git a/Examples/EulerAuto/src/Differencing.h b/Examples/EulerAuto/src/Differencing.h
new file mode 100644
index 0000000..0908172
--- /dev/null
+++ b/Examples/EulerAuto/src/Differencing.h
@@ -0,0 +1,12 @@
+#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)])
+#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)]))
diff --git a/Examples/EulerAuto/src/RegisterMoL.cc b/Examples/EulerAuto/src/RegisterMoL.cc
new file mode 100644
index 0000000..c01d0fd
--- /dev/null
+++ b/Examples/EulerAuto/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 EulerAuto_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("EulerAuto::Den"), CCTK_VarIndex("EulerAuto::Denrhs"));
+ ierr += MoLRegisterEvolved(CCTK_VarIndex("EulerAuto::En"), CCTK_VarIndex("EulerAuto::Enrhs"));
+ ierr += MoLRegisterEvolved(CCTK_VarIndex("EulerAuto::S1"), CCTK_VarIndex("EulerAuto::S1rhs"));
+ ierr += MoLRegisterEvolved(CCTK_VarIndex("EulerAuto::S2"), CCTK_VarIndex("EulerAuto::S2rhs"));
+ ierr += MoLRegisterEvolved(CCTK_VarIndex("EulerAuto::S3"), CCTK_VarIndex("EulerAuto::S3rhs"));
+ return;
+}
diff --git a/Examples/EulerAuto/src/RegisterSymmetries.cc b/Examples/EulerAuto/src/RegisterSymmetries.cc
new file mode 100644
index 0000000..45ee014
--- /dev/null
+++ b/Examples/EulerAuto/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 EulerAuto_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, "EulerAuto::Den");
+
+ sym[0] = 1;
+ sym[1] = 1;
+ sym[2] = 1;
+ SetCartSymVN(cctkGH, sym, "EulerAuto::En");
+
+ sym[0] = -1;
+ sym[1] = 1;
+ sym[2] = 1;
+ SetCartSymVN(cctkGH, sym, "EulerAuto::S1");
+
+ sym[0] = 1;
+ sym[1] = -1;
+ sym[2] = 1;
+ SetCartSymVN(cctkGH, sym, "EulerAuto::S2");
+
+ sym[0] = 1;
+ sym[1] = 1;
+ sym[2] = -1;
+ SetCartSymVN(cctkGH, sym, "EulerAuto::S3");
+
+ sym[0] = 1;
+ sym[1] = 1;
+ sym[2] = 1;
+ SetCartSymVN(cctkGH, sym, "EulerAuto::DenFlux");
+
+ sym[0] = 1;
+ sym[1] = 1;
+ sym[2] = 1;
+ SetCartSymVN(cctkGH, sym, "EulerAuto::DenLeft");
+
+ sym[0] = 1;
+ sym[1] = 1;
+ sym[2] = 1;
+ SetCartSymVN(cctkGH, sym, "EulerAuto::DenRight");
+
+ sym[0] = 1;
+ sym[1] = 1;
+ sym[2] = 1;
+ SetCartSymVN(cctkGH, sym, "EulerAuto::EnFlux");
+
+ sym[0] = 1;
+ sym[1] = 1;
+ sym[2] = 1;
+ SetCartSymVN(cctkGH, sym, "EulerAuto::EnLeft");
+
+ sym[0] = 1;
+ sym[1] = 1;
+ sym[2] = 1;
+ SetCartSymVN(cctkGH, sym, "EulerAuto::EnRight");
+
+ sym[0] = 1;
+ sym[1] = 1;
+ sym[2] = 1;
+ SetCartSymVN(cctkGH, sym, "EulerAuto::p");
+
+ sym[0] = 1;
+ sym[1] = 1;
+ sym[2] = 1;
+ SetCartSymVN(cctkGH, sym, "EulerAuto::pLeft");
+
+ sym[0] = 1;
+ sym[1] = 1;
+ sym[2] = 1;
+ SetCartSymVN(cctkGH, sym, "EulerAuto::pRight");
+
+ sym[0] = 1;
+ sym[1] = 1;
+ sym[2] = 1;
+ SetCartSymVN(cctkGH, sym, "EulerAuto::rho");
+
+ sym[0] = 1;
+ sym[1] = 1;
+ sym[2] = 1;
+ SetCartSymVN(cctkGH, sym, "EulerAuto::rhoLeft");
+
+ sym[0] = 1;
+ sym[1] = 1;
+ sym[2] = 1;
+ SetCartSymVN(cctkGH, sym, "EulerAuto::rhoRight");
+
+ sym[0] = 1;
+ sym[1] = 1;
+ sym[2] = 1;
+ SetCartSymVN(cctkGH, sym, "EulerAuto::S1Flux");
+
+ sym[0] = 1;
+ sym[1] = 1;
+ sym[2] = 1;
+ SetCartSymVN(cctkGH, sym, "EulerAuto::S1Left");
+
+ sym[0] = 1;
+ sym[1] = 1;
+ sym[2] = 1;
+ SetCartSymVN(cctkGH, sym, "EulerAuto::S1Right");
+
+ sym[0] = 1;
+ sym[1] = 1;
+ sym[2] = 1;
+ SetCartSymVN(cctkGH, sym, "EulerAuto::S2Flux");
+
+ sym[0] = 1;
+ sym[1] = 1;
+ sym[2] = 1;
+ SetCartSymVN(cctkGH, sym, "EulerAuto::S2Left");
+
+ sym[0] = 1;
+ sym[1] = 1;
+ sym[2] = 1;
+ SetCartSymVN(cctkGH, sym, "EulerAuto::S2Right");
+
+ sym[0] = 1;
+ sym[1] = 1;
+ sym[2] = 1;
+ SetCartSymVN(cctkGH, sym, "EulerAuto::S3Flux");
+
+ sym[0] = 1;
+ sym[1] = 1;
+ sym[2] = 1;
+ SetCartSymVN(cctkGH, sym, "EulerAuto::S3Left");
+
+ sym[0] = 1;
+ sym[1] = 1;
+ sym[2] = 1;
+ SetCartSymVN(cctkGH, sym, "EulerAuto::S3Right");
+
+ sym[0] = 1;
+ sym[1] = 1;
+ sym[2] = 1;
+ SetCartSymVN(cctkGH, sym, "EulerAuto::v1Left");
+
+ sym[0] = 1;
+ sym[1] = 1;
+ sym[2] = 1;
+ SetCartSymVN(cctkGH, sym, "EulerAuto::v1Right");
+
+ sym[0] = 1;
+ sym[1] = 1;
+ sym[2] = 1;
+ SetCartSymVN(cctkGH, sym, "EulerAuto::v2Left");
+
+ sym[0] = 1;
+ sym[1] = 1;
+ sym[2] = 1;
+ SetCartSymVN(cctkGH, sym, "EulerAuto::v2Right");
+
+ sym[0] = 1;
+ sym[1] = 1;
+ sym[2] = 1;
+ SetCartSymVN(cctkGH, sym, "EulerAuto::v3Left");
+
+ sym[0] = 1;
+ sym[1] = 1;
+ sym[2] = 1;
+ SetCartSymVN(cctkGH, sym, "EulerAuto::v3Right");
+
+ sym[0] = -1;
+ sym[1] = 1;
+ sym[2] = 1;
+ SetCartSymVN(cctkGH, sym, "EulerAuto::v1");
+
+ sym[0] = 1;
+ sym[1] = -1;
+ sym[2] = 1;
+ SetCartSymVN(cctkGH, sym, "EulerAuto::v2");
+
+ sym[0] = 1;
+ sym[1] = 1;
+ sym[2] = -1;
+ SetCartSymVN(cctkGH, sym, "EulerAuto::v3");
+
+}
diff --git a/Examples/EulerAuto/src/Startup.cc b/Examples/EulerAuto/src/Startup.cc
new file mode 100644
index 0000000..419637c
--- /dev/null
+++ b/Examples/EulerAuto/src/Startup.cc
@@ -0,0 +1,10 @@
+/* File produced by Kranc */
+
+#include "cctk.h"
+
+extern "C" int EulerAuto_Startup(void)
+{
+ const char * banner = "EulerAuto";
+ CCTK_RegisterBanner(banner);
+ return 0;
+}
diff --git a/Examples/EulerAuto/src/eulerauto_cons_calc_conserved.cc b/Examples/EulerAuto/src/eulerauto_cons_calc_conserved.cc
new file mode 100644
index 0000000..9f483da
--- /dev/null
+++ b/Examples/EulerAuto/src/eulerauto_cons_calc_conserved.cc
@@ -0,0 +1,128 @@
+/* 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 eulerauto_cons_calc_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 eulerauto_cons_calc_conserved_Body");
+ }
+
+ if (cctk_iteration % eulerauto_cons_calc_conserved_calc_every != eulerauto_cons_calc_conserved_calc_offset)
+ {
+ return;
+ }
+
+ const char *groups[] = {"EulerAuto::Den_group","EulerAuto::En_group","EulerAuto::p_group","EulerAuto::rho_group","EulerAuto::S_group","EulerAuto::v_group"};
+ GenericFD_AssertGroupStorage(cctkGH, "eulerauto_cons_calc_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 p1odx = INV(dx);
+ CCTK_REAL const p1ody = INV(dy);
+ CCTK_REAL const p1odz = 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 eulerauto_cons_calc_conserved(CCTK_ARGUMENTS)
+{
+ DECLARE_CCTK_ARGUMENTS;
+ DECLARE_CCTK_PARAMETERS;
+
+ GenericFD_LoopOverEverything(cctkGH, &eulerauto_cons_calc_conserved_Body);
+}
diff --git a/Examples/EulerAuto/src/eulerauto_cons_calc_flux_1.cc b/Examples/EulerAuto/src/eulerauto_cons_calc_flux_1.cc
new file mode 100644
index 0000000..579c9dc
--- /dev/null
+++ b/Examples/EulerAuto/src/eulerauto_cons_calc_flux_1.cc
@@ -0,0 +1,206 @@
+/* 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 eulerauto_cons_calc_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 */, "EulerAuto::Den_flux_group","flat");
+ if (ierr < 0)
+ CCTK_WARN(1, "Failed to register flat BC for EulerAuto::Den_flux_group.");
+ ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "EulerAuto::En_flux_group","flat");
+ if (ierr < 0)
+ CCTK_WARN(1, "Failed to register flat BC for EulerAuto::En_flux_group.");
+ ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "EulerAuto::S1_flux_group","flat");
+ if (ierr < 0)
+ CCTK_WARN(1, "Failed to register flat BC for EulerAuto::S1_flux_group.");
+ ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "EulerAuto::S2_flux_group","flat");
+ if (ierr < 0)
+ CCTK_WARN(1, "Failed to register flat BC for EulerAuto::S2_flux_group.");
+ ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "EulerAuto::S3_flux_group","flat");
+ if (ierr < 0)
+ CCTK_WARN(1, "Failed to register flat BC for EulerAuto::S3_flux_group.");
+ return;
+}
+
+static void eulerauto_cons_calc_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 eulerauto_cons_calc_flux_1_Body");
+ }
+
+ if (cctk_iteration % eulerauto_cons_calc_flux_1_calc_every != eulerauto_cons_calc_flux_1_calc_offset)
+ {
+ return;
+ }
+
+ const char *groups[] = {"EulerAuto::Den_flux_group","EulerAuto::Den_lr_group","EulerAuto::En_flux_group","EulerAuto::En_lr_group","EulerAuto::p_lr_group","EulerAuto::rho_lr_group","EulerAuto::S1_flux_group","EulerAuto::S1_lr_group","EulerAuto::S2_flux_group","EulerAuto::S2_lr_group","EulerAuto::S3_flux_group","EulerAuto::S3_lr_group","EulerAuto::v1_lr_group","EulerAuto::v2_lr_group","EulerAuto::v3_lr_group"};
+ GenericFD_AssertGroupStorage(cctkGH, "eulerauto_cons_calc_flux_1", 15, groups);
+
+ GenericFD_EnsureStencilFits(cctkGH, "eulerauto_cons_calc_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 p1odx = INV(dx);
+ CCTK_REAL const p1ody = INV(dy);
+ CCTK_REAL const p1odz = 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 S1LeftL = S1Left[index];
+ CCTK_REAL S1RightL = S1Right[index];
+ CCTK_REAL S2LeftL = S2Left[index];
+ CCTK_REAL S2RightL = S2Right[index];
+ CCTK_REAL S3LeftL = S3Left[index];
+ CCTK_REAL S3RightL = S3Right[index];
+ CCTK_REAL v1LeftL = v1Left[index];
+ CCTK_REAL v1RightL = v1Right[index];
+ CCTK_REAL v2LeftL = v2Left[index];
+ CCTK_REAL v2RightL = v2Right[index];
+ CCTK_REAL v3LeftL = v3Left[index];
+ CCTK_REAL v3RightL = v3Right[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 ShiftMinus1S1Right = ShiftMinus1(&S1Right[index]);
+ CCTK_REAL const ShiftMinus1S2Right = ShiftMinus1(&S2Right[index]);
+ CCTK_REAL const ShiftMinus1S3Right = ShiftMinus1(&S3Right[index]);
+ CCTK_REAL const ShiftMinus1v1Right = ShiftMinus1(&v1Right[index]);
+ CCTK_REAL const ShiftMinus1v2Right = ShiftMinus1(&v2Right[index]);
+ CCTK_REAL const ShiftMinus1v3Right = ShiftMinus1(&v3Right[index]);
+
+ /* Calculate temporaries and grid functions */
+ CCTK_REAL DenFluxLeft = rhoLeftL*v1LeftL;
+
+ CCTK_REAL DenFluxRight = ShiftMinus1rhoRight*ShiftMinus1v1Right;
+
+ CCTK_REAL DenFluxL = 0.5*(DenFluxLeft + DenFluxRight + (-DenLeftL +
+ ShiftMinus1DenRight)*ToReal(hlleAlpha));
+
+ CCTK_REAL S1FluxLeft = pLeftL + rhoLeftL*SQR(v1LeftL);
+
+ CCTK_REAL S1FluxRight = ShiftMinus1pRight +
+ ShiftMinus1rhoRight*SQR(ShiftMinus1v1Right);
+
+ CCTK_REAL S1FluxL = 0.5*(S1FluxLeft + S1FluxRight + (-S1LeftL +
+ ShiftMinus1S1Right)*ToReal(hlleAlpha));
+
+ CCTK_REAL S2FluxLeft = rhoLeftL*v1LeftL*v2LeftL;
+
+ CCTK_REAL S2FluxRight =
+ ShiftMinus1rhoRight*ShiftMinus1v1Right*ShiftMinus1v2Right;
+
+ CCTK_REAL S2FluxL = 0.5*(S2FluxLeft + S2FluxRight + (-S2LeftL +
+ ShiftMinus1S2Right)*ToReal(hlleAlpha));
+
+ CCTK_REAL S3FluxLeft = rhoLeftL*v1LeftL*v3LeftL;
+
+ CCTK_REAL S3FluxRight =
+ ShiftMinus1rhoRight*ShiftMinus1v1Right*ShiftMinus1v3Right;
+
+ CCTK_REAL S3FluxL = 0.5*(S3FluxLeft + S3FluxRight + (-S3LeftL +
+ ShiftMinus1S3Right)*ToReal(hlleAlpha));
+
+ CCTK_REAL EnFluxLeft = (EnLeftL + pLeftL)*v1LeftL;
+
+ CCTK_REAL EnFluxRight = (ShiftMinus1EnRight +
+ ShiftMinus1pRight)*ShiftMinus1v1Right;
+
+ CCTK_REAL EnFluxL = 0.5*(EnFluxLeft + EnFluxRight + (-EnLeftL +
+ ShiftMinus1EnRight)*ToReal(hlleAlpha));
+
+ /* Copy local copies back to grid functions */
+ DenFlux[index] = DenFluxL;
+ EnFlux[index] = EnFluxL;
+ S1Flux[index] = S1FluxL;
+ S2Flux[index] = S2FluxL;
+ S3Flux[index] = S3FluxL;
+ }
+ }
+ }
+}
+
+extern "C" void eulerauto_cons_calc_flux_1(CCTK_ARGUMENTS)
+{
+ DECLARE_CCTK_ARGUMENTS;
+ DECLARE_CCTK_PARAMETERS;
+
+ GenericFD_LoopOverInterior(cctkGH, &eulerauto_cons_calc_flux_1_Body);
+}
diff --git a/Examples/EulerAuto/src/eulerauto_cons_calc_flux_2.cc b/Examples/EulerAuto/src/eulerauto_cons_calc_flux_2.cc
new file mode 100644
index 0000000..cf67145
--- /dev/null
+++ b/Examples/EulerAuto/src/eulerauto_cons_calc_flux_2.cc
@@ -0,0 +1,206 @@
+/* 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 eulerauto_cons_calc_flux_2_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 */, "EulerAuto::Den_flux_group","flat");
+ if (ierr < 0)
+ CCTK_WARN(1, "Failed to register flat BC for EulerAuto::Den_flux_group.");
+ ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "EulerAuto::En_flux_group","flat");
+ if (ierr < 0)
+ CCTK_WARN(1, "Failed to register flat BC for EulerAuto::En_flux_group.");
+ ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "EulerAuto::S1_flux_group","flat");
+ if (ierr < 0)
+ CCTK_WARN(1, "Failed to register flat BC for EulerAuto::S1_flux_group.");
+ ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "EulerAuto::S2_flux_group","flat");
+ if (ierr < 0)
+ CCTK_WARN(1, "Failed to register flat BC for EulerAuto::S2_flux_group.");
+ ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "EulerAuto::S3_flux_group","flat");
+ if (ierr < 0)
+ CCTK_WARN(1, "Failed to register flat BC for EulerAuto::S3_flux_group.");
+ return;
+}
+
+static void eulerauto_cons_calc_flux_2_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 eulerauto_cons_calc_flux_2_Body");
+ }
+
+ if (cctk_iteration % eulerauto_cons_calc_flux_2_calc_every != eulerauto_cons_calc_flux_2_calc_offset)
+ {
+ return;
+ }
+
+ const char *groups[] = {"EulerAuto::Den_flux_group","EulerAuto::Den_lr_group","EulerAuto::En_flux_group","EulerAuto::En_lr_group","EulerAuto::p_lr_group","EulerAuto::rho_lr_group","EulerAuto::S1_flux_group","EulerAuto::S1_lr_group","EulerAuto::S2_flux_group","EulerAuto::S2_lr_group","EulerAuto::S3_flux_group","EulerAuto::S3_lr_group","EulerAuto::v1_lr_group","EulerAuto::v2_lr_group","EulerAuto::v3_lr_group"};
+ GenericFD_AssertGroupStorage(cctkGH, "eulerauto_cons_calc_flux_2", 15, groups);
+
+ GenericFD_EnsureStencilFits(cctkGH, "eulerauto_cons_calc_flux_2", 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 p1odx = INV(dx);
+ CCTK_REAL const p1ody = INV(dy);
+ CCTK_REAL const p1odz = 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 S1LeftL = S1Left[index];
+ CCTK_REAL S1RightL = S1Right[index];
+ CCTK_REAL S2LeftL = S2Left[index];
+ CCTK_REAL S2RightL = S2Right[index];
+ CCTK_REAL S3LeftL = S3Left[index];
+ CCTK_REAL S3RightL = S3Right[index];
+ CCTK_REAL v1LeftL = v1Left[index];
+ CCTK_REAL v1RightL = v1Right[index];
+ CCTK_REAL v2LeftL = v2Left[index];
+ CCTK_REAL v2RightL = v2Right[index];
+ CCTK_REAL v3LeftL = v3Left[index];
+ CCTK_REAL v3RightL = v3Right[index];
+
+
+ /* Include user supplied include files */
+
+ /* Precompute derivatives */
+ CCTK_REAL const ShiftMinus2DenRight = ShiftMinus2(&DenRight[index]);
+ CCTK_REAL const ShiftMinus2EnRight = ShiftMinus2(&EnRight[index]);
+ CCTK_REAL const ShiftMinus2pRight = ShiftMinus2(&pRight[index]);
+ CCTK_REAL const ShiftMinus2rhoRight = ShiftMinus2(&rhoRight[index]);
+ CCTK_REAL const ShiftMinus2S1Right = ShiftMinus2(&S1Right[index]);
+ CCTK_REAL const ShiftMinus2S2Right = ShiftMinus2(&S2Right[index]);
+ CCTK_REAL const ShiftMinus2S3Right = ShiftMinus2(&S3Right[index]);
+ CCTK_REAL const ShiftMinus2v1Right = ShiftMinus2(&v1Right[index]);
+ CCTK_REAL const ShiftMinus2v2Right = ShiftMinus2(&v2Right[index]);
+ CCTK_REAL const ShiftMinus2v3Right = ShiftMinus2(&v3Right[index]);
+
+ /* Calculate temporaries and grid functions */
+ CCTK_REAL DenFluxLeft = rhoLeftL*v2LeftL;
+
+ CCTK_REAL DenFluxRight = ShiftMinus2rhoRight*ShiftMinus2v2Right;
+
+ CCTK_REAL DenFluxL = 0.5*(DenFluxLeft + DenFluxRight + (-DenLeftL +
+ ShiftMinus2DenRight)*ToReal(hlleAlpha));
+
+ CCTK_REAL S1FluxLeft = rhoLeftL*v1LeftL*v2LeftL;
+
+ CCTK_REAL S1FluxRight =
+ ShiftMinus2rhoRight*ShiftMinus2v1Right*ShiftMinus2v2Right;
+
+ CCTK_REAL S1FluxL = 0.5*(S1FluxLeft + S1FluxRight + (-S1LeftL +
+ ShiftMinus2S1Right)*ToReal(hlleAlpha));
+
+ CCTK_REAL S2FluxLeft = pLeftL + rhoLeftL*SQR(v2LeftL);
+
+ CCTK_REAL S2FluxRight = ShiftMinus2pRight +
+ ShiftMinus2rhoRight*SQR(ShiftMinus2v2Right);
+
+ CCTK_REAL S2FluxL = 0.5*(S2FluxLeft + S2FluxRight + (-S2LeftL +
+ ShiftMinus2S2Right)*ToReal(hlleAlpha));
+
+ CCTK_REAL S3FluxLeft = rhoLeftL*v2LeftL*v3LeftL;
+
+ CCTK_REAL S3FluxRight =
+ ShiftMinus2rhoRight*ShiftMinus2v2Right*ShiftMinus2v3Right;
+
+ CCTK_REAL S3FluxL = 0.5*(S3FluxLeft + S3FluxRight + (-S3LeftL +
+ ShiftMinus2S3Right)*ToReal(hlleAlpha));
+
+ CCTK_REAL EnFluxLeft = (EnLeftL + pLeftL)*v2LeftL;
+
+ CCTK_REAL EnFluxRight = (ShiftMinus2EnRight +
+ ShiftMinus2pRight)*ShiftMinus2v2Right;
+
+ CCTK_REAL EnFluxL = 0.5*(EnFluxLeft + EnFluxRight + (-EnLeftL +
+ ShiftMinus2EnRight)*ToReal(hlleAlpha));
+
+ /* Copy local copies back to grid functions */
+ DenFlux[index] = DenFluxL;
+ EnFlux[index] = EnFluxL;
+ S1Flux[index] = S1FluxL;
+ S2Flux[index] = S2FluxL;
+ S3Flux[index] = S3FluxL;
+ }
+ }
+ }
+}
+
+extern "C" void eulerauto_cons_calc_flux_2(CCTK_ARGUMENTS)
+{
+ DECLARE_CCTK_ARGUMENTS;
+ DECLARE_CCTK_PARAMETERS;
+
+ GenericFD_LoopOverInterior(cctkGH, &eulerauto_cons_calc_flux_2_Body);
+}
diff --git a/Examples/EulerAuto/src/eulerauto_cons_calc_flux_3.cc b/Examples/EulerAuto/src/eulerauto_cons_calc_flux_3.cc
new file mode 100644
index 0000000..797da55
--- /dev/null
+++ b/Examples/EulerAuto/src/eulerauto_cons_calc_flux_3.cc
@@ -0,0 +1,206 @@
+/* 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 eulerauto_cons_calc_flux_3_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 */, "EulerAuto::Den_flux_group","flat");
+ if (ierr < 0)
+ CCTK_WARN(1, "Failed to register flat BC for EulerAuto::Den_flux_group.");
+ ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "EulerAuto::En_flux_group","flat");
+ if (ierr < 0)
+ CCTK_WARN(1, "Failed to register flat BC for EulerAuto::En_flux_group.");
+ ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "EulerAuto::S1_flux_group","flat");
+ if (ierr < 0)
+ CCTK_WARN(1, "Failed to register flat BC for EulerAuto::S1_flux_group.");
+ ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "EulerAuto::S2_flux_group","flat");
+ if (ierr < 0)
+ CCTK_WARN(1, "Failed to register flat BC for EulerAuto::S2_flux_group.");
+ ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "EulerAuto::S3_flux_group","flat");
+ if (ierr < 0)
+ CCTK_WARN(1, "Failed to register flat BC for EulerAuto::S3_flux_group.");
+ return;
+}
+
+static void eulerauto_cons_calc_flux_3_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 eulerauto_cons_calc_flux_3_Body");
+ }
+
+ if (cctk_iteration % eulerauto_cons_calc_flux_3_calc_every != eulerauto_cons_calc_flux_3_calc_offset)
+ {
+ return;
+ }
+
+ const char *groups[] = {"EulerAuto::Den_flux_group","EulerAuto::Den_lr_group","EulerAuto::En_flux_group","EulerAuto::En_lr_group","EulerAuto::p_lr_group","EulerAuto::rho_lr_group","EulerAuto::S1_flux_group","EulerAuto::S1_lr_group","EulerAuto::S2_flux_group","EulerAuto::S2_lr_group","EulerAuto::S3_flux_group","EulerAuto::S3_lr_group","EulerAuto::v1_lr_group","EulerAuto::v2_lr_group","EulerAuto::v3_lr_group"};
+ GenericFD_AssertGroupStorage(cctkGH, "eulerauto_cons_calc_flux_3", 15, groups);
+
+ GenericFD_EnsureStencilFits(cctkGH, "eulerauto_cons_calc_flux_3", 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 p1odx = INV(dx);
+ CCTK_REAL const p1ody = INV(dy);
+ CCTK_REAL const p1odz = 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 S1LeftL = S1Left[index];
+ CCTK_REAL S1RightL = S1Right[index];
+ CCTK_REAL S2LeftL = S2Left[index];
+ CCTK_REAL S2RightL = S2Right[index];
+ CCTK_REAL S3LeftL = S3Left[index];
+ CCTK_REAL S3RightL = S3Right[index];
+ CCTK_REAL v1LeftL = v1Left[index];
+ CCTK_REAL v1RightL = v1Right[index];
+ CCTK_REAL v2LeftL = v2Left[index];
+ CCTK_REAL v2RightL = v2Right[index];
+ CCTK_REAL v3LeftL = v3Left[index];
+ CCTK_REAL v3RightL = v3Right[index];
+
+
+ /* Include user supplied include files */
+
+ /* Precompute derivatives */
+ CCTK_REAL const ShiftMinus3DenRight = ShiftMinus3(&DenRight[index]);
+ CCTK_REAL const ShiftMinus3EnRight = ShiftMinus3(&EnRight[index]);
+ CCTK_REAL const ShiftMinus3pRight = ShiftMinus3(&pRight[index]);
+ CCTK_REAL const ShiftMinus3rhoRight = ShiftMinus3(&rhoRight[index]);
+ CCTK_REAL const ShiftMinus3S1Right = ShiftMinus3(&S1Right[index]);
+ CCTK_REAL const ShiftMinus3S2Right = ShiftMinus3(&S2Right[index]);
+ CCTK_REAL const ShiftMinus3S3Right = ShiftMinus3(&S3Right[index]);
+ CCTK_REAL const ShiftMinus3v1Right = ShiftMinus3(&v1Right[index]);
+ CCTK_REAL const ShiftMinus3v2Right = ShiftMinus3(&v2Right[index]);
+ CCTK_REAL const ShiftMinus3v3Right = ShiftMinus3(&v3Right[index]);
+
+ /* Calculate temporaries and grid functions */
+ CCTK_REAL DenFluxLeft = rhoLeftL*v3LeftL;
+
+ CCTK_REAL DenFluxRight = ShiftMinus3rhoRight*ShiftMinus3v3Right;
+
+ CCTK_REAL DenFluxL = 0.5*(DenFluxLeft + DenFluxRight + (-DenLeftL +
+ ShiftMinus3DenRight)*ToReal(hlleAlpha));
+
+ CCTK_REAL S1FluxLeft = rhoLeftL*v1LeftL*v3LeftL;
+
+ CCTK_REAL S1FluxRight =
+ ShiftMinus3rhoRight*ShiftMinus3v1Right*ShiftMinus3v3Right;
+
+ CCTK_REAL S1FluxL = 0.5*(S1FluxLeft + S1FluxRight + (-S1LeftL +
+ ShiftMinus3S1Right)*ToReal(hlleAlpha));
+
+ CCTK_REAL S2FluxLeft = rhoLeftL*v2LeftL*v3LeftL;
+
+ CCTK_REAL S2FluxRight =
+ ShiftMinus3rhoRight*ShiftMinus3v2Right*ShiftMinus3v3Right;
+
+ CCTK_REAL S2FluxL = 0.5*(S2FluxLeft + S2FluxRight + (-S2LeftL +
+ ShiftMinus3S2Right)*ToReal(hlleAlpha));
+
+ CCTK_REAL S3FluxLeft = pLeftL + rhoLeftL*SQR(v3LeftL);
+
+ CCTK_REAL S3FluxRight = ShiftMinus3pRight +
+ ShiftMinus3rhoRight*SQR(ShiftMinus3v3Right);
+
+ CCTK_REAL S3FluxL = 0.5*(S3FluxLeft + S3FluxRight + (-S3LeftL +
+ ShiftMinus3S3Right)*ToReal(hlleAlpha));
+
+ CCTK_REAL EnFluxLeft = (EnLeftL + pLeftL)*v3LeftL;
+
+ CCTK_REAL EnFluxRight = (ShiftMinus3EnRight +
+ ShiftMinus3pRight)*ShiftMinus3v3Right;
+
+ CCTK_REAL EnFluxL = 0.5*(EnFluxLeft + EnFluxRight + (-EnLeftL +
+ ShiftMinus3EnRight)*ToReal(hlleAlpha));
+
+ /* Copy local copies back to grid functions */
+ DenFlux[index] = DenFluxL;
+ EnFlux[index] = EnFluxL;
+ S1Flux[index] = S1FluxL;
+ S2Flux[index] = S2FluxL;
+ S3Flux[index] = S3FluxL;
+ }
+ }
+ }
+}
+
+extern "C" void eulerauto_cons_calc_flux_3(CCTK_ARGUMENTS)
+{
+ DECLARE_CCTK_ARGUMENTS;
+ DECLARE_CCTK_PARAMETERS;
+
+ GenericFD_LoopOverInterior(cctkGH, &eulerauto_cons_calc_flux_3_Body);
+}
diff --git a/Examples/EulerAuto/src/eulerauto_cons_calc_intercell_conserved_1.cc b/Examples/EulerAuto/src/eulerauto_cons_calc_intercell_conserved_1.cc
new file mode 100644
index 0000000..3f91fa6
--- /dev/null
+++ b/Examples/EulerAuto/src/eulerauto_cons_calc_intercell_conserved_1.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 eulerauto_cons_calc_intercell_conserved_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 eulerauto_cons_calc_intercell_conserved_1_Body");
+ }
+
+ if (cctk_iteration % eulerauto_cons_calc_intercell_conserved_1_calc_every != eulerauto_cons_calc_intercell_conserved_1_calc_offset)
+ {
+ return;
+ }
+
+ const char *groups[] = {"EulerAuto::Den_lr_group","EulerAuto::En_lr_group","EulerAuto::p_lr_group","EulerAuto::rho_lr_group","EulerAuto::S1_lr_group","EulerAuto::S2_lr_group","EulerAuto::S3_lr_group","EulerAuto::v1_lr_group","EulerAuto::v2_lr_group","EulerAuto::v3_lr_group"};
+ GenericFD_AssertGroupStorage(cctkGH, "eulerauto_cons_calc_intercell_conserved_1", 10, 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 p1odx = INV(dx);
+ CCTK_REAL const p1ody = INV(dy);
+ CCTK_REAL const p1odz = 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 v1LeftL = v1Left[index];
+ CCTK_REAL v1RightL = v1Right[index];
+ CCTK_REAL v2LeftL = v2Left[index];
+ CCTK_REAL v2RightL = v2Right[index];
+ CCTK_REAL v3LeftL = v3Left[index];
+ CCTK_REAL v3RightL = v3Right[index];
+
+
+ /* Include user supplied include files */
+
+ /* Precompute derivatives */
+
+ /* Calculate temporaries and grid functions */
+ CCTK_REAL DenLeftL = rhoLeftL;
+
+ CCTK_REAL S1LeftL = rhoLeftL*v1LeftL;
+
+ CCTK_REAL S2LeftL = rhoLeftL*v2LeftL;
+
+ CCTK_REAL S3LeftL = rhoLeftL*v3LeftL;
+
+ CCTK_REAL EnLeftL = pLeftL*INV(-1 + ToReal(gamma)) +
+ 0.5*rhoLeftL*(SQR(v1LeftL) + SQR(v2LeftL) + SQR(v3LeftL));
+
+ CCTK_REAL DenRightL = rhoRightL;
+
+ CCTK_REAL S1RightL = rhoRightL*v1RightL;
+
+ CCTK_REAL S2RightL = rhoRightL*v2RightL;
+
+ CCTK_REAL S3RightL = rhoRightL*v3RightL;
+
+ CCTK_REAL EnRightL = pRightL*INV(-1 + ToReal(gamma)) +
+ 0.5*rhoRightL*(SQR(v1RightL) + SQR(v2RightL) + SQR(v3RightL));
+
+ /* Copy local copies back to grid functions */
+ DenLeft[index] = DenLeftL;
+ DenRight[index] = DenRightL;
+ EnLeft[index] = EnLeftL;
+ EnRight[index] = EnRightL;
+ S1Left[index] = S1LeftL;
+ S1Right[index] = S1RightL;
+ S2Left[index] = S2LeftL;
+ S2Right[index] = S2RightL;
+ S3Left[index] = S3LeftL;
+ S3Right[index] = S3RightL;
+ }
+ }
+ }
+}
+
+extern "C" void eulerauto_cons_calc_intercell_conserved_1(CCTK_ARGUMENTS)
+{
+ DECLARE_CCTK_ARGUMENTS;
+ DECLARE_CCTK_PARAMETERS;
+
+ GenericFD_LoopOverEverything(cctkGH, &eulerauto_cons_calc_intercell_conserved_1_Body);
+}
diff --git a/Examples/EulerAuto/src/eulerauto_cons_calc_intercell_conserved_2.cc b/Examples/EulerAuto/src/eulerauto_cons_calc_intercell_conserved_2.cc
new file mode 100644
index 0000000..209949e
--- /dev/null
+++ b/Examples/EulerAuto/src/eulerauto_cons_calc_intercell_conserved_2.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 eulerauto_cons_calc_intercell_conserved_2_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 eulerauto_cons_calc_intercell_conserved_2_Body");
+ }
+
+ if (cctk_iteration % eulerauto_cons_calc_intercell_conserved_2_calc_every != eulerauto_cons_calc_intercell_conserved_2_calc_offset)
+ {
+ return;
+ }
+
+ const char *groups[] = {"EulerAuto::Den_lr_group","EulerAuto::En_lr_group","EulerAuto::p_lr_group","EulerAuto::rho_lr_group","EulerAuto::S1_lr_group","EulerAuto::S2_lr_group","EulerAuto::S3_lr_group","EulerAuto::v1_lr_group","EulerAuto::v2_lr_group","EulerAuto::v3_lr_group"};
+ GenericFD_AssertGroupStorage(cctkGH, "eulerauto_cons_calc_intercell_conserved_2", 10, 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 p1odx = INV(dx);
+ CCTK_REAL const p1ody = INV(dy);
+ CCTK_REAL const p1odz = 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 v1LeftL = v1Left[index];
+ CCTK_REAL v1RightL = v1Right[index];
+ CCTK_REAL v2LeftL = v2Left[index];
+ CCTK_REAL v2RightL = v2Right[index];
+ CCTK_REAL v3LeftL = v3Left[index];
+ CCTK_REAL v3RightL = v3Right[index];
+
+
+ /* Include user supplied include files */
+
+ /* Precompute derivatives */
+
+ /* Calculate temporaries and grid functions */
+ CCTK_REAL DenLeftL = rhoLeftL;
+
+ CCTK_REAL S1LeftL = rhoLeftL*v1LeftL;
+
+ CCTK_REAL S2LeftL = rhoLeftL*v2LeftL;
+
+ CCTK_REAL S3LeftL = rhoLeftL*v3LeftL;
+
+ CCTK_REAL EnLeftL = pLeftL*INV(-1 + ToReal(gamma)) +
+ 0.5*rhoLeftL*(SQR(v1LeftL) + SQR(v2LeftL) + SQR(v3LeftL));
+
+ CCTK_REAL DenRightL = rhoRightL;
+
+ CCTK_REAL S1RightL = rhoRightL*v1RightL;
+
+ CCTK_REAL S2RightL = rhoRightL*v2RightL;
+
+ CCTK_REAL S3RightL = rhoRightL*v3RightL;
+
+ CCTK_REAL EnRightL = pRightL*INV(-1 + ToReal(gamma)) +
+ 0.5*rhoRightL*(SQR(v1RightL) + SQR(v2RightL) + SQR(v3RightL));
+
+ /* Copy local copies back to grid functions */
+ DenLeft[index] = DenLeftL;
+ DenRight[index] = DenRightL;
+ EnLeft[index] = EnLeftL;
+ EnRight[index] = EnRightL;
+ S1Left[index] = S1LeftL;
+ S1Right[index] = S1RightL;
+ S2Left[index] = S2LeftL;
+ S2Right[index] = S2RightL;
+ S3Left[index] = S3LeftL;
+ S3Right[index] = S3RightL;
+ }
+ }
+ }
+}
+
+extern "C" void eulerauto_cons_calc_intercell_conserved_2(CCTK_ARGUMENTS)
+{
+ DECLARE_CCTK_ARGUMENTS;
+ DECLARE_CCTK_PARAMETERS;
+
+ GenericFD_LoopOverEverything(cctkGH, &eulerauto_cons_calc_intercell_conserved_2_Body);
+}
diff --git a/Examples/EulerAuto/src/eulerauto_cons_calc_intercell_conserved_3.cc b/Examples/EulerAuto/src/eulerauto_cons_calc_intercell_conserved_3.cc
new file mode 100644
index 0000000..9398982
--- /dev/null
+++ b/Examples/EulerAuto/src/eulerauto_cons_calc_intercell_conserved_3.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 eulerauto_cons_calc_intercell_conserved_3_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 eulerauto_cons_calc_intercell_conserved_3_Body");
+ }
+
+ if (cctk_iteration % eulerauto_cons_calc_intercell_conserved_3_calc_every != eulerauto_cons_calc_intercell_conserved_3_calc_offset)
+ {
+ return;
+ }
+
+ const char *groups[] = {"EulerAuto::Den_lr_group","EulerAuto::En_lr_group","EulerAuto::p_lr_group","EulerAuto::rho_lr_group","EulerAuto::S1_lr_group","EulerAuto::S2_lr_group","EulerAuto::S3_lr_group","EulerAuto::v1_lr_group","EulerAuto::v2_lr_group","EulerAuto::v3_lr_group"};
+ GenericFD_AssertGroupStorage(cctkGH, "eulerauto_cons_calc_intercell_conserved_3", 10, 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 p1odx = INV(dx);
+ CCTK_REAL const p1ody = INV(dy);
+ CCTK_REAL const p1odz = 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 v1LeftL = v1Left[index];
+ CCTK_REAL v1RightL = v1Right[index];
+ CCTK_REAL v2LeftL = v2Left[index];
+ CCTK_REAL v2RightL = v2Right[index];
+ CCTK_REAL v3LeftL = v3Left[index];
+ CCTK_REAL v3RightL = v3Right[index];
+
+
+ /* Include user supplied include files */
+
+ /* Precompute derivatives */
+
+ /* Calculate temporaries and grid functions */
+ CCTK_REAL DenLeftL = rhoLeftL;
+
+ CCTK_REAL S1LeftL = rhoLeftL*v1LeftL;
+
+ CCTK_REAL S2LeftL = rhoLeftL*v2LeftL;
+
+ CCTK_REAL S3LeftL = rhoLeftL*v3LeftL;
+
+ CCTK_REAL EnLeftL = pLeftL*INV(-1 + ToReal(gamma)) +
+ 0.5*rhoLeftL*(SQR(v1LeftL) + SQR(v2LeftL) + SQR(v3LeftL));
+
+ CCTK_REAL DenRightL = rhoRightL;
+
+ CCTK_REAL S1RightL = rhoRightL*v1RightL;
+
+ CCTK_REAL S2RightL = rhoRightL*v2RightL;
+
+ CCTK_REAL S3RightL = rhoRightL*v3RightL;
+
+ CCTK_REAL EnRightL = pRightL*INV(-1 + ToReal(gamma)) +
+ 0.5*rhoRightL*(SQR(v1RightL) + SQR(v2RightL) + SQR(v3RightL));
+
+ /* Copy local copies back to grid functions */
+ DenLeft[index] = DenLeftL;
+ DenRight[index] = DenRightL;
+ EnLeft[index] = EnLeftL;
+ EnRight[index] = EnRightL;
+ S1Left[index] = S1LeftL;
+ S1Right[index] = S1RightL;
+ S2Left[index] = S2LeftL;
+ S2Right[index] = S2RightL;
+ S3Left[index] = S3LeftL;
+ S3Right[index] = S3RightL;
+ }
+ }
+ }
+}
+
+extern "C" void eulerauto_cons_calc_intercell_conserved_3(CCTK_ARGUMENTS)
+{
+ DECLARE_CCTK_ARGUMENTS;
+ DECLARE_CCTK_PARAMETERS;
+
+ GenericFD_LoopOverEverything(cctkGH, &eulerauto_cons_calc_intercell_conserved_3_Body);
+}
diff --git a/Examples/EulerAuto/src/eulerauto_cons_calc_primitives.cc b/Examples/EulerAuto/src/eulerauto_cons_calc_primitives.cc
new file mode 100644
index 0000000..0a7228a
--- /dev/null
+++ b/Examples/EulerAuto/src/eulerauto_cons_calc_primitives.cc
@@ -0,0 +1,128 @@
+/* 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 eulerauto_cons_calc_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 eulerauto_cons_calc_primitives_Body");
+ }
+
+ if (cctk_iteration % eulerauto_cons_calc_primitives_calc_every != eulerauto_cons_calc_primitives_calc_offset)
+ {
+ return;
+ }
+
+ const char *groups[] = {"EulerAuto::Den_group","EulerAuto::En_group","EulerAuto::p_group","EulerAuto::rho_group","EulerAuto::S_group","EulerAuto::v_group"};
+ GenericFD_AssertGroupStorage(cctkGH, "eulerauto_cons_calc_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 p1odx = INV(dx);
+ CCTK_REAL const p1ody = INV(dy);
+ CCTK_REAL const p1odz = 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 eulerauto_cons_calc_primitives(CCTK_ARGUMENTS)
+{
+ DECLARE_CCTK_ARGUMENTS;
+ DECLARE_CCTK_PARAMETERS;
+
+ GenericFD_LoopOverEverything(cctkGH, &eulerauto_cons_calc_primitives_Body);
+}
diff --git a/Examples/EulerAuto/src/eulerauto_cons_calc_reconstruct_1.cc b/Examples/EulerAuto/src/eulerauto_cons_calc_reconstruct_1.cc
new file mode 100644
index 0000000..0506ef0
--- /dev/null
+++ b/Examples/EulerAuto/src/eulerauto_cons_calc_reconstruct_1.cc
@@ -0,0 +1,207 @@
+/* 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 eulerauto_cons_calc_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 */, "EulerAuto::p_lr_group","flat");
+ if (ierr < 0)
+ CCTK_WARN(1, "Failed to register flat BC for EulerAuto::p_lr_group.");
+ ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "EulerAuto::rho_lr_group","flat");
+ if (ierr < 0)
+ CCTK_WARN(1, "Failed to register flat BC for EulerAuto::rho_lr_group.");
+ ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "EulerAuto::v1_lr_group","flat");
+ if (ierr < 0)
+ CCTK_WARN(1, "Failed to register flat BC for EulerAuto::v1_lr_group.");
+ ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "EulerAuto::v2_lr_group","flat");
+ if (ierr < 0)
+ CCTK_WARN(1, "Failed to register flat BC for EulerAuto::v2_lr_group.");
+ ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "EulerAuto::v3_lr_group","flat");
+ if (ierr < 0)
+ CCTK_WARN(1, "Failed to register flat BC for EulerAuto::v3_lr_group.");
+ return;
+}
+
+static void eulerauto_cons_calc_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 eulerauto_cons_calc_reconstruct_1_Body");
+ }
+
+ if (cctk_iteration % eulerauto_cons_calc_reconstruct_1_calc_every != eulerauto_cons_calc_reconstruct_1_calc_offset)
+ {
+ return;
+ }
+
+ const char *groups[] = {"EulerAuto::p_group","EulerAuto::p_lr_group","EulerAuto::rho_group","EulerAuto::rho_lr_group","EulerAuto::v1_lr_group","EulerAuto::v2_lr_group","EulerAuto::v3_lr_group","EulerAuto::v_group"};
+ GenericFD_AssertGroupStorage(cctkGH, "eulerauto_cons_calc_reconstruct_1", 8, groups);
+
+ GenericFD_EnsureStencilFits(cctkGH, "eulerauto_cons_calc_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 p1odx = INV(dx);
+ CCTK_REAL const p1ody = INV(dy);
+ CCTK_REAL const p1odz = 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 v1LeftL = -0.5*slope + v1L;
+
+ CCTK_REAL v1RightL = 0.5*slope + v1L;
+
+ slopeL = DiffMinus1v2;
+
+ slopeR = DiffPlus1v2;
+
+ slope = VanLeer(slopeL,slopeR);
+
+ CCTK_REAL v2LeftL = -0.5*slope + v2L;
+
+ CCTK_REAL v2RightL = 0.5*slope + v2L;
+
+ slopeL = DiffMinus1v3;
+
+ slopeR = DiffPlus1v3;
+
+ slope = VanLeer(slopeL,slopeR);
+
+ CCTK_REAL v3LeftL = -0.5*slope + v3L;
+
+ CCTK_REAL v3RightL = 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;
+ v1Left[index] = v1LeftL;
+ v1Right[index] = v1RightL;
+ v2Left[index] = v2LeftL;
+ v2Right[index] = v2RightL;
+ v3Left[index] = v3LeftL;
+ v3Right[index] = v3RightL;
+ }
+ }
+ }
+}
+
+extern "C" void eulerauto_cons_calc_reconstruct_1(CCTK_ARGUMENTS)
+{
+ DECLARE_CCTK_ARGUMENTS;
+ DECLARE_CCTK_PARAMETERS;
+
+ GenericFD_LoopOverInterior(cctkGH, &eulerauto_cons_calc_reconstruct_1_Body);
+}
diff --git a/Examples/EulerAuto/src/eulerauto_cons_calc_reconstruct_2.cc b/Examples/EulerAuto/src/eulerauto_cons_calc_reconstruct_2.cc
new file mode 100644
index 0000000..f71f106
--- /dev/null
+++ b/Examples/EulerAuto/src/eulerauto_cons_calc_reconstruct_2.cc
@@ -0,0 +1,207 @@
+/* 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 eulerauto_cons_calc_reconstruct_2_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 */, "EulerAuto::p_lr_group","flat");
+ if (ierr < 0)
+ CCTK_WARN(1, "Failed to register flat BC for EulerAuto::p_lr_group.");
+ ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "EulerAuto::rho_lr_group","flat");
+ if (ierr < 0)
+ CCTK_WARN(1, "Failed to register flat BC for EulerAuto::rho_lr_group.");
+ ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "EulerAuto::v1_lr_group","flat");
+ if (ierr < 0)
+ CCTK_WARN(1, "Failed to register flat BC for EulerAuto::v1_lr_group.");
+ ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "EulerAuto::v2_lr_group","flat");
+ if (ierr < 0)
+ CCTK_WARN(1, "Failed to register flat BC for EulerAuto::v2_lr_group.");
+ ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "EulerAuto::v3_lr_group","flat");
+ if (ierr < 0)
+ CCTK_WARN(1, "Failed to register flat BC for EulerAuto::v3_lr_group.");
+ return;
+}
+
+static void eulerauto_cons_calc_reconstruct_2_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 eulerauto_cons_calc_reconstruct_2_Body");
+ }
+
+ if (cctk_iteration % eulerauto_cons_calc_reconstruct_2_calc_every != eulerauto_cons_calc_reconstruct_2_calc_offset)
+ {
+ return;
+ }
+
+ const char *groups[] = {"EulerAuto::p_group","EulerAuto::p_lr_group","EulerAuto::rho_group","EulerAuto::rho_lr_group","EulerAuto::v1_lr_group","EulerAuto::v2_lr_group","EulerAuto::v3_lr_group","EulerAuto::v_group"};
+ GenericFD_AssertGroupStorage(cctkGH, "eulerauto_cons_calc_reconstruct_2", 8, groups);
+
+ GenericFD_EnsureStencilFits(cctkGH, "eulerauto_cons_calc_reconstruct_2", 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 p1odx = INV(dx);
+ CCTK_REAL const p1ody = INV(dy);
+ CCTK_REAL const p1odz = 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 DiffPlus2p = DiffPlus2(&p[index]);
+ CCTK_REAL const DiffMinus2p = DiffMinus2(&p[index]);
+ CCTK_REAL const DiffPlus2rho = DiffPlus2(&rho[index]);
+ CCTK_REAL const DiffMinus2rho = DiffMinus2(&rho[index]);
+ CCTK_REAL const DiffPlus2v1 = DiffPlus2(&v1[index]);
+ CCTK_REAL const DiffMinus2v1 = DiffMinus2(&v1[index]);
+ CCTK_REAL const DiffPlus2v2 = DiffPlus2(&v2[index]);
+ CCTK_REAL const DiffMinus2v2 = DiffMinus2(&v2[index]);
+ CCTK_REAL const DiffPlus2v3 = DiffPlus2(&v3[index]);
+ CCTK_REAL const DiffMinus2v3 = DiffMinus2(&v3[index]);
+
+ /* Calculate temporaries and grid functions */
+ CCTK_REAL slopeL = DiffMinus2rho;
+
+ CCTK_REAL slopeR = DiffPlus2rho;
+
+ CCTK_REAL slope = VanLeer(slopeL,slopeR);
+
+ CCTK_REAL rhoLeftL = rhoL - 0.5*slope;
+
+ CCTK_REAL rhoRightL = rhoL + 0.5*slope;
+
+ slopeL = DiffMinus2v1;
+
+ slopeR = DiffPlus2v1;
+
+ slope = VanLeer(slopeL,slopeR);
+
+ CCTK_REAL v1LeftL = -0.5*slope + v1L;
+
+ CCTK_REAL v1RightL = 0.5*slope + v1L;
+
+ slopeL = DiffMinus2v2;
+
+ slopeR = DiffPlus2v2;
+
+ slope = VanLeer(slopeL,slopeR);
+
+ CCTK_REAL v2LeftL = -0.5*slope + v2L;
+
+ CCTK_REAL v2RightL = 0.5*slope + v2L;
+
+ slopeL = DiffMinus2v3;
+
+ slopeR = DiffPlus2v3;
+
+ slope = VanLeer(slopeL,slopeR);
+
+ CCTK_REAL v3LeftL = -0.5*slope + v3L;
+
+ CCTK_REAL v3RightL = 0.5*slope + v3L;
+
+ slopeL = DiffMinus2p;
+
+ slopeR = DiffPlus2p;
+
+ 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;
+ v1Left[index] = v1LeftL;
+ v1Right[index] = v1RightL;
+ v2Left[index] = v2LeftL;
+ v2Right[index] = v2RightL;
+ v3Left[index] = v3LeftL;
+ v3Right[index] = v3RightL;
+ }
+ }
+ }
+}
+
+extern "C" void eulerauto_cons_calc_reconstruct_2(CCTK_ARGUMENTS)
+{
+ DECLARE_CCTK_ARGUMENTS;
+ DECLARE_CCTK_PARAMETERS;
+
+ GenericFD_LoopOverInterior(cctkGH, &eulerauto_cons_calc_reconstruct_2_Body);
+}
diff --git a/Examples/EulerAuto/src/eulerauto_cons_calc_reconstruct_3.cc b/Examples/EulerAuto/src/eulerauto_cons_calc_reconstruct_3.cc
new file mode 100644
index 0000000..5204483
--- /dev/null
+++ b/Examples/EulerAuto/src/eulerauto_cons_calc_reconstruct_3.cc
@@ -0,0 +1,207 @@
+/* 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 eulerauto_cons_calc_reconstruct_3_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 */, "EulerAuto::p_lr_group","flat");
+ if (ierr < 0)
+ CCTK_WARN(1, "Failed to register flat BC for EulerAuto::p_lr_group.");
+ ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "EulerAuto::rho_lr_group","flat");
+ if (ierr < 0)
+ CCTK_WARN(1, "Failed to register flat BC for EulerAuto::rho_lr_group.");
+ ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "EulerAuto::v1_lr_group","flat");
+ if (ierr < 0)
+ CCTK_WARN(1, "Failed to register flat BC for EulerAuto::v1_lr_group.");
+ ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "EulerAuto::v2_lr_group","flat");
+ if (ierr < 0)
+ CCTK_WARN(1, "Failed to register flat BC for EulerAuto::v2_lr_group.");
+ ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "EulerAuto::v3_lr_group","flat");
+ if (ierr < 0)
+ CCTK_WARN(1, "Failed to register flat BC for EulerAuto::v3_lr_group.");
+ return;
+}
+
+static void eulerauto_cons_calc_reconstruct_3_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 eulerauto_cons_calc_reconstruct_3_Body");
+ }
+
+ if (cctk_iteration % eulerauto_cons_calc_reconstruct_3_calc_every != eulerauto_cons_calc_reconstruct_3_calc_offset)
+ {
+ return;
+ }
+
+ const char *groups[] = {"EulerAuto::p_group","EulerAuto::p_lr_group","EulerAuto::rho_group","EulerAuto::rho_lr_group","EulerAuto::v1_lr_group","EulerAuto::v2_lr_group","EulerAuto::v3_lr_group","EulerAuto::v_group"};
+ GenericFD_AssertGroupStorage(cctkGH, "eulerauto_cons_calc_reconstruct_3", 8, groups);
+
+ GenericFD_EnsureStencilFits(cctkGH, "eulerauto_cons_calc_reconstruct_3", 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 p1odx = INV(dx);
+ CCTK_REAL const p1ody = INV(dy);
+ CCTK_REAL const p1odz = 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 DiffPlus3p = DiffPlus3(&p[index]);
+ CCTK_REAL const DiffMinus3p = DiffMinus3(&p[index]);
+ CCTK_REAL const DiffPlus3rho = DiffPlus3(&rho[index]);
+ CCTK_REAL const DiffMinus3rho = DiffMinus3(&rho[index]);
+ CCTK_REAL const DiffPlus3v1 = DiffPlus3(&v1[index]);
+ CCTK_REAL const DiffMinus3v1 = DiffMinus3(&v1[index]);
+ CCTK_REAL const DiffPlus3v2 = DiffPlus3(&v2[index]);
+ CCTK_REAL const DiffMinus3v2 = DiffMinus3(&v2[index]);
+ CCTK_REAL const DiffPlus3v3 = DiffPlus3(&v3[index]);
+ CCTK_REAL const DiffMinus3v3 = DiffMinus3(&v3[index]);
+
+ /* Calculate temporaries and grid functions */
+ CCTK_REAL slopeL = DiffMinus3rho;
+
+ CCTK_REAL slopeR = DiffPlus3rho;
+
+ CCTK_REAL slope = VanLeer(slopeL,slopeR);
+
+ CCTK_REAL rhoLeftL = rhoL - 0.5*slope;
+
+ CCTK_REAL rhoRightL = rhoL + 0.5*slope;
+
+ slopeL = DiffMinus3v1;
+
+ slopeR = DiffPlus3v1;
+
+ slope = VanLeer(slopeL,slopeR);
+
+ CCTK_REAL v1LeftL = -0.5*slope + v1L;
+
+ CCTK_REAL v1RightL = 0.5*slope + v1L;
+
+ slopeL = DiffMinus3v2;
+
+ slopeR = DiffPlus3v2;
+
+ slope = VanLeer(slopeL,slopeR);
+
+ CCTK_REAL v2LeftL = -0.5*slope + v2L;
+
+ CCTK_REAL v2RightL = 0.5*slope + v2L;
+
+ slopeL = DiffMinus3v3;
+
+ slopeR = DiffPlus3v3;
+
+ slope = VanLeer(slopeL,slopeR);
+
+ CCTK_REAL v3LeftL = -0.5*slope + v3L;
+
+ CCTK_REAL v3RightL = 0.5*slope + v3L;
+
+ slopeL = DiffMinus3p;
+
+ slopeR = DiffPlus3p;
+
+ 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;
+ v1Left[index] = v1LeftL;
+ v1Right[index] = v1RightL;
+ v2Left[index] = v2LeftL;
+ v2Right[index] = v2RightL;
+ v3Left[index] = v3LeftL;
+ v3Right[index] = v3RightL;
+ }
+ }
+ }
+}
+
+extern "C" void eulerauto_cons_calc_reconstruct_3(CCTK_ARGUMENTS)
+{
+ DECLARE_CCTK_ARGUMENTS;
+ DECLARE_CCTK_PARAMETERS;
+
+ GenericFD_LoopOverInterior(cctkGH, &eulerauto_cons_calc_reconstruct_3_Body);
+}
diff --git a/Examples/EulerAuto/src/eulerauto_cons_calc_rhs_1.cc b/Examples/EulerAuto/src/eulerauto_cons_calc_rhs_1.cc
new file mode 100644
index 0000000..24e51d4
--- /dev/null
+++ b/Examples/EulerAuto/src/eulerauto_cons_calc_rhs_1.cc
@@ -0,0 +1,156 @@
+/* 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 eulerauto_cons_calc_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 */, "EulerAuto::Den_grouprhs","flat");
+ if (ierr < 0)
+ CCTK_WARN(1, "Failed to register flat BC for EulerAuto::Den_grouprhs.");
+ ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "EulerAuto::En_grouprhs","flat");
+ if (ierr < 0)
+ CCTK_WARN(1, "Failed to register flat BC for EulerAuto::En_grouprhs.");
+ ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "EulerAuto::S_grouprhs","flat");
+ if (ierr < 0)
+ CCTK_WARN(1, "Failed to register flat BC for EulerAuto::S_grouprhs.");
+ return;
+}
+
+static void eulerauto_cons_calc_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 eulerauto_cons_calc_rhs_1_Body");
+ }
+
+ if (cctk_iteration % eulerauto_cons_calc_rhs_1_calc_every != eulerauto_cons_calc_rhs_1_calc_offset)
+ {
+ return;
+ }
+
+ const char *groups[] = {"EulerAuto::Den_flux_group","EulerAuto::Den_grouprhs","EulerAuto::En_flux_group","EulerAuto::En_grouprhs","EulerAuto::S1_flux_group","EulerAuto::S2_flux_group","EulerAuto::S3_flux_group","EulerAuto::S_grouprhs"};
+ GenericFD_AssertGroupStorage(cctkGH, "eulerauto_cons_calc_rhs_1", 8, groups);
+
+ GenericFD_EnsureStencilFits(cctkGH, "eulerauto_cons_calc_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 p1odx = INV(dx);
+ CCTK_REAL const p1ody = INV(dy);
+ CCTK_REAL const p1odz = 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 DenFluxL = DenFlux[index];
+ CCTK_REAL DenrhsL = Denrhs[index];
+ CCTK_REAL EnFluxL = EnFlux[index];
+ CCTK_REAL EnrhsL = Enrhs[index];
+ CCTK_REAL S1FluxL = S1Flux[index];
+ CCTK_REAL S1rhsL = S1rhs[index];
+ CCTK_REAL S2FluxL = S2Flux[index];
+ CCTK_REAL S2rhsL = S2rhs[index];
+ CCTK_REAL S3FluxL = S3Flux[index];
+ CCTK_REAL S3rhsL = S3rhs[index];
+
+
+ /* Include user supplied include files */
+
+ /* Precompute derivatives */
+ CCTK_REAL const PDplus1DenFlux = PDplus1(&DenFlux[index]);
+ CCTK_REAL const PDplus1EnFlux = PDplus1(&EnFlux[index]);
+ CCTK_REAL const PDplus1S1Flux = PDplus1(&S1Flux[index]);
+ CCTK_REAL const PDplus1S2Flux = PDplus1(&S2Flux[index]);
+ CCTK_REAL const PDplus1S3Flux = PDplus1(&S3Flux[index]);
+
+ /* Calculate temporaries and grid functions */
+ DenrhsL = DenrhsL - PDplus1DenFlux;
+
+ EnrhsL = EnrhsL - PDplus1EnFlux;
+
+ S1rhsL = -PDplus1S1Flux + S1rhsL;
+
+ S2rhsL = -PDplus1S2Flux + S2rhsL;
+
+ S3rhsL = -PDplus1S3Flux + S3rhsL;
+
+ /* 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 eulerauto_cons_calc_rhs_1(CCTK_ARGUMENTS)
+{
+ DECLARE_CCTK_ARGUMENTS;
+ DECLARE_CCTK_PARAMETERS;
+
+ GenericFD_LoopOverInterior(cctkGH, &eulerauto_cons_calc_rhs_1_Body);
+}
diff --git a/Examples/EulerAuto/src/eulerauto_cons_calc_rhs_2.cc b/Examples/EulerAuto/src/eulerauto_cons_calc_rhs_2.cc
new file mode 100644
index 0000000..caee229
--- /dev/null
+++ b/Examples/EulerAuto/src/eulerauto_cons_calc_rhs_2.cc
@@ -0,0 +1,156 @@
+/* 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 eulerauto_cons_calc_rhs_2_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 */, "EulerAuto::Den_grouprhs","flat");
+ if (ierr < 0)
+ CCTK_WARN(1, "Failed to register flat BC for EulerAuto::Den_grouprhs.");
+ ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "EulerAuto::En_grouprhs","flat");
+ if (ierr < 0)
+ CCTK_WARN(1, "Failed to register flat BC for EulerAuto::En_grouprhs.");
+ ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "EulerAuto::S_grouprhs","flat");
+ if (ierr < 0)
+ CCTK_WARN(1, "Failed to register flat BC for EulerAuto::S_grouprhs.");
+ return;
+}
+
+static void eulerauto_cons_calc_rhs_2_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 eulerauto_cons_calc_rhs_2_Body");
+ }
+
+ if (cctk_iteration % eulerauto_cons_calc_rhs_2_calc_every != eulerauto_cons_calc_rhs_2_calc_offset)
+ {
+ return;
+ }
+
+ const char *groups[] = {"EulerAuto::Den_flux_group","EulerAuto::Den_grouprhs","EulerAuto::En_flux_group","EulerAuto::En_grouprhs","EulerAuto::S1_flux_group","EulerAuto::S2_flux_group","EulerAuto::S3_flux_group","EulerAuto::S_grouprhs"};
+ GenericFD_AssertGroupStorage(cctkGH, "eulerauto_cons_calc_rhs_2", 8, groups);
+
+ GenericFD_EnsureStencilFits(cctkGH, "eulerauto_cons_calc_rhs_2", 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 p1odx = INV(dx);
+ CCTK_REAL const p1ody = INV(dy);
+ CCTK_REAL const p1odz = 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 DenFluxL = DenFlux[index];
+ CCTK_REAL DenrhsL = Denrhs[index];
+ CCTK_REAL EnFluxL = EnFlux[index];
+ CCTK_REAL EnrhsL = Enrhs[index];
+ CCTK_REAL S1FluxL = S1Flux[index];
+ CCTK_REAL S1rhsL = S1rhs[index];
+ CCTK_REAL S2FluxL = S2Flux[index];
+ CCTK_REAL S2rhsL = S2rhs[index];
+ CCTK_REAL S3FluxL = S3Flux[index];
+ CCTK_REAL S3rhsL = S3rhs[index];
+
+
+ /* Include user supplied include files */
+
+ /* Precompute derivatives */
+ CCTK_REAL const PDplus2DenFlux = PDplus2(&DenFlux[index]);
+ CCTK_REAL const PDplus2EnFlux = PDplus2(&EnFlux[index]);
+ CCTK_REAL const PDplus2S1Flux = PDplus2(&S1Flux[index]);
+ CCTK_REAL const PDplus2S2Flux = PDplus2(&S2Flux[index]);
+ CCTK_REAL const PDplus2S3Flux = PDplus2(&S3Flux[index]);
+
+ /* Calculate temporaries and grid functions */
+ DenrhsL = DenrhsL - PDplus2DenFlux;
+
+ EnrhsL = EnrhsL - PDplus2EnFlux;
+
+ S1rhsL = -PDplus2S1Flux + S1rhsL;
+
+ S2rhsL = -PDplus2S2Flux + S2rhsL;
+
+ S3rhsL = -PDplus2S3Flux + S3rhsL;
+
+ /* 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 eulerauto_cons_calc_rhs_2(CCTK_ARGUMENTS)
+{
+ DECLARE_CCTK_ARGUMENTS;
+ DECLARE_CCTK_PARAMETERS;
+
+ GenericFD_LoopOverInterior(cctkGH, &eulerauto_cons_calc_rhs_2_Body);
+}
diff --git a/Examples/EulerAuto/src/eulerauto_cons_calc_rhs_3.cc b/Examples/EulerAuto/src/eulerauto_cons_calc_rhs_3.cc
new file mode 100644
index 0000000..f485670
--- /dev/null
+++ b/Examples/EulerAuto/src/eulerauto_cons_calc_rhs_3.cc
@@ -0,0 +1,156 @@
+/* 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 eulerauto_cons_calc_rhs_3_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 */, "EulerAuto::Den_grouprhs","flat");
+ if (ierr < 0)
+ CCTK_WARN(1, "Failed to register flat BC for EulerAuto::Den_grouprhs.");
+ ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "EulerAuto::En_grouprhs","flat");
+ if (ierr < 0)
+ CCTK_WARN(1, "Failed to register flat BC for EulerAuto::En_grouprhs.");
+ ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GenericFD_GetBoundaryWidth(cctkGH), -1 /* no table */, "EulerAuto::S_grouprhs","flat");
+ if (ierr < 0)
+ CCTK_WARN(1, "Failed to register flat BC for EulerAuto::S_grouprhs.");
+ return;
+}
+
+static void eulerauto_cons_calc_rhs_3_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 eulerauto_cons_calc_rhs_3_Body");
+ }
+
+ if (cctk_iteration % eulerauto_cons_calc_rhs_3_calc_every != eulerauto_cons_calc_rhs_3_calc_offset)
+ {
+ return;
+ }
+
+ const char *groups[] = {"EulerAuto::Den_flux_group","EulerAuto::Den_grouprhs","EulerAuto::En_flux_group","EulerAuto::En_grouprhs","EulerAuto::S1_flux_group","EulerAuto::S2_flux_group","EulerAuto::S3_flux_group","EulerAuto::S_grouprhs"};
+ GenericFD_AssertGroupStorage(cctkGH, "eulerauto_cons_calc_rhs_3", 8, groups);
+
+ GenericFD_EnsureStencilFits(cctkGH, "eulerauto_cons_calc_rhs_3", 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 p1odx = INV(dx);
+ CCTK_REAL const p1ody = INV(dy);
+ CCTK_REAL const p1odz = 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 DenFluxL = DenFlux[index];
+ CCTK_REAL DenrhsL = Denrhs[index];
+ CCTK_REAL EnFluxL = EnFlux[index];
+ CCTK_REAL EnrhsL = Enrhs[index];
+ CCTK_REAL S1FluxL = S1Flux[index];
+ CCTK_REAL S1rhsL = S1rhs[index];
+ CCTK_REAL S2FluxL = S2Flux[index];
+ CCTK_REAL S2rhsL = S2rhs[index];
+ CCTK_REAL S3FluxL = S3Flux[index];
+ CCTK_REAL S3rhsL = S3rhs[index];
+
+
+ /* Include user supplied include files */
+
+ /* Precompute derivatives */
+ CCTK_REAL const PDplus3DenFlux = PDplus3(&DenFlux[index]);
+ CCTK_REAL const PDplus3EnFlux = PDplus3(&EnFlux[index]);
+ CCTK_REAL const PDplus3S1Flux = PDplus3(&S1Flux[index]);
+ CCTK_REAL const PDplus3S2Flux = PDplus3(&S2Flux[index]);
+ CCTK_REAL const PDplus3S3Flux = PDplus3(&S3Flux[index]);
+
+ /* Calculate temporaries and grid functions */
+ DenrhsL = DenrhsL - PDplus3DenFlux;
+
+ EnrhsL = EnrhsL - PDplus3EnFlux;
+
+ S1rhsL = -PDplus3S1Flux + S1rhsL;
+
+ S2rhsL = -PDplus3S2Flux + S2rhsL;
+
+ S3rhsL = -PDplus3S3Flux + S3rhsL;
+
+ /* 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 eulerauto_cons_calc_rhs_3(CCTK_ARGUMENTS)
+{
+ DECLARE_CCTK_ARGUMENTS;
+ DECLARE_CCTK_PARAMETERS;
+
+ GenericFD_LoopOverInterior(cctkGH, &eulerauto_cons_calc_rhs_3_Body);
+}
diff --git a/Examples/EulerAuto/src/eulerauto_cons_calc_zero_rhs.cc b/Examples/EulerAuto/src/eulerauto_cons_calc_zero_rhs.cc
new file mode 100644
index 0000000..ba14718
--- /dev/null
+++ b/Examples/EulerAuto/src/eulerauto_cons_calc_zero_rhs.cc
@@ -0,0 +1,142 @@
+/* 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 eulerauto_cons_calc_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 eulerauto_cons_calc_zero_rhs_Body");
+ }
+
+ if (cctk_iteration % eulerauto_cons_calc_zero_rhs_calc_every != eulerauto_cons_calc_zero_rhs_calc_offset)
+ {
+ return;
+ }
+
+ const char *groups[] = {"EulerAuto::Den_grouprhs","EulerAuto::En_grouprhs","EulerAuto::S_grouprhs"};
+ GenericFD_AssertGroupStorage(cctkGH, "eulerauto_cons_calc_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 p1odx = INV(dx);
+ CCTK_REAL const p1ody = INV(dy);
+ CCTK_REAL const p1odz = 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;
+
+ DenrhsL = 0;
+
+ DenrhsL = 0;
+
+ CCTK_REAL S1rhsL = 0;
+
+ CCTK_REAL S2rhsL = 0;
+
+ CCTK_REAL S3rhsL = 0;
+
+ S1rhsL = 0;
+
+ S2rhsL = 0;
+
+ S3rhsL = 0;
+
+ S1rhsL = 0;
+
+ S2rhsL = 0;
+
+ S3rhsL = 0;
+
+ CCTK_REAL EnrhsL = 0;
+
+ EnrhsL = 0;
+
+ 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 eulerauto_cons_calc_zero_rhs(CCTK_ARGUMENTS)
+{
+ DECLARE_CCTK_ARGUMENTS;
+ DECLARE_CCTK_PARAMETERS;
+
+ GenericFD_LoopOverEverything(cctkGH, &eulerauto_cons_calc_zero_rhs_Body);
+}
diff --git a/Examples/EulerAuto/src/eulerauto_initial_shock.cc b/Examples/EulerAuto/src/eulerauto_initial_shock.cc
new file mode 100644
index 0000000..d4bf071
--- /dev/null
+++ b/Examples/EulerAuto/src/eulerauto_initial_shock.cc
@@ -0,0 +1,126 @@
+/* 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 eulerauto_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 eulerauto_initial_shock_Body");
+ }
+
+ if (cctk_iteration % eulerauto_initial_shock_calc_every != eulerauto_initial_shock_calc_offset)
+ {
+ return;
+ }
+
+ const char *groups[] = {"grid::coordinates","EulerAuto::p_group","EulerAuto::rho_group","EulerAuto::v_group"};
+ GenericFD_AssertGroupStorage(cctkGH, "eulerauto_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 p1odx = INV(dx);
+ CCTK_REAL const p1ody = INV(dy);
+ CCTK_REAL const p1odz = 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 eulerauto_initial_shock(CCTK_ARGUMENTS)
+{
+ DECLARE_CCTK_ARGUMENTS;
+ DECLARE_CCTK_PARAMETERS;
+
+ GenericFD_LoopOverEverything(cctkGH, &eulerauto_initial_shock_Body);
+}
diff --git a/Examples/EulerAuto/src/make.code.defn b/Examples/EulerAuto/src/make.code.defn
new file mode 100644
index 0000000..0e17ddb
--- /dev/null
+++ b/Examples/EulerAuto/src/make.code.defn
@@ -0,0 +1,3 @@
+# File produced by Kranc
+
+SRCS = Startup.cc RegisterMoL.cc RegisterSymmetries.cc eulerauto_initial_shock.cc eulerauto_cons_calc_zero_rhs.cc eulerauto_cons_calc_conserved.cc eulerauto_cons_calc_primitives.cc eulerauto_cons_calc_reconstruct_1.cc eulerauto_cons_calc_intercell_conserved_1.cc eulerauto_cons_calc_flux_1.cc eulerauto_cons_calc_rhs_1.cc eulerauto_cons_calc_reconstruct_2.cc eulerauto_cons_calc_intercell_conserved_2.cc eulerauto_cons_calc_flux_2.cc eulerauto_cons_calc_rhs_2.cc eulerauto_cons_calc_reconstruct_3.cc eulerauto_cons_calc_intercell_conserved_3.cc eulerauto_cons_calc_flux_3.cc eulerauto_cons_calc_rhs_3.cc Boundaries.cc