--- MITgcm/verification/fizhi-gridalt-hs/code/do_fizhi.F 2004/04/27 17:43:40 1.1 +++ MITgcm/verification/fizhi-gridalt-hs/code/do_fizhi.F 2004/08/20 13:40:03 1.2 @@ -1,37 +1,552 @@ - subroutine do_fizhi(uphy,vphy,thphy,sphy,pephy, - . ctmt,xxmt,yymt,zetamt,xlmt,khmt,tke, - . xC,yC, - .im1,im2,jm1,jm2,Nrphys,Nsx,Nsy,idim1,idim2,jdim1,jdim2,bi,bj,nchp, - . duphy,dvphy,dthphy,dsphy) +C $Header: /home/ubuntu/mnt/e9_copy/MITgcm/verification/fizhi-gridalt-hs/code/do_fizhi.F,v 1.2 2004/08/20 13:40:03 molod Exp $ +C $Name: $ +#include "FIZHI_OPTIONS.h" + subroutine do_fizhi(myid, + . idim1,idim2,jdim1,jdim2,Nrphin,Nsxin,Nsyin,im1,im2,jm1,jm2,bi,bj, + . nchp,nchptot,nchpland, + . uphy,vphy,thphy,sphy,pephy,lons,lats, + . ctmt,xxmt,yymt,zetamt,xlmt,khmt,tke, + . tgz,sst,sice,phis_var,landtype,fracland,emiss,albnirdr,albnirdf, + . albvisdr,albvisdf,ityp,chfr,alai,agrn,igrd,chlat,chlon, + . tcanopy,tdeep,ecanopy,swetshal,swetroot,swetdeep,snodep,capac, + . o3,qstr,co2,cfc11,cfc12,cfc22,n2o,methane, + . duphy,dvphy,dthphy,dsphy) c----------------------------------------------------------------------- -c Dummy routine to calculate physics increments - here set them to -c the Held-Suarez forcing terms +c Interface routine to calculate physics increments - calls fizhi_driver. +c Purpose of this routine is to set up arrays local to fizhi and 'save' +c them from one iteration to the next, and act as interface between the +c model common blocks (held in fizhi_wrapper) and fizhi_driver. +c Copies of variables that are 'shadowed' are made here without shadows +c for passing to fizhi_driver. +c Note: routine is called from inside a bi-bj loop +c c----------------------------------------------------------------------- - implicit none -#include "CPP_OPTIONS.h" + implicit none +#include "SIZE.h" +#include "fizhi_SIZE.h" +#include "chronos.h" + +C Argument list declarations + integer myid,im1,im2,jm1,jm2,idim1,idim2,jdim1,jdim2 + integer Nrphin,Nsxin,Nsyin,bi,bj,nchp + integer nchptot(Nsxin,Nsyin),nchpland(Nsxin,Nsyin) + _RL uphy(idim1:idim2,jdim1:jdim2,Nrphin,Nsxin,Nsyin) + _RL vphy(idim1:idim2,jdim1:jdim2,Nrphin,Nsxin,Nsyin) + _RL thphy(idim1:idim2,jdim1:jdim2,Nrphin,Nsxin,Nsyin) + _RL sphy(idim1:idim2,jdim1:jdim2,Nrphin,Nsxin,Nsyin) + _RL pephy(idim1:idim2,jdim1:jdim2,Nrphin+1,Nsxin,Nsyin) + _RS lons(idim1:idim2,jdim1:jdim2,Nsxin,Nsyin) + _RS lats(idim1:idim2,jdim1:jdim2,Nsxin,Nsyin) + _RL ctmt(nchp,Nsxin,Nsyin),xxmt(nchp,Nsxin,Nsyin) + _RL yymt(nchp,Nsxin,Nsyin) + _RL zetamt(nchp,Nsxin,Nsyin) + _RL xlmt(nchp,Nrphin,Nsxin,Nsyin),khmt(nchp,Nrphin,Nsxin,Nsyin) + _RL tke(nchp,Nrphin,Nsxin,Nsyin) + _RL tgz(im2,jm2,Nsxin,Nsyin) + _RL sst(idim1:idim2,jdim1:jdim2,Nsxin,Nsyin) + _RL sice(idim1:idim2,jdim1:jdim2,Nsxin,Nsyin) + _RL phis_var(im2,jm2,Nsxin,Nsyin) + integer landtype(im2,jm2,Nsxin,Nsyin) + _RL fracland(im2,jm2,Nsxin,Nsyin),emiss(im2,jm2,10,Nsxin,Nsyin) + _RL albvisdr(im2,jm2,Nsxin,Nsyin),albvisdf(im2,jm2,Nsxin,Nsyin) + _RL albnirdr(im2,jm2,Nsxin,Nsyin),albnirdf(im2,jm2,Nsxin,Nsyin) + _RL chfr(nchp,Nsxin,Nsyin),alai(nchp,Nsxin,Nsyin) + _RL agrn(nchp,Nsxin,Nsyin) + integer ityp(nchp,Nsxin,Nsyin),igrd(nchp,Nsxin,Nsyin) + _RL chlat(nchp,Nsxin,Nsyin),chlon(nchp,Nsxin,Nsyin) + _RL tcanopy(nchp,Nsxin,Nsyin),tdeep(nchp,Nsxin,Nsyin) + _RL ecanopy(nchp,Nsxin,Nsyin),swetshal(nchp,Nsxin,Nsyin) + _RL swetroot(nchp,Nsxin,Nsyin),swetdeep(nchp,Nsxin,Nsyin) + _RL snodep(nchp,Nsxin,Nsyin),capac(nchp,Nsxin,Nsyin) + _RL o3(im2,jm2,Nrphin,Nsxin,Nsyin) + _RL qstr(im2,jm2,Nrphin,Nsxin,Nsyin) + _RL co2,cfc11,cfc12,cfc22,n2o(Nrphin),methane(Nrphin) + _RL duphy(idim1:idim2,jdim1:jdim2,Nrphin,Nsxin,Nsyin) + _RL dvphy(idim1:idim2,jdim1:jdim2,Nrphin,Nsxin,Nsyin) + _RL dthphy(idim1:idim2,jdim1:jdim2,Nrphin,Nsxin,Nsyin) + _RL dsphy(idim1:idim2,jdim1:jdim2,Nrphin,Nsxin,Nsyin) + + +c Local Variables + integer ptracer,ntracer + parameter (ptracer = 1) + parameter (ntracer = 1) + integer iras,nlwcld,nlwlz,nswcld,nswlz + integer imstturbsw,imstturblw + + _RL xlats(sNx,sNy),xlons(sNx,sNy),sea_ice(sNx,sNy) + _RL p(sNx,sNy,Nsx,Nsy) + _RL u(sNx,sNy,Nrphys),v(sNx,sNy,Nrphys),t(sNx,sNy,Nrphys) + _RL q(sNx,sNy,Nrphys,ntracer) + _RL pl(sNx,sNy,Nrphys,Nsx,Nsy),pkl(sNx,sNy,Nrphys,Nsx,Nsy) + _RL ple(sNx,sNy,Nrphys+1,Nsx,Nsy) + _RL pkle(sNx,sNy,Nrphys+1,Nsx,Nsy) + _RL dpres(sNx,sNy,Nrphys,Nsx,Nsy) + _RL lwdt(sNx,sNy,Nrphys,Nsx,Nsy) + _RL lwdtclr(sNx,sNy,Nrphys,Nsx,Nsy) + _RL swdt(sNx,sNy,Nrphys,Nsx,Nsy) + _RL swdtclr(sNx,sNy,Nrphys,Nsx,Nsy) + _RL turbu(sNx,sNy,Nrphys,Nsx,Nsy) + _RL turbv(sNx,sNy,Nrphys,Nsx,Nsy) + _RL turbt(sNx,sNy,Nrphys,Nsx,Nsy) + _RL turbq(sNx,sNy,Nrphys,ntracer,Nsx,Nsy) + _RL moistu(sNx,sNy,Nrphys,Nsx,Nsy) + _RL moistv(sNx,sNy,Nrphys,Nsx,Nsy) + _RL moistt(sNx,sNy,Nrphys,Nsx,Nsy) + _RL moistq(sNx,sNy,Nrphys,ntracer,Nsx,Nsy) + _RL radswt(sNx,sNy,Nsx,Nsy),radswg(sNx,sNy,Nsx,Nsy) + _RL swgclr(sNx,sNy,Nsx,Nsy) + _RL fdirpar(sNx,sNy,Nsx,Nsy),fdifpar(sNx,sNy,Nsx,Nsy) + _RL osr(sNx,sNy,Nsx,Nsy),osrclr(sNx,sNy,Nsx,Nsy) + _RL tg0(sNx,sNy,Nsx,Nsy),radlwg(sNx,sNy,Nsx,Nsy) + _RL lwgclr(sNx,sNy,Nsx,Nsy),st4(sNx,sNy,Nsx,Nsy) + _RL dst4(sNx,sNy,Nsx,Nsy),dlwdtg(sNx,sNy,Nrphys,Nsx,Nsy) + _RL rainlsp(sNx,sNy,Nsx,Nsy),raincon(sNx,sNy,Nsx,Nsy) + _RL snowfall(sNx,sNy,Nsx,Nsy) + _RL cldtot_lw(sNx,sNy,Nrphys,Nsx,Nsy) + _RL cldras_lw(sNx,sNy,Nrphys,Nsx,Nsy) + _RL cldlsp_lw(sNx,sNy,Nrphys,Nsx,Nsy) + _RL lwlz(sNx,sNy,Nrphys,Nsx,Nsy) + _RL cldtot_sw(sNx,sNy,Nrphys,Nsx,Nsy) + _RL cldras_sw(sNx,sNy,Nrphys,Nsx,Nsy) + _RL cldlsp_sw(sNx,sNy,Nrphys,Nsx,Nsy) + _RL swlz(sNx,sNy,Nrphys,Nsx,Nsy) + _RL qliqavesw(sNx,sNy,Nrphys,Nsx,Nsy) + _RL qliqavelw(sNx,sNy,Nrphys,Nsx,Nsy) + _RL fccavesw(sNx,sNy,Nrphys,Nsx,Nsy) + _RL fccavelw(sNx,sNy,Nrphys,Nsx,Nsy) + _RL qq(sNx,sNy,Nrphys,Nsx,Nsy) + + integer i,j,L + _RL getcon, kappa, p0kappa, s0, ra + _RL cosz(sNx,sNy) + + _RL tempij(sNx,sNy) + + _RL kF,sigma_b,ks,ka,deg2rad,pi,atm_po,atm_kappa,termp,kv,kT + _RL term1,term2,thetalim,thetaeq,recip_p0g + + logical alarm + external alarm + +c save lwdt,lwdtclr,swdt,swdtclr,turbu,turbv,turbt,turbq +c save moistu,moistv,moistt,moistq +c save radswg,swgclr,fdirpar,fdifpar,osr,osrclr,tg0,radlwg +c save st4,dst4,dlwdtg,rainlsp,raincon,snowfall,iras +c save nlwcld,cldtot_lw,cldras_lw,cldlsp_lw,nlwlz,lwlz +c save nswcld,cldtot_sw,cldras_sw,cldlsp_sw,nswlz,swlz +c save imstturbsw,imstturblw,qliqavesw,qliqavelw,fccavesw,fccavelw +c save qq +c save pl,ple,dpres,pkle,pkl + + common /saver/ lwdt,lwdtclr,swdt,swdtclr,turbu,turbv,turbt,turbq + common /saver/ moistu,moistv,moistt,moistq + common /saver/ radswg,swgclr,fdirpar,fdifpar,osr,osrclr,tg0,radlwg + common /saver/ st4,dst4,dlwdtg,rainlsp,raincon,snowfall + common /saver/ cldtot_lw,cldras_lw,cldlsp_lw,lwlz + common /saver/ cldtot_sw,cldras_sw,cldlsp_sw,swlz + common /saver/ imstturbsw,imstturblw,qliqavesw,qliqavelw,fccavesw + common /saver/ fccavelw + common /saver/ qq + common /saver/ pl,ple,dpres,pkle,pkl + common /saver/ nlwcld,nlwlz + common /saver/ nswcld,nswlz + common /saver/ iras + +C*********************************************************************** +C Unshadow input arrays (and make 'fizhi theta' from true theta) +C*********************************************************************** + + if( (nhms.eq.nhms0) .and. (nymd.eq.nymd0) ) then + _BEGIN_MASTER(myid) + if(myid.eq.1) print *,' Initializing fizhi arrays ' + _END_MASTER(myid) + imstturblw = 0 + imstturbsw = 0 + iras = 0 + nlwcld = 0 + nlwlz = 0 + nswcld = 0 + nswlz = 0 + do L = 1,Nrphys + do j = jm1,jm2 + do i = im1,im2 + swlz(i,j,L,bi,bj) = 0. + lwlz(i,j,L,bi,bj) = 0. + qliqavesw(i,j,L,bi,bj) = 0. + qliqavelw(i,j,L,bi,bj) = 0. + fccavesw(i,j,L,bi,bj) = 0. + fccavelw(i,j,L,bi,bj) = 0. + cldtot_sw(i,j,L,bi,bj) = 0. + cldras_sw(i,j,L,bi,bj) = 0. + cldlsp_sw(i,j,L,bi,bj) = 0. + cldtot_lw(i,j,L,bi,bj) = 0. + cldras_lw(i,j,L,bi,bj) = 0. + cldlsp_lw(i,j,L,bi,bj) = 0. + lwdt(i,j,L,bi,bj) = 0. + swdt(i,j,L,bi,bj) = 0. + turbt(i,j,L,bi,bj) = 0. + moistt(i,j,L,bi,bj) = 0. + turbq(i,j,L,1,bi,bj) = 0. + moistq(i,j,L,1,bi,bj) = 0. + turbu(i,j,L,bi,bj) = 0. + moistu(i,j,L,bi,bj) = 0. + turbv(i,j,L,bi,bj) = 0. + moistv(i,j,L,bi,bj) = 0. + enddo + enddo + enddo + do j = jm1,jm2 + do i = im1,im2 + rainlsp(i,j,bi,bj) = 0. + raincon(i,j,bi,bj) = 0. + snowfall(i,j,bi,bj) = 0. + enddo + enddo + endif + + kappa = getcon('KAPPA') + p0kappa = 1000.0 ** kappa + S0 = getcon('S0') + + do j = jm1,jm2 + do i = im1,im2 + xlats(i,j) = lats(i,j,bi,bj) + xlons(i,j) = lons(i,j,bi,bj) + enddo + enddo + + call astro ( nymd,nhms, xlats,xlons, im2*jm2, cosz,ra ) + do j=jm1,jm2 + do i=im1,im2 + radswt(i,j,bi,bj) = S0*(1.0/ra**2)*cosz(i,j) + enddo + enddo + + if( alarm('moist') .or. alarm('turb') .or. + . alarm('radsw') .or. alarm('radlw') ) then + +C compute pressures - all pressure are converted here to hPa + do j = jm1,jm2 + do i = im1,im2 + ple(i,j,Nrphys+1,bi,bj) = pephy(i,j,Nrphys+1,bi,bj)/100. + pkle(i,j,Nrphys+1,bi,bj)=(pephy(i,j,Nrphys+1,bi,bj)/100.) **kappa + p(i,j,bi,bj) = pephy(i,j,Nrphys+1,bi,bj)/100. + sea_ice(i,j) = sice(i,j,bi,bj) + enddo + enddo + do L = 1,Nrphys + do j = jm1,jm2 + do i = im1,im2 + u(i,j,L) = uphy(i,j,L,bi,bj) + v(i,j,L) = vphy(i,j,L,bi,bj) + t(i,j,L) = thphy(i,j,L,bi,bj)/p0kappa + q(i,j,L,1) = sphy(i,j,L,bi,bj) + pl(i,j,L,bi,bj) = (pephy(i,j,L,bi,bj)+pephy(i,j,L+1,bi,bj))/200. + dpres(i,j,L,bi,bj)=(pephy(i,j,L+1,bi,bj)-pephy(i,j,L,bi,bj))/100. + ple(i,j,L,bi,bj) = pephy(i,j,L,bi,bj)/100. + if (ple(i,j,L,bi,bj).gt.0.) then + pkle(i,j,L,bi,bj) = ple(i,j,L,bi,bj) **kappa + else + pkle(i,j,L,bi,bj) = 0. + endif + enddo + enddo + enddo + + call pkappa (im2,jm2,Nrphys,ple(1,1,1,bi,bj),pkle(1,1,1,bi,bj), + . pkl(1,1,1,bi,bj)) + + if(2.eq.1 )then + print *,' In do fizhi, before fizhi driver - bi = ',bi + do L = 1,Nrphys+1 + do j = jm1,jm2 + do i = im1,im2 + tempij(i,j) = pephy(i,j,L,bi,bj) + enddo + enddo +c print *,' pephy at level ',l,' ',tempij + enddo + do L = 1,Nrphys + do j = jm1,jm2 + do i = im1,im2 + tempij(i,j) = u(i,j,L) + enddo + enddo +c print *,' u at level ',l,' ',tempij + enddo + do L = 1,Nrphys + do j = jm1,jm2 + do i = im1,im2 + tempij(i,j) = v(i,j,L) + enddo + enddo +c print *,' v at level ',l,' ',tempij + enddo + do L = 1,Nrphys + do j = jm1,jm2 + do i = im1,im2 + tempij(i,j) = t(i,j,L) + enddo + enddo + print *,' t at level ',l,' ',tempij + enddo + do L = 1,Nrphys + do j = jm1,jm2 + do i = im1,im2 + tempij(i,j) = q(i,j,L,1) + enddo + enddo + print *,' q at level ',l,' ',tempij + enddo + do L = 1,Nrphys + do j = jm1,jm2 + do i = im1,im2 + tempij(i,j) = qstr(i,j,L,bi,bj) + enddo + enddo + print *,' radiation q at level ',l,' ',tempij + enddo + do L = 1,Nrphys + do j = jm1,jm2 + do i = im1,im2 + tempij(i,j) = pl(i,j,L,bi,bj) + enddo + enddo +c print *,' pl at level ',l,' ',tempij + enddo + do L = 1,Nrphys+1 + do j = jm1,jm2 + do i = im1,im2 + tempij(i,j) = ple(i,j,L,bi,bj) + enddo + enddo +c print *,' ple at level ',l,' ',tempij + enddo + do L = 1,Nrphys + do j = jm1,jm2 + do i = im1,im2 + tempij(i,j) = pkl(i,j,L,bi,bj) + enddo + enddo +c print *,' pkl at level ',l,' ',tempij + enddo + do L = 1,Nrphys+1 + do j = jm1,jm2 + do i = im1,im2 + tempij(i,j) = pkle(i,j,L,bi,bj) + enddo + enddo +c print *,' pkle at level ',l,' ',tempij + enddo + do L = 1,Nrphys + do j = jm1,jm2 + do i = im1,im2 + tempij(i,j) = dpres(i,j,L,bi,bj) + enddo + enddo +c print *,' dpres at level ',l,' ',tempij + enddo + do j = jm1,jm2 + do i = im1,im2 + tempij(i,j) = tgz(i,j,bi,bj) + enddo + enddo +c print *,' tgz ',tempij + + print *,' Just before fizhi driver call ' + + endif + + + + call fizhi_driver(myid,im2,jm2,Nrphys,bi,bj,ptracer,ntracer,xlats, + . xlons,p(1,1,bi,bj),u,v,t,q,pl(1,1,1,bi,bj),ple(1,1,1,bi,bj), + . dpres(1,1,1,bi,bj),pkle(1,1,1,bi,bj),pkl(1,1,1,bi,bj), + . fracland(1,1,bi,bj),landtype(1,1,bi,bj),radswt(1,1,bi,bj), + . phis_var(1,1,bi,bj),tgz(1,1,bi,bj),sea_ice,nchp,chlat(1,bi,bj), + . chlon(1,bi,bj),igrd(1,bi,bj),nchptot(bi,bj),nchpland(bi,bj), + . chfr(1,bi,bj),ityp(1,bi,bj),tcanopy(1,bi,bj),tdeep(1,bi,bj), + . ecanopy(1,bi,bj),swetshal(1,bi,bj),swetroot(1,bi,bj), + . swetdeep(1,bi,bj),capac(1,bi,bj),snodep(1,bi,bj), + . ctmt(1,bi,bj),xxmt(1,bi,bj),yymt(1,bi,bj),zetamt(1,bi,bj), + . xlmt(1,1,bi,bj),khmt(1,1,bi,bj),tke(1,1,bi,bj), + . albvisdr(1,1,bi,bj),albvisdf(1,1,bi,bj),albnirdr(1,1,bi,bj), + . albnirdf(1,1,bi,bj),emiss(1,1,1,bi,bj),alai(1,bi,bj), + . agrn(1,bi,bj), + . qstr(1,1,1,bi,bj),o3(1,1,1,bi,bj), + . co2,cfc11,cfc12,cfc22,methane,n2o, + . lwdt(1,1,1,bi,bj),lwdtclr(1,1,1,bi,bj),swdt(1,1,1,bi,bj), + . swdtclr(1,1,1,bi,bj),turbu(1,1,1,bi,bj),turbv(1,1,1,bi,bj), + . turbt(1,1,1,bi,bj),turbq(1,1,1,1,bi,bj),moistu(1,1,1,bi,bj), + . moistv(1,1,1,bi,bj),moistt(1,1,1,bi,bj),moistq(1,1,1,1,bi,bj), + . radswg(1,1,bi,bj),swgclr(1,1,bi,bj),fdirpar(1,1,bi,bj), + . fdifpar(1,1,bi,bj),osr(1,1,bi,bj),osrclr(1,1,bi,bj), + . tg0(1,1,bi,bj),radlwg(1,1,bi,bj),lwgclr(1,1,bi,bj), + . st4(1,1,bi,bj),dst4(1,1,bi,bj),dlwdtg(1,1,1,bi,bj), + . rainlsp(1,1,bi,bj),raincon(1,1,bi,bj),snowfall(1,1,bi,bj),iras, + . nlwcld,cldtot_lw(1,1,1,bi,bj),cldras_lw(1,1,1,bi,bj), + . cldlsp_lw(1,1,1,bi,bj),nlwlz,lwlz(1,1,1,bi,bj), + . nswcld,cldtot_sw(1,1,1,bi,bj),cldras_sw(1,1,1,bi,bj), + . cldlsp_sw(1,1,1,bi,bj),nswlz,swlz(1,1,1,bi,bj), + . imstturbsw,imstturblw,qliqavesw(1,1,1,bi,bj), + . qliqavelw(1,1,1,bi,bj),fccavesw(1,1,1,bi,bj), + . fccavelw(1,1,1,bi,bj),qq(1,1,1,bi,bj)) + + if(2.eq.1)then + print *,' In do fizhi, after fizhi driver - bi = ',bi + do L = 1,Nrphys + do j = jm1,jm2 + do i = im1,im2 + tempij(i,j) = turbu(i,j,L,bi,bj) + enddo + enddo +c print *,' turbu at level ',l,' ',tempij + enddo + do L = 1,Nrphys + do j = jm1,jm2 + do i = im1,im2 + tempij(i,j) = turbv(i,j,L,bi,bj) + enddo + enddo +c print *,' turbv at level ',l,' ',tempij + enddo + do L = 1,Nrphys + do j = jm1,jm2 + do i = im1,im2 + tempij(i,j) = turbt(i,j,L,bi,bj)*p0kappa/p(i,j,bi,bj) + enddo + enddo + print *,' turbt at level ',l,' ',tempij + enddo + do L = 1,Nrphys + do j = jm1,jm2 + do i = im1,im2 + tempij(i,j) = turbq(i,j,L,1,bi,bj)/p(i,j,bi,bj) + enddo + enddo +c print *,' turbq at level ',l,' ',tempij + enddo + do L = 1,Nrphys + do j = jm1,jm2 + do i = im1,im2 + tempij(i,j) = moistu(i,j,L,bi,bj) + enddo + enddo +c print *,' moistu at level ',l,' ',tempij + enddo + do L = 1,Nrphys + do j = jm1,jm2 + do i = im1,im2 + tempij(i,j) = moistv(i,j,L,bi,bj) + enddo + enddo +c print *,' moistv at level ',l,' ',tempij + enddo + do L = 1,Nrphys + do j = jm1,jm2 + do i = im1,im2 + tempij(i,j) = moistt(i,j,L,bi,bj)*p0kappa/p(i,j,bi,bj) + enddo + enddo + print *,' moistt at level ',l,' ',tempij + enddo + do L = 1,Nrphys + do j = jm1,jm2 + do i = im1,im2 + tempij(i,j) = moistq(i,j,L,1,bi,bj)/p(i,j,bi,bj) + enddo + enddo +c print *,' moistq at level ',l,' ',tempij + enddo + do L = 1,Nrphys + do j = jm1,jm2 + do i = im1,im2 + tempij(i,j) = swdt(i,j,L,bi,bj)*radswt(i,j,bi,bj) *p0kappa / + . p(i,j,bi,bj) + enddo + enddo + print *,' swdt at level ',l,' ',tempij + enddo + do L = 1,Nrphys + do j = jm1,jm2 + do i = im1,im2 + tempij(i,j) = lwdt(i,j,L,bi,bj) + enddo + enddo + print *,' lwdt alone at level ',l,' ',tempij + enddo + do L = 1,Nrphys + do j = jm1,jm2 + do i = im1,im2 + tempij(i,j) = (lwdt(i,j,L,bi,bj)+ + . dlwdtg(i,j,L,bi,bj)*(tgz(i,j,bi,bj)-tg0(i,j,bi,bj))) + . *p0kappa/p(i,j,bi,bj) + enddo + enddo + print *,' net lwdt at level ',l,' ',tempij + enddo + endif + + do L = 1,Nrphys + do j = jm1,jm2 + do i = im1,im2 + duphy(i,j,L,bi,bj) = moistu(i,j,L,bi,bj) + turbu(i,j,L,bi,bj) + dvphy(i,j,L,bi,bj) = moistv(i,j,L,bi,bj) + turbv(i,j,L,bi,bj) + dthphy(i,j,L,bi,bj) = ((moistt(i,j,L,bi,bj)+turbt(i,j,L,bi,bj)+ + . lwdt(i,j,L,bi,bj) + + . dlwdtg(i,j,L,bi,bj) * (tgz(i,j,bi,bj)-tg0(i,j,bi,bj)) + + . swdt(i,j,L,bi,bj)*radswt(i,j,bi,bj) )*p0kappa ) / p(i,j,bi,bj) + dsphy(i,j,L,bi,bj) = (moistq(i,j,L,1,bi,bj)+turbq(i,j,L,1,bi,bj)) + . /p(i,j,bi,bj) + enddo + enddo + enddo + + if(2.eq.1 )then + print *,' In do fizhi, computed fizhi tendencies ',bi + do L = 1,Nrphys + do j = jm1,jm2 + do i = im1,im2 + tempij(i,j) = duphy(i,j,L,bi,bj) + enddo + enddo +c print *,' duphy at level ',l,' ',tempij + enddo + do L = 1,Nrphys + do j = jm1,jm2 + do i = im1,im2 + tempij(i,j) = dvphy(i,j,L,bi,bj) + enddo + enddo +c print *,' dvphy at level ',l,' ',tempij + enddo + do L = 1,Nrphys + do j = jm1,jm2 + do i = im1,im2 + tempij(i,j) = dthphy(i,j,L,bi,bj) + enddo + enddo + print *,' dthphy at level ',l,' ',tempij + enddo + do L = 1,Nrphys + do j = jm1,jm2 + do i = im1,im2 + tempij(i,j) = dsphy(i,j,L,bi,bj) + enddo + enddo + print *,' dsphy at level ',l,' ',tempij + enddo + endif + + endif + + call fizhi_step_diag(myid,p,uphy,vphy,thphy,sphy,qq,pkl,dpres, + . radswt,radswg,swgclr,osr,osrclr,st4,dst4,tgz,tg0,radlwg,lwgclr, + . turbu,turbv,turbt,turbq,moistu,moistv,moistt,moistq, + . lwdt,swdt,lwdtclr,swdtclr,dlwdtg, + . im1,im2,jm1,jm2,Nrphys,Nsx,Nsy,bi,bj,ntracer) - 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 kF=1. _d 0/86400. _d 0 sigma_b = 0.7 _d 0 @@ -43,42 +558,42 @@ deg2rad = getcon('DEG2RAD') do L = 1,Nrphys - do j = jdim1,jdim2 - do i = idim1,idim2 - recip_P0g= 1. _d 0 / pephy(i,j,1,bi,bj) + do j = jm1,jm2 + do i = im1,im2 + recip_P0g= 1. _d 0 / pephy(i,j,Nrphys+1,bi,bj) c U and V terms: termP=0.5 _d 0*((pephy(i,j,L,bi,bj)+pephy(i,j,L+1,bi,bj)) & *recip_P0g ) kV=kF*MAX( 0. _d 0, (termP-sigma_b)/(1. _d 0-sigma_b) ) duphy(i,j,L,bi,bj)= -kV*uphy(i,j,L,bi,bj) dvphy(i,j,L,bi,bj)= -kV*vphy(i,j,L,bi,bj) - + c T terms C-- Forcing term(s) - term1=60. _d 0*(sin(yC(I,J,bi,bj)*deg2rad)**2) + term1=60. _d 0*(sin(lats(I,J,bi,bj)*deg2rad)**2) termP=0.5 _d 0*( pephy(i,j,L,bi,bj) + pephy(i,j,L+1,bi,bj) ) term2=10. _d 0*log(termP/atm_po) - & *(cos(yC(I,J,bi,bj)*deg2rad)**2) + & *(cos(lats(I,J,bi,bj)*deg2rad)**2) thetaLim = 200. _d 0/ ((termP/atm_po)**atm_kappa) thetaEq=315. _d 0-term1-term2 thetaEq=MAX(thetaLim,thetaEq) kT=ka+(ks-ka) & *MAX(0. _d 0, & (termP*recip_P0g-sigma_b)/(1. _d 0-sigma_b) ) - & *COS((yC(I,J,bi,bj)*deg2rad))**4 + & *COS((lats(I,J,bi,bj)*deg2rad))**4 if(termP*recip_P0g.gt.0.04)then dthphy(i,j,L,bi,bj)=- kT*( thphy(I,J,L,bi,bj)-thetaEq ) - else + else dthphy(i,j,L,bi,bj)=0. endif c S terms (hs runs dry - no moisture) C-- Forcing term(s) dsphy(i,j,L,bi,bj)=0. - + enddo enddo enddo - return - end + return + end