aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwerner <werner@7ec00dc9-1e7a-42ad-bf73-a299ee168e72>1999-10-11 08:37:23 +0000
committerwerner <werner@7ec00dc9-1e7a-42ad-bf73-a299ee168e72>1999-10-11 08:37:23 +0000
commitb728565aaa12282846d658d7837b32511cd23cee (patch)
treec63d69cb4231b6c05cdf9a0a98559e34c6c57375
parentdbda1e93594ce0cbd0c225d35675a07a490ef665 (diff)
WaveToy Initial data in C++ (only gaussian initial data here for easyness)
git-svn-id: http://svn.cactuscode.org/arrangements/CactusWave/IDScalarWaveCXX/trunk@2 7ec00dc9-1e7a-42ad-bf73-a299ee168e72
-rw-r--r--README7
-rw-r--r--interface.ccl6
-rw-r--r--param.ccl26
-rw-r--r--schedule.ccl10
-rw-r--r--src/InitialData.cc73
-rw-r--r--src/make.code.defn9
6 files changed, 131 insertions, 0 deletions
diff --git a/README b/README
new file mode 100644
index 0000000..af9375e
--- /dev/null
+++ b/README
@@ -0,0 +1,7 @@
+Cactus Code Thorn IDScalarWave, C++
+Authors : Tom Goodale, Gabrielle Allen, Werner Benger
+CVS info : $Header$
+--------------------------------------------------------------------------
+
+This thorns sets initial data for the scalar wave equation evolver
+
diff --git a/interface.ccl b/interface.ccl
new file mode 100644
index 0000000..6f8e4d9
--- /dev/null
+++ b/interface.ccl
@@ -0,0 +1,6 @@
+# Interface definition for thorn IDScalarWave
+# $Header$
+
+implements: idscalarwavecxx
+inherits: wavetoy grid
+
diff --git a/param.ccl b/param.ccl
new file mode 100644
index 0000000..3f7be29
--- /dev/null
+++ b/param.ccl
@@ -0,0 +1,26 @@
+# Parameter definitions for thorn IDScalarWave
+# $Header$
+
+shares: grid
+
+USES KEYWORD type ""
+{
+}
+
+private:
+
+REAL radius "The radius of the gaussian wave"
+{
+ 0:* ::
+} 0.0
+
+REAL sigma "The sigma for the gaussian wave"
+{
+ 0:* ::
+} 0.1
+
+REAL amplitude "The amplitude of the waves"
+{
+ *:* :: "No restriction"
+} 1.0
+
diff --git a/schedule.ccl b/schedule.ccl
new file mode 100644
index 0000000..91ea515
--- /dev/null
+++ b/schedule.ccl
@@ -0,0 +1,10 @@
+# Schedule definitions for thorn IDScalarWave
+# $Header$
+
+schedule IDScalarWaveCXX_InitialData at CCTK_INITIAL
+{
+ STORAGE: wavetoy::scalarevolve,wavetoy::scalarold
+ COMMUNICATION: wavetoy::scalarevolve
+ LANG: C
+} "Initial data for 3D wave equation"
+
diff --git a/src/InitialData.cc b/src/InitialData.cc
new file mode 100644
index 0000000..c8d790d
--- /dev/null
+++ b/src/InitialData.cc
@@ -0,0 +1,73 @@
+ /*@@
+ @file InitialData.cc
+ @date
+ @author Werner Benger
+ @desc
+ Initial data for the 3D Wave Equation
+ Derived from Tom Goodale
+ @enddesc
+ @@*/
+
+#include "cctk.h"
+#include "cctk_Flesh.h"
+#include "cctk_parameters.h"
+#include "cctk_Groups.h"
+#include "cctk_arguments.h"
+#include "cctk_Comm.h"
+
+#include "CactusBase/CartGrid3D/src/Symmetry.h"
+
+#include <math.h>
+
+inline double sqr(double val)
+{
+ return val*val;
+}
+
+
+ /*@@
+ @routine IDScalarWave_InitialData
+ @date
+ @author Tom Goodale
+ @desc
+ Set up initial data for the wave equation
+ @enddesc
+ @calls
+ @calledby
+ @history
+
+ @endhistory
+
+@@*/
+
+extern "C" void IDScalarWaveCXX_InitialData(CCTK_CARGUMENTS)
+{
+ DECLARE_CCTK_CARGUMENTS
+ DECLARE_CCTK_PARAMETERS
+
+ for(int k=0; k<cctk_lsh[2]; k++)
+ for(int j=0; j<cctk_lsh[1]; j++)
+ for(int i=0; i<cctk_lsh[0]; i++)
+ {
+ int index = CCTK_GFINDEX3D(cctkGH,i,j,k);
+
+ double X = x[index], Y = y[index], Z = z[index];
+ double R = sqrt(X*X + Y*Y + Z*Z);
+
+ phi_old[index] = phi[index] =
+ amplitude*exp( - sqr( (R - radius) / sigma ) );
+ }
+
+ //
+ // Apply symmetry boundary conditions
+ //
+ ApplySymmetry(cctkGH,"wavetoy::scalarevolve");
+
+ //
+ // Synchronise
+ //
+ CCTK_SyncGroup(cctkGH,"wavetoy::scalarevolve");
+
+ return;
+}
+
diff --git a/src/make.code.defn b/src/make.code.defn
new file mode 100644
index 0000000..4335306
--- /dev/null
+++ b/src/make.code.defn
@@ -0,0 +1,9 @@
+# Main make.code.defn file for thorn IDScalarWave
+# $Header$
+
+# Source files in this directory
+SRCS = InitialData.cc
+
+# Subdirectories containing source files
+SUBDIRS =
+