Skip to content

Commit

Permalink
Merge pull request #369 from climbfuji/ufs_public_release_update_from…
Browse files Browse the repository at this point in the history
…_dtc_20191210

ufs_public_release: updates from DTC and GSD, interstitial scheme reorganization, bug fixes, code cleanup, new physics for GFSv16beta, scientific documentation
  • Loading branch information
climbfuji authored Dec 16, 2019
2 parents 333980d + 419f816 commit 122de71
Show file tree
Hide file tree
Showing 50 changed files with 4,931 additions and 1,674 deletions.
64 changes: 57 additions & 7 deletions physics/GFS_GWD_generic.F90
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ module GFS_GWD_generic_pre

contains

!> \section arg_table_GFS_GWD_generic_pre_init Argument Table
!!
subroutine GFS_GWD_generic_pre_init()
end subroutine GFS_GWD_generic_pre_init

Expand Down Expand Up @@ -105,12 +103,64 @@ subroutine GFS_GWD_generic_pre_run( &
end subroutine GFS_GWD_generic_pre_run
!> @}

! \ingroup GFS_ogwd
! \brief Brief description of the subroutine
!
!> \section arg_table_GFS_GWD_generic_pre_finalize Argument Table
!!
subroutine GFS_GWD_generic_pre_finalize()
end subroutine GFS_GWD_generic_pre_finalize

end module GFS_GWD_generic_pre

!> This module contains the CCPP-compliant orographic gravity wave drag post
!! interstitial codes.
module GFS_GWD_generic_post

contains


subroutine GFS_GWD_generic_post_init()
end subroutine GFS_GWD_generic_post_init

!! \section arg_table_GFS_GWD_generic_post_run Argument Table
!! \htmlinclude GFS_GWD_generic_post_run.html
!!
!! \section general General Algorithm
!! \section detailed Detailed Algorithm
!! @{
subroutine GFS_GWD_generic_post_run(lssav, ldiag3d, dtf, dusfcg, dvsfcg, dudt, dvdt, dtdt, &
& dugwd, dvgwd, du3dt, dv3dt, dt3dt, errmsg, errflg)

use machine, only : kind_phys
implicit none

logical, intent(in) :: lssav, ldiag3d

real(kind=kind_phys), intent(in) :: dusfcg(:), dvsfcg(:)
real(kind=kind_phys), intent(in) :: dudt(:,:), dvdt(:,:), dtdt(:,:)
real(kind=kind_phys), intent(in) :: dtf

real(kind=kind_phys), intent(inout) :: dugwd(:), dvgwd(:)
real(kind=kind_phys), intent(inout) :: du3dt(:,:), dv3dt(:,:), dt3dt(:,:)

character(len=*), intent(out) :: errmsg
integer, intent(out) :: errflg

! Initialize CCPP error handling variables
errmsg = ''
errflg = 0

if (lssav) then
dugwd(:) = dugwd(:) + dusfcg(:)*dtf
dvgwd(:) = dvgwd(:) + dvsfcg(:)*dtf

if (ldiag3d) then
du3dt(:,:) = du3dt(:,:) + dudt(:,:) * dtf
dv3dt(:,:) = dv3dt(:,:) + dvdt(:,:) * dtf
dt3dt(:,:) = dt3dt(:,:) + dtdt(:,:) * dtf
endif
endif

end subroutine GFS_GWD_generic_post_run
!> @}

subroutine GFS_GWD_generic_post_finalize()
end subroutine GFS_GWD_generic_post_finalize

end module GFS_GWD_generic_post
137 changes: 137 additions & 0 deletions physics/GFS_GWD_generic.meta
Original file line number Diff line number Diff line change
Expand Up @@ -167,3 +167,140 @@
[ccpp-arg-table]
name = GFS_GWD_generic_pre_finalize
type = scheme

########################################################################
[ccpp-arg-table]
name = GFS_GWD_generic_post_run
type = scheme
[lssav]
standard_name = flag_diagnostics
long_name = flag for calculating diagnostic fields
units = flag
dimensions = ()
type = logical
intent = in
optional = F
[ldiag3d]
standard_name = flag_diagnostics_3D
long_name = flag for calculating 3-D diagnostic fields
units = flag
dimensions = ()
type = logical
intent = in
optional = F
[dtf]
standard_name = time_step_for_dynamics
long_name = dynamics time step
units = s
dimensions = ()
type = real
kind = kind_phys
intent = in
optional = F
[dusfcg]
standard_name = instantaneous_x_stress_due_to_gravity_wave_drag
long_name = zonal surface stress due to orographic gravity wave drag
units = Pa
dimensions = (horizontal_dimension)
type = real
kind = kind_phys
intent = in
optional = F
[dvsfcg]
standard_name = instantaneous_y_stress_due_to_gravity_wave_drag
long_name = meridional surface stress due to orographic gravity wave drag
units = Pa
dimensions = (horizontal_dimension)
type = real
kind = kind_phys
intent = in
optional = F
[dudt]
standard_name = tendency_of_x_wind_due_to_model_physics
long_name = zonal wind tendency due to model physics
units = m s-2
dimensions = (horizontal_dimension,vertical_dimension)
type = real
kind = kind_phys
intent = in
optional = F
[dvdt]
standard_name = tendency_of_y_wind_due_to_model_physics
long_name = meridional wind tendency due to model physics
units = m s-2
dimensions = (horizontal_dimension,vertical_dimension)
type = real
kind = kind_phys
intent = in
optional = F
[dtdt]
standard_name = tendency_of_air_temperature_due_to_model_physics
long_name = air temperature tendency due to model physics
units = K s-1
dimensions = (horizontal_dimension,vertical_dimension)
type = real
kind = kind_phys
intent = in
optional = F
[dugwd]
standard_name = time_integral_of_x_stress_due_to_gravity_wave_drag
long_name = integral over time of zonal stress due to gravity wave drag
units = Pa s
dimensions = (horizontal_dimension)
type = real
kind = kind_phys
intent = inout
optional = F
[dvgwd]
standard_name = time_integral_of_y_stress_due_to_gravity_wave_drag
long_name = integral over time of meridional stress due to gravity wave drag
units = Pa s
dimensions = (horizontal_dimension)
type = real
kind = kind_phys
intent = inout
optional = F
[du3dt]
standard_name = cumulative_change_in_x_wind_due_to_orographic_gravity_wave_drag
long_name = cumulative change in zonal wind due to orographic gravity wave drag
units = m s-1
dimensions = (horizontal_dimension,vertical_dimension)
type = real
kind = kind_phys
intent = inout
optional = F
[dv3dt]
standard_name = cumulative_change_in_y_wind_due_to_orographic_gravity_wave_drag
long_name = cumulative change in meridional wind due to orographic gravity wave drag
units = m s-1
dimensions = (horizontal_dimension,vertical_dimension)
type = real
kind = kind_phys
intent = inout
optional = F
[dt3dt]
standard_name = cumulative_change_in_temperature_due_to_orographic_gravity_wave_drag
long_name = cumulative change in temperature due to orographic gravity wave drag
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
units = none
dimensions = ()
type = character
kind = len=*
intent = out
optional = F
[errflg]
standard_name = ccpp_error_flag
long_name = error flag for error handling in CCPP
units = flag
dimensions = ()
type = integer
intent = out
optional = F
29 changes: 21 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 Down Expand Up @@ -180,14 +185,23 @@ subroutine GFS_MP_generic_post_run(im, ix, levs, kdt, nrcm, ncld, nncl, ntcw, nt
ice = frain*ice0 ! time-step ice
snow = frain*snow0 ! time-step snow
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 Expand Up @@ -296,7 +310,6 @@ subroutine GFS_MP_generic_post_run(im, ix, levs, kdt, nrcm, ncld, nncl, ntcw, nt
! if (snow0(i)+ice0(i)+graupel0(i)+csnow > 0.0) then
! Sfcprop%srflag(i) = 1. ! clu: set srflag to 'snow' (i.e. 1)
! endif
! compute fractional srflag
total_precip = snow0(i)+ice0(i)+graupel0(i)+rain0(i)+rainc(i)
if (total_precip > rainmin) then
srflag(i) = (snow0(i)+ice0(i)+graupel0(i)+csnow)/total_precip
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 @@ -766,6 +766,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 @@ -811,6 +819,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
Loading

0 comments on commit 122de71

Please sign in to comment.