Skip to content

Commit e327086

Browse files
authored
Merge pull request #158 from cbegeman/ocn-port-ice-shelf-2d
Port ice_shelf_2d test cases
2 parents 3fbb789 + 8364eda commit e327086

40 files changed

+2466
-20
lines changed

docs/developers_guide/ocean/api.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,32 @@
107107
viz.Viz.run
108108
```
109109

110+
### ice_shelf_2d
111+
112+
```{eval-rst}
113+
.. currentmodule:: polaris.ocean.tasks.ice_shelf_2d
114+
115+
.. autosummary::
116+
:toctree: generated/
117+
118+
add_ice_shelf_2d_tasks
119+
120+
default.Default
121+
122+
forward.Forward
123+
forward.Forward.compute_cell_count
124+
forward.Forward.dynamic_model_config
125+
126+
init.Init
127+
init.Init.run
128+
129+
validate.Validate
130+
validate.Validate.run
131+
132+
viz.Viz
133+
viz.Viz.run
134+
```
135+
110136
### inertial_gravity_wave
111137

112138
```{eval-rst}
@@ -283,6 +309,25 @@
283309
SphericalConvergenceForward.compute_cell_count
284310
```
285311

312+
### Ice Shelf
313+
314+
```{eval-rst}
315+
.. currentmodule:: polaris.ocean.ice_shelf
316+
317+
.. autosummary::
318+
:toctree: generated/
319+
320+
IceShelfTask
321+
IceShelfTask.setup_ssh_adjustment_steps
322+
323+
SshAdjustment
324+
SshAdjustment.run
325+
326+
SshForward
327+
SshForward.compute_cell_count
328+
SshForward.dynamic_model_config
329+
```
330+
286331
### Ocean Model
287332

288333
```{eval-rst}
@@ -336,11 +381,16 @@
336381
vertical.grid_1d.write_1d_grid
337382
vertical.partial_cells.alter_bottom_depth
338383
vertical.partial_cells.alter_ssh
384+
vertical.sigma.init_sigma_vertical_coord
385+
vertical.sigma.update_sigma_layer_thickness
386+
vertical.update_layer_thickness
339387
vertical.zlevel.init_z_level_vertical_coord
388+
vertical.zlevel.update_z_level_layer_thickness
340389
vertical.zlevel.compute_min_max_level_cell
341390
vertical.zlevel.compute_z_level_layer_thickness
342391
vertical.zlevel.compute_z_level_resting_thickness
343392
vertical.zstar.init_z_star_vertical_coord
393+
vertical.zstar.update_z_star_layer_thickness
344394
```
345395

346396
### Visualization

docs/developers_guide/ocean/framework.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,25 @@ rather needs to be computed. The default behavior is to read the requested
383383
variable (the value associate the `'name'` key) at the time index closest to
384384
the evaluation time specified by the `convergence_eval_time` config option.
385385

386+
(dev-ocean-framework-ice-shelf)=
387+
388+
## Ice Shelf Tasks
389+
390+
The `polaris.ocean.ice_shelf` module provides support for ice shelf tasks.
391+
392+
The {py:class}`polaris.ocean.ice_shelf.IceShelf` class can serve as a parent
393+
class for ice shelf tests, such as
394+
{py:class}`polaris.ocean.tasks.ice_shelf_2d.IceShelf2d`.
395+
396+
The {py:meth}`polaris.ocean.ice_shelf.IceShelf.setup_ssh_adjustment_steps()`
397+
sets up `ssh_forward` and `ssh_adjustment` steps from the classes
398+
{py:class}`polaris.ocean.ice_shelf.ssh_forward.SshForward`
399+
{py:class}`polaris.ocean.ice_shelf.ssh_adjustment.SshAdjustment`.
400+
The `ssh_adjustment` section of the config file sets the parameters for these
401+
steps, as described in {ref}`ocean-ssh-adjustment`. It returns the last
402+
`ssh_adjustment` step, which is typically used as the
403+
initial state for subsequent forward steps.
404+
386405
(dev-ocean-framework-vertical)=
387406

388407
## Vertical coordinate
@@ -402,7 +421,10 @@ this section of the config file. The function
402421
`minLevelCell`, `maxLevelCell`, `cellMask`, `layerThickness`, `zMid`,
403422
and `restingThickness` variables for {ref}`ocean-z-level` and
404423
{ref}`ocean-z-star` coordinates using the `ssh` and `bottomDepth` as well
405-
as config options from `vertical_grid`.
424+
as config options from `vertical_grid`. The function
425+
{py:func}`polaris.ocean.vertical.update_layer_thickness` can be used to update
426+
`layerThickness` when either or both of `bottomDepth` and `ssh` have been
427+
changed.
406428

407429
(dev-ocean-rpe)=
408430

docs/developers_guide/ocean/tasks/correlated_tracers_2d.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ of convergence.
1313
## framework
1414

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

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

2525
### base_mesh
2626

docs/developers_guide/ocean/tasks/divergent_2d.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ model config options related to drag and default horizontal and
2020
vertical momentum and tracer diffusion, as well as defining `mesh`, `input`,
2121
`restart`, and `output` streams. This file has Jinja templating that is
2222
used to update model config options based on Polaris config options, see
23-
{ref}`dev-ocean-spherical-convergence`.
23+
{ref}`dev-ocean-convergence`.
2424

2525
### base_mesh
2626

docs/developers_guide/ocean/tasks/geostrophic.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ in {ref}`ocean-geostrophic-init` in the User's Guide.
3535
The class {py:class}`polaris.ocean.tasks.geostrophic.forward.Forward`
3636
descends from {py:class}`polaris.ocean.convergence.spherical.SphericalConvergenceForward`,
3737
and defines a step for running MPAS-Ocean from an initial condition produced in
38-
an `init` step. See {ref}`dev-ocean-spherical-convergence` for some relevant
38+
an `init` step. See {ref}`dev-ocean-convergence` for some relevant
3939
discussion of the parent class. The time step is determined from the resolution
4040
based on the `dt_per_km` config option in the `[spherical_convergences]`
4141
section. Other model config options are taken from `forward.yaml`.
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
(dev-ocean-ice-shelf-2d)=
2+
3+
# ice_shelf_2d
4+
5+
The `ice_shelf_2d` test group
6+
(`polaris.ocean.tasks.ice_shelf_2d.IceShelf2d`)
7+
implements a very simplified ice-shelf cavity that is invariant in the x
8+
direction (see {ref}`ocean-ice-shelf-2d`). Here, we describe the shared
9+
framework for this test group and the 2 test cases.
10+
11+
(dev-ocean-ice-shelf-2d-framework)=
12+
13+
## framework
14+
15+
The shared config options for the `ice_shelf_2d` test group
16+
are described in {ref}`ocean-ice-shelf-2d` in the User's Guide.
17+
18+
Additionally, the test group has shared `ssh_forward.yaml` and `forward.yaml`
19+
files with common namelist options and streams related to the `ssh_adjustment`
20+
and `forward` steps, respectively.
21+
22+
The test case class is inherited from
23+
{py:class}`polaris.ocean.ice_shelf.IceShelfTask` and
24+
its {py:class}`polaris.ocean.ice_shelf.ssh_forward.SshForward` and
25+
{py:class}`polaris.ocean.ice_shelf.ssh_adjustment.SshAdjustment` step classes
26+
are used to set up one of each step for each iteration given by the config
27+
option `ssh_adjustment:iterations`.
28+
29+
### init
30+
31+
The class :py:class:`polaris.ocean.tasks.ice_shelf_2d.init.Init`
32+
defines a step for setting up the initial state for each test case.
33+
34+
First, a mesh appropriate for the resolution is generated using
35+
{py:func}`mpas_tools.planar_hex.make_planar_hex_mesh()`. Then, the mesh is
36+
culled to remove periodicity in the y direction. A vertical grid is generated,
37+
with 20 layers of 100-m thickness each by default. Then, the 1D grid is either
38+
"squashed" down so the sea-surface height corresponds to the location of the
39+
ice-ocean interface (ice draft) using a z-star {ref}`dev-ocean-framework-vertical`
40+
or top layers are removed where there is an ice shelf using a z-level
41+
coordinate. Finally, the initial salinity profile is computed along with
42+
uniform temperature and zero initial velocity.
43+
44+
### forward
45+
46+
The class {py:class}`compass.ocean.tests.ice_shelf_2d.forward.Forward`
47+
defines a step for running MPAS-Ocean from the initial condition produced in
48+
the `init` step. For MPAS-Ocean, PIO namelist options are modified and a
49+
graph partition is generated as part of `runtime_setup()`. Next, the ocean
50+
model is run.
51+
52+
### validate
53+
54+
The class {py:class}`polaris.ocean.tasks.ice_shelf_2d.validate.Validate`
55+
defines a step for validating outputs in two step directories against one
56+
another. This step ensures that `temperature`, `salinity`, `layerThickness`
57+
and `normalVelocity` are identical in `output.nc` files in the two steps.
58+
It also checks a number of land ice variables and frazil variables stored in
59+
`land_ice_fluxes.nc` and `frazil.nc`, respectively. This step is used by the
60+
restart test (see {ref}`dev-ocean-ice-shelf-2d-restart`).
61+
62+
### viz
63+
64+
The class {py:class}`polaris.ocean.tasks.ice_shelf_2d.viz.Viz` uses the planar
65+
visualization capabilities provided by
66+
{py:func}`polaris.ocean.viz.compute_transect()`.
67+
68+
(dev-ocean-ice-shelf-2d-default)=
69+
70+
## default
71+
72+
The {py:class}`polaris.ocean.tasks.ice_shelf_2d.default.Default` test case
73+
config options are described in {ref}`ocean-ice-shelf-2d-default`.
74+
75+
The test creates and mesh and initial condition, performs 15 iterations of
76+
SSH adjustment to make sure the SSH is as close as possible to being in
77+
dynamic balance with the land-ice pressure. Then, it performs a 10-minute
78+
forward simulation. If a baseline is provided, a large number of variables
79+
(both prognostic and related to land-ice fluxes) are checked to make sure
80+
they match the baseline.
81+
82+
The restart test, `ocean/planar/ice_shelf_2d/$RES/$COORD_TYPE/default/with_restart`
83+
is just a variant of the default test that has two additional steps, a `forward`
84+
step and a `validate` step.
85+
86+
The tidal forcing test, `ocean/planar/ice_shelf_2d/$RES/$COORD_TYPE/default_tidal_forcing`
87+
is a variant of the `default` test that has tidal forcing, is run for longer
88+
(0.1 days), and uses the RK4 time integration scheme by default.

docs/developers_guide/ocean/tasks/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ correlated_tracers_2d
1010
cosine_bell
1111
geostrophic
1212
divergent_2d
13+
ice_shelf_2d
1314
inertial_gravity_wave
1415
internal_wave
1516
manufactured_solution

docs/developers_guide/ocean/tasks/nondivergent_2d.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ model config options related to drag and default horizontal and
2020
vertical momentum and tracer diffusion, as well as defining `mesh`, `input`,
2121
`restart`, and `output` streams. This file has Jinja templating that is
2222
used to update model config options based on Polaris config options, see
23-
{ref}`dev-ocean-spherical-convergence`.
23+
{ref}`dev-ocean-convergence`.
2424

2525
### base_mesh
2626

docs/developers_guide/ocean/tasks/rotation_2d.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ model config options related to drag and default horizontal and
2020
vertical momentum and tracer diffusion, as well as defining `mesh`, `input`,
2121
`restart`, and `output` streams. This file has Jinja templating that is
2222
used to update model config options based on Polaris config options, see
23-
{ref}`dev-ocean-spherical-convergence`.
23+
{ref}`dev-ocean-convergence`.
2424

2525
### base_mesh
2626

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
(ocean-ice-shelf)=
2+
3+
# Ice shelf
4+
5+
The framework defines an `IceShelfTask` class that provides methods common
6+
to tasks that feature ice shelf cavities. At present, the only method included
7+
sets up ssh adjustment steps, described in ocean-ssh-adjustment.
8+
9+
(ocean-ssh-adjustment)=
10+
11+
## SSH adjustment steps
12+
13+
For tasks that feature ice shelf cavities, a series of forward simulations is
14+
run in order to iteratively bring the SSH in equilibrium with the land ice
15+
pressure. These steps are typically shared between all tasksthat also share
16+
initial conditions and namelist options that influence the dynamics. Only the
17+
output from the final SSH adjustment step is used as the initial state for the
18+
forward step(s) of the task.
19+
20+
### config options
21+
22+
The following config options are used by SSH adjustment steps. The defaults are
23+
shown here, but may be changed in a task's local config file.
24+
25+
```cfg
26+
# Options related to ssh adjustment steps
27+
[ssh_adjustment]
28+
29+
# Number of ssh adjustment iterations
30+
iterations = 10
31+
32+
# Output interval for the ssh adjustment phase in hours
33+
output_interval = 1.0
34+
35+
# Run duration of each ssh adjustment phase in hours
36+
run_duration = 1.0
37+
38+
# Variable in init.nc that determines where to adjust SSH
39+
mask_variable = adjustSSHMask
40+
41+
# Whether to adjust land ice pressure or SSH
42+
adjust_variable = landIcePressure
43+
44+
# Time integration scheme
45+
time_integrator = split_explicit
46+
47+
# Time step in seconds as a function of resolution
48+
rk4_dt_per_km = 6
49+
50+
# Time step in seconds as a function of resolution
51+
split_dt_per_km = 6
52+
53+
# Time step in seconds as a function of resolution
54+
btr_dt_per_km = 1
55+
```

docs/users_guide/ocean/framework/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@ across tasks.
99
:titlesonly: true
1010
1111
vertical
12+
ice_shelf
1213
```

0 commit comments

Comments
 (0)