File indexing completed on 2018-03-02 18:45:25 UTC
view on githubraw file Latest commit add29e06 on 2018-01-31 20:35:05 UTC
88974492f6 Andr*0001 #include "FIZHI_OPTIONS.h"
eec2a90a83 Jean*0002 SUBROUTINE DO_FIZHI(myIter,myid,
0003 & idim1,idim2,jdim1,jdim2,Nrphin,nSxin,nSyin,im1,im2,jm1,jm2,bi,bj,
0004 & turbStart, nchp,nchptot,nchpland,
0005 & uphy,vphy,thphy,sphy,pephy,lons,lats,Zsurf,
0006 & ctmt,xxmt,yymt,zetamt,xlmt,khmt,tke,
0007 & tgz,sst,sice,phis_var,landtype,fracland,emiss,albnirdr,albnirdf,
0008 & albvisdr,albvisdf,ityp,chfr,alai,agrn,igrd,chlat,chlon,
0009 & tcanopy,tdeep,ecanopy,swetshal,swetroot,swetdeep,snodep,capac,
0010 & o3,qstr,co2,cfc11,cfc12,cfc22,n2o,methane,
0011 & iras,nlwcld,cldtotlwin,cldraslwin,cldlsplwin,nlwlz,lwlzin,
0012 & nswcld,cldtotswin,cldrasswin,cldlspswin,nswlz,swlzin,imstturbsw,
0013 & imstturblw,qliqaveswin,qliqavelwin,fccaveswin,fccavelwin,
0014 & rainconin,rainlspin,snowfallin,
0015 & duphy,dvphy,dthphy,dsphy)
106e970f7f Andr*0016
88974492f6 Andr*0017
0018
0019
eec2a90a83 Jean*0020
88974492f6 Andr*0021
0022
0023
106e970f7f Andr*0024
88974492f6 Andr*0025
eec2a90a83 Jean*0026 IMPLICIT NONE
88974492f6 Andr*0027 #include "SIZE.h"
0028 #include "fizhi_SIZE.h"
0029 #include "chronos.h"
0030
0031
eec2a90a83 Jean*0032 INTEGER myIter,myid,im1,im2,jm1,jm2,idim1,idim2,jdim1,jdim2
0033 INTEGER Nrphin,nSxin,nSyin,bi,bj,nchp
0034 LOGICAL turbStart
0035 INTEGER nchptot(nSxin,nSyin),nchpland(nSxin,nSyin)
0036 _RL uphy(idim1:idim2,jdim1:jdim2,Nrphin,nSxin,nSyin)
0037 _RL vphy(idim1:idim2,jdim1:jdim2,Nrphin,nSxin,nSyin)
0038 _RL thphy(idim1:idim2,jdim1:jdim2,Nrphin,nSxin,nSyin)
0039 _RL sphy(idim1:idim2,jdim1:jdim2,Nrphin,nSxin,nSyin)
0040 _RL pephy(idim1:idim2,jdim1:jdim2,Nrphin+1,nSxin,nSyin)
0041 _RS lons(idim1:idim2,jdim1:jdim2,nSxin,nSyin)
0042 _RS lats(idim1:idim2,jdim1:jdim2,nSxin,nSyin)
0043 _RS Zsurf(idim1:idim2,jdim1:jdim2,nSxin,nSyin)
0044 _RL ctmt(nchp,nSxin,nSyin),xxmt(nchp,nSxin,nSyin)
0045 _RL yymt(nchp,nSxin,nSyin)
0046 _RL zetamt(nchp,nSxin,nSyin)
0047 _RL xlmt(nchp,Nrphin,nSxin,nSyin),khmt(nchp,Nrphin,nSxin,nSyin)
0048 _RL tke(nchp,Nrphin,nSxin,nSyin)
0049 _RL tgz(im2,jm2,nSxin,nSyin)
0050 _RL sst(idim1:idim2,jdim1:jdim2,nSxin,nSyin)
0051 _RL sice(idim1:idim2,jdim1:jdim2,nSxin,nSyin)
0052 _RL phis_var(im2,jm2,nSxin,nSyin)
0053 INTEGER landtype(im2,jm2,nSxin,nSyin)
0054 _RL fracland(im2,jm2,nSxin,nSyin),emiss(im2,jm2,10,nSxin,nSyin)
0055 _RL albvisdr(im2,jm2,nSxin,nSyin),albvisdf(im2,jm2,nSxin,nSyin)
0056 _RL albnirdr(im2,jm2,nSxin,nSyin),albnirdf(im2,jm2,nSxin,nSyin)
0057 _RL chfr(nchp,nSxin,nSyin),alai(nchp,nSxin,nSyin)
0058 _RL agrn(nchp,nSxin,nSyin)
0059 INTEGER ityp(nchp,nSxin,nSyin),igrd(nchp,nSxin,nSyin)
0060 _RL chlat(nchp,nSxin,nSyin),chlon(nchp,nSxin,nSyin)
0061 _RL tcanopy(nchp,nSxin,nSyin),tdeep(nchp,nSxin,nSyin)
0062 _RL ecanopy(nchp,nSxin,nSyin),swetshal(nchp,nSxin,nSyin)
0063 _RL swetroot(nchp,nSxin,nSyin),swetdeep(nchp,nSxin,nSyin)
0064 _RL snodep(nchp,nSxin,nSyin),capac(nchp,nSxin,nSyin)
0065 _RL o3(im2,jm2,Nrphin,nSxin,nSyin)
0066 _RL qstr(im2,jm2,Nrphin,nSxin,nSyin)
88974492f6 Andr*0067 _RL co2,cfc11,cfc12,cfc22,n2o(Nrphin),methane(Nrphin)
52f17ee294 Andr*0068
eec2a90a83 Jean*0069 INTEGER iras(nSxin,nSyin)
0070 INTEGER nlwcld(nSxin,nSyin),nlwlz(nSxin,nSyin)
0071 INTEGER nswcld(nSxin,nSyin),nswlz(nSxin,nSyin)
0072 INTEGER imstturbsw(nSxin,nSyin),imstturblw(nSxin,nSyin)
0073 _RL cldtotlwin(idim1:idim2,jdim1:jdim2,Nrphin,nSxin,nSyin)
0074 _RL cldraslwin(idim1:idim2,jdim1:jdim2,Nrphin,nSxin,nSyin)
0075 _RL cldlsplwin(idim1:idim2,jdim1:jdim2,Nrphin,nSxin,nSyin)
0076 _RL lwlzin(idim1:idim2,jdim1:jdim2,Nrphin,nSxin,nSyin)
0077 _RL cldtotswin(idim1:idim2,jdim1:jdim2,Nrphin,nSxin,nSyin)
0078 _RL cldrasswin(idim1:idim2,jdim1:jdim2,Nrphin,nSxin,nSyin)
0079 _RL cldlspswin(idim1:idim2,jdim1:jdim2,Nrphin,nSxin,nSyin)
0080 _RL swlzin(idim1:idim2,jdim1:jdim2,Nrphin,nSxin,nSyin)
0081 _RL qliqaveswin(idim1:idim2,jdim1:jdim2,Nrphin,nSxin,nSyin)
0082 _RL qliqavelwin(idim1:idim2,jdim1:jdim2,Nrphin,nSxin,nSyin)
0083 _RL fccaveswin(idim1:idim2,jdim1:jdim2,Nrphin,nSxin,nSyin)
0084 _RL fccavelwin(idim1:idim2,jdim1:jdim2,Nrphin,nSxin,nSyin)
0085 _RL rainlspin(idim1:idim2,jdim1:jdim2,nSxin,nSyin)
0086 _RL rainconin(idim1:idim2,jdim1:jdim2,nSxin,nSyin)
0087 _RL snowfallin(idim1:idim2,jdim1:jdim2,nSxin,nSyin)
0088
0089
0090 _RL duphy(idim1:idim2,jdim1:jdim2,Nrphin,nSxin,nSyin)
0091 _RL dvphy(idim1:idim2,jdim1:jdim2,Nrphin,nSxin,nSyin)
0092 _RL dthphy(idim1:idim2,jdim1:jdim2,Nrphin,nSxin,nSyin)
0093 _RL dsphy(idim1:idim2,jdim1:jdim2,Nrphin,nSxin,nSyin)
88974492f6 Andr*0094
0095
0096
eec2a90a83 Jean*0097 INTEGER ptracer,ntracer
0098 PARAMETER (ptracer = 1)
0099 PARAMETER (ntracer = 1)
88974492f6 Andr*0100
0101 _RL xlats(sNx,sNy),xlons(sNx,sNy),sea_ice(sNx,sNy)
eec2a90a83 Jean*0102 _RL p(sNx,sNy,nSx,nSy)
88974492f6 Andr*0103 _RL u(sNx,sNy,Nrphys),v(sNx,sNy,Nrphys),t(sNx,sNy,Nrphys)
0104 _RL q(sNx,sNy,Nrphys,ntracer)
eec2a90a83 Jean*0105 _RL pl(sNx,sNy,Nrphys,nSx,nSy),pkl(sNx,sNy,Nrphys,nSx,nSy)
0106 _RL ple(sNx,sNy,Nrphys+1,nSx,nSy)
0107 _RL pkle(sNx,sNy,Nrphys+1,nSx,nSy)
0108 _RL dpres(sNx,sNy,Nrphys,nSx,nSy)
0109 _RL lwdt(sNx,sNy,Nrphys,nSx,nSy)
0110 _RL lwdtclr(sNx,sNy,Nrphys,nSx,nSy)
0111 _RL swdt(sNx,sNy,Nrphys,nSx,nSy)
0112 _RL swdtclr(sNx,sNy,Nrphys,nSx,nSy)
0113 _RL turbu(sNx,sNy,Nrphys,nSx,nSy)
0114 _RL turbv(sNx,sNy,Nrphys,nSx,nSy)
0115 _RL turbt(sNx,sNy,Nrphys,nSx,nSy)
0116 _RL turbq(sNx,sNy,Nrphys,ntracer,nSx,nSy)
0117 _RL moistu(sNx,sNy,Nrphys,nSx,nSy)
0118 _RL moistv(sNx,sNy,Nrphys,nSx,nSy)
0119 _RL moistt(sNx,sNy,Nrphys,nSx,nSy)
0120 _RL moistq(sNx,sNy,Nrphys,ntracer,nSx,nSy)
0121 _RL radswt(sNx,sNy,nSx,nSy),radswg(sNx,sNy,nSx,nSy)
0122 _RL swgclr(sNx,sNy,nSx,nSy)
0123 _RL fdirpar(sNx,sNy,nSx,nSy),fdifpar(sNx,sNy,nSx,nSy)
0124 _RL osr(sNx,sNy,nSx,nSy),osrclr(sNx,sNy,nSx,nSy)
0125 _RL tg0(sNx,sNy,nSx,nSy),radlwg(sNx,sNy,nSx,nSy)
0126 _RL lwgclr(sNx,sNy,nSx,nSy),st4(sNx,sNy,nSx,nSy)
0127 _RL dst4(sNx,sNy,nSx,nSy),dlwdtg(sNx,sNy,Nrphys,nSx,nSy)
0128 _RL qq(sNx,sNy,Nrphys,nSx,nSy)
0129 INTEGER i,j,L
88974492f6 Andr*0130 _RL getcon, kappa, p0kappa, s0, ra
0131 _RL cosz(sNx,sNy)
52f17ee294 Andr*0132 _RL cldtot_lw(sNx,sNy,Nrphys)
0133 _RL cldras_lw(sNx,sNy,Nrphys)
0134 _RL cldlsp_lw(sNx,sNy,Nrphys)
0135 _RL lwlz(sNx,sNy,Nrphys)
0136 _RL cldtot_sw(sNx,sNy,Nrphys)
0137 _RL cldras_sw(sNx,sNy,Nrphys)
0138 _RL cldlsp_sw(sNx,sNy,Nrphys)
0139 _RL swlz(sNx,sNy,Nrphys)
0140 _RL qliqavesw(sNx,sNy,Nrphys)
0141 _RL qliqavelw(sNx,sNy,Nrphys)
0142 _RL fccavesw(sNx,sNy,Nrphys)
0143 _RL fccavelw(sNx,sNy,Nrphys)
0144 _RL rainlsp(sNx,sNy)
0145 _RL raincon(sNx,sNy)
0146 _RL snowfall(sNx,sNy)
88974492f6 Andr*0147
0148 _RL tempij(sNx,sNy)
51da277c7f Andr*0149 _RL tempi(2)
88974492f6 Andr*0150
0151 _RL kF,sigma_b,ks,ka,deg2rad,pi,atm_po,atm_kappa,termp,kv,kT
0152 _RL term1,term2,thetalim,thetaeq,recip_p0g
0153
eec2a90a83 Jean*0154 LOGICAL alarm
0155 EXTERNAL alarm
0156
88974492f6 Andr*0157
0158
106e970f7f Andr*0159 kF=1. _d 0/86400. _d 0
0160 sigma_b = 0.7 _d 0
0161 ka=1. _d 0/(40. _d 0*86400. _d 0)
0162 ks=1. _d 0/(4. _d 0 *86400. _d 0)
0163 pi = getcon('PI')
0164 atm_kappa = getcon('KAPPA')
0165 atm_po = getcon('ATMPOPA')
0166 deg2rad = getcon('DEG2RAD')
0167
0168 do L = 1,Nrphys
88974492f6 Andr*0169 do j = jm1,jm2
0170 do i = im1,im2
0171 recip_P0g= 1. _d 0 / pephy(i,j,Nrphys+1,bi,bj)
106e970f7f Andr*0172
0173 termP=0.5 _d 0*((pephy(i,j,L,bi,bj)+pephy(i,j,L+1,bi,bj))
0174 & *recip_P0g )
0175 kV=kF*MAX( 0. _d 0, (termP-sigma_b)/(1. _d 0-sigma_b) )
0176 duphy(i,j,L,bi,bj)= -kV*uphy(i,j,L,bi,bj)
0177 dvphy(i,j,L,bi,bj)= -kV*vphy(i,j,L,bi,bj)
eec2a90a83 Jean*0178
106e970f7f Andr*0179
0180
88974492f6 Andr*0181 term1=60. _d 0*(sin(lats(I,J,bi,bj)*deg2rad)**2)
106e970f7f Andr*0182 termP=0.5 _d 0*( pephy(i,j,L,bi,bj) + pephy(i,j,L+1,bi,bj) )
0183 term2=10. _d 0*log(termP/atm_po)
88974492f6 Andr*0184 & *(cos(lats(I,J,bi,bj)*deg2rad)**2)
106e970f7f Andr*0185 thetaLim = 200. _d 0/ ((termP/atm_po)**atm_kappa)
0186 thetaEq=315. _d 0-term1-term2
0187 thetaEq=MAX(thetaLim,thetaEq)
0188 kT=ka+(ks-ka)
0189 & *MAX(0. _d 0,
0190 & (termP*recip_P0g-sigma_b)/(1. _d 0-sigma_b) )
88974492f6 Andr*0191 & *COS((lats(I,J,bi,bj)*deg2rad))**4
106e970f7f Andr*0192 if(termP*recip_P0g.gt.0.04)then
0193 dthphy(i,j,L,bi,bj)=- kT*( thphy(I,J,L,bi,bj)-thetaEq )
eec2a90a83 Jean*0194 else
106e970f7f Andr*0195 dthphy(i,j,L,bi,bj)=0.
0196 endif
0197
0198
0199
0200 dsphy(i,j,L,bi,bj)=0.
eec2a90a83 Jean*0201
106e970f7f Andr*0202 enddo
0203 enddo
0204 enddo
0205
88974492f6 Andr*0206 return
0207 end