From 93d24c79067505c1497de1ae765e69cc00d18019 Mon Sep 17 00:00:00 2001 From: Trevor Hillebrand Date: Tue, 27 Jun 2023 13:15:58 -0700 Subject: [PATCH 1/7] Add new fct advection tests for dome group Add new fct advection tests for dome group --- compass/landice/tests/dome/__init__.py | 28 +++++++------ .../tests/dome/decomposition_test/__init__.py | 23 ++++++++--- .../tests/dome/restart_test/__init__.py | 39 ++++++++++++++++--- .../landice/tests/dome/smoke_test/__init__.py | 20 ++++++++-- 4 files changed, 84 insertions(+), 26 deletions(-) diff --git a/compass/landice/tests/dome/__init__.py b/compass/landice/tests/dome/__init__.py index 6eb3c68814..76d64efe49 100644 --- a/compass/landice/tests/dome/__init__.py +++ b/compass/landice/tests/dome/__init__.py @@ -1,7 +1,7 @@ -from compass.testgroup import TestGroup -from compass.landice.tests.dome.smoke_test import SmokeTest from compass.landice.tests.dome.decomposition_test import DecompositionTest from compass.landice.tests.dome.restart_test import RestartTest +from compass.landice.tests.dome.smoke_test import SmokeTest +from compass.testgroup import TestGroup class Dome(TestGroup): @@ -17,16 +17,20 @@ def __init__(self, mpas_core): for mesh_type in ['2000m', 'variable_resolution']: for velo_solver in ['sia', 'FO']: + for advection_type in ['fo', 'fct']: - self.add_test_case( - SmokeTest(test_group=self, velo_solver=velo_solver, - mesh_type=mesh_type)) + self.add_test_case( + SmokeTest(test_group=self, velo_solver=velo_solver, + mesh_type=mesh_type, + advection_type=advection_type)) - self.add_test_case( - DecompositionTest(test_group=self, - velo_solver=velo_solver, - mesh_type=mesh_type)) + self.add_test_case( + DecompositionTest(test_group=self, + velo_solver=velo_solver, + mesh_type=mesh_type, + advection_type=advection_type)) - self.add_test_case( - RestartTest(test_group=self, velo_solver=velo_solver, - mesh_type=mesh_type)) + self.add_test_case( + RestartTest(test_group=self, velo_solver=velo_solver, + mesh_type=mesh_type, + advection_type=advection_type)) diff --git a/compass/landice/tests/dome/decomposition_test/__init__.py b/compass/landice/tests/dome/decomposition_test/__init__.py index b25126dbd7..7521efc8eb 100644 --- a/compass/landice/tests/dome/decomposition_test/__init__.py +++ b/compass/landice/tests/dome/decomposition_test/__init__.py @@ -1,8 +1,8 @@ -from compass.validate import compare_variables -from compass.testcase import TestCase -from compass.landice.tests.dome.setup_mesh import SetupMesh from compass.landice.tests.dome.run_model import RunModel +from compass.landice.tests.dome.setup_mesh import SetupMesh from compass.landice.tests.dome.visualize import Visualize +from compass.testcase import TestCase +from compass.validate import compare_variables class DecompositionTest(TestCase): @@ -15,9 +15,12 @@ class DecompositionTest(TestCase): ---------- mesh_type : str The resolution or type of mesh of the test case + + advection_type : {'fo', 'fct'} + The type of advection to use for thickness and tracers """ - def __init__(self, test_group, velo_solver, mesh_type): + def __init__(self, test_group, velo_solver, mesh_type, advection_type): """ Create the test case @@ -31,11 +34,16 @@ def __init__(self, test_group, velo_solver, mesh_type): mesh_type : str The resolution or type of mesh of the test case + + advection_type : {'fo', 'fct'} + The type of advection to use for thickness and tracers """ name = 'decomposition_test' self.mesh_type = mesh_type self.velo_solver = velo_solver - subdir = '{}/{}_{}'.format(mesh_type, velo_solver.lower(), name) + self.advection_type = advection_type + subdir = '{}/{}_{}_{}'.format(mesh_type, velo_solver.lower(), + advection_type, name) super().__init__(test_group=test_group, name=name, subdir=subdir) @@ -53,6 +61,11 @@ def __init__(self, test_group, velo_solver, mesh_type): name = 'visualize_{}'.format(name) step = Visualize(test_case=self, mesh_type=mesh_type, name=name, subdir=name, input_dir=input_dir) + if advection_type == 'fct': + step.add_namelist_options( + {'config_thickness_advection': "'fct'", + 'config_tracer_advection': "'fct'"}, + out_name='namelist.landice') self.add_step(step, run_by_default=False) # no configure() method is needed diff --git a/compass/landice/tests/dome/restart_test/__init__.py b/compass/landice/tests/dome/restart_test/__init__.py index c8d908ea75..74ff14494b 100644 --- a/compass/landice/tests/dome/restart_test/__init__.py +++ b/compass/landice/tests/dome/restart_test/__init__.py @@ -1,8 +1,8 @@ -from compass.validate import compare_variables -from compass.testcase import TestCase -from compass.landice.tests.dome.setup_mesh import SetupMesh from compass.landice.tests.dome.run_model import RunModel +from compass.landice.tests.dome.setup_mesh import SetupMesh from compass.landice.tests.dome.visualize import Visualize +from compass.testcase import TestCase +from compass.validate import compare_variables class RestartTest(TestCase): @@ -15,9 +15,12 @@ class RestartTest(TestCase): ---------- mesh_type : str The resolution or type of mesh of the test case + + advection_type : {'fo', 'fct'} + The type of advection to use for thickness and tracers """ - def __init__(self, test_group, velo_solver, mesh_type): + def __init__(self, test_group, velo_solver, mesh_type, advection_type): """ Create the test case @@ -31,11 +34,16 @@ def __init__(self, test_group, velo_solver, mesh_type): mesh_type : str The resolution or type of mesh of the test case + + advection_type : {'fo', 'fct'} + The type of advection to use for thickness and tracers """ name = 'restart_test' self.mesh_type = mesh_type self.velo_solver = velo_solver - subdir = '{}/{}_{}'.format(mesh_type, velo_solver.lower(), name) + self.advection_type = advection_type + subdir = '{}/{}_{}_{}'.format(mesh_type, velo_solver.lower(), + advection_type, name) super().__init__(test_group=test_group, name=name, subdir=subdir) @@ -50,6 +58,13 @@ def __init__(self, test_group, velo_solver, mesh_type): step.add_namelist_file( 'compass.landice.tests.dome.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.dome.restart_test', 'streams.full', out_name='streams.landice') @@ -71,6 +86,13 @@ def __init__(self, test_group, velo_solver, mesh_type): step.add_namelist_file( 'compass.landice.tests.dome.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.dome.restart_test', 'streams.restart', out_name='streams.landice') @@ -78,6 +100,13 @@ def __init__(self, test_group, velo_solver, mesh_type): step.add_namelist_file( 'compass.landice.tests.dome.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.dome.restart_test', 'streams.restart.rst', out_name='streams.landice.rst') diff --git a/compass/landice/tests/dome/smoke_test/__init__.py b/compass/landice/tests/dome/smoke_test/__init__.py index e0b9afd241..29420246bf 100644 --- a/compass/landice/tests/dome/smoke_test/__init__.py +++ b/compass/landice/tests/dome/smoke_test/__init__.py @@ -1,7 +1,7 @@ -from compass.testcase import TestCase -from compass.landice.tests.dome.setup_mesh import SetupMesh from compass.landice.tests.dome.run_model import RunModel +from compass.landice.tests.dome.setup_mesh import SetupMesh from compass.landice.tests.dome.visualize import Visualize +from compass.testcase import TestCase class SmokeTest(TestCase): @@ -16,9 +16,12 @@ class SmokeTest(TestCase): velo_solver : {'sia', 'FO'} The velocity solver to use for the test case + + advection_type : {'fo', 'fct'} + The type of advection to use for thickness and tracers """ - def __init__(self, test_group, velo_solver, mesh_type): + def __init__(self, test_group, velo_solver, mesh_type, advection_type): """ Create the test case @@ -32,11 +35,16 @@ def __init__(self, test_group, velo_solver, mesh_type): mesh_type : str The resolution or type of mesh of the test case + + advection_type : {'fo', 'fct'} + The type of advection to use for thickness and tracers """ name = 'smoke_test' self.mesh_type = mesh_type self.velo_solver = velo_solver - subdir = '{}/{}_{}'.format(mesh_type, velo_solver.lower(), name) + self.advection_type = advection_type + subdir = '{}/{}_{}_{}'.format(mesh_type, velo_solver.lower(), + advection_type, name) super().__init__(test_group=test_group, name=name, subdir=subdir) @@ -49,6 +57,10 @@ def __init__(self, test_group, velo_solver, mesh_type): if velo_solver == 'sia': step.add_namelist_options( {'config_run_duration': "'0200-00-00_00:00:00'"}) + if advection_type == 'fct': + step.add_namelist_options( + {'config_thickness_advection': "'fct'", + 'config_tracer_advection': "'fct'"}) self.add_step(step) step = Visualize(test_case=self, mesh_type=mesh_type) From dc1d673071332bf2100da96c6cf888e859787227 Mon Sep 17 00:00:00 2001 From: Trevor Hillebrand Date: Wed, 28 Jun 2023 11:20:23 -0700 Subject: [PATCH 2/7] Fix dome decomposition test namelists for fct The namelist files in the run step were not being properly updated to ust fct advection. This fixes that. --- .../tests/dome/decomposition_test/__init__.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/compass/landice/tests/dome/decomposition_test/__init__.py b/compass/landice/tests/dome/decomposition_test/__init__.py index 7521efc8eb..9ad3075e56 100644 --- a/compass/landice/tests/dome/decomposition_test/__init__.py +++ b/compass/landice/tests/dome/decomposition_test/__init__.py @@ -52,20 +52,21 @@ def __init__(self, test_group, velo_solver, mesh_type, advection_type): for procs in [1, 4]: name = '{}proc_run'.format(procs) - self.add_step( - RunModel(test_case=self, name=name, subdir=name, ntasks=procs, - openmp_threads=1, velo_solver=velo_solver, - mesh_type=mesh_type)) + step = RunModel(test_case=self, name=name, subdir=name, + ntasks=procs, openmp_threads=1, + velo_solver=velo_solver, mesh_type=mesh_type) - input_dir = name - name = 'visualize_{}'.format(name) - step = Visualize(test_case=self, mesh_type=mesh_type, name=name, - subdir=name, input_dir=input_dir) if advection_type == 'fct': step.add_namelist_options( {'config_thickness_advection': "'fct'", 'config_tracer_advection': "'fct'"}, out_name='namelist.landice') + self.add_step(step) + + input_dir = name + name = 'visualize_{}'.format(name) + step = Visualize(test_case=self, mesh_type=mesh_type, name=name, + subdir=name, input_dir=input_dir) self.add_step(step, run_by_default=False) # no configure() method is needed From 9b38065c2ce700d99d0e7c79ce507953fc8ab188 Mon Sep 17 00:00:00 2001 From: Trevor Hillebrand Date: Wed, 28 Jun 2023 13:24:00 -0700 Subject: [PATCH 3/7] Add greenland fct tests --- compass/landice/tests/greenland/__init__.py | 16 +++++++----- .../greenland/decomposition_test/__init__.py | 24 +++++++++++------ .../tests/greenland/restart_test/__init__.py | 26 ++++++++++++++++--- .../tests/greenland/smoke_test/__init__.py | 19 +++++++++----- 4 files changed, 61 insertions(+), 24 deletions(-) diff --git a/compass/landice/tests/greenland/__init__.py b/compass/landice/tests/greenland/__init__.py index 500338d5ff..70d0f72a54 100644 --- a/compass/landice/tests/greenland/__init__.py +++ b/compass/landice/tests/greenland/__init__.py @@ -19,14 +19,18 @@ def __init__(self, mpas_core): super().__init__(mpas_core=mpas_core, name='greenland') for velo_solver in ['sia', 'FO']: - self.add_test_case( - SmokeTest(test_group=self, velo_solver=velo_solver)) + for advection_type in ['fo', 'fct']: + self.add_test_case( + SmokeTest(test_group=self, velo_solver=velo_solver, + advection_type=advection_type)) - self.add_test_case( - DecompositionTest(test_group=self, velo_solver=velo_solver)) + self.add_test_case( + DecompositionTest(test_group=self, velo_solver=velo_solver, + advection_type=advection_type)) - self.add_test_case( - RestartTest(test_group=self, velo_solver=velo_solver)) + self.add_test_case( + RestartTest(test_group=self, velo_solver=velo_solver, + advection_type=advection_type)) self.add_test_case( MeshGen(test_group=self)) diff --git a/compass/landice/tests/greenland/decomposition_test/__init__.py b/compass/landice/tests/greenland/decomposition_test/__init__.py index 06930965bd..04ee181be8 100644 --- a/compass/landice/tests/greenland/decomposition_test/__init__.py +++ b/compass/landice/tests/greenland/decomposition_test/__init__.py @@ -1,6 +1,6 @@ -from compass.validate import compare_variables -from compass.testcase import TestCase from compass.landice.tests.greenland.run_model import RunModel +from compass.testcase import TestCase +from compass.validate import compare_variables class DecompositionTest(TestCase): @@ -10,7 +10,7 @@ class DecompositionTest(TestCase): results of the two runs are identical. """ - def __init__(self, test_group, velo_solver): + def __init__(self, test_group, velo_solver, advection_type): """ Create the test case @@ -21,10 +21,13 @@ def __init__(self, test_group, velo_solver): velo_solver : {'sia', 'FO'} The velocity solver to use for the test case + + advection_type : {'fo', 'fct'} + The type of advection to use for thickness and tracers """ name = 'decomposition_test' self.velo_solver = velo_solver - subdir = '{}_{}'.format(velo_solver.lower(), name) + subdir = '{}_{}_{}'.format(velo_solver.lower(), advection_type, name) super().__init__(test_group=test_group, name=name, subdir=subdir) if velo_solver == 'sia': @@ -36,10 +39,15 @@ def __init__(self, test_group, velo_solver): for procs in self.cores_set: name = '{}proc_run'.format(procs) - self.add_step( - RunModel(test_case=self, velo_solver=velo_solver, name=name, - subdir=name, ntasks=procs, min_tasks=procs, - openmp_threads=1)) + step = RunModel(test_case=self, velo_solver=velo_solver, name=name, + subdir=name, ntasks=procs, min_tasks=procs, + openmp_threads=1) + 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 diff --git a/compass/landice/tests/greenland/restart_test/__init__.py b/compass/landice/tests/greenland/restart_test/__init__.py index b90e194e85..673b25a352 100644 --- a/compass/landice/tests/greenland/restart_test/__init__.py +++ b/compass/landice/tests/greenland/restart_test/__init__.py @@ -1,6 +1,6 @@ -from compass.validate import compare_variables -from compass.testcase import TestCase from compass.landice.tests.greenland.run_model import RunModel +from compass.testcase import TestCase +from compass.validate import compare_variables class RestartTest(TestCase): @@ -10,7 +10,7 @@ class RestartTest(TestCase): test case verifies that the results of the two runs are identical. """ - def __init__(self, test_group, velo_solver): + def __init__(self, test_group, velo_solver, advection_type): """ Create the test case @@ -21,9 +21,12 @@ def __init__(self, test_group, velo_solver): velo_solver : {'sia', 'FO'} The velocity solver to use for the test case + + advection_type : {'fo', 'fct'} + The type of advection to use for thickness and tracers """ name = 'restart_test' - subdir = '{}_{}'.format(velo_solver.lower(), name) + subdir = '{}_{}_{}'.format(velo_solver.lower(), advection_type, name) super().__init__(test_group=test_group, name=name, subdir=subdir) ntasks = 36 @@ -42,6 +45,11 @@ def __init__(self, test_group, velo_solver): step.add_namelist_file( 'compass.landice.tests.greenland.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.greenland.restart_test', 'streams.full', out_name='streams.landice') @@ -56,6 +64,11 @@ def __init__(self, test_group, velo_solver): step.add_namelist_file( 'compass.landice.tests.greenland.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.greenland.restart_test', 'streams.restart', out_name='streams.landice') @@ -63,6 +76,11 @@ def __init__(self, test_group, velo_solver): step.add_namelist_file( 'compass.landice.tests.greenland.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') # same streams file for both restart stages step.add_streams_file( 'compass.landice.tests.greenland.restart_test', diff --git a/compass/landice/tests/greenland/smoke_test/__init__.py b/compass/landice/tests/greenland/smoke_test/__init__.py index 7d0d49d7ca..943bfddbb7 100644 --- a/compass/landice/tests/greenland/smoke_test/__init__.py +++ b/compass/landice/tests/greenland/smoke_test/__init__.py @@ -1,5 +1,5 @@ -from compass.testcase import TestCase from compass.landice.tests.greenland.run_model import RunModel +from compass.testcase import TestCase class SmokeTest(TestCase): @@ -8,7 +8,7 @@ class SmokeTest(TestCase): mesh and initial condition, then performs a short forward run on 36 cores. """ - def __init__(self, test_group, velo_solver): + def __init__(self, test_group, velo_solver, advection_type): """ Create the test case @@ -20,9 +20,11 @@ def __init__(self, test_group, velo_solver): velo_solver : {'sia', 'FO'} The velocity solver to use for the test case + advection_type : {'fo', 'fct'} + The type of advection to use for thickness and tracers """ name = 'smoke_test' - subdir = '{}_{}'.format(velo_solver.lower(), name) + subdir = '{}_{}_{}'.format(velo_solver.lower(), advection_type, name) super().__init__(test_group=test_group, name=name, subdir=subdir) ntasks = 36 @@ -33,9 +35,14 @@ def __init__(self, test_group, velo_solver): else: raise ValueError('Unexpected velo_solver {}'.format(velo_solver)) - self.add_step( - RunModel(test_case=self, velo_solver=velo_solver, ntasks=ntasks, - min_tasks=min_tasks, openmp_threads=1)) + step = RunModel(test_case=self, velo_solver=velo_solver, ntasks=ntasks, + min_tasks=min_tasks, openmp_threads=1) + 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 because we will use the default dome # config options From 48f491357c2b0f301703e10764514d6b30d47bc4 Mon Sep 17 00:00:00 2001 From: Trevor Hillebrand Date: Wed, 28 Jun 2023 15:52:08 -0700 Subject: [PATCH 4/7] Add thwaites fct tests --- compass/landice/tests/thwaites/__init__.py | 25 +++++++++++++------ .../thwaites/decomposition_test/__init__.py | 21 ++++++++++------ .../tests/thwaites/restart_test/__init__.py | 22 +++++++++++++--- 3 files changed, 49 insertions(+), 19 deletions(-) diff --git a/compass/landice/tests/thwaites/__init__.py b/compass/landice/tests/thwaites/__init__.py index 1e0274bf0a..d0ebf0d9be 100644 --- a/compass/landice/tests/thwaites/__init__.py +++ b/compass/landice/tests/thwaites/__init__.py @@ -16,14 +16,23 @@ def __init__(self, mpas_core): """ super().__init__(mpas_core=mpas_core, name='thwaites') - self.add_test_case(DecompositionTest(test_group=self, - depth_integrated=False)) - self.add_test_case(DecompositionTest(test_group=self, - depth_integrated=True)) + for advection_type in ['fo', 'fct']: + self.add_test_case(DecompositionTest( + test_group=self, + advection_type=advection_type, + depth_integrated=False)) + self.add_test_case(DecompositionTest( + test_group=self, + advection_type=advection_type, + depth_integrated=True)) - self.add_test_case(RestartTest(test_group=self, - depth_integrated=False)) - self.add_test_case(RestartTest(test_group=self, - depth_integrated=True)) + self.add_test_case(RestartTest( + test_group=self, + advection_type=advection_type, + depth_integrated=False)) + self.add_test_case(RestartTest( + test_group=self, + advection_type=advection_type, + depth_integrated=True)) self.add_test_case(MeshGen(test_group=self)) diff --git a/compass/landice/tests/thwaites/decomposition_test/__init__.py b/compass/landice/tests/thwaites/decomposition_test/__init__.py index 22d4419133..8a2cc30f75 100644 --- a/compass/landice/tests/thwaites/decomposition_test/__init__.py +++ b/compass/landice/tests/thwaites/decomposition_test/__init__.py @@ -10,7 +10,7 @@ class DecompositionTest(TestCase): results of the two runs are identical. """ - def __init__(self, test_group, depth_integrated=False): + def __init__(self, test_group, advection_type, depth_integrated=False): """ Create the test case @@ -24,21 +24,26 @@ def __init__(self, test_group, depth_integrated=False): """ if depth_integrated is True: - name = 'fo-depthInt_decomposition_test' + name_tmp = 'fo-depthInt_decomposition_test' else: - name = 'fo_decomposition_test' + name_tmp = 'fo_decomposition_test' + name = f'{advection_type}_{name_tmp}' super().__init__(test_group=test_group, name=name) self.cores_set = [16, 32] for procs in self.cores_set: name = '{}proc_run'.format(procs) - self.add_step( - RunModel(test_case=self, name=name, - depth_integrated=depth_integrated, - ntasks=procs, min_tasks=procs, openmp_threads=1)) - + step = RunModel(test_case=self, name=name, + depth_integrated=depth_integrated, + ntasks=procs, min_tasks=procs, openmp_threads=1) + 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 # no run() method is needed diff --git a/compass/landice/tests/thwaites/restart_test/__init__.py b/compass/landice/tests/thwaites/restart_test/__init__.py index 9195804438..742ab0386d 100644 --- a/compass/landice/tests/thwaites/restart_test/__init__.py +++ b/compass/landice/tests/thwaites/restart_test/__init__.py @@ -10,7 +10,7 @@ class RestartTest(TestCase): test case verifies that the results of the two runs are identical. """ - def __init__(self, test_group, depth_integrated=False): + def __init__(self, test_group, advection_type, depth_integrated=False): """ Create the test case @@ -25,10 +25,11 @@ def __init__(self, test_group, depth_integrated=False): """ if depth_integrated is True: - name = 'fo-depthInt_restart_test' + name_tmp = 'fo-depthInt_restart_test' else: - name = 'fo_restart_test' + name_tmp = 'fo_restart_test' + name = f'{advection_type}_{name_tmp}' super().__init__(test_group=test_group, name=name) ntasks = 36 @@ -42,6 +43,11 @@ def __init__(self, test_group, depth_integrated=False): step.add_namelist_file( 'compass.landice.tests.thwaites.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.thwaites.restart_test', 'streams.full', out_name='streams.landice') @@ -57,6 +63,11 @@ def __init__(self, test_group, depth_integrated=False): step.add_namelist_file( 'compass.landice.tests.thwaites.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.thwaites.restart_test', 'streams.restart', out_name='streams.landice') @@ -64,6 +75,11 @@ def __init__(self, test_group, depth_integrated=False): step.add_namelist_file( 'compass.landice.tests.thwaites.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') # same streams file for both restart stages step.add_streams_file( 'compass.landice.tests.thwaites.restart_test', From 2e577a9fcb6d84259501ca78f398b6829d8d82ac Mon Sep 17 00:00:00 2001 From: Trevor Hillebrand Date: Thu, 29 Jun 2023 11:17:34 -0700 Subject: [PATCH 5/7] 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. --- compass/landice/tests/humboldt/__init__.py | 80 +++++++++++-------- .../humboldt/decomposition_test/__init__.py | 23 ++++-- .../tests/humboldt/restart_test/__init__.py | 27 ++++++- 3 files changed, 85 insertions(+), 45 deletions(-) diff --git a/compass/landice/tests/humboldt/__init__.py b/compass/landice/tests/humboldt/__init__.py index 294345340e..b850ae889e 100644 --- a/compass/landice/tests/humboldt/__init__.py +++ b/compass/landice/tests/humboldt/__init__.py @@ -25,50 +25,58 @@ def __init__(self, mpas_core): DecompositionTest(test_group=self, velo_solver=velo_solver, calving_law='none', - 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='none', - mesh_type=mesh_type)) + 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( - DecompositionTest(test_group=self, - velo_solver=velo_solver, - calving_law='von_Mises_stress', - mesh_type=mesh_type, - damage='threshold', - face_melt=True)) + 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( - RestartTest(test_group=self, - velo_solver=velo_solver, - calving_law='von_Mises_stress', - mesh_type=mesh_type, - damage='threshold', - face_melt=True)) + 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)) for velo_solver in ['FO']: - self.add_test_case( - DecompositionTest(test_group=self, - velo_solver=velo_solver, - calving_law='von_Mises_stress', - mesh_type=mesh_type, - damage='threshold', - face_melt=True, - depth_integrated=True)) + 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, + depth_integrated=True)) - self.add_test_case( - RestartTest(test_group=self, - velo_solver=velo_solver, - calving_law='von_Mises_stress', - mesh_type=mesh_type, - damage='threshold', - face_melt=True, - depth_integrated=True)) + 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, + depth_integrated=True)) # Create decomp and restart tests for all calving laws. # Note that FO velo solver is NOT BFB across decompositions @@ -86,13 +94,15 @@ 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')) # Add hydro tests mesh_type = '3km' @@ -101,6 +111,7 @@ def __init__(self, mpas_core): velo_solver='none', calving_law='none', mesh_type=mesh_type, + advection_type='fo', damage=None, face_melt=False, hydro=True)) @@ -110,6 +121,7 @@ def __init__(self, mpas_core): velo_solver='none', calving_law='none', mesh_type=mesh_type, + advection_type='fo', damage=None, face_melt=False, hydro=True)) diff --git a/compass/landice/tests/humboldt/decomposition_test/__init__.py b/compass/landice/tests/humboldt/decomposition_test/__init__.py index 1def33a56d..754b38ec5d 100644 --- a/compass/landice/tests/humboldt/decomposition_test/__init__.py +++ b/compass/landice/tests/humboldt/decomposition_test/__init__.py @@ -39,8 +39,8 @@ class DecompositionTest(TestCase): """ def __init__(self, test_group, velo_solver, calving_law, mesh_type, - damage=None, face_melt=False, depth_integrated=False, - hydro=False): + advection_type, damage=None, face_melt=False, + depth_integrated=False, hydro=False): """ Create the test case @@ -58,6 +58,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 @@ -73,6 +76,7 @@ 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 @@ -84,8 +88,8 @@ def __init__(self, test_group, velo_solver, calving_law, mesh_type, self.hydro = False # build dir name. always include velo solver and calving law - subdir = 'mesh-{}_decomposition_test/velo-{}'.format( - mesh_type, velo_solver.lower()) + subdir = 'mesh-{}_decomposition_test/velo-{}_advec-{}'.format( + mesh_type, velo_solver.lower(), advection_type) if velo_solver == 'FO' and depth_integrated is True: subdir += '-depthInt' subdir += '_calving-{}'.format(calving_law.lower()) @@ -105,15 +109,20 @@ 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, + 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, depth_integrated=depth_integrated, hydro=self.hydro, - mesh_type=mesh_type)) + 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 diff --git a/compass/landice/tests/humboldt/restart_test/__init__.py b/compass/landice/tests/humboldt/restart_test/__init__.py index dd68e73748..2a63dc5c81 100644 --- a/compass/landice/tests/humboldt/restart_test/__init__.py +++ b/compass/landice/tests/humboldt/restart_test/__init__.py @@ -31,8 +31,8 @@ class RestartTest(TestCase): """ def __init__(self, test_group, velo_solver, calving_law, mesh_type, - damage=None, face_melt=False, depth_integrated=False, - hydro=False): + advection_type, damage=None, face_melt=False, + depth_integrated=False, hydro=False): """ Create the test case @@ -50,6 +50,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 @@ -65,6 +68,7 @@ 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 @@ -76,8 +80,8 @@ def __init__(self, test_group, velo_solver, calving_law, mesh_type, self.hydro = False # build dir name. always include velo solver and calving law - subdir = 'mesh-{}_restart_test/velo-{}'.format( - mesh_type, velo_solver.lower()) + subdir = 'mesh-{}_restart_test/velo-{}_advec-{}'.format( + mesh_type, velo_solver.lower(), advection_type) if velo_solver == 'FO' and depth_integrated is True: subdir += '-depthInt' subdir += '_calving-{}'.format(calving_law.lower()) @@ -111,6 +115,11 @@ def __init__(self, test_group, velo_solver, calving_law, mesh_type, step.add_namelist_file( 'compass.landice.tests.humboldt.restart_test', nl1, 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') @@ -140,6 +149,11 @@ def __init__(self, test_group, velo_solver, calving_law, mesh_type, step.add_namelist_file( 'compass.landice.tests.humboldt.restart_test', nl1, 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') @@ -147,6 +161,11 @@ def __init__(self, test_group, velo_solver, calving_law, mesh_type, step.add_namelist_file( 'compass.landice.tests.humboldt.restart_test', nl2, 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') From acda9250d783e0a779702f01358882a45451bacd Mon Sep 17 00:00:00 2001 From: Trevor Hillebrand Date: Thu, 29 Jun 2023 11:19:00 -0700 Subject: [PATCH 6/7] Add fct_integration suite Add fct_integration suite, which uses a subset of the new fct advection tests based on the tests in full_integration. --- compass/landice/suites/fct_integration.txt | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 compass/landice/suites/fct_integration.txt diff --git a/compass/landice/suites/fct_integration.txt b/compass/landice/suites/fct_integration.txt new file mode 100644 index 0000000000..63d5007a4f --- /dev/null +++ b/compass/landice/suites/fct_integration.txt @@ -0,0 +1,9 @@ +landice/dome/2000m/fo_fct_decomposition_test +landice/dome/2000m/fo_fct_restart_test +landice/dome/variable_resolution/fo_fct_decomposition_test +landice/dome/variable_resolution/fo_fct_restart_test +landice/greenland/fo_fct_decomposition_test +landice/greenland/fo_fct_restart_test +landice/thwaites/fct_decomposition_test +landice/thwaites/fct_restart_test +landice/humboldt/mesh-3km_restart_test/velo-fo_advec-fct_calving-von_mises_stress_damage-threshold_faceMelting From c884eaf5d3703a6e11e0d3216f09c3216f657a8a Mon Sep 17 00:00:00 2001 From: Trevor Hillebrand Date: Thu, 26 Oct 2023 12:11:24 -0700 Subject: [PATCH 7/7] Fix names of thwaites tests in suite definition file Fix names of thwaites tests in suite definition file. Note that the naming convention of these tests is currently {advection}_{velocity_solver}, which is the reverse of the convention for other tests. This will be addressed in a future commit. --- compass/landice/suites/fct_integration.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compass/landice/suites/fct_integration.txt b/compass/landice/suites/fct_integration.txt index 63d5007a4f..fdac6948db 100644 --- a/compass/landice/suites/fct_integration.txt +++ b/compass/landice/suites/fct_integration.txt @@ -4,6 +4,6 @@ landice/dome/variable_resolution/fo_fct_decomposition_test landice/dome/variable_resolution/fo_fct_restart_test landice/greenland/fo_fct_decomposition_test landice/greenland/fo_fct_restart_test -landice/thwaites/fct_decomposition_test -landice/thwaites/fct_restart_test +landice/thwaites/fct_fo_decomposition_test +landice/thwaites/fct_fo_restart_test landice/humboldt/mesh-3km_restart_test/velo-fo_advec-fct_calving-von_mises_stress_damage-threshold_faceMelting