-
Notifications
You must be signed in to change notification settings - Fork 109
Cleanup YBoundary #3416
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
Merged
Merged
Cleanup YBoundary #3416
Changes from all commits
Commits
Show all changes
35 commits
Select commit
Hold shift + click to select a range
d26d00e
Only retain `iter` as public API
dschwoerer d42c8ab
Add dirichlet_o2 yboundary unit test
dschwoerer 71e6c82
Improve dirichlet_o2 unit test
dschwoerer c47e72c
Add interpolate_boundary_o2 test
dschwoerer 16b2935
Rename to interpolate_boundary_o?
dschwoerer 3303846
Rename to BoundaryLimitMode
dschwoerer 7de0aab
Be explicit about grid size
dschwoerer 152c639
Add test for extrapolate_boundary_o2
dschwoerer 4845503
Add dirichlet_o1 and dirichlet_o3 for FA
dschwoerer dfe11f1
Add tests for dirichlet_o1 and dirichlet_o3 for FA
dschwoerer 3f5c6a6
Add tests for interpolate/extrapolate for FA
dschwoerer 04fa6c9
Remove commented out code
dschwoerer 41df0a7
Fixup boundary_free functions
dschwoerer 59660e9
Add tests for extrapolate_boundary_free and set_free
dschwoerer a5566a3
Add unit test for grad_o2
dschwoerer b5beb22
add test for next_o2
dschwoerer 27ec403
Implementations have to start with _
dschwoerer 09fa911
getBoundaries can be const
dschwoerer 1608fe4
Return BoutReal for computed values
dschwoerer 2819acf
Fix sign error
dschwoerer 2ad4324
Switch to bout::boundary::BoundaryRegionY*
dschwoerer 00c9b40
Remove legacy implementation for FA
dschwoerer 2adbad5
Remove legacy implementation for FCI
dschwoerer b413c14
Update documentation
dschwoerer 69dc6b0
Add more unit tests
dschwoerer cc4a312
Switch to shared_ptr for getBoundaries
dschwoerer 6408fa4
Add even more unit tests
dschwoerer f14e7bb
Merge remote-tracking branch 'origin/next' into yboundary-cleanup
dschwoerer 2f0db39
Add missing file
dschwoerer 402c44b
Apply clang-tidy fixes
dschwoerer e9ac3b9
Use unsigned for enum
dschwoerer 8350185
Do not try to delete shared_ptr
dschwoerer 8e35339
Remove unused header
dschwoerer 1777961
Apply clang-tidy fixes
dschwoerer f9549c2
Fix y location
dschwoerer 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
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| #pragma once | ||
|
|
||
| #include <bout/bout_types.hxx> | ||
|
|
||
| #include <cstdint> | ||
|
|
||
| namespace bout { | ||
| namespace boundary { | ||
| /// Types of free boundary condition | ||
| /// ================== =================================================== | ||
| /// Name Description | ||
| /// ================== =================================================== | ||
| /// ``limited`` use exponential if decreasing, otherwise Neumanm | ||
| /// ``exponential`` use exponential extrapolation | ||
| /// ``linear`` use linear extrapolation | ||
| /// ================== =================================================== | ||
| enum class BoundaryFreeExtrapolation : std::uint8_t { limited, exponential, linear }; | ||
|
dschwoerer marked this conversation as resolved.
dschwoerer marked this conversation as resolved.
|
||
|
|
||
| // Limited free gradient of log of a quantity | ||
| // This ensures that the guard cell values remain positive | ||
| // while also ensuring that the quantity never increases | ||
| // | ||
| // fm fc | fp | ||
| // ^ boundary | ||
| // | ||
| // exp( 2*log(fc) - log(fm) ) | ||
| inline BoutReal limitFreeScale(BoutReal fm, BoutReal fc, | ||
| bout::boundary::BoundaryFreeExtrapolation mode) { | ||
| if ((fm < fc) && (mode == bout::boundary::BoundaryFreeExtrapolation::limited)) { | ||
| return fc; // Neumann rather than increasing into boundary | ||
| } | ||
| if (fm < 1e-10) { | ||
| return fc; // Low / no density condition | ||
| } | ||
|
|
||
| BoutReal fp = 0; | ||
| switch (mode) { | ||
| case bout::boundary::BoundaryFreeExtrapolation::limited: | ||
| case bout::boundary::BoundaryFreeExtrapolation::exponential: | ||
| fp = fc * fc / fm; // Exponential | ||
| break; | ||
| case bout::boundary::BoundaryFreeExtrapolation::linear: | ||
| fp = (2.0 * fc) - fm; // Linear | ||
| break; | ||
| } | ||
|
|
||
| #if CHECKLEVEL >= 2 | ||
| if (!std::isfinite(fp)) { | ||
| throw BoutException("SheathBoundary limitFree: {}, {} -> {}", fm, fc, fp); | ||
| } | ||
| #endif | ||
|
|
||
| return fp; | ||
| } | ||
|
|
||
| } // namespace boundary | ||
| } // namespace bout | ||
This file contains hidden or 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
This file contains hidden or 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.
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.
Uh oh!
There was an error while loading. Please reload this page.