mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-01-11 00:41:56 -06:00
removing the use of cast between base class and derived class
between WellsGroupInterface and WellsGroup, WellNode.
This commit is contained in:
parent
631ea6cf82
commit
9bfe9d561a
@ -271,8 +271,7 @@ namespace Opm
|
||||
// find a node needs to update targets, then update targets for all the wellls inside the group.
|
||||
// if (leaf_nodes_[i]->shouldUpdateWellTargets() && !leaf_nodes_[i]->individualControl()) {
|
||||
if (!leaf_nodes_[i]->individualControl()) {
|
||||
// TODO: will remove dynamic_cast with interface revision.
|
||||
WellsGroup* parent_node = dynamic_cast<Opm::WellsGroup *>(leaf_nodes_[i]->getParent());
|
||||
WellsGroupInterface* parent_node = leaf_nodes_[i]->getParent();
|
||||
// update the target within this group.
|
||||
if (leaf_nodes_[i]->isProducer()) {
|
||||
parent_node->updateWellProductionTargets(well_rates);
|
||||
|
@ -246,6 +246,15 @@ namespace Opm
|
||||
should_update_well_targets_ = should_update_well_targets;
|
||||
}
|
||||
|
||||
bool WellsGroupInterface::individualControl() const {
|
||||
return individual_control_;
|
||||
}
|
||||
|
||||
void WellsGroupInterface::setIndividualControl(const bool individual_control) {
|
||||
individual_control_ = individual_control;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// ============== WellsGroup members =============
|
||||
|
||||
@ -687,9 +696,8 @@ namespace Opm
|
||||
double rate_individual_control = 0.;
|
||||
|
||||
for (size_t i = 0; i < children_.size(); ++i) {
|
||||
const std::shared_ptr<Opm::WellNode> well_node = std::dynamic_pointer_cast<Opm::WellNode>(children_[i]);
|
||||
if (well_node->individualControl() && well_node->isProducer()) {
|
||||
rate_individual_control += std::abs(well_node->getLiquidProductionRate(well_rates));
|
||||
if (children_[i]->individualControl() && children_[i]->isProducer()) {
|
||||
rate_individual_control += std::abs(children_[i]->getLiquidProductionRate(well_rates));
|
||||
}
|
||||
}
|
||||
|
||||
@ -698,11 +706,10 @@ namespace Opm
|
||||
const double my_guide_rate = productionGuideRate(true);
|
||||
|
||||
for (size_t i = 0; i < children_.size(); ++i) {
|
||||
const std::shared_ptr<Opm::WellNode> well_node = std::dynamic_pointer_cast<Opm::WellNode>(children_[i]);
|
||||
if (!well_node->individualControl() && well_node->isProducer()) {
|
||||
const double children_guide_rate = well_node->productionGuideRate(true);
|
||||
well_node->applyProdGroupControl(control_mode, (children_guide_rate/my_guide_rate) * rate_for_group_control, true);
|
||||
well_node->setShouldUpdateWellTargets(false);
|
||||
if (!children_[i]->individualControl() && children_[i]->isProducer()) {
|
||||
const double children_guide_rate = children_[i]->productionGuideRate(true);
|
||||
children_[i]->applyProdGroupControl(control_mode, (children_guide_rate/my_guide_rate) * rate_for_group_control, true);
|
||||
children_[i]->setShouldUpdateWellTargets(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -712,19 +719,31 @@ namespace Opm
|
||||
// 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()) {
|
||||
if (!children_[i]->individualControl() && children_[i]->isInjector()) {
|
||||
children_[i]->setShouldUpdateWellTargets(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool WellsGroupInterface::individualControl() const {
|
||||
return individual_control_;
|
||||
bool WellsGroup::isProducer() const
|
||||
{
|
||||
}
|
||||
|
||||
void WellsGroupInterface::setIndividualControl(const bool individual_control) {
|
||||
individual_control_ = individual_control;
|
||||
bool WellsGroup::isInjector() const
|
||||
{
|
||||
}
|
||||
|
||||
double WellsGroup::getLiquidProductionRate(const std::vector<double>& /*well_rates*/) const
|
||||
{
|
||||
}
|
||||
|
||||
double WellsGroup::getOilProductionRate(const std::vector<double>& /*well_rates*/) const
|
||||
{
|
||||
}
|
||||
|
||||
double WellsGroup::getWaterProductionRate(const std::vector<double>& /*well_rates*/) const
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@ -1136,6 +1155,13 @@ namespace Opm
|
||||
return getTotalProductionFlow(well_rates, BlackoilPhases::Aqua);
|
||||
}
|
||||
|
||||
void WellNode::updateWellProductionTargets(const std::vector<double>& /*well_rates*/)
|
||||
{
|
||||
}
|
||||
|
||||
void WellNode::updateWellInjectionTargets(const std::vector<double>& /*well_rates*/)
|
||||
{
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
|
@ -217,6 +217,25 @@ namespace Opm
|
||||
|
||||
virtual bool setShouldUpdateWellTargets(const bool);
|
||||
|
||||
/// Whether it is a production well
|
||||
/// Should only appy for WellNode
|
||||
virtual bool isProducer() const = 0;
|
||||
|
||||
/// Whether it is an injection well
|
||||
/// Should only appy for WellNode
|
||||
virtual bool isInjector() const = 0;
|
||||
|
||||
virtual double getLiquidProductionRate(const std::vector<double>& well_rates) const = 0;
|
||||
|
||||
virtual double getOilProductionRate(const std::vector<double>& well_rates) const = 0;
|
||||
|
||||
virtual double getWaterProductionRate(const std::vector<double>& well_rates) const = 0;
|
||||
|
||||
virtual void updateWellProductionTargets(const std::vector<double>& well_rates) = 0;
|
||||
|
||||
virtual void updateWellInjectionTargets(const std::vector<double>& well_rates) = 0;
|
||||
|
||||
|
||||
protected:
|
||||
/// Calculates the correct rate for the given ProductionSpecification::ControlMode
|
||||
double rateByMode(const double* res_rates,
|
||||
@ -325,9 +344,23 @@ namespace Opm
|
||||
virtual void applyExplicitReinjectionControls(const std::vector<double>& well_reservoirrates_phase,
|
||||
const std::vector<double>& well_surfacerates_phase);
|
||||
|
||||
void updateWellProductionTargets(const std::vector<double>& well_rates);
|
||||
virtual void updateWellProductionTargets(const std::vector<double>& well_rates);
|
||||
|
||||
void updateWellInjectionTargets(const std::vector<double>& well_rates);
|
||||
virtual void updateWellInjectionTargets(const std::vector<double>& well_rates);
|
||||
|
||||
/// Whether it is a production well
|
||||
/// Should only appy for WellNode
|
||||
virtual bool isProducer() const;
|
||||
|
||||
/// Whether it is an injection well
|
||||
/// Should only appy for WellNode
|
||||
virtual bool isInjector() const;
|
||||
|
||||
virtual double getLiquidProductionRate(const std::vector<double>& well_rates) const;
|
||||
|
||||
virtual double getOilProductionRate(const std::vector<double>& well_rates) const;
|
||||
|
||||
virtual double getWaterProductionRate(const std::vector<double>& well_rates) const;
|
||||
|
||||
private:
|
||||
std::vector<std::shared_ptr<WellsGroupInterface> > children_;
|
||||
@ -422,15 +455,20 @@ namespace Opm
|
||||
const std::vector<double>& well_surfacerates_phase);
|
||||
int groupControlIndex() const;
|
||||
|
||||
bool isProducer() const;
|
||||
virtual bool isProducer() const;
|
||||
|
||||
bool isInjector() const;
|
||||
virtual bool isInjector() const;
|
||||
|
||||
double getLiquidProductionRate(const std::vector<double>& well_rates) const;
|
||||
virtual double getLiquidProductionRate(const std::vector<double>& well_rates) const;
|
||||
|
||||
double getOilProductionRate(const std::vector<double>& well_rates) const;
|
||||
virtual double getOilProductionRate(const std::vector<double>& well_rates) const;
|
||||
|
||||
virtual double getWaterProductionRate(const std::vector<double>& well_rates) const;
|
||||
|
||||
virtual void updateWellProductionTargets(const std::vector<double>& well_rates);
|
||||
|
||||
virtual void updateWellInjectionTargets(const std::vector<double>& well_rates);
|
||||
|
||||
double getWaterProductionRate(const std::vector<double>& well_rates) const;
|
||||
|
||||
private:
|
||||
Wells* wells_;
|
||||
|
Loading…
Reference in New Issue
Block a user