2 |
|
|
3 |
#include "CPP_EEOPTIONS.h" |
#include "CPP_EEOPTIONS.h" |
4 |
|
|
5 |
SUBROUTINE DYNAMICS(myThid) |
SUBROUTINE DYNAMICS(myTime, myIter, myThid) |
6 |
C /==========================================================\ |
C /==========================================================\ |
7 |
C | SUBROUTINE DYNAMICS | |
C | SUBROUTINE DYNAMICS | |
8 |
C | o Controlling routine for the explicit part of the model | |
C | o Controlling routine for the explicit part of the model | |
25 |
#include "SIZE.h" |
#include "SIZE.h" |
26 |
#include "EEPARAMS.h" |
#include "EEPARAMS.h" |
27 |
#include "CG2D.h" |
#include "CG2D.h" |
28 |
|
#include "PARAMS.h" |
29 |
#include "DYNVARS.h" |
#include "DYNVARS.h" |
30 |
|
|
31 |
C == Routine arguments == |
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. |
C myThid - Thread number for this instance of the routine. |
35 |
INTEGER myThid |
INTEGER myThid |
36 |
|
_RL myTime |
37 |
|
INTEGER myIter |
38 |
|
|
39 |
C == Local variables |
C == Local variables |
40 |
C xA, yA - Per block temporaries holding face areas |
C xA, yA - Per block temporaries holding face areas |
84 |
_RL pH (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nz) |
_RL pH (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nz) |
85 |
_RL rhokm1(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
_RL rhokm1(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
86 |
_RL rhokp1(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
_RL rhokp1(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
87 |
|
_RL rhotmp(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
88 |
_RL pSurfX(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
_RL pSurfX(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
89 |
_RL pSurfY(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
_RL pSurfY(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
90 |
|
_RL K13 (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nz) |
91 |
|
_RL K23 (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nz) |
92 |
|
_RL K33 (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nz) |
93 |
|
_RL KapGM (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
94 |
INTEGER iMin, iMax |
INTEGER iMin, iMax |
95 |
INTEGER jMin, jMax |
INTEGER jMin, jMax |
96 |
INTEGER bi, bj |
INTEGER bi, bj |
104 |
C uninitialised but inert locations. |
C uninitialised but inert locations. |
105 |
DO j=1-OLy,sNy+OLy |
DO j=1-OLy,sNy+OLy |
106 |
DO i=1-OLx,sNx+OLx |
DO i=1-OLx,sNx+OLx |
107 |
xA(i,j) = 0.*1. _d 37 |
xA(i,j) = 0. _d 0 |
108 |
yA(i,j) = 0.*1. _d 37 |
yA(i,j) = 0. _d 0 |
109 |
uTrans(i,j) = 0.*1. _d 37 |
uTrans(i,j) = 0. _d 0 |
110 |
vTrans(i,j) = 0.*1. _d 37 |
vTrans(i,j) = 0. _d 0 |
111 |
aTerm(i,j) = 0.*1. _d 37 |
aTerm(i,j) = 0. _d 0 |
112 |
xTerm(i,j) = 0.*1. _d 37 |
xTerm(i,j) = 0. _d 0 |
113 |
cTerm(i,j) = 0.*1. _d 37 |
cTerm(i,j) = 0. _d 0 |
114 |
mTerm(i,j) = 0.*1. _d 37 |
mTerm(i,j) = 0. _d 0 |
115 |
pTerm(i,j) = 0.*1. _d 37 |
pTerm(i,j) = 0. _d 0 |
116 |
fZon(i,j) = 0.*1. _d 37 |
fZon(i,j) = 0. _d 0 |
117 |
fMer(i,j) = 0.*1. _d 37 |
fMer(i,j) = 0. _d 0 |
118 |
DO K=1,nZ |
DO K=1,nZ |
119 |
pH (i,j,k) = 0.*1. _d 37 |
pH (i,j,k) = 0. _d 0 |
120 |
|
K13(i,j,k) = 0. _d 0 |
121 |
|
K23(i,j,k) = 0. _d 0 |
122 |
|
K33(i,j,k) = 0. _d 0 |
123 |
ENDDO |
ENDDO |
124 |
rhokm1(i,j) = 0. _d 0 |
rhokm1(i,j) = 0. _d 0 |
125 |
rhokp1(i,j) = 0. _d 0 |
rhokp1(i,j) = 0. _d 0 |
126 |
ENDDO |
rhotmp(i,j) = 0. _d 0 |
|
ENDDO |
|
|
C-- Set up work arrays that need valid initial values |
|
|
DO j=1-OLy,sNy+OLy |
|
|
DO i=1-OLx,sNx+OLx |
|
|
wTrans(i,j) = 0. _d 0 |
|
|
fVerT(i,j,1) = 0. _d 0 |
|
|
fVerT(i,j,2) = 0. _d 0 |
|
|
fVerS(i,j,1) = 0. _d 0 |
|
|
fVerS(i,j,2) = 0. _d 0 |
|
|
fVerU(i,j,1) = 0. _d 0 |
|
|
fVerU(i,j,2) = 0. _d 0 |
|
|
fVerV(i,j,1) = 0. _d 0 |
|
|
fVerV(i,j,2) = 0. _d 0 |
|
127 |
ENDDO |
ENDDO |
128 |
ENDDO |
ENDDO |
129 |
|
|
130 |
DO bj=myByLo(myThid),myByHi(myThid) |
DO bj=myByLo(myThid),myByHi(myThid) |
131 |
DO bi=myBxLo(myThid),myBxHi(myThid) |
DO bi=myBxLo(myThid),myBxHi(myThid) |
132 |
|
|
133 |
C-- Boundary condition on hydrostatic pressure is pH(z=0)=0 |
C-- Boundary condition on hydrostatic pressure is pH(z=0)=0 |
134 |
DO j=1-OLy,sNy+OLy |
DO j=1-OLy,sNy+OLy |
135 |
DO i=1-OLx,sNx+OLx |
DO i=1-OLx,sNx+OLx |
136 |
pH(i,j,1) = 0. _d 0 |
pH(i,j,1) = 0. _d 0 |
137 |
|
K13(i,j,1) = 0. _d 0 |
138 |
|
K23(i,j,1) = 0. _d 0 |
139 |
|
K33(i,j,1) = 0. _d 0 |
140 |
|
KapGM(i,j) = 0. _d 0 |
141 |
|
ENDDO |
142 |
|
ENDDO |
143 |
|
|
144 |
|
C-- Set up work arrays that need valid initial values |
145 |
|
DO j=1-OLy,sNy+OLy |
146 |
|
DO i=1-OLx,sNx+OLx |
147 |
|
wTrans(i,j) = 0. _d 0 |
148 |
|
fVerT(i,j,1) = 0. _d 0 |
149 |
|
fVerT(i,j,2) = 0. _d 0 |
150 |
|
fVerS(i,j,1) = 0. _d 0 |
151 |
|
fVerS(i,j,2) = 0. _d 0 |
152 |
|
fVerU(i,j,1) = 0. _d 0 |
153 |
|
fVerU(i,j,2) = 0. _d 0 |
154 |
|
fVerV(i,j,1) = 0. _d 0 |
155 |
|
fVerV(i,j,2) = 0. _d 0 |
156 |
ENDDO |
ENDDO |
157 |
ENDDO |
ENDDO |
158 |
|
|
171 |
CALL TIMESTEP( |
CALL TIMESTEP( |
172 |
I bi,bj,iMin,iMax,jMin,jMax,1,pSurfX,pSurfY,myThid) |
I bi,bj,iMin,iMax,jMin,jMax,1,pSurfX,pSurfY,myThid) |
173 |
|
|
174 |
|
C-- Density of 1st level (below W(1)) reference to level 1 |
175 |
|
CALL FIND_RHO( |
176 |
|
I bi, bj, iMin, iMax, jMin, jMax, 1, 1, eosType, |
177 |
|
O rhoKm1, |
178 |
|
I myThid ) |
179 |
|
C-- Integrate hydrostatic balance for pH with BC of pH(z=0)=0 |
180 |
|
CALL CALC_PH( |
181 |
|
I bi,bj,iMin,iMax,jMin,jMax,1,rhoKm1,rhoKm1, |
182 |
|
U pH, |
183 |
|
I myThid ) |
184 |
|
DO J=1-Oly,sNy+Oly |
185 |
|
DO I=1-Olx,sNx+Olx |
186 |
|
rhoKp1(I,J)=rhoKm1(I,J) |
187 |
|
ENDDO |
188 |
|
ENDDO |
189 |
|
|
190 |
DO K=2,Nz |
DO K=2,Nz |
191 |
C-- Update fields in Kth level according to tendency terms |
C-- Update fields in Kth level according to tendency terms |
192 |
CALL TIMESTEP( |
CALL TIMESTEP( |
193 |
I bi,bj,iMin,iMax,jMin,jMax,K,pSurfX,pSurfY,myThid) |
I bi,bj,iMin,iMax,jMin,jMax,K,pSurfX,pSurfY,myThid) |
194 |
C Density of K-1 level (above W(K)) reference to K level |
C-- Density of K-1 level (above W(K)) reference to K-1 level |
195 |
CALL FIND_RHO( |
copt CALL FIND_RHO( |
196 |
I bi, bj, iMin, iMax, jMin, jMax, K-1, K, 'LINEAR', |
copt I bi, bj, iMin, iMax, jMin, jMax, K-1, K-1, eosType, |
197 |
O rhoKm1, |
copt O rhoKm1, |
198 |
I myThid ) |
copt I myThid ) |
199 |
C Density of K level (below W(K)) reference to K level |
C rhoKm1=rhoKp1 |
200 |
CALL FIND_RHO( |
DO J=1-Oly,sNy+Oly |
201 |
I bi, bj, iMin, iMax, jMin, jMax, K, K, 'LINEAR', |
DO I=1-Olx,sNx+Olx |
202 |
O rhoKp1, |
rhoKm1(I,J)=rhoKp1(I,J) |
203 |
I myThid ) |
ENDDO |
204 |
|
ENDDO |
205 |
|
C-- Density of K level (below W(K)) reference to K level |
206 |
|
CALL FIND_RHO( |
207 |
|
I bi, bj, iMin, iMax, jMin, jMax, K, K, eosType, |
208 |
|
O rhoKp1, |
209 |
|
I myThid ) |
210 |
|
C-- Density of K-1 level (above W(K)) reference to K level |
211 |
|
CALL FIND_RHO( |
212 |
|
I bi, bj, iMin, iMax, jMin, jMax, K-1, K, eosType, |
213 |
|
O rhotmp, |
214 |
|
I myThid ) |
215 |
|
C-- Calculate iso-neutral slopes for the GM/Redi parameterisation |
216 |
|
CALL CALC_ISOSLOPES( |
217 |
|
I bi, bj, iMin, iMax, jMin, jMax, K, |
218 |
|
I rhoKm1, rhoKp1, rhotmp, |
219 |
|
O K13, K23, K33, KapGM, |
220 |
|
I myThid ) |
221 |
C-- Calculate static stability and mix where convectively unstable |
C-- Calculate static stability and mix where convectively unstable |
222 |
CALL CONVECT( |
CALL CONVECT( |
223 |
I bi,bj,iMin,iMax,jMin,jMax,K,rhoKm1,rhoKp1,myThid) |
I bi,bj,iMin,iMax,jMin,jMax,K,rhoKm1,rhoKp1, |
224 |
C Density of K-1 level (above W(K)) reference to K-1 level |
I myTime,myIter,myThid) |
225 |
CALL FIND_RHO( |
C-- Density of K-1 level (above W(K)) reference to K-1 level |
226 |
I bi, bj, iMin, iMax, jMin, jMax, K-1, K-1, 'LINEAR', |
CALL FIND_RHO( |
227 |
O rhoKm1, |
I bi, bj, iMin, iMax, jMin, jMax, K-1, K-1, eosType, |
228 |
I myThid ) |
O rhoKm1, |
229 |
|
I myThid ) |
230 |
|
C-- Density of K level (below W(K)) referenced to K level |
231 |
|
CALL FIND_RHO( |
232 |
|
I bi, bj, iMin, iMax, jMin, jMax, K, K, eosType, |
233 |
|
O rhoKp1, |
234 |
|
I myThid ) |
235 |
C-- Integrate hydrostatic balance for pH with BC of pH(z=0)=0 |
C-- Integrate hydrostatic balance for pH with BC of pH(z=0)=0 |
236 |
CALL CALC_PH( |
CALL CALC_PH( |
237 |
I bi,bj,iMin,iMax,jMin,jMax,K,rhoKm1, |
I bi,bj,iMin,iMax,jMin,jMax,K,rhoKm1,rhoKp1, |
238 |
U pH, |
U pH, |
|
I myThid ) |
|
|
ENDDO ! K |
|
|
|
|
|
C Density of Nz level (bottom level) reference to Nz level |
|
|
CALL FIND_RHO( |
|
|
I bi, bj, iMin, iMax, jMin, jMax, Nz, Nz, 'LINEAR', |
|
|
O rhoKm1, |
|
239 |
I myThid ) |
I myThid ) |
240 |
C-- Integrate hydrostatic balance for pH with BC of pH(z=0)=0 |
|
241 |
CALL CALC_PH( |
ENDDO |
|
I bi,bj,iMin,iMax,jMin,jMax,Nz+1,rhoKm1, |
|
|
U pH, |
|
|
I myThid ) |
|
242 |
|
|
243 |
DO K = Nz, 1, -1 |
DO K = Nz, 1, -1 |
244 |
kM1 =max(1,k-1) ! Points to level above k (=k-1) |
kM1 =max(1,k-1) ! Points to level above k (=k-1) |
256 |
I myThid) |
I myThid) |
257 |
|
|
258 |
C-- Calculate accelerations in the momentum equations |
C-- Calculate accelerations in the momentum equations |
259 |
CALL CALC_MOM_RHS( |
IF ( momStepping ) THEN |
260 |
I bi,bj,iMin,iMax,jMin,jMax,k,kM1,kUp,kDown, |
CALL CALC_MOM_RHS( |
261 |
I xA,yA,uTrans,vTrans,wTrans,maskC, |
I bi,bj,iMin,iMax,jMin,jMax,k,kM1,kUp,kDown, |
262 |
I pH, |
I xA,yA,uTrans,vTrans,wTrans,maskC, |
263 |
U aTerm,xTerm,cTerm,mTerm,pTerm, |
I pH, |
264 |
U fZon, fMer, fVerU, fVerV, |
U aTerm,xTerm,cTerm,mTerm,pTerm, |
265 |
I myThid) |
U fZon, fMer, fVerU, fVerV, |
266 |
|
I myThid) |
267 |
|
ENDIF |
268 |
|
|
269 |
C-- Calculate active tracer tendencies |
C-- Calculate active tracer tendencies |
270 |
CALL CALC_GT( |
IF ( tempStepping ) THEN |
271 |
I bi,bj,iMin,iMax,jMin,jMax, k,kM1,kUp,kDown, |
CALL CALC_GT( |
272 |
I xA,yA,uTrans,vTrans,wTrans,maskUp, |
I bi,bj,iMin,iMax,jMin,jMax, k,kM1,kUp,kDown, |
273 |
U aTerm,xTerm,fZon,fMer,fVerT, |
I xA,yA,uTrans,vTrans,wTrans,maskUp, |
274 |
I myThid) |
I K13,K23,K33,KapGM, |
275 |
|
U aTerm,xTerm,fZon,fMer,fVerT, |
276 |
|
I myThid) |
277 |
|
ENDIF |
278 |
Cdbg CALL CALC_GS( |
Cdbg CALL CALC_GS( |
279 |
Cdbg I bi,bj,iMin,iMax,jMin,jMax, k,kM1,kUp,kDown, |
Cdbg I bi,bj,iMin,iMax,jMin,jMax, k,kM1,kUp,kDown, |
280 |
Cdbg I xA,yA,uTrans,vTrans,wTrans,maskUp, |
Cdbg I xA,yA,uTrans,vTrans,wTrans,maskUp, |
281 |
|
Cdbg I K13,K23,K33,KapGM, |
282 |
Cdbg U aTerm,xTerm,fZon,fMer,fVerS, |
Cdbg U aTerm,xTerm,fZon,fMer,fVerS, |
283 |
Cdbg I myThid) |
Cdbg I myThid) |
284 |
|
|
287 |
ENDDO |
ENDDO |
288 |
ENDDO |
ENDDO |
289 |
|
|
290 |
|
!dbg write(0,*) 'dynamics: pS',minval(cg2d_x),maxval(cg2d_x) |
291 |
|
!dbg write(0,*) 'dynamics: U',minval(uVel(1:sNx,1:sNy,:,:,:)), |
292 |
|
!dbg & maxval(uVel(1:sNx,1:sNy,:,:,:)) |
293 |
|
!dbg write(0,*) 'dynamics: V',minval(vVel(1:sNx,1:sNy,:,:,:)), |
294 |
|
!dbg & maxval(vVel(1:sNx,1:sNy,:,:,:)) |
295 |
|
!dbg write(0,*) 'dynamics: K13',minval(K13(1:sNx,1:sNy,:)), |
296 |
|
!dbg & maxval(K13(1:sNx,1:sNy,:)) |
297 |
|
!dbg write(0,*) 'dynamics: K23',minval(K23(1:sNx,1:sNy,:)), |
298 |
|
!dbg & maxval(K23(1:sNx,1:sNy,:)) |
299 |
|
!dbg write(0,*) 'dynamics: K33',minval(K33(1:sNx,1:sNy,:)), |
300 |
|
!dbg & maxval(K33(1:sNx,1:sNy,:)) |
301 |
|
!dbg write(0,*) 'dynamics: gT',minval(gT(1:sNx,1:sNy,:,:,:)), |
302 |
|
!dbg & maxval(gT(1:sNx,1:sNy,:,:,:)) |
303 |
|
!dbg write(0,*) 'dynamics: T',minval(Theta(1:sNx,1:sNy,:,:,:)), |
304 |
|
!dbg & maxval(Theta(1:sNx,1:sNy,:,:,:)) |
305 |
|
!dbg write(0,*) 'dynamics: pH',minval(pH/(Gravity*Rhonil)), |
306 |
|
!dbg & maxval(pH/(Gravity*Rhonil)) |
307 |
|
|
308 |
RETURN |
RETURN |
309 |
END |
END |