Skip to content
72 changes: 16 additions & 56 deletions physics/Interstitials/UFS_SCM_NEPTUNE/GFS_rrtmgp_cloud_mp.F90
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
module GFS_rrtmgp_cloud_mp
use machine, only: kind_phys
use radiation_tools, only: check_error_msg
use module_radiation_clouds, only: progcld_thompson
use module_radiation_clouds, only: progcld_thompson, cld_frac_XuRandall
use rrtmgp_lw_cloud_optics, only: &
radliq_lwr => radliq_lwrLW, radliq_upr => radliq_uprLW,&
radice_lwr => radice_lwrLW, radice_upr => radice_uprLW
Expand Down Expand Up @@ -346,7 +346,8 @@ subroutine cloud_mp_GF(nCol, nLev, lsmask, t_lay, p_lev, p_lay, qs_lay, relhum,
cld_cnv_frac !< Convective cloud-fraction (1)
! Local
integer :: iCol, iLay
real(kind_phys) :: tem1, deltaP, clwc, qc, qi
real(kind_phys) :: tem1, deltaP, clwc, qc, qi, play_pa
real(kind_phys) :: lambda = 0.50

tem1 = 1.0e5/con_g
do iLay = 1, nLev
Expand All @@ -372,8 +373,9 @@ subroutine cloud_mp_GF(nCol, nLev, lsmask, t_lay, p_lev, p_lay, qs_lay, relhum,
if(qi > 1.E-8) cld_cnv_reice(iCol,iLay) = max(173.45 + 2.14*(t_lay(iCol,iLay)-273.15), 20.)

! Xu-Randall (1996) cloud-fraction.
cld_cnv_frac(iCol,iLay) = cld_frac_XuRandall(p_lay(iCol,iLay), &
qs_lay(iCol,iLay), relhum(iCol,iLay), qc+qi, alpha0)
play_pa = p_lay(iCol,iLay) *0.01
cld_cnv_frac(iCol,iLay) = cld_frac_XuRandall(play_pa, qs_lay(iCol,iLay), &
relhum(iCol,iLay), qc+qi, alpha0, lambda, 1.0)
endif
enddo
enddo
Expand Down Expand Up @@ -489,7 +491,8 @@ subroutine cloud_mp_SAMF(nCol, nLev, t_lay, p_lev, p_lay, qs_lay, relhum,
cld_cnv_frac !< Convective cloud-fraction
! Local
integer :: iCol, iLay
real(kind_phys) :: tem0, tem1, deltaP, clwc
real(kind_phys) :: tem0, tem1, deltaP, clwc, play_pa
real(kind_phys) :: lambda = 0.50

tem0 = 1.0e5/con_g
do iLay = 1, nLev
Expand All @@ -504,8 +507,9 @@ subroutine cloud_mp_SAMF(nCol, nLev, t_lay, p_lev, p_lay, qs_lay, relhum,
cld_cnv_reice(iCol,iLay) = reice_def

! Xu-Randall (1996) cloud-fraction.
cld_cnv_frac(iCol,iLay) = cld_frac_XuRandall(p_lay(iCol,iLay), &
qs_lay(iCol,iLay), relhum(iCol,iLay), cnv_mixratio(iCol,iLay), alpha0)
play_pa = p_lay(iCol,iLay) * 0.01
cld_cnv_frac(iCol,iLay) = cld_frac_XuRandall(play_pa, qs_lay(iCol,iLay), &
relhum(iCol,iLay), cnv_mixratio(iCol,iLay), alpha0, lambda, 1.0)
endif
enddo
enddo
Expand Down Expand Up @@ -706,7 +710,8 @@ subroutine cloud_mp_thompson(nCol, nLev, nTracers, ncnd, i_cldliq, i_cldice, i_c
cld_rwp !< Cloud rain water path

! Local variables
real(kind_phys) :: tem1, pfac, cld_mr, deltaP, tem2
real(kind_phys) :: tem1, pfac, cld_mr, deltaP, tem2, play_pa
real(kind_phys) :: lambda = 0.50
real(kind_phys), dimension(nCol, nLev, min(4,ncnd)) :: cld_condensate
integer :: iCol,iLay,l

Expand Down Expand Up @@ -740,8 +745,9 @@ subroutine cloud_mp_thompson(nCol, nLev, nTracers, ncnd, i_cldliq, i_cldice, i_c
! Xu-Randall (1996) cloud-fraction. **Additionally, Conditioned on relative-humidity**
cld_mr = cld_condensate(iCol,iLay,1) + cld_condensate(iCol,iLay,2) + &
cld_condensate(iCol,iLay,3) + cld_condensate(iCol,iLay,4)
cld_frac(iCol,iLay) = cld_frac_XuRandall(p_lay(iCol,iLay), &
qs_lay(iCol,iLay), relhum(iCol,iLay), cld_mr, alpha0, cond_cfrac_onRH)
play_pa = p_lay(iCol,iLay) * 0.01
cld_frac(iCol,iLay) = cld_frac_XuRandall(play_pa, qs_lay(iCol,iLay), &
relhum(iCol,iLay), cld_mr, alpha0, lambda, 1.0, cond_cfrac_onRH)
enddo
enddo

Expand Down Expand Up @@ -769,52 +775,6 @@ subroutine cloud_mp_thompson(nCol, nLev, nTracers, ncnd, i_cldliq, i_cldice, i_c

end subroutine cloud_mp_thompson

!> This function computes the cloud-fraction following
!! Xu-Randall(1996) \cite xu_and_randall_1996
!!
function cld_frac_XuRandall(p_lay, qs_lay, relhum, cld_mr, alpha, cond_cfrac_onRH)
implicit none
! Inputs
logical, intent(in), optional :: &
cond_cfrac_onRH ! If true, cloud-fracion set to unity when rh>99%

real(kind_phys), intent(in) :: &
p_lay, & !< Pressure (Pa)
qs_lay, & !< Saturation vapor-pressure (Pa)
relhum, & !< Relative humidity
cld_mr, & !< Total cloud mixing ratio
alpha !< Scheme parameter (default=100)

! Outputs
real(kind_phys) :: cld_frac_XuRandall

! Locals
real(kind_phys) :: clwt, clwm, onemrh, tem1, tem2, tem3

! Parameters
real(kind_phys) :: &
lambda = 0.50, & !
P = 0.25

clwt = 1.0e-8 * (p_lay*0.001)
if (cld_mr > clwt) then
if(present(cond_cfrac_onRH) .and. relhum > 0.99) then
cld_frac_XuRandall = 1.
else
onemrh = max(1.e-10, 1.0 - relhum)
tem1 = alpha / min(max((onemrh*qs_lay)**lambda,0.0001),1.0)
tem2 = max(min(tem1*(cld_mr - clwt), 50.0 ), 0.0 )
tem3 = sqrt(sqrt(relhum)) ! This assumes "p" = 0.25. Identical, but cheaper than relhum**p
!
cld_frac_XuRandall = max( tem3*(1.0-exp(-tem2)), 0.0 )
endif
else
cld_frac_XuRandall = 0.0
endif

return
end function

!> This routine is a wrapper to update the Thompson effective particle sizes used by the
!! RRTMGP radiation scheme.
subroutine cmp_reff_Thompson(nLev, nCol, i_cldliq, i_cldice, i_cldsnow, i_cldice_nc, &
Expand Down