Re-implement computeTotalMobility() in terms of computePhaseMobilities().

This commit is contained in:
Bård Skaflestad 2012-03-12 16:09:26 +01:00
parent 2ac5157148
commit c4f803fedd

View File

@ -89,17 +89,18 @@ namespace Opm
const std::vector<double>& s, const std::vector<double>& s,
std::vector<double>& totmob) std::vector<double>& totmob)
{ {
int num_cells = cells.size(); std::vector<double> pmobc;
int num_phases = props.numPhases();
totmob.resize(num_cells); computePhaseMobilities(props, cells, s, pmobc);
ASSERT(int(s.size()) == num_cells*num_phases);
std::vector<double> kr(num_cells*num_phases); const std::size_t np = props.numPhases();
props.relperm(num_cells, &s[0], &cells[0], &kr[0], 0); const std::vector<int>::size_type nc = cells.size();
const double* mu = props.viscosity();
for (int cell = 0; cell < num_cells; ++cell) { std::vector<double>(cells.size(), 0.0).swap(totmob);
totmob[cell] = 0;
for (int phase = 0; phase < num_phases; ++phase) { for (std::vector<int>::size_type c = 0; c < nc; ++c) {
totmob[cell] += kr[num_phases*cell + phase]/mu[phase]; for (std::size_t p = 0; p < np; ++p) {
totmob[ c ] += pmobc[c*np + p];
} }
} }
} }