Renamed residual_.reservoir -> residual_.mass_balance.

Also initialize in initializer list, eliminating the need for
the allocateResidual() method.
This commit is contained in:
Atgeirr Flø Rasmussen 2013-05-24 22:16:06 +02:00
parent a3be33a312
commit 9894fdc2d4
2 changed files with 11 additions and 15 deletions

View File

@ -150,8 +150,9 @@ namespace Opm {
, wops_ (wells) , wops_ (wells)
, grav_ (gravityOperator(grid_, ops_, geo_)) , grav_ (gravityOperator(grid_, ops_, geo_))
, rq_ (fluid.numPhases()) , rq_ (fluid.numPhases())
, residual_ ( { std::vector<ADB>(fluid.numPhases(), ADB::null()),
ADB::null() } )
{ {
allocateResidual();
} }
void void
@ -244,12 +245,6 @@ namespace Opm {
} }
void
FullyImplicitBlackoilSolver::allocateResidual()
{
residual_.reservoir.resize(fluid_.numPhases(), ADB::null());
}
FullyImplicitBlackoilSolver::SolutionState FullyImplicitBlackoilSolver::SolutionState
FullyImplicitBlackoilSolver::constantState(const BlackoilState& x) FullyImplicitBlackoilSolver::constantState(const BlackoilState& x)
{ {
@ -405,7 +400,7 @@ namespace Opm {
for (int phase = 0; phase < fluid_.numPhases(); ++phase) { for (int phase = 0; phase < fluid_.numPhases(); ++phase) {
computeMassFlux(phase, transi, kr, state); computeMassFlux(phase, transi, kr, state);
residual_.reservoir[ phase ] = residual_.mass_balance[ phase ] =
dtpv*(rq_[phase].accum[1] - rq_[phase].accum[0]) dtpv*(rq_[phase].accum[1] - rq_[phase].accum[0])
+ ops_.div*rq_[phase].mflux; + ops_.div*rq_[phase].mflux;
} }
@ -416,7 +411,7 @@ namespace Opm {
rq_[po].head.value()); rq_[po].head.value());
const ADB Rs = upwind.select(state.Rs); const ADB Rs = upwind.select(state.Rs);
residual_.reservoir[ Gas ] += ops_.div * (Rs * rq_[po].mflux); residual_.mass_balance[ Gas ] += ops_.div * (Rs * rq_[po].mflux);
} }
} }
@ -473,8 +468,8 @@ namespace Opm {
{ {
double r = 0; double r = 0;
for (std::vector<ADB>::const_iterator for (std::vector<ADB>::const_iterator
b = residual_.reservoir.begin(), b = residual_.mass_balance.begin(),
e = residual_.reservoir.end(); e = residual_.mass_balance.end();
b != e; ++b) b != e; ++b)
{ {
r = std::max(r, (*b).value().matrix().norm()); r = std::max(r, (*b).value().matrix().norm());

View File

@ -106,14 +106,15 @@ namespace Opm {
std::vector<ReservoirResidualQuant> rq_; std::vector<ReservoirResidualQuant> rq_;
// The mass_balance vector has one element for each active phase,
// each of which has size equal to the number of cells.
// The well_eq has size equal to the number of wells.
struct { struct {
std::vector<ADB> reservoir; std::vector<ADB> mass_balance;
ADB well_eq;
} residual_; } residual_;
// Private methods. // Private methods.
void
allocateResidual();
SolutionState SolutionState
constantState(const BlackoilState& x); constantState(const BlackoilState& x);