zm_conv.f90

来自「CCSM Research Tools: Community Atmospher」· F90 代码 · 共 1,872 行 · 第 1/5 页

F90
1,872
字号
#include <misc.h>#include <params.h>module zm_conv!---------------------------------------------------------------------------------! Purpose:!! Interface from Zhang-McFarlane convection scheme, includes evaporation of convective ! precip from the ZM scheme!! Author: Byron Boville, from code in tphysbc!!---------------------------------------------------------------------------------  use precision, only: r8  use ppgrid,    only: pcols, pver, pverp  use moistconvection,  only: cp, grav, rgrav, rgas, limcnv  implicit none  save  private                         ! Make default type private to the module!! PUBLIC: interfaces!  public zm_convi                 ! ZM schemea  public zm_convr                 ! ZM schemea  public zm_conv_evap             ! evaporation of precip from ZM schemea!! Private data!   public rl, cpres, capelmt   real(r8) qmin       ! Lower bound on specific humidity   real(r8) rl         ! wg latent heat of vaporization.   real(r8) cpres      ! specific heat at constant pressure in j/kg-degk.   real(r8), parameter :: capelmt = 70.  ! threshold value for cape for deep convection.containssubroutine zm_convi( tmelt, epsilo, latvap, cpair )!! Initialization of ZM constants!   real(r8), intent(in) :: tmelt   ! Freezing temperature   real(r8), intent(in) :: epsilo  ! Freezing temperature   real(r8), intent(in) :: latvap  ! Latent heat of vaporization   real(r8), intent(in) :: cpair   ! Specific heat of dry air (J/K/kg)#include <guang.h>   cpres = cpair   a = 21.656   b = 5418.   c1 = 6.112   c2 = 17.67   c3 = 243.5   eps1 = epsilo   qmin = 1.E-20   tfreez = tmelt   rl = latvapend subroutine zm_convisubroutine zm_convr(lchnk   ,ncol    , &                    t       ,qh      ,pcpc    ,jctop   ,jcbot   , &                    pblh    ,zm      ,geos    ,zi      ,qtg     , &                    ttg     ,pap     ,paph    ,dpp     ,ts      , &                    delt    ,mcon    ,cme     ,nstep   ,          &                    tpert   ,dlf     ,pflx    ,zdu     ,cmfdqr  , &                    mu2     ,md2     ,du2     ,eu2     ,ed2     , &                    dp      ,dsubcld ,jt      ,maxg    ,ideep   , &                    lengath ,ql      )!----------------------------------------------------------------------- ! ! Purpose: ! Main driver for zhang-mcfarlane convection scheme ! ! Method: ! performs deep convective adjustment based on mass-flux closure! algorithm.! ! Author:guang jun zhang, m.lazare, n.mcfarlane. CAM Contact: P. Rasch!! This is contributed code not fully standardized by the CAM core group.! All variables have been typed, where most are identified in comments! The current procedure will be reimplemented in a subsequent version! of the CAM where it will include a more straightforward formulation! and will make use of the standard CAM nomenclature! !-----------------------------------------------------------------------   use tracers, only: pcnst, pnats!! ************************ index of variables **********************!!  wg * alpha    array of vertical differencing used (=1. for upstream).!  w  * cape     convective available potential energy.!  wg * capeg    gathered convective available potential energy.!  c  * capelmt  threshold value for cape for deep convection.!  ic  * cpres    specific heat at constant pressure in j/kg-degk.!  i  * dpp      !  ic  * delt     length of model time-step in seconds.!  wg * dp       layer thickness in mbs (between upper/lower interface).!  wg * dqdt     mixing ratio tendency at gathered points.!  wg * dsdt     dry static energy ("temp") tendency at gathered points.!  wg * dudt     u-wind tendency at gathered points.!  wg * dvdt     v-wind tendency at gathered points.!  wg * dsubcld  layer thickness in mbs between lcl and maxi.!  ic  * grav     acceleration due to gravity in m/sec2.!  wg * du       detrainment in updraft. specified in mid-layer!  wg * ed       entrainment in downdraft.!  wg * eu       entrainment in updraft.!  wg * hmn      moist static energy.!  wg * hsat     saturated moist static energy.!  w  * ideep    holds position of gathered points vs longitude index.!  ic  * pver     number of model levels.!  wg * j0       detrainment initiation level index.!  wg * jd       downdraft   initiation level index.!  ic  * jlatpr   gaussian latitude index for printing grids (if needed).!  wg * jt       top  level index of deep cumulus convection.!  w  * lcl      base level index of deep cumulus convection.!  wg * lclg     gathered values of lcl.!  w  * lel      index of highest theoretical convective plume.!  wg * lelg     gathered values of lel.!  w  * lon      index of onset level for deep convection.!  w  * maxi     index of level with largest moist static energy.!  wg * maxg     gathered values of maxi.!  wg * mb       cloud base mass flux.!  wg * mc       net upward (scaled by mb) cloud mass flux.!  wg * md       downward cloud mass flux (positive up).!  wg * mu       upward   cloud mass flux (positive up). specified!                at interface!  ic  * msg      number of missing moisture levels at the top of model.!  w  * p        grid slice of ambient mid-layer pressure in mbs.!  i  * pblt     row of pbl top indices.!  w  * pcpdh    scaled surface pressure.!  w  * pf       grid slice of ambient interface pressure in mbs.!  wg * pg       grid slice of gathered values of p.!  w  * q        grid slice of mixing ratio.!  wg * qd       grid slice of mixing ratio in downdraft.!  wg * qg       grid slice of gathered values of q.!  i/o * qh       grid slice of specific humidity.!  w  * qh0      grid slice of initial specific humidity.!  wg * qhat     grid slice of upper interface mixing ratio.!  wg * ql       grid slice of cloud liquid water.!  wg * qs       grid slice of saturation mixing ratio.!  w  * qstp     grid slice of parcel temp. saturation mixing ratio.!  wg * qstpg    grid slice of gathered values of qstp.!  wg * qu       grid slice of mixing ratio in updraft.!  ic  * rgas     dry air gas constant.!  wg * rl       latent heat of vaporization.!  w  * s        grid slice of scaled dry static energy (t+gz/cp).!  wg * sd       grid slice of dry static energy in downdraft.!  wg * sg       grid slice of gathered values of s.!  wg * shat     grid slice of upper interface dry static energy.!  wg * su       grid slice of dry static energy in updraft.!  wg * sumde    row of vertically-integrated moist static energy!                change.!  wg * sumdq    row of vertically-integrated scaled mixing ratio!                change.!  wg * sumdt    row of vertically-integrated dry static energy change.!  wg * sumq     row of vertically-integrated mixing ratio change.!  i/o * t       !  o  * jctop    row of top-of-deep-convection indices passed out.!  o  * jcbot    row of base of cloud indices passed out.!  wg * tg       grid slice of gathered values of t.!  w  * tl       row of parcel temperature at lcl.!  wg * tlg      grid slice of gathered values of tl.!  w  * tp       grid slice of parcel temperatures.!  wg * tpg      grid slice of gathered values of tp.!  i/o * u        grid slice of u-wind (real).!  wg * ug       grid slice of gathered values of u.!  i/o * utg      grid slice of u-wind tendency (real).!  i/o * v        grid slice of v-wind (real).!  w  * va       work array re-used by called subroutines.!  wg * vg       grid slice of gathered values of v.!  i/o * vtg      grid slice of v-wind tendency (real).!  i  * w        grid slice of diagnosed large-scale vertical velocity.!  w  * z        grid slice of ambient mid-layer height in metres.!  w  * zf       grid slice of ambient interface height in metres.!  wg * zfg      grid slice of gathered values of zf.!  wg * zg       grid slice of gathered values of z.!!-----------------------------------------------------------------------!! multi-level i/o fields:!  i      => input arrays.!  i/o    => input/output arrays.!  w      => work arrays.!  wg     => work arrays operating only on gathered points.!  ic     => input data constants.!  c      => data constants pertaining to subroutine itself.!! input/output arguments:!   real(r8),intent(inout) :: t(pcols,pver)              ! grid slice of temperature at mid-layer.   real(r8),intent(inout) :: qh(pcols,pver,pcnst+pnats) ! grid slice of specific humidity.   real(r8) u(pcols,pver)              ! grid slice of U-wind (real).   real(r8) v(pcols,pver)              ! grid slice of U-wind (real).   real(r8),intent(inout) :: qtg(pcols,pver)   real(r8),intent(inout) :: ttg(pcols,pver)!      real(r8),intent(inout) :: utg(pcols,pver)        ! grid slice of u-wind tendency (real).!      real(r8),intent(inout) :: vtg(pcols,pver)        ! grid slice of v-wind tendency (real).!! input arguments!   integer, intent(in) :: lchnk                   ! chunk identifier   integer, intent(in) :: ncol                    ! number of atmospheric columns   real(r8), intent(in) :: pap(pcols,pver)        real(r8), intent(in) :: paph(pcols,pver+1)   real(r8), intent(in) :: dpp(pcols,pver)        ! local sigma half-level thickness (i.e. dshj).   real(r8), intent(in) :: zm(pcols,pver)   real(r8), intent(in) :: geos(pcols)   real(r8), intent(in) :: zi(pcols,pver+1)   real(r8), intent(in) :: pblh(pcols)   real(r8) zs(pcols)   real(r8), intent(in) :: tpert(pcols)!! output arguments!   real(r8) pcpck(pcols,pver)   real(r8), intent(out) :: mcon(pcols,pverp)   real(r8) dlg(pcols,pver)    ! gathrd version of the detraining cld h2o tend   real(r8), intent(out) :: dlf(pcols,pver)    ! scattrd version of the detraining cld h2o tend   real(r8), intent(out) :: pflx(pcols,pverp)  ! scattered precip flux at each level   real(r8) pflxg(pcols,pverp) ! gather precip flux at each level   real(r8) cug(pcols,pver)    ! gathered condensation rate   real(r8) evpg(pcols,pver)   ! gathered evap rate of rain in downdraft   real(r8) mumax(pcols)   real(r8), intent(out) :: cme(pcols,pver)   real(r8), intent(out) :: zdu(pcols,pver)   real(r8), intent(out) :: cmfdqr(pcols,pver)! move these vars from local storage to output so that convective! transports can be done in outside of conv_cam.   real(r8), intent(out) :: mu2(pcols,pver)   real(r8), intent(out) :: eu2(pcols,pver)   real(r8), intent(out) :: du2(pcols,pver)   real(r8), intent(out) :: md2(pcols,pver)   real(r8), intent(out) :: ed2(pcols,pver)   real(r8), intent(out) :: dp(pcols,pver)       ! wg layer thickness in mbs (between upper/lower interface).   real(r8), intent(out) :: dsubcld(pcols)       ! wg layer thickness in mbs between lcl and maxi.   integer jt(pcols)                          ! wg top  level index of deep cumulus convection.   integer maxg(pcols)                        ! wg gathered values of maxi.   integer ideep(pcols)                       ! w holds position of gathered points vs longitude index.   integer lengath!     diagnostic field used by chem/wetdep codes   real(r8) ql(pcols,pver)                    ! wg grid slice of cloud liquid water.!! single-level i/o fields:!!       input arguments!   real(r8), intent(in) :: ts(pcols)   real(r8) pblt(pcols)           ! i row of pbl top indices.!!       input/output arguments:!   real(r8) paprc(pcols)   real(r8) paprs(pcols)!!       output arguments:!   real(r8), intent(out) :: jctop(pcols)  ! o row of top-of-deep-convection indices passed out.   real(r8), intent(out) :: jcbot(pcols)  ! o row of base of cloud indices passed out.   real(r8) pcpr(pcols)   real(r8) pcps(pcols)   real(r8), intent(out) :: pcpc(pcols)!!-----------------------------------------------------------------------!! general work fields (local variables):!   real(r8) q(pcols,pver)              ! w  grid slice of mixing ratio.   real(r8) p(pcols,pver)              ! w  grid slice of ambient mid-layer pressure in mbs.   real(r8) z(pcols,pver)              ! w  grid slice of ambient mid-layer height in metres.   real(r8) s(pcols,pver)              ! w  grid slice of scaled dry static energy (t+gz/cp).   real(r8) tp(pcols,pver)             ! w  grid slice of parcel temperatures.   real(r8) zf(pcols,pver+1)           ! w  grid slice of ambient interface height in metres.   real(r8) pf(pcols,pver+1)           ! w  grid slice of ambient interface pressure in mbs.   real(r8) qstp(pcols,pver)           ! w  grid slice of parcel temp. saturation mixing ratio.   real(r8) cape(pcols)                ! w  convective available potential energy.   real(r8) tl(pcols)                  ! w  row of parcel temperature at lcl.   real(r8) sumq(pcols)                ! wg row of vertically-integrated mixing ratio change.   real(r8) pcpdh(pcols)               ! w  scaled surface pressure.!      real(r8) sumdt(pcols)           ! wg row of vertically-integrated dry static energy change.!      real(r8) sumdq(pcols)           ! wg row of vertically-integrated scaled mixing ratio change!      real(r8) sumde(pcols)           ! wg row of vertically-integrated moist static energy change   integer lcl(pcols)                  ! w  base level index of deep cumulus convection.   integer lel(pcols)                  ! w  index of highest theoretical convective plume.   integer lon(pcols)                  ! w  index of onset level for deep convection.   integer maxi(pcols)                 ! w  index of level with largest moist static energy.   integer index(pcols)   real(r8) precip!! gathered work fields:!   real(r8) qg(pcols,pver)             ! wg grid slice of gathered values of q.   real(r8) tg(pcols,pver)             ! w  grid slice of temperature at interface.   real(r8) pg(pcols,pver)             ! wg grid slice of gathered values of p.   real(r8) zg(pcols,pver)             ! wg grid slice of gathered values of z.   real(r8) sg(pcols,pver)             ! wg grid slice of gathered values of s.   real(r8) tpg(pcols,pver)            ! wg grid slice of gathered values of tp.   real(r8) zfg(pcols,pver+1)          ! wg grid slice of gathered values of zf.   real(r8) qstpg(pcols,pver)          ! wg grid slice of gathered values of qstp.   real(r8) ug(pcols,pver)             ! wg grid slice of gathered values of u.   real(r8) vg(pcols,pver)             ! wg grid slice of gathered values of v.   real(r8) cmeg(pcols,pver)   real(r8) cmfdqrg(pcols,pver)   real(r8) capeg(pcols)               ! wg gathered convective available potential energy.   real(r8) tlg(pcols)                 ! wg grid slice of gathered values of tl.   integer lclg(pcols)                 ! wg gathered values of lcl.   integer lelg(pcols)!! work fields arising from gathered calculations.!   real(r8) mu(pcols,pver)             ! wg upward cloud mass flux (positive up). specified at interface   real(r8) eu(pcols,pver)             ! wg entrainment in updraft.   real(r8) dqdt(pcols,pver)           ! wg mixing ratio tendency at gathered points.   real(r8) dsdt(pcols,pver)           ! wg dry static energy ("temp") tendency at gathered points.   real(r8) du(pcols,pver)             ! wg detrainment in updraft. specified in mid-layer   real(r8) md(pcols,pver)             ! wg downward cloud mass flux (positive up).   real(r8) ed(pcols,pver)             ! wg entrainment in downdraft.!      real(r8) alpha(pcols,pver)      ! array of vertical differencing used (=1. for upstream).   real(r8) sd(pcols,pver)             ! wg grid slice of dry static energy in downdraft.   real(r8) qd(pcols,pver)             ! wg grid slice of mixing ratio in downdraft.   real(r8) mc(pcols,pver)             ! wg net upward (scaled by mb) cloud mass flux.   real(r8) qhat(pcols,pver)           ! wg grid slice of upper interface mixing ratio.   real(r8) qu(pcols,pver)             ! wg grid slice of mixing ratio in updraft.   real(r8) su(pcols,pver)             ! wg grid slice of dry static energy in updraft.   real(r8) qs(pcols,pver)             ! wg grid slice of saturation mixing ratio.   real(r8) shat(pcols,pver)           ! wg grid slice of upper interface dry static energy.   real(r8) hmn(pcols,pver)            ! wg moist static energy.   real(r8) hsat(pcols,pver)           ! wg saturated moist static energy.   real(r8) qlg(pcols,pver)   real(r8) dudt(pcols,pver)           ! wg u-wind tendency at gathered points.   real(r8) dvdt(pcols,pver)           ! wg v-wind tendency at gathered points.!      real(r8) ud(pcols,pver)!      real(r8) vd(pcols,pver)!      real(r8) deltat(pcols,pver)!      real(r8) deltaq(pcols,pver)   real(r8) mb(pcols)                  ! wg cloud base mass flux.   real(r8) totpcp(pcols)   real(r8) totevp(pcols)   integer jlcl(pcols)   integer j0(pcols)                 ! wg detrainment initiation level index.   integer jd(pcols)                 ! wg downdraft initiation level index.   real(r8) delt                     ! length of model time-step in seconds.   integer i   integer ii   integer k   integer msg                      !  ic number of missing moisture levels at the top of model.   integer nstep   real(r8) psdiss   real(r8) psevap   real(r8) psheat   real(r8) psrain   real(r8) qdifr   real(r8) qeff   real(r8) sdifr!#include <guang.h>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?