Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port sphere transport test group for ocean components #104

Merged
merged 23 commits into from
Oct 17, 2023
Merged
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
9bc025a
Migrate sphere_transport test to tasks
cbegeman Sep 22, 2023
c16db6c
Update sphere transport yaml file
cbegeman Sep 25, 2023
b7f693f
Align sphere_tranport cases with spherical convergence
cbegeman Sep 25, 2023
4eb8a75
Add sphere transport tasks
cbegeman Sep 26, 2023
430c129
Add cfg files for each task
cbegeman Sep 26, 2023
73bd0f8
Add sphere transport suites
cbegeman Sep 26, 2023
119fdc1
Change output interval to be consistent with analysis
cbegeman Sep 26, 2023
61fe84f
Add all plot types to viz for sphere transport
cbegeman Oct 2, 2023
509343a
Use conv analysis step in sphere transport
cbegeman Oct 1, 2023
e089a20
Add filament analysis step to sphere transport
cbegeman Oct 1, 2023
dc54d20
Fixup sphere_transport convergence rebase shared config
cbegeman Oct 2, 2023
01ff9e6
Add mixing analysis to correlated tracers
cbegeman Oct 2, 2023
5ae0b58
Add viz at midway through simulation
cbegeman Oct 4, 2023
04d9575
Move a few initial state parameters to cfg options
cbegeman Oct 4, 2023
855bbbb
Cleanup initial state routines and add more cfg options
cbegeman Oct 5, 2023
f384999
fixup viz
cbegeman Oct 5, 2023
8c2381b
Update user's guide
cbegeman Oct 4, 2023
5fbec50
Update developer's guide
cbegeman Oct 4, 2023
6e5771d
Update api
cbegeman Oct 5, 2023
9f73157
remove resources from api
cbegeman Oct 5, 2023
fa00153
Use time module for sphere transport
cbegeman Oct 6, 2023
034f978
fixup rebase onto enhance convergence steps
cbegeman Oct 9, 2023
0e4f866
Update convergence rates
cbegeman Oct 9, 2023
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
34 changes: 34 additions & 0 deletions docs/developers_guide/ocean/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,40 @@
viz.Viz.run
```

### sphere_transport

```{eval-rst}
.. currentmodule:: polaris.ocean.tasks.sphere_transport

.. autosummary::
:toctree: generated/

add_sphere_transport_tasks

SphereTransport
SphereTransport.configure

init.Init
init.Init.run

forward.Forward

analysis.Analysis
analysis.Analysis.convergence_parameters

mixing_analysis.MixingAnalysis
mixing_analysis.MixingAnalysis.run

filament_analysis.FilamentAnalysis
filament_analysis.FilamentAnalysis.run

viz.VizMap
viz.VizMap.runtime_setup

viz.Viz
viz.Viz.run
```

### cosine_bell

```{eval-rst}
Expand Down
108 changes: 108 additions & 0 deletions docs/developers_guide/ocean/tasks/correlated_tracers_2d.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
(dev-ocean-correlated-tracers-2d)=

# correlated_tracers_2d

The {py:class}`polaris.ocean.tasks.sphere_transport.SphereTransport`
`correlated_tracers_2d` test performs a 12-day run on the sphere that has a periodic
deforming flow which affects tracer distributions. The resolution of the
sphere varies (by default, between 60 and 240 km). After one period, the
tracer distributions are compared the initial condition to evaluate numerical
errors associated with the horizontal advection scheme and determine the rate
of convergence.

## framework

The config options for the `correlated_tracers_2d` test is described in
{ref}`ocean-correlated_tracers-2d` in the User's Guide.

Additionally, the test uses a `forward.yaml` file with a few common
model config options related to drag and default horizontal and
vertical momentum and tracer diffusion, as well as defining `mesh`, `input`,
`restart`, and `output` streams. This file has Jinja templating that is
used to update model config options based on Polaris config options, see
{ref}`dev-ocean-spherical-convergence`.

### base_mesh

Sphere transport tasks use shared `base_mesh` steps for creating
{ref}`dev-ocean-spherical-meshes` at a sequence of resolutions.

### init

The class {py:class}`polaris.ocean.tasks.sphere_transport.init.Init`
defines a step for setting up the initial state at each resolution. The
initial state is differentiated between `correlated_tracers_2d` and the other tests
set up by the class.

### forward

The class {py:class}`polaris.ocean.tasks.sphere_transport.forward.Forward`
descends from {py:class}`polaris.ocean.convergence.spherical.SphericalConvergenceForward`,
and defines a step for running MPAS-Ocean from an initial condition produced in
an `init` step. See {ref}`dev-ocean-convergence` for some relevant
discussion of the parent class. The time step is determined from the resolution
based on the `dt_per_km` config option in the `[convergence_forward]`
section. Other model config options are taken from `forward.yaml`.

### analysis

The class {py:class}`polaris.ocean.tasks.sphere_transport.analysis.Analysis`
descends from
{py:class}`polaris.ocean.convergence.ConvergenceAnalysis`,
and defines a step for computing the error norm (L2) for the results
at each resolution for tracers and layer thickness, saving them in
`convergence_*.csv` and plotting them in `convergence_*.png`.

### mixing_analysis

The class {py:class}`polaris.ocean.tasks.sphere_transport.mixing_analysis.MixingAnalysis`
plots the relationship between two correlated tracers for each resolution in
`triplots.png`.

### viz

Visualization steps are available only in the `correlated_tracers_2d/with_viz`
tasks. They are not included in the `correlated_tracers_2d` in order to keep regression
as fast as possible when visualization isn't needed.

The class {py:class}`polaris.ocean.tasks.sphere_transport.viz.VizMap`
defines a step for creating a mapping file from the MPAS mesh at a given
resolution to a lon-lat grid at a resolution and interpolation method
determined by config options.

```cfg
# options for visualization for the cosine bell convergence test case
[sphere_transport_viz]

# visualization latitude and longitude resolution
dlon = 0.5
dlat = 0.5

# remapping method ('bilinear', 'neareststod', 'conserve')
remap_method = conserve
```

The class {py:class}`polaris.ocean.tasks.sphere_transport.viz.Viz`
is a step for plotting the initial and final states of the advection test for
each resolution, mapped to the common lat-lon grid. The colormap is controlled
by these options:

```cfg
# options for visualization for the cosine bell convergence test case
[sphere_transport_viz_*]

# colormap options
# colormap
colormap_name = viridis

# the type of norm used in the colormap
norm_type = linear

# A dictionary with keywords for the norm
norm_args = {'vmin': 0., 'vmax': 1.}

# We could provide colorbar tick marks but we'll leave the defaults
# colorbar_ticks = np.linspace(0., 1., 9)
```

See {ref}`dev-visualization-global` for more details.
102 changes: 102 additions & 0 deletions docs/developers_guide/ocean/tasks/divergent_2d.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
(dev-ocean-divergent-2d)=

# divergent_2d

The {py:class}`polaris.ocean.tasks.sphere_transport.SphereTransport`
`divergent_2d` test performs a 12-day run on the sphere that has a periodic
divergent flow which affects tracer distributions. The resolution of the
sphere varies (by default, between 60 and 240 km). After one period, the
tracer distributions are compared the initial condition to evaluate numerical
errors associated with the horizontal advection scheme and determine the rate
of convergence.

## framework

The config options for the `divergent_2d` test is described in
{ref}`ocean-divergent-2d` in the User's Guide.

Additionally, the test uses a `forward.yaml` file with a few common
model config options related to drag and default horizontal and
vertical momentum and tracer diffusion, as well as defining `mesh`, `input`,
`restart`, and `output` streams. This file has Jinja templating that is
used to update model config options based on Polaris config options, see
{ref}`dev-ocean-spherical-convergence`.

### base_mesh

Sphere transport tasks use shared `base_mesh` steps for creating
{ref}`dev-ocean-spherical-meshes` at a sequence of resolutions.

### init

The class {py:class}`polaris.ocean.tasks.sphere_transport.init.Init`
defines a step for setting up the initial state at each resolution. The
initial state is differentiated between `divergent_2d` and the other tests
set up by the class.

### forward

The class {py:class}`polaris.ocean.tasks.sphere_transport.forward.Forward`
descends from {py:class}`polaris.ocean.convergence.spherical.SphericalConvergenceForward`,
and defines a step for running MPAS-Ocean from an initial condition produced in
an `init` step. See {ref}`dev-ocean-convergence` for some relevant
discussion of the parent class. The time step is determined from the resolution
based on the `dt_per_km` config option in the `[convergence_forward]`
section. Other model config options are taken from `forward.yaml`.

### analysis

The class {py:class}`polaris.ocean.tasks.sphere_transport.analysis.Analysis`
descends from
{py:class}`polaris.ocean.convergence.ConvergenceAnalysis`,
and defines a step for computing the error norm (L2) for the results
at each resolution for tracers and layer thickness, saving them in
`convergence_*.csv` and plotting them in `convergence_*.png`.

### viz

Visualization steps are available only in the `divergent_2d/with_viz`
tasks. They are not included in the `divergent_2d` in order to keep regression
as fast as possible when visualization isn't needed.

The class {py:class}`polaris.ocean.tasks.sphere_transport.viz.VizMap`
defines a step for creating a mapping file from the MPAS mesh at a given
resolution to a lon-lat grid at a resolution and interpolation method
determined by config options.

```cfg
# options for visualization for the cosine bell convergence test case
[sphere_transport_viz]

# visualization latitude and longitude resolution
dlon = 0.5
dlat = 0.5

# remapping method ('bilinear', 'neareststod', 'conserve')
remap_method = conserve
```

The class {py:class}`polaris.ocean.tasks.sphere_transport.viz.Viz`
is a step for plotting the initial and final states of the advection test for
each resolution, mapped to the common lat-lon grid. The colormap is controlled
by these options:

```cfg
# options for visualization for the cosine bell convergence test case
[sphere_transport_viz_*]

# colormap options
# colormap
colormap_name = viridis

# the type of norm used in the colormap
norm_type = linear

# A dictionary with keywords for the norm
norm_args = {'vmin': 0., 'vmax': 1.}

# We could provide colorbar tick marks but we'll leave the defaults
# colorbar_ticks = np.linspace(0., 1., 9)
```

See {ref}`dev-visualization-global` for more details.
4 changes: 4 additions & 0 deletions docs/developers_guide/ocean/tasks/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,13 @@
:titlesonly: true

baroclinic_channel
correlated_tracers_2d
cosine_bell
geostrophic
divergent_2d
inertial_gravity_wave
manufactured_solution
nondivergent_2d
rotation_2d
single_column
```
108 changes: 108 additions & 0 deletions docs/developers_guide/ocean/tasks/nondivergent_2d.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
(dev-ocean-nondivergent-2d)=

# nondivergent_2d

The {py:class}`polaris.ocean.tasks.sphere_transport.SphereTransport`
`nondivergent_2d` test performs a 12-day run on the sphere that has a periodic
deforming flow which affects tracer distributions. The resolution of the
sphere varies (by default, between 60 and 240 km). After one period, the
tracer distributions are compared the initial condition to evaluate numerical
errors associated with the horizontal advection scheme and determine the rate
of convergence.

## framework

The config options for the `nondivergent_2d` test is described in
{ref}`ocean-nondivergent-2d` in the User's Guide.

Additionally, the test uses a `forward.yaml` file with a few common
model config options related to drag and default horizontal and
vertical momentum and tracer diffusion, as well as defining `mesh`, `input`,
`restart`, and `output` streams. This file has Jinja templating that is
used to update model config options based on Polaris config options, see
{ref}`dev-ocean-spherical-convergence`.

### base_mesh

Sphere transport tasks use shared `base_mesh` steps for creating
{ref}`dev-ocean-spherical-meshes` at a sequence of resolutions.

### init

The class {py:class}`polaris.ocean.tasks.sphere_transport.init.Init`
defines a step for setting up the initial state at each resolution. The
initial state is differentiated between `nondivergent_2d` and the other tests
set up by the class.

### forward

The class {py:class}`polaris.ocean.tasks.sphere_transport.forward.Forward`
descends from {py:class}`polaris.ocean.convergence.spherical.SphericalConvergenceForward`,
and defines a step for running MPAS-Ocean from an initial condition produced in
an `init` step. See {ref}`dev-ocean-convergence` for some relevant
discussion of the parent class. The time step is determined from the resolution
based on the `dt_per_km` config option in the `[convergence_forward]`
section. Other model config options are taken from `forward.yaml`.

### analysis

The class {py:class}`polaris.ocean.tasks.sphere_transport.analysis.Analysis`
descends from
{py:class}`polaris.ocean.convergence.ConvergenceAnalysis`,
and defines a step for computing the error norm (L2) for the results
at each resolution for tracers and layer thickness, saving them in
`convergence_*.csv` and plotting them in `convergence_*.png`.

### filament_analysis

The class {py:class}`polaris.ocean.tasks.sphere_transport.filament_analysis.FilamentAnalysis`
computes a filament diagnostic for each threshold value and each resolution
and plots that diagnostic in `filament.png`.

### viz

Visualization steps are available only in the `nondivergent_2d/with_viz`
tasks. They are not included in the `nondivergent_2d` in order to keep regression
as fast as possible when visualization isn't needed.

The class {py:class}`polaris.ocean.tasks.sphere_transport.viz.VizMap`
defines a step for creating a mapping file from the MPAS mesh at a given
resolution to a lon-lat grid at a resolution and interpolation method
determined by config options.

```cfg
# options for visualization for the cosine bell convergence test case
[sphere_transport_viz]

# visualization latitude and longitude resolution
dlon = 0.5
dlat = 0.5

# remapping method ('bilinear', 'neareststod', 'conserve')
remap_method = conserve
```

The class {py:class}`polaris.ocean.tasks.sphere_transport.viz.Viz`
is a step for plotting the initial and final states of the advection test for
each resolution, mapped to the common lat-lon grid. The colormap is controlled
by these options:

```cfg
# options for visualization for the cosine bell convergence test case
[sphere_transport_viz_*]

# colormap options
# colormap
colormap_name = viridis

# the type of norm used in the colormap
norm_type = linear

# A dictionary with keywords for the norm
norm_args = {'vmin': 0., 'vmax': 1.}

# We could provide colorbar tick marks but we'll leave the defaults
# colorbar_ticks = np.linspace(0., 1., 9)
```

See {ref}`dev-visualization-global` for more details.
Loading