Sync from NCAR/main + Thompson params#309
Conversation
the end of subroutines, remove duplicate print statements
statements. More cleanup
"can not" to cannot.
errflg directly. On branch return-on-error
…k that w3emc is using the expected precision
…k that w3emc is using the expected precision
UFS-dev PR#195
Co-authored-by: Dom Heinzeller <dom.heinzeller@icloud.com>
Co-authored-by: Dom Heinzeller <dom.heinzeller@icloud.com>
Co-authored-by: Dom Heinzeller <dom.heinzeller@icloud.com>
…ue 1155 for details Co-authored-by: MicroTed <37668594+MicroTed@users.noreply.github.com>
…997_A-SCM_WoFS_v0-CI bugfix: NaNs in module_mp_nssl_2mom.F90
UFS-dev PR#253
UFS-dev PR#302
|
|
||
| if (present(con_nt_c_l)) nt_c_l = con_nt_c_l | ||
| if (present(con_nt_c_o)) nt_c_o = con_nt_c_o | ||
| if (present(con_av_i)) then |
There was a problem hiding this comment.
Where is this con_av_i defined, in GFS_typedefs.F90? Is it initialized as 0 ?
There was a problem hiding this comment.
Ruiyu,
Since it is an optional, It is used only when larger than 0. However, I think it is not used at this moment.
There was a problem hiding this comment.
@RuiyuSun It is passed in as an optional argument. It is defined in GFS_typedefs as -999 and is set by namelist, although no namelists are set up to change it. For all UFS configurations, right now, con_av_i is present, but less than 0, so the functional form is used below. For NEPTUNE, they will pass in a value > 0 and therefore, it can be used as a constant, which is what they need. A couple of commits back, I tried to just have it as an optional argument without defining it in GFS_typedefs.F90, but apparently, the CCPP framework won't allow this, hence the need to define it, but set it as a nonsense/negative value.
There was a problem hiding this comment.
@dustinswales @climbfuji Optional argument experts: is it correct to say that for variables that are optional at the scheme level at least need to be declared and have metadata in every host? For example, I originally had the av_i argument in this PR as an optional argument with metadata in Thompson MP, but since I knew that UFS-based hosts wouldn't need it, I didn't even add a declaration or metadata in *_typedefs. The CCPP framework errored out because it expected the host to at least have these for cross-checking. Should the framework be able to skip these variables (that are optional in the scheme but not present in the host)?
There was a problem hiding this comment.
See d856677 for how I originally coded it.
There was a problem hiding this comment.
That's an interesting question. I agree that the idea of "if it's an optional argument and the host doesn't know, then simply don't provide it - i.e. never present" sounds good. One question would then be if that opens the door to unintended errors. But we need to first remind ourselves what capgen does in this case. Does it create the optional variable? Or does it ignore optional variables when it generates interstitial variables in the caps? @dustinswales do you know?
There was a problem hiding this comment.
Does anyone knows the answer to @climbfuji's question? @dustinswales Do you know? thanks
There was a problem hiding this comment.
In any case, I don't think that this should hold up this PR since it works as coded, although we're having to define something in the UFS that it will likely never use, which is wasteful. In this case, it's just a scalar, but one could imagine that this could be a larger issue if schemes needed large optional arrays, but in that case, we'd just make them conditionally-allocatable with a condition that always evaluates to false, so no extra memory involved, just kinda unnecessary code.
AnningCheng-NOAA
left a comment
There was a problem hiding this comment.
looks fine with me
|
Combined #321 into this one. |
|
Testing for #2882 is complete, please continue with the merge process, thank you. |
…25_09_04 Sync from NCAR/main + Thompson params
Description of Changes:
Changes from:
The issue: Some subroutines do not have return statements after an error occurs. Instead two variables errflg and errmsg are reset or re-initialized in subsequent calls, and if an error occurs it is not captured and the program continues without stopping. Please note that some calls already have if(errflg/=0) return in place.
This PR fixes an issue to return right after an error occurs. Subroutines that use errflg and errmsg should be checked for errflg and abort if necessary. Insert if(errflg/=0) return after such calls.
In addition the following is added:
Remove unnecessary return statements at the end of subroutines. In one case, there were actually two return statements right after each other.
Improve error messages and remove duplicate print statements if they are the same as the errmsg.
Change “can not” to “cannot” and other minor additions.
UPDATE: Thanks to reviewers' feedback, this PR also includes cleanup of GFS_phys_time_vary.fv3.F90 to remove copy_error calls from one-thread region (accessing errmsg and errflg directly).
NCAR#1152 description (issue):
The way w3emc is used in GFS_time_vary_pre is not safe, since there is no protection against argument mismatches in case the wrong version of the library (e.g., _4 instead of _d) is used. This came up during the debugging of a w3emc build issue with Intel oneAPI ifx.
A detailed description can be found here: JCSDA/spack-stack#1716
The issue also provides a code snippet that protects against using a wrong kind for the integer and real arguments in the w3difdat routines.
reviewer changes from UFS-dev PR#253 NCAR/ccpp-physics#1154 (parameterized types in canopy_utils_mod)
reviewer changes from UFS-dev PR#195 NCAR/ccpp-physics#1153 (remove dependence on MPI in mp_tempo_post, other minor naming changes)
bugfix for NSSL MP: bugfix: NaNs in module_mp_nssl_2mom.F90 NCAR/ccpp-physics#1157
Make some Thompson MP tuning parameters visible/tunable from host (needed by NRL NEPTUNE)
Remove NOAHMP write statement that was making output too verbose (Remove non-warning log write statement #321 )
Tests Conducted:
UFS RTs on Ursa show no changes to baselines. Some testing was done at NRL with the NEPTUNE model that necessitated reversing some UFS-specific tuning commits. See NCAR#1158
Dependencies:
None
Documentation:
None
Issue (optional):
Fixes NCAR#1155
Closes #320
Contributors (optional):
@matusmartini @climbfuji @dpsarmie