-
Notifications
You must be signed in to change notification settings - Fork 13
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
Mixed fs limiter #459
Merged
Merged
Mixed fs limiter #459
Changes from 7 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
8e14e7a
start MixedFSLimiter
ta440 6062ebf
MixedFSLimiter is operational
ta440 18867a5
added an integration test for a mixed function space limiter
ta440 021d9d7
changed mixed_fs_limiter test to DG and DG1_equispaced
ta440 4186efc
lint
ta440 792bb45
lint
ta440 126ce4e
lint
ta440 c7edb1b
removed fabs from minimum diagnostic
ta440 2ba9e61
Merge branch 'main' into mixed_fs_limiter
ta440 dd18af9
tom changes
ta440 3a7942d
revert diagnostics file
ta440 1c301e6
Merge branch 'main' into mixed_fs_limiter
tommbendall File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -12,7 +12,7 @@ | |||||
|
||||||
import numpy as np | ||||||
|
||||||
__all__ = ["DG1Limiter", "ThetaLimiter", "NoLimiter"] | ||||||
__all__ = ["DG1Limiter", "ThetaLimiter", "NoLimiter", "MixedFSLimiter"] | ||||||
|
||||||
|
||||||
class DG1Limiter(object): | ||||||
|
@@ -178,3 +178,35 @@ def apply(self, field): | |||||
applied, if this was not a blank limiter. | ||||||
""" | ||||||
pass | ||||||
|
||||||
|
||||||
class MixedFSLimiter(object): | ||||||
"""An object to hold a dictionary that defines limiters for transported prognostic | ||||||
variables. Different limiters may be applied to different fields and not every transported variable needs a defined limiter. | ||||||
""" | ||||||
|
||||||
def __init__(self, equation, sublimiters): | ||||||
""" | ||||||
Args: | ||||||
equation (:class: 'PrognosticEquationSet'): the prognostic equation(s) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
I think we need a back quotation here and not forward ones! |
||||||
sublimiters (dict): A dictionary holding limiters defined for individual prognostic variables | ||||||
Raises: | ||||||
ValueError: If a limiter is defined for a field that is not in the prognostic variable set | ||||||
""" | ||||||
self.sublimiters = sublimiters | ||||||
|
||||||
for field, sublimiter in sublimiters.items(): | ||||||
# Check that the field is in the prognostic variable set: | ||||||
if field not in equation.field_names: | ||||||
raise ValueError(f"The limiter defined for {field} is for a field that does not exist in the equation set") | ||||||
else: | ||||||
self.sublimiters[field].idx = equation.field_names.index(field) | ||||||
|
||||||
def apply(self, fields): | ||||||
""" | ||||||
Apply the individual limiters to specific prognostic variables | ||||||
""" | ||||||
|
||||||
for _, sublimiter in self.sublimiters.items(): | ||||||
field = fields.subfunctions[sublimiter.idx] | ||||||
sublimiter.apply(field) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When the docstrings go over more than one line, I think we should generally put the open quotation marks on their own line