1 |
C $Id$ |
C $Header$ |
2 |
|
|
3 |
#include "CPP_EEOPTIONS.h" |
#include "CPP_EEOPTIONS.h" |
4 |
|
|
25 |
#include "SIZE.h" |
#include "SIZE.h" |
26 |
#include "EEPARAMS.h" |
#include "EEPARAMS.h" |
27 |
#include "CG2D.h" |
#include "CG2D.h" |
28 |
|
#include "DYNVARS.h" |
29 |
|
|
30 |
C == Routine arguments == |
C == Routine arguments == |
31 |
C myThid - Thread number for this instance of the routine. |
C myThid - Thread number for this instance of the routine. |
77 |
_RL fVerU (1-OLx:sNx+OLx,1-OLy:sNy+OLy,2) |
_RL fVerU (1-OLx:sNx+OLx,1-OLy:sNy+OLy,2) |
78 |
_RL fVerV (1-OLx:sNx+OLx,1-OLy:sNy+OLy,2) |
_RL fVerV (1-OLx:sNx+OLx,1-OLy:sNy+OLy,2) |
79 |
_RL pH (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nz) |
_RL pH (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nz) |
80 |
|
_RL rhokm1(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
81 |
|
_RL rhokp1(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
82 |
|
_RL pSurfX(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
83 |
|
_RL pSurfY(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
84 |
INTEGER iMin, iMax |
INTEGER iMin, iMax |
85 |
INTEGER jMin, jMax |
INTEGER jMin, jMax |
86 |
INTEGER bi, bj |
INTEGER bi, bj |
94 |
C uninitialised but inert locations. |
C uninitialised but inert locations. |
95 |
DO j=1-OLy,sNy+OLy |
DO j=1-OLy,sNy+OLy |
96 |
DO i=1-OLx,sNx+OLx |
DO i=1-OLx,sNx+OLx |
97 |
xA(i,j) = 0.*1. _d 37 |
xA(i,j) = 0. _d 0 |
98 |
yA(i,j) = 0.*1. _d 37 |
yA(i,j) = 0. _d 0 |
99 |
uTrans(i,j) = 0.*1. _d 37 |
uTrans(i,j) = 0. _d 0 |
100 |
vTrans(i,j) = 0.*1. _d 37 |
vTrans(i,j) = 0. _d 0 |
101 |
aTerm(i,j) = 0.*1. _d 37 |
aTerm(i,j) = 0. _d 0 |
102 |
xTerm(i,j) = 0.*1. _d 37 |
xTerm(i,j) = 0. _d 0 |
103 |
cTerm(i,j) = 0.*1. _d 37 |
cTerm(i,j) = 0. _d 0 |
104 |
mTerm(i,j) = 0.*1. _d 37 |
mTerm(i,j) = 0. _d 0 |
105 |
pTerm(i,j) = 0.*1. _d 37 |
pTerm(i,j) = 0. _d 0 |
106 |
fZon(i,j) = 0.*1. _d 37 |
fZon(i,j) = 0. _d 0 |
107 |
fMer(i,j) = 0.*1. _d 37 |
fMer(i,j) = 0. _d 0 |
108 |
DO K=1,nZ |
DO K=1,nZ |
109 |
pH (i,j,k) = 0.*1. _d 37 |
pH (i,j,k) = 0. _d 0 |
110 |
ENDDO |
ENDDO |
111 |
|
rhokm1(i,j) = 0. _d 0 |
112 |
|
rhokp1(i,j) = 0. _d 0 |
113 |
ENDDO |
ENDDO |
114 |
ENDDO |
ENDDO |
115 |
C-- Set up work arrays that need valid initial values |
C-- Set up work arrays that need valid initial values |
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 |
134 |
|
DO j=1-OLy,sNy+OLy |
135 |
|
DO i=1-OLx,sNx+OLx |
136 |
|
pH(i,j,1) = 0. _d 0 |
137 |
|
ENDDO |
138 |
|
ENDDO |
139 |
|
|
140 |
iMin = 1-OLx+1 |
iMin = 1-OLx+1 |
141 |
iMax = sNx+OLx |
iMax = sNx+OLx |
142 |
jMin = 1-OLy+1 |
jMin = 1-OLy+1 |
143 |
jMax = sNy+OLy |
jMax = sNy+OLy |
144 |
|
|
145 |
C-- Update fields according to tendency terms |
C-- Calculate gradient of surface pressure |
146 |
|
CALL GRAD_PSURF( |
147 |
|
I bi,bj,iMin,iMax,jMin,jMax, |
148 |
|
O pSurfX,pSurfY, |
149 |
|
I myThid) |
150 |
|
|
151 |
|
C-- Update fields in top level according to tendency terms |
152 |
CALL TIMESTEP( |
CALL TIMESTEP( |
153 |
I bi,bj,iMin,iMax,jMin,jMax,myThid) |
I bi,bj,iMin,iMax,jMin,jMax,1,pSurfX,pSurfY,myThid) |
154 |
|
|
155 |
C-- Calculate rho with the appropriate equation of state |
C Density of 1st level (below W(1)) reference to level 1 |
156 |
CALL FIND_RHO( |
CALL FIND_RHO( |
157 |
I bi,bj,iMin,iMax,jMin,jMax,myThid) |
I bi, bj, iMin, iMax, jMin, jMax, 1, 1, 'LINEAR', |
158 |
|
O rhoKm1, |
159 |
|
I myThid ) |
160 |
|
C-- Integrate hydrostatic balance for pH with BC of pH(z=0)=0 |
161 |
|
CALL CALC_PH( |
162 |
|
I bi,bj,iMin,iMax,jMin,jMax,1,rhoKm1,rhoKm1, |
163 |
|
U pH, |
164 |
|
I myThid ) |
165 |
|
|
166 |
|
DO K=2,Nz |
167 |
|
C-- Update fields in Kth level according to tendency terms |
168 |
|
CALL TIMESTEP( |
169 |
|
I bi,bj,iMin,iMax,jMin,jMax,K,pSurfX,pSurfY,myThid) |
170 |
|
C Density of K-1 level (above W(K)) reference to K level |
171 |
|
CALL FIND_RHO( |
172 |
|
I bi, bj, iMin, iMax, jMin, jMax, K-1, K, 'LINEAR', |
173 |
|
O rhoKm1, |
174 |
|
I myThid ) |
175 |
|
C Density of K level (below W(K)) reference to K level |
176 |
|
CALL FIND_RHO( |
177 |
|
I bi, bj, iMin, iMax, jMin, jMax, K, K, 'LINEAR', |
178 |
|
O rhoKp1, |
179 |
|
I myThid ) |
180 |
C-- Calculate static stability and mix where convectively unstable |
C-- Calculate static stability and mix where convectively unstable |
181 |
CALL CONVECT( |
CALL CONVECT( |
182 |
I bi,bj,iMin,iMax,jMin,jMax,myThid) |
I bi,bj,iMin,iMax,jMin,jMax,K,rhoKm1,rhoKp1,myThid) |
183 |
|
C Density of K-1 level (above W(K)) reference to K-1 level |
184 |
|
CALL FIND_RHO( |
185 |
|
I bi, bj, iMin, iMax, jMin, jMax, K-1, K-1, 'LINEAR', |
186 |
|
O rhoKm1, |
187 |
|
I myThid ) |
188 |
|
C Density of K level (below W(K)) referenced 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-- 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 |
194 |
CALL CALC_PH( |
CALL CALC_PH( |
195 |
I bi,bj,iMin,iMax,jMin,jMax, |
I bi,bj,iMin,iMax,jMin,jMax,K,rhoKm1,rhoKp1, |
196 |
O pH, |
U pH, |
197 |
I myThid ) |
I myThid ) |
198 |
|
|
199 |
|
ENDDO ! K |
200 |
|
|
201 |
DO K = Nz, 1, -1 |
DO K = Nz, 1, -1 |
202 |
kM1 =max(1,k-1) ! Points to level above k (=k-1) |
kM1 =max(1,k-1) ! Points to level above k (=k-1) |
203 |
kUp =1+MOD(k+1,2) ! Cycles through 1,2 to point to layer above |
kUp =1+MOD(k+1,2) ! Cycles through 1,2 to point to layer above |
234 |
Cdbg U aTerm,xTerm,fZon,fMer,fVerS, |
Cdbg U aTerm,xTerm,fZon,fMer,fVerS, |
235 |
Cdbg I myThid) |
Cdbg I myThid) |
236 |
|
|
237 |
ENDDO |
ENDDO ! K |
238 |
|
|
239 |
ENDDO |
ENDDO |
240 |
ENDDO |
ENDDO |