1 |
C $Header: /u/gcmpack/MITgcm/pkg/fizhi/do_fizhi.F,v 1.26 2004/07/28 01:25:07 molod Exp $ |
2 |
C $Name: $ |
3 |
#include "FIZHI_OPTIONS.h" |
4 |
subroutine do_fizhi(myid, |
5 |
. idim1,idim2,jdim1,jdim2,Nrphin,Nsxin,Nsyin,im1,im2,jm1,jm2,bi,bj, |
6 |
. nchp,nchptot,nchpland, |
7 |
. uphy,vphy,thphy,sphy,pephy,lons,lats, |
8 |
. ctmt,xxmt,yymt,zetamt,xlmt,khmt,tke, |
9 |
. tgz,sst,sice,phis_var,landtype,fracland,emiss,albnirdr,albnirdf, |
10 |
. albvisdr,albvisdf,ityp,chfr,alai,agrn,igrd,chlat,chlon, |
11 |
. tcanopy,tdeep,ecanopy,swetshal,swetroot,swetdeep,snodep,capac, |
12 |
. o3,qstr,co2,cfc11,cfc12,cfc22,n2o,methane, |
13 |
. duphy,dvphy,dthphy,dsphy) |
14 |
c----------------------------------------------------------------------- |
15 |
c Interface routine to calculate physics increments - calls fizhi_driver. |
16 |
c Purpose of this routine is to set up arrays local to fizhi and 'save' |
17 |
c them from one iteration to the next, and act as interface between the |
18 |
c model common blocks (held in fizhi_wrapper) and fizhi_driver. |
19 |
c Copies of variables that are 'shadowed' are made here without shadows |
20 |
c for passing to fizhi_driver. |
21 |
c Note: routine is called from inside a bi-bj loop |
22 |
c |
23 |
c----------------------------------------------------------------------- |
24 |
implicit none |
25 |
#include "SIZE.h" |
26 |
#include "fizhi_SIZE.h" |
27 |
#include "chronos.h" |
28 |
|
29 |
C Argument list declarations |
30 |
integer myid,im1,im2,jm1,jm2,idim1,idim2,jdim1,jdim2 |
31 |
integer Nrphin,Nsxin,Nsyin,bi,bj,nchp,nchptot,nchpland |
32 |
_RL uphy(idim1:idim2,jdim1:jdim2,Nrphin,Nsxin,Nsyin) |
33 |
_RL vphy(idim1:idim2,jdim1:jdim2,Nrphin,Nsxin,Nsyin) |
34 |
_RL thphy(idim1:idim2,jdim1:jdim2,Nrphin,Nsxin,Nsyin) |
35 |
_RL sphy(idim1:idim2,jdim1:jdim2,Nrphin,Nsxin,Nsyin) |
36 |
_RL pephy(idim1:idim2,jdim1:jdim2,Nrphin+1,Nsxin,Nsyin) |
37 |
_RS lons(idim1:idim2,jdim1:jdim2,Nsxin,Nsyin) |
38 |
_RS lats(idim1:idim2,jdim1:jdim2,Nsxin,Nsyin) |
39 |
_RL ctmt(nchp,Nsxin,Nsyin),xxmt(nchp,Nsxin,Nsyin) |
40 |
_RL yymt(nchp,Nsxin,Nsyin) |
41 |
_RL zetamt(nchp,Nsxin,Nsyin) |
42 |
_RL xlmt(nchp,Nrphin,Nsxin,Nsyin),khmt(nchp,Nrphin,Nsxin,Nsyin) |
43 |
_RL tke(nchp,Nrphin,Nsxin,Nsyin) |
44 |
_RL tgz(im2,jm2,Nsxin,Nsyin) |
45 |
_RL sst(idim1:idim2,jdim1:jdim2,Nsxin,Nsyin) |
46 |
_RL sice(idim1:idim2,jdim1:jdim2,Nsxin,Nsyin) |
47 |
_RL phis_var(im2,jm2,Nsxin,Nsyin) |
48 |
integer landtype(im2,jm2,Nsxin,Nsyin) |
49 |
_RL fracland(im2,jm2,Nsxin,Nsyin),emiss(im2,jm2,10,Nsxin,Nsyin) |
50 |
_RL albvisdr(im2,jm2,Nsxin,Nsyin),albvisdf(im2,jm2,Nsxin,Nsyin) |
51 |
_RL albnirdr(im2,jm2,Nsxin,Nsyin),albnirdf(im2,jm2,Nsxin,Nsyin) |
52 |
_RL chfr(nchp,Nsxin,Nsyin),alai(nchp,Nsxin,Nsyin) |
53 |
_RL agrn(nchp,Nsxin,Nsyin) |
54 |
integer ityp(nchp,Nsxin,Nsyin),igrd(nchp,Nsxin,Nsyin) |
55 |
_RL chlat(nchp,Nsxin,Nsyin),chlon(nchp,Nsxin,Nsyin) |
56 |
_RL tcanopy(nchp,Nsxin,Nsyin),tdeep(nchp,Nsxin,Nsyin) |
57 |
_RL ecanopy(nchp,Nsxin,Nsyin),swetshal(nchp,Nsxin,Nsyin) |
58 |
_RL swetroot(nchp,Nsxin,Nsyin),swetdeep(nchp,Nsxin,Nsyin) |
59 |
_RL snodep(nchp,Nsxin,Nsyin),capac(nchp,Nsxin,Nsyin) |
60 |
_RL o3(im2,jm2,Nrphin,Nsxin,Nsyin) |
61 |
_RL qstr(im2,jm2,Nrphin,Nsxin,Nsyin) |
62 |
_RL co2,cfc11,cfc12,cfc22,n2o(Nrphin),methane(Nrphin) |
63 |
_RL duphy(idim1:idim2,jdim1:jdim2,Nrphin,Nsxin,Nsyin) |
64 |
_RL dvphy(idim1:idim2,jdim1:jdim2,Nrphin,Nsxin,Nsyin) |
65 |
_RL dthphy(idim1:idim2,jdim1:jdim2,Nrphin,Nsxin,Nsyin) |
66 |
_RL dsphy(idim1:idim2,jdim1:jdim2,Nrphin,Nsxin,Nsyin) |
67 |
|
68 |
c Local Variables |
69 |
integer ptracer,ntracer |
70 |
parameter (ptracer = 1) |
71 |
parameter (ntracer = 1) |
72 |
integer iras,nlwcld,nlwlz,nswcld,nswlz |
73 |
integer imstturbsw,imstturblw |
74 |
|
75 |
_RL xlats(sNx,sNy),xlons(sNx,sNy),sea_ice(sNx,sNy) |
76 |
_RL p(sNx,sNy,Nsx,Nsy) |
77 |
_RL u(sNx,sNy,Nrphys),v(sNx,sNy,Nrphys),t(sNx,sNy,Nrphys) |
78 |
_RL q(sNx,sNy,Nrphys,ntracer) |
79 |
_RL pl(sNx,sNy,Nrphys,Nsx,Nsy),pkl(sNx,sNy,Nrphys,Nsx,Nsy) |
80 |
_RL ple(sNx,sNy,Nrphys+1,Nsx,Nsy) |
81 |
_RL pkle(sNx,sNy,Nrphys+1,Nsx,Nsy) |
82 |
_RL dpres(sNx,sNy,Nrphys,Nsx,Nsy) |
83 |
_RL lwdt(sNx,sNy,Nrphys,Nsx,Nsy) |
84 |
_RL lwdtclr(sNx,sNy,Nrphys,Nsx,Nsy) |
85 |
_RL swdt(sNx,sNy,Nrphys,Nsx,Nsy) |
86 |
_RL swdtclr(sNx,sNy,Nrphys,Nsx,Nsy) |
87 |
_RL turbu(sNx,sNy,Nrphys,Nsx,Nsy) |
88 |
_RL turbv(sNx,sNy,Nrphys,Nsx,Nsy) |
89 |
_RL turbt(sNx,sNy,Nrphys,Nsx,Nsy) |
90 |
_RL turbq(sNx,sNy,Nrphys,ntracer,Nsx,Nsy) |
91 |
_RL moistu(sNx,sNy,Nrphys,Nsx,Nsy) |
92 |
_RL moistv(sNx,sNy,Nrphys,Nsx,Nsy) |
93 |
_RL moistt(sNx,sNy,Nrphys,Nsx,Nsy) |
94 |
_RL moistq(sNx,sNy,Nrphys,ntracer,Nsx,Nsy) |
95 |
_RL radswt(sNx,sNy,Nsx,Nsy),radswg(sNx,sNy,Nsx,Nsy) |
96 |
_RL swgclr(sNx,sNy,Nsx,Nsy) |
97 |
_RL fdirpar(sNx,sNy,Nsx,Nsy),fdifpar(sNx,sNy,Nsx,Nsy) |
98 |
_RL osr(sNx,sNy,Nsx,Nsy),osrclr(sNx,sNy,Nsx,Nsy) |
99 |
_RL tg0(sNx,sNy,Nsx,Nsy),radlwg(sNx,sNy,Nsx,Nsy) |
100 |
_RL lwgclr(sNx,sNy,Nsx,Nsy),st4(sNx,sNy,Nsx,Nsy) |
101 |
_RL dst4(sNx,sNy,Nsx,Nsy),dlwdtg(sNx,sNy,Nrphys,Nsx,Nsy) |
102 |
_RL rainlsp(sNx,sNy,Nsx,Nsy),raincon(sNx,sNy,Nsx,Nsy) |
103 |
_RL snowfall(sNx,sNy,Nsx,Nsy) |
104 |
_RL cldtot_lw(sNx,sNy,Nrphys,Nsx,Nsy) |
105 |
_RL cldras_lw(sNx,sNy,Nrphys,Nsx,Nsy) |
106 |
_RL cldlsp_lw(sNx,sNy,Nrphys,Nsx,Nsy) |
107 |
_RL lwlz(sNx,sNy,Nrphys,Nsx,Nsy) |
108 |
_RL cldtot_sw(sNx,sNy,Nrphys,Nsx,Nsy) |
109 |
_RL cldras_sw(sNx,sNy,Nrphys,Nsx,Nsy) |
110 |
_RL cldlsp_sw(sNx,sNy,Nrphys,Nsx,Nsy) |
111 |
_RL swlz(sNx,sNy,Nrphys,Nsx,Nsy) |
112 |
_RL qliqavesw(sNx,sNy,Nrphys,Nsx,Nsy) |
113 |
_RL qliqavelw(sNx,sNy,Nrphys,Nsx,Nsy) |
114 |
_RL fccavesw(sNx,sNy,Nrphys,Nsx,Nsy) |
115 |
_RL fccavelw(sNx,sNy,Nrphys,Nsx,Nsy) |
116 |
_RL qq(sNx,sNy,Nrphys,Nsx,Nsy) |
117 |
|
118 |
integer i,j,L |
119 |
_RL getcon, kappa, p0kappa, s0, ra |
120 |
_RL cosz(sNx,sNy) |
121 |
|
122 |
logical alarm |
123 |
external alarm |
124 |
|
125 |
save lwdt,lwdtclr,swdt,swdtclr,turbu,turbv,turbt,turbq |
126 |
save moistu,moistv,moistt,moistq |
127 |
save radswg,swgclr,fdirpar,fdifpar,osr,osrclr,tg0,radlwg |
128 |
save st4,dst4,dlwdtg,rainlsp,raincon,snowfall,iras |
129 |
save nlwcld,cldtot_lw,cldras_lw,cldlsp_lw,nlwlz,lwlz |
130 |
save nswcld,cldtot_sw,cldras_sw,cldlsp_sw,nswlz,swlz |
131 |
save imstturbsw,imstturblw,qliqavesw,qliqavelw,fccavesw,fccavelw |
132 |
save qq |
133 |
save pl,ple,dpres,pkle,pkl |
134 |
|
135 |
C*********************************************************************** |
136 |
C Unshadow input arrays (and make 'fizhi theta' from true theta) |
137 |
C*********************************************************************** |
138 |
|
139 |
if( (nhms.eq.nhms0) .and. (nymd.eq.nymd0) ) then |
140 |
imstturblw = 0 |
141 |
imstturbsw = 0 |
142 |
iras = 0 |
143 |
nlwcld = 0 |
144 |
nlwlz = 0 |
145 |
nswcld = 0 |
146 |
nswlz = 0 |
147 |
do L = 1,Nrphys |
148 |
do j = jm1,jm2 |
149 |
do i = im1,im2 |
150 |
swlz(i,j,L,bi,bj) = 0. |
151 |
lwlz(i,j,L,bi,bj) = 0. |
152 |
qliqavesw(i,j,L,bi,bj) = 0. |
153 |
qliqavelw(i,j,L,bi,bj) = 0. |
154 |
fccavesw(i,j,L,bi,bj) = 0. |
155 |
fccavelw(i,j,L,bi,bj) = 0. |
156 |
cldtot_sw(i,j,L,bi,bj) = 0. |
157 |
cldras_sw(i,j,L,bi,bj) = 0. |
158 |
cldlsp_sw(i,j,L,bi,bj) = 0. |
159 |
cldtot_lw(i,j,L,bi,bj) = 0. |
160 |
cldras_lw(i,j,L,bi,bj) = 0. |
161 |
cldlsp_lw(i,j,L,bi,bj) = 0. |
162 |
enddo |
163 |
enddo |
164 |
enddo |
165 |
endif |
166 |
|
167 |
kappa = getcon('KAPPA') |
168 |
p0kappa = 1000.0 ** kappa |
169 |
S0 = getcon('S0') |
170 |
|
171 |
do j = jm1,jm2 |
172 |
do i = im1,im2 |
173 |
xlats(i,j) = lats(i,j,bi,bj) |
174 |
xlons(i,j) = lons(i,j,bi,bj) |
175 |
enddo |
176 |
enddo |
177 |
|
178 |
call astro ( nymd,nhms, xlats,xlons, im2*jm2, cosz,ra ) |
179 |
do j=jm1,jm2 |
180 |
do i=im1,im2 |
181 |
radswt(i,j,bi,bj) = S0*(1.0/ra**2)*cosz(i,j) |
182 |
enddo |
183 |
enddo |
184 |
|
185 |
if( alarm('moist') .or. alarm('turb') .or. |
186 |
. alarm('radsw') .or. alarm('radlw') ) then |
187 |
|
188 |
C compute pressures - all pressure are converted here to hPa |
189 |
do j = jm1,jm2 |
190 |
do i = im1,im2 |
191 |
ple(i,j,Nrphys+1,bi,bj) = pephy(i,j,Nrphys+1,bi,bj)/100. |
192 |
pkle(i,j,Nrphys+1,bi,bj)=(pephy(i,j,Nrphys+1,bi,bj)/100.) **kappa |
193 |
p(i,j,bi,bj) = pephy(i,j,Nrphys+1,bi,bj)/100. |
194 |
sea_ice(i,j) = sice(i,j,bi,bj) |
195 |
enddo |
196 |
enddo |
197 |
do L = 1,Nrphys |
198 |
do j = jm1,jm2 |
199 |
do i = im1,im2 |
200 |
u(i,j,L) = uphy(i,j,L,bi,bj) |
201 |
v(i,j,L) = vphy(i,j,L,bi,bj) |
202 |
t(i,j,L) = thphy(i,j,L,bi,bj)/p0kappa |
203 |
q(i,j,L,1) = sphy(i,j,L,bi,bj) |
204 |
pl(i,j,L,bi,bj) = (pephy(i,j,L,bi,bj)+pephy(i,j,L+1,bi,bj))/200. |
205 |
dpres(i,j,L,bi,bj)=(pephy(i,j,L+1,bi,bj)-pephy(i,j,L,bi,bj))/100. |
206 |
ple(i,j,L,bi,bj) = pephy(i,j,L,bi,bj)/100. |
207 |
pkle(i,j,L,bi,bj) = ple(i,j,L,bi,bj) **kappa |
208 |
enddo |
209 |
enddo |
210 |
enddo |
211 |
|
212 |
call pkappa (im2,jm2,Nrphys,ple(1,1,1,bi,bj),pkle(1,1,1,bi,bj), |
213 |
. pkl(1,1,1,bi,bj)) |
214 |
|
215 |
call fizhi_driver(myid,im2,jm2,Nrphys,bi,bj,ptracer,ntracer,xlats, |
216 |
. xlons,p(1,1,bi,bj),u,v,t,q,pl(1,1,1,bi,bj),ple(1,1,1,bi,bj), |
217 |
. dpres(1,1,1,bi,bj),pkle(1,1,1,bi,bj),pkl(1,1,1,bi,bj), |
218 |
. fracland(1,1,bi,bj),landtype(1,1,bi,bj),radswt(1,1,bi,bj), |
219 |
. phis_var(1,1,bi,bj),tgz(1,1,bi,bj),sea_ice,nchp,chlat(1,bi,bj), |
220 |
. chlon(1,bi,bj),igrd(1,bi,bj),nchptot,nchpland,chfr(1,bi,bj), |
221 |
. ityp(1,bi,bj),tcanopy(1,bi,bj),tdeep(1,bi,bj),ecanopy(1,bi,bj), |
222 |
. swetshal(1,bi,bj),swetroot(1,bi,bj),swetdeep(1,bi,bj), |
223 |
. capac(1,bi,bj),snodep(1,bi,bj), |
224 |
. ctmt(1,bi,bj),xxmt(1,bi,bj),yymt(1,bi,bj),zetamt(1,bi,bj), |
225 |
. xlmt(1,1,bi,bj),khmt(1,1,bi,bj),tke(1,1,bi,bj), |
226 |
. albvisdr(1,1,bi,bj),albvisdf(1,1,bi,bj),albnirdr(1,1,bi,bj), |
227 |
. albnirdf(1,1,bi,bj),emiss(1,1,1,bi,bj),alai(1,bi,bj), |
228 |
. agrn(1,bi,bj), |
229 |
. qstr(1,1,1,bi,bj),o3(1,1,1,bi,bj), |
230 |
. co2,cfc11,cfc12,cfc22,methane,n2o, |
231 |
. lwdt(1,1,1,bi,bj),lwdtclr(1,1,1,bi,bj),swdt(1,1,1,bi,bj), |
232 |
. swdtclr(1,1,1,bi,bj),turbu(1,1,1,bi,bj),turbv(1,1,1,bi,bj), |
233 |
. turbt(1,1,1,bi,bj),turbq(1,1,1,1,bi,bj),moistu(1,1,1,bi,bj), |
234 |
. moistv(1,1,1,bi,bj),moistt(1,1,1,bi,bj),moistq(1,1,1,1,bi,bj), |
235 |
. radswg(1,1,bi,bj),swgclr(1,1,bi,bj),fdirpar(1,1,bi,bj), |
236 |
. fdifpar(1,1,bi,bj),osr(1,1,bi,bj),osrclr(1,1,bi,bj), |
237 |
. tg0(1,1,bi,bj),radlwg(1,1,bi,bj),lwgclr(1,1,bi,bj), |
238 |
. st4(1,1,bi,bj),dst4(1,1,bi,bj),dlwdtg(1,1,1,bi,bj), |
239 |
. rainlsp(1,1,bi,bj),raincon(1,1,bi,bj),snowfall(1,1,bi,bj),iras, |
240 |
. nlwcld,cldtot_lw(1,1,1,bi,bj),cldras_lw(1,1,1,bi,bj), |
241 |
. cldlsp_lw(1,1,1,bi,bj),nlwlz,lwlz(1,1,1,bi,bj), |
242 |
. nswcld,cldtot_sw(1,1,1,bi,bj),cldras_sw(1,1,1,bi,bj), |
243 |
. cldlsp_sw(1,1,1,bi,bj),nswlz,swlz(1,1,1,bi,bj), |
244 |
. imstturbsw,imstturblw,qliqavesw(1,1,1,bi,bj), |
245 |
. qliqavelw(1,1,1,bi,bj),fccavesw(1,1,1,bi,bj), |
246 |
. fccavelw(1,1,1,bi,bj),qq(1,1,1,bi,bj)) |
247 |
|
248 |
endif |
249 |
|
250 |
do L = 1,Nrphys |
251 |
do j = jm1,jm2 |
252 |
do i = im1,im2 |
253 |
duphy(i,j,L,bi,bj) = moistu(i,j,L,bi,bj) + turbu(i,j,L,bi,bj) |
254 |
dvphy(i,j,L,bi,bj) = moistv(i,j,L,bi,bj) + turbv(i,j,L,bi,bj) |
255 |
dthphy(i,j,L,bi,bj) = ((moistt(i,j,L,bi,bj)+turbt(i,j,L,bi,bj)+ |
256 |
. lwdt(i,j,L,bi,bj) + |
257 |
. dlwdtg(i,j,L,bi,bj) * (tgz(i,j,bi,bj)-tg0(i,j,bi,bj)) + |
258 |
. swdt(i,j,L,bi,bj)*radswt(i,j,bi,bj) )*p0kappa ) / p(i,j,bi,bj) |
259 |
dsphy(i,j,L,bi,bj) = (moistq(i,j,L,1,bi,bj)+turbq(i,j,L,1,bi,bj)) |
260 |
. /p(i,j,bi,bj) |
261 |
enddo |
262 |
enddo |
263 |
enddo |
264 |
|
265 |
call fizhi_step_diag(myid,p,uphy,vphy,thphy,sphy,qq,pkl,dpres, |
266 |
. radswt,radswg,swgclr,osr,osrclr,st4,dst4,tgz,tg0,radlwg,lwgclr, |
267 |
. turbu,turbv,turbt,turbq,moistu,moistv,moistt,moistq, |
268 |
. lwdt,swdt,lwdtclr,swdtclr,dlwdtg, |
269 |
. im1,im2,jm1,jm2,Nrphys,Nsx,Nsy,bi,bj,ntracer) |
270 |
|
271 |
return |
272 |
end |