From 2034d2746037f5a926c9f3d0da89b5d9e7ab5756 Mon Sep 17 00:00:00 2001 From: allen Date: Tue, 14 Sep 1999 11:37:28 +0000 Subject: Design changes git-svn-id: http://svn.cactuscode.org/arrangements/CactusWave/WaveToyF77/trunk@23 4451c3c6-1034-4891-99ea-21147727ccdf --- interface.ccl | 6 +- param.ccl | 1 + schedule.ccl | 3 +- src/InitSymBound.F77 | 1 + src/WaveToy.F77 | 164 ++++++++++++++++++++++++++++----------------------- 5 files changed, 95 insertions(+), 80 deletions(-) diff --git a/interface.ccl b/interface.ccl index f8be420..3d135c8 100644 --- a/interface.ccl +++ b/interface.ccl @@ -2,7 +2,7 @@ # $Header$ implements: wavetoy - + public: cctk_real scalarevolve type = GF @@ -10,8 +10,6 @@ cctk_real scalarevolve type = GF phi } "The evolved scalar field" -protected: - cctk_real scalarold type = GF { phi_old @@ -21,7 +19,7 @@ private: cctk_real scalartmps type = GF { - tmp + phi_next } "Temporary GFs for WaveToy" diff --git a/param.ccl b/param.ccl index fc1009c..4c545dc 100644 --- a/param.ccl +++ b/param.ccl @@ -8,6 +8,7 @@ KEYWORD bound "Type of boundary condition to use" "none" :: "No boundary condition" "flat" :: "Flat boundary condition" "radiation" :: "Radiation boundary condition" + "zero" :: "Zero boundary condition" } "none" diff --git a/schedule.ccl b/schedule.ccl index 416d4c8..7c39c3f 100644 --- a/schedule.ccl +++ b/schedule.ccl @@ -21,7 +21,8 @@ COMMUNICATION: scalarevolve schedule WaveToyF77_Evolution at CCTK_EVOL { LANG: Fortran - STORAGE: scalartmps + STORAGE:scalartmps + COMMUNICATION:scalartmps } "Evolution of 3D wave equation" 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 + -- cgit v1.2.3