InjectorType enum is moved out from Well class

This commit is contained in:
Joakim Hove
2020-03-03 09:08:02 +01:00
parent 2d31a192b8
commit 9268bcb2ac
10 changed files with 84 additions and 81 deletions

View File

@@ -1278,7 +1278,7 @@ public:
const auto ctlMode = controls.cmode; const auto ctlMode = controls.cmode;
const auto injType = controls.injector_type; const auto injType = controls.injector_type;
using CMode = ::Opm::Well::InjectorCMode; using CMode = ::Opm::Well::InjectorCMode;
using WType = ::Opm::Well::InjectorType; using WType = ::Opm::InjectorType;
auto ftype = [](const auto wtype) -> std::string auto ftype = [](const auto wtype) -> std::string
{ {
@@ -1404,7 +1404,7 @@ public:
const auto ctlMode = controls.cmode; const auto ctlMode = controls.cmode;
const auto injType = controls.injector_type; const auto injType = controls.injector_type;
using CMode = ::Opm::Well::InjectorCMode; using CMode = ::Opm::Well::InjectorCMode;
using WType = ::Opm::Well::InjectorType; using WType = ::Opm::InjectorType;
auto ftype = [](const auto wtype) -> std::string auto ftype = [](const auto wtype) -> std::string
{ {

View File

@@ -185,16 +185,16 @@ public:
well->setWellType(Well::Injector); well->setWellType(Well::Injector);
const auto controls = deckWell.injectionControls(summaryState); const auto controls = deckWell.injectionControls(summaryState);
switch (controls.injector_type) { switch (controls.injector_type) {
case Opm::Well::InjectorType::WATER: case Opm::InjectorType::WATER:
well->setInjectedPhaseIndex(FluidSystem::waterPhaseIdx); well->setInjectedPhaseIndex(FluidSystem::waterPhaseIdx);
break; break;
case Opm::Well::InjectorType::GAS: case Opm::InjectorType::GAS:
well->setInjectedPhaseIndex(FluidSystem::gasPhaseIdx); well->setInjectedPhaseIndex(FluidSystem::gasPhaseIdx);
break; break;
case Opm::Well::InjectorType::OIL: case Opm::InjectorType::OIL:
well->setInjectedPhaseIndex(FluidSystem::oilPhaseIdx); well->setInjectedPhaseIndex(FluidSystem::oilPhaseIdx);
break; break;
case Opm::Well::InjectorType::MULTI: case Opm::InjectorType::MULTI:
throw std::runtime_error("Not implemented: Multi-phase injector wells"); throw std::runtime_error("Not implemented: Multi-phase injector wells");
} }
@@ -226,19 +226,19 @@ public:
} }
switch (controls.injector_type) { switch (controls.injector_type) {
case Opm::Well::InjectorType::WATER: case Opm::InjectorType::WATER:
well->setVolumetricPhaseWeights(/*oil=*/0.0, /*gas=*/0.0, /*water=*/1.0); well->setVolumetricPhaseWeights(/*oil=*/0.0, /*gas=*/0.0, /*water=*/1.0);
break; break;
case Opm::Well::InjectorType::OIL: case Opm::InjectorType::OIL:
well->setVolumetricPhaseWeights(/*oil=*/1.0, /*gas=*/0.0, /*water=*/0.0); well->setVolumetricPhaseWeights(/*oil=*/1.0, /*gas=*/0.0, /*water=*/0.0);
break; break;
case Opm::Well::InjectorType::GAS: case Opm::InjectorType::GAS:
well->setVolumetricPhaseWeights(/*oil=*/0.0, /*gas=*/1.0, /*water=*/0.0); well->setVolumetricPhaseWeights(/*oil=*/0.0, /*gas=*/1.0, /*water=*/0.0);
break; break;
case Opm::Well::InjectorType::MULTI: case Opm::InjectorType::MULTI:
throw std::runtime_error("Not implemented: Multi-phase injection wells"); throw std::runtime_error("Not implemented: Multi-phase injection wells");
} }

View File

@@ -382,7 +382,7 @@ namespace Opm
Opm::DeferredLogger& deferred_logger); Opm::DeferredLogger& deferred_logger);
void assembleGroupProductionControl(const Group& group, const WellState& well_state, const Opm::Schedule& schedule, const SummaryState& summaryState, EvalWell& control_eq, double efficincyFactor, Opm::DeferredLogger& deferred_logger); void assembleGroupProductionControl(const Group& group, const WellState& well_state, const Opm::Schedule& schedule, const SummaryState& summaryState, EvalWell& control_eq, double efficincyFactor, Opm::DeferredLogger& deferred_logger);
void assembleGroupInjectionControl(const Group& group, const WellState& well_state, const Opm::Schedule& schedule, const SummaryState& summaryState, const Well::InjectorType& injectorType, EvalWell& control_eq, double efficincyFactor, Opm::DeferredLogger& deferred_logger); void assembleGroupInjectionControl(const Group& group, const WellState& well_state, const Opm::Schedule& schedule, const SummaryState& summaryState, const InjectorType& injectorType, EvalWell& control_eq, double efficincyFactor, Opm::DeferredLogger& deferred_logger);
void assemblePressureEq(const int seg) const; void assemblePressureEq(const int seg) const;

View File

@@ -301,20 +301,20 @@ namespace Opm
{ {
const auto& controls = well.injectionControls(summaryState); const auto& controls = well.injectionControls(summaryState);
Well::InjectorType injectorType = controls.injector_type; InjectorType injectorType = controls.injector_type;
int phasePos; int phasePos;
switch (injectorType) { switch (injectorType) {
case Well::InjectorType::WATER: case InjectorType::WATER:
{ {
phasePos = pu.phase_pos[BlackoilPhases::Aqua]; phasePos = pu.phase_pos[BlackoilPhases::Aqua];
break; break;
} }
case Well::InjectorType::OIL: case InjectorType::OIL:
{ {
phasePos = pu.phase_pos[BlackoilPhases::Liquid]; phasePos = pu.phase_pos[BlackoilPhases::Liquid];
break; break;
} }
case Well::InjectorType::GAS: case InjectorType::GAS:
{ {
phasePos = pu.phase_pos[BlackoilPhases::Vapour]; phasePos = pu.phase_pos[BlackoilPhases::Vapour];
break; break;
@@ -891,7 +891,7 @@ namespace Opm
auto phase = well.getInjectionProperties().injectorType; auto phase = well.getInjectionProperties().injectorType;
if (FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx)) { if (FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx)) {
if (phase == Well::InjectorType::WATER) { if (phase == InjectorType::WATER) {
primary_variables_[seg][WFrac] = 1.0; primary_variables_[seg][WFrac] = 1.0;
} else { } else {
primary_variables_[seg][WFrac] = 0.0; primary_variables_[seg][WFrac] = 0.0;
@@ -899,7 +899,7 @@ namespace Opm
} }
if (FluidSystem::phaseIsActive(FluidSystem::gasPhaseIdx)) { if (FluidSystem::phaseIsActive(FluidSystem::gasPhaseIdx)) {
if (phase == Well::InjectorType::GAS) { if (phase == InjectorType::GAS) {
primary_variables_[seg][GFrac] = 1.0; primary_variables_[seg][GFrac] = 1.0;
} else { } else {
primary_variables_[seg][GFrac] = 0.0; primary_variables_[seg][GFrac] = 0.0;
@@ -1650,18 +1650,18 @@ namespace Opm
if (FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx) if (FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx)
&& Indices::canonicalToActiveComponentIndex(FluidSystem::waterCompIdx) == comp_idx && Indices::canonicalToActiveComponentIndex(FluidSystem::waterCompIdx) == comp_idx
&& phase == Well::InjectorType::WATER) && phase == InjectorType::WATER)
return primary_variables_evaluation_[seg][GTotal] / scalingFactor(ebosCompIdxToFlowCompIdx(comp_idx)); return primary_variables_evaluation_[seg][GTotal] / scalingFactor(ebosCompIdxToFlowCompIdx(comp_idx));
if (FluidSystem::phaseIsActive(FluidSystem::oilPhaseIdx) if (FluidSystem::phaseIsActive(FluidSystem::oilPhaseIdx)
&& Indices::canonicalToActiveComponentIndex(FluidSystem::oilCompIdx) == comp_idx && Indices::canonicalToActiveComponentIndex(FluidSystem::oilCompIdx) == comp_idx
&& phase == Well::InjectorType::OIL) && phase == InjectorType::OIL)
return primary_variables_evaluation_[seg][GTotal] / scalingFactor(ebosCompIdxToFlowCompIdx(comp_idx)); return primary_variables_evaluation_[seg][GTotal] / scalingFactor(ebosCompIdxToFlowCompIdx(comp_idx));
if (FluidSystem::phaseIsActive(FluidSystem::gasPhaseIdx) if (FluidSystem::phaseIsActive(FluidSystem::gasPhaseIdx)
&& Indices::canonicalToActiveComponentIndex(FluidSystem::gasCompIdx) == comp_idx && Indices::canonicalToActiveComponentIndex(FluidSystem::gasCompIdx) == comp_idx
&& phase == Well::InjectorType::GAS) && phase == InjectorType::GAS)
return primary_variables_evaluation_[seg][GTotal] / scalingFactor(ebosCompIdxToFlowCompIdx(comp_idx)); return primary_variables_evaluation_[seg][GTotal] / scalingFactor(ebosCompIdxToFlowCompIdx(comp_idx));
return 0.0; return 0.0;
@@ -1768,23 +1768,23 @@ namespace Opm
const Opm::Well::InjectorCMode& current = well_state.currentInjectionControls()[well_index]; const Opm::Well::InjectorCMode& current = well_state.currentInjectionControls()[well_index];
const auto& controls = inj_controls; const auto& controls = inj_controls;
Well::InjectorType injectorType = controls.injector_type; InjectorType injectorType = controls.injector_type;
double scaling = 1.0; double scaling = 1.0;
const auto& pu = phaseUsage(); const auto& pu = phaseUsage();
switch (injectorType) { switch (injectorType) {
case Well::InjectorType::WATER: case InjectorType::WATER:
{ {
scaling = scalingFactor(pu.phase_pos[BlackoilPhases::Aqua]); scaling = scalingFactor(pu.phase_pos[BlackoilPhases::Aqua]);
break; break;
} }
case Well::InjectorType::OIL: case InjectorType::OIL:
{ {
scaling = scalingFactor(pu.phase_pos[BlackoilPhases::Liquid]); scaling = scalingFactor(pu.phase_pos[BlackoilPhases::Liquid]);
break; break;
} }
case Well::InjectorType::GAS: case InjectorType::GAS:
{ {
scaling = scalingFactor(pu.phase_pos[BlackoilPhases::Vapour]); scaling = scalingFactor(pu.phase_pos[BlackoilPhases::Vapour]);
break; break;
@@ -1808,17 +1808,17 @@ namespace Opm
double coeff = 1.0; double coeff = 1.0;
switch (injectorType) { switch (injectorType) {
case Well::InjectorType::WATER: case InjectorType::WATER:
{ {
coeff = convert_coeff[pu.phase_pos[BlackoilPhases::Aqua]]; coeff = convert_coeff[pu.phase_pos[BlackoilPhases::Aqua]];
break; break;
} }
case Well::InjectorType::OIL: case InjectorType::OIL:
{ {
coeff = convert_coeff[pu.phase_pos[BlackoilPhases::Liquid]]; coeff = convert_coeff[pu.phase_pos[BlackoilPhases::Liquid]];
break; break;
} }
case Well::InjectorType::GAS: case InjectorType::GAS:
{ {
coeff = convert_coeff[pu.phase_pos[BlackoilPhases::Vapour]]; coeff = convert_coeff[pu.phase_pos[BlackoilPhases::Vapour]];
break; break;
@@ -2113,7 +2113,7 @@ namespace Opm
template <typename TypeTag> template <typename TypeTag>
void void
MultisegmentWell<TypeTag>:: MultisegmentWell<TypeTag>::
assembleGroupInjectionControl(const Group& group, const WellState& well_state, const Opm::Schedule& schedule, const SummaryState& summaryState, const Well::InjectorType& injectorType, EvalWell& control_eq, double efficiencyFactor, Opm::DeferredLogger& deferred_logger) assembleGroupInjectionControl(const Group& group, const WellState& well_state, const Opm::Schedule& schedule, const SummaryState& summaryState, const InjectorType& injectorType, EvalWell& control_eq, double efficiencyFactor, Opm::DeferredLogger& deferred_logger)
{ {
const auto& well = well_ecl_; const auto& well = well_ecl_;
const auto& pu = phaseUsage(); const auto& pu = phaseUsage();
@@ -2124,7 +2124,7 @@ namespace Opm
double scaling = 1.0; double scaling = 1.0;
switch (injectorType) { switch (injectorType) {
case Well::InjectorType::WATER: case InjectorType::WATER:
{ {
phasePos = pu.phase_pos[BlackoilPhases::Aqua]; phasePos = pu.phase_pos[BlackoilPhases::Aqua];
wellTarget = Well::GuideRateTarget::WAT; wellTarget = Well::GuideRateTarget::WAT;
@@ -2132,7 +2132,7 @@ namespace Opm
scaling = scalingFactor(pu.phase_pos[BlackoilPhases::Aqua]); scaling = scalingFactor(pu.phase_pos[BlackoilPhases::Aqua]);
break; break;
} }
case Well::InjectorType::OIL: case InjectorType::OIL:
{ {
phasePos = pu.phase_pos[BlackoilPhases::Liquid]; phasePos = pu.phase_pos[BlackoilPhases::Liquid];
wellTarget = Well::GuideRateTarget::OIL; wellTarget = Well::GuideRateTarget::OIL;
@@ -2140,7 +2140,7 @@ namespace Opm
scaling = scalingFactor(pu.phase_pos[BlackoilPhases::Liquid]); scaling = scalingFactor(pu.phase_pos[BlackoilPhases::Liquid]);
break; break;
} }
case Well::InjectorType::GAS: case InjectorType::GAS:
{ {
phasePos = pu.phase_pos[BlackoilPhases::Vapour]; phasePos = pu.phase_pos[BlackoilPhases::Vapour];
wellTarget = Well::GuideRateTarget::GAS; wellTarget = Well::GuideRateTarget::GAS;

View File

@@ -34,6 +34,7 @@
#include <opm/models/blackoil/blackoilbrinemodules.hh> #include <opm/models/blackoil/blackoilbrinemodules.hh>
#include <opm/material/densead/DynamicEvaluation.hpp> #include <opm/material/densead/DynamicEvaluation.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/ScheduleTypes.hpp>
#include <dune/common/dynvector.hh> #include <dune/common/dynvector.hh>
#include <dune/common/dynmatrix.hh> #include <dune/common/dynmatrix.hh>
@@ -404,7 +405,7 @@ namespace Opm
void assembleControlEq(const WellState& well_state, const Opm::Schedule& schedule, const SummaryState& summaryState, Opm::DeferredLogger& deferred_logger); void assembleControlEq(const WellState& well_state, const Opm::Schedule& schedule, const SummaryState& summaryState, Opm::DeferredLogger& deferred_logger);
void assembleGroupProductionControl(const Group& group, const WellState& well_state, const Opm::Schedule& schedule, const SummaryState& summaryState, EvalWell& control_eq, double efficincyFactor, Opm::DeferredLogger& deferred_logger); void assembleGroupProductionControl(const Group& group, const WellState& well_state, const Opm::Schedule& schedule, const SummaryState& summaryState, EvalWell& control_eq, double efficincyFactor, Opm::DeferredLogger& deferred_logger);
void assembleGroupInjectionControl(const Group& group, const WellState& well_state, const Opm::Schedule& schedule, const SummaryState& summaryState, const Well::InjectorType& injectorType, EvalWell& control_eq, double efficincyFactor, Opm::DeferredLogger& deferred_logger); void assembleGroupInjectionControl(const Group& group, const WellState& well_state, const Opm::Schedule& schedule, const SummaryState& summaryState, const InjectorType& injectorType, EvalWell& control_eq, double efficincyFactor, Opm::DeferredLogger& deferred_logger);
// handle the non reasonable fractions due to numerical overshoot // handle the non reasonable fractions due to numerical overshoot
void processFractions() const; void processFractions() const;

View File

@@ -193,24 +193,24 @@ namespace Opm
if (this->isInjector()) { // only single phase injection if (this->isInjector()) { // only single phase injection
double inj_frac = 0.0; double inj_frac = 0.0;
switch (this->wellEcl().injectorType()) { switch (this->wellEcl().injectorType()) {
case Well::InjectorType::WATER: case InjectorType::WATER:
if (comp_idx == int(Indices::canonicalToActiveComponentIndex(FluidSystem::waterCompIdx))) { if (comp_idx == int(Indices::canonicalToActiveComponentIndex(FluidSystem::waterCompIdx))) {
inj_frac = 1.0; inj_frac = 1.0;
} }
break; break;
case Well::InjectorType::GAS: case InjectorType::GAS:
if (has_solvent && comp_idx == contiSolventEqIdx) { // solvent if (has_solvent && comp_idx == contiSolventEqIdx) { // solvent
inj_frac = wsolvent(); inj_frac = wsolvent();
} else if (comp_idx == int(Indices::canonicalToActiveComponentIndex(FluidSystem::gasCompIdx))) { } else if (comp_idx == int(Indices::canonicalToActiveComponentIndex(FluidSystem::gasCompIdx))) {
inj_frac = has_solvent ? 1.0 - wsolvent() : 1.0; inj_frac = has_solvent ? 1.0 - wsolvent() : 1.0;
} }
break; break;
case Well::InjectorType::OIL: case InjectorType::OIL:
if (comp_idx == int(Indices::canonicalToActiveComponentIndex(FluidSystem::oilCompIdx))) { if (comp_idx == int(Indices::canonicalToActiveComponentIndex(FluidSystem::oilCompIdx))) {
inj_frac = 1.0; inj_frac = 1.0;
} }
break; break;
case Well::InjectorType::MULTI: case InjectorType::MULTI:
// Not supported. // Not supported.
// deferred_logger.warning("MULTI_PHASE_INJECTOR_NOT_SUPPORTED", // deferred_logger.warning("MULTI_PHASE_INJECTOR_NOT_SUPPORTED",
// "Multi phase injectors are not supported, requested for well " + name()); // "Multi phase injectors are not supported, requested for well " + name());
@@ -643,7 +643,7 @@ namespace Opm
// change temperature for injecting fluids // change temperature for injecting fluids
if (this->isInjector() && cq_s[activeCompIdx] > 0.0){ if (this->isInjector() && cq_s[activeCompIdx] > 0.0){
// only handles single phase injection now // only handles single phase injection now
assert(this->well_ecl_.injectorType() != Well::InjectorType::MULTI); assert(this->well_ecl_.injectorType() != InjectorType::MULTI);
fs.setTemperature(this->well_ecl_.temperature()); fs.setTemperature(this->well_ecl_.temperature());
typedef typename std::decay<decltype(fs)>::type::Scalar FsScalar; typedef typename std::decay<decltype(fs)>::type::Scalar FsScalar;
typename FluidSystem::template ParameterCache<FsScalar> paramCache; typename FluidSystem::template ParameterCache<FsScalar> paramCache;
@@ -791,21 +791,21 @@ namespace Opm
Base::rateConverter_.calcCoeff(/*fipreg*/ 0, Base::pvtRegionIdx_, convert_coeff); Base::rateConverter_.calcCoeff(/*fipreg*/ 0, Base::pvtRegionIdx_, convert_coeff);
const auto& pu = phaseUsage(); const auto& pu = phaseUsage();
Well::InjectorType injectorType = controls.injector_type; InjectorType injectorType = controls.injector_type;
double coeff = 1.0; double coeff = 1.0;
switch (injectorType) { switch (injectorType) {
case Well::InjectorType::WATER: case InjectorType::WATER:
{ {
coeff = convert_coeff[pu.phase_pos[BlackoilPhases::Aqua]]; coeff = convert_coeff[pu.phase_pos[BlackoilPhases::Aqua]];
break; break;
} }
case Well::InjectorType::OIL: case InjectorType::OIL:
{ {
coeff = convert_coeff[pu.phase_pos[BlackoilPhases::Liquid]]; coeff = convert_coeff[pu.phase_pos[BlackoilPhases::Liquid]];
break; break;
} }
case Well::InjectorType::GAS: case InjectorType::GAS:
{ {
coeff = convert_coeff[pu.phase_pos[BlackoilPhases::Vapour]]; coeff = convert_coeff[pu.phase_pos[BlackoilPhases::Vapour]];
break; break;
@@ -979,7 +979,7 @@ namespace Opm
template <typename TypeTag> template <typename TypeTag>
void void
StandardWell<TypeTag>:: StandardWell<TypeTag>::
assembleGroupInjectionControl(const Group& group, const WellState& well_state, const Opm::Schedule& schedule, const SummaryState& summaryState, const Well::InjectorType& injectorType, EvalWell& control_eq, double efficiencyFactor, Opm::DeferredLogger& deferred_logger) assembleGroupInjectionControl(const Group& group, const WellState& well_state, const Opm::Schedule& schedule, const SummaryState& summaryState, const InjectorType& injectorType, EvalWell& control_eq, double efficiencyFactor, Opm::DeferredLogger& deferred_logger)
{ {
const auto& well = well_ecl_; const auto& well = well_ecl_;
const auto pu = phaseUsage(); const auto pu = phaseUsage();
@@ -989,21 +989,21 @@ namespace Opm
Phase injectionPhase; Phase injectionPhase;
switch (injectorType) { switch (injectorType) {
case Well::InjectorType::WATER: case InjectorType::WATER:
{ {
phasePos = pu.phase_pos[BlackoilPhases::Aqua]; phasePos = pu.phase_pos[BlackoilPhases::Aqua];
wellTarget = Well::GuideRateTarget::WAT; wellTarget = Well::GuideRateTarget::WAT;
injectionPhase = Phase::WATER; injectionPhase = Phase::WATER;
break; break;
} }
case Well::InjectorType::OIL: case InjectorType::OIL:
{ {
phasePos = pu.phase_pos[BlackoilPhases::Liquid]; phasePos = pu.phase_pos[BlackoilPhases::Liquid];
wellTarget = Well::GuideRateTarget::OIL; wellTarget = Well::GuideRateTarget::OIL;
injectionPhase = Phase::OIL; injectionPhase = Phase::OIL;
break; break;
} }
case Well::InjectorType::GAS: case InjectorType::GAS:
{ {
phasePos = pu.phase_pos[BlackoilPhases::Vapour]; phasePos = pu.phase_pos[BlackoilPhases::Vapour];
wellTarget = Well::GuideRateTarget::GAS; wellTarget = Well::GuideRateTarget::GAS;
@@ -1587,16 +1587,16 @@ namespace Opm
well_state.wellRates()[index_of_well_ * number_of_phases_ + p] = 0.0; well_state.wellRates()[index_of_well_ * number_of_phases_ + p] = 0.0;
} }
switch (this->wellEcl().injectorType()) { switch (this->wellEcl().injectorType()) {
case Well::InjectorType::WATER: case InjectorType::WATER:
well_state.wellRates()[index_of_well_ * number_of_phases_ + pu.phase_pos[Water]] = primary_variables_[WQTotal]; well_state.wellRates()[index_of_well_ * number_of_phases_ + pu.phase_pos[Water]] = primary_variables_[WQTotal];
break; break;
case Well::InjectorType::GAS: case InjectorType::GAS:
well_state.wellRates()[index_of_well_ * number_of_phases_ + pu.phase_pos[Gas]] = primary_variables_[WQTotal]; well_state.wellRates()[index_of_well_ * number_of_phases_ + pu.phase_pos[Gas]] = primary_variables_[WQTotal];
break; break;
case Well::InjectorType::OIL: case InjectorType::OIL:
well_state.wellRates()[index_of_well_ * number_of_phases_ + pu.phase_pos[Oil]] = primary_variables_[WQTotal]; well_state.wellRates()[index_of_well_ * number_of_phases_ + pu.phase_pos[Oil]] = primary_variables_[WQTotal];
break; break;
case Well::InjectorType::MULTI: case InjectorType::MULTI:
// Not supported. // Not supported.
deferred_logger.warning("MULTI_PHASE_INJECTOR_NOT_SUPPORTED", deferred_logger.warning("MULTI_PHASE_INJECTOR_NOT_SUPPORTED",
"Multi phase injectors are not supported, requested for well " + name()); "Multi phase injectors are not supported, requested for well " + name());
@@ -1681,20 +1681,20 @@ namespace Opm
{ {
const auto& controls = well.injectionControls(summaryState); const auto& controls = well.injectionControls(summaryState);
Well::InjectorType injectorType = controls.injector_type; InjectorType injectorType = controls.injector_type;
int phasePos; int phasePos;
switch (injectorType) { switch (injectorType) {
case Well::InjectorType::WATER: case InjectorType::WATER:
{ {
phasePos = pu.phase_pos[BlackoilPhases::Aqua]; phasePos = pu.phase_pos[BlackoilPhases::Aqua];
break; break;
} }
case Well::InjectorType::OIL: case InjectorType::OIL:
{ {
phasePos = pu.phase_pos[BlackoilPhases::Liquid]; phasePos = pu.phase_pos[BlackoilPhases::Liquid];
break; break;
} }
case Well::InjectorType::GAS: case InjectorType::GAS:
{ {
phasePos = pu.phase_pos[BlackoilPhases::Vapour]; phasePos = pu.phase_pos[BlackoilPhases::Vapour];
break; break;
@@ -2409,16 +2409,16 @@ namespace Opm
// No flow => use well specified fractions for mix. // No flow => use well specified fractions for mix.
if (this->isInjector()) { if (this->isInjector()) {
switch (this->wellEcl().injectorType()) { switch (this->wellEcl().injectorType()) {
case Well::InjectorType::WATER: case InjectorType::WATER:
mix[FluidSystem::waterCompIdx] = 1.0; mix[FluidSystem::waterCompIdx] = 1.0;
break; break;
case Well::InjectorType::GAS: case InjectorType::GAS:
mix[FluidSystem::gasCompIdx] = 1.0; mix[FluidSystem::gasCompIdx] = 1.0;
break; break;
case Well::InjectorType::OIL: case InjectorType::OIL:
mix[FluidSystem::oilCompIdx] = 1.0; mix[FluidSystem::oilCompIdx] = 1.0;
break; break;
case Well::InjectorType::MULTI: case InjectorType::MULTI:
// Not supported. // Not supported.
// deferred_logger.warning("MULTI_PHASE_INJECTOR_NOT_SUPPORTED", // deferred_logger.warning("MULTI_PHASE_INJECTOR_NOT_SUPPORTED",
// "Multi phase injectors are not supported, requested for well " + name()); // "Multi phase injectors are not supported, requested for well " + name());
@@ -2968,16 +2968,16 @@ namespace Opm
// under surface condition is used here // under surface condition is used here
if (this->isInjector()) { if (this->isInjector()) {
switch (this->wellEcl().injectorType()) { switch (this->wellEcl().injectorType()) {
case Well::InjectorType::WATER: case InjectorType::WATER:
primary_variables_[WQTotal] = well_state.wellRates()[np * well_index + pu.phase_pos[Water]]; primary_variables_[WQTotal] = well_state.wellRates()[np * well_index + pu.phase_pos[Water]];
break; break;
case Well::InjectorType::GAS: case InjectorType::GAS:
primary_variables_[WQTotal] = well_state.wellRates()[np * well_index + pu.phase_pos[Gas]]; primary_variables_[WQTotal] = well_state.wellRates()[np * well_index + pu.phase_pos[Gas]];
break; break;
case Well::InjectorType::OIL: case InjectorType::OIL:
primary_variables_[WQTotal] = well_state.wellRates()[np * well_index + pu.phase_pos[Oil]]; primary_variables_[WQTotal] = well_state.wellRates()[np * well_index + pu.phase_pos[Oil]];
break; break;
case Well::InjectorType::MULTI: case InjectorType::MULTI:
// Not supported. // Not supported.
deferred_logger.warning("MULTI_PHASE_INJECTOR_NOT_SUPPORTED", deferred_logger.warning("MULTI_PHASE_INJECTOR_NOT_SUPPORTED",
"Multi phase injectors are not supported, requested for well " + name()); "Multi phase injectors are not supported, requested for well " + name());
@@ -3004,7 +3004,7 @@ namespace Opm
auto phase = well_ecl_.getInjectionProperties().injectorType; auto phase = well_ecl_.getInjectionProperties().injectorType;
// only single phase injection handled // only single phase injection handled
if (FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx)) { if (FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx)) {
if (phase == Well::InjectorType::WATER) { if (phase == InjectorType::WATER) {
primary_variables_[WFrac] = 1.0; primary_variables_[WFrac] = 1.0;
} else { } else {
primary_variables_[WFrac] = 0.0; primary_variables_[WFrac] = 0.0;
@@ -3012,7 +3012,7 @@ namespace Opm
} }
if (FluidSystem::phaseIsActive(FluidSystem::gasPhaseIdx)) { if (FluidSystem::phaseIsActive(FluidSystem::gasPhaseIdx)) {
if (phase == Well::InjectorType::GAS) { if (phase == InjectorType::GAS) {
primary_variables_[GFrac] = 1.0 - wsolvent(); primary_variables_[GFrac] = 1.0 - wsolvent();
if (has_solvent) { if (has_solvent) {
primary_variables_[SFrac] = wsolvent(); primary_variables_[SFrac] = wsolvent();

View File

@@ -22,6 +22,7 @@
#define OPM_WELLGROUPHELPERS_HEADER_INCLUDED #define OPM_WELLGROUPHELPERS_HEADER_INCLUDED
#include <vector> #include <vector>
#include <opm/parser/eclipse/EclipseState/Schedule/ScheduleTypes.hpp>
namespace Opm { namespace Opm {
@@ -66,18 +67,18 @@ namespace Opm {
if (wellEcl.isInjector() && injector) { if (wellEcl.isInjector() && injector) {
// only switch if the well phase is the same as the group phase // only switch if the well phase is the same as the group phase
// Get the current controls. // Get the current controls.
const Well::InjectorType& injectorType = wellEcl.getInjectionProperties().injectorType; const InjectorType& injectorType = wellEcl.getInjectionProperties().injectorType;
if (injectorType == Well::InjectorType::WATER && groupInjectionPhase != Phase::WATER) if (injectorType == InjectorType::WATER && groupInjectionPhase != Phase::WATER)
continue; continue;
if (injectorType == Well::InjectorType::OIL && groupInjectionPhase != Phase::OIL) if (injectorType == InjectorType::OIL && groupInjectionPhase != Phase::OIL)
continue; continue;
if (injectorType == Well::InjectorType::GAS && groupInjectionPhase != Phase::GAS) if (injectorType == InjectorType::GAS && groupInjectionPhase != Phase::GAS)
continue; continue;
if (injectorType == Well::InjectorType::MULTI) if (injectorType == InjectorType::MULTI)
throw("Expected WATER, OIL or GAS as type for injectors " + wellEcl.name()); throw("Expected WATER, OIL or GAS as type for injectors " + wellEcl.name());
if (wellState.currentInjectionControls()[well_index] != Well::InjectorCMode::GRUP) { if (wellState.currentInjectionControls()[well_index] != Well::InjectorCMode::GRUP) {

View File

@@ -19,6 +19,7 @@
along with OPM. If not, see <http://www.gnu.org/licenses/>. along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <opm/parser/eclipse/EclipseState/Schedule/ScheduleTypes.hpp>
#include <opm/simulators/utils/DeferredLoggingErrorHelpers.hpp> #include <opm/simulators/utils/DeferredLoggingErrorHelpers.hpp>
namespace Opm namespace Opm
@@ -99,7 +100,7 @@ namespace Opm
if (has_solvent && well.isInjector()) { if (has_solvent && well.isInjector()) {
auto injectorType = well_ecl_.injectorType(); auto injectorType = well_ecl_.injectorType();
if (injectorType == Well::InjectorType::GAS) { if (injectorType == InjectorType::GAS) {
wsolvent_ = well_ecl_.getSolventFraction(); wsolvent_ = well_ecl_.getSolventFraction();
} }
} }
@@ -337,7 +338,7 @@ namespace Opm
auto injectorType = well_ecl_.injectorType(); auto injectorType = well_ecl_.injectorType();
if (injectorType == Well::InjectorType::WATER) { if (injectorType == InjectorType::WATER) {
WellPolymerProperties polymer = well_ecl_.getPolymerProperties(); WellPolymerProperties polymer = well_ecl_.getPolymerProperties();
const double polymer_injection_concentration = polymer.m_polymerConcentration; const double polymer_injection_concentration = polymer.m_polymerConcentration;
return polymer_injection_concentration; return polymer_injection_concentration;
@@ -362,7 +363,7 @@ namespace Opm
auto injectorType = well_ecl_.injectorType(); auto injectorType = well_ecl_.injectorType();
if (injectorType == Well::InjectorType::GAS) { if (injectorType == InjectorType::GAS) {
WellFoamProperties fprop = well_ecl_.getFoamProperties(); WellFoamProperties fprop = well_ecl_.getFoamProperties();
return fprop.m_foamConcentration; return fprop.m_foamConcentration;
} else { } else {
@@ -384,7 +385,7 @@ namespace Opm
auto injectorType = well_ecl_.injectorType(); auto injectorType = well_ecl_.injectorType();
if (injectorType == Well::InjectorType::WATER) { if (injectorType == InjectorType::WATER) {
WellBrineProperties fprop = well_ecl_.getBrineProperties(); WellBrineProperties fprop = well_ecl_.getBrineProperties();
return fprop.m_saltConcentration; return fprop.m_saltConcentration;
} else { } else {
@@ -1466,21 +1467,21 @@ namespace Opm
if (controls.hasControl(Well::InjectorCMode::RATE) && currentControl != Well::InjectorCMode::RATE) if (controls.hasControl(Well::InjectorCMode::RATE) && currentControl != Well::InjectorCMode::RATE)
{ {
Well::InjectorType injectorType = controls.injector_type; InjectorType injectorType = controls.injector_type;
double current_rate = 0.0; double current_rate = 0.0;
switch (injectorType) { switch (injectorType) {
case Well::InjectorType::WATER: case InjectorType::WATER:
{ {
current_rate = well_state.wellRates()[ wellrate_index + pu.phase_pos[BlackoilPhases::Aqua] ]; current_rate = well_state.wellRates()[ wellrate_index + pu.phase_pos[BlackoilPhases::Aqua] ];
break; break;
} }
case Well::InjectorType::OIL: case InjectorType::OIL:
{ {
current_rate = well_state.wellRates()[ wellrate_index + pu.phase_pos[BlackoilPhases::Liquid] ]; current_rate = well_state.wellRates()[ wellrate_index + pu.phase_pos[BlackoilPhases::Liquid] ];
break; break;
} }
case Well::InjectorType::GAS: case InjectorType::GAS:
{ {
current_rate = well_state.wellRates()[ wellrate_index + pu.phase_pos[BlackoilPhases::Vapour] ]; current_rate = well_state.wellRates()[ wellrate_index + pu.phase_pos[BlackoilPhases::Vapour] ];
break; break;

View File

@@ -296,19 +296,19 @@ namespace Opm
if (well.isInjector()) { if (well.isInjector()) {
if (inj_controls.cmode == Well::InjectorCMode::RATE) { if (inj_controls.cmode == Well::InjectorCMode::RATE) {
switch (inj_controls.injector_type) { switch (inj_controls.injector_type) {
case Well::InjectorType::WATER: case InjectorType::WATER:
assert(pu.phase_used[BlackoilPhases::Aqua]); assert(pu.phase_used[BlackoilPhases::Aqua]);
wellrates_[np*w + pu.phase_pos[BlackoilPhases::Aqua]] = inj_surf_rate; wellrates_[np*w + pu.phase_pos[BlackoilPhases::Aqua]] = inj_surf_rate;
break; break;
case Well::InjectorType::GAS: case InjectorType::GAS:
assert(pu.phase_used[BlackoilPhases::Vapour]); assert(pu.phase_used[BlackoilPhases::Vapour]);
wellrates_[np*w + pu.phase_pos[BlackoilPhases::Vapour]] = inj_surf_rate; wellrates_[np*w + pu.phase_pos[BlackoilPhases::Vapour]] = inj_surf_rate;
break; break;
case Well::InjectorType::OIL: case InjectorType::OIL:
assert(pu.phase_used[BlackoilPhases::Liquid]); assert(pu.phase_used[BlackoilPhases::Liquid]);
wellrates_[np*w + pu.phase_pos[BlackoilPhases::Liquid]] = inj_surf_rate; wellrates_[np*w + pu.phase_pos[BlackoilPhases::Liquid]] = inj_surf_rate;
break; break;
case Well::InjectorType::MULTI: case InjectorType::MULTI:
// Not currently handled, keep zero init. // Not currently handled, keep zero init.
break; break;
} }

View File

@@ -1589,7 +1589,7 @@ BOOST_AUTO_TEST_CASE(WellInjectionProperties)
7, 7,
true, true,
8, 8,
Opm::Well::InjectorType::OIL, Opm::InjectorType::OIL,
Opm::Well::InjectorCMode::BHP); Opm::Well::InjectorCMode::BHP);
auto val2 = PackUnpack(val1); auto val2 = PackUnpack(val1);
DO_CHECKS(Well::WellInjectionProperties) DO_CHECKS(Well::WellInjectionProperties)