mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
keeping putting group controlling in.
This commit is contained in:
parent
4d57b641a8
commit
26cc5de202
@ -189,4 +189,30 @@ namespace Opm
|
|||||||
roots_[i]->applyExplicitReinjectionControls(well_reservoirrates_phase, well_surfacerates_phase);
|
roots_[i]->applyExplicitReinjectionControls(well_reservoirrates_phase, well_surfacerates_phase);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//TODO: later, it should be extended to update group targets
|
||||||
|
bool WellCollection::needUpdateWellTargets() const
|
||||||
|
{
|
||||||
|
for (size_t i = 0; i < leaf_nodes_.size(); ++i) {
|
||||||
|
if (leaf_nodes_[i]->shouldUpdateWellTargets() && !leaf_nodes_[i]->individualControl()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const size_t WellCollection::numNode() const
|
||||||
|
{
|
||||||
|
return leaf_nodes_.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
WellNode* WellCollection::getNode(size_t i) const
|
||||||
|
{
|
||||||
|
assert( i< numNode());
|
||||||
|
return leaf_nodes_[i];
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -110,6 +110,20 @@ namespace Opm
|
|||||||
void applyExplicitReinjectionControls(const std::vector<double>& well_reservoirrates_phase,
|
void applyExplicitReinjectionControls(const std::vector<double>& well_reservoirrates_phase,
|
||||||
const std::vector<double>& well_surfacerates_phase);
|
const std::vector<double>& well_surfacerates_phase);
|
||||||
|
|
||||||
|
/// Checking whehter 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;
|
||||||
|
|
||||||
|
const size_t numNode() const;
|
||||||
|
|
||||||
|
WellNode* getNode(size_t i) const;
|
||||||
|
|
||||||
|
template <class WellState>
|
||||||
|
void updateWellTargets(const WellState& well_state);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// To account for the possibility of a forest
|
// To account for the possibility of a forest
|
||||||
std::vector<std::shared_ptr<WellsGroupInterface> > roots_;
|
std::vector<std::shared_ptr<WellsGroupInterface> > roots_;
|
||||||
@ -121,5 +135,7 @@ namespace Opm
|
|||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Opm
|
} // namespace Opm
|
||||||
|
|
||||||
|
#include "WellCollection_impl.hpp"
|
||||||
#endif /* OPM_WELLCOLLECTION_HPP */
|
#endif /* OPM_WELLCOLLECTION_HPP */
|
||||||
|
|
||||||
|
@ -68,7 +68,9 @@ namespace Opm
|
|||||||
name_(myname),
|
name_(myname),
|
||||||
production_specification_(prod_spec),
|
production_specification_(prod_spec),
|
||||||
injection_specification_(inje_spec),
|
injection_specification_(inje_spec),
|
||||||
phase_usage_(phase_usage)
|
phase_usage_(phase_usage),
|
||||||
|
individual_control_(true), // always begin with individual control
|
||||||
|
should_update_well_targets_(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -80,6 +82,12 @@ namespace Opm
|
|||||||
{
|
{
|
||||||
return parent_;
|
return parent_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WellsGroupInterface* WellsGroupInterface::getParent()
|
||||||
|
{
|
||||||
|
return parent_;
|
||||||
|
}
|
||||||
|
|
||||||
const std::string& WellsGroupInterface::name() const
|
const std::string& WellsGroupInterface::name() const
|
||||||
{
|
{
|
||||||
return name_;
|
return name_;
|
||||||
@ -229,8 +237,15 @@ namespace Opm
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool WellsGroupInterface::shouldUpdateWellTargets() const {
|
||||||
|
return should_update_well_targets_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool WellsGroupInterface::setShouldUpdateWellTargets(const bool should_update_well_targets) {
|
||||||
|
should_update_well_targets_ = should_update_well_targets;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ============== WellsGroup members =============
|
// ============== WellsGroup members =============
|
||||||
|
|
||||||
@ -638,6 +653,16 @@ namespace Opm
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool WellsGroupInterface::individualControl() const {
|
||||||
|
return individual_control_;
|
||||||
|
}
|
||||||
|
|
||||||
|
void WellsGroupInterface::setIndividualControl(const bool individual_control) {
|
||||||
|
individual_control_ = individual_control;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ============== WellNode members ============
|
// ============== WellNode members ============
|
||||||
|
|
||||||
|
|
||||||
@ -851,6 +876,8 @@ namespace Opm
|
|||||||
well_controls_iset_distr(wells_->ctrls[self_index_] , group_control_index_ , distr);
|
well_controls_iset_distr(wells_->ctrls[self_index_] , group_control_index_ , distr);
|
||||||
}
|
}
|
||||||
set_current_control(self_index_, group_control_index_, wells_);
|
set_current_control(self_index_, group_control_index_, wells_);
|
||||||
|
// TODO: it might always be the case
|
||||||
|
setIndividualControl(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1003,6 +1030,14 @@ namespace Opm
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/// Returning the group control index
|
||||||
|
int WellNode::groupControlIndex() const
|
||||||
|
{
|
||||||
|
return group_control_index_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -92,6 +92,8 @@ namespace Opm
|
|||||||
/// Gets the parent of the group, NULL if no parent.
|
/// Gets the parent of the group, NULL if no parent.
|
||||||
const WellsGroupInterface* getParent() const;
|
const WellsGroupInterface* getParent() const;
|
||||||
|
|
||||||
|
WellsGroupInterface* getParent();
|
||||||
|
|
||||||
/// Calculates the number of leaf nodes in the given group.
|
/// Calculates the number of leaf nodes in the given group.
|
||||||
/// A leaf node is defined to have one leaf node in its group.
|
/// A leaf node is defined to have one leaf node in its group.
|
||||||
virtual int numberOfLeafNodes() = 0;
|
virtual int numberOfLeafNodes() = 0;
|
||||||
@ -202,6 +204,18 @@ namespace Opm
|
|||||||
virtual void applyExplicitReinjectionControls(const std::vector<double>& well_reservoirrates_phase,
|
virtual void applyExplicitReinjectionControls(const std::vector<double>& well_reservoirrates_phase,
|
||||||
const std::vector<double>& well_surfacerates_phase) = 0;
|
const std::vector<double>& well_surfacerates_phase) = 0;
|
||||||
|
|
||||||
|
/// Return whether the well is running under group control target
|
||||||
|
/// or under their own limit.
|
||||||
|
/// True under their own limit.
|
||||||
|
/// False running under group control target
|
||||||
|
bool individualControl() const;
|
||||||
|
|
||||||
|
/// Update the status for individual contrl
|
||||||
|
void setIndividualControl(const bool);
|
||||||
|
|
||||||
|
virtual bool shouldUpdateWellTargets() const;
|
||||||
|
|
||||||
|
virtual bool setShouldUpdateWellTargets(const bool);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/// Calculates the correct rate for the given ProductionSpecification::ControlMode
|
/// Calculates the correct rate for the given ProductionSpecification::ControlMode
|
||||||
@ -221,6 +235,13 @@ namespace Opm
|
|||||||
ProductionSpecification production_specification_;
|
ProductionSpecification production_specification_;
|
||||||
InjectionSpecification injection_specification_;
|
InjectionSpecification injection_specification_;
|
||||||
PhaseUsage phase_usage_;
|
PhaseUsage phase_usage_;
|
||||||
|
// when some well (mabye group also later), change status from group control
|
||||||
|
// to individual control, or the other way, the targets for the wells in the group need to be redistributed.
|
||||||
|
bool should_update_well_targets_;
|
||||||
|
// Whether well is running under the group control target.
|
||||||
|
// Current only consider one level of control.
|
||||||
|
// So not putting it in the WellsGroupInterface yet.
|
||||||
|
bool individual_control_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -303,6 +324,9 @@ namespace Opm
|
|||||||
virtual void applyExplicitReinjectionControls(const std::vector<double>& well_reservoirrates_phase,
|
virtual void applyExplicitReinjectionControls(const std::vector<double>& well_reservoirrates_phase,
|
||||||
const std::vector<double>& well_surfacerates_phase);
|
const std::vector<double>& well_surfacerates_phase);
|
||||||
|
|
||||||
|
template <class WellState>
|
||||||
|
void updateWellTargets(const WellState& well_state);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<std::shared_ptr<WellsGroupInterface> > children_;
|
std::vector<std::shared_ptr<WellsGroupInterface> > children_;
|
||||||
};
|
};
|
||||||
@ -394,6 +418,7 @@ namespace Opm
|
|||||||
/// with all phase rates of a single well adjacent in the array.
|
/// with all phase rates of a single well adjacent in the array.
|
||||||
virtual void applyExplicitReinjectionControls(const std::vector<double>& well_reservoirrates_phase,
|
virtual void applyExplicitReinjectionControls(const std::vector<double>& well_reservoirrates_phase,
|
||||||
const std::vector<double>& well_surfacerates_phase);
|
const std::vector<double>& well_surfacerates_phase);
|
||||||
|
int groupControlIndex() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Wells* wells_;
|
Wells* wells_;
|
||||||
@ -416,5 +441,7 @@ namespace Opm
|
|||||||
std::shared_ptr<WellsGroupInterface> createGroupWellsGroup(const Group& group, size_t timeStep,
|
std::shared_ptr<WellsGroupInterface> createGroupWellsGroup(const Group& group, size_t timeStep,
|
||||||
const PhaseUsage& phase_usage );
|
const PhaseUsage& phase_usage );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#include "WellsGroup_impl.hpp"
|
||||||
#endif /* OPM_WELLSGROUP_HPP */
|
#endif /* OPM_WELLSGROUP_HPP */
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user