/[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.5 by molod, Fri Oct 15 21:15:06 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         . iras,nlwcld,cldtotlwin,cldraslwin,cldlsplwin,nlwlz,lwlzin,
14         . nswcld,cldtotswin,cldrasswin,cldlspswin,nswlz,swlzin,imstturbsw,
15         . imstturblw,qliqaveswin,qliqavelwin,fccaveswin,fccavelwin,
16         . rainconin,rainlspin,snowfallin,
17         . duphy,dvphy,dthphy,dsphy)
18  c-----------------------------------------------------------------------  c-----------------------------------------------------------------------
19  c Dummy routine to calculate physics increments - here set them to  c Interface routine to calculate physics increments - calls fizhi_driver.
20  c                                  the Held-Suarez forcing terms  c Purpose of this routine is to set up arrays local to fizhi and 'save'
21  c-----------------------------------------------------------------------  c them from one iteration to the next, and act as interface between the
22         implicit none  c model common blocks (held in fizhi_wrapper) and fizhi_driver.
23  #include "CPP_OPTIONS.h"  c Copies of variables that are 'shadowed' are made here without shadows
24    c for passing to fizhi_driver.
25         integer im1,im2,jm1,jm2,idim1,idim2,jdim1,jdim2  c Note: routine is called from inside a bi-bj loop
        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)  
26  c  c
27         integer i,j,L  c-----------------------------------------------------------------------
28         _RL kF,sigma_b,ks,ka,deg2rad,pi,atm_po,atm_kappa,termp,kv,kT        implicit none
29         _RL term1,term2,thetalim,thetaeq,recip_p0g  #include "SIZE.h"
30         _RL getcon  #include "fizhi_SIZE.h"
31    #include "chronos.h"
32    
33    C Argument list declarations
34          integer myid,im1,im2,jm1,jm2,idim1,idim2,jdim1,jdim2
35          integer Nrphin,Nsxin,Nsyin,bi,bj,nchp
36          integer nchptot(Nsxin,Nsyin),nchpland(Nsxin,Nsyin)
37          _RL uphy(idim1:idim2,jdim1:jdim2,Nrphin,Nsxin,Nsyin)
38          _RL vphy(idim1:idim2,jdim1:jdim2,Nrphin,Nsxin,Nsyin)
39          _RL thphy(idim1:idim2,jdim1:jdim2,Nrphin,Nsxin,Nsyin)
40          _RL sphy(idim1:idim2,jdim1:jdim2,Nrphin,Nsxin,Nsyin)
41          _RL pephy(idim1:idim2,jdim1:jdim2,Nrphin+1,Nsxin,Nsyin)
42          _RS lons(idim1:idim2,jdim1:jdim2,Nsxin,Nsyin)
43          _RS lats(idim1:idim2,jdim1:jdim2,Nsxin,Nsyin)
44          _RL ctmt(nchp,Nsxin,Nsyin),xxmt(nchp,Nsxin,Nsyin)
45          _RL yymt(nchp,Nsxin,Nsyin)
46          _RL zetamt(nchp,Nsxin,Nsyin)
47          _RL xlmt(nchp,Nrphin,Nsxin,Nsyin),khmt(nchp,Nrphin,Nsxin,Nsyin)
48          _RL tke(nchp,Nrphin,Nsxin,Nsyin)
49          _RL tgz(im2,jm2,Nsxin,Nsyin)
50          _RL sst(idim1:idim2,jdim1:jdim2,Nsxin,Nsyin)
51          _RL sice(idim1:idim2,jdim1:jdim2,Nsxin,Nsyin)
52          _RL phis_var(im2,jm2,Nsxin,Nsyin)
53          integer landtype(im2,jm2,Nsxin,Nsyin)
54          _RL fracland(im2,jm2,Nsxin,Nsyin),emiss(im2,jm2,10,Nsxin,Nsyin)
55          _RL albvisdr(im2,jm2,Nsxin,Nsyin),albvisdf(im2,jm2,Nsxin,Nsyin)
56          _RL albnirdr(im2,jm2,Nsxin,Nsyin),albnirdf(im2,jm2,Nsxin,Nsyin)
57          _RL chfr(nchp,Nsxin,Nsyin),alai(nchp,Nsxin,Nsyin)
58          _RL agrn(nchp,Nsxin,Nsyin)
59          integer ityp(nchp,Nsxin,Nsyin),igrd(nchp,Nsxin,Nsyin)
60          _RL chlat(nchp,Nsxin,Nsyin),chlon(nchp,Nsxin,Nsyin)
61          _RL tcanopy(nchp,Nsxin,Nsyin),tdeep(nchp,Nsxin,Nsyin)
62          _RL ecanopy(nchp,Nsxin,Nsyin),swetshal(nchp,Nsxin,Nsyin)
63          _RL swetroot(nchp,Nsxin,Nsyin),swetdeep(nchp,Nsxin,Nsyin)
64          _RL snodep(nchp,Nsxin,Nsyin),capac(nchp,Nsxin,Nsyin)
65          _RL o3(im2,jm2,Nrphin,Nsxin,Nsyin)
66          _RL qstr(im2,jm2,Nrphin,Nsxin,Nsyin)
67          _RL co2,cfc11,cfc12,cfc22,n2o(Nrphin),methane(Nrphin)
68    
69          integer iras(Nsxin,Nsyin)
70          integer nlwcld(Nsxin,Nsyin),nlwlz(Nsxin,Nsyin)
71          integer nswcld(Nsxin,Nsyin),nswlz(Nsxin,Nsyin)
72          integer imstturbsw(Nsxin,Nsyin),imstturblw(Nsxin,Nsyin)
73          _RL cldtotlwin(idim1:idim2,jdim1:jdim2,Nrphin,Nsxin,Nsyin)
74          _RL cldraslwin(idim1:idim2,jdim1:jdim2,Nrphin,Nsxin,Nsyin)
75          _RL cldlsplwin(idim1:idim2,jdim1:jdim2,Nrphin,Nsxin,Nsyin)
76          _RL lwlzin(idim1:idim2,jdim1:jdim2,Nrphin,Nsxin,Nsyin)
77          _RL cldtotswin(idim1:idim2,jdim1:jdim2,Nrphin,Nsxin,Nsyin)
78          _RL cldrasswin(idim1:idim2,jdim1:jdim2,Nrphin,Nsxin,Nsyin)
79          _RL cldlspswin(idim1:idim2,jdim1:jdim2,Nrphin,Nsxin,Nsyin)
80          _RL swlzin(idim1:idim2,jdim1:jdim2,Nrphin,Nsxin,Nsyin)
81          _RL qliqaveswin(idim1:idim2,jdim1:jdim2,Nrphin,Nsxin,Nsyin)
82          _RL qliqavelwin(idim1:idim2,jdim1:jdim2,Nrphin,Nsxin,Nsyin)
83          _RL fccaveswin(idim1:idim2,jdim1:jdim2,Nrphin,Nsxin,Nsyin)
84          _RL fccavelwin(idim1:idim2,jdim1:jdim2,Nrphin,Nsxin,Nsyin)
85          _RL rainlspin(idim1:idim2,jdim1:jdim2,Nsxin,Nsyin)
86          _RL rainconin(idim1:idim2,jdim1:jdim2,Nsxin,Nsyin)
87          _RL snowfallin(idim1:idim2,jdim1:jdim2,Nsxin,Nsyin)
88    
89    
90          _RL duphy(idim1:idim2,jdim1:jdim2,Nrphin,Nsxin,Nsyin)
91          _RL dvphy(idim1:idim2,jdim1:jdim2,Nrphin,Nsxin,Nsyin)
92          _RL dthphy(idim1:idim2,jdim1:jdim2,Nrphin,Nsxin,Nsyin)
93          _RL dsphy(idim1:idim2,jdim1:jdim2,Nrphin,Nsxin,Nsyin)
94    
95    
96    c Local Variables
97          integer ptracer,ntracer
98          parameter (ptracer = 1)
99          parameter (ntracer = 1)
100    
101          _RL xlats(sNx,sNy),xlons(sNx,sNy),sea_ice(sNx,sNy)
102          _RL p(sNx,sNy,Nsx,Nsy)
103          _RL u(sNx,sNy,Nrphys),v(sNx,sNy,Nrphys),t(sNx,sNy,Nrphys)
104          _RL q(sNx,sNy,Nrphys,ntracer)
105          _RL pl(sNx,sNy,Nrphys,Nsx,Nsy),pkl(sNx,sNy,Nrphys,Nsx,Nsy)
106          _RL ple(sNx,sNy,Nrphys+1,Nsx,Nsy)
107          _RL pkle(sNx,sNy,Nrphys+1,Nsx,Nsy)
108          _RL dpres(sNx,sNy,Nrphys,Nsx,Nsy)
109          _RL lwdt(sNx,sNy,Nrphys,Nsx,Nsy)
110          _RL lwdtclr(sNx,sNy,Nrphys,Nsx,Nsy)
111          _RL swdt(sNx,sNy,Nrphys,Nsx,Nsy)
112          _RL swdtclr(sNx,sNy,Nrphys,Nsx,Nsy)
113          _RL turbu(sNx,sNy,Nrphys,Nsx,Nsy)
114          _RL turbv(sNx,sNy,Nrphys,Nsx,Nsy)
115          _RL turbt(sNx,sNy,Nrphys,Nsx,Nsy)
116          _RL turbq(sNx,sNy,Nrphys,ntracer,Nsx,Nsy)
117          _RL moistu(sNx,sNy,Nrphys,Nsx,Nsy)
118          _RL moistv(sNx,sNy,Nrphys,Nsx,Nsy)
119          _RL moistt(sNx,sNy,Nrphys,Nsx,Nsy)
120          _RL moistq(sNx,sNy,Nrphys,ntracer,Nsx,Nsy)
121          _RL radswt(sNx,sNy,Nsx,Nsy),radswg(sNx,sNy,Nsx,Nsy)
122          _RL swgclr(sNx,sNy,Nsx,Nsy)
123          _RL fdirpar(sNx,sNy,Nsx,Nsy),fdifpar(sNx,sNy,Nsx,Nsy)
124          _RL osr(sNx,sNy,Nsx,Nsy),osrclr(sNx,sNy,Nsx,Nsy)
125          _RL tg0(sNx,sNy,Nsx,Nsy),radlwg(sNx,sNy,Nsx,Nsy)
126          _RL lwgclr(sNx,sNy,Nsx,Nsy),st4(sNx,sNy,Nsx,Nsy)
127          _RL dst4(sNx,sNy,Nsx,Nsy),dlwdtg(sNx,sNy,Nrphys,Nsx,Nsy)
128          _RL qq(sNx,sNy,Nrphys,Nsx,Nsy)
129          integer i,j,L
130          _RL getcon, kappa, p0kappa, s0, ra
131          _RL cosz(sNx,sNy)
132          _RL cldtot_lw(sNx,sNy,Nrphys)
133          _RL cldras_lw(sNx,sNy,Nrphys)
134          _RL cldlsp_lw(sNx,sNy,Nrphys)
135          _RL lwlz(sNx,sNy,Nrphys)
136          _RL cldtot_sw(sNx,sNy,Nrphys)
137          _RL cldras_sw(sNx,sNy,Nrphys)
138          _RL cldlsp_sw(sNx,sNy,Nrphys)
139          _RL swlz(sNx,sNy,Nrphys)
140          _RL qliqavesw(sNx,sNy,Nrphys)
141          _RL qliqavelw(sNx,sNy,Nrphys)
142          _RL fccavesw(sNx,sNy,Nrphys)
143          _RL fccavelw(sNx,sNy,Nrphys)
144          _RL rainlsp(sNx,sNy)
145          _RL raincon(sNx,sNy)
146          _RL snowfall(sNx,sNy)
147    
148          _RL tempij(sNx,sNy)
149          _RL tempi(2)
150    
151          _RL kF,sigma_b,ks,ka,deg2rad,pi,atm_po,atm_kappa,termp,kv,kT
152          _RL term1,term2,thetalim,thetaeq,recip_p0g
153    
154          logical alarm
155          external alarm
156          
157    C***********************************************************************
158    
159         kF=1. _d 0/86400. _d 0         kF=1. _d 0/86400. _d 0
160         sigma_b = 0.7 _d 0         sigma_b = 0.7 _d 0
# Line 43  c Line 166  c
166         deg2rad = getcon('DEG2RAD')         deg2rad = getcon('DEG2RAD')
167    
168         do L = 1,Nrphys         do L = 1,Nrphys
169          do j = jdim1,jdim2          do j = jm1,jm2
170          do i = idim1,idim2          do i = im1,im2
171           recip_P0g= 1. _d 0 / pephy(i,j,1,bi,bj)           recip_P0g= 1. _d 0 / pephy(i,j,Nrphys+1,bi,bj)
172  c U  and V terms:  c U  and V terms:
173           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))
174       &                   *recip_P0g )       &                   *recip_P0g )
175           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) )
176           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)
177           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)
178          
179  c T terms  c T terms
180  C--   Forcing term(s)  C--   Forcing term(s)
181           term1=60. _d 0*(sin(yC(I,J,bi,bj)*deg2rad)**2)           term1=60. _d 0*(sin(lats(I,J,bi,bj)*deg2rad)**2)
182           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) )
183           term2=10. _d 0*log(termP/atm_po)           term2=10. _d 0*log(termP/atm_po)
184       &            *(cos(yC(I,J,bi,bj)*deg2rad)**2)       &            *(cos(lats(I,J,bi,bj)*deg2rad)**2)
185           thetaLim = 200. _d 0/ ((termP/atm_po)**atm_kappa)           thetaLim = 200. _d 0/ ((termP/atm_po)**atm_kappa)
186           thetaEq=315. _d 0-term1-term2           thetaEq=315. _d 0-term1-term2
187           thetaEq=MAX(thetaLim,thetaEq)           thetaEq=MAX(thetaLim,thetaEq)
188           kT=ka+(ks-ka)           kT=ka+(ks-ka)
189       &     *MAX(0. _d 0,       &     *MAX(0. _d 0,
190       &       (termP*recip_P0g-sigma_b)/(1. _d 0-sigma_b) )       &       (termP*recip_P0g-sigma_b)/(1. _d 0-sigma_b) )
191       &     *COS((yC(I,J,bi,bj)*deg2rad))**4       &     *COS((lats(I,J,bi,bj)*deg2rad))**4
192           if(termP*recip_P0g.gt.0.04)then           if(termP*recip_P0g.gt.0.04)then
193            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 )
194           else           else
195            dthphy(i,j,L,bi,bj)=0.            dthphy(i,j,L,bi,bj)=0.
196           endif           endif
197    
198  c S terms (hs runs dry - no moisture)  c S terms (hs runs dry - no moisture)
199  C--   Forcing term(s)  C--   Forcing term(s)
200           dsphy(i,j,L,bi,bj)=0.           dsphy(i,j,L,bi,bj)=0.
201          
202          enddo          enddo
203          enddo          enddo
204         enddo         enddo
205    
206         return        return
207         end        end

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

  ViewVC Help
Powered by ViewVC 1.1.22