Skip to content

Commit

Permalink
Merge commit 'f47ce5cf1ab0223670e13f2ebccd876ec98ec09d' into noresm
Browse files Browse the repository at this point in the history
  • Loading branch information
mvdebolskiy committed Aug 7, 2023
2 parents 2bc9775 + f47ce5c commit 9c9c208
Show file tree
Hide file tree
Showing 36 changed files with 1,426 additions and 87 deletions.
55 changes: 55 additions & 0 deletions bld/CLMBuildNamelist.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1793,6 +1793,11 @@ sub process_namelist_inline_logic {
# namelist group: clm_initinterp_inparm #
#########################################
setup_logic_initinterp($opts, $nl_flags, $definition, $defaults, $nl);

###############################
# namelist group: exice_streams #
###############################
setup_logic_exice($opts, $nl_flags, $definition, $defaults, $nl);
}

#-------------------------------------------------------------------------------
Expand Down Expand Up @@ -2197,6 +2202,7 @@ sub setup_logic_soilstate {
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'organic_frac_squared' );
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'use_bedrock',
'use_fates'=>$nl_flags->{'use_fates'}, 'vichydro'=>$nl_flags->{'vichydro'} );
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'use_excess_ice'); # excess ice flag should be read before stream vars

my $var1 = "soil_layerstruct_predefined";
my $var2 = "soil_layerstruct_userdefined";
Expand Down Expand Up @@ -4306,6 +4312,54 @@ sub setup_logic_fates {
}
}

#-------------------------------------------------------------------------------
sub setup_logic_exice {
#
# excess ice streams
#
my ($opts, $nl_flags, $definition, $defaults, $nl) = @_;
my $use_exice = $nl->get_value( 'use_excess_ice' );
my $use_exice_streams = $nl->get_value( 'use_excess_ice_streams' );
# IF excess ice streams is on
if (defined($use_exice_streams) && value_is_true($use_exice_streams)) {
# Can only be true if excess ice is also on, otherwise fail
if (defined($use_exice) && not value_is_true($use_exice)) {
$log->fatal_error("use_excess_ice_streams can NOT be TRUE when use_excess_ice is FALSE" );
}
# Otherwise if ice streams are off
} else {
my @list = ( "stream_meshfile_exice", "stream_fldfilename_exice" );
# fail is excess ice streams files are set
foreach my $var ( @list ) {
if ( defined($nl->get_value($var)) ) {
$log->fatal_error("$var should NOT be set when use_excess_ice_streams=FALSE" );
}
}
# mapalgo can only be none, if excess ice streams are off
my $map_algo = $nl->get_value("stream_mapalgo_exice");
if ( defined($map_algo) && ($map_algo ne "none") ) {
$log->fatal_error("stream_mapalgo_exice can ONLY be none when use_excess_ice_streams=FALSE" );
}
}
# If excess ice is on
if (defined($use_exice) && value_is_true($use_exice)) {
# IF nuopc driver and excess ice streams are on get the stream defaults
if (defined($use_exice_streams) && value_is_true($use_exice_streams)) {
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_fldfilename_exice');
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_mapalgo_exice');
# If excess ice streams on, but NOT the NUOPC driver fail
if ( not $opts->{'driver'} eq "nuopc" ) {
$log->fatal_error("nuopc driver is required when use_excess_ice_streams is set to true" );
# NUOPC driver needs a mesh file
} else {
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_meshfile_exice');
}
}
}


} # end exice streams

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

sub setup_logic_misc {
Expand Down Expand Up @@ -4377,6 +4431,7 @@ sub write_output_files {
push @groups, "nitrif_inparm";
push @groups, "lifire_inparm";
push @groups, "ch4finundated";
push @groups, "exice_streams";
push @groups, "soilbgc_decomp";
push @groups, "clm_canopy_inparm";
if (remove_leading_and_trailing_quotes($nl->get_value('snow_cover_fraction_method')) eq 'SwensonLawrence2012') {
Expand Down
10 changes: 10 additions & 0 deletions bld/namelist_files/namelist_defaults_ctsm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2713,4 +2713,14 @@ use_crop=".true.">lnd/clm2/surfdata_map/ctsm5.1.dev052/landuse.timeseries_mpasa1

<init_interp_method>general</init_interp_method>

<!-- ========================================= -->
<!-- Defaults for excess ice -->
<!-- ========================================= -->

<use_excess_ice>.false.</use_excess_ice>

<stream_fldfilename_exice use_excess_ice=".true.">lnd/clm2/paramdata/exice_init_0.125x0.125_c20220516.nc</stream_fldfilename_exice>
<stream_meshfile_exice use_excess_ice=".true.">lnd/clm2/paramdata/exice_init_0.125x0.125_ESMFmesh_cdf5_c20220802.nc</stream_meshfile_exice>
<stream_mapalgo_exice use_excess_ice=".true.">bilinear</stream_mapalgo_exice>

</namelist_defaults>
34 changes: 34 additions & 0 deletions bld/namelist_files/namelist_definition_ctsm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2848,4 +2848,38 @@ use case.)

</entry>

<!-- ======================================================================================== -->
<!-- Namelist options related to excess ice -->
<!-- ======================================================================================== -->
<entry id="use_excess_ice" type="logical" category="clm_physics"
group="clm_inparm" valid_values="" >
If TRUE turn on the excess ice physics, (Lee et al., 2014; Cai et al., 2020)
</entry>

<entry id="use_excess_ice_streams" type="logical" category="clm_physics"
group="exice_streams" valid_values="" >
If TRUE and use_excess_ice is TRUE, use the excess ice stream to determine the initial values of the excess ice field
if FALSE and use_excess_ice is TRUE, expect excess ice to come from the initial conditions or restart file
Expect to be FALSE is use_excess_ice is FALSE
</entry>

<entry id="stream_fldfilename_exice" type="char*256(30)" category="datasets"
input_pathname="abs" group="exice_streams" valid_values="" >
Filename of input stream data for excess ice data
</entry>

<entry id="stream_meshfile_exice" type="char*256" category="datasets"
input_pathname="abs" group="exice_streams" valid_values="" >
mesh filename of input stream data for excess ice
</entry>

<entry id="stream_mapalgo_exice" type="char*256" category="datasets"
group="exice_streams" valid_values="bilinear,nn,none" >
Mapping method from excess ice input stream data to the model resolution
bilinear = bilinear interpolation
nn = nearest neighbor
none = no interpolation
</entry>


</namelist_definition>
39 changes: 35 additions & 4 deletions bld/unit_testers/build-namelist_test.pl
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,9 @@ sub cat_and_create_namelistinfile {
#
# Figure out number of tests that will run
#
my $ntests = 1975;
my $ntests = 1992;
if ( defined($opts{'compare'}) ) {
$ntests += 1344;
$ntests += 1353;
}
plan( tests=>$ntests );

Expand Down Expand Up @@ -323,6 +323,8 @@ sub cat_and_create_namelistinfile {
"-res 0.9x1.25 -structure fast",
"-res 0.9x1.25 -namelist '&a irrigate=.true./'", "-res 0.9x1.25 -verbose", "-res 0.9x1.25 -ssp_rcp SSP1-2.6", "-res 0.9x1.25 -test", "-res 0.9x1.25 -sim_year 1850",
"-res 0.9x1.25 -namelist '&a use_lai_streams=.true.,use_soil_moisture_streams=.true./'",
"-res 0.9x1.25 -namelist '&a use_excess_ice=.true. use_excess_ice_streams=.true./'",
"-res 0.9x1.25 -namelist '&a use_excess_ice=.true. use_excess_ice_streams=.false./'",
"-res 0.9x1.25 -use_case 1850_control",
"-res 1x1pt_US-UMB -clm_usr_name 1x1pt_US-UMB -namelist '&a fsurdat=\"/dev/null\"/'",
"-res 1x1_brazil",
Expand All @@ -337,6 +339,10 @@ sub cat_and_create_namelistinfile {
my $base_options = "-envxml_dir . -driver $driver";
if ( $driver eq "mct" ) {
$base_options = "$base_options -lnd_frac $DOMFILE";
# Skip the MCT test for excess ice streams
if ( $options =~ /use_excess_ice_streams=.true./ ) {
next;
}
} else {
$base_options = "$base_options -namelist '&a force_send_to_atm = .false./'";
}
Expand Down Expand Up @@ -524,8 +530,33 @@ sub cat_and_create_namelistinfile {
GLC_TWO_WAY_COUPLING=>"FALSE",
phys=>"clm4_5",
},
"soilm_stream wo use" =>{ options=>"-res 0.9x1.25 -envxml_dir .",
namelst=>"use_soil_moisture_streams = .false.,stream_fldfilename_soilm='missing_file'",
"soilm_stream off w file" =>{ options=>"-res 0.9x1.25 -envxml_dir .",
namelst=>"use_soil_moisture_streams = .false.,stream_fldfilename_soilm='file_provided_when_off'",
GLC_TWO_WAY_COUPLING=>"FALSE",
phys=>"clm5_0",
},
"exice_stream off w file" =>{ options=>"-res 0.9x1.25 -envxml_dir .",
namelst=>"use_excess_ice=.true., use_excess_ice_streams = .false.,stream_fldfilename_exice='file_provided_when_off'",
GLC_TWO_WAY_COUPLING=>"FALSE",
phys=>"clm5_0",
},
"exice_stream off w mesh" =>{ options=>"-res 0.9x1.25 -envxml_dir .",
namelst=>"use_excess_ice=.true., use_excess_ice_streams = .false.,stream_meshfile_exice='file_provided_when_off'",
GLC_TWO_WAY_COUPLING=>"FALSE",
phys=>"clm5_0",
},
"exice off, but stream on" =>{ options=>"-res 0.9x1.25 -envxml_dir .",
namelst=>"use_excess_ice=.false., use_excess_ice_streams = .true.,stream_fldfilename_exice='file_provided', stream_meshfile_exice='file_provided'",
GLC_TWO_WAY_COUPLING=>"FALSE",
phys=>"clm5_0",
},
"exice stream off, but setmap"=>{ options=>"-res 0.9x1.25 -envxml_dir .",
namelst=>"use_excess_ice=.true., use_excess_ice_streams = .false.,stream_mapalgo_exice='bilinear'",
GLC_TWO_WAY_COUPLING=>"FALSE",
phys=>"clm5_0",
},
"exice stream on, but mct" =>{ options=>"--res 0.9x1.25 --envxml_dir . --driver mct --lnd_frac $DOMFILE ",
namelst=>"use_excess_ice=.true., use_excess_ice_streams=.true.",
GLC_TWO_WAY_COUPLING=>"FALSE",
phys=>"clm5_0",
},
Expand Down
1 change: 0 additions & 1 deletion cime_config/testdefs/ExpectedTestFails.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@


<!-- aux_clm test suite failures -->

<test name="SMS_D_Ld1_Mmpi-serial_Vmct.f45_f45_mg37.I2000Clm50SpRs.izumi_gnu.clm-ptsRLA">
<phase name="SHAREDLIB_BUILD">
<status>FAIL</status>
Expand Down
18 changes: 18 additions & 0 deletions cime_config/testdefs/testlist_clm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,24 @@
<option name="wallclock">00:40:00</option>
</options>
</test>
<test name="ERS_D" grid="f10_f10_mg37" compset="I1850Clm51Sp" testmods="clm/ExcessIceStreams">
<machines>
<machine name="izumi" compiler="nag" category="aux_clm"/>
</machines>
<options>
<option name="wallclock">00:20:00</option>
<option name="comment" >Include an excess ice test starting up from streams</option>
</options>
</test>
<test name="SMS_Lm12" grid="f09_f09_mg17" compset="I1850Clm51Sp" testmods="clm/ExcessIceStartup_output_sp_exice">
<machines>
<machine name="cheyenne" compiler="intel" category="ctsm_sci"/>
</machines>
<options>
<option name="wallclock">01:00:00</option>
<option name="comment" >Include an excess ice test starting up from an finidat startup file with excessice output with extra output</option>
</options>
</test>
<test name="SMS_Ln9_P144x3" grid="f19_g17" compset="IHistClm50Sp" testmods="clm/waccmx_offline2005Start">
<machines>
<machine name="cheyenne" compiler="intel" category="ctsm_sci"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
../monthly
../../../../usermods_dirs/output_sp_exice
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
use_excess_ice = .true.
finidat = '$DIN_LOC_ROOT/lnd/clm2/initdata_map/clmi.I1850Clm50Sp.0003-01-01.0.9x1.25_gx1v7_exice_simyr1850_c221205.nc'
use_init_interp = .true.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
../default
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
use_excess_ice = .true.
use_excess_ice_streams = .true.
2 changes: 2 additions & 0 deletions cime_config/usermods_dirs/output_sp_exice/include_user_mods
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
../_includes/output_base
../output_sp
8 changes: 8 additions & 0 deletions cime_config/usermods_dirs/output_sp_exice/user_nl_clm
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
!----------------------------------------------------------------------------------
! Settings from output_sp_exice
!----------------------------------------------------------------------------------

! h3 stream (yearly average, gridcell-level)
! Eyr
hist_fincl4 += 'EXCESS_ICE'

119 changes: 119 additions & 0 deletions doc/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,4 +1,123 @@
===============================================================
Tag name: ctsm5.1.dev132
Originator(s): mvdebolskiy (NORCE, Bergen, Norway), slevis (Samuel Levis,UCAR/TSS,303-665-1310)
Date: Fri Aug 4 17:52:45 MDT 2023
One-line Summary: Add parameterization to allow excess ice in soil and subsidence

Purpose and description of changes
----------------------------------

As described in PR #1787:

Parameterization for excess ice described in Lee et al. (2014):
http://dx.doi.org/10.1088/1748-9326/9/12/124006

This code is a modified version of code provided by Lei Cai:
https://github.com/lca041/ctsm/tree/clm5.0.dev92_exice

Works only for the nuopc driver.

Files changed:
bld/CLMBuildNamelist.pm, bld/namelist_files/namelist_defaults_ctsm.xml, bld/namelist_files/namelist_definitionss_ctsm.xml -- added namelist options;
src/main/clm_varctl.F90, src/main/controlMod.F90 -- added option to switch excess ice physics and read namelist option;
src/biogeophys/WaterStateType.F90 -- added prognostic excess ice variable and a history field;
src/biogeophys/WaterStateBulkType.F90, src/main/clm_instMod.F90, -- added arguments to soubrutiens for proper initialization;
src/biogeophys/TemperatureType.F90 -- initial soil temperature set to 268.15 K at the cold start (possibly redundant because #1460 is closed)
src/biogeophys/WaterDiagnosticBulkType.F90 -- added two diagnostic excess ice variables and two history fields;
src/biogeophys/SoilTemperatureMod.F90 -- added main excess ice calculations;
src/biogeophys/TotalWaterAndHeatMod.F90 -- added excess ice to total water for balance checks;
src/biogeophys/SoilHydrologyMod.F90 -- added excess ice for ice fraction calculation;

New files:
src/cpl/share_esmf/ExcessIceStreamType.F90 -- routines to read dataset with initial excess ice concentration


Significant changes to scientifically-supported configurations
--------------------------------------------------------------

Does this tag change answers significantly for any of the following physics configurations?
(Details of any changes will be given in the "Answer changes" section below.)

[Put an [X] in the box for any configuration with significant answer changes.]

[ ] clm5_1

[ ] clm5_0

[ ] ctsm5_0-nwp

[ ] clm4_5


Bugs fixed or introduced
------------------------
CTSM issues fixed (include CTSM Issue #):
Fixes #1229 -- excess ice


Notes of particular relevance for users
---------------------------------------

Caveats for users (e.g., need to interpolate initial conditions):
Excess ice can EITHER be turned on by using the stream file, OR a restart file that has excess ice on it.
Since, excess ice is expected to melt as time goes on, the use of a restart file is preferred.
But, use of a restart file requires a simulation that was spun up to that point.

Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables):
New namelist options added:
- use_excess_ice (logical, in clm_inparm) default = .false.; turns on excess ice physics
- stream_meshfile_exice, stream_fldfilename_exice, stream_mapalgo_exice (char, in exice_streams)
meshfile, stream file, spatial interpolation algorithm for initial values of excess ice
defaults - lnd/clm2/paramdata/exice_init_0.125x0.125_ESMFmesh_c20220516.nc,
lnd/clm2/paramdata/exice_init_0.125x0.125_c20220516.nc
and bilinear
Dataset interpolated to 0.125x0.125 degrees grid from Brown et al. (1997) can be found here:
https://drive.google.com/file/d/1mA457Oa52zG_MtLGB7KHuUYQvsS2-P5o/view?usp=sharing
Dataset used only in cold start or hybrid runs (or starting with finidat) that do not have excess ice


Notes of particular relevance for developers:
---------------------------------------------
Changes to tests or testing:
New tests in place for this new code

Testing summary:
----------------
[Remove any lines that don't apply.]

[PASS means all tests PASS; OK means tests PASS other than expected fails.]

build-namelist tests (if CLMBuildNamelist.pm has changed):

cheyenne - PASS

tools-tests (test/tools) (if tools have been changed):

cheyenne -

regular tests (aux_clm: https://github.com/ESCOMP/CTSM/wiki/System-Testing-Guide#pre-merge-system-testing):

cheyenne ---- OK
izumi ------- OK

any other testing (give details below):

If the tag used for baseline comparisons was NOT the previous tag, note that here:


Answer changes
--------------

Changes answers relative to baseline: No


Other details
-------------
Pull Requests that document the changes (include PR ids):
https://github.com/ESCOMP/ctsm/pull/1787

===============================================================
===============================================================
Tag name: ctsm5.1.dev131
Originator(s): samrabin (Sam Rabin,UCAR/TSS)
Date: Thu Jul 27 14:24:07 MDT 2023
Expand Down
1 change: 1 addition & 0 deletions doc/ChangeSum
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
Tag Who Date Summary
============================================================================================================================
ctsm5.1.dev132 slevis 08/04/2023 Add parameterization to allow excess ice in soil and subsidence
ctsm5.1.dev131 samrabin 07/27/2023 Enable prescribed crop calendars
ctsm5.1.dev130 glemieux 07/09/2023 FATES parameter file and test definition update
ctsm5.1.dev129 erik 06/22/2023 NEON fixes for TOOL and user-mods, add SP for NEON, some history file updates, black refactor for buildlib/buildnml
Expand Down
Loading

0 comments on commit 9c9c208

Please sign in to comment.