Skip to content

Commit

Permalink
delinting pep8 errors
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewhoffman committed Aug 4, 2023
1 parent 36673ee commit 4d29c18
Show file tree
Hide file tree
Showing 11 changed files with 82 additions and 79 deletions.
2 changes: 1 addition & 1 deletion compass/landice/tests/dome/albany_input.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ ANONYMOUS:
Type: 'Glen''s Law'
Flow Rate Type: Uniform
'Glen''s Law Homotopy Parameter': 1.0

Cubature Degree: 4

# Discretization Description
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ ANONYMOUS:
Effective Pressure: 1.0
#Zero Effective Pressure On Floating Ice At Nodes: true
Zero Beta On Floating Ice: true
Cubature Degree: 4

Cubature Degree: 4
Basal Cubature Degree: 8

# Discretization Description
Expand Down
75 changes: 37 additions & 38 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,53 +22,53 @@ 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))
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))

# 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))
DecompositionTest(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,
damage='threshold',
face_melt=True))
RestartTest(test_group=self,
velo_solver=velo_solver,
calving_law='von_Mises_stress',
mesh_type=mesh_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))
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))

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))
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))

# Create decomp and restart tests for all calving laws.
# Note that FO velo solver is NOT BFB across decompositions
Expand Down
2 changes: 1 addition & 1 deletion compass/landice/tests/humboldt/albany_input.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ ANONYMOUS:
Power Exponent: 3.33333333333E-1
Effective Pressure Type: Hydrostatic
Use Pressurized Bed Above Sea Level: False

Cubature Degree: 4

# Discretization Description
Expand Down
6 changes: 3 additions & 3 deletions compass/landice/tests/humboldt/decomposition_test/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class DecompositionTest(TestCase):
face_melt : bool
Whether to include face melting
depth_integrated : bool
Whether the (FO) velocity model is depth integrated
Expand Down Expand Up @@ -60,7 +60,7 @@ def __init__(self, test_group, velo_solver, calving_law, mesh_type,
face_melt : bool
Whether to include face melting
depth_integrated : bool
Whether the (FO) velocity model is depth integrated
"""
Expand All @@ -77,7 +77,7 @@ def __init__(self, test_group, velo_solver, calving_law, mesh_type,
subdir = 'mesh-{}_decomposition_test/velo-{}'.format(
mesh_type, velo_solver.lower())
if velo_solver == 'FO' and depth_integrated is True:
subdir += '-depthInt'
subdir += '-depthInt'
subdir += '_calving-{}'.format(calving_law.lower())
# append damage and facemelt if provided
if damage is not None:
Expand Down
10 changes: 5 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 @@ -22,7 +22,7 @@ class RestartTest(TestCase):
face_melt : bool
Whether to include face melting
depth_integrated : bool
Whether the (FO) velocity model is depth integrated
"""
Expand Down Expand Up @@ -51,7 +51,7 @@ def __init__(self, test_group, velo_solver, calving_law, mesh_type,
face_melt : bool
Whether to include face melting
depth_integrated : bool
Whether the (FO) velocity model is depth integrated
"""
Expand All @@ -68,7 +68,7 @@ def __init__(self, test_group, velo_solver, calving_law, mesh_type,
subdir = 'mesh-{}_restart_test/velo-{}'.format(
mesh_type, velo_solver.lower())
if velo_solver == 'FO' and depth_integrated is True:
subdir += '-depthInt'
subdir += '-depthInt'
subdir += '_calving-{}'.format(calving_law.lower())
# append damage and facemelt if provided
if damage is not None:
Expand Down
14 changes: 7 additions & 7 deletions compass/landice/tests/humboldt/run_model.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from compass.model import run_model, make_graph_file
from compass.model import make_graph_file, run_model
from compass.step import Step


Expand Down Expand Up @@ -62,7 +62,7 @@ def __init__(self, test_case, velo_solver, mesh_type,
face_melt : bool, optional
Whether to include face melting
depth_integrated : bool, optional
Whether the (FO) velocity model is depth integrated
Expand Down Expand Up @@ -140,13 +140,13 @@ def __init__(self, test_case, velo_solver, mesh_type,

if depth_integrated:
self.add_input_file(filename='albany_input.yaml',
target='albany_input_depthInt.yaml',
package='compass.landice.tests.humboldt',
copy=True)
target='albany_input_depthInt.yaml',
package='compass.landice.tests.humboldt',
copy=True)
else:
self.add_input_file(filename='albany_input.yaml',
package='compass.landice.tests.humboldt',
copy=True)
package='compass.landice.tests.humboldt',
copy=True)

self.add_model_as_input()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ ANONYMOUS:
Effective Pressure: 1.0
# Zero Effective Pressure On Floating Ice At Nodes: true
Zero Beta On Floating Ice: true

Cubature Degree: 4
Basal Cubature Degree: 8

Expand Down
11 changes: 6 additions & 5 deletions compass/landice/tests/thwaites/decomposition_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.thwaites.run_model import RunModel
from compass.testcase import TestCase
from compass.validate import compare_variables


class DecompositionTest(TestCase):
Expand All @@ -18,7 +18,7 @@ def __init__(self, test_group, depth_integrated=False):
----------
test_group : compass.landice.tests.thwaites.Thwaites
The test group that this test case belongs to
depth_integrated : bool
Whether the (FO) velocity model is depth integrated
Expand All @@ -27,15 +27,16 @@ def __init__(self, test_group, depth_integrated=False):
name = 'fo-depthInt_decomposition_test'
else:
name = 'fo_decomposition_test'

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,
RunModel(test_case=self, name=name,
depth_integrated=depth_integrated,
ntasks=procs, min_tasks=procs, openmp_threads=1))

# no configure() method is needed
Expand Down
18 changes: 10 additions & 8 deletions compass/landice/tests/thwaites/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.thwaites.run_model import RunModel
from compass.testcase import TestCase
from compass.validate import compare_variables


class RestartTest(TestCase):
Expand All @@ -18,25 +18,26 @@ def __init__(self, test_group, depth_integrated=False):
----------
test_group : compass.landice.tests.thwaites.Thwaites
The test group that this test case belongs to
depth_integrated : bool
Whether the (FO) velocity model is depth integrated
"""

if depth_integrated is True:
name = 'fo-depthInt_restart_test'
else:
name = 'fo_restart_test'

super().__init__(test_group=test_group, name=name)

ntasks = 36
min_tasks = 4

name = 'full_run'
step = RunModel(test_case=self, name=name, depth_integrated=depth_integrated,
ntasks=ntasks, min_tasks=min_tasks, openmp_threads=1)
step = RunModel(test_case=self, name=name,
depth_integrated=depth_integrated,
ntasks=ntasks, min_tasks=min_tasks, openmp_threads=1)
# modify the namelist options and streams file
step.add_namelist_file(
'compass.landice.tests.thwaites.restart_test',
Expand All @@ -47,7 +48,8 @@ def __init__(self, test_group, depth_integrated=False):
self.add_step(step)

name = 'restart_run'
step = RunModel(test_case=self, name=name, ntasks=ntasks, depth_integrated=depth_integrated,
step = RunModel(test_case=self, name=name, ntasks=ntasks,
depth_integrated=depth_integrated,
min_tasks=min_tasks, openmp_threads=1,
suffixes=['landice', 'landice.rst'])

Expand Down
17 changes: 9 additions & 8 deletions compass/landice/tests/thwaites/run_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ class RunModel(Step):
twice, the second time with ``namelist.landice.rst`` and
``streams.landice.rst``
"""
def __init__(self, test_case, name='run_model', depth_integrated=False, subdir=None,
ntasks=1, min_tasks=None, openmp_threads=1, suffixes=None):
def __init__(self, test_case, name='run_model', depth_integrated=False,
subdir=None, ntasks=1, min_tasks=None, openmp_threads=1,
suffixes=None):
"""
Create a new test case
Expand All @@ -28,7 +29,7 @@ def __init__(self, test_case, name='run_model', depth_integrated=False, subdir=N
name : str, optional
the name of the test case
depth_integrated : bool, optional
Whether the (FO) velocity model is depth integrated
Expand Down Expand Up @@ -81,13 +82,13 @@ def __init__(self, test_case, name='run_model', depth_integrated=False, subdir=N

if depth_integrated:
self.add_input_file(filename='albany_input.yaml',
target='albany_input_depthInt.yaml',
package='compass.landice.tests.thwaites',
copy=True)
target='albany_input_depthInt.yaml',
package='compass.landice.tests.thwaites',
copy=True)
else:
self.add_input_file(filename='albany_input.yaml',
package='compass.landice.tests.thwaites',
copy=True)
package='compass.landice.tests.thwaites',
copy=True)

self.add_model_as_input()

Expand Down

0 comments on commit 4d29c18

Please sign in to comment.