Skip to content

Commit

Permalink
add irrigation stream
Browse files Browse the repository at this point in the history
  • Loading branch information
swensosc committed Mar 10, 2023
1 parent 7edde0b commit 4cfb548
Show file tree
Hide file tree
Showing 9 changed files with 532 additions and 4 deletions.
33 changes: 32 additions & 1 deletion bld/CLMBuildNamelist.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1652,6 +1652,11 @@ sub process_namelist_inline_logic {
##########################################
setup_logic_soilm_streams($opts, $nl_flags, $definition, $defaults, $nl, $physv);

##########################################
# namelist group: irrigation_streams #
##########################################
setup_logic_irrig_streams($opts, $nl_flags, $definition, $defaults, $nl, $physv);

##################################
# namelist group: cnmresp_inparm #
##################################
Expand Down Expand Up @@ -3599,6 +3604,32 @@ sub setup_logic_soilm_streams {

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

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

if ( $physv->as_long() >= $physv->as_long("clm4_5") ) {
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'irrig_mapalgo',
'hgrid'=>$nl_flags->{'res'} );
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_year_first_irrig', 'phys'=>$nl_flags->{'phys'},
'sim_year'=>$nl_flags->{'sim_year'},
'sim_year_range'=>$nl_flags->{'sim_year_range'});
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_year_last_irrig', 'phys'=>$nl_flags->{'phys'},
'sim_year'=>$nl_flags->{'sim_year'},
'sim_year_range'=>$nl_flags->{'sim_year_range'});
# Set align year, if first and last years are different
if ( $nl->get_value('stream_year_first_irrig') !=
$nl->get_value('stream_year_last_irrig') ) {
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl,
'model_year_align_irrig', 'sim_year'=>$nl_flags->{'sim_year'},
'sim_year_range'=>$nl_flags->{'sim_year_range'});
}
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_fldfilename_irrig', 'phys'=>$nl_flags->{'phys'},
'hgrid'=>"0.9x1.25" );
}
}

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

sub setup_logic_lai_streams {
# lai streams require clm4_5/clm5_0
my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_;
Expand Down Expand Up @@ -3953,7 +3984,7 @@ sub write_output_files {
} else {

@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
soil_moisture_streams irrigation_streams lai_streams atm2lnd_inparm lnd2atm_inparm clm_canopyhydrology_inparm cnphenology
clm_soilhydrology_inparm dynamic_subgrid cnvegcarbonstate
finidat_consistency_checks dynpft_consistency_checks
clm_initinterp_inparm century_soilbgcdecompcascade
Expand Down
13 changes: 13 additions & 0 deletions bld/namelist_files/namelist_defaults_clm4_5.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1135,6 +1135,19 @@ lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_0.9x1.25_SSP5-3.4_78pfts_CMIP6_
<soilm_tintalgo>linear</soilm_tintalgo>
<soilm_offset >0</soilm_offset>

<!-- Irrigation streams namelist defaults -->
<!-- This is if you want to prescribe the irrigation from input datasets rather than model it -->
<use_irrigation_streams>.false.</use_irrigation_streams>
<stream_year_first_irrig >1997</stream_year_first_irrig>
<stream_year_last_irrig >1997</stream_year_last_irrig>
<model_year_align_irrig >1997</model_year_align_irrig>

<stream_fldfilename_irrig hgrid="0.9x1.25">lnd/clm2/prescribed_data/LFMIP-pdLC-SST.H2OSOI.0.9x1.25.20levsoi.natveg.1980-2014.MONS_climo.c190716.nc</stream_fldfilename_irrig>

<irrig_mapalgo>nn</irrig_mapalgo>
<irrig_tintalgo>nearest</irrig_tintalgo>
<irrig_offset >0</irrig_offset>

<!-- LAI streams namelist defaults -->
<use_lai_streams >.false.</use_lai_streams>
<stream_year_first_lai >2001</stream_year_first_lai>
Expand Down
48 changes: 48 additions & 0 deletions bld/namelist_files/namelist_definition_clm4_5.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1602,6 +1602,54 @@ If true, will ignore the prescribed soilm data for that point and let the model
prescribed data.
</entry>

<!-- ============================================================ -->
<!-- irrigation stream -->
<!-- ============================================================ -->
<!-- Prescribed irrigation -->
<entry id="use_irrigation_streams" type="logical" category="physics"
group="clm_inparm" valid_values="" value=".false.">
Toggle to turn on use of input prescribed irrigation streams rather than have CLM prognose it (EXPERIMENTAL)
</entry>

<entry id="stream_year_first_irrig" type="integer" category="datasets"
group="irrigation_streams" valid_values="" >
First year to loop over for prescribed soil moisture streams data
</entry>

<entry id="stream_year_last_irrig" type="integer" category="datasets"
group="irrigation_streams" valid_values="" >
Last year to loop over for prescribed irrigation streams data
</entry>

<entry id="model_year_align_irrig" type="integer" category="datasets"
group="irrigation_streams" valid_values="" >
Simulation year that aligns with stream_year_first_irrig value
</entry>

<entry id="stream_fldfilename_irrig" type="char*256(30)" category="datasets"
input_pathname="abs" group="irrigation_streams" valid_values="" >
Filename of input stream data for prescribed irrigation streams data
</entry>

<entry id="irrig_tintalgo" type="char*256" category="datasets"
group="irrigation_streams" valid_values="linear,nearest,lower,upper" >
Time interpolation method to use for prescribed irrigation streams data
</entry>

<entry id="irrig_offset" type="integer" category="datasets"
group="irrigation_streams" >
Offset in time coordinate for irrigation streams (sec)
</entry>

<entry id="irrig_mapalgo" type="char*256" category="datasets"
group="irrig_streams" valid_values="bilinear,nn,spval,copy" >
Mapping method from irrigation input file to the model resolution
bilinear = bilinear interpolation
nn = nearest neighbor
spval = set to special value
copy = copy using the same indices
</entry>

<!-- ======================================================================================== -->
<!-- lai_streams streams Namelist (when phys = CLM4_5) -->
<!-- ======================================================================================== -->
Expand Down
2 changes: 1 addition & 1 deletion src/biogeophys/IrrigationMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ module IrrigationMod
real(r8), pointer :: relsat_target_col(:,:) ! relative saturation at which smp is at the irrigation target [col, nlevsoi]

! Private data members; time-varying:
real(r8), pointer :: irrig_rate_patch (:) ! current irrigation rate [mm/s]
real(r8), pointer, public :: irrig_rate_patch (:) ! current irrigation rate [mm/s]
real(r8), pointer :: irrig_rate_demand_patch (:) ! current irrigation rate, neglecting surface water source limitation [mm/s]
integer , pointer :: n_irrig_steps_left_patch (:) ! number of time steps for which we still need to irrigate today (if 0, ignore)
real(r8), pointer :: qflx_irrig_demand_patch (:) ! irrigation flux neglecting surface water source limitation [mm/s]
Expand Down
Loading

0 comments on commit 4cfb548

Please sign in to comment.