MOM6
MOM6 copied to clipboard
`initialize_sponges_file` ignores default value of `USE_REGRIDDING`
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.
This specific issue will be corrected once https://github.com/NOAA-GFDL/MOM6/pull/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,
The code correcting this issue has now been merged onto the main branch of MOM6 as a part of https://github.com/mom-ocean/MOM6/pull/1582, with the specific changes coming in from https://github.com/NOAA-GFDL/MOM6/pull/180.