Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move some hardcoded parameters to the paramsfile #1039

Merged
merged 11 commits into from
Jun 18, 2020
4 changes: 2 additions & 2 deletions bld/namelist_files/namelist_defaults_ctsm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -393,8 +393,8 @@ attributes from the config_cache.xml file (with keys converted to upper-case).
<!-- The default filenames are given relative to the root directory
for the CLM2 data in the CESM distribution -->
<!-- Plant function types (relative to {csmdata}) -->
<paramfile phys="clm5_0">lnd/clm2/paramdata/clm5_params.c200519.nc</paramfile>
<paramfile phys="clm4_5">lnd/clm2/paramdata/clm_params.c200519.nc</paramfile>
<paramfile phys="clm5_0">lnd/clm2/paramdata/clm5_params.c200612b.nc</paramfile>
<paramfile phys="clm4_5">lnd/clm2/paramdata/clm45_params.c200613b.nc</paramfile>

<!-- ================================================================== -->
<!-- FATES default parameter file -->
Expand Down
39 changes: 36 additions & 3 deletions src/biogeochem/CNFireLi2016Mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ module CNFireLi2016Mod
!
! !PUBLIC TYPES:
public :: cnfire_li2016_type
public :: readParams
!
type, extends(cnfire_base_type) :: cnfire_li2016_type
private
Expand All @@ -58,6 +59,16 @@ module CNFireLi2016Mod
procedure, public :: CNFireArea ! Calculate fire area
end type cnfire_li2016_type

!
! !PRIVATE MEMBER DATA:
!-----------------------------------------------------------------------

type, private :: params_type
real(r8) :: prh30 ! Factor related to dependence of fuel combustibility on 30-day running mean of relative humidity (unitless)
real(r8) :: ignition_efficiency ! Ignition efficiency of cloud-to-ground lightning (unitless)
end type params_type
type(params_type), private :: params_inst

character(len=*), parameter, private :: sourcefile = &
__FILE__

Expand All @@ -77,6 +88,28 @@ function need_lightning_and_popdens(this)
need_lightning_and_popdens = .true.
end function need_lightning_and_popdens

!-----------------------------------------------------------------------
subroutine readParams( ncid )
!
! !USES:
use ncdio_pio, only: file_desc_t
use paramUtilMod, only: readNcdioScalar
!
! !ARGUMENTS:
implicit none
type(file_desc_t),intent(inout) :: ncid ! pio netCDF file id
!
! !LOCAL VARIABLES:
character(len=*), parameter :: subname = 'readCNFireLi2016Params'
!--------------------------------------------------------------------

! Factor related to dependence of fuel combustibility on 30-day running mean of relative humidity (unitless)
call readNcdioScalar(ncid, 'prh30', subname, params_inst%prh30)
! Ignition efficiency of cloud-to-ground lightning (unitless)
call readNcdioScalar(ncid, 'ignition_efficiency', subname, params_inst%ignition_efficiency)

end subroutine readParams

!-----------------------------------------------------------------------
subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_soilp, &
atm2lnd_inst, energyflux_inst, saturated_excess_runoff_inst, waterdiagnosticbulk_inst, &
Expand Down Expand Up @@ -593,7 +626,7 @@ subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_
if (trotr1_col(c)+trotr2_col(c)<=0.6_r8) then
afuel =min(1._r8,max(0._r8,(fuelc(c)-2500._r8)/(5000._r8-2500._r8)))
arh=1._r8-max(0._r8, min(1._r8,(forc_rh(g)-rh_low)/(rh_hgh-rh_low)))
arh30=1._r8-max(0.7_r8, min(1._r8,rh30_col(c)/90._r8))
arh30=1._r8-max(params_inst%prh30, min(1._r8,rh30_col(c)/90._r8))
if (forc_rh(g) < rh_hgh.and. wtlf(c) > 0._r8 .and. tsoi17(c)> SHR_CONST_TKFRZ)then
fire_m = ((afuel*arh30+(1._r8-afuel)*arh)**1.5_r8)*((1._r8 -max(0._r8,&
min(1._r8,(btran_col(c)/wtlf(c)-bt_min)/(bt_max-bt_min))))**0.5_r8)
Expand All @@ -602,8 +635,8 @@ subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_
end if
lh = pot_hmn_ign_counts_alpha*6.8_r8*hdmlf**(0.43_r8)/30._r8/24._r8
fs = 1._r8-(0.01_r8+0.98_r8*exp(-0.025_r8*hdmlf))
ig = (lh+this%forc_lnfm(g)/(5.16_r8+2.16_r8*cos(SHR_CONST_PI/180._r8*3*min(60._r8,abs(grc%latdeg(g)))))*0.22_r8) &
*(1._r8-fs)*(1._r8-cropf_col(c))
ig = (lh+this%forc_lnfm(g)/(5.16_r8+2.16_r8*cos(SHR_CONST_PI/180._r8*3*min(60._r8,abs(grc%latdeg(g)))))* &
params_inst%ignition_efficiency)*(1._r8-fs)*(1._r8-cropf_col(c))
nfire(c) = ig/secsphr*fb*fire_m*lgdp_col(c) !fire counts/km2/sec
Lb_lf = 1._r8+10._r8*(1._r8-EXP(-0.06_r8*forc_wind(g)))
spread_m = fire_m**0.5_r8
Expand Down
9 changes: 6 additions & 3 deletions src/biogeophys/BareGroundFluxesMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@ module BareGroundFluxesMod
public :: readParams

type, private :: params_type
real(r8) :: a_coef ! Drag coefficient under less dense canopy (unitless)
real(r8) :: a_exp ! Drag exponent under less dense canopy (unitless)
real(r8) :: a_coef ! Drag coefficient under less dense canopy (unitless)
real(r8) :: a_exp ! Drag exponent under less dense canopy (unitless)
real(r8) :: wind_min ! Minimum wind speed at the atmospheric forcing height (m/s)
end type params_type
type(params_type), private :: params_inst
!------------------------------------------------------------------------------
Expand All @@ -60,6 +61,8 @@ subroutine readParams( ncid )
call readNcdioScalar(ncid, 'a_coef', subname, params_inst%a_coef)
! Drag exponent under less dense canopy (unitless)
call readNcdioScalar(ncid, 'a_exp', subname, params_inst%a_exp)
! Minimum wind speed at the atmospheric forcing height (m/s)
call readNcdioScalar(ncid, 'wind_min', subname, params_inst%wind_min)

end subroutine readParams

Expand Down Expand Up @@ -287,7 +290,7 @@ subroutine BareGroundFluxes(bounds, num_noexposedvegp, filter_noexposedvegp, &
dlrad(p) = 0._r8
ulrad(p) = 0._r8

ur(p) = max(1.0_r8,sqrt(forc_u(g)*forc_u(g)+forc_v(g)*forc_v(g)))
ur(p) = max(params_inst%wind_min,sqrt(forc_u(g)*forc_u(g)+forc_v(g)*forc_v(g)))
dth(p) = thm(p)-t_grnd(c)
dqh(p) = forc_q(c) - qg(c)
dthv = dth(p)*(1._r8+0.61_r8*forc_q(c))+0.61_r8*forc_th(c)*dqh(p)
Expand Down
17 changes: 10 additions & 7 deletions src/biogeophys/CanopyFluxesMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,13 @@ module CanopyFluxesMod
public :: readParams

type, private :: params_type
real(r8) :: lai_dl ! Plant litter area index (m2/m2)
real(r8) :: z_dl ! Litter layer thickness (m)
real(r8) :: a_coef ! Drag coefficient under less dense canopy (unitless)
real(r8) :: a_exp ! Drag exponent under less dense canopy (unitless)
real(r8) :: csoilc ! Soil drag coefficient under dense canopy (unitless)
real(r8) :: cv ! Turbulent transfer coeff. between canopy surface and canopy air (m/s^(1/2))
real(r8) :: lai_dl ! Plant litter area index (m2/m2)
real(r8) :: z_dl ! Litter layer thickness (m)
real(r8) :: a_coef ! Drag coefficient under less dense canopy (unitless)
real(r8) :: a_exp ! Drag exponent under less dense canopy (unitless)
real(r8) :: csoilc ! Soil drag coefficient under dense canopy (unitless)
real(r8) :: cv ! Turbulent transfer coeff. between canopy surface and canopy air (m/s^(1/2))
real(r8) :: wind_min ! Minimum wind speed at the atmospheric forcing height (m/s)
end type params_type
type(params_type), private :: params_inst
!
Expand Down Expand Up @@ -176,6 +177,8 @@ subroutine readParams( ncid )
call readNcdioScalar(ncid, 'csoilc', subname, params_inst%csoilc)
! Turbulent transfer coeff between canopy surface and canopy air (m/s^(1/2))
call readNcdioScalar(ncid, 'cv', subname, params_inst%cv)
! Minimum wind speed at the atmospheric forcing height (m/s)
call readNcdioScalar(ncid, 'wind_min', subname, params_inst%wind_min)

end subroutine readParams

Expand Down Expand Up @@ -755,7 +758,7 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp,
taf(p) = (t_grnd(c) + thm(p))/2._r8
qaf(p) = (forc_q(c)+qg(c))/2._r8

ur(p) = max(1.0_r8,sqrt(forc_u(g)*forc_u(g)+forc_v(g)*forc_v(g)))
ur(p) = max(params_inst%wind_min,sqrt(forc_u(g)*forc_u(g)+forc_v(g)*forc_v(g)))
dth(p) = thm(p)-taf(p)
dqh(p) = forc_q(c)-qaf(p)
delq(p) = qg(c) - qaf(p)
Expand Down
2 changes: 1 addition & 1 deletion src/biogeophys/HydrologyDrainageMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module HydrologyDrainageMod
use shr_log_mod , only : errMsg => shr_log_errMsg
use decompMod , only : bounds_type
use clm_varctl , only : iulog, use_vichydro
use clm_varcon , only : e_ice, denh2o, denice, rpi, spval
use clm_varcon , only : denh2o, denice, rpi, spval
use atm2lndType , only : atm2lnd_type
use glc2lndMod , only : glc2lnd_type
use SoilHydrologyType , only : soilhydrology_type
Expand Down
2 changes: 1 addition & 1 deletion src/biogeophys/HydrologyNoDrainageMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Module HydrologyNoDrainageMod
use shr_log_mod , only : errMsg => shr_log_errMsg
use decompMod , only : bounds_type
use clm_varctl , only : iulog, use_vichydro, use_fates
use clm_varcon , only : e_ice, denh2o, denice, rpi, spval
use clm_varcon , only : denh2o, denice, rpi, spval
use CLMFatesInterfaceMod, only : hlm_fates_interface_type
use atm2lndType , only : atm2lnd_type
use AerosolMod , only : aerosol_type
Expand Down
31 changes: 29 additions & 2 deletions src/biogeophys/InfiltrationExcessRunoffMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module InfiltrationExcessRunoffMod
use decompMod , only : bounds_type
use abortutils , only : endrun
use clm_varctl , only : iulog, use_vichydro
use clm_varcon , only : spval, e_ice
use clm_varcon , only : spval
use SoilHydrologyType, only : soilhydrology_type
use SoilStateType , only : soilstate_type
use SaturatedExcessRunoffMod, only : saturated_excess_runoff_type
Expand All @@ -24,6 +24,13 @@ module InfiltrationExcessRunoffMod

! !PUBLIC TYPES:

public :: readParams

type, private :: params_type
real(r8) :: e_ice ! Soil ice impedance factor (unitless)
end type params_type
type(params_type), private :: params_inst

type, public :: infiltration_excess_runoff_type
private
! Public data members
Expand Down Expand Up @@ -70,6 +77,26 @@ module InfiltrationExcessRunoffMod
! Infrastructure routines
! ========================================================================

!-----------------------------------------------------------------------
subroutine readParams( ncid )
!
! !USES:
use ncdio_pio, only: file_desc_t
use paramUtilMod, only: readNcdioScalar
!
! !ARGUMENTS:
implicit none
type(file_desc_t),intent(inout) :: ncid ! pio netCDF file id
!
! !LOCAL VARIABLES:
character(len=*), parameter :: subname = 'readParams_InfiltrationExcessRunoff'
!--------------------------------------------------------------------

! Soil ice impedance factor (unitless)
call readNcdioScalar(ncid, 'e_ice', subname, params_inst%e_ice)

end subroutine readParams

!-----------------------------------------------------------------------
subroutine Init(this, bounds)
!
Expand Down Expand Up @@ -269,7 +296,7 @@ subroutine ComputeQinmaxHksat(bounds, num_hydrologyc, filter_hydrologyc, &

do fc = 1, num_hydrologyc
c = filter_hydrologyc(fc)
qinmax_on_unsaturated_area(c) = minval(10._r8**(-e_ice*(icefrac(c,1:3)))*hksat(c,1:3))
qinmax_on_unsaturated_area(c) = minval(10._r8**(-params_inst%e_ice*(icefrac(c,1:3)))*hksat(c,1:3))
end do

end associate
Expand Down
11 changes: 7 additions & 4 deletions src/biogeophys/LakeFluxesMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,10 @@ module LakeFluxesMod
public :: readParams

type, private :: params_type
real(r8) :: a_coef ! Drag coefficient under less dense canopy (unitless)
real(r8) :: a_exp ! Drag exponent under less dense canopy (unitless)
real(r8) :: zsno ! Momentum roughness length for snow (m)
real(r8) :: a_coef ! Drag coefficient under less dense canopy (unitless)
real(r8) :: a_exp ! Drag exponent under less dense canopy (unitless)
real(r8) :: zsno ! Momentum roughness length for snow (m)
real(r8) :: wind_min ! Minimum wind speed at the atmospheric forcing height (m/s)
end type params_type
type(params_type), private :: params_inst
!-----------------------------------------------------------------------
Expand All @@ -63,6 +64,8 @@ subroutine readParams( ncid )
call readNcdioScalar(ncid, 'a_exp', subname, params_inst%a_exp)
! Momentum roughness length for snow (m)
call readNcdioScalar(ncid, 'zsno', subname, params_inst%zsno)
! Minimum wind speed at the atmospheric forcing height (m/s)
call readNcdioScalar(ncid, 'wind_min', subname, params_inst%wind_min)

end subroutine readParams

Expand Down Expand Up @@ -392,7 +395,7 @@ subroutine LakeFluxes(bounds, num_lakec, filter_lakec, num_lakep, filter_lakep,

! Initialize stability variables

ur(p) = max(1.0_r8,sqrt(forc_u(g)*forc_u(g)+forc_v(g)*forc_v(g)))
ur(p) = max(params_inst%wind_min,sqrt(forc_u(g)*forc_u(g)+forc_v(g)*forc_v(g)))
dth(p) = thm(p)-t_grnd(c)
dqh(p) = forc_q(c)-qsatg(c)
dthv = dth(p)*(1._r8+0.61_r8*forc_q(c))+0.61_r8*forc_th(c)*dqh(p)
Expand Down
Loading