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

Cn matrix v3 #640

Merged
merged 93 commits into from
Jul 19, 2024
Merged
Show file tree
Hide file tree
Changes from 49 commits
Commits
Show all changes
93 commits
Select commit Hold shift + click to select a range
2785caf
Seperate out nrepr loops into ones for matrixcn off and on
ekluzek May 27, 2022
effacf2
Corrections for cheyenne test-suite to pass
slevis-lmwg Nov 28, 2023
ffc6acc
Upd. expected fails, test list, and relevant error checks
slevis-lmwg Nov 30, 2023
0401113
Update expected fails and testlist files
slevis-lmwg Dec 1, 2023
24eaf7d
Merge tag 'ctsm5.1.dev091' into cn-matrix_v3
slevis-lmwg Dec 6, 2023
def2f75
Change failing SMS_Ln9_P72x2 test to passing SMS_Ln9_P360x2
slevis-lmwg Dec 12, 2023
0fc0d32
Merge tag 'ctsm5.1.dev092' into cn-matrix_v3
slevis-lmwg Dec 15, 2023
08768f9
To pass test, add use_matrixcn=.false. to luna testmod
slevis-lmwg Dec 18, 2023
eb73e17
Merge tag 'ctsm5.1.dev093' into cn-matrix_slevis
slevis-lmwg Dec 19, 2023
8b2cb72
Remove two clm45 tests from ExpectedTestFails
slevis-lmwg Dec 19, 2023
a038bc1
Merge branch 'cn-matrix_slevis' into cn-matrix_v3
slevis-lmwg Dec 19, 2023
245e2df
Merge tag 'ctsm5.1.dev095' into cn-matrix_v3
slevis-lmwg Dec 20, 2023
92d7ae0
Merge tag 'ctsm5.1.dev096' into cn-matrix_v3
slevis-lmwg Dec 20, 2023
8764072
Merge tag 'ctsm5.1.dev099' into cn-matrix_v3
slevis-lmwg Dec 20, 2023
e7cb30a
Merge tag 'ctsm5.1.dev100' into cn-matrix_v3
slevis-lmwg Dec 22, 2023
ddfac7b
Backed dev100 mods out of 3 more files for 1x1_brazil test to pass
slevis-lmwg Dec 22, 2023
2a77c9d
Merge tag 'ctsm5.1.dev118' into cn-matrix_v3
slevis-lmwg Dec 26, 2023
0c7f43b
Merge tag 'ctsm5.1.dev119' into cn-matrix_v3
slevis-lmwg Dec 27, 2023
42af57b
Matrixcn updates pertaining to GULU (gross unrep. landuse chg)
slevis-lmwg Dec 28, 2023
57aa176
Additional updates for matrixcn to work with GULU
slevis-lmwg Dec 28, 2023
1242be2
Cheyenne GULU test now passes with these additional updates
slevis-lmwg Dec 29, 2023
3ce716f
Merge tag 'ctsm5.1.dev133' into cn-matrix_v3
slevis-lmwg Dec 29, 2023
46cbf4b
Remove PS from SMS_Ld3_PS test for it to work with matrixcn
slevis-lmwg Dec 29, 2023
1381a02
Merge tag 'ctsm5.1.dev134' into cn-matrix_v3
slevis-lmwg Dec 30, 2023
cd6d643
Merge commit '46cbf4b' into cn-matrix_v3
slevis-lmwg Dec 30, 2023
2287bb6
Corrections for model to build and a test to pass
slevis-lmwg Dec 30, 2023
107f854
Fix for FatesCold simulations to pass
slevis-lmwg Dec 31, 2023
273bbdb
Merge tag 'ctsm5.1.dev159' into cn-matrix_v3
slevis-lmwg Jan 2, 2024
a1fac72
Merge commit '107f854' into cn-matrix_v3
slevis-lmwg Jan 2, 2024
3af4aed
Corrections from comparing model versions
slevis-lmwg Jan 3, 2024
2ea1cec
Corrections to lists of tests and expected failures
slevis-lmwg Jan 3, 2024
2a7f430
Merge tag 'ctsm5.1.dev162' into cn-matrix_v3
slevis-lmwg Mar 7, 2024
dca1b62
Merge tag 'ctsm5.1.dev163' into cn-matrix_v3
slevis-lmwg Mar 12, 2024
3b4d882
Add matrixcn code for residue removal variables
slevis-lmwg Mar 12, 2024
fe50ce1
Update comment based on most recent code changes
slevis-lmwg Mar 12, 2024
acd1413
Correction to latest code mods
slevis-lmwg Mar 12, 2024
82c1903
Corrections for PEM...till test to PASS
slevis-lmwg Mar 19, 2024
0767f1d
Merge tag 'ctsm5.1.dev174' into cn-matrix_v3
slevis-lmwg Mar 19, 2024
64870fa
Getting around "file not found" error for /run directory
slevis-lmwg Mar 25, 2024
25f0236
Getting around "file not found" error for rundir (this time test passes)
slevis-lmwg Mar 26, 2024
d4cbc8c
Bug-fix discovered by izumi_nag test
slevis-lmwg Mar 26, 2024
f06ceb8
Update derecho test from failing P64x2 to passing P24x2
slevis-lmwg Mar 26, 2024
0ebb7e0
Rename isspinup -> spinup_matrixcn, is_outmatrix -> hist_wrt_matrixcn…
slevis-lmwg Mar 27, 2024
1a2ddff
Replace 1.e+36 with spval in cnmatrix code
slevis-lmwg Mar 27, 2024
a35f775
Merge tag 'ctsm5.1.dev175' into cn-matrix_v3
slevis-lmwg Mar 27, 2024
47839a7
Black reformatting of two files
slevis-lmwg Mar 27, 2024
4cef2cc
Update .git-blame-ignore-revs
slevis-lmwg Mar 27, 2024
e793643
testlist updates for LGRAIN2 and LREPRSTRUCT tests
slevis-lmwg Apr 3, 2024
306d11a
testlist updates for already existing matrixcn tests
slevis-lmwg Apr 3, 2024
99ba6ce
Removed testmod directory not in use
slevis-lmwg Apr 5, 2024
45dbe62
Adding matrixcnOn testmods
slevis-lmwg Apr 5, 2024
0d07eb2
45 new tests with matrixcnOn testmods
slevis-lmwg Apr 8, 2024
a2fc12b
Change matrixcnOn tests to Clm51 and remove redundant tests
slevis-lmwg Apr 11, 2024
3331a67
Merge tag 'ctsm5.1.dev176' into cn-matrix_v3
slevis-lmwg Apr 11, 2024
bd7d031
Rename failing Clm51 tests back to Clm50 due to missing compsets
slevis-lmwg Apr 11, 2024
5d0a037
Remove a clm/FatesCold--clm/matrixcnOn test as invalid
slevis-lmwg Apr 12, 2024
0f08b6e
Merge tag 'ctsm5.2.001' into cn-matrix_v3
slevis-lmwg May 1, 2024
f0f2b9e
Additional conflict resolution in testlist_clm.xml
slevis-lmwg May 1, 2024
3cc33e5
Update test to use a valid compset
slevis-lmwg May 2, 2024
bbfe2b4
Correction to last commit (1850 should have been 2000)
slevis-lmwg May 2, 2024
57004d9
New conflict resolution in testlist_clm.xml, this time for an izumi test
slevis-lmwg May 3, 2024
d0eeb1f
Merge tag 'ctsm5.2.005' into cn-matrix_v3
slevis-lmwg May 15, 2024
5e9bc2e
Update finidat that previously failing test now picks up by default
slevis-lmwg May 16, 2024
73031ae
Merge tag 'ctsm5.2.007' into cn-matrix_v3
slevis-lmwg May 31, 2024
5431850
Add cime_config/usermods_dirs/NEON/NIWO/user_nl_clm for tests to pass
slevis-lmwg Jun 4, 2024
0edef8a
Update ntests in bld/unit_testers/build-namelist_test.pl
slevis-lmwg Jun 4, 2024
1a49e54
Reformatting by "make run-black"
slevis-lmwg Jun 4, 2024
66e1c3d
Update .git-blame-ignore-revs
slevis-lmwg Jun 4, 2024
dfebe5f
Remove user_nl_clm (added in 5431850) and replace 2 NIWO tests with HARV
slevis-lmwg Jun 7, 2024
463fac1
Minor comment updates
slevis-lmwg Jun 24, 2024
47234a9
Add overridable warning that cnmatrix may fail in transient mode
slevis-lmwg Jun 25, 2024
18e63e3
Abort if matrixcn is .true. and nrepr is not 1
slevis-lmwg Jun 25, 2024
f8330c9
Correct earlier commit 47234a9: warning about cnmatrix and transient
slevis-lmwg Jun 25, 2024
17143ee
Correct earlier commit 18e63e3: abort if matrixcn and nrepr not 1
slevis-lmwg Jun 25, 2024
4b18e79
Replace clm45_monthly_matrixcn_soilCN30 testmod and test with clm60
slevis-lmwg Jun 25, 2024
1761a7b
Move new param file to inputdata and rimport
slevis-lmwg Jun 25, 2024
1e97001
Change use_matrixcn, use_soil_matrixcn to default .false. before merge
slevis-lmwg Jun 25, 2024
7feb657
Rm redunant LG* and LR* tests and corresponding expected fails
slevis-lmwg Jun 26, 2024
03fb25a
Two new tests in testlist_clm and two new tests in expected fails
slevis-lmwg Jul 5, 2024
0efd37f
New testmods /matrixcnOn_Hist to use -ignore_warnings in IHist compsets
slevis-lmwg Jul 5, 2024
4ca2b6a
Add error: matrixcn not ok with NTHRDS_LND > 1 (the check does not work)
slevis-lmwg Jul 11, 2024
3ce1bb4
Code mods to get the error check in the previous commit to work
slevis-lmwg Jul 11, 2024
7417640
Allow tests with threading to proceed with -ignore_warnings
slevis-lmwg Jul 12, 2024
3695e12
Merge tag 'ctsm5.2.011' into cn-matrix_v3
slevis-lmwg Jul 12, 2024
8e618bb
Add new test to build-namelist_test.pl (currently failing)
slevis-lmwg Jul 12, 2024
af11aaa
Remove new test from build-namelist_test.pl for now
slevis-lmwg Jul 15, 2024
aa923a4
Correct two test names in ExpectedTestFails.xml
slevis-lmwg Jul 16, 2024
ef970e2
Make hillslope_fsat_equals_zero .false. unless use_hillslope = .true.
slevis-lmwg Jul 16, 2024
3fe75fe
Merge tag 'ctsm5.2.012' into cn-matrix_v3
slevis-lmwg Jul 16, 2024
c031e1c
Update ntests in build-namelist_test.pl
slevis-lmwg Jul 18, 2024
98d0731
Merge remote-tracking branch 'escomp/master' into cn-matrix_v3
slevis-lmwg Jul 18, 2024
c2b6c43
Draft ChangeLog/ChangeSum
slevis-lmwg Jul 18, 2024
5aeb618
Update ChangeLog/ChangeSum
slevis-lmwg Jul 19, 2024
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
1 change: 1 addition & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@ d866510188d26d51bcd6d37239283db690af7e82
6fccf682eaf718615407d9bacdd3903b8786a03d
2500534eb0a83cc3aff94b30fb62e915054030bf
78d05967c2b027dc9776a884716597db6ef7f57c
47839a77229c61555e3b8932927bb54cdc511b27
190 changes: 172 additions & 18 deletions bld/CLMBuildNamelist.pm
Original file line number Diff line number Diff line change
Expand Up @@ -101,18 +101,22 @@ OPTIONS
(Only for CLM4.5/CLM5.0)
-[no-]chk_res Also check [do NOT check] to make sure the resolution and
land-mask is valid.
-clm_accelerated_spinup "on|off" Setup in a configuration to run as fast as possible for doing a throw-away
-clm_accelerated_spinup "on|sasu|off" Setup in a configuration to run as fast as possible for doing a throw-away
simulation in order to get the model to a spun-up state. So do things like
turn off expensive options and setup for a low level of history output.

If CLM4.5/CLM5.0 and bgc it also includes a prognostic Carbon model (cn or bgc)
, also by default turn on Accelerated Decomposition mode which
is controlled by the namelist variable spinup_state.
is controlled by the namelist variable spinup_state (when soil matrix CN is off).

Turn on given spinup mode for BGC setting of CN
Turn on given spinup mode for BGC setting of CN (soil matrix CN off)
on : Turn on Accelerated Decomposition (spinup_state = 1 or 2)
off : run in normal mode (spinup_state = 0)

To spinup using the CN soil matrix method use "sasu" SemiAnalytic Spin-Up (SASU)
sasu: Turn on matrix spinup (spinup_matrixcn=T)
Normal spinup sequence is: on, sasu, off

Default is set by clm_accelerated_spinup mode.

Spinup is now a two step procedure. First, run the model
Expand Down Expand Up @@ -894,6 +898,7 @@ sub setup_cmdl_bgc {
'phys'=>$nl_flags->{'phys'}, 'use_cn'=>$nl_flags->{'use_cn'}, 'use_fates'=>$nl_flags->{'use_fates'},
'use_fates_sp'=>$nl_flags->{'use_fates_sp'} );
my $soil_decomp_method = remove_leading_and_trailing_quotes( $nl->get_value( $var ) );
$nl_flags->{$var} = $soil_decomp_method;

if ( &value_is_true($nl_flags->{'use_cn'}) ) {
if ( $soil_decomp_method eq "None" ) {
Expand Down Expand Up @@ -952,6 +957,30 @@ sub setup_cmdl_bgc {
if ( (! &value_is_true($nl_flags->{'use_nitrif_denitrif'}) ) && &value_is_true($nl->get_value('use_fun')) ) {
$log->fatal_error("When FUN is on, use_nitrif_denitrif MUST also be on!");
}
#
# Make sure clm_accelerate_spinup is set correctly
#
$var = "clm_accelerated_spinup";
if ( $opts->{$var} ne "default" ) {
$val = $opts->{$var};
} else {
$val = $defaults->get_value($var);
}
$nl_flags->{$var} = $val;
# 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'},
, '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)) ) {
$nl_flags->{$var} = ".true.";
} else {
$nl_flags->{$var} = ".false.";
}
if ( &value_is_true($nl->get_value($var)) && $nl_flags->{'soil_decomp_method'} ne "CENTURYKoven2013" ) {
$log->fatal_error("$var can only be on with CENTURYKoven2013 soil decomposition");
}
} # end bgc


Expand Down Expand Up @@ -1156,32 +1185,40 @@ sub setup_cmdl_spinup {
my $val;
my $var;
$nl_flags->{'spinup'} = undef;
# clm_accelerated_spinup will already have been set in setup_cmdl_bgc
$var = "clm_accelerated_spinup";
if ( $opts->{$var} ne "default" ) {
$val = $opts->{$var};
} else {
$val = $defaults->get_value($var);
}
$nl_flags->{$var} = $val;
$val = $nl_flags->{'clm_accelerated_spinup'};
my $group = $definition->get_group_name($var);
$nl->set_variable_value($group, $var, quote_string($val) );
if ( ! $definition->is_valid_value( $var, $val , 'noquotes' => 1) ) {
my @valid_values = $definition->get_valid_values( $var );
$log->fatal_error("$var has an invalid value ($val). Valid values are: @valid_values");
}
if ( $nl_flags->{'clm_accelerated_spinup'} eq "sasu" ) {
if ( ! &value_is_true($nl_flags->{'use_cn'}) ) {
$log->fatal_error("If clm_accelerated_spinup is sasu, use_cn MUST be on" );
}
if ( ! &value_is_true($nl_flags->{'use_soil_matrixcn'}) ) {
$log->fatal_error("If clm_accelerated_spinup is sasu, use_soil_matrixcn MUST be on" );
}
}
$log->verbose_message("CLM accelerated spinup mode is $val");
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->{$var},
use_cn=>$nl_flags->{'use_cn'}, use_fates=>$nl_flags->{'use_fates'} );
$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_soil_matrixcn=>$nl_flags->{"use_soil_matrixcn"} );
if ( $nl->get_value("spinup_state") ne 0 ) {
$nl_flags->{'bgc_spinup'} = "on";
if ( &value_is_true($nl_flags->{'use_soil_matrixcn'}) ) {
$log->fatal_error("spinup_state is accelerated (=1 or 2), but use_soil_matrixcn is also true" .
", change one or the other");
}
if ( $nl_flags->{'clm_accelerated_spinup'} eq "off" ) {
$log->fatal_error("spinup_state is accelerated, but clm_accelerated_spinup is off, change one or the other");
}
} else {
$nl_flags->{'bgc_spinup'} = "off";
$val = $defaults->get_value($var);
}
# For AD spinup mode by default reseed dead plants
if ( $nl_flags->{$var} ne "off" ) {
Expand All @@ -1196,6 +1233,27 @@ sub setup_cmdl_spinup {
}
}
$nl_flags->{$var} = $val;
if ( &value_is_true($nl_flags->{'use_soil_matrixcn'}) ) {
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, "spinup_matrixcn",
, 'use_fates'=>$nl_flags->{'use_fates'}, 'bgc_mode'=>$nl_flags->{'bgc_mode'}
, 'phys'=>$nl_flags->{'phys'}, 'use_soil_matrixcn'=>$nl_flags->{'use_soil_matrixcn'},
, clm_accelerated_spinup=>$nl_flags->{'clm_accelerated_spinup'} );
my $spinup;
if ( &value_is_true($nl->get_value("spinup_matrixcn") ) ) {
$spinup = ".true.";
} else {
$spinup = ".false.";
}
$nl_flags->{'spinup_matrixcn'} = $spinup;
if ( &value_is_true($nl_flags->{'spinup_matrixcn'}) ) {
$nl_flags->{'bgc_spinup'} = "on";
if ( $nl_flags->{'clm_accelerated_spinup'} eq "off" ) {
$log->fatal_error("matrix spinup (spinup_matrixcn) is True, but clm_accelerated_spinup is off, change one or the other");
}
} else {
$nl_flags->{'bgc_spinup'} = "off";
}
}
my $group = $definition->get_group_name($var);
$nl->set_variable_value($group, $var, quote_string($val) );
if ( ! $definition->is_valid_value( $var, $val , 'noquotes' => 1) ) {
Expand All @@ -1205,11 +1263,13 @@ sub setup_cmdl_spinup {
if ( $nl_flags->{'bgc_spinup'} eq "on" && (not &value_is_true( $nl_flags->{'use_cn'} )) && (not &value_is_true($nl_flags->{'use_fates'})) ) {
$log->fatal_error("$var can not be '$nl_flags->{'bgc_spinup'}' if neither CN nor FATES is turned on (use_cn=$nl_flags->{'use_cn'}, use_fates=$nl_flags->{'use_fates'}).");
}
if ( $nl->get_value("spinup_state") eq 0 && $nl_flags->{'bgc_spinup'} eq "on" ) {
$log->fatal_error("Namelist spinup_state contradicts the command line option bgc_spinup" );
}
if ( $nl->get_value("spinup_state") eq 1 && $nl_flags->{'bgc_spinup'} eq "off" ) {
$log->fatal_error("Namelist spinup_state contradicts the command line option bgc_spinup" );
if ( ! &value_is_true($nl_flags->{'use_soil_matrixcn'}) ) {
if ( $nl->get_value("spinup_state") eq 0 && $nl_flags->{'bgc_spinup'} eq "on" ) {
$log->fatal_error("Namelist spinup_state contradicts the command line option bgc_spinup" );
}
if ( $nl->get_value("spinup_state") eq 1 && $nl_flags->{'bgc_spinup'} eq "off" ) {
$log->fatal_error("Namelist spinup_state contradicts the command line option bgc_spinup" );
}
}

$val = $nl_flags->{'bgc_spinup'};
Expand Down Expand Up @@ -1594,6 +1654,7 @@ sub process_namelist_inline_logic {
if ( remove_leading_and_trailing_quotes($nl_flags->{'clm_start_type'}) ne "branch" ) {
setup_logic_initial_conditions($opts, $nl_flags, $definition, $defaults, $nl, $physv);
}
setup_logic_cnmatrix($opts, $nl_flags, $definition, $defaults, $nl);
setup_logic_spinup($opts, $nl_flags, $definition, $defaults, $nl);
setup_logic_supplemental_nitrogen($opts, $nl_flags, $definition, $defaults, $nl);
setup_logic_snowpack($opts, $nl_flags, $definition, $defaults, $nl);
Expand Down Expand Up @@ -3074,7 +3135,7 @@ sub setup_logic_spinup {
if ( $nl_flags->{'bgc_mode'} eq "sp" && defined($nl->get_value('override_bgc_restart_mismatch_dump'))) {
$log->fatal_error("CN must be on if override_bgc_restart_mismatch_dump is set.");
}
if ( $nl_flags->{'clm_accelerated_spinup'} eq "on" ) {
if ( $nl_flags->{'clm_accelerated_spinup'} =~ /on|sasu/ ) {
foreach my $var ( "hist_nhtfrq", "hist_fincl1", "hist_empty_htapes", "hist_mfilt" ) {
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl,
$var, use_cn=>$nl_flags->{'use_cn'}, use_fates=>$nl_flags->{'use_fates'},
Expand Down Expand Up @@ -4499,6 +4560,99 @@ sub setup_logic_fates {
}
}


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

sub setup_logic_cnmatrix {
#
# Set some default options related to the CN Matrix options
#
my ($opts, $nl_flags, $definition, $defaults, $nl) = @_;

my @matrixlist = ( "use_matrixcn", "hist_wrt_matrixcn_diag" );
foreach my $var ( @matrixlist ) {
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var
, 'use_fates'=>$nl_flags->{'use_fates'}, 'bgc_mode'=>$nl_flags->{'bgc_mode'}
, 'phys'=>$nl_flags->{'phys'}, 'use_soil_matrixcn'=>$nl_flags->{'use_soil_matrixcn'},
, 'spinup_matrixcn'=>$nl_flags->{'spinup_matrixcn'}, 'clm_accelerated_spinup'=>$nl_flags->{'clm_accelerated_spinup'} );
}
@matrixlist = ( "use_matrixcn", "use_soil_matrixcn", "hist_wrt_matrixcn_diag", "spinup_matrixcn" );
# Matrix items can't be on for SP mode
if ( $nl_flags->{'bgc_mode'} eq "sp" ) {
foreach my $var ( @matrixlist ) {
if ( &value_is_true($nl->get_value($var)) ) {
$log->fatal_error("$var can NOT be on for SP mode" );
}
}
# Matrix items can't be on for FATES
} elsif ( $nl_flags->{'bgc_mode'} eq "fates" ) {
foreach my $var ( @matrixlist ) {
if ( &value_is_true($nl->get_value($var)) ) {
$log->fatal_error("$var can NOT be on with FATES" );
}
}
# Otherwise for CN or BGC mode
} else {
# TODO (slevis 2023/12/1) The next two if statements do nothing. Erik K and Sam L found that
# for_testing_use_second_grain_pool and for_testing_use_repr_structure_pool
# are empty rather than .true. or .false., but we did not get to the bottom
# of why, yet. The same error-check in the code does get triggered at run-time,
# so we will not pursue fixing this right now.
# If matrixcn is on, for_testing_use_second_grain_pool and for_testing_use_repr_structure_pool must be off
if ( &value_is_true($nl->get_value("use_matrixcn")) && &value_is_true($nl_flags->{"for_testing_use_second_grain_pool"}) ) {
$log->fatal_error("for_testing_use_second_grain_pool can NOT be on when use_matrixcn is on" );
}
if ( &value_is_true($nl->get_value("use_matrixcn")) && &value_is_true($nl_flags->{"for_testing_use_repr_structure_pool"}) ) {
$log->fatal_error("for_testing_use_repr_structure_pool can NOT be on when use_matrixcn is on" );
}
# If both matrixcn and soil_matrix are off outmatrix can't be on
if ( ! &value_is_true($nl->get_value("use_matrixcn")) && ! &value_is_true($nl_flags->{"use_soil_matrixcn"}) ) {
my $var = "hist_wrt_matrixcn_diag";
if ( &value_is_true($nl->get_value($var)) ) {
$log->fatal_error("$var can NOT be on when both use_matrixcn and use_soil_matrixcn are off" );
}
}
# If soil_matrix is off ispspinup can't be on
if ( ! &value_is_true($nl_flags->{"use_soil_matrixcn"}) ) {
my $var = "spinup_matrixcn";
if ( &value_is_true($nl->get_value($var)) ) {
$log->fatal_error("$var can NOT be on when use_soil_matrixcn is off" );
}
}
}
# if soil matrix is on and spinup is on, set spinup specific variables
my @spinup_vars = ( "nyr_forcing", "nyr_sasu", "iloop_avg" );
foreach my $var ( @spinup_vars ) {
if ( &value_is_true($nl_flags->{"use_soil_matrixcn"}) && &value_is_true($nl_flags->{'spinup_matrixcn'}) ) {
if ( $var ne "nyr_sasu" ) {
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var,
, 'phys'=>$nl_flags->{'phys'}, 'spinup_matrixcn'=>$nl_flags->{'spinup_matrixcn'} );
} else {
# Set SASU spinup period to nyr_forcing (slow mode) by default
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var,
, 'val'=>$nl->get_value("nyr_forcing") );
}
my $val = $nl->get_value($var);
if ( $val == -999 && ($var eq "iloop_avg") ) { next; } # iloop_avg can be special flag value
if ( $val < 1 ) {
$log->fatal_error("$var can NOT be negative or zero" );
}
} else {
my $val = $nl->get_value($var);
if ( defined($val) ) {
$log->fatal_error("$var can NOT be set when use_soil_matrixcn and isspsinup are off" );
}
}
}
if ( &value_is_true($nl_flags->{"use_soil_matrixcn"}) && &value_is_true($nl_flags->{'spinup_matrixcn'}) ) {
my $nyr_forcing = $nl->get_value('nyr_forcing');
my $nyr_sasu = $nl->get_value('nyr_sasu');
if ( $nyr_sasu > $nyr_forcing ) {
$log->fatal_error("nyr_sasu can NOT be greater than nyr_forcing" );
}
}
}

#-------------------------------------------------------------------------------
sub setup_logic_exice {
#
Expand Down
Loading
Loading