Merge pull request #1098 from jokva/phase-in-runspec

Read phase information from EclipseState.runspec
This commit is contained in:
Joakim Hove 2016-11-02 11:52:24 +01:00 committed by GitHub
commit e348baa6c7
2 changed files with 23 additions and 9 deletions

View File

@ -25,7 +25,7 @@
#include <opm/parser/eclipse/Deck/Deck.hpp>
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/TableManager.hpp>
#include <opm/parser/eclipse/EclipseState/Runspec.hpp>
namespace Opm
@ -38,15 +38,15 @@ namespace Opm
PhaseUsage pu;
std::fill(pu.phase_used, pu.phase_used + BlackoilPhases::MaxNumPhases, 0);
const auto& tm = eclipseState.getTableManager();
const auto& phase = eclipseState.runspec().phases();
// Discover phase usage.
if (tm.hasPhase(Phase::PhaseEnum::WATER)) {
if (phase.active(Phase::WATER)) {
pu.phase_used[BlackoilPhases::Aqua] = 1;
}
if (tm.hasPhase(Phase::PhaseEnum::OIL)) {
if (phase.active(Phase::OIL)) {
pu.phase_used[BlackoilPhases::Liquid] = 1;
}
if (tm.hasPhase(Phase::PhaseEnum::GAS)) {
if (phase.active(Phase::GAS)) {
pu.phase_used[BlackoilPhases::Vapour] = 1;
}
pu.num_phases = 0;
@ -76,14 +76,17 @@ namespace Opm
PhaseUsage pu;
std::fill(pu.phase_used, pu.phase_used + BlackoilPhases::MaxNumPhases, 0);
Runspec runspec( deck );
const auto& phase = runspec.phases();
// Discover phase usage.
if (deck.hasKeyword("WATER")) {
if (phase.active( Phase::WATER )) {
pu.phase_used[BlackoilPhases::Aqua] = 1;
}
if (deck.hasKeyword("OIL")) {
if (phase.active( Phase::OIL )) {
pu.phase_used[BlackoilPhases::Liquid] = 1;
}
if (deck.hasKeyword("GAS")) {
if (phase.active( Phase::GAS )) {
pu.phase_used[BlackoilPhases::Vapour] = 1;
}
pu.num_phases = 0;

View File

@ -1004,6 +1004,17 @@ namespace Opm
}
InjectionSpecification::InjectorType toInjectorType( Phase p )
{
switch( p ) {
case Phase::OIL: return InjectionSpecification::OIL;
case Phase::WATER: return InjectionSpecification::WATER;
case Phase::GAS: return InjectionSpecification::GAS;
}
OPM_THROW(std::logic_error, "Invalid state." );
}
#define HANDLE_ICM(x) \
if (type == #x) { \
return InjectionSpecification::x; \
@ -1069,7 +1080,7 @@ namespace Opm
InjectionSpecification injection_specification;
ProductionSpecification production_specification;
if (group.isInjectionGroup(timeStep)) {
injection_specification.injector_type_ = toInjectorType(Phase::PhaseEnum2String(group.getInjectionPhase(timeStep)));
injection_specification.injector_type_ = toInjectorType(group.getInjectionPhase(timeStep));
injection_specification.control_mode_ = toInjectionControlMode(GroupInjection::ControlEnum2String(group.getInjectionControlMode(timeStep)));
injection_specification.surface_flow_max_rate_ = group.getSurfaceMaxRate(timeStep);
injection_specification.reservoir_flow_max_rate_ = group.getReservoirMaxRate(timeStep);