Merge remote-tracking branch 'upstream/master' into New_BLACKOIL_SIMULATOR

This commit is contained in:
Kai Bao 2014-07-25 15:56:52 +02:00
commit 013e4e452a
2 changed files with 41 additions and 4 deletions

View File

@ -291,6 +291,10 @@ namespace Opm {
void
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
/// residual mass balance (tol_cnv).
bool getConvergence(const double dt);

View File

@ -1330,9 +1330,6 @@ namespace {
const V rsSat0 = fluidRsSat(p_old, cells_);
const V rsSat = fluidRsSat(p, cells_);
// reset the phase conditions
std::vector<PhasePresence> cond(nc);
std::fill(primalVariable_.begin(), primalVariable_.end(), PrimalVariables::Sg);
if (has_disgas_) {
@ -1448,6 +1445,8 @@ namespace {
const V bhp = bhp_old - dbhp_limited;
std::copy(&bhp[0], &bhp[0] + bhp.size(), well_state.bhp().begin());
// Update phase conditions used for property calculations.
updatePhaseCondFromPrimalVariable();
}
@ -2115,9 +2114,43 @@ namespace {
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()
{
if (! active_[Gas]) {
OPM_THROW(std::logic_error, "updatePhaseCondFromPrimarVariable() logic requires active gas phase.");
}
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