-
Notifications
You must be signed in to change notification settings - Fork 340
Add default handling for fates firemodes in lightning resolution #3606
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
base: b4b-dev
Are you sure you want to change the base?
Conversation
ekluzek
left a comment
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 really glad you noticed this and figured out a solution! Thanks for making this PR so we can fix this.
I have a couple small things I'd like to see us improve on. I'm suggesting I do those and then have you review and approve the changes. Let me know if that sounds like a reasonable process to you.
| if ( &value_is_true($nl->get_value('use_cn')) ) { | ||
| add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'fire_method'); | ||
| } | ||
|
|
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 think it makes sense for this to go here. But, I also think that the call to setup_logic_fates could be moved in front of this as an alternative way to do it. Since, the lightning resolution for fire is now used for both BGC and FATES I think we should add more comments to the header about this being the case. This was originally designed as only being for BGC and not FATES. So it would be good to clarify that in the header and some of the comments in the code.
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 was thinking the order could be changed, but fates_spitfire_mode isn't set until much later. So I don't see a way to merely change the order of the calls to make this work. You might have already tested that as the easiest solution.
In any case since both FATES and BGC need to determine the lightning resolution, they both need to be taken into account here so this change makes sense.
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.
The other thing I realized is that to protect against reordering going wrong -- we can add some assert statements to the subroutines to ensure the needed things are appropriately set. It would be simple to add a few statements to start doing that.
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.
So @mvdebolskiy there's a couple small things that I can see doing that would be good to bring in with this. I suggest the way forward, would be for me to push to your branch -- but have you look over my changes at the end and make sure you approve. I could also give you some instructions and have you implement it -- and then go back and forth to get it right. But, I think it would be easier to have me do those couple things here. So how does that sound for process?
|
@ekluzek you can push into here, it's totaly fine. I've added checks for vars not being defined yet, before reading in defaults. |
|
|
||
| # we have to process defaults for fates fire modes before and not in setup_logc_fates, however, they should not be defined for use_cn or other bgc | ||
| if ( &value_is_true($nl->get_value('use_fates')) ) { | ||
| if ( ! defined($nl->get_value('use_fates_managed_fire')) ) { |
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.
This line here and in 1037 can be removed.
Description of changes
Make
CLMBuildNamelist.pmread defaults forfates_spitfire_modeanduse_fates_managed_firebefore they are first used insetup_cmdl_fire_light_res.Right now, changing defaults in
namelist_defaults_ctsm.xmlwill result in incorrect lightning streams namelists iffates_spitfire_mode>2. Right now we do not have these values by defaults +Fatestestmod explicitly setsfates_spitfire_mode=1in theuser_nl_clm.Specific notes
This is not necessarily needed right now (since we are not updating defaults here), however, if in the future, running fates_spitfire_mode with lightning data will become default (hopefully), without this PR, changing defaults will be useless.
Contributors other than yourself, if any:
@rosiealice @JessicaNeedham @maritsandstad @kjetilaas
CTSM Issues Fixed (include github issue #):
Are answers expected to change (and if so in what way)?
No
Any User Interface Changes (namelist or namelist defaults changes)?
No
Does this create a need to change or add documentation? Did you do so?
No
Testing performed, if any:
Since to test this, one needs to change
namelist_defaults_ctsm.xmlandFatestestmod, there is a branch: https://github.com/mvdebolskiy/CTSM/tree/spit-ligh-testTested namelist building with this branch by making baselines first with
ctsm5.3.084:Then checking out testing branch and:
The results:
Expected NLFAIL:
Which means, setting fates_spitfire_mode=4 in defaults for fates makes light_streams namelist to get populated.