diff options
author | allen <allen@4451c3c6-1034-4891-99ea-21147727ccdf> | 1999-09-14 11:37:28 +0000 |
---|---|---|
committer | allen <allen@4451c3c6-1034-4891-99ea-21147727ccdf> | 1999-09-14 11:37:28 +0000 |
commit | 2034d2746037f5a926c9f3d0da89b5d9e7ab5756 (patch) | |
tree | 8f25a751f6e60d7ff7f5c72f15f18ebc709bdd4e /src | |
parent | c3a1612f7f045216e952390333405cc71b72aa84 (diff) |
Design changes
git-svn-id: http://svn.cactuscode.org/arrangements/CactusWave/WaveToyF77/trunk@23 4451c3c6-1034-4891-99ea-21147727ccdf
Diffstat (limited to 'src')
-rw-r--r-- | src/InitSymBound.F77 | 1 | ||||
-rw-r--r-- | src/WaveToy.F77 | 164 |
2 files changed, 90 insertions, 75 deletions
diff --git a/src/InitSymBound.F77 b/src/InitSymBound.F77 index 9ea3fd4..9ab3c43 100644 --- a/src/InitSymBound.F77 +++ b/src/InitSymBound.F77 @@ -40,6 +40,7 @@ sym(3) = one call SetCartSymmetry(cctkGH, sym,'wavetoy::phi') + call SetCartSymmetry(cctkGH, sym,'wavetoyf77::phi_next') return end diff --git a/src/WaveToy.F77 b/src/WaveToy.F77 index 830db0c..fdf5dcb 100644 --- a/src/WaveToy.F77 +++ b/src/WaveToy.F77 @@ -7,61 +7,15 @@ @enddesc @@*/ +c Using Cactus infrastructure #include "cctk.h" -#include "cctk_parameters.h" -#include "cctk_arguments.h" +c Using Cactus parameters +#include "cctk_parameters.h" - /*@@ - @routine WaveToyF77_Boundaries - @date - @author Tom Goodale - @desc - Boundary conditions for the wave equation - @enddesc - @calls ApplyFlatBC,ApplyRadiativeBC - @calledby - @history - - @endhistory - -@@*/ - - subroutine WaveToyF77_Boundaries(CCTK_FARGUMENTS) - - implicit none - - DECLARE_CCTK_FARGUMENTS - DECLARE_CCTK_PARAMETERS - - CCTK_REAL zero - integer ierr - integer sw(3) - integer CCTK_Equals - - zero = 0.0 - -c Set the stencil width - sw(1)=1 - sw(2)=1 - sw(3)=1 - - call ApplySymmetry(cctkGH,"wavetoy::scalarevolve") - - if (CCTK_EQUALS(bound,"flat")) then - call ApplyFlatBC(ierr,cctkGH,sw,"wavetoy::phi") - else if (CCTK_Equals(bound,"radiation").eq.1) then - call ApplyRadiativeBC(ierr,cctkGH,zero,sw,"wavetoy::phi","wavetoy::phi_old") - end if - - if (ierr < 0) then - call CCTK_WARN(0,"Boundary conditions not applied - giving up!"); - end if - - return - end +c Using Cactus arguments lists +#include "cctk_arguments.h" -c -------------------------------------------------------------- /*@@ @routine WaveToyF77_Evolution @@ -78,24 +32,23 @@ c -------------------------------------------------------------- @@*/ - subroutine WaveToyF77_evolution(CCTK_FARGUMENTS) + subroutine WaveToyF77_Evolution(CCTK_FARGUMENTS) implicit none +c Declare variables in argument list DECLARE_CCTK_FARGUMENTS - DECLARE_CCTK_PARAMETERS -c Declare local variables INTEGER i,j,k INTEGER istart, jstart, kstart, iend, jend, kend CCTK_REAL dx,dy,dz,dt c Set up shorthands c ----------------- - dx = cctk_delta_space(1) - dy = cctk_delta_space(2) - dz = cctk_delta_space(3) - dt = cctk_delta_time + dx = CCTK_DELTA_SPACE(1) + dy = CCTK_DELTA_SPACE(2) + dz = CCTK_DELTA_SPACE(3) + dt = CCTK_DELTA_TIME istart = 2 jstart = 2 @@ -111,18 +64,26 @@ c ---------------- do j = jstart, jend do i = istart, iend - tmp(i,j,k) = - 1 2.0*(1.0 - (dt**2)*(1.0/dx**2 + - 2 1.0/dy**2 +1.0/dz**2))*phi(i,j,k) - - 3 phi_old(i,j,k) + (dt**2) * - 5 ((phi(i+1,j,k)+phi(i-1,j,k))/dx**2 - 6 +(phi(i,j+1,k)+phi(i,j-1,k))/dy**2 - 7 +(phi(i,j,k+1)+phi(i,j,k-1))/dz**2) + phi_next(i,j,k) = + & 2.0*(1.0 - (dt**2)*(1.0/dx**2 + + & 1.0/dy**2 +1.0/dz**2))*phi(i,j,k) - + & phi_old(i,j,k) + (dt**2) * + & ((phi(i+1,j,k)+phi(i-1,j,k))/dx**2 + & +(phi(i,j+1,k)+phi(i,j-1,k))/dy**2 + & +(phi(i,j,k+1)+phi(i,j,k-1))/dz**2) end do end do end do +c Synchronize +c ----------- + call CCTK_SyncGroup(cctkGH,"wavetoyf77::scalartmps") + +c Apply boundary conditions +c ------------------------- + call WaveToyF77_Boundaries(CCTK_PASS_FTOF) + c Update timeslices c ----------------- do k = 1, cctk_lsh(3) @@ -130,25 +91,78 @@ c ----------------- do i = 1, cctk_lsh(1) phi_old(i,j,k) = phi(i,j,k) - phi(i,j,k) = tmp(i,j,k) + phi(i,j,k) = phi_next(i,j,k) end do end do end do -c Apply boundary conditions -c ------------------------- - call WaveToyF77_Boundaries(CCTK_PASS_FTOF) - -c Synchronize -c ----------- - call CCTK_SyncGroup(cctkGH,"wavetoy::scalarevolve") - return end -c -------------------------------------------------------------- + /*@@ + @routine WaveToyF77_Boundaries + @date + @author Tom Goodale + @desc + Boundary conditions for the wave equation + @enddesc + @calls ApplySymmetry,ApplyFlatBC,ApplyRadiativeBC + @history + + @endhistory + +@@*/ + + subroutine WaveToyF77_Boundaries(CCTK_FARGUMENTS) + + implicit none + +c Declare arguement list + DECLARE_CCTK_FARGUMENTS + +c Declare parameters + DECLARE_CCTK_PARAMETERS + +c Local declarations + CCTK_REAL zero + integer ierr + integer sw(3) + +c Cactus declarations + integer CCTK_Equals + + zero = 0.0 + +c Set the stencil width +c --------------------- + sw(1)=1 + sw(2)=1 + sw(3)=1 + +c Apply the symmetry boundary conditions on any coordinate axes +c ------------------------------------------------------------- + call ApplySymmetry(cctkGH,"wavetoyf77::scalartmps") + +c Apply the outer boundary conditions +c ----------------------------------- + if (CCTK_EQUALS(bound,"flat")) then + call ApplyFlatBC(ierr,cctkGH,sw,"wavetoyf77::phi_next") + else if (CCTK_EQUALS(bound,"zero")) then + call ApplyConstantBC(ierr,cctkGH,zero,sw,"wavetoyf77::phi_next") + else if (CCTK_Equals(bound,"radiation").eq.1) then + call ApplyRadiativeBC(ierr,cctkGH,zero,sw,"wavetoyf77::phi_next", + & "wavetoy::phi") + end if + + if (ierr < 0) then + call CCTK_WARN(0,"Boundary conditions not applied - giving up!"); + end if + + return + end + |