From cacec2739c0a2971c517bba9e9c5955c345ff0ae Mon Sep 17 00:00:00 2001 From: Kai Bao Date: Mon, 26 Jun 2023 14:18:02 +0200 Subject: [PATCH] moving the inj_multiplier to BlackoilWellModelGeneric to handle the situation that a well can be `SHUT` in the Schedule. If stored in PerfData, when a well is `SHUT`, the inforamtion related to WINJMULT will be discarded. Before we want to change how the `PerfData` works, storing `inj_multiplier` in BlackoilWellModelGeneric is the viable approach. --- opm/simulators/wells/BlackoilWellModelGeneric.cpp | 10 ++++++---- opm/simulators/wells/BlackoilWellModelGeneric.hpp | 5 +++++ opm/simulators/wells/PerfData.cpp | 3 --- opm/simulators/wells/PerfData.hpp | 4 ---- parallelTests.cmake | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/opm/simulators/wells/BlackoilWellModelGeneric.cpp b/opm/simulators/wells/BlackoilWellModelGeneric.cpp index de36f1461..aef3f3443 100644 --- a/opm/simulators/wells/BlackoilWellModelGeneric.cpp +++ b/opm/simulators/wells/BlackoilWellModelGeneric.cpp @@ -1411,16 +1411,18 @@ void BlackoilWellModelGeneric::initInjMult() { if (well->isInjector() && well->wellEcl().getInjMultMode() != Well::InjMultMode::NONE) { const auto& ws = this->wellState().well(well->indexOfWell()); const auto& perf_data = ws.perf_data; - well->initInjMult(perf_data.inj_multiplier); + if ((this->prev_inj_multipliers_.count(well->name())) == 0 ) { + this->prev_inj_multipliers_[well->name()] = std::vector(perf_data.size(), 1.0); + } + well->initInjMult(this->prev_inj_multipliers_.at(well->name())); } } } void BlackoilWellModelGeneric::updateInjMult(DeferredLogger& deferred_logger) { for (const auto& well : this->well_container_generic_) { - if (well->wellEcl().getInjMultMode() != Well::InjMultMode::NONE && well->isInjector()) { - auto& perf_data = this->wellState().well(well->indexOfWell()).perf_data; - well->updateInjMult(perf_data.inj_multiplier, deferred_logger); + if (well->isInjector() && well->wellEcl().getInjMultMode() != Well::InjMultMode::NONE) { + well->updateInjMult(this->prev_inj_multipliers_[well->name()], deferred_logger); } } } diff --git a/opm/simulators/wells/BlackoilWellModelGeneric.hpp b/opm/simulators/wells/BlackoilWellModelGeneric.hpp index 2c4de25cf..8f500f52c 100644 --- a/opm/simulators/wells/BlackoilWellModelGeneric.hpp +++ b/opm/simulators/wells/BlackoilWellModelGeneric.hpp @@ -192,6 +192,7 @@ public: serializer(closed_this_step_); serializer(guideRate_); serializer(node_pressures_); + serializer(prev_inj_multipliers_); serializer(active_wgstate_); serializer(last_valid_wgstate_); serializer(nupcol_wgstate_); @@ -208,6 +209,7 @@ public: this->local_shut_wells_ == rhs.local_shut_wells_ && this->closed_this_step_ == rhs.closed_this_step_ && this->node_pressures_ == rhs.node_pressures_ && + this->prev_inj_multipliers_ == rhs.prev_inj_multipliers_ && this->active_wgstate_ == rhs.active_wgstate_ && this->last_valid_wgstate_ == rhs.last_valid_wgstate_ && this->nupcol_wgstate_ == rhs.nupcol_wgstate_ && @@ -433,6 +435,9 @@ protected: std::unique_ptr vfp_properties_{}; std::map node_pressures_; // Storing network pressures for output. + // previous injection multiplier, it is used in the injection multiplier calculation for WINJMULT keyword + std::unordered_map> prev_inj_multipliers_; + /* The various wellState members should be accessed and modified through the accessor functions wellState(), prevWellState(), diff --git a/opm/simulators/wells/PerfData.cpp b/opm/simulators/wells/PerfData.cpp index 7b60ff9ed..4c6f04527 100644 --- a/opm/simulators/wells/PerfData.cpp +++ b/opm/simulators/wells/PerfData.cpp @@ -43,7 +43,6 @@ PerfData::PerfData(std::size_t num_perf, double pressure_first_connection_, bool , ecl_index(num_perf) { if (injector) { - this->inj_multiplier.resize(num_perf, 1.0); this->water_throughput.resize(num_perf); this->skin_pressure.resize(num_perf); this->water_velocity.resize(num_perf); @@ -95,7 +94,6 @@ bool PerfData::try_assign(const PerfData& other) { this->solvent_rates = other.solvent_rates; this->polymer_rates = other.polymer_rates; this->brine_rates = other.brine_rates; - this->inj_multiplier = other.inj_multiplier; this->water_throughput = other.water_throughput; this->skin_pressure = other.skin_pressure; this->water_velocity = other.water_velocity; @@ -119,7 +117,6 @@ bool PerfData::operator==(const PerfData& rhs) const this->connection_transmissibility_factor == rhs.connection_transmissibility_factor && this->satnum_id == rhs.satnum_id && this->ecl_index == rhs.ecl_index && - this->inj_multiplier == rhs.inj_multiplier && this->water_throughput == rhs.water_throughput && this->skin_pressure == rhs.skin_pressure && this->water_velocity == rhs.water_velocity; diff --git a/opm/simulators/wells/PerfData.hpp b/opm/simulators/wells/PerfData.hpp index a760dd608..6eda2c357 100644 --- a/opm/simulators/wells/PerfData.hpp +++ b/opm/simulators/wells/PerfData.hpp @@ -57,7 +57,6 @@ public: serializer(connection_transmissibility_factor); serializer(satnum_id); serializer(ecl_index); - serializer(inj_multiplier); serializer(water_throughput); serializer(skin_pressure); serializer(water_velocity); @@ -79,9 +78,6 @@ public: std::vector connection_transmissibility_factor; std::vector satnum_id; std::vector ecl_index; - // the injection multiplier due to WINJMULT keyword - // it only applies to injectors - std::vector inj_multiplier; // The water_throughput, skin_pressure and water_velocity variables are only // used for injectors to check the injectivity. diff --git a/parallelTests.cmake b/parallelTests.cmake index f6a0eb508..330621458 100644 --- a/parallelTests.cmake +++ b/parallelTests.cmake @@ -177,7 +177,7 @@ add_test_compare_parallel_simulation(CASENAME winjmult_msw FILENAME WINJMULT_MSW SIMULATOR flow ABS_TOL ${abs_tol} - REL_TOL 0.21 + REL_TOL 0.12 DIR winjmult TEST_ARGS --enable-tuning=true)