From 9d8a44f5a28273c20c4c9ad6943b95f9adcb6e53 Mon Sep 17 00:00:00 2001 From: Carolyn Begeman Date: Wed, 23 Jun 2021 16:21:50 -0500 Subject: [PATCH] Add config option for number of inactive layers --- compass/ocean/tests/global_ocean/configure.py | 1 + compass/ocean/tests/global_ocean/mesh/qu240/qu240.cfg | 1 + compass/ocean/vertical/grid_1d.py | 4 ++++ 3 files changed, 6 insertions(+) diff --git a/compass/ocean/tests/global_ocean/configure.py b/compass/ocean/tests/global_ocean/configure.py index 99f6286899..9661f41fdc 100644 --- a/compass/ocean/tests/global_ocean/configure.py +++ b/compass/ocean/tests/global_ocean/configure.py @@ -26,6 +26,7 @@ def configure_global_ocean(test_case, mesh, init=None): config.get('global_ocean', 'prefix'))) if init is not None and init.with_inactive_top_cells: + config.set('vertical_grid', 'inactive_top_cells', '1') config.set('vertical_grid', 'vert_levels', '{}'.format( config.getint('vertical_grid', 'vert_levels')+1)) diff --git a/compass/ocean/tests/global_ocean/mesh/qu240/qu240.cfg b/compass/ocean/tests/global_ocean/mesh/qu240/qu240.cfg index a6c2eacb2f..c44406d420 100644 --- a/compass/ocean/tests/global_ocean/mesh/qu240/qu240.cfg +++ b/compass/ocean/tests/global_ocean/mesh/qu240/qu240.cfg @@ -16,6 +16,7 @@ min_layer_thickness = 3.0 # The maximum layer thickness max_layer_thickness = 500.0 +inactive_top_cells = 0 # options for global ocean testcases [global_ocean] diff --git a/compass/ocean/vertical/grid_1d.py b/compass/ocean/vertical/grid_1d.py index f0c99fd820..3a5ca26407 100644 --- a/compass/ocean/vertical/grid_1d.py +++ b/compass/ocean/vertical/grid_1d.py @@ -46,6 +46,10 @@ def generate_1d_grid(config): bottom_depth = section.getfloat('bottom_depth') # renormalize to the requested range interfaces = (bottom_depth/interfaces[-1]) * interfaces + if config.has_option('vertical_grid', 'inactive_top_cells'): + offset = config.getint('vertical_grid', 'inactive_top_cells') + if offset > 0: + interfaces[offset:] = interfaces[:0-offset] return interfaces