8000 Improve hydro_radial test cases by matthewhoffman · Pull Request #811 · MPAS-Dev/compass · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Improve hydro_radial test cases #811

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

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from compass.validate import compare_variables
from compass.testcase import TestCase
from compass.landice.tests.hydro_radial.setup_mesh import SetupMesh
from compass.landice.tests.hydro_radial.run_model import RunModel
from compass.landice.tests.hydro_radial.setup_mesh import SetupMesh
from compass.landice.tests.hydro_radial.visualize import Visualize
from compass.testcase import TestCase
from compass.validate import compare_variables


class DecompositionTest(TestCase):
Expand All @@ -24,7 +24,7 @@ def __init__(self, test_group):
super().__init__(test_group=test_group, name='decomposition_test')

self.add_step(
SetupMesh(test_case=self, initial_condition='zero'))
SetupMesh(test_case=self, initial_condition='exact'))

for procs in [1, 3]:
name = '{}proc_run'.format(procs)
Expand All @@ -36,7 +36,7 @@ def __init__(self, test_group):
name = 'visualize_{}'.format(name)
step = Visualize(test_case=self, name=name, subdir=name,
input_dir=input_dir)
self.add_step(step, run_by_default=False)
self.add_step(step)

# no configure() method is needed

Expand Down
3 changes: 2 additions & 1 deletion compass/landice/tests/hydro_radial/namelist.landice
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
config_dt = '0001-00-00_00:00:00'
config_dt = '0000-01-00_00:00:00'
config_start_time = '0001-01-01_00:00:00'
config_stop_time = '0001-02-01_00:00:00'
config_block_decomp_file_prefix = 'graph.info.part.'
config_velocity_solver = 'none'
Expand Down
20 changes: 10 additions & 10 deletions compass/landice/tests/hydro_radial/restart_test/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from compass.validate import compare_variables
from compass.testcase import TestCase
from compass.landice.tests.hydro_radial.setup_mesh import SetupMesh
from compass.landice.tests.hydro_radial.run_model import RunModel
from compass.landice.tests.hydro_radial.setup_mesh import SetupMesh
from compass.landice.tests.hydro_radial.visualize import Visualize
from compass.testcase import TestCase
from compass.validate import compare_variables


class RestartTest(TestCase):
Expand All @@ -25,11 +25,11 @@ def __init__(self, test_group):
super().__init__(test_group=test_group, name='restart_test')

self.add_step(
SetupMesh(test_case=self, initial_condition='zero'))
SetupMesh(test_case=self, initial_condition='exact'))

name = 'full_run'
step = RunModel(test_case=self, name=name, subdir=name, ntasks=4,
openmp_threads=1)
step = RunModel(test_case=self, name=name, subdir=name, ntasks=128,
min_tasks=1, openmp_threads=1)
# modify the namelist options and streams file
step.add_namelist_file(
'compass.landice.tests.hydro_radial.restart_test',
Expand All @@ -43,11 +43,11 @@ def __init__(self, test_group):
name = 'visualize_{}'.format(name)
step = Visualize(test_case=self, name=name, subdir=name,
input_dir=input_dir)
self.add_step(step, run_by_default=False)
self.add_step(step, run_by_default=True)

name = 'restart_run'
step = RunModel(test_case=self, name=name, subdir=name, ntasks=4,
openmp_threads=1,
step = RunModel(test_case=self, name=name, subdir=name, ntasks=128,
min_tasks=1, openmp_threads=1,
suffixes=['landice', 'landice.rst'])

# modify the namelist options and streams file
Expand All @@ -70,7 +70,7 @@ def __init__(self, test_group):
name = 'visualize_{}'.format(name)
step = Visualize(test_case=self, name=name, subdir=name,
input_dir=input_dir)
self.add_step(step, run_by_default=False)
self.add_step(step, run_by_default=True)

# no configure() method is needed

Expand Down
4 changes: 2 additions & 2 deletions compass/landice/tests/hydro_radial/restart_test/namelist.full
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
config_dt = '0000-01-00_00:00:00'
config_start_time = '0001-01-01_00:00:00'
config_stop_time = '0003-01-01_00:00:00'
config_run_duration = 'none'
config_stop_time = '0001-03-01_00:00:00'
config_write_output_on_startup = .true.
config_do_restart = .false.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
config_dt = '0000-01-00_00:00:00'
config_start_time = '0001-01-01_00:00:00'
config_stop_time = '0003-01-01_00:00:00'
config_run_duration = 'none'
config_stop_time = '0001-02-01_00:00:00'
config_write_output_on_startup = .true.
config_do_restart = .false.
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
config_start_time = '0002-01-01_00:00:00'
config_stop_time = '0003-01-01_00:00:00'
config_dt = '0000-01-00_00:00:00'
config_start_time = '0001-02-01_00:00:00'
config_stop_time = '0001-03-01_00:00:00'
config_write_output_on_startup = .true.
config_do_restart = .true.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<streams>

<immutable_stream name="restart"
output_interval="0001-00-00_00:00:00"/>
output_interval="0000-01-00_00:00:00"/>

</streams>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<streams>

<immutable_stream name="restart"
output_interval="0001-00-00_00:00:00"/>
output_interval="0000-01-00_00:00:00"/>

</streams>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<streams>

<immutable_stream name="restart"
output_interval="0001-00-00_00:00:00"/>
output_interval="0000-01-00_00:00:00"/>

<stream name="output"
clobber_mode="overwrite">
Expand Down
9 changes: 5 additions & 4 deletions compass/landice/tests/hydro_radial/spinup_test/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from compass.testcase import TestCase
from compass.landice.tests.hydro_radial.setup_mesh import SetupMesh
from compass.landice.tests.hydro_radial.run_model import RunModel
from compass.landice.tests.hydro_radial.setup_mesh import SetupMesh
from compass.landice.tests.hydro_radial.visualize import Visualize
from compass.testcase import TestCase


class SpinupTest(TestCase):
Expand All @@ -24,7 +24,8 @@ def __init__(self, test_group):

self.add_step(
SetupMesh(test_case=self, initial_condition='zero'))
step = RunModel(test_case=self, ntasks=4, openmp_threads=1)
step = RunModel(test_case=self, ntasks=128, min_tasks=1,
openmp_threads=1)
step.add_namelist_file(
'compass.landice.tests.hydro_radial.spinup_test',
'namelist.landice')
Expand All @@ -35,7 +36,7 @@ def __init__(self, test_group):
self.add_step(step)

step = Visualize(test_case=self)
self.add_step(step, run_by_default=False)
self.add_step(step)

# no configure() method is needed

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from compass.testcase import TestCase
from compass.landice.tests.hydro_radial.setup_mesh import SetupMesh
from compass.landice.tests.hydro_radial.run_model import RunModel
from compass.landice.tests.hydro_radial.setup_mesh import SetupMesh
from compass.landice.tests.hydro_radial.visualize import Visualize
from compass.testcase import TestCase


class SteadyStateDriftTest(TestCase):
Expand All @@ -24,9 +24,10 @@ def __init__(self, test_group):
self.add_step(
SetupMesh(test_case=self, initial_condition='exact'))
self.add_step(
RunModel(test_case=self, ntasks=4, openmp_threads=1))
RunModel(test_case=self, ntasks=128, min_tasks=1,
openmp_threads=1))
step = Visualize(test_case=self)
self.add_step(step, run_by_default=False)
self.add_step(step)

# no configure() method is needed

Expand Down
2 changes: 1 addition & 1 deletion compass/landice/tests/hydro_radial/streams.landice
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<immutable_stream name="restart"
type="input;output"
filename_template="restart.$Y.nc"
filename_template="restart.$Y-$M-$D.nc"
filename_interval="output_interval"
output_interval="1000-00-00_00:00:00"
clobber_mode="truncate"
Expand Down
14 changes: 7 additions & 7 deletions compass/landice/tests/hydro_radial/visualize.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import numpy as np
import netCDF4
import matplotlib.pyplot as plt
import netCDF4
import numpy as np

from compass.step import Step

Expand Down Expand Up @@ -138,7 +138,7 @@ def visualize_hydro_radial(config, logger):
plt.plot([5.0, 5.0], [0.0, 45.0], ':k')
plt.grid(True)
if save_images:
plt.savefig('hydro_radial_vs_exact.png', dpi=150)
plt.savefig('hydro_radial_vs_exact.png', dpi=250)

# plot how close to SS we are
fig = plt.figure(2, facecolor='w')
Expand All @@ -157,7 +157,7 @@ def visualize_hydro_radial(config, logger):
plt.grid(True)

if save_images:
plt.savefig('hydro_radial_steady_state.png', dpi=150)
plt.savefig('hydro_radial_steady_state.png', dpi=250)

# plot opening/closing rates
fig = plt.figure(3, facecolor='w')
Expand Down Expand Up @@ -201,7 +201,7 @@ def visualize_hydro_radial(config, logger):
plt.grid(True)

if save_images:
plt.savefig('hydro_radial_opening_closing.png', dpi=150)
plt.savefig('hydro_radial_opening_closing.png', dpi=250)

# plot some edge quantities
inde = np.nonzero(yEdge[:] == centerY)
Expand Down Expand Up @@ -258,7 +258,7 @@ def visualize_hydro_radial(config, logger):
dx = dcEdge.mean()

if save_images:
plt.savefig('hydro_radial_edge.png', dpi=150)
plt.savefig('hydro_radial_edge.png', dpi=250)

fig = plt.figure(6, facecolor='w')

Expand Down Expand Up @@ -288,7 +288,7 @@ def visualize_hydro_radial(config, logger):

plt.draw()
if save_images:
plt.savefig('hydro_radial_error.png', dpi=150)
plt.savefig('hydro_radial_error.png', dpi=250)

if hide_figs:
logger.info("Plot display disabled with hide_plot config option.")
Expand Down
16 changes: 5 additions & 11 deletions docs/developers_guide/landice/test_groups/hydro_radial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ hydro_radial

The ``hydro_radial`` test group (:py:class:`compass.landice.tests.hydro_radial.HydroRadial`)
implements variants of the radially symmetric hydrological test case at 1-km
uniform resolution and 3 vertical layers (see :ref:`landice_hydro_radial`).
uniform resolution (see :ref:`landice_hydro_radial`).
Here, we describe the shared framework for this test group and the 4 test
cases.

Expand Down Expand Up @@ -36,7 +36,8 @@ to partition the mesh before the model run.

Finally, the initial condition is defined in the private function
``_setup_hydro_radial_initial_conditions()``. Most test cases use a
``zero`` initial condition (meaning a very thin initial ice sheet), but the
``zero`` initial condition (meaning a very thin initial water thickness),
but the
``steady_state_drift_test`` uses an ``exact`` initial condition that uses
a nearly exact numerical solution in steady state, as described in
`Bueler et al. (2015) <https://doi.org/10.5194/gmd-8-1613-2015>`_.
Expand All @@ -60,13 +61,6 @@ is optional in each test case and can be run manually to plot the results of
the test case. It iscontrol by the config options in the ``hydro_radial_viz``
section.

This step is not run by default by adding it with ``run_by_default=False``:

.. code-block:: python

step = Visualize(test_case=self)
self.add_step(step, run_by_default=False)

.. _dev_landice_hydro_radial_spinup_test:

spinup_test
Expand Down Expand Up @@ -103,8 +97,8 @@ restart_test
------------

The :py:class:`compass.landice.tests.hydro_radial.restart_test.RestartTest`
performs a 2-year run once on 4 cores, then a sequence of 2 1-year runs on 4
cores. It ensures that ``waterThickness`` and ``waterPressure`` are identical
performs a 2-month run once, then a sequence of 2 1-month runs.
It ensures that ``waterThickness`` and ``waterPressure`` are identical
at the end of the two runs (as well as with a baseline if one is provided when
calling :ref:`dev_compass_setup`).

Expand Down
40 changes: 27 additions & 13 deletions docs/users_guide/landice/test_groups/hydro_radial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,19 @@ hydro_radial

The ``landice/hydro_radial`` test group implements variants of the
radially symmetric hydrological test case from
`Bueler et al. (2015) <https://doi.org/10.5194/gmd-8-1613-2015>`_.
`Bueler and van Pelt (2015) <https://doi.org/10.5194/gmd-8-1613-2015>`_.
The test case uses semi-analytic solutions for water depth and water
pressure for an ice sheet with prescribed ice thickness and sliding speed.

The domain is approximately rectangular with a radially symmetric ice sheet
at its center. The mesh has 1-km horizontal resolution and 3 vertical layers.
<<<Further description here>>>
.. figure:: images/hydro_radial_vs_exact.png
:width: 800 px
:align: center

Profiles of modeled water depth (W) and water pressure (P_w)
compared to the semi-exact solution of Bueler and van Pelt (2015)

<<<Exmaple image here>>>
The domain is approximately rectangular with a radially symmetric ice sheet
at its center. The mesh has 1-km horizontal resolution.

The test group includes 4 test cases. All test cases are made up of 3
types of steps, ``setup_mesh``, which defines the mesh and initial conditions
Expand Down Expand Up @@ -58,29 +64,37 @@ spinup_test
-----------

``landice/hydro_radial/spinup_test`` performs a 10,000-year spin-up run from
"zero" (a very thin ice sheet) to quasi-steady state.
"zero" (a very thin ice initial water layer) to quasi-steady state.
This takes about 10 minutes on 128 processors (1 cpu node) on Perlmutter.

steady_state_drift_test
-----------------------

``landice/hydro_radial/steady_state_drift_test`` performs a 1-month run,
starting from the "exact" (that is, a nearly exact steady-state solution) as
the initial condition.
the initial condition. The model drift away from the initialized exact
solution can be used as a metric of model error. See figure 3 in
Hoffman, Matthew J., et al. 2018. “MPAS-Albany Land Ice (MALI):
A Variable-Resolution Ice Sheet Model for Earth System Modeling Using
Voronoi Grids.” Geoscientific Model Development 11 (9):
3747–80. https://doi.org/10.5194/gmd-11-3747-2018.


decomposition_test
------------------

``landice/hydro_radial/decomposition_test`` runs short (1-month) integrations
of the model forward in time on 1 (``1proc_run`` step) and then on 3 cores
``landice/hydro_radial/decomposition_test`` runs the steady state drift
test on 1 (``1proc_run`` step) and then on 3 cores
(``3proc_run`` step) to make sure the resulting prognostic variables are
bit-for-bit identical between the two runs.

restart_test
------------

``landice/hydro_radial/restart_test`` first run a 2-year integration of the
``landice/hydro_radial/restart_test`` first run a 2-month integration of the
model forward in time (``full_run`` step). Then, a second step
(``restart_run``) performs 2 1-year runs, where the second begins from a
(``restart_run``) performs 2 1-month runs, where the second begins from a
restart file saved by the first. Prognostic variables are compared between the
"full" and "restart" runs at year 2 to make sure they are bit-for-bit
identical.
"full" and "restart" runs at the end of 2 months to make sure they are bit-for-bit
identical. This test is set up as in the steady_state_drift_test and
decomposition_test but runs for a total of two months instead of one.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
0