Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/NCAR/ccpp-physics into rr…
Browse files Browse the repository at this point in the history
…tmgp-dev2
  • Loading branch information
dustinswales committed Feb 12, 2020
2 parents 75c479d + 01ed01f commit 8d42056
Show file tree
Hide file tree
Showing 26 changed files with 770 additions and 335 deletions.
17 changes: 12 additions & 5 deletions physics/GFS_DCNV_generic.F90
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ end subroutine GFS_DCNV_generic_pre_finalize
!! \htmlinclude GFS_DCNV_generic_pre_run.html
!!
#endif
subroutine GFS_DCNV_generic_pre_run (im, levs, ldiag3d, do_cnvgwd, do_ca, &
subroutine GFS_DCNV_generic_pre_run (im, levs, ldiag3d, do_cnvgwd, do_ca, cplchm,&
isppt_deep, gu0, gv0, gt0, gq0_water_vapor, &
save_u, save_v, save_t, save_qv, ca_deep, &
errmsg, errflg)
dqdti, errmsg, errflg)

use machine, only: kind_phys
use machine, only: kind_phys

implicit none

integer, intent(in) :: im, levs
logical, intent(in) :: ldiag3d, do_cnvgwd, do_ca, isppt_deep
logical, intent(in) :: ldiag3d, do_cnvgwd, do_ca, cplchm, isppt_deep
real(kind=kind_phys), dimension(im,levs), intent(in) :: gu0
real(kind=kind_phys), dimension(im,levs), intent(in) :: gv0
real(kind=kind_phys), dimension(im,levs), intent(in) :: gt0
Expand All @@ -37,9 +37,12 @@ subroutine GFS_DCNV_generic_pre_run (im, levs, ldiag3d, do_cnvgwd, do_ca,
real(kind=kind_phys), dimension(im,levs), intent(inout) :: save_t
real(kind=kind_phys), dimension(im,levs), intent(inout) :: save_qv
real(kind=kind_phys), dimension(im), intent(in) :: ca_deep
! dqdti only allocated if cplchm is .true.
real(kind=kind_phys), dimension(:,:), intent(inout) :: dqdti
character(len=*), intent(out) :: errmsg
integer, intent(out) :: errflg

real(kind=kind_phys), parameter :: zero = 0.0d0
integer :: i, k

! Initialize CCPP error handling variables
Expand Down Expand Up @@ -70,14 +73,18 @@ subroutine GFS_DCNV_generic_pre_run (im, levs, ldiag3d, do_cnvgwd, do_ca,
enddo
endif

if (ldiag3d .or. isppt_deep) then
if (ldiag3d .or. cplchm .or. isppt_deep) then
do k=1,levs
do i=1,im
save_qv(i,k) = gq0_water_vapor(i,k)
enddo
enddo
endif

if (cplchm) then
dqdti = zero
endif

end subroutine GFS_DCNV_generic_pre_run

end module GFS_DCNV_generic_pre
Expand Down
17 changes: 17 additions & 0 deletions physics/GFS_DCNV_generic.meta
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@
type = logical
intent = in
optional = F
[cplchm]
standard_name = flag_for_chemistry_coupling
long_name = flag controlling cplchm collection (default off)
units = flag
dimensions = ()
type = logical
intent = in
optional = F
[isppt_deep]
standard_name = flag_for_combination_of_sppt_with_isppt_deep
long_name = switch for combination with isppt_deep.
Expand Down Expand Up @@ -130,6 +138,15 @@
kind = kind_phys
intent = in
optional = F
[dqdti]
standard_name = instantaneous_water_vapor_specific_humidity_tendency_due_to_convection
long_name = instantaneous moisture tendency due to convection
units = kg kg-1 s-1
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
30 changes: 22 additions & 8 deletions physics/GFS_MP_generic.F90
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ subroutine GFS_MP_generic_post_run(im, ix, levs, kdt, nrcm, ncld, nncl, ntcw, nt
rann, xlat, xlon, gt0, gq0, prsl, prsi, phii, tsfc, ice, snow, graupel, save_t, save_qv, 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, dt3dt, dq3dt, rain_cpl, rainc_cpl, snow_cpl, pwat, &
do_sppt, dtdtr, dtdtc, drain_cpl, dsnow_cpl, lsm, lsm_ruc, raincprv, rainncprv, iceprv, snowprv, graupelprv, &
dtp, errmsg, errflg)
do_sppt, dtdtr, dtdtc, drain_cpl, dsnow_cpl, lsm, lsm_ruc, lsm_noahmp, raincprv, rainncprv, iceprv, snowprv, &
graupelprv, draincprv, drainncprv, diceprv, dsnowprv, dgraupelprv, dtp, errmsg, errflg)
!
use machine, only: kind_phys

Expand Down Expand Up @@ -120,13 +120,18 @@ subroutine GFS_MP_generic_post_run(im, ix, levs, kdt, nrcm, ncld, nncl, ntcw, nt
real(kind=kind_phys), dimension(im), intent(inout) :: drain_cpl
real(kind=kind_phys), dimension(im), intent(inout) :: dsnow_cpl

! Rainfall variables previous time step (update for RUC LSM)
integer, intent(in) :: lsm, lsm_ruc
! Rainfall variables previous time step
integer, intent(in) :: lsm, lsm_ruc, lsm_noahmp
real(kind=kind_phys), dimension(im), intent(inout) :: raincprv
real(kind=kind_phys), dimension(im), intent(inout) :: rainncprv
real(kind=kind_phys), dimension(im), intent(inout) :: iceprv
real(kind=kind_phys), dimension(im), intent(inout) :: snowprv
real(kind=kind_phys), dimension(im), intent(inout) :: graupelprv
real(kind=kind_phys), dimension(im), intent(inout) :: draincprv
real(kind=kind_phys), dimension(im), intent(inout) :: drainncprv
real(kind=kind_phys), dimension(im), intent(inout) :: diceprv
real(kind=kind_phys), dimension(im), intent(inout) :: dsnowprv
real(kind=kind_phys), dimension(im), intent(inout) :: dgraupelprv

real(kind=kind_phys), intent(in) :: dtp

Expand All @@ -152,7 +157,7 @@ subroutine GFS_MP_generic_post_run(im, ix, levs, kdt, nrcm, ncld, nncl, ntcw, nt
errflg = 0

onebg = one/con_g

do i = 1, im
rain(i) = rainc(i) + frain * rain1(i) ! time-step convective plus explicit
enddo
Expand Down Expand Up @@ -184,14 +189,23 @@ subroutine GFS_MP_generic_post_run(im, ix, levs, kdt, nrcm, ncld, nncl, ntcw, nt
tprcp = max (0.,rain) ! time-step convective and explicit precip
ice = frain*rain1*sr ! time-step ice
end if

if (lsm==lsm_ruc) then
if (imp_physics == imp_physics_gfdl .or. imp_physics == imp_physics_thompson) then

if (lsm==lsm_ruc .or. lsm==lsm_noahmp) then
raincprv(:) = rainc(:)
rainncprv(:) = frain * rain1(:)
iceprv(:) = ice(:)
snowprv(:) = snow(:)
graupelprv(:) = graupel(:)
!for NoahMP, calculate precipitation rates from liquid water equivalent thickness for use in next time step
!Note (GJF): Precipitation LWE thicknesses are multiplied by the frain factor, and are thus on the dynamics time step, but the conversion as written
! (with dtp in the denominator) assumes the rate is calculated on the physics time step. This only works as expected when dtf=dtp (i.e. when frain=1).
if (lsm == lsm_noahmp) then
tem = 1.0 / (dtp*con_p001) !GJF: This conversion was taken from GFS_physics_driver.F90, but should denominator also have the frain factor?
draincprv(:) = tem * raincprv(:)
drainncprv(:) = tem * rainncprv(:)
dsnowprv(:) = tem * snowprv(:)
dgraupelprv(:) = tem * graupelprv(:)
diceprv(:) = tem * iceprv(:)
end if
end if

Expand Down
53 changes: 53 additions & 0 deletions physics/GFS_MP_generic.meta
Original file line number Diff line number Diff line change
Expand Up @@ -774,6 +774,14 @@
type = integer
intent = in
optional = F
[lsm_noahmp]
standard_name = flag_for_noahmp_land_surface_scheme
long_name = flag for NOAH MP land surface model
units = flag
dimensions = ()
type = integer
intent = in
optional = F
[raincprv]
standard_name = lwe_thickness_of_convective_precipitation_amount_from_previous_timestep
long_name = convective_precipitation_amount from previous timestep
Expand Down Expand Up @@ -819,6 +827,51 @@
kind = kind_phys
intent = inout
optional = F
[draincprv]
standard_name = convective_precipitation_rate_from_previous_timestep
long_name = convective precipitation rate from previous timestep
units = mm s-1
dimensions = (horizontal_dimension)
type = real
kind = kind_phys
intent = inout
optional = F
[drainncprv]
standard_name = explicit_rainfall_rate_from_previous_timestep
long_name = explicit rainfall rate previous timestep
units = mm s-1
dimensions = (horizontal_dimension)
type = real
kind = kind_phys
intent = inout
optional = F
[diceprv]
standard_name = ice_precipitation_rate_from_previous_timestep
long_name = ice precipitation rate from previous timestep
units = mm s-1
dimensions = (horizontal_dimension)
type = real
kind = kind_phys
intent = inout
optional = F
[dsnowprv]
standard_name = snow_precipitation_rate_from_previous_timestep
long_name = snow precipitation rate from previous timestep
units = mm s-1
dimensions = (horizontal_dimension)
type = real
kind = kind_phys
intent = inout
optional = F
[dgraupelprv]
standard_name = graupel_precipitation_rate_from_previous_timestep
long_name = graupel precipitation rate from previous timestep
units = mm s-1
dimensions = (horizontal_dimension)
type = real
kind = kind_phys
intent = inout
optional = F
[dtp]
standard_name = time_step_for_physics
long_name = physics timestep
Expand Down
42 changes: 32 additions & 10 deletions physics/GFS_rrtmg_post.F90
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ end subroutine GFS_rrtmg_post_init
!!
subroutine GFS_rrtmg_post_run (Model, Grid, Diag, Radtend, Statein, &
Coupling, scmpsw, im, lm, ltp, kt, kb, kd, raddt, aerodp, &
cldsa, mtopa, mbota, clouds1, cldtaulw, cldtausw, &
cldsa, mtopa, mbota, clouds1, cldtaulw, cldtausw, nday, &
errmsg, errflg)

use machine, only: kind_phys
Expand All @@ -41,7 +41,7 @@ subroutine GFS_rrtmg_post_run (Model, Grid, Diag, Radtend, Statein, &
type(GFS_diag_type), intent(inout) :: Diag
type(cmpfsw_type), dimension(size(Grid%xlon,1)), intent(in) :: scmpsw

integer, intent(in) :: im, lm, ltp, kt, kb, kd
integer, intent(in) :: im, lm, ltp, kt, kb, kd, nday
real(kind=kind_phys), intent(in) :: raddt

real(kind=kind_phys), dimension(size(Grid%xlon,1),NSPC1), intent(in) :: aerodp
Expand Down Expand Up @@ -152,18 +152,40 @@ subroutine GFS_rrtmg_post_run (Model, Grid, Diag, Radtend, Statein, &
Diag%fluxr(i,11-j) = Diag%fluxr(i,11-j) + tem0d * Statein%prsi(i,itop+kt)
Diag%fluxr(i,14-j) = Diag%fluxr(i,14-j) + tem0d * Statein%prsi(i,ibtc+kb)
Diag%fluxr(i,17-j) = Diag%fluxr(i,17-j) + tem0d * Statein%tgrs(i,itop)
enddo
enddo

! Anning adds optical depth and emissivity output
tem1 = 0.
tem2 = 0.
do k=ibtc,itop
tem1 = tem1 + cldtausw(i,k) ! approx .55 mu channel
tem2 = tem2 + cldtaulw(i,k) ! approx 10. mu channel
if (Model%lsswr .and. (nday > 0)) then
do j = 1, 3
do i = 1, IM
tem0d = raddt * cldsa(i,j)
itop = mtopa(i,j) - kd
ibtc = mbota(i,j) - kd
tem1 = 0.
do k=ibtc,itop
tem1 = tem1 + cldtausw(i,k) ! approx .55 um channel
enddo
Diag%fluxr(i,43-j) = Diag%fluxr(i,43-j) + tem0d * tem1
enddo
Diag%fluxr(i,43-j) = Diag%fluxr(i,43-j) + tem0d * tem1
Diag%fluxr(i,46-j) = Diag%fluxr(i,46-j) + tem0d * (1.0-exp(-tem2))
enddo
enddo
endif

if (Model%lslwr) then
do j = 1, 3
do i = 1, IM
tem0d = raddt * cldsa(i,j)
itop = mtopa(i,j) - kd
ibtc = mbota(i,j) - kd
tem2 = 0.
do k=ibtc,itop
tem2 = tem2 + cldtaulw(i,k) ! approx 10. um channel
enddo
Diag%fluxr(i,46-j) = Diag%fluxr(i,46-j) + tem0d * (1.0-exp(-tem2))
enddo
enddo
endif

endif

endif ! end_if_lssav
Expand Down
8 changes: 8 additions & 0 deletions physics/GFS_rrtmg_post.meta
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,14 @@
kind = kind_phys
intent = in
optional = F
[nday]
standard_name = daytime_points_dimension
long_name = daytime points dimension
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
9 changes: 5 additions & 4 deletions physics/GFS_surface_generic.F90
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,11 @@ subroutine GFS_surface_generic_pre_run (im, levs, vfrac, islmsk, isot, ivegsrc,

if (cplflx) then
do i=1,im
islmsk_cice(i) = int(slimskin_cpl(i)+0.5)
if(islmsk_cice(i) == 4)then
flag_cice(i) = .true.
ulwsfc_cice(i) = ulwsfcin_cpl(i)
islmsk_cice(i) = nint(slimskin_cpl(i))
flag_cice(i) = (islmsk_cice(i) == 4)

if (flag_cice(i)) then
! ulwsfc_cice(i) = ulwsfcin_cpl(i)
dusfc_cice(i) = dusfcin_cpl(i)
dvsfc_cice(i) = dvsfcin_cpl(i)
dtsfc_cice(i) = dtsfcin_cpl(i)
Expand Down
8 changes: 7 additions & 1 deletion physics/cires_ugwp.F90
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,13 @@ end subroutine cires_ugwp_finalize
! -----------------------------------------------------------------------
! order = dry-adj=>conv=mp-aero=>radiation -sfc/land- chem -> vertdiff-> [rf-gws]=> ion-re
! -----------------------------------------------------------------------
!>@brief The subroutine executes the CIRES UGWP
!>@brief These subroutines and modules execute the CIRES UGWP Version 0
!>\defgroup cires_ugwp_run Unified Gravity Wave Physics General Algorithm
!> @{
!! The physics of NGWs in the UGWP framework (Yudin et al. 2018 \cite yudin_et_al_2018) is represented by four GW-solvers, which is introduced in Lindzen (1981) \cite lindzen_1981, Hines (1997) \cite hines_1997, Alexander and Dunkerton (1999) \cite alexander_and_dunkerton_1999, and Scinocca (2003) \cite scinocca_2003. The major modification of these GW solvers is represented by the addition of the background dissipation of temperature and winds to the saturation criteria for wave breaking. This feature is important in the mesosphere and thermosphere for WAM applications and it considers appropriate scale-dependent dissipation of waves near the model top lid providing the momentum and energy conservation in the vertical column physics (Shaw and Shepherd 2009 \cite shaw_and_shepherd_2009). In the UGWP-v0, the modification of Scinocca (2003) \cite scinocca_2003 scheme for NGWs with non-hydrostatic and rotational effects for GW propagations and background dissipation is represented by the subroutine \ref fv3_ugwp_solv2_v0. In the next release of UGWP, additional GW-solvers will be implemented along with physics-based triggering of waves and stochastic approaches for selection of GW modes characterized by horizontal phase velocities, azimuthal directions and magnitude of the vertical momentum flux (VMF).
!!
!! In UGWP-v0, the specification for the VMF function is adopted from the GEOS-5 global atmosphere model of GMAO NASA/GSFC, as described in Molod et al. (2015) \cite molod_et_al_2015 and employed in the MERRRA-2 reanalysis (Gelaro et al., 2017 \cite gelaro_et_al_2017). The Fortran subroutine \ref slat_geos5_tamp describes the latitudinal shape of VMF-function as displayed in Figure 3 of Molod et al. (2015) \cite molod_et_al_2015. It shows that the enhanced values of VMF in the equatorial region gives opportunity to simulate the QBO-like oscillations in the equatorial zonal winds and lead to more realistic simulations of the equatorial dynamics in GEOS-5 operational and MERRA-2 reanalysis products. For the first vertically extended version of FV3GFS in the stratosphere and mesosphere, this simplified function of VMF allows us to tune the model climate and to evaluate multi-year simulations of FV3GFS with the MERRA-2 and ERA-5 reanalysis products, along with temperature, ozone, and water vapor observations of current satellite missions. After delivery of the UGWP-code, the EMC group developed and tested approach to modulate the zonal mean NGW forcing by 3D-distributions of the total precipitation as a proxy for the excitation of NGWs by convection and the vertically-integrated (surface - tropopause) Turbulent Kinetic Energy (TKE). The verification scores with updated NGW forcing, as reported elsewhere by EMC researchers, display noticeable improvements in the forecast scores produced by FV3GFS configuration extended into the mesosphere.
!!
!> \section arg_table_cires_ugwp_run Argument Table
!! \htmlinclude cires_ugwp_run.html
!!
Expand Down
4 changes: 4 additions & 0 deletions physics/cires_ugwp_triggers.F90
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,10 @@ end subroutine get_spectra_tau_okw
!
!
!
!>\ingroup cires_ugwp_run
!> @{
!!
!!
subroutine slat_geos5_tamp(im, tau_amp, xlatdeg, tau_gw)
!=================
! GEOS-5 & MERRA-2 lat-dependent GW-source function tau(z=Zlaunch) =rho*<u'w'>
Expand Down
10 changes: 10 additions & 0 deletions physics/docs/ccpp_doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ INPUT = pdftxt/mainpage.txt \
pdftxt/GFS_SAMF.txt \
pdftxt/GFS_SAMFdeep.txt \
pdftxt/GFS_GWDC.txt \
pdftxt/UGWPv0.txt \
pdftxt/GFS_SAMFshal.txt \
pdftxt/GFDL_cloud.txt \
### pdftxt/GFS_SURFACE_PERT.txt \
Expand All @@ -134,6 +135,7 @@ INPUT = pdftxt/mainpage.txt \
### pdftxt/GFSphys_namelist.txt \
### pdftxt/GFS_STOCHY_PHYS.txt \
pdftxt/suite_input.nml.txt \
pdftxt/NoahMP.txt \
### in-core MP
../gfdl_fv_sat_adj.F90 \
### time_vary
Expand Down Expand Up @@ -172,6 +174,10 @@ INPUT = pdftxt/mainpage.txt \
../sflx.f \
../namelist_soilveg.f \
../set_soilveg.f \
../sfc_noahmp_drv.f \
../module_sf_noahmplsm.f90 \
../module_sf_noahmp_glacier.f90 \
../noahmp_tables.f90 \
### Sea Ice Surface
../sfc_sice.f \
### PBL
Expand Down Expand Up @@ -199,6 +205,10 @@ INPUT = pdftxt/mainpage.txt \
### Shallow Convection
../samfshalcnv.f \
../cnvc90.f \
### Unified Gravity Wave
../cires_ugwp.F90 \
../ugwp_driver_v0.F \
../cires_ugwp_triggers.F90 \
### Microphysics
### ../gscond.f \
### ../precpd.f \
Expand Down
Loading

0 comments on commit 8d42056

Please sign in to comment.