Fix some bugs: referring to the wrong phase in two places.

This commit is contained in:
Atgeirr Flø Rasmussen 2013-05-27 00:24:38 +02:00
parent 09c4362e3c
commit 78fa581417

View File

@ -34,6 +34,7 @@
#include <cassert> #include <cassert>
#include <iomanip> #include <iomanip>
typedef AutoDiff::ForwardBlock<double> ADB; typedef AutoDiff::ForwardBlock<double> ADB;
typedef ADB::V V; typedef ADB::V V;
typedef ADB::M M; typedef ADB::M M;
@ -200,7 +201,8 @@ namespace Opm {
} }
if (resTooLarge) { if (resTooLarge) {
THROW("Failed to compute converged solution in " << it << " iterations."); std::cerr << "Failed to compute converged solution in " << it << " iterations. Ignoring!\n";
// THROW("Failed to compute converged solution in " << it << " iterations.");
} }
} }
@ -329,6 +331,8 @@ namespace Opm {
assert (not x.saturation().empty()); assert (not x.saturation().empty());
const DataBlock s = Eigen::Map<const DataBlock>(& x.saturation()[0], nc, np); const DataBlock s = Eigen::Map<const DataBlock>(& x.saturation()[0], nc, np);
const Opm::PhaseUsage pu = fluid_.phaseUsage(); const Opm::PhaseUsage pu = fluid_.phaseUsage();
// We do not handle a Water/Gas situation correctly, guard against it.
ASSERT (active_[ Oil]);
if (active_[ Water ]) { if (active_[ Water ]) {
const V sw = s.col(pu.phase_pos[ Water ]); const V sw = s.col(pu.phase_pos[ Water ]);
vars0.push_back(sw); vars0.push_back(sw);
@ -568,7 +572,7 @@ namespace Opm {
so -= sw; so -= sw;
varstart += nc; varstart += nc;
for (int c = 0; c < nc; ++c) { for (int c = 0; c < nc; ++c) {
state.saturation()[c*np + pos] = so[c]; state.saturation()[c*np + pos] = sw[c];
} }
} }
if (active_[ Gas ]) { if (active_[ Gas ]) {
@ -583,7 +587,7 @@ namespace Opm {
} }
} }
if (active_[ Oil ]) { if (active_[ Oil ]) {
const int pos = pu.phase_pos[ Gas ]; const int pos = pu.phase_pos[ Oil ];
for (int c = 0; c < nc; ++c) { for (int c = 0; c < nc; ++c) {
state.saturation()[c*np + pos] = so[c]; state.saturation()[c*np + pos] = so[c];
} }