diff --git a/opm/simulators/wells/MultisegmentWell_impl.hpp b/opm/simulators/wells/MultisegmentWell_impl.hpp index 1cb5c3975..764827c8d 100644 --- a/opm/simulators/wells/MultisegmentWell_impl.hpp +++ b/opm/simulators/wells/MultisegmentWell_impl.hpp @@ -76,6 +76,11 @@ namespace Opm if constexpr (Base::has_watVapor) { OPM_THROW(std::runtime_error, "water evaporation is not supported by multisegment well yet"); } + + if(this->rsRvInj() > 0) { + OPM_THROW(std::runtime_error, "dissolved gas/ vapporized oil in injected oil/gas not supported by multisegment well yet." + << " \n See (WCONINJE item 10 / WCONHIST item 8)"); + } } diff --git a/opm/simulators/wells/StandardWellEval.cpp b/opm/simulators/wells/StandardWellEval.cpp index 912b97c45..5b3118b99 100644 --- a/opm/simulators/wells/StandardWellEval.cpp +++ b/opm/simulators/wells/StandardWellEval.cpp @@ -195,12 +195,19 @@ getQs(const int comp_idx) const if (Indices::enableSolvent && comp_idx == Indices::contiSolventEqIdx) { // solvent inj_frac = baseif_.wsolvent(); } else if (comp_idx == int(Indices::canonicalToActiveComponentIndex(FluidSystem::gasCompIdx))) { - inj_frac = Indices::enableSolvent ? 1.0 - baseif_.wsolvent() : 1.0; + inj_frac = 1.0 - baseif_.rsRvInj(); + if (Indices::enableSolvent) { + inj_frac -= baseif_.wsolvent(); + } + } else if (FluidSystem::phaseIsActive(FluidSystem::oilPhaseIdx) && comp_idx == int(Indices::canonicalToActiveComponentIndex(FluidSystem::oilCompIdx))) { + inj_frac = baseif_.rsRvInj(); } break; case InjectorType::OIL: if (comp_idx == int(Indices::canonicalToActiveComponentIndex(FluidSystem::oilCompIdx))) { - inj_frac = 1.0; + inj_frac = 1.0 - baseif_.rsRvInj(); + } else if (FluidSystem::phaseIsActive(FluidSystem::gasPhaseIdx) && comp_idx == int(Indices::canonicalToActiveComponentIndex(FluidSystem::gasCompIdx))) { + inj_frac = baseif_.rsRvInj(); } break; case InjectorType::MULTI: @@ -316,9 +323,9 @@ updatePrimaryVariables(const WellState& well_state, DeferredLogger& deferred_log if (FluidSystem::phaseIsActive(FluidSystem::gasPhaseIdx)) { auto phase = baseif_.wellEcl().getInjectionProperties().injectorType; if (phase == InjectorType::GAS) { - primary_variables_[GFrac] = 1.0; + primary_variables_[GFrac] = (1.0 - baseif_.rsRvInj()); if constexpr (Indices::enableSolvent) { - primary_variables_[GFrac] = 1.0 - baseif_.wsolvent(); + primary_variables_[GFrac] = 1.0 - baseif_.rsRvInj() - baseif_.wsolvent(); primary_variables_[SFrac] = baseif_.wsolvent(); } } else { diff --git a/opm/simulators/wells/WellInterfaceGeneric.cpp b/opm/simulators/wells/WellInterfaceGeneric.cpp index 8b18c72a0..ed9dc5c35 100644 --- a/opm/simulators/wells/WellInterfaceGeneric.cpp +++ b/opm/simulators/wells/WellInterfaceGeneric.cpp @@ -173,6 +173,11 @@ double WellInterfaceGeneric::wsolvent() const return wsolvent_; } +double WellInterfaceGeneric::rsRvInj() const +{ + return well_ecl_.getInjectionProperties().rsRvInj; +} + bool WellInterfaceGeneric::wellHasTHPConstraints(const SummaryState& summaryState) const { if (dynamic_thp_limit_) { diff --git a/opm/simulators/wells/WellInterfaceGeneric.hpp b/opm/simulators/wells/WellInterfaceGeneric.hpp index 5ea5a9b3d..4aefa1299 100644 --- a/opm/simulators/wells/WellInterfaceGeneric.hpp +++ b/opm/simulators/wells/WellInterfaceGeneric.hpp @@ -170,6 +170,7 @@ public: double getTHPConstraint(const SummaryState& summaryState) const; double getALQ(const WellState& well_state) const; double wsolvent() const; + double rsRvInj() const; // whether a well is specified with a non-zero and valid VFP table number bool isVFPActive(DeferredLogger& deferred_logger) const; diff --git a/opm/simulators/wells/WellInterface_impl.hpp b/opm/simulators/wells/WellInterface_impl.hpp index 093204df7..72236a04f 100644 --- a/opm/simulators/wells/WellInterface_impl.hpp +++ b/opm/simulators/wells/WellInterface_impl.hpp @@ -718,7 +718,16 @@ namespace Opm switch(current) { case Well::InjectorCMode::RATE: { - ws.surface_rates[phasePos] = controls.surface_rate; + ws.surface_rates[phasePos] = (1.0 - this->rsRvInj()) * controls.surface_rate; + if(this->rsRvInj() > 0) { + if (injectorType == InjectorType::OIL && FluidSystem::phaseIsActive(FluidSystem::gasPhaseIdx)) { + ws.surface_rates[pu.phase_pos[BlackoilPhases::Vapour]] = controls.surface_rate * this->rsRvInj(); + } else if (injectorType == InjectorType::GAS && FluidSystem::phaseIsActive(FluidSystem::oilPhaseIdx)) { + ws.surface_rates[pu.phase_pos[BlackoilPhases::Liquid]] = controls.surface_rate * this->rsRvInj(); + } else { + OPM_DEFLOG_THROW(std::runtime_error, "Expected OIL or GAS as type for injectors when RS/RV (item 10) is non-zero " + this->name(), deferred_logger ); + } + } break; }