mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06: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:
@@ -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