mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Update phase condition vector from primary variables.
This is necessary as an interim measure, since the phase condition vectors are still used in property calculations.
This commit is contained in:
@@ -291,6 +291,10 @@ namespace Opm {
|
|||||||
void
|
void
|
||||||
updatePrimalVariableFromState(const BlackoilState& state);
|
updatePrimalVariableFromState(const BlackoilState& state);
|
||||||
|
|
||||||
|
/// Update the phaseCondition_ member based on the primalVariable_ member.
|
||||||
|
void
|
||||||
|
updatePhaseCondFromPrimalVariable();
|
||||||
|
|
||||||
/// Compute convergence based on total mass balance (tol_mb) and maximum
|
/// Compute convergence based on total mass balance (tol_mb) and maximum
|
||||||
/// residual mass balance (tol_cnv).
|
/// residual mass balance (tol_cnv).
|
||||||
bool getConvergence(const double dt);
|
bool getConvergence(const double dt);
|
||||||
|
|||||||
@@ -1330,9 +1330,6 @@ namespace {
|
|||||||
const V rsSat0 = fluidRsSat(p_old, cells_);
|
const V rsSat0 = fluidRsSat(p_old, cells_);
|
||||||
const V rsSat = fluidRsSat(p, cells_);
|
const V rsSat = fluidRsSat(p, cells_);
|
||||||
|
|
||||||
// reset the phase conditions
|
|
||||||
std::vector<PhasePresence> cond(nc);
|
|
||||||
|
|
||||||
std::fill(primalVariable_.begin(), primalVariable_.end(), PrimalVariables::Sg);
|
std::fill(primalVariable_.begin(), primalVariable_.end(), PrimalVariables::Sg);
|
||||||
|
|
||||||
if (has_disgas_) {
|
if (has_disgas_) {
|
||||||
@@ -1448,6 +1445,8 @@ namespace {
|
|||||||
const V bhp = bhp_old - dbhp_limited;
|
const V bhp = bhp_old - dbhp_limited;
|
||||||
std::copy(&bhp[0], &bhp[0] + bhp.size(), well_state.bhp().begin());
|
std::copy(&bhp[0], &bhp[0] + bhp.size(), well_state.bhp().begin());
|
||||||
|
|
||||||
|
// Update phase conditions used for property calculations.
|
||||||
|
updatePhaseCondFromPrimalVariable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -2115,9 +2114,40 @@ namespace {
|
|||||||
if (so[c] <= 0 && sg[c] > 0) {primalVariable_[c] = PrimalVariables::RV; }
|
if (so[c] <= 0 && sg[c] > 0) {primalVariable_[c] = PrimalVariables::RV; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
updatePhaseCondFromPrimalVariable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/// Update the phaseCondition_ member based on the primalVariable_ member.
|
||||||
|
template<class T>
|
||||||
|
void
|
||||||
|
FullyImplicitBlackoilSolver<T>::updatePhaseCondFromPrimalVariable()
|
||||||
|
{
|
||||||
|
const int nc = primalVariable_.size();
|
||||||
|
for (int c = 0; c < nc; ++c) {
|
||||||
|
phaseCondition_[c] = PhasePresence(); // No free phases.
|
||||||
|
phaseCondition_[c].setFreeWater(); // Not necessary for property calculation usage.
|
||||||
|
switch (primalVariable_[c]) {
|
||||||
|
case PrimalVariables::Sg:
|
||||||
|
phaseCondition_[c].setFreeOil();
|
||||||
|
phaseCondition_[c].setFreeGas();
|
||||||
|
break;
|
||||||
|
case PrimalVariables::RS:
|
||||||
|
phaseCondition_[c].setFreeOil();
|
||||||
|
break;
|
||||||
|
case PrimalVariables::RV:
|
||||||
|
phaseCondition_[c].setFreeGas();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
OPM_THROW(std::logic_error, "Unknown primary variable enum value in cell " << c << ": " << primalVariable_[c]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} // namespace Opm
|
} // namespace Opm
|
||||||
|
|||||||
Reference in New Issue
Block a user