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 register_diag_field axes_grp pointer init #1456

Merged
merged 3 commits into from
Aug 7, 2021

Conversation

marshallward
Copy link
Collaborator

Several axes_grp pointers in register_diag_field were null()-initialized
at declaration, e.g.

  type(axes_grp), pointer :: axes => null()

This implicitly declares the pointers with save, which preserves its
value across calls. These axes will not be initialized to null()
(excepting the first call).

In this instance, this was causing d2 axes to be created when they
should not have existed.

This patch eliminates the implicit save attributes and applies
explicit initialization when required.

Several axes_grp pointers in register_diag_field were null()-initialized
at declaration, e.g.

  type(axes_grp), pointer :: axes => null()

This implicitly declares the pointers with `save`, which preserves its
value across calls.   First call excepted, these axes will not be
initialized to null().

In this instance, this was causing d2 axes to be created when they
should not have existed.

This patch eliminates the implicit `save` attributes and applies
explicit initialization when required.
@marshallward
Copy link
Collaborator Author

This should fix #1455.

@Hallberg-NOAA Hallberg-NOAA linked an issue Jul 30, 2021 that may be closed by this pull request
@marshallward marshallward mentioned this pull request Aug 5, 2021
@codecov
Copy link

codecov bot commented Aug 6, 2021

Codecov Report

Merging #1456 (5cdc20d) into dev/gfdl (580db49) will not change coverage.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##           dev/gfdl    #1456   +/-   ##
=========================================
  Coverage     29.13%   29.13%           
=========================================
  Files           235      235           
  Lines         71025    71025           
=========================================
  Hits          20694    20694           
  Misses        50331    50331           
Impacted Files Coverage Δ
src/framework/MOM_diag_mediator.F90 54.09% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 580db49...5cdc20d. Read the comment docs.

Copy link
Collaborator

@Hallberg-NOAA Hallberg-NOAA left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand and agree with these changes. Moreover, I have verified that the three pointers that are no longer being nullified when they are declared and are not being explicitly nullified in the code are being properly set before they have used.

This PR has passed the TC testing, and I will merge it in as soon as the pipeline tests have run successfully.

@adcroft
Copy link
Collaborator

adcroft commented Aug 6, 2021

https://gitlab.gfdl.noaa.gov/ogrp/MOM6/-/jobs/67881 passed with doc string msgs

@marshallward
Copy link
Collaborator Author

Sorry, I updated main -> dev/gfdl before this managed to get in.

Since the PR has already been approved and tested, I will do this merge and update the parameters.

@marshallward marshallward merged commit 7883f63 into mom-ocean:dev/gfdl Aug 7, 2021
@marshallward marshallward deleted the diag_d2_ptr_fix branch October 20, 2021 13:01
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

Successfully merging this pull request may close these issues.

Registered modules for diagnostics differ between compilers
3 participants