Skip to content

branch with 5.3.05Y: Make sure FORTRAN code properly aborts when fire-emission is asked for and it can't be provided #2844

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

Merged
merged 59 commits into from
Jun 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
13e5437
Add tests for fire_emis with SP bgc mode or BGC mode with nofire, the…
ekluzek Oct 3, 2024
36126dc
Make CLM_BLDNML_OPTS explicitly turn off drv_flds_in options off for …
ekluzek Oct 11, 2024
8653d35
Start adding a unit tests for CNFireFactory with just a single simple…
ekluzek Oct 23, 2024
b98fe8c
Start adding a unit tests for CNFireFactory with just a single simple…
ekluzek Oct 23, 2024
cfff96a
Merge remote-tracking branch 'escomp/cesm3_0_beta04_changes' into fir…
ekluzek Oct 23, 2024
69e1ccf
Merge remote-tracking branch 'escomp/cesm3_0_beta04_changes' into fir…
ekluzek Feb 6, 2025
2c330c0
Change to full ESMF library
ekluzek Feb 6, 2025
6d0f1e5
Add tests for each of the Li fire types
ekluzek Feb 7, 2025
3d81a1b
Add LAI stream to compile list
ekluzek Mar 4, 2025
9f7527e
Add check_dim_size
ekluzek Mar 4, 2025
e022783
Add FireClean method
ekluzek Mar 4, 2025
29b5b61
Make pointers set to NULL, and add BaseFireClean method
ekluzek Mar 4, 2025
61826eb
Add shr_expr and fire_emis to list
ekluzek Mar 4, 2025
de0c358
Add more setup and teardown, and also add several more tests, and inc…
ekluzek Mar 4, 2025
d4707b6
Initialize pointer to NULL, add clean method, add some returns after …
ekluzek Mar 4, 2025
fad3d1b
Add a note about the call to the base BaseFireClean method failing at…
ekluzek Mar 4, 2025
2fcc081
Get one of the failing tests working by implementing an init method t…
ekluzek Mar 5, 2025
39661d6
Get the last test working by aborting if fire-emissions are on in SP …
ekluzek Mar 5, 2025
ed88834
Add CNFireSetFireMethod for unit testing of the CNFireFactory, remove…
ekluzek Mar 5, 2025
570c5fe
Initialize fire_method to UNSET, so it will fail if it isn't set by s…
ekluzek Mar 6, 2025
6bcac0c
The unit testing actually doesn't need to call the fire_emis namelist…
ekluzek Mar 6, 2025
ad3d766
Add FATES Fire factory files to list
ekluzek Mar 6, 2025
4e36aa4
Add unit-tester for FATESFireFactory, two tests pass, two fail becaus…
ekluzek Mar 7, 2025
52c290a
Add unit-tester for FATESFireFactory, two tests pass, two fail becaus…
ekluzek Mar 7, 2025
a6fb39a
Get another test working, by checking that fire-emissions are off for…
ekluzek Mar 7, 2025
bbcc2a1
Merge tag 'ctsm5.3.030' into fire_emis
ekluzek Mar 7, 2025
99676ab
Don't allocate cnfire if NOT a BGC case
ekluzek Mar 10, 2025
bf6170e
Don't set stream types to NULL as they aren't pointers
ekluzek Mar 10, 2025
236a0a4
Make sure fire-emissions is off for FatesSp and FatesSt3 modes, which…
ekluzek Mar 11, 2025
14ad093
Add a fates_use_ed_st3 test and make sure it works
ekluzek Mar 11, 2025
1e5bfff
Get new namelist tests to work
ekluzek Mar 12, 2025
ae3fc28
Add failing test that both fates_sp and fates_st3 can be active at th…
ekluzek Mar 13, 2025
d7a23c7
Merge remote-tracking branch 'escomp/cesm3_0_beta04_changes' into fir…
ekluzek Mar 13, 2025
d0ba1ac
Change query of use_fates_sp to use nl_flags
ekluzek Mar 13, 2025
026d24f
Another update to use nl_flags query for use_fates_sp
ekluzek Mar 13, 2025
8caba7c
Don't allow both use_fates_sp and use_fates_ed_st3 to be on at the sa…
ekluzek Mar 13, 2025
e91f427
Add checking around if ESMF is already initialized or not, and add no…
ekluzek Mar 18, 2025
5c01edc
Refactor so FireInit doesn't include NLFilename or namelist reads, an…
ekluzek Mar 28, 2025
461887b
Add some documentation about how some tests are standalone, and one i…
ekluzek Mar 28, 2025
4bd0eb8
Remove namelist file as no longer needed
ekluzek Mar 31, 2025
23de87c
Improve the error message as noticed in the review
ekluzek Mar 31, 2025
cd7c8c9
Successful ignitions doesn't need to be specially handled
ekluzek Apr 11, 2025
658414b
Add a check to die when fire_emission and fates is on for now, the un…
ekluzek Apr 11, 2025
3669784
Get unit test working again
ekluzek Apr 14, 2025
178f164
Fix typo
ekluzek Apr 14, 2025
5905eba
Correct fire_emis option in CLM_BLD_NML_OPTS
ekluzek Apr 14, 2025
b4298e2
Fix fire initialization for full cases
ekluzek Apr 16, 2025
771652a
Put nofireemis first in the include file so that nofireemis is turned…
ekluzek Apr 17, 2025
2c22d92
Merge remote-tracking branch 'escomp/cesm3_0_beta04_changes' into fir…
ekluzek Apr 17, 2025
c8fb17f
Fix more Sp tests to have nofireemis
ekluzek Apr 18, 2025
dacf60b
Explicit check that use_cn is false so that drydepnomegan tests will …
ekluzek Apr 18, 2025
6fc87c7
Add nofireemis to two more ClmSp tests
ekluzek Apr 29, 2025
09c06a8
Fix a few more tests that need to use nofireemis
ekluzek May 9, 2025
a576300
Merge tag 'ctsm5.3.043' into fire_emis
ekluzek May 9, 2025
38798b0
Allocate cnfire_method for fates as nofire, because it's passed down …
ekluzek May 10, 2025
607b96b
Merge tag 'ctsm5.3.053' into fire_emis
ekluzek Jun 2, 2025
11f313d
Fix more tests with sp that need nofireemis
ekluzek Jun 14, 2025
f8ad8a1
Another nofireemis change
ekluzek Jun 14, 2025
99aed55
Merge branch 'cesm3_0_beta04_changes' into fire_emis
ekluzek Jun 14, 2025
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
59 changes: 36 additions & 23 deletions bld/CLMBuildNamelist.pm
Original file line number Diff line number Diff line change
Expand Up @@ -4071,7 +4071,16 @@ sub setup_logic_fire_emis {
if ( &value_is_true( $nl_flags->{'use_fates'} ) ) {
$log->warning("Fire emission option $var can NOT be on when FATES is also on.\n" .
" DON'T use the '--fire_emis' option when '--bgc fates' is activated");
}
} elsif ( ! &value_is_true( $nl_flags->{'use_cn'} ) ) {
$log->fatal_error("Fire emission option $var can NOT be on when BGC SP (i.e. Satellite Phenology) is also on.\n" .
" DON'T use the '--fire_emis' option when '--bgc sp' is activated");
} elsif ( &value_is_true( $nl_flags->{'use_cn'}) ) {
my $fire_method = remove_leading_and_trailing_quotes( $nl->get_value('fire_method') );
if ( $fire_method eq "nofire" ) {
$log->fatal_error("Fire emission option $var can NOT be on with BGC and fire_method=='nofire'.\n" .
" DON'T use the '--fire_emis' option when fire_method is nofire");
}
}
}
}
}
Expand Down Expand Up @@ -4235,7 +4244,7 @@ sub setup_logic_lai_streams {
if ( &value_is_true($nl_flags->{'use_crop'}) && &value_is_true($nl->get_value('use_lai_streams')) ) {
$log->fatal_error("turning use_lai_streams on is incompatable with use_crop set to true.");
}
if ( $nl_flags->{'bgc_mode'} eq "sp" || ($nl_flags->{'bgc_mode'} eq "fates" && &value_is_true($nl->get_value('use_fates_sp')) )) {
if ( $nl_flags->{'bgc_mode'} eq "sp" || ($nl_flags->{'bgc_mode'} eq "fates" && &value_is_true($nl_flags->{'use_fates_sp'}) )) {
if ( &value_is_true($nl->get_value('use_lai_streams')) ) {
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'use_lai_streams');
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'lai_mapalgo',
Expand Down Expand Up @@ -4745,29 +4754,26 @@ sub setup_logic_fates {
# For FATES SP mode make sure no-competetiion, and fixed-biogeography are also set
# And also check for other settings that can't be trigged on as well
#
my $var = "use_fates_sp";
if ( defined($nl->get_value($var)) ) {
if ( &value_is_true($nl->get_value($var)) ) {
my @list = ( "use_fates_nocomp", "use_fates_fixed_biogeog" );
foreach my $var ( @list ) {
if ( ! &value_is_true($nl->get_value($var)) ) {
$log->fatal_error("$var is required when FATES SP is on (use_fates_sp)" );
}
}
# spit-fire can't be on with FATES SP mode is active
if ( $nl->get_value('fates_spitfire_mode') > 0 ) {
$log->fatal_error('fates_spitfire_mode can NOT be set to greater than 0 when use_fates_sp is true');
}
if ( &value_is_true($nl_flags->{'use_fates_sp'}) ) {
my @list = ( "use_fates_nocomp", "use_fates_fixed_biogeog" );
foreach my $var ( @list ) {
if ( ! &value_is_true($nl->get_value($var)) ) {
$log->fatal_error("$var is required when FATES SP is on (use_fates_sp)" );
}
}
# spit-fire can't be on with FATES SP mode is active
if ( $nl->get_value('fates_spitfire_mode') > 0 ) {
$log->fatal_error('fates_spitfire_mode can NOT be set to greater than 0 when use_fates_sp is true');
}

# fates landuse can't be on with FATES SP mode is active
if ( &value_is_true($nl->get_value('use_fates_luh')) ) {
$log->fatal_error('use_fates_luh can NOT be true when use_fates_sp is true');
}
# fates landuse can't be on with FATES SP mode is active
if ( &value_is_true($nl->get_value('use_fates_luh')) ) {
$log->fatal_error('use_fates_luh can NOT be true when use_fates_sp is true');
}

# hydro isn't currently supported to work when FATES SP mode is active
if (&value_is_true( $nl->get_value('use_fates_planthydro') )) {
$log->fatal_error('fates sp mode is currently not supported to work with fates hydro');
}
# hydro isn't currently supported to work when FATES SP mode is active
if (&value_is_true( $nl->get_value('use_fates_planthydro') )) {
$log->fatal_error('fates sp mode is currently not supported to work with fates hydro');
}
}
my $var = "use_fates_inventory_init";
Expand All @@ -4792,6 +4798,13 @@ sub setup_logic_fates {
}
}
}
# Check that both FaTES-SP and FATES ST3 aren't both on
my $var = "use_fates_ed_st3";
if ( defined($nl->get_value($var)) ) {
if ( &value_is_true($nl->get_value($var)) && &value_is_true($nl_flags->{'use_fates_sp'}) ) {
$log->fatal_error("$var can NOT also be true with use_fates_sp true" );
}
}
# check that fates landuse change mode has the necessary luh2 landuse timeseries data
# and add the default if not defined. Do not add default if use_fates_potentialveg is true.
# If fixed biogeography is on, make sure that flandusepftdat is avilable.
Expand Down
22 changes: 17 additions & 5 deletions bld/unit_testers/build-namelist_test.pl
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,10 @@ sub cat_and_create_namelistinfile {
#
# Figure out number of tests that will run
#
my $ntests = 3276;
my $ntests = 3285;

if ( defined($opts{'compare'}) ) {
$ntests += 1987;
$ntests += 2161;
}
plan( tests=>$ntests );

Expand Down Expand Up @@ -288,7 +288,7 @@ sub cat_and_create_namelistinfile {
&make_config_cache($phys);
my @mfiles = ( "lnd_in", "drv_flds_in", $tempfile );
my $mfiles = NMLTest::CompFiles->new( $cwd, @mfiles );
foreach my $options ( "-drydep", "-megan", "-drydep -megan", "-fire_emis", "-drydep -megan -fire_emis" ) {
foreach my $options ( "-drydep --bgc sp", "-megan --bgc sp", "-drydep -megan --bgc bgc", "-fire_emis --bgc bgc", "-drydep -megan -fire_emis --bgc bgc" ) {
&make_env_run();
eval{ system( "$bldnml -envxml_dir . $options > $tempfile 2>&1 " ); };
is( $@, '', "options: $options" );
Expand Down Expand Up @@ -576,8 +576,8 @@ sub cat_and_create_namelistinfile {
"--res 1.9x2.5 --bgc bgc --use_case 1850-2100_SSP2-4.5_transient --namelist '&a start_ymd=19101023/'",
"-namelist \"&a dust_emis_method='Zender_2003', zender_soil_erod_source='lnd' /'\"",
"-bgc bgc -use_case 2000_control -namelist \"&a fire_method='nofire'/\" -crop",
"-res 0.9x1.25 -bgc sp -use_case 1850_noanthro_control -drydep -fire_emis",
"-res 0.9x1.25 -bgc bgc -use_case 1850_noanthro_control -drydep -fire_emis -light_res 360x720",
"-res 0.9x1.25 -bgc sp -use_case 1850_noanthro_control -drydep",
"-res 0.9x1.25 -bgc bgc -use_case 1850_noanthro_control -drydep -fire_emis -megan -light_res 360x720",
"--bgc bgc --light_res none --namelist \"&a fire_method='nofire'/\"",
"--bgc fates --light_res 360x720 --no-megan --namelist \"&a fates_spitfire_mode=2/\"",
"--bgc fates --light_res none --no-megan --namelist \"&a fates_spitfire_mode=1/\"",
Expand Down Expand Up @@ -1093,6 +1093,10 @@ sub cat_and_create_namelistinfile {
namelst=>"suplnitro='NONE'",
phys=>"clm6_0",
},
"FATESwBothSpST3" =>{ options=>"--bgc fates --envxml_dir . --no-megan",
namelst=>"use_fates_sp = TRUE, use_fates_ed_st3 = TRUE",
phys=>"clm6_0",
},
"FireNoneButBGCfireon" =>{ options=>"-bgc bgc -envxml_dir . -light_res none",
namelst=>"fire_method='li2021gswpfrc'",
phys=>"clm6_0",
Expand Down Expand Up @@ -1145,6 +1149,14 @@ sub cat_and_create_namelistinfile {
namelst=>"",
phys=>"clm4_5",
},
"useFIREEMISwithNOFIRE" =>{ options=>"--bgc bgc --envxml_dir . --fire_emis",
namelst=>"fire_method='nofire'",
phys=>"clm6_0",
},
"useFIREEMISwithSP" =>{ options=>"--bgc sp --envxml_dir . --fire_emis",
namelst=>"",
phys=>"clm6_0",
},
"useDRYDEPwithFATES" =>{ options=>"--bgc fates --envxml_dir . --no-megan --drydep",
namelst=>"",
phys=>"clm4_5",
Expand Down
24 changes: 18 additions & 6 deletions cime_config/config_component.xml
Original file line number Diff line number Diff line change
Expand Up @@ -241,12 +241,24 @@
<type>char</type>
<default_value></default_value>
<values>
<!--- All versions -->
<value compset="_CLM[^_]*%SP" >-bgc sp</value>
<value compset="_CLM[^_]*BGC" >-bgc bgc</value>
<value compset="_CLM[^_]*BGC-CROP" >-bgc bgc -crop</value>
<value compset="_CLM[^_]*FATES" >-bgc fates -no-megan</value>
<value compset="_CLM[^_]*FATES-SP" >-bgc fates -no-megan</value>
<!--- All versions with DATM -->
<value compset="DATM[^_]*_CLM[^_]*%SP" >-bgc sp</value>
<value compset="DATM[^_]*_CLM[^_]*BGC" >-bgc bgc</value>
<value compset="DATM[^_]*_CLM[^_]*BGC-CROP" >-bgc bgc -crop</value>

<!-- FATES currently can't use MEGAN, drydep, or fire-emission whether coupled to CAM or NOT-->
<value compset="CLM[^_]*FATES" >--bgc fates --no-megan --no-drydep --no-fire_emis</value>

<!-- ======================================= Coupled to CAM Options ======================================
All versions with CAM - turn off sending test drv_flds_in namelists from CTSM

When coupled to CAM - expect CAM to determine these drv_flds settings
See issue #2713 for more information on this.
-->
<value compset="CAM[^_]*_CLM[^_]*%SP" >--bgc sp --no-megan --no-drydep --no-fire_emis</value>
<value compset="CAM[^_]*_CLM[^_]*BGC" >--bgc bgc --no-megan --no-drydep --no-fire_emis</value>
<value compset="CAM[^_]*_CLM[^_]*BGC-CROP" >--bgc bgc --crop --no-megan --no-drydep --no-fire_emis</value>
<!-- ======================================= End of Coupled to CAM Options =============================== -->

<!-- Options specific for CLM4.5 -->
<value compset="_CLM45%[^_]*BGCDV" >-bgc bgc -dynamic_vegetation</value>
Expand Down
Loading