Skip to content

Commit

Permalink
Merge branch 'clm-unit-fix' into ufs-dev-PR139
Browse files Browse the repository at this point in the history
  • Loading branch information
grantfirl committed Feb 6, 2024
2 parents c7a9e0d + 846ec8e commit 3a557d7
Show file tree
Hide file tree
Showing 91 changed files with 10,631 additions and 6,050 deletions.
8 changes: 5 additions & 3 deletions physics/GFS_DCNV_generic_post.F90
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ subroutine GFS_DCNV_generic_post_run (im, levs, lssav, ldiag3d, qdiag3d, ras, &
index_of_temperature, index_of_x_wind, index_of_y_wind, ntqv, gq0, save_q, &
cnvw, cnvc, cnvw_phy_f3d, cnvc_phy_f3d, flag_for_dcnv_generic_tend, &
ntcw,ntiw,ntclamt,ntrw,ntsw,ntrnc,ntsnc,ntgl, &
ntgnc, nthl, nthnc, nthv, ntgv, ntsigma, ntrac,clw, &
ntgnc, nthl, nthnc, nthv, ntgv, ntrz, ntgz, nthz, ntsigma, ntrac,clw, &
satmedmf, trans_trac, errmsg, errflg)


Expand Down Expand Up @@ -44,8 +44,9 @@ subroutine GFS_DCNV_generic_post_run (im, levs, lssav, ldiag3d, qdiag3d, ras, &
real(kind=kind_phys), dimension(:,:,:), intent(inout) :: dtend
integer, intent(in) :: dtidx(:,:), index_of_process_dcnv, index_of_temperature, &
index_of_x_wind, index_of_y_wind, ntqv
integer, intent(in) :: ntcw,ntiw,ntclamt,ntrw,ntsw,ntrnc,ntsnc,ntgl, &
ntgnc, nthl, nthnc, nthv, ntgv, ntsigma, ntrac
integer, intent(in) :: ntcw,ntiw,ntclamt,ntrw,ntsw,ntrnc,ntsnc,ntgl, &
ntgnc, nthl, nthnc, nthv, ntgv, ntrz, ntgz, nthz, &
ntsigma, ntrac
real(kind=kind_phys), dimension(:,:,:), intent(in) :: clw


Expand Down Expand Up @@ -112,6 +113,7 @@ subroutine GFS_DCNV_generic_post_run (im, levs, lssav, ldiag3d, qdiag3d, ras, &
n /= ntrw .and. n /= ntsw .and. n /= ntrnc .and. &
n /= ntsnc .and. n /= ntgl .and. n /= ntgnc .and. &
n /= nthl .and. n /= nthnc .and. n /= nthv .and. &
n /= ntrz .and. n /= ntgz .and. n /= nthz .and. &
n /= ntgv .and. n /= ntsigma) then
tracers = tracers + 1
idtend = dtidx(100+n,index_of_process_dcnv)
Expand Down
21 changes: 21 additions & 0 deletions physics/GFS_DCNV_generic_post.meta
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,27 @@
dimensions = ()
type = integer
intent = in
[ntrz]
standard_name = index_of_reflectivity_of_rain_in_tracer_concentration_array
long_name = tracer index for rain reflectivity
units = index
dimensions = ()
type = integer
intent = in
[ntgz]
standard_name = index_of_reflectivity_of_graupel_in_tracer_concentration_array
long_name = tracer index for graupel reflectivity
units = index
dimensions = ()
type = integer
intent = in
[nthz]
standard_name = index_of_reflectivity_of_hail_in_tracer_concentration_array
long_name = tracer index for hail reflectivity
units = index
dimensions = ()
type = integer
intent = in
[clw]
standard_name = convective_transportable_tracers
long_name = array to contain cloud water and other convective trans. tracers
Expand Down
7 changes: 5 additions & 2 deletions physics/GFS_DCNV_generic_pre.F90
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ subroutine GFS_DCNV_generic_pre_run (im, levs, ldiag3d, qdiag3d, do_cnvgwd, cplc
gu0, gv0, gt0, gq0, nsamftrac, ntqv, &
save_u, save_v, save_t, save_q, clw, &
ntcw,ntiw,ntclamt,ntrw,ntsw,ntrnc,ntsnc,ntgl, &
ntgnc, nthl, nthnc, nthv, ntgv,ntsigma, &
ntgnc, nthl, nthnc, nthv, ntgv, &
ntrz, ntgz, nthz, ntsigma, &
cscnv, satmedmf, trans_trac, ras, ntrac, &
dtidx, index_of_process_dcnv, errmsg, errflg)

Expand All @@ -22,7 +23,8 @@ subroutine GFS_DCNV_generic_pre_run (im, levs, ldiag3d, qdiag3d, do_cnvgwd, cplc
implicit none

integer, intent(in) :: im, levs, nsamftrac, ntqv, index_of_process_dcnv, dtidx(:,:), &
ntcw,ntiw,ntclamt,ntrw,ntsw,ntrnc,ntsnc,ntgl,ntrac,ntgnc,nthl,nthnc,nthv,ntgv,ntsigma
ntcw,ntiw,ntclamt,ntrw,ntsw,ntrnc,ntsnc,ntgl,ntrac,ntgnc,nthl,nthnc,nthv,ntgv, &
ntrz, ntgz, nthz, ntsigma
logical, intent(in) :: ldiag3d, qdiag3d, do_cnvgwd, cplchm
real(kind=kind_phys), dimension(:,:), intent(in) :: gu0
real(kind=kind_phys), dimension(:,:), intent(in) :: gv0
Expand Down Expand Up @@ -68,6 +70,7 @@ subroutine GFS_DCNV_generic_pre_run (im, levs, ldiag3d, qdiag3d, do_cnvgwd, cplc
n /= ntrw .and. n /= ntsw .and. n /= ntrnc .and. &
n /= ntsnc .and. n /= ntgl .and. n /= ntgnc .and. &
n /= nthl .and. n /= nthnc .and. n /= nthv .and. &
n /= ntrz .and. n /= ntgz .and. n /= nthz .and. &
n /= ntgv .and. n/= ntsigma) then
tracers = tracers + 1
if(dtidx(100+n,index_of_process_dcnv)>0) then
Expand Down
21 changes: 21 additions & 0 deletions physics/GFS_DCNV_generic_pre.meta
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,27 @@
dimensions = ()
type = integer
intent = in
[ntrz]
standard_name = index_of_reflectivity_of_rain_in_tracer_concentration_array
long_name = tracer index for rain reflectivity
units = index
dimensions = ()
type = integer
intent = in
[ntgz]
standard_name = index_of_reflectivity_of_graupel_in_tracer_concentration_array
long_name = tracer index for graupel reflectivity
units = index
dimensions = ()
type = integer
intent = in
[nthz]
standard_name = index_of_reflectivity_of_hail_in_tracer_concentration_array
long_name = tracer index for hail reflectivity
units = index
dimensions = ()
type = integer
intent = in
[clw]
standard_name = convective_transportable_tracers
long_name = array to contain cloud water and other convective trans. tracers
Expand Down
69 changes: 64 additions & 5 deletions physics/GFS_MP_generic_post.F90
Original file line number Diff line number Diff line change
Expand Up @@ -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, &
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
66 changes: 66 additions & 0 deletions physics/GFS_MP_generic_post.meta
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
29 changes: 22 additions & 7 deletions physics/GFS_PBL_generic_post.F90
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ 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, &
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_fer_hires, imp_physics_nssl, nssl_ccn_on, ltaerosol, mraerosol, nssl_hail_on, &
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, &
dqdt, dusfc_cpl, dvsfc_cpl, dtsfc_cpl, dtend, dtidx, index_of_temperature, index_of_x_wind, index_of_y_wind, &
Expand All @@ -30,12 +30,12 @@ subroutine GFS_PBL_generic_post_run (im, levs, nvdiff, ntrac,
integer, parameter :: kp = kind_phys
integer, intent(in) :: im, levs, nvdiff, ntrac, ntchs, ntchm, kdt
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
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_zhao_carr, imp_physics_mg, imp_physics_fer_hires
integer, intent(in) :: imp_physics_nssl
logical, intent(in) :: nssl_ccn_on, nssl_hail_on
logical, intent(in) :: nssl_ccn_on, nssl_hail_on, nssl_3moment
logical, intent(in) :: ltaerosol, cplflx, cplaqm, cplchm, lssav, ldiag3d, lsidea, use_med_flux, mraerosol
logical, intent(in) :: hybedmf, do_shoc, satmedmf, shinhong, do_ysu

Expand Down Expand Up @@ -270,8 +270,16 @@ subroutine GFS_PBL_generic_post_run (im, levs, nvdiff, ntrac,
dqdt(i,k,ntgv) = dvdftra(i,k,14)
dqdt(i,k,nthv) = dvdftra(i,k,15)
dqdt(i,k,ntoz) = dvdftra(i,k,16)
n = 16
IF ( nssl_ccn_on ) THEN
dqdt(i,k,ntccn) = dvdftra(i,k,17)
dqdt(i,k,ntccn) = dvdftra(i,k,n+1)
n = n+1
ENDIF
IF ( nssl_3moment ) THEN
dqdt(i,k,ntrz) = dvdftra(i,k,n+1)
dqdt(i,k,ntgz) = dvdftra(i,k,n+2)
dqdt(i,k,nthz) = dvdftra(i,k,n+3)
n = n+3
ENDIF
enddo
enddo
Expand All @@ -292,9 +300,16 @@ subroutine GFS_PBL_generic_post_run (im, levs, nvdiff, ntrac,
dqdt(i,k,ntsnc) = dvdftra(i,k,10)
dqdt(i,k,ntgnc) = dvdftra(i,k,11)
dqdt(i,k,ntgv) = dvdftra(i,k,12)
dqdt(i,k,ntoz) = dvdftra(i,k,13)
dqdt(i,k,ntoz) = dvdftra(i,k,13)
n = 13
IF ( nssl_ccn_on ) THEN
dqdt(i,k,ntccn) = dvdftra(i,k,14)
dqdt(i,k,ntccn) = dvdftra(i,k,n+1)
n = n+1
ENDIF
IF ( nssl_3moment ) THEN
dqdt(i,k,ntrz) = dvdftra(i,k,n+1)
dqdt(i,k,ntgz) = dvdftra(i,k,n+2)
n = n+2
ENDIF
enddo
enddo
Expand Down
28 changes: 28 additions & 0 deletions physics/GFS_PBL_generic_post.meta
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,27 @@
dimensions = ()
type = integer
intent = in
[ntrz]
standard_name = index_of_reflectivity_of_rain_in_tracer_concentration_array
long_name = tracer index for rain reflectivity
units = index
dimensions = ()
type = integer
intent = in
[ntgz]
standard_name = index_of_reflectivity_of_graupel_in_tracer_concentration_array
long_name = tracer index for graupel reflectivity
units = index
dimensions = ()
type = integer
intent = in
[nthz]
standard_name = index_of_reflectivity_of_hail_in_tracer_concentration_array
long_name = tracer index for hail reflectivity
units = index
dimensions = ()
type = integer
intent = in
[imp_physics]
standard_name = control_for_microphysics_scheme
long_name = choice of microphysics scheme
Expand Down Expand Up @@ -295,6 +316,13 @@
dimensions = ()
type = logical
intent = in
[nssl_3moment]
standard_name = nssl_3moment
long_name = 3-moment activation flag in NSSL microphysics scheme
units = flag
dimensions = ()
type = logical
intent = in
[cplflx]
standard_name = flag_for_surface_flux_coupling
long_name = flag controlling cplflx collection (default off)
Expand Down
Loading

0 comments on commit 3a557d7

Please sign in to comment.