Skip to content

Commit

Permalink
Code update to connect MMM WSM6 to CCPP SCM
Browse files Browse the repository at this point in the history
	modified:   ../../Interstitials/UFS_SCM_NEPTUNE/GFS_MP_generic_post.meta
	modified:   ../../Interstitials/UFS_SCM_NEPTUNE/GFS_PBL_generic_common.F90
	modified:   ../../Interstitials/UFS_SCM_NEPTUNE/GFS_PBL_generic_post.F90
	modified:   ../../Interstitials/UFS_SCM_NEPTUNE/GFS_PBL_generic_post.meta
	modified:   ../../Interstitials/UFS_SCM_NEPTUNE/GFS_PBL_generic_pre.F90
	modified:   ../../Interstitials/UFS_SCM_NEPTUNE/GFS_PBL_generic_pre.meta
	modified:   ../../Interstitials/UFS_SCM_NEPTUNE/GFS_debug.F90
	modified:   ../../Interstitials/UFS_SCM_NEPTUNE/GFS_rrtmg_pre.F90
	modified:   ../../Interstitials/UFS_SCM_NEPTUNE/GFS_suite_interstitial_4.F90
	modified:   ../../Interstitials/UFS_SCM_NEPTUNE/maximum_hourly_diagnostics.F90
	modified:   ../../Interstitials/UFS_SCM_NEPTUNE/maximum_hourly_diagnostics.meta
	new file:   gfs_mmm_mp_wsm6_post.F90
	new file:   gfs_mmm_mp_wsm6_post.meta
	new file:   gfs_mmm_mp_wsm6_pre.F90
	new file:   gfs_mmm_mp_wsm6_pre.meta
	deleted:    scm_mp_wsm6_post.F90
	deleted:    scm_mp_wsm6_post.meta
	deleted:    scm_mp_wsm6_pre.F90
	deleted:    scm_mp_wsm6_pre.meta
	modified:   ../../PBL/MYNN_EDMF/mynnedmf_wrapper.F90
	modified:   ../../PBL/MYNN_EDMF/mynnedmf_wrapper.meta
	modified:   ../../Radiation/radiation_clouds.f
	modified:   ../../mmm_physics
  • Loading branch information
bluefinweiwei committed Aug 29, 2024
1 parent d7e08a8 commit 9058f59
Show file tree
Hide file tree
Showing 23 changed files with 820 additions and 254 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@
dimensions = (horizontal_loop_extent,vertical_layer_dimension,number_of_tracers)
type = real
kind = kind_phys
intent = inout
intent = in
[rain0]
standard_name = lwe_thickness_of_explicit_rain_amount
long_name = explicit rain on physics timestep
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ module GFS_PBL_generic_common

contains

subroutine set_aerosol_tracer_index(imp_physics, imp_physics_wsm6, &
subroutine set_aerosol_tracer_index(imp_physics, imp_physics_wsm6,imp_physics_wsm6_mmm, &
imp_physics_thompson, ltaerosol,mraerosol, &
imp_physics_mg, ntgl, imp_physics_gfdl, &
imp_physics_zhao_carr, imp_physics_nssl,&
nssl_hail_on, nssl_ccn_on, kk, &
errmsg, errflg)
implicit none
!
integer, intent(in ) :: imp_physics, imp_physics_wsm6, &
integer, intent(in ) :: imp_physics, imp_physics_wsm6, imp_physics_wsm6_mmm, &
imp_physics_thompson, &
imp_physics_mg, ntgl, imp_physics_gfdl, &
imp_physics_zhao_carr,imp_physics_nssl
Expand All @@ -31,9 +31,9 @@ subroutine set_aerosol_tracer_index(imp_physics, imp_physics_wsm6, &
errflg = 0

! Set Interstitial%kk = last index in diffused tracer array before chemistry-aerosol tracers
if (imp_physics == imp_physics_wsm6) then
if (imp_physics == imp_physics_wsm6 .or. imp_physics == imp_physics_wsm6_mmm) then
! WSM6
kk = 4
kk = 7
elseif (imp_physics == imp_physics_thompson) then
! Thompson
if(ltaerosol) then
Expand Down
19 changes: 11 additions & 8 deletions physics/Interstitials/UFS_SCM_NEPTUNE/GFS_PBL_generic_post.F90
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module GFS_PBL_generic_post
subroutine GFS_PBL_generic_post_run (im, levs, nvdiff, ntrac, &
ntqv, ntcw, ntiw, ntrw, ntsw, ntlnc, ntinc, ntrnc, ntsnc, ntgnc, ntwa, ntia, ntgl, ntoz, ntke, ntkev,nqrimef, &
trans_aero, ntchs, ntchm, ntccn, nthl, nthnc, ntgv, nthv, ntrz, ntgz, nthz, &
imp_physics, imp_physics_gfdl, imp_physics_thompson, imp_physics_wsm6, imp_physics_zhao_carr, imp_physics_mg, &
imp_physics, imp_physics_gfdl, imp_physics_thompson, imp_physics_wsm6, imp_physics_wsm6_mmm, imp_physics_zhao_carr, imp_physics_mg, &
imp_physics_fer_hires, imp_physics_nssl, nssl_ccn_on, ltaerosol, mraerosol, nssl_hail_on, nssl_3moment, &
cplflx, cplaqm, cplchm, lssav, flag_for_pbl_generic_tend, ldiag3d, lsidea, hybedmf, do_shoc, satmedmf, &
shinhong, do_ysu, dvdftra, dusfc1, dvsfc1, dtsfc1, dqsfc1, dtf, dudt, dvdt, dtdt, htrsw, htrlw, xmu, &
Expand All @@ -32,7 +32,7 @@ subroutine GFS_PBL_generic_post_run (im, levs, nvdiff, ntrac,
integer, intent(in) :: ntqv, ntcw, ntiw, ntrw, ntsw, ntlnc, ntinc, ntrnc, ntsnc, ntgnc, ntwa, ntia, ntgl, ntoz, ntke, ntkev, nqrimef
integer, intent(in) :: ntccn, nthl, nthnc, ntgv, nthv, ntrz, ntgz, nthz
logical, intent(in) :: trans_aero
integer, intent(in) :: imp_physics, imp_physics_gfdl, imp_physics_thompson, imp_physics_wsm6
integer, intent(in) :: imp_physics, imp_physics_gfdl, imp_physics_thompson, imp_physics_wsm6, imp_physics_wsm6_mmm
integer, intent(in) :: imp_physics_zhao_carr, imp_physics_mg, imp_physics_fer_hires
integer, intent(in) :: imp_physics_nssl
logical, intent(in) :: nssl_ccn_on, nssl_hail_on, nssl_3moment
Expand Down Expand Up @@ -103,7 +103,7 @@ subroutine GFS_PBL_generic_post_run (im, levs, nvdiff, ntrac,
!
if (trans_aero) then
! Set kk if chemistry-aerosol tracers are diffused
call set_aerosol_tracer_index(imp_physics, imp_physics_wsm6, &
call set_aerosol_tracer_index(imp_physics, imp_physics_wsm6, imp_physics_wsm6_mmm, &
imp_physics_thompson, ltaerosol,mraerosol, &
imp_physics_mg, ntgl, imp_physics_gfdl, &
imp_physics_zhao_carr, imp_physics_nssl,&
Expand All @@ -122,14 +122,17 @@ subroutine GFS_PBL_generic_post_run (im, levs, nvdiff, ntrac,
enddo
endif
!
if (imp_physics == imp_physics_wsm6) then
if (imp_physics == imp_physics_wsm6 .or. imp_physics == imp_physics_wsm6_mmm) then
! WSM6
do k=1,levs
do i=1,im
dqdt(i,k,ntqv) = dvdftra(i,k,1)
dqdt(i,k,ntcw) = dvdftra(i,k,2)
dqdt(i,k,ntiw) = dvdftra(i,k,3)
dqdt(i,k,ntoz) = dvdftra(i,k,4)
dqdt(i,k,ntqv) = dvdftra(i,k,1)
dqdt(i,k,ntcw) = dvdftra(i,k,2)
dqdt(i,k,ntiw) = dvdftra(i,k,3)
dqdt(i,k,ntrw) = dvdftra(i,k,4)
dqdt(i,k,ntsw) = dvdftra(i,k,5)
dqdt(i,k,ntgl) = dvdftra(i,k,6)
dqdt(i,k,ntoz) = dvdftra(i,k,7)
enddo
enddo

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,13 @@
dimensions = ()
type = integer
intent = in
[imp_physics_wsm6_mmm]
standard_name = identifier_for_wsm6_mmm_microphysics_scheme
long_name = choice of WSM6 MMM microphysics scheme
units = flag
dimensions = ()
type = integer
intent = in
[imp_physics_zhao_carr]
standard_name = identifier_for_zhao_carr_microphysics_scheme
long_name = choice of Zhao-Carr microphysics scheme
Expand Down
21 changes: 12 additions & 9 deletions physics/Interstitials/UFS_SCM_NEPTUNE/GFS_PBL_generic_pre.F90
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ subroutine GFS_PBL_generic_pre_run (im, levs, nvdiff, ntrac, rtg_ozone_index,
ntqv, ntcw, ntiw, ntrw, ntsw, ntlnc, ntinc, ntrnc, ntsnc, ntgnc, &
ntwa, ntia, ntgl, ntoz, ntke, ntkev, nqrimef, trans_aero, ntchs, ntchm, &
ntccn, nthl, nthnc, ntgv, nthv, ntrz, ntgz, nthz, &
imp_physics, imp_physics_gfdl, imp_physics_thompson, imp_physics_wsm6, &
imp_physics, imp_physics_gfdl, imp_physics_thompson, imp_physics_wsm6, imp_physics_wsm6_mmm, &
imp_physics_zhao_carr, imp_physics_mg, imp_physics_fer_hires, imp_physics_nssl, &
ltaerosol, mraerosol, nssl_ccn_on, nssl_hail_on, nssl_3moment, &
hybedmf, do_shoc, satmedmf, qgrs, vdftra, save_u, save_v, save_t, save_q, &
Expand All @@ -31,7 +31,7 @@ subroutine GFS_PBL_generic_pre_run (im, levs, nvdiff, ntrac, rtg_ozone_index,
integer, intent(in) :: ntwa, ntia, ntgl, ntoz, ntke, ntkev, nqrimef,ntchs, ntchm
integer, intent(in) :: ntccn, nthl, nthnc, ntgv, nthv, ntrz, ntgz, nthz
logical, intent(in) :: trans_aero, ldiag3d, qdiag3d, lssav
integer, intent(in) :: imp_physics, imp_physics_gfdl, imp_physics_thompson, imp_physics_wsm6
integer, intent(in) :: imp_physics, imp_physics_gfdl, imp_physics_thompson, imp_physics_wsm6, imp_physics_wsm6_mmm
integer, intent(in) :: imp_physics_zhao_carr, imp_physics_mg, imp_physics_fer_hires
logical, intent(in) :: ltaerosol, hybedmf, do_shoc, satmedmf, flag_for_pbl_generic_tend, mraerosol
integer, intent(in) :: imp_physics_nssl
Expand Down Expand Up @@ -62,17 +62,20 @@ subroutine GFS_PBL_generic_pre_run (im, levs, nvdiff, ntrac, rtg_ozone_index,
vdftra = qgrs
rtg_ozone_index = ntoz
else
if (imp_physics == imp_physics_wsm6) then
if (imp_physics == imp_physics_wsm6 .or. imp_physics == imp_physics_wsm6_mmm) then
! WSM6
do k=1,levs
do i=1,im
vdftra(i,k,1) = qgrs(i,k,ntqv)
vdftra(i,k,2) = qgrs(i,k,ntcw)
vdftra(i,k,3) = qgrs(i,k,ntiw)
vdftra(i,k,4) = qgrs(i,k,ntoz)
vdftra(i,k,1) = qgrs(i,k,ntqv)
vdftra(i,k,2) = qgrs(i,k,ntcw)
vdftra(i,k,3) = qgrs(i,k,ntiw)
vdftra(i,k,4) = qgrs(i,k,ntrw)
vdftra(i,k,5) = qgrs(i,k,ntsw)
vdftra(i,k,6) = qgrs(i,k,ntgl)
vdftra(i,k,7) = qgrs(i,k,ntoz)
enddo
enddo
rtg_ozone_index = 4
rtg_ozone_index = 7

! Ferrier-Aligo
elseif (imp_physics == imp_physics_fer_hires) then
Expand Down Expand Up @@ -272,7 +275,7 @@ subroutine GFS_PBL_generic_pre_run (im, levs, nvdiff, ntrac, rtg_ozone_index,
endif
!
if (trans_aero) then
call set_aerosol_tracer_index(imp_physics, imp_physics_wsm6, &
call set_aerosol_tracer_index(imp_physics, imp_physics_wsm6, imp_physics_wsm6_mmm, &
imp_physics_thompson, ltaerosol,mraerosol, &
imp_physics_mg, ntgl, imp_physics_gfdl, &
imp_physics_zhao_carr, imp_physics_nssl,&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,13 @@
dimensions = ()
type = integer
intent = in
[imp_physics_wsm6_mmm]
standard_name = identifier_for_wsm6_mmm_microphysics_scheme
long_name = choice of WSM6 MMM microphysics scheme
units = flag
dimensions = ()
type = integer
intent = in
[imp_physics_zhao_carr]
standard_name = identifier_for_zhao_carr_microphysics_scheme
long_name = choice of Zhao-Carr microphysics scheme
Expand Down
2 changes: 1 addition & 1 deletion physics/Interstitials/UFS_SCM_NEPTUNE/GFS_debug.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1392,7 +1392,7 @@ subroutine GFS_interstitialtoscreen_run (Model, Statein, Stateout, Sfcprop, Coup
call print_var(mpirank, omprank, blkno, Grid%xlat_d, Grid%xlon_d, 'Interstitial%clxss ', Interstitial%clxss )
end if
! GFDL and Thompson MP
if (Model%imp_physics == Model%imp_physics_gfdl .or. Model%imp_physics == Model%imp_physics_thompson .or. Model%imp_physics == Model%imp_physics_nssl) then
if (Model%imp_physics == Model%imp_physics_gfdl .or. Model%imp_physics == Model%imp_physics_thompson .or. Model%imp_physics == Model%imp_physics_nssl .or. Model%imp_physics == Model%imp_physics_wsm6_mmm) then
call print_var(mpirank, omprank, blkno, Grid%xlat_d, Grid%xlon_d, 'Interstitial%graupelmp ', Interstitial%graupelmp )
call print_var(mpirank, omprank, blkno, Grid%xlat_d, Grid%xlon_d, 'Interstitial%icemp ', Interstitial%icemp )
call print_var(mpirank, omprank, blkno, Grid%xlat_d, Grid%xlon_d, 'Interstitial%rainmp ', Interstitial%rainmp )
Expand Down
18 changes: 17 additions & 1 deletion physics/Interstitials/UFS_SCM_NEPTUNE/GFS_rrtmg_pre.F90
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,7 @@ subroutine GFS_rrtmg_pre_run (im, levs, lm, lmk, lmp, n_var_lndp, lextop,&
ccnd(i,k,4) = tracer1(i,k,ntsw) ! snow water
enddo
enddo
elseif (ncnd == 5 .or. ncnd == 6) then ! GFDL MP, Thompson, MG3, NSSL
elseif (ncnd == 5 .or. ncnd == 6) then ! GFDL MP, Thompson, MG3, NSSL, MMM WSM6
do k=1,LMK
do i=1,IM
ccnd(i,k,1) = tracer1(i,k,ntcw) ! liquid water
Expand Down Expand Up @@ -880,6 +880,22 @@ subroutine GFS_rrtmg_pre_run (im, levs, lm, lmk, lmp, n_var_lndp, lextop,&
! not used yet -- effr_in should always be true for now
endif

elseif (imp_physics == imp_physics_wsm6_mmm ) then ! MMM WSM6 MP
cldcov = 0.0
if(effr_in) then
do k=1,lm
k1 = k + kd
do i=1,im
effrl(i,k1) = effrl_inout(i,k)! re_cloud (i,k)
effri(i,k1) = effri_inout(i,k)! re_ice (i,k)
effrr(i,k1) = 1000. ! Neither G or Gp needs it, pass in a placeholder with reasonable value
effrs(i,k1) = effrs_inout(i,k) ! re_snow(i,k)
enddo
enddo
else
! not used yet -- effr_in should always be true for now
endif

elseif (imp_physics == imp_physics_thompson) then ! Thompson MP
!
! Compute effective radii for QC, QI, QS with (GF, MYNN) or without (all others) sub-grid clouds
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ subroutine GFS_suite_interstitial_4_run (im, levs, ltaerosol, tracers_total, ntr
enddo
endif

if ((imp_physics == imp_physics_thompson .or. imp_physics == imp_physics_wsm6_mmm) &
if ((imp_physics == imp_physics_thompson) &
.and. (ntlnc>0 .or. ntinc>0)) then
if_convert_dry_rho: if (convert_dry_rho) then
do k=1,levs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ module maximum_hourly_diagnostics
subroutine maximum_hourly_diagnostics_run(im, levs, reset, lradar, imp_physics, &
imp_physics_gfdl, imp_physics_thompson, &
imp_physics_fer_hires, imp_physics_nssl, &
con_g, phil, &
imp_physics_wsm6_mmm, con_g, phil, &
gt0, refl_10cm, refdmax, refdmax263k, u10m, v10m, &
u10max, v10max, spd10max, pgr, t2m, q2m, t02max, &
t02min, rh02max, rh02min, dtp, rain, pratemax, &
Expand All @@ -37,7 +37,7 @@ subroutine maximum_hourly_diagnostics_run(im, levs, reset, lradar, imp_physics,
integer, intent(in) :: im, levs, kdt
logical, intent(in) :: reset, lradar, lightning_threat
integer, intent(in) :: imp_physics, imp_physics_gfdl, imp_physics_thompson, imp_physics_fer_hires, &
imp_physics_nssl
imp_physics_nssl, imp_physics_wsm6_mmm
real(kind_phys), intent(in ) :: con_g
real(kind_phys), intent(in ) :: con_rd
real(kind_phys), intent(in ) :: phil(:,:)
Expand Down Expand Up @@ -86,7 +86,8 @@ subroutine maximum_hourly_diagnostics_run(im, levs, reset, lradar, imp_physics,
if (lradar .and. (imp_physics == imp_physics_gfdl .or. &
imp_physics == imp_physics_thompson .or. &
imp_physics == imp_physics_fer_hires .or. &
imp_physics == imp_physics_nssl )) then
imp_physics == imp_physics_nssl .or. &
imp_physics == imp_physics_wsm6_mmm)) then
allocate(refd(im))
allocate(refd263k(im))
call max_fields(phil,refl_10cm,con_g,im,levs,refd,gt0,refd263k)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,13 @@
dimensions = ()
type = integer
intent = in
[imp_physics_wsm6_mmm]
standard_name = identifier_for_wsm6_mmm_microphysics_scheme
long_name = choice of WSM6 MMM microphysics scheme
units = flag
dimensions = ()
type = integer
intent = in
[con_g]
standard_name = gravitational_acceleration
long_name = gravitational acceleration
Expand Down
82 changes: 82 additions & 0 deletions physics/MP/wsm6/gfs_mmm_mp_wsm6_post.F90
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
! ###########################################################################################
!
! ###########################################################################################
module gfs_mmm_mp_wsm6_post
use machine, only: kind_phys

implicit none

public gfs_mmm_mp_wsm6_post_run

contains
!> \section arg_table_gfs_mmm_mp_wsm6_post_run
!! \htmlinclude gfs_mmm_mp_wsm6_post_run.html
!!
! #########################################################################################
!
! #########################################################################################
subroutine gfs_mmm_mp_wsm6_post_run(nCol, nLev, re_qc, re_qi, re_qs, re_qc_um, re_qi_um, re_qs_um, &
convert_dry_rho, qv, spechum, qc, qr, qi, qs, qg, &
rainmp_mm, snowmp_mm, graupelmp_mm, rainmp, snowmp, graupelmp, &
rain_nonphy_mm, snow_nonphy_mm, graupel_nonphy_mm, &
rain_nonphy, snow_nonphy, graupel_nonphy, prcpmp, errmsg, errflg)

! input variables
integer, intent(in) :: nCol
integer, intent(in) :: nLev
real(kind_phys), dimension(:,:), intent(in) :: re_qc, re_qi, re_qs
real(kind_phys), dimension(:,:), intent(in) :: qv
real(kind_phys), dimension(:), intent(in) :: rainmp_mm, snowmp_mm, graupelmp_mm, rain_nonphy_mm, snow_nonphy_mm, graupel_nonphy_mm
logical, intent(in) :: convert_dry_rho

! output variables
real(kind_phys), dimension(:,:), intent(out) :: re_qc_um, re_qi_um, re_qs_um
real(kind_phys), dimension(:,:), intent(inout) :: spechum, qc, qr, qi, qs, qg
real(kind_phys), dimension(:), intent(out) :: rainmp, snowmp, graupelmp, rain_nonphy, snow_nonphy, graupel_nonphy, prcpmp

character(len=*), intent(out) :: &
errmsg ! CCPP error message
integer, intent(out) :: &
errflg ! CCPP error code
! local variables
integer :: i, k

! Initialize CCPP error handling
errmsg = ''
errflg = 0

! Convert unit of meter to micrometer
do k=1,nLev
do i=1,nCol
re_qc_um(i,k) = re_qc(i,k) * 1e6
re_qi_um(i,k) = re_qi(i,k) * 1e6
re_qs_um(i,k) = re_qs(i,k) * 1e6
end do
end do

!> - Convert water vapor mixing ratio back to specific humidity
spechum = qv/(1.0_kind_phys+qv)

if (convert_dry_rho) then
qc = qc/(1.0_kind_phys+qv)
qr = qr/(1.0_kind_phys+qv)
qi = qi/(1.0_kind_phys+qv)
qs = qs/(1.0_kind_phys+qv)
qg = qg/(1.0_kind_phys+qv)
end if

!> - Convert unit of precipitation from mm to m
rainmp = rainmp_mm / 1e3
snowmp = snowmp_mm / 1e3
graupelmp = graupelmp_mm / 1e3

rain_nonphy = rain_nonphy_mm / 1e3
snow_nonphy = snow_nonphy_mm / 1e3
graupel_nonphy = graupel_nonphy_mm / 1e3

!> - Output total amount of precip (rain, snow, graupel) on physics timestep
prcpmp = rainmp + snowmp + graupelmp

end subroutine gfs_mmm_mp_wsm6_post_run

end module gfs_mmm_mp_wsm6_post
Loading

0 comments on commit 9058f59

Please sign in to comment.