Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 31 additions & 5 deletions physics/MP/Thompson/module_mp_thompson.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1043,7 +1043,8 @@ subroutine mp_gt_driver(qv, qc, qr, qi, qs, qg, ni, nr, nc, &
tprr_rcs, tprv_rev, tten3, qvten3, &
qrten3, qsten3, qgten3, qiten3, niten3, &
nrten3, ncten3, qcten3, &
pfils, pflls)
pfils, pflls, &
tc_rain, tc_snow)

implicit none

Expand Down Expand Up @@ -1112,6 +1113,8 @@ subroutine mp_gt_driver(qv, qc, qr, qi, qs, qg, ni, nr, nc, &
tprr_rcs, tprv_rev, tten3, qvten3, &
qrten3, qsten3, qgten3, qiten3, niten3, &
nrten3, ncten3, qcten3
! TC adjustment
real(wp), INTENT (IN) :: tc_rain, tc_snow

!..Local variables
real(wp), dimension(kts:kte):: &
Expand Down Expand Up @@ -1481,7 +1484,8 @@ subroutine mp_gt_driver(qv, qc, qr, qi, qs, qg, ni, nr, nc, &
tprr_rcs1, tprv_rev1, &
tten1, qvten1, qrten1, qsten1, &
qgten1, qiten1, niten1, nrten1, ncten1, qcten1, &
pfil1, pfll1)
pfil1, pfll1, &
tc_rain, tc_snow)

pcp_ra(i,j) = pcp_ra(i,j) + pptrain
pcp_sn(i,j) = pcp_sn(i,j) + pptsnow
Expand Down Expand Up @@ -1901,7 +1905,8 @@ subroutine mp_thompson (qv1d, qc1d, qi1d, qr1d, qs1d, qg1d, ni1d, &
tprr_rcs1, tprv_rev1, &
tten1, qvten1, qrten1, qsten1, &
qgten1, qiten1, niten1, nrten1, ncten1, qcten1, &
pfil1, pfll1)
pfil1, pfll1, &
tc_rain, tc_snow)

use mpi_f08

Expand Down Expand Up @@ -1937,6 +1942,8 @@ subroutine mp_thompson (qv1d, qc1d, qi1d, qr1d, qs1d, qg1d, ni1d, &
tprr_rcs1, tprv_rev1, tten1, qvten1, &
qrten1, qsten1, qgten1, qiten1, niten1, &
nrten1, ncten1, qcten1
! TC adjustment
real(wp), intent(in) :: tc_rain, tc_snow

#if ( WRF_CHEM == 1 )
real(wp), dimension(kts:kte), intent(inout) :: &
Expand Down Expand Up @@ -2031,6 +2038,7 @@ subroutine mp_thompson (qv1d, qc1d, qi1d, qr1d, qs1d, qg1d, ni1d, &
logical :: debug_flag
integer :: nu_c

real(wp) :: ymaxw, ytmp1 ! tc djustment tmp variable
!+---+

debug_flag = .false.
Expand Down Expand Up @@ -3769,6 +3777,15 @@ subroutine mp_thompson (qv1d, qc1d, qi1d, qr1d, qs1d, qg1d, ni1d, &
enddo

if (ANY(L_qr .eqv. .true.)) then
ymaxw=maxval(w1d)
ytmp1=tc_rain
! if <0, tc adjustment is w-dependent
if (tc_rain < 0) then
ytmp1=1.0
! Linearly increase with max W, up to 0.1 for Maxw>=5m/s, only for +W
if (ymaxw >= 0.5) ytmp1=abs(tc_rain)+min((ymaxw-0.5)/(5.0-0.5),1.0)*0.1
endif

do k = kte, kts, -1
vtr = 0.
rhof(k) = SQRT(RHO_NOT/rho(k))
Expand All @@ -3777,15 +3794,15 @@ subroutine mp_thompson (qv1d, qc1d, qi1d, qr1d, qs1d, qg1d, ni1d, &
lamr = (am_r*crg(3)*org2*nr(k)/rr(k))**obmr
vtr = rhof(k)*av_r*crg(6)*org3 * lamr**cre(3) &
*((lamr+fv_r)**(-cre(6)))
vtrk(k) = vtr
vtrk(k) = vtr*ytmp1
! First below is technically correct:
! vtr = rhof(k)*av_r*crg(5)*org2 * lamr**cre(2) &
! *((lamr+fv_r)**(-cre(5)))
! Test: make number fall faster (but still slower than mass)
! Goal: less prominent size sorting
vtr = rhof(k)*av_r*crg(7)/crg(12) * lamr**cre(12) &
*((lamr+fv_r)**(-cre(7)))
vtnrk(k) = vtr
vtnrk(k) = vtr*ytmp1
else
vtrk(k) = vtrk(k+1)
vtnrk(k) = vtnrk(k+1)
Expand Down Expand Up @@ -3869,6 +3886,14 @@ subroutine mp_thompson (qv1d, qc1d, qi1d, qr1d, qs1d, qg1d, ni1d, &
!+---+-----------------------------------------------------------------+

if (ANY(L_qs .eqv. .true.)) then
ymaxw=maxval(w1d)
ytmp1=tc_snow
! if <0, tc adjustment is w-dependent
if (tc_snow < 0) then
ytmp1=1.0
! Linearly increase with max W, up to 0.1 for Maxw>=5m/s, only for +W
if (ymaxw >= 0.5) ytmp1= abs(tc_snow)+min((ymaxw-0.5)/(5.0-0.5),1.0)*0.1
endif
nstep = 0
do k = kte, kts, -1
vts = 0.
Expand All @@ -3886,6 +3911,7 @@ subroutine mp_thompson (qv1d, qc1d, qi1d, qr1d, qs1d, qg1d, ni1d, &
t3_vts = Kap0*csg(1)*ils1**cse(1)
t4_vts = Kap1*Mrat**mu_s*csg(7)*ils2**cse(7)
vts = rhof(k)*av_s * (t1_vts+t2_vts)/(t3_vts+t4_vts)
vts=vts*ytmp1
if (prr_sml(k) .gt. 0.0) then
! vtsk(k) = max(vts*vts_boost(k), &
! & vts*((vtrk(k)-vts*vts_boost(k))/(temp(k)-T_0)))
Expand Down
13 changes: 10 additions & 3 deletions physics/MP/Thompson/mp_thompson.F90
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,7 @@ subroutine mp_thompson_run(ncol, nlev, con_g, con_rd, &
spp_prt_list, spp_var_list, &
spp_stddev_cutoff, &
cplchm, pfi_lsan, pfl_lsan, &
tc_rain, tc_snow, &
is_initialized, errmsg, errflg)

implicit none
Expand Down Expand Up @@ -465,6 +466,9 @@ subroutine mp_thompson_run(ncol, nlev, con_g, con_rd, &
real(kind=kind_phys), intent(inout), dimension(:,:), optional :: pfi_lsan
real(kind=kind_phys), intent(inout), dimension(:,:), optional :: pfl_lsan

! TC adjustment
real(kind_phys), intent(in) :: tc_rain, tc_snow

! Local variables

! Reduced time step if subcycling is used
Expand Down Expand Up @@ -776,7 +780,8 @@ subroutine mp_thompson_run(ncol, nlev, con_g, con_rd, &
tprv_rev=tprv_rev, tten3=tten3, &
qvten3=qvten3, qrten3=qrten3, qsten3=qsten3, qgten3=qgten3, &
qiten3=qiten3, niten3=niten3, nrten3=nrten3, ncten3=ncten3, &
qcten3=qcten3, pfils=pfils, pflls=pflls)
qcten3=qcten3, pfils=pfils, pflls=pflls, &
tc_rain=tc_rain, tc_snow=tc_snow)
else if (merra2_aerosol_aware) then
call mp_gt_driver(qv=qv, qc=qc, qr=qr, qi=qi, qs=qs, qg=qg, ni=ni, nr=nr, &
nc=nc, nwfa=nwfa, nifa=nifa, &
Expand Down Expand Up @@ -818,7 +823,8 @@ subroutine mp_thompson_run(ncol, nlev, con_g, con_rd, &
tprv_rev=tprv_rev, tten3=tten3, &
qvten3=qvten3, qrten3=qrten3, qsten3=qsten3, qgten3=qgten3, &
qiten3=qiten3, niten3=niten3, nrten3=nrten3, ncten3=ncten3, &
qcten3=qcten3, pfils=pfils, pflls=pflls)
qcten3=qcten3, pfils=pfils, pflls=pflls, &
tc_rain=tc_rain, tc_snow=tc_snow)
else
call mp_gt_driver(qv=qv, qc=qc, qr=qr, qi=qi, qs=qs, qg=qg, ni=ni, nr=nr, &
tt=tgrs, p=prsl, w=w, dz=dz, dt_in=dtstep, dt_inner=dt_inner, &
Expand Down Expand Up @@ -858,7 +864,8 @@ subroutine mp_thompson_run(ncol, nlev, con_g, con_rd, &
tprv_rev=tprv_rev, tten3=tten3, &
qvten3=qvten3, qrten3=qrten3, qsten3=qsten3, qgten3=qgten3, &
qiten3=qiten3, niten3=niten3, nrten3=nrten3, ncten3=ncten3, &
qcten3=qcten3, pfils=pfils, pflls=pflls)
qcten3=qcten3, pfils=pfils, pflls=pflls, &
tc_rain=tc_rain, tc_snow=tc_snow)
end if
if (errflg/=0) return

Expand Down
16 changes: 16 additions & 0 deletions physics/MP/Thompson/mp_thompson.meta
Original file line number Diff line number Diff line change
Expand Up @@ -943,6 +943,22 @@
dimensions = ()
type = logical
intent = inout
[tc_rain]
standard_name = tc_adjustment_rain_fall_speed
long_name = tc adjustment rain fall speed
units = none
dimensions = ()
type = real
kind = kind_phys
intent = in
[tc_snow]
standard_name = tc_adjustment_snow_fall_speed
long_name = tc adjustment snow fall speed
units = none
dimensions = ()
type = real
kind = kind_phys
intent = in
[errmsg]
standard_name = ccpp_error_message
long_name = error message for error handling in CCPP
Expand Down
6 changes: 4 additions & 2 deletions physics/Radiation/RRTMGP/rrtmgp_lw_cloud_optics.F90
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ module rrtmgp_lw_cloud_optics
! ######################################################################################
!>
subroutine rrtmgp_lw_cloud_optics_init(rrtmgp_root_dir, rrtmgp_lw_file_clouds, &
nrghice, mpicomm, mpirank, mpiroot, errmsg, errflg)
nrghice, mpicomm, mpirank, mpiroot1, errmsg, errflg)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dustinswales @BinLiu-NOAA I am worried about this change. The host model defines mpiroot, not the scheme. You are hardcoding it in the RRTMGP scheme to be zero. This is a dangerous assumption in my opinion. Can you not just pass in the value you need (i.e. zero) from the host model?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@climbfuji I got a similar concern on this. @Qingfu-Liu and @dustinswales, not sure if it's easy to come up a more generalized solution for this.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this is not an ideal solution. Sorry for not proposing something cleaner.

The problem was related to nested domains and initialization. Setting mpiroot=0 in the scheme avoided the situation where the nested domain(s) would try to reset this global data already being set by the parent domain.

@BinLiu-NOAA @climbfuji Hang tight and I'll work on a fix

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I just realized that the UWM PR does not add any new testing for the HAFS_v2 suites being introduced to NOAA-EMC/ufsatm.
@BinLiu-NOAA If you can you update the UWM PR to include a test, I can provide a more elegant solution.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dustinswales We do plan to update some existing HAFS RTs in UWM to be aligned with future HAFS v2.2 configurations/suites. However, these HAFS RTs related updates will most likely come from a later/future PR, since the HAFSv2.2 final configurations are still evolving (hopefully will be finalized in the next few weeks).

Meanwhile, definitely can provide you a canned test case for developing/testing alternative solutions before the HAFS RT update PR. Thanks!

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this is not an ideal solution. Sorry for not proposing something cleaner.

The problem was related to nested domains and initialization. Setting mpiroot=0 in the scheme avoided the situation where the nested domain(s) would try to reset this global data already being set by the parent domain.

@BinLiu-NOAA @climbfuji Hang tight and I'll work on a fix

In terms alternative solutions, I recall @SamuelTrahanNOAA and @JiayiPeng-NOAA worked/implemented an approach for a similar issue related nesting/moving-nesting support for the stochastics physics. Please feel free to comment/suggest if you have some ideas. Thanks!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dustinswales We do plan to update some existing HAFS RTs in UWM to be aligned with future HAFS v2.2 configurations/suites. However, these HAFS RTs related updates will most likely come from a later/future PR, since the HAFSv2.2 final configurations are still evolving (hopefully will be finalized in the next few weeks).

Meanwhile, definitely can provide you a canned test case for developing/testing alternative solutions before the HAFS RT update PR. Thanks!

@BinLiu-NOAA That works for me. (No rush as I will be off until 1/5/26.)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed RE: the need for a more general solution. Do the nest physics always get initialized after the parent domain physics? If so, would a logical is_initialized-type variable in GFS_typedefs/control DDT do the trick? Or even a scheme module-level variable like is used in other schemes?

Copy link
Collaborator

@dustinswales dustinswales Jan 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@climbfuji @grantfirl We could just set Init_parm%master = 0 in fv3/atmos_model.F90:

#ifdef MOVING_NEST
    Init_parm%master = 0 
#endif

And revert all these changes to the GP scheme files.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand this completely, but what @grantfirl suggests seems to make the most sense - keep track of the initialization through a host model (or scheme module) variable?


! Inputs
character(len=128),intent(in) :: &
Expand All @@ -61,7 +61,8 @@ subroutine rrtmgp_lw_cloud_optics_init(rrtmgp_root_dir, rrtmgp_lw_file_clouds,
mpicomm !< MPI communicator
integer, intent(in) :: &
mpirank, & !< Current MPI rank
mpiroot !< Master MPI rank
mpiroot1 !< Master MPI rank
integer :: mpiroot

! Outputs
character(len=*), intent(out) :: &
Expand All @@ -77,6 +78,7 @@ subroutine rrtmgp_lw_cloud_optics_init(rrtmgp_root_dir, rrtmgp_lw_file_clouds,
errmsg = ''
errflg = 0

mpiroot = 0
! Filenames are set in the physics_nml
lw_cloud_props_file = trim(rrtmgp_root_dir)//trim(rrtmgp_lw_file_clouds)

Expand Down
8 changes: 5 additions & 3 deletions physics/Radiation/RRTMGP/rrtmgp_lw_gas_optics.F90
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ module rrtmgp_lw_gas_optics

!>
subroutine rrtmgp_lw_gas_optics_init(rrtmgp_root_dir, rrtmgp_lw_file_gas, &
active_gases_array, mpicomm, mpirank, mpiroot, errmsg, errflg)
active_gases_array, mpicomm, mpirank, mpiroot1, errmsg, errflg)

! Inputs
character(len=128),intent(in) :: &
Expand All @@ -84,8 +84,9 @@ subroutine rrtmgp_lw_gas_optics_init(rrtmgp_root_dir, rrtmgp_lw_file_gas,
mpicomm !< MPI communicator
integer,intent(in) :: &
mpirank, & !< Current MPI rank
mpiroot !< Master MPI rank

mpiroot1 !< Master MPI rank
integer :: mpiroot

! Outputs
character(len=*), intent(out) :: &
errmsg !< CCPP error message
Expand All @@ -102,6 +103,7 @@ subroutine rrtmgp_lw_gas_optics_init(rrtmgp_root_dir, rrtmgp_lw_file_gas,
errmsg = ''
errflg = 0

mpiroot = 0
! Filenames are set in the physics_nml
lw_gas_props_file = trim(rrtmgp_root_dir)//trim(rrtmgp_lw_file_gas)

Expand Down
6 changes: 4 additions & 2 deletions physics/Radiation/RRTMGP/rrtmgp_sw_cloud_optics.F90
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ module rrtmgp_sw_cloud_optics
! ######################################################################################
!>
subroutine rrtmgp_sw_cloud_optics_init( rrtmgp_root_dir, rrtmgp_sw_file_clouds, &
nrghice, mpicomm, mpirank, mpiroot, errmsg, errflg)
nrghice, mpicomm, mpirank, mpiroot1, errmsg, errflg)

! Inputs
character(len=128),intent(in) :: &
Expand All @@ -57,7 +57,8 @@ subroutine rrtmgp_sw_cloud_optics_init( rrtmgp_root_dir, rrtmgp_sw_file_clouds,
mpicomm !< MPI communicator
integer, intent(in) :: &
mpirank, & !< Current MPI rank
mpiroot !< Master MPI rank
mpiroot1 !< Master MPI rank
integer :: mpiroot

! Outputs
character(len=*), intent(out) :: &
Expand All @@ -73,6 +74,7 @@ subroutine rrtmgp_sw_cloud_optics_init( rrtmgp_root_dir, rrtmgp_sw_file_clouds,
errmsg = ''
errflg = 0

mpiroot = 0
! Filenames are set in the physics_nml
sw_cloud_props_file = trim(rrtmgp_root_dir)//trim(rrtmgp_sw_file_clouds)

Expand Down
6 changes: 4 additions & 2 deletions physics/Radiation/RRTMGP/rrtmgp_sw_gas_optics.F90
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ module rrtmgp_sw_gas_optics
!! the full k-distribution data is read in, reduced by the "active gases" provided, and
!! loaded into the RRTMGP DDT, ty_gas_optics_rrtmgp.
subroutine rrtmgp_sw_gas_optics_init(rrtmgp_root_dir, rrtmgp_sw_file_gas, &
active_gases_array, mpicomm, mpirank, mpiroot, errmsg, errflg)
active_gases_array, mpicomm, mpirank, mpiroot1, errmsg, errflg)

! Inputs
character(len=128),intent(in) :: &
Expand All @@ -95,7 +95,8 @@ subroutine rrtmgp_sw_gas_optics_init(rrtmgp_root_dir, rrtmgp_sw_file_gas,
mpicomm !< MPI communicator
integer,intent(in) :: &
mpirank, & !< Current MPI rank
mpiroot !< Master MPI rank
mpiroot1 !< Master MPI rank
integer :: mpiroot

! Outputs
character(len=*), intent(out) :: &
Expand All @@ -113,6 +114,7 @@ subroutine rrtmgp_sw_gas_optics_init(rrtmgp_root_dir, rrtmgp_sw_file_gas,
errmsg = ''
errflg = 0

mpiroot = 0
! Filenames are set in the gfphysics_nml
sw_gas_props_file = trim(rrtmgp_root_dir)//trim(rrtmgp_sw_file_gas)

Expand Down