Bugfix: in SATNUM treatment, allow for inactive cells.

This commit is contained in:
Atgeirr Flø Rasmussen 2012-04-19 15:00:56 +02:00
parent 7b382a82e8
commit b9b01326c6
4 changed files with 15 additions and 10 deletions

View File

@ -27,7 +27,7 @@ namespace Opm
{
rock_.init(deck, global_cell);
pvt_.init(deck);
satprops_.init(deck);
satprops_.init(deck, global_cell);
if (pvt_.numPhases() != satprops_.numPhases()) {
THROW("BlackoilPropertiesBasic::BlackoilPropertiesBasic() - Inconsistent number of phases in pvt data ("
<< pvt_.numPhases() << ") and saturation-dependent function data (" << satprops_.numPhases() << ").");

View File

@ -31,7 +31,7 @@ namespace Opm
{
rock_.init(deck, global_cell);
pvt_.init(deck);
satprops_.init(deck);
satprops_.init(deck, global_cell);
if (pvt_.numPhases() != satprops_.numPhases()) {
THROW("IncompPropertiesFromDeck::IncompPropertiesFromDeck() - Inconsistent number of phases in pvt data ("
<< pvt_.numPhases() << ") and saturation-dependent function data (" << satprops_.numPhases() << ").");

View File

@ -32,7 +32,8 @@ namespace Opm
}
/// Initialize from deck.
void SaturationPropsFromDeck::init(const EclipseGridParser& deck)
void SaturationPropsFromDeck::init(const EclipseGridParser& deck,
const std::vector<int>& global_cell)
{
phase_usage_ = phaseUsageFromDeck(deck);
@ -42,15 +43,17 @@ namespace Opm
THROW("SaturationPropsFromDeck::init() -- oil phase must be active.");
}
// Obtain SATNUM, if it exists.
// Obtain SATNUM, if it exists, and create cell_to_func_.
// Otherwise, let the cell_to_func_ mapping be just empty.
int satfuncs_expected = 1;
if (deck.hasField("SATNUM")) {
cell_to_func_ = deck.getIntegerValue("SATNUM");
satfuncs_expected = *std::max_element(cell_to_func_.begin(), cell_to_func_.end());
// Must subtract 1 to get numbering from 0.
std::transform(cell_to_func_.begin(), cell_to_func_.end(),
cell_to_func_.begin(), std::bind2nd(std::plus<double>(), -1));
const std::vector<int>& satnum = deck.getIntegerValue("SATNUM");
satfuncs_expected = *std::max_element(satnum.begin(), satnum.end());
int num_cells = global_cell.size();
cell_to_func_.resize(num_cells);
for (int cell = 0; cell < num_cells; ++cell) {
cell_to_func_[cell] = satnum[global_cell[cell]] - 1;
}
}
// Find number of tables, check for consistency.

View File

@ -35,7 +35,9 @@ namespace Opm
SaturationPropsFromDeck();
/// Initialize from deck.
void init(const EclipseGridParser& deck);
/// global_cell maps from grid cells to their original logical Cartesian indices.
void init(const EclipseGridParser& deck,
const std::vector<int>& global_cell);
/// \return P, the number of phases.
int numPhases() const;