/[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.24 - (hide annotations) (download)
Thu Dec 22 00:11:11 2011 UTC (12 years, 6 months ago) by jmc
Branch: MAIN
CVS Tags: checkpoint64, checkpoint63p, checkpoint63q, checkpoint63r, checkpoint63s, checkpoint63l, checkpoint63m, checkpoint63n, checkpoint63o, checkpoint63h, checkpoint63i, checkpoint63j, checkpoint63k, checkpoint64a, checkpoint64c, checkpoint64b
Changes since 1.23: +1 -5 lines
remove/avoid un-used variables

1 jmc 1.24 C $Header: /u/gcmpack/MITgcm/model/src/ini_cartesian_grid.F,v 1.23 2011/12/12 19:01:01 jmc Exp $
2 adcroft 1.16 C $Name: $
3 cnh 1.1
4 cnh 1.10 #include "CPP_OPTIONS.h"
5 cnh 1.1
6 cnh 1.17 CBOP
7     C !ROUTINE: INI_CARTESIAN_GRID
8     C !INTERFACE:
9 cnh 1.1 SUBROUTINE INI_CARTESIAN_GRID( myThid )
10 jmc 1.22
11 cnh 1.17 C !DESCRIPTION: \bv
12     C *==========================================================*
13 jmc 1.21 C | SUBROUTINE INI_CARTESIAN_GRID
14     C | o Initialise model coordinate system
15 cnh 1.17 C *==========================================================*
16 jmc 1.21 C | The grid arrays, initialised here, are used throughout
17     C | the code in evaluating gradients, integrals and spatial
18 jmc 1.23 C | avarages. This routine is called separately by each
19     C | thread and initialises only the region of the domain
20     C | it is "responsible" for.
21     C | Under the cartesian grid mode primitive distances
22     C | in X and Y are in metres. Distance in Z are in m or Pa
23 jmc 1.21 C | depending on the vertical gridding mode.
24 cnh 1.17 C *==========================================================*
25     C \ev
26    
27     C !USES:
28 adcroft 1.12 IMPLICIT NONE
29 cnh 1.1 C === Global variables ===
30     #include "SIZE.h"
31     #include "EEPARAMS.h"
32     #include "PARAMS.h"
33     #include "GRID.h"
34    
35 cnh 1.17 C !INPUT/OUTPUT PARAMETERS:
36 cnh 1.1 C == Routine arguments ==
37 jmc 1.23 C myThid :: my Thread Id Number
38 cnh 1.1 INTEGER myThid
39    
40 cnh 1.17 C !LOCAL VARIABLES:
41 cnh 1.1 C == Local variables ==
42 jmc 1.23 C bi,bj :: tile indices
43     C i, j :: loop counters
44     C delXloc :: mesh spacing in X direction
45     C delYloc :: mesh spacing in Y direction
46     C xGloc :: mesh corner-point location (local "Long" real array type)
47     C yGloc :: mesh corner-point location (local "Long" real array type)
48     INTEGER bi, bj
49     INTEGER i, j
50     INTEGER gridNx, gridNy
51     C NOTICE the extended range of indices!!
52     _RL delXloc(0-OLx:sNx+OLx)
53     _RL delYloc(0-OLy:sNy+OLy)
54     C NOTICE the extended range of indices!!
55     _RL xGloc(1-OLx:sNx+OLx+1,1-OLy:sNy+OLy+1)
56     _RL yGloc(1-OLx:sNx+OLx+1,1-OLy:sNy+OLy+1)
57 cnh 1.17 CEOP
58 adcroft 1.16
59 jmc 1.23 C-- For each tile ...
60 cnh 1.1 DO bj = myByLo(myThid), myByHi(myThid)
61     DO bi = myBxLo(myThid), myBxHi(myThid)
62 adcroft 1.16
63 jmc 1.23 C-- set tile local mesh (same units as delX,deY)
64     C corresponding to coordinates of cell corners for N+1 grid-lines
65    
66     CALL INI_LOCAL_GRID(
67     O xGloc, yGloc,
68     O delXloc, delYloc,
69     O gridNx, gridNy,
70     I bi, bj, myThid )
71 adcroft 1.16
72     C-- Make a permanent copy of [xGloc,yGloc] in [xG,yG]
73 jmc 1.23 DO j=1-OLy,sNy+OLy
74     DO i=1-OLx,sNx+OLx
75 jmc 1.22 xG(i,j,bi,bj) = xGloc(i,j)
76     yG(i,j,bi,bj) = yGloc(i,j)
77 adcroft 1.16 ENDDO
78     ENDDO
79    
80     C-- Calculate [xC,yC], coordinates of cell centers
81 jmc 1.23 DO j=1-OLy,sNy+OLy
82     DO i=1-OLx,sNx+OLx
83 adcroft 1.16 C by averaging
84 jmc 1.22 xC(i,j,bi,bj) = 0.25 _d 0*(
85     & xGloc(i,j)+xGloc(i+1,j)+xGloc(i,j+1)+xGloc(i+1,j+1) )
86     yC(i,j,bi,bj) = 0.25 _d 0*(
87     & yGloc(i,j)+yGloc(i+1,j)+yGloc(i,j+1)+yGloc(i+1,j+1) )
88 adcroft 1.16 ENDDO
89     ENDDO
90    
91     C-- Calculate [dxF,dyF], lengths between cell faces (through center)
92 jmc 1.23 DO j=1-OLy,sNy+OLy
93     DO i=1-OLx,sNx+OLx
94     dxF(i,j,bi,bj) = delXloc(i)
95     dyF(i,j,bi,bj) = delYloc(j)
96 adcroft 1.16 ENDDO
97     ENDDO
98    
99     C-- Calculate [dxG,dyG], lengths along cell boundaries
100 jmc 1.23 DO j=1-OLy,sNy+OLy
101     DO i=1-OLx,sNx+OLx
102     dxG(i,j,bi,bj) = delXloc(i)
103     dyG(i,j,bi,bj) = delYloc(j)
104 adcroft 1.16 ENDDO
105     ENDDO
106    
107     C-- The following arrays are not defined in some parts of the halo
108     C region. We set them to zero here for safety. If they are ever
109     C referred to, especially in the denominator then it is a mistake!
110 jmc 1.23 DO j=1-OLy,sNy+OLy
111     DO i=1-OLx,sNx+OLx
112 jmc 1.22 dxC(i,j,bi,bj) = 0.
113     dyC(i,j,bi,bj) = 0.
114     dxV(i,j,bi,bj) = 0.
115     dyU(i,j,bi,bj) = 0.
116     rAw(i,j,bi,bj) = 0.
117     rAs(i,j,bi,bj) = 0.
118 adcroft 1.16 ENDDO
119     ENDDO
120    
121     C-- Calculate [dxC], zonal length between cell centers
122 jmc 1.23 DO j=1-OLy,sNy+OLy
123     DO i=1-OLx+1,sNx+OLx ! NOTE range
124 jmc 1.22 dxC(i,j,bi,bj) = 0.5 _d 0*(dxF(i,j,bi,bj)+dxF(i-1,j,bi,bj))
125 cnh 1.1 ENDDO
126     ENDDO
127 adcroft 1.16
128     C-- Calculate [dyC], meridional length between cell centers
129 jmc 1.23 DO j=1-OLy+1,sNy+OLy ! NOTE range
130     DO i=1-OLx,sNx+OLx
131 jmc 1.22 dyC(i,j,bi,bj) = 0.5 _d 0*(dyF(i,j,bi,bj)+dyF(i,j-1,bi,bj))
132 cnh 1.1 ENDDO
133     ENDDO
134 adcroft 1.16
135     C-- Calculate [dxV,dyU], length between velocity points (through corners)
136 jmc 1.23 DO j=1-OLy+1,sNy+OLy ! NOTE range
137     DO i=1-OLx+1,sNx+OLx ! NOTE range
138 adcroft 1.16 C by averaging (method I)
139 jmc 1.22 dxV(i,j,bi,bj) = 0.5 _d 0*(dxG(i,j,bi,bj)+dxG(i-1,j,bi,bj))
140     dyU(i,j,bi,bj) = 0.5 _d 0*(dyG(i,j,bi,bj)+dyG(i,j-1,bi,bj))
141 adcroft 1.16 C by averaging (method II)
142 jmc 1.22 c dxV(i,j,bi,bj) = 0.5*(dxG(i,j,bi,bj)+dxG(i-1,j,bi,bj))
143     c dyU(i,j,bi,bj) = 0.5*(dyC(i,j,bi,bj)+dyC(i-1,j,bi,bj))
144 cnh 1.1 ENDDO
145     ENDDO
146 adcroft 1.16
147 jmc 1.21 C-- Calculate vertical face area
148 jmc 1.23 DO j=1-OLy,sNy+OLy
149     DO i=1-OLx,sNx+OLx
150 jmc 1.22 rA (i,j,bi,bj) = dxF(i,j,bi,bj)*dyF(i,j,bi,bj)
151     rAw(i,j,bi,bj) = dxC(i,j,bi,bj)*dyG(i,j,bi,bj)
152     rAs(i,j,bi,bj) = dxG(i,j,bi,bj)*dyC(i,j,bi,bj)
153     rAz(i,j,bi,bj) = dxV(i,j,bi,bj)*dyU(i,j,bi,bj)
154 jmc 1.18 C-- Set trigonometric terms & grid orientation:
155 jmc 1.22 tanPhiAtU(i,j,bi,bj) = 0.
156     tanPhiAtV(i,j,bi,bj) = 0.
157     angleCosC(i,j,bi,bj) = 1.
158     angleSinC(i,j,bi,bj) = 0.
159 cnh 1.6 ENDDO
160     ENDDO
161 cnh 1.1
162 adcroft 1.16 C-- Cosine(lat) scaling
163 jmc 1.22 DO j=1-OLy,sNy+OLy
164 jmc 1.23 cosFacU(j,bi,bj) = 1.
165     cosFacV(j,bi,bj) = 1.
166 jmc 1.22 sqcosFacU(j,bi,bj)=1.
167     sqcosFacV(j,bi,bj)=1.
168 adcroft 1.16 ENDDO
169    
170 jmc 1.21 C-- end bi,bj loops
171     ENDDO
172     ENDDO
173 adcroft 1.16
174 cnh 1.1 RETURN
175     END

  ViewVC Help
Powered by ViewVC 1.1.22