-
Notifications
You must be signed in to change notification settings - Fork 64
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
Add constituent tendency capability #584
Conversation
… constituent-tend
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.
Looks great so far @peverwhee! Still working through the details but just had a few preliminary questions/comments on the python side of things.
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.
Thanks for this @peverwhee ! One or two most likely dumb questions, other than that looks fine with @mwaxmonsky's comments applied.
scripts/host_cap.py
Outdated
else: | ||
tend_dim = dim | ||
# end if | ||
if const_dimensions[index] == 'horizontal_loop_extent': |
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 adjustment for tendency/constituent vars is just for matching horizontal dimensions, correct?
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.
yep! not a permanent change, just a way to make sure that the dimensions match between the tendency variable and the corresponding constituent "state" variable
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.
Some initial comments while I try to wrap my head around things.
Side note: the word "tendency" doesn't look real anymore.
scripts/host_cap.py
Outdated
const_kind = const_var.get_prop_value('kind') | ||
if tend_stdname_split == const_stdname: | ||
# We found a match! Check units | ||
if tend_units.split('s-1')[0].strip() != const_units: |
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 assumes that s-1
is always at the end. But it is entirely valid (from a math standpoint) to write kg s-1 m-2
instead of kg m-2 s-1
. And it's of course also valid to write m s-2
for a tendency of the constituent had m s-1
...
Probably not an issue, but we should document this in the updated (!) CCPP technical documentation
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.
@peverwhee I think this is fine.
I do have a question about extending some existing code rather than adding your own routine (See inline comments).
scripts/host_cap.py
Outdated
# end if | ||
# end for | ||
# end for | ||
# Check that all tendency variables are valid | ||
errmsg, errflg = check_tendency_variables(tend_vars, const_vars) |
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.
Most of this code/logic in check_tendency_variables already exists in the the VarCompatObj (and here).
Could the ability to check for "compatibility between any variable, not just a const variable, and its tendency" be folded into there? (This would make it more useable if someone wanted to do something similar with "state_variables" in the _pre/_post scheme calls.)
I'd be happy to help.
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 took a stab at modifying compatible
to validate tendencies. Let me know what you think!
@peverwhee Please re-request a review from all the reviewers once you've addressed the questions/concerns from @mwaxmonsky and @dustinswales (I keep coming back to re-review but then remind myself that there are still comments that need to be addressed). Thank you! |
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.
Thanks for addressing my comments and those of @mwaxmonsky . Looks good to me now!
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.
@peverwhee These changes look awesome!
I'm glad to see that the compatibility object was able to handle the logic w/o many modifications.
if var1_stdname != var2_stdname: | ||
# If it's a tendency variable, it's assumed the standard name is of the | ||
# form "tendency_of_var2_stdname" | ||
if not is_tend and var1_stdname != var2_stdname: |
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.
Should we add a check that starts with tendency_
when is_tend=True
? Or is this handled somewhere else? If redundant, ignore.
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 call! as it's currently used, it's only called when a variable starts with "tendency_of" but I added the check to prevent future (by me) implementation issues!
@peverwhee Can you please update the branch from develop? There are merge conflicts that need to be resolved. Thanks! |
@DomHeinzeller done! I think I'll give @gold2718 a bit more time if he'd still like to review this before merging. Say, by next wednesday (11/6)? |
Summary
Adds constituent tendency array and enables the use of individual constituent tendency variables.
Description
In order to facilitate time-splitting, this PR adds/enables the following:
User interface changes?: Yes, but optional
User can now use the following in scheme metadata:
ccpp_constituent_tendencies
(standard name for the array of constituent tendencies)tendency_of_CONSTITUENT
(tendency array for a specific constituent)constituent = True
(specifies variable will be handled by constituents object)Testing:
test removed: None
unit tests: Added doctests to new check_tendency_variables function in host_cap.F90
system tests: Modified advection_test to use tendency variable and tendency array
manual testing: Updates run in CAM-SIMA