1 |
C $Header$ |
C $Header$ |
2 |
C $Name$ |
C $Name$ |
3 |
|
|
4 |
|
#include "FIZHI_OPTIONS.h" |
5 |
subroutine fizhi_init_vars (myThid) |
subroutine fizhi_init_vars (myThid) |
6 |
c----------------------------------------------------------------------- |
c----------------------------------------------------------------------- |
7 |
c Routine to initialise the fizhi state. |
c Routine to initialise the fizhi state. |
21 |
c Calls: dyn2phys (x4) |
c Calls: dyn2phys (x4) |
22 |
c----------------------------------------------------------------------- |
c----------------------------------------------------------------------- |
23 |
implicit none |
implicit none |
|
#include "CPP_OPTIONS.h" |
|
24 |
#include "SIZE.h" |
#include "SIZE.h" |
25 |
#include "fizhi_SIZE.h" |
#include "fizhi_SIZE.h" |
26 |
#include "land_SIZE.h" |
#include "fizhi_land_SIZE.h" |
27 |
#include "GRID.h" |
#include "GRID.h" |
28 |
#include "DYNVARS.h" |
#include "DYNVARS.h" |
29 |
#include "gridalt_mapping.h" |
#include "gridalt_mapping.h" |
30 |
#include "fizhi_coms.h" |
#include "fizhi_coms.h" |
31 |
#include "land_coms.h" |
#include "fizhi_land_coms.h" |
32 |
|
#include "fizhi_earth_coms.h" |
33 |
#include "EEPARAMS.h" |
#include "EEPARAMS.h" |
34 |
#include "SURFACE.h" |
#include "SURFACE.h" |
35 |
#include "PARAMS.h" |
#include "PARAMS.h" |
36 |
|
#include "chronos.h" |
37 |
|
|
38 |
integer myThid |
integer myThid |
39 |
|
|
43 |
_RL windphy(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nrphys,nSx,nSy) |
_RL windphy(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nrphys,nSx,nSy) |
44 |
_RL udyntemp(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy) |
_RL udyntemp(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy) |
45 |
_RL vdyntemp(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy) |
_RL vdyntemp(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy) |
46 |
|
_RL tempphy(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nrphys,nSx,nSy) |
47 |
|
|
48 |
integer i, j, L, bi, bj, Lbotij |
integer i, j, L, bi, bj, Lbotij |
49 |
integer im1, im2, jm1, jm2, idim1, idim2, jdim1, jdim2 |
integer im1, im2, jm1, jm2, idim1, idim2, jdim1, jdim2 |
50 |
|
logical alarm |
51 |
|
external alarm |
52 |
|
|
53 |
im1 = 1-OLx |
im1 = 1-OLx |
54 |
im2 = sNx+OLx |
im2 = sNx+OLx |
59 |
jdim1 = 1 |
jdim1 = 1 |
60 |
jdim2 = sNy |
jdim2 = sNy |
61 |
|
|
62 |
IF ( startTime.EQ.0. .AND. nIter0.EQ.0 ) THEN |
c First Check to see if we can start a fizhi experiment at current time |
63 |
print *,' In fizhi_init_vars: Cold start ' |
c All Fizhi alarms must be on for the first time step of a segment |
64 |
|
|
65 |
|
if( .not.alarm('moist') .or. .not.alarm('turb') .or. |
66 |
|
. .not.alarm('radsw') .or. .not.alarm('radlw') ) then |
67 |
|
print *,' Cant Start Fizhi experiment at ',nymd,' ',nhms |
68 |
|
stop |
69 |
|
endif |
70 |
|
|
71 |
|
C Deal Here with Variables that are on a Fizhi Pickup or need Initialization |
72 |
|
|
73 |
|
IF ( startTime.EQ.baseTime .AND. nIter0.EQ.0 ) THEN |
74 |
|
print *,' In fizhi_init_vars: Beginning of New Experiment ' |
75 |
|
|
76 |
do bj = myByLo(myThid), myByHi(myThid) |
do bj = myByLo(myThid), myByHi(myThid) |
77 |
do bi = myBxLo(myThid), myBxHi(myThid) |
do bi = myBxLo(myThid), myBxHi(myThid) |
140 |
|
|
141 |
c Create initial fields on phys. grid - interpolate from dyn. grid |
c Create initial fields on phys. grid - interpolate from dyn. grid |
142 |
call dyn2phys(udyntemp,pedyn,im1,im2,jm1,jm2,Nr,Nsx,Nsy, |
call dyn2phys(udyntemp,pedyn,im1,im2,jm1,jm2,Nr,Nsx,Nsy, |
143 |
. 1,sNx,1,sNy,bi,bj,windphy,pephy,ksurfC,Nrphys,nlperdyn,1,uphy) |
. 1,sNx,1,sNy,bi,bj,windphy,pephy,ksurfC,Nrphys,nlperdyn,1,tempphy) |
144 |
|
c Note: Interpolation gives bottom-up arrays (level 1 is bottom), |
145 |
|
c Physics works top-down. so -> need to flip arrays |
146 |
|
do L = 1,Nrphys |
147 |
|
do j = 1,sNy |
148 |
|
do i = 1,sNx |
149 |
|
uphy(i,j,Nrphys+1-L,bi,bj) = tempphy(i,j,L,bi,bj) |
150 |
|
enddo |
151 |
|
enddo |
152 |
|
enddo |
153 |
call dyn2phys(vdyntemp,pedyn,im1,im2,jm1,jm2,Nr,Nsx,Nsy, |
call dyn2phys(vdyntemp,pedyn,im1,im2,jm1,jm2,Nr,Nsx,Nsy, |
154 |
. 1,sNx,1,sNy,bi,bj,windphy,pephy,ksurfC,Nrphys,nlperdyn,1,vphy) |
. 1,sNx,1,sNy,bi,bj,windphy,pephy,ksurfC,Nrphys,nlperdyn,1,tempphy) |
155 |
|
do L = 1,Nrphys |
156 |
|
do j = 1,sNy |
157 |
|
do i = 1,sNx |
158 |
|
vphy(i,j,Nrphys+1-L,bi,bj) = tempphy(i,j,L,bi,bj) |
159 |
|
enddo |
160 |
|
enddo |
161 |
|
enddo |
162 |
call dyn2phys(theta,pedyn,im1,im2,jm1,jm2,Nr,Nsx,Nsy, |
call dyn2phys(theta,pedyn,im1,im2,jm1,jm2,Nr,Nsx,Nsy, |
163 |
. 1,sNx,1,sNy,bi,bj,windphy,pephy,ksurfC,Nrphys,nlperdyn,0,thphy) |
. 1,sNx,1,sNy,bi,bj,windphy,pephy,ksurfC,Nrphys,nlperdyn,0,tempphy) |
164 |
|
do L = 1,Nrphys |
165 |
|
do j = 1,sNy |
166 |
|
do i = 1,sNx |
167 |
|
thphy(i,j,Nrphys+1-L,bi,bj) = tempphy(i,j,L,bi,bj) |
168 |
|
enddo |
169 |
|
enddo |
170 |
|
enddo |
171 |
|
|
172 |
call dyn2phys(salt,pedyn,im1,im2,jm1,jm2,Nr,Nsx,Nsy, |
call dyn2phys(salt,pedyn,im1,im2,jm1,jm2,Nr,Nsx,Nsy, |
173 |
. 1,sNx,1,sNy,bi,bj,windphy,pephy,ksurfC,Nrphys,nlperdyn,0,sphy) |
. 1,sNx,1,sNy,bi,bj,windphy,pephy,ksurfC,Nrphys,nlperdyn,0,tempphy) |
174 |
|
do L = 1,Nrphys |
175 |
|
do j = 1,sNy |
176 |
|
do i = 1,sNx |
177 |
|
sphy(i,j,Nrphys+1-L,bi,bj) = tempphy(i,j,L,bi,bj) |
178 |
|
enddo |
179 |
|
enddo |
180 |
|
enddo |
181 |
|
|
182 |
c Now initialize tke, xlmt, khmt, xxmt, yymt, ctmt, zetamt, |
c Zero out fizhi tendency arrays on the fizhi grid |
183 |
c Now initialize land state too - tcanopy, etc... |
do L = 1,Nrphys |
184 |
do L = 1,Nrphys |
do j = 1,sNy |
185 |
do i = 1,nchp |
do i = 1,sNx |
186 |
tke(i,L,bi,bj) = 0. |
duphy(i,j,L,bi,bj) = 0. |
187 |
xlmt(i,L,bi,bj) = 0. |
dvphy(i,j,L,bi,bj) = 0. |
188 |
khmt(i,L,bi,bj) = 0. |
dthphy(i,j,L,bi,bj) = 0. |
189 |
|
dsphy(i,j,L,bi,bj) = 0. |
190 |
enddo |
enddo |
191 |
enddo |
enddo |
192 |
c Now initialize land state too - tcanopy, etc... ZERO FOR NOW, |
enddo |
193 |
|
|
194 |
|
c Zero out fizhi tendency arrays on the dynamics grid |
195 |
|
do L = 1,Nr |
196 |
|
do j = jm1,jm2 |
197 |
|
do i = im1,im2 |
198 |
|
guphy(i,j,L,bi,bj) = 0. |
199 |
|
gvphy(i,j,L,bi,bj) = 0. |
200 |
|
gthphy(i,j,L,bi,bj) = 0. |
201 |
|
gsphy(i,j,L,bi,bj) = 0. |
202 |
|
enddo |
203 |
|
enddo |
204 |
|
enddo |
205 |
|
|
206 |
|
c Initialize vegetation tile tke, xlmt, khmt, xxmt, yymt, ctmt, zetamt, |
207 |
|
if( (nhms.eq.nhms0) .and. (nymd.eq.nymd0) ) then |
208 |
|
print *,' Cold Start: Zero out Turb second moments ' |
209 |
|
do i = 1,nchp |
210 |
|
ctmt(i,bi,bj) = 0. |
211 |
|
xxmt(i,bi,bj) = 0. |
212 |
|
yymt(i,bi,bj) = 0. |
213 |
|
zetamt(i,bi,bj) = 0. |
214 |
|
enddo |
215 |
|
do L = 1,Nrphys |
216 |
|
do i = 1,nchp |
217 |
|
tke(i,L,bi,bj) = 0. |
218 |
|
xlmt(i,L,bi,bj) = 0. |
219 |
|
khmt(i,L,bi,bj) = 0. |
220 |
|
enddo |
221 |
|
enddo |
222 |
|
else |
223 |
|
print *,' Need initial Values for TKE - dont have them! ' |
224 |
|
stop |
225 |
|
endif |
226 |
|
|
227 |
|
c Now initialize vegetation tile land state too - tcanopy, etc... |
228 |
|
c call fizhi_init_vegsurftiles( nymd,nhms, 'D', myThid ) |
229 |
|
c Now initialize land state too - tcanopy, etc... SET FOR NOW, |
230 |
c READ CLIM FOR REAL |
c READ CLIM FOR REAL |
231 |
do i = 1,nchp |
do i = 1,nchp |
232 |
tcanopy(i) = 0. |
tcanopy(i,bi,bj) = 283. |
233 |
tdeep(i) = 0. |
tdeep(i,bi,bj) = 282.5 |
234 |
ecanopy(i) = 0. |
ecanopy(i,bi,bj) = 2.e-2 |
235 |
swetshal(i) = 0. |
swetshal(i,bi,bj) = 0.6 |
236 |
swetroot(i) = 0. |
swetroot(i,bi,bj) = 0.5 |
237 |
swetdeep(i) = 0. |
swetdeep(i,bi,bj) = 0.5 |
238 |
capac(i) = 0. |
capac(i,bi,bj) = 0. |
239 |
snodep(i) = 0. |
snodep(i,bi,bj) = 0. |
240 |
enddo |
enddo |
241 |
|
|
242 |
|
c Now initialize fizhi arrays that will be on a pickup |
243 |
|
print *,' Initialize fizhi arrays that will be on pickup ' |
244 |
|
imstturblw(bi,bj) = 0 |
245 |
|
imstturbsw(bi,bj) = 0 |
246 |
|
iras(bi,bj) = 0 |
247 |
|
nlwcld(bi,bj) = 0 |
248 |
|
nlwlz(bi,bj) = 0 |
249 |
|
nswcld(bi,bj) = 0 |
250 |
|
nswlz(bi,bj) = 0 |
251 |
|
do L = 1,Nrphys |
252 |
|
do j = 1,sNy |
253 |
|
do i = 1,sNx |
254 |
|
swlz(i,j,L,bi,bj) = 0. |
255 |
|
lwlz(i,j,L,bi,bj) = 0. |
256 |
|
qliqavesw(i,j,L,bi,bj) = 0. |
257 |
|
qliqavelw(i,j,L,bi,bj) = 0. |
258 |
|
fccavesw(i,j,L,bi,bj) = 0. |
259 |
|
fccavelw(i,j,L,bi,bj) = 0. |
260 |
|
cldtot_sw(i,j,L,bi,bj) = 0. |
261 |
|
cldras_sw(i,j,L,bi,bj) = 0. |
262 |
|
cldlsp_sw(i,j,L,bi,bj) = 0. |
263 |
|
cldtot_lw(i,j,L,bi,bj) = 0. |
264 |
|
cldras_lw(i,j,L,bi,bj) = 0. |
265 |
|
cldlsp_lw(i,j,L,bi,bj) = 0. |
266 |
|
enddo |
267 |
|
enddo |
268 |
|
enddo |
269 |
|
do j = 1,sNy |
270 |
|
do i = 1,sNx |
271 |
|
rainlsp(i,j,bi,bj) = 0. |
272 |
|
raincon(i,j,bi,bj) = 0. |
273 |
|
snowfall(i,j,bi,bj) = 0. |
274 |
|
enddo |
275 |
|
enddo |
276 |
|
|
277 |
enddo |
enddo |
278 |
enddo |
enddo |
281 |
print *,' In fizhi_init_vars: Read from restart ' |
print *,' In fizhi_init_vars: Read from restart ' |
282 |
|
|
283 |
C-- Read fizhi package state variables from pickup file |
C-- Read fizhi package state variables from pickup file |
284 |
call fizhi_read_pickup( nIter0, myThid ) |
|
285 |
|
call fizhi_read_pickup( nIter0, myThid ) |
286 |
|
CALL FIZHI_READ_VEGTILES( nIter0, 'D', myThid ) |
287 |
|
|
288 |
ENDIF |
ENDIF |
289 |
|
|
290 |
return |
return |