Also refactor getWellConvergence() like getConvergence().

This commit is contained in:
Atgeirr Flø Rasmussen 2015-09-30 15:20:04 +02:00
parent dcb78877eb
commit d29ee6967c

View File

@ -2312,7 +2312,8 @@ namespace detail {
int nc, int nc,
int nw) const int nw) const
{ {
const int num_elems = B.cols(); const int np = asImpl().numPhases();
const int nm = asImpl().numMaterials();
// Do the global reductions // Do the global reductions
#if HAVE_MPI #if HAVE_MPI
@ -2361,22 +2362,24 @@ namespace detail {
else else
#endif #endif
{ {
B_avg.resize(num_elems); B_avg.resize(nm);
maxCoeff.resize(num_elems); maxCoeff.resize(nm);
R_sum.resize(num_elems); R_sum.resize(nm);
maxNormWell.resize(num_elems); maxNormWell.resize(np);
for ( int idx = 0; idx < num_elems; ++idx ) for ( int idx = 0; idx < nm; ++idx )
{ {
B_avg[idx] = B.col(idx).sum()/nc; B_avg[idx] = B.col(idx).sum()/nc;
maxCoeff[idx] = tempV.col(idx).maxCoeff(); maxCoeff[idx] = tempV.col(idx).maxCoeff();
R_sum[idx] = R.col(idx).sum(); R_sum[idx] = R.col(idx).sum();
assert(nm >= np);
if (idx < np) {
maxNormWell[idx] = 0.0; maxNormWell[idx] = 0.0;
for ( int w = 0; w < nw; ++w ) for ( int w = 0; w < nw; ++w ) {
{
maxNormWell[idx] = std::max(maxNormWell[idx], std::abs(residual_.well_flux_eq.value()[nw*idx + w])); maxNormWell[idx] = std::max(maxNormWell[idx], std::abs(residual_.well_flux_eq.value()[nw*idx + w]));
} }
} }
}
// Compute total pore volume // Compute total pore volume
return geo_.poreVolume().sum(); return geo_.poreVolume().sum();
} }