Merge pull request #3879 from totto82/rsrvinj2

WIP implement rsrv item 10 WCONINJE
This commit is contained in:
Tor Harald Sandve 2022-06-16 08:30:31 +02:00 committed by GitHub
commit 60d0fe0f87
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 32 additions and 5 deletions

View File

@ -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)");
}
}

View File

@ -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 {

View File

@ -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_) {

View File

@ -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;

View File

@ -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;
}