diff options
author | allen <allen@90eea020-d82d-4da5-bf6e-4ee79ff7632f> | 1999-09-11 14:42:11 +0000 |
---|---|---|
committer | allen <allen@90eea020-d82d-4da5-bf6e-4ee79ff7632f> | 1999-09-11 14:42:11 +0000 |
commit | c1a160ee40148807114ef2dc9cba78423f9d9e4d (patch) | |
tree | eb0a38878ef047b47cd8b5c2e366b8fe0f8b2ac2 /src | |
parent | bc183385b05ad4e7279ffab130e828d8160e383f (diff) |
Fixing the bug in using radiation boundary conditions (I had copied
the call line from F77 which was actually wrong but bizarrely worked)
Adding error codes to boundary conditions. Changing things around
to make the application of boundary conditions clearer. Now the
arrays are swapped at the end and not in the middle. Need to copy
this to the other 2 thorns.
git-svn-id: http://svn.cactuscode.org/arrangements/CactusWave/WaveToyC/trunk@6 90eea020-d82d-4da5-bf6e-4ee79ff7632f
Diffstat (limited to 'src')
-rw-r--r-- | src/InitSymBound.c | 3 | ||||
-rw-r--r-- | src/WaveToy.c | 67 |
2 files changed, 40 insertions, 30 deletions
diff --git a/src/InitSymBound.c b/src/InitSymBound.c index d075e9a..de8bd0d 100644 --- a/src/InitSymBound.c +++ b/src/InitSymBound.c @@ -36,5 +36,6 @@ void WaveToyC_InitSymBound(CCTK_CARGUMENTS) sym[2] = 1; SetCartSymmetry(cctkGH, sym,"wavetoy::phi"); + SetCartSymmetry(cctkGH, sym,"wavetoyc::phi_new"); -}
\ No newline at end of file +} diff --git a/src/WaveToy.c b/src/WaveToy.c index 5635056..7bb2db7 100644 --- a/src/WaveToy.c +++ b/src/WaveToy.c @@ -37,23 +37,29 @@ void WaveToyC_Boundaries(CCTK_CARGUMENTS) DECLARE_CCTK_CARGUMENTS DECLARE_CCTK_PARAMETERS - int sw[3]; - - /* Set the stencil width */ - sw[0]=1; - sw[1]=1; - sw[2]=1; - - ApplySymmetry(cctkGH,"wavetoy::scalarevolve"); - - if (CCTK_EQUALS(bound,"flat")) - { - ApplyFlatBC(cctkGH,sw,"wavetoy::phi"); - } - else if (CCTK_Equals(bound,"radiation")) - { - ApplyRadiativeBC(cctkGH,1,sw,"wavetoy::phi","wavetoy::phi_old"); - } + int ierr; + int sw[3]; + + /* Set the stencil width */ + sw[0]=1; + sw[1]=1; + sw[2]=1; + + ApplySymmetry(cctkGH,"wavetoyc::scalartmps"); + + if (CCTK_EQUALS(bound,"flat")) + { + ierr = ApplyFlatBC(cctkGH,sw,"wavetoyc::phi_new"); + } + else if (CCTK_Equals(bound,"radiation")) + { + ierr = ApplyRadiativeBC(cctkGH,0,sw,"wavetoyc::phi_new","wavetoy::phi"); + } + + if (ierr < 0) + { + CCTK_WARN(0,"Boundary conditions not applied - giving up!"); + } } @@ -109,7 +115,7 @@ void WaveToyC_Evolution(CCTK_CARGUMENTS) { for (i=istart; i<iend; i++) { - tmp[CCTK_GFINDEX3D(cctkGH,i,j,k)] = + phi_new[CCTK_GFINDEX3D(cctkGH,i,j,k)] = 2*(1 - (dt2)*(1/dx2 + 1/dy2 + 1/dz2))* phi[CCTK_GFINDEX3D(cctkGH,i,j,k)] - phi_old[CCTK_GFINDEX3D(cctkGH,i,j,k)] @@ -123,27 +129,30 @@ void WaveToyC_Evolution(CCTK_CARGUMENTS) } } } - + + + /* Synchronize */ + CCTK_SyncGroup(cctkGH,"wavetoy::scalarevolve"); + + + /* Apply boundary conditions */ + WaveToyC_Boundaries(CCTK_PASS_CTOC); + + /* Update timeslices */ - for (k=kstart; k<kend; k++) + for (k=0; k<cctk_lsh[2]; k++) { - for (j=jstart; j<jend; j++) + for (j=0; j<cctk_lsh[1]; j++) { - for (i=istart; i<iend; i++) + for (i=0; i<cctk_lsh[0]; i++) { phi_old[CCTK_GFINDEX3D(cctkGH,i,j,k)] = phi[CCTK_GFINDEX3D(cctkGH,i,j,k)]; phi[CCTK_GFINDEX3D(cctkGH,i,j,k)] - = tmp[CCTK_GFINDEX3D(cctkGH,i,j,k)]; + = phi_new[CCTK_GFINDEX3D(cctkGH,i,j,k)]; } } } - - /* Apply boundary conditions */ - WaveToyC_Boundaries(CCTK_PASS_CTOC); - - /* Synchronize */ - CCTK_SyncGroup(cctkGH,"wavetoy::scalarevolve"); } |