diff --git a/opm/autodiff/BlackoilModelBase_impl.hpp b/opm/autodiff/BlackoilModelBase_impl.hpp index 94a1e470c..7f66d0d83 100644 --- a/opm/autodiff/BlackoilModelBase_impl.hpp +++ b/opm/autodiff/BlackoilModelBase_impl.hpp @@ -1058,12 +1058,12 @@ namespace detail { converged = getWellConvergence(it); // When the well targets are just updated or need to be updated, we need at least one more iteration. - if (asImpl().wellModel().justUpdateWellTargets()) { + if (asImpl().wellModel().wellCollection()->justUpdateWellTargets()) { converged = false; - asImpl().wellModel().setJustUpdateWellTargets(false); + asImpl().wellModel().wellCollection()->setJustUpdateWellTargets(false); } - if (converged && asImpl().wellModel().needUpdateWellTargets()) { + if (converged && asImpl().wellModel().wellCollection()->needUpdateWellTargets()) { converged = false; } diff --git a/opm/autodiff/MultisegmentWells.cpp b/opm/autodiff/MultisegmentWells.cpp index 7cb88b49b..c3bff5534 100644 --- a/opm/autodiff/MultisegmentWells.cpp +++ b/opm/autodiff/MultisegmentWells.cpp @@ -141,10 +141,12 @@ namespace Opm { MultisegmentWells:: MultisegmentWells(const Wells* wells_arg, + WellCollection* well_collection, const std::vector< const Well* >& wells_ecl, const int time_step) : wells_multisegment_( createMSWellVector(wells_arg, wells_ecl, time_step) ) , wops_ms_(wells_multisegment_) + , well_collection_(well_collection) , num_phases_(wells_arg ? wells_arg->number_of_phases : 0) , wells_(wells_arg) , fluid_(nullptr) @@ -381,6 +383,16 @@ namespace Opm { return indices; } + + + + + WellCollection* + MultisegmentWells:: + wellCollection() const { + return well_collection_; + } + } // end of namespace Opm diff --git a/opm/autodiff/MultisegmentWells.hpp b/opm/autodiff/MultisegmentWells.hpp index 144428962..07764cc3f 100644 --- a/opm/autodiff/MultisegmentWells.hpp +++ b/opm/autodiff/MultisegmentWells.hpp @@ -32,6 +32,7 @@ #include #include +#include #include #include @@ -89,6 +90,7 @@ namespace Opm { // TODO: using a vector of WellMultiSegmentConstPtr for now // TODO: it should use const Wells or something else later. MultisegmentWells(const Wells* wells_arg, + WellCollection* well_collection, const std::vector< const Well* >& wells_ecl, const int time_step); @@ -229,11 +231,16 @@ namespace Opm { const std::vector& kr_adb, const std::vector& fluid_density); + WellCollection* wellCollection() const; + protected: // TODO: probably a wells_active_ will be required here. bool wells_active_; std::vector wells_multisegment_; MultisegmentWellOps wops_ms_; + // It will probably need to be updated during running time. + WellCollection* well_collection_; + const int num_phases_; int nseg_total_; int nperf_total_; diff --git a/opm/autodiff/SimulatorFullyImplicitBlackoilMultiSegment_impl.hpp b/opm/autodiff/SimulatorFullyImplicitBlackoilMultiSegment_impl.hpp index d44508444..f29f105ce 100644 --- a/opm/autodiff/SimulatorFullyImplicitBlackoilMultiSegment_impl.hpp +++ b/opm/autodiff/SimulatorFullyImplicitBlackoilMultiSegment_impl.hpp @@ -122,7 +122,7 @@ namespace Opm const auto wells_ecl = eclipse_state_->getSchedule().getWells(timer.currentStepNum()); const int current_time_step = timer.currentStepNum(); - const WellModel well_model(wells, wells_ecl, current_time_step); + const WellModel well_model(wells, &(wells_manager.wellCollection()), wells_ecl, current_time_step); well_state.init(well_model, state, prev_well_state, wells); diff --git a/opm/autodiff/StandardWells.hpp b/opm/autodiff/StandardWells.hpp index 6da9a9a9d..e74010ebe 100644 --- a/opm/autodiff/StandardWells.hpp +++ b/opm/autodiff/StandardWells.hpp @@ -191,23 +191,14 @@ namespace Opm { const WellState& well_state, DynamicListEconLimited& list_econ_limited) const; - bool justUpdateWellTargets() const { - return well_collection_->justUpdateWellTargets(); - } - bool needUpdateWellTargets() const { - return well_collection_->needUpdateWellTargets(); - } - - void setJustUpdateWellTargets(const bool flag) const { - well_collection_->setJustUpdateWellTargets(flag); - } + WellCollection* wellCollection() const; protected: bool wells_active_; const Wells* wells_; const WellOps wops_; - // TODO: It will probably need to be updated during running time. + // It will probably need to be updated during running time. WellCollection* well_collection_; const BlackoilPropsAdInterface* fluid_; diff --git a/opm/autodiff/StandardWellsSolvent.hpp b/opm/autodiff/StandardWellsSolvent.hpp index cf8a1eeab..40cf18270 100644 --- a/opm/autodiff/StandardWellsSolvent.hpp +++ b/opm/autodiff/StandardWellsSolvent.hpp @@ -37,7 +37,7 @@ namespace Opm { using Base::computeWellConnectionDensitesPressures; // --------- Public methods --------- - StandardWellsSolvent(const Wells* wells_arg); + StandardWellsSolvent(const Wells* wells_arg, WellCollection* well_collection); // added the Solvent related void initSolvent(const SolventPropsAdFromDeck* solvent_props, diff --git a/opm/autodiff/StandardWellsSolvent_impl.hpp b/opm/autodiff/StandardWellsSolvent_impl.hpp index c5fee1583..855ce5aea 100644 --- a/opm/autodiff/StandardWellsSolvent_impl.hpp +++ b/opm/autodiff/StandardWellsSolvent_impl.hpp @@ -32,8 +32,8 @@ namespace Opm - StandardWellsSolvent::StandardWellsSolvent(const Wells* wells_arg) - : Base(wells_arg) + StandardWellsSolvent::StandardWellsSolvent(const Wells* wells_arg, WellCollection* well_collection) + : Base(wells_arg, well_collection) , solvent_props_(nullptr) , solvent_pos_(-1) , has_solvent_(false) diff --git a/opm/autodiff/StandardWells_impl.hpp b/opm/autodiff/StandardWells_impl.hpp index a3974171a..6525cbe2f 100644 --- a/opm/autodiff/StandardWells_impl.hpp +++ b/opm/autodiff/StandardWells_impl.hpp @@ -1602,4 +1602,12 @@ namespace Opm } + + + + WellCollection* StandardWells::wellCollection() const { + return well_collection_; + } + + } // namespace Opm diff --git a/tests/test_multisegmentwells.cpp b/tests/test_multisegmentwells.cpp index 6e1fe9947..9d49c5609 100644 --- a/tests/test_multisegmentwells.cpp +++ b/tests/test_multisegmentwells.cpp @@ -119,7 +119,7 @@ struct SetupMSW { const Wells* wells = wells_manager.c_wells(); const auto wells_ecl = ecl_state.getSchedule().getWells(current_timestep); - ms_wells.reset(new Opm::MultisegmentWells(wells, wells_ecl, current_timestep)); + ms_wells.reset(new Opm::MultisegmentWells(wells, &(wells_manager.wellCollection()), wells_ecl, current_timestep)); }; std::shared_ptr ms_wells;