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

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

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


Revision 1.9 - (show annotations) (download)
Mon May 25 21:29:45 1998 UTC (26 years ago) by cnh
Branch: MAIN
CVS Tags: checkpoint3
Changes since 1.8: +18 -14 lines
Added flags for turning off momentum equation and/or temperature equation

1 C $Header: /u/gcmpack/models/MITgcmUV/model/src/dynamics.F,v 1.8 1998/05/25 20:05:55 cnh Exp $
2
3 #include "CPP_EEOPTIONS.h"
4
5 SUBROUTINE DYNAMICS(myTime, myIter, myThid)
6 C /==========================================================\
7 C | SUBROUTINE DYNAMICS |
8 C | o Controlling routine for the explicit part of the model |
9 C | dynamics. |
10 C |==========================================================|
11 C | This routine evaluates the "dynamics" terms for each |
12 C | block of ocean in turn. Because the blocks of ocean have |
13 C | overlap regions they are independent of one another. |
14 C | If terms involving lateral integrals are needed in this |
15 C | routine care will be needed. Similarly finite-difference |
16 C | operations with stencils wider than the overlap region |
17 C | require special consideration. |
18 C | Notes |
19 C | ===== |
20 C | C*P* comments indicating place holders for which code is |
21 C | presently being developed. |
22 C \==========================================================/
23
24 C == Global variables ===
25 #include "SIZE.h"
26 #include "EEPARAMS.h"
27 #include "CG2D.h"
28 #include "PARAMS.h"
29 #include "DYNVARS.h"
30
31 C == Routine arguments ==
32 C myTime - Current time in simulation
33 C myIter - Current iteration number in simulation
34 C myThid - Thread number for this instance of the routine.
35 INTEGER myThid
36 _RL myTime
37 INTEGER myIter
38
39 C == Local variables
40 C xA, yA - Per block temporaries holding face areas
41 C uTrans, vTrans, wTrans - Per block temporaries holding flow transport
42 C o uTrans: Zonal transport
43 C o vTrans: Meridional transport
44 C o wTrans: Vertical transport
45 C maskC,maskUp o maskC: land/water mask for tracer cells
46 C o maskUp: land/water mask for W points
47 C aTerm, xTerm, cTerm - Work arrays for holding separate terms in
48 C mTerm, pTerm, tendency equations.
49 C fZon, fMer, fVer[STUV] o aTerm: Advection term
50 C o xTerm: Mixing term
51 C o cTerm: Coriolis term
52 C o mTerm: Metric term
53 C o pTerm: Pressure term
54 C o fZon: Zonal flux term
55 C o fMer: Meridional flux term
56 C o fVer: Vertical flux term - note fVer
57 C is "pipelined" in the vertical
58 C so we need an fVer for each
59 C variable.
60 C iMin, iMax - Ranges and sub-block indices on which calculations
61 C jMin, jMax are applied.
62 C bi, bj
63 C k, kUp, kDown, kM1 - Index for layer above and below. kUp and kDown
64 C are switched with layer to be the appropriate index
65 C into fVerTerm
66 _RS xA (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
67 _RS yA (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
68 _RL uTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
69 _RL vTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
70 _RL wTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
71 _RS maskC (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
72 _RS maskUp(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
73 _RL aTerm (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
74 _RL xTerm (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
75 _RL cTerm (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
76 _RL mTerm (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
77 _RL pTerm (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
78 _RL fZon (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
79 _RL fMer (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
80 _RL fVerT (1-OLx:sNx+OLx,1-OLy:sNy+OLy,2)
81 _RL fVerS (1-OLx:sNx+OLx,1-OLy:sNy+OLy,2)
82 _RL fVerU (1-OLx:sNx+OLx,1-OLy:sNy+OLy,2)
83 _RL fVerV (1-OLx:sNx+OLx,1-OLy:sNy+OLy,2)
84 _RL pH (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nz)
85 _RL rhokm1(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
86 _RL rhokp1(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
87 _RL pSurfX(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
88 _RL pSurfY(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
89 _RL K13 (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nz)
90 _RL K23 (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nz)
91 _RL K33 (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nz)
92 _RL KapGM (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
93 INTEGER iMin, iMax
94 INTEGER jMin, jMax
95 INTEGER bi, bj
96 INTEGER i, j
97 INTEGER k, kM1, kUp, kDown
98
99 C-- Set up work arrays with valid (i.e. not NaN) values
100 C These inital values do not alter the numerical results. They
101 C just ensure that all memory references are to valid floating
102 C point numbers. This prevents spurious hardware signals due to
103 C uninitialised but inert locations.
104 DO j=1-OLy,sNy+OLy
105 DO i=1-OLx,sNx+OLx
106 xA(i,j) = 0. _d 0
107 yA(i,j) = 0. _d 0
108 uTrans(i,j) = 0. _d 0
109 vTrans(i,j) = 0. _d 0
110 aTerm(i,j) = 0. _d 0
111 xTerm(i,j) = 0. _d 0
112 cTerm(i,j) = 0. _d 0
113 mTerm(i,j) = 0. _d 0
114 pTerm(i,j) = 0. _d 0
115 fZon(i,j) = 0. _d 0
116 fMer(i,j) = 0. _d 0
117 DO K=1,nZ
118 pH (i,j,k) = 0. _d 0
119 K13(i,j,k) = 0. _d 0
120 K23(i,j,k) = 0. _d 0
121 K33(i,j,k) = 0. _d 0
122 ENDDO
123 rhokm1(i,j) = 0. _d 0
124 rhokp1(i,j) = 0. _d 0
125 ENDDO
126 ENDDO
127
128 DO bj=myByLo(myThid),myByHi(myThid)
129 DO bi=myBxLo(myThid),myBxHi(myThid)
130
131 C-- Boundary condition on hydrostatic pressure is pH(z=0)=0
132 DO j=1-OLy,sNy+OLy
133 DO i=1-OLx,sNx+OLx
134 pH(i,j,1) = 0. _d 0
135 K13(i,j,1) = 0. _d 0
136 K23(i,j,1) = 0. _d 0
137 K33(i,j,1) = 0. _d 0
138 KapGM(i,j) = 0. _d 0
139 ENDDO
140 ENDDO
141
142 C-- Set up work arrays that need valid initial values
143 DO j=1-OLy,sNy+OLy
144 DO i=1-OLx,sNx+OLx
145 wTrans(i,j) = 0. _d 0
146 fVerT(i,j,1) = 0. _d 0
147 fVerT(i,j,2) = 0. _d 0
148 fVerS(i,j,1) = 0. _d 0
149 fVerS(i,j,2) = 0. _d 0
150 fVerU(i,j,1) = 0. _d 0
151 fVerU(i,j,2) = 0. _d 0
152 fVerV(i,j,1) = 0. _d 0
153 fVerV(i,j,2) = 0. _d 0
154 ENDDO
155 ENDDO
156
157 iMin = 1-OLx+1
158 iMax = sNx+OLx
159 jMin = 1-OLy+1
160 jMax = sNy+OLy
161
162 C-- Calculate gradient of surface pressure
163 CALL GRAD_PSURF(
164 I bi,bj,iMin,iMax,jMin,jMax,
165 O pSurfX,pSurfY,
166 I myThid)
167
168 C-- Update fields in top level according to tendency terms
169 CALL TIMESTEP(
170 I bi,bj,iMin,iMax,jMin,jMax,1,pSurfX,pSurfY,myThid)
171
172 C-- Density of 1st level (below W(1)) reference to level 1
173 CALL FIND_RHO(
174 I bi, bj, iMin, iMax, jMin, jMax, 1, 1, 'LINEAR',
175 O rhoKm1,
176 I myThid )
177 C-- Integrate hydrostatic balance for pH with BC of pH(z=0)=0
178 CALL CALC_PH(
179 I bi,bj,iMin,iMax,jMin,jMax,1,rhoKm1,rhoKm1,
180 U pH,
181 I myThid )
182
183 DO K=2,Nz
184 C-- Update fields in Kth level according to tendency terms
185 CALL TIMESTEP(
186 I bi,bj,iMin,iMax,jMin,jMax,K,pSurfX,pSurfY,myThid)
187 C-- Density of K-1 level (above W(K)) reference to K level
188 CALL FIND_RHO(
189 I bi, bj, iMin, iMax, jMin, jMax, K-1, K, 'LINEAR',
190 O rhoKm1,
191 I myThid )
192 C-- Density of K level (below W(K)) reference to K level
193 CALL FIND_RHO(
194 I bi, bj, iMin, iMax, jMin, jMax, K, K, 'LINEAR',
195 O rhoKp1,
196 I myThid )
197 C-- Calculate iso-neutral slopes for the GM/Redi parameterisation
198 CALL CALC_ISOSLOPES(
199 I bi, bj, iMin, iMax, jMin, jMax, K,
200 I rhoKm1, rhoKp1,
201 O K13, K23, K33, KapGM,
202 I myThid )
203 C-- Calculate static stability and mix where convectively unstable
204 CALL CONVECT(
205 I bi,bj,iMin,iMax,jMin,jMax,K,rhoKm1,rhoKp1,
206 I myTime,myIter,myThid)
207 C-- Density of K-1 level (above W(K)) reference to K-1 level
208 CALL FIND_RHO(
209 I bi, bj, iMin, iMax, jMin, jMax, K-1, K-1, 'LINEAR',
210 O rhoKm1,
211 I myThid )
212 C-- Density of K level (below W(K)) referenced to K level
213 CALL FIND_RHO(
214 I bi, bj, iMin, iMax, jMin, jMax, K, K, 'LINEAR',
215 O rhoKp1,
216 I myThid )
217 C-- Integrate hydrostatic balance for pH with BC of pH(z=0)=0
218 CALL CALC_PH(
219 I bi,bj,iMin,iMax,jMin,jMax,K,rhoKm1,rhoKp1,
220 U pH,
221 I myThid )
222
223 ENDDO
224
225 DO K = Nz, 1, -1
226 kM1 =max(1,k-1) ! Points to level above k (=k-1)
227 kUp =1+MOD(k+1,2) ! Cycles through 1,2 to point to layer above
228 kDown=1+MOD(k,2) ! Cycles through 2,1 to point to current layer
229 iMin = 1-OLx+2
230 iMax = sNx+OLx-1
231 jMin = 1-OLy+2
232 jMax = sNy+OLy-1
233
234 C-- Get temporary terms used by tendency routines
235 CALL CALC_COMMON_FACTORS (
236 I bi,bj,iMin,iMax,jMin,jMax,k,kM1,kUp,kDown,
237 O xA,yA,uTrans,vTrans,wTrans,maskC,maskUp,
238 I myThid)
239
240 C-- Calculate accelerations in the momentum equations
241 IF ( momStepping ) THEN
242 CALL CALC_MOM_RHS(
243 I bi,bj,iMin,iMax,jMin,jMax,k,kM1,kUp,kDown,
244 I xA,yA,uTrans,vTrans,wTrans,maskC,
245 I pH,
246 U aTerm,xTerm,cTerm,mTerm,pTerm,
247 U fZon, fMer, fVerU, fVerV,
248 I myThid)
249 ENDIF
250
251 C-- Calculate active tracer tendencies
252 IF ( tempStepping ) THEN
253 CALL CALC_GT(
254 I bi,bj,iMin,iMax,jMin,jMax, k,kM1,kUp,kDown,
255 I xA,yA,uTrans,vTrans,wTrans,maskUp,
256 I K13,K23,K33,KapGM,
257 U aTerm,xTerm,fZon,fMer,fVerT,
258 I myThid)
259 ENDIF
260 Cdbg CALL CALC_GS(
261 Cdbg I bi,bj,iMin,iMax,jMin,jMax, k,kM1,kUp,kDown,
262 Cdbg I xA,yA,uTrans,vTrans,wTrans,maskUp,
263 Cdbg I K13,K23,K33,KapGM,
264 Cdbg U aTerm,xTerm,fZon,fMer,fVerS,
265 Cdbg I myThid)
266
267 ENDDO
268
269 ENDDO
270 ENDDO
271
272 !dbg write(0,*) 'dynamics: pS',minval(cg2d_x),maxval(cg2d_x)
273 !dbg write(0,*) 'dynamics: U',minval(uVel(1:sNx,1:sNy,:,:,:)),
274 !dbg & maxval(uVel(1:sNx,1:sNy,:,:,:))
275 !dbg write(0,*) 'dynamics: V',minval(vVel(1:sNx,1:sNy,:,:,:)),
276 !dbg & maxval(vVel(1:sNx,1:sNy,:,:,:))
277 !dbg write(0,*) 'dynamics: gT',minval(gT(1:sNx,1:sNy,:,:,:)),
278 !dbg & maxval(gT(1:sNx,1:sNy,:,:,:))
279 !dbg write(0,*) 'dynamics: T',minval(Theta(1:sNx,1:sNy,:,:,:)),
280 !dbg & maxval(Theta(1:sNx,1:sNy,:,:,:))
281 !dbg write(0,*) 'dynamics: pH',minval(pH/(Gravity*Rhonil)),
282 !dbg & maxval(pH/(Gravity*Rhonil))
283
284 RETURN
285 END

  ViewVC Help
Powered by ViewVC 1.1.22