Fix crash in physics_check_data when registry variable has initial_value but not read from file, yet is modified (intent out) from physics scheme #422
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Phew, that is a long title!
Tag name (required for release branches):
Originator(s): @jimmielin
Description (include the issue title, and the keyword ['closes', 'fixes', 'resolves'] followed by the issue number):
This is a proposed fix for a corner case where a variable is introduced into the CAM registry that has an initial_value but never read from file, as well as having an intent(out) or intent(inout) from a physics scheme.
Such a case might happen because a variable might only be set in a scheme's "init" phase, yet used for "run" phases, and thus necessitates its introduction into the registry to persist state across timesteps. However, because this variable needs to be set in the scheme's "init" phase (and thus has intent(out)) it triggers the physics data check routine.
The physics_check_data select case uses the find_input_name_idx to retrieve the name_idx, which is then used to get the actual input name, via phys_var_stdnames(name_idx); however, if a variable is intent(out) yet never read from file, find_input_name_idx in physics_data.F90 returns init_mark_idx = -2, which is out of bounds for phys_var_stdnames, and yet not covered by the guard case statements in the select case in physics_check_data; this commit adds the guard case for init_mark_idx with a comment to denote the corner case's triggering conditions.
Describe any changes made to build system: updates
write_init_files.py
which handles code generation forphysics_inputs.F90
.To replicate
hplin/gw_drag
@2cfe2971b05dcbe81fca4b1157a5ca8c408e7f81
.gitmodules
to use jimmielin/atmospheric_physics atb2eabf666d6b06e63e59a429e6a4b5bcc32bfcd7
for ncar-physics external--compiler gnu --run-unsupported --compset FPHYStest --res ne3pg3_ne3pg3_mg37
; select physics suite./xmlchange CAM_CONFIG_OPTS="--physics-suites gw_cam4 --dyn none"
user_nl_cam
observe crash at end of first timestep where physics check data normally runs.
Describe any changes made to the namelist: N/A
List any changes to the defaults for the input datasets (e.g. boundary datasets): N/A
List all files eliminated and why: N/A
List all files added and what they do: N/A
List all existing files that have been modified, and describe the changes:
(Helpful git command:
git diff --name-status development...<your_branch_name>
)If there are new failures (compared to the
test/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?
All B4B