/[MITgcm]/MITgcm/model/src/ini_cartesian_grid.F
ViewVC logotype

Contents of /MITgcm/model/src/ini_cartesian_grid.F

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.15 - (show annotations) (download)
Sun Feb 4 14:38:47 2001 UTC (23 years, 3 months ago) by cnh
Branch: MAIN
CVS Tags: checkpoint38, c37_adj, checkpoint39, checkpoint37, checkpoint36, checkpoint35
Branch point for: pre38
Changes since 1.14: +2 -1 lines
Made sure each .F and .h file had
the CVS keywords Header and Name at its start.
Most had header but very few currently have Name, so
lots of changes!

1 C $Header: /u/gcmpack/models/MITgcmUV/model/src/ini_cartesian_grid.F,v 1.14 2001/02/02 21:04:48 adcroft Exp $
2 C $Name: $
3
4 #include "CPP_OPTIONS.h"
5
6 CStartOfInterface
7 SUBROUTINE INI_CARTESIAN_GRID( myThid )
8 C /==========================================================\
9 C | SUBROUTINE INI_CARTESIAN_GRID |
10 C | o Initialise model coordinate system |
11 C |==========================================================|
12 C | These arrays are used throughout the code in evaluating |
13 C | gradients, integrals and spatial avarages. This routine |
14 C | is called separately by each thread and initialise only |
15 C | the region of the domain it is "responsible" for. |
16 C | Notes: |
17 C | Two examples are included. One illustrates the |
18 C | initialisation of a cartesian grid. The other shows the |
19 C | inialisation of a spherical polar grid. Other orthonormal|
20 C | grids can be fitted into this design. In this case |
21 C | custom metric terms also need adding to account for the |
22 C | projections of velocity vectors onto these grids. |
23 C | The structure used here also makes it possible to |
24 C | implement less regular grid mappings. In particular |
25 C | o Schemes which leave out blocks of the domain that are |
26 C | all land could be supported. |
27 C | o Multi-level schemes such as icosohedral or cubic |
28 C | grid projections onto a sphere can also be fitted |
29 C | within the strategy we use. |
30 C | Both of the above also require modifying the support |
31 C | routines that map computational blocks to simulation |
32 C | domain blocks. |
33 C | Under the cartesian grid mode primitive distances in X |
34 C | and Y are in metres. Disktance in Z are in m or Pa |
35 C | depending on the vertical gridding mode. |
36 C \==========================================================/
37 IMPLICIT NONE
38
39 C === Global variables ===
40 #include "SIZE.h"
41 #include "EEPARAMS.h"
42 #include "PARAMS.h"
43 #include "GRID.h"
44
45 C == Routine arguments ==
46 C myThid - Number of this instance of INI_CARTESIAN_GRID
47 INTEGER myThid
48 CEndOfInterface
49
50 C == Local variables ==
51 C xG, yG - Global coordinate location.
52 C xBase - South-west corner location for process.
53 C yBase
54 C zUpper - Work arrays for upper and lower
55 C zLower cell-face heights.
56 C phi - Temporary scalar
57 C xBase - Temporaries for lower corner coordinate
58 C yBase
59 C iG, jG - Global coordinate index. Usually used to hold
60 C the south-west global coordinate of a tile.
61 C bi,bj - Loop counters
62 C zUpper - Temporary arrays holding z coordinates of
63 C zLower upper and lower faces.
64 C I,J,K
65 _RL xGloc, yGloc
66 _RL xBase, yBase
67 INTEGER iG, jG
68 INTEGER bi, bj
69 INTEGER I, J
70
71 C-- Simple example of inialisation on cartesian grid
72 C-- First set coordinates of cell centers
73 C This operation is only performed at start up so for more
74 C complex configurations it is usually OK to pass iG, jG to a custom
75 C function and have it return xG and yG.
76 C Set up my local grid first
77 xC0 = 0. _d 0
78 yC0 = 0. _d 0
79 DO bj = myByLo(myThid), myByHi(myThid)
80 jG = myYGlobalLo + (bj-1)*sNy
81 DO bi = myBxLo(myThid), myBxHi(myThid)
82 iG = myXGlobalLo + (bi-1)*sNx
83 yBase = 0. _d 0
84 xBase = 0. _d 0
85 DO i=1,iG-1
86 xBase = xBase + delX(i)
87 ENDDO
88 DO j=1,jG-1
89 yBase = yBase + delY(j)
90 ENDDO
91 yGloc = yBase
92 DO J=1,sNy
93 xGloc = xBase
94 DO I=1,sNx
95 xG(I,J,bi,bj) = xGloc
96 yG(I,J,bi,bj) = yGloc
97 xc(I,J,bi,bj) = xGloc + delX(iG+i-1)*0.5 _d 0
98 yc(I,J,bi,bj) = yGloc + delY(jG+j-1)*0.5 _d 0
99 xGloc = xGloc + delX(iG+I-1)
100 dxF(I,J,bi,bj) = delX(iG+i-1)
101 dyF(I,J,bi,bj) = delY(jG+j-1)
102 ENDDO
103 yGloc = yGloc + delY(jG+J-1)
104 ENDDO
105 ENDDO
106 ENDDO
107 C Now sync. and get edge regions from other threads and/or processes.
108 C Note: We could just set the overlap regions ourselves here but
109 C exchanging edges is safer and is good practice!
110 _EXCH_XY_R4( xc, myThid )
111 _EXCH_XY_R4( yc, myThid )
112 _EXCH_XY_R4(dxF, myThid )
113 _EXCH_XY_R4(dyF, myThid )
114
115 C-- Calculate separation between other points
116 C dxG, dyG are separations between cell corners along cell faces.
117 DO bj = myByLo(myThid), myByHi(myThid)
118 DO bi = myBxLo(myThid), myBxHi(myThid)
119 DO J=1,sNy
120 DO I=1,sNx
121 dxG(I,J,bi,bj) = (dxF(I,J,bi,bj)+dxF(I,J-1,bi,bj))*0.5 _d 0
122 dyG(I,J,bi,bj) = (dyF(I,J,bi,bj)+dyF(I-1,J,bi,bj))*0.5 _d 0
123 ENDDO
124 ENDDO
125 ENDDO
126 ENDDO
127 _EXCH_XY_R4(dxG, myThid )
128 _EXCH_XY_R4(dyG, myThid )
129 C dxV, dyU are separations between velocity points along cell faces.
130 DO bj = myByLo(myThid), myByHi(myThid)
131 DO bi = myBxLo(myThid), myBxHi(myThid)
132 DO J=1,sNy
133 DO I=1,sNx
134 dxV(I,J,bi,bj) = (dxG(I,J,bi,bj)+dxG(I-1,J,bi,bj))*0.5 _d 0
135 dyU(I,J,bi,bj) = (dyG(I,J,bi,bj)+dyG(I,J-1,bi,bj))*0.5 _d 0
136 ENDDO
137 ENDDO
138 ENDDO
139 ENDDO
140 _EXCH_XY_R4(dxV, myThid )
141 _EXCH_XY_R4(dyU, myThid )
142 C dxC, dyC is separation between cell centers
143 DO bj = myByLo(myThid), myByHi(myThid)
144 DO bi = myBxLo(myThid), myBxHi(myThid)
145 DO J=1,sNy
146 DO I=1,sNx
147 dxC(I,J,bi,bj) = (dxF(I,J,bi,bj)+dxF(I-1,J,bi,bj))*0.5 _d 0
148 dyC(I,J,bi,bj) = (dyF(I,J,bi,bj)+dyF(I,J-1,bi,bj))*0.5 _d 0
149 ENDDO
150 ENDDO
151 ENDDO
152 ENDDO
153 _EXCH_XY_R4(dxC, myThid )
154 _EXCH_XY_R4(dyC, myThid )
155 C Calculate vertical face area
156 DO bj = myByLo(myThid), myByHi(myThid)
157 DO bi = myBxLo(myThid), myBxHi(myThid)
158 DO J=1,sNy
159 DO I=1,sNx
160 rA (I,J,bi,bj) = dxF(I,J,bi,bj)*dyF(I,J,bi,bj)
161 rAw(I,J,bi,bj) = dxC(I,J,bi,bj)*dyG(I,J,bi,bj)
162 rAs(I,J,bi,bj) = dxG(I,J,bi,bj)*dyC(I,J,bi,bj)
163 rAz(I,J,bi,bj) = dxV(I,J,bi,bj)*dyU(I,J,bi,bj)
164 tanPhiAtU(I,J,bi,bj) = 0. _d 0
165 tanPhiAtV(I,J,bi,bj) = 0. _d 0
166 ENDDO
167 ENDDO
168 ENDDO
169 ENDDO
170 _EXCH_XY_R4 (rA , myThid )
171 _EXCH_XY_R4 (rAw , myThid )
172 _EXCH_XY_R4 (rAs , myThid )
173 _EXCH_XY_R4 (tanPhiAtU , myThid )
174 _EXCH_XY_R4 (tanPhiAtV , myThid )
175
176 C
177 RETURN
178 END

  ViewVC Help
Powered by ViewVC 1.1.22