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" |
30 |
|
|
31 |
C == Routine arguments == |
C == Routine arguments == |
32 |
C myThid - Thread number for this instance of the routine. |
C myThid - Thread number for this instance of the routine. |
78 |
_RL fVerU (1-OLx:sNx+OLx,1-OLy:sNy+OLy,2) |
_RL fVerU (1-OLx:sNx+OLx,1-OLy:sNy+OLy,2) |
79 |
_RL fVerV (1-OLx:sNx+OLx,1-OLy:sNy+OLy,2) |
_RL fVerV (1-OLx:sNx+OLx,1-OLy:sNy+OLy,2) |
80 |
_RL pH (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nz) |
_RL pH (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nz) |
81 |
|
_RL rhokm1(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
82 |
|
_RL rhokp1(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
83 |
|
_RL pSurfX(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
84 |
|
_RL pSurfY(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
85 |
|
_RL K13 (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nz) |
86 |
|
_RL K23 (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nz) |
87 |
|
_RL K33 (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nz) |
88 |
|
_RL KapGM (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
89 |
INTEGER iMin, iMax |
INTEGER iMin, iMax |
90 |
INTEGER jMin, jMax |
INTEGER jMin, jMax |
91 |
INTEGER bi, bj |
INTEGER bi, bj |
99 |
C uninitialised but inert locations. |
C uninitialised but inert locations. |
100 |
DO j=1-OLy,sNy+OLy |
DO j=1-OLy,sNy+OLy |
101 |
DO i=1-OLx,sNx+OLx |
DO i=1-OLx,sNx+OLx |
102 |
xA(i,j) = 0.*1. _d 37 |
xA(i,j) = 0. _d 0 |
103 |
yA(i,j) = 0.*1. _d 37 |
yA(i,j) = 0. _d 0 |
104 |
uTrans(i,j) = 0.*1. _d 37 |
uTrans(i,j) = 0. _d 0 |
105 |
vTrans(i,j) = 0.*1. _d 37 |
vTrans(i,j) = 0. _d 0 |
106 |
aTerm(i,j) = 0.*1. _d 37 |
aTerm(i,j) = 0. _d 0 |
107 |
xTerm(i,j) = 0.*1. _d 37 |
xTerm(i,j) = 0. _d 0 |
108 |
cTerm(i,j) = 0.*1. _d 37 |
cTerm(i,j) = 0. _d 0 |
109 |
mTerm(i,j) = 0.*1. _d 37 |
mTerm(i,j) = 0. _d 0 |
110 |
pTerm(i,j) = 0.*1. _d 37 |
pTerm(i,j) = 0. _d 0 |
111 |
fZon(i,j) = 0.*1. _d 37 |
fZon(i,j) = 0. _d 0 |
112 |
fMer(i,j) = 0.*1. _d 37 |
fMer(i,j) = 0. _d 0 |
113 |
DO K=1,nZ |
DO K=1,nZ |
114 |
pH (i,j,k) = 0.*1. _d 37 |
pH (i,j,k) = 0. _d 0 |
115 |
|
K13(i,j,k) = 0. _d 0 |
116 |
|
K23(i,j,k) = 0. _d 0 |
117 |
|
K33(i,j,k) = 0. _d 0 |
118 |
ENDDO |
ENDDO |
119 |
ENDDO |
rhokm1(i,j) = 0. _d 0 |
120 |
ENDDO |
rhokp1(i,j) = 0. _d 0 |
|
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 |
|
121 |
ENDDO |
ENDDO |
122 |
ENDDO |
ENDDO |
123 |
|
|
124 |
DO bj=myByLo(myThid),myByHi(myThid) |
DO bj=myByLo(myThid),myByHi(myThid) |
125 |
DO bi=myBxLo(myThid),myBxHi(myThid) |
DO bi=myBxLo(myThid),myBxHi(myThid) |
126 |
|
|
127 |
|
C-- Boundary condition on hydrostatic pressure is pH(z=0)=0 |
128 |
|
DO j=1-OLy,sNy+OLy |
129 |
|
DO i=1-OLx,sNx+OLx |
130 |
|
pH(i,j,1) = 0. _d 0 |
131 |
|
K13(i,j,1) = 0. _d 0 |
132 |
|
K23(i,j,1) = 0. _d 0 |
133 |
|
K33(i,j,1) = 0. _d 0 |
134 |
|
KapGM(i,j) = 0. _d 0 |
135 |
|
ENDDO |
136 |
|
ENDDO |
137 |
|
|
138 |
|
C-- Set up work arrays that need valid initial values |
139 |
|
DO j=1-OLy,sNy+OLy |
140 |
|
DO i=1-OLx,sNx+OLx |
141 |
|
wTrans(i,j) = 0. _d 0 |
142 |
|
fVerT(i,j,1) = 0. _d 0 |
143 |
|
fVerT(i,j,2) = 0. _d 0 |
144 |
|
fVerS(i,j,1) = 0. _d 0 |
145 |
|
fVerS(i,j,2) = 0. _d 0 |
146 |
|
fVerU(i,j,1) = 0. _d 0 |
147 |
|
fVerU(i,j,2) = 0. _d 0 |
148 |
|
fVerV(i,j,1) = 0. _d 0 |
149 |
|
fVerV(i,j,2) = 0. _d 0 |
150 |
|
ENDDO |
151 |
|
ENDDO |
152 |
|
|
153 |
iMin = 1-OLx+1 |
iMin = 1-OLx+1 |
154 |
iMax = sNx+OLx |
iMax = sNx+OLx |
155 |
jMin = 1-OLy+1 |
jMin = 1-OLy+1 |
156 |
jMax = sNy+OLy |
jMax = sNy+OLy |
157 |
|
|
158 |
C-- Update fields according to tendency terms |
C-- Calculate gradient of surface pressure |
159 |
|
CALL GRAD_PSURF( |
160 |
|
I bi,bj,iMin,iMax,jMin,jMax, |
161 |
|
O pSurfX,pSurfY, |
162 |
|
I myThid) |
163 |
|
|
164 |
|
C-- Update fields in top level according to tendency terms |
165 |
CALL TIMESTEP( |
CALL TIMESTEP( |
166 |
I bi,bj,iMin,iMax,jMin,jMax,myThid) |
I bi,bj,iMin,iMax,jMin,jMax,1,pSurfX,pSurfY,myThid) |
167 |
|
|
168 |
C-- Calculate rho with the appropriate equation of state |
C-- Density of 1st level (below W(1)) reference to level 1 |
169 |
CALL FIND_RHO( |
CALL FIND_RHO( |
170 |
I bi,bj,iMin,iMax,jMin,jMax,myThid) |
I bi, bj, iMin, iMax, jMin, jMax, 1, 1, 'LINEAR', |
171 |
|
O rhoKm1, |
172 |
|
I myThid ) |
173 |
|
C-- Integrate hydrostatic balance for pH with BC of pH(z=0)=0 |
174 |
|
CALL CALC_PH( |
175 |
|
I bi,bj,iMin,iMax,jMin,jMax,1,rhoKm1,rhoKm1, |
176 |
|
U pH, |
177 |
|
I myThid ) |
178 |
|
|
179 |
|
DO K=2,Nz |
180 |
|
C-- Update fields in Kth level according to tendency terms |
181 |
|
CALL TIMESTEP( |
182 |
|
I bi,bj,iMin,iMax,jMin,jMax,K,pSurfX,pSurfY,myThid) |
183 |
|
C-- Density of K-1 level (above W(K)) reference to K level |
184 |
|
CALL FIND_RHO( |
185 |
|
I bi, bj, iMin, iMax, jMin, jMax, K-1, K, 'LINEAR', |
186 |
|
O rhoKm1, |
187 |
|
I myThid ) |
188 |
|
C-- Density of K level (below W(K)) reference to K level |
189 |
|
CALL FIND_RHO( |
190 |
|
I bi, bj, iMin, iMax, jMin, jMax, K, K, 'LINEAR', |
191 |
|
O rhoKp1, |
192 |
|
I myThid ) |
193 |
|
C-- Calculate iso-neutral slopes for the GM/Redi parameterisation |
194 |
|
CALL CALC_ISOSLOPES( |
195 |
|
I bi, bj, iMin, iMax, jMin, jMax, K, |
196 |
|
I rhoKm1, rhoKp1, |
197 |
|
O K13, K23, K33, KapGM, |
198 |
|
I myThid ) |
199 |
C-- Calculate static stability and mix where convectively unstable |
C-- Calculate static stability and mix where convectively unstable |
200 |
CALL CONVECT( |
CALL CONVECT( |
201 |
I bi,bj,iMin,iMax,jMin,jMax,myThid) |
I bi,bj,iMin,iMax,jMin,jMax,K,rhoKm1,rhoKp1,myThid) |
202 |
|
C-- Density of K-1 level (above W(K)) reference to K-1 level |
203 |
|
CALL FIND_RHO( |
204 |
|
I bi, bj, iMin, iMax, jMin, jMax, K-1, K-1, 'LINEAR', |
205 |
|
O rhoKm1, |
206 |
|
I myThid ) |
207 |
|
C-- Density of K level (below W(K)) referenced to K level |
208 |
|
CALL FIND_RHO( |
209 |
|
I bi, bj, iMin, iMax, jMin, jMax, K, K, 'LINEAR', |
210 |
|
O rhoKp1, |
211 |
|
I myThid ) |
212 |
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 |
213 |
CALL CALC_PH( |
CALL CALC_PH( |
214 |
I bi,bj,iMin,iMax,jMin,jMax, |
I bi,bj,iMin,iMax,jMin,jMax,K,rhoKm1,rhoKp1, |
215 |
O pH, |
U pH, |
216 |
I myThid ) |
I myThid ) |
217 |
|
|
218 |
|
ENDDO |
219 |
|
|
220 |
DO K = Nz, 1, -1 |
DO K = Nz, 1, -1 |
221 |
kM1 =max(1,k-1) ! Points to level above k (=k-1) |
kM1 =max(1,k-1) ! Points to level above k (=k-1) |
245 |
CALL CALC_GT( |
CALL CALC_GT( |
246 |
I bi,bj,iMin,iMax,jMin,jMax, k,kM1,kUp,kDown, |
I bi,bj,iMin,iMax,jMin,jMax, k,kM1,kUp,kDown, |
247 |
I xA,yA,uTrans,vTrans,wTrans,maskUp, |
I xA,yA,uTrans,vTrans,wTrans,maskUp, |
248 |
|
I K13,K23,K33,KapGM, |
249 |
U aTerm,xTerm,fZon,fMer,fVerT, |
U aTerm,xTerm,fZon,fMer,fVerT, |
250 |
I myThid) |
I myThid) |
251 |
Cdbg CALL CALC_GS( |
Cdbg CALL CALC_GS( |
252 |
Cdbg I bi,bj,iMin,iMax,jMin,jMax, k,kM1,kUp,kDown, |
Cdbg I bi,bj,iMin,iMax,jMin,jMax, k,kM1,kUp,kDown, |
253 |
Cdbg I xA,yA,uTrans,vTrans,wTrans,maskUp, |
Cdbg I xA,yA,uTrans,vTrans,wTrans,maskUp, |
254 |
|
Cdbg I K13,K23,K33,KapGM, |
255 |
Cdbg U aTerm,xTerm,fZon,fMer,fVerS, |
Cdbg U aTerm,xTerm,fZon,fMer,fVerS, |
256 |
Cdbg I myThid) |
Cdbg I myThid) |
257 |
|
|
260 |
ENDDO |
ENDDO |
261 |
ENDDO |
ENDDO |
262 |
|
|
263 |
|
!dbg write(0,*) 'dynamics: pS',minval(cg2d_x),maxval(cg2d_x) |
264 |
|
!dbg write(0,*) 'dynamics: U',minval(uVel(1:sNx,1:sNy,:,:,:)), |
265 |
|
!dbg & maxval(uVel(1:sNx,1:sNy,:,:,:)) |
266 |
|
!dbg write(0,*) 'dynamics: V',minval(vVel(1:sNx,1:sNy,:,:,:)), |
267 |
|
!dbg & maxval(vVel(1:sNx,1:sNy,:,:,:)) |
268 |
|
!dbg write(0,*) 'dynamics: gT',minval(gT(1:sNx,1:sNy,:,:,:)), |
269 |
|
!dbg & maxval(gT(1:sNx,1:sNy,:,:,:)) |
270 |
|
!dbg write(0,*) 'dynamics: T',minval(Theta(1:sNx,1:sNy,:,:,:)), |
271 |
|
!dbg & maxval(Theta(1:sNx,1:sNy,:,:,:)) |
272 |
|
!dbg write(0,*) 'dynamics: pH',minval(pH/(Gravity*Rhonil)), |
273 |
|
!dbg & maxval(pH/(Gravity*Rhonil)) |
274 |
|
|
275 |
RETURN |
RETURN |
276 |
END |
END |