mirror of
https://github.com/OPM/opm-simulators.git
synced 2026-10-12 08:54:53 -05:00
each phase needs to be above certain value to be treated to be present
it helps to recover some RESTART running based on single precision format.
This commit is contained in:
1 parent
9e483bed45
commit
56e829329f
1 file changed
+27
@@ -1868,6 +1868,9 @@ private:
|
||||
elemFluidState.setPvtRegionIndex(pvtRegionIndex(elemIdx));
|
||||
eclWriter_->eclOutputModule().initHysteresisParams(this->simulator(), elemIdx);
|
||||
eclWriter_->eclOutputModule().assignToFluidState(elemFluidState, elemIdx);
|
||||
|
||||
processRestartSaturations_(elemFluidState);
|
||||
|
||||
lastRs_[elemIdx] = elemFluidState.Rs();
|
||||
lastRv_[elemIdx] = elemFluidState.Rv();
|
||||
if (enableSolvent)
|
||||
@@ -1894,6 +1897,30 @@ private:
|
||||
|
||||
}
|
||||
|
||||
void processRestartSaturations_(InitialFluidState& elemFluidState) {
|
||||
// each phase needs to be above certain value to be claimed to be existing
|
||||
// this is used to recover some RESTART running with the defaulted single-precision format
|
||||
const Scalar smallSaturationTolerance = 1.e-6;
|
||||
Scalar sumSaturation = 0.;
|
||||
for (size_t phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
|
||||
if (FluidSystem::phaseIsActive(phaseIdx)) {
|
||||
if (elemFluidState.saturation(phaseIdx) < smallSaturationTolerance)
|
||||
elemFluidState.setSaturation(phaseIdx, 0.);
|
||||
|
||||
sumSaturation += elemFluidState.saturation(phaseIdx);
|
||||
}
|
||||
}
|
||||
|
||||
assert(sumSaturation > 0.);
|
||||
|
||||
for (size_t phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
|
||||
if (FluidSystem::phaseIsActive(phaseIdx)) {
|
||||
const Scalar saturation = elemFluidState.saturation(phaseIdx) / sumSaturation;
|
||||
elemFluidState.setSaturation(phaseIdx, saturation);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void readExplicitInitialCondition_()
|
||||
{
|
||||
const auto& vanguard = this->simulator().vanguard();
|
||||
|
||||
Reference in new issue
Block a user