Made the WellNode be aware of their own index
This commit is contained in:
1 parent
9511d8dce2
commit
77dc0991cf
7 files changed
+68
-2
No files matched your search
@@ -68,6 +68,14 @@ int main(int argc, char** argv) {
|
|||||||
std::vector<double> pressure;
|
std::vector<double> pressure;
|
||||||
std::vector<double> face_flux;
|
std::vector<double> face_flux;
|
||||||
pressure_solver.solve(totmob, omega, src, bcs.c_bcs(), pressure, face_flux);
|
pressure_solver.solve(totmob, omega, src, bcs.c_bcs(), pressure, face_flux);
|
||||||
|
|
||||||
|
if(wells.wellCollection().conditionsMet(pressure, *grid.c_grid())) {
|
||||||
|
std::cout << "Conditions met for wells!" << std::endl;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::cout << "Conditions not met for wells!"<<std::endl;
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,6 +68,8 @@ namespace Opm
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const std::vector<std::tr1::shared_ptr<WellsGroupInterface> >& WellCollection::getLeafNodes() const {
|
const std::vector<std::tr1::shared_ptr<WellsGroupInterface> >& WellCollection::getLeafNodes() const {
|
||||||
return leaf_nodes_;
|
return leaf_nodes_;
|
||||||
}
|
}
|
||||||
@@ -83,4 +85,16 @@ namespace Opm
|
|||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool WellCollection::conditionsMet(const std::vector<double> pressure, const UnstructuredGrid& grid) const {
|
||||||
|
for(size_t i = 0; i < roots_.size(); i++) {
|
||||||
|
if(! roots_[i]->conditionsMet(pressure, grid) ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -24,6 +24,7 @@ along with OpenRS. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <opm/core/WellsGroup.hpp>
|
#include <opm/core/WellsGroup.hpp>
|
||||||
|
#include <opm/core/grid.h>
|
||||||
#include <opm/core/eclipse/EclipseGridParser.hpp>
|
#include <opm/core/eclipse/EclipseGridParser.hpp>
|
||||||
|
|
||||||
namespace Opm
|
namespace Opm
|
||||||
@@ -38,6 +39,8 @@ namespace Opm
|
|||||||
void addChild(std::string child, std::string parent,
|
void addChild(std::string child, std::string parent,
|
||||||
const EclipseGridParser& deck);
|
const EclipseGridParser& deck);
|
||||||
|
|
||||||
|
bool conditionsMet(const std::vector<double> pressure, const UnstructuredGrid& grid) const;
|
||||||
|
|
||||||
const std::vector<std::tr1::shared_ptr<WellsGroupInterface> >& getLeafNodes() const;
|
const std::vector<std::tr1::shared_ptr<WellsGroupInterface> >& getLeafNodes() const;
|
||||||
private:
|
private:
|
||||||
// To account for the possibility of a forest
|
// To account for the possibility of a forest
|
||||||
|
|||||||
+18
-1
@@ -40,6 +40,7 @@ namespace Opm
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
WellsGroupInterface* WellsGroup::findGroup(std::string name_of_node)
|
WellsGroupInterface* WellsGroup::findGroup(std::string name_of_node)
|
||||||
{
|
{
|
||||||
if (name() == name_of_node) {
|
if (name() == name_of_node) {
|
||||||
@@ -56,6 +57,12 @@ namespace Opm
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool WellsGroup::conditionsMet(const std::vector<double> pressure, const UnstructuredGrid& grid)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void WellsGroup::addChild(std::tr1::shared_ptr<WellsGroupInterface> child)
|
void WellsGroup::addChild(std::tr1::shared_ptr<WellsGroupInterface> child)
|
||||||
{
|
{
|
||||||
@@ -68,6 +75,11 @@ namespace Opm
|
|||||||
: WellsGroupInterface(myname, prod_spec, inj_spec)
|
: WellsGroupInterface(myname, prod_spec, inj_spec)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool WellNode::conditionsMet(const std::vector<double> pressure, const UnstructuredGrid& grid)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
WellsGroupInterface* WellNode::findGroup(std::string name_of_node)
|
WellsGroupInterface* WellNode::findGroup(std::string name_of_node)
|
||||||
{
|
{
|
||||||
@@ -83,7 +95,12 @@ namespace Opm
|
|||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WellNode::setWellsPointer(const struct Wells* wells, int self_index) {
|
||||||
|
wells_ = wells;
|
||||||
|
self_index_ = self_index;
|
||||||
|
}
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
+12
-1
@@ -4,6 +4,7 @@
|
|||||||
#include <opm/core/InjectionSpecification.hpp>
|
#include <opm/core/InjectionSpecification.hpp>
|
||||||
#include <opm/core/ProductionSpecification.hpp>
|
#include <opm/core/ProductionSpecification.hpp>
|
||||||
#include <opm/core/eclipse/EclipseGridParser.hpp>
|
#include <opm/core/eclipse/EclipseGridParser.hpp>
|
||||||
|
#include <opm/core/grid.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
|
||||||
@@ -29,6 +30,8 @@ namespace Opm
|
|||||||
|
|
||||||
/// \returns true if the object is a leaf node (WellNode), false otherwise.
|
/// \returns true if the object is a leaf node (WellNode), false otherwise.
|
||||||
virtual bool isLeafNode() const;
|
virtual bool isLeafNode() const;
|
||||||
|
|
||||||
|
virtual bool conditionsMet(const std::vector<double> pressure, const UnstructuredGrid& grid) = 0;
|
||||||
|
|
||||||
/// \returns the pointer to the WellsGroupInterface with the given name. NULL if
|
/// \returns the pointer to the WellsGroupInterface with the given name. NULL if
|
||||||
/// the name is not found.a
|
/// the name is not found.a
|
||||||
@@ -51,6 +54,8 @@ namespace Opm
|
|||||||
virtual WellsGroupInterface* findGroup(std::string name_of_node);
|
virtual WellsGroupInterface* findGroup(std::string name_of_node);
|
||||||
|
|
||||||
void addChild(std::tr1::shared_ptr<WellsGroupInterface> child);
|
void addChild(std::tr1::shared_ptr<WellsGroupInterface> child);
|
||||||
|
|
||||||
|
virtual bool conditionsMet(const std::vector<double> pressure, const UnstructuredGrid& grid);
|
||||||
private:
|
private:
|
||||||
std::vector<std::tr1::shared_ptr<WellsGroupInterface> > children_;
|
std::vector<std::tr1::shared_ptr<WellsGroupInterface> > children_;
|
||||||
};
|
};
|
||||||
@@ -65,8 +70,14 @@ namespace Opm
|
|||||||
InjectionSpecification inj_spec);
|
InjectionSpecification inj_spec);
|
||||||
|
|
||||||
virtual WellsGroupInterface* findGroup(std::string name_of_node);
|
virtual WellsGroupInterface* findGroup(std::string name_of_node);
|
||||||
|
virtual bool conditionsMet(const std::vector<double> pressure, const UnstructuredGrid& grid);
|
||||||
virtual bool isLeafNode() const;
|
virtual bool isLeafNode() const;
|
||||||
|
|
||||||
|
void setWellsPointer(const struct Wells* wells, int self_index);
|
||||||
|
|
||||||
|
private:
|
||||||
|
const struct Wells* wells_;
|
||||||
|
int self_index_;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Doc me!
|
/// Doc me!
|
||||||
|
|||||||
@@ -520,6 +520,13 @@ namespace Opm
|
|||||||
WelspecsLine line = welspecs.welspecs[i];
|
WelspecsLine line = welspecs.welspecs[i];
|
||||||
wells_.addChild(line.name_, line.group_, deck);
|
wells_.addChild(line.name_, line.group_, deck);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for(size_t i = 0; i < wells_.getLeafNodes().size(); i++) {
|
||||||
|
WellNode* node = static_cast<WellNode*>(wells_.getLeafNodes()[i].get());
|
||||||
|
|
||||||
|
// We know that getLeafNodes() is ordered the same way as they're indexed in w_
|
||||||
|
node->setWellsPointer(w_, i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -541,6 +548,10 @@ namespace Opm
|
|||||||
return w_;
|
return w_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const WellCollection& WellsManager::wellCollection() const
|
||||||
|
{
|
||||||
|
return well_collection_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -54,6 +54,8 @@ namespace Opm
|
|||||||
/// The method is named similarly to c_str() in std::string,
|
/// The method is named similarly to c_str() in std::string,
|
||||||
/// to make it clear that we are returning a C-compatible struct.
|
/// to make it clear that we are returning a C-compatible struct.
|
||||||
const Wells* c_wells() const;
|
const Wells* c_wells() const;
|
||||||
|
|
||||||
|
const WellCollection& wellCollection() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Disable copying and assignment.
|
// Disable copying and assignment.
|
||||||
|
|||||||
Reference in new issue
Block a user