Skip to content

Commit 458c8f1

Browse files
committed
Add humboldt fct tests
Add 3km fct full physics tests for humboldt. Note that the decomposition tests do not pass validation, but testing shows that they also fail using fo advection.
1 parent 7367056 commit 458c8f1

File tree

3 files changed

+67
-30
lines changed

3 files changed

+67
-30
lines changed

compass/landice/tests/humboldt/__init__.py

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
from compass.testgroup import TestGroup
1+
from compass.landice.tests.humboldt.decomposition_test import DecompositionTest
22
from compass.landice.tests.humboldt.mesh_gen import MeshGen
3-
from compass.landice.tests.humboldt.decomposition_test \
4-
import DecompositionTest
53
from compass.landice.tests.humboldt.restart_test import RestartTest
4+
from compass.testgroup import TestGroup
65

76

87
class Humboldt(TestGroup):
@@ -23,32 +22,37 @@ def __init__(self, mpas_core):
2322
mesh_type = '1km'
2423
for velo_solver in ['FO']:
2524
self.add_test_case(
26-
DecompositionTest(test_group=self,
27-
velo_solver=velo_solver,
28-
calving_law='none',
29-
mesh_type=mesh_type))
25+
DecompositionTest(test_group=self,
26+
velo_solver=velo_solver,
27+
calving_law='none',
28+
mesh_type=mesh_type,
29+
advection_type='fo'))
3030
self.add_test_case(
31-
RestartTest(test_group=self,
32-
velo_solver=velo_solver,
33-
calving_law='none',
34-
mesh_type=mesh_type))
31+
RestartTest(test_group=self,
32+
velo_solver=velo_solver,
33+
calving_law='none',
34+
mesh_type=mesh_type,
35+
advection_type='fo'))
3536

3637
# Set up 'full physics' tests using the 3km mesh
3738
mesh_type = '3km'
3839
for velo_solver in ['FO', 'none']:
39-
self.add_test_case(
40+
for advection_type in ['fo', 'fct']:
41+
self.add_test_case(
4042
DecompositionTest(test_group=self,
4143
velo_solver=velo_solver,
4244
calving_law='von_Mises_stress',
4345
mesh_type=mesh_type,
46+
advection_type=advection_type,
4447
damage='threshold',
4548
face_melt=True))
4649

47-
self.add_test_case(
50+
self.add_test_case(
4851
RestartTest(test_group=self,
4952
velo_solver=velo_solver,
5053
calving_law='von_Mises_stress',
5154
mesh_type=mesh_type,
55+
advection_type=advection_type,
5256
damage='threshold',
5357
face_melt=True))
5458

@@ -68,10 +72,12 @@ def __init__(self, mpas_core):
6872
DecompositionTest(test_group=self,
6973
velo_solver=velo_solver,
7074
calving_law=calving_law,
71-
mesh_type=mesh_type))
75+
mesh_type=mesh_type,
76+
advection_type='fo'))
7277

7378
self.add_test_case(
7479
RestartTest(test_group=self,
7580
velo_solver=velo_solver,
7681
calving_law=calving_law,
77-
mesh_type=mesh_type))
82+
mesh_type=mesh_type,
83+
advection_type='fo'))

compass/landice/tests/humboldt/decomposition_test/__init__.py

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class DecompositionTest(TestCase):
3434
"""
3535

3636
def __init__(self, test_group, velo_solver, calving_law, mesh_type,
37-
damage=None, face_melt=False):
37+
advection_type, damage=None, face_melt=False):
3838
"""
3939
Create the test case
4040
@@ -52,6 +52,9 @@ def __init__(self, test_group, velo_solver, calving_law, mesh_type,
5252
mesh_type : {'1km', '3km'}
5353
The resolution or type of mesh of the test case
5454
55+
advection_type : {'fo', 'fct'}
56+
The type of advection to use for thickness and tracers
57+
5558
damage : str
5659
The damage method used for the test case
5760
@@ -61,15 +64,17 @@ def __init__(self, test_group, velo_solver, calving_law, mesh_type,
6164
name = 'decomposition_test'
6265
self.mesh_type = mesh_type
6366
self.velo_solver = velo_solver
67+
self.advection_type = advection_type
6468
assert self.velo_solver in {'sia', 'FO', 'none'}, \
6569
"Value of velo_solver must be one of {'sia', 'FO', 'none'}"
6670
self.calving_law = calving_law
6771
self.damage = damage
6872
self.face_melt = face_melt
6973

7074
# build dir name. always include velo solver and calving law
71-
subdir = 'mesh-{}_decomposition_test/velo-{}_calving-{}'.format(
72-
mesh_type, velo_solver.lower(), calving_law.lower())
75+
subdir = 'mesh-{}_decomposition_test/velo-{}_advec-{}_calving-{}'.format( # noqa
76+
mesh_type, velo_solver.lower(),
77+
advection_type, calving_law.lower())
7378
# append damage and facemelt if provided
7479
if damage is not None:
7580
subdir += '_damage-{}'.format(damage)
@@ -84,13 +89,19 @@ def __init__(self, test_group, velo_solver, calving_law, mesh_type,
8489
self.proc_list = [1, 32]
8590
for procs in self.proc_list:
8691
name = '{}proc_run'.format(procs)
87-
self.add_step(
88-
RunModel(test_case=self, name=name, subdir=name, ntasks=procs,
89-
openmp_threads=1, velo_solver=self.velo_solver,
90-
calving_law=self.calving_law,
91-
damage=self.damage,
92-
face_melt=self.face_melt,
93-
mesh_type=mesh_type))
92+
step = RunModel(test_case=self, name=name, subdir=name,
93+
ntasks=procs, openmp_threads=1,
94+
velo_solver=self.velo_solver,
95+
calving_law=self.calving_law,
96+
damage=self.damage,
97+
face_melt=self.face_melt,
98+
mesh_type=mesh_type)
99+
if advection_type == 'fct':
100+
step.add_namelist_options(
101+
{'config_thickness_advection': "'fct'",
102+
'config_tracer_advection': "'fct'"},
103+
out_name='namelist.landice')
104+
self.add_step(step)
94105

95106
# no configure() method is needed
96107

compass/landice/tests/humboldt/restart_test/__init__.py

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
from compass.validate import compare_variables
2-
from compass.testcase import TestCase
31
from compass.landice.tests.humboldt.run_model import RunModel
2+
from compass.testcase import TestCase
3+
from compass.validate import compare_variables
44

55

66
class RestartTest(TestCase):
@@ -25,7 +25,7 @@ class RestartTest(TestCase):
2525
"""
2626

2727
def __init__(self, test_group, velo_solver, calving_law, mesh_type,
28-
damage=None, face_melt=False):
28+
advection_type, damage=None, face_melt=False):
2929
"""
3030
Create the test case
3131
@@ -43,6 +43,9 @@ def __init__(self, test_group, velo_solver, calving_law, mesh_type,
4343
mesh_type : {'1km', '3km'}
4444
The resolution or type of mesh of the test case
4545
46+
advection_type : {'fo', 'fct'}
47+
The type of advection to use for thickness and tracers
48+
4649
damage : str
4750
The damage method used for the test case
4851
@@ -52,15 +55,17 @@ def __init__(self, test_group, velo_solver, calving_law, mesh_type,
5255
name = 'restart_test'
5356
self.mesh_type = mesh_type
5457
self.velo_solver = velo_solver
58+
self.advection_type = advection_type
5559
assert self.velo_solver in {'sia', 'FO', 'none'}, \
5660
"Value of velo_solver must be one of {'sia', 'FO', 'none'}"
5761
self.calving_law = calving_law
5862
self.damage = damage
5963
self.face_melt = face_melt
6064

6165
# build dir name. always include velo solver and calving law
62-
subdir = 'mesh-{}_restart_test/velo-{}_calving-{}'.format(
63-
mesh_type, velo_solver.lower(), calving_law.lower())
66+
subdir = 'mesh-{}_restart_test/velo-{}_advec-{}_calving-{}'.format(
67+
mesh_type, velo_solver.lower(), advection_type,
68+
calving_law.lower())
6469
# append damage and facemelt if provided
6570
if damage is not None:
6671
subdir += '_damage-{}'.format(damage)
@@ -80,6 +85,11 @@ def __init__(self, test_group, velo_solver, calving_law, mesh_type,
8085
step.add_namelist_file(
8186
'compass.landice.tests.humboldt.restart_test',
8287
'namelist.full', out_name='namelist.landice')
88+
if advection_type == 'fct':
89+
step.add_namelist_options(
90+
{'config_thickness_advection': "'fct'",
91+
'config_tracer_advection': "'fct'"},
92+
out_name='namelist.landice')
8393
step.add_streams_file(
8494
'compass.landice.tests.humboldt.restart_test',
8595
'streams.full', out_name='streams.landice')
@@ -98,13 +108,23 @@ def __init__(self, test_group, velo_solver, calving_law, mesh_type,
98108
step.add_namelist_file(
99109
'compass.landice.tests.humboldt.restart_test',
100110
'namelist.restart', out_name='namelist.landice')
111+
if advection_type == 'fct':
112+
step.add_namelist_options(
113+
{'config_thickness_advection': "'fct'",
114+
'config_tracer_advection': "'fct'"},
115+
out_name='namelist.landice')
101116
step.add_streams_file(
102117
'compass.landice.tests.humboldt.restart_test',
103118
'streams.restart', out_name='streams.landice')
104119

105120
step.add_namelist_file(
106121
'compass.landice.tests.humboldt.restart_test',
107122
'namelist.restart.rst', out_name='namelist.landice.rst')
123+
if advection_type == 'fct':
124+
step.add_namelist_options(
125+
{'config_thickness_advection': "'fct'",
126+
'config_tracer_advection': "'fct'"},
127+
out_name='namelist.landice.rst')
108128
step.add_streams_file(
109129
'compass.landice.tests.humboldt.restart_test',
110130
'streams.restart.rst', out_name='streams.landice.rst')

0 commit comments

Comments
 (0)