Support non-zero SurfacePressure#433
Conversation
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>
|
This branch is based off of #428 |
|
##Testing Testing was with E3SM-Project/polaris#610 Polaris
|
|
Documentation hasn't yet been updated. |
|
We need to add to this that we subtract |
32511f1 to
d18f6bd
Compare
|
I will instead define pressure fields clearly as relative pressure and drop the CF standard name |
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>
d18f6bd to
6ef1c89
Compare
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>
6ef1c89 to
18c5e81
Compare
Updated TestingAgain with E3SM-Project/polaris#610 Polaris
|
|
@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
left a comment
There was a problem hiding this comment.
I agree with the code changes you made here. I will circle back for testing.
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.
This PR moves
SurfacePressureownership fromVertCoordtoOceanStateso it participates in IO, and defines all Omega pressure fields as relative (gauge) pressure.Changes
Move
SurfacePressureintoOceanStateSurfacePressure/SurfacePressureHarrays fromVertCoordtoOceanStateSurfacePressurein theStateandRestartfield groups so it is included in IC and restart streamsVertCoordso it can be used when computing 3D pressureVertCoordinitSurfacePressure()inOceanInitafter the stream read so the host mirror and halo are ready before the model advancesA consequence of this work is that
SurfacePressuremust always be present in the Omega initial condition.It will be filled with fill values, not zeros, if it is absent, and the
Statefield group read will fail for files that are missingSurfacePressure.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:Eos.halready passesPressure * Pa2Dbwith no offset, consistent with this definition.ẑ = p / (ρ₀ g)equals zero at the sea surface under standard atmospheric forcing only whenpis relative pressure. Under absolute pressure the surface pseudo-height would already be ≈ −10 m, which is conceptually strange.sea_water_pressureis defined for absolute pressure, so it is removed fromPressureInterfaceandPressureMid; no CF standard name exists for relative pressure.Specific changes:
VertCoord.cpp: removesea_water_pressureCF standard name fromPressureInterfaceandPressureMid; 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: removesurface_air_pressureCF standard name fromSurfacePressure; update long name to say "relative pressure"Eos.h: document thatPressureinputs to the TEOS-10 specific-volume, freezing-temperature, and Brunt-Väisälä functors are relative pressureVertCoord.h/VertCoord.cpp: clarify thatcomputePressurecomputes relative pressure given relativeSurfacePressureOceanState.md,VertCoord.md): describe all pressure fields as relative, note thatSurfacePressureis 0 Pa for standard atmospheric forcing and represents the atmospheric anomaly in coupled runsOceanState.md): note thatSurfacePressureis relative pressure, typically ≈ 0 Pa for free-surface runsChecklist
Testingwith the following:have been run on and indicate that are all passing.
has passed, using the Polaris
e3sm_submodules/Omegabaseline-pfor both the baseline (Polarise3sm_submodules/Omega) and the PR build