Skip to content

Commit

Permalink
Merge pull request #525 from XiaSun-Atmos/constant
Browse files Browse the repository at this point in the history
Cleanup grandfathered stuff (use of constants from host model)-1st round
  • Loading branch information
climbfuji authored Aug 11, 2021
2 parents 0965515 + ba50531 commit aaa4792
Show file tree
Hide file tree
Showing 30 changed files with 636 additions and 114 deletions.
8 changes: 4 additions & 4 deletions physics/GFS_MP_generic.F90
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,9 @@ end subroutine GFS_MP_generic_post_init
!!
!> \section gfs_mp_gen GFS MP Generic Post General Algorithm
!> @{
subroutine GFS_MP_generic_post_run(im, levs, kdt, nrcm, nncl, ntcw, ntrac, imp_physics, imp_physics_gfdl, &
imp_physics_thompson, imp_physics_mg, imp_physics_fer_hires, cal_pre, cplflx, cplchm, con_g, dtf, frain, rainc, &
subroutine GFS_MP_generic_post_run( &
im, levs, kdt, nrcm, nncl, ntcw, ntrac, imp_physics, imp_physics_gfdl, imp_physics_thompson, &
imp_physics_mg, imp_physics_fer_hires, cal_pre, cplflx, cplchm, 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, &
Expand All @@ -103,7 +104,7 @@ subroutine GFS_MP_generic_post_run(im, levs, kdt, nrcm, nncl, ntcw, ntrac, imp_p
logical, intent(in) :: cal_pre, lssav, ldiag3d, qdiag3d, cplflx, cplchm
integer, intent(in) :: index_of_temperature,index_of_process_mp

real(kind=kind_phys), intent(in) :: dtf, frain, con_g
real(kind=kind_phys), intent(in) :: dtf, frain, con_g, rainmin
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 @@ -146,7 +147,6 @@ subroutine GFS_MP_generic_post_run(im, levs, kdt, nrcm, nncl, ntcw, ntrac, imp_p
! DH* TODO: CLEANUP, all of these should be coming in through the argument list
real(kind=kind_phys), parameter :: con_p001= 0.001_kind_phys
real(kind=kind_phys), parameter :: con_day = 86400.0_kind_phys
real(kind=kind_phys), parameter :: rainmin = 1.0e-13_kind_phys
real(kind=kind_phys), parameter :: p850 = 85000.0_kind_phys
! *DH

Expand Down
9 changes: 9 additions & 0 deletions physics/GFS_MP_generic.meta
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,15 @@
type = integer
intent = in
optional = F
[rainmin]
standard_name = lwe_thickness_of_minimum_rain_amount
long_name = minimum rain amount
units = m
dimensions = ()
type = real
kind = kind_phys
intent = in
optional = F
[nrcm]
standard_name = number_of_random_numbers
long_name = second dimension of random number stream for RAS
Expand Down
2 changes: 1 addition & 1 deletion physics/aerclm_def.F
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module aerclm_def
use machine , only : kind_phys
implicit none

integer, parameter :: levsaer=72, ntrcaerm=15, timeaer=12
integer :: latsaer, lonsaer, ntrcaer, levsw

Expand Down
7 changes: 4 additions & 3 deletions physics/cu_gf_driver.F90
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
module cu_gf_driver

! DH* TODO: replace constants with arguments to cu_gf_driver_run
use physcons , g => con_g, cp => con_cp, xlv => con_hvap, r_v => con_rv
!use physcons , g => con_g, cp => con_cp, xlv => con_hvap, r_v => con_rv
use machine , only: kind_phys
use cu_gf_deep, only: cu_gf_deep_run,neg_check,autoconv,aeroevap,fct1d3
use cu_gf_sh , only: cu_gf_sh_run
Expand Down Expand Up @@ -75,7 +75,7 @@ end subroutine cu_gf_driver_finalize
!!
!>\section gen_gf_driver GSD GF Cumulus Scheme General Algorithm
!> @{
subroutine cu_gf_driver_run(ntracer,garea,im,km,dt,cactiv, &
subroutine cu_gf_driver_run(ntracer,garea,im,km,dt,cactiv,g,cp,xlv,r_v, &
forcet,forceqv_spechum,phil,raincv,qv_spechum,t,cld1d, &
us,vs,t2di,w,qv2di_spechum,p2di,psuri, &
hbot,htop,kcnv,xland,hfx2,qfx2,cliw,clcw, &
Expand Down Expand Up @@ -106,9 +106,10 @@ subroutine cu_gf_driver_run(ntracer,garea,im,km,dt,cactiv, &
integer :: its,ite, jts,jte, kts,kte
integer, intent(in ) :: im,km,ntracer
logical, intent(in ) :: flag_for_scnv_generic_tend,flag_for_dcnv_generic_tend
real (kind=kind_phys), intent(in) :: g,cp,xlv,r_v
logical, intent(in ) :: ldiag3d

real(kind=kind_phys), optional, intent(inout) :: dtend(:,:,:)
real(kind=kind_phys), intent(inout) :: dtend(:,:,:)
integer, intent(in) :: dtidx(:,:), &
index_of_x_wind, index_of_y_wind, index_of_temperature, &
index_of_process_scnv, index_of_process_dcnv, ntqv, ntcw, ntiw
Expand Down
36 changes: 36 additions & 0 deletions physics/cu_gf_driver.meta
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,42 @@
type = integer
intent = inout
optional = F
[g]
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
[xlv]
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
[r_v]
standard_name = gas_constant_water_vapor
long_name = ideal gas constant for water vapor
units = J kg-1 K-1
dimensions = ()
type = real
kind = kind_phys
intent = in
optional = F
[forcet]
standard_name = tendency_of_air_temperature_due_to_nonphysics
long_name = temperature tendency due to dynamics only
Expand Down
15 changes: 11 additions & 4 deletions physics/dcyc2.f
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ end subroutine dcyc2t3_finalize
subroutine dcyc2t3_run &
! --- inputs:
& ( solhr,slag,sdec,cdec,sinlat,coslat, &
& con_g, con_cp, con_pi, con_sbc, &
& xlon,coszen,tsfc_lnd,tsfc_ice,tsfc_wat,tf,tsflw,tsfc, &
& sfcemis_lnd, sfcemis_ice, sfcemis_wat, &
& sfcdsw,sfcnsw,sfcdlw,swh,swhc,hlw,hlwc, &
Expand All @@ -194,8 +195,8 @@ subroutine dcyc2t3_run &
& )
!
use machine, only : kind_phys
use physcons, only : con_pi, con_sbc, con_cp, con_g
use radiation_tools, only : cmp_tlev
use radiation_tools, only : cmp_tlev

implicit none
!
! --- constant parameters:
Expand All @@ -204,8 +205,7 @@ subroutine dcyc2t3_run &
& hour12 = 12.0_kind_phys, &
& f3600 = one/3600.0_kind_phys, &
& f7200 = one/7200.0_kind_phys, &
& czlimt = 0.0001_kind_phys, & ! ~ cos(89.99427)
& pid12 = con_pi / hour12
& czlimt = 0.0001_kind_phys ! ~ cos(89.99427)

! --- inputs:
integer, intent(in) :: im, levs
Expand Down Expand Up @@ -237,6 +237,12 @@ subroutine dcyc2t3_run &
real(kind=kind_phys), dimension(:,:), intent(in) :: p_lev, &
& flux2D_lwUP, flux2D_lwDOWN, fluxlwUP_jac, t_lev

real(kind_phys), intent(in ) :: con_g, con_cp, &
& con_pi, con_sbc

real(kind_phys) :: pid12


! --- input/output:
real(kind=kind_phys), dimension(:,:), intent(inout) :: dtdt, htrlw
real(kind=kind_phys), dimension(:,:), intent(inout) :: dtdtnp
Expand Down Expand Up @@ -286,6 +292,7 @@ subroutine dcyc2t3_run &
tem1 = fhswr / deltim
nstp = max(6, nint(tem1))
nstl = max(1, nint(nstp/tem1))
pid12 = con_pi / hour12
!
! --- ... sw time-step adjustment for current cosine of zenith angle
! ----------------------------------------------------------
Expand Down
36 changes: 36 additions & 0 deletions physics/dcyc2.meta
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,42 @@
kind = kind_phys
intent = in
optional = F
[con_g]
standard_name = gravitational_acceleration
long_name = gravitational acceleration
units = m s-2
dimensions = ()
type = real
kind = kind_phys
intent = in
optional = F
[con_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
[con_pi]
standard_name = pi
long_name = ratio of a circle's circumference to its diameter
units = none
dimensions = ()
type = real
kind = kind_phys
intent = in
optional = F
[con_sbc]
standard_name = stefan_boltzmann_constant
long_name = Stefan-Boltzmann constant
units = W m-2 K-4
dimensions = ()
type = real
kind = kind_phys
intent = in
optional = F
[tsfc_lnd]
standard_name = surface_skin_temperature_over_land_interstitial
long_name = surface skin temperature over land (temporary use as interstitial)
Expand Down
28 changes: 15 additions & 13 deletions physics/get_prs_fv3.F90
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module get_prs_fv3

use machine, only: kind_phys
use physcons, only: con_fvirt
! use physcons, only: con_fvirt

!--- public declarations
public get_prs_fv3_init, get_prs_fv3_run, get_prs_fv3_finalize
Expand All @@ -18,20 +18,21 @@ end subroutine get_prs_fv3_init
!! \section arg_table_get_prs_fv3_run Argument Table
!! \htmlinclude get_prs_fv3_run.html
!!
subroutine get_prs_fv3_run(ix, levs, phii, prsi, tgrs, qgrs1, del, del_gz, errmsg, errflg)
subroutine get_prs_fv3_run(ix, levs, con_fvirt, phii, prsi, tgrs, qgrs1, del, del_gz, errmsg, errflg)

implicit none

! Interface variables
integer, intent(in) :: ix, levs
real(kind=kind_phys), intent(in) :: con_fvirt
real(kind=kind_phys), dimension(:,:), intent(in) :: phii
real(kind=kind_phys), dimension(:,:), intent(in) :: prsi
real(kind=kind_phys), dimension(:,:), intent(in) :: tgrs
real(kind=kind_phys), dimension(:,:), intent(in) :: qgrs1
real(kind=kind_phys), dimension(:,:), intent(out) :: del
real(kind=kind_phys), dimension(:,:), intent(in) :: tgrs
real(kind=kind_phys), dimension(:,:), intent(in) :: qgrs1
real(kind=kind_phys), dimension(:,:), intent(out) :: del
real(kind=kind_phys), dimension(:,:), intent(out) :: del_gz
character(len=*), intent(out) :: errmsg
integer, intent(out) :: errflg
character(len=*), intent(out) :: errmsg
integer, intent(out) :: errflg

! Local variables
integer :: i, k
Expand Down Expand Up @@ -79,19 +80,20 @@ end subroutine get_phi_fv3_init
!! \section arg_table_get_phi_fv3_run Argument Table
!! \htmlinclude get_phi_fv3_run.html
!!
subroutine get_phi_fv3_run(ix, levs, gt0, gq01, del_gz, phii, phil, errmsg, errflg)
subroutine get_phi_fv3_run(ix, levs, con_fvirt, gt0, gq01, del_gz, phii, phil, errmsg, errflg)

implicit none

! Interface variables
integer, intent(in) :: ix, levs
real(kind=kind_phys), dimension(:,:), intent(in) :: gt0
real(kind=kind_phys), dimension(:,:), intent(in) :: gq01
real(kind=kind_phys), intent(in) :: con_fvirt
real(kind=kind_phys), dimension(:,:), intent(in) :: gt0
real(kind=kind_phys), dimension(:,:), intent(in) :: gq01
real(kind=kind_phys), dimension(:,:), intent(inout) :: del_gz
real(kind=kind_phys), dimension(:,:), intent(out) :: phii
real(kind=kind_phys), dimension(:,:), intent(out) :: phil
character(len=*), intent(out) :: errmsg
integer, intent(out) :: errflg
real(kind=kind_phys), dimension(:,:), intent(out) :: phil
character(len=*), intent(out) :: errmsg
integer, intent(out) :: errflg

! Local variables
integer :: i, k
Expand Down
18 changes: 18 additions & 0 deletions physics/get_prs_fv3.meta
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,15 @@
type = integer
intent = in
optional = F
[con_fvirt]
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
[phii]
standard_name = geopotential_at_interface
long_name = interface geopotential
Expand Down Expand Up @@ -121,6 +130,15 @@
type = integer
intent = in
optional = F
[con_fvirt]
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
[gt0]
standard_name = air_temperature_of_new_state
long_name = updated air temperature
Expand Down
20 changes: 10 additions & 10 deletions physics/gfdl_cloud_microphys.F90
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,13 @@ end subroutine gfdl_cloud_microphys_finalize
!! \section arg_table_gfdl_cloud_microphys_run Argument Table
!! \htmlinclude gfdl_cloud_microphys_run.html
!!
subroutine gfdl_cloud_microphys_run( &
levs, im, con_g, con_fvirt, con_rd, con_eps, frland, garea, islmsk, &
gq0, gq0_ntcw, gq0_ntrw, gq0_ntiw, gq0_ntsw, gq0_ntgl, gq0_ntclamt, &
gt0, gu0, gv0, vvl, prsl, phii, del, &
rain0, ice0, snow0, graupel0, prcp0, sr, &
dtp, hydrostatic, phys_hydrostatic, lradar, refl_10cm, &
reset, effr_in, rew, rei, rer, res, reg, &
subroutine gfdl_cloud_microphys_run( &
levs, im, rainmin, con_g, con_fvirt, con_rd, con_eps, frland, garea, islmsk, &
gq0, gq0_ntcw, gq0_ntrw, gq0_ntiw, gq0_ntsw, gq0_ntgl, gq0_ntclamt, &
gt0, gu0, gv0, vvl, prsl, phii, del, &
rain0, ice0, snow0, graupel0, prcp0, sr, &
dtp, hydrostatic, phys_hydrostatic, lradar, refl_10cm, &
reset, effr_in, rew, rei, rer, res, reg, &
cplchm, pfi_lsan, pfl_lsan, errmsg, errflg)

use machine, only: kind_phys
Expand All @@ -130,16 +130,16 @@ subroutine gfdl_cloud_microphys_run( &
real(kind=kind_phys), parameter :: one = 1.0d0
real(kind=kind_phys), parameter :: con_p001= 0.001d0
real(kind=kind_phys), parameter :: con_day = 86400.d0
real(kind=kind_phys), parameter :: rainmin = 1.0d-13
!real(kind=kind_phys), parameter :: rainmin = 1.0d-13
! *DH

! interface variables
integer, intent(in ) :: levs, im
real(kind=kind_phys), intent(in ) :: con_g, con_fvirt, con_rd, con_eps
real(kind=kind_phys), intent(in ) :: con_g, con_fvirt, con_rd, con_eps, rainmin
real(kind=kind_phys), intent(in ), dimension(:) :: frland, garea
integer, intent(in ), dimension(:) :: islmsk
real(kind=kind_phys), intent(inout), dimension(:,:) :: gq0, gq0_ntcw, gq0_ntrw, gq0_ntiw, &
gq0_ntsw, gq0_ntgl, gq0_ntclamt
gq0_ntsw, gq0_ntgl, gq0_ntclamt
real(kind=kind_phys), intent(inout), dimension(:,:) :: gt0, gu0, gv0
real(kind=kind_phys), intent(in ), dimension(:,:) :: vvl, prsl, del
real(kind=kind_phys), intent(in ), dimension(:,:) :: phii
Expand Down
9 changes: 9 additions & 0 deletions physics/gfdl_cloud_microphys.meta
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,15 @@
type = integer
intent = in
optional = F
[rainmin]
standard_name = lwe_thickness_of_minimum_rain_amount
long_name = minimum rain amount
units = m
dimensions = ()
type = real
kind = kind_phys
intent = in
optional = F
[con_g]
standard_name = gravitational_acceleration
long_name = gravitational acceleration
Expand Down
4 changes: 2 additions & 2 deletions physics/gfdl_sfc_layer.F90
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ end subroutine gfdl_sfc_layer_finalize
!! \htmlinclude gfdl_sfc_layer_run.html
!!
subroutine gfdl_sfc_layer_run (im, nsoil, km, xlat, xlon, flag_iter, lsm, &
lsm_noah, lsm_noahmp, lsm_ruc, lsm_noah_wrfv4, icoef_sf, cplwav, &
lsm_noah, lsm_noahmp, lsm_ruc, lsm_noah_wrfv4, icoef_sf, cplwav, karman,&
cplwav2atm, lcurr_sf, pert_Cd, ntsflg, sfenth, z1, shdmax, ivegsrc, &
vegtype, sigmaf, dt, wet, dry, icy, isltyp, rd, grav, ep1, ep2, smois, &
psfc, prsl1, q1, t1, u1, v1, wspd, u10, v10, gsw, glw, tsurf_wat, &
Expand Down Expand Up @@ -157,7 +157,7 @@ subroutine gfdl_sfc_layer_run (im, nsoil, km, xlat, xlon, flag_iter, lsm, &
logical :: ch_bound_excursion

!GJF: the vonKarman constant should come in through the CCPP and be defined by the host model
real (kind=kind_phys), parameter :: karman = 0.4
real (kind=kind_phys), intent(in) :: karman
real (kind=kind_phys), parameter :: log01=log(0.01), log05=log(0.05), &
log07=log(0.07)

Expand Down
Loading

0 comments on commit aaa4792

Please sign in to comment.