aboutsummaryrefslogtreecommitdiff
path: root/Examples/AdvectCaKernel/src
diff options
context:
space:
mode:
Diffstat (limited to 'Examples/AdvectCaKernel/src')
-rw-r--r--Examples/AdvectCaKernel/src/Boundaries.cc41
-rw-r--r--Examples/AdvectCaKernel/src/CaKernel__initial_gaussian.code67
-rw-r--r--Examples/AdvectCaKernel/src/Differencing.h12
-rw-r--r--Examples/AdvectCaKernel/src/RegisterMoL.cc18
-rw-r--r--Examples/AdvectCaKernel/src/RegisterSymmetries.cc24
-rw-r--r--Examples/AdvectCaKernel/src/Startup.cc10
-rw-r--r--Examples/AdvectCaKernel/src/make.code.defn8
7 files changed, 180 insertions, 0 deletions
diff --git a/Examples/AdvectCaKernel/src/Boundaries.cc b/Examples/AdvectCaKernel/src/Boundaries.cc
new file mode 100644
index 0000000..03d5618
--- /dev/null
+++ b/Examples/AdvectCaKernel/src/Boundaries.cc
@@ -0,0 +1,41 @@
+/* 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 AdvectCaKernel_CheckBoundaries(CCTK_ARGUMENTS)
+{
+ DECLARE_CCTK_ARGUMENTS;
+ DECLARE_CCTK_PARAMETERS;
+
+ return;
+}
+
+extern "C" void AdvectCaKernel_SelectBoundConds(CCTK_ARGUMENTS)
+{
+ DECLARE_CCTK_ARGUMENTS;
+ DECLARE_CCTK_PARAMETERS;
+
+ CCTK_INT ierr = 0;
+ return;
+}
+
+
+
+/* template for entries in parameter file:
+*/
+
diff --git a/Examples/AdvectCaKernel/src/CaKernel__initial_gaussian.code b/Examples/AdvectCaKernel/src/CaKernel__initial_gaussian.code
new file mode 100644
index 0000000..19ecad8
--- /dev/null
+++ b/Examples/AdvectCaKernel/src/CaKernel__initial_gaussian.code
@@ -0,0 +1,67 @@
+#undef KRANC_DIFF_FUNCTIONS
+#define KRANC_C
+#include "Differencing.h"
+#include "GenericFD.h"
+
+#define KRANC_GFOFFSET3D(u,i,j,k) I3D(u,i,j,k)
+
+
+/* Define macros used in calculations */
+#define INITVALUE (42)
+#define QAD(x) (SQR(SQR(x)))
+#define INV(x) ((1.0) / (x))
+#define SQR(x) ((x) * (x))
+#define CUB(x) ((x) * (x) * (x))
+
+CAKERNEL_initial_gaussian_Begin
+
+ /* Include user-supplied include files */
+
+ /* Initialise finite differencing variables */
+ CCTK_REAL const dx = params.cagh_dx;
+ CCTK_REAL const dy = params.cagh_dy;
+ CCTK_REAL const dz = params.cagh_dz;
+ CCTK_REAL const dt = params.cagh_dt;
+ CCTK_REAL const t = params.cagh_time;
+ CCTK_REAL const dxi = INV(dx);
+ CCTK_REAL const dyi = INV(dy);
+ CCTK_REAL const dzi = INV(dz);
+ CCTK_REAL const khalf = 0.5;
+ CCTK_REAL const kthird = 1/3.0;
+ CCTK_REAL const ktwothird = 2.0/3.0;
+ CCTK_REAL const kfourthird = 4.0/3.0;
+ CCTK_REAL const keightthird = 8.0/3.0;
+ CCTK_REAL const hdxi = 0.5 * dxi;
+ CCTK_REAL const hdyi = 0.5 * dyi;
+ CCTK_REAL const hdzi = 0.5 * dzi;
+
+ /* Initialize predefined quantities */
+ CCTK_REAL const p1odx = INV(dx);
+
+ /* Assign local copies of arrays functions */
+
+
+
+ /* Calculate temporaries and arrays functions */
+
+ /* Copy local copies back to grid functions */
+ CAKERNEL_initial_gaussian_Computations_Begin
+
+ /* Assign local copies of grid functions */
+
+ CCTK_REAL xL = I3D(x,0,0,0);
+
+
+ /* Include user supplied include files */
+
+ /* Precompute derivatives */
+
+ /* Calculate temporaries and grid functions */
+ CCTK_REAL phiL = exp(-100.*SQR(xL + t));
+
+ /* Copy local copies back to grid functions */
+ I3D(phi,0,0,0) = phiL;
+
+ CAKERNEL_initial_gaussian_Computations_End
+
+CAKERNEL_initial_gaussian_End
diff --git a/Examples/AdvectCaKernel/src/Differencing.h b/Examples/AdvectCaKernel/src/Differencing.h
new file mode 100644
index 0000000..2dc688d
--- /dev/null
+++ b/Examples/AdvectCaKernel/src/Differencing.h
@@ -0,0 +1,12 @@
+#ifndef KRANC_DIFF_FUNCTIONS
+# define PDstandard1(u) ((-KRANC_GFOFFSET3D(u,0,0,0) + KRANC_GFOFFSET3D(u,1,0,0))*p1odx)
+#else
+# define PDstandard1(u) (PDstandard1_impl(u,p1odx,cdj,cdk))
+static CCTK_REAL PDstandard1_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1odx, ptrdiff_t const cdj, ptrdiff_t const cdk) CCTK_ATTRIBUTE_NOINLINE CCTK_ATTRIBUTE_UNUSED;
+static CCTK_REAL PDstandard1_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1odx, ptrdiff_t const cdj, ptrdiff_t const cdk)
+{
+ ptrdiff_t const cdi=sizeof(CCTK_REAL);
+ return (-KRANC_GFOFFSET3D(u,0,0,0) + KRANC_GFOFFSET3D(u,1,0,0))*p1odx;
+}
+#endif
+
diff --git a/Examples/AdvectCaKernel/src/RegisterMoL.cc b/Examples/AdvectCaKernel/src/RegisterMoL.cc
new file mode 100644
index 0000000..bce1435
--- /dev/null
+++ b/Examples/AdvectCaKernel/src/RegisterMoL.cc
@@ -0,0 +1,18 @@
+/* File produced by Kranc */
+
+#include "cctk.h"
+#include "cctk_Arguments.h"
+#include "cctk_Parameters.h"
+
+extern "C" void AdvectCaKernel_RegisterVars(CCTK_ARGUMENTS)
+{
+ DECLARE_CCTK_ARGUMENTS;
+ DECLARE_CCTK_PARAMETERS;
+
+ CCTK_INT ierr = 0;
+
+ /* Register all the evolved grid functions with MoL */
+
+ /* Register all the evolved Array functions with MoL */
+ return;
+}
diff --git a/Examples/AdvectCaKernel/src/RegisterSymmetries.cc b/Examples/AdvectCaKernel/src/RegisterSymmetries.cc
new file mode 100644
index 0000000..c1c48a5
--- /dev/null
+++ b/Examples/AdvectCaKernel/src/RegisterSymmetries.cc
@@ -0,0 +1,24 @@
+/* File produced by Kranc */
+
+#include "cctk.h"
+#include "cctk_Arguments.h"
+#include "cctk_Parameters.h"
+#include "Symmetry.h"
+
+extern "C" void AdvectCaKernel_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, "AdvectCaKernel::phi");
+
+}
diff --git a/Examples/AdvectCaKernel/src/Startup.cc b/Examples/AdvectCaKernel/src/Startup.cc
new file mode 100644
index 0000000..ba99b79
--- /dev/null
+++ b/Examples/AdvectCaKernel/src/Startup.cc
@@ -0,0 +1,10 @@
+/* File produced by Kranc */
+
+#include "cctk.h"
+
+extern "C" int AdvectCaKernel_Startup(void)
+{
+ const char * banner = "AdvectCaKernel";
+ CCTK_RegisterBanner(banner);
+ return 0;
+}
diff --git a/Examples/AdvectCaKernel/src/make.code.defn b/Examples/AdvectCaKernel/src/make.code.defn
new file mode 100644
index 0000000..9f29474
--- /dev/null
+++ b/Examples/AdvectCaKernel/src/make.code.defn
@@ -0,0 +1,8 @@
+# File produced by Kranc
+
+SRCS = Startup.cc RegisterMoL.cc RegisterSymmetries.cc Boundaries.cc
+
+
+############################################################
+#CAKERNEL AUTO GENERATED PART. DO NOT EDIT BELOW THIS POINT#
+############################################################