Move the Coriolis helpers to the framework - #692
Open
xylar wants to merge 5 commits into
Open
Conversation
Collaborator
Author
TestingPolaris
|
Collaborator
Author
|
This work is needed because |
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
force-pushed
the
move-coriolis-to-framework
branch
from
August 7, 2026 14:36
f85a752 to
80f0a13
Compare
Contributor
Great! Happy to review. I am visiting family now until Monday morning, but can get to this then. |
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
force-pushed
the
move-coriolis-to-framework
branch
from
August 8, 2026 11:41
80f0a13 to
a6c269f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The helpers that add
fCell,fEdgeandfVertexto a mesh have lived inpolaris/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 topolaris/coriolis.pyand the[coriolis]config section topolaris/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 withtype = 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
Checklist
api.md) has any new or modified class, method and/or functions listedTestingcomment in the PR documents testing used to verify the changes