Skip to content

Commit

Permalink
Merge pull request #139 from xylar/fix-geostrphic-thresholds
Browse files Browse the repository at this point in the history
Use Separate geostrophic thresholds for h and norm. vel.
  • Loading branch information
xylar authored Oct 20, 2023
2 parents 4614ddb + 2db0569 commit 03a2cfe
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 9 deletions.
17 changes: 11 additions & 6 deletions docs/users_guide/ocean/tasks/geostrophic.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,18 +166,23 @@ These are the basic constants used to initialize the test case according to
the Williams et al. (1992) paper. The temperature and salinity are arbitrary,
since they do not vary in space and should not affect the evolution.

Two additional config options relate to detecting when the convergence rate of
the test (using the L2 norm to compute the error) is unexpectedly low, which
raises an error:
Three additional config options relate to detecting when the convergence rate
for the water-column thickness (h) and normal velocity (using the L2 norm to
compute the error). If either convergence rate is unexpectedly low an error is
raised:
```cfg
# config options for convergence tests
[convergence]
# Convergence threshold below which a test fails
convergence_thresh = 0.4
# Type of error to compute
error_type = l2
# options for geostrophic convergence test case
[geostrophic]
# convergence threshold below which the test fails
convergence_thresh_h = 0.4
convergence_thresh_normalVelocity = 1.3
```

The convergence rate of the water-column thickness for this test case is very
Expand Down
24 changes: 24 additions & 0 deletions polaris/ocean/tasks/geostrophic/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,3 +128,27 @@ def get_output_field(self, mesh_name, field_name, time, zidx=None):
time=time, zidx=None)
h = ssh + bottom_depth
return h

def convergence_parameters(self, field_name=None):
"""
Get convergence parameters
Parameters
----------
field_name : str
The name of the variable of which we evaluate convergence
For cosine_bell, we use the same convergence rate for all fields
Returns
-------
conv_thresh: float
The minimum convergence rate
conv_thresh: float
The maximum convergence rate
"""
config = self.config
conv_thresh = config.getfloat('geostrophic',
f'convergence_thresh_{field_name}')
error_type = config.get('convergence', 'error_type')

return conv_thresh, error_type
7 changes: 4 additions & 3 deletions polaris/ocean/tasks/geostrophic/geostrophic.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ coord_type = z-star
# Evaluation time for convergence analysis (in hours)
convergence_eval_time = 120.0

# Convergence threshold below which a test fails
convergence_thresh = 0.4

# Type of error to compute
error_type = l2

Expand Down Expand Up @@ -54,6 +51,10 @@ temperature = 15.0
# the constant salinity of the domain
salinity = 35.0

# convergence threshold below which the test fails
convergence_thresh_h = 0.4
convergence_thresh_normalVelocity = 1.3


# options for visualization for the geostrophic convergence test case
[geostrophic_viz]
Expand Down

0 comments on commit 03a2cfe

Please sign in to comment.