Passed around a WellControlResult argument to the different wellcontrol functions

This commit is contained in:
Kjetil Olsen Lye
2012-04-17 16:36:49 +02:00
parent 5d39e3c0ef
commit 069ad5a611
4 changed files with 35 additions and 10 deletions

View File

@@ -89,9 +89,10 @@ namespace Opm
} }
bool WellCollection::conditionsMet(const std::vector<double>& well_bhp, const std::vector<double>& well_rate, bool WellCollection::conditionsMet(const std::vector<double>& well_bhp, const std::vector<double>& well_rate,
const UnstructuredGrid& grid, const std::vector<double>& saturations, double epsilon) const { const UnstructuredGrid& grid, const std::vector<double>& saturations,
WellControlResult& result, double epsilon) const {
for(size_t i = 0; i < leaf_nodes_.size(); i++) { for(size_t i = 0; i < leaf_nodes_.size(); i++) {
if(! static_cast<WellNode*>(leaf_nodes_[i].get())->conditionsMet(well_bhp, well_rate, grid, saturations, epsilon) ) { if(! static_cast<WellNode*>(leaf_nodes_[i].get())->conditionsMet(well_bhp, well_rate, grid, saturations, result, epsilon) ) {
return false; return false;
} }
} }

View File

@@ -41,7 +41,9 @@ namespace Opm
bool conditionsMet(const std::vector<double>& well_bhp, const std::vector<double>& well_rate, bool conditionsMet(const std::vector<double>& well_bhp, const std::vector<double>& well_rate,
const UnstructuredGrid& grid, const std::vector<double>& saturations, double epsilon=1e-8) const; const UnstructuredGrid& grid, const std::vector<double>& saturations,
WellControlResult& result,
double epsilon=1e-8) const;
const std::vector<std::tr1::shared_ptr<WellsGroupInterface> >& getLeafNodes() const; const std::vector<std::tr1::shared_ptr<WellsGroupInterface> >& getLeafNodes() const;

View File

@@ -118,12 +118,13 @@ namespace Opm
bool WellsGroup::conditionsMet(const std::vector<double>& well_bhp, const std::vector<double>& well_rate, bool WellsGroup::conditionsMet(const std::vector<double>& well_bhp, const std::vector<double>& well_rate,
const UnstructuredGrid& grid, const std::vector<double>& saturations, const UnstructuredGrid& grid, const std::vector<double>& saturations,
const struct Wells* wells, int index_of_well, double epsilon) const struct Wells* wells, int index_of_well, WellControlResult& result,
double epsilon)
{ {
if (parent_ != NULL) { if (parent_ != NULL) {
bool parent_ok = bool parent_ok =
(static_cast<WellsGroup*> (parent_))->conditionsMet(well_bhp, (static_cast<WellsGroup*> (parent_))->conditionsMet(well_bhp,
well_rate,grid, saturations, wells, index_of_well, epsilon); well_rate,grid, saturations, wells, index_of_well, result, epsilon);
if (!parent_ok) { if (!parent_ok) {
return false; return false;
} }
@@ -207,11 +208,19 @@ namespace Opm
} }
bool WellNode::conditionsMet(const std::vector<double>& well_bhp, const std::vector<double>& well_rate, bool WellNode::conditionsMet(const std::vector<double>& well_bhp, const std::vector<double>& well_rate,
const UnstructuredGrid& grid, const std::vector<double>& saturations, double epsilon) const UnstructuredGrid& grid, const std::vector<double>& saturations,
WellControlResult& result, double epsilon)
{ {
if (parent_ != NULL) { if (parent_ != NULL) {
bool parent_ok = (static_cast<WellsGroup*> (parent_))->conditionsMet(well_bhp, well_rate, grid, saturations, wells_, self_index_, epsilon); bool parent_ok = (static_cast<WellsGroup*> (parent_))->conditionsMet(well_bhp,
well_rate,
grid,
saturations,
wells_,
self_index_,
result,
epsilon);
if (!parent_ok) { if (!parent_ok) {
return false; return false;
} }

View File

@@ -11,6 +11,18 @@
namespace Opm namespace Opm
{ {
struct ExceedInformation {
std::string group_name_;
int well_index_;
double surplus_;
};
struct WellControlResult {
std::vector<ExceedInformation> oil_rate_;
std::vector<ExceedInformation> fluid_rate_;
std::vector<ExceedInformation> bhp_;
};
class WellsGroupInterface class WellsGroupInterface
{ {
public: public:
@@ -76,7 +88,7 @@ namespace Opm
bool conditionsMet(const std::vector<double>& well_bhp, const std::vector<double>& well_rate, bool conditionsMet(const std::vector<double>& well_bhp, const std::vector<double>& well_rate,
const UnstructuredGrid& grid, const std::vector<double>& saturations, const struct Wells* wells, const UnstructuredGrid& grid, const std::vector<double>& saturations, const struct Wells* wells,
int index_of_well, double epsilon = 1e-8); int index_of_well, WellControlResult& result, double epsilon = 1e-8);
virtual void calculateGuideRates(); virtual void calculateGuideRates();
@@ -97,7 +109,8 @@ namespace Opm
virtual WellsGroupInterface* findGroup(std::string name_of_node); virtual WellsGroupInterface* findGroup(std::string name_of_node);
virtual bool conditionsMet(const std::vector<double>& well_bhp, const std::vector<double>& well_rate, virtual bool conditionsMet(const std::vector<double>& well_bhp, const std::vector<double>& well_rate,
const UnstructuredGrid& grid, const std::vector<double>& saturations, double epsilon=1e-8); const UnstructuredGrid& grid, const std::vector<double>& saturations,
WellControlResult& result, double epsilon=1e-8);
virtual bool isLeafNode() const; virtual bool isLeafNode() const;
void setWellsPointer(const struct Wells* wells, int self_index); void setWellsPointer(const struct Wells* wells, int self_index);