Skip to content

Support non-zero SurfacePressure#433

Draft
xylar wants to merge 21 commits into
E3SM-Project:developfrom
xylar:omega/support-surface-pressure
Draft

Support non-zero SurfacePressure#433
xylar wants to merge 21 commits into
E3SM-Project:developfrom
xylar:omega/support-surface-pressure

Conversation

@xylar

@xylar xylar commented Jun 11, 2026

Copy link
Copy Markdown

This PR moves SurfacePressure ownership from VertCoord to OceanState so it participates in IO, and defines all Omega pressure fields as relative (gauge) pressure.


Changes

Move SurfacePressure into OceanState

  • Move SurfacePressure/SurfacePressureH arrays from VertCoord to OceanState
  • Register SurfacePressure in the State and Restart field groups so it is included in IC and restart streams
  • Share the device array back to VertCoord so it can be used when computing 3D pressure
  • Exchange halos and sync device→host after the initial-state stream read
  • Remove the placeholder TODO zero-fill from VertCoord
  • Call initSurfacePressure() in OceanInit after the stream read so the host mirror and halo are ready before the model advances

A consequence of this work is that SurfacePressure must always be present in the Omega initial condition.
It will be filled with fill values, not zeros, if it is absent, and the State field group read will fail for files that are missing SurfacePressure.

Define all pressure fields as relative (gauge) pressure

Omega's pressure fields (SurfacePressure, PressureInterface, PressureMid) are defined as relative pressure — absolute pressure minus the standard atmosphere (101325 Pa). Motivations:

  • TEOS-10 expects relative (gauge) pressure; Eos.h already passes Pressure * Pa2Db with no offset, consistent with this definition.
  • z-tilde pseudo-height ẑ = p / (ρ₀ g) equals zero at the sea surface under standard atmospheric forcing only when p is relative pressure. Under absolute pressure the surface pseudo-height would already be ≈ −10 m, which is conceptually strange.
  • The CF standard name sea_water_pressure is defined for absolute pressure, so it is removed from PressureInterface and PressureMid; no CF standard name exists for relative pressure.

Specific changes:

  • VertCoord.cpp: remove sea_water_pressure CF standard name from PressureInterface and PressureMid; update long names to say "relative pressure (gauge pressure)"; set minimum valid value to −AtmRefP (≈ −101325 Pa, since absolute pressure ≥ 0 implies relative pressure ≥ −standard atmosphere)
  • OceanState.cpp: remove surface_air_pressure CF standard name from SurfacePressure; update long name to say "relative pressure"
  • Eos.h: document that Pressure inputs to the TEOS-10 specific-volume, freezing-temperature, and Brunt-Väisälä functors are relative pressure
  • VertCoord.h/VertCoord.cpp: clarify that computePressure computes relative pressure given relative SurfacePressure
  • User guide (OceanState.md, VertCoord.md): describe all pressure fields as relative, note that SurfacePressure is 0 Pa for standard atmospheric forcing and represents the atmospheric anomaly in coupled runs
  • Developer guide (OceanState.md): note that SurfacePressure is relative pressure, typically ≈ 0 Pa for free-surface runs

Checklist

  • Documentation:
  • Linting
  • Testing
    • Add a comment to the PR titled Testing with the following:
      • Which machines CTest unit tests
        have been run on and indicate that are all passing.
      • The Polaris omega_pr test suite
        has passed, using the Polaris e3sm_submodules/Omega baseline
      • Document machine(s), compiler(s), and the build path(s) used for -p for both the baseline (Polaris e3sm_submodules/Omega) and the PR build
      • Indicate "All tests passed" or document failing tests
      • Document testing used to verify the changes including any tests that are added/modified/impacted.
    • New tests:
      • CTest unit tests for new features have been added per the approved design.

xylar and others added 18 commits June 10, 2026 07:39
This merge adds 5 constexpr fill value constants (FillValueI4,
FillValueI8, FillValueR4, FillValueR8, FillValueReal) in namespace
OMEGA, wrapping PIO_FILL_* from SCORPIO.
This merge adds private fillWithValue<T>() template helper
(using if constexpr on T::value_type) and a call to it at the end
of attachData<T>(). Arrays are now auto-filled with the declared
fill value at attach time.
This merge removes all local fill value declarations and replaces
references with the centralized constants.
In some cases we definitely don't want to overwrite fields we attach
with fill values.

Fix 2 such cases in Tracers and OceanState
We don't want fill values at every boundary edge becausee these
are also valid.  Instead, we want zeros except for edges between
two inactive cells (e.g. both adjacent cells are below bathymetry)
Rather than assuming that the NormalVelocity read from an initial
condition has correct masking, we ensure that it has fill values
for inactive layers, zeros at boundary edges (both adjacent to
land and to bathymetry), and leave its values unchanged for active,
non-boundary layers.
We need to ensure that it is zero at active boundary edges.
- Move SurfacePressure/SurfacePressureH arrays from VertCoord to OceanState,
  which already owns the other state fields (NormalVelocity, PseudoThickness)
- Register SurfacePressure in the State and Restart field groups in
  OceanState::defineFields() so it is included in IC and restart streams
- Share the device array back to VertCoord via setSurfacePressure() so its
  pressure-computation kernels continue to work without duplication
- Add OceanState::initSurfacePressure() to exchange halos and sync
  device->host after the initial-state stream read
- Remove the placeholder TODO zero-fill from VertCoord; the field now arrives
  pre-filled from the IC file or defaults to zero from host allocation
- Call initSurfacePressure() in OceanInit after the stream read so the host
  mirror and halo are ready before the model advances

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Call initSurfacePressure() in initStateTest() to mirror the production
  initialization sequence after the IC stream read
- Test that SurfacePressureH extent matches NCellsSize
- Test that SurfacePressure reads as zero when not present in the IC file,
  confirming the default-zero behavior expected for uncoupled runs

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@xylar

xylar commented Jun 11, 2026

Copy link
Copy Markdown
Author

This branch is based off of #428

@xylar xylar marked this pull request as draft June 11, 2026 17:55
@xylar

xylar commented Jun 11, 2026

Copy link
Copy Markdown
Author

##Testing

Testing was with E3SM-Project/polaris#610

Polaris omega_pr suite

  • Baseline workdir: /lcrc/group/e3sm/ac.xylar/polaris_1.0/chrysalis/test_20260610/omega-pr-fix-fill-values
  • Baseline build: /lcrc/group/e3sm/ac.xylar/polaris_1.0/chrysalis/test_20260610/omega-pr-fix-fill-values/build
  • PR build: /lcrc/group/e3sm/ac.xylar/polaris_1.0/chrysalis/test_20260610/omega-pr-surface-pressure-init2/build
  • PR workdir: /lcrc/group/e3sm/ac.xylar/polaris_1.0/chrysalis/test_20260610/omega-pr-surface-pressure-init2
  • Machine: chrysalis
  • Partition: compute
  • Compiler: oneapi-ifx
  • Build type: Release
  • Log: /lcrc/group/e3sm/ac.xylar/polaris_1.0/chrysalis/test_20260610/omega-pr-surface-pressure-init2/polaris_omega_pr.o1231363
  • Result: All tests passed

A new realistic global initial condition is needed with SurfacePressure included before CTests can be expected to pass. I have not yet done this, and am hoping that the utility in E3SM-Project/polaris#562 might be used.

@xylar

xylar commented Jun 11, 2026

Copy link
Copy Markdown
Author

Documentation hasn't yet been updated.

Comment thread components/omega/src/ocn/OceanState.cpp Outdated
Comment thread components/omega/src/ocn/OceanState.cpp Outdated
@xylar

xylar commented Jun 12, 2026

Copy link
Copy Markdown
Author

We need to add to this that we subtract standard_atmosphere from pressure when computing SpecVol.

@xylar xylar force-pushed the omega/support-surface-pressure branch 2 times, most recently from 32511f1 to d18f6bd Compare June 12, 2026 20:04
@xylar

xylar commented Jun 13, 2026

Copy link
Copy Markdown
Author

I will instead define pressure fields clearly as relative pressure and drop the CF standard name sea_water_pressure, see E3SM-Project/polaris#610 (comment)

Remove the incorrect CF standard name `surface_air_pressure` (which
applies to absolute atmospheric pressure) and update the long name to
explicitly say "relative pressure", since SurfacePressure is defined as
pressure relative to the standard atmosphere (101325 Pa).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@xylar xylar force-pushed the omega/support-surface-pressure branch from d18f6bd to 6ef1c89 Compare June 13, 2026 11:27
All three pressure fields (SurfacePressure, PressureInterface,
PressureMid) are relative pressure — absolute pressure minus the
standard atmosphere (101325 Pa). This clarification is needed because:
- The CF standard name sea_water_pressure applies to absolute pressure,
  so it is removed and left blank for PressureInterface and PressureMid
- The TEOS-10 EOS expects relative pressure, consistent with how Eos.h
  already passes pressure (Pa2Db * Pressure with no AtmRefP offset)
- The z-tilde pseudo-height is 0 m at the sea surface under standard
  atmospheric forcing only when p is relative pressure

Changes:
- VertCoord.cpp: remove sea_water_pressure CF name, update long names
  and min valid values (-AtmRefP, since absolute pressure >= 0) for
  PressureInterface and PressureMid; clarify computePressure comment
- VertCoord.h: clarify computePressure declaration comment
- Eos.h: note that Pressure inputs to TEOS-10 functors are relative
- userGuide/OceanState.md: describe SurfacePressure as relative
  pressure, typically 0 Pa for standard atmospheric forcing
- userGuide/VertCoord.md: note that p in the pseudo-height formula is
  relative pressure; update PressureInterface/PressureMid descriptions
- devGuide/OceanState.md: note SurfacePressure is relative pressure

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@xylar xylar force-pushed the omega/support-surface-pressure branch from 6ef1c89 to 18c5e81 Compare June 13, 2026 11:50
@xylar

xylar commented Jun 13, 2026

Copy link
Copy Markdown
Author

Updated Testing

Again with E3SM-Project/polaris#610

Polaris omega_pr suite

  • Baseline workdir: /lcrc/group/e3sm/ac.xylar/polaris_1.0/chrysalis/test_20260611/omega-pr-baseline/
  • Baseline build: /lcrc/group/e3sm/ac.xylar/polaris_1.0/chrysalis/test_20260611/omega-pr-baseline/build
  • PR build: /lcrc/group/e3sm/ac.xylar/polaris_1.0/chrysalis/test_20260613/omega-pr-surface-pressure-init/build
  • PR workdir: /lcrc/group/e3sm/ac.xylar/polaris_1.0/chrysalis/test_20260613/omega-pr-surface-pressure-init
  • Machine: chrysalis
  • Partition: compute
  • Compiler: oneapi-ifx
  • Build type: Release
  • Log: /lcrc/group/e3sm/ac.xylar/polaris_1.0/chrysalis/test_20260613/omega-pr-surface-pressure-init/polaris_omega_pr.o1235245
  • Result: All tests passed

@xylar

xylar commented Jun 13, 2026

Copy link
Copy Markdown
Author

@cbegeman, @andrewdnolan and @alicebarthel, sorry for the see-sawing on relative vs. absolute pressure. I have settled on relative pressure and that is documented here now.

Please review and modify as needed (e.g. rebasing after #428 goes in). Please get @sbrus89 or someone else with the privileges to merge when you're happy, and once #428 has been merged.

@cbegeman cbegeman left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I agree with the code changes you made here. I will circle back for testing.

cbegeman added a commit to E3SM-Project/polaris that referenced this pull request Jun 15, 2026
Adds `surfacePressure` to Omega initial conditions ...


...but does not add it to yaml files. Thus, `surfacePressure` is not used by the model. This relies on E3SM-Project/Omega#433. Adding `surfacePressure` to the yaml files for Omega-supported tests (that do not use `State`) will be done in a further PR.

This PR also adds `surfacePressure` --> `SurfacePressure` mapping from MPAS-Ocean --> Omega.

We need to add `SurfacePressure` explicitly to to manufactured solution initial state, since it does not use the `State` field group.
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.

3 participants