Skip to content

Commit

Permalink
Merge pull request #1055 from grantfirl/ufs-dev-PR129
Browse files Browse the repository at this point in the history
UFS-dev PR#129
grantfirl authored Mar 11, 2024
2 parents fa3d019 + 0ef0378 commit 0ea250d
Showing 4 changed files with 131 additions and 68 deletions.
69 changes: 64 additions & 5 deletions physics/GFS_MP_generic_post.F90
Original file line number Diff line number Diff line change
@@ -21,7 +21,8 @@ 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, cpllnd, progsigma, con_g, rhowater, rainmin, dtf, &
frain, rainc, rain1, rann, xlat, xlon, gt0, gq0, prsl, prsi, phii, tsfc, ice, snow, graupel, save_t, save_q, &
frain, rainc, rain1, rann, xlat, xlon, gt0, gq0, prsl, prsi, phii, tsfc, ice, phil, htop, refl_10cm, &
imfshalcnv,imfshalcnv_gf,imfdeepcnv,imfdeepcnv_gf,imfdeepcnv_samf, con_t0c, 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, frzr, frzrb, frozr, frozrb, tsnowp, tsnowpb, rhonewsn1, exticeden, &
@@ -40,20 +41,21 @@ subroutine GFS_MP_generic_post_run(
integer, intent(in) :: imp_physics_nssl, iopt_lake_clm, iopt_lake, lkm
logical, intent(in) :: cal_pre, lssav, ldiag3d, qdiag3d, cplflx, cplchm, cpllnd, progsigma, exticeden
integer, intent(in) :: index_of_temperature,index_of_process_mp,use_lake_model(:)

integer, intent(in) :: imfshalcnv,imfshalcnv_gf,imfdeepcnv,imfdeepcnv_gf,imfdeepcnv_samf
integer, dimension (:), intent(in) :: htop
integer :: dfi_radar_max_intervals
real(kind=kind_phys), intent(in) :: fh_dfi_radar(:), fhour
real(kind=kind_phys), intent(in) :: fh_dfi_radar(:), fhour, con_t0c
real(kind=kind_phys), intent(in) :: radar_tten_limits(:)
integer :: ix_dfi_radar(:)
real(kind=kind_phys), dimension(:,:), intent(inout) :: gt0
real(kind=kind_phys), dimension(:,:), intent(inout) :: gt0,refl_10cm

real(kind=kind_phys), intent(in) :: dtf, frain, con_g, rainmin, rhowater
real(kind=kind_phys), dimension(:), intent(in) :: rain1, xlat, xlon, tsfc
real(kind=kind_phys), dimension(:), intent(inout) :: ice, snow, graupel, rainc
real(kind=kind_phys), dimension(:), intent(in) :: rain0, ice0, snow0, graupel0
real(kind=kind_phys), dimension(:,:), intent(in) :: rann
real(kind=kind_phys), dimension(:,:), intent(in) :: prsl, save_t, del
real(kind=kind_phys), dimension(:,:), intent(in) :: prsi, phii
real(kind=kind_phys), dimension(:,:), intent(in) :: prsi, phii,phil
real(kind=kind_phys), dimension(:,:,:), intent(in) :: gq0, save_q

real(kind=kind_phys), dimension(:,:,:), intent(in) :: dfi_radar_tten
@@ -112,6 +114,17 @@ subroutine GFS_MP_generic_post_run(
real :: snowrat,grauprat,icerat,curat,prcpncfr,prcpcufr
real :: rhonewsnow,rhoprcpice,rhonewgr,rhonewice

real(kind_phys), parameter :: dbzmin=-20.0
real(kind_phys) :: cuprate
real(kind_phys) :: ze, ze_conv, dbz_sum

real(kind_phys), dimension(1:im,1:levs) :: zo
real(kind_phys), dimension(1:im) :: zfrz
real(kind_phys), dimension(1:im) :: factor
real(kind_phys) ze_mp, fctz, delz
logical :: lfrz


! Initialize CCPP error handling variables
errmsg = ''
errflg = 0
@@ -121,6 +134,52 @@ subroutine GFS_MP_generic_post_run(
do i = 1, im
rain(i) = rainc(i) + frain * rain1(i) ! time-step convective plus explicit
enddo
!
! Combine convective reflectivity with MP reflectivity for selected
! parameterizations.
if ( (imp_physics==imp_physics_thompson .or. imp_physics==imp_physics_nssl) .and. &
(imfdeepcnv==imfdeepcnv_samf .or. imfdeepcnv==imfdeepcnv_gf .or. imfshalcnv==imfshalcnv_gf) ) then
do i=1,im
factor(i) = 0.0
lfrz = .true.
zfrz(i) = phil(i,1)*onebg
do k = levs, 1, -1
zo(i,k) = phil(i,k)*onebg
if (gt0(i,k) >= con_t0c .and. lfrz) then
zfrz(i) = zo(i,k)
lfrz = .false.
endif
enddo
enddo
!
do i=1,im
if(rainc (i) > 0.0 .and. htop(i) > 0) then
factor(i) = -2./max(1000., zo(i,htop(i)) - zfrz(i))
endif
enddo

! combine the reflectivity from both Thompson MP and samfdeep convection

do k=1,levs
do i=1,im
if(rainc(i) > 0. .and. k <= htop(i)) then
fctz = 0.0
delz = zo(i,k) - zfrz(i)
if(delz <0.0) then
fctz = 1. ! wrong
else
fctz = 10.**(factor(i)*delz)
endif
cuprate = rainc(i) * 3.6e6 / dtp ! cu precip rate (mm/h)
ze_conv = 300.0 * cuprate**1.4
ze_conv = fctz * ze_conv
ze_mp = 10._kind_phys ** (0.1 * refl_10cm(i,k))
dbz_sum = max(DBZmin, 10.*log10(ze_mp + ze_conv))
refl_10cm(i,k) = dbz_sum
endif
enddo
enddo
endif

! compute surface snowfall, graupel/sleet, freezing rain and precip ice density
if (imp_physics == imp_physics_gfdl .or. imp_physics == imp_physics_thompson .or. imp_physics == imp_physics_nssl ) then
66 changes: 66 additions & 0 deletions physics/GFS_MP_generic_post.meta
Original file line number Diff line number Diff line change
@@ -254,6 +254,72 @@
type = real
kind = kind_phys
intent = in
[phil]
standard_name = geopotential
long_name = layer geopotential
units = m2 s-2
dimensions = (horizontal_loop_extent,vertical_layer_dimension)
type = real
kind = kind_phys
intent = in
[htop]
standard_name = vertical_index_at_cloud_top
long_name = index for cloud top
units = index
dimensions = (horizontal_loop_extent)
type = integer
intent = in
[refl_10cm]
standard_name = radar_reflectivity_10cm
long_name = instantaneous refl_10cm
units = dBZ
dimensions = (horizontal_loop_extent,vertical_layer_dimension)
type = real
kind = kind_phys
intent = inout
[imfshalcnv]
standard_name = control_for_shallow_convection_scheme
long_name = flag for mass-flux shallow convection scheme
units = flag
dimensions = ()
type = integer
intent = in
[imfshalcnv_gf]
standard_name = identifier_for_grell_freitas_shallow_convection
long_name = flag for Grell-Freitas shallow convection scheme
units = flag
dimensions = ()
type = integer
intent = in
[imfdeepcnv]
standard_name = control_for_deep_convection_scheme
long_name = flag for mass-flux deep convection scheme
units = flag
dimensions = ()
type = integer
intent = in
[imfdeepcnv_gf]
standard_name = identifier_for_grell_freitas_deep_convection
long_name = flag for Grell-Freitas deep convection scheme
units = flag
dimensions = ()
type = integer
intent = in
[imfdeepcnv_samf]
standard_name = identifer_for_scale_aware_mass_flux_deep_convection
long_name = flag for SAMF deep convection scheme
units = flag
dimensions = ()
type = integer
intent = in
[con_t0c]
standard_name = temperature_at_zero_celsius
long_name = temperature at 0 degree Celsius
units = K
dimensions = ()
type = real
kind = kind_phys
intent = in
[tsfc]
standard_name = surface_skin_temperature
long_name = surface skin temperature
24 changes: 1 addition & 23 deletions physics/cu_gf_driver_post.F90
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@ module cu_gf_driver_post
!> \section arg_table_cu_gf_driver_post_run Argument Table
!! \htmlinclude cu_gf_driver_post_run.html
!!
subroutine cu_gf_driver_post_run (im, km, t, q, prevst, prevsq, cactiv, cactiv_m, conv_act, conv_act_m,dt, garea, raincv, maxupmf, refl_10cm, errmsg, errflg)
subroutine cu_gf_driver_post_run (im, km, t, q, prevst, prevsq, cactiv, cactiv_m, conv_act, conv_act_m, errmsg, errflg)

use machine, only: kind_phys

@@ -25,25 +25,17 @@ subroutine cu_gf_driver_post_run (im, km, t, q, prevst, prevsq, cactiv, cactiv_m
integer, intent(in) :: im, km
real(kind_phys), intent(in) :: t(:,:)
real(kind_phys), intent(in) :: q(:,:)
real(kind_phys), dimension(:),intent(in) :: garea
real(kind_phys), intent(out) :: prevst(:,:)
real(kind_phys), intent(out) :: prevsq(:,:)
integer, intent(in) :: cactiv(:)
integer, intent(in) :: cactiv_m(:)
real(kind_phys), intent(out) :: conv_act(:)
real(kind_phys), intent(out) :: conv_act_m(:)
! for Radar reflectivity
real(kind_phys), intent(in) :: dt
real(kind_phys), intent(in) :: raincv(:), maxupmf(:)
real(kind_phys), intent(inout) :: refl_10cm(:,:)
character(len=*), intent(out) :: errmsg
!$acc declare copyin(t,q,cactiv,cactiv_m) copyout(prevst,prevsq,conv_act,conv_act_m)
integer, intent(out) :: errflg

! Local variables
real(kind_phys), parameter :: dbzmin=-10.0
real(kind_phys) :: cuprate
real(kind_phys) :: ze, ze_conv, dbz_sum
integer :: i, k

! Initialize CCPP error handling variables
@@ -65,20 +57,6 @@ subroutine cu_gf_driver_post_run (im, km, t, q, prevst, prevsq, cactiv, cactiv_m
else
conv_act_m(i)=0.0
endif
! reflectivity parameterization for parameterized convection (reference:Unipost MDLFLD.f)
ze = 0.0
ze_conv = 0.0
dbz_sum = 0.0
cuprate = 1.e3*raincv(i) * 3600.0 / dt ! cu precip rate (mm/h)
if(cuprate .lt. 0.05) cuprate=0.
ze_conv = 300.0 * cuprate**1.5
if (maxupmf(i).gt.0.1 .and. cuprate.gt.0.) then
do k = 1, km
ze = 10._kind_phys ** (0.1 * refl_10cm(i,k))
dbz_sum = max(dbzmin, 10.0 * log10(ze + ze_conv))
refl_10cm(i,k) = dbz_sum
enddo
endif
enddo
!$acc end kernels

40 changes: 0 additions & 40 deletions physics/cu_gf_driver_post.meta
Original file line number Diff line number Diff line change
@@ -83,46 +83,6 @@
type = real
kind = kind_phys
intent = out
[dt]
standard_name = timestep_for_physics
long_name = physics time step
units = s
dimensions = ()
type = real
kind = kind_phys
intent = in
[garea]
standard_name = cell_area
long_name = grid cell area
units = m2
dimensions = (horizontal_loop_extent)
type = real
kind = kind_phys
intent = in
[raincv]
standard_name = lwe_thickness_of_deep_convective_precipitation_amount
long_name = deep convective rainfall amount on physics timestep
units = m
dimensions = (horizontal_loop_extent)
type = real
kind = kind_phys
intent = in
[maxupmf]
standard_name = maximum_convective_updraft_mass_flux
long_name = maximum convective updraft mass flux within a column
units = m s-1
dimensions = (horizontal_loop_extent)
type = real
kind = kind_phys
intent = in
[refl_10cm]
standard_name = radar_reflectivity_10cm
long_name = instantaneous refl_10cm
units = dBZ
dimensions = (horizontal_loop_extent,vertical_layer_dimension)
type = real
kind = kind_phys
intent = inout
[errmsg]
standard_name = ccpp_error_message
long_name = error message for error handling in CCPP

0 comments on commit 0ea250d

Please sign in to comment.