Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/NCAR/ccpp-physics into ccpp…
Browse files Browse the repository at this point in the history
…_scheme_sim
  • Loading branch information
dustinswales committed Apr 5, 2023
2 parents a296389 + 88ec3ca commit e49f1f6
Show file tree
Hide file tree
Showing 107 changed files with 6,353 additions and 6,957 deletions.
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[submodule "physics/rte-rrtmgp"]
path = physics/rte-rrtmgp
url = https://github.com/earth-system-radiation/rte-rrtmgp
branch = dtc/ccpp
branch = main
12 changes: 0 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,10 @@ get_filename_component(LOCAL_CURRENT_SOURCE_DIR ${FULL_PATH_TO_CMAKELISTS} DIREC
# List of files that need to be compiled without OpenMP
set(SCHEMES_OPENMP_OFF ${LOCAL_CURRENT_SOURCE_DIR}/physics/rte-rrtmgp/rrtmgp/mo_gas_optics.F90
${LOCAL_CURRENT_SOURCE_DIR}/physics/rte-rrtmgp/rrtmgp/mo_rrtmgp_constants.F90
${LOCAL_CURRENT_SOURCE_DIR}/physics/rte-rrtmgp/rrtmgp/mo_rrtmgp_util_reorder.F90
${LOCAL_CURRENT_SOURCE_DIR}/physics/rte-rrtmgp/rrtmgp/mo_gas_concentrations.F90
${LOCAL_CURRENT_SOURCE_DIR}/physics/rte-rrtmgp/rrtmgp/mo_rrtmgp_util_string.F90
${LOCAL_CURRENT_SOURCE_DIR}/physics/rte-rrtmgp/rrtmgp/kernels/mo_gas_optics_kernels.F90
${LOCAL_CURRENT_SOURCE_DIR}/physics/rte-rrtmgp/rrtmgp/kernels/mo_rrtmgp_util_reorder_kernels.F90
${LOCAL_CURRENT_SOURCE_DIR}/physics/rte-rrtmgp/rrtmgp/mo_gas_optics_rrtmgp.F90
${LOCAL_CURRENT_SOURCE_DIR}/physics/rte-rrtmgp/tests/mo_testing_io.F90
${LOCAL_CURRENT_SOURCE_DIR}/physics/rte-rrtmgp/tests/clear_sky_regression.F90
${LOCAL_CURRENT_SOURCE_DIR}/physics/rte-rrtmgp/extensions/mo_rrtmgp_clr_all_sky.F90
${LOCAL_CURRENT_SOURCE_DIR}/physics/rte-rrtmgp/extensions/mo_fluxes_byband.F90
${LOCAL_CURRENT_SOURCE_DIR}/physics/rte-rrtmgp/extensions/solar_variability/mo_solar_variability.F90
Expand All @@ -97,14 +93,6 @@ set(SCHEMES_OPENMP_OFF ${LOCAL_CURRENT_SOURCE_DIR}/physics/rte-rrtmgp/rrtmgp/mo_
${LOCAL_CURRENT_SOURCE_DIR}/physics/rte-rrtmgp/extensions/mo_compute_bc.F90
${LOCAL_CURRENT_SOURCE_DIR}/physics/rte-rrtmgp/extensions/cloud_optics/mo_cloud_sampling.F90
${LOCAL_CURRENT_SOURCE_DIR}/physics/rte-rrtmgp/extensions/cloud_optics/mo_cloud_optics.F90
${LOCAL_CURRENT_SOURCE_DIR}/physics/rte-rrtmgp/examples/mo_load_coefficients.F90
${LOCAL_CURRENT_SOURCE_DIR}/physics/rte-rrtmgp/examples/rfmip-clear-sky/rrtmgp_rfmip_sw.F90
${LOCAL_CURRENT_SOURCE_DIR}/physics/rte-rrtmgp/examples/rfmip-clear-sky/mo_rfmip_io.F90
${LOCAL_CURRENT_SOURCE_DIR}/physics/rte-rrtmgp/examples/rfmip-clear-sky/rrtmgp_rfmip_lw.F90
${LOCAL_CURRENT_SOURCE_DIR}/physics/rte-rrtmgp/examples/mo_simple_netcdf.F90
${LOCAL_CURRENT_SOURCE_DIR}/physics/rte-rrtmgp/examples/all-sky/rrtmgp_allsky.F90
${LOCAL_CURRENT_SOURCE_DIR}/physics/rte-rrtmgp/examples/all-sky/mo_load_cloud_coefficients.F90
${LOCAL_CURRENT_SOURCE_DIR}/physics/rte-rrtmgp/examples/all-sky/mo_garand_atmos_io.F90
${LOCAL_CURRENT_SOURCE_DIR}/physics/rte-rrtmgp/rte/mo_rte_config.F90
${LOCAL_CURRENT_SOURCE_DIR}/physics/rte-rrtmgp/rte/mo_source_functions.F90
${LOCAL_CURRENT_SOURCE_DIR}/physics/rte-rrtmgp/rte/mo_rte_sw.F90
Expand Down
301 changes: 186 additions & 115 deletions CODEOWNERS

Large diffs are not rendered by default.

85 changes: 79 additions & 6 deletions physics/GFS_MP_generic_post.F90
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ 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, rainmin, dtf, frain, rainc, &
rain1, rann, xlat, xlon, gt0, gq0, prsl, prsi, phii, tsfc, ice, 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, &
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, &
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, &
drain_cpl, dsnow_cpl, lsm, lsm_ruc, lsm_noahmp, raincprv, rainncprv, iceprv, snowprv, &
graupelprv, draincprv, drainncprv, diceprv, dsnowprv, dgraupelprv, dtp, dfi_radar_max_intervals, &
dtend, dtidx, index_of_temperature, index_of_process_mp,ldiag3d, qdiag3d,dqdt_qmicro, lssav, num_dfi_radar, &
Expand All @@ -37,7 +38,7 @@ subroutine GFS_MP_generic_post_run(
integer, intent(in) :: im, levs, kdt, nrcm, nncl, ntcw, ntrac, num_dfi_radar, index_of_process_dfi_radar
integer, intent(in) :: imp_physics, imp_physics_gfdl, imp_physics_thompson, imp_physics_mg, imp_physics_fer_hires
integer, intent(in) :: imp_physics_nssl
logical, intent(in) :: cal_pre, lssav, ldiag3d, qdiag3d, cplflx, cplchm, cpllnd, progsigma
logical, intent(in) :: cal_pre, lssav, ldiag3d, qdiag3d, cplflx, cplchm, cpllnd, progsigma, exticeden
integer, intent(in) :: index_of_temperature,index_of_process_mp

integer :: dfi_radar_max_intervals
Expand All @@ -46,7 +47,7 @@ subroutine GFS_MP_generic_post_run(
integer :: ix_dfi_radar(:)
real(kind=kind_phys), dimension(:,:), intent(inout) :: gt0

real(kind=kind_phys), intent(in) :: dtf, frain, con_g, rainmin
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
Expand Down Expand Up @@ -81,6 +82,13 @@ subroutine GFS_MP_generic_post_run(
real(kind=kind_phys), dimension(:), intent(inout) :: diceprv
real(kind=kind_phys), dimension(:), intent(inout) :: dsnowprv
real(kind=kind_phys), dimension(:), intent(inout) :: dgraupelprv
real(kind=kind_phys), dimension(:), intent(inout) :: frzr
real(kind=kind_phys), dimension(:), intent(inout) :: frzrb
real(kind=kind_phys), dimension(:), intent(inout) :: frozr
real(kind=kind_phys), dimension(:), intent(inout) :: frozrb
real(kind=kind_phys), dimension(:), intent(inout) :: tsnowp
real(kind=kind_phys), dimension(:), intent(inout) :: tsnowpb
real(kind=kind_phys), dimension(:), intent(inout) :: rhonewsn1
real(kind=kind_phys), dimension(:,:), intent(inout) :: dqdt_qmicro
real(kind=kind_phys), dimension(:,:), intent(inout) :: prevsq
real(kind=kind_phys), intent(in) :: dtp
Expand All @@ -101,6 +109,9 @@ subroutine GFS_MP_generic_post_run(
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

real :: snowrat,grauprat,icerat,curat,prcpncfr,prcpcufr
real :: rhonewsnow,rhoprcpice,rhonewgr,rhonewice

! Initialize CCPP error handling variables
errmsg = ''
errflg = 0
Expand All @@ -111,6 +122,68 @@ subroutine GFS_MP_generic_post_run(
rain(i) = rainc(i) + frain * rain1(i) ! time-step convective plus explicit
enddo

! 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
do i = 1, im
if (gt0(i,1) .le. 273) then
frzr(i) = frzr(i) + rain0(i)
frzrb(i) = frzrb(i) + rain0(i)
endif
tsnowp(i) = tsnowp(i) + snow0(i)
tsnowpb(i) = tsnowpb(i) + snow0(i)
frozr(i) = frozr(i) + graupel0(i)
frozrb(i) = frozrb(i) + graupel0(i)
enddo
!Compute the variable precip ice density for specific LSM schemes and options
if (exticeden) then
snowrat = 0.
grauprat = 0.
icerat = 0.
prcpncfr = 0.
prcpcufr = 0.
curat = 0.
prcpncfr = 0.
prcpcufr = 0.
rhonewsnow = 0.
rhonewgr = 0.
rhonewice = 0.
rhoprcpice = 0.
do i = 1, im
rhonewsn1(i)= 200.
prcpncfr = rain1(i)*sr(i)
if(sr(i) > 0..and. gt0(i,1) < 273.) then
prcpcufr = max(0.,rainc(i)*sr(i))
else
if(gt0(i,1) < 273.) then
prcpcufr = max(0.,rainc(i))
else
prcpcufr = 0.
endif ! gt0(i,1) < 273.
endif ! frzfrac > 0.
!
if((prcpncfr + prcpcufr) > 0.) then
! -- calculate snow, graupel and ice fractions in falling frozen precip
snowrat=min(1.,max(0.,snow0(i)/(prcpncfr + prcpcufr)))
grauprat=min(1.,max(0.,graupel0(i)/(prcpncfr + prcpcufr)))
icerat=min(1.,max(0.,(prcpncfr-snow0(i)-graupel0(i)) &
/(prcpncfr + prcpcufr)))
curat=min(1.,max(0.,(prcpcufr/(prcpncfr + prcpcufr))))

rhonewsnow=min(125.,1000.0/max(8.,(17.*tanh((276.65-gt0(i,1))*0.15))))
rhonewgr=min(500.,rhowater/max(2.,(3.5*tanh((274.15-gt0(i,1))*0.3333))))
rhonewice=rhonewsnow
!--- compute density of "precip ice" from weighted contribution
! of snow, graupel and ice fractions

rhoprcpice = min(500.,max(58.8,(rhonewsnow*snowrat + &
rhonewgr*grauprat + rhonewice*icerat + rhonewgr*curat)))
! from now on rhonewsn1 is the density of falling frozen precipitation
rhonewsn1(i)=rhoprcpice
endif
enddo
endif
endif

!> - If requested (e.g. Zhao-Carr MP scheme), call calpreciptype() to calculate dominant
!! precipitation type.
! DH* TODO - Fix wrong code in non-CCPP build (GFS_physics_driver)
Expand Down
71 changes: 71 additions & 0 deletions physics/GFS_MP_generic_post.meta
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,14 @@
type = real
kind = kind_phys
intent = in
[rhowater]
standard_name = fresh_liquid_water_density_at_0c
long_name = density of liquid water
units = kg m-3
dimensions = ()
type = real
kind = kind_phys
intent = in
[dtf]
standard_name = timestep_for_dynamics
long_name = dynamics timestep
Expand Down Expand Up @@ -278,6 +286,69 @@
type = real
kind = kind_phys
intent = inout
[frzr]
standard_name = cumulative_lwe_thickness_of_surface_freezing_rain_amount
long_name = accumulated surface freezing rain
units = m
dimensions = (horizontal_loop_extent)
type = real
kind = kind_phys
intent = inout
[frzrb]
standard_name = cumulative_lwe_thickness_of_surface_freezing_rain_amount_in_bucket
long_name = accumulated surface freezing rain in bucket
units = m
dimensions = (horizontal_loop_extent)
type = real
kind = kind_phys
intent = inout
[frozr]
standard_name = cumulative_lwe_thickness_of_surface_graupel_amount
long_name = accumulated surface graupel
units = m
dimensions = (horizontal_loop_extent)
type = real
kind = kind_phys
intent = inout
[frozrb]
standard_name = cumulative_lwe_thickness_of_surface_graupel_amount_in_bucket
long_name = accumulated surface graupel in bucket
units = m
dimensions = (horizontal_loop_extent)
type = real
kind = kind_phys
intent = inout
[tsnowp]
standard_name = cumulative_lwe_thickness_of_surface_snow_amount
long_name = accumulated surface snow
units = m
dimensions = (horizontal_loop_extent)
type = real
kind = kind_phys
intent = inout
[tsnowpb]
standard_name = cumulative_lwe_thickness_of_surface_snow_amount_in_bucket
long_name = accumulated surface snow in bucket
units = m
dimensions = (horizontal_loop_extent)
type = real
kind = kind_phys
intent = inout
[rhonewsn1]
standard_name = surface_frozen_precipitation_density
long_name = density of precipitation ice
units = kg m-3
dimensions = (horizontal_loop_extent)
type = real
kind = kind_phys
intent = inout
[exticeden]
standard_name = do_external_surface_frozen_precipitation_density
long_name = flag for calculating frozen precip ice density outside of the LSM
units = flag
dimensions = ()
type = logical
intent = in
[save_t]
standard_name = air_temperature_save
long_name = air temperature before entering a physics scheme
Expand Down
80 changes: 39 additions & 41 deletions physics/GFS_cloud_diagnostics.F90
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

module GFS_cloud_diagnostics
use machine, only: kind_phys
use physparam, only: icldflg
use module_radiation_clouds, only: gethml

! Module parameters (imported directly from radiation_cloud.f)
Expand All @@ -19,10 +18,6 @@ module GFS_cloud_diagnostics

! Version tag and last revision date
character(40), parameter :: VTAGCLD='UFS-cloud-diagnostics vX.x May 2020 '

! Module variables
integer :: &
llyr = 2 ! Upper limit of boundary layer clouds

public GFS_cloud_diagnostics_run

Expand All @@ -36,51 +31,54 @@ module GFS_cloud_diagnostics
!> \section arg_table_GFS_cloud_diagnostics_run
!! \htmlinclude GFS_cloud_diagnostics_run.html
!!
subroutine GFS_cloud_diagnostics_run(nCol, nLev, iovr_rand, iovr_maxrand, iovr_max, &
iovr_dcorr, iovr_exp, iovr_exprand, lsswr, lslwr, lat, de_lgth, p_lay, &
subroutine GFS_cloud_diagnostics_run(nCol, nLev, iovr, iovr_rand, iovr_maxrand, &
iovr_max, iovr_dcorr, iovr_exp, iovr_exprand, lsswr, lslwr, lat, de_lgth, p_lay, &
cld_frac, p_lev, deltaZ, cloud_overlap_param, precip_overlap_param, con_pi, &
mtopa, mbota, cldsa, errmsg, errflg)
top_at_1, si, mtopa, mbota, cldsa, errmsg, errflg)
implicit none

! Inputs
integer, intent(in) :: &
nCol, & ! Number of horizontal grid-points
nLev ! Number of vertical-layers
integer, intent(in) :: &
iovr_rand, & ! Flag for random cloud overlap method
iovr_maxrand, & ! Flag for maximum-random cloud overlap method
iovr_max, & ! Flag for maximum cloud overlap method
iovr_dcorr, & ! Flag for decorrelation-length cloud overlap method
iovr_exp, & ! Flag for exponential cloud overlap method
iovr_exprand ! Flag for exponential-random cloud overlap method
logical, intent(in) :: &
lsswr, & ! Call SW radiation?
lslwr ! Call LW radiation
real(kind_phys), intent(in) :: &
con_pi ! Physical constant: pi
integer, intent(in) :: &
nCol, & ! Number of horizontal grid-points
nLev ! Number of vertical-layers
integer, intent(in) :: &
iovr, & ! Choice of cloud-overlap method
iovr_rand, & ! Flag for random cloud overlap method
iovr_maxrand, & ! Flag for maximum-random cloud overlap method
iovr_max, & ! Flag for maximum cloud overlap method
iovr_dcorr, & ! Flag for decorrelation-length cloud overlap method
iovr_exp, & ! Flag for exponential cloud overlap method
iovr_exprand ! Flag for exponential-random cloud overlap method
logical, intent(in) :: &
lsswr, & ! Call SW radiation?
lslwr, & ! Call LW radiation?
top_at_1 ! Vertical ordering flag
real(kind_phys), intent(in) :: &
con_pi ! Physical constant: pi
real(kind_phys), dimension(:), intent(in) :: &
lat, & ! Latitude
de_lgth ! Decorrelation length
lat, & ! Latitude
de_lgth, & ! Decorrelation length
si ! Vertical sigma coordinate
real(kind_phys), dimension(:,:), intent(in) :: &
p_lay, & ! Pressure at model-layer
cld_frac ! Total cloud fraction
p_lay, & ! Pressure at model-layer
cld_frac ! Total cloud fraction
real(kind_phys), dimension(:,:), intent(in) :: &
p_lev ! Pressure at model interfaces
p_lev ! Pressure at model interfaces
real(kind_phys), dimension(:,:), intent(in) :: &
deltaZ, & ! Layer thickness (m)
cloud_overlap_param, & ! Cloud-overlap parameter
precip_overlap_param ! Precipitation overlap parameter
deltaZ, & ! Layer thickness (m)
cloud_overlap_param, & ! Cloud-overlap parameter
precip_overlap_param ! Precipitation overlap parameter

! Outputs
character(len=*), intent(out) :: &
errmsg ! Error message
integer, intent(out) :: &
errflg ! Error flag
integer,dimension(:,:),intent(out) :: &
mbota, & ! Vertical indices for cloud tops
mtopa ! Vertical indices for cloud bases
character(len=*), intent(out) :: &
errmsg ! Error message
integer, intent(out) :: &
errflg ! Error flag
integer,dimension(:,:),intent(out) :: &
mbota, & ! Vertical indices for cloud tops
mtopa ! Vertical indices for cloud bases
real(kind_phys),dimension(:,:), intent(out) :: &
cldsa ! Fraction of clouds for low, middle, high, total and BL
cldsa ! Fraction of clouds for low, middle, high, total and BL

! Local variables
integer i,id,iCol,iLay,icld
Expand Down Expand Up @@ -111,8 +109,8 @@ subroutine GFS_cloud_diagnostics_run(nCol, nLev, iovr_rand, iovr_maxrand, iovr_m
! defined by ptopc. The cloud overlapping method is defined by control flag 'iovr', which may
! be different for lw and sw radiation programs.
call gethml(p_lay*0.01, ptop1, cld_frac, cldcnv, deltaZ, de_lgth, cloud_overlap_param,&
nCol, nLev, iovr_rand, iovr_maxrand, iovr_max, iovr_dcorr, iovr_exp, &
iovr_exprand, cldsa, mtopa, mbota)
nCol, nLev, iovr, iovr_rand, iovr_maxrand, iovr_max, iovr_dcorr, iovr_exp, &
iovr_exprand, top_at_1, si, cldsa, mtopa, mbota)

end subroutine GFS_cloud_diagnostics_run
!> @}
Expand Down
Loading

0 comments on commit e49f1f6

Please sign in to comment.