mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Added further checks for well conditions. Fixed a small bug in reading WCONPROD
This commit is contained in:
parent
67251e7f77
commit
a7e471951d
@ -127,6 +127,38 @@ namespace Opm
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
int number_of_leaf_nodes = 1;//numberOfLeafNodes();
|
||||
|
||||
double bhp_target = 1e100;
|
||||
double rate_target = 1e100;
|
||||
switch(wells->type[index_of_well]) {
|
||||
case INJECTOR:
|
||||
{
|
||||
const InjectionSpecification& inje_spec = injSpec();
|
||||
bhp_target = inje_spec.BHP_limit_ / number_of_leaf_nodes;
|
||||
rate_target = inje_spec.fluid_volume_max_rate_ / number_of_leaf_nodes;
|
||||
break;
|
||||
}
|
||||
case PRODUCER:
|
||||
{
|
||||
const ProductionSpecification& prod_spec = prodSpec();
|
||||
bhp_target = prod_spec.BHP_limit_ / number_of_leaf_nodes;
|
||||
rate_target = prod_spec.fluid_volume_max_rate_ / number_of_leaf_nodes;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (well_bhp[index_of_well] - bhp_target > epsilon) {
|
||||
std::cout << "BHP not met" << std::endl;
|
||||
return false;
|
||||
}
|
||||
if(well_rate[index_of_well] - rate_target > epsilon) {
|
||||
std::cout << wells->type[index_of_well] << std::endl;
|
||||
std::cout << "well_rate not met" << std::endl;
|
||||
std::cout << "target = " << rate_target << ", well_rate[index_of_well] = " << well_rate[index_of_well] << std::endl;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -135,6 +167,19 @@ namespace Opm
|
||||
children_.push_back(child);
|
||||
}
|
||||
|
||||
|
||||
int WellsGroup::numberOfLeafNodes() {
|
||||
// This could probably use some caching, but seeing as how the number of
|
||||
// wells is relatively small, we'll do without for now.
|
||||
int sum = 0;
|
||||
|
||||
for(size_t i = 0; i < children_.size(); i++) {
|
||||
sum += children_[i]->numberOfLeafNodes();
|
||||
}
|
||||
|
||||
return sum;
|
||||
}
|
||||
|
||||
WellNode::WellNode(const std::string& myname,
|
||||
ProductionSpecification prod_spec,
|
||||
InjectionSpecification inj_spec)
|
||||
@ -215,6 +260,11 @@ namespace Opm
|
||||
// Empty
|
||||
}
|
||||
|
||||
int WellNode::numberOfLeafNodes()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
|
@ -45,7 +45,13 @@ namespace Opm
|
||||
void setParent(WellsGroupInterface* parent);
|
||||
const WellsGroupInterface* getParent() const;
|
||||
|
||||
/// Recursively calculate the guide rate for each member of the well group.
|
||||
/// This should be called after the guide rates are set to the non-normalized values.
|
||||
virtual void calculateGuideRates() = 0;
|
||||
|
||||
/// Calculates the number of leaf nodes in the given group.
|
||||
/// A leaf node is defined to have one leaf node in its group.
|
||||
virtual int numberOfLeafNodes() = 0;
|
||||
protected:
|
||||
WellsGroupInterface* parent_;
|
||||
|
||||
@ -73,6 +79,9 @@ namespace Opm
|
||||
int index_of_well, double epsilon = 1e-8);
|
||||
|
||||
virtual void calculateGuideRates();
|
||||
|
||||
|
||||
virtual int numberOfLeafNodes();
|
||||
private:
|
||||
std::vector<std::tr1::shared_ptr<WellsGroupInterface> > children_;
|
||||
};
|
||||
@ -94,6 +103,7 @@ namespace Opm
|
||||
void setWellsPointer(const struct Wells* wells, int self_index);
|
||||
|
||||
virtual void calculateGuideRates();
|
||||
virtual int numberOfLeafNodes();
|
||||
private:
|
||||
const struct Wells* wells_;
|
||||
int self_index_;
|
||||
|
@ -517,9 +517,7 @@ namespace Opm
|
||||
|
||||
// Apply guide rates:
|
||||
for (size_t i = 0; i < well_data.size(); i++) {
|
||||
std::cout << "hello" << std::endl;
|
||||
if (well_collection_.getLeafNodes()[i]->prodSpec().control_mode_ == ProductionSpecification::GRUP) {
|
||||
std::cout << "hello" << std::endl;
|
||||
if (well_collection_.getLeafNodes()[i]->prodSpec().guide_rate_type_ == ProductionSpecification::OIL) {
|
||||
well_data[i].control = RATE;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user