-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #253 from xylar/cosine-bell-decomp
Add a cosine-bell decomposition test
- Loading branch information
Showing
13 changed files
with
159 additions
and
30 deletions.
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
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
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
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
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,3 @@ | ||
ocean/planar/manufactured_solution/convergence_both | ||
ocean/spherical/icos/cosine_bell/decomp | ||
ocean/spherical/icos/cosine_bell/restart |
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
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,93 @@ | ||
from polaris import Task | ||
from polaris.ocean.convergence import get_resolution_for_task | ||
from polaris.ocean.mesh.spherical import add_spherical_base_mesh_step | ||
from polaris.ocean.tasks.cosine_bell.forward import Forward | ||
from polaris.ocean.tasks.cosine_bell.init import Init | ||
from polaris.ocean.tasks.cosine_bell.validate import Validate | ||
|
||
|
||
class Decomp(Task): | ||
""" | ||
A cosine bell decomposition task, which makes sure the model produces | ||
identical results on different numbers of cores. | ||
""" | ||
|
||
def __init__(self, component, config, icosahedral, refinement_factor, | ||
refinement, proc_counts): | ||
""" | ||
Create the convergence test | ||
Parameters | ||
---------- | ||
component : polaris.ocean.Ocean | ||
The ocean component that this task belongs to | ||
config : polaris.config.PolarisConfigParser | ||
A shared config parser | ||
icosahedral : bool | ||
Whether to use icosahedral, as opposed to less regular, JIGSAW | ||
meshes | ||
refinement_factor : float | ||
The factor by which to scale space, time or both | ||
refinement : str | ||
Refinement type. One of 'space', 'time' or 'both' indicating both | ||
space and time | ||
proc_counts : list of int | ||
The number of processors to run each step on | ||
""" | ||
|
||
if icosahedral: | ||
prefix = 'icos' | ||
else: | ||
prefix = 'qu' | ||
|
||
task_subdir = f'spherical/{prefix}/cosine_bell/decomp' | ||
name = f'{prefix}_cosine_bell_decomp' | ||
config_filename = 'cosine_bell.cfg' | ||
|
||
super().__init__(component=component, name=name, subdir=task_subdir) | ||
|
||
self.set_shared_config(config, link=config_filename) | ||
|
||
resolution = get_resolution_for_task( | ||
config, refinement_factor, refinement=refinement) | ||
|
||
base_mesh_step, mesh_name = add_spherical_base_mesh_step( | ||
component, resolution, icosahedral) | ||
|
||
name = f'{prefix}_init_{mesh_name}' | ||
init_subdir = f'spherical/{prefix}/cosine_bell/init/{mesh_name}' | ||
if init_subdir in component.steps: | ||
init_step = component.steps[init_subdir] | ||
else: | ||
init_step = Init(component=component, name=name, | ||
subdir=init_subdir, base_mesh=base_mesh_step) | ||
init_step.set_shared_config(config, link=config_filename) | ||
|
||
self.add_step(base_mesh_step, symlink=f'base_mesh/{mesh_name}') | ||
self.add_step(init_step, symlink=f'init/{mesh_name}') | ||
|
||
step_names = [] | ||
for procs in proc_counts: | ||
name = f'{procs}proc' | ||
step_names.append(name) | ||
subdir = f'{task_subdir}/{name}' | ||
step = Forward( | ||
component=component, name=name, subdir=subdir, | ||
mesh=base_mesh_step, init=init_step, | ||
refinement_factor=refinement_factor, | ||
refinement=refinement) | ||
step.dynamic_ntasks = False | ||
step.ntasks = procs | ||
step.min_tasks = procs | ||
step.set_shared_config( | ||
config, link=config_filename) | ||
self.add_step(step) | ||
|
||
self.add_step(Validate(component=component, | ||
step_subdirs=step_names, | ||
indir=task_subdir)) |