-
Notifications
You must be signed in to change notification settings - Fork 67
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
Fixes to the special case with almost only water #803
Closed
Closed
Changes from all commits
Commits
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
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 |
---|---|---|
|
@@ -495,8 +495,6 @@ public: | |
*/ | ||
bool adaptPrimaryVariables(const Problem& problem, unsigned globalDofIdx, Scalar eps = 0.0) | ||
{ | ||
static const Scalar thresholdWaterFilledCell = 1.0 - eps; | ||
|
||
// this function accesses quite a few black-oil specific low-level functions | ||
// directly for better performance (instead of going the canonical way through | ||
// the IntensiveQuantities). The reason is that most intensive quantities are not | ||
|
@@ -548,25 +546,30 @@ public: | |
|
||
// special case cells with almost only water | ||
// use both saturations (if the phase is enabled) | ||
// to avoid a singular matrix. | ||
// almost is defined as sw >= 1.0-1e-6. | ||
static const Scalar thresholdWaterFilledCell = 1.0 - 1e-6; | ||
|
||
// if dissolved gas in water is enabled we shouldn't enter | ||
// here but instead switch to Rsw as primary variable | ||
// as sw >= 1.0 -> gas <= 0 (i.e. gas phase disappears) | ||
// as sw >= 1.0 -> sg <= 0 (i.e. gas phase disappears) | ||
if (sw >= thresholdWaterFilledCell && !FluidSystem::enableDissolvedGasInWater()) { | ||
|
||
// make sure water saturations does not exceed 1.0 | ||
// make sure water saturations does not exceed 1.01 | ||
// we dont stricly force it to 1.0 to avoid convergence issue. | ||
if constexpr (waterEnabled) { | ||
(*this)[Indices::waterSwitchIdx] = 1.0; | ||
(*this)[Indices::waterSwitchIdx] = std::min(1.01, sw); | ||
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. It is very unfortunate if we have to let saturations go outside physical constraints, especially by so much. Is this change crucial? If so, could 1 + eps be used here instead of 1.01? |
||
assert(primaryVarsMeaningWater() == WaterMeaning::Sw); | ||
} | ||
|
||
// the hydrocarbon gas saturation is set to 0.0 | ||
if constexpr (compositionSwitchEnabled) | ||
(*this)[Indices::compositionSwitchIdx] = 0.0; | ||
|
||
changed = primaryVarsMeaningGas() != GasMeaning::Sg; | ||
if(changed) { | ||
if constexpr (compositionSwitchEnabled) | ||
if constexpr (compositionSwitchEnabled) { | ||
setPrimaryVarsMeaningGas(GasMeaning::Sg); | ||
|
||
} | ||
// use water pressure? | ||
} | ||
return changed; | ||
|
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.
(Still in Draft, but I will make a few comments.)
Why not use the eps argument as before? Do we need to use eps 0 for other reasons?