Source code for compass.ocean.tests.baroclinic_channel.rpe_test

from compass.testcase import TestCase
from compass.ocean.tests.baroclinic_channel.initial_state import InitialState
from compass.ocean.tests.baroclinic_channel.forward import Forward
from compass.ocean.tests.baroclinic_channel.rpe_test.analysis import Analysis
from compass.ocean.tests import baroclinic_channel


[docs]class RpeTest(TestCase): """ The reference potential energy (RPE) test case for the baroclinic channel test group performs a 20-day integration of the model forward in time at 5 different values of the viscosity at the given resolution. Attributes ---------- resolution : str The resolution of the test case """
[docs] def __init__(self, test_group, resolution): """ Create the test case Parameters ---------- test_group : compass.ocean.tests.baroclinic_channel.BaroclinicChannel The test group that this test case belongs to resolution : str The resolution of the test case """ name = 'rpe_test' subdir = '{}/{}'.format(resolution, name) super().__init__(test_group=test_group, name=name, subdir=subdir) nus = [1, 5, 10, 20, 200] res_params = {'1km': {'cores': 144, 'min_cores': 36}, '4km': {'cores': 36, 'min_cores': 8}, '10km': {'cores': 8, 'min_cores': 4}} if resolution not in res_params: raise ValueError( 'Unsupported resolution {}. Supported values are: ' '{}'.format(resolution, list(res_params))) params = res_params[resolution] self.resolution = resolution self.add_step( InitialState(test_case=self, resolution=resolution)) for index, nu in enumerate(nus): name = 'rpe_test_{}_nu_{}'.format(index + 1, nu) step = Forward( test_case=self, name=name, subdir=name, cores=params['cores'], min_cores=params['min_cores'], resolution=resolution, nu=float(nu)) step.add_namelist_file( 'compass.ocean.tests.baroclinic_channel.rpe_test', 'namelist.forward') step.add_streams_file( 'compass.ocean.tests.baroclinic_channel.rpe_test', 'streams.forward') self.add_step(step) self.add_step( Analysis(test_case=self, resolution=resolution, nus=nus))
[docs] def configure(self): """ Modify the configuration options for this test case. """ baroclinic_channel.configure(self.resolution, self.config)
# no run() is needed because we're doing the default: running all steps