keeping adding group control related in.
This commit is contained in:
parent
f628064884
commit
0d5a86cc71
@ -46,4 +46,3 @@ namespace Opm
|
||||
}
|
||||
|
||||
#endif /* OPM_PRODUCTIONSPECIFICATION_HPP */
|
||||
|
||||
|
@ -310,7 +310,10 @@ namespace Opm
|
||||
{
|
||||
if (forced || (prodSpec().control_mode_ == ProductionSpecification::FLD
|
||||
|| prodSpec().control_mode_ == ProductionSpecification::NONE)) {
|
||||
const double my_guide_rate = productionGuideRate(!forced);
|
||||
const double my_guide_rate = productionGuideRate(false);
|
||||
std::cout << " forced " << forced << std::endl;
|
||||
std::cout << " name " << name () << std::endl;
|
||||
std::cout << " my_guide_rate is " << my_guide_rate << std::endl;
|
||||
if (my_guide_rate == 0.0) {
|
||||
// Nothing to do here
|
||||
std::cout << "returning" << std::endl;
|
||||
@ -470,7 +473,9 @@ namespace Opm
|
||||
case ProductionSpecification::LRAT:
|
||||
case ProductionSpecification::RESV:
|
||||
{
|
||||
const double my_guide_rate = productionGuideRate(true);
|
||||
// const double my_guide_rate = productionGuideRate(true);
|
||||
const double my_guide_rate = productionGuideRate(false);
|
||||
std::cout << "my_guide_rate of group " << name() << " is " << my_guide_rate << std::endl;
|
||||
if (my_guide_rate == 0) {
|
||||
OPM_THROW(std::runtime_error, "Can't apply group control for group " << name() << " as the sum of guide rates for all group controlled wells is zero.");
|
||||
}
|
||||
@ -549,8 +554,14 @@ namespace Opm
|
||||
{
|
||||
double sum = 0.0;
|
||||
for (size_t i = 0; i < children_.size(); ++i) {
|
||||
if (only_group) {
|
||||
if (!children_[i]->individualControl()) {
|
||||
sum += children_[i]->productionGuideRate(only_group);
|
||||
}
|
||||
} else {
|
||||
sum += children_[i]->productionGuideRate(only_group);
|
||||
}
|
||||
}
|
||||
return sum;
|
||||
}
|
||||
|
||||
@ -1013,6 +1024,7 @@ namespace Opm
|
||||
// 2. the well violating some limits and working under limits. We do not have strategy
|
||||
// to handle this situation yet.
|
||||
// if (!only_group || prodSpec().control_mode_ == ProductionSpecification::GRUP) {
|
||||
std::cout << "guide_rate for well " << name() << " is " << prodSpec().guide_rate_ << std::endl;
|
||||
return prodSpec().guide_rate_;
|
||||
// }
|
||||
// return 0.0;
|
||||
|
@ -19,6 +19,7 @@
|
||||
*/
|
||||
|
||||
#include <opm/core/wells/WellsGroup.hpp>
|
||||
#include <iostream>
|
||||
|
||||
|
||||
namespace Opm
|
||||
@ -35,6 +36,57 @@ namespace Opm
|
||||
|
||||
// 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_;
|
||||
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") {
|
||||
auto* parent_node = getParent();
|
||||
control_mode = parent_node->prodSpec().control_mode_;
|
||||
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;
|
||||
|
||||
for (size_t i = 0; i < children_.size(); ++i) {
|
||||
if (children_[i]->individualControl()) {
|
||||
// get the rate here.
|
||||
const std::string well_name = children_[i]->name();
|
||||
std::cout << "well_name " << well_name;
|
||||
typedef typename WellState::WellMapType::const_iterator const_iterator;
|
||||
const_iterator it = well_state.wellMap().find(well_name);
|
||||
const int well_index = (*it).second[0];
|
||||
const int np = well_state.numPhases();
|
||||
|
||||
const double oil_rate = well_state.wellRates()[np * well_index + 1];
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
const double rate_for_group_control = target_rate - rate_individual_control;
|
||||
|
||||
const double my_guide_rate = productionGuideRate(true);
|
||||
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) {
|
||||
const double children_guide_rate = children_[i]->productionGuideRate(true);
|
||||
children_[i]->applyProdGroupControl(control_mode, (children_guide_rate/my_guide_rate) * rate_for_group_control, false);
|
||||
children_[i]->setShouldUpdateWellTargets(false);
|
||||
}
|
||||
std::cin.ignore();
|
||||
// liquid_max_rate
|
||||
|
||||
// update the injectioin control
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user