Skip to content

Add Omega horizontal pressure gradient tests#465

Merged
sbrus89 merged 55 commits into
E3SM-Project:mainfrom
xylar:add-omega-two-column
Apr 21, 2026
Merged

Add Omega horizontal pressure gradient tests#465
sbrus89 merged 55 commits into
E3SM-Project:mainfrom
xylar:add-omega-two-column

Conversation

@xylar
Copy link
Copy Markdown
Collaborator

@xylar xylar commented Feb 18, 2026

This merge adds three horiz_press_grad tests for the horizontal pressure-gradient acceleration (HPGA) in Omega:

  • salinity_gradient - salinity varies horizontally; temperature varies only with depth and layer pseudo-thicknesses are uniform
  • temperature_gradient - temperature varies horizontally; salinity varies only with depth and layer pseudo-thicknesses are uniform
  • ztilde_gradient - pseudo-height of layers are sloped; temperature and salinity vary only with depth (thus, HPGA should be close to zero)

The tests include :

  • a reference step that computes a high-fidelity reference solution (numerical quadrature in the vertical; a 4th-order gradient in the horizontal)
  • init steps at each of a list of horizontal and vertical resolutions that provide initial conditions and a Python implementation of the centered, 2nd-order HPGA
  • forward steps at each resolution that just computes the HPGA (in NormalVelocityTend) in Omega
  • an analysis step that checks the RMS difference between the Omega and Polaris centered HPGA (verification of the implementation) and plots the convergence of the HPGA with respect to the reference solution. Errors are raised if the Omega solution diverges too much from the Python implementation at any resolution or from the reference solution at the highest resolution. An error is also raised if the convergence rate is too poor.

Checklist

  • Developer's Guide has been updated
  • API documentation in the Developer's Guide (api.md) has any new or modified class, method and/or functions listed
  • Documentation has been built locally and changes look as expected
  • Testing comment in the PR documents testing used to verify the changes
  • New tests have been added to a test suite

@xylar
Copy link
Copy Markdown
Collaborator Author

xylar commented Feb 18, 2026

This is build off of #464 so I will hold off a bit on asking for reviews and rebase once that (hopefully) goes in.

@xylar xylar added enhancement New feature or request ocean Related to the ocean component Omega PR required The polaris changes won't work with the current Omega submodule and require an update labels Feb 19, 2026
@xylar xylar self-assigned this Feb 19, 2026
@xylar xylar requested a review from sbrus89 February 19, 2026 07:27
@xylar
Copy link
Copy Markdown
Collaborator Author

xylar commented Mar 11, 2026

This needs to be updated to not use the Density0 Omega config option to be consistent with E3SM-Project/Omega#358.

@cbegeman
Copy link
Copy Markdown
Collaborator

cbegeman commented Apr 13, 2026

Updated
I think the order of integration related to testing the pressure gradient might be

  1. Turn off HPG term in tests that do not require it #529 with submodule update to include Add centered pressure gradient Omega#353
  2. this PR
  3. a polaris PR to extend Omega support for the overflow test case led by @mark-petersen
  4. a polaris PR to extend Omega support for the seamount test case led by (?)

@xylar
Copy link
Copy Markdown
Collaborator Author

xylar commented Apr 13, 2026

@cbegeman, I would like #529 to bring in the submodule update. Form there, I agree.

@cbegeman
Copy link
Copy Markdown
Collaborator

@xylar Thanks for pointing that out. Sounds good

@sbrus89
Copy link
Copy Markdown
Contributor

sbrus89 commented Apr 14, 2026

I'll add the submodule update tomorrow. Sorry I forgot to do that today.



class Reference(OceanIOStep):
r"""
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
r"""
"""

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I'll check on this. There may be a math reason this needs to be a literal string rather than decoding the back-slashes.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Ah, I didn't think of that

Comment on lines +102 to +104
- Omega RMS error versus reference (`omega_vs_reference.png`), including a
power-law fit and convergence slope, and
- Omega RMS difference versus Python initialization (`omega_vs_python.png`).
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can we provide more detail here to explain exactly what we're evaluating against? It's not immediately apparent to me why, in order to evaluate the pressure gradient tendency at the midpoint of edges given the T,S,layerThickness fields at the midpoint of cells, we choose as "truth" a 4th-order reconstruction given T,S,dTdx,dSdx at the midpoint of edges (not sure that I got all these details right, just trying to be specific about what details would be helpful). I realize that some of this info might be in the design doc but I think it would be good to include here or in the description section.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Noted. I will try to do a better job of documenting this.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I made major revisions to the docs. Hopefully, this is clarified. Please have a look if you have time.

@xylar xylar force-pushed the add-omega-two-column branch from a385f6b to c613e45 Compare April 17, 2026 16:30
@xylar xylar marked this pull request as ready for review April 17, 2026 16:36
@xylar xylar force-pushed the add-omega-two-column branch from c613e45 to 6681b49 Compare April 17, 2026 16:36
@xylar
Copy link
Copy Markdown
Collaborator Author

xylar commented Apr 17, 2026

@sbrus89, I rebased this following #529. Could you give it one more test and let me know if you want anything changed? I'd like to get this merged pretty soon.

@xylar xylar added Omega PR finished The polaris changes required an update to the Omega submodule and this is now finished and removed Omega PR required The polaris changes won't work with the current Omega submodule and require an update labels Apr 17, 2026
xylar added 7 commits April 17, 2026 18:41
For now, just creates initial conditions in each column, including
specific volume.
The vertical coordinate is z-tilde, but the z-tilde at the sea
floor has to be found iteratively such that the geometric
water-column thickness is as expected
xylar added 15 commits April 17, 2026 18:41
The analysis fails if errors exceed the thresholds or if the
convergence rate is outside the expected range.
Limit the convergence analysis to 6 km and higher.

Add absolute error threshold for situations where the HPGA is
too small for the normalize error to be useful.
Add 0.5 km resolution and lower convergence fit to <= 4 km.

Switch reference solution to higher res (0.25 km).

Adjust convergence thresholds.
This makes the problem more numerically challenging.
Drop coarsest resolutions (16, 8, 6 km) and add more fine resolutions
(1.5 and 0.75 km).
Flesh out the description of the reference and init implelmentaitons
of the HPGF.
@xylar xylar force-pushed the add-omega-two-column branch from 6681b49 to 9e83366 Compare April 17, 2026 16:41
@xylar
Copy link
Copy Markdown
Collaborator Author

xylar commented Apr 17, 2026

I'm rerunning the omega_nightly suite on Frontier right now (with craygnu).

@cbegeman
Copy link
Copy Markdown
Collaborator

@xylar Thanks for expanding the docs. Unless I missed it, can you state that you are evaluating the pressure gradient at the one edge adjoining the two columns and that the x-axis is normal to that edge (or a similar corrected statement if I'm mistaken).

@xylar
Copy link
Copy Markdown
Collaborator Author

xylar commented Apr 17, 2026

@cbegeman, I'm trying my best to clarify this further:

mesh

The mesh is planar with two adjacent ocean cells. For each resolution in
horiz_resolutions, the spacing between the two columns is set by that value
(in km).

The HPGA diagnostic is evaluated on the single internal horizontal edge that
connects the two columns, at each layer midpoint. In this page, x denotes
the along-layer horizontal direction used by Omega's horizontal gradient
operator. In the idealized two-column planar geometry, this direction follows
the line joining the two cell centers. It is therefore related to the shared
edge normal, but it is not intended to define a separate exact geometric
edge-normal coordinate.

vertical grid

The vertical coordinate is z-tilde with a uniform pseudo-height spacing for
each test in vert_resolutions.

The meaning of the along-layer x direction depends on the task variant. In
the salinity_gradient and temperature_gradient tests, the z-tilde
interfaces are level, so pressure surfaces are also horizontally level except
where they intersect the bathymetry. In the ztilde_gradient test, the
prescribed z-tilde gradient tilts the layers, so the pressure surfaces are
sloped and the along-layer direction follows those sloping layers.

The reference step uses a finer spacing vert_res chosen so that every test
spacing is an integer multiple of 2 * vert_res. This allows reference
interfaces to align with test midpoints for exact subsampling in analysis.

Although I do keep flat z-tilde layers in 2 of the 3 tests, this is only true until we hit the bathymetry, which is flat in geometric height but not in z-tilde. The 3rd test has tilted layers and the gradient in computed along layer, not normal to the edge.

@xylar
Copy link
Copy Markdown
Collaborator Author

xylar commented Apr 17, 2026

I tried to create a figure illustrating the configuration but it was not really good enough to be helpful. I think a more cartoonish illustration might show the concepts but wouldn't be particularly true to the test. Happy to keep iterating.

Copy link
Copy Markdown
Collaborator

@cbegeman cbegeman left a comment

Choose a reason for hiding this comment

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

@xylar I think what you added provides enough clarity. I think a diagram could be reserved for the Omega documentation of the pgrad algorithm (I don't recall whether it already has one). Thanks for iterating!

@xylar
Copy link
Copy Markdown
Collaborator Author

xylar commented Apr 17, 2026

@cbegeman, thank you for pushing things to be better.

@xylar xylar assigned sbrus89 and unassigned xylar Apr 20, 2026
Copy link
Copy Markdown
Contributor

@sbrus89 sbrus89 left a comment

Choose a reason for hiding this comment

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

I tested this by doing a local merge into main on pm-cpu. All tests pass with baseline comparisons to the current main except for the salinity_gradient test, which this PR adds to the omega_pr suite:

Polaris omega_pr suite

  • Baseline workdir: /global/homes/s/sbrus/scratch/polaris_constant_eos_omega_pr_baseline/
  • Baseline build: /global/homes/s/sbrus/scratch/polaris_constant_eos_omega_pr_baseline/build
  • PR build: /global/homes/s/sbrus/scratch/polaris_add-two-column/build
  • PR workdir: /global/homes/s/sbrus/scratch/polaris_add-two-column
  • Machine: pm-cpu
  • Compiler: gnu
  • Build type: Release
  • Log: not found
  • Result:
    • Diffs (1 of 10):
      • ocean/horiz_press_grad/salinity_gradient

@sbrus89 sbrus89 merged commit d4bcf57 into E3SM-Project:main Apr 21, 2026
5 checks passed
@sbrus89
Copy link
Copy Markdown
Contributor

sbrus89 commented Apr 21, 2026

Thanks for all your work on this @xylar!

@xylar xylar deleted the add-omega-two-column branch April 22, 2026 05:42
@xylar
Copy link
Copy Markdown
Collaborator Author

xylar commented Apr 22, 2026

Thanks for reviewing and merging @sbrus89!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request ocean Related to the ocean component Omega PR finished The polaris changes required an update to the Omega submodule and this is now finished

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants