diff --git a/opm/core/wells/WellCollection.cpp b/opm/core/wells/WellCollection.cpp index a8675f75..d94aa947 100644 --- a/opm/core/wells/WellCollection.cpp +++ b/opm/core/wells/WellCollection.cpp @@ -204,7 +204,7 @@ namespace Opm } - //TODO: later, it should be extended to update group targets + // TODO: later, it should be extended to update group targets bool WellCollection::needUpdateWellTargets() const { return needUpdateInjectionTargets() || needUpdateProductionTargets(); @@ -213,6 +213,9 @@ namespace Opm bool WellCollection::needUpdateInjectionTargets() const { + // TODO: it should based on individual group + // With current approach, it will potentially result in more update, + // thus more iterations, while it will not cause result wrong. bool any_group_control_node = false; bool any_should_update_node = false; @@ -233,6 +236,9 @@ namespace Opm bool WellCollection::needUpdateProductionTargets() const { + // TODO: it should based on individual group + // With current approach, it will potentially result in more update, + // thus more iterations, while it will not cause result wrong. bool any_group_control_node = false; bool any_should_update_node = false; diff --git a/opm/core/wells/WellCollection.hpp b/opm/core/wells/WellCollection.hpp index 3c8b5f73..b98d992f 100644 --- a/opm/core/wells/WellCollection.hpp +++ b/opm/core/wells/WellCollection.hpp @@ -111,33 +111,42 @@ namespace Opm const std::vector& well_surfacerates_phase); - // TODO: should have tried to use the above applyExplicitReinjectionControls - // For prototyping, make a new function here at the moment. + /// applying VREP group control based on calculated voidage rates void applyVREPGroupControls(const std::vector& well_voidage_rates, const std::vector& conversion_coeffs); - /// Checking whehter need to update the targets of the wells / or the groups later + /// Checking whether need to update the targets of the wells / or the groups later /// True need to update well targets within this iteration, no switching control within this iteration. /// False no need to update well targets within this iteration, continuing as usual. - /// TODO: currently return true whenever a wellNode needs to be updated. Later some more sophiscated - /// strategy might be required. bool needUpdateWellTargets() const; + /// Checking whether need to update the targets for the injection wells. bool needUpdateInjectionTargets() const; + + /// Checking whehter need to update the targets for the production wells. bool needUpdateProductionTargets() const; + /// Number of the well nodes. size_t numNode() const; + /// Getting the ith well node. WellNode* getNode(size_t i) const; + /// Updating the well targets based on the well rates. void updateWellTargets(const std::vector well_rates); + /// True right after updating the well targets due to wells switching between individual control and group control. + /// It is used to force the simulation continue for another iteration in case that update the well targets are updated, + /// at the same time, the simulation is ended because of achieving the convergence with previous well targets. bool justUpdateWellTargets() const; + /// Setting the value for just_update_well_targets_ void setJustUpdateWellTargets(const bool flag); + /// When we have VREP group, we need to update the targets based on the updated production voidage rates for each iteration. bool havingVREPGroups() const; + /// Setting the VREP group flag when creating the well collection. void setHavingVREPGroups(const bool vrep); private: diff --git a/opm/core/wells/WellsGroup.cpp b/opm/core/wells/WellsGroup.cpp index 4975a05f..6562c4da 100644 --- a/opm/core/wells/WellsGroup.cpp +++ b/opm/core/wells/WellsGroup.cpp @@ -538,23 +538,14 @@ namespace Opm InjectionSpecification::InjectorType inj_type = injSpec().injector_type_; switch (inj_mode) { case InjectionSpecification::RATE: - // need to be careful in the future. - // pay attention to the phase under control and the phase for the guide rate - // they can be different, and more delicate situatioin can happen here. case InjectionSpecification::RESV: { - // very hacky way here. - // The logic of the code is that only a well is specified under GRUP control, it is under group control. - // Which is not the case observed from the result. - // From the result, if we specify group control with GCONPROD and WCONPROD for a well, it looks like - // the well will be under group control. - // TODO: make the logic correct here instead of using `false here`. + // all the wells will be assinged a group control target. + // TODO: when we consider WGRUPCON and well groups not responding to higher level group control const double my_guide_rate = injectionGuideRate(false); for (size_t i = 0; i < children_.size(); ++i) { - // Apply for all children. - // Note, we do _not_ want to call the applyProdGroupControl in this object, - // as that would check if we're under group control, something we're not. + // Apply group control to all children. const double children_guide_rate = children_[i]->injectionGuideRate(false); children_[i]->applyInjGroupControl(inj_mode, inj_type, (children_guide_rate / my_guide_rate) * getTarget(inj_mode) / efficiencyFactor(), @@ -563,18 +554,6 @@ namespace Opm return; } case InjectionSpecification::VREP: - { - // really not sure whether to give a initialized target will be a good idea. It can cause the initial guess too far - // from the reasonable result and numerical convergence failure. - // Let us try to see what will happen. We begin with 100 / day, which is about 0.001. - // const double my_guide_rate = injectionGuideRate(false); - - /* for (size_t i = 0; i < children_.size(); ++i) { - const double children_guide_rate = children_[i] -> injectionGuideRate(false); - children_[i]->applyInjGroupControl(, inj_type, - (children_guide_rate / my_guide_rate) * target / efficiencyFactor(), true); - } */ - } case InjectionSpecification::REIN: std::cout << "Replacement keywords found, remember to call applyExplicitReinjectionControls." << std::endl; return;