Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
bc02339
Update mpaso-omega variable and namelist option map
cbegeman Sep 12, 2025
11fb271
Update mpaso-omega variable and namelist option map
cbegeman Sep 12, 2025
2231961
Remove `Dimension: nVertLevels: 1` from YAML files
xylar Oct 27, 2025
22fc202
Add InitialVertCoord stream
xylar Oct 27, 2025
f43d002
Rename SshCellDefault --> SshCell
xylar Oct 27, 2025
4e98b26
Add RestartRead stream, now always required
xylar Oct 27, 2025
148f6e4
Update submodules in Omega build instructions
xylar Oct 28, 2025
f9ba8c8
Use free slip solution from hendershott
cbegeman Jun 18, 2025
79b9f3d
Update barotropic gyre config for munk free-slip
cbegeman Jun 18, 2025
35e7995
Provide references for analytic solutions
cbegeman Jun 20, 2025
67e54e5
Make free slip and no slip two separate tests
cbegeman Aug 4, 2025
a8e6aa1
Differentiate free slip and no slip cases further
cbegeman Aug 21, 2025
89834e1
Use AB2 for btrgyre because it runs much faster
cbegeman Aug 22, 2025
74d468b
Make run duration a cfg option
cbegeman Aug 22, 2025
4a403b0
Add btrgyre test suite
cbegeman Sep 8, 2025
e9601f9
Add relative vorticity output
cbegeman Sep 8, 2025
52c5f2e
REMOVE: add wall slip factor to yaml
cbegeman Aug 4, 2025
e715d53
Add omega support to barotropic gyre
cbegeman Sep 12, 2025
e3f9929
Switch time integrator back to AB2 for MPAS-O
cbegeman Sep 12, 2025
eaadb2b
Update user's guide
cbegeman Sep 12, 2025
5adc587
Update developer's guide
cbegeman Sep 12, 2025
b2842db
Update docstrings
cbegeman Sep 12, 2025
18d00ac
Add barotropic_gyre free slip case to PR suite
cbegeman Oct 28, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/developers_guide/ocean/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,11 @@
analysis.Analysis.exact_solution
analysis.Analysis.run

forward.compute_max_time_step
forward.Forward
forward.Forward.compute_cell_count
forward.Forward.compute_max_time_step
forward.Forward.dynamic_model_config
forward.Forward.setup

init.Init
init.Init.setup
Expand Down
18 changes: 9 additions & 9 deletions docs/developers_guide/ocean/tasks/barotropic_gyre.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ defines a step for setting up the initial state for each test case.
First, a mesh appropriate for the resolution is generated using
{py:func}`mpas_tools.planar_hex.make_planar_hex_mesh()`. Then, the mesh is
culled to remove periodicity in the x and y directions. A vertical grid is
generated, with 1 layer by default. Next, the wind stress forcing field is
generated, with 3 layers by default. Next, the wind stress forcing field is
generated.

### forward
Expand All @@ -39,9 +39,10 @@ tasks have as their target and minimum (if the resources are not explicitly
prescribed). For MPAS-Ocean, PIO namelist options are modified and a
graph partition is generated as part of `runtime_setup()`. Next, the ocean
model is run. If `run_time_steps` is provided then this determines the run
duration, otherwise the duration is 3 years. Finally, validation of
`layerThickness` and `normalVelocity` in the `output.nc` file are performed
against a baseline if one is provided when calling {ref}`dev-polaris-setup`.
duration, otherwise the duration is given by the config option `run_duration`.
Finally, validation of `layerThickness` and `normalVelocity` in the `output.nc`
file are performed against a baseline if one is provided when calling
{ref}`dev-polaris-setup`.

### analysis

Expand All @@ -51,9 +52,8 @@ the analytical solution for the linearized dynamics. This step also produces a
figure with the model solution, the analytical solution, and the difference
between the two.

(dev-ocean-baroclinic-gyre-default)=
## barotropic_gyre

## default

The {py:class}`polaris.tasks.ocean.baroclinic_channel.default.Default`
test performs a test of the linearized dynamics.
The {py:class}`polaris.tasks.ocean.barotropic_gyre.BarotropicGyre`
test performs either the Munk free-slip or the Munk no-slip cases depending
on the `test_name` and `boundary_condition` parameters provided.
8 changes: 6 additions & 2 deletions docs/developers_guide/quick_start.md
Original file line number Diff line number Diff line change
Expand Up @@ -493,8 +493,12 @@ Otherwise, to build Omega,
source ./load_<env_name>_<machine>_<compiler>_<mpi>.sh
git submodule update --init e3sm_submodules/Omega
cd e3sm_submodules/Omega
git submodule update --init --recursive externals/YAKL externals/ekat \
externals/scorpio cime
externals/YAKL \
externals/ekat \
externals/scorpio \
externals/cpptrace \
components/omega/external \
cime
cd components/omega
mkdir build
cd build
Expand Down
84 changes: 63 additions & 21 deletions docs/users_guide/ocean/tasks/barotropic_gyre.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,19 @@ clockwise circulation. The comparison with the analytical solution is performed
via a streamfunction. The L2 norm is printed and the following figure is
produced:

```{image} images/barotropic_gyre_solution.png
```{image} images/barotropic_gyre_free-slip_solution.png
:align: center
:width: 800 px
```

The analytic solution for the free slip condition is derived from
Henderschott's General Circulation of the Ocean doi:10.1007/978-1-4612-4636-7
p.223 unnumbered equation after 2.3.9.

The analytic solution for the no slip condition is derived from
Vallis's Atmospheric and Oceanic Fluid Dynamics doi:10.1017/9781107588417
p.743 equation 19.49.

## mesh

The mesh is planar with dimensions given by the config options `lx` and `ly`
Expand Down Expand Up @@ -92,11 +100,14 @@ where `tau_0` is given by a config option.
:width: 500 px
```

### config options
## config options

```cfg
[barotropic_gyre]

# time integrator
time_integrator = split_explicit_ab2

# distance in kilometers between cell centers
resolution = 20

Expand All @@ -109,24 +120,21 @@ ly = 1200
# Maximum amplitude of the zonal wind stress [N m-2]
tau_0 = 0.1

# Horizontal visocity [m2 s-1]
nu_2 = 4e2

# [s-1 m-1]
beta = 10e-11

# [s-1]
f_0 = 10e-4
# Horizontal gradient in coriolis parameter [s-1 m-1]
beta = 1.0e-10

# homogenous fluid density [kg m-3]
rho_0 = 1000

# Duration of forward step if run_time_steps not given [years]
run_duration = 2.
```

The config option `nu_2` specifies the del2 horizontal viscosity. This value
will be compared against the resolution to check for stability at set-up. All
other config options are explained further in previous sections.

### cores
## cores

The number of cores is determined by `goal_cells_per_core` and
`max_cells_per_core` in the `ocean` section of the config file.
Expand All @@ -135,15 +143,7 @@ The number of cores is determined by `goal_cells_per_core` and

## supported models

These tasks support only MPAS-Ocean.

## default

The default case is designed such that only a short forward run is performed.
However, when users set up the default case, a long forward run is also set
up and may be run along with the analysis step to compare the numerical
solution with an analytical solution. The user should change the
`barotropic_gyre: steps_to_run` config option to include desired steps.
These tasks support both MPAS-Ocean and Omega.

### time step and run duration

Expand All @@ -152,5 +152,47 @@ condition assuming a maximum velocity of 1 m/s and a function of the coriolis
parameter `f_0`. The stability parameter is set to 0.25 based on the stability
of MPAS-Ocean for this test case.

The run duration is 3 time steps for the `short_forward` step and 3 years for
The run duration is 3 time steps for the `short_forward` step and 2 years for
the `long_forward` step.

## munk free-slip

The Munk free-slip test case uses its own set of default horizontal viscosity
and coriolis parameter values. It also automatically compares against the
analytic solution for the free-slip case during the `analysis` step.

The case is designed such that only a short forward run is performed.
However, when users set up the default case, a long forward run and analysis
step are also set up and may be run together to compare the numerical
solution with an analytical solution. The user should change the
`barotropic_gyre_munk_free-slip: steps_to_run` config option to include desired
steps.

### config options

```cfg
[barotropic_gyre_munk_free-slip]

# Horizontal visocity [m2 s-1]
nu_2 = 1e2

# Coriolis parameter [s-1]
f_0 = 1.0e-4
```

## munk no-slip

This case has the same attributes described in munk free-slip except the no-
slip solution and a separate cfg section are used.

### config options

```cfg
[barotropic_gyre_munk_no-slip]

# Horizontal visocity [m2 s-1]
nu_2 = 4e2

# Coriolis parameter [s-1]
f_0 = 1.0e-3
```
31 changes: 30 additions & 1 deletion polaris/ocean/model/mpaso_to_omega.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ dimensions:
nCells: NCells
nEdges: NEdges
nVertices: NVertices
nTracers: NTracers
maxEdges: MaxEdges
maxEdges2: MaxEdges2
TWO: MaxCellsOnEdge
Expand All @@ -11,6 +12,16 @@ dimensions:
nVertLevelsP1: NVertLevelsP1

variables:
# mesh
cellsOnCell: CellsOnCell
edgesOnCell: EdgesOnCell
verticesOnCell: VerticesOnCell
cellsOnEdge: CellsOnEdge
edgesOnEdge: EdgesOnEdge
verticesOnEdge: VerticesOnEdge
cellsOnVertex: CellsOnVertex
edgesOnVertex: EdgesOnVertex

# tracers
temperature: Temperature
salinity: Salinity
Expand All @@ -23,7 +34,10 @@ variables:
normalVelocity: NormalVelocity

# auxiliary state
ssh: SshCellDefault
ssh: SshCell
windStressZonal: WindStressZonal
windStressMeridional: WindStressMeridional
relativeVorticity: RelVortVertex

config:
- section:
Expand Down Expand Up @@ -67,6 +81,21 @@ config:
config_use_mom_del4: VelHyperDiffTendencyEnable
config_mom_del4: ViscDel4

- section:
forcing: Tendencies
options:
config_use_bulk_wind_stress: WindForcingTendencyEnable

- section:
debug: Tendencies
options:
config_disable_vel_explicit_bottom_drag: BottomDragTendencyEnable

- section:
bottom_drag: Tendencies
options:
config_explicit_bottom_drag_coeff: BottomDragCoeff

- section:
manufactured_solution: ManufacturedSolution
options:
Expand Down
2 changes: 2 additions & 0 deletions polaris/suites/ocean/barotropic_gyre.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ocean/planar/barotropic_gyre/munk/free-slip
ocean/planar/barotropic_gyre/munk/no-slip
1 change: 1 addition & 0 deletions polaris/suites/ocean/omega_pr.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
ocean/planar/manufactured_solution/convergence_both/default
ocean/planar/barotropic_gyre/munk/free-slip
ocean/spherical/icos/rotation_2d
ocean/spherical/icos/cosine_bell/decomp
ocean/spherical/icos/cosine_bell/restart
87 changes: 60 additions & 27 deletions polaris/tasks/ocean/barotropic_gyre/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,72 +19,105 @@ def add_barotropic_gyre_tasks(component):
component : polaris.tasks.ocean.Ocean
the ocean component that the task will be added to
"""
test_name = 'default'
component.add_task(
BarotropicGyre(component=component, test_name=test_name)
group_name = 'barotropic_gyre'
group_dir = os.path.join('planar', group_name)
config_filename = f'{group_name}.cfg'
config_filepath = os.path.join(component.name, group_dir, config_filename)
config = PolarisConfigParser(filepath=config_filepath)
config.add_from_package(
f'polaris.tasks.ocean.{group_name}', config_filename
)

for boundary_condition in ['free-slip', 'no-slip']:
component.add_task(
BarotropicGyre(
component=component,
subdir=group_dir,
test_name='munk',
boundary_condition=boundary_condition,
config=config,
config_filename=config_filename,
)
)


class BarotropicGyre(Task):
"""
The convergence test case for inertial gravity waves
"""

def __init__(self, component, test_name):
def __init__(
self,
component,
subdir,
test_name,
boundary_condition,
config,
config_filename,
):
"""
Create the test case

Parameters
----------
component : polaris.tasks.ocean.Ocean
The ocean component that this task belongs to
subdir : str
The subdirectory for the task
test_name : str
The name of the test (e.g., 'munk')
boundary_condition : str
The type of boundary condition ('free-slip' or 'no-slip')
config : PolarisConfigParser
The configuration parser for the task
config_filename : str
The name of the configuration file
"""
group_name = 'barotropic_gyre'
name = f'{group_name}_{test_name}'
subdir = os.path.join('planar', group_name, test_name)
super().__init__(component=component, name=name, subdir=subdir)

config = self.config
config_filename = f'{group_name}.cfg'
config.filepath = os.path.join(component.name, subdir, config_filename)
config.add_from_package(
f'polaris.tasks.ocean.{group_name}', config_filename
)
name = f'{test_name}/{boundary_condition}'
indir = f'{subdir}/{name}'
super().__init__(component=component, name=name, subdir=indir)
self.set_shared_config(config, link=config_filename)

init = Init(component=component, subdir=subdir)
init.set_shared_config(config, link=config_filename)
self.add_step(init)
init_step = Init(
component=component,
indir=indir,
boundary_condition=boundary_condition,
test_name=test_name,
)
self.add_step(init_step)

forward = Forward(
forward_step = Forward(
component=component,
indir=self.subdir,
indir=indir,
ntasks=None,
min_tasks=None,
openmp_threads=1,
boundary_condition=boundary_condition,
name='short_forward',
run_time_steps=3,
graph_target=os.path.join(init.path, 'culled_graph.info'),
graph_target=os.path.join(init_step.path, 'culled_graph.info'),
)
forward.set_shared_config(config, link=config_filename)
self.add_step(forward)
forward_step.set_shared_config(config, link=config_filename)
self.add_step(forward_step)

forward = Forward(
component=component,
indir=self.subdir,
indir=indir,
ntasks=None,
min_tasks=None,
openmp_threads=1,
boundary_condition=boundary_condition,
name='long_forward',
graph_target=os.path.join(init.path, 'culled_graph.info'),
graph_target=os.path.join(init_step.path, 'culled_graph.info'),
)
forward.set_shared_config(config, link=config_filename)
self.add_step(forward, run_by_default=False)

analysis = Analysis(
component=component,
indir=self.subdir,
boundary_condition='free slip',
indir=indir,
test_name=test_name,
boundary_condition=boundary_condition,
)
analysis.set_shared_config(config, link=config_filename)
self.add_step(analysis, run_by_default=False)
Loading
Loading