Skip to content

Conversation

@herrwang0
Copy link

@herrwang0 herrwang0 commented Dec 13, 2025

This PR adds a new 2D field meanSL to grid control structure. meanSL is primarily used to handle a domain with spatially uneven long term mean surface level, with the Great Lakes being a prime example.

  • As bathyT, meanSL is referenced to z_ref in ocean_grid_type (and to zero in dyn_horgrid_type). meanSL adopts height unit and is positive above z_ref or zero.
  • Cosmetically, the expression G%meanSL + G%bathyT in calculating column thickness is used instead of G%bathyT + G%meanSL, which (hopefully) can be easily interpreted as G%meanSL - (-G%bathyT).
  • meanSL is NOT replacing z_ref.
    1. So that z_ref can still be used as a uniform reference height for debugging/testing.
    2. If we instead turn z_ref into as a 2D field, topography will have to change to column thickness, which may not be very user-friendly.
  • Why not use a mean thickness?
    1. Mean thickness could reduce a lot of max(meanSL+bathyT, 0.0) operations, but majority of the mean thickness calculation happens in _init, so this is probably not a lot of extra work. The exception is find_face_area under certain configurations in barotropic solver.
    2. mean sea level = difference of two large numbers. (though we don't actually use grad(meanSL)).
  • This affects 14 modules. By default, meanSL is uniformly zero (or z_ref internally), so there is no answer change.
  • The three commits are meant to separate the introduction of meanSL and the actual usage of meanSL.

Edit: sorry for claiming the #1000 issue/pr/discussion.

The spatially varying time mean sea level meanSL is used as a reference
height to calculate, e.g., time mean ocean column thickness
max(meanSL + bathyT, 0.0). This field allows the model run in a domain
with spatically varying mean height, e.g. the Great Lakes system.

This first commit insulates the changes from the rest of the model. It
only adds the field to ocean_grid_type and dyn_horgrid_type, the
transcription between the two types, and a routine to read it from a
file. The field is not yet used by the rest of the code.
This commit uses G%meanSL in 13 modules. The change is essentially
replacing G%bathyT + G%Z_ref with G%meanSL + G%bathyT. Note that this
does NOT mean parameter G%Z_ref is replaced by G%meanSL. G%Z_ref is
factored in both G%meanSL and G%bathyT and it is kept as a useful
consistency testing tool.

Another cosmetic change is made by using G%meanSL + G%bathyT, instead of
G%bathyT + G%meanSL, which (hopefully) can be easily interpreted as
G%meanSL - (-G%bathyT).
else
max_depth = diagnoseMaximumDepth(D,G)
if (present(meanSL)) then
max_depth = diagnoseMaximumDepth(D+meanSL, G)
Copy link
Member

Choose a reason for hiding this comment

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

This line is doing an array-syntax sum of two fields, including working in the halo regions. This is not permitted in MOM6, as is explained at https://github.com/NOAA-GFDL/MOM6/wiki/Code-style-guide#array-syntax. Please replace this with an explicit calculation of the total water column thickness in its own array.

Copy link
Author

Choose a reason for hiding this comment

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

Done. I think It should be noted that in this particular case, halo is explicitly excluded in the calculation diagnoseMaximumDepth. But I agree that this abundance of caution is warranted in the long run.

if (trim(config) /= "DOME") then
call limit_topography(D, G, PF, max_depth, US)
if (trim(config) /= "DOME") then
! MAXIMUM_DEPTH is not set and topogrpahy does not need to be trimmed by its maximum depth.
Copy link
Member

Choose a reason for hiding this comment

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

"topogrpahy" should be "topography".

Copy link
Author

Choose a reason for hiding this comment

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

Done

Copy link
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.

In my view, this PR will be ready to go once the instance of an inappropriate use of array syntax math (noted in a specific comment on the line in question) has been addressed.

max_depth is really used as a maximum static thickness throughout the
model, so meanSL needs to be considered.
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.

2 participants