aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorgoodale <goodale@90eea020-d82d-4da5-bf6e-4ee79ff7632f>2000-03-29 07:42:15 +0000
committergoodale <goodale@90eea020-d82d-4da5-bf6e-4ee79ff7632f>2000-03-29 07:42:15 +0000
commitc7a57ec2e13fa24ad80c633369e8f6055ea89c23 (patch)
treed7e3b2c00cf34f9c52cbe8f8b843b682e1e1e04c /src
parentaa70aa70e686f8b6e048e56f8bedc0538730fd3d (diff)
Changed to use timelevels - thanks for putting the rotation in PUGH Ed.
Note that the no-boundary condition tests assumed that phi_new had zero at its boundaries. This is, or course, no longer true with timelevel rotation. Tom git-svn-id: http://svn.cactuscode.org/arrangements/CactusWave/WaveToyC/trunk@40 90eea020-d82d-4da5-bf6e-4ee79ff7632f
Diffstat (limited to 'src')
-rw-r--r--src/InitSymBound.c15
-rw-r--r--src/WaveToy.c130
2 files changed, 64 insertions, 81 deletions
diff --git a/src/InitSymBound.c b/src/InitSymBound.c
index ae0c34b..018bf39 100644
--- a/src/InitSymBound.c
+++ b/src/InitSymBound.c
@@ -31,16 +31,15 @@ static char *rcsid = "$Header$";
void WaveToyC_InitSymBound(CCTK_ARGUMENTS)
{
- DECLARE_CCTK_ARGUMENTS
+ DECLARE_CCTK_ARGUMENTS
- int sym[3];
+ int sym[3];
- sym[0] = 1;
- sym[1] = 1;
- sym[2] = 1;
+ sym[0] = 1;
+ sym[1] = 1;
+ sym[2] = 1;
- SetCartSymmetry(cctkGH, sym,"wavetoy::phi");
- SetCartSymmetry(cctkGH, sym,"wavetoyc::phi_new");
+ SetCartSymmetry(cctkGH, sym,"wavetoy::phi");
- return;
+ return;
}
diff --git a/src/WaveToy.c b/src/WaveToy.c
index 8a1c6d3..40c3b68 100644
--- a/src/WaveToy.c
+++ b/src/WaveToy.c
@@ -35,86 +35,72 @@ static void WaveToyC_Boundaries(CCTK_ARGUMENTS);
void WaveToyC_Evolution(CCTK_ARGUMENTS)
{
- DECLARE_CCTK_ARGUMENTS
-
- int i,j,k;
- int index;
- int istart, jstart, kstart, iend, jend, kend;
- CCTK_REAL dx,dy,dz,dt,dx2,dy2,dz2,dt2;
- CCTK_REAL dx2i,dy2i,dz2i;
-
- /* Set up shorthands */
- dx = CCTK_DELTA_SPACE(0);
- dy = CCTK_DELTA_SPACE(1);
- dz = CCTK_DELTA_SPACE(2);
- dt = CCTK_DELTA_TIME;
+ DECLARE_CCTK_ARGUMENTS
- dx2=dx*dx;
- dy2=dy*dy;
- dz2=dz*dz;
- dt2=dt*dt;
-
- dx2i = 1.0/dx2;
- dy2i = 1.0/dy2;
- dz2i = 1.0/dz2;
-
- istart = 1;
- jstart = 1;
- kstart = 1;
+ int i,j,k;
+ int index;
+ int istart, jstart, kstart, iend, jend, kend;
+ CCTK_REAL dx,dy,dz,dt,dx2,dy2,dz2,dt2;
+ CCTK_REAL dx2i,dy2i,dz2i;
+
+ CCTK_REAL factor;
+
+ /* Set up shorthands */
+ dx = CCTK_DELTA_SPACE(0);
+ dy = CCTK_DELTA_SPACE(1);
+ dz = CCTK_DELTA_SPACE(2);
+ dt = CCTK_DELTA_TIME;
- iend = cctk_lsh[0]-1;
- jend = cctk_lsh[1]-1;
- kend = cctk_lsh[2]-1;
+ dx2 = dx*dx;
+ dy2 = dy*dy;
+ dz2 = dz*dz;
+ dt2 = dt*dt;
+
+ dx2i = 1.0/dx2;
+ dy2i = 1.0/dy2;
+ dz2i = 1.0/dz2;
+
+ istart = 1;
+ jstart = 1;
+ kstart = 1;
+
+ iend = cctk_lsh[0]-1;
+ jend = cctk_lsh[1]-1;
+ kend = cctk_lsh[2]-1;
- /* Do the evolution */
+ /* Do the evolution */
- for (k=kstart; k<kend; k++)
+ factor = 2*(1 - (dt2)*(dx2i + dy2i + dz2i));
+
+ for (k=kstart; k<kend; k++)
+ {
+ for (j=jstart; j<jend; j++)
+ {
+ for (i=istart; i<iend; i++)
{
- for (j=jstart; j<jend; j++)
- {
- for (i=istart; i<iend; i++)
- {
- index = CCTK_GFINDEX3D(cctkGH,i,j,k);
-
- phi_new[index] =
- 2*(1 - (dt2)*(dx2i + dy2i + dz2i))*
- phi[index] -
- phi_old[index]
- + (dt2) *
+ index = CCTK_GFINDEX3D(cctkGH,i,j,k);
+
+ phi_n[index] = factor*
+ phi[index] - phi_p[index]
+ + (dt2) *
( ( phi[CCTK_GFINDEX3D(cctkGH,i+1,j ,k )]
+phi[CCTK_GFINDEX3D(cctkGH,i-1,j ,k )] )*dx2i
+( phi[CCTK_GFINDEX3D(cctkGH,i ,j+1,k )]
+phi[CCTK_GFINDEX3D(cctkGH,i ,j-1,k )] )*dy2i
+( phi[CCTK_GFINDEX3D(cctkGH,i ,j ,k+1)]
+phi[CCTK_GFINDEX3D(cctkGH,i ,j, k-1)] )*dz2i);
- }
- }
- }
-
-
- /* Synchronize before applying boundary conditions */
- CCTK_SyncGroup(cctkGH,"wavetoyc::scalartmps");
-
- /* Apply boundary conditions */
- WaveToyC_Boundaries(CCTK_PASS_CTOC);
+ }
+ }
+ }
- /* Update timeslices */
- for (k=0; k<cctk_lsh[2]; k++)
- {
- for (j=0; j<cctk_lsh[1]; j++)
- {
- for (i=0; i<cctk_lsh[0]; i++)
- {
-
- index = CCTK_GFINDEX3D(cctkGH,i,j,k);
- phi_old[index] = phi[index];
- phi[index] = phi_new[index];
- }
- }
- }
-
+ /* Synchronize before applying boundary conditions */
+ CCTK_SyncGroup(cctkGH,"wavetoy::scalarevolve");
+
+ /* Apply boundary conditions */
+ WaveToyC_Boundaries(CCTK_PASS_CTOC);
+ return;
}
@@ -125,7 +111,7 @@ void WaveToyC_Evolution(CCTK_ARGUMENTS)
@desc
Boundary conditions for the wave equation
@enddesc
- @calls CartSymBCGroupI,FlatBC,RadiativeBC
+ @calls CartSymBCGroup,FlatBC,RadiativeBC
@calledby
@history
@@ -146,15 +132,15 @@ static void WaveToyC_Boundaries(CCTK_ARGUMENTS)
sw[1]=1;
sw[2]=1;
- ierr = CartSymBCGroup(cctkGH,"wavetoyc::scalartmps");
+ ierr = CartSymBCGroup(cctkGH,"wavetoy::scalarevolve");
if (CCTK_EQUALS(bound,"flat"))
{
- ierr = FlatBCVar(cctkGH,sw,"wavetoyc::phi_new");
+ ierr = FlatBCVar(cctkGH,sw,"wavetoy::phi");
}
else if (CCTK_Equals(bound,"radiation"))
{
- ierr = RadiativeBCVar(cctkGH,0.0,1.0,sw,"wavetoyc::phi_new","wavetoy::phi");
+ ierr = RadiativeBCVar(cctkGH,0.0,1.0,sw,"wavetoy::phi","wavetoy::phi");
}
if (ierr < 0)
@@ -162,7 +148,5 @@ static void WaveToyC_Boundaries(CCTK_ARGUMENTS)
CCTK_WARN(0,"Boundary conditions not applied - giving up!");
}
-
-
-
+ return;
}