Skip to content

Commit

Permalink
Merge radar_tten support
Browse files Browse the repository at this point in the history
  • Loading branch information
SamuelTrahanNOAA committed May 5, 2021
1 parent 1488fa6 commit a5ad176
Show file tree
Hide file tree
Showing 7 changed files with 223 additions and 33 deletions.
74 changes: 61 additions & 13 deletions physics/GFS_MP_generic.F90
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ end subroutine GFS_MP_generic_pre_init
!> \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, ntrac, gt0, gq0, save_t, save_qv, save_q, errmsg, errflg)
subroutine GFS_MP_generic_pre_run(im, levs, ldiag3d, qdiag3d, do_aw, ntcw, nncl, ntrac, gt0, gq0, save_t, save_qv, save_q, num_dfi_radar, errmsg, errflg)
!
use machine, only: kind_phys

implicit none
integer, intent(in) :: im, levs, ntcw, nncl, ntrac
integer, intent(in) :: im, levs, ntcw, nncl, ntrac, num_dfi_radar
logical, intent(in) :: ldiag3d, qdiag3d, do_aw
real(kind=kind_phys), dimension(im, levs), intent(in) :: gt0
real(kind=kind_phys), dimension(im, levs, ntrac), intent(in) :: gq0
Expand All @@ -34,12 +34,14 @@ subroutine GFS_MP_generic_pre_run(im, levs, ldiag3d, qdiag3d, do_aw, ntcw, nncl,
errmsg = ''
errflg = 0

if (ldiag3d .or. do_aw) then
if (ldiag3d .or. do_aw .or. num_dfi_radar>0) then
do k=1,levs
do i=1,im
save_t(i,k) = gt0(i,k)
enddo
enddo
endif
if (ldiag3d .or. do_aw) then
if(qdiag3d) then
do k=1,levs
do i=1,im
Expand Down Expand Up @@ -90,32 +92,38 @@ subroutine GFS_MP_generic_post_run(im, levs, kdt, nrcm, ncld, nncl, ntcw, ntrac,
graupel0, del, rain, domr_diag, domzr_diag, domip_diag, doms_diag, tprcp, srflag, sr, cnvprcp, totprcp, totice, &
totsnw, totgrp, cnvprcpb, totprcpb, toticeb, totsnwb, totgrpb, dt3dt, dq3dt, rain_cpl, rainc_cpl, snow_cpl, pwat, &
do_sppt, ca_global, dtdtr, dtdtc, drain_cpl, dsnow_cpl, lsm, lsm_ruc, lsm_noahmp, raincprv, rainncprv, iceprv, snowprv, &
graupelprv, draincprv, drainncprv, diceprv, dsnowprv, dgraupelprv, dtp, errmsg, errflg)
graupelprv, draincprv, drainncprv, diceprv, dsnowprv, dgraupelprv, dtp, num_dfi_radar, fh_dfi_radar, ix_dfi_radar,&
dfi_radar_tten, radar_tten_limits, dt3dt_dfi_radar, fhour, errmsg, errflg)
!
use machine, only: kind_phys

implicit none

integer, intent(in) :: im, levs, kdt, nrcm, ncld, nncl, ntcw, ntrac
integer, intent(in) :: im, levs, kdt, nrcm, ncld, nncl, ntcw, ntrac, num_dfi_radar
integer, intent(in) :: imp_physics, imp_physics_gfdl, imp_physics_thompson, imp_physics_mg, imp_physics_fer_hires
logical, intent(in) :: cal_pre, lssav, ldiag3d, qdiag3d, cplflx, cplchm

integer, intent(in) :: ix_dfi_radar(4)
real(kind=kind_phys), intent(in) :: dtf, frain, con_g
real(kind=kind_phys), intent(in) :: radar_tten_limits(2), fh_dfi_radar(5), fhour
real(kind=kind_phys), dimension(im), intent(in) :: rain1, xlat, xlon, tsfc
real(kind=kind_phys), dimension(im), intent(inout) :: ice, snow, graupel, rainc
real(kind=kind_phys), dimension(im), intent(in) :: rain0, ice0, snow0, graupel0
real(kind=kind_phys), dimension(im,nrcm), intent(in) :: rann
real(kind=kind_phys), dimension(im,levs), intent(in) :: gt0, prsl, save_t, save_qv, del
real(kind=kind_phys), dimension(im,levs), intent(inout) :: gt0
real(kind=kind_phys), dimension(im,levs), intent(in) :: prsl, save_t, save_qv, del
real(kind=kind_phys), dimension(im,levs+1), intent(in) :: prsi, phii
real(kind=kind_phys), dimension(im,levs,ntrac), intent(in) :: gq0

real(kind=kind_phys), dimension(:,:,:), optional, intent(in) :: dfi_radar_tten

real(kind=kind_phys), dimension(im), intent(in ) :: sr
real(kind=kind_phys), dimension(im), intent(inout) :: rain, domr_diag, domzr_diag, domip_diag, doms_diag, tprcp, &
srflag, cnvprcp, totprcp, totice, totsnw, totgrp, cnvprcpb, &
totprcpb, toticeb, totsnwb, totgrpb, rain_cpl, rainc_cpl, &
snow_cpl, pwat

real(kind=kind_phys), dimension(:,:), intent(inout) :: dt3dt ! only if ldiag3d
real(kind=kind_phys), dimension(:,:), intent(inout) :: dt3dt, dt3dt_dfi_radar ! only if ldiag3d
real(kind=kind_phys), dimension(:,:), intent(inout) :: dq3dt ! only if ldiag3d and qdiag3d

! Stochastic physics / surface perturbations
Expand Down Expand Up @@ -151,10 +159,10 @@ subroutine GFS_MP_generic_post_run(im, levs, kdt, nrcm, ncld, nncl, ntcw, ntrac,
real(kind=kind_phys), parameter :: p850 = 85000.0_kind_phys
! *DH

integer :: i, k, ic
integer :: i, k, ic, itime

real(kind=kind_phys), parameter :: zero = 0.0_kind_phys, one = 1.0_kind_phys
real(kind=kind_phys) :: crain, csnow, onebg, tem, total_precip, tem1, tem2
real(kind=kind_phys) :: crain, csnow, onebg, tem, total_precip, tem1, tem2, ttend
real(kind=kind_phys), dimension(im) :: domr, domzr, domip, doms, t850, work1

! Initialize CCPP error handling variables
Expand Down Expand Up @@ -245,6 +253,44 @@ subroutine GFS_MP_generic_post_run(im, levs, kdt, nrcm, ncld, nncl, ntcw, ntrac,

endif

do itime=1,num_dfi_radar
if(ix_dfi_radar(itime)<1) cycle
if(fhour<fh_dfi_radar(itime)) cycle
if(fhour>=fh_dfi_radar(itime+1)) cycle
exit
enddo
if_radar: if(itime<=num_dfi_radar) then
radar_k: do k=3,levs-2
radar_i: do i=1,im
! if(dfi_radar_tten(i,k,itime)>-19) then
! gt0(i,k) = save_t(i,k) + dfi_radar_tten(i,k,itime)
! endif
ttend = dfi_radar_tten(i,k,itime)
if_active: if (ttend>-19) then
ttend = max(ttend,radar_tten_limits(1))
ttend = min(ttend,radar_tten_limits(2))
! add radar temp tendency
! there is radar coverage
gt0(i,k) = save_t(i,k) + ttend*dtp
endif if_active
enddo radar_i
enddo radar_k
if(ldiag3d) then
dt3dt(:,1:2) = dt3dt(:,1:2) + (gt0(:,1:2)-save_t(:,1:2))*frain
do k=3,levs-2
do i=1,im
ttend = dfi_radar_tten(i,k,itime)
if(ttend>-19) then
dt3dt_dfi_radar(i,k) = dt3dt_dfi_radar(i,k) + (gt0(i,k)-save_t(i,k)) * frain
else
dt3dt(i,k) = dt3dt(i,k) + (gt0(i,k)-save_t(i,k)) * frain
endif
enddo
enddo
dt3dt(:,levs-1:levs) = dt3dt(:,levs-1:levs) + (gt0(:,levs-1:levs)-save_t(:,levs-1:levs))*frain
endif
endif if_radar

t850(1:im) = gt0(1:im,1)

do k = 1, levs-1
Expand Down Expand Up @@ -341,11 +387,13 @@ subroutine GFS_MP_generic_post_run(im, levs, kdt, nrcm, ncld, nncl, ntcw, ntrac,
enddo

if (ldiag3d) then
do k=1,levs
do i=1,im
dt3dt(i,k) = dt3dt(i,k) + (gt0(i,k)-save_t(i,k)) * frain
if(itime>num_dfi_radar) then
do k=1,levs
do i=1,im
dt3dt(i,k) = dt3dt(i,k) + (gt0(i,k)-save_t(i,k)) * frain
enddo
enddo
enddo
endif
if (qdiag3d) then
do k=1,levs
do i=1,im
Expand Down
69 changes: 69 additions & 0 deletions physics/GFS_MP_generic.meta
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,14 @@
kind = kind_phys
intent = inout
optional = F
[num_dfi_radar]
standard_name = num_dfi_radar
long_name = number of time ranges with dfi radar tendencies
units = count
dimensions = ()
type = integer
intent = in
optional = F
[errmsg]
standard_name = ccpp_error_message
long_name = error message for error handling in CCPP
Expand Down Expand Up @@ -903,6 +911,67 @@
kind = kind_phys
intent = in
optional = F
[num_dfi_radar]
standard_name = num_dfi_radar
long_name = number of time ranges with dfi radar tendencies
units = count
dimensions = ()
type = integer
intent = in
optional = F
[fh_dfi_radar]
standard_name = times_at_which_dfi_radar_tten_is_available
long_name = times at which dfi_radar_tten is available
units = h
dimensions = (5)
type = real
kind = kind_phys
intent = in
optional = F
[ix_dfi_radar]
standard_name = time_indices_in_dfi_radar_tten
long_name = time indices in dfi radar tten
units = index
dimensions = (4)
type = integer
intent = in
optional = F
[dfi_radar_tten]
standard_name = dfi_radar_tten
long_name = prescribed microphysics temperature tendency from radar data
units = K s-1
dimensions = (horizontal_dimension,vertical_dimension,num_dfi_radar)
type = real
kind = kind_phys
intent = in
optional = F
[fhour]
standard_name = forecast_time
long_name = current forecast time
units = h
dimensions = ()
type = real
kind = kind_phys
intent = in
optional = F
[radar_tten_limits]
standard_name = allowed_bounds_of_radar_prescribed_tendencies
long_name = allowed bounds of prescribed microphysics temperature tendencies
units = K
dimensions = (2)
type = real
kind = kind_phys
intent = in
optional = F
[dt3dt_dfi_radar]
standard_name = cumulative_change_in_temperature_due_to_dfi_radar
long_name = cumulative change in temperature due to dfi radar
units = K
dimensions = (horizontal_dimension,vertical_dimension)
type = real
kind = kind_phys
intent = inout
optional = F
[errmsg]
standard_name = ccpp_error_message
long_name = error message for error handling in CCPP
Expand Down
24 changes: 12 additions & 12 deletions physics/cu_gf_deep.F90
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,7 @@ subroutine cu_gf_deep_run( &
!! more is possible, talk to developer or
!! implement yourself. pattern is expected to be
!! betwee -1 and +1
#if ( wrf_dfi_radar == 1 )
,do_capsuppress,cap_suppress_j & !
#endif
,k22 & !
,jmin,tropics) !

Expand All @@ -127,16 +125,8 @@ subroutine cu_gf_deep_run( &
real(kind=kind_phys), dimension (its:ite) &
,intent (in ) :: rand_mom,rand_vmas

#if ( wrf_dfi_radar == 1 )
!
! option of cap suppress:
! do_capsuppress = 1 do
! do_capsuppress = other don't
!
!
integer, intent(in ) ,optional :: do_capsuppress
real(kind=kind_phys), dimension( its:ite ) :: cap_suppress_j
#endif
integer, intent(in) :: do_capsuppress
real(kind=kind_phys), intent(in), optional, dimension(:) :: cap_suppress_j
!
!
!
Expand Down Expand Up @@ -448,6 +438,16 @@ subroutine cu_gf_deep_run( &
ztexec(:)=0
zqexec(:)=0
endif
if(do_capsuppress == 1) then
do i=its,itf
cap_max(i)=cap_maxs
if (abs(cap_suppress_j(i) - 1.0 ) < 0.1 ) then
cap_max(i)=cap_maxs+75.
elseif (abs(cap_suppress_j(i) - 0.0 ) < 0.1 ) then
cap_max(i)=10.0
endif
enddo
endif
!
!--- initial entrainment rate (these may be changed later on in the
!--- program
Expand Down
31 changes: 25 additions & 6 deletions physics/cu_gf_driver.F90
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ subroutine cu_gf_driver_run(ntracer,garea,im,km,dt,cactiv, &
flag_for_scnv_generic_tend,flag_for_dcnv_generic_tend, &
du3dt_SCNV,dv3dt_SCNV,dt3dt_SCNV,dq3dt_SCNV, &
du3dt_DCNV,dv3dt_DCNV,dt3dt_DCNV,dq3dt_DCNV, &
fhour,fh_dfi_radar,ix_dfi_radar,num_dfi_radar,dfi_radar_tten, &
ldiag3d,qdiag3d,qci_conv,errmsg,errflg)
!-------------------------------------------------------------
implicit none
Expand Down Expand Up @@ -109,6 +110,10 @@ subroutine cu_gf_driver_run(ntracer,garea,im,km,dt,cactiv, &
du3dt_SCNV,dv3dt_SCNV,dt3dt_SCNV,dq3dt_SCNV, &
du3dt_DCNV,dv3dt_DCNV,dt3dt_DCNV,dq3dt_DCNV

real(kind=kind_phys), intent(in) :: fhour, fh_dfi_radar(5)
integer, intent(in) :: num_dfi_radar, ix_dfi_radar(4)
real(kind=kind_phys), intent(in), pointer :: dfi_radar_tten(:,:,:)

integer, dimension (im), intent(inout) :: hbot,htop,kcnv
integer, dimension (im), intent(in) :: xland
real(kind=kind_phys), dimension (im), intent(in) :: pbl
Expand Down Expand Up @@ -185,13 +190,31 @@ subroutine cu_gf_driver_run(ntracer,garea,im,km,dt,cactiv, &
real(kind=kind_phys), dimension (im) :: hfx,qfx
real(kind=kind_phys) tem,tem1,tf,tcr,tcrf

real(kind=kind_phys) :: cap_suppress_j(im)
integer :: itime, do_cap_suppress

!parameter (tf=243.16, tcr=270.16, tcrf=1.0/(tcr-tf)) ! FV3 original
!parameter (tf=263.16, tcr=273.16, tcrf=1.0/(tcr-tf))
!parameter (tf=233.16, tcr=263.16, tcrf=1.0/(tcr-tf))
parameter (tf=258.16, tcr=273.16, tcrf=1.0/(tcr-tf)) ! as fim, HCB tuning
! initialize ccpp error handling variables
errmsg = ''
errflg = 0

do itime=1,num_dfi_radar
if(ix_dfi_radar(itime)<1) cycle
if(fhour<fh_dfi_radar(itime)) cycle
if(fhour>=fh_dfi_radar(itime+1)) cycle
exit
enddo
if_radar: if(itime<=num_dfi_radar) then
do_cap_suppress = 1
cap_suppress_j = dfi_radar_tten(:,1,itime)
else
do_cap_suppress = 0
cap_suppress_j = 0
endif if_radar

!
! Scale specific humidity to dry mixing ratio
!
Expand Down Expand Up @@ -571,9 +594,7 @@ subroutine cu_gf_driver_run(ntracer,garea,im,km,dt,cactiv, &
! more is possible, talk to developer or
! implement yourself. pattern is expected to be
! betwee -1 and +1
#if ( wrf_dfi_radar == 1 )
,do_capsuppress,cap_suppress_j &
#endif
,do_cap_suppress,cap_suppress_j &
,k22m &
,jminm,tropics)

Expand Down Expand Up @@ -652,9 +673,7 @@ subroutine cu_gf_driver_run(ntracer,garea,im,km,dt,cactiv, &
! more is possible, talk to developer or
! implement yourself. pattern is expected to be
! betwee -1 and +1
#if ( wrf_dfi_radar == 1 )
,do_capsuppress,cap_suppress_j &
#endif
,do_cap_suppress,cap_suppress_j &
,k22 &
,jmin,tropics)
jpr=0
Expand Down
Loading

0 comments on commit a5ad176

Please sign in to comment.