-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
1,114 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
from compass.ocean.tests.baroclinic_channel import decomp_test, default, \ | ||
restart_test, rpe_test, threads_test | ||
|
||
|
||
def collect(): | ||
""" | ||
Get a list of testcases in this configuration | ||
Returns | ||
------- | ||
testcases : list | ||
A list of tests within this configuration | ||
""" | ||
testcases = list() | ||
for resolution in ['1km', '4km', '10km']: | ||
for test in [rpe_test]: | ||
testcases.append(test.collect(resolution=resolution)) | ||
for resolution in ['10km']: | ||
for test in [decomp_test, default, restart_test, threads_test]: | ||
testcases.append(test.collect(resolution=resolution)) | ||
|
||
return testcases | ||
|
||
|
||
def configure(testcase, config): | ||
""" | ||
Modify the configuration options for this testcase. | ||
Parameters | ||
---------- | ||
testcase : dict | ||
A dictionary of properties of this testcase from the ``collect()`` | ||
function | ||
config : configparser.ConfigParser | ||
Configuration options for this testcase, a combination of the defaults | ||
for the machine, core and configuration | ||
""" | ||
resolution = testcase['resolution'] | ||
res_params = {'10km': {'nx': 16, | ||
'ny': 50, | ||
'dc': 10e3}, | ||
'4km': {'nx': 40, | ||
'ny': 126, | ||
'dc': 4e3}, | ||
'1km': {'nx': 160, | ||
'ny': 500, | ||
'dc': 1e3}} | ||
|
||
if resolution not in res_params: | ||
raise ValueError('Unsupported resolution {}. Supported values are: ' | ||
'{}'.format(resolution, list(res_params))) | ||
res_params = res_params[resolution] | ||
for param in res_params: | ||
config.set('baroclinic_channel', param, '{}'.format(res_params[param])) |
36 changes: 36 additions & 0 deletions
36
compass/ocean/tests/baroclinic_channel/baroclinic_channel.cfg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# namelist options for the baroclinic channel test case | ||
[baroclinic_channel] | ||
|
||
# Number of vertical levels in baroclinic channel test case. Typical value is 20. | ||
vert_levels = 20 | ||
|
||
# Logical flag that determines if locations of features are defined by distance | ||
# or fractions. False means fractions. | ||
use_distances = False | ||
|
||
# Temperature of the surface in the northern half of the domain. | ||
surface_temperature = 13.1 | ||
|
||
# Temperature of the bottom in the northern half of the domain. | ||
bottom_temperature = 10.1 | ||
|
||
# Difference in the temperature field between the northern and southern halves | ||
# of the domain. | ||
temperature_difference = 1.2 | ||
|
||
# Fraction of domain in Y direction the temperature gradient should be linear | ||
# over. | ||
gradient_width_frac = 0.08 | ||
|
||
# Width of the temperature gradient around the center sin wave. Default value | ||
# is relative to a 500km domain in Y. | ||
gradient_width_dist = 40e3 | ||
|
||
# Depth of the bottom of the ocean for the baroclinic channel test case. | ||
bottom_depth = 1000.0 | ||
|
||
# Salinity of the water in the entire domain. | ||
salinity = 35.0 | ||
|
||
# Coriolis parameter for entire domain. | ||
coriolis_parameter = -1.2e-4 |
73 changes: 73 additions & 0 deletions
73
compass/ocean/tests/baroclinic_channel/decomp_test/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
from compass.testcase import run_steps, get_default | ||
from compass.ocean.tests.baroclinic_channel import initial_state, forward | ||
from compass.ocean.tests import baroclinic_channel | ||
|
||
|
||
def collect(resolution): | ||
""" | ||
Get a dictionary of testcase properties | ||
Parameters | ||
---------- | ||
resolution : {'10km'} | ||
The resolution of the mesh | ||
Returns | ||
------- | ||
testcase : dict | ||
A dict of properties of this test case, including its steps | ||
""" | ||
description = 'baroclinic channel {} default'.format(resolution) | ||
module = __name__ | ||
|
||
name = module.split('.')[-1] | ||
subdir = '{}/{}'.format(resolution, name) | ||
steps = dict() | ||
step = initial_state.collect(resolution) | ||
steps[step['name']] = step | ||
|
||
for procs in [4, 8]: | ||
step = forward.collect(resolution, procs=procs, threads=1) | ||
step['name'] = '{}proc'.format(procs) | ||
step['subdir'] = step['name'] | ||
steps[step['name']] = step | ||
|
||
testcase = get_default(module, description, steps, subdir=subdir) | ||
testcase['resolution'] = resolution | ||
|
||
return testcase | ||
|
||
|
||
def configure(testcase, config): | ||
""" | ||
Modify the configuration options for this testcase. | ||
Parameters | ||
---------- | ||
testcase : dict | ||
A dictionary of properties of this testcase from the ``collect()`` | ||
function | ||
config : configparser.ConfigParser | ||
Configuration options for this testcase, a combination of the defaults | ||
for the machine, core and configuration | ||
""" | ||
baroclinic_channel.configure(testcase, config) | ||
|
||
|
||
def run(testcase, config): | ||
""" | ||
Run each step of the testcase | ||
Parameters | ||
---------- | ||
testcase : dict | ||
A dictionary of properties of this testcase from the ``collect()`` | ||
function | ||
config : configparser.ConfigParser | ||
Configuration options for this testcase, a combination of the defaults | ||
for the machine, core and configuration | ||
""" | ||
steps = ['initial_state', '4proc', '8proc'] | ||
run_steps(testcase, config, steps) |
69 changes: 69 additions & 0 deletions
69
compass/ocean/tests/baroclinic_channel/default/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
from compass.testcase import run_steps, get_default | ||
from compass.ocean.tests.baroclinic_channel import initial_state, forward | ||
from compass.ocean.tests import baroclinic_channel | ||
|
||
|
||
def collect(resolution): | ||
""" | ||
Get a dictionary of testcase properties | ||
Parameters | ||
---------- | ||
resolution : {'10km'} | ||
The resolution of the mesh | ||
Returns | ||
------- | ||
testcase : dict | ||
A dict of properties of this test case, including its steps | ||
""" | ||
description = 'baroclinic channel {} default'.format(resolution) | ||
module = __name__ | ||
|
||
name = module.split('.')[-1] | ||
subdir = '{}/{}'.format(resolution, name) | ||
steps = dict() | ||
step = initial_state.collect(resolution) | ||
steps[step['name']] = step | ||
step = forward.collect(resolution, procs=4, threads=1) | ||
steps[step['name']] = step | ||
|
||
testcase = get_default(module, description, steps, subdir=subdir) | ||
testcase['resolution'] = resolution | ||
|
||
return testcase | ||
|
||
|
||
def configure(testcase, config): | ||
""" | ||
Modify the configuration options for this testcase. | ||
Parameters | ||
---------- | ||
testcase : dict | ||
A dictionary of properties of this testcase from the ``collect()`` | ||
function | ||
config : configparser.ConfigParser | ||
Configuration options for this testcase, a combination of the defaults | ||
for the machine, core and configuration | ||
""" | ||
baroclinic_channel.configure(testcase, config) | ||
|
||
|
||
def run(testcase, config): | ||
""" | ||
Run each step of the testcase | ||
Parameters | ||
---------- | ||
testcase : dict | ||
A dictionary of properties of this testcase from the ``collect()`` | ||
function | ||
config : configparser.ConfigParser | ||
Configuration options for this testcase, a combination of the defaults | ||
for the machine, core and configuration | ||
""" | ||
steps = ['initial_state', 'forward'] | ||
run_steps(testcase, config, steps) |
Oops, something went wrong.