Skip to content

Commit

Permalink
send constants through physcons module; sending constants through the…
Browse files Browse the repository at this point in the history
… argument list (specifically grav and cp) causes regression test failures in PROD mode
  • Loading branch information
grantfirl authored and climbfuji committed Apr 6, 2020
1 parent e839247 commit 78c03e0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 48 deletions.
27 changes: 15 additions & 12 deletions physics/moninedmf.f
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,15 @@ subroutine hedmf_run (ix,im,km,ntrac,ntcw,dv,du,tau,rtg, &
& dusfc,dvsfc,dtsfc,dqsfc,hpbl,hgamt,hgamq,dkt, &
& kinver,xkzm_m,xkzm_h,xkzm_s,lprnt,ipr, &
& xkzminv,moninq_fac,hurr_pbl,islimsk,var_ric, &
& coef_ric_l,coef_ric_s,grav,cp,hvap,fv,errmsg,errflg)
& coef_ric_l,coef_ric_s,errmsg,errflg)
!
use machine , only : kind_phys
use funcphys , only : fpvs
!GJF: Note that sending these constants through the argument list
!results in regression test failures with "PROD" mode compilation
!flags (specifically, grav and cp)
use physcons, grav => con_g, cp => con_cp,
& hvap => con_hvap, fv => con_fvirt

implicit none
!
Expand All @@ -81,7 +86,6 @@ subroutine hedmf_run (ix,im,km,ntrac,ntcw,dv,du,tau,rtg, &

!
real(kind=kind_phys), intent(in) :: delt, xkzm_m, xkzm_h, xkzm_s
real(kind=kind_phys), intent(in) :: grav, cp, hvap, fv
real(kind=kind_phys), intent(in) :: xkzminv, moninq_fac, var_ric, &
& coef_ric_l, coef_ric_s
real(kind=kind_phys), intent(inout) :: dv(im,km), du(im,km), &
Expand Down Expand Up @@ -158,7 +162,7 @@ subroutine hedmf_run (ix,im,km,ntrac,ntcw,dv,du,tau,rtg, &
! ublflg: true for unstable but not convective(strongly unstable) pbl
!
real(kind=kind_phys) aphi16, aphi5, bvf2, wfac,
& cfac, conq, cont,
& cfac, conq, cont, conw,
& dk, dkmax, dkmin,
& dq1, dsdz2, dsdzq, dsdzt,
& dsdzu, dsdzv,
Expand All @@ -182,8 +186,9 @@ subroutine hedmf_run (ix,im,km,ntrac,ntcw,dv,du,tau,rtg, &
& ptem, ptem1, ptem2, tx1(im), tx2(im)
!
real(kind=kind_phys) zstblmax,h1, h2, qlcr, actei,
& cldtime, ttend_fac

& cldtime
real :: ttend_fac

!! for hurricane application
real(kind=kind_phys) wspm(im,km-1)
integer kLOC ! RGF
Expand All @@ -192,6 +197,9 @@ subroutine hedmf_run (ix,im,km,ntrac,ntcw,dv,du,tau,rtg, &
integer, parameter :: useshape=2!0-- no change, original ALPHA adjustment,1-- shape1, 2-- shape2(adjust above sfc)
real :: smax,ashape,sz2h, sksfc,skmax,ashape1,skminusk0, hmax
cc
parameter(gravi=1.0/grav)
parameter(gocp=grav/cp)
parameter(cont=cp/grav,conq=hvap/grav,conw=1.0/grav) ! for del in pa
! parameter(cont=1000.*cp/grav,conq=1000.*hvap/grav,conw=1000./grav) ! for del in kpa
parameter(rlam=30.0,vk=0.4,vk2=vk*vk)
parameter(prmin=0.25,prmax=4.,zolcr=0.2,zolcru=-0.5)
Expand Down Expand Up @@ -242,11 +250,6 @@ subroutine hedmf_run (ix,im,km,ntrac,ntcw,dv,du,tau,rtg, &
errmsg = ''
errflg = 0

!> ## Compute preliminary variables from input arguments
gravi=1.0/grav
gocp=grav/cp
cont=cp/grav
conq=hvap/grav
! compute preliminary variables
!
if (ix .lt. im) stop
Expand Down Expand Up @@ -1393,8 +1396,8 @@ subroutine hedmf_run (ix,im,km,ntrac,ntcw,dv,du,tau,rtg, &
vtend = (a2(i,k)-v1(i,k))*rdt
du(i,k) = du(i,k) + utend
dv(i,k) = dv(i,k) + vtend
dusfc(i) = dusfc(i) + gravi*del(i,k)*utend
dvsfc(i) = dvsfc(i) + gravi*del(i,k)*vtend
dusfc(i) = dusfc(i) + conw*del(i,k)*utend
dvsfc(i) = dvsfc(i) + conw*del(i,k)*vtend
!
! for dissipative heating for ecmwf model
!
Expand Down
36 changes: 0 additions & 36 deletions physics/moninedmf.meta
Original file line number Diff line number Diff line change
Expand Up @@ -542,42 +542,6 @@
kind = kind_phys
intent = in
optional = F
[grav]
standard_name = gravitational_acceleration
long_name = gravitational acceleration
units = m s-2
dimensions = ()
type = real
kind = kind_phys
intent = in
optional = F
[cp]
standard_name = specific_heat_of_dry_air_at_constant_pressure
long_name = specific heat of dry air at constant pressure
units = J kg-1 K-1
dimensions = ()
type = real
kind = kind_phys
intent = in
optional = F
[hvap]
standard_name = latent_heat_of_vaporization_of_water_at_0C
long_name = latent heat of evaporation/sublimation
units = J kg-1
dimensions = ()
type = real
kind = kind_phys
intent = in
optional = F
[fv]
standard_name = ratio_of_vapor_to_dry_air_gas_constants_minus_one
long_name = (rv/rd) - 1 (rv = ideal gas constant for water vapor)
units = none
dimensions = ()
type = real
kind = kind_phys
intent = in
optional = F
[errmsg]
standard_name = ccpp_error_message
long_name = error message for error handling in CCPP
Expand Down

0 comments on commit 78c03e0

Please sign in to comment.