Skip to content

Commit

Permalink
Merge pull request #1257 from glemieux/fma-merge-ctsm5.1.dev020
Browse files Browse the repository at this point in the history
Merge ctsm5.1.dev020 tag into fates_main_api
  • Loading branch information
rgknox authored Jan 26, 2021
2 parents a7e020f + e09dc51 commit 5f348ca
Show file tree
Hide file tree
Showing 215 changed files with 25,863 additions and 18,550 deletions.
9 changes: 5 additions & 4 deletions .config_files.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,20 @@
<entry_id>

<!-- This is the same as the default entry in
cime/config/cesm/config_files.xml except for the value for clm:
In a standalone clm checkout, COMP_ROOT_DIR_LND is $SRCROOT
cime/config/cesm/config_files.xml except for the value for CTSM:
In a standalone CTSM checkout, COMP_ROOT_DIR_LND is $SRCROOT
rather than $SRCROOT/components/clm.
However, because of the way overrides are handled, we need to
re-specify the full information here rather than just overriding
the value for clm.
the value for CTSM.
-->
<entry id="COMP_ROOT_DIR_LND">
<type>char</type>
<default_value>unset</default_value>
<values>
<value component="clm" >$SRCROOT</value>
<value component="clm" >$SRCROOT</value>
<value component="ctsm" >$SRCROOT</value>
<value component="dlnd" comp_interface="mct">$CIMEROOT/src/components/data_comps_mct/dlnd</value>
<value component="dlnd" comp_interface="nuopc">$CIMEROOT/src/components/cdeps/dlnd</value>
<value component="slnd" >$CIMEROOT/src/components/stub_comps_$COMP_INTERFACE/slnd</value>
Expand Down
16 changes: 4 additions & 12 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ manage_externals.log
/tools/PTCLM/
/cime/
/components/
/doc/doc-builder/

# ignore svn directories
**/.svn/**
Expand Down Expand Up @@ -47,16 +48,6 @@ CMakeFiles/
# unit testing directories
/src/unit_tests.*

# files generated by the unit test build
/src/dyn_subgrid/dynVarMod.F90
/src/dyn_subgrid/dynVarTimeInterpMod.F90
/src/dyn_subgrid/dynVarTimeUninterpMod.F90
/src/utils/array_utils.F90
/src/unit_test_stubs/utils/restUtilMod_stub.F90
/src/unit_test_stubs/main/ncdio_pio_fake.F90
/src/unit_test_stubs/main/ncdio_var.F90
/src/unit_test_shr/unittestArrayMod.F90

# cime_config
buildnmlc

Expand All @@ -72,6 +63,7 @@ buildnmlc
/bld/unit_testers/drv_flds_in*
/bld/unit_testers/temp_file.txt*
/bld/unit_testers/user_nl_clm_real_parameters*
/bld/unit_testers/user_nl_ctsm_real_parameters*
/bld/unit_testers/env_run.xml

# tools testing output
Expand All @@ -86,8 +78,8 @@ surfdata_*.namelist
landuse.timeseries_*.namelist
landuse.timeseries_*.log
landuse_timeseries_*.txt
clm.input_data_list
clm.input_data_list.previous
ctsm.input_data_list
ctsm.input_data_list.previous
*.stdout.txt.o*

# mksurfdata unit tests
Expand Down
36 changes: 28 additions & 8 deletions Externals.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -16,31 +16,51 @@ required = True
local_path = components/rtm
protocol = git
repo_url = https://github.com/ESCOMP/RTM
tag = rtm1_0_72
tag = rtm1_0_73
required = True

[mosart]
local_path = components/mosart
protocol = git
repo_url = https://github.com/ESCOMP/MOSART
tag = mosart1_0_37
tag = mosart1_0_38
required = True

[cdeps]
hash = 45b7a85
[mizuRoute]
local_path = components/mizuRoute
protocol = git
repo_url = https://github.com/ESCOMP/CDEPS.git
local_path = components/cdeps
repo_url = https://github.com/nmizukami/mizuRoute
hash = 34723c2
required = True

[cime]
local_path = cime
protocol = git
repo_url = https://github.com/ESMCI/cime
tag = cime5.8.32
externals = ../Externals_cime.cfg
tag = branch_tags/cime5.8.32_a02
required = True

[cmeps]
local_path = cime/src/drivers/nuopc/
protocol = git
repo_url = https://github.com/ESCOMP/CMEPS.git
hash = 7654038
required = True

[cdeps]
local_path = components/cdeps
protocol = git
repo_url = https://github.com/ESCOMP/CDEPS.git
hash = 45b7a85
required = True

[doc-builder]
local_path = doc/doc-builder
protocol = git
repo_url = https://github.com/ESMCI/doc-builder
tag = v1.0.5
required = False

[externals_description]
schema_version = 1.0.0

9 changes: 0 additions & 9 deletions Externals_cime.cfg

This file was deleted.

104 changes: 83 additions & 21 deletions bld/CLMBuildNamelist.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1010,24 +1010,6 @@ sub setup_cmdl_maxpft {
}
$nl_flags->{'maxpft'} = $val;

$var = "maxpatch_pft";
my $group = $definition->get_group_name($var);
if ( ! defined($nl->get_variable_value($group, $var)) ) {
$val = $nl_flags->{'maxpft'};
$nl->set_variable_value($group, $var, $val);
}
$val = $nl->get_variable_value($group, $var);
my @valid_values = ($maxpatchpft{'.true.'}, $maxpatchpft{'.false.'} );
my $found = 0;
foreach my $valid_val ( @valid_values ) {
if ( $val == $valid_val ) {
$found = 1;
last;
}
}
if ( ! $found ) {
$log->warning("$var has a value ($val) that is normally NOT valid. Normal valid values are: @valid_values");
}
}

#-------------------------------------------------------------------------------
Expand Down Expand Up @@ -1488,7 +1470,7 @@ sub process_namelist_inline_logic {
##############################
# namelist group: clm_inparm #
##############################
setup_logic_site_specific($nl_flags, $definition, $nl);
setup_logic_site_specific($opts, $nl_flags, $definition, $defaults, $nl);
setup_logic_lnd_frac($opts, $nl_flags, $definition, $defaults, $nl, $envxml_ref);
setup_logic_co2_type($opts, $nl_flags, $definition, $defaults, $nl);
setup_logic_irrigate($opts, $nl_flags, $definition, $defaults, $nl);
Expand Down Expand Up @@ -1516,6 +1498,7 @@ sub process_namelist_inline_logic {
setup_logic_supplemental_nitrogen($opts, $nl_flags, $definition, $defaults, $nl);
setup_logic_snowpack($opts, $nl_flags, $definition, $defaults, $nl);
setup_logic_fates($opts, $nl_flags, $definition, $defaults, $nl);
setup_logic_misc($opts, $nl_flags, $definition, $defaults, $nl);

#########################################
# namelist group: atm2lnd_inparm
Expand Down Expand Up @@ -1717,7 +1700,7 @@ sub process_namelist_inline_logic {

sub setup_logic_site_specific {
# site specific requirements
my ($nl_flags, $definition, $nl) = @_;
my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_;

# res check prevents polluting the namelist with an unnecessary
# false variable for every run
Expand Down Expand Up @@ -1748,6 +1731,9 @@ sub setup_logic_site_specific {
$log->fatal_error("1x1_numaIA grids must use a compset with CN and CROP turned on.");
}
}
# Set compname
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'compname',
'phys'=>$nl_flags->{'phys'} );
}

#-------------------------------------------------------------------------------
Expand Down Expand Up @@ -2378,6 +2364,7 @@ sub setup_logic_dynamic_subgrid {

setup_logic_do_transient_pfts($opts, $nl_flags, $definition, $defaults, $nl);
setup_logic_do_transient_crops($opts, $nl_flags, $definition, $defaults, $nl);
setup_logic_do_transient_lakes($opts, $nl_flags, $definition, $defaults, $nl);
setup_logic_do_harvest($opts, $nl_flags, $definition, $defaults, $nl);

add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'reset_dynbal_baselines');
Expand Down Expand Up @@ -2543,6 +2530,69 @@ sub setup_logic_do_transient_crops {
}
}

sub setup_logic_do_transient_lakes {
#
# Set do_transient_lakes default value, and perform error checking on do_transient_lakes
#
# Assumes the following are already set in the namelist (although it's okay
# for them to be unset if that will be their final state):
# - flanduse_timeseries
#
# NOTE(wjs, 2020-08-23) I based this function on setup_logic_do_transient_crops. I'm
# not sure if all of the checks here are truly important for transient lakes (in
# particular, my guess is that collapse_urban could probably be done with transient
# lakes - as well as transient pfts and transient crops for that matter), but some of
# the checks probably are needed, and it seems best to keep transient lakes consistent
# with other transient areas in this respect.
my ($opts, $nl_flags, $definition, $defaults, $nl) = @_;

my $var = 'do_transient_lakes';

# cannot_be_true will be set to a non-empty string in any case where
# do_transient_lakes should not be true; if it turns out that
# do_transient_lakes IS true in any of these cases, a fatal error will be
# generated
my $cannot_be_true = "";

my $n_dom_pfts = $nl->get_value( 'n_dom_pfts' );
my $n_dom_landunits = $nl->get_value( 'n_dom_landunits' );
my $toosmall_soil = $nl->get_value( 'toosmall_soil' );
my $toosmall_crop = $nl->get_value( 'toosmall_crop' );
my $toosmall_glacier = $nl->get_value( 'toosmall_glacier' );
my $toosmall_lake = $nl->get_value( 'toosmall_lake' );
my $toosmall_wetland = $nl->get_value( 'toosmall_wetland' );
my $toosmall_urban = $nl->get_value( 'toosmall_urban' );

if (string_is_undef_or_empty($nl->get_value('flanduse_timeseries'))) {
$cannot_be_true = "$var can only be set to true when running a transient case (flanduse_timeseries non-blank)";
}

if (!$cannot_be_true) {
# Note that, if the variable cannot be true, we don't call add_default
# - so that we don't clutter up the namelist with variables that don't
# matter for this case
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var);
}

# Make sure the value is false when it needs to be false - i.e., that the
# user hasn't tried to set a true value at an inappropriate time.

if (&value_is_true($nl->get_value($var)) && $cannot_be_true) {
$log->fatal_error($cannot_be_true);
}

# if do_transient_lakes is .true. and any of these (n_dom_* or toosmall_*)
# are > 0 or collapse_urban = .true., then give fatal error
if (&value_is_true($nl->get_value($var))) {
if (&value_is_true($nl->get_value('collapse_urban'))) {
$log->fatal_error("$var cannot be combined with collapse_urban");
}
if ($n_dom_pfts > 0 || $n_dom_landunits > 0 || $toosmall_soil > 0 || $toosmall_crop > 0 || $toosmall_glacier > 0 || $toosmall_lake > 0 || $toosmall_wetland > 0 || $toosmall_urban > 0) {
$log->fatal_error("$var cannot be combined with any of the of the following > 0: n_dom_pfts > 0, n_dom_landunit > 0, toosmall_soil > 0._r8, toosmall_crop > 0._r8, toosmall_glacier > 0._r8, toosmall_lake > 0._r8, toosmall_wetland > 0._r8, toosmall_urban > 0._r8");
}
}
}

sub setup_logic_do_harvest {
#
# Set do_harvest default value, and perform error checking on do_harvest
Expand Down Expand Up @@ -3420,7 +3470,7 @@ sub setup_logic_megan {
#-------------------------------------------------------------------------------

sub setup_logic_soilm_streams {
# prescribed soil moisture streams require clm4_5/clm5_0
# prescribed soil moisture streams require clm4_5/clm5_0/clm5_1
my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_;

add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'use_soil_moisture_streams');
Expand Down Expand Up @@ -3833,6 +3883,18 @@ sub setup_logic_fates {

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

sub setup_logic_misc {
#
# Set some misc options
#
my ($opts, $nl_flags, $definition, $defaults, $nl) = @_;

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

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

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

Expand Down
6 changes: 3 additions & 3 deletions bld/config_files/clm_phys_vers.pm
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use bigint;
#use warnings;
#use diagnostics;

my @version_strings = ("clm4_5", "clm5_0");
my @version_strings = ("clm4_5", "clm5_0", "clm5_1");

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

Expand Down Expand Up @@ -83,12 +83,12 @@ if ( ! defined(caller) && $#ARGV == -1 ) {
require Test::More;
Test::More->import( );

plan( tests=>2 );
plan( tests=>3 );

sub testit {
print "unit tester\n";
my %lastv;
my @vers_list = ( "clm4_5", "clm5_0" );
my @vers_list = ( "clm4_5", "clm5_0", "clm5_1" );
foreach my $vers ( @vers_list ) {
my $phys = config_files::clm_phys_vers->new($vers);
isa_ok($phys, "config_files::clm_phys_vers", "created clm_phys_vers object");
Expand Down
4 changes: 2 additions & 2 deletions bld/config_files/config_definition_ctsm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
<config_definition>

<entry id="phys"
valid_values="clm4_5,clm5_0"
valid_values="clm4_5,clm5_0,clm5_1"
value="clm4_5"
category="physics">
Specifies either clm4_5 or clm5_0 physics
Specifies either clm4_5, clm5_0, or clm5_1 physics
</entry>

<entry id="clm_root"
Expand Down
2 changes: 1 addition & 1 deletion bld/listDefaultNamelist.pl
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ sub make_config_cache {
<?xml version="1.0"?>
<config_definition>
<commandline></commandline>
<entry id="phys" value="$phys" list="" valid_values="clm4_5,clm5_0">Specifies clm physics</entry>
<entry id="phys" value="$phys" list="" valid_values="clm4_5,clm5_0,clm5_1">Specifies clm physics</entry>
</config_definition>
EOF
$fh->close();
Expand Down
Loading

0 comments on commit 5f348ca

Please sign in to comment.