diff --git a/physics/CONV/Chikira_Sugiyama/cs_conv.F90 b/physics/CONV/Chikira_Sugiyama/cs_conv.F90 index ab7388df8..953f03ed2 100644 --- a/physics/CONV/Chikira_Sugiyama/cs_conv.F90 +++ b/physics/CONV/Chikira_Sugiyama/cs_conv.F90 @@ -1,6 +1,3 @@ -!> \file cs_conv.F90 -!! This file contains the Chikira-Sugiyama Convection scheme. - module cs_conv !--------------------------------------------------------------------------------- ! Purpose: @@ -8,12 +5,57 @@ module cs_conv !>--------------------------------------------------------------------------------- ! Purpose: ! -!> Interface for Chikira-Sugiyama convection scheme -!! -!! Author: Minoru Chikira +! Interface for Chikira-Sugiyama convection scheme +! +! Author: Minoru Chikira +! History: +! June 26 2014 D. Dazlich - Modified for GFS +! Apr 10 2015 : S. Moorthi - check for allocatable arrays and fix argument for cbmfx +! Oct 2015 : D. Dazlich - Add computation of updraft area fraction (sigma) for +! diagnostic purposes. +! Aug 2016 : D. Dazlich - Create flux form of tendencies and multiply by +! Arakawa-Wu functions of sigma +! Sep 2016 : S. Moorthi - found two bugs - cleanup and some optimization +! Oct 2016 : S. Moorthi - added sigma affects on tracers and CUMFLX and CUMDET +! made many cosmetic changes +! Nov 2016 : S. Moorthi - further optimization and cleanup and several bug fixes +! April 2017 : S. moorthi - many changes including removing elam and making gcym +! a function of cloud type. This makes it possible for +! AW affect propagate to other routines such as CUMUPR +! Apr 12, 2017 : S. Moorthi Added flx_form logical and relevant code to compute AW +! without flux form when false. +! May 17, 2017 : S. Moorthi - Added routine CUMSBW for just momentum change +! in advective form +! Sep 08, 2017 : D. Dazlich - tracers in flux form for AW +! Nov -- 2017 : S. Moorthi - fix some bugs and fix fluxform for tracers +! Nov 22 2017 : S. Moorthi - add kcnv array to identify points where deep convection +! operates - 0 - no convection 1 - with convection +! Jan 30 2018 : S, Moorthi - fixed sigmad dimension error in CUMDWN and an error when adjustp=.true. +! +! May -- 2018 : S. Moorthi - modified cumup to compute total workfunction (positive plus negative) +! and negative part only and to let a particular ensemble exist only if +! the ratio of negative to total is less than some prescribed percent. +! Also, added an extra iteration in this k loop. Reduced some memory. +! June 2018 : S. Moorthi - the output mass fluxes ud_mf, dd_mf and dt_mf are over time step delta +! February 2024: A. Cheng - updated from CSU and RT tests passed both intel and ! GNU +! Arakawa-Wu implemtation: for background, consult An Introduction to the +! General Circulation of the Atmosphere, Randall, chapter six. +! Traditional parameterizations compute tendencies like those in eq 103, 105 and 106. +! Because Arakawa-Wu applies different functions to different components to the +! terms within these equations, it requires the terms used in alternate eqns 91 - 93. +! The code required to compute these terms is added within, and the appropriate +! functions of updraft area fraction (sigma) are applied. Thus, AW requires three +! steps: +! computation of the updraft area fraction +! alternative representation of the tendency terms +! application of functions of sigma to the alternative tendency terms +! here, and in gbphys to the large-scale microphysics tendencies. +! +! The bulk of AW is implemented within subroutine CS_CUMLUS, and the routines it calls. +! !--------------------------------------------------------------------------------- ! - use machine , only : kind_phys + use machine , only : kind_phys use physcons, only : cp => con_cp, grav => con_g, & & rair => con_rd, rvap => con_rv, & & cliq => con_cliq, cvap => con_cvap, & @@ -32,26 +74,26 @@ module cs_conv elocp=el/cp, oneocp=one/cp, gocp=grav/cp, gravi=one/grav,& emeltocp=emelt/cp, cpoemelt=cp/emelt, epsln=1.e-10_kind_phys - real(kind_phys), parameter :: fact1=(cvap-cliq)/rvap, fact2=el/rvap-fact1*t0c !< to calculate d(qs)/dT + real(kind_phys), parameter :: fact1=(cvap-cliq)/rvap, fact2=el/rvap-fact1*t0c ! to calculate d(qs)/dT logical, parameter :: adjustp=.true. ! logical, parameter :: adjustp=.false. ! Tuning parameters set from namelist ! -! real(kind_phys), parameter, public :: CLMD = 0.60, & !< entrainment efficiency (now thru argument) +! real(kind_phys), parameter, public :: CLMD = 0.60, & ! entrainment efficiency (now thru argument) real(kind_phys), parameter, public :: & - PA=0.15, & !< factor for buoyancy to affect updraft velocity - CPRES = 0.55, & !< pressure factor for momentum transport - ALP0 = 5.0e7, & !< alpha parameter in prognostic closure -! ALP0 = 8.0e7, & !< alpha parameter in prognostic closure + PA=0.15, & ! factor for buoyancy to affect updraft velocity + CPRES = 0.55, & ! pressure factor for momentum transport + ALP0 = 5.0e7, & ! alpha parameter in prognostic closure +! ALP0 = 8.0e7, & ! alpha parameter in prognostic closure ! CLMP = (one-CLMD)*(PA+PA), & ! CLMDPA = CLMD*PA, & - spblmin=0.05, & !< minimum cloudbase height in p/ps - spblmax=0.30, & !< maximum cloudbase height in p/ps -! spblcrit=0.03, & !< minimum cloudbase height in p/ps -! spblcrit=0.035,& !< minimum cloudbase height in p/ps -! spblcrit=0.025,& !< minimum cloudbase height in p/ps + spblmin=0.05, & ! minimum cloudbase height in p/ps + spblmax=0.30, & ! maximum cloudbase height in p/ps +! spblcrit=0.03, & ! minimum cloudbase height in p/ps +! spblcrit=0.035,& ! minimum cloudbase height in p/ps +! spblcrit=0.025,& ! minimum cloudbase height in p/ps cincrit= -150.0 ! cincrit= -120.0 ! cincrit= -100.0 @@ -60,117 +102,66 @@ module cs_conv !DD and precipitation. Decrease for more precip real(kind_phys), public :: precz0, preczh, clmd, clmp, clmdpa + real(kind_phys), public, parameter :: c0t=0.002, d0t=0.002 ! ! Private data ! real(kind_phys), parameter :: unset_kind_phys = -999._kind_phys ! missing value ! - integer :: iulog !< unit to write debugging and diagnostic output + integer :: iulog ! unit to write debugging and diagnostic output !DD Note - see if I can find corresponding variable in a GFS module ! ! Shared variables ! - integer, parameter :: ITI = 2, ITL = 3 !< index of ice and liquid water + integer, parameter :: ITI = 2, ITL = 3 ! index of ice and liquid water - integer, save, dimension(50) :: IMFXR !< 0: mass fixer is not applied - !! tracers which may become negative - !! values e.g. subgrid-PDFs - !! 1: mass fixer is applied, total mass - !! may change through cumulus scheme - !! e.g. moisture, liquid cloud, ice - !! cloud, aerosols - !! 2: mass fixer is applied, total mass - !! never change through cumulus scheme - !! e.g. CO2 + integer, save, dimension(50) :: IMFXR ! 0: mass fixer is not applied + ! tracers which may become negative + ! values e.g. subgrid-PDFs + ! 1: mass fixer is applied, total mass + ! may change through cumulus scheme + ! e.g. moisture, liquid cloud, ice + ! cloud, aerosols + ! 2: mass fixer is applied, total mass + ! never change through cumulus scheme + ! e.g. CO2 ! PUBLIC: interfaces ! - public cs_conv_run ! CS scheme main driver - + public cs_conv_run ! CS scheme main driver + contains -!>\defgroup cs_scheme Chikira-Sugiyama Cumulus Scheme Module -!> \brief The subroutine contains the main driver for Chikira-Sugiyama convective scheme. -!! -!! \author Minoru Chikira -!! -!! History: -!! - Jun 26 2014 : D. Dazlich - Modified for GFS -!! - Apr 10 2015 : S. Moorthi - check for allocatable arrays and fix argument for cbmfx -!! - Oct 2015 : D. Dazlich - Add computation of updraft area fraction (sigma) for -!! diagnostic purposes. -!! - Aug 2016 : D. Dazlich - Create flux form of tendencies and multiply by -!! Arakawa-Wu functions of sigma -!! - Sep 2016 : S. Moorthi - found two bugs - cleanup and some optimization -!! - Oct 2016 : S. Moorthi - added sigma affects on tracers and CUMFLX and CUMDET -!! made many cosmetic changes -!! - Nov 2016 : S. Moorthi - further optimization and cleanup and several bug fixes -!! - April 2017 : S. moorthi - many changes including removing elam and making gcym -!! a function of cloud type. This makes it possible for -!! AW affect propagate to other routines such as CUMUPR -!! - Apr 12, 2017 : S. Moorthi - Added flx_form logical and relevant code to compute AW -!! without flux form when false. -!! - May 17, 2017 : S. Moorthi - Added routine CUMSBW for just momentum change -!! in advective form -!! - Sep 08, 2017 : D. Dazlich - tracers in flux form for AW -!! - Nov 2017 : S. Moorthi - fix some bugs and fix fluxform for tracers -!! - Nov 22 2017 : S. Moorthi - add kcnv array to identify points where deep convection -!! operates - 0 - no convection 1 - with convection -!! - Jan 30 2018 : S. Moorthi - fixed sigmad dimension error in CUMDWN and an error when adjustp=.true. -!! - May 2018 : S. Moorthi - modified cumup to compute total workfunction (positive plus negative) -!! and negative part only and to let a particular ensemble exist only if -!! the ratio of negative to total is less than some prescribed percent. -!! Also, added an extra iteration in this k loop. Reduced some memory. -!! - June 2018 : S. Moorthi - the output mass fluxes ud_mf, dd_mf and dt_mf are over time step delta -!! -!! \b Arakawa-Wu \b implemtation: -!! for background, consult An Introduction to the -!! General Circulation of the Atmosphere, Randall, chapter six. -!! Traditional parameterizations compute tendencies like those in eq 103, 105 and 106. -!! Because Arakawa-Wu applies different functions to different components to the -!! terms within these equations, it requires the terms used in alternate eqns 91 - 93. -!! The code required to compute these terms is added within, and the appropriate -!! functions of updraft area fraction (sigma) are applied. Thus, AW requires three -!! steps: -!! -# computation of the updraft area fraction -!! -# alternative representation of the tendency terms -!! -# application of functions of sigma to the alternative tendency terms -!! here, and in gbphys to the large-scale microphysics tendencies. -!! -!! The bulk of AW is implemented within subroutine CS_CUMLUS(), and the routines it calls. -!! -!! -!! JLS NOTE: The convective mass fluxes (dt_mf, dd_mf and ud_mf) passed in and out of cs_conv have not been multiplied by -!! the timestep (kg/m2/sec) as they are in all other convective schemes. EMC is aware of this problem, -!! and in the future will be fixing this discrepancy. In the meantime, CCPP will use the same mass flux standard_name -!! and long_name as the other convective schemes, where the units are in kg/m2. (Aug 2018) -!! -!! \section arg_table_cs_conv_run Argument Table -!! \htmlinclude cs_conv_run.html -!! -!! \section general_cs_conv CS Convection Scheme General Algorithm -!> @{ - subroutine cs_conv_run( IJSDIM , KMAX , ntracp1 , NN, & - NTR , nctp , & !DD dimensions - otspt , lat , kdt , & - t , q , rain1 , clw , & - zm , zi , pap , paph , & - delta , delti , ud_mf , dd_mf , dt_mf, & - u , v , fscav , fswtr, & - cbmfx , mype , wcbmaxm , precz0in, preczhin, & - clmdin , sigma , do_aw , do_awdd , flx_form, & - lprnt , ipr, kcnv, & - QLCN, QICN, w_upi, cf_upi, CNV_MFD, & ! for coupling to MG microphysics - CNV_DQLDT,CLCN,CNV_FICE,CNV_NDROP,CNV_NICE, & - mp_phys,errmsg,errflg) +!--------------------------------------------------------------------------------- + subroutine cs_conv_run( IJSDIM , KMAX , ntracp1 , NN, & + NTR , nctp , & !DD dimensions + otspt , lat , kdt , & + t , q , rain1 , clw , & + zm , zi , pap , paph , & + delta , delti , ud_mf , dd_mf , dt_mf, & + u , v , fscav , fswtr, & + cbmfx , mype , wcbmaxm , precz0in, preczhin, & + clmdin , sigma , do_aw , do_awdd , flx_form, & + lprnt , ipr, kcnv, & + QLCN, QICN, w_upi, cf_upi, CNV_MFD, & + CNV_DQLDT,CLCN,CNV_FICE,CNV_NDROP,CNV_NICE, & + mp_phys,errmsg,errflg) +!--------------------------------------------------------------------------------- +! Purpose: +! +! Main driver for Chikira-Sugiyama convective scheme +! +! Author: Minoru Chikira +! +!--------------------------------------------------------------------------------- implicit none ! ! input arguments ! - INTEGER, INTENT(IN) :: IJSDIM, KMAX, ntracp1, nn, NTR, mype, nctp, mp_phys, kdt, lat !! DD, for GFS, pass in - logical, intent(in) :: otspt(:,:) ! otspt(:,1) - on/off switch for tracer transport by updraft and + INTEGER, INTENT(IN) :: IJSDIM, KMAX, ntracp1, nn, NTR, mype, nctp, mp_phys, kdt,lat !! DD, for GFS, pass in + logical, intent(in) :: otspt(1:ntracp1,1:2)! otspt(:,1) - on/off switch for tracer transport by updraft and ! downdraft. should not include subgrid PDF and turbulence ! otspt(:,2) - on/off switch for tracer transport by subsidence ! should include subgrid PDF and turbulence @@ -188,8 +179,8 @@ subroutine cs_conv_run( IJSDIM , KMAX , ntracp1 , NN, & real(kind_phys), intent(inout) :: u(:,:) ! zonal wind at mid-layer (m/s) real(kind_phys), intent(inout) :: v(:,:) ! meridional wind at mid-layer (m/s) - real(kind_phys), intent(in) :: DELTA ! physics time step - real(kind_phys), intent(in) :: DELTI ! dynamics time step (model time increment in seconds) + real(kind_phys), intent(in) :: DELTA ! physics time step + real(kind_phys), intent(in) :: DELTI ! dynamics time step (model time increment in seconds) logical, intent(in) :: do_aw, do_awdd, flx_form ! ! modified arguments @@ -200,8 +191,9 @@ subroutine cs_conv_run( IJSDIM , KMAX , ntracp1 , NN, & ! ! updraft, downdraft, and detrainment mass flux (kg/m2/s) real(kind_phys), intent(inout), dimension(:,:) :: ud_mf, dd_mf, dt_mf - + real(kind_phys), intent(out) :: rain1(:) ! lwe thickness of deep convective precipitation amount (m) + ! GJF* These variables are conditionally allocated depending on whether the ! Morrison-Gettelman microphysics is used, so they must be declared ! using assumed shape. @@ -225,40 +217,44 @@ subroutine cs_conv_run( IJSDIM , KMAX , ntracp1 , NN, & ! ! output arguments of CS_CUMLUS ! - real(kind_phys), dimension(IJSDIM,KMAX,nctp) :: vverti - - real(kind_phys) GTT(IJSDIM,KMAX) !< temperature tendency [K/s] - real(kind_phys) GTQ(IJSDIM,KMAX,NTR) !< tracer tendency [kg/kg/s] - real(kind_phys) GTU(IJSDIM,KMAX) !< zonal velocity tendency [m/s2] - real(kind_phys) GTV(IJSDIM,KMAX) !< meridional velocity tendency [m/s2] - real(kind_phys) GTPRP(IJSDIM,KMAX) !< precipitation (including snowfall) flux at interfaces [kg/m2/s] - real(kind_phys) GSNWP(IJSDIM,KMAX) !< snowfall flux at interfaces [kg/m2/s] + real(kind_phys), dimension(IJSDIM,KMAX+1,nctp) :: vverti, sigmai + +! - integer KT(IJSDIM,nctp) !< cloud top index for each cloud type + real(kind_phys) GTT(IJSDIM,KMAX) ! temperature tendency [K/s] + real(kind_phys) GTQ(IJSDIM,KMAX,NTR) ! tracer tendency [kg/kg/s] + real(kind_phys) GTU(IJSDIM,KMAX) ! zonal velocity tendency [m/s2] + real(kind_phys) GTV(IJSDIM,KMAX) ! meridional velocity tendency [m/s2] + real(kind_phys) CMDET(IJSDIM,KMAX) ! detrainment mass flux [kg/m2/s] + real(kind_phys) GTPRP(IJSDIM,KMAX+1) ! precipitation (including snowfall) flux + real(kind_phys) GSNWP(IJSDIM,KMAX+1) ! snowfall flux at interfaces [kg/m2/s] + real(kind_phys) GMFX0(IJSDIM,KMAX+1) ! updraft mass flux [kg/m2/s] + real(kind_phys) GMFX1(IJSDIM,KMAX+1) ! downdraft mass flux [kg/m2/s] + integer KT(IJSDIM,nctp) ! cloud top index for each cloud type - real(kind_phys) :: cape(IJSDIM) !< convective available potential energy (J/kg) + real(kind_phys) :: cape(IJSDIM) ! convective available potential energy (J/kg) real(kind_phys) :: prec(IJSDIM) !< precipitation at surface (including snowfall) (kg/m2/s) - real(kind_phys) :: snow(IJSDIM) !< snowfall at surface (kg/m2/s) + real(kind_phys) :: snow(IJSDIM) ! snowfall at surface (kg/m2/s) ! ! input arguments of CS_CUMLUS ! - real(kind_phys) GDT(IJSDIM,KMAX) !< temperature [K] - real(kind_phys) GDQ(IJSDIM,KMAX,NTR) !< tracers including moisture [kg/kg] !DDsigmadiag - real(kind_phys) GDU(IJSDIM,KMAX) !< zonal wind [m/s] - real(kind_phys) GDV(IJSDIM,KMAX) !< meridional wind [m/s] - real(kind_phys) GDTM(IJSDIM,KMAX+1) !< temperature at boundaries of layers [K] - real(kind_phys) GDP(IJSDIM,KMAX) !< pressure [Pa] - real(kind_phys) GDPM(IJSDIM,KMAX+1) !< pressure at boundaries of layers [Pa] - real(kind_phys) GDZ(IJSDIM,KMAX) !< altitude [m] - real(kind_phys) GDZM(IJSDIM,KMAX+1) !< altitude at boundaries of layers [m] - real(kind_phys) delp(IJSDIM,KMAX) !< pressure difference between layers [Pa] - real(kind_phys) delpi(IJSDIM,KMAX) !< grav/delp + real(kind_phys) GDT(IJSDIM,KMAX) ! temperature [K] + real(kind_phys) GDQ(IJSDIM,KMAX,NTR) ! tracers including moisture [kg/kg] !DDsigmadiag + real(kind_phys) GDU(IJSDIM,KMAX) ! zonal wind [m/s] + real(kind_phys) GDV(IJSDIM,KMAX) ! meridional wind [m/s] + real(kind_phys) GDTM(IJSDIM,KMAX+1) ! temperature at boundaries of layers [K] + real(kind_phys) GDP(IJSDIM,KMAX) ! pressure [Pa] + real(kind_phys) GDPM(IJSDIM,KMAX+1) ! pressure at boundaries of layers [Pa] + real(kind_phys) GDZ(IJSDIM,KMAX) ! altitude [m] + real(kind_phys) GDZM(IJSDIM,KMAX+1) ! altitude at boundaries of layers [m] + real(kind_phys) delp(IJSDIM,KMAX) ! pressure difference between layers [Pa] + real(kind_phys) delpi(IJSDIM,KMAX) ! grav/delp ! ! local variables ! -!DD real(kind_phys) :: zs(IJSDIM) !< surface height [m] +!DD real(kind_phys) :: zs(IJSDIM) ! surface height [m] - integer KTMAX(IJSDIM) !< max of KT + integer KTMAX(IJSDIM) ! max of KT real(kind_phys) :: ftintm, wrk, wrk1, tem integer i, k, n, ISTS, IENS, kp1 @@ -274,7 +270,6 @@ subroutine cs_conv_run( IJSDIM , KMAX , ntracp1 , NN, & ! lprnt = kdt == 1 .and. mype == 38 ! ipr = 43 - precz0 = precz0in preczh = preczhin clmd = clmdin @@ -315,16 +310,6 @@ subroutine cs_conv_run( IJSDIM , KMAX , ntracp1 , NN, & enddo !DD following adapted from ras -!> -# Following the Relaxed Arakawa Schubert Scheme (RAS; -!! Moorthi and Suarez 1992 \cite moorthi_and_suarez_1992 ), -!! separate total condensate between ice and water. -!! The ratio of cloud ice to cloud water is determined by a linear function -!! of temperature: -!!\f[ -!! F_i(T)= (T_2-T)/(T_2-T_1) -!!\f] -!! where T is temperature, and\f$T_1\f$ and \f$T_2\f$ are set as tcf=263.16 -!! and tf= 233.16 if (clw(1,1,2) <= -999.0) then ! input ice/water are together do k=1,kmax do i=1,IJSDIM @@ -358,7 +343,7 @@ subroutine cs_conv_run( IJSDIM , KMAX , ntracp1 , NN, & ! !*************************************************************************************** ! -!> -# Calculate temperature at interfaces +! calculate temperature at interfaces ! DO K=2,KMAX @@ -375,28 +360,29 @@ subroutine cs_conv_run( IJSDIM , KMAX , ntracp1 , NN, & GDTM(I,1) = GDT(I,1) ! Is this a good approximation ? - Moorthi ENDDO -!> -# Initialize the sigma diagnostics +!DDsigma - initialize the sigma diagnostics do n=1,nctp - do k=1,kmax + do k=1,kmax+1 do i=ists,iens vverti(i,k,n) = zero + sigmai(i,k,n) = zero enddo enddo enddo - do k=1,kmax + do k=1,kmax+1 do i=ists,iens sigma(i,k) = zero enddo enddo ! -!> -# Call cs_cumlus() for the main CS cumulus parameterization - call CS_CUMLUS (IJSDIM, IJSDIM, KMAX , NTR , & !DD dimensions +!*************************************************************************************** + call CS_CUMLUS (IJSDIM , IJSDIM, KMAX , NTR , & !DD dimensions otspt(1:ntr,1), otspt(1:ntr,2), & lprnt , ipr , & GTT , GTQ , GTU , GTV , & ! output - dt_mf , & ! output - GTPRP , GSNWP , ud_mf , & ! output - dd_mf , cape , KT , & ! output + CMDET , & ! output + GTPRP , GSNWP , GMFX0 , & ! output + GMFX1 , cape , KT , & ! output CBMFX , & ! modified GDT , GDQ , GDU , GDV , & ! input GDTM , & ! input @@ -404,23 +390,21 @@ subroutine cs_conv_run( IJSDIM , KMAX , ntracp1 , NN, & delp , delpi , & DELTA , DELTI , ISTS , IENS, mype,& ! input fscav, fswtr, wcbmaxm, nctp, & - sigma, vverti, & ! input/output !DDsigma + sigmai, sigma, vverti, & ! input/output !DDsigma do_aw, do_awdd, flx_form) ! ! !DD detrainment has to be added in for GFS ! ! if (lprnt) write(0,*)' aft cs_cum gtqi=',gtq(ipr,:,2) -! if (lprnt) write(0,*)' aft cs_cum gtql=',gtq(ipr,:,3) - - - do n=2,NTR - do k=1,KMAX - do i=1,IJSDIM - clw(i,k,n-1) = max(zero, GDQ(i,k,n) + GTQ(i,k,n) * delta) - enddo - enddo - enddo +! if (lprnt) write(0,*)' aft cs_cum gtql=',gtq(ipr,:,3), clw(sprh, ice,liq,..ntke) + do n = 2, NTR + do k = 1, KMAX + do i = 1, IJSDIM + clw(i,k,n-1) = max(zero, GDQ(i,k,n) + GTQ(i,k,n) * delta) + end do + end do + end do ! if (lprnt) write(0,*)' aftcs_cum tkein=',gdq(ipr,1:25,ntr),' delta=',delta ! if (lprnt) write(0,*)' aftcs_cum tke=',clw(ipr,1:25,ntr-1) ! if (lprnt) write(0,*)'in cs clw1a=',clw(ipr,:,1),' kdt=',kdt @@ -432,10 +416,13 @@ subroutine cs_conv_run( IJSDIM , KMAX , ntracp1 , NN, & t(i,k) = GDT(i,k) + GTT(i,k) * delta u(i,k) = GDU(i,k) + GTU(i,k) * delta v(i,k) = GDV(i,k) + GTV(i,k) * delta +! Set the mass fluxes. + ud_mf (i,k) = GMFX0(i,k) + dd_mf (i,k) = GMFX1(i,k) + dt_mf (i,k) = CMDET(i,k) enddo enddo - if (mp_phys == 10) then ! for 2M microphysics, always output these variables if (do_aw) then do k=1,KMAX @@ -458,8 +445,8 @@ subroutine cs_conv_run( IJSDIM , KMAX , ntracp1 , NN, & ! CNV_PRC3(i,k) = 0.0 CNV_NDROP(i,k) = 0.0 CNV_NICE(i,k) = 0.0 - cf_upi(i,k) = max(0.0, min(1.0, 0.5*(sigma(i,k)+sigma(i,kp1)))) - CLCN(i,k) = cf_upi(i,k) !downdraft is below updraft +! cf_upi(i,k) = max(0.0,min(0.01*log(1.0+500*ud_mf(i,k)),0.1)) +! CLCN(i,k) = cf_upi(i,k) !downdraft is below updraft !! clcn(i,k) = max(0.0,min(0.01*log(1.0+500*ud_mf(i,k)/delta),0.25)) w_upi(i,k) = 0.0 @@ -484,6 +471,7 @@ subroutine cs_conv_run( IJSDIM , KMAX , ntracp1 , NN, & do i=1,IJSDIM qicn(i,k) = max(0.0, clw(i,k,1)-gdq(i,k,2)) qlcn(i,k) = max(0.0, clw(i,k,2)-gdq(i,k,3)) + cnv_fice(i,k) = qicn(i,k) / max(1.0e-10,qicn(i,k)+qlcn(i,k)) ! ! CNV_MFD(i,k) = dt_mf(i,k) * (1/delta) @@ -492,9 +480,9 @@ subroutine cs_conv_run( IJSDIM , KMAX , ntracp1 , NN, & ! CNV_PRC3(i,k) = 0.0 CNV_NDROP(i,k) = 0.0 CNV_NICE(i,k) = 0.0 - cf_upi(i,k) = max(0.0,min(0.01*log(1.0+500*ud_mf(i,k)),0.25)) +! cf_upi(i,k) = max(0.0,min(0.01*log(1.0+500*ud_mf(i,k)),0.1)) ! & 500*ud_mf(i,k)),0.60)) - CLCN(i,k) = cf_upi(i,k) !downdraft is below updraft +! CLCN(i,k) = cf_upi(i,k) !downdraft is below updraft w_upi(i,k) = ud_mf(i,k)*(t(i,k)+epsvt*gdq(i,k,1)) * rair & / (max(cf_upi(i,k),1.e-12)*gdp(i,k)) @@ -522,7 +510,7 @@ subroutine cs_conv_run( IJSDIM , KMAX , ntracp1 , NN, & endif enddo -!> -# Multiply mass fluxes by the time step +! multiplying mass fluxes by the time step do k=1,kmax do i=1,ijsdim @@ -532,11 +520,13 @@ subroutine cs_conv_run( IJSDIM , KMAX , ntracp1 , NN, & enddo enddo -! rain1(:) = prec(:) * (delta*0.001) ! Convert prec flux kg/m2/sec to rain1 in m +! rain1(:) = prec(:) * (delta*0.001) ! Convert prec flux kg/m2/sec to +! rain1 in m do i= 1, IJSDIM rain1(i) = prec(i) * (delta*0.001) enddo + ! if (lprnt) then ! write(0,*)' aft cs_cum prec=',prec(ipr),'GTPRP=',GTPRP(ipr,1) ! endif @@ -549,33 +539,34 @@ subroutine cs_conv_run( IJSDIM , KMAX , ntracp1 , NN, & ! endif end subroutine cs_conv_run -!> @} !************************************************************************ -!>\ingroup cs_scheme -!! Main subroutine for the cumulus parameterization with -!! state-dependent entrainment rate developed by Minoru Chikira. -!! -!! - This routine works as the prognostic Arakawa-Schubert scheme -!! if OPT_ASMODE is specified. -!! - Specify OPT_NS02 to use entrainment rate of Neggers et al. (2002) -!! - Specify OPT_CUMBGT to check water and energy budget. -!! - Specify OPT_CUMCHK to check range of output values. -!! -!! History(yy/mm/dd): -!! - 08/09/19(chikira) MIROC4.1 -!! - 08/10/30(hiro) CMT modified -!! - 08/11/11(chikira) Neggers et al. (2002) -!! - 08/12/3 (chikira) downdraft detrainment modified -!! - 08/12/3 (chikira) COSP output -!! - 09/02/24(chikira) fix convective inhibition -!! - 09/04/16(hiro) CMIP5 output (cbasep,ctopp) -!! - 09/09/03(yokohata) COSP -!! - 10/11/19(toshi) small bug fix -!! - 14/02/07(chikira) CUMDWN bug fix, CMT modified -!!\section gen_cs_cumlus CSAW cs_cumlus General Algorithm -!> @{ +!* Original source code in MIROC5 +!* +!* PACKAGE PCUMC !! physics: cumulus parameterization with +!* state-dependent entrainment rate +!* developed by Minoru Chikira +!* [Note] +!* -This routine works as the prognostic Arakawa-Schubert scheme +!* if OPT_ASMODE is specified. +!* -Specify OPT_NS02 to use entrainment rate of Neggers et al. (2002) +!* -Specify OPT_CUMBGT to check water and energy budget. +!* -Specify OPT_CUMCHK to check range of output values. +!* +!* [HIS] 08/09/19(chikira) MIROC4.1 +!* 08/10/30(hiro) CMT modified +!* 08/11/11(chikira) Neggers et al. (2002) +!* 08/12/3 (chikira) downdraft detrainment modified +!* 08/12/3 (chikira) COSP output +!* 09/02/24(chikira) fix convective inhibition +!* 09/04/16(hiro) CMIP5 output (cbasep,ctopp) +!* 09/09/03(yokohata) COSP +!* 10/11/19(toshi) small bug fix +!* 14/02/07(chikira) CUMDWN bug fix, CMT modified +!************************************************************************ +! cumulus main routine +! -------------------- SUBROUTINE CS_CUMLUS (im , IJSDIM, KMAX , NTR , & !DD dimensions otspt1, otspt2, lprnt , ipr , & GTT , GTQ , GTU , GTV , & ! output @@ -586,11 +577,11 @@ SUBROUTINE CS_CUMLUS (im , IJSDIM, KMAX , NTR , & !DD dimensions GDT , GDQ , GDU , GDV , & ! input GDTM , & ! input GDP , GDPM , GDZ , GDZM , & ! input - delp , delpi , & + delp , delpinv , & DELTA , DELTI , ISTS , IENS, mype,& ! input fscav, fswtr, wcbmaxm, nctp, & ! - sigma, vverti, & ! input/output !DDsigma - do_aw, do_awdd, flx_form ) + sigmai, sigma, vverti, & ! input/output !DDsigma + do_aw, do_awdd, flx_form) ! IMPLICIT NONE @@ -598,222 +589,291 @@ SUBROUTINE CS_CUMLUS (im , IJSDIM, KMAX , NTR , & !DD dimensions INTEGER, INTENT(IN) :: im, IJSDIM, KMAX, NTR, mype, nctp, ipr !! DD, for GFS, pass in logical, intent(in) :: do_aw, do_awdd, flx_form ! switch to apply Arakawa-Wu to the tendencies logical, intent(in) :: otspt1(ntr), otspt2(ntr), lprnt + REAL(kind_phys),intent(in) :: DELP (IJSDIM, KMAX) + REAL(kind_phys),intent(in) :: DELPINV (IJSDIM, KMAX) ! ! [OUTPUT] - REAL(kind_phys), INTENT(OUT) :: GTT (IJSDIM, KMAX ) ! heating rate - REAL(kind_phys), INTENT(OUT) :: GTQ (IJSDIM, KMAX, NTR) ! change in q - REAL(kind_phys), INTENT(OUT) :: GTU (IJSDIM, KMAX ) ! tendency of u - REAL(kind_phys), INTENT(OUT) :: GTV (IJSDIM, KMAX ) ! tendency of v - REAL(kind_phys), INTENT(OUT) :: CMDET (IJSDIM, KMAX ) ! detrainment mass flux - -! assuming there is no flux at the top of the atmospherea - Moorthi - REAL(kind_phys), INTENT(OUT) :: GTPRP (IJSDIM, KMAX ) ! rain+snow flux - REAL(kind_phys), INTENT(OUT) :: GSNWP (IJSDIM, KMAX ) ! snowfall flux - REAL(kind_phys), INTENT(OUT) :: GMFX0 (IJSDIM, KMAX ) ! updraft mass flux - REAL(kind_phys), INTENT(OUT) :: GMFX1 (IJSDIM, KMAX ) ! downdraft mass flux - - REAL(kind_phys), INTENT(OUT) :: CAPE (IJSDIM ) - INTEGER , INTENT(OUT) :: KT (IJSDIM, NCTP ) ! cloud top + REAL(kind_phys), INTENT(OUT) :: GTT ( IJSDIM, KMAX ) !! heating rate + REAL(kind_phys), INTENT(OUT) :: GTQ ( IJSDIM, KMAX, NTR ) !! change in q + REAL(kind_phys), INTENT(OUT) :: GTU ( IJSDIM, KMAX ) !! tendency of u + REAL(kind_phys), INTENT(OUT) :: GTV ( IJSDIM, KMAX ) !! tendency of v + REAL(kind_phys), INTENT(OUT) :: CMDET ( IJSDIM, KMAX ) !! detrainment mass flux + REAL(kind_phys) :: GTLDET( IJSDIM, KMAX ) !! cloud liquid tendency by detrainment + REAL(kind_phys) :: GTIDET( IJSDIM, KMAX ) !! cloud ice tendency by detrainment + REAL(kind_phys), INTENT(OUT) :: GTPRP ( IJSDIM, KMAX+1 ) !! rain+snow flux + REAL(kind_phys), INTENT(OUT) :: GSNWP ( IJSDIM, KMAX+1 ) !! snowfall flux + REAL(kind_phys), INTENT(OUT) :: GMFX0 ( IJSDIM, KMAX+1 ) !! updraft mass flux + REAL(kind_phys), INTENT(OUT) :: GMFX1 ( IJSDIM, KMAX+1 ) !! downdraft mass flux + REAL(kind_phys), INTENT(OUT) :: CAPE ( IJSDIM ) + INTEGER , INTENT(OUT) :: KT ( IJSDIM, NCTP ) !! cloud top ! ! [MODIFIED] - REAL(kind_phys), INTENT(INOUT) :: CBMFX (IM, NCTP) ! cloud base mass flux - -!DDsigma - output added for AW sigma diagnostics -! sigma and vert. velocity as a function of cloud type (1==sfc) - real(kind_phys), intent(out), dimension(IM,KMAX) :: sigma !sigma totaled over cloud type - on interfaces (1=sfc) - real(kind_phys), intent(out), dimension(IM,KMAX,nctp) :: vverti + REAL(kind_phys), INTENT(INOUT) :: CBMFX ( IM, NCTP ) !! cloud base mass flux + !DDsigma - output added for AW sigma diagnostics + real(kind_phys), intent(out) :: sigmai(IM,KMAX+1,nctp) !DDsigma sigma by cloud type - on interfaces (1=sfc) + real(kind_phys), intent(out) :: vverti(IM,KMAX+1,nctp) !DDsigma vert. vel. by cloud type - on interfaces (1=sfc) + real(kind_phys), intent(out) :: sigma(IM,KMAX+1) !DDsigma sigma totaled over cloud type - on interfaces (1=sfc) + ! for computing AW flux form of tendencies -! The tendencies are summed over all cloud types -! real(kind_phys), intent(out), dimension(IM,KMAX) :: & !DDsigmadiag - real(kind_phys), allocatable, dimension(:,:) :: sfluxterm, qvfluxterm,& ! tendencies of DSE and water vapor due to eddy mass flux - qlfluxterm, qifluxterm,& ! tendencies of cloud water and cloud ice due to eddy mass flux +! real(kind_phys), dimension(IM,KMAX) :: & !DDsigmadiag +! sfluxterm, qvfluxterm +! real(kind_phys), dimension(IM,KMAX) :: & !DDsigmadiag +! qlfluxterm, qifluxterm +! real(kind_phys), dimension(ijsdim,kmax,ntrq:ntr) :: trfluxterm ! tendencies of tracers due to eddy mass flux + real(kind_phys), dimension(IM,KMAX) :: & !DDsigmadiag + condtermt, condtermq, frzterm, prectermq, prectermfrz + !DDsigma -! The fluxes are for an individual cloud type and reused. -! condtermt, condtermq are eddy flux of temperature and water vapor - condtermt, condtermq, frzterm, & - prectermq, prectermfrz - real(kind_phys), allocatable, dimension(:,:,:) :: trfluxterm ! tendencies of tracers due to eddy mass flux ! ! [INPUT] - REAL(kind_phys), INTENT(IN) :: GDT (IJSDIM, KMAX ) ! temperature T - REAL(kind_phys), INTENT(IN) :: GDQ (IJSDIM, KMAX, NTR) ! humidity, tracer !DDsigmadiag - REAL(kind_phys), INTENT(IN) :: GDU (IJSDIM, KMAX ) ! westerly u - REAL(kind_phys), INTENT(IN) :: GDV (IJSDIM, KMAX ) ! southern wind v - REAL(kind_phys), INTENT(IN) :: GDTM (IJSDIM, KMAX+1 ) ! temperature T - REAL(kind_phys), INTENT(IN) :: GDP (IJSDIM, KMAX ) ! pressure P - REAL(kind_phys), INTENT(IN) :: GDPM (IJSDIM, KMAX+1 ) ! pressure (half lev) - REAL(kind_phys), INTENT(IN) :: GDZ (IJSDIM, KMAX ) ! altitude - REAL(kind_phys), INTENT(IN) :: GDZM (IJSDIM, KMAX+1 ) ! altitude - REAL(kind_phys), INTENT(IN) :: DELTA ! delta(t) (dynamics) - REAL(kind_phys), INTENT(IN) :: DELTI ! delta(t) (internal variable) - INTEGER, INTENT(IN) :: ISTS, IENS ! array range + REAL(kind_phys), INTENT(IN) :: GDT ( IJSDIM, KMAX ) !! temperature T + REAL(kind_phys), INTENT(IN) :: GDQ ( IJSDIM, KMAX, NTR ) !! humidity, tracer !DDsigmadiag + REAL(kind_phys), INTENT(IN) :: GDU ( IJSDIM, KMAX ) !! westerly u + REAL(kind_phys), INTENT(IN) :: GDV ( IJSDIM, KMAX ) !! southern wind v + REAL(kind_phys), INTENT(IN) :: GDTM ( IJSDIM, KMAX+1 ) !! temperature T + REAL(kind_phys), INTENT(IN) :: GDP ( IJSDIM, KMAX ) !! pressure P + REAL(kind_phys), INTENT(IN) :: GDPM ( IJSDIM, KMAX+1 ) !! pressure (half lev) + REAL(kind_phys), INTENT(IN) :: GDZ ( IJSDIM, KMAX ) !! altitude + REAL(kind_phys), INTENT(IN) :: GDZM ( IJSDIM, KMAX+1 ) !! altitude + REAL(kind_phys), INTENT(IN) :: DELTA !! delta(t) (dynamics) + REAL(kind_phys), INTENT(IN) :: DELTI !! delta(t) (internal variable) + INTEGER, INTENT(IN) :: ISTS, IENS !! array range real(kind_phys), intent(in) :: fscav(ntr), fswtr(ntr), wcbmaxm(ijsdim) ! ! [INTERNAL WORK] REAL(kind_phys), allocatable :: GPRCC (:, :) ! rainfall -! REAL(kind_phys) GPRCC (IJSDIM, NTR) ! rainfall -! REAL(kind_phys) GSNWC (IJSDIM) ! snowfall -! REAL(kind_phys) CUMCLW(IJSDIM, KMAX) ! cloud water in cumulus -! REAL(kind_phys) CUMFRC(IJSDIM) ! cumulus cloud fraction -! -! REAL(kind_phys) GTCFRC(IJSDIM, KMAX) ! change in cloud fraction -! REAL(kind_phys) FLIQC (IJSDIM, KMAX) ! liquid ratio in cumulus -! -! REAL(kind_phys) GDCFRC(IJSDIM, KMAX) ! cloud fraction -! - REAL(kind_phys) GDW (IJSDIM, KMAX) ! total water - REAL(kind_phys) DELP (IJSDIM, KMAX) - REAL(kind_phys) DELPI (IJSDIM, KMAX) - REAL(kind_phys) GDQS (IJSDIM, KMAX) ! saturate moisture - REAL(kind_phys) FDQS (IJSDIM, KMAX) - REAL(kind_phys) GAM (IJSDIM, KMAX) - REAL(kind_phys) GDS (IJSDIM, KMAX) ! dry static energy - REAL(kind_phys) GDH (IJSDIM, KMAX) ! moist static energy - REAL(kind_phys) GDHS (IJSDIM, KMAX) ! saturate MSE -! - REAL(kind_phys) GCYM (IJSDIM, KMAX, NCTP)! norm. mass flux (half lev) - REAL(kind_phys) GCHB (IJSDIM) ! cloud base MSE-Li*Qi - REAL(kind_phys) GCWB (IJSDIM) ! cloud base total water - REAL(kind_phys) GCUB (IJSDIM) ! cloud base U - REAL(kind_phys) GCVB (IJSDIM) ! cloud base V - REAL(kind_phys) GCIB (IJSDIM) ! cloud base ice - REAL(kind_phys) GCtrB (IJSDIM,ntrq:ntr) ! cloud base tracer - REAL(kind_phys) GCYT (IJSDIM, NCTP) ! norm. mass flux @top - REAL(kind_phys) GCHT (IJSDIM, NCTP) ! cloud top MSE - REAL(kind_phys) GCQT (IJSDIM, NCTP) ! cloud top q - REAL(kind_phys) GCwT (IJSDIM) ! cloud top total water - REAL(kind_phys) GCUT (IJSDIM, NCTP) ! cloud top U - REAL(kind_phys) GCVT (IJSDIM, NCTP) ! cloud top V - REAL(kind_phys) GCLT (IJSDIM, NCTP) ! cloud top cloud water - REAL(kind_phys) GCIT (IJSDIM, NCTP) ! cloud top cloud ice + REAL(kind_phys) GSNWC ( IJSDIM ) !! snowfall + REAL(kind_phys) CUMCLW( IJSDIM, KMAX ) !! cloud water in cumulus + REAL(kind_phys) CUMFRC( IJSDIM ) !! cumulus cloud fraction +!COSP + REAL(kind_phys) QLIQC ( IJSDIM, KMAX ) !! cumulus cloud liquid water [kg/kg] + REAL(kind_phys) QICEC ( IJSDIM, KMAX ) !! cumulus cloud ice [kg/kg] + REAL(kind_phys) GPRCPF( IJSDIM, KMAX ) !! rainfall flux at full level + REAL(kind_phys) GSNWPF( IJSDIM, KMAX ) !! snowfall flux at full level +! + REAL(kind_phys) GTCFRC( IJSDIM, KMAX ) !! change in cloud fraction + REAL(kind_phys) FLIQC ( IJSDIM, KMAX ) !! liquid ratio in cumulus +! +!#ifdef OPT_CHASER +! REAL(kind_phys) RFXC ( IJSDIM, KMAX+1 ) !! precipi. flx [kg/m2/s] +! REAL(kind_phys) SFXC ( IJSDIM, KMAX+1 ) !! ice/snow flx [kg/m2/s] +! INTEGER LEVCUM( IJSDIM, KMAX ) !! flag for cum. cloud top +! REAL(kind_phys) LNFRC ( IJSDIM, KMAX ) !! areal rates of clouds +! REAL(kind_phys) REVC ( IJSDIM, KMAX ) !! evaporation rates +!#endif +! + REAL(kind_phys) GDCFRC( IJSDIM, KMAX ) !! cloud fraction +! +! REAL(kind_phys) GTQL ( IJSDIM, KMAX ) !! tendency of cloud liquid +! + REAL(kind_phys) GDW ( IJSDIM, KMAX ) !! total water + REAL(kind_phys) GDQS ( IJSDIM, KMAX ) !! saturate moisture + REAL(kind_phys) FDQS ( IJSDIM, KMAX ) + REAL(kind_phys) GAM ( IJSDIM, KMAX ) + REAL(kind_phys) GDS ( IJSDIM, KMAX ) !! dry static energy + REAL(kind_phys) GDH ( IJSDIM, KMAX ) !! moist static energy + REAL(kind_phys) GDHS ( IJSDIM, KMAX ) !! saturate MSE +! + REAL(kind_phys) GCYM ( IJSDIM, KMAX, NCTP ) !! norm. mass flux (half lev) + REAL(kind_phys) GCHB ( IJSDIM ) !! cloud base MSE-Li*Qi + REAL(kind_phys) GCWB ( IJSDIM ) !! cloud base total water + REAL(kind_phys) GCtrB ( IJSDIM, ntrq:ntr ) !! cloud base water vapor tracer + REAL(kind_phys) GCUB ( IJSDIM ) !! cloud base U + REAL(kind_phys) GCVB ( IJSDIM ) !! cloud base V + REAL(kind_phys) GCIB ( IJSDIM ) !! cloud base ice + REAL(kind_phys) ELAM ( IJSDIM, KMAX, NCTP ) !! entrainment (rate*massflux) + REAL(kind_phys) GCYT ( IJSDIM, NCTP ) !! norm. mass flux @top + REAL(kind_phys) GCHT ( IJSDIM, NCTP ) !! cloud top MSE + REAL(kind_phys) GCQT ( IJSDIM, NCTP ) !! cloud top q + REAL(kind_phys) GCwT ( IJSDIM ) !! cloud top total water + REAL(kind_phys) GCUT ( IJSDIM, NCTP ) !! cloud top U + REAL(kind_phys) GCVT ( IJSDIM, NCTP ) !! cloud top V + REAL(kind_phys) GCLT ( IJSDIM, NCTP ) !! cloud top cloud water + REAL(kind_phys) GCIT ( IJSDIM, NCTP ) !! cloud top cloud ice REAL(kind_phys) GCtrT (IJSDIM, ntrq:ntr, NCTP) ! cloud top tracer - REAL(kind_phys) GTPRT (IJSDIM, NCTP) ! precipitation/M - REAL(kind_phys) GCLZ (IJSDIM, KMAX) ! cloud liquid for each CTP - REAL(kind_phys) GCIZ (IJSDIM, KMAX) ! cloud ice for each CTP - -! REAL(kind_phys) ACWF (IJSDIM, NCTP) ! cloud work function - REAL(kind_phys) ACWF (IJSDIM ) ! cloud work function - REAL(kind_phys) GPRCIZ(IJSDIM, KMAX) ! precipitation - REAL(kind_phys) GSNWIZ(IJSDIM, KMAX) ! snowfall - REAL(kind_phys) GTPRC0(IJSDIM) ! precip. before evap. - - REAL(kind_phys) GMFLX (IJSDIM, KMAX) ! mass flux (updraft+downdraft) - REAL(kind_phys) QLIQ (IJSDIM, KMAX) ! total cloud liquid - REAL(kind_phys) QICE (IJSDIM, KMAX) ! total cloud ice - REAL(kind_phys) GPRCI (IJSDIM, KMAX) ! rainfall generation - REAL(kind_phys) GSNWI (IJSDIM, KMAX) ! snowfall generation - - REAL(kind_phys) GPRCP (IJSDIM, KMAX) ! rainfall flux -! - REAL(kind_phys) GTEVP (IJSDIM, KMAX) ! evaporation+sublimation - REAL(kind_phys) GMDD (IJSDIM, KMAX) ! downdraft mass flux - -! REAL(kind_phys) CUMHGT(IJSDIM, NCTP) ! cloud top height -! REAL(kind_phys) CTOPP (IJSDIM) ! cloud top pressure - - REAL(kind_phys) GDZTR (IJSDIM) ! tropopause height -! REAL(kind_phys) FLIQOU(IJSDIM, KMAX) ! liquid ratio in cumulus - INTEGER KB (IJSDIM) - INTEGER KSTRT (IJSDIM) ! tropopause level - REAL(kind_phys) GAMX - REAL(kind_phys) CIN (IJSDIM) - INTEGER JBUOY (IJSDIM) - REAL(kind_phys) DELZ, BUOY, DELWC, DELER - REAL(kind_phys) WCBX (IJSDIM) -! REAL(kind_phys) ERMR (NCTP) ! entrainment rate (ASMODE) -! SAVE ERMR - INTEGER KTMX (NCTP) ! max of cloud top - INTEGER KTMXT ! max of cloud top -! REAL(kind_phys) TIMED - REAL(kind_phys) GDCLDX, GDMU2X, GDMU3X -! -! REAL(kind_phys) HBGT (IJSDIM) ! imbalance in column heat -! REAL(kind_phys) WBGT (IJSDIM) ! imbalance in column water + REAL(kind_phys) GTPRT ( IJSDIM, NCTP ) !! precipitation/M + REAL(kind_phys) GCLZ ( IJSDIM, KMAX ) !! cloud liquid for each CTP + REAL(kind_phys) GCIZ ( IJSDIM, KMAX ) !! cloud ice for each CTP + + REAL(kind_phys) ACWF ( IJSDIM ) !! cloud work function + REAL(kind_phys) GPRCIZ( IJSDIM, KMAX+1, NCTP ) !! precipitation + REAL(kind_phys) GSNWIZ( IJSDIM, KMAX+1, NCTP ) !! snowfall + REAL(kind_phys) GTPRC0( IJSDIM ) !! precip. before evap. + + REAL(kind_phys) GMFLX ( IJSDIM, KMAX+1 ) !! mass flux (updraft+downdraft) + REAL(kind_phys) QLIQ ( IJSDIM, KMAX ) !! total cloud liquid + REAL(kind_phys) QICE ( IJSDIM, KMAX ) !! total cloud ice + REAL(kind_phys) GPRCI ( IJSDIM, KMAX ) !! rainfall generation + REAL(kind_phys) GSNWI ( IJSDIM, KMAX ) !! snowfall generation + + REAL(kind_phys) GPRCP ( IJSDIM, KMAX+1 ) !! rainfall flux +! + REAL(kind_phys) GTEVP ( IJSDIM, KMAX ) !! evaporation+sublimation + REAL(kind_phys) GMDD ( IJSDIM, KMAX+1 ) !! downdraft mass flux + + REAL(kind_phys) CUMHGT( IJSDIM, NCTP ) !! cloud top height + REAL(kind_phys) CTOPP ( IJSDIM ) !! cloud top pressure + + REAL(kind_phys) GDZTR ( IJSDIM ) !! tropopause height + REAL(kind_phys) FLIQOU( IJSDIM, KMAX ) !! liquid ratio in cumulus +!#ifdef OPT_CHASER +! REAL(kind_phys) TOPFLX( IJSDIM, NCTP ) !! flux at each cloud top +!#endif + INTEGER KB ( IJSDIM ) + INTEGER KSTRT ( IJSDIM ) !! tropopause level + REAL(kind_phys) GAMX + REAL(kind_phys) CIN ( IJSDIM ) + INTEGER JBUOY ( IJSDIM ) + REAL(kind_phys) DELZ, BUOY, DELWC, DELER +!M REAL(kind_phys) WCB ( NCTP ) !! updraft velocity**2 @base +!M SAVE WCB + REAL(kind_phys) WCBX (IJSDIM) +! REAL(kind_phys) ERMR ( NCTP ) !! entrainment rate (ASMODE) +! SAVE ERMR + INTEGER KTMX ( NCTP ) !! max of cloud top + INTEGER KTMXT !! max of cloud top + REAL(kind_phys) TIMED + REAL(kind_phys) GDCLDX, GDMU2X, GDMU3X +! + LOGICAL OOUT1, OOUT2 + INTEGER KBMX, I, K, CTP, ierr, n, kp1, l, l1, kk, kbi, kmi, km1 + real(kind_phys) tem1, tem2, tem3, cbmfl, mflx_e, teme, tems + + REAL(kind_phys) HBGT ( IJSDIM ) !! imbalance in column heat + REAL(kind_phys) WBGT ( IJSDIM ) !! imbalance in column water -!DDsigma begin local work variables - all on model interfaces (sfc=1) - REAL(kind_phys) lamdai ! lamda for cloud type ctp - REAL(kind_phys) gdqm, gdlm, gdim ! water vapor + !DDsigma begin local work variables - all on model interfaces (sfc=1) + REAL(kind_phys) lamdai( IJSDIM, KMAX+1, nctp ) !! lamda for cloud type ctp + REAL(kind_phys) lamdaprod( IJSDIM, KMAX+1 ) !! product of (1+lamda) through cloud type ctp + REAL(kind_phys) gdrhom !! density + REAL(kind_phys) gdtvm !! virtual temperature + REAL(kind_phys) gdqm, gdwm,gdlm, gdim !! water vaper REAL(kind_phys) gdtrm(ntrq:ntr) ! tracer - -! the following are new arguments to cumup to get them out for AW - REAL(kind_phys) wcv (IJSDIM, KMAX) ! in-cloud vertical velocity - REAL(kind_phys) GCTM (IJSDIM, KMAX) ! cloud T (half lev) !DDsigmadiag make output - REAL(kind_phys) GCQM (IJSDIM, KMAX) ! cloud q (half lev) !DDsigmadiag make output - REAL(kind_phys) GCwM (IJSDIM, KMAX) ! cloud q (half lev) !DDsigmadiag make output - REAL(kind_phys) GCiM (IJSDIM, KMAX) ! cloud q (half lev) !DDsigmadiag make output - REAL(kind_phys) GClM (IJSDIM, KMAX) ! cloud q (half lev) !DDsigmadiag make output - REAL(kind_phys) GChM (IJSDIM, KMAX) ! cloud q (half lev) !DDsigmadiag make output - REAL(kind_phys) GCtrM (IJSDIM, KMAX, ntrq:ntr) ! cloud tracer (half lev) !DDsigmadiag make output - -! eddy flux profiles for dse, water vapor, cloud water, cloud ice - REAL(kind_phys), dimension(Kmax+1) :: sfluxtem, qvfluxtem, qlfluxtem, qifluxtem - REAL(kind_phys), dimension(Kmax+1,ntrq:ntr) :: trfluxtem ! tracer - -! tendency profiles - condensation heating, condensation moistening, heating due to -! freezing, total precip production, frozen precip production - REAL(kind_phys), dimension(ijsdim,Kmax) :: dtcondtem, dqcondtem, dtfrztem, dqprectem,& ! Moorthi - dfrzprectem, lamdaprod !< product of (1+lamda) through cloud type ctp - REAL(kind_phys), dimension(ijsdim,Kmax) :: dtevap, dqevap, dtmelt, dtsubl - -! factor to modify precip rate to force conservation of water. With bug fixes it's -! not doing anything now. - REAL(kind_phys), dimension(ijsdim) :: moistening_aw - real(kind_phys), dimension(ijsdim,kmax) :: gctbl, gcqbl,gcwbl, gcqlbl, gcqibl, & !DDsigmadiag updraft profiles below cloud Base - sigmad ! downdraft area fraction - real(kind_phys), dimension(ijsdim,kmax,ntrq:ntr) :: gctrbl !DDsigmadiag tracer updraft profiles below cloud Base -! rhs_q, rhs_h are residuals of condensed water, MSE budgets to compute condensation, -! and heating due to freezing - real(kind_phys) :: rhs_q, rhs_h, fsigma, sigmai, delpinv -! real(kind_phys) :: rhs_q, rhs_h, sftem, qftem, qlftem, qiftem, & -! fsigma ! factor to reduce mass flux terms (1-sigma**2) for AW + character(len=4) :: cproc !DDsigmadiag + + ! the following are new arguments to cumup to get them out + REAL(kind_phys) wcv( IJSDIM, KMAX+1, nctp) !! in-cloud vertical velocity + REAL(kind_phys) GCTM ( IJSDIM, KMAX+1 ) !! cloud T (half lev) !DDsigmadiag make output + REAL(kind_phys) GCQM ( IJSDIM, KMAX+1, nctp ) !! cloud q (half lev) !DDsigmadiag make output + REAL(kind_phys) GCwM ( IJSDIM, KMAX+1, nctp ) !! cloud q (half lev) !DDsigmadiag make output + REAL(kind_phys) GCiM ( IJSDIM, KMAX+1 ) !! cloud q (half lev) !DDsigmadiag make output + REAL(kind_phys) GClM ( IJSDIM, KMAX+1 ) !! cloud q (half lev) !DDsigmadiag make output + REAL(kind_phys) GChM ( IJSDIM, KMAX+1, nctp ) !! cloud q (half lev) !DDsigmadiag make output + REAL(kind_phys) GCtrM (IJSDIM, KMAX, ntrq:ntr) ! cloud tracer (half lev) !DDsigmadiag make output + +! these are the fluxes at the interfaces - AW will operate on them + REAL(kind_phys), dimension(ijsdim,Kmax+1,nctp) :: sfluxtem, qvfluxtem, qlfluxtem, qifluxtem + REAL(kind_phys), dimension(ijsdim,Kmax+1,ntrq:ntr,nctp) :: trfluxtem ! tracer + + REAL(kind_phys), dimension(ijsdim,Kmax+1) :: dtcondtem, dqcondtem, dtfrztem, dqprectem,dfrzprectem + REAL(kind_phys), dimension(ijsdim,Kmax) :: dtevap, dqevap, dtmelt, dtsubl + REAL(kind_phys), dimension(ijsdim) :: moistening_aw + real(kind_phys) rhs_q, rhs_h, sftem, qftem, qlftem, qiftem + real(kind_phys), dimension(ijsdim,kmax+1) :: gctbl, gcqbl,gcwbl, gcqlbl, gcqibl !DDsigmadiag updraft profiles below cloud Base + real(kind_phys), dimension(ijsdim,kmax,ntrq:ntr) :: gctrbl !DDsigmadiag tracer updraft profiles below cloud Base + real(kind_phys), dimension(ijsdim,kmax+1) :: sigmad + real(kind_phys) :: fsigma( IJSDIM, KMAX+1 ) ! factor to reduce mass flux terms (1-sigma**2) for AW + real(kind_phys) :: lamdamax ! for sorting lamda values + integer loclamdamax + real(kind_phys) :: pr_tot, pr_ice, pr_liq !DDsigma end local work variables ! -! profiles of heating due to precip evaporation, melting and sublimation, and the -! evap, melting and sublimation rates. +! [INTERNAL PARM] + REAL(kind_phys) :: WCBMIN = 0._kind_phys !! min. of updraft velocity at cloud base +!M REAL(kind_phys) :: WCBMAX = 1.4_kind_phys !! max. of updraft velocity at cloud base +!M wcbas commented by Moorthi since it is not used +!M REAL(kind_phys) :: WCBAS = 2._kind_phys !! updraft velocity**2 at cloud base (ASMODE) +!M REAL(kind_phys) :: ERAMIN = 1.e-5_kind_phys !! min. of entrainment rate + !! used only in OPT_ASMODE +!M REAL(kind_phys) :: ERAMAX = 2.e-3_kind_phys !! max. of entrainment rate + !! used only in OPT_ASMODE +! downdraft mass flux terms now slot nctp+1 in the *fluxterm arrays + REAL(kind_phys) dtdwn ( IJSDIM, KMAX ) !! t tendency downdraft detrainment + REAL(kind_phys) dqvdwn ( IJSDIM, KMAX ) !! qv tendency downdraft detrainment + REAL(kind_phys) dqldwn ( IJSDIM, KMAX ) !! ql tendency downdraft detrainment + REAL(kind_phys) dqidwn ( IJSDIM, KMAX ) !! qi tendency downdraft detrainment + REAL(kind_phys), dimension(ijsdim,kmax,ntrq:ntr) :: dtrdwn ! tracer tendency downdraft detrainment + + LOGICAL :: OINICB = .false. !! set 0.d0 to CBMFX + + REAL(kind_phys) :: VARMIN = 1.e-13_kind_phys !! minimum of PDF variance + REAL(kind_phys) :: VARMAX = 5.e-7_kind_phys !! maximum of PDF variance + REAL(kind_phys) :: SKWMAX = 0.566_kind_phys !! maximum of PDF skewness + + REAL(kind_phys) :: PSTRMX = 400.e2_kind_phys !! max P of tropopause + REAL(kind_phys) :: PSTRMN = 50.e2_kind_phys !! min P of tropopause + REAL(kind_phys) :: GCRSTR = 1.e-4_kind_phys !! crit. dT/dz tropopause - REAL(kind_phys), allocatable, dimension(:,:) :: dtdwn, & ! t tendency downdraft detrainment - dqvdwn, & ! qv tendency downdraft detrainment - dqldwn, & ! ql tendency downdraft detrainment - dqidwn ! qi tendency downdraft detrainment - REAL(kind_phys), allocatable, dimension(:,:,:) :: dtrdwn ! tracer tendency downdraft detrainment + ! 0: mass fixer is not applied + ! tracers which may become negative values + ! e.g. subgrid-PDFs + ! 1: mass fixer is applied, total mass may change through cumulus scheme + ! e.g. moisture, liquid cloud, ice cloud, aerosols + ! 2: mass fixer is applied, total mass never change through cumulus scheme + ! e.g. CO2 + real(kind=kind_phys), parameter :: zero=0.0, one=1.0 + real(kind=kind_phys) :: tem, esat +! + LOGICAL, SAVE :: OFIRST = .TRUE. !! called first time? +! +! [ONCE] + IF ( OFIRST ) THEN +!DD IF ( mrank == 0 ) & +!DD WRITE ( iulog,* ) ' @@@ CHIKIRA-SUGIYAMA CUMULUS SCHEME' -!DDsigma end local work variables + OFIRST = .FALSE. + +! if (.not. allocated(FSCAV)) ALLOCATE (FSCAV(NTR)) !DD made module scope and allocatable +! if (.not. allocated(FSWTR)) ALLOCATE (FSWTR(NTR)) !DD made module scope and allocatable +! fscav = 0._kind_phys +! fswtr = 0._kind_phys +! write(0,*)' NTR in cs_conv=',ntr,' mype=',mype +! do n=1,ntr +! FSCAV(n) = 0._kind_phys !DD split declaration and initialization +! FSWTR(n) = 0._kind_phys !DD split declaration and initialization +! enddo + + IF ( OINICB ) THEN +!DD IF ( mype == 0 ) WRITE ( iulog,*)' ### PCUMC: OINICB=T - DEFAULT USED: CBMFX', 0.D0 + CBMFX = 0.D0 + END IF ! -! [INTERNAL PARM] - REAL(kind_phys), parameter :: WCBMIN = zero ! min. of updraft velocity at cloud base +!DDdebug IF ( NCTP < 1 ) & +!DDdebug CALL endrun( 'CS_CUMLUS: NCTP must be positive.' ) -!M REAL(kind_phys) :: WCBMAX = 1.4_kind_phys ! max. of updraft velocity at cloud base -!M wcbas commented by Moorthi since it is not used -!M REAL(kind_phys) :: WCBAS = 2._kind_phys ! updraft velocity**2 at cloud base (ASMODE) -!M REAL(kind_phys) :: ERAMIN = 1.e-5_kind_phys ! min. of entrainment rate - ! used only in OPT_ASMODE -!M REAL(kind_phys) :: ERAMAX = 2.e-3_kind_phys ! max. of entrainment rate - ! used only in OPT_ASMODE - LOGICAL :: OINICB = .false. ! set 0.d0 to CBMFX when .true. +! DELWC = ( WCBMAX-WCBMIN ) / DBLE( NCTP ) +! DO CTP = 1, NCTP +! DELWC = ( WCBMAXm(i)-WCBMIN ) / DBLE( NCTP ) +! WCB ( CTP ) = ( CTP*DELWC )**2 +! END DO -! REAL(kind_phys) :: VARMIN = 1.e-13_kind_phys ! minimum of PDF variance -! REAL(kind_phys) :: VARMAX = 5.e-7_kind_phys ! maximum of PDF variance -! REAL(kind_phys) :: SKWMAX = 0.566_kind_phys ! maximum of PDF skewness +!DD#ifdef OPT_ASMODE +!DD IF ( NCTP >= 2 ) THEN +!DD IF ( ERAMIN <= 0._kind_phys ) & +!DD CALL endrun( 'CS_CUMLUS: ERAMIN must be positive.' ) +!DD DELER = LOG10( ERAMAX / ERAMIN ) / DBLE( NCTP-1 ) +!DD DO CTP = 1, NCTP +!DD ERMR( CTP ) = ERAMAX*( 10.D0**( -DELER*( CTP-1 ) ) ) +!DD END DO +!DD ELSE +!DD ERMR( 1 ) = ERAMIN +!DD END IF +!DD IF ( mrank == 0 ) & +!DD WRITE( iulog,* ) & +!DD ' ### PCUMC: ERMR =', ( ERMR( CTP ), CTP=1, NCTP ) +!DD#else - REAL(kind_phys) :: PSTRMX = 400.e2_kind_phys ! max P of tropopause - REAL(kind_phys) :: PSTRMN = 50.e2_kind_phys ! min P of tropopause - REAL(kind_phys) :: GCRSTR = 1.e-4_kind_phys ! crit. dT/dz tropopause +! ERMR = 0._kind_phys - real(kind=kind_phys) :: tem, esat, mflx_e, cbmfl, tem1, tem2, tem3 - INTEGER :: KBMX, I, K, CTP, ierr, n, kp1, km1, kk, kbi, l, l1 -! - LOGICAL, SAVE :: OFIRST = .TRUE. ! called first time? -! +!DD IF ( mype == 0 ) WRITE( iulog,* )' ### PCUMC: WCB =', ( WCB( CTP ), CTP=1, NCTP) +!DD#endif - IF (OFIRST) THEN - OFIRST = .FALSE. - IF (OINICB) THEN - CBMFX = zero - ENDIF - ENDIF + END IF ! + + kp1 = kmax + 1 do n=1,ntr do k=1,kmax do i=1,ijsdim @@ -821,77 +881,100 @@ SUBROUTINE CS_CUMLUS (im , IJSDIM, KMAX , NTR , & !DD dimensions enddo enddo enddo - + do k=1,kmax+1 + do i=1,ijsdim + gmflx(i,k) = zero + gmfx0(i,k) = zero + enddo + enddo do k=1,kmax do i=1,ijsdim - gtt(i,k) = zero - gtu(i,k) = zero - gtv(i,k) = zero - gmflx(i,k) = zero - gmfx0(i,k) = zero - gprci(i,k) = zero - gsnwi(i,k) = zero - qliq(i,k) = zero - qice(i,k) = zero -! gtcfrc(i,k) = zero -! cumclw(i,k) = zero -! fliqc(i,k) = zero - sigma(i,k) = zero + gtt(i,k) = zero + gtu(i,k) = zero + gtv(i,k) = zero + gprci(i,k) = zero + gsnwi(i,k) = zero + qliq(i,k) = zero + qice(i,k) = zero +! gtcfrc(i,k) = zero +! cumclw(i,k) = zero +! fliqc(i,k) = zero + fliqou(i,k) = zero + gprcpf(i,k) = zero + gsnwpf(i,k) = zero + cmdet(i,k) = zero enddo enddo if (flx_form) then - allocate(sfluxterm(ijsdim,kmax), qvfluxterm(ijsdim,kmax), qlfluxterm(ijsdim,kmax), & - qifluxterm(ijsdim,kmax), condtermt(ijsdim,kmax), condtermq(ijsdim,kmax), & - frzterm(ijsdim,kmax), prectermq(ijsdim,kmax), prectermfrz(ijsdim,kmax), & - dtdwn(ijsdim,kmax), dqvdwn(ijsdim,kmax), dqldwn(ijsdim,kmax), & - dqidwn(ijsdim,kmax), trfluxterm(ijsdim,kmax,ntrq:ntr), & - dtrdwn(ijsdim,kmax,ntrq:ntr)) - do k=1,kmax - do i=1,ijsdim - sfluxterm(i,k) = zero - qvfluxterm(i,k) = zero - qlfluxterm(i,k) = zero - qifluxterm(i,k) = zero - condtermt(i,k) = zero - condtermq(i,k) = zero - frzterm(i,k) = zero - prectermq(i,k) = zero - prectermfrz(i,k) = zero - dtdwn(i,k) = zero - dqvdwn(i,k) = zero - dqldwn(i,k) = zero - dqidwn(i,k) = zero - cmdet(i,k) = zero + do ctp = 1,nctp + do k=1,kp1 + do i=1,ijsdim + sfluxtem(i,k,ctp) = zero + qvfluxtem(i,k,ctp) = zero + qlfluxtem(i,k,ctp) = zero + qifluxtem(i,k,ctp) = zero + enddo + enddo + do n = ntrq,ntr + do k=1,kp1 + do i=1,ijsdim + trfluxtem(i,k,n,ctp) = zero + enddo + enddo enddo enddo - do n = ntrq,ntr do k=1,kmax do i=1,ijsdim - trfluxterm(i,k,n) = zero - dtrdwn(i,k,n) = zero + condtermt(i,k) = zero + condtermq(i,k) = zero + frzterm(i,k) = zero + prectermq(i,k) = zero + prectermfrz(i,k) = zero enddo enddo - enddo + do k=1,kmax + do i=1,ijsdim + dtdwn(i,k) = zero + dqvdwn(i,k) = zero + dqldwn(i,k) = zero + dqidwn(i,k) = zero + enddo + enddo + do n = ntrq,ntr + do k=1,kmax + do i=1,ijsdim + dtrdwn(i,k,n) = zero + enddo + enddo + enddo endif do i=1,ijsdim -! gprcc(i,:) = zero - gtprc0(i) = zero -! hbgt(i) = zero -! wbgt(i) = zero - gdztr(i) = zero - kstrt(i) = kmax +! gprcc(i,:) = zero +! gmflx(i,kp1) = zero + gmfx0(i,kp1) = zero + gtprc0(i) = zero +! hbgt(i) = zero +! wbgt(i) = zero + gdztr(i) = zero + kstrt(i) = kmax enddo +!#ifdef OPT_CHASER +! TOPFLX = 0.D0 +! LNFRC = 0.D0 +! REVC = 0.D0 +! LEVCUM = 0 +!#endif do k=1,kmax do i=1,ijsdim - GDW(i,k) = GDQ(i,k,1) + GDQ(i,k,ITL) + GDQ(i,k,iti) + GDW(i,k) = GDQ( i,k,1 ) + GDQ( i,k,ITL ) + GDQ( i,k,ITI ) enddo enddo -!> -# Compute layer saturate moisture \f$Q_i\f$(GDQS) and -!! saturate moist static energy (GDHS; see Appendix B in -!! Chikira and Sugiyama (2010) \cite Chikira_2010) - DO K=1,KMAX - DO I=ISTS,IENS +! + DO K = 1, KMAX + DO I = ISTS, IENS +! DELP ( I,K ) = GDPM( I,K ) - GDPM( I,K+1 ) +! delpinv(I,K) = grav / delp(I,K) esat = min(gdp(i,k), fpvs(gdt(i,k))) GDQS(I,K) = min(EPSV*esat/max(gdp(i,k)+epsvm1*esat, 1.0e-10), 0.1) tem = one / GDT(I,K) @@ -900,43 +983,39 @@ SUBROUTINE CS_CUMLUS (im , IJSDIM, KMAX , NTR , & !DD dimensions GDS (I,K) = CP*GDT(I,K) + GRAV*GDZ(I,K) ! layer dry static energy GDH (I,K) = GDS(I,K) + EL*GDQ(I,K,1) ! layer moist static energy GDHS(I,K) = GDS(I,K) + EL*GDQS(I,K) ! layer sat. moist static energy - ENDDO - ENDDO + END DO + END DO ! ! < tropopause > ! -!> -# Compute tropopause height (GDZTR) - DO K=1,KMAX - kp1 = k + 1 - DO I=ISTS,IENS - GAMX = (GDTM(I,KP1)-GDTM(I,K)) / (GDZM(I,KP1)-GDZM(I,K)) - IF ((GDP(I,K) < PSTRMX .AND. GAMX > GCRSTR) .OR. GDP(I,K) < PSTRMN) THEN - KSTRT(I) = MIN(K, KSTRT(I)) - ENDIF - ENDDO - ENDDO - DO I=ISTS,IENS - K = KSTRT(I) - GDZTR(I) = GDZM(I,K) - ENDDO -! -!DDsigma - arguments added to get subcloud profiles in updraft -! so AW eddy flux tendencies can be computed - -!> -# Call cumbas() to compute cloud base properties + DO K = 1, KMAX + DO I = ISTS, IENS + GAMX = ( GDTM( I,K+1 )-GDTM( I,K ) ) / ( GDZM( I,K+1 )-GDZM( I,K ) ) + IF ( (GDP(I,K) < PSTRMX .AND. GAMX > GCRSTR) .OR. GDP(I,K) < PSTRMN) THEN + KSTRT( I ) = MIN( K, KSTRT(I) ) + END IF + END DO + END DO + DO I = ISTS, IENS + K = KSTRT( I ) + GDZTR( I ) = GDZM( I,K ) + END DO +! +!! Cloud Base properties CALL CUMBAS(IJSDIM, KMAX , & !DD dimensions - KB , GCYM(1,1,1) , KBMX , & ! output + KB , GCYM(:,:,1) , KBMX , & ! output ntr , ntrq , & GCHB , GCWB , GCUB , GCVB , & ! output GCIB , gctrb, & ! output GDH , GDW , GDHS , GDQS , & ! input - GDQ(1,1,iti) , GDU , GDV , GDZM , & ! input + GDQ(:,:,iti) , GDU , GDV , GDZM , & ! input GDPM , FDQS , GAM , & ! input lprnt, ipr, & ISTS , IENS , & !) ! input gctbl, gcqbl,gdq,gcwbl, gcqlbl, gcqibl, gctrbl) ! sub cloud tendencies ! -!> -# Compute CAPE and CIN +! +! Compute CAPE and CIN ! DO I=ISTS,IENS CAPE(i) = zero @@ -951,11 +1030,11 @@ SUBROUTINE CS_CUMLUS (im , IJSDIM, KMAX , NTR , & !DD dimensions ELSE BUOY = (GDS(I,1)-GDS(I,K)) / (CP*GDT(I,K)) END IF - IF (BUOY > zero .AND. JBUOY(I) >= -1) THEN + IF (BUOY > zero .AND. JBUOY(I) >= -1) THEN CAPE(I) = CAPE(I) + BUOY * GRAV * (GDZM(I,K+1) - GDZM(I,K)) JBUOY(I) = 2 ELSEIF (BUOY < zero .AND. JBUOY(I) /= 2) THEN - CIN(I) = CIN(I) - BUOY * GRAV * (GDZM(I,K+1) - GDZM(I,K)) + CIN(I) = CIN(I) + BUOY * GRAV * (GDZM(I,K+1) - GDZM(I,K)) JBUOY(I) = -1 ENDIF endif @@ -967,12 +1046,24 @@ SUBROUTINE CS_CUMLUS (im , IJSDIM, KMAX , NTR , & !DD dimensions ENDDO !DDsigma some initialization before summing over cloud type -!> -# Initialize variables before summing over cloud types - do k=1,kmax ! Moorthi + if(flx_form) then + do k=1,kp1 ! Moorthi do i=1,ijsdim lamdaprod(i,k) = one + sigma(i,k) = 0.0 + enddo + enddo + + do ctp=1,nctp + do k=1,kp1 + do i=1,ijsdim + lamdai(i,k,ctp) = zero + sigmai(i,k,ctp) = zero + vverti(i,k,ctp) = zero + enddo enddo enddo + endif do ctp=2,nctp do k=1,kmax @@ -990,71 +1081,56 @@ SUBROUTINE CS_CUMLUS (im , IJSDIM, KMAX , NTR , & !DD dimensions WCBX(I) = DELWC * DELWC enddo - do k=1,kmax ! Moorthi - do i=1,ijsdim - dqcondtem(i,k) = zero - dqprectem(i,k) = zero - dfrzprectem(i,k) = zero - dtfrztem(i,k) = zero - dtcondtem(i,k) = zero - enddo - enddo ! getting more incloud profiles of variables to compute eddy flux tendencies ! and condensation rates +!! CUMUP computes In-cloud Properties -! DH* GNU crashes - check all arguments to CUMUP for their dimensions -! before and after CUMUP (i.e. here), and inside the routine, in -! particular: gctm, gcqm, gcwm, gchm, gcwt, gclm, gcim,gctrm -! also, inside, check that no reads/writes out of bounds occur *DH -!> -# Call cumup() to compute in-cloud properties CALL CUMUP(IJSDIM, KMAX, NTR, ntrq, & !DD dimensions ACWF , & ! output - GCLZ , GCIZ , GPRCIZ , GSNWIZ, & ! output - GCYT(1,CTP) , GCHT(1,CTP) , GCQT (1,CTP), & ! output - GCLT(1,CTP) , GCIT(1,CTP) , GTPRT(1,CTP), & ! output - GCUT(1,CTP) , GCVT(1,CTP) , gctrt(1,ntrq:ntr,ctp), & ! output - KT (1,CTP) , KTMX(CTP) , & ! output - GCYM(1,1,CTP) , & ! modified - wcv , & ! !DD-sigma new output + GCLZ , GCIZ , GPRCIZ(:,:,CTP), GSNWIZ(:,:,CTP), & ! output + GCYT(:,CTP) , GCHT(:,CTP) , GCQT (:,CTP), & ! output + GCLT(:,CTP) , GCIT(:,CTP) , GTPRT(:,CTP), & ! output + GCUT(:,CTP) , GCVT(:,CTP) , gctrt(:,ntrq:ntr,ctp), & ! output + KT (:,CTP) , KTMX(CTP) , & ! output + GCYM(:,:,CTP) , & ! modified + wcv(:,:,CTP) , & ! !DD-sigma new output GCHB , GCWB , GCUB , GCVB , & ! input !DDsigmadiag GCIB , gctrb , & ! input GDU , GDV , GDH , GDW , & ! input GDHS , GDQS , GDT , GDTM , & ! input - GDQ , GDQ(1,1,iti) , GDZ , GDZM , & ! input + GDQ , GDQ(:,:,iti) , GDZ , GDZM , & ! input GDPM , FDQS , GAM , GDZTR , & ! input CPRES , WCBX , & ! input KB , CTP , ISTS , IENS , & ! input - gctm , gcqm, gcwm, gchm, gcwt, gclm, gcim, gctrm, & ! additional incloud profiles and cloud top total water + gctm , gcqm(:,:,CTP), gcwm(:,:,CTP), gchm(:,:,CTP),& + gcwt, gclm, gcim, gctrm, & ! additional incloud profiles and cloud top total water lprnt , ipr ) ! -!> -# Call cumbmx() to compute cloud base mass flux +!! CUMBMX computes Cloud Base Mass Flux + CALL CUMBMX(IJSDIM, KMAX, & !DD dimensions - CBMFX(1,CTP), & ! modified - ACWF , GCYT(1,CTP), GDZM , & ! input + CBMFX(:,CTP), & ! modified + ACWF , GCYT(:,CTP), GDZM , & ! input GDW , GDQS , DELP , & ! input - KT (1,CTP), KTMX(CTP) , KB , & ! input + KT (:,CTP), KTMX(CTP) , KB , & ! input DELTI , ISTS , IENS ) !DDsigma - begin sigma computation ! At this point cbmfx is updated and we have everything we need to compute sigma - do i=ISTS,IENS - if (flx_form) then -!> -# Initialize eddy fluxes for cloud types - do k=1,kmax+1 - sfluxtem(k) = zero - qvfluxtem(k) = zero - qlfluxtem(k) = zero - qifluxtem(k) = zero - enddo - do n=ntrq,ntr ! tracers - do k=1,kmax+1 - trfluxtem(k,n) = zero - enddo + if (flx_form) then + do k=1,kmax + 1 ! Moorthi + do i=1,ijsdim + dqcondtem(i,k) = zero + dqprectem(i,k) = zero + dfrzprectem(i,k) = zero + dtfrztem(i,k) = zero + dtcondtem(i,k) = zero enddo - endif + enddo + do i=ISTS,IENS cbmfl = cbmfx(i,ctp) kk = kt(i,ctp) ! cloud top index @@ -1062,56 +1138,53 @@ SUBROUTINE CS_CUMLUS (im , IJSDIM, KMAX , NTR , & !DD dimensions kbi = kb(i) ! cloud base index do k=kbi,kk ! loop from cloud base to cloud top km1 = k - 1 - rhs_h = zero - rhs_q = zero -!> -# Interpolate environment variables to layer interface +! get environment variables interpolated to layer interface GDQM = half * (GDQ(I,K,1) + GDQ(I,KM1,1)) ! as computed in cumup ! GDwM = half * (GDw(I,K) + GDw(I,KM1 )) - GDlM = half * (GDQ(I,K,3) + GDQ(I,KM1,3)) - GDiM = half * (GDQ(I,K,2) + GDQ(I,KM1,2)) + GDlM = half * (GDQ(I,K,itl) + GDQ(I,KM1,itl)) + GDiM = half * (GDQ(I,K,iti) + GDQ(I,KM1,iti)) do n = ntrq,NTR GDtrM(n) = half * (GDQ(I,K,n) + GDQ(I,KM1,n)) ! as computed in cumup enddo mflx_e = gcym(i,k,ctp) * cbmfl ! mass flux at level k for cloud ctp - if (do_aw) then - -!> -# Compute lamda for a cloud type and then updraft area fraction -!! (sigmai) following Equations 23 and 12 of -!! Arakawa and Wu (2013) \cite arakawa_and_wu_2013 , respectively - - lamdai = mflx_e * rair * gdtm(i,k)*(one+epsvt*gdqm) & - / (gdpm(i,k)*wcv(i,k)) - lamdaprod(i,k) = lamdaprod(i,k) * (one+lamdai) -! vverti(i,k,ctp) = wcv(i,k) -! sigmai(i,k,ctp) = lamdai / lamdaprod(i,k) -! sigma(i,k) = max(zero, min(one, sigma(i,k) + sigmai(i,k,ctp))) +! this is the computation of lamda for a cloud type, and then updraft area fraction +! (sigmai for a single cloud type) - sigmai = lamdai / lamdaprod(i,k) - sigma(i,k) = max(zero, min(one, sigma(i,k) + sigmai)) - vverti(i,k,ctp) = sigmai * wcv(i,k) - else - sigma(i,k) = 0.0 - endif + lamdai(i,k,ctp) = mflx_e * rair * gdtm(i,k)*(one+epsvt*gdqm) & + / (gdpm(i,k)*wcv(i,k,ctp)) + +! just compute lamdai here, we will compute sigma, sigmai, and vverti outside +! the cloud type loop after we can sort lamdai +! lamdaprod(i,k) = lamdaprod(i,k) * (one+lamdai(i,k,ctp)) +! +!! vverti(i,k,ctp) = wcv(i,k) +!! sigmai(i,k,ctp) = lamdai / lamdaprod(i,k) +!! sigma(i,k) = max(zero, min(one, sigma(i,k) + sigmai(i,k,ctp))) +! +! sigmai(i,k,ctp) = lamdai(i,k,ctp) / lamdaprod(i,k) +! sigma(i,k) = max(zero, min(one, sigma(i,k) + sigmai(i,k,ctp))) +! vverti(i,k,ctp) = sigmai(i,k,ctp) * wcv(i,k,ctp) - if (flx_form) then +! sigma effect won't be applied until later, when lamda is sorted ! fsigma = 1.0 ! no aw effect, comment following lines to undo AW - fsigma = one - sigma(i,k) +! fsigma = one - sigma(i,k) -!> -# Compute tendencies based on mass flux and condensation +! compute tendencies based on mass flux, and tendencies based on condensation ! fsigma is the AW reduction of flux tendencies if(k == kbi) then do l=2,kbi ! compute eddy fluxes below cloud base - tem = - fsigma * gcym(i,l,ctp) * cbmfl +! tem = - fsigma * gcym(i,l,ctp) * cbmfl + tem = - gcym(i,l,ctp) * cbmfl ! first get environment variables at layer interface l1 = l - 1 GDQM = half * (GDQ(I,l,1) + GDQ(I,l1,1)) - GDlM = half * (GDQ(I,l,3) + GDQ(I,l1,3)) - GDiM = half * (GDQ(I,l,2) + GDQ(I,l1,2)) + GDlM = half * (GDQ(I,l,itl) + GDQ(I,l1,itl)) + GDiM = half * (GDQ(I,l,iti) + GDQ(I,l1,iti)) !! GDwM = half * (GDw(I,l) + GDw(I,l1)) do n = ntrq,NTR GDtrM(n) = half * (GDQ(I,l,n) + GDQ(I,l1,n)) ! as computed in cumup @@ -1119,12 +1192,12 @@ SUBROUTINE CS_CUMLUS (im , IJSDIM, KMAX , NTR , & !DD dimensions ! flux = mass flux * (updraft variable minus environment variable) !centered differences - sfluxtem(l) = tem * (gdtm(i,l)-gctbl(i,l)) - qvfluxtem(l) = tem * (gdqm-gcqbl(i,l)) - qlfluxtem(l) = tem * (gdlm-gcqlbl(i,l)) - qifluxtem(l) = tem * (gdim-gcqibl(i,l)) + sfluxtem(i,l,ctp) = tem * (gdtm(i,l)-gctbl(i,l)) + qvfluxtem(i,l,ctp) = tem * (gdqm-gcqbl(i,l)) + qlfluxtem(i,l,ctp) = tem * (gdlm-gcqlbl(i,l)) + qifluxtem(i,l,ctp) = tem * (gdim-gcqibl(i,l)) do n = ntrq,NTR - trfluxtem(l,n) = tem * (gdtrm(n)-gctrbl(i,l,n)) + trfluxtem(i,l,n,ctp) = tem * (gdtrm(n)-gctrbl(i,l,n)) enddo ! if(lprnt .and. i == ipr) write(0,*)' l=',l,' kbi=',kbi,' tem =', tem,' trfluxtem=',trfluxtem(l,ntr),& ! ' gdtrm=',gdtrm(ntr),' gctrbl=',gctrbl(i,l,ntr),' gq=',GDQ(I,l,ntr),GDQ(I,l1,ntr),' l1=',l1,' ctp=',ctp,& @@ -1146,14 +1219,15 @@ SUBROUTINE CS_CUMLUS (im , IJSDIM, KMAX , NTR , & !DD dimensions else ! flux = mass flux * (updraft variable minus environment variable) - tem = - fsigma * mflx_e +! tem = - fsigma * mflx_e + tem = - mflx_e !centered - sfluxtem(k) = tem * (gdtm(i,k)+gocp*gdzm(i,k)-gctm(i,k)) - qvfluxtem(k) = tem * (gdqm-gcqm(i,k)) - qlfluxtem(k) = tem * (gdlm-gclm(i,k)) - qifluxtem(k) = tem * (gdim-gcim(i,k)) + sfluxtem(i,k,ctp) = tem * (gdtm(i,k)+gocp*gdzm(i,k)-gctm(i,k)) + qvfluxtem(i,k,ctp) = tem * (gdqm-gcqm(i,k,ctp)) + qlfluxtem(i,k,ctp) = tem * (gdlm-gclm(i,k)) + qifluxtem(i,k,ctp) = tem * (gdim-gcim(i,k)) do n = ntrq,NTR - trfluxtem(k,n) = tem * (gdtrm(n)-gctrm(i,k,n)) + trfluxtem(i,k,n,ctp) = tem * (gdtrm(n)-gctrm(i,k,n)) enddo !upstream - This better matches what the original CS tendencies do @@ -1185,216 +1259,242 @@ SUBROUTINE CS_CUMLUS (im , IJSDIM, KMAX , NTR , & !DD dimensions ! ' fsigma=',fsigma,' mflx_e=',mflx_e,' trfluxtemk=',trfluxtem(k,ntr),' sigma=',sigma(i,k) -! the condensation terms - these come from the MSE and condensed water budgets for -! an entraining updraft -! if(k > kb(i)) then ! comment for test -! if(k <= kk) then ! Moorthi -! if(k < kt(i,ctp)) then -! rhs_h = cbmfl*(gcym(i,k)*gchm(i,k) - (gcym(i,km1)*gchm(i,km1) & -! + GDH(I,Km1 )*(gcym(i,k)-gcym(i,km1))) ) -! rhs_q = cbmfl*(gcym(i,k)*(gcwm(i,k)-gcqm(i,k)) & -! - (gcym(i,km1)*(gcwm(i,km1)-gcqm(i,km1)) & -! + (GDw( I,Km1 )-gdq(i,km1,1))*(gcym(i,k)-gcym(i,km1))) ) -! tem = cbmfl * (one - sigma(i,k)) - tem = cbmfl * (one - 0.5*(sigma(i,k)+sigma(i,km1))) - tem1 = gcym(i,k,ctp) * (one - sigma(i,k)) - tem2 = gcym(i,km1,ctp) * (one - sigma(i,km1)) - rhs_h = cbmfl * (tem1*gchm(i,k) - (tem2*gchm(i,km1) & - + GDH(I,Km1)*(tem1-tem2)) ) - rhs_q = cbmfl * (tem1*(gcwm(i,k)-gcqm(i,k)) & - - (tem2*(gcwm(i,km1)-gcqm(i,km1)) & - + (GDw(I,Km1)-gdq(i,km1,1))*(tem1-tem2)) ) - -! ELSE -! rhs_h = cbmfl*(gcht(i,ctp) - (gcym(i,k-1)*gchm(i,k-1) + GDH( I,K-1 )*(gcyt(i,ctp)-gcym(i,k-1))) ) -! rhs_q = cbmfl*((gcwt(i)-gcqt(i,ctp)) - (gcym(i,k-1)*(gcwm(i,k-1)-gcqm(i,k-1)) + (GDw( I,K-1 )-gdq(i,k-1,1))*(gcyt(i,ctp)-gcym(i,k-1))) ) -! endif - -!> -# Compute condensation, total precipitation production, frozen precipitation production, -!! heating due to freezing, and total temperature tendency due to in-cloud microphysics - dqcondtem(i,km1) = -rhs_q ! condensation -! dqprectem(i,km1) = cbmfl * (GPRCIZ(i,k) + GSNWIZ(i,k)) - dqprectem(i,km1) = tem * (GPRCIZ(i,k) + GSNWIZ(i,k)) ! total precip production -! dfrzprectem(i,km1) = cbmfl * GSNWIZ(i,k) - dfrzprectem(i,km1) = tem * GSNWIZ(i,k) ! production of frozen precip - dtfrztem(i,km1) = rhs_h*oneocp ! heating due to freezing - dtcondtem(i,km1) = - elocp * dqcondtem(i,km1) + dtfrztem(i,km1) - endif ! if(k > kbi) then - endif ! if (flx_form) enddo ! end of k=kbi,kk loop endif ! end of if(cbmfl > zero) -! get tendencies by difference of fluxes, sum over cloud type - - if (flx_form) then - do k = 1,kk - delpinv = delpi(i,k) -!> -# Sum single cloud microphysical tendencies over all cloud types - condtermt(i,k) = condtermt(i,k) + dtcondtem(i,k) * delpinv - condtermq(i,k) = condtermq(i,k) + dqcondtem(i,k) * delpinv - prectermq(i,k) = prectermq(i,k) + dqprectem(i,k) * delpinv - prectermfrz(i,k) = prectermfrz(i,k) + dfrzprectem(i,k) * delpinv - frzterm(i,k) = frzterm(i,k) + dtfrztem(i,k) * delpinv - -!> -# Compute flux tendencies and vertical flux divergence - sfluxterm(i,k) = sfluxterm(i,k) - (sfluxtem(k+1) - sfluxtem(k)) * delpinv - qvfluxterm(i,k) = qvfluxterm(i,k) - (qvfluxtem(k+1) - qvfluxtem(k)) * delpinv - qlfluxterm(i,k) = qlfluxterm(i,k) - (qlfluxtem(k+1) - qlfluxtem(k)) * delpinv - qifluxterm(i,k) = qifluxterm(i,k) - (qifluxtem(k+1) - qifluxtem(k)) * delpinv - do n = ntrq,ntr - trfluxterm(i,k,n) = trfluxterm(i,k,n) - (trfluxtem(k+1,n) - trfluxtem(k,n)) * delpinv - enddo -! if (lprnt .and. i == ipr) write(0,*)' k=',k,' trfluxtem=',trfluxtem(k+1,ntr),trfluxtem(k,ntr),& -! ' ctp=',ctp,' trfluxterm=',trfluxterm(i,k,ntr) - enddo - endif ! if (flx_form) enddo ! end of i loop -! - do i=ists,iens - if (cbmfx(i,ctp) > zero) then - tem = one - sigma(i,kt(i,ctp)) - gcyt(i,ctp) = tem * gcyt(i,ctp) - gtprt(i,ctp) = tem * gtprt(i,ctp) - gclt(i,ctp) = tem * gclt(i,ctp) - gcht(i,ctp) = tem * gcht(i,ctp) - gcqt(i,ctp) = tem * gcqt(i,ctp) - gcit(i,ctp) = tem * gcit(i,ctp) - if (.not. flx_form) then - do n = ntrq,ntr - gctrt(i,n,ctp) = tem * gctrt(i,n,ctp) - enddo - end if - gcut(i,ctp) = tem * gcut(i,ctp) - gcvt(i,ctp) = tem * gcvt(i,ctp) - do k=1,kmax - kk = kb(i) - if (k < kk) then - tem = one - sigma(i,kk) - tem1 = tem - else - tem = one - sigma(i,k) - tem1 = one - 0.5*(sigma(i,k)+sigma(i,k-1)) - endif - gcym(i,k,ctp) = tem * gcym(i,k,ctp) - gprciz(i,k) = tem1 * gprciz(i,k) - gsnwiz(i,k) = tem1 * gsnwiz(i,k) - gclz(i,k) = tem1 * gclz(i,k) - gciz(i,k) = tem1 * gciz(i,k) - enddo - endif - enddo + endif ! if (flx_form) +! +! we don't reduce these values in AW, just the tendencies due to fluxes +! do i=ists,iens +! if (cbmfx(i,ctp) > zero) then +! tem = one - sigma(i,kt(i,ctp)) +! gcyt(i,ctp) = tem * gcyt(i,ctp) +! gtprt(i,ctp) = tem * gtprt(i,ctp) +! gclt(i,ctp) = tem * gclt(i,ctp) +! gcht(i,ctp) = tem * gcht(i,ctp) +! gcqt(i,ctp) = tem * gcqt(i,ctp) +! gcit(i,ctp) = tem * gcit(i,ctp) +! do n = ntrq,ntr +! gctrt(i,n,ctp) = tem * gctrt(i,n,ctp) +! enddo +! gcut(i,ctp) = tem * gcut(i,ctp) +! gcvt(i,ctp) = tem * gcvt(i,ctp) +! do k=1,kmax +! kk = kb(i) +! if (k < kk) then +! tem = one - sigma(i,kk) +! tem1 = tem +! else +! tem = one - sigma(i,k) +! tem1 = one - 0.5*(sigma(i,k)+sigma(i,k-1)) +! endif +! gcym(i,k,ctp) = tem * gcym(i,k,ctp) +! gprciz(i,k) = tem1 * gprciz(i,k) +! gsnwiz(i,k) = tem1 * gsnwiz(i,k) +! gclz(i,k) = tem1 * gclz(i,k) +! gciz(i,k) = tem1 * gciz(i,k) +! enddo +! endif +! enddo ! -!> -# Call cumflx() to compute cloud mass flux and precipitation +! Cloud Mass Flux & Precip. CALL CUMFLX(IM , IJSDIM, KMAX , & !DD dimensions GMFX0 , GPRCI , GSNWI , CMDET, & ! output QLIQ , QICE , GTPRC0, & ! output - CBMFX(1,CTP) , GCYM(1,1,ctp), GPRCIZ , GSNWIZ , & ! input - GTPRT(1,CTP) , GCLZ , GCIZ , GCYT(1,ctp),& ! input - KB , KT(1,CTP) , KTMX(CTP) , & ! input + CBMFX(:,CTP) , GCYM(:,:,ctp), GPRCIZ(:,:,CTP), GSNWIZ(:,:,CTP) , & ! input + GTPRT(:,CTP) , GCLZ , GCIZ , GCYT(:,ctp),& ! input + KB , KT(:,CTP) , KTMX(CTP) , & ! input ISTS , IENS ) ! input ENDDO ! end of cloud type ctp loop -!> -# Compute net updraft mass flux for all clouds + +! do k=1,kmax do i=ists,iens - GMFLX(I,k) = GMFX0(I,k) ! contains net updraft mass flux for all clouds + GMFLX( I,k ) = GMFX0( I,k ) enddo enddo KTMXT = 3 - DO CTP=1,NCTP - IF (KTMX(CTP) > KTMXT) KTMXT = KTMX(CTP) - ENDDO - -! DO K=1,KTMXT -! DO I=ISTS,IENS -! CUMCLW(I,K) = QLIQ(I,K) + QICE(I,K) -! IF (CUMCLW(I,K) > zero) THEN -! FLIQC(I,K) = QLIQ(I,K) / CUMCLW(I,K) -! ENDIF -! ENDDO -! ENDDO -! -! Cumulus Cloudiness -! CALL CUMCLD(IJSDIM, KMAX , & !DD dimensions -! CUMCLW, QLIQ , QICE , FLIQC , & ! modified -! CUMFRC, & ! output -! GMFLX , KTMXT , ISTS , IENS ) ! input -! -! - Call cumdet() to compute cloud detrainment heating. + DO CTP = 1, NCTP + IF ( KTMX( CTP ) > KTMXT ) KTMXT = KTMX( CTP ) + END DO +! DO K = 1, KTMXT +! DO I = ISTS, IENS +! CUMCLW( I,K ) = QLIQ( I,K ) + QICE( I,K ) +! IF ( CUMCLW( I,K ) > zero ) THEN +! FLIQC( I,K ) = QLIQ( I,K ) / CUMCLW( I,K ) +! FLIQOU( I,K ) = FLIQC( I,K ) +! END IF +! END DO +! END DO +! +! CALL CUMCLD & !! Cumulus Cloudiness +! ( IJSDIM, KMAX , & !DD dimensions +! CUMCLW, QLIQ , QICE , FLIQC , & ! modified +! CUMFRC, & ! output +! GMFLX , KTMXT , ISTS , IENS ) ! input +! +! Cloud Detrainment Heating if (.not. flx_form) then CALL CUMDET(im , IJSDIM, KMAX , NTR , ntrq , & !DD dimensions GTT , GTQ , GTU , GTV , & ! modified GDH , GDQ , GDU , GDV , & ! input ! GTT , GTQ , GTCFRC, GTU , GTV , & ! modified ! GDH , GDQ , GDCFRC, GDU , GDV , & ! input - CBMFX , GCYT , DELPI , GCHT , GCQT , & ! input - GCLT , GCIT , GCUT , GCVT , GDQ(1,1,iti),& ! input + CBMFX , GCYT , DELPInv , GCHT , GCQT , & ! input + GCLT , GCIT , GCUT , GCVT , GDQ(:,:,iti),& ! input gctrt , & KT , ISTS , IENS, nctp ) ! input endif + !for now area fraction of the downdraft is zero, it will be computed -! within cumdwn and applied there -! Get AW downdraft eddy flux and microphysical tendencies out of downdraft code. +! within cumdwn and applied there. So we will get the total sigma now before calling it, +! and apply to the diabatic terms from the updrafts. - do k=1,kmax - do i=ists,iens - sigmad(i,k) = zero - enddo - enddo +! if (do_aw.and.flx_form) then + if (flx_form) then + do k=1,kp1 + do i=ists,iens + lamdamax = maxval(lamdai(i,k,:)) + do while (lamdamax > zero) + loclamdamax = maxloc(lamdai(i,k,:),dim=1) + lamdaprod(i,k) = lamdaprod(i,k) * (one+lamdai(i,k,loclamdamax)) + sigmai(i,k,loclamdamax) = lamdai(i,k,loclamdamax) / lamdaprod(i,k) + sigma(i,k) = max(zero, min(one, sigma(i,k) + sigmai(i,k,loclamdamax))) + vverti(i,k,loclamdamax) = sigmai(i,k,loclamdamax) * wcv(i,k,loclamdamax) + + ! make this lamdai negative so it won't be counted again + lamdai(i,k,loclamdamax) = -lamdai(i,k,loclamdamax) + ! get new lamdamax + lamdamax = maxval(lamdai(i,k,:)) + enddo + ! restore original values of lamdai + lamdai(i,k,:) = abs(lamdai(i,k,:)) +! write(6,'(i2,14f7.4)') k,sigmai(i,k,:) + enddo + enddo + endif + +! the condensation terms - these come from the MSE and condensed water budgets for +! an entraining updraft + if(flx_form) then + DO CTP=1,NCTP ! loop over cloud types + dtcondtem(:,:) = zero + dqcondtem(:,:) = zero + dqprectem(:,:) = zero + dfrzprectem(:,:) = zero + dtfrztem(:,:) = zero + do i=ISTS,IENS + cbmfl = cbmfx(i,ctp) + kk = kt(i,ctp) ! cloud top index + if(cbmfl > zero) then ! this should avoid zero wcv in the denominator + kbi = kb(i) ! cloud base index + do k=kbi,kk ! loop from cloud base to cloud top + km1 = k - 1 + rhs_h = zero + rhs_q = zero + if(k > kbi) then +! tem = cbmfl * (one - sigma(i,k)) + tem = cbmfl * (one - 0.5*(sigma(i,k)+sigma(i,km1))) + tem1 = gcym(i,k,ctp) * (one - sigma(i,k)) + tem2 = gcym(i,km1,ctp) * (one - sigma(i,km1)) + rhs_h = cbmfl * (tem1*gchm(i,k,ctp) - (tem2*gchm(i,km1,ctp) & + + GDH(I,Km1)*(tem1-tem2)) ) + rhs_q = cbmfl * (tem1*(gcwm(i,k,ctp)-gcqm(i,k,ctp)) & + - (tem2*(gcwm(i,km1,ctp)-gcqm(i,km1,ctp)) & + + (GDw(I,Km1)-gdq(i,km1,1))*(tem1-tem2)) ) +! + dqcondtem(i,km1) = -rhs_q ! condensation + dqprectem(i,km1) = tem * (GPRCIZ(i,k,ctp) + GSNWIZ(i,k,ctp)) ! total precip production + dfrzprectem(i,km1) = tem * GSNWIZ(i,k,ctp) ! production of frozen precip + dtfrztem(i,km1) = rhs_h*oneocp ! heating due to freezing +! total temperature tendency due to in cloud microphysics + dtcondtem(i,km1) = - elocp * dqcondtem(i,km1) + dtfrztem(i,km1) + + endif ! if(k > kbi) then + enddo ! end of k=kbi,kk loop + + endif ! end of if(cbmfl > zero) + + +! get tendencies by difference of fluxes, sum over cloud type + + do k = 1,kk +! sum single cloud microphysical tendencies over all cloud types + condtermt(i,k) = condtermt(i,k) + dtcondtem(i,k) * delpinv(i,k) + condtermq(i,k) = condtermq(i,k) + dqcondtem(i,k) * delpinv(i,k) + prectermq(i,k) = prectermq(i,k) + dqprectem(i,k) * delpinv(i,k) + prectermfrz(i,k) = prectermfrz(i,k) + dfrzprectem(i,k) * delpinv(i,k) + frzterm(i,k) = frzterm(i,k) + dtfrztem(i,k) * delpinv(i,k) + +! if (lprnt .and. i == ipr) write(0,*)' k=',k,' trfluxtem=',trfluxtem(k+1,ntr),trfluxtem(k,ntr),& +! ' ctp=',ctp,' trfluxterm=',trfluxterm(i,k,ntr) + enddo + + enddo ! end of i loop + enddo ! end of nctp loop + endif +!downdraft sigma and mass-flux tendency terms are now put into +! the nctp+1 slot of the cloud-type dimensiond variables -!> -# Call cumdwn() to compute cumulus downdraft and assocated melt, freeze -!! and evaporation - CALL CUMDWN(IM , IJSDIM, KMAX , NTR , ntrq , & ! DD dimensions + do k=1,kmax + do i=ists,iens + sigmad(i,k) = zero + enddo + enddo + +! cumulus downdraft - Melt & Freeze & Evaporation + CALL CUMDWN(IM, IJSDIM, KMAX, NTR, ntrq, nctp, & ! DD dimensions GTT , GTQ , GTU , GTV , & ! modified GMFLX , & ! modified updraft+downdraft flux GPRCP , GSNWP , GTEVP , GMDD , & ! output GPRCI , GSNWI , & ! input - GDH , GDW , GDQ , GDQ(1,1,iti) , & ! input + GDH , GDW , GDQ , GDQ(:,:,iti) , & ! input GDQS , GDS , GDHS , GDT , & ! input GDU , GDV , GDZ , & ! input - GDZM , FDQS , DELP , DELPI , & ! input + GDZM , FDQS , DELP , DELPInv , & ! input sigmad, do_aw , do_awdd, flx_form, & ! DDsigma input dtmelt, dtevap, dtsubl, & ! DDsigma input dtdwn , dqvdwn, dqldwn, dqidwn, & ! DDsigma input dtrdwn, & +! sfluxtem(:,:,nctp+1) , qvfluxtem(:,:,nctp+1), & !interface flux, not tendency +! qlfluxtem(:,:,nctp+1), qifluxtem(:,:,nctp+1), & ! +! trfluxtem(:,:,ntrq,nctp+1), & KB , KTMXT , ISTS , IENS ) ! input -! here we substitute the AW tendencies into tendencies to be passed out -! if (do_aw) then -! do k=1,kmax -! do i=ists,iens -! sigma(i,k) = sigma(i,k) + sigmad(i,k) -! enddo -! enddo -!> -# Call cumsbw() to compute cloud subsidence heating +! sigma = sigma + sigmad + + if (.not. flx_form) then ! Cloud Subsidence Heating ! -----------------------= CALL CUMSBH(IM , IJSDIM, KMAX , NTR , ntrq , & !DD dimensions GTT , GTQ , & ! modified GTU , GTV , & ! modified - GDH , GDQ , GDQ(1,1,iti) , & ! input + GDH , GDQ , GDQ(:,:,iti) , & ! input GDU , GDV , & ! input - DELPI , GMFLX , GMFX0 , & ! input + DELPINV , GMFLX , GMFX0 , & ! input KTMXT , CPRES , kb, ISTS , IENS ) ! input else CALL CUMSBW(IM , IJSDIM, KMAX , & !DD dimensions GTU , GTV , & ! modified GDU , GDV , & ! input - DELPI , GMFLX , GMFX0 , & ! input + DELPINV , GMFLX , GMFX0 , & ! input KTMXT , CPRES , kb, ISTS , IENS ) ! input endif + ! -! for now the following routines appear to be of no consequence to AW - DD +! for now the following routines appear to be of no consequence - DD ! if (.not. flx_form) then ! Tracer Updraft properties @@ -1411,27 +1511,27 @@ SUBROUTINE CS_CUMLUS (im , IJSDIM, KMAX , NTR , & !DD dimensions GCYM , GCYT , GCQT , GCLT , GCIT , & ! input GTPRT , GTEVP , GTPRC0, & ! input KB , KBMX , KT , KTMX , KTMXT , & ! input - DELPI , OTSPT1, ISTS , IENS, & ! input + DELPInv , OTSPT1, ISTS , IENS, & ! input fscav , fswtr, nctp) ! ! Tracer Change due to Downdraft ! --------------- CALL CUMDNR(im ,IJSDIM , KMAX , NTR , & !DD dimensions GTQ , & ! modified - GDQ , GMDD , DELPI , & ! input + GDQ , GMDD , DELPInv , & ! input KTMXT , OTSPT1, ISTS , IENS ) ! input !! !! Tracer change due to Subsidence !! --------------- !! This will be done by cumsbh, now DD 20170907 -! CALL CUMSBR(im , IJSDIM, KMAX , NTR , & !DD dimensions +! CALL CUMSBR(im , IJSDIM, KMAX , NTR ,NCTP, & !DD dimensions ! GTQ , & ! modified ! GDQ , DELPI , & ! input ! GMFLX , KTMXT , OTSPT2, & ! input ! ISTS , IENS ) ! input endif - +!! ! if this tracer not advected zero it out DO n = ntrq,NTR if (.not. OTSPT2(n)) then @@ -1442,11 +1542,64 @@ SUBROUTINE CS_CUMLUS (im , IJSDIM, KMAX , NTR , & !DD dimensions ENDDO endif ENDDO - -! if(do_aw .and. flx_form) then ! compute AW tendencies -!> -# Compute AW tendencies of T, ql and qi + + if(flx_form) then ! compute AW tendencies ! AW lump all heating together, compute qv term + +! sigma interpolated to the layer for condensation, etc. terms, precipitation + if(do_aw) then + do k=1,kmax + kp1 = k+1 + do i=1,ijsdim + fsigma(i,k) = one - half*(sigma(i,k)+sigma(i,kp1)) + enddo + enddo + else + do k=1,kmax+1 + do i=1,ijsdim + fsigma(i,k) = one + enddo + enddo + endif + +! AW adjustment of precip fluxes from downdraft model + if(do_aw) then + kp1 = kmax+1 + DO I=ISTS,IENS + GSNWP( I,kp1 ) = zero + GPRCP( I,kp1 ) = zero + ENDDO + tem1 = cpoemelt/grav + tem2 = cpoel/grav + tem3 = cpoesub/grav + DO K=KMAX,1,-1 + kp1 = k+1 + DO I=ISTS,IENS + tem = -dtmelt(i,k) * delp(i,k) * tem1 + teme = -dtevap(i,k) * delp(i,k) * tem2 + tems = -dtsubl(i,k) * delp(i,k) * tem3 + GSNWP(I,k) = GSNWP(I,kp1) + fsigma(i,k) * (GSNWI(i,k) - tem - tems) + GPRCP(I,k) = GPRCP(I,kp1) + fsigma(i,k) * (GPRCI(i,k) + tem - teme) + ENDDO + ENDDO + endif + + +! some of the above routines have set the tendencies and they need to be +! reinitialized, gtt not needed, but gtq needed Anning 5/25/2020 + do n=1,ntr + do k=1,kmax + do i=1,ijsdim + gtq(i,k,n) = zero + enddo + enddo + enddo +! do k=1,kmax +! do i=1,ijsdim +! gtt(i,k) = zero +! enddo +! enddo do k=1,kmax do i=ists,iens dqevap(i,k) = - dtevap(i,k)*cpoel - dtsubl(i,k)*cpoesub @@ -1454,25 +1607,70 @@ SUBROUTINE CS_CUMLUS (im , IJSDIM, KMAX , NTR , & !DD dimensions dtsubl(i,k) = zero enddo enddo - do i=1,ijsdim - moistening_aw(i) = zero - enddo - tem2 = one / delta + + +! diabatic terms from updraft and downdraft models DO K=1,KMAX DO I=ISTS,IENS tem = frzterm(i,k)*cpoEMELT - prectermfrz(i,k) - gtt(i,k) = dtdwn(i,k) + sfluxterm(i,k) + condtermt(i,k) & - + dtmelt(i,k) + dtevap(i,k) - gtq(i,k,1) = dqvdwn(i,k) + qvfluxterm(i,k) + condtermq(i,k) & - + dqevap(i,k) - gtq(i,k,itl) = dqldwn(i,k) + qlfluxterm(i,k) - condtermq(i,k) & +! gtt(i,k) = gtt(i,k) + fsigma(i,k)*(dtmelt(i,k) + dtevap(i,k)) + condtermt(i,k) +! gtq(i,k,1) = gtq(i,k,1) + fsigma(i,k)*dqevap(i,k) + condtermq(i,k) +! gtq(i,k,itl) = gtq(i,k,itl) - (condtermq(i,k) + prectermq(i,k) + tem) +! gtq(i,k,iti) = gtq(i,k,iti) + tem + gtt(i,k) = dtdwn(i,k) + condtermt(i,k) & + + fsigma(i,k)*(dtmelt(i,k) + dtevap(i,k)) + gtq(i,k,1) = dqvdwn(i,k) + condtermq(i,k) & + + fsigma(i,k) * dqevap(i,k) + gtq(i,k,itl) = dqldwn(i,k) - condtermq(i,k) & - prectermq(i,k) - tem - gtq(i,k,iti) = dqidwn(i,k) + qifluxterm(i,k) + tem + gtq(i,k,iti) = dqidwn(i,k) + tem + ! detrainment terms get zeroed ! gtldet(i,k) = zero ! gtidet(i,k) = zero + ENDDO + ENDDO +!! flux tendencies - compute the vertical flux divergence + DO ctp =1,nctp + DO I=ISTS,IENS + cbmfl = cbmfx(i,ctp) + kk = kt(i,ctp) ! cloud top index + if(cbmfl > zero) then ! this should avoid zero wcv in the denominator + DO K=1,kk + kp1 = k+1 + gtt(i,k) = gtt(i,k) - (fsigma(i,kp1)*sfluxtem(i,kp1,ctp) & + - fsigma(i,k)*sfluxtem(i,k,ctp)) * delpinv(i,k) + gtq(i,k,1) = gtq(i,k,1) - (fsigma(i,kp1)*qvfluxtem(i,kp1,ctp) & + - fsigma(i,k)*qvfluxtem(i,k,ctp)) * delpinv(i,k) + gtq(i,k,itl) = gtq(i,k,itl) - (fsigma(i,kp1)*qlfluxtem(i,kp1,ctp) & + - fsigma(i,k)*qlfluxtem(i,k,ctp)) * delpinv(i,k) + gtq(i,k,iti) = gtq(i,k,iti) - (fsigma(i,kp1)*qifluxtem(i,kp1,ctp) & + - fsigma(i,k)*qifluxtem(i,k,ctp)) * delpinv(i,k) + ENDDO +! replace tracer tendency only if to be advected. + DO n = ntrq,NTR + if (OTSPT2(n)) then + DO K=1,kk + kp1 = k+1 + gtq(i,k,n) = - (fsigma(i,kp1)*trfluxtem(i,kp1,n,ctp) & + - fsigma(i,k)*trfluxtem(i,k,n,ctp)) * delpinv(i,k) + ENDDO + endif + ENDDO + end if + ENDDO + ENDDO +! if(kdt>4) stop 1000 + DO I=ISTS,IENS + moistening_aw(i) = zero + enddo + +! adjust tendencies that will lead to negative water mixing ratios + tem2 = one / delta + DO K=1,KMAX + DO I=ISTS,IENS tem1 = - gdq(i,k,itl)*tem2 if (gtq(i,k,itl) < tem1) then tem3 = gtq(i,k,itl) - tem1 @@ -1490,6 +1688,7 @@ SUBROUTINE CS_CUMLUS (im , IJSDIM, KMAX , NTR , & !DD dimensions tem1 = - gdq(i,k,1)*tem2 if (gtq(i,k,1) < tem1) then gtt(i,k) = gtt(i,k) + elocp*(gtq(i,k,1)-tem1) + gtq(i,k,1) = tem1 endif @@ -1499,57 +1698,34 @@ SUBROUTINE CS_CUMLUS (im , IJSDIM, KMAX , NTR , & !DD dimensions ENDDO ENDDO -! replace tracer tendency only if to be advected. - DO n = ntrq,NTR - if (OTSPT2(n)) then - DO K=1,KMAX - DO I=ISTS,IENS - gtq(i,k,n) = dtrdwn(i,k,n) + trfluxterm(i,k,n) - ENDDO - ENDDO - endif - ENDDO +!! replace tracer tendency only if to be advected. + DO n = ntrq,NTR + if (OTSPT2(n)) then + DO K=1,KMAX + DO I=ISTS,IENS + gtq(i,k,n) = gtq(i,k,n) + dtrdwn(i,k,n) + ENDDO + ENDDO + endif + ENDDO ! if (lprnt) write(0,*)' endcs_cum gtq=',gtq(ipr,1:25,ntr) ! if (lprnt) write(0,*)' endcs_cum trfluxterm=',trfluxterm(ipr,1:25,ntr) endif ! if (flx_form) -!!!! this section may need adjustment for cloud ice and water with flux_form -! -! do k=1,kmax -! do i=ISTS,IENS -! GTQ(I,k,ITI) = GTQI(I,k) -! enddo -! enddo -! -!> -# Call cumfxr() for tracer mass fixer without detrainment +! Tracer mass fixer without detrainment CALL CUMFXR(IM , IJSDIM, KMAX , NTR , & !DD dimensions GTQ , & ! modified GDQ , DELP , DELTA , KTMXT , IMFXR, & ! input ISTS , IENS ) ! input - ! -! do k=1,kmax -! do i=ISTS,IENS -! GTQL(I,k) = GTQ(I,k,ITL) + GTLDET(I,k) + GTIDET(I,k) -! enddo -! enddo -! -! Tracer mass fixer with detrainment -! CALL CUMFXR1(IM , IJSDIM, KMAX , & !DD dimensions -! GTQL , & ! modified -! GDQ(1,1,ITL), DELP, DELTA, KTMXT, IMFXR(ITL), & ! input -! ISTS , IENS ) ! input -! -!!!!! end fixer section - -! DO K=1,KMAX -! DO I=ISTS, IENS -! GTLDET(I,k) = GTQL(I,k) - GTQ(I,k,ITL) - GTIDET(I,k) +! DO K = 1, KMAX +! DO I = ISTS, IENS +! GTLDET( I,k ) = GTQL( I,k ) - GTQ( I,k,ITL ) - GTIDET( I,k ) ! tendencies of subgrid PDF (turned off) ! GDCLDX = GDCFRC( I,K ) + GTCFRC( I,K )*DELTA -! GDCLDX = MIN( MAX( GDCLDX, 0.D0 ), one ) +! GDCLDX = MIN( MAX( GDCLDX, 0.D0 ), 1.D0 ) ! GTCFRC( I,K ) = ( GDCLDX - GDCFRC( I,K ) )/DELTA ! ! GDMU2X = GDQ( I,K,IMU2 ) + GTQ( I,K,IMU2 )*DELTA @@ -1559,93 +1735,117 @@ SUBROUTINE CS_CUMLUS (im , IJSDIM, KMAX , NTR , & !DD dimensions ! GTQ( I,K,IMU2 ) = ( GDMU2X - GDQ( I,K,IMU2 ))/DELTA ! GTQ( I,K,IMU3 ) = ( GDMU3X - GDQ( I,K,IMU3 ))/DELTA ! -! tem = DELP(I,K)*GRAVI -! HBGT(I) = HBGT(I) + (CP*GTT(I,K) + EL*GTQ(I,K,1) & -! - EMELT*GTQ(I,K,ITI)) * tem -! - EMELT*(GTQ(I,K,ITI)+GTIDET(I,K))) * tem -! WBGT(I) = WBGT(I) + (GTQ(I,K,1) + GTQ(I,K,ITL) + GTQ(I,K,ITI)) * tem -! + GTLDET(I,K) + GTIDET(I,K)) * tem -! ENDDO -! ENDDO +! tem = DELP(I,K)*GRAVI +! HBGT( I ) = HBGT( I ) + ( CP*GTT(I,K) + EL*GTQ(I,K,1) & +! - EMELT*(GTQ(I,K,ITI)+GTIDET(I,K)) ) * tem +! WBGT( I ) = WBGT( I ) + ( GTQ(I,K,1) + GTQ(I,K,ITL) & +! + GTQ(I,K,ITI) + GTLDET(I,K) + GTIDET(I,K) ) * tem +! END DO +! END DO - ! -! DO I=ISTS,IENS -! HBGT(I) = HBGT(I) - EMELT*GSNWC(I) -! WBGT(I) = WBGT(I) + GPRCC(I,1) + GSNWC(I) -! CTOPP(I) = 1.D6 -! ENDDO -! -! The following commented out because they are unused -! DO CTP=1,NCTP -! DO I=ISTS, IENS -! kk = kt(i,ctp) -! IF (KK > KB(I) ) THEN -! CUMHGT(I,CTP) = GDZ(I,KK) -! CTOPP(I) = MIN(CTOPP(I), GDP(I,KK)) -! ELSE -! CUMHGT (I,CTP) = -999.D0 -! ENDIF -! ENDDO -! ENDDO -! DO I=ISTS,IENS -! IF(CTOPP(I) >= 1.D6) THEN -! CTOPP(I) = -999.D0 -! ENDIF -! ENDDO -! -!> -# Ensures conservation of water. -!In fact, no adjustment of the precip -! is occuring now which is a good sign! DD - if(flx_form .and. adjustp) then +! DO I = ISTS, IENS +! HBGT( I ) = HBGT( I ) - EMELT*GSNWC( I ) +! WBGT( I ) = WBGT( I ) + GPRCC( I,1 ) + GSNWC( I ) +! CTOPP( I ) = 1.D6 +! END DO +! +! DO CTP = 1, NCTP +! DO I = ISTS, IENS +! IF ( KT( I,CTP ) .GT. KB( I ) ) THEN +! CUMHGT ( I,CTP ) = GDZ( I,KT( I,CTP ) ) +! CTOPP( I ) = MIN( CTOPP( I ),GDP( I,KT( I,CTP ) )) +! ELSE +! CUMHGT ( I,CTP ) = -999.D0 +! END IF +!! END DO +! END DO +! DO I = ISTS, IENS +! IF( CTOPP( I ) >= 1.D6 ) THEN +! CTOPP( I ) = -999.D0 +! END IF +! END DO +! +! This code ensures conservation of water (precip=vert. integral of water tend.). +! In fact, no adjustment of the precip (moistenening_aw=1) when do_aw false +! is occuring now which is a good sign! +! Factor deviates less than 0.5% from one when do_aw true - is this just due the averaging +! of sigma for the terms coming out of cumdwn? + + if(flx_form) then DO I = ISTS, IENS if(gprcp(i,1)+gsnwp(i,1) > 1.e-12_kind_phys) then - moistening_aw(i) = - moistening_aw(i) / (gprcp(i,1)+gsnwp(i,1)) - else - moistening_aw(i) = 1.0 + moistening_aw(i) = -moistening_aw(i) / (gprcp(i,1)+gsnwp(i,1)) +! print*,'moistening_aw',moistening_aw(i) + gprcp(i,:) = gprcp(i,:) * moistening_aw(i) + gsnwp(i,:) = gsnwp(i,:) * moistening_aw(i) endif - ENDDO - do k=1,kmax - DO I = ISTS, IENS - gprcp(i,k) = max(0.0, gprcp(i,k) * moistening_aw(i)) - gsnwp(i,k) = max(0.0, gsnwp(i,k) * moistening_aw(i)) - ENDDO - enddo - + END DO endif + +! second method of determining sfc precip only +! if(flx_form) then +! DO I = ISTS, IENS +! pr_tot = zero +! pr_liq = zero +! pr_ice = zero +! do k = 1,kmax +! pr_tot = pr_tot - (gtq(i,k,1)+gtq(i,k,itl)+gtq(i,k,iti)) * delp(i,k) * gravi +! pr_ice = pr_ice + ( cp*gtt(i,k) + el*gtq(i,k,1) - emelt*gtq(i,k,iti) ) & +! * delp(i,k)*gravi +! enddo + !pr_ice = max( min(pr_tot, pr_ice / (emelt)),zero) +! pr_ice = pr_ice / emelt +! pr_liq = pr_tot - pr_ice +! END DO +! print *,'precip1',pr_tot*86400.,gprcp(1,1)*86400.,gsnwp(1,1)*86400. +! print *,'precip2',pr_tot*86400.,pr_liq*86400.,pr_ice*86400. +! endif + + DO K = 1, KMAX + DO I = ISTS, IENS + GPRCPF( I,K ) = 0.5D0*( GPRCP( I,K )+GPRCP( I,K+1 ) ) + GSNWPF( I,K ) = 0.5D0*( GSNWP( I,K )+GSNWP( I,K+1 ) ) + END DO + END DO + ! -! do i=ISTS,IENS -! GPRCC(I,1) = GPRCP(I,1) -! GSNWC(I ) = GSNWP(I,1) -! enddo - do k=1,kmax +! do i=ISTS,IENS +! GPRCC( I,1 ) = GPRCP( I,1 ) +! GSNWC( I ) = GSNWP( I,1 ) +! enddo + +! adjust sfc precip consistently with vertically integrated +! temperature and moisture tendencies + + do k=1,kmax+1 do i=ISTS,IENS - GTPRP(I,k) = GPRCP(I,k) + GSNWP(I,k) + GTPRP( I,k ) = GPRCP( I,k ) + GSNWP( I,k ) enddo enddo ! + !DD provide GFS with a separate downdraft mass flux - DO K=1,KMAX - DO I=ISTS,IENS - GMFX1(I,K) = GMFX0(I,K) - GMFLX(I,K) - ENDDO - ENDDO -! - if (flx_form) then - deallocate(sfluxterm, qvfluxterm, qlfluxterm, qifluxterm,& - condtermt, condtermq, frzterm, prectermq, & - prectermfrz, dtdwn, dqvdwn, dqldwn, & - dqidwn, trfluxterm, dtrdwn) - endif - if (allocated(gprcc)) deallocate(gprcc) + if(do_aw) then + DO K = 1, KMAX+1 + DO I = ISTS, IENS + fsigma(i,k) = one - sigma(i,k) + GMFX0( I,K ) = GMFX0( I,K ) * fsigma(i,k) + GMFLX( I,K ) = GMFLX( I,K ) * fsigma(i,k) + END DO + END DO + endif + DO K = 1, KMAX+1 + DO I = ISTS, IENS + GMFX1( I,K ) = GMFX0( I,K ) - GMFLX( I,K ) + END DO + END DO + if (allocated(gprcc)) deallocate(gprcc) ! END SUBROUTINE CS_CUMLUS -!> @} !*********************************************************************** -!>\ingroup cs_scheme -!! This subroutine calculates cloud base properties. - SUBROUTINE CUMBAS & ! cloud base + SUBROUTINE CUMBAS & !! cloud base ( IJSDIM, KMAX , & !DD dimensions KB , GCYM , KBMX , & ! output ntr , ntrq , & @@ -1679,7 +1879,7 @@ SUBROUTINE CUMBAS & ! cloud base !DDsigma added to arglist for AW, subcloud updraft profiles: temperature, water vapor ! total water, cloud water, and cloud ice respectively - REAL(kind_phys), dimension(ijsdim,kmax) :: gctbl, gcqbl, gcwbl, gcqlbl, gcqibl !>DDsigmadiag + REAL(kind_phys), dimension(ijsdim,kmax) :: gctbl, gcqbl, gcwbl, gcqlbl, gcqibl !DDsigmadiag REAL(kind_phys), dimension(ijsdim,kmax,ntrq:ntr) :: gctrbl !DDsigmadiag ! ! [INPUT] @@ -1748,14 +1948,14 @@ SUBROUTINE CUMBAS & ! cloud base ENDIF ENDDO ENDDO - DO K=KLCLB+1,KBMAX-1 - DO I=ISTS,IENS - spbl(i) = one - gdpm(i,k) * tx1(i) - IF (kb(i) > k .and. spbl(i) > spblmax) THEN - KB(I) = K - ENDIF - ENDDO - ENDDO +! DO K=KLCLB+1,KBMAX-1 +! DO I=ISTS,IENS +! spbl(i) = one - gdpm(i,k) * tx1(i) +! IF (kb(i) > k .and. spbl(i) > spblmax) THEN +! KB(I) = K +! ENDIF +! ENDDO +! ENDDO ! DO K=KBMAX-1,KLCLB+1,-1 ! DO I=ISTS,IENS ! GAMX = FDQS(I,K) / (one+GAM(I,K)) * oneocp @@ -1874,8 +2074,6 @@ SUBROUTINE CUMBAS & ! cloud base ! END SUBROUTINE CUMBAS !*********************************************************************** -!>\ingroup cs_scheme -!! This subroutine calculates in-cloud properties. SUBROUTINE CUMUP & !! in-cloud properties ( IJSDIM, KMAX , NTR , ntrq , & !DD dimensions ACWF , & ! output @@ -1907,88 +2105,88 @@ SUBROUTINE CUMUP & !! in-cloud properties logical :: lprnt ! ! [OUTPUT] - REAL(kind_phys) ACWF (IJSDIM) !< cloud work function - REAL(kind_phys) GCLZ (IJSDIM, KMAX) !< cloud liquid water*eta - REAL(kind_phys) GCIZ (IJSDIM, KMAX) !< cloud ice*eta - REAL(kind_phys) GPRCIZ(IJSDIM, KMAX) !< rain generation*eta - REAL(kind_phys) GSNWIZ(IJSDIM, KMAX) !< snow generation*eta - REAL(kind_phys) GCYT (IJSDIM) !< norm. mass flux @top - REAL(kind_phys) GCHT (IJSDIM) !< cloud top MSE*eta - REAL(kind_phys) GCQT (IJSDIM) !< cloud top moisture*eta - REAL(kind_phys) GCLT (IJSDIM) !< cloud top liquid water*eta - REAL(kind_phys) GCIT (IJSDIM) !< cloud top ice*eta - REAL(kind_phys) GCtrT (IJSDIM, ntrq:ntr) !< cloud top tracer*eta - REAL(kind_phys) GTPRT (IJSDIM) !< cloud top (rain+snow)*eta - REAL(kind_phys) GCUT (IJSDIM) !< cloud top u*eta - REAL(kind_phys) GCVT (IJSDIM) !< cloud top v*eta - REAL(kind_phys) GCwT (IJSDIM) !< cloud top v*eta - INTEGER KT (IJSDIM) !< cloud top - INTEGER KTMX !< max of cloud top - REAL(kind_phys) WCV (IJSDIM, KMAX) !< updraft velocity (half lev) !DD sigma make output + REAL(kind_phys) ACWF (IJSDIM) ! cloud work function + REAL(kind_phys) GCLZ (IJSDIM, KMAX) ! cloud liquid water*eta + REAL(kind_phys) GCIZ (IJSDIM, KMAX) ! cloud ice*eta + REAL(kind_phys) GPRCIZ(IJSDIM, KMAX+1) ! rain generation*eta + REAL(kind_phys) GSNWIZ(IJSDIM, KMAX+1) ! snow generation*eta + REAL(kind_phys) GCYT (IJSDIM) ! norm. mass flux @top + REAL(kind_phys) GCHT (IJSDIM) ! cloud top MSE*eta + REAL(kind_phys) GCQT (IJSDIM) ! cloud top moisture*eta + REAL(kind_phys) GCLT (IJSDIM) ! cloud top liquid water*eta + REAL(kind_phys) GCIT (IJSDIM) ! cloud top ice*eta + REAL(kind_phys) GCtrT (IJSDIM, ntrq:ntr) ! cloud top tracer*eta + REAL(kind_phys) GTPRT (IJSDIM) ! cloud top (rain+snow)*eta + REAL(kind_phys) GCUT (IJSDIM) ! cloud top u*eta + REAL(kind_phys) GCVT (IJSDIM) ! cloud top v*eta + REAL(kind_phys) GCwT (IJSDIM) ! cloud top v*eta + INTEGER KT (IJSDIM) ! cloud top + INTEGER KTMX ! max of cloud top + REAL(kind_phys) WCV (IJSDIM, KMAX+1) ! updraft velocity (half lev) !DD sigma make output ! ! [MODIFIED] - REAL(kind_phys) GCYM (IJSDIM, KMAX) !< norm. mass flux + REAL(kind_phys) GCYM (IJSDIM, KMAX) ! norm. mass flux ! ! [INPUT] - REAL(kind_phys) GCHB (IJSDIM) !< cloud base Moist Static Energy - REAL(kind_phys) GCWB (IJSDIM) !< cloud base total water - REAL(kind_phys) GCUB (IJSDIM) !< cloud base U - REAL(kind_phys) GCVB (IJSDIM) !< cloud base V - REAL(kind_phys) GCIB (IJSDIM) !< cloud base ice - REAL(kind_phys) GCtrB (IJSDIM,ntrq:ntr) !< cloud base tracers - REAL(kind_phys) GDU (IJSDIM, KMAX) !< U - REAL(kind_phys) GDV (IJSDIM, KMAX) !< V - REAL(kind_phys) GDH (IJSDIM, KMAX) !< moist static energy - REAL(kind_phys) GDW (IJSDIM, KMAX) !< total water - REAL(kind_phys) GDHS (IJSDIM, KMAX) !< saturation MSE - REAL(kind_phys) GDQS (IJSDIM, KMAX) !< saturation q - REAL(kind_phys) GDT (IJSDIM, KMAX) !< T - REAL(kind_phys) GDTM (IJSDIM, KMAX+1) !< T (half lev) - REAL(kind_phys) GDQ (IJSDIM, KMAX, NTR) !< q !!DDsigmadiag - REAL(kind_phys) GDQI (IJSDIM, KMAX) !< cloud ice - REAL(kind_phys) GDZ (IJSDIM, KMAX) !< z - REAL(kind_phys) GDZM (IJSDIM, KMAX+1) !< z (half lev) - REAL(kind_phys) GDPM (IJSDIM, KMAX+1) !< p (half lev) + REAL(kind_phys) GCHB (IJSDIM) ! cloud base Moist Static Energy + REAL(kind_phys) GCWB (IJSDIM) ! cloud base total water + REAL(kind_phys) GCUB (IJSDIM) ! cloud base U + REAL(kind_phys) GCVB (IJSDIM) ! cloud base V + REAL(kind_phys) GCIB (IJSDIM) ! cloud base ice + REAL(kind_phys) GCtrB (IJSDIM,ntrq:ntr) ! cloud base tracers + REAL(kind_phys) GDU (IJSDIM, KMAX) ! U + REAL(kind_phys) GDV (IJSDIM, KMAX) ! V + REAL(kind_phys) GDH (IJSDIM, KMAX) ! moist static energy + REAL(kind_phys) GDW (IJSDIM, KMAX) ! total water + REAL(kind_phys) GDHS (IJSDIM, KMAX) ! saturation MSE + REAL(kind_phys) GDQS (IJSDIM, KMAX) ! saturation q + REAL(kind_phys) GDT (IJSDIM, KMAX) ! T + REAL(kind_phys) GDTM (IJSDIM, KMAX+1) ! T (half lev) + REAL(kind_phys) GDQ (IJSDIM, KMAX, NTR) ! q !!DDsigmadiag + REAL(kind_phys) GDQI (IJSDIM, KMAX) ! cloud ice + REAL(kind_phys) GDZ (IJSDIM, KMAX) ! z + REAL(kind_phys) GDZM (IJSDIM, KMAX+1) ! z (half lev) + REAL(kind_phys) GDPM (IJSDIM, KMAX+1) ! p (half lev) REAL(kind_phys) FDQS (IJSDIM, KMAX) REAL(kind_phys) GAM (IJSDIM, KMAX) - REAL(kind_phys) GDZTR (IJSDIM) !< tropopause height - REAL(kind_phys) CPRES !< pres. fac. for cum. fric. - REAL(kind_phys) WCB(ijsdim) !< cloud base updraft velocity**2 -! REAL(kind_phys) ERMR !< entrainment rate (ASMODE) + REAL(kind_phys) GDZTR (IJSDIM) ! tropopause height + REAL(kind_phys) CPRES ! pres. fac. for cum. fric. + REAL(kind_phys) WCB(ijsdim) ! cloud base updraft velocity**2 +! REAL(kind_phys) ERMR ! entrainment rate (ASMODE) INTEGER KB (IJSDIM) INTEGER CTP, ISTS, IENS ! ! [INTERNAL WORK] - REAL(kind_phys) ACWFK (IJSDIM,KMAX) !< cloud work function - REAL(kind_phys) ACWFN (IJSDIM,KMAX) !< negative part of cloud work function - REAL(kind_phys) myGCHt !< cloud top h *eta (half lev) - REAL(kind_phys) GCHMZ (IJSDIM, KMAX) !< cloud h *eta (half lev) - REAL(kind_phys) GCWMZ (IJSDIM, KMAX) !< cloud Qt*eta (half lev) - REAL(kind_phys) GCUMZ (IJSDIM, KMAX) !< cloud U *eta (half lev) - REAL(kind_phys) GCVMZ (IJSDIM, KMAX) !< cloud V *eta (half lev) - REAL(kind_phys) GCqMZ (IJSDIM ) !< cloud qv*eta (half lev) - REAL(kind_phys) GCIMZ (IJSDIM, KMAX) !< cloud Qi*eta (half lev) - REAL(kind_phys) GCtrMZ(IJSDIM, KMAX,ntrq:ntr)!< cloud tracer*eta (half lev) - REAL(kind_phys) GTPRMZ(IJSDIM, KMAX) !< rain+snow *eta (half lev) -! - REAL(kind_phys) BUOY (IJSDIM, KMAX) !< buoyancy - REAL(kind_phys) BUOYM (IJSDIM, KMAX) !< buoyancy (half lev) - REAL(kind_phys) WCM (IJSDIM ) !< updraft velocity**2 (half lev) -! REAL(kind_phys) WCM (IJSDIM, KMAX) !< updraft velocity**2 (half lev) + REAL(kind_phys) ACWFK (IJSDIM,KMAX) ! cloud work function + REAL(kind_phys) ACWFN (IJSDIM,KMAX) ! negative part of cloud work function + REAL(kind_phys) myGCHt ! cloud top h *eta (half lev) + REAL(kind_phys) GCHMZ (IJSDIM, KMAX) ! cloud h *eta (half lev) + REAL(kind_phys) GCWMZ (IJSDIM, KMAX) ! cloud Qt*eta (half lev) + REAL(kind_phys) GCUMZ (IJSDIM, KMAX) ! cloud U *eta (half lev) + REAL(kind_phys) GCVMZ (IJSDIM, KMAX) ! cloud V *eta (half lev) + REAL(kind_phys) GCqMZ (IJSDIM ) ! cloud qv*eta (half lev) + REAL(kind_phys) GCIMZ (IJSDIM, KMAX) ! cloud Qi*eta (half lev) + REAL(kind_phys) GCtrMZ(IJSDIM, KMAX,ntrq:ntr)! cloud tracer*eta (half lev) + REAL(kind_phys) GTPRMZ(IJSDIM, KMAX) ! rain+snow *eta (half lev) +! + REAL(kind_phys) BUOY (IJSDIM, KMAX) ! buoyancy + REAL(kind_phys) BUOYM (IJSDIM, KMAX) ! buoyancy (half lev) + REAL(kind_phys) WCM (IJSDIM ) ! updraft velocity**2 (half lev) +! REAL(kind_phys) WCM (IJSDIM, KMAX) ! updraft velocity**2 (half lev) !DD sigma make output REAL(kind_phys) WCV ( IJSDIM, KMAX+1 ) !! updraft velocity (half lev) - REAL(kind_phys) GCY (IJSDIM, KMAX) !< norm. mass flux -! REAL(kind_phys) ELAR (IJSDIM, KMAX) !< entrainment rate - REAL(kind_phys) ELAR !< entrainment rate at mid layer -! - REAL(kind_phys) GCHM (IJSDIM, KMAX) !< cloud MSE (half lev) - REAL(kind_phys) GCWM (IJSDIM, KMAX) !< cloud Qt (half lev) !DDsigmadiag - REAL(kind_phys) GCTM (IJSDIM, KMAX) !< cloud T (half lev) !DDsigmadiag make output - REAL(kind_phys) GCQM (IJSDIM, KMAX) !< cloud q (half lev) !DDsigmadiag make output - REAL(kind_phys) GCLM (IJSDIM, KMAX) !< cloud liquid ( half lev) - REAL(kind_phys) GCIM (IJSDIM, KMAX) !< cloud ice (half lev) - REAL(kind_phys) GCUM (IJSDIM, KMAX) !< cloud U (half lev) - REAL(kind_phys) GCVM (IJSDIM, KMAX) !< cloud V (half lev) - REAL(kind_phys) GCtrM (IJSDIM, KMAX,ntrq:ntr) !< cloud tracer (half lev) + REAL(kind_phys) GCY (IJSDIM, KMAX) ! norm. mass flux +! REAL(kind_phys) ELAR (IJSDIM, KMAX) ! entrainment rate + REAL(kind_phys) ELAR ! entrainment rate at mid layer +! + REAL(kind_phys) GCHM (IJSDIM, KMAX+1) ! cloud MSE (half lev) + REAL(kind_phys) GCWM (IJSDIM, KMAX+1) ! cloud Qt (half lev) !DDsigmadiag + REAL(kind_phys) GCTM (IJSDIM, KMAX+1) ! cloud T (half lev) !DDsigmadiag make output + REAL(kind_phys) GCQM (IJSDIM, KMAX+1) ! cloud q (half lev) !DDsigmadiag make output + REAL(kind_phys) GCLM (IJSDIM, KMAX+1) ! cloud liquid ( half lev) + REAL(kind_phys) GCIM (IJSDIM, KMAX+1) ! cloud ice (half lev) + REAL(kind_phys) GCUM (IJSDIM, KMAX) ! cloud U (half lev) + REAL(kind_phys) GCVM (IJSDIM, KMAX) ! cloud V (half lev) + REAL(kind_phys) GCtrM (IJSDIM, KMAX,ntrq:ntr) ! cloud tracer (half lev) ! REAL(kind_phys), dimension(IJSDIM) :: WCM_, ELARM1, GDZMKB REAL(kind_phys) GDQSM, GDHSM, GDQM, GDSM, GDCM, FDQSM, GCCM, & @@ -2021,8 +2219,9 @@ SUBROUTINE CUMUP & !! in-cloud properties ! REAL(kind_phys) :: WCCRT = zero !m REAL(kind_phys) :: WCCRT = 0.01 REAL(kind_phys) :: WCCRT = 1.0e-6_kind_phys, wvcrt=1.0e-3_kind_phys - REAL(kind_phys) :: TSICE = 268.15_kind_phys ! compatible with macrop_driver - REAL(kind_phys) :: TWICE = 238.15_kind_phys ! compatible with macrop_driver + REAL(kind_phys) :: TSICE = 273.15_kind_phys ! compatible with macrop_driver + REAL(kind_phys) :: TWICE = 233.15_kind_phys ! compatible with macrop_driver + REAL(kind_phys) :: c1t ! REAL(kind_phys) :: wfn_neg = 0.1 REAL(kind_phys) :: wfn_neg = 0.15 @@ -2033,10 +2232,15 @@ SUBROUTINE CUMUP & !! in-cloud properties REAL(kind_phys) :: esat, tem ! REAL(kind_phys) :: esat, tem, rhs_h, rhs_q ! +! [INTERNAL FUNC] + REAL(kind_phys) FPREC ! precipitation ratio in condensate + REAL(kind_phys) FRICE ! ice ratio in cloud water REAL(kind_phys) Z ! altitude REAL(kind_phys) ZH ! scale height REAL(kind_phys) T ! temperature ! + FPREC(Z,ZH) = MIN(MAX(one-EXP(-(Z-PRECZ0)/ZH), zero), one) + FRICE(T) = MIN(MAX((TSICE-T)/(TSICE-TWICE), zero), one) ! ! Note: iteration is not made to diagnose cloud ice for simplicity ! @@ -2052,14 +2256,25 @@ SUBROUTINE CUMUP & !! in-cloud properties GCVT (I) = zero GCwT (I) = zero enddo + do k=1,kmax+1 + do i=ists,iens + GPRCIZ(I,k) = zero + GSNWIZ(I,k) = zero + enddo + enddo + do k=1,kmax + do i=ists,iens + WCV (I,k) = unset_kind_phys + GCLM (I,k) = unset_kind_phys + GCIM (I,k) = unset_kind_phys + enddo + enddo do k=1,kmax do i=ists,iens ACWFK (I,k) = unset_kind_phys ACWFN (I,k) = unset_kind_phys GCLZ (I,k) = zero GCIZ (I,k) = zero - GPRCIZ(I,k) = zero - GSNWIZ(I,k) = zero ! GCHMZ (I,k) = zero GCWMZ (I,k) = zero @@ -2070,15 +2285,12 @@ SUBROUTINE CUMUP & !! in-cloud properties ! BUOY (I,k) = unset_kind_phys BUOYM (I,k) = unset_kind_phys - WCV (I,k) = unset_kind_phys GCY (I,k) = unset_kind_phys ! GCHM (I,k) = unset_kind_phys GCWM (I,k) = unset_kind_phys GCTM (I,k) = unset_kind_phys GCQM (I,k) = unset_kind_phys - GCLM (I,k) = unset_kind_phys - GCIM (I,k) = unset_kind_phys GCUM (I,k) = unset_kind_phys GCVM (I,k) = unset_kind_phys enddo @@ -2199,13 +2411,24 @@ SUBROUTINE CUMUP & !! in-cloud properties FDQSM = GDQSM * tem * (fact1 + fact2*tem) ! calculate d(qs)/dT CPGMI = one / (CP + EL*FDQSM) - PRCZH = PRECZH * MIN(GDZTR(I)*ZTREFI, one) - PRECR = FPREC(GDZM(I,K)-GDZMKB(I), PRCZH ) ! wrk = one / GCYM(I,K) DCTM = (GCHMZ(I,K)*wrk - GDHSM) * CPGMI GCQMZ(i) = min((GDQSM+FDQSM*DCTM)*GCYM(I,K), GCWMZ(I,K)) - GTPRMZ(I,K) = PRECR * (GCWMZ(I,K)-GCQMZ(i)) + if(PRECZH > zero) then + PRCZH = PRECZH * MIN(GDZTR(I)*ZTREFI, one) + PRECR = FPREC(GDZM(I,K)-GDZMKB(I), PRCZH ) + GTPRMZ(I,K) = PRECR * (GCWMZ(I,K)-GCQMZ(i)) + else + DELC=GDZ(I,K)-GDZ(I,KM1) + if(gdtm(i,k)>TSICE) then + c1t=c0t*delc + else + c1t=c0t*exp(d0t*(gdtm(i,k)-TSICE))*delc + end if + c1t=min(c1t, one) + GTPRMZ(I,K) = c1t * (GCWMZ(I,K)-GCQMZ(i)) + end if GTPRMZ(I,K) = MAX(GTPRMZ(I,K), GTPRMZ(I,KM1)) GCCMZ = GCWMZ(I,K) - GCQMZ(i) - GTPRMZ(I,K ) DELC = MIN(GCCMZ, zero) @@ -2274,7 +2497,11 @@ SUBROUTINE CUMUP & !! in-cloud properties wrk = one / GCYM(I,K) DCTM = (GCHMZ(I,K)*wrk - GDHSM) * CPGMI GCQMZ(i) = min((GDQSM+FDQSM*DCTM)*GCYM(I,K), GCWMZ(I,K)) - GTPRMZ(I,K) = PRECR * (GCWMZ(I,K)-GCQMZ(i)) + if(PRECZH > zero) then + GTPRMZ(I,K) = PRECR * (GCWMZ(I,K)-GCQMZ(i)) + else + GTPRMZ(I,K) = c1t * (GCWMZ(I,K)-GCQMZ(i)) + end if GTPRMZ(I,K) = MAX(GTPRMZ(I,K), GTPRMZ(I,KM1)) GCCMZ = GCWMZ(I,K) - GCQMZ(i) - GTPRMZ(I,K) DELC = MIN(GCCMZ, zero) @@ -2399,8 +2626,19 @@ SUBROUTINE CUMUP & !! in-cloud properties wrk = one / gcyt(i) DCT = (GCHT(I)*wrk - GDHS(I,K)) / (CP*(one + GAM(I,K))) GCQT(I) = min((GDQS(I,K) + FDQS(I,K)*DCT) * GCYT(I), GCWT(i)) - PRCZH = PRECZH * MIN(GDZTR(I)*ZTREFI, one) - GTPRT(I) = FPREC(GDZ(I,K)-GDZMKB(I), PRCZH) * (GCWT(i)-GCQT(I)) + if(PRECZH > zero) then + PRCZH = PRECZH * MIN(GDZTR(I)*ZTREFI, one) + GTPRT(I) = FPREC(GDZ(I,K)-GDZMKB(I), PRCZH) * (GCWT(i)-GCQT(I)) + else + DELC=GDZ(I,K)-GDZ(I,K-1) + if(gdtm(i,k)>TSICE) then + c1t=c0t*delc + else + c1t=c0t*exp(d0t*(gdtm(i,k)-TSICE))*delc + end if + c1t=min(c1t, one) + GTPRT(I) = c1t * (GCWT(i)-GCQT(I)) + end if GTPRT(I) = MAX(GTPRT(I), GTPRMZ(I,K)) GCCT = GCWT(i) - GCQT(I) - GTPRT(I) DELC = MIN(GCCT, zero) @@ -2503,28 +2741,8 @@ SUBROUTINE CUMUP & !! in-cloud properties ! ! WRITE( CTNUM, '(I2.2)' ) CTP ! - -contains - - pure function FPREC(Z,ZH) - implicit none - real(kind_phys), intent(in) :: Z - real(kind_phys), intent(in) :: ZH - real(kind_phys) :: FPREC - FPREC = MIN(MAX(one-EXP(-(Z-PRECZ0)/ZH), zero), one) - end function FPREC - - pure function FRICE(T) - implicit none - real(kind_phys), intent(in) :: T - real(kind_phys) :: FRICE - FRICE = MIN(MAX((TSICE-T)/(TSICE-TWICE), zero), one) - end function FRICE - END SUBROUTINE CUMUP !*********************************************************************** -!>\ingroup cs_scheme -!! This subroutine computes cloud base mass flux. SUBROUTINE CUMBMX & !! cloud base mass flux ( IJSDIM, KMAX , & !DD dimensions CBMFX , & ! modified @@ -2539,19 +2757,19 @@ SUBROUTINE CUMBMX & !! cloud base mass flux INTEGER, INTENT(IN) :: IJSDIM, KMAX ! DD, for GFS, pass in ! ! [MODIFY] - REAL(kind_phys) CBMFX (IJSDIM) !< cloud base mass flux + REAL(kind_phys) CBMFX (IJSDIM) ! cloud base mass flux ! ! [INPUT] - REAL(kind_phys) ACWF (IJSDIM) !< cloud work function - REAL(kind_phys) GCYT (IJSDIM) !< norm mass flux @top - REAL(kind_phys) GDZM (IJSDIM, KMAX+1) !< height - REAL(kind_phys) GDW (IJSDIM, KMAX) !< total water - REAL(kind_phys) GDQS (IJSDIM, KMAX) !< saturate humidity - REAL(kind_phys) DELP (IJSDIM, KMAX) !< delt pressure - INTEGER KT (IJSDIM) !< cloud top - INTEGER KTMX !< max. of cloud top - INTEGER KB (IJSDIM) !< cloud base - REAL(kind_phys) DELT !< time step + REAL(kind_phys) ACWF (IJSDIM) ! cloud work function + REAL(kind_phys) GCYT (IJSDIM) ! norm mass flux @top + REAL(kind_phys) GDZM (IJSDIM, KMAX+1) ! height + REAL(kind_phys) GDW (IJSDIM, KMAX) ! total water + REAL(kind_phys) GDQS (IJSDIM, KMAX) ! saturate humidity + REAL(kind_phys) DELP (IJSDIM, KMAX) ! delt pressure + INTEGER KT (IJSDIM) ! cloud top + INTEGER KTMX ! max. of cloud top + INTEGER KB (IJSDIM) ! cloud base + REAL(kind_phys) DELT ! time step INTEGER ISTS, IENS ! ! [INTERNAL WORK] @@ -2561,9 +2779,9 @@ SUBROUTINE CUMBMX & !! cloud base mass flux ! ! [INTERNAL PARAM] REAL(kind_phys) :: FMAX = 1.5e-2_kind_phys ! maximum flux -! REAL(kind_phys) :: RHMCRT = zero ! critical val. of cloud mean RH -! REAL(kind_phys) :: RHMCRT = 0.25_kind_phys ! critical val. of cloud mean RH - REAL(kind_phys) :: RHMCRT = 0.50_kind_phys ! critical val. of cloud mean RH +! REAL(kind_phys) :: RHMCRT = zero ! critical val. of cloud mean RH + REAL(kind_phys) :: RHMCRT = 0.25_kind_phys ! critical val. of cloud mean RH +! REAL(kind_phys) :: RHMCRT = 0.50_kind_phys ! critical val. of cloud mean RH REAL(kind_phys) :: ALP1 = zero REAL(kind_phys) :: TAUD = 1.e3_kind_phys ! REAL(kind_phys) :: TAUD = 6.e2_kind_phys @@ -2608,8 +2826,6 @@ SUBROUTINE CUMBMX & !! cloud base mass flux ! END SUBROUTINE CUMBMX !*********************************************************************** -!>\ingroup cs_scheme -!! This subroutine computes cloud mass flux & precip. SUBROUTINE CUMFLX & !! cloud mass flux ( IM , IJSDIM, KMAX , & !DD dimensions GMFLX , GPRCI , GSNWI , CMDET, & ! output @@ -2624,26 +2840,26 @@ SUBROUTINE CUMFLX & !! cloud mass flux INTEGER, INTENT(IN) :: IJSDIM, KMAX, IM !! DD, for GFS, pass in ! ! [OUTPUT] - REAL(kind_phys) GMFLX (IJSDIM, KMAX) !< mass flux - REAL(kind_phys) CMDET (IJSDIM, KMAX) !< detrainment mass flux - REAL(kind_phys) GPRCI (IJSDIM, KMAX) !< rainfall generation - REAL(kind_phys) GSNWI (IJSDIM, KMAX) !< snowfall generation - REAL(kind_phys) QLIQ (IJSDIM, KMAX) !< cloud liquid - REAL(kind_phys) QICE (IJSDIM, KMAX) !< cloud ice - REAL(kind_phys) GTPRC0(IJSDIM) !< precip. before evap. + REAL(kind_phys) GMFLX (IJSDIM, KMAX+1) !! mass flux + REAL(kind_phys) CMDET (IJSDIM, KMAX) !! detrainment mass flux + REAL(kind_phys) GPRCI (IJSDIM, KMAX) !! rainfall generation + REAL(kind_phys) GSNWI (IJSDIM, KMAX) !! snowfall generation + REAL(kind_phys) QLIQ (IJSDIM, KMAX) !! cloud liquid + REAL(kind_phys) QICE (IJSDIM, KMAX) !! cloud ice + REAL(kind_phys) GTPRC0(IJSDIM) !! precip. before evap. ! ! [INPUT] - REAL(kind_phys) CBMFX (IJSDIM) !< cloud base mass flux - REAL(kind_phys) GCYM (IJSDIM, KMAX) !< normalized mass flux - REAL(kind_phys) GCYT (IJSDIM) !< detraining mass flux - REAL(kind_phys) GPRCIZ(IJSDIM, KMAX) !< precipitation/M - REAL(kind_phys) GSNWIZ(IJSDIM, KMAX) !< snowfall/M - REAL(kind_phys) GTPRT (IJSDIM) !< rain+snow @top - REAL(kind_phys) GCLZ (IJSDIM, KMAX) !< cloud liquid/M - REAL(kind_phys) GCIZ (IJSDIM, KMAX) !< cloud ice/M - INTEGER KB (IJSDIM) !< cloud base - INTEGER KT (IJSDIM) !< cloud top - INTEGER KTMX !< max of cloud top + REAL(kind_phys) CBMFX (IJSDIM) !! cloud base mass flux + REAL(kind_phys) GCYM (IJSDIM, KMAX) !! normalized mass flux + REAL(kind_phys) GCYT (IJSDIM) !! detraining mass flux + REAL(kind_phys) GPRCIZ(IJSDIM, KMAX+1) !! precipitation/M + REAL(kind_phys) GSNWIZ(IJSDIM, KMAX+1) !! snowfall/M + REAL(kind_phys) GTPRT (IJSDIM) !! rain+snow @top + REAL(kind_phys) GCLZ (IJSDIM, KMAX) !! cloud liquid/M + REAL(kind_phys) GCIZ (IJSDIM, KMAX) !! cloud ice/M + INTEGER KB (IJSDIM) !! cloud base + INTEGER KT (IJSDIM) !! cloud top + INTEGER KTMX !! max of cloud top INTEGER ISTS, IENS, I, K ! DO K=1,KTMX @@ -2668,8 +2884,6 @@ SUBROUTINE CUMFLX & !! cloud mass flux ! END SUBROUTINE CUMFLX !*********************************************************************** -!>\ingroup cs_scheme -!! This subroutine calculates cloud detrainment heating. SUBROUTINE CUMDET & !! detrainment ( im , IJSDIM, KMAX , NTR , ntrq , & !DD dimensions GTT , GTQ , GTU , GTV , & ! modified @@ -2686,30 +2900,30 @@ SUBROUTINE CUMDET & !! detrainment INTEGER, INTENT(IN) :: im, IJSDIM, KMAX, NTR, nctp, ntrq !! DD, for GFS, pass in ! ! [MODIFY] - REAL(kind_phys) GTT (IJSDIM, KMAX) !< temperature tendency - REAL(kind_phys) GTQ (IJSDIM, KMAX, NTR) !< moisture tendency -! REAL(kind_phys) GTCFRC(IJSDIM, KMAX) !< cloud fraction tendency - REAL(kind_phys) GTU (IJSDIM, KMAX) !< u tendency - REAL(kind_phys) GTV (IJSDIM, KMAX) !< v tendency + REAL(kind_phys) GTT (IJSDIM, KMAX) !! temperature tendency + REAL(kind_phys) GTQ (IJSDIM, KMAX, NTR) !! moisture tendency +! REAL(kind_phys) GTCFRC(IJSDIM, KMAX) !! cloud fraction tendency + REAL(kind_phys) GTU (IJSDIM, KMAX) !! u tendency + REAL(kind_phys) GTV (IJSDIM, KMAX) !! v tendency ! ! [INPUT] - REAL(kind_phys) GDH (IJSDIM, KMAX) !< moist static energy - REAL(kind_phys) GDQ (IJSDIM, KMAX, NTR) !< humidity qv -! REAL(kind_phys) GDCFRC(IJSDIM, KMAX) !< cloud fraction + REAL(kind_phys) GDH (IJSDIM, KMAX) !! moist static energy + REAL(kind_phys) GDQ (IJSDIM, KMAX, NTR) !! humidity qv +! REAL(kind_phys) GDCFRC(IJSDIM, KMAX) !! cloud fraction REAL(kind_phys) GDU (IJSDIM, KMAX) REAL(kind_phys) GDV (IJSDIM, KMAX) REAL(kind_phys) DELPI (IJSDIM, KMAX) - REAL(kind_phys) CBMFX (IM, NCTP) !< cloud base mass flux - REAL(kind_phys) GCYT (IJSDIM, NCTP) !< detraining mass flux - REAL(kind_phys) GCHT (IJSDIM, NCTP) !< detraining MSE - REAL(kind_phys) GCQT (IJSDIM, NCTP) !< detraining qv - REAL(kind_phys) GCLT (IJSDIM, NCTP) !< detraining ql - REAL(kind_phys) GCIT (IJSDIM, NCTP) !< detraining qi - REAL(kind_phys) GCtrT (IJSDIM, ntrq:ntr, NCTP)!< detraining tracer - REAL(kind_phys) GCUT (IJSDIM, NCTP) !< detraining u - REAL(kind_phys) GCVT (IJSDIM, NCTP) !< detraining v - REAL(kind_phys) GDQI (IJSDIM, KMAX) !< cloud ice - INTEGER KT (IJSDIM, NCTP) !< cloud top + REAL(kind_phys) CBMFX (IM, NCTP) !! cloud base mass flux + REAL(kind_phys) GCYT (IJSDIM, NCTP) !! detraining mass flux + REAL(kind_phys) GCHT (IJSDIM, NCTP) !! detraining MSE + REAL(kind_phys) GCQT (IJSDIM, NCTP) !! detraining qv + REAL(kind_phys) GCLT (IJSDIM, NCTP) !! detraining ql + REAL(kind_phys) GCIT (IJSDIM, NCTP) !! detraining qi + REAL(kind_phys) GCtrT (IJSDIM, ntrq:ntr, NCTP)!! detraining tracer + REAL(kind_phys) GCUT (IJSDIM, NCTP) !! detraining u + REAL(kind_phys) GCVT (IJSDIM, NCTP) !! detraining v + REAL(kind_phys) GDQI (IJSDIM, KMAX) !! cloud ice + INTEGER KT (IJSDIM, NCTP) !! cloud top INTEGER ISTS, IENS ! ! [INTERNAL WORK] @@ -2745,7 +2959,6 @@ SUBROUTINE CUMDET & !! detrainment ! END SUBROUTINE CUMDET !*********************************************************************** -!>\ingroup cs_scheme SUBROUTINE CUMSBH & !! adiabat. descent ( IM , IJSDIM, KMAX , NTR, ntrq, & !DD dimensions GTT , GTQ , & ! modified @@ -2761,23 +2974,23 @@ SUBROUTINE CUMSBH & !! adiabat. descent INTEGER, INTENT(IN) :: IJSDIM, IM, KMAX, NTR, ntrq !! DD, for GFS, pass in ! ! [MODIFY] - REAL(kind_phys) GTT (IJSDIM, KMAX) !< Temperature tendency - REAL(kind_phys) GTQ (IJSDIM, KMAX, NTR) !< Moisture etc tendency - REAL(kind_phys) GTU (IJSDIM, KMAX) !< u tendency - REAL(kind_phys) GTV (IJSDIM, KMAX) !< v tendency + REAL(kind_phys) GTT (IJSDIM, KMAX) !! Temperature tendency + REAL(kind_phys) GTQ (IJSDIM, KMAX, NTR) !! Moisture etc tendency + REAL(kind_phys) GTU (IJSDIM, KMAX) !! u tendency + REAL(kind_phys) GTV (IJSDIM, KMAX) !! v tendency ! ! [INPUT] REAL(kind_phys) GDH (IJSDIM, KMAX) - REAL(kind_phys) GDQ (IJSDIM, KMAX, NTR) !< humidity etc + REAL(kind_phys) GDQ (IJSDIM, KMAX, NTR) !! humidity etc REAL(kind_phys) GDQI (IJSDIM, KMAX) REAL(kind_phys) GDU (IJSDIM, KMAX) REAL(kind_phys) GDV (IJSDIM, KMAX) REAL(kind_phys) DELPI (IJSDIM, KMAX) - REAL(kind_phys) GMFLX (IJSDIM, KMAX) !< mass flux (updraft+downdraft) - REAL(kind_phys) GMFX0 (IJSDIM, KMAX) !< mass flux (updraft only) - INTEGER KB(IJSDIM) !< cloud base index - negative means no convection + REAL(kind_phys) GMFLX (IJSDIM, KMAX+1) !! mass flux (updraft+downdraft) + REAL(kind_phys) GMFX0 (IJSDIM, KMAX+1) !! mass flux (updraft only) + INTEGER KB(IJSDIM) !! cloud base index - negative means no convection INTEGER KTMX - REAL(kind_phys) CPRES !< pressure factor for cumulus friction + REAL(kind_phys) CPRES !! pressure factor for cumulus friction INTEGER ISTS, IENS ! ! [INTERNAL WORK] @@ -2868,8 +3081,6 @@ END SUBROUTINE CUMSBH !*********************************************************************** ! !*********************************************************************** -!>\ingroup cs_scheme -!! This subroutine calculate cloud subsidence heating. SUBROUTINE CUMSBW & !! adiabat. descent ( IM , IJSDIM, KMAX , & !DD dimensions GTU , GTV , & ! modified @@ -2883,18 +3094,18 @@ SUBROUTINE CUMSBW & !! adiabat. descent INTEGER, INTENT(IN) :: IJSDIM, IM, KMAX!! DD, for GFS, pass in ! ! [MODIFY] - REAL(kind_phys) GTU (IJSDIM, KMAX) !< u tendency - REAL(kind_phys) GTV (IJSDIM, KMAX) !< v tendency + REAL(kind_phys) GTU (IJSDIM, KMAX) !! u tendency + REAL(kind_phys) GTV (IJSDIM, KMAX) !! v tendency ! ! [INPUT] REAL(kind_phys) GDU (IJSDIM, KMAX) REAL(kind_phys) GDV (IJSDIM, KMAX) REAL(kind_phys) DELPI (IJSDIM, KMAX) - REAL(kind_phys) GMFLX (IJSDIM, KMAX) !< mass flux (updraft+downdraft) - REAL(kind_phys) GMFX0 (IJSDIM, KMAX) !< mass flux (updraft only) - INTEGER KB(IJSDIM) !< cloud base index - negative means no convection + REAL(kind_phys) GMFLX (IJSDIM, KMAX+1) !! mass flux (updraft+downdraft) + REAL(kind_phys) GMFX0 (IJSDIM, KMAX+1) !! mass flux (updraft only) + INTEGER KB(IJSDIM) !! cloud base index - negative means no convection INTEGER KTMX, ISTS, IENS - REAL(kind_phys) CPRES !< pressure factor for cumulus friction + REAL(kind_phys) CPRES !! pressure factor for cumulus friction ! ! [INTERNAL WORK] REAL(kind_phys) FX1, SBU0, SBV0, SBU1, SBV1, wrk, wrk1 @@ -2937,142 +3148,145 @@ SUBROUTINE CUMSBW & !! adiabat. descent enddo enddo ! - END SUBROUTINE CUMSBW + END SUBROUTINE CUMSBW!*********************************************************************** !*********************************************************************** -!>\ingroup cs_scheme -!! This subroution calculates freeze, melt and evaporation in cumulus downdraft. - SUBROUTINE CUMDWN & ! Freeze & Melt & Evaporation - ( IM , IJSDIM, KMAX , NTR , ntrq, & !DD dimensions - GTT , GTQ , GTU , GTV , & ! modified - GMFLX , & ! modified - GPRCP , GSNWP , GTEVP , GMDD , & ! output - GPRCI , GSNWI , & ! input - GDH , GDW , GDQ , GDQI , & ! input - GDQS , GDS , GDHS , GDT , & ! input - GDU , GDV , GDZ , & ! input - GDZM , FDQS , DELP , & ! input - DELPI , & - sigmad, do_aw , do_awdd, flx_form, & !DDsigma input - gtmelt, gtevap, gtsubl, & !DDsigma input - dtdwn , dqvdwn, dqldwn, dqidwn, & !DDsigma input - dtrdwn, & - KB , KTMX , ISTS , IENS ) ! input -! -! DD AW : modify to get eddy fluxes and microphysical tendencies for AW +SUBROUTINE CUMDWN & !! Freeze & Melt & Evaporation + ( IM, IJSDIM, KMAX,NTR,ntrq,nctp, & !DD dimensions + GTT , GTQ , GTU , GTV , & ! modified + GMFLX , & ! modified + GPRCP , GSNWP , GTEVP , GMDD , & ! output + GPRCI , GSNWI , & ! input + GDH , GDW , GDQ , GDQI , & ! input + GDQS , GDS , GDHS , GDT , & ! input + GDU , GDV , GDZ , & ! input + GDZM , FDQS , DELP , delpi, & ! input + sigmad, do_aw , do_awdd, flx_form, & ! DDsigma input + gtmelt, gtevap, gtsubl, & !DDsigma input + dtdwn , dqvdwn, dqldwn, dqidwn, & !DDsigma input + dtrdwn, & +! sflux , qvflux, qlflux, qiflux, & !DDsigma input +! trflux, & + KB , KTMX , ISTS , IENS ) ! input +! ! IMPLICIT NONE - INTEGER, INTENT(IN) :: IM, IJSDIM, KMAX, NTR, ntrq ! DD, for GFS, pass in + INTEGER, INTENT(IN) :: IM, IJSDIM, KMAX, NTR , ntrq, nctp !! DD, for GFS, pass in logical, intent(in) :: do_aw, do_awdd, flx_form ! ! [MODIFY] - REAL(kind_phys) GTT (IJSDIM, KMAX) !< Temperature tendency - REAL(kind_phys) GTQ (IJSDIM, KMAX, NTR) !< Moisture etc tendency - REAL(kind_phys) GTU (IJSDIM, KMAX) !< u tendency - REAL(kind_phys) GTV (IJSDIM, KMAX) !< v tendency - REAL(kind_phys) GMFLX (IJSDIM, KMAX) !< mass flux + REAL(kind_phys) GTT ( IJSDIM, KMAX ) !! Temperature tendency + REAL(kind_phys) GTQ ( IJSDIM, KMAX, NTR ) !! Moisture etc tendency + REAL(kind_phys) GTU ( IJSDIM, KMAX ) !! u tendency + REAL(kind_phys) GTV ( IJSDIM, KMAX ) !! v tendency + REAL(kind_phys) GMFLX ( IJSDIM, KMAX+1 ) !! mass flux ! ! [OUTPUT] - REAL(kind_phys) GPRCP (IJSDIM, KMAX) !< rainfall flux - REAL(kind_phys) GSNWP (IJSDIM, KMAX) !< snowfall flux - REAL(kind_phys) GTEVP (IJSDIM, KMAX) !< evaporation+sublimation - REAL(kind_phys) GMDD (IJSDIM, KMAX) !< downdraft mass flux - -!AW microphysical tendencies - REAL(kind_phys) gtmelt (IJSDIM, KMAX) !< t tendency ice-liq - REAL(kind_phys) gtevap (IJSDIM, KMAX) !< t tendency liq-vapor - REAL(kind_phys) gtsubl (IJSDIM, KMAX) !< t tendency ice-vapor -!AW eddy flux tendencies - REAL(kind_phys) dtdwn (IJSDIM, KMAX) !< t tendency downdraft detrainment - REAL(kind_phys) dqvdwn (IJSDIM, KMAX) !< qv tendency downdraft detrainment - REAL(kind_phys) dqldwn (IJSDIM, KMAX) !< ql tendency downdraft detrainment - REAL(kind_phys) dqidwn (IJSDIM, KMAX) !< qi tendency downdraft detrainment - REAL(kind_phys) dtrdwn (IJSDIM, KMAX, ntrq:ntr) !< tracer tendency downdraft detrainment -! AW downdraft area fraction (assumed zero for now) - REAL(kind_phys) sigmad (IJSDIM,KMAX) !< DDsigma cloud downdraft area fraction - + REAL(kind_phys) GPRCP ( IJSDIM, KMAX+1 ) !! rainfall flux + REAL(kind_phys) GSNWP ( IJSDIM, KMAX+1 ) !! snowfall flux + REAL(kind_phys) GTEVP ( IJSDIM, KMAX ) !! evaporation+sublimation + REAL(kind_phys) GMDD ( IJSDIM, KMAX+1 ) !! downdraft mass flux + REAL(kind_phys) gtmelt ( IJSDIM, KMAX ) !! t tendency ice-liq + REAL(kind_phys) gtevap ( IJSDIM, KMAX ) !! t tendency liq-vapor + REAL(kind_phys) gtsubl ( IJSDIM, KMAX ) !! t tendency ice-vapor + REAL(kind_phys) dtdwn ( IJSDIM, KMAX ) !! t tendency downdraft ! detrainment + REAL(kind_phys) dqvdwn ( IJSDIM, KMAX ) !! qv tendency downdraft ! detrainment + REAL(kind_phys) dqldwn ( IJSDIM, KMAX ) !! ql tendency downdraft ! detrainment + REAL(kind_phys) dqidwn ( IJSDIM, KMAX ) !! qi tendency downdraft ! detrainment + REAL(kind_phys) dtrdwn (IJSDIM, KMAX, ntrq:ntr) ! tracer tendency ! downdraft detrainment +! REAL(kind_phys) sflux ( IJSDIM, KMAX+1 ) !! t interface flux - already zero in calling routine +! REAL(kind_phys) qvflux ( IJSDIM, KMAX+1 ) !! qv interface flux +! REAL(kind_phys) qlflux ( IJSDIM, KMAX+1 ) !! ql interface flux +! REAL(kind_phys) qiflux ( IJSDIM, KMAX+1 ) !! qi interface flux +! REAL(kind_phys) trflux (IJSDIM, KMAX+1, ntrq:ntr) ! tracer tendency downdraft detrainment ! [INPUT] - REAL(kind_phys) GPRCI (IJSDIM, KMAX) !< rainfall generation - REAL(kind_phys) GSNWI (IJSDIM, KMAX) !< snowfall generation - REAL(kind_phys) GDH (IJSDIM, KMAX) !< moist static energy - REAL(kind_phys) GDW (IJSDIM, KMAX) !< total water - REAL(kind_phys) GDQ (IJSDIM, KMAX, NTR) !< humidity etc - REAL(kind_phys) GDQI (IJSDIM, KMAX) !< cloud ice - REAL(kind_phys) GDQS (IJSDIM, KMAX) !< saturate humidity - REAL(kind_phys) GDS (IJSDIM, KMAX) !< dry static energy - REAL(kind_phys) GDHS (IJSDIM, KMAX) !< saturate moist static energy - REAL(kind_phys) GDT (IJSDIM, KMAX) !< air temperature T - REAL(kind_phys) GDU (IJSDIM, KMAX) !< u-velocity - REAL(kind_phys) GDV (IJSDIM, KMAX) !< v-velocity - REAL(kind_phys) GDZ (IJSDIM, KMAX) !< altitude - REAL(kind_phys) GDZM (IJSDIM, KMAX+1) !< altitude (half lev) - REAL(kind_phys) FDQS (IJSDIM, KMAX) - REAL(kind_phys) DELP (IJSDIM, KMAX) + REAL(kind_phys) GPRCI ( IJSDIM, KMAX ) !! rainfall generation + REAL(kind_phys) GSNWI ( IJSDIM, KMAX ) !! snowfall generation + REAL(kind_phys) GDH ( IJSDIM, KMAX ) !! moist static energy + REAL(kind_phys) GDW ( IJSDIM, KMAX ) !! total water + REAL(kind_phys) GDQ ( IJSDIM, KMAX, NTR ) !! humidity etc + REAL(kind_phys) GDQI ( IJSDIM, KMAX ) !! cloud ice + REAL(kind_phys) GDQS ( IJSDIM, KMAX ) !! saturate humidity + REAL(kind_phys) GDS ( IJSDIM, KMAX ) !! dry static energy + REAL(kind_phys) GDHS ( IJSDIM, KMAX ) !! saturate moist static energy + REAL(kind_phys) GDT ( IJSDIM, KMAX ) !! air temperature T + REAL(kind_phys) GDU ( IJSDIM, KMAX ) !! u-velocity + REAL(kind_phys) GDV ( IJSDIM, KMAX ) !! v-velocity + REAL(kind_phys) GDZ ( IJSDIM, KMAX ) !! altitude + REAL(kind_phys) GDZM ( IJSDIM, KMAX+1 ) !! altitude (half lev) + REAL(kind_phys) FDQS ( IJSDIM, KMAX ) + REAL(kind_phys) DELP ( IJSDIM, KMAX ) REAL(kind_phys) DELPI (IJSDIM, KMAX) - INTEGER KB (IJSDIM) - INTEGER KTMX, ISTS, IENS + INTEGER KB ( IJSDIM ) + INTEGER KTMX + INTEGER ISTS, IENS + REAL(kind_phys) sigmad (IM,KMAX+1) !!DDsigma cloud downdraft area fraction ! ! [INTERNAL WORK] -! Note: Some variables have 3-dimensions for the purpose of budget check. - REAL(kind_phys) EVAPD (IJSDIM, KMAX) !< evap. in downdraft - REAL(kind_phys) SUBLD (IJSDIM, KMAX) !< subl. in downdraft - REAL(kind_phys) EVAPE (IJSDIM, KMAX) !< evap. in environment - REAL(kind_phys) SUBLE (IJSDIM, KMAX) !< subl. in environment - REAL(kind_phys) EVAPX (IJSDIM, KMAX) !< evap. env. to DD - REAL(kind_phys) SUBLX (IJSDIM, KMAX) !< subl. env. to DD - REAL(kind_phys) GMDDE (IJSDIM, KMAX) !< downdraft entrainment - REAL(kind_phys) SNMLT (IJSDIM, KMAX) !< melt - freeze - REAL(kind_phys) GCHDD (IJSDIM, KMAX) !< MSE detrainment - REAL(kind_phys) GCWDD (IJSDIM, KMAX) !< water detrainment - REAL(kind_phys) GTTEV (IJSDIM, KMAX) !< T tendency by evaporation - REAL(kind_phys) GTQEV (IJSDIM, KMAX) !< q tendency by evaporation - REAL(kind_phys) GCHD (ISTS:IENS) !< downdraft MSE - REAL(kind_phys) GCWD (ISTS:IENS) !< downdraft q -! profiles of downdraft variables for AW flux tendencies - REAL(kind_phys) GCdseD(ISTS:IENS, KMAX) !< downdraft dse - REAL(kind_phys) GCqvD (ISTS:IENS, KMAX) !< downdraft qv -! REAL(kind_phys) GCqlD (ISTS:IENS, KMAX) !< downdraft ql -! REAL(kind_phys) GCqiD (ISTS:IENS, KMAX) !< downdraft qi - REAL(kind_phys) GCtrD (ISTS:IENS, ntrq:ntr) !< downdraft tracer - - REAL(kind_phys) GCUD (ISTS:IENS) !< downdraft u - REAL(kind_phys) GCVD (ISTS:IENS) !< downdraft v - REAL(kind_phys) FSNOW (ISTS:IENS) - REAL(kind_phys) GMDDD (ISTS:IENS) - - REAL(kind_phys) GDTW, GCHX, GCTX, GCQSX, GTPRP, EVSU, GTEVE, LVIC, & - DQW, DTW, GDQW, DZ, GCSD, FDET, GDHI, GMDDX, & - GMDDMX, GCHDX, GCWDX, GCUDD, GCVDD, GTHCI, GTQVCI, & - wrk, wrk1, wrk2, wrk3, wrk4, tx1, & - WMX, HMX, DDWMX, DDHMX, dp_above, dp_below, fsigma, & - fmelt, fevp, wrkn, gctrdd(ntrq:ntr) - +! Note: Some variables have 3-dimensions for the purpose of budget ! check. + REAL(kind_phys) EVAPD ( IJSDIM, KMAX ) !! evap. in downdraft + REAL(kind_phys) SUBLD ( IJSDIM, KMAX ) !! subl. in downdraft + REAL(kind_phys) EVAPE ( IJSDIM, KMAX ) !! evap. in environment + REAL(kind_phys) SUBLE ( IJSDIM, KMAX ) !! subl. in environment + REAL(kind_phys) EVAPX ( IJSDIM, KMAX ) !! evap. env. to DD + REAL(kind_phys) SUBLX ( IJSDIM, KMAX ) !! subl. env. to DD + REAL(kind_phys) GMDDE ( IJSDIM, KMAX ) !! downdraft entrainment + REAL(kind_phys) SNMLT ( IJSDIM, KMAX ) !! melt - freeze + REAL(kind_phys) GCHDD ( IJSDIM, KMAX ) !! MSE detrainment + REAL(kind_phys) GCWDD ( IJSDIM, KMAX ) !! water detrainment + REAL(kind_phys) GTTEV ( IJSDIM, KMAX ) !! T tendency by evaporation + REAL(kind_phys) GTQEV ( IJSDIM, KMAX ) !! q tendency by evaporation + REAL(kind_phys) GCHD ( ISTS:IENS ) !! downdraft MSE + REAL(kind_phys) GCWD ( ISTS:IENS ) !! downdraft q + REAL(kind_phys) GCdseD ( ISTS:IENS, KMAX ) !! downdraft dse + REAL(kind_phys) GCqvD ( ISTS:IENS, KMAX ) !! downdraft qv + REAL(kind_phys) GCqlD ( ISTS:IENS, KMAX ) !! downdraft ql + REAL(kind_phys) GCqiD ( ISTS:IENS, KMAX ) !! downdraft qi + REAL(kind_phys) GCtrD (ISTS:IENS, ntrq:ntr) ! downdraft tracer + REAL(kind_phys) GCUD ( ISTS:IENS ) !! downdraft u + REAL(kind_phys) GCVD ( ISTS:IENS ) !! downdraft v + REAL(kind_phys) FSNOW ( ISTS:IENS ) + REAL(kind_phys) GMDDD ( ISTS:IENS ) + INTEGER I, K + REAL(kind_phys) GDTW + REAL(kind_phys) GCHX, GCTX, GCQSX, GTPRP, EVSU, GTEVE, LVIC + REAL(kind_phys) DQW, DTW, GDQW, DZ, GCSD, FDET, GDHI + REAL(kind_phys) GMDDX, GMDDMX + REAL(kind_phys) GCHDX, GCWDX + REAL(kind_phys) GCUDD, GCVDD + REAL(kind_phys) GTHCI, GTQVCI, GTQLCI, GTQICI !M REAL(kind_phys) GTHCI, GTQVCI, GTQLCI, GTQICI, GTUCI, GTVCI + real(kind_phys) wrk, fmelt, fevp, gctrdd(ntrq:ntr) !DD#ifdef OPT_CUMBGT -! Water, energy, downdraft water and downdraft energy budgets -! REAL(kind_phys), dimension(ISTS:IENS) :: WBGT, HBGT, DDWBGT, DDHBGT - integer ij, i, k, kp1, n + REAL(kind_phys) WBGT ( ISTS:IENS ) !! water budget + REAL(kind_phys) HBGT ( ISTS:IENS ) !! energy budget + REAL(kind_phys) DDWBGT( ISTS:IENS ) !! downdraft water budget + REAL(kind_phys) DDHBGT( ISTS:IENS ) !! downdraft energy budget + REAL(kind_phys) WMX, HMX, DDWMX, DDHMX, tx1, wrk1, wrk2, wrk3, wrk4, wrkn + REAL(kind_phys) dp_above, dp_below + real(kind_phys) fsigma + integer ij, n, kp1 !DD#endif ! ! [INTERNAL PARM] - REAL(kind_phys), parameter :: TWSNOW = 273.15_kind_phys !< wet-bulb temp. rain/snow - REAL(kind_phys), parameter :: FTMLT = 4._kind_phys !< temp. factor for melt - REAL(kind_phys), parameter :: GMFLXC = 5.e-2_kind_phys !< critical mass flux - REAL(kind_phys), parameter :: VTERMS = 2._kind_phys !< terminal velocity of snowflake -! REAL(kind_phys), parameter :: MELTAU = 10._kind_phys !< melting timescale - REAL(kind_phys), parameter :: MELTAU = 20._kind_phys !< melting timescale ! Moorthi june 30, 2017 -! -! REAL(kind_phys), parameter :: EVAPR = 0.4_kind_phys !< evaporation factor ! Moorthi June 28, 2017 - REAL(kind_phys), parameter :: EVAPR = 0.3_kind_phys !< evaporation factor -! REAL(kind_phys), parameter :: EVAPR = 0._kind_phys !< evaporation factor - REAL(kind_phys), parameter :: REVPDD = 1._kind_phys !< max rate of DD to evapolation - REAL(kind_phys), parameter :: RDDR = 5.e-4_kind_phys !< DD rate (T0 R0 W0)^-1 -! REAL(kind_phys), parameter :: RDDR = 0._kind_phys !< DD rate (T0 R0 W0)^-1 - REAL(kind_phys), parameter :: RDDMX = 0.5_kind_phys !< norm. flux of downdraft - REAL(kind_phys), parameter :: VTERM = 5._kind_phys !< term. vel. of precip. -! REAL(kind_phys), parameter :: VTERM = 4._kind_phys !< term. vel. of precip. ! Moorthi June 28, 2017 - REAL(kind_phys), parameter :: EVATAU = 2._kind_phys !< evaporation/sublimation timescale - REAL(kind_phys), parameter :: ZDMIN = 5.e2_kind_phys !< min altitude of downdraft detrainment + REAL(kind_phys), parameter :: TWSNOW = 273.15_kind_phys ! wet-bulb temp. rain/snow + REAL(kind_phys), parameter :: FTMLT = 4._kind_phys ! temp. factor for melt + REAL(kind_phys), parameter :: GMFLXC = 5.e-2_kind_phys ! critical mass flux + REAL(kind_phys), parameter :: VTERMS = 2._kind_phys ! terminal velocity of snowflake +! REAL(kind_phys), parameter :: MELTAU = 10._kind_phys ! melting timescale + REAL(kind_phys), parameter :: MELTAU = 20._kind_phys ! melting timescale ! Moorthi june 30, 2017 +! +! REAL(kind_phys), parameter :: EVAPR = 0.4_kind_phys ! evaporation factor ! ! Moorthi June 28, 2017 + REAL(kind_phys), parameter :: EVAPR = 0.3_kind_phys ! evaporation factor +! REAL(kind_phys), parameter :: EVAPR = 0._kind_phys ! evaporation factor + REAL(kind_phys), parameter :: REVPDD = 1._kind_phys ! max rate of DD to evapolation + REAL(kind_phys), parameter :: RDDR = 5.e-4_kind_phys ! DD rate (T0 R0 W0)^-1 +! REAL(kind_phys), parameter :: RDDR = 0._kind_phys ! DD rate (T0 R0 ! W0)^-1 + REAL(kind_phys), parameter :: RDDMX = 0.5_kind_phys ! norm. flux of downdraft + REAL(kind_phys), parameter :: VTERM = 5._kind_phys ! term. vel. of precip. +! REAL(kind_phys), parameter :: VTERM = 4._kind_phys ! term. vel. of ! precip. ! Moorthi June 28, 2017 + REAL(kind_phys), parameter :: EVATAU = 2._kind_phys ! evaporation/sublimation timescale + REAL(kind_phys), parameter :: ZDMIN = 5.e2_kind_phys ! min altitude of downdraft detrainment real(kind_phys), parameter :: evapovtrm=EVAPR/VTERM !NOTE @@ -3089,66 +3303,43 @@ SUBROUTINE CUMDWN & ! Freeze & Melt & Evaporation GMDD (I,k) = zero GTEVP (I,k) = zero EVAPD (I,k) = zero - SUBLD (I,k) = zero - EVAPE (I,k) = zero - SUBLE (I,k) = zero - EVAPX (I,k) = zero - SUBLX (I,k) = zero - GMDDE (I,k) = zero - SNMLT (I,k) = zero - GCHDD (I,k) = zero - GCWDD (I,k) = zero - GTTEV (I,k) = zero - GTQEV (I,k) = zero - GCdseD(I,k) = zero - GCqvD (I,k) = zero -! GCqlD (I,k) = zero -! GCqiD (I,k) = zero - gtevap(I,k) = zero - gtmelt(I,k) = zero - gtsubl(I,k) = zero + SUBLD (I,k) = zero + EVAPE (I,k) = zero + SUBLE (I,k) = zero + EVAPX (I,k) = zero + SUBLX (I,k) = zero + GMDDE (I,k) = zero + SNMLT (I,k) = zero + GCHDD (I,k) = zero + GCWDD (I,k) = zero + GTTEV (I,k) = zero + GTQEV (I,k) = zero + GCdseD(I,k) = zero + GCqvD (I,k) = zero +! GCqlD (I,k) = zero +! GCqiD (I,k) = zero + gtevap(I,k) = zero + gtmelt(I,k) = zero + gtsubl(I,k) = zero enddo enddo -! testing on oct 17 2016 - if (flx_form) then - if (.not. do_awdd) then - do k=1,kmax - do i=ists,iens - if (kb(i) > 0) then - dtdwn (i,k) = gtt(i,k) - dqvdwn(i,k) = gtq(i,k,1) - dqldwn(i,k) = gtq(i,k,itl) - dqidwn(i,k) = gtq(i,k,iti) - endif - enddo - enddo - do n=ntrq,ntr - do k=1,kmax - do i=ists,iens - if (kb(i) > 0) then - dtrdwn(i,k,n) = gtq(i,k,n) - endif - enddo - enddo - enddo - else - do k=1,kmax - do i=ists,iens - dtdwn (I,k) = zero - dqvdwn(I,k) = zero - dqldwn(I,k) = zero - dqidwn(I,k) = zero - enddo - enddo - do n=ntrq,ntr - do k=1,kmax - do i=ists,iens - dtrdwn(i,k,n) = zero - enddo - enddo - enddo - endif - endif + +! These are zeroed by the calling routine, cs_cumlus +! do k=1,kmax +! do i=ists,iens +! dtdwn (I,k) = zero +! dqvdwn(I,k) = zero +! dqldwn(I,k) = zero +! dqidwn(I,k) = zero +! enddo +! enddo +! do n=ntrq,ntr +! do k=1,kmax +! do i=ists,iens +! dtrdwn(i,k,n) = zero +! enddo +! enddo +! enddo ! do i=ists,iens GCHD(I) = zero @@ -3158,10 +3349,10 @@ SUBROUTINE CUMDWN & ! Freeze & Melt & Evaporation enddo do n=ntrq,ntr do i=ists,iens - GCtrD (I,n) = zero + GCtrD (I,n) = zero enddo enddo -! + DO K=KTMX,1,-1 ! loop A kp1 = min(k+1,kmax) ! @@ -3178,24 +3369,24 @@ SUBROUTINE CUMDWN & ! Freeze & Melt & Evaporation LVIC = ELocp + EMELTocp*FSNOW(I) GDTW = GDT(I,K) - LVIC*(GDQS(I,K) - GDQ(I,K,1)) & / (one + LVIC*FDQS(I,K)) + + DZ = GDZM(I,KP1) - GDZM(I,K) + FMELT = (one + FTMLT*(GDTW - TWSNOW)) & + * (one - TANH(GMFLX(I,KP1)/GMFLXC)) & + * (one - TANH(VTERMS*MELTAU/DZ)) IF (GDTW < TWSNOW) THEN - GSNWP(I,K) = GSNWP(I,KP1) + GPRCI(I,K) + GSNWI(I,K) - GTTEV(I,K) = EMELToCP * GPRCI(I,K) * DELPI(I,K) - SNMLT(I,K) = -GPRCI(I,K) + SNMLT(I,K) = GPRCP(I,KP1)*min(max(FMELT, one), zero) ELSE - DZ = GDZM(I,KP1) - GDZM(I,K) - FMELT = (one + FTMLT*(GDTW - TWSNOW)) & - * (one - TANH(GMFLX(I,KP1)/GMFLXC)) & - * (one - TANH(VTERMS*MELTAU/DZ)) SNMLT(I,K) = GSNWP(I,KP1)*max(min(FMELT, one), zero) - GSNWP(I,K) = GSNWP(I,KP1)+GSNWI(I,K) - SNMLT(I,K) - GPRCP(I,K) = GPRCP(I,KP1)+GPRCI(I,K) + SNMLT(I,K) - GTTEV(I,K) = -EMELToCP * SNMLT(I,K) * DELPI(I,K) ENDIF + GSNWP(I,K) = GSNWP(I,KP1)+GSNWI(I,K) - SNMLT(I,K) + GPRCP(I,K) = GPRCP(I,KP1)+GPRCI(I,K) + SNMLT(I,K) + GTTEV(I,K) = -EMELToCP * SNMLT(I,K) * DELPI(I,K) !DD heating rate due to precip melting for AW gtmelt(i,k) = gtmelt(i,k) + GTTEV(I,K) endif ENDDO + ! ! < downdraft > ! @@ -3341,7 +3532,7 @@ SUBROUTINE CUMDWN & ! Freeze & Melt & Evaporation if (kb(i) > 0) then wrk = DELPI(I,k) tx1 = DELPI(I,kp1) - + GTTEV(I,K) = GTTEV(I,K) - wrk & * (ELocp*EVAPE(I,K)+(ELocp+EMELTocp)*SUBLE(I,K)) GTT(I,K) = GTT(I,K) + GTTEV(I,K) @@ -3350,29 +3541,41 @@ SUBROUTINE CUMDWN & ! Freeze & Melt & Evaporation GTQ(I,K,1) = GTQ(I,K,1) + GTQEV(I,K) ! GMFLX(I,K) = GMFLX(I,K) - GMDD(I,K) + endif + ENDDO ! end of i loop + ENDDO ! end of k loop ! AW tendencies due to vertical divergence of eddy fluxes + DO K=2,KTMX + kp1 = min(k+1,kmax) + DO I=ISTS,IENS + if (kb(i) > 0) then if (k > 1 .and. flx_form) then fsigma = one - sigmad(i,kp1) dp_below = wrk * (one - sigmad(i,k)) dp_above = tx1 * (one - sigmad(i,kp1)) - wrk1 = gmdd(i,kp1) * (gdt(i,k)+gocp*gdz(i,k)) - gcdsed(i,kp1)*oneocp + wrk1 = gmdd(i,kp1) * (gdt(i,k)+gocp*gdz(i,k)) - gcdsed(i,kp1)*oneocp wrk2 = gmdd(i,kp1) * gdq(i,k,1) - gcqvd(i,kp1) wrk3 = gmdd(i,kp1) * gdq(i,k,itl) wrk4 = gmdd(i,kp1) * gdqi(i,k) +! sflux(i,k) = gmdd(i,kp1) * (gdt(i,k)+gocp*gdz(i,k)) - gcdsed(i,kp1)*oneocp +! qvflux(i,k) = gmdd(i,kp1) * gdq(i,k,1) - gcqvd(i,kp1) +! qlflux(i,k) = gmdd(i,kp1) * gdq(i,k,itl) +! qiflux(i,k) = gmdd(i,kp1) * gdqi(i,k) dtdwn(i,k) = dtdwn(i,k) + dp_below * wrk1 dqvdwn(i,k) = dqvdwn(i,k) + dp_below * wrk2 - dqldwn(i,k) = dqldwn(i,k) + dp_below * wrk3 ! gcqld=0 - gcqld(i,k)) - dqidwn(i,k) = dqidwn(i,k) + dp_below * wrk4 ! gcqid=0 - gcqid(i,k)) + dqldwn(i,k) = dqldwn(i,k) + dp_below * wrk3 ! gcqld=0 ! - gcqld(i,k)) + dqidwn(i,k) = dqidwn(i,k) + dp_below * wrk4 ! gcqid=0 ! - gcqid(i,k)) dtdwn(i,kp1) = dtdwn(i,kp1) - dp_above * wrk1 dqvdwn(i,kp1) = dqvdwn(i,kp1) - dp_above * wrk2 - dqldwn(i,kp1) = dqldwn(i,kp1) - dp_above * wrk3 ! gcqld=0 - gcqld(i,k)) - dqidwn(i,kp1) = dqidwn(i,kp1) - dp_above * wrk4 ! gcqid=0 - gcqid(i,k)) + dqldwn(i,kp1) = dqldwn(i,kp1) - dp_above * wrk3 ! gcqld=0 ! - gcqld(i,k)) + dqidwn(i,kp1) = dqidwn(i,kp1) - dp_above * wrk4 ! gcqid=0 ! - gcqid(i,k)) do n = ntrq,ntr wrkn = gmdd(i,kp1) * gdq(i,k,n) +! trflux(i,k,n) = gmdd(i,kp1) * gdq(i,k,n) dtrdwn(i,k,n) = dtrdwn(i,k,n) + dp_below * wrkn dtrdwn(i,kp1,n) = dtrdwn(i,kp1,n) - dp_above * wrkn enddo @@ -3381,101 +3584,133 @@ SUBROUTINE CUMDWN & ! Freeze & Melt & Evaporation endif ENDDO ! end of i loop ENDDO ! end of k loop -! - if (.not. do_awdd .and. flx_form) then - do k=1,kmax - do i=ists,iens - if (kb(i) > 0) then - dtdwn(i,k) = gtt(i,k) - dtdwn(i,k) - dqvdwn(i,k) = gtq(i,k,1) - dqvdwn(i,k) - dqldwn(i,k) = gtq(i,k,itl) - dqldwn(i,k) - dqidwn(i,k) = gtq(i,k,iti) - dqidwn(i,k) - endif - enddo - enddo - do n=ntrq,ntr - do k=1,kmax - do i=ists,iens - if (kb(i) > 0) then - dtrdwn(i,k,n) = gtq(i,k,n) - dtrdwn(i,k,n) - endif - enddo - enddo - enddo - endif ! END SUBROUTINE CUMDWN +! !*********************************************************************** -!>\ingroup cs_scheme -!> This subroutine computes cumulus cloudiness. - SUBROUTINE CUMCLD & !! cloudiness + SUBROUTINE CUMCLD & !! cloudiness ( IJSDIM, KMAX , & !DD dimensions CUMCLW, QLIQ , QICE , FLIQC , & ! modified CUMFRC, & ! output +!#ifdef OPT_CHASER +! M LEVCUM, LNFRC , ! <> +! I TOPFLX, ! <> +!#endif GMFLX , KTMX , ISTS, IENS ) ! input +! +!DD use ppgrid , only: IJSDIM => pcols, KMAX => pver ! IMPLICIT NONE - INTEGER, INTENT(IN) :: IJSDIM, KMAX ! DD, for GFS, pass in + INTEGER, INTENT(IN) :: IJSDIM, KMAX !! DD, for GFS, pass in ! ! [OUTPUT] - REAL(kind_phys) CUMFRC(IJSDIM) !< cumulus cloud fraction + REAL(kind_phys) CUMFRC( IJSDIM ) !! cumulus cloud fraction ! ! [MODIFY] - REAL(kind_phys) CUMCLW(IJSDIM, KMAX) !< cloud water in cumulus - REAL(kind_phys) QLIQ (IJSDIM, KMAX) !< cloud liquid - REAL(kind_phys) QICE (IJSDIM, KMAX) !< cloud ice - REAL(kind_phys) FLIQC (IJSDIM, KMAX) !< liquid ratio in cumulus + REAL(kind_phys) CUMCLW( IJSDIM, KMAX ) !! cloud water in cumulus + REAL(kind_phys) QLIQ ( IJSDIM, KMAX ) !! cloud liquid + REAL(kind_phys) QICE ( IJSDIM, KMAX ) !! cloud ice + REAL(kind_phys) FLIQC ( IJSDIM, KMAX ) !! liquid ratio in cumulus +!#ifdef OPT_CHASER +! INTEGER LEVCUM( IJSDIM, KMAX ) !! +! REAL(kind_phys) LNFRC ( IJSDIM, KMAX ) !! fraction of each cloud +!#endif ! ! [INPUT] - REAL(kind_phys) GMFLX (IJSDIM, KMAX) ! cumulus mass flux + REAL(kind_phys) GMFLX ( IJSDIM, KMAX+1 ) !! cumulus mass flux INTEGER KTMX +!#ifdef OPT_CHASER +! REAL(kind_phys) TOPFLX( IJSDIM, NCTP ) !! mass flux at each cloud top +!#endif INTEGER ISTS, IENS ! ! [WORK] INTEGER I, K REAL(kind_phys) CUMF, QC, wrk +!#ifdef OPT_CHASER +! REAL(kind_phys) SNFRC( ISTS:IENS ) +! REAL(kind_phys) LNF +!#endif + LOGICAL, SAVE :: OFIRST = .TRUE. ! ! [INTERNAL PARAM] - REAL(kind_phys), parameter :: CMFMIN = 2.e-3_kind_phys, &!< Mc->cloudiness - CMFMAX = 3.e-1_kind_phys, &!< Mc->cloudiness - CLMIN = 1.e-3_kind_phys, &!< cloudiness Min. - CLMAX = 0.1_kind_phys, &!< cloudiness Max. - FACLW = 0.1_kind_phys, &!< Mc->CLW - FACLF = (CLMAX-CLMIN)/LOG(CMFMAX/CMFMIN) -! - CUMFRC(ISTS:IENS) = zero - DO K=1,KTMX - DO I=ISTS,IENS - CUMFRC(I) = MAX(CUMFRC(I), GMFLX(I,K)) - ENDDO - ENDDO - DO I=ISTS,IENS - IF (CUMFRC(I) > zero) THEN - CUMF = LOG(MAX(CUMFRC(I), CMFMIN)/CMFMIN) - CUMFRC(I) = MIN(FACLF*CUMF+CLMIN, CLMAX) - ENDIF - ENDDO -! - DO K=1,KTMX - DO I=ISTS,IENS - IF (GMFLX(I,K) > zero) THEN - wrk = FACLW / GMFLX(I,K) * CUMFRC(I) - QLIQ (I,K) = wrk * QLIQ(I,K) - QICE (I,K) = wrk * QICE(I,K) - CUMCLW(I,K) = wrk * CUMCLW(I,K) - QC = QLIQ(I,K) + QICE(I,K) - IF (QC > zero) THEN - FLIQC(I,K) = QLIQ(I,K) / QC - ENDIF - ENDIF - ENDDO - ENDDO + REAL(kind_phys) :: FACLW = 0.1_kind_phys !! Mc->CLW + REAL(kind_phys) :: CMFMIN = 2.e-3_kind_phys !! Mc->cloudiness + REAL(kind_phys) :: CMFMAX = 3.e-1_kind_phys !! Mc->cloudiness + REAL(kind_phys) :: CLMIN = 1.e-3_kind_phys !! cloudiness Min. + REAL(kind_phys) :: CLMAX = 0.1_kind_phys !! cloudiness Max. + REAL(kind_phys), SAVE :: FACLF +! + IF ( OFIRST ) THEN + FACLF = (CLMAX-CLMIN)/LOG(CMFMAX/CMFMIN) + OFIRST = .FALSE. + END IF +! + CUMFRC( ISTS:IENS ) = 0.D0 + DO K = 1, KTMX + DO I = ISTS, IENS + CUMFRC( I ) = MAX( CUMFRC( I ), GMFLX( I,K ) ) + END DO + END DO + DO I = ISTS, IENS + IF ( CUMFRC( I ) > 0.D0 ) THEN + CUMF = LOG( MAX( CUMFRC( I ),CMFMIN )/CMFMIN ) + CUMFRC( I ) = MIN( FACLF*CUMF+CLMIN, CLMAX ) + END IF + END DO +! + DO K = 1, KTMX + DO I = ISTS, IENS + IF ( GMFLX(I,K) > 0.D0 ) THEN + wrk = FACLW / GMFLX( I,K) * CUMFRC(I) + QLIQ (I,K) = wrk * QLIQ(I,K) + QICE (I,K) = wrk * QICE(I,K) + CUMCLW(I,K) = wrk * CUMCLW( I,K ) + QC = QLIQ( I,K ) + QICE( I,K ) + IF ( QC > 0.D0 ) THEN + FLIQC( I,K ) = QLIQ( I,K ) / QC + END IF + END IF + END DO + END DO +! +!#ifdef OPT_CHASER +! = <> ======================================================== +! +! DO 3100 K = 1 , KTMX +! DO 3100 I = ISTS , IENS +! IF ( TOPFLX( I,K ) .GT. CMFMIN*1.D-2 ) THEN +! LEVCUM( I,K ) = 1 +! END IF +! +! IF ( TOPFLX( I,K ) .GT. 0. ) THEN +! LNF = LOG( MAX(TOPFLX( I,K ),CMFMIN)/CMFMIN ) +! LNFRC( I,K ) = MIN( FACLF*LNF+CLMIN, CLMAX ) +! END IF +! 3100 CONTINUE +! +! DO I = ISTS, IENS +! SNFRC( I ) = 0.D0 +! END DO +! +! DO K = 1 , KTMX +! DO I = ISTS , IENS +! SNFRC( I ) = SNFRC( I ) + LNFRC( I,K ) +! END DO +! END DO +! +! DO K = 1 , KTMX +! DO I = ISTS , IENS +! IF ( SNFRC( I ) .GT. 0.D0 ) THEN +! LNFRC( I,K ) = LNFRC( I,K )*CUMFRC( I )/ SNFRC( I ) +! END IF +! END DO +! END DO +!#endif /* OPT_CHASER */ ! END SUBROUTINE CUMCLD !*********************************************************************** -!>\ingroup cs_scheme -!! This subroutine calculates SUBROUTINE CUMUPR & !! Tracer Updraft ( im , IJSDIM, KMAX , NTR , & !DD dimensions GTR , GPRCC , & ! modified @@ -3616,7 +3851,6 @@ SUBROUTINE CUMUPR & !! Tracer Updraft ! END SUBROUTINE CUMUPR !*********************************************************************** -!>\ingroup cs_scheme SUBROUTINE CUMDNR & !! Tracer Downdraft ( IM , IJSDIM, KMAX , NTR , & !DD dimensions GTR , & ! modified @@ -3666,62 +3900,68 @@ SUBROUTINE CUMDNR & !! Tracer Downdraft ! END SUBROUTINE CUMDNR !*********************************************************************** -!>\ingroup cs_scheme SUBROUTINE CUMSBR & !! Tracer Subsidence - ( IM , IJSDIM, KMAX , NTR , & !DD dimensions + ( IM , IJSDIM, KMAX, NTR, NCTP, & !DD dimensions GTR , & ! modified - GDR , DELPI , & ! input + GDR , DELP , & ! input GMFLX , KTMX , OTSPT , & ! input - ISTS, IENS ) ! input + sigmai , sigma , & !DDsigma input + ISTS, IENS ) ! input +! +!DD use ppgrid , only: IJSDIM => pcols, KMAX => pver +!DD use constituents, only: NTR => pcnst ! IMPLICIT NONE - INTEGER, INTENT(IN) :: IM, IJSDIM, KMAX, NTR !! DD, for GFS, pass in + INTEGER, INTENT(IN) :: IM, IJSDIM, KMAX, NTR, nctp !! DD, for GFS, pass in ! ! [MODIFY] - REAL(kind_phys) GTR (IJSDIM, KMAX, NTR) !! tracer tendency + REAL(kind_phys) GTR ( IJSDIM, KMAX, NTR ) !! tracer tendency ! ! [INPUT] - REAL(kind_phys) GDR (IJSDIM, KMAX, NTR) !! tracer - REAL(kind_phys) DELPI (IJSDIM, KMAX) - REAL(kind_phys) GMFLX (IJSDIM, KMAX) !! mass flux + REAL(kind_phys) GDR ( IJSDIM, KMAX, NTR ) !! tracer + REAL(kind_phys) DELP ( IJSDIM, KMAX ) + REAL(kind_phys) GMFLX ( IJSDIM, KMAX+1 ) !! mass flux INTEGER KTMX - LOGICAL OTSPT (NTR) !! tracer transport on/off + LOGICAL OTSPT ( NTR ) !! tracer transport on/off INTEGER ISTS, IENS + REAL(kind_phys) sigmai (IM,KMAX+1,NCTP), sigma(IM,KMAX+1) !!DDsigma cloud updraft fraction ! ! [INTERNAL WORK] INTEGER I, K, KM, KP, LT REAL(kind_phys) SBR0, SBR1, FX1 - REAL(kind_phys) FX(ISTS:IENS) + REAL(kind_phys) FX ( ISTS:IENS ) ! - DO LT=1,NTR - IF (OTSPT(LT)) THEN - DO I=ISTS,IENS - FX(I) = zero - enddo - DO K=KTMX,1,-1 - KM = MAX(K-1, 1) - KP = MIN(K+1, KMAX) - DO I=ISTS,IENS - SBR0 = GMFLX(I,KP) * (GDR(I,KP,LT) - GDR(I,K,LT)) - SBR1 = GMFLX(I,K) * (GDR(I,K,LT) - GDR(I,KM,LT)) - IF (GMFLX(I,K) > GMFLX(I,KP)) THEN - FX1 = half - ELSE - FX1 = zero - END IF - GTR(I,K,LT) = GTR(I,K,LT) + DELPI(I,K) & - * ((one-FX(I))*SBR0 + FX1*SBR1) - FX(I) = FX1 - ENDDO - ENDDO - ENDIF - ENDDO + DO LT = 1, NTR + IF ( OTSPT( LT ) ) THEN + DO I = ISTS, IENS + FX(I) = 0.D0 + enddo + DO K = KTMX, 1, -1 + KM = MAX( K-1, 1 ) + KP = MIN( K+1, KMAX ) + DO I = ISTS, IENS + SBR0 = GMFLX( I,K+1 ) * (GDR( I,KP,LT )-GDR( I,K ,LT )) + SBR1 = GMFLX( I,K ) * (GDR( I,K ,LT )-GDR( I,KM,LT )) +! + IF ( GMFLX( I,K ) > GMFLX( I,K+1 ) ) THEN + FX1 = 0.5D0 + ELSE + FX1 = 0.D0 + END IF +! + GTR(I,K,LT) = GTR(I,K,LT) + GRAV/DELP(I,K) & + * ((1.D0-FX( I))*SBR0 + FX1*SBR1 ) +! + FX( I ) = FX1 + END DO + END DO +! + END IF + END DO ! END SUBROUTINE CUMSBR !********************************************************************* -!>\ingroup cs_scheme -!! This subroutine calculates tracer mass fixer without detrainment. SUBROUTINE CUMFXR & ! Tracer mass fixer ( IM , IJSDIM, KMAX , NTR , & !DD dimensions GTR , & ! modified @@ -3813,24 +4053,26 @@ SUBROUTINE CUMFXR & ! Tracer mass fixe ! END SUBROUTINE CUMFXR !********************************************************************* -!>\ingroup cs_scheme - SUBROUTINE CUMFXR1 & ! Tracer mass fixer - ( IM , IJSDIM, KMAX , & !DD dimensions + SUBROUTINE CUMFXR1 & !! Tracer mass fixer + ( IM , IJSDIM, KMAX ,nctp, & !DD dimensions GTR , & ! modified GDR , DELP , DELTA , KTMX , IMFXR , & ! input + sigmai , sigma , & !DDsigma input ISTS , IENS ) ! input +! +!DD use ppgrid , only: IJSDIM => pcols, KMAX => pver ! IMPLICIT NONE - INTEGER, INTENT(IN) :: IM, IJSDIM, KMAX ! DD, for GFS, pass in + INTEGER, INTENT(IN) :: IM, IJSDIM, KMAX, nctp !! DD, for GFS, pass in ! ! [MODIFY] - REAL(kind_phys) GTR (IJSDIM, KMAX) ! tracer tendency + REAL(kind_phys) GTR ( IJSDIM, KMAX ) !! tracer tendency ! ! [INPUT] - REAL(kind_phys) GDR (IJSDIM, KMAX) ! tracer - REAL(kind_phys) DELP (IJSDIM, KMAX) - REAL(kind_phys) DELTA ! time step + REAL(kind_phys) GDR ( IJSDIM, KMAX ) !! tracer + REAL(kind_phys) DELP ( IJSDIM, KMAX ) + REAL(kind_phys) DELTA !! time step INTEGER KTMX INTEGER IMFXR ! 0: mass fixer is not applied @@ -3841,64 +4083,66 @@ SUBROUTINE CUMFXR1 & ! Tracer mass fixer ! 2: mass fixer is applied, total mass never change through cumulus scheme ! e.g. CO2 INTEGER ISTS, IENS + REAL(kind_phys) sigmai (IM,KMAX+1,NCTP), sigma(IM,KMAX+1) !!DDsigma cloud updraft fraction ! ! [INTERNAL WORK] REAL(kind_phys) GDR1 - REAL(kind_phys) GDR2 (ISTS:IENS, KMAX) - REAL(kind_phys), dimension(ISTS:IENS) :: TOT0, TOT1, TRAT + REAL(kind_phys) GDR2 ( ISTS:IENS, KMAX ) + REAL(kind_phys) TOT0 ( ISTS:IENS ) + REAL(kind_phys) TOT1 ( ISTS:IENS ) + REAL(kind_phys) TRAT ( ISTS:IENS ) REAL(kind_phys) FWAT INTEGER I, K ! ! Attention: tracers are forced to be positive unless IMFXR=0. ! - SELECT CASE (IMFXR) - CASE (0) - RETURN - CASE (1) - FWAT = one - CASE (2) - FWAT = zero - CASE DEFAULT - RETURN + SELECT CASE ( IMFXR ) + CASE (0) + RETURN + CASE (1) + FWAT = 1.D0 + CASE (2) + FWAT = 0.D0 + CASE DEFAULT + RETURN END SELECT ! - DO I=ISTS,IENS - TOT0(I) = zero - TOT1(I) = zero + DO I = ISTS, IENS + TOT0( I ) = 0.D0 + TOT1( I ) = 0.D0 enddo ! - DO K=KTMX,1,-1 - DO I=ISTS,IENS - IF (GTR(I,K) /= zero) THEN - GDR1 = GDR(I,K) + DELTA*GTR(I,K) - GDR2(I,K) = MAX(GDR1, zero) - GDR1 = GDR1*FWAT + GDR(I,K)*(one - FWAT) - TOT0(I) = TOT0(I) + GDR1 *(DELP(I,K)*GRAVI) - TOT1(I) = TOT1(I) + GDR2(I,K)*(DELP(I,K)*GRAVI) - ENDIF - ENDDO - ENDDO -! - DO I=ISTS,IENS - IF (TOT1(I) > zero) THEN - TRAT(I) = MAX(TOT0(I), zero) / TOT1(I) - ELSE - TRAT(I) = one - ENDIF - ENDDO -! - DO K=KTMX,1,-1 - DO I=ISTS,IENS - IF (GTR(I,K) /= zero) THEN - GDR2(I,K) = GDR2(I,K)*TRAT(I) - GTR (I,K) = (GDR2(I,K)-GDR(I,K)) / DELTA - ENDIF - ENDDO - ENDDO + DO K = KTMX, 1, -1 + DO I = ISTS, IENS + IF ( GTR( I,K ) /= 0.D0 ) THEN + GDR1 = GDR( I,K ) + DELTA*GTR( I,K ) + GDR2( I,K ) = MAX( GDR1, 0.D0 ) + GDR1 = GDR1*FWAT + GDR( I,K )*( 1.D0 - FWAT ) + TOT0( I ) = TOT0( I ) + GDR1 *(DELP( I,K )/GRAV) + TOT1( I ) = TOT1( I ) + GDR2( I,K )*(DELP( I,K )/GRAV) + END IF + END DO + END DO +! + DO I = ISTS, IENS + IF ( TOT1( I ) > 0.D0 ) THEN + TRAT( I ) = MAX( TOT0( I ), 0.D0 )/TOT1( I ) + ELSE + TRAT( I ) = 1.D0 + END IF + END DO +! + DO K = KTMX, 1, -1 + DO I = ISTS, IENS + IF ( GTR( I,K ) /= 0.D0 ) THEN + GDR2( I,K ) = GDR2( I,K )*TRAT( I ) + GTR ( I,K ) = ( GDR2( I,K )-GDR( I,K ) ) / DELTA + END IF + END DO + END DO ! END SUBROUTINE CUMFXR1 !********************************************************************* -!>\ingroup cs_scheme SUBROUTINE CUMCHK & ! check range of output values ( IJSDIM, KMAX , NTR , & !DD dimensions GTT , GTQ , GTU , GTV , & ! input @@ -3940,8 +4184,8 @@ SUBROUTINE CUMCHK & ! check range of output va REAL(kind_phys) :: CLWMAX = 1.e-3_kind_phys REAL(kind_phys) :: TPRPMAX = 1.e-2_kind_phys REAL(kind_phys) :: GTQIMAX = 1.e-5_kind_phys - !REAL(kind_phys) :: GTM2MAX = 1._kind_phys - !REAL(kind_phys) :: GTM3MAX = 1._kind_phys + REAL(kind_phys) :: GTM2MAX = 1._kind_phys + REAL(kind_phys) :: GTM3MAX = 1._kind_phys ! DO K=1,KMAX DO I=ISTS, IENS @@ -3997,7 +4241,6 @@ SUBROUTINE CUMCHK & ! check range of output va ENDDO ! END SUBROUTINE CUMCHK - !*********************************************************************** end module cs_conv diff --git a/physics/CONV/Chikira_Sugiyama/cs_conv_aw_adj.F90 b/physics/CONV/Chikira_Sugiyama/cs_conv_aw_adj.F90 index bd0444bab..d43a37c81 100644 --- a/physics/CONV/Chikira_Sugiyama/cs_conv_aw_adj.F90 +++ b/physics/CONV/Chikira_Sugiyama/cs_conv_aw_adj.F90 @@ -70,7 +70,6 @@ subroutine cs_conv_aw_adj_run(im, levs, do_cscnv, do_aw, do_shoc, & ! adjust sfc rainrate for conservation ! vertically integrate reduction of water increments, reduce precip by that amount - temrain1(:) = 0.0 do k = 1,levs do i = 1,im diff --git a/physics/CONV/Chikira_Sugiyama/cs_conv_pre.F90 b/physics/CONV/Chikira_Sugiyama/cs_conv_pre.F90 index 8cc1020d4..5af685db9 100644 --- a/physics/CONV/Chikira_Sugiyama/cs_conv_pre.F90 +++ b/physics/CONV/Chikira_Sugiyama/cs_conv_pre.F90 @@ -40,7 +40,6 @@ subroutine cs_conv_pre_run(im, levs, ntrac, q, clw1, clw2, & ! Initialize CCPP error handling variables errmsg = '' errflg = 0 - do i =1,im wcbmax(i) = cs_parm1 * work1(i) + cs_parm2 * work2(i) enddo @@ -61,4 +60,4 @@ subroutine cs_conv_pre_run(im, levs, ntrac, q, clw1, clw2, & return end subroutine cs_conv_pre_run -end module cs_conv_pre \ No newline at end of file +end module cs_conv_pre diff --git a/physics/MP/Morrison_Gettelman/m_micro.F90 b/physics/MP/Morrison_Gettelman/m_micro.F90 index 714372d53..4a8be97c0 100644 --- a/physics/MP/Morrison_Gettelman/m_micro.F90 +++ b/physics/MP/Morrison_Gettelman/m_micro.F90 @@ -63,7 +63,6 @@ subroutine m_micro_init(imp_physics, imp_physics_mg, fprcp, gravit, rair, rh2o, errmsg = '' errflg = 0 - if (is_initialized) return if (imp_physics /= imp_physics_mg) then @@ -410,7 +409,6 @@ subroutine m_micro_run( im, lm, flipv, dt_i & ! Initialize CCPP error handling variables errmsg = '' errflg = 0 - lprnt = .false. ipr = 1