Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
33 changes: 29 additions & 4 deletions bld/CLMBuildNamelist.pm
Original file line number Diff line number Diff line change
Expand Up @@ -994,7 +994,7 @@ sub setup_cmdl_bgc {
# Set soil matrix (which is needed later for spinup)
$var = "use_soil_matrixcn";
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var,
, 'use_fates'=>$nl_flags->{'use_fates'},
, 'use_fates'=>$nl_flags->{'use_fates'},
, 'soil_decomp_method'=>$nl_flags->{'soil_decomp_method'},
, 'phys'=>$nl_flags->{'phys'}, clm_accelerated_spinup=>$nl_flags->{'clm_accelerated_spinup'} );
if ( &value_is_true($nl->get_value($var)) ) {
Expand Down Expand Up @@ -1230,7 +1230,7 @@ sub setup_cmdl_spinup {
if ( &value_is_true($nl_flags->{'use_cn'}) ) {
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition,
$defaults, $nl, "spinup_state", clm_accelerated_spinup=>$nl_flags->{'clm_accelerated_spinup'},
use_cn=>$nl_flags->{'use_cn'}, use_fates=>$nl_flags->{'use_fates'},
use_cn=>$nl_flags->{'use_cn'}, use_fates=>$nl_flags->{'use_fates'},
use_soil_matrixcn=>$nl_flags->{"use_soil_matrixcn"} );
if ( $nl->get_value("spinup_state") ne 0 ) {
$nl_flags->{'bgc_spinup'} = "on";
Expand Down Expand Up @@ -1803,6 +1803,7 @@ sub process_namelist_inline_logic {
# NOTE: After setup_logic_dust_emis #
#####################################
setup_logic_megan($opts, $nl_flags, $definition, $defaults, $nl);
setup_logic_megan_opts($opts, $nl_flags, $definition, $defaults, $nl);

##################################
# namelist group: lai_streams #
Expand Down Expand Up @@ -4152,6 +4153,7 @@ sub setup_logic_dust_emis {

sub setup_logic_megan {
my ($opts, $nl_flags, $definition, $defaults, $nl) = @_;
# Setup megan_emis_nl namelist for drv_flds_in

my $var = "megan";

Expand Down Expand Up @@ -4181,6 +4183,29 @@ sub setup_logic_megan {

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

sub setup_logic_megan_opts {
my ($opts, $nl_flags, $definition, $defaults, $nl) = @_;
# Setup megan_opts namelist
# This should be set when megan is turned on by CTSM, but also when CAM has turned it on

if ($nl_flags->{'megan'} ) {
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'megan_use_gamma_sm');
if ( &value_is_true( $nl->get_value('megan_use_gamma_sm') ) ) {
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'megan_min_gamma_sm');
} elsif ( defined($nl->get_value('megan_min_gamma_sm')) ) {
$log->fatal_error("megan_min_gamma_sm should NOT be set when megan_use_gamma_sm NOT TRUE.\n" );
}
}
else {
if ( defined($nl->get_value('megan_use_gamma_sm')) ||
defined($nl->get_value('megan_min_gamma_sm')) ) {
$log->fatal_error("MEGAN options should NOT be set when MEGAN is NOT in use.\n" );
}
}
}

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

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

Expand Down Expand Up @@ -4992,7 +5017,7 @@ sub setup_logic_exice {
# excess ice streams, must be set before initial conditions
#
my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_;
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'use_excess_ice', 'phys'=>$physv->as_string());
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'use_excess_ice', 'phys'=>$physv->as_string());
my $use_exice = $nl->get_value( 'use_excess_ice' );
# Put use_exice into nl_flags so can be referenced later
if ( value_is_true($use_exice) ) {
Expand Down Expand Up @@ -5206,7 +5231,7 @@ sub write_output_files {

@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
cropcal_streams
cropcal_streams megan_opts
clm_soilhydrology_inparm dynamic_subgrid cnvegcarbonstate
finidat_consistency_checks dynpft_consistency_checks
clm_initinterp_inparm century_soilbgcdecompcascade
Expand Down
4 changes: 4 additions & 0 deletions bld/namelist_files/namelist_defaults_ctsm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,10 @@ attributes from the config_cache.xml file (with keys converted to upper-case).
<megan clm_accelerated_spinup="sasu">0</megan>
<megan configuration="nwp" >0</megan>

<!-- Setting to TRUE replicates previous ctsm5.3.063 answers, setting to false turns the soil moisture effect off -->
<megan_use_gamma_sm>.true.</megan_use_gamma_sm>
<megan_min_gamma_sm>0.0d00</megan_min_gamma_sm>

<!-- Supplmental Nitrogen mode -->
<suplnitro use_cn=".true." >NONE</suplnitro>
<suplnitro use_fates=".true." >ALL</suplnitro>
Expand Down
Loading