Skip to content

Commit

Permalink
Merge pull request NCAR#903 from lisa-bengtsson/prog_closure
Browse files Browse the repository at this point in the history
Add prognostic cumulus closure description in saSAS
  • Loading branch information
grantfirl authored Jun 3, 2022
2 parents f13ed4e + 2d2f1a6 commit 77bcfb1
Show file tree
Hide file tree
Showing 19 changed files with 878 additions and 64 deletions.
6 changes: 3 additions & 3 deletions physics/GFS_DCNV_generic_post.F90
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ subroutine GFS_DCNV_generic_post_run (im, levs, lssav, ldiag3d, qdiag3d, ras, &
index_of_temperature, index_of_x_wind, index_of_y_wind, ntqv, gq0, save_q, &
cnvw, cnvc, cnvw_phy_f3d, cnvc_phy_f3d, flag_for_dcnv_generic_tend, &
ntcw,ntiw,ntclamt,ntrw,ntsw,ntrnc,ntsnc,ntgl, &
ntgnc, nthl, nthnc, nthv, ntgv, ntrac,clw, &
ntgnc, nthl, nthnc, nthv, ntgv, ntsigma, ntrac,clw, &
satmedmf, trans_trac, errmsg, errflg)


Expand Down Expand Up @@ -45,7 +45,7 @@ subroutine GFS_DCNV_generic_post_run (im, levs, lssav, ldiag3d, qdiag3d, ras, &
integer, intent(in) :: dtidx(:,:), index_of_process_dcnv, index_of_temperature, &
index_of_x_wind, index_of_y_wind, ntqv
integer, intent(in) :: ntcw,ntiw,ntclamt,ntrw,ntsw,ntrnc,ntsnc,ntgl, &
ntgnc, nthl, nthnc, nthv, ntgv, ntrac
ntgnc, nthl, nthnc, nthv, ntgv, ntsigma, ntrac
real(kind=kind_phys), dimension(:,:,:), intent(in) :: clw


Expand Down Expand Up @@ -112,7 +112,7 @@ subroutine GFS_DCNV_generic_post_run (im, levs, lssav, ldiag3d, qdiag3d, ras, &
n /= ntrw .and. n /= ntsw .and. n /= ntrnc .and. &
n /= ntsnc .and. n /= ntgl .and. n /= ntgnc .and. &
n /= nthl .and. n /= nthnc .and. n /= nthv .and. &
n /= ntgv ) then
n /= ntgv .and. n /= ntsigma) then
tracers = tracers + 1
idtend = dtidx(100+n,index_of_process_dcnv)
if(idtend>0) then
Expand Down
7 changes: 7 additions & 0 deletions physics/GFS_DCNV_generic_post.meta
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,13 @@
dimensions = ()
type = logical
intent = in
[ntsigma]
standard_name = index_of_updraft_area_fraction_in_tracer_concentration_array
long_name = tracer index of updraft_area_fraction
units = index
dimensions = ()
type = integer
intent = in
[ntcw]
standard_name = index_of_cloud_liquid_water_mixing_ratio_in_tracer_concentration_array
long_name = tracer index for cloud condensate (or liquid water)
Expand Down
8 changes: 4 additions & 4 deletions physics/GFS_DCNV_generic_pre.F90
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ subroutine GFS_DCNV_generic_pre_run (im, levs, ldiag3d, qdiag3d, do_cnvgwd, cplc
gu0, gv0, gt0, gq0, nsamftrac, ntqv, &
save_u, save_v, save_t, save_q, clw, &
ntcw,ntiw,ntclamt,ntrw,ntsw,ntrnc,ntsnc,ntgl, &
ntgnc, nthl, nthnc, nthv, ntgv, &
ntgnc, nthl, nthnc, nthv, ntgv,ntsigma, &
cscnv, satmedmf, trans_trac, ras, ntrac, &
dtidx, index_of_process_dcnv, errmsg, errflg)

Expand All @@ -22,7 +22,7 @@ subroutine GFS_DCNV_generic_pre_run (im, levs, ldiag3d, qdiag3d, do_cnvgwd, cplc
implicit none

integer, intent(in) :: im, levs, nsamftrac, ntqv, index_of_process_dcnv, dtidx(:,:), &
ntcw,ntiw,ntclamt,ntrw,ntsw,ntrnc,ntsnc,ntgl,ntrac,ntgnc,nthl,nthnc,nthv,ntgv
ntcw,ntiw,ntclamt,ntrw,ntsw,ntrnc,ntsnc,ntgl,ntrac,ntgnc,nthl,nthnc,nthv,ntgv,ntsigma
logical, intent(in) :: ldiag3d, qdiag3d, do_cnvgwd, cplchm
real(kind=kind_phys), dimension(:,:), intent(in) :: gu0
real(kind=kind_phys), dimension(:,:), intent(in) :: gv0
Expand Down Expand Up @@ -68,7 +68,7 @@ subroutine GFS_DCNV_generic_pre_run (im, levs, ldiag3d, qdiag3d, do_cnvgwd, cplc
n /= ntrw .and. n /= ntsw .and. n /= ntrnc .and. &
n /= ntsnc .and. n /= ntgl .and. n /= ntgnc .and. &
n /= nthl .and. n /= nthnc .and. n /= nthv .and. &
n /= ntgv ) then
n /= ntgv .and. n/= ntsigma) then
tracers = tracers + 1
if(dtidx(100+n,index_of_process_dcnv)>0) then
save_q(:,:,n) = clw(:,:,tracers)
Expand All @@ -87,4 +87,4 @@ subroutine GFS_DCNV_generic_pre_run (im, levs, ldiag3d, qdiag3d, do_cnvgwd, cplc

end subroutine GFS_DCNV_generic_pre_run

end module GFS_DCNV_generic_pre
end module GFS_DCNV_generic_pre
7 changes: 7 additions & 0 deletions physics/GFS_DCNV_generic_pre.meta
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,13 @@
dimensions = ()
type = logical
intent = in
[ntsigma]
standard_name = index_of_updraft_area_fraction_in_tracer_concentration_array
long_name = tracer index of updraft_area_fraction
units = index
dimensions = ()
type = integer
intent = in
[ntcw]
standard_name = index_of_cloud_liquid_water_mixing_ratio_in_tracer_concentration_array
long_name = tracer index for cloud condensate (or liquid water)
Expand Down
28 changes: 23 additions & 5 deletions physics/GFS_MP_generic_post.F90
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,15 @@ module GFS_MP_generic_post
!> @{
subroutine GFS_MP_generic_post_run( &
im, levs, kdt, nrcm, nncl, ntcw, ntrac, imp_physics, imp_physics_gfdl, imp_physics_thompson, imp_physics_nssl, &
imp_physics_mg, imp_physics_fer_hires, cal_pre, cplflx, cplchm, con_g, rainmin, dtf, frain, rainc, &
imp_physics_mg, imp_physics_fer_hires, cal_pre, cplflx, cplchm, progsigma, con_g, rainmin, dtf, frain, rainc, &
rain1, rann, xlat, xlon, gt0, gq0, prsl, prsi, phii, tsfc, ice, snow, graupel, save_t, save_q, rain0, ice0, snow0,&
graupel0, del, rain, domr_diag, domzr_diag, domip_diag, doms_diag, tprcp, srflag, sr, cnvprcp, totprcp, totice, &
totsnw, totgrp, cnvprcpb, totprcpb, toticeb, totsnwb, totgrpb, rain_cpl, rainc_cpl, snow_cpl, pwat, &
drain_cpl, dsnow_cpl, lsm, lsm_ruc, lsm_noahmp, raincprv, rainncprv, iceprv, snowprv, &
graupelprv, draincprv, drainncprv, diceprv, dsnowprv, dgraupelprv, dtp, dfi_radar_max_intervals, &
dtend, dtidx, index_of_temperature, index_of_process_mp,ldiag3d, qdiag3d, lssav, num_dfi_radar, fh_dfi_radar, &
index_of_process_dfi_radar, ix_dfi_radar, dfi_radar_tten, radar_tten_limits, fhour, errmsg, errflg)
dtend, dtidx, index_of_temperature, index_of_process_mp,ldiag3d, qdiag3d,dqdt_qmicro, lssav, num_dfi_radar, &
fh_dfi_radar,index_of_process_dfi_radar, ix_dfi_radar, dfi_radar_tten, radar_tten_limits, fhour, prevsq, &
errmsg, errflg)
!
use machine, only: kind_phys
use calpreciptype_mod, only: calpreciptype
Expand All @@ -36,7 +37,7 @@ subroutine GFS_MP_generic_post_run(
integer, intent(in) :: im, levs, kdt, nrcm, nncl, ntcw, ntrac, num_dfi_radar, index_of_process_dfi_radar
integer, intent(in) :: imp_physics, imp_physics_gfdl, imp_physics_thompson, imp_physics_mg, imp_physics_fer_hires
integer, intent(in) :: imp_physics_nssl
logical, intent(in) :: cal_pre, lssav, ldiag3d, qdiag3d, cplflx, cplchm
logical, intent(in) :: cal_pre, lssav, ldiag3d, qdiag3d, cplflx, cplchm, progsigma
integer, intent(in) :: index_of_temperature,index_of_process_mp

integer :: dfi_radar_max_intervals
Expand Down Expand Up @@ -80,7 +81,8 @@ subroutine GFS_MP_generic_post_run(
real(kind=kind_phys), dimension(:), intent(inout) :: diceprv
real(kind=kind_phys), dimension(:), intent(inout) :: dsnowprv
real(kind=kind_phys), dimension(:), intent(inout) :: dgraupelprv

real(kind=kind_phys), dimension(:,:), intent(inout) :: dqdt_qmicro
real(kind=kind_phys), dimension(:,:), intent(inout) :: prevsq
real(kind=kind_phys), intent(in) :: dtp

! CCPP error handling
Expand Down Expand Up @@ -352,6 +354,15 @@ subroutine GFS_MP_generic_post_run(
endif if_tendency_diagnostics
endif if_save_fields

!If prognostic updraft area fraction is used in saSAS
if(progsigma)then
do k=1,levs
do i=1,im
dqdt_qmicro(i,k)=(gq0(i,k,1)-save_q(i,k,1))/dtp
enddo
enddo
endif

if (cplflx .or. cplchm) then
do i = 1, im
dsnow_cpl(i)= max(zero, rain(i) * srflag(i))
Expand Down Expand Up @@ -387,6 +398,13 @@ subroutine GFS_MP_generic_post_run(
pwat(i) = pwat(i) * onebg
enddo

if(progsigma)then
do k = 1, levs
do i=1, im
prevsq(i,k) = gq0(i,k,1)
enddo
enddo
endif

end subroutine GFS_MP_generic_post_run
!> @}
Expand Down
23 changes: 23 additions & 0 deletions physics/GFS_MP_generic_post.meta
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,13 @@
dimensions = ()
type = logical
intent = in
[progsigma]
standard_name = do_prognostic_updraft_area_fraction
long_name = flag for prognostic sigma in cumulus scheme
units = flag
dimensions = ()
type = logical
intent = in
[con_g]
standard_name = gravitational_acceleration
long_name = gravitational acceleration
Expand Down Expand Up @@ -724,6 +731,22 @@
dimensions = ()
type = logical
intent = in
[dqdt_qmicro]
standard_name = instantaneous_tendency_of_specific_humidity_due_to_microphysics
long_name = moisture tendency due to microphysics
units = kg kg-1 s-1
dimensions = (horizontal_loop_extent,vertical_layer_dimension)
type = real
kind = kind_phys
intent = inout
[prevsq]
standard_name = specific_humidity_on_previous_timestep
long_name = specific_humidity_on_previous_timestep
units = kg kg-1
dimensions = (horizontal_loop_extent,vertical_layer_dimension)
type = real
kind = kind_phys
intent = inout
[lssav]
standard_name = flag_for_diagnostics
long_name = logical flag for storing diagnostics
Expand Down
6 changes: 3 additions & 3 deletions physics/GFS_SCNV_generic_post.F90
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ subroutine GFS_SCNV_generic_post_run (im, levs, nn, lssav, ldiag3d, qdiag3d, &
rainc, cnvprcp, cnvprcpb, cnvw_phy_f3d, cnvc_phy_f3d, &
dtend, dtidx, index_of_temperature, index_of_x_wind, index_of_y_wind, &
index_of_process_scnv, ntqv, flag_for_scnv_generic_tend, &
ntcw,ntiw,ntclamt,ntrw,ntsw,ntrnc,ntsnc,ntgl,ntgnc, &
ntcw,ntiw,ntclamt,ntrw,ntsw,ntrnc,ntsnc,ntgl,ntgnc,ntsigma, &
imfshalcnv, imfshalcnv_sas, imfshalcnv_samf, ntrac, &
cscnv, satmedmf, trans_trac, ras, errmsg, errflg)

Expand All @@ -23,7 +23,7 @@ subroutine GFS_SCNV_generic_post_run (im, levs, nn, lssav, ldiag3d, qdiag3d, &
implicit none

integer, intent(in) :: im, levs, nn, ntqv, nsamftrac
integer, intent(in) :: ntcw,ntiw,ntclamt,ntrw,ntsw,ntrnc,ntsnc,ntgl,ntgnc,ntrac
integer, intent(in) :: ntcw,ntiw,ntclamt,ntrw,ntsw,ntrnc,ntsnc,ntgl,ntgnc,ntsigma,ntrac
logical, intent(in) :: lssav, ldiag3d, qdiag3d, flag_for_scnv_generic_tend
real(kind=kind_phys), intent(in) :: frain
real(kind=kind_phys), dimension(:,:), intent(in) :: gu0, gv0, gt0
Expand Down Expand Up @@ -103,7 +103,7 @@ subroutine GFS_SCNV_generic_post_run (im, levs, nn, lssav, ldiag3d, qdiag3d, &
do n=2,ntrac
if ( n /= ntcw .and. n /= ntiw .and. n /= ntclamt .and. &
n /= ntrw .and. n /= ntsw .and. n /= ntrnc .and. &
n /= ntsnc .and. n /= ntgl .and. n /= ntgnc) then
n /= ntsnc .and. n /= ntgl .and. n /= ntgnc .and. n /= ntsigma) then
tracers = tracers + 1
idtend = dtidx(100+n,index_of_process_scnv)
if(idtend>0) then
Expand Down
7 changes: 7 additions & 0 deletions physics/GFS_SCNV_generic_post.meta
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,13 @@
dimensions = ()
type = logical
intent = in
[ntsigma]
standard_name = index_of_updraft_area_fraction_in_tracer_concentration_array
long_name = tracer index of updraft_area_fraction
units = index
dimensions = ()
type = integer
intent = in
[ntcw]
standard_name = index_of_cloud_liquid_water_mixing_ratio_in_tracer_concentration_array
long_name = tracer index for cloud condensate (or liquid water)
Expand Down
8 changes: 4 additions & 4 deletions physics/GFS_SCNV_generic_pre.F90
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ module GFS_SCNV_generic_pre
subroutine GFS_SCNV_generic_pre_run (im, levs, ldiag3d, qdiag3d, gu0, gv0, gt0, gq0, &
save_u, save_v, save_t, save_q, ntqv, nsamftrac, flag_for_scnv_generic_tend, &
dtidx, index_of_process_scnv, ntcw,ntiw,ntclamt,ntrw,ntsw,ntrnc,ntsnc,ntgl,ntgnc, &
cscnv, satmedmf, trans_trac, ras, ntrac, clw, errmsg, errflg)
ntsigma, cscnv, satmedmf, trans_trac, ras, ntrac, clw, errmsg, errflg)

use machine, only: kind_phys

implicit none

integer, intent(in) :: im, levs, ntqv, nsamftrac, index_of_process_scnv, dtidx(:,:)
integer, intent(in) :: ntcw,ntiw,ntclamt,ntrw,ntsw,ntrnc,ntsnc,ntgl,ntgnc,ntrac
integer, intent(in) :: ntcw,ntiw,ntclamt,ntrw,ntsw,ntrnc,ntsnc,ntgl,ntgnc, ntsigma,ntrac
logical, intent(in) :: ldiag3d, qdiag3d, flag_for_scnv_generic_tend
real(kind=kind_phys), dimension(:,:), intent(in) :: gu0, gv0, gt0
real(kind=kind_phys), dimension(:,:,:), intent(in) :: gq0
Expand Down Expand Up @@ -49,7 +49,7 @@ subroutine GFS_SCNV_generic_pre_run (im, levs, ldiag3d, qdiag3d, gu0, gv0, gt0,
do n=2,ntrac
if ( n /= ntcw .and. n /= ntiw .and. n /= ntclamt .and. &
n /= ntrw .and. n /= ntsw .and. n /= ntrnc .and. &
n /= ntsnc .and. n /= ntgl .and. n /= ntgnc) then
n /= ntsnc .and. n /= ntgl .and. n /= ntgnc .and. n /= ntsigma) then
tracers = tracers + 1
if(dtidx(100+n,index_of_process_scnv)>0) then
save_q(:,:,n) = clw(:,:,tracers)
Expand All @@ -70,4 +70,4 @@ subroutine GFS_SCNV_generic_pre_run (im, levs, ldiag3d, qdiag3d, gu0, gv0, gt0,
end subroutine GFS_SCNV_generic_pre_run


end module GFS_SCNV_generic_pre
end module GFS_SCNV_generic_pre
7 changes: 7 additions & 0 deletions physics/GFS_SCNV_generic_pre.meta
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,13 @@
dimensions = ()
type = logical
intent = in
[ntsigma]
standard_name = index_of_updraft_area_fraction_in_tracer_concentration_array
long_name = tracer index of updraft_area_fraction
units = index
dimensions = ()
type = integer
intent = in
[ntcw]
standard_name = index_of_cloud_liquid_water_mixing_ratio_in_tracer_concentration_array
long_name = tracer index for cloud condensate (or liquid water)
Expand Down
37 changes: 32 additions & 5 deletions physics/GFS_suite_interstitial_3.F90
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,13 @@ module GFS_suite_interstitial_3
!! \htmlinclude GFS_suite_interstitial_3_run.html
!!
subroutine GFS_suite_interstitial_3_run (otsptflag, &
im, levs, nn, cscnv, &
im, levs, nn, cscnv,imfshalcnv, imfdeepcnv, &
imfshalcnv_samf, imfdeepcnv_samf,progsigma, &
first_time_step, restart, &
satmedmf, trans_trac, do_shoc, ltaerosol, ntrac, ntcw, &
ntiw, ntclamt, ntrw, ntsw, ntrnc, ntsnc, ntgl, ntgnc, &
xlon, xlat, gt0, gq0, imp_physics, imp_physics_mg, &
xlon, xlat, gt0, gq0, sigmain,sigmaout,qmicro, &
imp_physics, imp_physics_mg, &
imp_physics_zhao_carr, imp_physics_zhao_carr_pdf, &
imp_physics_gfdl, imp_physics_thompson, dtidx, ntlnc, &
imp_physics_wsm6, imp_physics_fer_hires, prsi, ntinc, &
Expand All @@ -33,8 +36,9 @@ subroutine GFS_suite_interstitial_3_run (otsptflag, &
imp_physics_gfdl, imp_physics_thompson, imp_physics_wsm6,imp_physics_fer_hires, &
imp_physics_nssl, me, index_of_process_conv_trans
integer, intent(in ), dimension(:) :: islmsk, kpbl, kinver
logical, intent(in ) :: cscnv, satmedmf, trans_trac, do_shoc, ltaerosol, ras

logical, intent(in ) :: cscnv, satmedmf, trans_trac, do_shoc, ltaerosol, ras, progsigma
logical, intent(in ) :: first_time_step, restart
integer, intent(in ) :: imfshalcnv, imfdeepcnv, imfshalcnv_samf,imfdeepcnv_samf
integer, intent(in) :: ntinc, ntlnc
logical, intent(in) :: ldiag3d, qdiag3d
integer, dimension(:,:), intent(in) :: dtidx
Expand All @@ -48,6 +52,8 @@ subroutine GFS_suite_interstitial_3_run (otsptflag, &
real(kind=kind_phys), intent(in ), dimension(:,:) :: gt0
real(kind=kind_phys), intent(in ), dimension(:,:,:) :: gq0

real(kind=kind_phys), intent(inout ), dimension(:,:) :: sigmain
real(kind=kind_phys), intent(inout ), dimension(:,:) :: sigmaout,qmicro
real(kind=kind_phys), intent(inout), dimension(:,:) :: rhc, save_qc
! save_qi is not allocated for Zhao-Carr MP
real(kind=kind_phys), intent(inout), dimension(:,:) :: save_qi
Expand All @@ -73,6 +79,27 @@ subroutine GFS_suite_interstitial_3_run (otsptflag, &
errmsg = ''
errflg = 0

! In case of using prognostic updraf area fraction, initialize area fraction here
! since progsigma_calc is called from both deep and shallow schemes.
if(((imfshalcnv == imfshalcnv_samf) .or. (imfdeepcnv == imfdeepcnv_samf)) &
.and. progsigma)then
if(first_time_step .and. .not. restart)then
do k=1,levs
do i=1,im
sigmain(i,k)=0.0
sigmaout(i,k)=0.0
qmicro(i,k)=0.0
enddo
enddo
endif
do k=1,levs
do i=1,im
sigmaout(i,k)=0.0
enddo
enddo
endif


if (cscnv .or. satmedmf .or. trans_trac .or. ras) then
tracers = 2
do n=2,ntrac
Expand Down Expand Up @@ -192,4 +219,4 @@ subroutine GFS_suite_interstitial_3_run (otsptflag, &

end subroutine GFS_suite_interstitial_3_run

end module GFS_suite_interstitial_3
end module GFS_suite_interstitial_3
Loading

0 comments on commit 77bcfb1

Please sign in to comment.