diff options
author | goodale <goodale@90eea020-d82d-4da5-bf6e-4ee79ff7632f> | 2000-03-29 07:42:15 +0000 |
---|---|---|
committer | goodale <goodale@90eea020-d82d-4da5-bf6e-4ee79ff7632f> | 2000-03-29 07:42:15 +0000 |
commit | c7a57ec2e13fa24ad80c633369e8f6055ea89c23 (patch) | |
tree | d7e3b2c00cf34f9c52cbe8f8b843b682e1e1e04c | |
parent | aa70aa70e686f8b6e048e56f8bedc0538730fd3d (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
-rw-r--r-- | interface.ccl | 8 | ||||
-rw-r--r-- | schedule.ccl | 1 | ||||
-rw-r--r-- | src/InitSymBound.c | 15 | ||||
-rw-r--r-- | src/WaveToy.c | 130 | ||||
-rw-r--r-- | test/test_wavetoyc/phi.dl | 4 | ||||
-rw-r--r-- | test/test_wavetoyc/phi.xl | 92 | ||||
-rw-r--r-- | test/test_wavetoyc/phi.yl | 92 | ||||
-rw-r--r-- | test/test_wavetoyc/phi_max.tl | 6 | ||||
-rw-r--r-- | test/test_wavetoyc/phi_min.tl | 2 | ||||
-rw-r--r-- | test/test_wavetoyc/phi_nm1.tl | 10 | ||||
-rw-r--r-- | test/test_wavetoyc/phi_nm2.tl | 4 |
11 files changed, 170 insertions, 194 deletions
diff --git a/interface.ccl b/interface.ccl index b995880..c44b041 100644 --- a/interface.ccl +++ b/interface.ccl @@ -8,18 +8,12 @@ USES INCLUDE: Symmetry.h public: -cctk_real scalarevolve type = GF +cctk_real scalarevolve type = GF Timelevels=3 { phi - phi_old } "The evolved scalar field" -private: -cctk_real scalartmps type = GF -{ - phi_new -} "Temporary GF for WaveToy" diff --git a/schedule.ccl b/schedule.ccl index 81a5463..5dfc65c 100644 --- a/schedule.ccl +++ b/schedule.ccl @@ -16,7 +16,6 @@ schedule WaveToyC_InitSymBound at BASEGRID schedule WaveToyC_Evolution as WaveToy_Evolution at EVOL { LANG: C - STORAGE: scalartmps } "Evolution of 3D wave equation" 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; } diff --git a/test/test_wavetoyc/phi.dl b/test/test_wavetoyc/phi.dl index 16493b0..12f574d 100644 --- a/test/test_wavetoyc/phi.dl +++ b/test/test_wavetoyc/phi.dl @@ -121,7 +121,7 @@ -0.683704 -0.0000000003848 -0.592544 -0.0000008256207 -0.501383 -0.0001851985238 --0.410223 -0.0080724403496 +-0.410223 -0.0080724403495 -0.319062 -0.0860002778716 -0.227901 -0.3020549188440 -0.136741 -0.2694342257320 @@ -130,7 +130,7 @@ 0.136741 -0.2694342257320 0.227901 -0.3020549188440 0.319062 -0.0860002778716 -0.410223 -0.0080724403496 +0.410223 -0.0080724403495 0.501383 -0.0001851985238 0.592544 -0.0000008256207 0.683704 -0.0000000003848 diff --git a/test/test_wavetoyc/phi.xl b/test/test_wavetoyc/phi.xl index 9bef5dd..55a520c 100644 --- a/test/test_wavetoyc/phi.xl +++ b/test/test_wavetoyc/phi.xl @@ -24,7 +24,7 @@ "Time = 0.052632 --0.500000 0.0000000000000 +-0.500000 0.0000000001579 -0.447368 0.0000002442580 -0.394737 0.0000055185355 -0.342105 0.0000636892398 @@ -43,13 +43,13 @@ 0.342105 0.0000636892398 0.394737 0.0000055185355 0.447368 0.0000002442580 -0.500000 0.0000000000000 +0.500000 0.0000000001579 "Time = 0.105263 -0.500000 0.0000000000000 --0.447368 0.0000074500351 --0.394737 0.0000571366688 +-0.447368 0.0000074500893 +-0.394737 0.0000571366787 -0.342105 0.0000891850929 -0.289474 -0.0021735254063 -0.236842 -0.0208336611591 @@ -64,17 +64,17 @@ 0.236842 -0.0208336611591 0.289474 -0.0021735254063 0.342105 0.0000891850929 -0.394737 0.0000571366688 -0.447368 0.0000074500351 +0.394737 0.0000571366787 +0.447368 0.0000074500893 0.500000 0.0000000000000 "Time = 0.157895 --0.500000 0.0000000000000 --0.447368 0.0000404464126 --0.394737 -0.0000934612273 --0.342105 -0.0028408356519 --0.289474 -0.0203343223830 +-0.500000 0.0000000000121 +-0.447368 0.0000404464522 +-0.394737 -0.0000934611932 +-0.342105 -0.0028408356421 +-0.289474 -0.0203343223824 -0.236842 -0.0840586024960 -0.184211 -0.2362253936422 -0.131579 -0.4920251452215 @@ -85,54 +85,54 @@ 0.131579 -0.4920251452215 0.184211 -0.2362253936422 0.236842 -0.0840586024960 -0.289474 -0.0203343223830 -0.342105 -0.0028408356519 -0.394737 -0.0000934612273 -0.447368 0.0000404464126 -0.500000 0.0000000000000 +0.289474 -0.0203343223824 +0.342105 -0.0028408356421 +0.394737 -0.0000934611932 +0.447368 0.0000404464522 +0.500000 0.0000000000121 "Time = 0.210526 --0.500000 0.0000000000000 --0.447368 -0.0002560735304 --0.394737 -0.0032223677845 --0.342105 -0.0191504024223 --0.289474 -0.0718425508255 --0.236842 -0.1869773941527 --0.184211 -0.3531984196037 +-0.500000 0.0000000001579 +-0.447368 -0.0002560735181 +-0.394737 -0.0032223677598 +-0.342105 -0.0191504023972 +-0.289474 -0.0718425508170 +-0.236842 -0.1869773941516 +-0.184211 -0.3531984196036 -0.131579 -0.4762760737732 -0.078947 -0.4212470397782 -0.026316 -0.2663944260771 0.026316 -0.2663944260771 0.078947 -0.4212470397782 0.131579 -0.4762760737732 -0.184211 -0.3531984196037 -0.236842 -0.1869773941527 -0.289474 -0.0718425508255 -0.342105 -0.0191504024223 -0.394737 -0.0032223677845 -0.447368 -0.0002560735304 -0.500000 0.0000000000000 +0.184211 -0.3531984196036 +0.236842 -0.1869773941516 +0.289474 -0.0718425508170 +0.342105 -0.0191504023972 +0.394737 -0.0032223677598 +0.447368 -0.0002560735181 +0.500000 0.0000000001579 "Time = 0.263158 -0.500000 0.0000000000000 --0.447368 -0.0034053135086 --0.394737 -0.0177523942899 --0.342105 -0.0616617809349 --0.289474 -0.1512610524732 --0.236842 -0.2676581405563 --0.184211 -0.3314593226331 --0.131579 -0.2530697030291 --0.078947 -0.0930373771551 +-0.447368 -0.0034053134726 +-0.394737 -0.0177523942812 +-0.342105 -0.0616617809179 +-0.289474 -0.1512610524542 +-0.236842 -0.2676581405491 +-0.184211 -0.3314593226319 +-0.131579 -0.2530697030290 +-0.078947 -0.0930373771550 -0.026316 -0.0172399268943 0.026316 -0.0172399268943 -0.078947 -0.0930373771551 -0.131579 -0.2530697030291 -0.184211 -0.3314593226331 -0.236842 -0.2676581405563 -0.289474 -0.1512610524732 -0.342105 -0.0616617809349 -0.394737 -0.0177523942899 -0.447368 -0.0034053135086 +0.078947 -0.0930373771550 +0.131579 -0.2530697030290 +0.184211 -0.3314593226319 +0.236842 -0.2676581405491 +0.289474 -0.1512610524542 +0.342105 -0.0616617809179 +0.394737 -0.0177523942812 +0.447368 -0.0034053134726 0.500000 0.0000000000000 diff --git a/test/test_wavetoyc/phi.yl b/test/test_wavetoyc/phi.yl index 9bef5dd..55a520c 100644 --- a/test/test_wavetoyc/phi.yl +++ b/test/test_wavetoyc/phi.yl @@ -24,7 +24,7 @@ "Time = 0.052632 --0.500000 0.0000000000000 +-0.500000 0.0000000001579 -0.447368 0.0000002442580 -0.394737 0.0000055185355 -0.342105 0.0000636892398 @@ -43,13 +43,13 @@ 0.342105 0.0000636892398 0.394737 0.0000055185355 0.447368 0.0000002442580 -0.500000 0.0000000000000 +0.500000 0.0000000001579 "Time = 0.105263 -0.500000 0.0000000000000 --0.447368 0.0000074500351 --0.394737 0.0000571366688 +-0.447368 0.0000074500893 +-0.394737 0.0000571366787 -0.342105 0.0000891850929 -0.289474 -0.0021735254063 -0.236842 -0.0208336611591 @@ -64,17 +64,17 @@ 0.236842 -0.0208336611591 0.289474 -0.0021735254063 0.342105 0.0000891850929 -0.394737 0.0000571366688 -0.447368 0.0000074500351 +0.394737 0.0000571366787 +0.447368 0.0000074500893 0.500000 0.0000000000000 "Time = 0.157895 --0.500000 0.0000000000000 --0.447368 0.0000404464126 --0.394737 -0.0000934612273 --0.342105 -0.0028408356519 --0.289474 -0.0203343223830 +-0.500000 0.0000000000121 +-0.447368 0.0000404464522 +-0.394737 -0.0000934611932 +-0.342105 -0.0028408356421 +-0.289474 -0.0203343223824 -0.236842 -0.0840586024960 -0.184211 -0.2362253936422 -0.131579 -0.4920251452215 @@ -85,54 +85,54 @@ 0.131579 -0.4920251452215 0.184211 -0.2362253936422 0.236842 -0.0840586024960 -0.289474 -0.0203343223830 -0.342105 -0.0028408356519 -0.394737 -0.0000934612273 -0.447368 0.0000404464126 -0.500000 0.0000000000000 +0.289474 -0.0203343223824 +0.342105 -0.0028408356421 +0.394737 -0.0000934611932 +0.447368 0.0000404464522 +0.500000 0.0000000000121 "Time = 0.210526 --0.500000 0.0000000000000 --0.447368 -0.0002560735304 --0.394737 -0.0032223677845 --0.342105 -0.0191504024223 --0.289474 -0.0718425508255 --0.236842 -0.1869773941527 --0.184211 -0.3531984196037 +-0.500000 0.0000000001579 +-0.447368 -0.0002560735181 +-0.394737 -0.0032223677598 +-0.342105 -0.0191504023972 +-0.289474 -0.0718425508170 +-0.236842 -0.1869773941516 +-0.184211 -0.3531984196036 -0.131579 -0.4762760737732 -0.078947 -0.4212470397782 -0.026316 -0.2663944260771 0.026316 -0.2663944260771 0.078947 -0.4212470397782 0.131579 -0.4762760737732 -0.184211 -0.3531984196037 -0.236842 -0.1869773941527 -0.289474 -0.0718425508255 -0.342105 -0.0191504024223 -0.394737 -0.0032223677845 -0.447368 -0.0002560735304 -0.500000 0.0000000000000 +0.184211 -0.3531984196036 +0.236842 -0.1869773941516 +0.289474 -0.0718425508170 +0.342105 -0.0191504023972 +0.394737 -0.0032223677598 +0.447368 -0.0002560735181 +0.500000 0.0000000001579 "Time = 0.263158 -0.500000 0.0000000000000 --0.447368 -0.0034053135086 --0.394737 -0.0177523942899 --0.342105 -0.0616617809349 --0.289474 -0.1512610524732 --0.236842 -0.2676581405563 --0.184211 -0.3314593226331 --0.131579 -0.2530697030291 --0.078947 -0.0930373771551 +-0.447368 -0.0034053134726 +-0.394737 -0.0177523942812 +-0.342105 -0.0616617809179 +-0.289474 -0.1512610524542 +-0.236842 -0.2676581405491 +-0.184211 -0.3314593226319 +-0.131579 -0.2530697030290 +-0.078947 -0.0930373771550 -0.026316 -0.0172399268943 0.026316 -0.0172399268943 -0.078947 -0.0930373771551 -0.131579 -0.2530697030291 -0.184211 -0.3314593226331 -0.236842 -0.2676581405563 -0.289474 -0.1512610524732 -0.342105 -0.0616617809349 -0.394737 -0.0177523942899 -0.447368 -0.0034053135086 +0.078947 -0.0930373771550 +0.131579 -0.2530697030290 +0.184211 -0.3314593226319 +0.236842 -0.2676581405491 +0.289474 -0.1512610524542 +0.342105 -0.0616617809179 +0.394737 -0.0177523942812 +0.447368 -0.0034053134726 0.500000 0.0000000000000 diff --git a/test/test_wavetoyc/phi_max.tl b/test/test_wavetoyc/phi_max.tl index 6355b45..7d6d6cf 100644 --- a/test/test_wavetoyc/phi_max.tl +++ b/test/test_wavetoyc/phi_max.tl @@ -2,6 +2,6 @@ 0.000000 0.8124050503725 0.052632 0.0002832523498 0.105263 0.0000891850929 -0.157895 0.0000404464126 -0.210526 0.0000003961843 -0.263158 0.0000001100396 +0.157895 0.0000404464522 +0.210526 0.0000003961856 +0.263158 0.0000001100397 diff --git a/test/test_wavetoyc/phi_min.tl b/test/test_wavetoyc/phi_min.tl index c002c48..a1d8579 100644 --- a/test/test_wavetoyc/phi_min.tl +++ b/test/test_wavetoyc/phi_min.tl @@ -4,4 +4,4 @@ 0.105263 -1.1290503258507 0.157895 -0.9019842677611 0.210526 -0.4997593550838 -0.263158 -0.3594146186544 +0.263158 -0.3594146186543 diff --git a/test/test_wavetoyc/phi_nm1.tl b/test/test_wavetoyc/phi_nm1.tl index 5ac6c8a..895a3b0 100644 --- a/test/test_wavetoyc/phi_nm1.tl +++ b/test/test_wavetoyc/phi_nm1.tl @@ -1,7 +1,7 @@ "phi norm1 v time 0.000000 0.0047741452163 -0.052632 0.0023586563889 -0.105263 0.0094832901772 -0.157895 0.0166095490057 -0.210526 0.0237365580785 -0.263158 0.0308582835984 +0.052632 0.0023586563905 +0.105263 0.0094832901779 +0.157895 0.0166095490059 +0.210526 0.0237365580784 +0.263158 0.0308582835960 diff --git a/test/test_wavetoyc/phi_nm2.tl b/test/test_wavetoyc/phi_nm2.tl index e9504b4..0fea72d 100644 --- a/test/test_wavetoyc/phi_nm2.tl +++ b/test/test_wavetoyc/phi_nm2.tl @@ -3,5 +3,5 @@ 0.052632 0.0158441957039 0.105263 0.0637392141088 0.157895 0.0805995803466 -0.210526 0.0821416890830 -0.263158 0.0821638479507 +0.210526 0.0821416890828 +0.263158 0.0821638479495 |