Skip to content

Commit

Permalink
Add config options to control init topo smoothing
Browse files Browse the repository at this point in the history
Up to now, topography smoothing has been disabled in MPAS-Ocean
init mode.  This merge adds config options to control it
(the number of iterations and the weight of a cell vs. its
neighbors in each iteration).  By default, topography smoothing
is still off.
  • Loading branch information
xylar committed Oct 8, 2023
1 parent b13977d commit 67ab4ad
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
5 changes: 5 additions & 0 deletions compass/ocean/tests/global_ocean/global_ocean.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ btr_dt_per_km = 1.5

# Maximum allowed Haney number for configurations with ice-shelf cavities
rx1_max = 20
# the number of iterations of topography smoothing
topo_smooth_iterations = 0
# the weight given to the central cell during each iteration of smoothing,
# where the n cellsOnCell (neighbors) are given a weight (1-weight)/n.
topo_smooth_weight = 0.9

# number of cores to use
init_ntasks = 36
Expand Down
18 changes: 15 additions & 3 deletions compass/ocean/tests/global_ocean/init/initial_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,21 @@ def setup(self):
Get resources at setup from config options
"""
self._get_resources()
rx1_max = self.config.getfloat('global_ocean', 'rx1_max')
self.add_namelist_options({'config_rx1_max': f'{rx1_max}'},
mode='init')
section = self.config['global_ocean']
rx1_max = section.getfloat('rx1_max')
topo_smooth_iterations = section.getint('topo_smooth_iterations')
topo_smooth_weight = section.getfloat('topo_smooth_weight')

options = {
'config_rx1_max':
f'{rx1_max}',
'config_global_ocean_topography_smooth_iterations':
f'{topo_smooth_iterations}',
'config_global_ocean_topography_smooth_weight':
f'{topo_smooth_weight}',
}

self.add_namelist_options(options, mode='init')

def constrain_resources(self, available_resources):
"""
Expand Down
1 change: 0 additions & 1 deletion compass/ocean/tests/global_ocean/init/namelist.init
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,3 @@ config_global_ocean_depth_conversion_factor = 1.0
config_global_ocean_minimum_depth = 10
config_global_ocean_deepen_critical_passages = .false.
config_block_decomp_file_prefix = 'graph.info.part.'
config_global_ocean_topography_smooth_iterations = 0

0 comments on commit 67ab4ad

Please sign in to comment.