-
Notifications
You must be signed in to change notification settings - Fork 38
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 #620 from cbegeman/ocn-add-wetting-drying-ramp-tests
Add ocean wetting-and-drying ramp tests This PR is for testing the wetting-and-drying ramp feature introduced in E3SM-Project/E3SM#5590
- Loading branch information
Showing
12 changed files
with
246 additions
and
14 deletions.
There are no files selected for viewing
Submodule E3SM-Project
updated
35 files
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 |
---|---|---|
@@ -1,9 +1,15 @@ | ||
ocean/drying_slope/250m/sigma/default | ||
ocean/drying_slope/250m/sigma/ramp | ||
ocean/drying_slope/250m/single_layer/default | ||
ocean/drying_slope/250m/single_layer/ramp | ||
ocean/drying_slope/1km/sigma/default | ||
ocean/drying_slope/1km/sigma/ramp | ||
ocean/drying_slope/1km/single_layer/default | ||
ocean/drying_slope/1km/single_layer/ramp | ||
ocean/dam_break/40cm/default | ||
ocean/dam_break/40cm/ramp | ||
ocean/dam_break/120cm/default | ||
ocean/dam_break/120cm/ramp | ||
ocean/isomip_plus/planar/5km/sigma/thin_film_drying_Ocean0 | ||
ocean/isomip_plus/planar/5km/sigma/thin_film_wetting_Ocean0 | ||
ocean/isomip_plus/planar/5km/single_layer/thin_film_tidal_forcing_Ocean0 |
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,82 @@ | ||
from math import floor | ||
|
||
from compass.ocean.tests.dam_break.forward import Forward | ||
from compass.ocean.tests.dam_break.initial_state import InitialState | ||
from compass.ocean.tests.dam_break.viz import Viz | ||
from compass.testcase import TestCase | ||
from compass.validate import compare_variables | ||
|
||
|
||
class Ramp(TestCase): | ||
""" | ||
The default dam_break test case | ||
Attributes | ||
---------- | ||
resolution : float | ||
The resolution of the test case in km | ||
""" | ||
|
||
def __init__(self, test_group, resolution): | ||
""" | ||
Create the test case | ||
Parameters | ||
---------- | ||
test_group : compass.ocean.tests.dam_break.DamBreak | ||
The test group that this test case belongs to | ||
resolution : float | ||
The resolution of the test case in m | ||
""" | ||
name = 'ramp' | ||
|
||
self.resolution = resolution | ||
if resolution < 1.: | ||
res_name = f'{int(resolution*1e3)}cm' | ||
else: | ||
res_name = f'{int(resolution)}m' | ||
min_tasks = int(40 / (resolution / 0.04)**2) | ||
ntasks = 10 * min_tasks | ||
subdir = f'{res_name}/{name}' | ||
super().__init__(test_group=test_group, name=name, | ||
subdir=subdir) | ||
|
||
self.add_step(InitialState(test_case=self)) | ||
forward_step = Forward(test_case=self, resolution=resolution, | ||
ntasks=ntasks, min_tasks=min_tasks, | ||
openmp_threads=1) | ||
forward_step.add_namelist_options({'config_zero_drying_velocity_ramp': | ||
".true."}) | ||
self.add_step(forward_step) | ||
self.add_step(Viz(test_case=self)) | ||
|
||
def configure(self): | ||
""" | ||
Modify the configuration options for this test case. | ||
""" | ||
|
||
resolution = self.resolution | ||
config = self.config | ||
dc = resolution # cell width in m | ||
dx = 13 # width of the domain in m | ||
dy = 28 # length of the domain in m | ||
nx = round(dx / dc) | ||
ny = int(2 * floor(dy / (2 * dc))) # guarantee that ny is even | ||
|
||
config.set('dam_break', 'nx', f'{nx}', comment='the number of ' | ||
'mesh cells in the x direction') | ||
config.set('dam_break', 'ny', f'{ny}', comment='the number of ' | ||
'mesh cells in the y direction') | ||
config.set('dam_break', 'dc', f'{dc}', comment='the distance ' | ||
'between adjacent cell centers') | ||
|
||
def validate(self): | ||
""" | ||
Validate variables against a baseline | ||
""" | ||
variables = ['layerThickness', 'normalVelocity', 'ssh'] | ||
compare_variables(test_case=self, variables=variables, | ||
filename1='forward/output.nc') |
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,99 @@ | ||
from compass.ocean.tests.drying_slope.forward import Forward | ||
from compass.ocean.tests.drying_slope.initial_state import InitialState | ||
from compass.ocean.tests.drying_slope.viz import Viz | ||
from compass.testcase import TestCase | ||
from compass.validate import compare_variables | ||
|
||
|
||
class Ramp(TestCase): | ||
""" | ||
The default drying_slope test case | ||
Attributes | ||
---------- | ||
resolution : float | ||
The resolution of the test case in km | ||
coord_type : str | ||
The type of vertical coordinate (``sigma``, ``single_layer``, etc.) | ||
""" | ||
|
||
def __init__(self, test_group, resolution, coord_type): | ||
""" | ||
Create the test case | ||
Parameters | ||
---------- | ||
test_group : compass.ocean.tests.drying_slope.DryingSlope | ||
The test group that this test case belongs to | ||
resolution : float | ||
The resolution of the test case in km | ||
coord_type : str | ||
The type of vertical coordinate (``sigma``, ``single_layer``) | ||
""" | ||
name = 'ramp' | ||
|
||
self.resolution = resolution | ||
self.coord_type = coord_type | ||
if resolution < 1.: | ||
res_name = f'{int(resolution*1e3)}m' | ||
else: | ||
res_name = f'{int(resolution)}km' | ||
subdir = f'{res_name}/{coord_type}/{name}' | ||
super().__init__(test_group=test_group, name=name, | ||
subdir=subdir) | ||
self.add_step(InitialState(test_case=self, coord_type=coord_type)) | ||
if coord_type == 'single_layer': | ||
forward_step = Forward(test_case=self, resolution=resolution, | ||
ntasks=4, openmp_threads=1, | ||
coord_type=coord_type) | ||
damping_coeffs = None | ||
forward_step.add_namelist_options( | ||
{'config_zero_drying_velocity_ramp': ".true."}) | ||
self.add_step(forward_step) | ||
else: | ||
damping_coeffs = [0.0025, 0.01] | ||
for damping_coeff in damping_coeffs: | ||
forward_step = Forward(test_case=self, resolution=resolution, | ||
ntasks=4, openmp_threads=1, | ||
damping_coeff=damping_coeff, | ||
coord_type=coord_type) | ||
forward_step.add_namelist_options( | ||
{'config_zero_drying_velocity_ramp': ".true."}) | ||
self.add_step(forward_step) | ||
self.damping_coeffs = damping_coeffs | ||
self.add_step(Viz(test_case=self, damping_coeffs=damping_coeffs)) | ||
|
||
def configure(self): | ||
""" | ||
Modify the configuration options for this test case. | ||
""" | ||
|
||
resolution = self.resolution | ||
config = self.config | ||
ny = round(28 / resolution) | ||
if resolution < 1.: | ||
ny += 2 | ||
dc = 1e3 * resolution | ||
|
||
config.set('drying_slope', 'ny', f'{ny}', comment='the number of ' | ||
'mesh cells in the y direction') | ||
config.set('drying_slope', 'dc', f'{dc}', comment='the distance ' | ||
'between adjacent cell centers') | ||
|
||
def validate(self): | ||
""" | ||
Validate variables against a baseline | ||
""" | ||
damping_coeffs = self.damping_coeffs | ||
variables = ['layerThickness', 'normalVelocity'] | ||
if damping_coeffs is not None: | ||
for damping_coeff in damping_coeffs: | ||
compare_variables(test_case=self, variables=variables, | ||
filename1=f'forward_{damping_coeff}/' | ||
'output.nc') | ||
else: | ||
compare_variables(test_case=self, variables=variables, | ||
filename1='forward/output.nc') |
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