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

Uninitialized variables in the Baltic test case #149

Closed
nichannah opened this issue Apr 27, 2015 · 2 comments
Closed

Uninitialized variables in the Baltic test case #149

nichannah opened this issue Apr 27, 2015 · 2 comments

Comments

@nichannah
Copy link
Collaborator

I ran valgrind on the Baltic test case and found use of uninitialized variables:

  • MOM_set_diffusivity.F90:1833: performs calculation using CS%Decay_scale_factor_lee, which is not set. This has no impact because the calculation is not used in the case where it is bad. Error would probably not ever trigger in an optimized run (since calculation would never be done).
  • MOM_set_diffusivity.F90:614: CS%Henyey_IGW_background_new is not initialized.
  • SIS_tracer_advect.F90: several locations. domore_u, domore_v not initialized.
  • SIS_tracer_advect.F90:331: G%set_first_direction is not set within SIS. This is used in several locations throughout the model.
  • src/initialization/midas_vertmap.F90: debug_, i_debug, j_debug not initialized.
  • /src/initialization/midas_vertmap.F90:605: dS not initialized.
  • src/core/MOM_barotropic.F90:200: frhatu1, frhatv1 not set to NULL.

Valgrind has shown itself to be a useful tool to find use of uninitialized variables. I have created an issue #148 to extend the valgrind testing.

adcroft added a commit to NOAA-GFDL/SIS2 that referenced this issue Apr 28, 2015
- Reported by @nicjhan in issue mom-ocean/MOM6#149.
- Following the use of G%first_direction in MOM6, I
  add a get_param() for the SIS2 parameter FIRST_DIRECTION.
- This does change all the SIS_parameter_doc.all files.
- No answer changes.
adcroft added a commit to NOAA-GFDL/MOM6-examples that referenced this issue Apr 28, 2015
mom-ocean/MOM6@9dd6497 Bugfix: uninitialized variable dS in midas_vertmap
mom-ocean/MOM6@b7ffdc9 Bugfix: uninitialized variable debug_ in midas_vertmap
mom-ocean/MOM6@719c885 Bugfix: uninitialized variable CS%Henyey_IGW_background_new
mom-ocean/MOM6@c11e836 Bugfix: uninitialized variable CS%Decay_scale_factor_lee

- mom-ocean/MOM6@719c885 changed all the MOM_parameter_doc.all files.
- No answer changes.
adcroft added a commit to NOAA-GFDL/MOM6-examples that referenced this issue Apr 28, 2015
NOAA-GFDL/SIS2@67a04e5 Bugfix: uninitialized variables domore_u, domore_v
NOAA-GFDL/SIS2@eb1d222 Bugfix: uninitialized variable G%first_direction

- NOAA-GFDL/SIS2@eb1d222 changed all the SIS_parameter_doc.all files.
- No answer changes.
adcroft added a commit that referenced this issue Apr 28, 2015
- Reported by @nicjhan in issue #149.
- The get_param() that set this parameter was inside an if-block so
  the parameter was not always set.
  - I set it to a nonsense value to make sure it is NOT used
    unintentionally.
- No answer changes.
adcroft added a commit that referenced this issue Apr 28, 2015
- Reported by @nicjhan in issue #149.
- There was no get_param() for the parameter HENYEY_IGW_BACKGROUND_NEW.
  - I added one and made it mutually exclusive with HENYEY_IGW_BACKGROUND.
  - It would appear we have not been using the new Henyey scheme!
- This did change the MOM_parameter_doc.all files.
- No answer changes.
adcroft added a commit that referenced this issue Apr 28, 2015
- Reported by @nicjhan in issue #149.
- debug_ was meant to be set to the state of an optional argument
  but if the optional argument was not present debug_ was never set.
  - i_debug and j_debug were also reported as uninitialized but I
    think initializating debug_ will avoid those references.
- No answer changes.
adcroft added a commit that referenced this issue Apr 28, 2015
- Reported by @nicjhan in issue #149.
- A maxval(abs(dS)) is using all of the array and yet only
  a sub-array is meant to be used. I simply initialized dS(:,:)=0
- No answer changes.
@adcroft
Copy link
Collaborator

adcroft commented Apr 28, 2015

I have not addressed

  • src/core/MOM_barotropic.F90:200: frhatu1, frhatv1 not set to NULL.

because the diagnostic is registered, allocated and posted but not actually calculated. I'm not sure whether @Hallberg-NOAA meant to add a diagnostic here (or had one when developing MOM_baratropc.F90) or whether he meant to delete it.

@nichannah
Copy link
Collaborator Author

I have fixed this so that it doesn't show up in valgrind checks.

The fact that the diagnostic is unfinished will get picked up by the diagnostic tests and fixed from there.

gustavo-marques pushed a commit to gustavo-marques/MOM6 that referenced this issue May 18, 2020
Hallberg-NOAA added a commit to Hallberg-NOAA/MOM6 that referenced this issue Jun 20, 2022
  Added the overloaded interface set_initialized() to the MOM_restart module, to
record that fields have been initialized, despite not appearing in a restart
file.  This will allow for a second call to set_initialized() after a call to
query_initialized() to replicate the existing behavior of query_initialized()
after MOM6 PR mom-ocean#149 (NOAA-GFDL#149) has been
accepted.  All answers are bitwise identical, but there is a new public
interface.
ashao pushed a commit to ashao/MOM6 that referenced this issue Jul 5, 2022
  Added the overloaded interface set_initialized() to the MOM_restart module, to
record that fields have been initialized, despite not appearing in a restart
file.  This will allow for a second call to set_initialized() after a call to
query_initialized() to replicate the existing behavior of query_initialized()
after MOM6 PR mom-ocean#149 (NOAA-GFDL#149) has been
accepted.  All answers are bitwise identical, but there is a new public
interface.
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