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