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

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

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


Revision 1.13 - (hide annotations) (download)
Mon Mar 27 22:25:44 2000 UTC (24 years, 1 month ago) by adcroft
Branch: MAIN
CVS Tags: checkpoint28, checkpoint29, checkpoint27, branch-atmos-merge-start, checkpoint26, branch-atmos-merge-shapiro, checkpoint33, checkpoint32, checkpoint31, checkpoint30, checkpoint34, branch-atmos-merge-zonalfilt, branch-atmos-merge-phase5, branch-atmos-merge-phase4, branch-atmos-merge-phase7, branch-atmos-merge-phase6, branch-atmos-merge-phase1, branch-atmos-merge-phase3, branch-atmos-merge-phase2
Branch point for: branch-atmos-merge
Changes since 1.12: +3 -9 lines
Removed unused variables and fixed some unitialized variables.

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

  ViewVC Help
Powered by ViewVC 1.1.22