From a36b44dbdf64ee2c8e0f87cdd276d23412e42f40 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Mon, 18 Nov 2024 10:57:44 +0100 Subject: [PATCH 01/14] getPrimaryVars: move to WellInterfaceGeneric --- opm/simulators/wells/WellInterface.hpp | 5 ----- opm/simulators/wells/WellInterfaceGeneric.hpp | 6 ++++++ 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/opm/simulators/wells/WellInterface.hpp b/opm/simulators/wells/WellInterface.hpp index 9ed3c7a1d..545eb6380 100644 --- a/opm/simulators/wells/WellInterface.hpp +++ b/opm/simulators/wells/WellInterface.hpp @@ -358,11 +358,6 @@ public: return connectionRates_; } - virtual std::vector getPrimaryVars() const - { - return {}; - } - virtual int setPrimaryVars(typename std::vector::const_iterator) { return 0; diff --git a/opm/simulators/wells/WellInterfaceGeneric.hpp b/opm/simulators/wells/WellInterfaceGeneric.hpp index b1268847b..bc7186649 100644 --- a/opm/simulators/wells/WellInterfaceGeneric.hpp +++ b/opm/simulators/wells/WellInterfaceGeneric.hpp @@ -189,6 +189,12 @@ public: void resetWellOperability(); + + virtual std::vector getPrimaryVars() const + { + return {}; + } + protected: bool getAllowCrossFlow() const; From 32dc2f990ce98f598480d22b5a50c96e182b1a5b Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Mon, 18 Nov 2024 10:57:44 +0100 Subject: [PATCH 02/14] setPrimaryVars: move to WellInterfaceGeneric --- opm/simulators/wells/WellInterface.hpp | 5 ----- opm/simulators/wells/WellInterfaceGeneric.hpp | 5 +++++ 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/opm/simulators/wells/WellInterface.hpp b/opm/simulators/wells/WellInterface.hpp index 545eb6380..a4d37b7fe 100644 --- a/opm/simulators/wells/WellInterface.hpp +++ b/opm/simulators/wells/WellInterface.hpp @@ -358,11 +358,6 @@ public: return connectionRates_; } - virtual int setPrimaryVars(typename std::vector::const_iterator) - { - return 0; - } - std::vector wellIndex(const int perf, const IntensiveQuantities& intQuants, const Scalar trans_mult, diff --git a/opm/simulators/wells/WellInterfaceGeneric.hpp b/opm/simulators/wells/WellInterfaceGeneric.hpp index bc7186649..032ce1b3f 100644 --- a/opm/simulators/wells/WellInterfaceGeneric.hpp +++ b/opm/simulators/wells/WellInterfaceGeneric.hpp @@ -195,6 +195,11 @@ public: return {}; } + virtual int setPrimaryVars(typename std::vector::const_iterator) + { + return 0; + } + protected: bool getAllowCrossFlow() const; From b0bb6473c94aa5f62ff28d970c9432ecd4bddcfe Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Mon, 18 Nov 2024 11:41:34 +0100 Subject: [PATCH 03/14] connectionDensity: move to WellInterfaceGeneric --- opm/simulators/wells/WellInterface.hpp | 3 --- opm/simulators/wells/WellInterfaceGeneric.hpp | 3 +++ 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/opm/simulators/wells/WellInterface.hpp b/opm/simulators/wells/WellInterface.hpp index a4d37b7fe..71d4e9702 100644 --- a/opm/simulators/wells/WellInterface.hpp +++ b/opm/simulators/wells/WellInterface.hpp @@ -270,9 +270,6 @@ public: WellState& well_state, DeferredLogger& deferred_logger) const = 0; - virtual Scalar connectionDensity(const int globalConnIdx, - const int openConnIdx) const = 0; - /// \brief Wether the Jacobian will also have well contributions in it. virtual bool jacobianContainsWellContributions() const { diff --git a/opm/simulators/wells/WellInterfaceGeneric.hpp b/opm/simulators/wells/WellInterfaceGeneric.hpp index 032ce1b3f..f511eb097 100644 --- a/opm/simulators/wells/WellInterfaceGeneric.hpp +++ b/opm/simulators/wells/WellInterfaceGeneric.hpp @@ -200,6 +200,9 @@ public: return 0; } + virtual Scalar connectionDensity(const int globalConnIdx, + const int openConnIdx) const = 0; + protected: bool getAllowCrossFlow() const; From 75dc66d4d29a1bb26370c2905fcdbb9374b76a5b Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Mon, 18 Nov 2024 11:03:47 +0100 Subject: [PATCH 04/14] getPrimaryVarsDomain: take domain index as parameter --- opm/simulators/flow/BlackoilModelNldd.hpp | 4 ++-- opm/simulators/wells/BlackoilWellModel.hpp | 2 +- opm/simulators/wells/BlackoilWellModel_impl.hpp | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/opm/simulators/flow/BlackoilModelNldd.hpp b/opm/simulators/flow/BlackoilModelNldd.hpp index 2a7d501af..3ba2b2e07 100644 --- a/opm/simulators/flow/BlackoilModelNldd.hpp +++ b/opm/simulators/flow/BlackoilModelNldd.hpp @@ -815,7 +815,7 @@ private: const SimulatorTimerInterface& timer, const Domain& domain) { - auto initial_local_well_primary_vars = model_.wellModel().getPrimaryVarsDomain(domain); + auto initial_local_well_primary_vars = model_.wellModel().getPrimaryVarsDomain(domain.index); auto initial_local_solution = Details::extractVector(solution, domain.cells); auto res = solveDomain(domain, timer, logger, iteration, false); local_report = res.first; @@ -840,7 +840,7 @@ private: const SimulatorTimerInterface& timer, const Domain& domain) { - auto initial_local_well_primary_vars = model_.wellModel().getPrimaryVarsDomain(domain); + auto initial_local_well_primary_vars = model_.wellModel().getPrimaryVarsDomain(domain.index); auto initial_local_solution = Details::extractVector(solution, domain.cells); auto res = solveDomain(domain, timer, logger, iteration, true); local_report = res.first; diff --git a/opm/simulators/wells/BlackoilWellModel.hpp b/opm/simulators/wells/BlackoilWellModel.hpp index d2b864b90..afaebb5bd 100644 --- a/opm/simulators/wells/BlackoilWellModel.hpp +++ b/opm/simulators/wells/BlackoilWellModel.hpp @@ -388,7 +388,7 @@ template class WellContributions; void updateWellControlsDomain(DeferredLogger& deferred_logger, const Domain& domain); void logPrimaryVars() const; - std::vector getPrimaryVarsDomain(const Domain& domain) const; + std::vector getPrimaryVarsDomain(const int domainIdx) const; void setPrimaryVarsDomain(const Domain& domain, const std::vector& vars); void setupDomains(const std::vector& domains); diff --git a/opm/simulators/wells/BlackoilWellModel_impl.hpp b/opm/simulators/wells/BlackoilWellModel_impl.hpp index 58c9b281b..4c224e474 100644 --- a/opm/simulators/wells/BlackoilWellModel_impl.hpp +++ b/opm/simulators/wells/BlackoilWellModel_impl.hpp @@ -3007,11 +3007,11 @@ namespace Opm { template std::vector::Scalar> BlackoilWellModel:: - getPrimaryVarsDomain(const Domain& domain) const + getPrimaryVarsDomain(const int domainIdx) const { std::vector ret; for (const auto& well : well_container_) { - if (well_domain_.at(well->name()) == domain.index) { + if (well_domain_.at(well->name()) == domainIdx) { const auto& pv = well->getPrimaryVars(); ret.insert(ret.end(), pv.begin(), pv.end()); } From 58ac8f2553492a6895e6bfab69c46c220d0299ef Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Mon, 18 Nov 2024 11:03:47 +0100 Subject: [PATCH 05/14] setPrimaryVarsDomain: take domain index as parameter --- opm/simulators/flow/BlackoilModelNldd.hpp | 4 ++-- opm/simulators/wells/BlackoilWellModel.hpp | 2 +- opm/simulators/wells/BlackoilWellModel_impl.hpp | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/opm/simulators/flow/BlackoilModelNldd.hpp b/opm/simulators/flow/BlackoilModelNldd.hpp index 3ba2b2e07..1ee045655 100644 --- a/opm/simulators/flow/BlackoilModelNldd.hpp +++ b/opm/simulators/flow/BlackoilModelNldd.hpp @@ -825,7 +825,7 @@ private: Details::setGlobal(initial_local_solution, domain.cells, solution); model_.simulator().model().invalidateAndUpdateIntensiveQuantities(/*timeIdx=*/0, domain); } else { - model_.wellModel().setPrimaryVarsDomain(domain, initial_local_well_primary_vars); + model_.wellModel().setPrimaryVarsDomain(domain.index, initial_local_well_primary_vars); Details::setGlobal(initial_local_solution, domain.cells, solution); model_.simulator().model().invalidateAndUpdateIntensiveQuantities(/*timeIdx=*/0, domain); } @@ -881,7 +881,7 @@ private: auto local_solution = Details::extractVector(solution, domain.cells); Details::setGlobal(local_solution, domain.cells, locally_solved); } else { - model_.wellModel().setPrimaryVarsDomain(domain, initial_local_well_primary_vars); + model_.wellModel().setPrimaryVarsDomain(domain.index, initial_local_well_primary_vars); Details::setGlobal(initial_local_solution, domain.cells, solution); model_.simulator().model().invalidateAndUpdateIntensiveQuantities(/*timeIdx=*/0, domain); } diff --git a/opm/simulators/wells/BlackoilWellModel.hpp b/opm/simulators/wells/BlackoilWellModel.hpp index afaebb5bd..30cff149e 100644 --- a/opm/simulators/wells/BlackoilWellModel.hpp +++ b/opm/simulators/wells/BlackoilWellModel.hpp @@ -389,7 +389,7 @@ template class WellContributions; void logPrimaryVars() const; std::vector getPrimaryVarsDomain(const int domainIdx) const; - void setPrimaryVarsDomain(const Domain& domain, const std::vector& vars); + void setPrimaryVarsDomain(const int domainIdx, const std::vector& vars); void setupDomains(const std::vector& domains); diff --git a/opm/simulators/wells/BlackoilWellModel_impl.hpp b/opm/simulators/wells/BlackoilWellModel_impl.hpp index 4c224e474..a725d2a57 100644 --- a/opm/simulators/wells/BlackoilWellModel_impl.hpp +++ b/opm/simulators/wells/BlackoilWellModel_impl.hpp @@ -3024,11 +3024,11 @@ namespace Opm { template void BlackoilWellModel:: - setPrimaryVarsDomain(const Domain& domain, const std::vector& vars) + setPrimaryVarsDomain(const int domainIdx, const std::vector& vars) { std::size_t offset = 0; for (auto& well : well_container_) { - if (well_domain_.at(well->name()) == domain.index) { + if (this->well_domain_.at(well->name()) == domainIdx) { int num_pri_vars = well->setPrimaryVars(vars.begin() + offset); offset += num_pri_vars; } From 5897805e5b922b694350b87f403c9065755e3969 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Mon, 18 Nov 2024 11:08:10 +0100 Subject: [PATCH 06/14] well_domain_: move to BlackoilWellModelGeneric --- opm/simulators/wells/BlackoilWellModel.hpp | 3 --- .../wells/BlackoilWellModelGeneric.hpp | 3 +++ .../wells/BlackoilWellModel_impl.hpp | 24 +++++++++---------- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/opm/simulators/wells/BlackoilWellModel.hpp b/opm/simulators/wells/BlackoilWellModel.hpp index 30cff149e..49784f8a4 100644 --- a/opm/simulators/wells/BlackoilWellModel.hpp +++ b/opm/simulators/wells/BlackoilWellModel.hpp @@ -447,9 +447,6 @@ template class WellContributions; std::vector B_avg_{}; - // Keep track of the domain of each well, if using subdomains. - std::map well_domain_; - // Store the local index of the wells perforated cells in the domain, if using subdomains SparseTable well_local_cells_; diff --git a/opm/simulators/wells/BlackoilWellModelGeneric.hpp b/opm/simulators/wells/BlackoilWellModelGeneric.hpp index b0107bc01..fb5989ab2 100644 --- a/opm/simulators/wells/BlackoilWellModelGeneric.hpp +++ b/opm/simulators/wells/BlackoilWellModelGeneric.hpp @@ -613,6 +613,9 @@ protected: // Store map of group name and close offending well for output std::map> closed_offending_wells_; + // Keep track of the domain of each well, if using subdomains. + std::map well_domain_; + private: WellInterfaceGeneric* getGenWell(const std::string& well_name); diff --git a/opm/simulators/wells/BlackoilWellModel_impl.hpp b/opm/simulators/wells/BlackoilWellModel_impl.hpp index a725d2a57..df4c0dbc4 100644 --- a/opm/simulators/wells/BlackoilWellModel_impl.hpp +++ b/opm/simulators/wells/BlackoilWellModel_impl.hpp @@ -273,7 +273,7 @@ namespace Opm { // try/catch here, as this function is not called in // parallel but for each individual domain of each rank. for (const auto& well: well_container_) { - if (well_domain_.at(well->name()) == domain.index) { + if (this->well_domain_.at(well->name()) == domain.index) { // Modifiy the Jacobian with explicit Schur complement // contributions if requested. if (param_.matrix_add_well_contributions_) { @@ -1772,7 +1772,7 @@ namespace Opm { assembleWellEqDomain(const double dt, const Domain& domain, DeferredLogger& deferred_logger) { for (auto& well : well_container_) { - if (well_domain_.at(well->name()) == domain.index) { + if (this->well_domain_.at(well->name()) == domain.index) { well->assembleWellEq(simulator_, dt, this->wellState(), this->groupState(), deferred_logger); } } @@ -1842,7 +1842,7 @@ namespace Opm { { for (size_t well_index = 0; well_index < well_container_.size(); ++well_index) { auto& well = well_container_[well_index]; - if (well_domain_.at(well->name()) == domainIndex) { + if (this->well_domain_.at(well->name()) == domainIndex) { // Well equations B and C uses only the perforated cells, so need to apply on local vectors // transfer global cells index to local subdomain cells index const auto& local_cells = well_local_cells_[well_index]; @@ -2082,7 +2082,7 @@ namespace Opm { // parallel but for each individual domain of each rank. DeferredLogger local_deferredLogger; for (auto& well : well_container_) { - if (well_domain_.at(well->name()) == domain.index) { + if (this->well_domain_.at(well->name()) == domain.index) { const auto& cells = well->cells(); x_local_.resize(cells.size()); @@ -2119,7 +2119,7 @@ namespace Opm { initPrimaryVariablesEvaluationDomain(const Domain& domain) const { for (auto& well : well_container_) { - if (well_domain_.at(well->name()) == domain.index) { + if (this->well_domain_.at(well->name()) == domain.index) { well->initPrimaryVariablesEvaluation(); } } @@ -2142,7 +2142,7 @@ namespace Opm { ConvergenceReport report; for (const auto& well : well_container_) { - if ((well_domain_.at(well->name()) == domain.index)) { + if ((this->well_domain_.at(well->name()) == domain.index)) { if (well->isOperableAndSolvable() || well->wellIsStopped()) { report += well->getWellConvergence(simulator_, this->wellState(), @@ -2346,7 +2346,7 @@ namespace Opm { // Check only individual well constraints and communicate. for (const auto& well : well_container_) { - if (well_domain_.at(well->name()) == domain.index) { + if (this->well_domain_.at(well->name()) == domain.index) { const auto mode = WellInterface::IndividualOrGroup::Individual; well->updateWellControl(simulator_, mode, this->wellState(), this->groupState(), deferred_logger); } @@ -3011,7 +3011,7 @@ namespace Opm { { std::vector ret; for (const auto& well : well_container_) { - if (well_domain_.at(well->name()) == domainIdx) { + if (this->well_domain_.at(well->name()) == domainIdx) { const auto& pv = well->getPrimaryVars(); ret.insert(ret.end(), pv.begin(), pv.end()); } @@ -3060,7 +3060,7 @@ namespace Opm { if (cell_present(first_well_cell)) { // Assuming that if the first well cell is found in a domain, // then all of that well's cells are in that same domain. - well_domain_[wellPtr->name()] = domain.index; + this->well_domain_[wellPtr->name()] = domain.index; // Verify that all of that well's cells are in that same domain. for (int well_cell : wellPtr->cells()) { @@ -3080,10 +3080,10 @@ namespace Opm { const Opm::Parallel::Communication& comm = grid().comm(); const int rank = comm.rank(); DeferredLogger local_log; - if (!well_domain_.empty()) { + if (!this->well_domain_.empty()) { std::ostringstream os; os << "Well name Rank Domain\n"; - for (const auto& [wname, domain] : well_domain_) { + for (const auto& [wname, domain] : this->well_domain_) { os << wname << std::setw(19 - wname.size()) << rank << std::setw(12) << domain << '\n'; } local_log.debug(os.str()); @@ -3099,7 +3099,7 @@ namespace Opm { std::vector local_cells; for (const auto& well : well_container_) { const auto& global_cells = well->cells(); - const int domain_index = well_domain_.at(well->name()); + const int domain_index = this->well_domain_.at(well->name()); const auto& domain_cells = domains[domain_index].cells; local_cells.resize(global_cells.size()); From 5217e63309fd0659f04bb3187c6fc540d2b7166f Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Mon, 18 Nov 2024 10:58:07 +0100 Subject: [PATCH 07/14] logPrimaryVars: move to BlackoilWellModelGeneric --- opm/simulators/wells/BlackoilWellModel.hpp | 1 - .../wells/BlackoilWellModelGeneric.cpp | 18 ++++++++++++++++-- .../wells/BlackoilWellModelGeneric.hpp | 2 ++ .../wells/BlackoilWellModel_impl.hpp | 19 ------------------- 4 files changed, 18 insertions(+), 22 deletions(-) diff --git a/opm/simulators/wells/BlackoilWellModel.hpp b/opm/simulators/wells/BlackoilWellModel.hpp index 49784f8a4..d73e3643c 100644 --- a/opm/simulators/wells/BlackoilWellModel.hpp +++ b/opm/simulators/wells/BlackoilWellModel.hpp @@ -387,7 +387,6 @@ template class WellContributions; const Domain& domain); void updateWellControlsDomain(DeferredLogger& deferred_logger, const Domain& domain); - void logPrimaryVars() const; std::vector getPrimaryVarsDomain(const int domainIdx) const; void setPrimaryVarsDomain(const int domainIdx, const std::vector& vars); diff --git a/opm/simulators/wells/BlackoilWellModelGeneric.cpp b/opm/simulators/wells/BlackoilWellModelGeneric.cpp index 7023d41f9..52f21c29c 100644 --- a/opm/simulators/wells/BlackoilWellModelGeneric.cpp +++ b/opm/simulators/wells/BlackoilWellModelGeneric.cpp @@ -69,9 +69,8 @@ #include #include #include -#include #include -#include +#include #include #include #include @@ -2041,6 +2040,21 @@ updateFiltrationModelsPreStep(DeferredLogger& deferred_logger) } } +template +void BlackoilWellModelGeneric:: +logPrimaryVars() const +{ + std::ostringstream os; + for (const auto& w : this->well_container_generic_) { + os << w->name() << ":"; + auto pv = w->getPrimaryVars(); + for (const Scalar v : pv) { + os << ' ' << v; + } + os << '\n'; + } + OpmLog::debug(os.str()); +} template class BlackoilWellModelGeneric; diff --git a/opm/simulators/wells/BlackoilWellModelGeneric.hpp b/opm/simulators/wells/BlackoilWellModelGeneric.hpp index fb5989ab2..1c047de1c 100644 --- a/opm/simulators/wells/BlackoilWellModelGeneric.hpp +++ b/opm/simulators/wells/BlackoilWellModelGeneric.hpp @@ -219,6 +219,8 @@ public: } bool wasDynamicallyShutThisTimeStep(const std::string& well_name) const; + void logPrimaryVars() const; + template void serializeOp(Serializer& serializer) { diff --git a/opm/simulators/wells/BlackoilWellModel_impl.hpp b/opm/simulators/wells/BlackoilWellModel_impl.hpp index df4c0dbc4..a826abeef 100644 --- a/opm/simulators/wells/BlackoilWellModel_impl.hpp +++ b/opm/simulators/wells/BlackoilWellModel_impl.hpp @@ -2985,25 +2985,6 @@ namespace Opm { } - template - void - BlackoilWellModel:: - logPrimaryVars() const - { - std::ostringstream os; - for (const auto& w : well_container_) { - os << w->name() << ":"; - auto pv = w->getPrimaryVars(); - for (const Scalar v : pv) { - os << ' ' << v; - } - os << '\n'; - } - OpmLog::debug(os.str()); - } - - - template std::vector::Scalar> BlackoilWellModel:: From a36d40957bcd6d71db90af386a5c8bb89417b3ca Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Mon, 18 Nov 2024 11:11:19 +0100 Subject: [PATCH 08/14] getPrimaryVarsDomain: move to BlackoilWellModelGeneric --- opm/simulators/wells/BlackoilWellModel.hpp | 1 - .../wells/BlackoilWellModelGeneric.cpp | 15 +++++++++++++++ .../wells/BlackoilWellModelGeneric.hpp | 1 + opm/simulators/wells/BlackoilWellModel_impl.hpp | 17 ----------------- 4 files changed, 16 insertions(+), 18 deletions(-) diff --git a/opm/simulators/wells/BlackoilWellModel.hpp b/opm/simulators/wells/BlackoilWellModel.hpp index d73e3643c..b6b6c07fd 100644 --- a/opm/simulators/wells/BlackoilWellModel.hpp +++ b/opm/simulators/wells/BlackoilWellModel.hpp @@ -387,7 +387,6 @@ template class WellContributions; const Domain& domain); void updateWellControlsDomain(DeferredLogger& deferred_logger, const Domain& domain); - std::vector getPrimaryVarsDomain(const int domainIdx) const; void setPrimaryVarsDomain(const int domainIdx, const std::vector& vars); void setupDomains(const std::vector& domains); diff --git a/opm/simulators/wells/BlackoilWellModelGeneric.cpp b/opm/simulators/wells/BlackoilWellModelGeneric.cpp index 52f21c29c..2d7442bb2 100644 --- a/opm/simulators/wells/BlackoilWellModelGeneric.cpp +++ b/opm/simulators/wells/BlackoilWellModelGeneric.cpp @@ -2056,6 +2056,21 @@ logPrimaryVars() const OpmLog::debug(os.str()); } +template +std::vector +BlackoilWellModelGeneric:: +getPrimaryVarsDomain(const int domainIdx) const +{ + std::vector ret; + for (const auto& well : this->well_container_generic_) { + if (this->well_domain_.at(well->name()) == domainIdx) { + const auto& pv = well->getPrimaryVars(); + ret.insert(ret.end(), pv.begin(), pv.end()); + } + } + return ret; +} + template class BlackoilWellModelGeneric; #if FLOW_INSTANTIATE_FLOAT diff --git a/opm/simulators/wells/BlackoilWellModelGeneric.hpp b/opm/simulators/wells/BlackoilWellModelGeneric.hpp index 1c047de1c..eef952567 100644 --- a/opm/simulators/wells/BlackoilWellModelGeneric.hpp +++ b/opm/simulators/wells/BlackoilWellModelGeneric.hpp @@ -220,6 +220,7 @@ public: bool wasDynamicallyShutThisTimeStep(const std::string& well_name) const; void logPrimaryVars() const; + std::vector getPrimaryVarsDomain(const int domainIdx) const; template void serializeOp(Serializer& serializer) diff --git a/opm/simulators/wells/BlackoilWellModel_impl.hpp b/opm/simulators/wells/BlackoilWellModel_impl.hpp index a826abeef..fd06c06d3 100644 --- a/opm/simulators/wells/BlackoilWellModel_impl.hpp +++ b/opm/simulators/wells/BlackoilWellModel_impl.hpp @@ -2985,23 +2985,6 @@ namespace Opm { } - template - std::vector::Scalar> - BlackoilWellModel:: - getPrimaryVarsDomain(const int domainIdx) const - { - std::vector ret; - for (const auto& well : well_container_) { - if (this->well_domain_.at(well->name()) == domainIdx) { - const auto& pv = well->getPrimaryVars(); - ret.insert(ret.end(), pv.begin(), pv.end()); - } - } - return ret; - } - - - template void BlackoilWellModel:: From 3d10b549e7485720fb189590ba00a2adb4442e90 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Mon, 18 Nov 2024 11:11:19 +0100 Subject: [PATCH 09/14] setPrimaryVarsDomain: move to BlackoilWellModelGeneric --- opm/simulators/wells/BlackoilWellModel.hpp | 2 -- .../wells/BlackoilWellModelGeneric.cpp | 14 ++++++++++++++ .../wells/BlackoilWellModelGeneric.hpp | 1 + opm/simulators/wells/BlackoilWellModel_impl.hpp | 17 ----------------- 4 files changed, 15 insertions(+), 19 deletions(-) diff --git a/opm/simulators/wells/BlackoilWellModel.hpp b/opm/simulators/wells/BlackoilWellModel.hpp index b6b6c07fd..1e48a63fc 100644 --- a/opm/simulators/wells/BlackoilWellModel.hpp +++ b/opm/simulators/wells/BlackoilWellModel.hpp @@ -387,8 +387,6 @@ template class WellContributions; const Domain& domain); void updateWellControlsDomain(DeferredLogger& deferred_logger, const Domain& domain); - void setPrimaryVarsDomain(const int domainIdx, const std::vector& vars); - void setupDomains(const std::vector& domains); protected: diff --git a/opm/simulators/wells/BlackoilWellModelGeneric.cpp b/opm/simulators/wells/BlackoilWellModelGeneric.cpp index 2d7442bb2..55e200d0e 100644 --- a/opm/simulators/wells/BlackoilWellModelGeneric.cpp +++ b/opm/simulators/wells/BlackoilWellModelGeneric.cpp @@ -2071,6 +2071,20 @@ getPrimaryVarsDomain(const int domainIdx) const return ret; } +template +void BlackoilWellModelGeneric:: +setPrimaryVarsDomain(const int domainIdx, const std::vector& vars) +{ + std::size_t offset = 0; + for (auto& well : this->well_container_generic_) { + if (this->well_domain_.at(well->name()) == domainIdx) { + int num_pri_vars = well->setPrimaryVars(vars.begin() + offset); + offset += num_pri_vars; + } + } + assert(offset == vars.size()); +} + template class BlackoilWellModelGeneric; #if FLOW_INSTANTIATE_FLOAT diff --git a/opm/simulators/wells/BlackoilWellModelGeneric.hpp b/opm/simulators/wells/BlackoilWellModelGeneric.hpp index eef952567..b4021786f 100644 --- a/opm/simulators/wells/BlackoilWellModelGeneric.hpp +++ b/opm/simulators/wells/BlackoilWellModelGeneric.hpp @@ -221,6 +221,7 @@ public: void logPrimaryVars() const; std::vector getPrimaryVarsDomain(const int domainIdx) const; + void setPrimaryVarsDomain(const int domainIdx, const std::vector& vars); template void serializeOp(Serializer& serializer) diff --git a/opm/simulators/wells/BlackoilWellModel_impl.hpp b/opm/simulators/wells/BlackoilWellModel_impl.hpp index fd06c06d3..a0cebcfac 100644 --- a/opm/simulators/wells/BlackoilWellModel_impl.hpp +++ b/opm/simulators/wells/BlackoilWellModel_impl.hpp @@ -2985,23 +2985,6 @@ namespace Opm { } - template - void - BlackoilWellModel:: - setPrimaryVarsDomain(const int domainIdx, const std::vector& vars) - { - std::size_t offset = 0; - for (auto& well : well_container_) { - if (this->well_domain_.at(well->name()) == domainIdx) { - int num_pri_vars = well->setPrimaryVars(vars.begin() + offset); - offset += num_pri_vars; - } - } - assert(offset == vars.size()); - } - - - template void BlackoilWellModel:: From 7ab8d1938ffad7c9c4ed2e93ad62c35de0965a7e Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Mon, 18 Nov 2024 11:33:44 +0100 Subject: [PATCH 10/14] wbpCalcMap_: move to BlackoilWellModelGeneric --- opm/simulators/wells/BlackoilWellModel.hpp | 8 -------- opm/simulators/wells/BlackoilWellModelGeneric.hpp | 8 ++++++++ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/opm/simulators/wells/BlackoilWellModel.hpp b/opm/simulators/wells/BlackoilWellModel.hpp index 1e48a63fc..abe10bee4 100644 --- a/opm/simulators/wells/BlackoilWellModel.hpp +++ b/opm/simulators/wells/BlackoilWellModel.hpp @@ -425,14 +425,6 @@ template class WellContributions; std::unique_ptr rateConverter_{}; std::map> regionalAveragePressureCalculator_{}; - struct WBPCalcID - { - std::optional::size_type> openWellIdx_{}; - std::size_t wbpCalcIdx_{}; - }; - - std::vector wbpCalcMap_{}; - SimulatorReportSingle last_report_{}; // Pre-step network solve at static reservoir conditions (group and well states might be updated) diff --git a/opm/simulators/wells/BlackoilWellModelGeneric.hpp b/opm/simulators/wells/BlackoilWellModelGeneric.hpp index b4021786f..116bed1fe 100644 --- a/opm/simulators/wells/BlackoilWellModelGeneric.hpp +++ b/opm/simulators/wells/BlackoilWellModelGeneric.hpp @@ -581,6 +581,14 @@ protected: std::vector> prod_index_calc_; mutable ParallelWBPCalculation wbpCalculationService_; + struct WBPCalcID + { + std::optional*>::size_type> openWellIdx_{}; + std::size_t wbpCalcIdx_{}; + }; + + std::vector wbpCalcMap_{}; + std::vector pvt_region_idx_; mutable std::unordered_set closed_this_step_; From a67e8c44b4d6f7c8b8c67d972881f30bc90597a6 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Mon, 18 Nov 2024 11:34:13 +0100 Subject: [PATCH 11/14] registerOpenWellsForWbpCalculation: move to BlackoilWellModelGeneric --- opm/simulators/wells/BlackoilWellModel.hpp | 2 -- .../wells/BlackoilWellModelGeneric.cpp | 16 ++++++++++++++ .../wells/BlackoilWellModelGeneric.hpp | 2 ++ .../wells/BlackoilWellModel_impl.hpp | 21 ------------------- 4 files changed, 18 insertions(+), 23 deletions(-) diff --git a/opm/simulators/wells/BlackoilWellModel.hpp b/opm/simulators/wells/BlackoilWellModel.hpp index abe10bee4..813816fb1 100644 --- a/opm/simulators/wells/BlackoilWellModel.hpp +++ b/opm/simulators/wells/BlackoilWellModel.hpp @@ -508,8 +508,6 @@ template class WellContributions; typename ParallelWBPCalculation::EvaluatorFactory makeWellSourceEvaluatorFactory(const std::vector::size_type wellIdx) const; - void registerOpenWellsForWBPCalculation(); - void updateAverageFormationFactor(); void computePotentials(const std::size_t widx, diff --git a/opm/simulators/wells/BlackoilWellModelGeneric.cpp b/opm/simulators/wells/BlackoilWellModelGeneric.cpp index 55e200d0e..5e31fca1f 100644 --- a/opm/simulators/wells/BlackoilWellModelGeneric.cpp +++ b/opm/simulators/wells/BlackoilWellModelGeneric.cpp @@ -2085,6 +2085,22 @@ setPrimaryVarsDomain(const int domainIdx, const std::vector& vars) assert(offset == vars.size()); } +template +void BlackoilWellModelGeneric:: +registerOpenWellsForWBPCalculation() +{ + assert (this->wbpCalcMap_.size() == this->wells_ecl_.size()); + + for (auto& wbpCalc : this->wbpCalcMap_) { + wbpCalc.openWellIdx_.reset(); + } + + auto openWellIdx = typename std::vector*>::size_type{0}; + for (const auto* openWell : this->well_container_generic_) { + this->wbpCalcMap_[openWell->indexOfWell()].openWellIdx_ = openWellIdx++; + } +} + template class BlackoilWellModelGeneric; #if FLOW_INSTANTIATE_FLOAT diff --git a/opm/simulators/wells/BlackoilWellModelGeneric.hpp b/opm/simulators/wells/BlackoilWellModelGeneric.hpp index 116bed1fe..7ebe73660 100644 --- a/opm/simulators/wells/BlackoilWellModelGeneric.hpp +++ b/opm/simulators/wells/BlackoilWellModelGeneric.hpp @@ -458,6 +458,8 @@ protected: void assignMassGasRate(data::Wells& wsrpt, const Scalar& gasDensity) const; + void registerOpenWellsForWBPCalculation(); + Schedule& schedule_; const SummaryState& summaryState_; const EclipseState& eclState_; diff --git a/opm/simulators/wells/BlackoilWellModel_impl.hpp b/opm/simulators/wells/BlackoilWellModel_impl.hpp index a0cebcfac..f4706208a 100644 --- a/opm/simulators/wells/BlackoilWellModel_impl.hpp +++ b/opm/simulators/wells/BlackoilWellModel_impl.hpp @@ -2486,27 +2486,6 @@ namespace Opm { - template - void - BlackoilWellModel:: - registerOpenWellsForWBPCalculation() - { - assert (this->wbpCalcMap_.size() == this->wells_ecl_.size()); - - for (auto& wbpCalc : this->wbpCalcMap_) { - wbpCalc.openWellIdx_.reset(); - } - - auto openWellIdx = typename std::vector::size_type{0}; - for (const auto* openWell : this->well_container_generic_) { - this->wbpCalcMap_[openWell->indexOfWell()].openWellIdx_ = openWellIdx++; - } - } - - - - - template void BlackoilWellModel:: From 4d998545eb14448edbb71bc7b3ad851557bfc37b Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Mon, 18 Nov 2024 11:41:52 +0100 Subject: [PATCH 12/14] initializeWBPCalculationService: move to BlackoilWellModelGeneric --- opm/simulators/wells/BlackoilWellModel.hpp | 5 -- .../wells/BlackoilWellModelGeneric.cpp | 74 +++++++++++++++++ .../wells/BlackoilWellModelGeneric.hpp | 5 ++ .../wells/BlackoilWellModel_impl.hpp | 83 ------------------- 4 files changed, 79 insertions(+), 88 deletions(-) diff --git a/opm/simulators/wells/BlackoilWellModel.hpp b/opm/simulators/wells/BlackoilWellModel.hpp index 813816fb1..6ec598ee5 100644 --- a/opm/simulators/wells/BlackoilWellModel.hpp +++ b/opm/simulators/wells/BlackoilWellModel.hpp @@ -500,14 +500,9 @@ template class WellContributions; // setting the well_solutions_ based on well_state. void updatePrimaryVariables(DeferredLogger& deferred_logger); - void initializeWBPCalculationService(); - data::WellBlockAveragePressures computeWellBlockAveragePressures() const; - typename ParallelWBPCalculation::EvaluatorFactory - makeWellSourceEvaluatorFactory(const std::vector::size_type wellIdx) const; - void updateAverageFormationFactor(); void computePotentials(const std::size_t widx, diff --git a/opm/simulators/wells/BlackoilWellModelGeneric.cpp b/opm/simulators/wells/BlackoilWellModelGeneric.cpp index 5e31fca1f..dbefc6bf2 100644 --- a/opm/simulators/wells/BlackoilWellModelGeneric.cpp +++ b/opm/simulators/wells/BlackoilWellModelGeneric.cpp @@ -2101,6 +2101,80 @@ registerOpenWellsForWBPCalculation() } } +template +typename ParallelWBPCalculation::EvaluatorFactory +BlackoilWellModelGeneric:: +makeWellSourceEvaluatorFactory(const std::vector::size_type wellIdx) const +{ + using Span = typename PAvgDynamicSourceData::template SourceDataSpan; + using Item = typename Span::Item; + + return [wellIdx, this]() -> typename ParallelWBPCalculation::Evaluator + { + if (! this->wbpCalcMap_[wellIdx].openWellIdx_.has_value()) { + // Well is stopped/shut. Return evaluator for stopped wells. + return []([[maybe_unused]] const int connIdx, Span sourceTerm) + { + // Well/connection is stopped/shut. Set all items to + // zero. + + sourceTerm + .set(Item::Pressure , 0.0) + .set(Item::PoreVol , 0.0) + .set(Item::MixtureDensity, 0.0) + .set(Item::Depth , 0.0) + ; + }; + } + + // Well is open. Return an evaluator for open wells/open connections. + return [this, wellPtr = this->well_container_generic_[*this->wbpCalcMap_[wellIdx].openWellIdx_]] + (const int connIdx, Span sourceTerm) + { + // Note: The only item which actually matters for the WBP + // calculation at the well reservoir connection level is the + // mixture density. Set other items to zero. + + const auto& connIdxMap = + this->conn_idx_map_[wellPtr->indexOfWell()]; + + const auto rho = wellPtr-> + connectionDensity(connIdxMap.global(connIdx), + connIdxMap.open(connIdx)); + + sourceTerm + .set(Item::Pressure , 0.0) + .set(Item::PoreVol , 0.0) + .set(Item::MixtureDensity, rho) + .set(Item::Depth , 0.0) + ; + }; + }; +} + +template +void BlackoilWellModelGeneric:: +initializeWBPCalculationService() +{ + this->wbpCalcMap_.clear(); + this->wbpCalcMap_.resize(this->wells_ecl_.size()); + + this->registerOpenWellsForWBPCalculation(); + + auto wellID = std::size_t{0}; + for (const auto& well : this->wells_ecl_) { + this->wbpCalcMap_[wellID].wbpCalcIdx_ = this->wbpCalculationService_ + .createCalculator(well, + this->local_parallel_well_info_[wellID], + this->conn_idx_map_[wellID].local(), + this->makeWellSourceEvaluatorFactory(wellID)); + + ++wellID; + } + + this->wbpCalculationService_.defineCommunication(); +} + template class BlackoilWellModelGeneric; #if FLOW_INSTANTIATE_FLOAT diff --git a/opm/simulators/wells/BlackoilWellModelGeneric.hpp b/opm/simulators/wells/BlackoilWellModelGeneric.hpp index 7ebe73660..893ffc53d 100644 --- a/opm/simulators/wells/BlackoilWellModelGeneric.hpp +++ b/opm/simulators/wells/BlackoilWellModelGeneric.hpp @@ -460,6 +460,11 @@ protected: void registerOpenWellsForWBPCalculation(); + typename ParallelWBPCalculation::EvaluatorFactory + makeWellSourceEvaluatorFactory(const std::vector::size_type wellIdx) const; + + void initializeWBPCalculationService(); + Schedule& schedule_; const SummaryState& summaryState_; const EclipseState& eclState_; diff --git a/opm/simulators/wells/BlackoilWellModel_impl.hpp b/opm/simulators/wells/BlackoilWellModel_impl.hpp index f4706208a..322a2463f 100644 --- a/opm/simulators/wells/BlackoilWellModel_impl.hpp +++ b/opm/simulators/wells/BlackoilWellModel_impl.hpp @@ -2357,34 +2357,6 @@ namespace Opm { - template - void - BlackoilWellModel:: - initializeWBPCalculationService() - { - this->wbpCalcMap_.clear(); - this->wbpCalcMap_.resize(this->wells_ecl_.size()); - - this->registerOpenWellsForWBPCalculation(); - - auto wellID = std::size_t{0}; - for (const auto& well : this->wells_ecl_) { - this->wbpCalcMap_[wellID].wbpCalcIdx_ = this->wbpCalculationService_ - .createCalculator(well, - this->local_parallel_well_info_[wellID], - this->conn_idx_map_[wellID].local(), - this->makeWellSourceEvaluatorFactory(wellID)); - - ++wellID; - } - - this->wbpCalculationService_.defineCommunication(); - } - - - - - template data::WellBlockAveragePressures BlackoilWellModel:: @@ -2431,61 +2403,6 @@ namespace Opm { - template - typename ParallelWBPCalculation::Scalar>::EvaluatorFactory - BlackoilWellModel:: - makeWellSourceEvaluatorFactory(const std::vector::size_type wellIdx) const - { - using Span = typename PAvgDynamicSourceData::template SourceDataSpan; - using Item = typename Span::Item; - - return [wellIdx, this]() -> typename ParallelWBPCalculation::Evaluator - { - if (! this->wbpCalcMap_[wellIdx].openWellIdx_.has_value()) { - // Well is stopped/shut. Return evaluator for stopped wells. - return []([[maybe_unused]] const int connIdx, Span sourceTerm) - { - // Well/connection is stopped/shut. Set all items to - // zero. - - sourceTerm - .set(Item::Pressure , 0.0) - .set(Item::PoreVol , 0.0) - .set(Item::MixtureDensity, 0.0) - .set(Item::Depth , 0.0) - ; - }; - } - - // Well is open. Return an evaluator for open wells/open connections. - return [this, wellPtr = this->well_container_[*this->wbpCalcMap_[wellIdx].openWellIdx_].get()] - (const int connIdx, Span sourceTerm) - { - // Note: The only item which actually matters for the WBP - // calculation at the well reservoir connection level is the - // mixture density. Set other items to zero. - - const auto& connIdxMap = - this->conn_idx_map_[wellPtr->indexOfWell()]; - - const auto rho = wellPtr-> - connectionDensity(connIdxMap.global(connIdx), - connIdxMap.open(connIdx)); - - sourceTerm - .set(Item::Pressure , 0.0) - .set(Item::PoreVol , 0.0) - .set(Item::MixtureDensity, rho) - .set(Item::Depth , 0.0) - ; - }; - }; - } - - - - - template void BlackoilWellModel:: From 44c8b6086ba014e427bf9a3bdcbfd3335c46600c Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Mon, 18 Nov 2024 11:46:26 +0100 Subject: [PATCH 13/14] computeWellBlockAveragePressures: move to BlackoilWellModelGeneric --- opm/simulators/wells/BlackoilWellModel.hpp | 5 +- .../wells/BlackoilWellModelGeneric.cpp | 42 +++++++++++++++++ .../wells/BlackoilWellModelGeneric.hpp | 3 ++ .../wells/BlackoilWellModel_impl.hpp | 46 ------------------- 4 files changed, 46 insertions(+), 50 deletions(-) diff --git a/opm/simulators/wells/BlackoilWellModel.hpp b/opm/simulators/wells/BlackoilWellModel.hpp index 6ec598ee5..a9949c567 100644 --- a/opm/simulators/wells/BlackoilWellModel.hpp +++ b/opm/simulators/wells/BlackoilWellModel.hpp @@ -296,7 +296,7 @@ template class WellContributions; data::WellBlockAveragePressures wellBlockAveragePressures() const { - return this->computeWellBlockAveragePressures(); + return this->computeWellBlockAveragePressures(this->gravity_); } // subtract B*inv(D)*C * x from A*x @@ -500,9 +500,6 @@ template class WellContributions; // setting the well_solutions_ based on well_state. void updatePrimaryVariables(DeferredLogger& deferred_logger); - data::WellBlockAveragePressures - computeWellBlockAveragePressures() const; - void updateAverageFormationFactor(); void computePotentials(const std::size_t widx, diff --git a/opm/simulators/wells/BlackoilWellModelGeneric.cpp b/opm/simulators/wells/BlackoilWellModelGeneric.cpp index dbefc6bf2..ed422668d 100644 --- a/opm/simulators/wells/BlackoilWellModelGeneric.cpp +++ b/opm/simulators/wells/BlackoilWellModelGeneric.cpp @@ -2175,6 +2175,48 @@ initializeWBPCalculationService() this->wbpCalculationService_.defineCommunication(); } +template +data::WellBlockAveragePressures +BlackoilWellModelGeneric:: +computeWellBlockAveragePressures(const Scalar gravity) const +{ + auto wbpResult = data::WellBlockAveragePressures{}; + + using Calculated = typename PAvgCalculatorResult::WBPMode; + using Output = data::WellBlockAvgPress::Quantity; + + this->wbpCalculationService_.collectDynamicValues(); + + const auto numWells = this->wells_ecl_.size(); + for (auto wellID = 0*numWells; wellID < numWells; ++wellID) { + const auto calcIdx = this->wbpCalcMap_[wellID].wbpCalcIdx_; + const auto& well = this->wells_ecl_[wellID]; + + if (! well.hasRefDepth()) { + // Can't perform depth correction without at least a + // fall-back datum depth. + continue; + } + + this->wbpCalculationService_ + .inferBlockAveragePressures(calcIdx, well.pavg(), + gravity, + well.getWPaveRefDepth()); + + const auto& result = this->wbpCalculationService_ + .averagePressures(calcIdx); + + auto& reported = wbpResult.values[well.name()]; + + reported[Output::WBP] = result.value(Calculated::WBP); + reported[Output::WBP4] = result.value(Calculated::WBP4); + reported[Output::WBP5] = result.value(Calculated::WBP5); + reported[Output::WBP9] = result.value(Calculated::WBP9); + } + + return wbpResult; +} + template class BlackoilWellModelGeneric; #if FLOW_INSTANTIATE_FLOAT diff --git a/opm/simulators/wells/BlackoilWellModelGeneric.hpp b/opm/simulators/wells/BlackoilWellModelGeneric.hpp index 893ffc53d..2ef35efd8 100644 --- a/opm/simulators/wells/BlackoilWellModelGeneric.hpp +++ b/opm/simulators/wells/BlackoilWellModelGeneric.hpp @@ -465,6 +465,9 @@ protected: void initializeWBPCalculationService(); + data::WellBlockAveragePressures + computeWellBlockAveragePressures(const Scalar gravity) const; + Schedule& schedule_; const SummaryState& summaryState_; const EclipseState& eclState_; diff --git a/opm/simulators/wells/BlackoilWellModel_impl.hpp b/opm/simulators/wells/BlackoilWellModel_impl.hpp index 322a2463f..ef70f469f 100644 --- a/opm/simulators/wells/BlackoilWellModel_impl.hpp +++ b/opm/simulators/wells/BlackoilWellModel_impl.hpp @@ -2357,52 +2357,6 @@ namespace Opm { - template - data::WellBlockAveragePressures - BlackoilWellModel:: - computeWellBlockAveragePressures() const - { - auto wbpResult = data::WellBlockAveragePressures{}; - - using Calculated = typename PAvgCalculatorResult::WBPMode; - using Output = data::WellBlockAvgPress::Quantity; - - this->wbpCalculationService_.collectDynamicValues(); - - const auto numWells = this->wells_ecl_.size(); - for (auto wellID = 0*numWells; wellID < numWells; ++wellID) { - const auto calcIdx = this->wbpCalcMap_[wellID].wbpCalcIdx_; - const auto& well = this->wells_ecl_[wellID]; - - if (! well.hasRefDepth()) { - // Can't perform depth correction without at least a - // fall-back datum depth. - continue; - } - - this->wbpCalculationService_ - .inferBlockAveragePressures(calcIdx, well.pavg(), - this->gravity_, - well.getWPaveRefDepth()); - - const auto& result = this->wbpCalculationService_ - .averagePressures(calcIdx); - - auto& reported = wbpResult.values[well.name()]; - - reported[Output::WBP] = result.value(Calculated::WBP); - reported[Output::WBP4] = result.value(Calculated::WBP4); - reported[Output::WBP5] = result.value(Calculated::WBP5); - reported[Output::WBP9] = result.value(Calculated::WBP9); - } - - return wbpResult; - } - - - - - template void BlackoilWellModel:: From 822fc11a3d1f5da4fc9f3e47bb049ba2ca5e86e7 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Mon, 18 Nov 2024 11:50:19 +0100 Subject: [PATCH 14/14] cosmetics --- opm/simulators/wells/BlackoilWellModel_impl.hpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/opm/simulators/wells/BlackoilWellModel_impl.hpp b/opm/simulators/wells/BlackoilWellModel_impl.hpp index ef70f469f..01b8654a4 100644 --- a/opm/simulators/wells/BlackoilWellModel_impl.hpp +++ b/opm/simulators/wells/BlackoilWellModel_impl.hpp @@ -1187,7 +1187,8 @@ namespace Opm { template void BlackoilWellModel:: - doPreStepNetworkRebalance(DeferredLogger& deferred_logger) { + doPreStepNetworkRebalance(DeferredLogger& deferred_logger) + { const double dt = this->simulator_.timeStepSize(); // TODO: should we also have the group and network backed-up here in case the solution did not get converged? auto& well_state = this->wellState(); @@ -1288,7 +1289,9 @@ namespace Opm { template bool BlackoilWellModel:: - updateWellControlsAndNetwork(const bool mandatory_network_balance, const double dt, DeferredLogger& local_deferredLogger) + updateWellControlsAndNetwork(const bool mandatory_network_balance, + const double dt, + DeferredLogger& local_deferredLogger) { // not necessarily that we always need to update once of the network solutions bool do_network_update = true; @@ -2245,7 +2248,9 @@ namespace Opm { template std::pair BlackoilWellModel:: - updateWellControls(const bool mandatory_network_balance, DeferredLogger& deferred_logger, const bool relax_network_tolerance) + updateWellControls(const bool mandatory_network_balance, + DeferredLogger& deferred_logger, + const bool relax_network_tolerance) { const int episodeIdx = simulator_.episodeIndex(); const auto& network = this->schedule()[episodeIdx].network();