Skip to content

Commit 1e1ac50

Browse files
authored
Merge pull request #774 from irenavankova/add-FRIS-meshes
Add FRIS meshes
2 parents 4130abc + ca1bb44 commit 1e1ac50

File tree

68 files changed

+4738
-9
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+4738
-9
lines changed

compass/ocean/tests/global_ocean/__init__.py

+5
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ def __init__(self, mpas_core):
5353
# Kuroshio meshes without ice-shelf cavities
5454
self._add_tests(mesh_names=['Kuroshio12to60', 'Kuroshio8to60'])
5555

56+
self._add_tests(mesh_names=['FRISwISC01to60'])
57+
self._add_tests(mesh_names=['FRISwISC02to60'])
58+
self._add_tests(mesh_names=['FRISwISC04to60'])
59+
self._add_tests(mesh_names=['FRISwISC08to60'])
60+
5661
# A test case for making E3SM support files from an existing mesh
5762
self.add_test_case(FilesForE3SM(test_group=self))
5863

compass/ocean/tests/global_ocean/mesh/__init__.py

+12
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
from compass.ocean.mesh.remap_topography import RemapTopography
77
from compass.ocean.tests.global_ocean.mesh.arrm10to60 import ARRM10to60BaseMesh
88
from compass.ocean.tests.global_ocean.mesh.ec30to60 import EC30to60BaseMesh
9+
from compass.ocean.tests.global_ocean.mesh.fris01to60 import FRIS01to60BaseMesh
10+
from compass.ocean.tests.global_ocean.mesh.fris02to60 import FRIS02to60BaseMesh
11+
from compass.ocean.tests.global_ocean.mesh.fris04to60 import FRIS04to60BaseMesh
12+
from compass.ocean.tests.global_ocean.mesh.fris08to60 import FRIS08to60BaseMesh
913
from compass.ocean.tests.global_ocean.mesh.kuroshio import KuroshioBaseMesh
1014
from compass.ocean.tests.global_ocean.mesh.qu import (
1115
IcosMeshFromConfigStep,
@@ -96,6 +100,14 @@ def __init__(self, test_group, mesh_name, high_res_topography):
96100
base_mesh_step = RRS6to18BaseMesh(self, name=name, subdir=subdir)
97101
elif mesh_name in ['SO12to60', 'SOwISC12to60']:
98102
base_mesh_step = SO12to60BaseMesh(self, name=name, subdir=subdir)
103+
elif mesh_name in ['FRIS01to60', 'FRISwISC01to60']:
104+
base_mesh_step = FRIS01to60BaseMesh(self, name=name, subdir=subdir)
105+
elif mesh_name in ['FRIS02to60', 'FRISwISC02to60']:
106+
base_mesh_step = FRIS02to60BaseMesh(self, name=name, subdir=subdir)
107+
elif mesh_name in ['FRIS04to60', 'FRISwISC04to60']:
108+
base_mesh_step = FRIS04to60BaseMesh(self, name=name, subdir=subdir)
109+
elif mesh_name in ['FRIS08to60', 'FRISwISC08to60']:
110+
base_mesh_step = FRIS08to60BaseMesh(self, name=name, subdir=subdir)
99111
elif mesh_name.startswith('Kuroshio'):
100112
base_mesh_step = KuroshioBaseMesh(self, name=name, subdir=subdir)
101113
elif mesh_name in ['WC14', 'WCwISC14']:

compass/ocean/tests/global_ocean/mesh/ec30to60/__init__.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import numpy as np
21
import mpas_tools.mesh.creation.mesh_definition_tools as mdt
2+
import numpy as np
33

44
from compass.mesh import QuasiUniformSphericalMeshStep
55

@@ -28,8 +28,8 @@ def build_cell_width_lat_lon(self):
2828

2929
dlon = 10.
3030
dlat = 0.1
31-
nlon = int(360./dlon) + 1
32-
nlat = int(180./dlat) + 1
31+
nlon = int(360. / dlon) + 1
32+
nlat = int(180. / dlat) + 1
3333
lon = np.linspace(-180., 180., nlon)
3434
lat = np.linspace(-90., 90., nlat)
3535

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,203 @@
1+
import mpas_tools.mesh.creation.mesh_definition_tools as mdt
2+
import numpy as np
3+
from geometric_features import read_feature_collection
4+
from mpas_tools.cime.constants import constants
5+
from mpas_tools.mesh.creation.signed_distance import (
6+
signed_distance_from_geojson,
7+
)
8+
9+
from compass.mesh import QuasiUniformSphericalMeshStep
10+
11+
12+
class FRIS01to60BaseMesh(QuasiUniformSphericalMeshStep):
13+
"""
14+
A step for creating SO12to60 meshes
15+
"""
16+
def setup(self):
17+
"""
18+
Add some input files
19+
"""
20+
21+
self.add_input_file(filename='atlantic.geojson',
22+
package=self.__module__)
23+
24+
self.add_input_file(filename='high_res_region.geojson',
25+
package=self.__module__)
26+
27+
self.add_input_file(filename='fris_v1_transition.geojson',
28+
package=self.__module__)
29+
30+
self.add_input_file(filename='fris_v1_peninsula_12km_v2.geojson',
31+
package=self.__module__)
32+
33+
self.add_input_file(
34+
filename='fris_v1_peninsula_12km_transition.geojson',
35+
package=self.__module__)
36+
37+
self.add_input_file(filename='fris_v1.geojson',
38+
package=self.__module__)
39+
40+
super().setup()
41+
42+
def build_cell_width_lat_lon(self):
43+
"""
44+
Create cell width array for this mesh on a regular latitude-longitude
45+
grid
46+
47+
Returns
48+
-------
49+
cellWidth : numpy.array
50+
m x n array of cell width in km
51+
52+
lon : numpy.array
53+
longitude in degrees (length n and between -180 and 180)
54+
55+
lat : numpy.array
56+
longitude in degrees (length m and between -90 and 90)
57+
"""
58+
59+
dlon = 0.1
60+
dlat = dlon
61+
earth_radius = constants['SHR_CONST_REARTH']
62+
nlon = int(360. / dlon) + 1
63+
nlat = int(180. / dlat) + 1
64+
lon = np.linspace(-180., 180., nlon)
65+
lat = np.linspace(-90., 90., nlat)
66+
67+
cellWidthSouth = mdt.EC_CellWidthVsLat(lat, cellWidthEq=30.,
68+
cellWidthMidLat=45.,
69+
cellWidthPole=45.,
70+
latPosEq=7.5, latWidthEq=3.0)
71+
72+
cellWidthNorth = mdt.EC_CellWidthVsLat(lat, cellWidthEq=30.,
73+
cellWidthMidLat=60.,
74+
cellWidthPole=35.,
75+
latPosEq=7.5, latWidthEq=3.0)
76+
77+
# Transition at Equator
78+
latTransition = 0.0
79+
latWidthTransition = 2.5
80+
cellWidthVsLat = mdt.mergeCellWidthVsLat(
81+
lat,
82+
cellWidthSouth,
83+
cellWidthNorth,
84+
latTransition,
85+
latWidthTransition)
86+
87+
_, cellWidth = np.meshgrid(lon, cellWidthVsLat)
88+
89+
cellWidthAtlantic = mdt.EC_CellWidthVsLat(lat, cellWidthEq=30.,
90+
cellWidthMidLat=30.,
91+
cellWidthPole=35.,
92+
latPosEq=7.5, latWidthEq=3.0)
93+
94+
cellWidthAtlantic = mdt.mergeCellWidthVsLat(
95+
lat,
96+
cellWidthSouth,
97+
cellWidthAtlantic,
98+
latTransition,
99+
latWidthTransition)
100+
101+
_, cellWidthAtlantic = np.meshgrid(lon, cellWidthAtlantic)
102+
103+
fc = read_feature_collection('atlantic.geojson')
104+
105+
atlantic_signed_distance = signed_distance_from_geojson(
106+
fc, lon, lat, earth_radius, max_length=0.25)
107+
108+
trans_width = 400e3
109+
trans_start = 0.
110+
weights = 0.5 * (1 + np.tanh((atlantic_signed_distance - trans_start) /
111+
trans_width))
112+
113+
cellWidth = cellWidthAtlantic * (1 - weights) + cellWidth * weights
114+
115+
fc = read_feature_collection('high_res_region.geojson')
116+
117+
so_signed_distance = signed_distance_from_geojson(fc, lon, lat,
118+
earth_radius,
119+
max_length=0.25)
120+
121+
# Equivalent to 20 degrees latitude
122+
trans_width = 1600e3
123+
trans_start = 500e3
124+
dx_min = 12.
125+
126+
weights = 0.5 * (1 + np.tanh((so_signed_distance - trans_start) /
127+
trans_width))
128+
129+
cellWidth = dx_min * (1 - weights) + cellWidth * weights
130+
131+
# Add high res FRIS region transition
132+
dx_min_fris = 1. # minimum resolution within the FRIS cavity
133+
134+
fc = read_feature_collection('fris_v1_transition.geojson')
135+
136+
so_signed_distance = signed_distance_from_geojson(fc, lon, lat,
137+
earth_radius,
138+
max_length=0.25)
139+
140+
# Equivalent to 600 km
141+
trans_width = 600e3
142+
trans_start = 0
143+
dx_min = dx_min_fris
144+
145+
weights = 0.5 * (1 + np.tanh((so_signed_distance - trans_start) /
146+
trans_width))
147+
148+
cellWidth = dx_min * (1 - weights) + cellWidth * weights
149+
150+
# Add 12 km sharp correction west of the peninsula
151+
fc = read_feature_collection('fris_v1_peninsula_12km_v2.geojson')
152+
153+
so_signed_distance = signed_distance_from_geojson(fc, lon, lat,
154+
earth_radius,
155+
max_length=0.25)
156+
157+
# Equivalent to 10 km
158+
trans_width = 10e3
159+
trans_start = 0
160+
dx_min = 12.
161+
162+
weights = 0.5 * (1 + np.tanh((so_signed_distance - trans_start) /
163+
trans_width))
164+
165+
cellWidth = dx_min * (1 - weights) + cellWidth * weights
166+
167+
# Add 12 km transition correction west of the peninsula
168+
fc = read_feature_collection(
169+
'fris_v1_peninsula_12km_transition.geojson')
170+
171+
so_signed_distance = signed_distance_from_geojson(fc, lon, lat,
172+
earth_radius,
173+
max_length=0.25)
174+
175+
# Equivalent to 150 km
176+
trans_width = 150e3
177+
trans_start = 0
178+
dx_min = 12.
179+
180+
weights = 0.5 * (1 + np.tanh((so_signed_distance - trans_start) /
181+
trans_width))
182+
183+
cellWidth = dx_min * (1 - weights) + cellWidth * weights
184+
185+
# Add high res FRIS region inner
186+
fc = read_feature_collection('fris_v1.geojson')
187+
188+
so_signed_distance = signed_distance_from_geojson(fc, lon, lat,
189+
earth_radius,
190+
max_length=0.25)
191+
192+
# Equivalent to 100 km (0 should be enough given the setup but to be
193+
# safe)
194+
trans_width = 100e3
195+
trans_start = 0
196+
dx_min = dx_min_fris
197+
198+
weights = 0.5 * (1 + np.tanh((so_signed_distance - trans_start) /
199+
trans_width))
200+
201+
cellWidth = dx_min * (1 - weights) + cellWidth * weights
202+
203+
return cellWidth, lon, lat
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
{
2+
"type": "FeatureCollection",
3+
"features": [
4+
{
5+
"type": "Feature",
6+
"properties": {
7+
"name": "Atlantic region",
8+
"component": "ocean",
9+
"object": "region",
10+
"author": "Xylar Asay-Davis"
11+
},
12+
"geometry": {
13+
"type": "Polygon",
14+
"coordinates": [
15+
[
16+
[
17+
-97.3828125,
18+
85.05112877979998
19+
],
20+
[
21+
-102.3046875,
22+
40.17887331434696
23+
],
24+
[
25+
-102.3046875,
26+
23.241346102386135
27+
],
28+
[
29+
-93.1640625,
30+
15.623036831528264
31+
],
32+
[
33+
-85.78125,
34+
13.581920900545844
35+
],
36+
[
37+
-83.583984375,
38+
9.535748998133627
39+
],
40+
[
41+
-81.2109375,
42+
8.059229627200192
43+
],
44+
[
45+
-79.013671875,
46+
9.795677582829743
47+
],
48+
[
49+
-75.9375,
50+
5.61598581915534
51+
],
52+
[
53+
-77.6953125,
54+
0
55+
],
56+
[
57+
16.171875,
58+
0
59+
],
60+
[
61+
27.773437499999996,
62+
26.745610382199022
63+
],
64+
[
65+
37.96875,
66+
32.24997445586331
67+
],
68+
[
69+
39.7265625,
70+
39.36827914916014
71+
],
72+
[
73+
32.6953125,
74+
53.9560855309879
75+
],
76+
[
77+
37.6171875,
78+
61.438767493682825
79+
],
80+
[
81+
25.664062500000004,
82+
68.26938680456564
83+
],
84+
[
85+
24.609375,
86+
85.05112877979998
87+
],
88+
[
89+
-97.3828125,
90+
85.05112877979998
91+
]
92+
]
93+
]
94+
}
95+
}
96+
]
97+
}

0 commit comments

Comments
 (0)