Skip to content

Move the Coriolis helpers to the framework - #692

Open
xylar wants to merge 5 commits into
E3SM-Project:mainfrom
xylar:move-coriolis-to-framework
Open

Move the Coriolis helpers to the framework#692
xylar wants to merge 5 commits into
E3SM-Project:mainfrom
xylar:move-coriolis-to-framework

Conversation

@xylar

@xylar xylar commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

The helpers that add fCell, fEdge and fVertex to a mesh have lived in polaris/ocean/ since they were written, but nothing about them is ocean-specific: they read coordinates that any MPAS mesh has, write fields that belong to the mesh rather than to the ocean, and depend only on framework-level code. This PR moves them to polaris/coriolis.py and the [coriolis] config section to polaris/default.cfg, so that sea ice, land ice or any future component can use them without reaching into the ocean component.

Along the way, the [coriolis] options lose their defaults. Previously a step that forgot to say what it needed quietly got no rotation, which is hard to notice in output and easy to ship by accident. Every task that needs Coriolis now has to state which kind it wants and with what parameters, and one that forgets gets an error naming the option it left unset. A task that genuinely wants no rotation says so with type = zero, which is a statement about the task rather than a default it fell into.

The move itself changes no results. All 16 ocean task families that use Coriolis already set what they need, so none of them required a change.

Testing

  • The module had no direct unit tests, since it was only ever exercised through task init steps. This PR adds a set covering each helper, the config-driven dispatch, and the new errors.
  • The Coriolis fields produced from all 16 task-family configs were compared before and after the move and are bit-identical.
  • The full unit test suite passes (312 tests).

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

@xylar xylar self-assigned this Aug 7, 2026
@xylar xylar added the clean-up label Aug 7, 2026
@xylar

xylar commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator Author

Testing

Polaris omega_pr suite

  • Baseline workdir: /lcrc/group/e3sm/ac.xylar/polaris_1.1/chrysalis/test_20260806/omega-pr-develop
  • Baseline build: /lcrc/group/e3sm/ac.xylar/polaris_1.1/chrysalis/test_20260806/omega-pr-develop/build
  • PR build: /lcrc/group/e3sm/ac.xylar/polaris_1.1/chrysalis/test_20260806/omega-pr-develop/build
  • PR workdir: /lcrc/group/e3sm/ac.xylar/polaris_1.1/chrysalis/test_20260807/omega-pr-coriolis-to-framework
  • Machine: chrysalis
  • Partition: compute
  • Compiler: intel
  • Build type: Release
  • Log: /lcrc/group/e3sm/ac.xylar/polaris_1.1/chrysalis/test_20260807/omega-pr-coriolis-to-framework/polaris_omega_pr.o1265277
  • Result:
    • Failures (4 of 17):
      • ocean/column/vmix_stable
      • ocean/column/vmix_unstable
      • ocean/column/ekman
      • ocean/column/inertial

@xylar

xylar commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator Author

This work is needed because e3sm/init needs to create a sea-ice initial condition with Coriolis and it is against the Polaris philosophy to use ocean framework to do that.

@xylar
xylar requested a review from katsmith133 August 7, 2026 07:23
@xylar

xylar commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator Author

@katsmith133, I am asking you to review as the Omega initial condition deputy. This work feeds into creating E3SM initial conditions for Omega and sea ice together.

@xylar
xylar force-pushed the move-coriolis-to-framework branch from f85a752 to 80f0a13 Compare August 7, 2026 14:36
@katsmith133

Copy link
Copy Markdown
Contributor

@katsmith133, I am asking you to review as the Omega initial condition deputy. This work feeds into creating E3SM initial conditions for Omega and sea ice together.

Great! Happy to review. I am visiting family now until Monday morning, but can get to this then.

@xylar xylar added framework Changes relating to the polaris framework as opposed to individual tests or analysis ocean Related to the ocean component labels Aug 8, 2026
xylar added 5 commits August 8, 2026 06:40
Nothing in polaris/ocean/coriolis.py is ocean-specific: it imports only
polaris.config and polaris.constants, reads mesh coordinates that any
MPAS mesh has, and writes fCell/fEdge/fVertex, which are mesh fields
rather than ocean fields.  Move it to polaris/coriolis.py so sea-ice,
land-ice and future components can use it without reaching into the
ocean component.

The module itself is unchanged; only the 16 imports of it move from
polaris.ocean.coriolis to polaris.coriolis.
Move the [coriolis] section from polaris/ocean/ocean.cfg to
polaris/default.cfg, so that the options are available to every
component rather than only to the ocean.  The block moves unchanged, so
behaviour is the same: type still defaults to zero.

A component with no rotation simply ignores the section, the same way it
ignores options it does not read today.
Blank all five [coriolis] options in polaris/default.cfg and raise a
ValueError naming whichever option a task failed to set, rather than
letting a step silently get no rotation because it forgot to say what it
wanted.

No task changes: all 16 ocean task families that call
add_coriolis_to_dataset already set "type" in their config, and each
already sets the parameter belonging to that type -- barotropic_gyre
sets beta_plane_f0 at run time and beta_plane_beta in config, and
geostrophic sets rotated_sphere_alpha both ways.

add_coriolis_to_dataset reads only the parameter belonging to the
selected type, so the options left blank for the other types are never
touched.
The module has had no direct unit tests: it was exercised only through
task init steps.  Every function is pure and takes a small dataset, so
the tests are cheap.

They cover the value each helper produces (2 omega sin(lat) at cells,
edges and vertices for the spherical case; alpha=0 matching it and
alpha=pi/2 moving the extrema onto the equator for the rotated sphere;
uniform fields for constant and zero; linear in y for the beta plane),
the attributes the fields carry, dispatch from config to each of the
five types, and the error naming whichever option a task left unset.
The module has never appeared in any api.md.  Add its six public
functions under the framework API reference and a developer-guide page
covering both ways to use it: add_coriolis_to_dataset() driven by the
[coriolis] config section, and the per-type helpers for steps that
should not be configurable.

Also drop "ocean" from add_coriolis_to_dataset()'s description of its
config argument, which no longer fits now that the module is framework
code.
@xylar
xylar force-pushed the move-coriolis-to-framework branch from 80f0a13 to a6c269f Compare August 8, 2026 11:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clean-up framework Changes relating to the polaris framework as opposed to individual tests or analysis ocean Related to the ocean component

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants