Add constituent tendency capability#584
Conversation
… constituent-tend
mwaxmonsky
left a comment
There was a problem hiding this comment.
Looks great so far @peverwhee! Still working through the details but just had a few preliminary questions/comments on the python side of things.
climbfuji
left a comment
There was a problem hiding this comment.
Thanks for this @peverwhee ! One or two most likely dumb questions, other than that looks fine with @mwaxmonsky's comments applied.
| else: | ||
| tend_dim = dim | ||
| # end if | ||
| if const_dimensions[index] == 'horizontal_loop_extent': |
There was a problem hiding this comment.
This adjustment for tendency/constituent vars is just for matching horizontal dimensions, correct?
There was a problem hiding this comment.
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
mkavulich
left a comment
There was a problem hiding this comment.
Some initial comments while I try to wrap my head around things.
Side note: the word "tendency" doesn't look real anymore.
| 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.
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
dustinswales
left a comment
There was a problem hiding this comment.
@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).
| # 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.
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.
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! |
climbfuji
left a comment
There was a problem hiding this comment.
Thanks for addressing my comments and those of @mwaxmonsky . Looks good to me now!
dustinswales
left a comment
There was a problem hiding this comment.
@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.
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.
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)? |
Tag name (required for main): Originator(s): peverwhee Summary (include the keyword ['closes', 'fixes', 'resolves'] and issue number): Brings in and enables new apply_constituent_tendencies scheme (from ESCOMP/atmospheric_physics#111) Describe any changes made to build system: Exclude constituent tendencies from required variables (now handled by the CCPP Framework in NCAR/ccpp-framework#584) Describe any changes made to the namelist: None List any changes to the defaults for the input datasets (e.g. boundary datasets): None List all files eliminated and why: None List all files added and what they do: None List all existing files that have been modified, and describe the changes: (Helpful git command: `git diff --name-status development...<your_branch_name>`) M .gitmodules - update CCPP-Framework and atmospheric_physics externals to point to updates for constituent tendencies M src/data/write_init_files.py - exclude constituent tendency variables (and array) from required variables list If there are new failures (compare to the existing-test-failures.txt file), have them OK'd by the gatekeeper, note them here, and add them to the file. If there are baseline differences, include the test and the reason for the diff. What is the nature of the change? Roundoff? derecho/intel/aux_sima: derecho/gnu/aux_sima: CAM-SIMA date used for the baseline comparison tests if different than latest: --------- Co-authored-by: Courtney Peverley <courtneyp@izumi.cgd.ucar.edu>
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