aboutsummaryrefslogtreecommitdiff
path: root/src/WaveBinary.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/WaveBinary.c')
-rw-r--r--src/WaveBinary.c51
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++)