aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorallen <allen@90eea020-d82d-4da5-bf6e-4ee79ff7632f>1999-09-10 13:17:29 +0000
committerallen <allen@90eea020-d82d-4da5-bf6e-4ee79ff7632f>1999-09-10 13:17:29 +0000
commit5424fb9e49a1d37b3e1f13806bf6aa3d81e4874f (patch)
tree81ddca6c9e2f91f058639132c16cadef2595120b /src
parentf56f298c3b29c36f03bf55e7a44c7a6fc124bc0a (diff)
This commit was generated by cvs2svn to compensate for changes in r2, which
included commits to RCS files with non-trunk default branches. git-svn-id: http://svn.cactuscode.org/arrangements/CactusWave/WaveToyC/trunk@3 90eea020-d82d-4da5-bf6e-4ee79ff7632f
Diffstat (limited to 'src')
-rw-r--r--src/InitSymBound.c40
-rw-r--r--src/Startup.c18
-rw-r--r--src/WaveToy.c157
-rw-r--r--src/make.code.defn9
4 files changed, 224 insertions, 0 deletions
diff --git a/src/InitSymBound.c b/src/InitSymBound.c
new file mode 100644
index 0000000..d075e9a
--- /dev/null
+++ b/src/InitSymBound.c
@@ -0,0 +1,40 @@
+ /*@@
+ @file InitSymBound.c
+ @date
+ @author Gabrielle Allen
+ @desc
+ Sets the symmetries for Wave Toy
+ @enddesc
+ @@*/
+
+#include "cctk.h"
+#include "cctk_arguments.h"
+
+ /*@@
+ @routine WaveToyC_InitSymBound
+ @date
+ @author Gabrielle Allen
+ @desc
+ Sets the symmetries for Wave Toy
+ @enddesc
+ @calls
+ @calledby
+ @history
+
+ @endhistory
+
+@@*/
+
+void WaveToyC_InitSymBound(CCTK_CARGUMENTS)
+{
+ DECLARE_CCTK_CARGUMENTS
+
+ int sym[3];
+
+ sym[0] = 1;
+ sym[1] = 1;
+ sym[2] = 1;
+
+ SetCartSymmetry(cctkGH, sym,"wavetoy::phi");
+
+} \ No newline at end of file
diff --git a/src/Startup.c b/src/Startup.c
new file mode 100644
index 0000000..2886535
--- /dev/null
+++ b/src/Startup.c
@@ -0,0 +1,18 @@
+ /*@@
+ @file Startup.c
+ @date
+ @author Gabrielle Allen
+ @desc
+ Register banner
+ @enddesc
+ @@*/
+
+int WaveToyC_Startup(void)
+{
+
+ const char *banner =
+"WaveToyC: Evolutions of a Scalar Field";
+
+ CCTK_RegisterBanner(banner);
+
+}
diff --git a/src/WaveToy.c b/src/WaveToy.c
new file mode 100644
index 0000000..5635056
--- /dev/null
+++ b/src/WaveToy.c
@@ -0,0 +1,157 @@
+ /*@@
+ @file WaveToy.c
+ @date
+ @author Tom Goodale
+ @desc
+ Evolution routines for the wave equation solver
+ @enddesc
+ @@*/
+
+#include "cctk.h"
+#include "cctk_parameters.h"
+#include "cctk_arguments.h"
+
+#include "cctk_Flesh.h"
+#include "cctk_Misc.h"
+#include "cctk_Comm.h"
+
+#include "CactusBase/Boundary/src/Boundary.h"
+
+ /*@@
+ @routine WaveToyC_Boundaries
+ @date
+ @author Tom Goodale
+ @desc
+ Boundary conditions for the wave equation
+ @enddesc
+ @calls ApplyFlatBC,ApplyRadiativeBC
+ @calledby
+ @history
+
+ @endhistory
+
+@@*/
+
+void WaveToyC_Boundaries(CCTK_CARGUMENTS)
+{
+ DECLARE_CCTK_CARGUMENTS
+ DECLARE_CCTK_PARAMETERS
+
+ int sw[3];
+
+ /* Set the stencil width */
+ sw[0]=1;
+ sw[1]=1;
+ sw[2]=1;
+
+ ApplySymmetry(cctkGH,"wavetoy::scalarevolve");
+
+ if (CCTK_EQUALS(bound,"flat"))
+ {
+ ApplyFlatBC(cctkGH,sw,"wavetoy::phi");
+ }
+ else if (CCTK_Equals(bound,"radiation"))
+ {
+ ApplyRadiativeBC(cctkGH,1,sw,"wavetoy::phi","wavetoy::phi_old");
+ }
+
+}
+
+
+ /*@@
+ @routine WaveToyC_Evolution
+ @date
+ @author Tom Goodale
+ @desc
+ Evolution for the wave equation
+ @enddesc
+ @calls CCTK_SyncGroup, wavetoy_boundaries
+ @calledby
+ @history
+
+ @endhistory
+
+@@*/
+
+void WaveToyC_Evolution(CCTK_CARGUMENTS)
+{
+ DECLARE_CCTK_CARGUMENTS
+ DECLARE_CCTK_PARAMETERS
+
+ int i,j,k;
+ int istart, jstart, kstart, iend, jend, kend;
+ CCTK_REAL dx,dy,dz,dt,dx2,dy2,dz2,dt2;
+
+ /* Set up shorthands */
+ dx = cctk_delta_space[0];
+ dy = cctk_delta_space[1];
+ dz = cctk_delta_space[2];
+ dt = cctk_delta_time;
+
+ dx2=dx*dx;
+ dy2=dy*dy;
+ dz2=dz*dz;
+ dt2=dt*dt;
+
+ istart = 1;
+ jstart = 1;
+ kstart = 1;
+
+ iend = cctk_lsh[0]-1;
+ jend = cctk_lsh[1]-1;
+ kend = cctk_lsh[2]-1;
+
+ /* Do the evolution */
+
+ for (k=kstart; k<kend; k++)
+ {
+ for (j=jstart; j<jend; j++)
+ {
+ for (i=istart; i<iend; i++)
+ {
+ tmp[CCTK_GFINDEX3D(cctkGH,i,j,k)] =
+ 2*(1 - (dt2)*(1/dx2 + 1/dy2 + 1/dz2))*
+ phi[CCTK_GFINDEX3D(cctkGH,i,j,k)] -
+ phi_old[CCTK_GFINDEX3D(cctkGH,i,j,k)]
+ + (dt2) *
+ ( ( phi[CCTK_GFINDEX3D(cctkGH,i+1,j,k)]
+ +phi[CCTK_GFINDEX3D(cctkGH,i-1,j,k)] )/dx2
+ +( phi[CCTK_GFINDEX3D(cctkGH,i,j+1,k)]
+ +phi[CCTK_GFINDEX3D(cctkGH,i,j-1,k)] )/dy2
+ +( phi[CCTK_GFINDEX3D(cctkGH,i,j,k+1)]
+ +phi[CCTK_GFINDEX3D(cctkGH,i,j,k-1)] )/dz2);
+ }
+ }
+ }
+
+ /* Update timeslices */
+ for (k=kstart; k<kend; k++)
+ {
+ for (j=jstart; j<jend; j++)
+ {
+ for (i=istart; i<iend; i++)
+ {
+ phi_old[CCTK_GFINDEX3D(cctkGH,i,j,k)]
+ = phi[CCTK_GFINDEX3D(cctkGH,i,j,k)];
+ phi[CCTK_GFINDEX3D(cctkGH,i,j,k)]
+ = tmp[CCTK_GFINDEX3D(cctkGH,i,j,k)];
+ }
+ }
+ }
+
+ /* Apply boundary conditions */
+ WaveToyC_Boundaries(CCTK_PASS_CTOC);
+
+ /* Synchronize */
+ CCTK_SyncGroup(cctkGH,"wavetoy::scalarevolve");
+
+}
+
+
+
+
+
+
+
+
+
diff --git a/src/make.code.defn b/src/make.code.defn
new file mode 100644
index 0000000..a3c63f2
--- /dev/null
+++ b/src/make.code.defn
@@ -0,0 +1,9 @@
+# Main make.code.defn file for thorn WaveToyC
+# $Header$
+
+# Source files in this directory
+SRCS = WaveToy.c InitSymBound.c Startup.c
+
+# Subdirectories containing source files
+SUBDIRS =
+