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

initialize_sponges_file ignores default value of USE_REGRIDDING #1576

Closed
pittwolfe opened this issue Jul 11, 2022 · 2 comments
Closed

initialize_sponges_file ignores default value of USE_REGRIDDING #1576

pittwolfe opened this issue Jul 11, 2022 · 2 comments

Comments

@pittwolfe
Copy link

initialize_sponges_file in MOM_state_initialization reads the USE_REGRIDDING configuration parameter, but doesn't have a default set. The line in question is

call get_param(param_file, mdl, "USE_REGRIDDING", use_ALE)

This potentially leads to undefined behavior. In my case, I'm running in layered mode but didn't explicitly set USE_REGRIDDING = False since false is the default. With the Gnu11 compiler, this resulted in USE_REGRIDDING being set to true, but only in initialize_sponges_file. This made the sponges behave very strangely and took me a while to figure out what was going on.

Explicitly setting USE_REGRIDDING = False solves the issue, but this is inconsistent with having it false by default.

Hallberg-NOAA added a commit to Hallberg-NOAA/MOM6 that referenced this issue Aug 1, 2022
  Set default values in all get_param calls for USE_REGRIDDING.  Previously,
there had been 4 calls where this was missing, which led to the problems noted
at mom-ocean#1576.  This PR will allow that issue
to be closed.  Also used the default argument in a get_param call for INPUTDIR,
although that case would not change any behavior because the value was set
before the get_param call.  A fail_in_missing argument was added to the FMS_cap
call to get_param for GUST_2D_FILE, mirroring what is done for the solo_driver
code, but cases where this was actually missing were very likely to have failed
later anyway, but without an explicit error message.  This PR could change
unpredictable behavior in cases where USE_REGRIDDING is not explicitly set, but
all answers are bitwise identical in the MOM6-examples test suite.
@Hallberg-NOAA
Copy link
Collaborator

This specific issue will be corrected once NOAA-GFDL#180 has been merged into main.

I have also created a test (in a separate commit) for any instances of calls to get_param without providing either a default value or a fail_if_missing argument, to avoid any other uninitialized variables. All code that is exercised by the MOM6-examples test suite (at https://github.com/NOAA-GFDL/MOM6-examples) are now passing these tests. However, I do not know whether this test is something that we will want to incorporate into our routine testing protocols, so for now I am keeping this new test on a separate branch at https://github.com/Hallberg-NOAA/MOM6/tree/fatal_missing_default,

marshallward pushed a commit to NOAA-GFDL/MOM6 that referenced this issue Aug 3, 2022
  Set default values in all get_param calls for USE_REGRIDDING.  Previously,
there had been 4 calls where this was missing, which led to the problems noted
at mom-ocean#1576.  This PR will allow that issue
to be closed.  Also used the default argument in a get_param call for INPUTDIR,
although that case would not change any behavior because the value was set
before the get_param call.  A fail_in_missing argument was added to the FMS_cap
call to get_param for GUST_2D_FILE, mirroring what is done for the solo_driver
code, but cases where this was actually missing were very likely to have failed
later anyway, but without an explicit error message.  This PR could change
unpredictable behavior in cases where USE_REGRIDDING is not explicitly set, but
all answers are bitwise identical in the MOM6-examples test suite.
@Hallberg-NOAA
Copy link
Collaborator

The code correcting this issue has now been merged onto the main branch of MOM6 as a part of #1582, with the specific changes coming in from NOAA-GFDL#180.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants