From 23ef9dce5c0511c3ea05a025d8178b5255a9d2ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Kvalsvik?= Date: Tue, 1 Nov 2016 11:37:27 +0100 Subject: [PATCH] Read phase information from EclipseState.runspec --- opm/core/props/phaseUsageFromDeck.hpp | 19 +++++++++++-------- opm/core/wells/WellsGroup.cpp | 13 ++++++++++++- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/opm/core/props/phaseUsageFromDeck.hpp b/opm/core/props/phaseUsageFromDeck.hpp index ea347d9d..18b42ea0 100644 --- a/opm/core/props/phaseUsageFromDeck.hpp +++ b/opm/core/props/phaseUsageFromDeck.hpp @@ -25,7 +25,7 @@ #include #include -#include +#include 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; diff --git a/opm/core/wells/WellsGroup.cpp b/opm/core/wells/WellsGroup.cpp index 6ec0cf10..e9267dde 100644 --- a/opm/core/wells/WellsGroup.cpp +++ b/opm/core/wells/WellsGroup.cpp @@ -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);