Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Separate geostrophic thresholds for h and norm. vel. #139

Merged
merged 2 commits into from
Oct 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading