Skip to content

Commit

Permalink
Add humboldt fct tests
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
trhille committed Jun 29, 2023
1 parent 7367056 commit 458c8f1
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 30 deletions.
36 changes: 21 additions & 15 deletions compass/landice/tests/humboldt/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
from compass.testgroup import TestGroup
from compass.landice.tests.humboldt.decomposition_test import DecompositionTest
from compass.landice.tests.humboldt.mesh_gen import MeshGen
from compass.landice.tests.humboldt.decomposition_test \
import DecompositionTest
from compass.landice.tests.humboldt.restart_test import RestartTest
from compass.testgroup import TestGroup


class Humboldt(TestGroup):
Expand All @@ -23,32 +22,37 @@ def __init__(self, mpas_core):
mesh_type = '1km'
for velo_solver in ['FO']:
self.add_test_case(
DecompositionTest(test_group=self,
velo_solver=velo_solver,
calving_law='none',
mesh_type=mesh_type))
DecompositionTest(test_group=self,
velo_solver=velo_solver,
calving_law='none',
mesh_type=mesh_type,
advection_type='fo'))
self.add_test_case(
RestartTest(test_group=self,
velo_solver=velo_solver,
calving_law='none',
mesh_type=mesh_type))
RestartTest(test_group=self,
velo_solver=velo_solver,
calving_law='none',
mesh_type=mesh_type,
advection_type='fo'))

# Set up 'full physics' tests using the 3km mesh
mesh_type = '3km'
for velo_solver in ['FO', 'none']:
self.add_test_case(
for advection_type in ['fo', 'fct']:
self.add_test_case(
DecompositionTest(test_group=self,
velo_solver=velo_solver,
calving_law='von_Mises_stress',
mesh_type=mesh_type,
advection_type=advection_type,
damage='threshold',
face_melt=True))

self.add_test_case(
self.add_test_case(
RestartTest(test_group=self,
velo_solver=velo_solver,
calving_law='von_Mises_stress',
mesh_type=mesh_type,
advection_type=advection_type,
damage='threshold',
face_melt=True))

Expand All @@ -68,10 +72,12 @@ def __init__(self, mpas_core):
DecompositionTest(test_group=self,
velo_solver=velo_solver,
calving_law=calving_law,
mesh_type=mesh_type))
mesh_type=mesh_type,
advection_type='fo'))

self.add_test_case(
RestartTest(test_group=self,
velo_solver=velo_solver,
calving_law=calving_law,
mesh_type=mesh_type))
mesh_type=mesh_type,
advection_type='fo'))
31 changes: 21 additions & 10 deletions compass/landice/tests/humboldt/decomposition_test/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class DecompositionTest(TestCase):
"""

def __init__(self, test_group, velo_solver, calving_law, mesh_type,
damage=None, face_melt=False):
advection_type, damage=None, face_melt=False):
"""
Create the test case
Expand All @@ -52,6 +52,9 @@ def __init__(self, test_group, velo_solver, calving_law, mesh_type,
mesh_type : {'1km', '3km'}
The resolution or type of mesh of the test case
advection_type : {'fo', 'fct'}
The type of advection to use for thickness and tracers
damage : str
The damage method used for the test case
Expand All @@ -61,15 +64,17 @@ def __init__(self, test_group, velo_solver, calving_law, mesh_type,
name = 'decomposition_test'
self.mesh_type = mesh_type
self.velo_solver = velo_solver
self.advection_type = advection_type
assert self.velo_solver in {'sia', 'FO', 'none'}, \
"Value of velo_solver must be one of {'sia', 'FO', 'none'}"
self.calving_law = calving_law
self.damage = damage
self.face_melt = face_melt

# build dir name. always include velo solver and calving law
subdir = 'mesh-{}_decomposition_test/velo-{}_calving-{}'.format(
mesh_type, velo_solver.lower(), calving_law.lower())
subdir = 'mesh-{}_decomposition_test/velo-{}_advec-{}_calving-{}'.format( # noqa
mesh_type, velo_solver.lower(),
advection_type, calving_law.lower())
# append damage and facemelt if provided
if damage is not None:
subdir += '_damage-{}'.format(damage)
Expand All @@ -84,13 +89,19 @@ def __init__(self, test_group, velo_solver, calving_law, mesh_type,
self.proc_list = [1, 32]
for procs in self.proc_list:
name = '{}proc_run'.format(procs)
self.add_step(
RunModel(test_case=self, name=name, subdir=name, ntasks=procs,
openmp_threads=1, velo_solver=self.velo_solver,
calving_law=self.calving_law,
damage=self.damage,
face_melt=self.face_melt,
mesh_type=mesh_type))
step = RunModel(test_case=self, name=name, subdir=name,
ntasks=procs, openmp_threads=1,
velo_solver=self.velo_solver,
calving_law=self.calving_law,
damage=self.damage,
face_melt=self.face_melt,
mesh_type=mesh_type)
if advection_type == 'fct':
step.add_namelist_options(
{'config_thickness_advection': "'fct'",
'config_tracer_advection': "'fct'"},
out_name='namelist.landice')
self.add_step(step)

# no configure() method is needed

Expand Down
30 changes: 25 additions & 5 deletions compass/landice/tests/humboldt/restart_test/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from compass.validate import compare_variables
from compass.testcase import TestCase
from compass.landice.tests.humboldt.run_model import RunModel
from compass.testcase import TestCase
from compass.validate import compare_variables


class RestartTest(TestCase):
Expand All @@ -25,7 +25,7 @@ class RestartTest(TestCase):
"""

def __init__(self, test_group, velo_solver, calving_law, mesh_type,
damage=None, face_melt=False):
advection_type, damage=None, face_melt=False):
"""
Create the test case
Expand All @@ -43,6 +43,9 @@ def __init__(self, test_group, velo_solver, calving_law, mesh_type,
mesh_type : {'1km', '3km'}
The resolution or type of mesh of the test case
advection_type : {'fo', 'fct'}
The type of advection to use for thickness and tracers
damage : str
The damage method used for the test case
Expand All @@ -52,15 +55,17 @@ def __init__(self, test_group, velo_solver, calving_law, mesh_type,
name = 'restart_test'
self.mesh_type = mesh_type
self.velo_solver = velo_solver
self.advection_type = advection_type
assert self.velo_solver in {'sia', 'FO', 'none'}, \
"Value of velo_solver must be one of {'sia', 'FO', 'none'}"
self.calving_law = calving_law
self.damage = damage
self.face_melt = face_melt

# build dir name. always include velo solver and calving law
subdir = 'mesh-{}_restart_test/velo-{}_calving-{}'.format(
mesh_type, velo_solver.lower(), calving_law.lower())
subdir = 'mesh-{}_restart_test/velo-{}_advec-{}_calving-{}'.format(
mesh_type, velo_solver.lower(), advection_type,
calving_law.lower())
# append damage and facemelt if provided
if damage is not None:
subdir += '_damage-{}'.format(damage)
Expand All @@ -80,6 +85,11 @@ def __init__(self, test_group, velo_solver, calving_law, mesh_type,
step.add_namelist_file(
'compass.landice.tests.humboldt.restart_test',
'namelist.full', out_name='namelist.landice')
if advection_type == 'fct':
step.add_namelist_options(
{'config_thickness_advection': "'fct'",
'config_tracer_advection': "'fct'"},
out_name='namelist.landice')
step.add_streams_file(
'compass.landice.tests.humboldt.restart_test',
'streams.full', out_name='streams.landice')
Expand All @@ -98,13 +108,23 @@ def __init__(self, test_group, velo_solver, calving_law, mesh_type,
step.add_namelist_file(
'compass.landice.tests.humboldt.restart_test',
'namelist.restart', out_name='namelist.landice')
if advection_type == 'fct':
step.add_namelist_options(
{'config_thickness_advection': "'fct'",
'config_tracer_advection': "'fct'"},
out_name='namelist.landice')
step.add_streams_file(
'compass.landice.tests.humboldt.restart_test',
'streams.restart', out_name='streams.landice')

step.add_namelist_file(
'compass.landice.tests.humboldt.restart_test',
'namelist.restart.rst', out_name='namelist.landice.rst')
if advection_type == 'fct':
step.add_namelist_options(
{'config_thickness_advection': "'fct'",
'config_tracer_advection': "'fct'"},
out_name='namelist.landice.rst')
step.add_streams_file(
'compass.landice.tests.humboldt.restart_test',
'streams.restart.rst', out_name='streams.landice.rst')
Expand Down

0 comments on commit 458c8f1

Please sign in to comment.