adding updateWellInjectionTargets updateWellProductionTargets

For WellsGroup. At least for the current moment, the updation of the
well targets for injectors and producers should be handled in a
seprate way.
This commit is contained in:
Kai Bao 2016-10-07 16:18:09 +02:00
parent 46a9a62741
commit 7295f26f54
4 changed files with 32 additions and 29 deletions

View File

@ -209,7 +209,7 @@ namespace Opm
any_should_update_node = true; any_should_update_node = true;
} }
if (leaf_nodes_[i]->individualControl()) { if (!leaf_nodes_[i]->individualControl()) {
any_group_control_node = true; any_group_control_node = true;
} }
} }
@ -228,7 +228,7 @@ namespace Opm
any_should_update_node = true; any_should_update_node = true;
} }
if (leaf_nodes_[i]->individualControl()) { if (!leaf_nodes_[i]->individualControl()) {
any_group_control_node = true; any_group_control_node = true;
} }
} }

View File

@ -38,7 +38,13 @@ namespace Opm
// TODO: will remove dynamic_cast with interface revision. // TODO: will remove dynamic_cast with interface revision.
WellsGroup* parent_node = dynamic_cast<Opm::WellsGroup *>(leaf_nodes_[i]->getParent()); WellsGroup* parent_node = dynamic_cast<Opm::WellsGroup *>(leaf_nodes_[i]->getParent());
// update the target within this group. // update the target within this group.
parent_node->updateWellTargets(well_state); if (leaf_nodes_[i]->isProducer()) {
parent_node->updateWellProductionTargets(well_state);
}
if (leaf_nodes_[i]->isInjector()) {
parent_node->updateWellInjectionTargets(well_state);
}
} }
} }

View File

@ -325,7 +325,10 @@ namespace Opm
const std::vector<double>& well_surfacerates_phase); const std::vector<double>& well_surfacerates_phase);
template <class WellState> template <class WellState>
void updateWellTargets(const WellState& well_state); void updateWellProductionTargets(const WellState& well_state);
template <class WellState>
void updateWellInjectionTargets(const WellState& well_state);
private: private:
std::vector<std::shared_ptr<WellsGroupInterface> > children_; std::vector<std::shared_ptr<WellsGroupInterface> > children_;

View File

@ -27,38 +27,28 @@ namespace Opm
template <class WellState> template <class WellState>
void WellsGroup::updateWellTargets(const WellState& well_state) void WellsGroup::updateWellProductionTargets(const WellState& well_state)
{ {
// TODO: currently, we only handle the level of the well groups for the moment, i.e. the level just above wells // TODO: currently, we only handle the level of the well groups for the moment, i.e. the level just above wells
// We believe the relations between groups are similar to the relations between different wells inside the same group. // We believe the relations between groups are similar to the relations between different wells inside the same group.
// While there will be somre more complication invloved for sure. // While there will be somre more complication invloved for sure.
// Basically, we need to update the target rates for the wells still under group control. // Basically, we need to update the target rates for the wells still under group control.
// What facility need to be put in?
// update the production control
// What we need there? 1. The target. 2. The control mode. 3. The share produced by the wells under individual control
// 4. The guide rate.
// control mode
ProductionSpecification::ControlMode control_mode = prodSpec().control_mode_; ProductionSpecification::ControlMode control_mode = prodSpec().control_mode_;
double target_rate = prodSpec().liquid_max_rate_; double target_rate = prodSpec().liquid_max_rate_;
std::cout << " control mode is " << ProductionSpecification::toString(control_mode);
std::cout << " rate is " << target_rate << std::endl;
if (ProductionSpecification::toString(control_mode) == "FLD") { if (ProductionSpecification::toString(control_mode) == "FLD") {
auto* parent_node = getParent(); auto* parent_node = getParent();
control_mode = parent_node->prodSpec().control_mode_; control_mode = parent_node->prodSpec().control_mode_;
target_rate = parent_node->prodSpec().liquid_max_rate_; target_rate = parent_node->prodSpec().liquid_max_rate_;
std::cout << " control mode is " << ProductionSpecification::toString(control_mode);
std::cout << " rate is " << target_rate << std::endl;
} }
double rate_individual_control = 0; double rate_individual_control = 0;
for (size_t i = 0; i < children_.size(); ++i) { for (size_t i = 0; i < children_.size(); ++i) {
if (children_[i]->individualControl()) { if (children_[i]->individualControl() && std::dynamic_pointer_cast<Opm::WellNode>(children_[i])->isProducer()) {
// get the rate here. // get the rate here.
const std::string well_name = children_[i]->name(); const std::string well_name = children_[i]->name();
std::cout << "well_name " << well_name;
typedef typename WellState::WellMapType::const_iterator const_iterator; typedef typename WellState::WellMapType::const_iterator const_iterator;
const_iterator it = well_state.wellMap().find(well_name); const_iterator it = well_state.wellMap().find(well_name);
const int well_index = (*it).second[0]; const int well_index = (*it).second[0];
@ -66,36 +56,40 @@ namespace Opm
const double oil_rate = well_state.wellRates()[np * well_index + 1]; const double oil_rate = well_state.wellRates()[np * well_index + 1];
const double water_rate = well_state.wellRates()[np * well_index]; const double water_rate = well_state.wellRates()[np * well_index];
std::cout << " oil_rate is " << oil_rate << " water_rate is " << water_rate << " liquid rate is " << oil_rate + water_rate << std::endl;
rate_individual_control += std::abs(oil_rate + water_rate); rate_individual_control += std::abs(oil_rate + water_rate);
} }
} }
const double rate_for_group_control = target_rate - rate_individual_control; const double rate_for_group_control = target_rate - rate_individual_control;
std::cout << " rate_for_group_control " << rate_for_group_control << std::endl;
const double my_guide_rate = productionGuideRate(true); const double my_guide_rate = productionGuideRate(true);
std::cout << " my_guide_rate is " << my_guide_rate << " when updateWellTargets " << std::endl;
if (my_guide_rate == 0) {
std::cout << " something wrong with the my_guide_rate, need to check, it should have come here " << std::endl;
std::cin.ignore();
}
for (size_t i = 0; i < children_.size(); ++i) { for (size_t i = 0; i < children_.size(); ++i) {
// if (children_[i]->shouldUpdateWellTargets() && !children_[i]->individualControl()) { // if (children_[i]->shouldUpdateWellTargets() && !children_[i]->individualControl()) {
if (!children_[i]->individualControl()) { if (!children_[i]->individualControl() && std::dynamic_pointer_cast<Opm::WellNode>(children_[i])->isProducer()) {
const double children_guide_rate = children_[i]->productionGuideRate(true); const double children_guide_rate = children_[i]->productionGuideRate(true);
std::cout << " well_name " << children_[i]->name() << " children_guide_rate " << children_guide_rate << " my_guide_rate " << my_guide_rate << std::endl;
std::cout << " new target rate is " << (children_guide_rate/my_guide_rate) * rate_for_group_control * 86400/0.1590 << std::endl;
// children_[i]->applyProdGroupControl(control_mode, (children_guide_rate/my_guide_rate) * rate_for_group_control, false); // children_[i]->applyProdGroupControl(control_mode, (children_guide_rate/my_guide_rate) * rate_for_group_control, false);
children_[i]->applyProdGroupControl(control_mode, (children_guide_rate/my_guide_rate) * rate_for_group_control, true); children_[i]->applyProdGroupControl(control_mode, (children_guide_rate/my_guide_rate) * rate_for_group_control, true);
children_[i]->setShouldUpdateWellTargets(false); children_[i]->setShouldUpdateWellTargets(false);
} }
} }
std::cin.ignore(); }
// liquid_max_rate
template <class WellState>
void WellsGroup::updateWellInjectionTargets(const WellState&) {
// NOT doing anything yet.
// Will finish it when having an examples with more than one injection wells within same injection group.
for (size_t i = 0; i < children_.size(); ++i) {
if (!children_[i]->individualControl() && std::dynamic_pointer_cast<Opm::WellNode>(children_[i])->isInjector()) {
children_[i]->setShouldUpdateWellTargets(false);
}
}
// update the injectioin control
} }
} }