diff options
author | allen <allen@b9286e40-80fe-41ab-903a-d6b447012e1e> | 2002-06-29 18:37:18 +0000 |
---|---|---|
committer | allen <allen@b9286e40-80fe-41ab-903a-d6b447012e1e> | 2002-06-29 18:37:18 +0000 |
commit | aceb267979362c8f7de476c61a269a5424df1c69 (patch) | |
tree | 18b1e9b9747a12d80f6c41a72959211e7f78b575 /src/WaveBinary.c | |
parent | 1b8525cc2558334fc8093ca4ce036a226e597a87 (diff) |
Included style suggestions from Erik Schnetter (Cactus/1104)
Used a more accurate representation of pi (hence new testsuite files)
Wrote some minimal documentation
git-svn-id: http://svn.cactuscode.org/arrangements/CactusWave/WaveBinarySource/trunk@36 b9286e40-80fe-41ab-903a-d6b447012e1e
Diffstat (limited to 'src/WaveBinary.c')
-rw-r--r-- | src/WaveBinary.c | 51 |
1 files changed, 43 insertions, 8 deletions
diff --git a/src/WaveBinary.c b/src/WaveBinary.c index 269a024..ab8f3ec 100644 --- a/src/WaveBinary.c +++ b/src/WaveBinary.c @@ -1,8 +1,17 @@ + /*@@ + @file WaveBinary.c + @date + @author Cactus Maintainers + @desc + Add a binary source term to the 3D scalar wave equation + @enddesc + @version $Header$ + @@*/ + #include <stdio.h> #include <stdlib.h> #include <math.h> -/* Using Cactus infrastructure */ #include "cctk.h" #include "cctk_Parameters.h" #include "cctk_Arguments.h" @@ -11,11 +20,35 @@ static const char *rcsid = "$Header$"; CCTK_FILEVERSION(CactusWave_WaveBinarySource_WaveBinary_c) +/******************************************************************** + ********************* Local Data Types *********************** + ********************************************************************/ + + +/******************************************************************** + ********************* Local Routine Prototypes ********************* + ********************************************************************/ -void WaveBinaryC(CCTK_ARGUMENTS); int IndexCeilC(cGH *GH, CCTK_REAL coord_value, int d); int IndexFloorC(cGH *GH, CCTK_REAL coord_value, int d); + +/******************************************************************** + ********************* Local Data ***************************** + ********************************************************************/ + + +/******************************************************************** + ***************** External Routines Prototype ******************** + ********************************************************************/ + +void WaveBinaryC(CCTK_ARGUMENTS); + + +/******************************************************************** + ********************** External Routines ************************ + ********************************************************************/ + void WaveBinaryC(CCTK_ARGUMENTS) { @@ -38,16 +71,18 @@ void WaveBinaryC(CCTK_ARGUMENTS) /* some flags */ int onthisproc, xproc, sign; static int firstcall; - + CCTK_REAL xs,ys,zs,rad; CCTK_REAL zmin,zmax,charge_factor; + const CCTK_REAL binary_pi=3.141592653589793; /* Because binary_charge and binary_size are a steerable parameters now, charge_factor needs to be recomputed at every iteration. */ charge_factor = 3.0*binary_charge/ - (4.0*3.1415*binary_size*binary_size*binary_size); + (4.0*binary_pi*binary_size*binary_size*binary_size); /* Initialize the range arrays */ + for (d=0;d<3;d++) { mingp[d] = 0; @@ -68,7 +103,7 @@ void WaveBinaryC(CCTK_ARGUMENTS) /* we have two charges opposite, origin is the center - sign mulitplies the charge xy-positions by +1 and -1 */ + sign multiplies the charge xy-positions by +1 and -1 */ for (sign=1; sign>=-1; sign-=2) { @@ -96,8 +131,8 @@ void WaveBinaryC(CCTK_ARGUMENTS) for (d=0;d<3;d++) { - /* check where our binaries are: - - the can be on our grid chunk completly + /* check where our binary sources are: + - they can be on our grid chunk completly - we have a lower part of the source on our grid chunk - we have a upper part - the source covers a grid chunk completetly @@ -157,7 +192,7 @@ void WaveBinaryC(CCTK_ARGUMENTS) maxc[0],maxc[1],maxc[2]); } - /* we have the source, no loop over the vindex boudary */ + /* we have the source, now loop over the vindex boundary */ if (onthisproc==3) { for (k=lowerloc[2];k<=upperloc[2];k++) |