aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorallen <allen@c78560ca-4b45-4335-b268-5f3340f3cb52>1999-02-25 18:17:47 +0000
committerallen <allen@c78560ca-4b45-4335-b268-5f3340f3cb52>1999-02-25 18:17:47 +0000
commitc8e09ec76b7afd18df1576341e98b925f0dd8189 (patch)
treef86f1d8fee581d82529dc8d88aef937052d2b333
parentb52cbc0263f316fb42ca0de7a6f631b4fd5a4f0a (diff)
Uncommented lines and added comments
git-svn-id: http://svn.cactuscode.org/arrangements/CactusBase/CartGrid3D/trunk@4 c78560ca-4b45-4335-b268-5f3340f3cb52
-rw-r--r--src/CartGrid3D.F194
1 files changed, 107 insertions, 87 deletions
diff --git a/src/CartGrid3D.F b/src/CartGrid3D.F
index 5a9332d..b209ec5 100644
--- a/src/CartGrid3D.F
+++ b/src/CartGrid3D.F
@@ -1,4 +1,11 @@
-#define THORN_IS_grid
+ /*@@
+ @file CartGrid3D.F
+ @date Thu Feb 18
+ @author Gabrielle Allen
+ @desc
+ Set up coordinates for a 3D Cartesian grid
+ @enddesc
+ @@*/
#include "cctk.h"
#include "declare_arguments.h"
@@ -11,30 +18,36 @@
DECLARE_CCTK_FARGUMENTS
DECLARE_PARAMETERS
- integer :: iflag, iconv, i, j, k
- REAL :: x0,y0,z0, dx, dy, dz
-
integer :: CCTK_Equals
+ integer :: iflag, iconv, i, j, k
+ REAL :: x0,y0,z0, dx, dy, dz
iflag = 0
iconv = 2**convlevel
- print *,"grid_xmin = ",grid_xmin
+ print *,"GH = ",GH
+ print *,"Grid = ",grid
+ print *,"grid_dx = ",grid_dx
+ print *,"cctk_itfirst = ",cctk_itlast
+
+c --------------------------------------------------------------
+c
+c 1: grids that ignore dx,dy,dz
+c
+c --------------------------------------------------------------
-c Defining all the parameters
-c ---------------------------
- grid_xmin = -1.0
- grid_xmax = 1.0
- grid_ymin = -1.0
- grid_ymax = 1.0
- grid_zmin = -1.0
- grid_zmax = 1.0
-c First, grids that ignore dx,dy,dz
-c ---------------------------------
+c --------------------------------------------------------------
+c
+c 1A: MINMAX
+c
+c User gives: minimum and maximum values of coordinates and
+c the number of gridpoints on the coarse grid
+c
+c --------------------------------------------------------------
-c if (CCTK_Equals(grid,'minmax')) then
+ if (CCTK_Equals(grid,'minmax')==0) then
iflag = iflag +1
@@ -54,102 +67,109 @@ c dx,dy,dz on the grid we are on
dz = coarse_dz/levfac
write(*,'(1X,A,1X,3(A,G12.7,2X))')
- & 'Minmax grid: ','dx=>',dx,'dy=>',dy,'dz=>',dz
+ & 'Minmax grid: Resetting ','dx=>',dx,'dy=>',dy,'dz=>',dz
-c elseif (CCTK_Equals(grid,'box')) then
-c iflag = iflag + 1
+c --------------------------------------------------------------
+c
+c 1B: BOX (-0.5 to 0.5)
+c
+c User gives: number of gridpoints on the coarse grid
+c
+c --------------------------------------------------------------
+
+ elseif (CCTK_Equals(grid,'box')==1) then
+
+ iflag = iflag + 1
-c x0 = -0.5
-c y0 = -0.5
-c z0 = -0.5
-c dx = 1.d0/max(global_nx-1,1)
-c dy = 1.d0/max(global_ny-1,1)
-c dz = 1.d0/max(global_nz-1,1)
-c if (global_nx == 1) x0 = 0.0D0
-c if (global_ny == 1) y0 = 0.0D0
-c if (global_nz == 1) z0 = 0.0D0
+c Coordinates are all -0.5 to 0.5
+ x0 = -0.5
+ y0 = -0.5
+ z0 = -0.5
+
+c dx,dy,dz on the coarsest grid of each GH
+ dx = 1.d0/max(global_sh(1)-1,1)
+ dy = 1.d0/max(global_sh(1)-1,1)
+ dz = 1.d0/max(global_sh(1)-1,1)
-c write(*,'(1X,A,1X,3(A,G12.7,2X))')
-c & 'Box grid: Resetting ','dx=>',dx,'dy=>',dy,'dz=>',dz
+c Special cases
+ if (global_sh(1) == 1) x0 = 0.0D0
+ if (global_sh(2) == 1) y0 = 0.0D0
+ if (global_sh(3) == 1) z0 = 0.0D0
-c Now, grids that use dx,dy,dz
-c ----------------------------
+ write(*,'(1X,A,1X,3(A,G12.7,2X))')
+ & 'Box grid: Resetting ','dx=>',dx,'dy=>',dy,'dz=>',dz
-c else
-c dx = grid_dx*iconv
-c dy = grid_dy*iconv
-c dz = grid_dz*iconv
+c --------------------------------------------------------------
+c
+c 2: grids that use dx,dy,dz
+c
+c --------------------------------------------------------------
-c if (CCTK_Equals(grid,'bitant')) then
+ else
-c iflag = iflag + 1
-c x0 = (0.5 - global_nx/2)*dx
-c y0 = (0.5 - global_ny/2)*dy
+c dx, dy, dz on the grid we are on
+ dx = grid_dx*iconv/levfac
+ dy = grid_dy*iconv/levfac
+ dz = grid_dz*iconv/levfac
-c if(nghostzones == 2) then
-c z0 = -1.5*dz
-c else
-c z0 = -0.5*dz
-c end if
+c -----------------------------------------------------------
+c
+c 2A: bitant
+c
+c User gives: grid spacing on the coarsest GH and
+c the number of gridpoints on the coarsest GH
+c
+c -----------------------------------------------------------
-c end if
+ if (CCTK_Equals(grid,'bitant')==1) then
-c if (CCTK_Equals(grid,'quadrant')) then
+ iflag = iflag + 1
+ x0 = (0.5 - global_sh(1)/2)*dx
+ y0 = (0.5 - global_sh(2)/2)*dy
+ z0 = (-dble(nghostzones)+0.5d0)*dz
-c iflag = iflag + 1
+ end if
-c if(nghostzones == 2) then
-c x0 = -1.5D0*dx
-c y0 = -1.5D0*dy
-c else
-c x0 = -0.5D0*dx
-c y0 = -0.5D0*dy
-c end if
-
-c z0 = (0.5D0 - global_nz/2)*dz
-
-c end if
+ if (CCTK_Equals(grid,'quadrant')==1) then
-c if (CCTK_Equals(grid,'octant')) then
-
-c if(nghostzones == 2) then
+ iflag = iflag + 1
+
+ x0 = (-dble(nghostzones)+0.5d0)*dx
+ y0 = (-dble(nghostzones)+0.5d0)*dy
+ z0 = (0.5D0 - global_sh(3)/2)*dz
-c iflag = iflag + 1
-c x0 = -1.5*dx
-c y0 = -1.5*dy
-c z0 = -1.5*dz
-
-c else
-
-c iflag = iflag + 1
-c x0 = -0.5*dx
-c y0 = -0.5*dy
-c z0 = -0.5*dz
-
-c end if
+ end if
+
+ if (CCTK_Equals(grid,'octant')==1) then
+
+ iflag = iflag + 1
+
+ x0 = (-dble(nghostzones)+0.5d0)*dx
+ y0 = (-dble(nghostzones)+0.5d0)*dy
+ z0 = (-dble(nghostzones)+0.5d0)*dz
-c end if
+ end if
-c if (CCTK_Equals(grid,'full')) then
+ if (CCTK_Equals(grid,'full')==1) then
-c iflag = iflag + 1
-c x0 = (0.5 - global_nx/2)*dx
-c y0 = (0.5 - global_ny/2)*dy
-c z0 = (0.5 - global_nz/2)*dz
+ iflag = iflag + 1
+ x0 = (0.5 - global_sh(1)/2)*dx
+ y0 = (0.5 - global_sh(2)/2)*dy
+ z0 = (0.5 - global_sh(3)/2)*dz
-c end if
+ end if
-c end if
+ end if
c No grid was set up
c ------------------
-c if (iflag.ne.1) then
-c write(*,*) 'setbasegrid error: check your grid keyword'
-c STOP
-c endif
+ if (iflag.ne.1) then
+ call CCTK_Warn(0,"No grid set up in CartGrid3D")
+ call CCTK_Exit(GH)
+ end if
c Set spatial coordinates