Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix uninitialized bug in GFDL MP #1035

Merged

Conversation

mathomp4
Copy link
Member

@mathomp4 mathomp4 commented Nov 26, 2024

CI tests with Debugging flags on found a bug in GFDL Microphysics. Namely the code has:

    real :: TOT_PREC_LS, AREA_LS_PRC, AREA_LS_PRC_K
    integer :: k

    revap(:) = 0.

    do k = ktop, kbot

        TOT_PREC_LS = TOT_PREC_LS  + (          ( qr (k) + qs (k) + qg (k) ) * den (k) )
        AREA_LS_PRC = AREA_LS_PRC  + ( qa (k) * ( qr (k) + qs (k) + qg (k) ) * den (k) )

The issue is that in the k-loop both TOT_PREC_LS and AREA_LS_PRC are uninitialized in the first run through the loop.

My fix is to initialize to 0.0 before going into the loop. I assume this is right, but I'll defer to @wmputman.


ETA: My editor cleaned up the whitespace, so the file comparison is not too nice to look out without ignoring whitespace. See:

https://github.com/GEOS-ESM/GEOSgcm_GridComp/pull/1035/files?w=1

@mathomp4 mathomp4 self-assigned this Nov 26, 2024
@mathomp4 mathomp4 requested a review from a team as a code owner November 26, 2024 19:38
@mathomp4 mathomp4 added the 0 diff The changes in this pull request have verified to be zero-diff with the target branch. label Nov 26, 2024
@mathomp4 mathomp4 merged commit 21697fe into feature/sdrabenh/gcm_v12 Nov 26, 2024
10 of 12 checks passed
@mathomp4 mathomp4 deleted the bugfix/mathomp4/v12-fix-uninit-bug branch November 26, 2024 20:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0 diff The changes in this pull request have verified to be zero-diff with the target branch.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants