Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 25 additions & 14 deletions bld/CLMBuildNamelist.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1814,6 +1814,11 @@ sub process_namelist_inline_logic {
##################################
setup_logic_cropcal_streams($opts, $nl_flags, $definition, $defaults, $nl);

##################################
# namelist group: distparams_streams #
##################################
setup_logic_distparams_streams($opts, $nl_flags, $definition, $defaults, $nl);

##########################################
# namelist group: soil_moisture_streams #
##########################################
Expand Down Expand Up @@ -4420,6 +4425,25 @@ sub setup_logic_cropcal_streams {

#-------------------------------------------------------------------------------

sub setup_logic_distparams_streams {
my ($opts, $nl_flags, $definition, $defaults, $nl) = @_;

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

# Add defaults if using any crop calendar input files
my $distparams_file = $nl->get_value('stream_fldFileName_distparams') ;
my $mesh_file = $nl->get_value('stream_meshfile_distparams') ;

# User provided an input file but set mesh file to empty
if ( !&string_is_undef_or_empty($distparams_file)) {
if ( &string_is_undef_or_empty($mesh_file) ) {
$log->fatal_error("If providing a spatially distributed parameter file, you must provide stream_meshfile_distparams" );
}
}
}

#-------------------------------------------------------------------------------

sub setup_logic_soilwater_movement {
my ($opts, $nl_flags, $definition, $defaults, $nl) = @_;

Expand Down Expand Up @@ -4658,19 +4682,6 @@ sub setup_logic_atm_forcing {
}
}
}

foreach $var ("precip_repartition_glc_all_snow_t",
"precip_repartition_glc_all_rain_t",
"precip_repartition_nonglc_all_snow_t",
"precip_repartition_nonglc_all_rain_t") {
if ( &value_is_true($nl->get_value("repartition_rain_snow")) ) {
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var);
} else {
if (defined($nl->get_value($var))) {
$log->fatal_error("$var can only be set if repartition_rain_snow is true");
}
}
}
}

#-------------------------------------------------------------------------------
Expand Down Expand Up @@ -5206,7 +5217,7 @@ sub write_output_files {

@groups = qw(clm_inparm ndepdyn_nml popd_streams urbantv_streams light_streams
soil_moisture_streams lai_streams atm2lnd_inparm lnd2atm_inparm clm_canopyhydrology_inparm cnphenology
cropcal_streams
cropcal_streams distparams_streams
clm_soilhydrology_inparm dynamic_subgrid cnvegcarbonstate
finidat_consistency_checks dynpft_consistency_checks
clm_initinterp_inparm century_soilbgcdecompcascade
Expand Down
24 changes: 8 additions & 16 deletions bld/namelist_files/namelist_defaults_ctsm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -227,20 +227,6 @@ attributes from the config_cache.xml file (with keys converted to upper-case).

<longwave_downscaling_limit>0.5</longwave_downscaling_limit>

<precip_repartition_nonglc_all_snow_t>0.</precip_repartition_nonglc_all_snow_t>
<precip_repartition_nonglc_all_rain_t>2.</precip_repartition_nonglc_all_rain_t>
<!-- For CLM5 and following, we assume rain at somewhat cooler temperatures. The main
motivation is to increase glacier melt, which otherwise is too low in
CESM2. The physical justification is that the 0 - 2 C ramp used elsewhere
makes sense for typical atmospheric profiles; but over glaciers, inversions
are more common, so it is more reasonable to expect rain despite
below-freezing near-surface temperatures. -->
<precip_repartition_glc_all_snow_t >-2.</precip_repartition_glc_all_snow_t>
<precip_repartition_glc_all_rain_t >0.</precip_repartition_glc_all_rain_t>
<!-- For CLM45, we used the same rain-snow partitioning for glaciers as for other landunits -->
<precip_repartition_glc_all_snow_t phys="clm4_5" >0.</precip_repartition_glc_all_snow_t>
<precip_repartition_glc_all_rain_t phys="clm4_5" >2.</precip_repartition_glc_all_rain_t>

<!-- lnd2atm defaults -->
<melt_non_icesheet_ice_runoff >.true.</melt_non_icesheet_ice_runoff>
<melt_non_icesheet_ice_runoff phys="clm4_5" >.false.</melt_non_icesheet_ice_runoff>
Expand Down Expand Up @@ -541,10 +527,9 @@ 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/ctsm5.3.041.Nfix_params.v13.c250221_upplim250.nc</paramfile>
<paramfile phys="clm6_0" >lnd/clm2/paramdata/ctsm5.3.041.Nfix_params.v13.c250221_upplim250_add_nml.nc</paramfile>
<paramfile phys="clm5_0" >lnd/clm2/paramdata/clm50_params.c250311.nc</paramfile>
<paramfile phys="clm4_5" >lnd/clm2/paramdata/clm45_params.c250311.nc</paramfile>

<!-- ================================================================== -->
<!-- FATES default parameter file -->
<!-- ================================================================== -->
Expand Down Expand Up @@ -2082,6 +2067,13 @@ lnd/clm2/surfdata_esmf/NEON/ctsm5.3.0/surfdata_1x1_NEON_TOOL_hist_2000_78pfts_c2
<stream_fldFileName_gdd20_season_end stream_gdd20_seasons=".true.">lnd/clm2/cropdata/calendars/processed/hdates_ggcmi_crop_calendar_phase3_v1.01_nninterp-hcru_hcru_mt13.2000-2000.20230728_165845.tweaked_latlons.nc</stream_fldFileName_gdd20_season_end>
<stream_meshfile_cropcal cropcals_rx_adapt=".true.">lnd/clm2/cropdata/calendars/processed/360x720_120830_ESMFmesh_c20210507_cdf5.tweaked_latlons.nc</stream_meshfile_cropcal>

<!-- spatially distributed parameters: default settings -->
<use_distributed_parameters>.false.</use_distributed_parameters>

<!-- spatially distributed parameters: default input files -->
<stream_fldFileName_distparams use_distributed_parameters=".true.">no_file_yet</stream_fldFileName_distparams>
<stream_meshfile_distparams use_distributed_parameters=".true.">no_file_yet</stream_meshfile_distparams>

<!-- lightning streams namelist defaults -->

<light_res use_cn=".false." >none</light_res>
Expand Down
44 changes: 20 additions & 24 deletions bld/namelist_files/namelist_definition_ctsm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1694,30 +1694,6 @@ This parameter must be in the range [0,1]
Only relevant if glcmec_downscale_longwave is .true.
</entry>

<entry id="precip_repartition_glc_all_snow_t" type="real" category="clm_physics"
group="atm2lnd_inparm" valid_values="" >
Temperature below which all precipitation falls as snow, for glacier columns (deg C)
Only relevant if repartition_rain_snow is .true.
</entry>

<entry id="precip_repartition_glc_all_rain_t" type="real" category="clm_physics"
group="atm2lnd_inparm" valid_values="" >
Temperature above which all precipitation falls as rain, for glacier columns (deg C)
Only relevant if repartition_rain_snow is .true.
</entry>

<entry id="precip_repartition_nonglc_all_snow_t" type="real" category="clm_physics"
group="atm2lnd_inparm" valid_values="" >
Temperature below which all precipitation falls as snow, for non-glacier columns (deg C)
Only relevant if repartition_rain_snow is .true.
</entry>

<entry id="precip_repartition_nonglc_all_rain_t" type="real" category="clm_physics"
group="atm2lnd_inparm" valid_values="" >
Temperature above which all precipitation falls as rain, for non-glacier columns (deg C)
Only relevant if repartition_rain_snow is .true.
</entry>

<!-- ======================================================================================== -->
<!-- Namelist items controlling fields sent to atmosphere -->
<!-- ======================================================================================== -->
Expand Down Expand Up @@ -2055,6 +2031,26 @@ Filename of input stream data for date (day of year) of end of gdd20 accumulatio
Filename of input stream data for crop calendar inputs
</entry>

<!-- ======================================================================================== -->
<!-- distparams_streams streams Namelist -->
<!-- ======================================================================================== -->

<!-- Distributed parameters -->
<entry id="use_distributed_parameters" type="logical" category="datasets"
group="distparams_streams" valid_values="" >
Flag to enable spatially distributed parameters
</entry>

<entry id="stream_fldfilename_distparams" type="char*512(30)" category="datasets"
input_pathname="abs" group="distparams_streams" valid_values="" >
Filename of input stream data for spatially distributed parameters
</entry>

<entry id="stream_meshfile_distparams" type="char*512" category="datasets"
input_pathname="abs" group="distparams_streams" valid_values="" >
Filename of mesh data for spatially distributed parameters
</entry>

<!-- ======================================================================================== -->
<!-- light_streams streams Namelist (when CN an CLM4_5 is active) -->
<!-- ======================================================================================== -->
Expand Down
5 changes: 3 additions & 2 deletions src/biogeophys/CanopyHydrologyMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ module CanopyHydrologyMod
use WaterStateBulkType , only : waterstatebulk_type
use WaterDiagnosticBulkType , only : waterdiagnosticbulk_type
use WaterTracerUtils , only : CalcTracerFromBulk
use ColumnType , only : col, column_type
use PatchType , only : patch, patch_type
use ColumnType , only : col, column_type
use PatchType , only : patch, patch_type

!
! !PUBLIC TYPES:
implicit none
Expand Down
9 changes: 6 additions & 3 deletions src/biogeophys/InfiltrationExcessRunoffMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ module InfiltrationExcessRunoffMod
use clm_varcon , only : spval
use SoilHydrologyType, only : soilhydrology_type
use SoilStateType , only : soilstate_type
use DistParamType , only : distparams => distributed_parameters
use SaturatedExcessRunoffMod, only : saturated_excess_runoff_type
use WaterFluxBulkType , only : waterfluxbulk_type
use WaterDiagnosticBulkType, only : waterdiagnosticbulk_type
use WaterFluxBulkType , only : waterfluxbulk_type
use WaterDiagnosticBulkType , only : waterdiagnosticbulk_type

implicit none
save
Expand Down Expand Up @@ -267,6 +268,8 @@ subroutine ComputeQinmaxHksat(bounds, num_hydrologyc, filter_hydrologyc, &
soilhydrology_inst, soilstate_inst, &
qinmax_on_unsaturated_area)
!
! USES
use ColumnType , only : col
! !DESCRIPTION:
! Compute qinmax using a parameterization based on hksat
!
Expand Down Expand Up @@ -296,7 +299,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**(-params_inst%e_ice*(icefrac(c,1:3)))*hksat(c,1:3))
qinmax_on_unsaturated_area(c) = minval(10._r8**(-distparams%e_ice%param_val(col%gridcell(c))*(icefrac(c,1:3)))*hksat(c,1:3))
end do

end associate
Expand Down
37 changes: 7 additions & 30 deletions src/biogeophys/SaturatedExcessRunoffMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ module SaturatedExcessRunoffMod
use clm_varcon , only : spval,ispval
use LandunitType , only : landunit_type
use landunit_varcon , only : istcrop
use ColumnType , only : column_type
use ColumnType , only : column_type
use DistParamType , only : distparams => distributed_parameters
use SoilHydrologyType, only : soilhydrology_type
use SoilStateType, only : soilstate_type
use SoilStateType , only : soilstate_type
use WaterFluxBulkType, only : waterfluxbulk_type

implicit none
Expand Down Expand Up @@ -50,12 +51,6 @@ module SaturatedExcessRunoffMod
procedure, private, nopass :: ComputeFsatTopmodel
procedure, private, nopass :: ComputeFsatVic
end type saturated_excess_runoff_type
public :: readParams

type, private :: params_type
real(r8) :: fff ! Decay factor for fractional saturated area (1/m)
end type params_type
type(params_type), private :: params_inst

! !PRIVATE DATA MEMBERS:

Expand Down Expand Up @@ -175,26 +170,6 @@ subroutine InitCold(this, bounds)

end subroutine InitCold

!-----------------------------------------------------------------------
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_SaturatedExcessRunoff'
!--------------------------------------------------------------------

! Decay factor for fractional saturated area (1/m)
call readNcdioScalar(ncid, 'fff', subname, params_inst%fff)

end subroutine readParams

! ========================================================================
! Science routines
! ========================================================================
Expand Down Expand Up @@ -315,6 +290,8 @@ end subroutine SaturatedExcessRunoff
subroutine ComputeFsatTopmodel(bounds, num_hydrologyc, filter_hydrologyc, &
soilhydrology_inst, soilstate_inst, fsat)
!
! USES
use ColumnType , only : col
! !DESCRIPTION:
! Compute fsat using the TOPModel-based parameterization
!
Expand Down Expand Up @@ -349,9 +326,9 @@ subroutine ComputeFsatTopmodel(bounds, num_hydrologyc, filter_hydrologyc, &
c = filter_hydrologyc(fc)
if (frost_table(c) > zwt_perched(c) .and. frost_table(c) <= zwt(c)) then
! use perched water table to determine fsat (if present)
fsat(c) = wtfact(c) * exp(-0.5_r8*params_inst%fff*zwt_perched(c))
fsat(c) = wtfact(c) * exp(-0.5_r8*distparams%fff%param_val(col%gridcell(c))*zwt_perched(c))
else
fsat(c) = wtfact(c) * exp(-0.5_r8*params_inst%fff*zwt(c))
fsat(c) = wtfact(c) * exp(-0.5_r8*distparams%fff%param_val(col%gridcell(c))*zwt(c))
end if
end do

Expand Down
Loading