Changed phaseUsageFromDeck to use eclipseState

This commit is contained in:
Kristian Flikka 2014-01-10 13:43:02 +01:00
parent 731fe7d3f4
commit 2ffcb219bb
2 changed files with 40 additions and 1 deletions

View File

@ -24,11 +24,50 @@
#include <opm/core/io/eclipse/EclipseGridParser.hpp>
#include <opm/core/props/BlackoilPhases.hpp>
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
namespace Opm
{
/// Looks at presence of WATER, OIL and GAS keywords in state object
/// to determine active phases.
inline PhaseUsage phaseUsageFromDeck(Opm::EclipseStateConstPtr eclipseState)
{
PhaseUsage pu;
std::fill(pu.phase_used, pu.phase_used + BlackoilPhases::MaxNumPhases, 0);
// Discover phase usage.
if (eclipseState->hasPhase(PhaseEnum::WATER)) {
pu.phase_used[BlackoilPhases::Aqua] = 1;
}
if (eclipseState->hasPhase(PhaseEnum::OIL)) {
pu.phase_used[BlackoilPhases::Liquid] = 1;
}
if (eclipseState->hasPhase(PhaseEnum::GAS)) {
pu.phase_used[BlackoilPhases::Vapour] = 1;
}
pu.num_phases = 0;
for (int i = 0; i < BlackoilPhases::MaxNumPhases; ++i) {
pu.phase_pos[i] = pu.num_phases;
pu.num_phases += pu.phase_used[i];
}
// Only 2 or 3 phase systems handled.
if (pu.num_phases < 2 || pu.num_phases > 3) {
OPM_THROW(std::runtime_error, "Cannot handle cases with " << pu.num_phases << " phases.");
}
// We need oil systems, since we do not support the keywords needed for
// water-gas systems.
if (!pu.phase_used[BlackoilPhases::Liquid]) {
OPM_THROW(std::runtime_error, "Cannot handle cases with no OIL, i.e. water-gas systems.");
}
return pu;
}
/// Looks at presence of WATER, OIL and GAS keywords in deck
/// to determine active phases.
inline PhaseUsage phaseUsageFromDeck(const EclipseGridParser& deck)

View File

@ -261,7 +261,7 @@ namespace Opm
}
// Obtain phase usage data.
PhaseUsage pu = phaseUsageFromDeck(deck);
PhaseUsage pu = phaseUsageFromDeck(eclipseState);
// These data structures will be filled in this constructor,
// then used to initialize the Wells struct.