Skip to content

Commit 8b5bd8c

Browse files
committed
Add config option for number of inactive layers
1 parent e58e239 commit 8b5bd8c

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

compass/ocean/tests/global_ocean/configure.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ def configure_global_ocean(test_case, mesh, init=None):
2626
config.get('global_ocean', 'prefix')))
2727

2828
if init is not None and init.with_inactive_top_cells:
29+
config.set('vertical_grid', 'inactive_top_cells', '1')
2930
config.set('vertical_grid', 'vert_levels', '{}'.format(
3031
config.getint('vertical_grid', 'vert_levels')+1))
3132

compass/ocean/tests/global_ocean/mesh/qu240/qu240.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ min_layer_thickness = 3.0
1616
# The maximum layer thickness
1717
max_layer_thickness = 500.0
1818

19+
inactive_top_cells = 0
1920

2021
# options for global ocean testcases
2122
[global_ocean]

compass/ocean/vertical/grid_1d.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,22 @@ def generate_1d_grid(config):
2222
interfaces : numpy.ndarray
2323
A 1D array of positive depths for layer interfaces in meters
2424
"""
25+
offset = 0
26+
if config.has_option('vertical_grid', 'inactive_top_cells'):
27+
offset = config.getint('vertical_grid', 'inactive_top_cells')
28+
2529
section = config['vertical_grid']
2630
grid_type = section.get('grid_type')
2731
if grid_type == 'uniform':
2832
vert_levels = section.getint('vert_levels')
29-
interfaces = _generate_uniform(vert_levels)
33+
interfaces = _generate_uniform(vert_levels - offset)
3034
elif grid_type == 'tanh_dz':
3135
vert_levels = section.getint('vert_levels')
3236
min_layer_thickness = section.getfloat('min_layer_thickness')
3337
max_layer_thickness = section.getfloat('max_layer_thickness')
3438
bottom_depth = section.getfloat('bottom_depth')
35-
interfaces = _create_tanh_dz_grid(vert_levels, bottom_depth,
39+
interfaces = _create_tanh_dz_grid(vert_levels - offset,
40+
bottom_depth,
3641
min_layer_thickness,
3742
max_layer_thickness)
3843

@@ -47,6 +52,9 @@ def generate_1d_grid(config):
4752
# renormalize to the requested range
4853
interfaces = (bottom_depth/interfaces[-1]) * interfaces
4954

55+
if config.has_option('vertical_grid', 'inactive_top_cells'):
56+
interfaces = np.append(np.zeros((offset)),interfaces)
57+
5058
return interfaces
5159

5260

0 commit comments

Comments
 (0)