From 147f0eb2bdc9f0a2a9c1f894f2f1a288abc3f7d2 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Wed, 9 Nov 2022 13:01:30 +0100 Subject: [PATCH 1/6] WellInterface: make initPrimaryVariablesEvaluation non-const this will obviously modify well state --- opm/simulators/wells/MultisegmentWell.hpp | 2 +- opm/simulators/wells/MultisegmentWell_impl.hpp | 2 +- opm/simulators/wells/StandardWell.hpp | 2 +- opm/simulators/wells/StandardWell_impl.hpp | 2 +- opm/simulators/wells/WellInterface.hpp | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/opm/simulators/wells/MultisegmentWell.hpp b/opm/simulators/wells/MultisegmentWell.hpp index 5ca3c8882..5c8ad486c 100644 --- a/opm/simulators/wells/MultisegmentWell.hpp +++ b/opm/simulators/wells/MultisegmentWell.hpp @@ -94,7 +94,7 @@ namespace Opm const std::vector< Scalar >& B_avg, const bool changed_to_open_this_step) override; - virtual void initPrimaryVariablesEvaluation() const override; + void initPrimaryVariablesEvaluation() override; /// updating the well state based the current control mode virtual void updateWellStateWithTarget(const Simulator& ebos_simulator, diff --git a/opm/simulators/wells/MultisegmentWell_impl.hpp b/opm/simulators/wells/MultisegmentWell_impl.hpp index 8b60964b6..ba5c0ba31 100644 --- a/opm/simulators/wells/MultisegmentWell_impl.hpp +++ b/opm/simulators/wells/MultisegmentWell_impl.hpp @@ -127,7 +127,7 @@ namespace Opm template void MultisegmentWell:: - initPrimaryVariablesEvaluation() const + initPrimaryVariablesEvaluation() { this->MSWEval::initPrimaryVariablesEvaluation(); } diff --git a/opm/simulators/wells/StandardWell.hpp b/opm/simulators/wells/StandardWell.hpp index a97409adc..87610ead0 100644 --- a/opm/simulators/wells/StandardWell.hpp +++ b/opm/simulators/wells/StandardWell.hpp @@ -144,7 +144,7 @@ namespace Opm const bool changed_to_open_this_step) override; - virtual void initPrimaryVariablesEvaluation() const override; + void initPrimaryVariablesEvaluation() override; /// check whether the well equations get converged for this well virtual ConvergenceReport getWellConvergence(const WellState& well_state, diff --git a/opm/simulators/wells/StandardWell_impl.hpp b/opm/simulators/wells/StandardWell_impl.hpp index b199a439c..eedb2b0dd 100644 --- a/opm/simulators/wells/StandardWell_impl.hpp +++ b/opm/simulators/wells/StandardWell_impl.hpp @@ -75,7 +75,7 @@ namespace Opm template void StandardWell:: - initPrimaryVariablesEvaluation() const + initPrimaryVariablesEvaluation() { this->primary_variables_.init(); } diff --git a/opm/simulators/wells/WellInterface.hpp b/opm/simulators/wells/WellInterface.hpp index eb8dc6d5e..a65434f37 100644 --- a/opm/simulators/wells/WellInterface.hpp +++ b/opm/simulators/wells/WellInterface.hpp @@ -148,7 +148,7 @@ public: const std::vector< Scalar >& B_avg, const bool changed_to_open_this_step); - virtual void initPrimaryVariablesEvaluation() const = 0; + virtual void initPrimaryVariablesEvaluation() = 0; virtual ConvergenceReport getWellConvergence(const WellState& well_state, const std::vector& B_avg, DeferredLogger& deferred_logger, const bool relax_tolerance) const = 0; From fba6249dd8bc8c5a723cead13a0182252ad64f76 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Wed, 9 Nov 2022 13:01:30 +0100 Subject: [PATCH 2/6] WellInterface: make recoverWellSolutionAndUpdateWellState non-const this will obviously modify well state --- opm/simulators/wells/MultisegmentWell.hpp | 6 +++--- opm/simulators/wells/MultisegmentWell_impl.hpp | 2 +- opm/simulators/wells/StandardWell.hpp | 6 +++--- opm/simulators/wells/StandardWell_impl.hpp | 2 +- opm/simulators/wells/WellInterface.hpp | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/opm/simulators/wells/MultisegmentWell.hpp b/opm/simulators/wells/MultisegmentWell.hpp index 5c8ad486c..a6a196f00 100644 --- a/opm/simulators/wells/MultisegmentWell.hpp +++ b/opm/simulators/wells/MultisegmentWell.hpp @@ -115,9 +115,9 @@ namespace Opm /// using the solution x to recover the solution xw for wells and applying /// xw to update Well State - virtual void recoverWellSolutionAndUpdateWellState(const BVector& x, - WellState& well_state, - DeferredLogger& deferred_logger) const override; + void recoverWellSolutionAndUpdateWellState(const BVector& x, + WellState& well_state, + DeferredLogger& deferred_logger) override; /// computing the well potentials for group control virtual void computeWellPotentials(const Simulator& ebosSimulator, diff --git a/opm/simulators/wells/MultisegmentWell_impl.hpp b/opm/simulators/wells/MultisegmentWell_impl.hpp index ba5c0ba31..851b703aa 100644 --- a/opm/simulators/wells/MultisegmentWell_impl.hpp +++ b/opm/simulators/wells/MultisegmentWell_impl.hpp @@ -238,7 +238,7 @@ namespace Opm MultisegmentWell:: recoverWellSolutionAndUpdateWellState(const BVector& x, WellState& well_state, - DeferredLogger& deferred_logger) const + DeferredLogger& deferred_logger) { if (!this->isOperableAndSolvable() && !this->wellIsStopped()) return; diff --git a/opm/simulators/wells/StandardWell.hpp b/opm/simulators/wells/StandardWell.hpp index 87610ead0..dd5ac47a7 100644 --- a/opm/simulators/wells/StandardWell.hpp +++ b/opm/simulators/wells/StandardWell.hpp @@ -159,9 +159,9 @@ namespace Opm /// using the solution x to recover the solution xw for wells and applying /// xw to update Well State - virtual void recoverWellSolutionAndUpdateWellState(const BVector& x, - WellState& well_state, - DeferredLogger& deferred_logger) const override; + void recoverWellSolutionAndUpdateWellState(const BVector& x, + WellState& well_state, + DeferredLogger& deferred_logger) override; /// computing the well potentials for group control virtual void computeWellPotentials(const Simulator& ebosSimulator, diff --git a/opm/simulators/wells/StandardWell_impl.hpp b/opm/simulators/wells/StandardWell_impl.hpp index eedb2b0dd..c6d0c83e7 100644 --- a/opm/simulators/wells/StandardWell_impl.hpp +++ b/opm/simulators/wells/StandardWell_impl.hpp @@ -1729,7 +1729,7 @@ namespace Opm StandardWell:: recoverWellSolutionAndUpdateWellState(const BVector& x, WellState& well_state, - DeferredLogger& deferred_logger) const + DeferredLogger& deferred_logger) { if (!this->isOperableAndSolvable() && !this->wellIsStopped()) return; diff --git a/opm/simulators/wells/WellInterface.hpp b/opm/simulators/wells/WellInterface.hpp index a65434f37..a7f8dadb5 100644 --- a/opm/simulators/wells/WellInterface.hpp +++ b/opm/simulators/wells/WellInterface.hpp @@ -178,7 +178,7 @@ public: /// xw to update Well State virtual void recoverWellSolutionAndUpdateWellState(const BVector& x, WellState& well_state, - DeferredLogger& deferred_logger) const = 0; + DeferredLogger& deferred_logger) = 0; /// Ax = Ax - C D^-1 B x virtual void apply(const BVector& x, BVector& Ax) const = 0; From c9856b9b2a9ffe91bab99658a61bf7e14dabdce2 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Wed, 9 Nov 2022 13:01:30 +0100 Subject: [PATCH 3/6] WellInterface: make updatePrimaryVariables non-const this will obviously modify well state --- opm/simulators/wells/MultisegmentWell.hpp | 2 +- opm/simulators/wells/MultisegmentWell_impl.hpp | 2 +- opm/simulators/wells/StandardWell.hpp | 2 +- opm/simulators/wells/StandardWell_impl.hpp | 2 +- opm/simulators/wells/WellInterface.hpp | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/opm/simulators/wells/MultisegmentWell.hpp b/opm/simulators/wells/MultisegmentWell.hpp index a6a196f00..e5c8f398b 100644 --- a/opm/simulators/wells/MultisegmentWell.hpp +++ b/opm/simulators/wells/MultisegmentWell.hpp @@ -125,7 +125,7 @@ namespace Opm std::vector& well_potentials, DeferredLogger& deferred_logger) override; - virtual void updatePrimaryVariables(const WellState& well_state, DeferredLogger& deferred_logger) const override; + void updatePrimaryVariables(const WellState& well_state, DeferredLogger& deferred_logger) override; virtual void solveEqAndUpdateWellState(WellState& well_state, DeferredLogger& deferred_logger) override; // const? diff --git a/opm/simulators/wells/MultisegmentWell_impl.hpp b/opm/simulators/wells/MultisegmentWell_impl.hpp index 851b703aa..7346bc009 100644 --- a/opm/simulators/wells/MultisegmentWell_impl.hpp +++ b/opm/simulators/wells/MultisegmentWell_impl.hpp @@ -139,7 +139,7 @@ namespace Opm template void MultisegmentWell:: - updatePrimaryVariables(const WellState& well_state, DeferredLogger& /* deferred_logger */) const + updatePrimaryVariables(const WellState& well_state, DeferredLogger& /* deferred_logger */) { this->MSWEval::updatePrimaryVariables(well_state); } diff --git a/opm/simulators/wells/StandardWell.hpp b/opm/simulators/wells/StandardWell.hpp index dd5ac47a7..4a16fab08 100644 --- a/opm/simulators/wells/StandardWell.hpp +++ b/opm/simulators/wells/StandardWell.hpp @@ -169,7 +169,7 @@ namespace Opm std::vector& well_potentials, DeferredLogger& deferred_logger) /* const */ override; - virtual void updatePrimaryVariables(const WellState& well_state, DeferredLogger& deferred_logger) const override; + void updatePrimaryVariables(const WellState& well_state, DeferredLogger& deferred_logger) override; virtual void solveEqAndUpdateWellState(WellState& well_state, DeferredLogger& deferred_logger) override; diff --git a/opm/simulators/wells/StandardWell_impl.hpp b/opm/simulators/wells/StandardWell_impl.hpp index c6d0c83e7..fc4c5c7c3 100644 --- a/opm/simulators/wells/StandardWell_impl.hpp +++ b/opm/simulators/wells/StandardWell_impl.hpp @@ -2010,7 +2010,7 @@ namespace Opm template void StandardWell:: - updatePrimaryVariables(const WellState& well_state, DeferredLogger& deferred_logger) const + updatePrimaryVariables(const WellState& well_state, DeferredLogger& deferred_logger) { if (!this->isOperableAndSolvable() && !this->wellIsStopped()) return; diff --git a/opm/simulators/wells/WellInterface.hpp b/opm/simulators/wells/WellInterface.hpp index a7f8dadb5..34967810f 100644 --- a/opm/simulators/wells/WellInterface.hpp +++ b/opm/simulators/wells/WellInterface.hpp @@ -204,7 +204,7 @@ public: const GroupState& group_state, DeferredLogger& deferred_logger) /* const */; - virtual void updatePrimaryVariables(const WellState& well_state, DeferredLogger& deferred_logger) const = 0; + virtual void updatePrimaryVariables(const WellState& well_state, DeferredLogger& deferred_logger) = 0; virtual void calculateExplicitQuantities(const Simulator& ebosSimulator, const WellState& well_state, From 64112f76b37a32a96b57ea2a5ef1198760468e0e Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Wed, 9 Nov 2022 13:05:40 +0100 Subject: [PATCH 4/6] StandardWell: make updateWellState non-const this will obviously modify well state --- opm/simulators/wells/StandardWell.hpp | 2 +- opm/simulators/wells/StandardWell_impl.hpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/opm/simulators/wells/StandardWell.hpp b/opm/simulators/wells/StandardWell.hpp index 4a16fab08..fc1287fac 100644 --- a/opm/simulators/wells/StandardWell.hpp +++ b/opm/simulators/wells/StandardWell.hpp @@ -257,7 +257,7 @@ namespace Opm // updating the well_state based on well solution dwells void updateWellState(const BVectorWell& dwells, WellState& well_state, - DeferredLogger& deferred_logger) const; + DeferredLogger& deferred_logger); // calculate the properties for the well connections // to calulate the pressure difference between well connections. diff --git a/opm/simulators/wells/StandardWell_impl.hpp b/opm/simulators/wells/StandardWell_impl.hpp index fc4c5c7c3..98c4e3898 100644 --- a/opm/simulators/wells/StandardWell_impl.hpp +++ b/opm/simulators/wells/StandardWell_impl.hpp @@ -932,7 +932,7 @@ namespace Opm StandardWell:: updateWellState(const BVectorWell& dwells, WellState& well_state, - DeferredLogger& deferred_logger) const + DeferredLogger& deferred_logger) { if (!this->isOperableAndSolvable() && !this->wellIsStopped()) return; From 13af642fe4bf846872fce18b1ba9eec3913fc76d Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Wed, 9 Nov 2022 13:06:11 +0100 Subject: [PATCH 5/6] StandardWell: make updatePrimaryVariablesNewton non-const this will obviously modify well state --- opm/simulators/wells/StandardWell.hpp | 2 +- opm/simulators/wells/StandardWell_impl.hpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/opm/simulators/wells/StandardWell.hpp b/opm/simulators/wells/StandardWell.hpp index fc1287fac..7c56f3f61 100644 --- a/opm/simulators/wells/StandardWell.hpp +++ b/opm/simulators/wells/StandardWell.hpp @@ -355,7 +355,7 @@ namespace Opm void updatePrimaryVariablesNewton(const BVectorWell& dwells, const WellState& well_state, - DeferredLogger& deferred_logger) const; + DeferredLogger& deferred_logger); void updateWellStateFromPrimaryVariables(WellState& well_state, DeferredLogger& deferred_logger) const; diff --git a/opm/simulators/wells/StandardWell_impl.hpp b/opm/simulators/wells/StandardWell_impl.hpp index 98c4e3898..23c3fbffc 100644 --- a/opm/simulators/wells/StandardWell_impl.hpp +++ b/opm/simulators/wells/StandardWell_impl.hpp @@ -951,7 +951,7 @@ namespace Opm StandardWell:: updatePrimaryVariablesNewton(const BVectorWell& dwells, const WellState& /* well_state */, - DeferredLogger& deferred_logger) const + DeferredLogger& deferred_logger) { const double dFLimit = this->param_.dwell_fraction_max_; const double dBHPLimit = this->param_.dbhp_max_rel_; From 2671a3fb35623f955a454dec87e2dea8adb42e93 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Wed, 9 Nov 2022 13:06:32 +0100 Subject: [PATCH 6/6] fixed: primary variables no longer needs to be mutable --- opm/simulators/wells/StandardWellEval.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opm/simulators/wells/StandardWellEval.hpp b/opm/simulators/wells/StandardWellEval.hpp index d9f78b6b6..094035749 100644 --- a/opm/simulators/wells/StandardWellEval.hpp +++ b/opm/simulators/wells/StandardWellEval.hpp @@ -105,7 +105,7 @@ protected: void updateWellStateFromPrimaryVariables(WellState& well_state, DeferredLogger& deferred_logger) const; - mutable PrimaryVariables primary_variables_; //!< Primary variables for well + PrimaryVariables primary_variables_; //!< Primary variables for well // the saturations in the well bore under surface conditions at the beginning of the time step std::vector F0_;