-
Notifications
You must be signed in to change notification settings - Fork 118
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
Use of uninitialized values in fv_mapz_mod.cs_profile
when iv == -3
#301
Comments
@spencerkclark you are correct. gam(i,km) was incorrectly not specified in the |
@laurenchilutti I haven't been assigned an issue before. Should I test the code and submit a patch? Thanks. |
@lharris4 I did not look closely before assigning this - I had thought this was a PR and I was adding you as a reviewer. Please disregard the assignment. |
@laurenchilutti Thank you. |
This follows the suggestion of Lucas Harris in NOAA-GFDL#301 for the fix.
This follows the suggestion of Lucas Harris in NOAA-GFDL#301 for the fix.
Describe the bug
Debugging the source of non-reproducibility for a configuration of SHiELD turned up the use of uninitialized values in a local array in the
cs_profile
subroutine of thefv_mapz
module. The issue occurs only wheniv == -3
, which corresponds to one of two possible modes for use when remapping the vertical velocity, the other beingiv == -2
. I have verified this with additional means, but the issue can be identified by inspecting the lines of code clipped below, considering the case wheniv == -3
:GFDL_atmos_cubed_sphere/model/fv_mapz.F90
Lines 1988 to 2071 in e94dc4b
The issue specifically stems from the local
gam
array, which is declared in line 1988 without any initial assignment. Wheniv == -3
it gets values for level1
in line 2025 and levels2
throughkm - 1
(inclusive) in line 2034, but is not assigned values for levelkm
prior to being used in line 2068. This leads to undefined / non-reproducible behavior at runtime.To Reproduce
Run SHiELD in non-hydrostatic mode with
fv_core_nml.kord_wz
less than zero andabs(fv_core_nml.kord_wz) > 7
, e.g.fv_core_nml.kord_wz = -9
. This tells the model to useiv == -3
andcs_profile
when remapping the vertical velocity:GFDL_atmos_cubed_sphere/model/fv_mapz.F90
Lines 411 to 424 in e94dc4b
Expected behavior
I would expect values to be defined for
gam(:,km)
wheniv == -3
prior to it being used in line 2068.System Environment
Describe the system environment, include:
The text was updated successfully, but these errors were encountered: