Skip to content

Commit

Permalink
Adopt progsigma (#1)
Browse files Browse the repository at this point in the history
* Adopt progsigma "Add prognostic cumulus closure description in saSAS NCAR#903"
https://github.com/NCAR/ccpp-physics/pull/903/files
	modified:   GFS_DCNV_generic_post.F90
	modified:   GFS_DCNV_generic_post.meta
	modified:   GFS_DCNV_generic_pre.F90
	modified:   GFS_DCNV_generic_pre.meta
	modified:   GFS_MP_generic_post.F90
	modified:   GFS_MP_generic_post.meta
	modified:   GFS_SCNV_generic_post.F90
	modified:   GFS_SCNV_generic_post.meta
	modified:   GFS_SCNV_generic_pre.F90
	modified:   GFS_SCNV_generic_pre.meta
	modified:   GFS_suite_interstitial_3.F90
	modified:   GFS_suite_interstitial_3.meta
	new file:   progsigma_calc.f90
	modified:   samfdeepcnv.f
	modified:   samfdeepcnv.meta
	modified:   samfshalcnv.f
	modified:   samfshalcnv.meta
	modified:   satmedmfvdifq.F
	modified:   satmedmfvdifq.meta

* Adopt bugfixed progsigma "Bugfix and optimization of prognostic closure for the P8 physics suite NCAR#967"
https://github.com/NCAR/ccpp-physics/pull/967/files
	modified:   GFS_MP_generic_pre.F90
	modified:   GFS_MP_generic_pre.meta
	modified:   progsigma_calc.f90
	modified:   samfdeepcnv.f
	modified:   samfshalcnv.f

	modified:   physics/GFS_MP_generic_pre.F90
	modified:   physics/GFS_MP_generic_pre.meta
	modified:   physics/progsigma_calc.f90
	modified:   physics/samfdeepcnv.f
	modified:   physics/samfshalcnv.f
  • Loading branch information
bluefinweiwei authored Oct 13, 2022
1 parent 87d4b6c commit 09fbbd7
Show file tree
Hide file tree
Showing 21 changed files with 903 additions and 75 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
9 changes: 8 additions & 1 deletion 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 Expand Up @@ -289,4 +296,4 @@
units = 1
dimensions = ()
type = integer
intent = out
intent = out
29 changes: 23 additions & 6 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

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,7 +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
10 changes: 5 additions & 5 deletions physics/GFS_MP_generic_pre.F90
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ module GFS_MP_generic_pre
!> \section arg_table_GFS_MP_generic_pre_run Argument Table
!! \htmlinclude GFS_MP_generic_pre_run.html
!!
subroutine GFS_MP_generic_pre_run(im, levs, ldiag3d, qdiag3d, do_aw, ntcw, nncl, &
subroutine GFS_MP_generic_pre_run(im, levs, ldiag3d, qdiag3d, do_aw, progsigma, ntcw, nncl, &
ntrac, gt0, gq0, save_t, save_q, num_dfi_radar, errmsg, errflg)
!
use machine, only: kind_phys

implicit none
integer, intent(in) :: im, levs, ntcw, nncl, ntrac, num_dfi_radar
logical, intent(in) :: ldiag3d, qdiag3d, do_aw
logical, intent(in) :: ldiag3d, qdiag3d, do_aw, progsigma
real(kind=kind_phys), dimension(:,:), intent(in) :: gt0
real(kind=kind_phys), dimension(:,:,:), intent(in) :: gq0

Expand All @@ -39,7 +39,7 @@ subroutine GFS_MP_generic_pre_run(im, levs, ldiag3d, qdiag3d, do_aw, ntcw, nncl,
enddo
enddo
endif
if (ldiag3d .or. do_aw) then
if (ldiag3d .or. do_aw .or. progsigma) then
if(qdiag3d) then
do n=1,ntrac
do k=1,levs
Expand All @@ -48,7 +48,7 @@ subroutine GFS_MP_generic_pre_run(im, levs, ldiag3d, qdiag3d, do_aw, ntcw, nncl,
enddo
enddo
enddo
else if(do_aw) then
else if(do_aw .or. progsigma) then
! if qdiag3d, all q are saved already
save_q(1:im,:,1) = gq0(1:im,:,1)
do n=ntcw,ntcw+nncl-1
Expand All @@ -59,4 +59,4 @@ subroutine GFS_MP_generic_pre_run(im, levs, ldiag3d, qdiag3d, do_aw, ntcw, nncl,

end subroutine GFS_MP_generic_pre_run

end module GFS_MP_generic_pre
end module GFS_MP_generic_pre
9 changes: 8 additions & 1 deletion physics/GFS_MP_generic_pre.meta
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@
dimensions = ()
type = logical
intent = in
[progsigma]
standard_name = do_prognostic_updraft_area_fraction
long_name = flag for prognostic area fraction in cumulus convection
units = flag
dimensions = ()
type = logical
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 Expand Up @@ -116,4 +123,4 @@
units = 1
dimensions = ()
type = integer
intent = out
intent = out
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
9 changes: 4 additions & 5 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 @@ -69,5 +69,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
9 changes: 8 additions & 1 deletion 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 Expand Up @@ -254,4 +261,4 @@
units = 1
dimensions = ()
type = integer
intent = out
intent = out
Loading

0 comments on commit 09fbbd7

Please sign in to comment.