-
Notifications
You must be signed in to change notification settings - Fork 317
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
Extend CNFireMethodMod with a FATESFireData class #991
Extend CNFireMethodMod with a FATESFireData class #991
Conversation
Following @ekluzek's recommendations in ESCOMP#982. Purpose: Allow FATES access to CTSM's infrastructure that reads lightning and human population data sets for use in SPITFIRE.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@slevisconsulting there's a little bit of misunderstanding about the object oriented class structure here. I gave some guidance, but we should probably go through this again after you've gone through it. But, it does look close!
src/main/clm_initializeMod.F90
Outdated
@@ -606,6 +614,14 @@ subroutine initialize2( ) | |||
call crop_inst%initAccVars(bounds_proc) | |||
end if | |||
|
|||
! use_fates_spitfire is assigned an integer value in the namelist | |||
! see bld/namelist_files/namelist_definition_clm4_5.xml for details | |||
if (use_fates_spitfire > 1) then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just call the generic one rather than the specific one
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment.
@ekluzek pls see my responses and revisions. If I am on the wrong track, let's definitely have a meeting. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated my comments and responded to your questions...
@slevisconsulting so Init2 and InterpFileInputs should go into clmfates_interface, rather than to the extensions of the Fire classes for FATES. I think it will help to have the general conversation about the Fire class methods and the refactoring I'm proposing to make sure you are clear on some of the OO concepts being used here. So I think we should plan on that before you proceed forward. We can make sure we talk about what I specifically plan on doing, as well as what you need to do here. I think most of the conversations can be resolved now. So I'll go through and make sure I do that. There are only a couple that will be outstanding. Once we go through there will only be a couple last changes to make. |
Removed from FATESFire[No]DataMod. Added to clmfates_interfaceMod. Updated calls in clm_driver and clm_initialize.
...since FATES only needs lightning for now.
I am seeing changes that are needed now that I'm looking directly at the code. There's a couple ways to proceed. I can figure out the changes and post the diff needed, or I could try to explain inline in github, or. I could submit a PR to your branch, or lastly if you authorize me -- I can push directly to your branch. Which of those sound like the best solution? |
I think simplest for me would be to authorize you to push directly to my branch. How do I do that? |
Go to your fork to CTSM on github. Go to settings tab on the right top, and then "manage access" option on the left down one. Then you can add me as a collaborator. At some point it asks you to enter your password. It'll send me an email and then I just need to accept it. I've done this with several people and it makes it a little easier to work on the same code together. Sometimes if there's something more extensive I'll still do a Pull Request, to their branch, so they can code review it beforehand. But, here we are talking about small changes. So I'll get it working for a simple case and then push my commits to your branch. I'll try to explain as well as I can in the commit notes. Thanks. |
Ok, you should get a email. Thanks @ekluzek |
…terface These are the changes that I see that are needed to keep fates_fire_data_method local to clmfates_interface. Whenever fates_fire_data is accessed it has to be done through clmfates_interface, because that's the object that contains it and has it instantiated. We also will want it to be private to clmfates_interface, so it can't be accessed or changed outside of there. There were some stubs here to pass specific instances of the class types before, but they weren't completed. So those are all removed and the generic method is being accessed so that you don't have to know which specific instance is being used. Testing: I haven't tested it yet. But, will before pushing
Testing with ./create_test ERS_D_Lm36.1x1_brazil.I2000Clm50FatesCruGs.cheyenne_intel.clm-Fates_nat_and_anthro_ignitions
@@ -945,18 +945,12 @@ sub setup_cmdl_fire_light_res { | |||
} | |||
if ( defined($fire_method) && $fire_method eq "nofire" ) { | |||
$nl_flags->{$var} = ".false."; | |||
} elsif ( &value_is_true($nl->get_value('use_cn')) ) { | |||
# } elsif ( &value_is_true($nl->get_value('use_cn')) || $nl_flags->{'fates_spitfire_mode'} > 1 ) { | |||
} elsif ( &value_is_true($nl->get_value('use_cn')) || &value_is_true($nl->get_value('use_fates')) ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New line 949 works
} elsif ( &value_is_true($nl->get_value('use_cn')) || &value_is_true($nl->get_value('use_fates')) ) {
However, I wish the commented-out line above it would work because it would narrow things down, but it doesn't work. The run proceeds to the next else and sets cnfireson = .false.
.
@ekluzek do you see an obvious problem with new line 948?
FATES testing passes except for the restart test that was already failing as reported in #667 . This PR is now ready for review again: |
@slevisconsulting yes, ideally the reviews would be completed before the rebase so as to bring in the a consistent set of code that includes review change requests. That said, if there are non-critical change requests that could be brought in later without much hassle and tests are all passing, I'm inclined to rebase this sooner rather that later. Can you point me to the test directory on cheyenne for confirmation, please? |
You prob. already know this: While Cheyenne is down, you can access the same directory from Casper: Note that this test |
I didn't know that; thanks for the tip! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@slevisconsulting I added a few comments and questions.
@@ -822,7 +822,7 @@ sub make_env_run { | |||
conopts=>"-phys clm4_0", | |||
}, | |||
"usespitfireButNOTFATES" =>{ options=>"-envxml_dir . -no-megan", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this allow use spitfire without FATES? The name suggests that to me...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jkshuman this belongs to a list of options that trigger namelist FAILs. The specific one triggers a failure if fates_spitfire_mode > 0
and -bgc has not been set to fates.
cime_config/testdefs/testmods_dirs/clm/Fates_nat_and_anthro_ignitions/README
Outdated
Show resolved
Hide resolved
@@ -474,6 +474,12 @@ subroutine initialize2( ) | |||
end if | |||
else | |||
call SatellitePhenologyInit(bounds_proc) | |||
|
|||
! fates_spitfire_mode is assigned an integer value in the namelist | |||
! see bld/namelist_files/namelist_definition_clm4_5.xml for details |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
! see bld/namelist_files/namelist_definition_clm4_5.xml for details | |
! see bld/namelist_files/namelist_definition_clm4_5.xml for details | |
! ignitions: 1=constant, 2=lightning, 3=obs, 4=lightning & anthro |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm leaning against this one because it introduces the risk of being missed in a future update of fates_spitfire_mode
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Though I see the benefit of including some explanation of the > 1
and maybe the naming of these various modes (that I introduced elsewhere) needs to be used here, as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
valid point, though it may be worth a quick explanation in more than 1 central location
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I replaced the > 1
with > scalar_lightning
in the latest commit.
src/main/clm_varctl.F90
Outdated
@@ -207,7 +207,7 @@ module clm_varctl | |||
integer, public :: fates_parteh_mode = -9 ! 1 => carbon only | |||
! 2 => C+N+P (not enabled yet) | |||
! no others enabled | |||
logical, public :: use_fates_spitfire = .false. ! true => use spitfire model | |||
integer, public :: fates_spitfire_mode = 0 ! > 0 => use spitfire model: see bld/namelist_files/namelist_definition_clm4_5.xml for details |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
integer, public :: fates_spitfire_mode = 0 ! > 0 => use spitfire model: see bld/namelist_files/namelist_definition_clm4_5.xml for details | |
integer, public :: fates_spitfire_mode = 0 ! > 0 => use spitfire model: ignitions: 1=constant, 2=lightning, 3=obs, 4=lightning & anthro |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as my most recent comment:
Name the various modes in a central location and then use them in all cases like this instead of hardwiring.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I completed this in the current PR's latest commit and in NGEET/fates#635.
The model builds, but I get a runtime system error in my cesm.log that looks like a problem leftover from cheyenne's downtime. What do you suggest @ekluzek :
dplace failed. Verify that the numatools module is loaded.
MPT ERROR: could not run executable (case #1)
(HPE MPT 2.19 02/23/19 05:31:12)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good news:
Whatever this was, it's been fixed, and my test now runs :-)
@glemieux I should have pointed out that today specifically Casper will also be down. Sorry for not mentioning sooner... |
Clearer documentation suggested by @jkshuman. Co-authored-by: jkshuman <[email protected]>
…nitions/README Clearer documentation suggestion by @jkshuman. Co-authored-by: jkshuman <[email protected]>
Clearer comment. Co-authored-by: jkshuman <[email protected]>
Comment clarification. Co-authored-by: jkshuman <[email protected]>
@glemieux you may have seen that I made some minor revisions in response to @jkshuman 's review. I have a few more to make once cheyenne comes up. I just want to make sure that you will let me know when I should stop further modifications to avoid conflicts with your re-basing. |
Thanks for the heads up @slevisconsulting |
Updating externals_clm configuration to new tag
Description of changes
Allow FATES access to CTSM's infrastructure that reads lightning and
human population data sets for use in SPITFIRE.
Following @ekluzek's detailed recommendations in #982 #983 .
Specific notes
Contributors other than yourself, if any:
@ekluzek @rgknox @ckoven @lmkueppers @jkshuman
CTSM Issues Fixed (include github issue #):
#982 #983
Also relates directly to issue NGEET/fates#562
and to pull request NGEET/fates#635
Are answers expected to change (and if so in what way)?
Not in non-FATES simulations.
Not in FATES simulations using
use_fates_spitfire < 2
Yes in FATES simulations using
use_fates_spitfire >= 2
Any User Interface Changes (namelist or namelist defaults changes)?
Changing
use_fates_spitfire
from logical to integer with valid values of:0 for no fire
1 for spitfire with default lightning constant
2 for spitfire with Li et al lightning data
3 for spitfire with successful ignitions data
as recommended by @rgknox here
Testing performed, if any:
Code builds. No further testing, yet.