import os
from polaris.config import PolarisConfigParser as PolarisConfigParser
from polaris.constants import get_constant
from polaris.tasks.ocean.barotropic_channel.default import Default as Default
[docs]
def add_barotropic_channel_tasks(component):
"""
Add tasks for barotropic channel tests to the ocean component
component : polaris.tasks.ocean.Ocean
the ocean component that the tasks will be added to
"""
group_name = 'barotropic_channel'
config_filename = f'{group_name}.cfg'
filepath = os.path.join(
component.name, 'planar', group_name, config_filename
)
config = PolarisConfigParser(filepath=filepath)
config.add_from_package('polaris.ocean.eos', 'constant.cfg')
config.add_from_package(
f'polaris.tasks.ocean.{group_name}', config_filename
)
# Set rhoref to the PCD value only at setup so that if the
# user wants to run with a different value by changing the cfg
# before runtime, they can
config.set(
'ocean',
'eos_constant_rhoref',
value=f'{get_constant("seawater_density_reference"):02g}',
)
default = Default(component=component)
default.set_shared_config(config, link=config_filename)
component.add_task(default)