From 069ad5a611b7d5f184085bbeff4def0fa2d05e40 Mon Sep 17 00:00:00 2001 From: Kjetil Olsen Lye Date: Tue, 17 Apr 2012 16:36:49 +0200 Subject: [PATCH] Passed around a WellControlResult argument to the different wellcontrol functions --- opm/core/WellCollection.cpp | 5 +++-- opm/core/WellCollection.hpp | 4 +++- opm/core/WellsGroup.cpp | 19 ++++++++++++++----- opm/core/WellsGroup.hpp | 17 +++++++++++++++-- 4 files changed, 35 insertions(+), 10 deletions(-) diff --git a/opm/core/WellCollection.cpp b/opm/core/WellCollection.cpp index f38e05d4a..1ac178ab2 100644 --- a/opm/core/WellCollection.cpp +++ b/opm/core/WellCollection.cpp @@ -89,9 +89,10 @@ namespace Opm } bool WellCollection::conditionsMet(const std::vector& well_bhp, const std::vector& well_rate, - const UnstructuredGrid& grid, const std::vector& saturations, double epsilon) const { + const UnstructuredGrid& grid, const std::vector& saturations, + WellControlResult& result, double epsilon) const { for(size_t i = 0; i < leaf_nodes_.size(); i++) { - if(! static_cast(leaf_nodes_[i].get())->conditionsMet(well_bhp, well_rate, grid, saturations, epsilon) ) { + if(! static_cast(leaf_nodes_[i].get())->conditionsMet(well_bhp, well_rate, grid, saturations, result, epsilon) ) { return false; } } diff --git a/opm/core/WellCollection.hpp b/opm/core/WellCollection.hpp index 92ccccfa2..2d5ffef69 100644 --- a/opm/core/WellCollection.hpp +++ b/opm/core/WellCollection.hpp @@ -41,7 +41,9 @@ namespace Opm bool conditionsMet(const std::vector& well_bhp, const std::vector& well_rate, - const UnstructuredGrid& grid, const std::vector& saturations, double epsilon=1e-8) const; + const UnstructuredGrid& grid, const std::vector& saturations, + WellControlResult& result, + double epsilon=1e-8) const; const std::vector >& getLeafNodes() const; diff --git a/opm/core/WellsGroup.cpp b/opm/core/WellsGroup.cpp index 6bf82b391..c7c6b1889 100644 --- a/opm/core/WellsGroup.cpp +++ b/opm/core/WellsGroup.cpp @@ -117,13 +117,14 @@ namespace Opm bool WellsGroup::conditionsMet(const std::vector& well_bhp, const std::vector& well_rate, - const UnstructuredGrid& grid, const std::vector& saturations, - const struct Wells* wells, int index_of_well, double epsilon) + const UnstructuredGrid& grid, const std::vector& saturations, + const struct Wells* wells, int index_of_well, WellControlResult& result, + double epsilon) { if (parent_ != NULL) { bool parent_ok = (static_cast (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) { return false; } @@ -207,11 +208,19 @@ namespace Opm } bool WellNode::conditionsMet(const std::vector& well_bhp, const std::vector& well_rate, - const UnstructuredGrid& grid, const std::vector& saturations, double epsilon) + const UnstructuredGrid& grid, const std::vector& saturations, + WellControlResult& result, double epsilon) { if (parent_ != NULL) { - bool parent_ok = (static_cast (parent_))->conditionsMet(well_bhp, well_rate, grid, saturations, wells_, self_index_, epsilon); + bool parent_ok = (static_cast (parent_))->conditionsMet(well_bhp, + well_rate, + grid, + saturations, + wells_, + self_index_, + result, + epsilon); if (!parent_ok) { return false; } diff --git a/opm/core/WellsGroup.hpp b/opm/core/WellsGroup.hpp index cc2b67f80..6da697e51 100644 --- a/opm/core/WellsGroup.hpp +++ b/opm/core/WellsGroup.hpp @@ -11,6 +11,18 @@ namespace Opm { + struct ExceedInformation { + std::string group_name_; + int well_index_; + double surplus_; + }; + + struct WellControlResult { + std::vector oil_rate_; + std::vector fluid_rate_; + std::vector bhp_; + + }; class WellsGroupInterface { public: @@ -76,7 +88,7 @@ namespace Opm bool conditionsMet(const std::vector& well_bhp, const std::vector& well_rate, const UnstructuredGrid& grid, const std::vector& 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(); @@ -97,7 +109,8 @@ namespace Opm virtual WellsGroupInterface* findGroup(std::string name_of_node); virtual bool conditionsMet(const std::vector& well_bhp, const std::vector& well_rate, - const UnstructuredGrid& grid, const std::vector& saturations, double epsilon=1e-8); + const UnstructuredGrid& grid, const std::vector& saturations, + WellControlResult& result, double epsilon=1e-8); virtual bool isLeafNode() const; void setWellsPointer(const struct Wells* wells, int self_index);