Skip to content

Diag buffer: Set fill_value_3d ks/ke size#1111

Merged
Hallberg-NOAA merged 2 commits into
NOAA-GFDL:dev/gfdlfrom
marshallward:diag-buffer-unittest-fix
May 11, 2026
Merged

Diag buffer: Set fill_value_3d ks/ke size#1111
Hallberg-NOAA merged 2 commits into
NOAA-GFDL:dev/gfdlfrom
marshallward:diag-buffer-unittest-fix

Conversation

@marshallward
Copy link
Copy Markdown
Member

The fill_value_3d unit test of diag_buffer_unit_tests_3d was not setting its vertical extent, causing inaccurate allocation sizes and potential segmentation faults. (Or, in my case, complete memory consumption and OS meltdowns.)

This patch adds set_vertical_extent and uses the same 10-element width. This appears to fix the issue for me.

@marshallward
Copy link
Copy Markdown
Member Author

@ashao Does this look right

@adcroft adcroft added the bug Something isn't working label May 7, 2026
@adcroft adcroft requested a review from Copilot May 7, 2026 11:50
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Reminder: MOM6 has a policy on AI-assisted contributions in Consortium-policy-on-AI.md.

This PR fixes the 3D diagnostic buffer unit test fill_value_3d by ensuring the buffer’s vertical extents are explicitly set before growing/allocating, preventing incorrect allocation sizes and potential memory/segfault failures.

Changes:

  • Add ks/ke parameters to fill_value_3d and call buffer%set_vertical_extent(ks=..., ke=...).
  • Align the test’s vertical extent with the existing 10-level convention used by other 3D buffer unit tests.

Comment thread src/framework/MOM_diag_buffers.F90 Outdated
Comment thread src/framework/MOM_diag_buffers.F90 Outdated
Comment thread src/framework/MOM_diag_buffers.F90
The `fill_value_3d` unit test of `diag_buffer_unit_tests_3d` was not
setting its vertical extent, causing inaccurate allocation sizes and
potential segmentation faults.  (Or, in my case, complete memory
consumption and OS meltdowns.)

This patch adds `set_vertical_extent` and uses the same 10-element
width.  This appears to fix the issue for me.
Some unused variables and incorrect comments have been removed from the
unit testing.

Assisted-by: copilot
@marshallward marshallward force-pushed the diag-buffer-unittest-fix branch from 2675351 to e066438 Compare May 11, 2026 14:52
Copy link
Copy Markdown
Member

@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 have examined these changes and they look correct to me.

@Hallberg-NOAA
Copy link
Copy Markdown
Member

This PR has passed pipeline testing at https://gitlab.gfdl.noaa.gov/ogrp/mom6ci/MOM6/-/pipelines/30833.

@Hallberg-NOAA Hallberg-NOAA merged commit 7ca304e into NOAA-GFDL:dev/gfdl May 11, 2026
52 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants