Merge pull request #5293 from totto82/fixInitGW

Fix gas-water initialization with transision zone
This commit is contained in:
Atgeirr Flø Rasmussen
2024-05-02 15:57:13 +02:00
committed by GitHub
2 changed files with 40 additions and 24 deletions
@@ -448,6 +448,13 @@ operator()(double s) const
fluidState.setSaturation(FluidSystem::gasPhaseIdx, 0.0);
fluidState.setSaturation(phase_, s);
// This code should only be called for water or gas phase
assert(phase_ != FluidSystem::oilPhaseIdx);
// The capillaryPressure code only uses the wetting phase saturation
if (phase_ == FluidSystem::gasPhaseIdx) {
fluidState.setSaturation(FluidSystem::waterPhaseIdx, 1.0 - s);
fluidState.setSaturation(FluidSystem::oilPhaseIdx, 1.0 - s);
}
std::array<double, FluidSystem::numPhases> pc{0.0};
using MaterialLaw = typename MaterialLawManager::MaterialLaw;
MaterialLaw::capillaryPressures(pc, matParams, fluidState);
@@ -578,9 +578,11 @@ deriveSaturations(const Position& x,
this->setEvaluationPoint(x, reg, ptable);
this->initializePhaseQuantities();
if (ptable.waterActive()) { this->deriveWaterSat(); }
if (ptable.gasActive()) { this->deriveGasSat(); }
if (ptable.waterActive()) { this->deriveWaterSat(); }
if (this->isOverlappingTransition()) {
this->fixUnphysicalTransition();
}
@@ -667,6 +669,12 @@ void PhaseSaturations<MaterialLawManager, FluidSystem, Region, CellID>::deriveWa
{
auto& sw = this->sat_.water;
const auto oilActive = this->evalPt_.ptable->oilActive();
if (!oilActive) {
// for 2p gas+water we set the water saturation to 1.0 - sg
sw = 1.0 - this->sat_.gas;
}
else {
const auto isIncr = false; // dPcow/dSw <= 0 for all Sw.
if (this->isConstCapPress(this->waterPos())) {
@@ -700,6 +708,7 @@ void PhaseSaturations<MaterialLawManager, FluidSystem, Region, CellID>::deriveWa
}
}
}
}
}
template <class MaterialLawManager, class FluidSystem, class Region, typename CellID>