Conversation
Allow schema file to be passed to validate Add Fortran comment write method Add metadata table type and name to CCPP datatable variable entries Improve generated constituent-handling code Fix issues with output of long comments Ensure more instance variables are 'private' Have capgen create database object Add line fill (target line length) interface to FortranWriter New Fortran interface, indent_size New Fortran interface, blank_line Added insert function for verbatim copy to file Allow arbitrary break for long lines Make sure call list variables have an intent Added link to constituent dictionary Add metadata to CCPP constituent object DDT Add Fortran writing unit tests and fix line break bugs Added constituent props array host interface, improved unit conversion error Use +ELLIPSIS instead of +IGNORE_EXCEPTION_DETAILS for doctests Constituent cleanup, no function side effects in interface Completed and optimized constituent accessor routines Added minimum allowed value property
Add molecular weight as variable and constituent property Fix missing property (advected) from database
…ariable in hash_table
Rename dir for var_action test to distinguish from ct_build
…d variable arrays
climbfuji
left a comment
There was a problem hiding this comment.
Thanks for addressing my comments. This is a non-expert approval which on its own is not sufficient for merging ;-)
dustinswales
left a comment
There was a problem hiding this comment.
@peverwhee Some minor comments, but overall looks good. Thanks for these changes!
I will start testing in the UFS using this branch and push to get on the commit queue asap.
| cap.write(f"integer{spc} :: num_dyn_consts", 2) | ||
| cap.write(f"integer{spc} :: index, index_start", 2) | ||
| cap.write(f"integer{spc} :: field_ind", 2) | ||
| cap.write(f"type({CONST_PROP_TYPE}), pointer :: const_prop", 2) |
There was a problem hiding this comment.
Should this be cap.write(f"type({CONST_PROP_TYPE}), pointer :: const_prop => null()", 2)
| cprop => this%find_const(standard_name) | ||
| if (associated(cprop)) then | ||
| ! Standard name already in table, let's see if the existing constituent is the same | ||
| cindex = cprop%const_index() |
| errflg = 0 | ||
| end if | ||
| ! Check moist mixing ratio for a dynamic constituent | ||
| call const_props(index_dyn2)%is_dry(const_log, errflg, errmsg) |
There was a problem hiding this comment.
Should this be calling "is_moist"?
There was a problem hiding this comment.
added another testing code block to confirm that is_moist returns true (but keeping the test of is_dry() returning false)
There was a problem hiding this comment.
@peverwhee Thanks for addressing my comments. Looks good!
(Running the UFS tests now, and will open PRs)
|
@gold2718 @mwaxmonsky Would you like to re-review before merging this? |
mwaxmonsky
left a comment
There was a problem hiding this comment.
Apologies for the delay, looks good to me!
Sorry, can I have today? |
Sure. We're trying to attach this to a set of UFS PRs that are on a queue to be final tested/merged early next week. If we can get final approval this week, it should be fine. |
| cap.write("end if", 3) | ||
| cap.write("end do", 2) | ||
| # end if | ||
|
|
There was a problem hiding this comment.
Why not deallocate dyn_const_name here? It does not seem to have any other uses and I do not see any call to {host_model.name}_ccpp_deallocate_dynamic_constituents.
There was a problem hiding this comment.
we can't deallocate {dyn_const_name} here because that's the module-level variable that holds the data for the dynamic constituents; deallocating it would mean you could no longer access those constituent properties
| cap.write(f"do index = 1, size(dyn_const_prop_{idx}, 1)", 2) | ||
| cap.write(f"{dyn_const_name}(index + index_start) = dyn_const_prop_{idx}(index)", 3) | ||
| cap.write("end do", 2) | ||
| cap.write(f"index_start = size(dyn_const_prop_{idx}, 1)", 2) |
There was a problem hiding this comment.
I see how this works if there are two entries in dyn_const_dict but what about 3? Shouldn't this be:
| cap.write(f"index_start = size(dyn_const_prop_{idx}, 1)", 2) | |
| cap.write(f"index_start = index_start + size(dyn_const_prop_{idx}, 1)", 2) |
There was a problem hiding this comment.
yes good point! fixed
gold2718
left a comment
There was a problem hiding this comment.
I'm still not sure I have covered all the corner cases (a simpler implementation would be easy to verify), but I have not found any more definite problems.
Summary
Brings in optional metadata field to enable dynamic (run-time) constituents; also brings in a couple new methods for the constituent object.
closes #557
Description
Key dynamic constituent mods:
Includes additional constituent object methods:
Includes fixes to ensure consistent order of generated code (use statements, variables, etc)
Also brings back the .github/workflow/python.yaml workflow that got lost somehow
User interface changes?: Yes, but optional
User can now use "dynamic_constituent_routine" metadata header field to point to a function contained within the module fortran.
Testing:
Modified advection test to include dynamic constituent routines.
Added doctests to ccpp_datafile
Generated code snippet