Skip to content

Commit

Permalink
Revert "Merge remote-tracking branch 'rgknox/rgknox/lnd/fates-part3' …
Browse files Browse the repository at this point in the history
…into next (PR #1536)"

This reverts commit 16bb80b, reversing
changes made to db6993d.
  • Loading branch information
Gautam Bisht committed May 23, 2017
1 parent 2d5aa5b commit 1793e10
Show file tree
Hide file tree
Showing 43 changed files with 5,075 additions and 8,404 deletions.
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,3 @@
path = components/mpas-cice/model
url = git@github.com:ACME-Climate/MPAS.git
branch = cice/develop
[submodule "components/clm/src/external_models/fates"]
path = components/clm/src/external_models/fates
url = git@github.com:ACME-Climate/fates.git
2 changes: 0 additions & 2 deletions cime/config/acme/machines/config_machines.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2340,7 +2340,6 @@
<machine MACH="lawrencium-lr3">
<DESC>Lawrencium LR3 cluster at LBL, OS is Linux (intel), batch system is SLURM</DESC>
<OS>LINUX</OS>
<NODENAME_REGEX>n000*</NODENAME_REGEX>
<COMPILERS>intel</COMPILERS>
<MPILIBS>openmpi,mpi-serial</MPILIBS>
<CIME_OUTPUT_ROOT>/global/scratch/$ENV{USER}</CIME_OUTPUT_ROOT>
Expand Down Expand Up @@ -2404,7 +2403,6 @@
<machine MACH="lawrencium-lr2">
<DESC>Lawrencium LR2 cluster at LBL, OS is Linux (intel), batch system is SLURM</DESC>
<OS>LINUX</OS>
<NODENAME_REGEX>n000*</NODENAME_REGEX>
<COMPILERS>intel</COMPILERS>
<MPILIBS>openmpi,mpi-serial</MPILIBS>
<CIME_OUTPUT_ROOT>/global/scratch/$ENV{USER}</CIME_OUTPUT_ROOT>
Expand Down
1 change: 0 additions & 1 deletion cime/scripts/lib/update_acme_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@
("ERS.f19_g16.I1850CNECACNTBC" ,"clm-eca"),
("ERS.f19_g16.I1850CNECACTCBC" ,"clm-eca"),
("SMS_Ly2_P1x1.1x1_smallvilleIA.ICLM45CNCROP", "force_netcdf_pio"),
("SMS_Lm1.f45_f45.ICLM45ED","clm-fates"),
("ERS.f19_g16.I1850CLM45","clm-betr"),
"ERS.ne11_oQU240.I20TRCLM45",
"ERS.f09_g16.IMCLM45BC")
Expand Down
149 changes: 54 additions & 95 deletions components/clm/bld/CLMBuildNamelist.pm
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ REQUIRED OPTIONS
"-sim_year list" to list valid simulation years
(default 2000)
OPTIONS
-bgc "value" Build CLM with BGC package [ sp | cn | bgc | ed ]
-bgc "value" Build CLM with BGC package [ sp | cn | bgc ]
(default is sp).
CLM Biogeochemistry mode
sp = Satellite Phenology (SP)
Expand All @@ -101,13 +101,9 @@ OPTIONS
(or CLM45BGC if phys=clm4_5/clm5_0, use_cn=true, use_vertsoilc=true,
use_century_decomp=true, use_nitrif_denitrif=true, and use_lch4=true,
use_dynroot)
This toggles on the namelist variables:
This toggles on the namelist variables:
use_cn, use_lch4, use_nitrif_denitrif, use_vertsoilc, use_century_decomp,
use_dynroot
ed = (fates) functionaly assembled terrestrial ecosystem simulator
with native below ground bgc
This toggles on the namelist variables:
use_ed, use_vertsoilc, use_century_decomp
-bgc_spinup "on|off" CLM 4.5 Only. For CLM 4.0, spinup is controlled from configure.
Turn on given spinup mode for BGC setting of CN
Expand Down Expand Up @@ -165,6 +161,8 @@ OPTIONS
-dynamic_vegetation Toggle for dynamic vegetation model. (default is off)
(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.
-fsnowoptics "opticalpropertiesfile" Snow optical properties input file
-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
Expand Down Expand Up @@ -297,6 +295,7 @@ sub process_commandline {
bgc => "default",
crop => 0,
dynamic_vegetation => 0,
ed_mode => 0,
envxml_dir => ".",
vichydro => 0,
maxpft => "default",
Expand Down Expand Up @@ -346,6 +345,7 @@ sub process_commandline {
"bgc=s" => \$opts{'bgc'},
"crop" => \$opts{'crop'},
"dynamic_vegetation" => \$opts{'dynamic_vegetation'},
"ed_mode" => \$opts{'ed_mode'},
"vichydro" => \$opts{'vichydro'},
"maxpft=i" => \$opts{'maxpft'},
"v|verbose" => \$opts{'verbose'},
Expand Down Expand Up @@ -679,7 +679,7 @@ sub process_namelist_commandline_options {
setup_cmdl_simulation_year($opts, $nl_flags, $definition, $defaults, $nl);
setup_cmdl_run_type($opts, $nl_flags, $definition, $defaults, $nl);
setup_cmdl_dynamic_vegetation($opts, $nl_flags, $definition, $defaults, $nl, $physv);
setup_cmdl_fates_mode($opts, $nl_flags, $definition, $defaults, $nl, $physv);
setup_cmdl_ed_mode($opts, $nl_flags, $definition, $defaults, $nl, $physv);
setup_cmdl_vichydro($opts, $nl_flags, $definition, $defaults, $nl, $physv);
setup_cmdl_betr_mode($opts, $nl_flags, $definition, $defaults, $nl, $physv);
}
Expand Down Expand Up @@ -750,66 +750,54 @@ sub setup_cmdl_mask {
verbose_message("CLM land mask is $nl_flags->{'mask'}");
}

sub setup_cmdl_fates_mode {
#-------------------------------------------------------------------------------
sub setup_cmdl_ed_mode {
#
# call this at least after crop check is called
#
my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_;

my $val;
my $var = "bgc_mode";
my $var = "ed_mode";

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

if ( $physv->as_long() == $physv->as_long("clm4_0") || $nl_flags->{'crop'} eq "on" ) {
if ( $nl_flags->{$var} eq "ed" ) {
if ( $nl_flags->{'ed_mode'} == 1 ) {
# ED is not a clm4_0 option and should not be used with crop and not with clm4_0
fatal_error("** Cannot turn ed mode on with crop or with clm4_0 physics.\n" );
}
} elsif ($nl_flags->{"bgc_mode"} eq "ed" && $nl_flags->{"use_ed"} ne ".true.") {
fatal_error("DEV_ERROR: internal logic error: bgc_mode = ed and use_ed = false.\n");

} else {

$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;
}
if ( defined($nl->get_value($var)) && $nl->get_value($var) ne $val ) {
fatal_error("$var is inconsistent with the commandline setting of -ed_mode");
}
if ( $nl_flags->{$var} eq ".true." ) {
# 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 -bgc ed 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_spitfire", "use_vertsoilc", "use_century_decomp" );
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'} );

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");
}

$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");
}
} else {
# we only dis-allow ed_spitfire with non-ed runs
$var = "use_ed_spitfire";
$var = "use_ed_spit_fire";
if ( defined($nl->get_value($var)) ) {
fatal_error("$var is being set, but can ONLY be set when -bgc ed option is used.\n");
fatal_error("$var is being set, but can ONLY be set when -ed_mode option is used.\n");
}
}
}
Expand All @@ -829,10 +817,10 @@ sub setup_cmdl_betr_mode {
$nl_flags->{'betr_mode'} = $val;

if ( $physv->as_long() == $physv->as_long("clm4_0") || $nl_flags->{'crop'} eq "on" ) {
if ( $nl_flags->{$var} == 1 ) {
# BeTR is not a clm4_0 option and should not be used with crop and not with clm4_0
fatal_error("** Cannot turn betr mode on with crop or with clm4_0 physics.\n" );
}
if ( $nl_flags->{'ed_mode'} == 1 ) {
# ED is not a clm4_0 option and should not be used with crop and not with clm4_0
fatal_error("** Cannot turn betr mode on with crop or with clm4_0 physics.\n" );
}
} else {

$var = "use_betr";
Expand Down Expand Up @@ -919,7 +907,6 @@ 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 All @@ -942,25 +929,15 @@ sub setup_cmdl_bgc {
my $setting = ".false.";
if ($nl_flags->{$var} eq "cn") {
$nl_flags->{'use_cn'} = ".true.";
$nl_flags->{'use_ed'} = ".false.";
} elsif ($nl_flags->{$var} eq "bgc") {
$nl_flags->{'use_cn'} = ".true.";
$nl_flags->{'use_ed'} = ".false.";
$setting = ".true.";
} elsif ($nl_flags->{$var} eq "ed" ) {
$nl_flags->{'use_cn'} = ".false.";
$nl_flags->{'use_ed'} = ".true.";
} else {
$nl_flags->{'use_cn'} = ".false.";
$nl_flags->{'use_ed'} = ".false.";
}
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 ( defined($nl->get_value("use_ed")) && ($nl_flags->{'use_ed'} ne $nl->get_value("use_ed")) ) {
fatal_error("The namelist variable use_ed 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;
Expand Down Expand Up @@ -989,18 +966,14 @@ sub setup_cmdl_bgc {
fatal_error("You are contradicting the -bgc setting with the namelist variables: @list" );
}

# # Now set use_cn
# $var = "use_cn";

# Now set use_cn and use_ed
foreach $var ( "use_cn", "use_ed" ) {
$val = $nl_flags->{$var};
$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");
}
# Now set use_cn
$var = "use_cn";
$val = $nl_flags->{'use_cn'};
$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");
}

# Now set use_dynroot
Expand Down Expand Up @@ -1900,7 +1873,6 @@ sub process_namelist_inline_logic {
setup_logic_bgc_spinup($opts->{'test'}, $nl_flags, $definition, $defaults, $nl, $physv);
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_fates($opts->{'test'}, $nl_flags, $definition, $defaults, $nl, $physv);

#########################################
# namelist group: clm_humanindex_inparm #
Expand Down Expand Up @@ -2975,7 +2947,7 @@ sub setup_logic_nitrogen_deposition {
'bgc'=>$nl_flags->{'bgc_mode'}, 'rcp'=>$nl_flags->{'rcp'},
'hgrid'=>"1.9x2.5" );

} elsif ( $physv->as_long() >= $physv->as_long("clm4_5") && $nl_flags->{'bgc_mode'} =~/cn|bgc/ ) {
} elsif ( $physv->as_long() >= $physv->as_long("clm4_5") && $nl_flags->{'bgc_mode'} ne "sp" ) {
add_default($test_files, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'ndepmapalgo', 'phys'=>$nl_flags->{'phys'},
'use_cn'=>$nl_flags->{'use_cn'}, 'hgrid'=>$nl_flags->{'res'} );
add_default($test_files, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_year_first_ndep', 'phys'=>$nl_flags->{'phys'},
Expand Down Expand Up @@ -3036,7 +3008,7 @@ sub setup_logic_phosphorus_deposition {
# 'hgrid'=>"1.9x2.5" );

# } elsif ( $physv->as_long() >= $physv->as_long("clm4_5") && $nl_flags->{'bgc_mode'} ne "sp" ) {
if ( $physv->as_long() >= $physv->as_long("clm4_5") && $nl_flags->{'bgc_mode'} =~/cn|bgc/ ) {
if ( $physv->as_long() >= $physv->as_long("clm4_5") && $nl_flags->{'bgc_mode'} ne "sp" ) {
add_default($test_files, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'pdepmapalgo', 'phys'=>$nl_flags->{'phys'},
'use_cn'=>$nl_flags->{'use_cn'}, 'hgrid'=>$nl_flags->{'res'} );
add_default($test_files, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_year_first_pdep', 'phys'=>$nl_flags->{'phys'},
Expand Down Expand Up @@ -3074,7 +3046,7 @@ sub setup_logic_popd_streams {
my ($test_files, $nl_flags, $definition, $defaults, $nl, $physv) = @_;

if ( $physv->as_long() >= $physv->as_long("clm4_5") ) {
if ( $nl_flags->{'bgc_mode'} =~/cn|bgc/ ) {
if ( $nl_flags->{'bgc_mode'} ne "sp" ) {
add_default($test_files, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'popdensmapalgo', 'hgrid'=>$nl_flags->{'res'} );
add_default($test_files, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_year_first_popdens', 'phys'=>$nl_flags->{'phys'},
'use_cn'=>$nl_flags->{'use_cn'}, 'sim_year'=>$nl_flags->{'sim_year'},
Expand Down Expand Up @@ -3111,7 +3083,7 @@ sub setup_logic_lightning_streams {
my ($test_files, $nl_flags, $definition, $defaults, $nl, $physv) = @_;

if ( $physv->as_long() >= $physv->as_long("clm4_5") ) {
if ( $nl_flags->{'bgc_mode'} =~/cn|bgc/ ) {
if ( $nl_flags->{'bgc_mode'} ne "sp" ) {
add_default($test_files, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'lightngmapalgo', 'use_cn'=>$nl_flags->{'use_cn'},
'hgrid'=>$nl_flags->{'res'} );
add_default($test_files, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_year_first_lightng', 'use_cn'=>$nl_flags->{'use_cn'},
Expand Down Expand Up @@ -3166,7 +3138,7 @@ sub setup_logic_megan {
if ($opts->{'megan'} ) {
if ( value_is_true( $nl_flags->{'use_ed'} ) ) {
fatal_error("MEGAN can NOT be on when ED is also on.\n" .
" Use the '-no-megan' option when '-bgc ed' is activated");
" Use the '-no-megan' option when '-ed_mode' is activated");
}
add_default($opts->{'test'}, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'megan_specifier');
check_megan_spec( $nl, $definition );
Expand Down Expand Up @@ -3258,19 +3230,6 @@ sub setup_logic_pflotran {
}
} # end setup_logic_pflotran

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

sub setup_logic_fates {
#
# 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_ed_spitfire', 'use_ed'=>$nl_flags->{'use_ed'} );
add_default($test_files, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'fates_paramfile', 'phys'=>$nl_flags->{'phys'});
}
}

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

Expand Down
7 changes: 2 additions & 5 deletions components/clm/bld/configure
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ OPTIONS
or double leading dashes. A consequence of this is that single letter options may
NOT be bundled.
-bgc <name> Build CLM with BGC package [ none | cn | cndv | ed]
-bgc <name> Build CLM with BGC package [ none | cn | cndv ]
(default is none).
-cache <file> Name of output cache file (default: config_cache.xml).
-cachedir <file> Name of directory where output cache file is written
Expand Down Expand Up @@ -654,10 +654,7 @@ sub write_filepath_cesmbld
"biogeophys/vsfm",
"biogeochem",
"dyn_subgrid",
"external_models/fates/main",
"external_models/fates/biogeophys",
"external_models/fates/biogeochem",
"external_models/fates/fire",
"ED/main",
"utils",
"cpl" );

Expand Down
Loading

0 comments on commit 1793e10

Please sign in to comment.