/[MITgcm]/MITgcm/verification/fizhi-gridalt-hs/code/do_fizhi.F
ViewVC logotype

Diff of /MITgcm/verification/fizhi-gridalt-hs/code/do_fizhi.F

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.1 by molod, Tue Apr 27 17:43:40 2004 UTC revision 1.3 by molod, Wed Sep 29 14:47:54 2004 UTC
# Line 1  Line 1 
1         subroutine do_fizhi(uphy,vphy,thphy,sphy,pephy,  C $Header$
2       .                              ctmt,xxmt,yymt,zetamt,xlmt,khmt,tke,  C $Name$
3       .                xC,yC,  #include "FIZHI_OPTIONS.h"
4       .im1,im2,jm1,jm2,Nrphys,Nsx,Nsy,idim1,idim2,jdim1,jdim2,bi,bj,nchp,         subroutine do_fizhi(myid,
5       .                                         duphy,dvphy,dthphy,dsphy)       . 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-----------------------------------------------------------------------  c-----------------------------------------------------------------------
15  c Dummy routine to calculate physics increments - here set them to  c Interface routine to calculate physics increments - calls fizhi_driver.
16  c                                  the Held-Suarez forcing terms  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-----------------------------------------------------------------------  c-----------------------------------------------------------------------
24         implicit none        implicit none
25  #include "CPP_OPTIONS.h"  #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
32          integer nchptot(Nsxin,Nsyin),nchpland(Nsxin,Nsyin)
33          _RL uphy(idim1:idim2,jdim1:jdim2,Nrphin,Nsxin,Nsyin)
34          _RL vphy(idim1:idim2,jdim1:jdim2,Nrphin,Nsxin,Nsyin)
35          _RL thphy(idim1:idim2,jdim1:jdim2,Nrphin,Nsxin,Nsyin)
36          _RL sphy(idim1:idim2,jdim1:jdim2,Nrphin,Nsxin,Nsyin)
37          _RL pephy(idim1:idim2,jdim1:jdim2,Nrphin+1,Nsxin,Nsyin)
38          _RS lons(idim1:idim2,jdim1:jdim2,Nsxin,Nsyin)
39          _RS lats(idim1:idim2,jdim1:jdim2,Nsxin,Nsyin)
40          _RL ctmt(nchp,Nsxin,Nsyin),xxmt(nchp,Nsxin,Nsyin)
41          _RL yymt(nchp,Nsxin,Nsyin)
42          _RL zetamt(nchp,Nsxin,Nsyin)
43          _RL xlmt(nchp,Nrphin,Nsxin,Nsyin),khmt(nchp,Nrphin,Nsxin,Nsyin)
44          _RL tke(nchp,Nrphin,Nsxin,Nsyin)
45          _RL tgz(im2,jm2,Nsxin,Nsyin)
46          _RL sst(idim1:idim2,jdim1:jdim2,Nsxin,Nsyin)
47          _RL sice(idim1:idim2,jdim1:jdim2,Nsxin,Nsyin)
48          _RL phis_var(im2,jm2,Nsxin,Nsyin)
49          integer landtype(im2,jm2,Nsxin,Nsyin)
50          _RL fracland(im2,jm2,Nsxin,Nsyin),emiss(im2,jm2,10,Nsxin,Nsyin)
51          _RL albvisdr(im2,jm2,Nsxin,Nsyin),albvisdf(im2,jm2,Nsxin,Nsyin)
52          _RL albnirdr(im2,jm2,Nsxin,Nsyin),albnirdf(im2,jm2,Nsxin,Nsyin)
53          _RL chfr(nchp,Nsxin,Nsyin),alai(nchp,Nsxin,Nsyin)
54          _RL agrn(nchp,Nsxin,Nsyin)
55          integer ityp(nchp,Nsxin,Nsyin),igrd(nchp,Nsxin,Nsyin)
56          _RL chlat(nchp,Nsxin,Nsyin),chlon(nchp,Nsxin,Nsyin)
57          _RL tcanopy(nchp,Nsxin,Nsyin),tdeep(nchp,Nsxin,Nsyin)
58          _RL ecanopy(nchp,Nsxin,Nsyin),swetshal(nchp,Nsxin,Nsyin)
59          _RL swetroot(nchp,Nsxin,Nsyin),swetdeep(nchp,Nsxin,Nsyin)
60          _RL snodep(nchp,Nsxin,Nsyin),capac(nchp,Nsxin,Nsyin)
61          _RL o3(im2,jm2,Nrphin,Nsxin,Nsyin)
62          _RL qstr(im2,jm2,Nrphin,Nsxin,Nsyin)
63          _RL co2,cfc11,cfc12,cfc22,n2o(Nrphin),methane(Nrphin)
64          _RL duphy(idim1:idim2,jdim1:jdim2,Nrphin,Nsxin,Nsyin)
65          _RL dvphy(idim1:idim2,jdim1:jdim2,Nrphin,Nsxin,Nsyin)
66          _RL dthphy(idim1:idim2,jdim1:jdim2,Nrphin,Nsxin,Nsyin)
67          _RL dsphy(idim1:idim2,jdim1:jdim2,Nrphin,Nsxin,Nsyin)
68    
69    
70    c Local Variables
71          integer ptracer,ntracer
72          parameter (ptracer = 1)
73          parameter (ntracer = 1)
74          integer iras,nlwcld,nlwlz,nswcld,nswlz
75          integer imstturbsw,imstturblw
76    
77          _RL xlats(sNx,sNy),xlons(sNx,sNy),sea_ice(sNx,sNy)
78          _RL p(sNx,sNy,Nsx,Nsy)
79          _RL u(sNx,sNy,Nrphys),v(sNx,sNy,Nrphys),t(sNx,sNy,Nrphys)
80          _RL q(sNx,sNy,Nrphys,ntracer)
81          _RL pl(sNx,sNy,Nrphys,Nsx,Nsy),pkl(sNx,sNy,Nrphys,Nsx,Nsy)
82          _RL ple(sNx,sNy,Nrphys+1,Nsx,Nsy)
83          _RL pkle(sNx,sNy,Nrphys+1,Nsx,Nsy)
84          _RL dpres(sNx,sNy,Nrphys,Nsx,Nsy)
85          _RL lwdt(sNx,sNy,Nrphys,Nsx,Nsy)
86          _RL lwdtclr(sNx,sNy,Nrphys,Nsx,Nsy)
87          _RL swdt(sNx,sNy,Nrphys,Nsx,Nsy)
88          _RL swdtclr(sNx,sNy,Nrphys,Nsx,Nsy)
89          _RL turbu(sNx,sNy,Nrphys,Nsx,Nsy)
90          _RL turbv(sNx,sNy,Nrphys,Nsx,Nsy)
91          _RL turbt(sNx,sNy,Nrphys,Nsx,Nsy)
92          _RL turbq(sNx,sNy,Nrphys,ntracer,Nsx,Nsy)
93          _RL moistu(sNx,sNy,Nrphys,Nsx,Nsy)
94          _RL moistv(sNx,sNy,Nrphys,Nsx,Nsy)
95          _RL moistt(sNx,sNy,Nrphys,Nsx,Nsy)
96          _RL moistq(sNx,sNy,Nrphys,ntracer,Nsx,Nsy)
97          _RL radswt(sNx,sNy,Nsx,Nsy),radswg(sNx,sNy,Nsx,Nsy)
98          _RL swgclr(sNx,sNy,Nsx,Nsy)
99          _RL fdirpar(sNx,sNy,Nsx,Nsy),fdifpar(sNx,sNy,Nsx,Nsy)
100          _RL osr(sNx,sNy,Nsx,Nsy),osrclr(sNx,sNy,Nsx,Nsy)
101          _RL tg0(sNx,sNy,Nsx,Nsy),radlwg(sNx,sNy,Nsx,Nsy)
102          _RL lwgclr(sNx,sNy,Nsx,Nsy),st4(sNx,sNy,Nsx,Nsy)
103          _RL dst4(sNx,sNy,Nsx,Nsy),dlwdtg(sNx,sNy,Nrphys,Nsx,Nsy)
104          _RL rainlsp(sNx,sNy,Nsx,Nsy),raincon(sNx,sNy,Nsx,Nsy)
105          _RL snowfall(sNx,sNy,Nsx,Nsy)
106          _RL cldtot_lw(sNx,sNy,Nrphys,Nsx,Nsy)
107          _RL cldras_lw(sNx,sNy,Nrphys,Nsx,Nsy)
108          _RL cldlsp_lw(sNx,sNy,Nrphys,Nsx,Nsy)
109          _RL lwlz(sNx,sNy,Nrphys,Nsx,Nsy)
110          _RL cldtot_sw(sNx,sNy,Nrphys,Nsx,Nsy)
111          _RL cldras_sw(sNx,sNy,Nrphys,Nsx,Nsy)
112          _RL cldlsp_sw(sNx,sNy,Nrphys,Nsx,Nsy)
113          _RL swlz(sNx,sNy,Nrphys,Nsx,Nsy)
114          _RL qliqavesw(sNx,sNy,Nrphys,Nsx,Nsy)
115          _RL qliqavelw(sNx,sNy,Nrphys,Nsx,Nsy)
116          _RL fccavesw(sNx,sNy,Nrphys,Nsx,Nsy)
117          _RL fccavelw(sNx,sNy,Nrphys,Nsx,Nsy)
118          _RL qq(sNx,sNy,Nrphys,Nsx,Nsy)
119    
120          integer i,j,L
121          _RL getcon, kappa, p0kappa, s0, ra
122          _RL cosz(sNx,sNy)
123    
124          _RL tempij(sNx,sNy)
125          _RL tempi(2)
126    
127          _RL kF,sigma_b,ks,ka,deg2rad,pi,atm_po,atm_kappa,termp,kv,kT
128          _RL term1,term2,thetalim,thetaeq,recip_p0g
129    
130          logical alarm
131          external alarm
132          
133    c     save lwdt,lwdtclr,swdt,swdtclr,turbu,turbv,turbt,turbq
134    c     save moistu,moistv,moistt,moistq
135    c     save radswg,swgclr,fdirpar,fdifpar,osr,osrclr,tg0,radlwg
136    c     save st4,dst4,dlwdtg,rainlsp,raincon,snowfall,iras
137    c     save nlwcld,cldtot_lw,cldras_lw,cldlsp_lw,nlwlz,lwlz
138    c     save nswcld,cldtot_sw,cldras_sw,cldlsp_sw,nswlz,swlz
139    c     save imstturbsw,imstturblw,qliqavesw,qliqavelw,fccavesw,fccavelw
140    c     save qq
141    c     save pl,ple,dpres,pkle,pkl
142          
143    c     common /saver/ lwdt,lwdtclr,swdt,swdtclr,turbu,turbv,turbt,turbq
144    c     common /saver/ moistu,moistv,moistt,moistq
145    c     common /saver/ radswg,swgclr,fdirpar,fdifpar,osr,osrclr,tg0,radlwg
146    c     common /saver/ st4,dst4,dlwdtg,rainlsp,raincon,snowfall
147    c     common /saver/ cldtot_lw,cldras_lw,cldlsp_lw,lwlz
148    c     common /saver/ cldtot_sw,cldras_sw,cldlsp_sw,swlz
149    c     common /saver/ imstturbsw,imstturblw,qliqavesw,qliqavelw,fccavesw
150    c     common /saver/ fccavelw
151    c     common /saver/ qq
152    c     common /saver/ pl,ple,dpres,pkle,pkl
153    c     common /saver/ nlwcld,nlwlz
154    c     common /saver/ nswcld,nswlz
155    c     common /saver/ iras
156    
157    C***********************************************************************
158    C Unshadow input arrays (and make 'fizhi theta' from true theta)
159    C***********************************************************************
160    
161    c     if( (nhms.eq.nhms0) .and. (nymd.eq.nymd0) ) then
162    c      _BEGIN_MASTER(myid)
163    c      if(myid.eq.1.and.bi.eq.1) print *,' Initializing fizhi arrays '
164    c      _END_MASTER(myid)
165    c      imstturblw = 0
166    c      imstturbsw = 0
167    c      iras = 0
168    c      nlwcld = 0
169    c      nlwlz = 0
170    c      nswcld = 0
171    c      nswlz = 0
172    c      do L = 1,Nrphys
173    c      do j = jm1,jm2
174    c      do i = im1,im2
175    c       swlz(i,j,L,bi,bj) = 0.
176    c       lwlz(i,j,L,bi,bj) = 0.
177    c       qliqavesw(i,j,L,bi,bj) = 0.
178    c       qliqavelw(i,j,L,bi,bj) = 0.
179    c       fccavesw(i,j,L,bi,bj) = 0.
180    c       fccavelw(i,j,L,bi,bj) = 0.
181    c       cldtot_sw(i,j,L,bi,bj) = 0.
182    c       cldras_sw(i,j,L,bi,bj) = 0.
183    c       cldlsp_sw(i,j,L,bi,bj) = 0.
184    c       cldtot_lw(i,j,L,bi,bj) = 0.
185    c       cldras_lw(i,j,L,bi,bj) = 0.
186    c       cldlsp_lw(i,j,L,bi,bj) = 0.
187    c       lwdt(i,j,L,bi,bj) = 0.
188    c       swdt(i,j,L,bi,bj) = 0.
189    c       turbt(i,j,L,bi,bj) = 0.
190    c       moistt(i,j,L,bi,bj) = 0.
191    c       turbq(i,j,L,1,bi,bj) = 0.
192    c       moistq(i,j,L,1,bi,bj) = 0.
193    c       turbu(i,j,L,bi,bj) = 0.
194    c       moistu(i,j,L,bi,bj) = 0.
195    c       turbv(i,j,L,bi,bj) = 0.
196    c       moistv(i,j,L,bi,bj) = 0.
197    c      enddo
198    c      enddo
199    c      enddo
200    c      do j = jm1,jm2
201    c      do i = im1,im2
202    c       rainlsp(i,j,bi,bj) = 0.
203    c       raincon(i,j,bi,bj) = 0.
204    c       snowfall(i,j,bi,bj) = 0.
205    c      enddo
206    c      enddo
207    c     endif
208    c
209    c     kappa = getcon('KAPPA')
210    c     p0kappa = 1000.0 ** kappa
211    c     S0 = getcon('S0')
212    c      
213    c     do j = jm1,jm2
214    c     do i = im1,im2
215    c      xlats(i,j) = lats(i,j,bi,bj)
216    c      xlons(i,j) = lons(i,j,bi,bj)
217    c     enddo
218    c     enddo
219    c
220    c     call astro ( nymd,nhms, xlats,xlons, im2*jm2, cosz,ra )
221    c     do j=jm1,jm2
222    c     do i=im1,im2
223    c      radswt(i,j,bi,bj) = S0*(1.0/ra**2)*cosz(i,j)
224    c     enddo
225    c     enddo
226    c
227    c     if( alarm('moist') .or. alarm('turb')   .or.
228    c    .    alarm('radsw') .or. alarm('radlw') ) then
229    c
230    C compute pressures - all pressure are converted here to hPa
231    c     do j = jm1,jm2
232    c     do i = im1,im2
233    c      ple(i,j,Nrphys+1,bi,bj) = pephy(i,j,Nrphys+1,bi,bj)/100.
234    c      pkle(i,j,Nrphys+1,bi,bj)=(pephy(i,j,Nrphys+1,bi,bj)/100.) **kappa
235    c      p(i,j,bi,bj) = pephy(i,j,Nrphys+1,bi,bj)/100.
236    c      sea_ice(i,j) = sice(i,j,bi,bj)
237    c     enddo
238    c     enddo
239    c     do L = 1,Nrphys
240    c     do j = jm1,jm2
241    c     do i = im1,im2
242    c      u(i,j,L) = uphy(i,j,L,bi,bj)
243    c      v(i,j,L) = vphy(i,j,L,bi,bj)
244    c      t(i,j,L) = thphy(i,j,L,bi,bj)/p0kappa
245    c      q(i,j,L,1) = sphy(i,j,L,bi,bj)
246    c      pl(i,j,L,bi,bj) = (pephy(i,j,L,bi,bj)+pephy(i,j,L+1,bi,bj))/200.
247    c      dpres(i,j,L,bi,bj)=(pephy(i,j,L+1,bi,bj)-pephy(i,j,L,bi,bj))/100.
248    c      ple(i,j,L,bi,bj) = pephy(i,j,L,bi,bj)/100.
249    c      if (ple(i,j,L,bi,bj).gt.0.) then
250    c       pkle(i,j,L,bi,bj) = ple(i,j,L,bi,bj) **kappa
251    c      else
252    c       pkle(i,j,L,bi,bj) = 0.
253    c      endif
254    c     enddo
255    c     enddo
256    c     enddo
257    c
258    c     call pkappa (im2,jm2,Nrphys,ple(1,1,1,bi,bj),pkle(1,1,1,bi,bj),
259    c    .                                                 pkl(1,1,1,bi,bj))
260    c
261    c     call fizhi_driver(myid,im2,jm2,Nrphys,bi,bj,ptracer,ntracer,xlats,
262    c    . xlons,p(1,1,bi,bj),u,v,t,q,pl(1,1,1,bi,bj),ple(1,1,1,bi,bj),
263    c    . dpres(1,1,1,bi,bj),pkle(1,1,1,bi,bj),pkl(1,1,1,bi,bj),
264    c    . fracland(1,1,bi,bj),landtype(1,1,bi,bj),radswt(1,1,bi,bj),
265    c    . phis_var(1,1,bi,bj),tgz(1,1,bi,bj),sea_ice,nchp,chlat(1,bi,bj),
266    c    . chlon(1,bi,bj),igrd(1,bi,bj),nchptot(bi,bj),nchpland(bi,bj),
267    c    . chfr(1,bi,bj),ityp(1,bi,bj),tcanopy(1,bi,bj),tdeep(1,bi,bj),
268    c    . ecanopy(1,bi,bj),swetshal(1,bi,bj),swetroot(1,bi,bj),
269    c    . swetdeep(1,bi,bj),capac(1,bi,bj),snodep(1,bi,bj),
270    c    . ctmt(1,bi,bj),xxmt(1,bi,bj),yymt(1,bi,bj),zetamt(1,bi,bj),
271    c    . xlmt(1,1,bi,bj),khmt(1,1,bi,bj),tke(1,1,bi,bj),
272    c    . albvisdr(1,1,bi,bj),albvisdf(1,1,bi,bj),albnirdr(1,1,bi,bj),
273    c    . albnirdf(1,1,bi,bj),emiss(1,1,1,bi,bj),alai(1,bi,bj),
274    c    . agrn(1,bi,bj),
275    c    . qstr(1,1,1,bi,bj),o3(1,1,1,bi,bj),
276    c    . co2,cfc11,cfc12,cfc22,methane,n2o,
277    c    . lwdt(1,1,1,bi,bj),lwdtclr(1,1,1,bi,bj),swdt(1,1,1,bi,bj),
278    c    . swdtclr(1,1,1,bi,bj),turbu(1,1,1,bi,bj),turbv(1,1,1,bi,bj),
279    c    . turbt(1,1,1,bi,bj),turbq(1,1,1,1,bi,bj),moistu(1,1,1,bi,bj),
280    c    . moistv(1,1,1,bi,bj),moistt(1,1,1,bi,bj),moistq(1,1,1,1,bi,bj),
281    c    . radswg(1,1,bi,bj),swgclr(1,1,bi,bj),fdirpar(1,1,bi,bj),
282    c    . fdifpar(1,1,bi,bj),osr(1,1,bi,bj),osrclr(1,1,bi,bj),
283    c    . tg0(1,1,bi,bj),radlwg(1,1,bi,bj),lwgclr(1,1,bi,bj),
284    c    . st4(1,1,bi,bj),dst4(1,1,bi,bj),dlwdtg(1,1,1,bi,bj),
285    c    . rainlsp(1,1,bi,bj),raincon(1,1,bi,bj),snowfall(1,1,bi,bj),iras,
286    c    . nlwcld,cldtot_lw(1,1,1,bi,bj),cldras_lw(1,1,1,bi,bj),
287    c    . cldlsp_lw(1,1,1,bi,bj),nlwlz,lwlz(1,1,1,bi,bj),
288    c    . nswcld,cldtot_sw(1,1,1,bi,bj),cldras_sw(1,1,1,bi,bj),
289    c    . cldlsp_sw(1,1,1,bi,bj),nswlz,swlz(1,1,1,bi,bj),
290    c    . imstturbsw,imstturblw,qliqavesw(1,1,1,bi,bj),
291    c    . qliqavelw(1,1,1,bi,bj),fccavesw(1,1,1,bi,bj),
292    c    . fccavelw(1,1,1,bi,bj),qq(1,1,1,bi,bj))
293    c
294    c     do L = 1,Nrphys
295    c     do j = jm1,jm2
296    c     do i = im1,im2
297    c      duphy(i,j,L,bi,bj) = moistu(i,j,L,bi,bj) + turbu(i,j,L,bi,bj)
298    c      dvphy(i,j,L,bi,bj) = moistv(i,j,L,bi,bj) + turbv(i,j,L,bi,bj)
299    c      dthphy(i,j,L,bi,bj) = ((moistt(i,j,L,bi,bj)+turbt(i,j,L,bi,bj)+
300    c    .   lwdt(i,j,L,bi,bj) +
301    c    .   dlwdtg(i,j,L,bi,bj) * (tgz(i,j,bi,bj)-tg0(i,j,bi,bj)) +
302    c    .   swdt(i,j,L,bi,bj)*radswt(i,j,bi,bj) )*p0kappa ) / p(i,j,bi,bj)
303    c      dsphy(i,j,L,bi,bj) = (moistq(i,j,L,1,bi,bj)+turbq(i,j,L,1,bi,bj))
304    c    .                                    /p(i,j,bi,bj)
305    c     enddo
306    c     enddo
307    c     enddo
308    c
309    c     endif
310    c
311    c     call fizhi_step_diag(myid,p,uphy,vphy,thphy,sphy,qq,pkl,dpres,
312    c    .  radswt,radswg,swgclr,osr,osrclr,st4,dst4,tgz,tg0,radlwg,lwgclr,
313    c    .  turbu,turbv,turbt,turbq,moistu,moistv,moistt,moistq,
314    c    .  lwdt,swdt,lwdtclr,swdtclr,dlwdtg,
315    c    .  im1,im2,jm1,jm2,Nrphys,Nsx,Nsy,bi,bj,ntracer)
316    
        integer im1,im2,jm1,jm2,idim1,idim2,jdim1,jdim2  
        integer Nrphys,Nsx,Nsy,bi,bj,nchp  
        _RL uphy(im1:im2,jm1:jm2,Nrphys,Nsx,Nsy)  
        _RL vphy(im1:im2,jm1:jm2,Nrphys,Nsx,Nsy)  
        _RL thphy(im1:im2,jm1:jm2,Nrphys,Nsx,Nsy)  
        _RL sphy(im1:im2,jm1:jm2,Nrphys,Nsx,Nsy)  
        _RL pephy(im1:im2,jm1:jm2,Nrphys+1,Nsx,Nsy)  
        _RL ctmt(nchp,Nsx,Nsy),xxmt(nchp,Nsx,Nsy),yymt(nchp,Nsx,Nsy)  
        _RL zetamt(nchp,Nsx,Nsy)  
        _RL xlmt(nchp,Nrphys,Nsx,Nsy),khmt(nchp,Nrphys,Nsx,Nsy)  
        _RL tke(nchp,Nrphys,Nsx,Nsy)  
        _RL duphy(im1:im2,jm1:jm2,Nrphys,Nsx,Nsy)  
        _RL dvphy(im1:im2,jm1:jm2,Nrphys,Nsx,Nsy)  
        _RL dthphy(im1:im2,jm1:jm2,Nrphys,Nsx,Nsy)  
        _RL dsphy(im1:im2,jm1:jm2,Nrphys,Nsx,Nsy)  
        _RS xC(im1:im2,jm1:jm2,Nsx,Nsy)  
        _RS yC(im1:im2,jm1:jm2,Nsx,Nsy)  
 c  
        integer i,j,L  
        _RL kF,sigma_b,ks,ka,deg2rad,pi,atm_po,atm_kappa,termp,kv,kT  
        _RL term1,term2,thetalim,thetaeq,recip_p0g  
        _RL getcon  
317    
318         kF=1. _d 0/86400. _d 0         kF=1. _d 0/86400. _d 0
319         sigma_b = 0.7 _d 0         sigma_b = 0.7 _d 0
# Line 43  c Line 325  c
325         deg2rad = getcon('DEG2RAD')         deg2rad = getcon('DEG2RAD')
326    
327         do L = 1,Nrphys         do L = 1,Nrphys
328          do j = jdim1,jdim2          do j = jm1,jm2
329          do i = idim1,idim2          do i = im1,im2
330           recip_P0g= 1. _d 0 / pephy(i,j,1,bi,bj)           recip_P0g= 1. _d 0 / pephy(i,j,Nrphys+1,bi,bj)
331  c U  and V terms:  c U  and V terms:
332           termP=0.5 _d 0*((pephy(i,j,L,bi,bj)+pephy(i,j,L+1,bi,bj))           termP=0.5 _d 0*((pephy(i,j,L,bi,bj)+pephy(i,j,L+1,bi,bj))
333       &                   *recip_P0g )       &                   *recip_P0g )
334           kV=kF*MAX( 0. _d 0, (termP-sigma_b)/(1. _d 0-sigma_b) )           kV=kF*MAX( 0. _d 0, (termP-sigma_b)/(1. _d 0-sigma_b) )
335           duphy(i,j,L,bi,bj)= -kV*uphy(i,j,L,bi,bj)           duphy(i,j,L,bi,bj)= -kV*uphy(i,j,L,bi,bj)
336           dvphy(i,j,L,bi,bj)= -kV*vphy(i,j,L,bi,bj)           dvphy(i,j,L,bi,bj)= -kV*vphy(i,j,L,bi,bj)
337          
338  c T terms  c T terms
339  C--   Forcing term(s)  C--   Forcing term(s)
340           term1=60. _d 0*(sin(yC(I,J,bi,bj)*deg2rad)**2)           term1=60. _d 0*(sin(lats(I,J,bi,bj)*deg2rad)**2)
341           termP=0.5 _d 0*( pephy(i,j,L,bi,bj) + pephy(i,j,L+1,bi,bj) )           termP=0.5 _d 0*( pephy(i,j,L,bi,bj) + pephy(i,j,L+1,bi,bj) )
342           term2=10. _d 0*log(termP/atm_po)           term2=10. _d 0*log(termP/atm_po)
343       &            *(cos(yC(I,J,bi,bj)*deg2rad)**2)       &            *(cos(lats(I,J,bi,bj)*deg2rad)**2)
344           thetaLim = 200. _d 0/ ((termP/atm_po)**atm_kappa)           thetaLim = 200. _d 0/ ((termP/atm_po)**atm_kappa)
345           thetaEq=315. _d 0-term1-term2           thetaEq=315. _d 0-term1-term2
346           thetaEq=MAX(thetaLim,thetaEq)           thetaEq=MAX(thetaLim,thetaEq)
347           kT=ka+(ks-ka)           kT=ka+(ks-ka)
348       &     *MAX(0. _d 0,       &     *MAX(0. _d 0,
349       &       (termP*recip_P0g-sigma_b)/(1. _d 0-sigma_b) )       &       (termP*recip_P0g-sigma_b)/(1. _d 0-sigma_b) )
350       &     *COS((yC(I,J,bi,bj)*deg2rad))**4       &     *COS((lats(I,J,bi,bj)*deg2rad))**4
351           if(termP*recip_P0g.gt.0.04)then           if(termP*recip_P0g.gt.0.04)then
352            dthphy(i,j,L,bi,bj)=- kT*( thphy(I,J,L,bi,bj)-thetaEq )            dthphy(i,j,L,bi,bj)=- kT*( thphy(I,J,L,bi,bj)-thetaEq )
353           else           else
354            dthphy(i,j,L,bi,bj)=0.            dthphy(i,j,L,bi,bj)=0.
355           endif           endif
356    
357  c S terms (hs runs dry - no moisture)  c S terms (hs runs dry - no moisture)
358  C--   Forcing term(s)  C--   Forcing term(s)
359           dsphy(i,j,L,bi,bj)=0.           dsphy(i,j,L,bi,bj)=0.
360          
361          enddo          enddo
362          enddo          enddo
363         enddo         enddo
364    
365         return        return
366         end        end

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.3

  ViewVC Help
Powered by ViewVC 1.1.22