Insert return calls right after offending call to subroutines if an error occurs#1141
Insert return calls right after offending call to subroutines if an error occurs#1141matusmartini wants to merge 8 commits into
Conversation
the end of subroutines, remove duplicate print statements
statements. More cleanup
|
FYI @climbfuji and thank you for your input on these modifications |
climbfuji
left a comment
There was a problem hiding this comment.
This is a great cleanup, thank you!
I know that some people consider a return before the end of a program unit as good programming, I don't have a strong opinion. It's up to the codeowners of these files, but if we can have it consistent then that's nice, of course.
"can not" to cannot.
|
@matusmartini Could you please merge the main branch into this branch? |
|
@AnningCheng-NOAA Could you please review changes to the MG microphysics code here? |
|
I've always wondered why there were |
grantfirl
left a comment
There was a problem hiding this comment.
@matusmartini All of these changes seem fine to me. The only push back that I could imagine is if some developer wanted their scheme to complete even if there is an internal error. I don't know why someone would want to though (perhaps debugging reasons?).
|
FYI, this passes the SCM RTs in NCAR/ccpp-scm#596 |
Done. No conflicts |
looks fine to me. |
|
I prefer to see different solutions for different threads.
…On Tue, Jun 24, 2025 at 2:10 PM Grant Firl ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In physics/Interstitials/UFS_SCM_NEPTUNE/GFS_phys_time_vary.fv3.F90
<#1141 (comment)>:
> @@ -229,6 +229,7 @@ subroutine GFS_phys_time_vary_init (
myerrmsg = 'read_aerdata failed without a message'
call read_aerdata (me,master,iflip,idate,myerrmsg,myerrflg)
call copy_error(myerrmsg, myerrflg, errmsg, errflg)
Would you like to see a different solution to all threads updating the
same errmsg and errflag, overwriting each other?
—
Reply to this email directly, view it on GitHub
<#1141 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ALQPMILZIBZGHXKPKXSVR533FGH7TAVCNFSM6AAAAAB6WE6KISVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDSNJUHA2DKOJTGQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
errflg directly. On branch return-on-error
|
@grantfirl I do not know what is the best course of actions. Feel free to let me know when this PR is good to go and I could merge main and resolve conflicts? |
|
I've combined this into #1159, so I'm going to close it. There isn't anything left to do. All tests pass and all combined PRs have been approved, so will merge shortly. |
|
Closing since combined with #1159 |
Description of Changes:
The issue: Some subroutines do not have return statements after an error occurs. Instead two variables
errflganderrmsgare 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 haveif(errflg/=0) returnin place.This PR fixes an issue to return right after an error occurs. Subroutines that use
errflganderrmsgshould be checked forerrflgand abort if necessary. Insertif(errflg/=0) returnafter such calls.In addition the following is added:
errmsg.UPDATE: Thanks to reviewers' feedback, this PR also includes cleanup of
GFS_phys_time_vary.fv3.F90to removecopy_errorcalls from one-thread region (accessingerrmsganderrflgdirectly).Tests Conducted:
None with the current head of the repo. Only quick tests with an older hash with NEPTUNE. We would like to adopt this ccpp error (
errflganderrmsg) handling on our next upgrade but we need this PR (once reviewed and approved) to be merged first.Dependencies:
None