From f861188d600cc94d3ab380a2c112d37ce50ae014 Mon Sep 17 00:00:00 2001 From: Tor Harald Sandve Date: Fri, 26 Feb 2021 08:15:01 +0100 Subject: [PATCH 1/3] make sure wells has valid controls --- .../wells/BlackoilWellModel_impl.hpp | 20 ------------------- .../wells/WellStateFullyImplicitBlackoil.hpp | 18 +++++++++++------ 2 files changed, 12 insertions(+), 26 deletions(-) diff --git a/opm/simulators/wells/BlackoilWellModel_impl.hpp b/opm/simulators/wells/BlackoilWellModel_impl.hpp index c335eb6c6..fab8bf33b 100644 --- a/opm/simulators/wells/BlackoilWellModel_impl.hpp +++ b/opm/simulators/wells/BlackoilWellModel_impl.hpp @@ -271,26 +271,6 @@ namespace Opm { well_state_.initWellStateMSWell(wells_ecl_, phase_usage_, &previous_well_state_); } - const int nw = wells_ecl_.size(); - for (int w = 0; w currentInjectionControls()[ oldIndex ]; - current_production_controls_[ newIndex ] = prevState->currentProductionControls()[ oldIndex ]; - } + current_injection_controls_[ newIndex ] = prevState->currentInjectionControls()[ oldIndex ]; + current_production_controls_[ newIndex ] = prevState->currentProductionControls()[ oldIndex ]; // wellrates for( int i=0, idx=newIndex*np, oldidx=oldIndex*np; i Date: Mon, 8 Mar 2021 11:13:34 +0100 Subject: [PATCH 2/3] fix issue when switching from injection to/from production --- opm/simulators/wells/WellStateFullyImplicitBlackoil.hpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/opm/simulators/wells/WellStateFullyImplicitBlackoil.hpp b/opm/simulators/wells/WellStateFullyImplicitBlackoil.hpp index 15e457b30..87e9a74e4 100644 --- a/opm/simulators/wells/WellStateFullyImplicitBlackoil.hpp +++ b/opm/simulators/wells/WellStateFullyImplicitBlackoil.hpp @@ -206,6 +206,11 @@ namespace Opm continue; } + if (is_producer_[newIndex] != prevState->is_producer_[oldIndex]) { + // Well changed from injector from/to producer, do not use its privious values. + continue; + } + // bhp bhp()[ newIndex ] = prevState->bhp()[ oldIndex ]; From 858856adec0ca458d5c1b48b616b1b70fbbd8395 Mon Sep 17 00:00:00 2001 From: Tor Harald Sandve Date: Tue, 9 Mar 2021 13:37:03 +0100 Subject: [PATCH 3/3] update solution for WAG injectors --- opm/simulators/wells/BlackoilWellModel_impl.hpp | 5 +++-- opm/simulators/wells/WellStateFullyImplicitBlackoil.hpp | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/opm/simulators/wells/BlackoilWellModel_impl.hpp b/opm/simulators/wells/BlackoilWellModel_impl.hpp index fab8bf33b..71905d793 100644 --- a/opm/simulators/wells/BlackoilWellModel_impl.hpp +++ b/opm/simulators/wells/BlackoilWellModel_impl.hpp @@ -383,10 +383,11 @@ namespace Opm { const auto& comm = ebosSimulator_.vanguard().grid().comm(); WellGroupHelpers::updateGuideRatesForWells(schedule(), phase_usage_, reportStepIdx, simulationTime, well_state_, comm, guideRate_.get()); try { - // Compute initial well solution for new wells + // Compute initial well solution for new wells and injectors that change injection type i.e. WAG. for (auto& well : well_container_) { const uint64_t effective_events_mask = ScheduleEvents::WELL_STATUS_CHANGE - + ScheduleEvents::NEW_WELL; + + ScheduleEvents::INJECTION_TYPE_CHANGED + + ScheduleEvents::NEW_WELL; const auto& events = schedule()[reportStepIdx].wellgroup_events(); const bool event = report_step_starts_ && events.hasEvent(well->name(), effective_events_mask); diff --git a/opm/simulators/wells/WellStateFullyImplicitBlackoil.hpp b/opm/simulators/wells/WellStateFullyImplicitBlackoil.hpp index 87e9a74e4..e9ede1547 100644 --- a/opm/simulators/wells/WellStateFullyImplicitBlackoil.hpp +++ b/opm/simulators/wells/WellStateFullyImplicitBlackoil.hpp @@ -207,7 +207,7 @@ namespace Opm } if (is_producer_[newIndex] != prevState->is_producer_[oldIndex]) { - // Well changed from injector from/to producer, do not use its privious values. + // Well changed to/from injector from/to producer, do not use its privious values. continue; }