Skip to content

Commit

Permalink
Merge pull request #2845 from olyson/b4b-dev_PPE2830-2831
Browse files Browse the repository at this point in the history
PPE parameter work -Addresses issues 2830 and 2831
  • Loading branch information
olyson authored Oct 28, 2024
2 parents 9f44365 + 0fd1a04 commit f0566a6
Show file tree
Hide file tree
Showing 12 changed files with 121 additions and 156 deletions.
14 changes: 0 additions & 14 deletions bld/CLMBuildNamelist.pm
Original file line number Diff line number Diff line change
Expand Up @@ -3602,17 +3602,6 @@ sub setup_logic_luna {
if ( &value_is_true($nl->get_value('lnc_opt') ) && not &value_is_true( $nl_flags->{'use_cn'}) ) {
$log->fatal_error("Cannot turn lnc_opt to true when bgc=sp" );
}
my $var = "jmaxb1";
if ( &value_is_true( $nl_flags->{'use_luna'} ) ) {
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var,
'use_luna'=>$nl_flags->{'use_luna'} );
}
my $val = $nl->get_value($var);
if ( ! &value_is_true( $nl_flags->{'use_luna'} ) ) {
if ( defined($val) ) {
$log->fatal_error("Cannot set $var when use_luna is NOT on" );
}
}
}

#-------------------------------------------------------------------------------
Expand Down Expand Up @@ -4526,8 +4515,6 @@ sub setup_logic_canopyhydrology {
#
my ($opts, $nl_flags, $definition, $defaults, $nl) = @_;

add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'interception_fraction' );
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'maximum_leaf_wetted_fraction' );
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'use_clm5_fpi' );
}

Expand All @@ -4546,7 +4533,6 @@ sub setup_logic_snowpack {
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'wind_dependent_snow_density');
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'snow_overburden_compaction_method');
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'lotmp_snowdensity_method');
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'upplim_destruct_metamorph');
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'reset_snow');
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'reset_snow_glc');
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'reset_snow_glc_ela');
Expand Down
18 changes: 4 additions & 14 deletions bld/namelist_files/namelist_defaults_ctsm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -413,11 +413,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case).

<!-- Canopy hydrology namelist defaults -->
<use_clm5_fpi >.true.</use_clm5_fpi>
<interception_fraction >1.0</interception_fraction>
<maximum_leaf_wetted_fraction >0.05</maximum_leaf_wetted_fraction>
<use_clm5_fpi phys="clm4_5" >.false.</use_clm5_fpi>
<interception_fraction phys="clm4_5" >0.25</interception_fraction>
<maximum_leaf_wetted_fraction phys="clm4_5" >1.0</maximum_leaf_wetted_fraction>

<!-- Soilwater movement namelist defaults -->
<soilwater_movement_method >1</soilwater_movement_method>
Expand Down Expand Up @@ -493,9 +489,6 @@ attributes from the config_cache.xml file (with keys converted to upper-case).
<lotmp_snowdensity_method >'Slater2017'</lotmp_snowdensity_method>
<lotmp_snowdensity_method phys="clm4_5" >'TruncatedAnderson1976'</lotmp_snowdensity_method>

<upplim_destruct_metamorph >175.d00</upplim_destruct_metamorph>
<upplim_destruct_metamorph phys="clm4_5" >100.d00</upplim_destruct_metamorph>

<overburden_compress_tfactor>0.08d00</overburden_compress_tfactor>

<reset_snow>.false.</reset_snow>
Expand Down Expand Up @@ -551,10 +544,10 @@ 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="clm6_0" >lnd/clm2/paramdata/ctsm60_params.c240822.nc</paramfile>
<paramfile phys="clm5_1" >lnd/clm2/paramdata/ctsm51_params.c240814.nc</paramfile>
<paramfile phys="clm5_0" >lnd/clm2/paramdata/clm50_params.c240814.nc</paramfile>
<paramfile phys="clm4_5" >lnd/clm2/paramdata/clm45_params.c240814.nc</paramfile>
<paramfile phys="clm6_0" >lnd/clm2/paramdata/ctsm60_params.c241017.nc</paramfile>
<paramfile phys="clm5_1" >lnd/clm2/paramdata/ctsm51_params.c241017.nc</paramfile>
<paramfile phys="clm5_0" >lnd/clm2/paramdata/clm50_params.c241017.nc</paramfile>
<paramfile phys="clm4_5" >lnd/clm2/paramdata/clm45_params.c241017.nc</paramfile>

<!-- ================================================================== -->
<!-- FATES default parameter file -->
Expand Down Expand Up @@ -606,9 +599,6 @@ attributes from the config_cache.xml file (with keys converted to upper-case).
<use_fertilizer >.false.</use_fertilizer>
<use_fertilizer use_crop=".true." >.true.</use_fertilizer>

<!-- Could depend on physics version -->
<jmaxb1 use_luna=".true." >0.17</jmaxb1>

<!-- o3_veg_stress_method-->
<o3_veg_stress_method>unset</o3_veg_stress_method>

Expand Down
20 changes: 0 additions & 20 deletions bld/namelist_files/namelist_definition_ctsm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -404,21 +404,11 @@ Max number of iterations used in subr. CanopyFluxes. For many years, 40 was the
<default>Default: 40</default>
</entry>

<entry id="interception_fraction" type="real" category="clm_physics"
group="clm_canopyhydrology_inparm" valid_values="" >
Fraction of intercepted precipitation
</entry>

<entry id="use_clm5_fpi" type="logical" category="clm_physics"
group="clm_canopyhydrology_inparm" valid_values="" >
If TRUE use clm5 equation for fraction of intercepted precipitation
</entry>

<entry id="maximum_leaf_wetted_fraction" type="real" category="clm_physics"
group="clm_canopyhydrology_inparm" valid_values="" >
Maximum fraction of leaf that may be wet prior to drip occuring
</entry>

<entry id="baseflow_scalar" type="real" category="clm_physics"
group="soilhydrology_inparm" valid_values="" >
Scalar multiplier for base flow rate
Expand Down Expand Up @@ -712,11 +702,6 @@ Scalar of leaf respiration to vcmax
The maximum value to use for zeta under stable conditions
</entry>

<entry id="Jmaxb1" type="real" category="clm_physics"
group="luna" >
baseline proportion of nitrogen allocated for electron transport (J)
</entry>

<entry id="use_fates" type="logical" category="physics"
group="clm_inparm" valid_values="" value=".false.">
Toggle to turn on the FATES model
Expand Down Expand Up @@ -2844,11 +2829,6 @@ TruncatedAnderson1976 -- Truncate the Anderson-1976 equation at the value for -1
Slater2017 ------------- Use equation from Slater that increases snow density for very cold temperatures (Arctic, Antarctic)
</entry>

<entry id="upplim_destruct_metamorph" type="real" category="clm_physics"
group="clm_snowhydrology_inparm" >
Upper Limit on Destructive Metamorphism Compaction [kg/m3]
</entry>

<entry id="overburden_compress_Tfactor" type="real" category="clm_physics"
group="clm_snowhydrology_inparm" >
Snow compaction overburden exponential factor (1/K)
Expand Down
4 changes: 0 additions & 4 deletions bld/unit_testers/build-namelist_test.pl
Original file line number Diff line number Diff line change
Expand Up @@ -1235,10 +1235,6 @@ sub cat_and_create_namelistinfile {
namelst=>"use_luna=.true., lnc_opt=.true.",
phys=>"clm5_0",
},
"NOlunabutsetJmaxb1" =>{ options=>"-envxml_dir . -bgc sp",
namelst=>"use_luna=.false., jmaxb1=1.0",
phys=>"clm5_0",
},
"envxml_not_dir" =>{ options=>"-envxml_dir myuser_nl_clm",
namelst=>"",
phys=>"clm5_0",
Expand Down
9 changes: 9 additions & 0 deletions cime_config/testdefs/testlist_clm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -875,6 +875,15 @@
<option name="comment" >Run matrix solution fast spinup for restart beyond a year (to trigger next year logic) turning off extra options to make faster (so without crop or isotopes). This test would've caught a previous bug.</option>
</options>
</test>
<test name="SMS_Lm1" grid="f10_f10_mg37" compset="I1850Clm60Bgc" testmods="clm/clm60_monthly_matrixcn_soilCN30">
<machines>
<machine name="derecho" compiler="intel" category="aux_clm"/>
</machines>
<options>
<option name="wallclock">01:20:00</option>
<option name="comment" >Smoke test of soil CN-matrix on with soil CN ratio set to 30</option>
</options>
</test>
<test name="ERS_D" grid="f19_g17" compset="I1850Clm50BgcCrop" testmods="clm/ciso_monthly_matrixcn_spinup">
<machines>
<machine name="derecho" compiler="intel" category="aux_clm"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
paramfile = '$DIN_LOC_ROOT/lnd/clm2/paramdata/ctsm51_ciso_cwd_hr_params.c240814.nc'
paramfile = '$DIN_LOC_ROOT/lnd/clm2/paramdata/ctsm51_ciso_cwd_hr_params.c241017.nc'
hist_fincl1 = 'CWDC_HR','C13_CWDC_HR','C14_CWDC_HR','CWD_HR_L2','CWD_HR_L2_vr','CWD_HR_L3','CWD_HR_L3_vr'
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
use_soil_matrixcn = .true.
paramfile = '$DIN_LOC_ROOT/lnd/clm2/paramdata/ctsm60_params_cn30.c240822.nc'
paramfile = '$DIN_LOC_ROOT/lnd/clm2/paramdata/ctsm60_params_cn30.c241017.nc'
43 changes: 34 additions & 9 deletions src/biogeochem/CNGapMortalityMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ module CNGapMortalityMod
!
! !USES:
use shr_kind_mod , only : r8 => shr_kind_r8
use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=)
use decompMod , only : bounds_type
use abortutils , only : endrun
use shr_log_mod , only : errMsg => shr_log_errMsg
use clm_varpar , only : mxpft
use pftconMod , only : pftcon
use CNDVType , only : dgvs_type
use CNVegCarbonStateType , only : cnveg_carbonstate_type, spinup_factor_deadwood
Expand All @@ -34,8 +36,10 @@ module CNGapMortalityMod
public :: CNGapMortality

type, private :: params_type
real(r8):: am ! mortality rate based on annual rate, fractional mortality (1/yr)
real(r8):: k_mort ! coeff. of growth efficiency in mortality equation
real(r8), allocatable :: r_mort(:) ! Mortality rate (1/year)
contains
procedure, private :: allocParams ! Allocate the parameters
end type params_type
!
type(params_type), private :: params_inst
Expand All @@ -49,6 +53,24 @@ module CNGapMortalityMod

contains

!-----------------------------------------------------------------------
subroutine allocParams ( this )
!
implicit none

! !ARGUMENTS:
class(params_type) :: this
!
! !LOCAL VARIABLES:
character(len=32) :: subname = 'allocParams'
!-----------------------------------------------------------------------

! allocate parameters

allocate( this%r_mort (0:mxpft) ) ; this%r_mort(:) = nan

end subroutine allocParams

!-----------------------------------------------------------------------
subroutine readParams ( ncid )
!
Expand All @@ -67,18 +89,21 @@ subroutine readParams ( ncid )
character(len=100) :: errCode = '-Error reading in parameters file:'
logical :: readv ! has variable been read in or not
real(r8) :: tempr ! temporary to read in constant
real(r8) :: temp1d(0:mxpft) ! temporary to read in parameter
character(len=100) :: tString ! temp. var for reading
!-----------------------------------------------------------------------

tString='r_mort'
call ncd_io(varname=trim(tString),data=tempr, flag='read', ncid=ncid, readvar=readv)
if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__))
params_inst%am=tempr

tString='k_mort'
call ncd_io(varname=trim(tString),data=tempr, flag='read', ncid=ncid, readvar=readv)
if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__))
params_inst%k_mort=tempr

call params_inst%allocParams()

tString='r_mort'
call ncd_io(varname=trim(tString),data=temp1d, flag='read', ncid=ncid, readvar=readv)
if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__))
params_inst%r_mort=temp1d

end subroutine readParams

Expand Down Expand Up @@ -183,8 +208,6 @@ subroutine CNGapMortality (bounds, num_soilp, filter_soilp, &
)

dt = real( get_step_size(), r8 )
! set the mortality rate based on annual rate
am = params_inst%am
! set coeff of growth efficiency in mortality equation
k_mort = params_inst%k_mort

Expand Down Expand Up @@ -216,9 +239,11 @@ subroutine CNGapMortality (bounds, num_soilp, filter_soilp, &
am = min(1._r8, am + heatstress(p))
else ! lpj didn't set this for grasses; cn does
! set the mortality rate based on annual rate
am = params_inst%am
am = params_inst%r_mort(ivt(p))
end if

else
am = params_inst%r_mort(ivt(p))
end if

m = am/(get_average_days_per_year() * secspday)
Expand Down
18 changes: 8 additions & 10 deletions src/biogeophys/CanopyHydrologyMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ module CanopyHydrologyMod
real(r8) :: snow_canopy_storage_scalar ! Canopy-storage-of-snow parameter (kg/m2)
real(r8) :: snowcan_unload_temp_fact ! Temperature canopy snow unload scaling (C2 in Eq. 14, Roesch et al. 2001) (K*s)
real(r8) :: snowcan_unload_wind_fact ! Wind canopy snow unload scaling (modifies 1.56e5, where 1.56e5 is C3 in Eq. 15, Roesch et al. 2001) (-)
real(r8) :: interception_fraction ! Fraction of intercepted precipitation (-)
real(r8) :: maximum_leaf_wetted_fraction ! Maximum fraction of leaf that may be wet (-)
end type params_type
type(params_type), private :: params_inst
!
Expand All @@ -67,8 +69,6 @@ module CanopyHydrologyMod
private :: BulkDiag_FracWet ! Determine fraction of vegetated surface that is wet
!
! !PRIVATE DATA MEMBERS:
real(r8) :: interception_fraction ! Fraction of intercepted precipitation
real(r8) :: maximum_leaf_wetted_fraction ! Maximum fraction of leaf that may be wet
logical, private :: use_clm5_fpi = .false. ! use clm5 fpi equation

character(len=*), parameter, private :: sourcefile = &
Expand Down Expand Up @@ -99,8 +99,6 @@ subroutine CanopyHydrology_readnl( NLFilename )
character(len=32) :: subname = 'CanopyHydrology_readnl' ! subroutine name
!-----------------------------------------------------------------------
namelist /clm_canopyhydrology_inparm/ &
interception_fraction, &
maximum_leaf_wetted_fraction, &
use_clm5_fpi

! ----------------------------------------------------------------------
Expand All @@ -125,15 +123,11 @@ subroutine CanopyHydrology_readnl( NLFilename )
end if

! Broadcast namelist variables read in
call shr_mpi_bcast(interception_fraction, mpicom)
call shr_mpi_bcast(maximum_leaf_wetted_fraction, mpicom)
call shr_mpi_bcast(use_clm5_fpi, mpicom)

if (masterproc) then
write(iulog,*) ' '
write(iulog,*) 'canopyhydrology settings:'
write(iulog,*) ' interception_fraction = ',interception_fraction
write(iulog,*) ' maximum_leaf_wetted_fraction = ',maximum_leaf_wetted_fraction
write(iulog,*) ' use_clm5_fpi = ',use_clm5_fpi
endif

Expand Down Expand Up @@ -162,6 +156,10 @@ subroutine readParams( ncid )
call readNcdioScalar(ncid, 'snowcan_unload_temp_fact', subname, params_inst%snowcan_unload_temp_fact)
! Wind canopy snow unload scaling (modifies 1.56e5, where 1.56e5 is C3 in Eq. 15, Roesch et al. 2001) (-)
call readNcdioScalar(ncid, 'snowcan_unload_wind_fact', subname, params_inst%snowcan_unload_wind_fact)
! Fraction of intercepted precipitation (-)
call readNcdioScalar(ncid, 'interception_fraction', subname, params_inst%interception_fraction)
! Maximum fraction of leaf that may be wet (-)
call readNcdioScalar(ncid, 'maximum_leaf_wetted_fraction', subname, params_inst%maximum_leaf_wetted_fraction)

end subroutine readParams

Expand Down Expand Up @@ -535,7 +533,7 @@ subroutine BulkFlux_CanopyInterceptionAndThroughfall(bounds, num_nolakep, filter
if (check_point_for_interception_and_excess(p)) then
! Coefficient of interception
if (use_clm5_fpi) then
fpiliq = interception_fraction * tanh(elai(p) + esai(p))
fpiliq = params_inst%interception_fraction * tanh(elai(p) + esai(p))
else
fpiliq = 0.25_r8*(1._r8 - exp(-0.5_r8*(elai(p) + esai(p))))
end if
Expand Down Expand Up @@ -1170,7 +1168,7 @@ subroutine BulkDiag_FracWet(bounds, num_soilp, filter_soilp, &
if (h2ocan > 0._r8) then
vegt = frac_veg_nosno(p)*(elai(p) + esai(p))
fwet(p) = (h2ocan / (vegt * params_inst%liq_canopy_storage_scalar))**0.666666666666_r8
fwet(p) = min (fwet(p),maximum_leaf_wetted_fraction) ! Check for maximum limit of fwet
fwet(p) = min (fwet(p),params_inst%maximum_leaf_wetted_fraction) ! Check for maximum limit of fwet
if (snocan(p) > 0._r8) then
fcansno(p) = (snocan(p) / (vegt * params_inst%snow_canopy_storage_scalar))**0.15_r8 ! must match snocanmx
fcansno(p) = min (fcansno(p),1.0_r8)
Expand Down
Loading

0 comments on commit f0566a6

Please sign in to comment.