Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updates to ed relevant namelist build options #19

Merged
merged 21 commits into from
Feb 26, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
c8bfca7
inserted no-megan clause to ED compset configurations
rgknox Feb 17, 2016
c61aaef
added use_century_decomp and use_vertsoilc to the ed_mode in componen…
rgknox Feb 17, 2016
c6185f2
updated the intel compiler for lr2/lr3
rgknox Feb 17, 2016
89809d8
Added env_mach_specific.lawrencium-lr3
rgknox Feb 18, 2016
a7ff225
corrections to CLMBuildNamelist.pm, removed the setting variable and …
rgknox Feb 18, 2016
b4deeba
Initial tinkering with namelist unit tests of ed_mode
rgknox Feb 19, 2016
bbc0558
Merge branch 'rgknox/cime/lawrencium-newintel' into rgknox/cime/ed-au…
rgknox Feb 19, 2016
73ba5c8
completed a working prototype of ed_mode namelist unittests, 9 tests …
rgknox Feb 19, 2016
109b32b
trying to integrate usage of namelist default files and calls to add_…
rgknox Feb 23, 2016
69e3efb
unit tests now working correctly and calling add_defaults via default…
rgknox Feb 24, 2016
476dccb
syntax corrections on namelist_default xml, reverted H variables in t…
rgknox Feb 24, 2016
6bd1285
Added test ERS_D_Ld5.f10_f10.ICLM45ED.ed_ed.clm-edNoFire
rgknox Feb 24, 2016
d9d1bda
added conditional to the add_default namelist building for ed logic, …
rgknox Feb 24, 2016
5c6dd43
Merge branch 'master' into rgknox/cime/ed-auto-options
rgknox Feb 24, 2016
04f9481
modified the edNoFire regression tests to use pre-existing use_centur…
rgknox Feb 24, 2016
63a2773
removed inherited default namelist variables in the edNoFire test cases
rgknox Feb 24, 2016
48631c5
edNoFire updated to get inherited namelist from edTest
rgknox Feb 25, 2016
a066165
git added include_user_mods
rgknox Feb 25, 2016
1703aa1
fixed error on the spit_fire=false namelist unit test
rgknox Feb 25, 2016
7268027
uncommented the initialization of the physics namelist variable in th…
rgknox Feb 25, 2016
3d6f43d
Update the clm build-namelist unit test to remove warning.
bandre-ucar Feb 25, 2016
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
4 changes: 2 additions & 2 deletions cime/machines/env_mach_specific.lawrencium-lr2
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ module load cmake
module load perl xml-libxml switch

if ( $COMPILER == "intel" ) then
module load intel/2015.0.090
module load intel/2015.6.233
module load openmpi
module load netcdf/4.3.2-intel-p
module load netcdf/4.4.0-intel-p
module load mkl
endif

Expand Down
37 changes: 37 additions & 0 deletions cime/machines/env_mach_specific.lawrencium-lr3
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#! /bin/csh -f

set CESM_REPO = `./xmlquery CCSM_REPOTAG -value`
if($status == 0) then
set COMPILER = `./xmlquery COMPILER -value`
set MPILIB = `./xmlquery MPILIB -value`
set DEBUG = `./xmlquery DEBUG -value`
set OS = `./xmlquery OS -value`
set PROFILE_PAPI_ENABLE = `./xmlquery PROFILE_PAPI_ENABLE -value`
set PROJECT = `./xmlquery PROJECT -value`
else
echo $0 using settings from environment:
endif
echo "COMPILER=$COMPILER"
echo "MPILIB=$MPILIB"
echo "DEBUG=$DEBUG"
echo "OS=$OS"
echo "PROJECT=$PROJECT"

source /etc/profile.d/modules.csh
module purge
module load cmake
module load perl xml-libxml switch

if ( $COMPILER == "intel" ) then
module load intel/2015.6.233
module load openmpi
module load netcdf/4.4.0-intel-p
module load mkl
endif

setenv NETCDF_PATH $NETCDF_DIR
#-------------------------------------------------------------------------------

limit coredumpsize 1000000
limit stacksize unlimited

2 changes: 1 addition & 1 deletion cime/scripts/Tools/config_compsets.xml
Original file line number Diff line number Diff line change
Expand Up @@ -845,7 +845,7 @@ CAM[45]%L60 => CAM with 60 layers and full gravity wave spectrum:
<CLM_BLDNML_OPTS compset="_CLM45%[^_]*BGCDV" >-bgc bgc -dynamic_vegetation</CLM_BLDNML_OPTS>
<CLM_BLDNML_OPTS compset="_CLM45%[^_]*CNDV-CROP" >-bgc cn -dynamic_vegetation -crop</CLM_BLDNML_OPTS>
<CLM_BLDNML_OPTS compset="_CLM45%[^_]*BGCDV-CROP">-bgc bgc -dynamic_vegetation -crop</CLM_BLDNML_OPTS>
<CLM_BLDNML_OPTS compset="_CLM45%[^_]*ED" >-ed_mode</CLM_BLDNML_OPTS>
<CLM_BLDNML_OPTS compset="_CLM45%[^_]*ED" >-ed_mode -no-megan</CLM_BLDNML_OPTS>

<CLM_BLDNML_OPTS compset="_CLM50%[^_]*SP" >-bgc sp</CLM_BLDNML_OPTS>
<CLM_BLDNML_OPTS compset="_CLM50%[^_]*BGC" >-bgc bgc</CLM_BLDNML_OPTS>
Expand Down
114 changes: 84 additions & 30 deletions components/clm/bld/CLMBuildNamelist.pm
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,9 @@ OPTIONS
(can ONLY be turned on when BGC type is 'cn' or 'bgc')
This turns on the namelist variable: use_cndv
-ed_mode Turn ED (Ecosystem Demography) : [on | off] (default is off)
Sets the namelist variable use_ed and use_spit_fire.
Sets the namelist variable use_ed, checks for use_spit_fire,
use_vertsoilc, use_century_decomp and use_lch4
Also specifies defaults for these
-glc_present Set to true if the glc model is present (not sglc).
This is used for error-checking, to make sure other options are
set appropriately.
Expand Down Expand Up @@ -730,7 +732,6 @@ sub setup_cmdl_ed_mode {
$var = "use_ed";
$nl_flags->{$var} = ".false.";
if ($nl_flags->{'ed_mode'} eq 1) {
message("Using ED (Ecosystem Demography).");
$val = ".true.";
$nl_flags->{$var} = $val;
}
Expand All @@ -745,13 +746,42 @@ sub setup_cmdl_ed_mode {
fatal_error("$var has a value ($val) that is NOT valid. Valid values are: @valid_values\n");
}

$var = "use_ed_spit_fire";
$nl->set_variable_value($group, $var, $val);
if ( ! $definition->is_valid_value($var, $val) ) {
my @valid_values = $definition->get_valid_values( $var );
fatal_error("$var has a value ($val) that is NOT valid. Valid values are: @valid_values\n");
# This section is a place-holder to test for modules that are not allowed with ED
# the defaults which are set in the logic section of the namelist builder will
# automatically set these correctly (well that is the assumption), but here we
# want to set a catch to fail and warn users if they explicitly set incompatible user namelist
# options

# my $var = "use_somevar";
# $val = $nl_flags->{$var};
# if ( defined($nl->get_value($var)) ) {
# if ( $nl->get_value($var) == ".true." ) {
# fatal_error("$var was set to .true., which is incompatible when -ed_mode option is used.\n");
# }
# }


# The following variables may be set by the user and are compatible with use_ed
# no need to set defaults, covered in a different routine
my @list = ( "use_ed_spit_fire", "use_vertsoilc", "use_century_decomp", "use_lch4" );
foreach my $var ( @list ) {
if ( defined($nl->get_value($var)) ) {
$nl_flags->{$var} = $nl->get_value($var);
$val = $nl_flags->{$var};
my $group = $definition->get_group_name($var);
$nl->set_variable_value($group, $var, $val);
if ( ! $definition->is_valid_value( $var, $val ) ) {
my @valid_values = $definition->get_valid_values( $var );
fatal_error("$var has a value ($val) that is NOT valid. Valid values are: @valid_values\n");
}
}
}

# add_default($test_files, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'use_vertsoilc', 'use_ed'=>$nl_flags->{'use_ed'} );


} else {
# we only dis-allow ed_spit_fire with non-ed runs
$var = "use_ed_spit_fire";
if ( defined($nl->get_value($var)) ) {
fatal_error("$var is being set, but can ONLY be set when -ed_mode option is used.\n");
Expand All @@ -771,6 +801,7 @@ sub setup_cmdl_bgc {

$val = $opts->{$var};
$nl_flags->{'bgc_mode'} = $val;

if ( $physv->as_long() == $physv->as_long("clm4_0") ) {
if ( $nl_flags->{'bgc_mode'} ne "default" ) {
fatal_error("-bgc option used with clm4_0 physics. -bgc can ONLY be used with clm4_5/clm5_0 physics");
Expand Down Expand Up @@ -802,29 +833,32 @@ sub setup_cmdl_bgc {
if ( defined($nl->get_value("use_cn")) && ($nl_flags->{'use_cn'} ne $nl->get_value("use_cn")) ) {
fatal_error("The namelist variable use_cn is inconsistent with the -bgc option");
}
# If the variable has already been set use it, if not set to the value defined by the bgc_mode
my @list = ( "use_lch4", "use_nitrif_denitrif", "use_vertsoilc", "use_century_decomp" );
my $ndiff = 0;
foreach my $var ( @list ) {
if ( ! defined($nl->get_value($var)) ) {
$nl_flags->{$var} = $setting;
} else {
if ( $nl->get_value($var) ne $setting ) {
$ndiff += 1;
}
$nl_flags->{$var} = $nl->get_value($var);
}
$val = $nl_flags->{$var};
my $group = $definition->get_group_name($var);
$nl->set_variable_value($group, $var, $val);
if ( ! $definition->is_valid_value( $var, $val ) ) {
my @valid_values = $definition->get_valid_values( $var );
fatal_error("$var has a value ($val) that is NOT valid. Valid values are: @valid_values\n");
}
}
# If all the variables are different report it as an error
if ( $ndiff == ($#list + 1) ) {
fatal_error("You are contradicting the -bgc setting with the namelist variables: @list" );

if ( $opts->{"ed_mode"} != 1) {
# If the variable has already been set use it, if not set to the value defined by the bgc_mode
my @list = ( "use_lch4", "use_nitrif_denitrif", "use_vertsoilc", "use_century_decomp" );
my $ndiff = 0;
foreach my $var ( @list ) {
if ( ! defined($nl->get_value($var)) ) {
$nl_flags->{$var} = $setting;
} else {
if ( $nl->get_value($var) ne $setting ) {
$ndiff += 1;
}
$nl_flags->{$var} = $nl->get_value($var);
}
$val = $nl_flags->{$var};
my $group = $definition->get_group_name($var);
$nl->set_variable_value($group, $var, $val);
if ( ! $definition->is_valid_value( $var, $val ) ) {
my @valid_values = $definition->get_valid_values( $var );
fatal_error("$var has a value ($val) that is NOT valid. Valid values are: @valid_values\n");
}
}
# If all the variables are different report it as an error
if ( $ndiff == ($#list + 1) ) {
fatal_error("You are contradicting the -bgc setting with the namelist variables: @list" );
}
}

# Now set use_cn
Expand Down Expand Up @@ -1427,6 +1461,7 @@ sub process_namelist_inline_logic {
setup_logic_supplemental_nitrogen($opts->{'test'}, $nl_flags, $definition, $defaults, $nl, $physv);
setup_logic_snowpack($opts->{'test'}, $nl_flags, $definition, $defaults, $nl, $physv);
setup_logic_atm_forcing($opts->{'test'}, $nl_flags, $definition, $defaults, $nl, $physv);
setup_logic_ed($opts->{'test'}, $nl_flags, $definition, $defaults, $nl, $physv);

#########################################
# namelist group: clm_humanindex_inparm #
Expand Down Expand Up @@ -2736,6 +2771,23 @@ sub setup_logic_atm_forcing {

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

sub setup_logic_ed {
#
# Set some default options related to Ecosystem Demography
#
my ($test_files, $nl_flags, $definition, $defaults, $nl, $physv) = @_;

if ($physv->as_long() >= $physv->as_long("clm4_5") && value_is_true( $nl_flags->{'use_ed'}) ) {
add_default($test_files, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'use_vertsoilc', 'use_ed'=>$nl_flags->{'use_ed'} );
add_default($test_files, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'use_century_decomp', 'use_ed'=>$nl_flags->{'use_ed'} );
add_default($test_files, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'use_ed_spit_fire', 'use_ed'=>$nl_flags->{'use_ed'} );
add_default($test_files, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'use_lch4', 'use_ed'=>$nl_flags->{'use_ed'} );
add_default($test_files, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'use_nitrif_denitrif', 'use_ed'=>$nl_flags->{'use_ed'} );
}
}

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

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

Expand Down Expand Up @@ -2840,6 +2892,7 @@ sub add_default {
$var = $1;
}
# Query the definition to find which group the variable belongs to. Exit if not found.

my $group = $definition->get_group_name($var);
unless ($group) {
my $fname = $definition->get_file_name();
Expand All @@ -2860,6 +2913,7 @@ sub add_default {
# in %settings to the get_value method to be used as attributes that are matched
# when looking for default values.
else {

$val = $defaults->get_value($var, \%settings);

# Truncate model_version appropriately
Expand Down
11 changes: 11 additions & 0 deletions components/clm/bld/namelist_files/namelist_defaults_clm4_5.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1612,4 +1612,15 @@ lnd/clm2/surfdata_map/surfdata_ne30np4_simyr1850_c141219.nc</fsurdat>

<use_aereoxid_prog use_cn=".true.">.true.</use_aereoxid_prog>

<!-- ========================================= -->
<!-- Defaults for use_ed = .true. -->
<!-- ========================================= -->

<use_vertsoilc use_ed=".true.">.true.</use_vertsoilc>
<use_century_decomp use_ed=".true.">.true.</use_century_decomp>
<use_ed_spit_fire use_ed=".true.">.true.</use_ed_spit_fire>
<use_lch4 use_ed=".true.">.false.</use_lch4>
<use_nitrif_denitrif use_ed=".true.">.false.</use_nitrif_denitrif>


</namelist_defaults>
Original file line number Diff line number Diff line change
Expand Up @@ -427,13 +427,13 @@ Requires the CN model to work (either CN or CNDV).
<entry id="use_vertsoilc" type="logical" category="bgc"
group="clm_inparm" valid_values="" value=".false.">
Turn on vertical soil carbon.
Requires the CN model to work (either CN or CNDV).
Requires the CN or ED model to work (either CN or CNDV).
</entry>

<entry id="use_century_decomp" type="logical" category="bgc"
group="clm_inparm" valid_values="" value=".false.">
Use parameters for decomposition from the CENTURY Carbon model
Requires the CN model to work (either CN or CNDV).
Requires the CN or ED model to work (either CN or CNDV).
</entry>

<entry id="use_extralakelayers" type="logical" category="physics"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,18 @@ attributes from the config_cache.xml file (with keys converted to upper-case).
<!-- Plant function types (relative to {csmdata}) -->
<paramfile >lnd/clm2/paramdata/clm_params.c130821.nc</paramfile>


<!--- ======================================== -->
<!--- Defaults for use_ed = .true. -->
<!-- ======================================== -->

<use_vertsoilc use_ed=".true.">.true.</use_vertsoilc>
<use_century_decomp use_ed=".true." >.true.</use_century_decomp>
<use_ed_spit_fire use_ed=".true.">.true.</use_ed_spit_fire>
<use_lch4 use_ed=".true.">.false.</use_lch4>
<use_nitrif_denitrif use_ed=".true.">.false.</use_nitrif_denitrif>


<!--

Original initial condition file at 1 degree resolution
Expand Down Expand Up @@ -1478,4 +1490,5 @@ lnd/clm2/surfdata_map/surfdata_ne30np4_simyr1850_c130927.nc</fsurdat>

<use_aereoxid_prog use_cn=".true.">.true.</use_aereoxid_prog>


</namelist_defaults>
10 changes: 8 additions & 2 deletions components/clm/bld/test_build_namelist/t/template_test_XXX.pm
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use parent qw(Test::Class);
# Common test fixture for all tests:
#
#-------------------------------------------------------------------------------
sub startup : Test(startup => 3) {
sub startup : Test(startup => 4) {
my $self = shift;
# provide common fixture for all tests, only created once at the
# start of the tests.
Expand All @@ -23,8 +23,14 @@ sub startup : Test(startup => 3) {
$self->{definition} = Build::NamelistDefinition->new("t/input/namelist_definition_clm4_5_test.xml");
isnt($self->{definition}, undef, (caller(0))[3] . " : namelist_definition object created.");

$self->{defaults} = Build::NamelistDefaults->new("t/input/namelist_defaults_clm4_5_test.xml");
$self->{defaults} = Build::NamelistDefaults->new("t/input/namelist_defaults_clm4_5_test.xml",$self->{cfg});
isnt($self->{defaults}, undef, (caller(0))[3] . " : namelist_defaults object created.");

# The next line may be usefull (set startup => 4) in arg call above:
$self->{physv} = config_files::clm_phys_vers->new( $self->{cfg}->get('phys') );
isnt($self->{physv}, undef, (caller(0))[3] . " : phys_vers object created.");


}

sub shutdown : Test(shutdown) {
Expand Down
Loading