-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #756 from trhille/landice/add_crane_glacier_mesh
Add Crane Glacier mesh generation This merge adds a Crane Glacier test group with a mesh generation test case.
- Loading branch information
Showing
13 changed files
with
305 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"type": "FeatureCollection", | ||
"name": "crane", | ||
"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } }, | ||
"features": [ | ||
{ "type": "Feature", "properties": { "name": "Crane", "tags": "Crane", "object": "region", "component": "landice", "author": "https://nsidc.org/data/nsidc-0709/versions/2" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -62.711133639719051, -65.201690711497449 ], [ -62.670350055324924, -65.222528990830909 ], [ -62.603459729541953, -65.242580535851928 ], [ -62.572933915847166, -65.263459838062047 ], [ -62.5447479615612, -65.280135328846143 ], [ -62.526497752286581, -65.28953644693928 ], [ -62.505122164004312, -65.302192318858971 ], [ -62.485513843643858, -65.307365058584693 ], [ -62.456050254898265, -65.306845472030545 ], [ -62.416719886631014, -65.301407479922261 ], [ -62.325208704931725, -65.295492600965616 ], [ -62.335693172886117, -65.281896177745708 ], [ -62.317445266252619, -65.267199412520284 ], [ -62.298527185097853, -65.256186534513901 ], [ -62.270881390790265, -65.25997099550591 ], [ -62.243281563118522, -65.273087823873411 ], [ -62.224460224612052, -65.281283149356511 ], [ -62.207546873139194, -65.287430270161053 ], [ -62.190867321049865, -65.293903404053424 ], [ -62.156665341547331, -65.292936788753778 ], [ -62.098387196049593, -65.288693547437447 ], [ -62.007252795520166, -65.281089453867637 ], [ -62.018859863281264, -65.375587463378082 ], [ -62.016600511940915, -65.379978412162856 ], [ -62.077136087381596, -65.380590210127849 ], [ -62.145699215470813, -65.372818470998254 ], [ -62.167281294498281, -65.375205553640882 ], [ -62.222861066440238, -65.371647482909793 ], [ -62.291680881779712, -65.372550024011389 ], [ -62.345048311349345, -65.367675194569742 ], [ -62.390573553751047, -65.370527255810515 ], [ -62.461664445041194, -65.389161881004426 ], [ -62.514312160790922, -65.402953390636739 ], [ -62.56636193602624, -65.414222755333114 ], [ -62.659506325283054, -65.431956710379481 ], [ -62.737637116748708, -65.454237931998676 ], [ -62.805918071586682, -65.482698633184754 ], [ -62.811183455537751, -65.484889234346724 ], [ -62.867708260649586, -65.511061365188823 ], [ -62.885804488291811, -65.542376342806179 ], [ -62.886691630407086, -65.569250665285935 ], [ -62.890670180308163, -65.576005754891469 ], [ -62.89831926564306, -65.588982307100196 ], [ -62.900773458184162, -65.589992247734628 ], [ -62.929764097326832, -65.601912856045203 ], [ -63.002567564209123, -65.629035378321959 ], [ -63.126602388643924, -65.631554288838103 ], [ -63.236318220802865, -65.63019217813239 ], [ -63.303819000409725, -65.599646937653191 ], [ -63.34925965578536, -65.569997824340518 ], [ -63.365154289162966, -65.55375966578741 ], [ -63.385548345064301, -65.53767854182712 ], [ -63.388604133476498, -65.516436113569014 ], [ -63.322626984854296, -65.457362380394201 ], [ -63.293553165044756, -65.420795970865555 ], [ -63.263005675425205, -65.393281566591043 ], [ -63.22118042805085, -65.379796313503746 ], [ -63.189035571735126, -65.375371224505727 ], [ -63.092184036117075, -65.343941847844178 ], [ -63.057623964387204, -65.307638195868762 ], [ -62.98940255786006, -65.283710009963457 ], [ -62.912046122160845, -65.275008725259099 ], [ -62.889459667642733, -65.25213604170456 ], [ -62.861455853629565, -65.239849619201379 ], [ -62.848620556551481, -65.21727944406112 ], [ -62.711133639719051, -65.201690711497449 ] ] ] } } | ||
] | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from compass.landice.tests.crane.mesh_gen import MeshGen | ||
from compass.testgroup import TestGroup | ||
|
||
|
||
class Crane(TestGroup): | ||
""" | ||
A test group for Crane Glacier test cases. | ||
""" | ||
def __init__(self, mpas_core): | ||
""" | ||
mpas_core : compass.landice.Landice | ||
the MPAS core that this test group belongs to | ||
""" | ||
super().__init__(mpas_core=mpas_core, name='crane') | ||
|
||
self.add_test_case(MeshGen(test_group=self)) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
from compass.landice.mesh import build_cell_width, build_mali_mesh | ||
from compass.model import make_graph_file | ||
from compass.step import Step | ||
|
||
|
||
class Mesh(Step): | ||
""" | ||
A step for creating a mesh and initial condition for thwaites test cases | ||
""" | ||
def __init__(self, test_case): | ||
""" | ||
Create the step | ||
Parameters | ||
---------- | ||
test_case : compass.TestCase | ||
The test case this step belongs to | ||
""" | ||
super().__init__(test_case=test_case, name='mesh', cpus_per_task=128, | ||
min_cpus_per_task=1) | ||
|
||
self.add_output_file(filename='graph.info') | ||
self.add_output_file(filename='Crane.nc') | ||
self.add_input_file(filename='antarctica_8km_2024_01_29.nc', | ||
target='antarctica_8km_2024_01_29.nc', | ||
database='') | ||
self.add_input_file(filename='Crane.geojson', | ||
package='compass.landice.tests.crane', | ||
target='Crane.geojson', | ||
database=None) | ||
self.add_input_file(filename='antarctica_1km_2024_01_29_AP.nc', | ||
target='antarctica_1km_2024_01_29_AP.nc', | ||
database='') | ||
|
||
# no setup() method is needed | ||
|
||
def run(self): | ||
""" | ||
Run this step of the test case | ||
""" | ||
logger = self.logger | ||
mesh_name = 'Crane.nc' | ||
section_name = 'mesh' | ||
|
||
logger.info('calling build_cell_width') | ||
cell_width, x1, y1, geom_points, geom_edges, floodMask = \ | ||
build_cell_width( | ||
self, section_name=section_name, | ||
gridded_dataset='antarctica_8km_2024_01_29.nc') | ||
|
||
build_mali_mesh( | ||
self, cell_width, x1, y1, geom_points, geom_edges, | ||
mesh_name=mesh_name, section_name=section_name, | ||
gridded_dataset='antarctica_1km_2024_01_29_AP.nc', | ||
projection='ais-bedmap2', geojson_file='Crane.geojson', | ||
cores=self.cpus_per_task) | ||
|
||
logger.info('creating graph.info') | ||
make_graph_file(mesh_filename=mesh_name, | ||
graph_filename='graph.info') |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
from compass.landice.tests.crane.mesh import Mesh | ||
from compass.testcase import TestCase | ||
from compass.validate import compare_variables | ||
|
||
|
||
class MeshGen(TestCase): | ||
""" | ||
The high resolution test case for the crane test | ||
group simply creates the mesh and initial condition. | ||
The basal friction optimization occurs separately, | ||
outside of COMPASS. | ||
""" | ||
|
||
def __init__(self, test_group): | ||
""" | ||
Create the test case | ||
Parameters | ||
---------- | ||
test_group : compass.landice.tests.crane.Crane | ||
The test group that this test case belongs to | ||
""" | ||
name = 'mesh_gen' | ||
subdir = name | ||
super().__init__(test_group=test_group, name=name, | ||
subdir=subdir) | ||
|
||
self.add_step( | ||
Mesh(test_case=self)) | ||
|
||
def validate(self): | ||
""" | ||
Compare ``thickness``, ``bedTopography``, ``iceMask`` and | ||
``beta`` with a baseline if one was provided. | ||
""" | ||
variables = ['thickness', 'bedTopography', 'iceMask', | ||
'beta'] | ||
compare_variables(test_case=self, variables=variables, | ||
filename1='mesh/Crane.nc') |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# config options for mesh_gen test case | ||
[mesh] | ||
|
||
# number of levels in the mesh | ||
levels = 10 | ||
|
||
# Bounds of Crane regional mesh | ||
x_min = -2.442e6 | ||
x_max = -2.246e6 | ||
y_min = 1.124e6 | ||
y_max = 1.334e6 | ||
|
||
# distance from ice margin to cull (km). | ||
# Set to a value <= 0 if you do not want | ||
# to cull based on distance from margin. | ||
cull_distance = -1.0 | ||
|
||
# mesh density parameters | ||
# minimum cell spacing (meters) | ||
min_spac = 5.e2 | ||
# maximum cell spacing (meters) | ||
max_spac = 1.e3 | ||
# log10 of max speed for cell spacing | ||
high_log_speed = 2.5 | ||
# log10 of min speed for cell spacing | ||
low_log_speed = 0.75 | ||
# distance at which cell spacing = max_spac | ||
high_dist = 1.e5 | ||
# distance within which cell spacing = min_spac | ||
low_dist = 5.e4 | ||
|
||
# mesh density parameters used if use_bed = True | ||
# These settings are taken from the Humboldt mesh | ||
# and have not yet been evaluated for Crane. | ||
# distance at which bed topography has no effect | ||
high_dist_bed = 1.e5 | ||
# distance within which bed topography has maximum effect | ||
low_dist_bed = 5.e4 | ||
# Bed elev beneath which cell spacing is minimized | ||
low_bed = 50.0 | ||
# Bed elev above which cell spacing is maximized | ||
high_bed = 100.0 | ||
|
||
# mesh density functions | ||
use_speed = True | ||
use_dist_to_grounding_line = True | ||
use_dist_to_edge = False | ||
use_bed = False |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
.. _dev_landice_crane: | ||
|
||
crane | ||
============= | ||
|
||
The ``crane`` test group (:py:class:`compass.landice.tests.crane.Crane`) | ||
creates a variable resolution (default 500 m - 1 km) mesh for a regional domain of Crane Glacier | ||
(see :ref:`landice_crane`). | ||
|
||
.. _dev_landice_crane_framework: | ||
|
||
framework | ||
--------- | ||
|
||
The shared config options for the ``crane`` test group are described | ||
in :ref:`landice_crane` in the User's Guide. | ||
|
||
mesh | ||
~~~~ | ||
|
||
The class :py:class:`compass.landice.tests.crane.mesh.Mesh` | ||
defines a step for creating a variable resolution Crane Glacier mesh. | ||
This is used by the ``mesh_gen`` test case. | ||
|
||
mesh_gen | ||
-------- | ||
|
||
The :py:class:`compass.landice.tests.crane.mesh_gen.MeshGen` | ||
calls the :py:class:`compass.landice.tests.crane.mesh.Mesh` to create | ||
the variable resolution Crane Glacier mesh. |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
.. _landice_crane: | ||
|
||
crane | ||
============= | ||
|
||
The ``landice/crane`` test group includes a test case for creating a | ||
mesh for Crane Glacier, Antarctica. The optimization for basal friction | ||
happens outside of COMPASS because it requires expert usage and takes a | ||
larger amount of computing resources than COMPASS is typically run with. | ||
|
||
.. figure:: images/crane_500mto1km.png | ||
:width: 777 px | ||
:align: center | ||
|
||
Bed topography in meters above sea level on Crane 500m-1km mesh. | ||
|
||
The test group includes a single test case that creates the variable resolution mesh. | ||
|
||
config options | ||
-------------- | ||
|
||
The test group uses the following default config options. At this point only | ||
the mesh generation options are adjusted through the config file. | ||
|
||
.. code-block:: cfg | ||
# config options for mesh_gen test case | ||
[mesh] | ||
# number of levels in the mesh | ||
levels = 10 | ||
# Bounds of Crane regional mesh | ||
x_min = -2.442e6 | ||
x_max = -2.246e6 | ||
y_min = 1.124e6 | ||
y_max = 1.334e6 | ||
# distance from ice margin to cull (km). | ||
# Set to a value <= 0 if you do not want | ||
# to cull based on distance from margin. | ||
cull_distance = -1.0 | ||
# mesh density parameters | ||
# minimum cell spacing (meters) | ||
min_spac = 5.e2 | ||
# maximum cell spacing (meters) | ||
max_spac = 1.e3 | ||
# log10 of max speed for cell spacing | ||
high_log_speed = 2.5 | ||
# log10 of min speed for cell spacing | ||
low_log_speed = 0.75 | ||
# distance at which cell spacing = max_spac | ||
high_dist = 1.e5 | ||
# distance within which cell spacing = min_spac | ||
low_dist = 5.e4 | ||
# mesh density parameters used if use_bed = True | ||
# These settings are taken from the Humboldt mesh | ||
# and have not yet been evaluated for Crane. | ||
# distance at which bed topography has no effect | ||
high_dist_bed = 1.e5 | ||
# distance within which bed topography has maximum effect | ||
low_dist_bed = 5.e4 | ||
# Bed elev beneath which cell spacing is minimized | ||
low_bed = 50.0 | ||
# Bed elev above which cell spacing is maximized | ||
high_bed = 100.0 | ||
# mesh density functions | ||
use_speed = True | ||
use_dist_to_grounding_line = True | ||
use_dist_to_edge = False | ||
use_bed = False | ||
mesh_gen | ||
-------- | ||
|
||
``landice/crane/default`` creates a variable resolution mesh. | ||
The default is 500m-1km resolution with mesh density determined by | ||
observed ice speed and distance to grounding line. There is no model | ||
integration step. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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