From 71dc800db76cce021294def0e6c36997a0b76f85 Mon Sep 17 00:00:00 2001 From: goodale Date: Mon, 11 Oct 1999 10:30:21 +0000 Subject: Modified to have precisely the functionality of IDScalarWave - now is another implementation of IDScalarWave. Tom git-svn-id: http://svn.cactuscode.org/arrangements/CactusWave/IDScalarWaveCXX/trunk@3 7ec00dc9-1e7a-42ad-bf73-a299ee168e72 --- interface.ccl | 2 +- param.ccl | 22 +++++++++++ schedule.ccl | 7 +++- src/CheckParameters.cc | 51 ++++++++++++++++++++++++ src/InitialData.cc | 104 ++++++++++++++++++++++++++++++++++++------------- src/make.code.defn | 2 +- 6 files changed, 157 insertions(+), 31 deletions(-) create mode 100644 src/CheckParameters.cc diff --git a/interface.ccl b/interface.ccl index 6f8e4d9..ee17e13 100644 --- a/interface.ccl +++ b/interface.ccl @@ -1,6 +1,6 @@ # Interface definition for thorn IDScalarWave # $Header$ -implements: idscalarwavecxx +implements: idscalarwave inherits: wavetoy grid diff --git a/param.ccl b/param.ccl index 3f7be29..9a7401d 100644 --- a/param.ccl +++ b/param.ccl @@ -7,6 +7,15 @@ USES KEYWORD type "" { } +restricted: + +KEYWORD initial_data "Type of initial data" +{ + "plane" :: "Plane wave" + "gaussian" :: "Gaussian wave" + "box" :: "Box wave" +} "gaussian" + private: REAL radius "The radius of the gaussian wave" @@ -19,6 +28,19 @@ REAL sigma "The sigma for the gaussian wave" 0:* :: } 0.1 +REAL kx "The wave number in the x-direction" +{ + *:* :: "No restriction" +} 4.0 +REAL ky "The wave number in the y-direction" +{ + *:* :: "No restriction" +} 0.0 +REAL kz "The wave number in the z-direction" +{ + *:* :: "No restriction" +} 0.0 + REAL amplitude "The amplitude of the waves" { *:* :: "No restriction" diff --git a/schedule.ccl b/schedule.ccl index 91ea515..052e424 100644 --- a/schedule.ccl +++ b/schedule.ccl @@ -1,9 +1,14 @@ # Schedule definitions for thorn IDScalarWave # $Header$ +schedule IDScalarWaveCXX_CheckParameters at CCTK_PARAMCHECK +{ + LANG: C +} "Check parameters" + schedule IDScalarWaveCXX_InitialData at CCTK_INITIAL { - STORAGE: wavetoy::scalarevolve,wavetoy::scalarold + STORAGE: wavetoy::scalarevolve COMMUNICATION: wavetoy::scalarevolve LANG: C } "Initial data for 3D wave equation" diff --git a/src/CheckParameters.cc b/src/CheckParameters.cc new file mode 100644 index 0000000..f0f6fdb --- /dev/null +++ b/src/CheckParameters.cc @@ -0,0 +1,51 @@ +/* + @file CheckParameters.F77 + @date + @author Gabrielle Allen + @desc + Check parameters for the wave equation initial data + @enddesc + @@*/ + +#include "cctk.h" +#include "cctk_parameters.h" +#include "cctk_arguments.h" + +static char *rcsid = "$Header$"; + + /*@@ + @routine IDScalarWave_CheckParameters + @date + @author Gabrielle Allen + @desc + Check parameters for the wave equation initial data + @enddesc + @calls + @calledby + @history + @hdate Mon Oct 11 11:49:21 1999 @hauthor Tom Goodale + @hdesc Converted to C++ + @endhistory + +@@*/ + +extern "C" void IDScalarWaveCXX_CheckParameters(CCTK_CARGUMENTS) +{ + DECLARE_CCTK_CARGUMENTS + DECLARE_CCTK_PARAMETERS + + if(CCTK_Equals(initial_data,"box")) + { + if (!CCTK_Equals(type, "box")) + { + CCTK_PARAMWARN("Must have a box grid with box initial data"); + } + + if (kx == 0 || ky == 0 || kz == 0) + { + CCTK_PARAMWARN("Cannot have zero kx,ky,kz for box initial data"); + } + } + return; +} + diff --git a/src/InitialData.cc b/src/InitialData.cc index c8d790d..8b770dc 100644 --- a/src/InitialData.cc +++ b/src/InitialData.cc @@ -8,23 +8,24 @@ @enddesc @@*/ +#include + #include "cctk.h" #include "cctk_Flesh.h" #include "cctk_parameters.h" #include "cctk_Groups.h" #include "cctk_arguments.h" -#include "cctk_Comm.h" +#include "cctk_Misc.h" -#include "CactusBase/CartGrid3D/src/Symmetry.h" +static char *rcsid = "$Header$"; -#include - -inline double sqr(double val) +inline CCTK_REAL sqr(CCTK_REAL val) { - return val*val; + return val*val; } + /*@@ @routine IDScalarWave_InitialData @date @@ -35,39 +36,86 @@ inline double sqr(double val) @calls @calledby @history - + @hdate Mon Oct 11 11:48:03 1999 @hauthor Werner Benger + @hdesc Converted to C++ + @hdate Mon Oct 11 11:48:20 1999 @hauthor Tom Goodale + @hdesc Added the rest of the initial data. @endhistory @@*/ extern "C" void IDScalarWaveCXX_InitialData(CCTK_CARGUMENTS) { - DECLARE_CCTK_CARGUMENTS - DECLARE_CCTK_PARAMETERS + DECLARE_CCTK_CARGUMENTS + DECLARE_CCTK_PARAMETERS + + CCTK_REAL dt = CCTK_DELTA_TIME; + + if(CCTK_Equals(initial_data, "plane")) + { + CCTK_REAL omega = sqrt(sqr(kx)+sqr(ky)+sqr(kz)); + + for(int k=0; k