Added checks for BHP and fluid_volume_rate for group control. Also added error tolerance for group control
This commit is contained in:
parent
fdfd360481
commit
affbb08795
@ -76,7 +76,7 @@ int main(int argc, char** argv) {
|
|||||||
std::vector<double> well_rate;
|
std::vector<double> well_rate;
|
||||||
pressure_solver.solve(totmob, omega, src, wdp, bcs.c_bcs(), pressure, face_flux, well_bhp, well_rate);
|
pressure_solver.solve(totmob, omega, src, wdp, bcs.c_bcs(), pressure, face_flux, well_bhp, well_rate);
|
||||||
std::cout << "Solved" << std::endl;
|
std::cout << "Solved" << std::endl;
|
||||||
if(wells.wellCollection().conditionsMet(well_bhp, well_rate)) {
|
if(wells.wellCollection().conditionsMet(well_bhp, well_rate, *grid.c_grid(), state.saturation() )) {
|
||||||
std::cout << "Conditions met for wells!" << std::endl;
|
std::cout << "Conditions met for wells!" << std::endl;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -3,8 +3,8 @@ namespace Opm
|
|||||||
{
|
{
|
||||||
|
|
||||||
InjectionSpecification::InjectionSpecification()
|
InjectionSpecification::InjectionSpecification()
|
||||||
: injector_type_(WATER), control_mode_(NONE), surface_flow_max_rate_(0.0),
|
: injector_type_(WATER), control_mode_(NONE), surface_flow_max_rate_(1e100),
|
||||||
reinjection_fraction_target_(0.0), BHP_limit_(0.0)
|
reinjection_fraction_target_(0.0), BHP_limit_(1e100)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -7,11 +7,11 @@ namespace Opm
|
|||||||
:
|
:
|
||||||
control_mode_(NONE_CM),
|
control_mode_(NONE_CM),
|
||||||
procedure_(NONE_P),
|
procedure_(NONE_P),
|
||||||
oil_max_rate_(-1.0),
|
oil_max_rate_(1e100),
|
||||||
water_production_target_(-1.0),
|
water_production_target_(1e100),
|
||||||
fluid_volume_max_rate_(-1.0),
|
fluid_volume_max_rate_(1e100),
|
||||||
BHP_limit_(-1.0),
|
BHP_limit_(1e100),
|
||||||
guide_rate_(-1.0)
|
guide_rate_(1e100)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,9 +88,10 @@ namespace Opm
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WellCollection::conditionsMet(const std::vector<double>& well_bhp, const std::vector<double>& well_rate) const {
|
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 {
|
||||||
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) ) {
|
if(! static_cast<WellNode*>(leaf_nodes_[i].get())->conditionsMet(well_bhp, well_rate, grid, saturations, epsilon) ) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,8 @@ namespace Opm
|
|||||||
const EclipseGridParser& deck);
|
const EclipseGridParser& deck);
|
||||||
|
|
||||||
|
|
||||||
bool conditionsMet(const std::vector<double>& well_bhp, const std::vector<double>& well_rate) const;
|
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 std::vector<std::tr1::shared_ptr<WellsGroupInterface> >& getLeafNodes() const;
|
const std::vector<std::tr1::shared_ptr<WellsGroupInterface> >& getLeafNodes() const;
|
||||||
|
|
||||||
|
@ -115,10 +115,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 struct Wells* wells, int index_of_well)
|
const UnstructuredGrid& grid, const std::vector<double>& saturations,
|
||||||
|
const struct Wells* wells, int index_of_well, double epsilon)
|
||||||
{
|
{
|
||||||
if (parent_ != NULL) {
|
if (parent_ != NULL) {
|
||||||
bool parent_ok = (static_cast<WellsGroup*> (parent_))->conditionsMet(well_bhp, well_rate, wells, index_of_well);
|
bool parent_ok =
|
||||||
|
(static_cast<WellsGroup*> (parent_))->conditionsMet(well_bhp,
|
||||||
|
well_rate,grid, saturations, wells, index_of_well, epsilon);
|
||||||
if (!parent_ok) {
|
if (!parent_ok) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -138,15 +141,26 @@ 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)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (parent_ != NULL) {
|
if (parent_ != NULL) {
|
||||||
bool parent_ok = (static_cast<WellsGroup*> (parent_))->conditionsMet(well_bhp, well_rate, wells_, self_index_);
|
bool parent_ok = (static_cast<WellsGroup*> (parent_))->conditionsMet(well_bhp, well_rate, grid, saturations, wells_, self_index_, epsilon);
|
||||||
if (!parent_ok) {
|
if (!parent_ok) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::cout << "checking here" << std::endl;
|
||||||
|
// Check for self:
|
||||||
|
if(well_rate[self_index_] - prodSpec().BHP_limit_ > epsilon) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(well_rate[self_index_] - prodSpec().fluid_volume_max_rate_ > epsilon) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,8 +67,9 @@ namespace Opm
|
|||||||
|
|
||||||
void addChild(std::tr1::shared_ptr<WellsGroupInterface> child);
|
void addChild(std::tr1::shared_ptr<WellsGroupInterface> child);
|
||||||
|
|
||||||
bool conditionsMet(const std::vector<double>& well_bhp, const std::vector<double>& well_rate, const struct Wells* wells,
|
bool conditionsMet(const std::vector<double>& well_bhp, const std::vector<double>& well_rate,
|
||||||
int index_of_well);
|
const UnstructuredGrid& grid, const std::vector<double>& saturations, const struct Wells* wells,
|
||||||
|
int index_of_well, double epsilon = 1e-8);
|
||||||
|
|
||||||
virtual void calculateGuideRates();
|
virtual void calculateGuideRates();
|
||||||
private:
|
private:
|
||||||
@ -85,7 +86,8 @@ 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>& 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);
|
||||||
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);
|
||||||
|
@ -513,13 +513,13 @@ namespace Opm
|
|||||||
}
|
}
|
||||||
|
|
||||||
well_collection_.calculateGuideRates();
|
well_collection_.calculateGuideRates();
|
||||||
}
|
|
||||||
|
|
||||||
|
#if 0
|
||||||
// Apply guide rates:
|
// Apply guide rates:
|
||||||
for (size_t i = 0; i < well_data.size(); i++) {
|
for (size_t i = 0; i < well_data.size(); i++) {
|
||||||
if(well_collection_.getLeafNodes()[i]->prodSpec().control_mode_ == ProductionSpecification::GRUP)
|
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) {
|
if (well_collection_.getLeafNodes()[i]->prodSpec().guide_rate_type_ == ProductionSpecification::OIL) {
|
||||||
well_data[i].control = RATE;
|
well_data[i].control = RATE;
|
||||||
|
|
||||||
@ -528,10 +528,9 @@ namespace Opm
|
|||||||
well_data[i].target = guide_rate * parent_oil_rate;
|
well_data[i].target = guide_rate * parent_oil_rate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(well_collection_.getLeafNodes()[i]->injSpec().control_mode_ == InjectionSpecification::GRUP)
|
|
||||||
{
|
|
||||||
if(well_collection_.getLeafNodes()[i]->prodSpec().guide_rate_type_ == ProductionSpecification::RAT) {
|
|
||||||
|
|
||||||
|
if (well_collection_.getLeafNodes()[i]->injSpec().control_mode_ == InjectionSpecification::GRUP) {
|
||||||
|
if (well_collection_.getLeafNodes()[i]->prodSpec().guide_rate_type_ == ProductionSpecification::RAT) {
|
||||||
well_data[i].control = RATE;
|
well_data[i].control = RATE;
|
||||||
well_data[i].type = INJECTOR;
|
well_data[i].type = INJECTOR;
|
||||||
double parent_surface_rate = well_collection_.getLeafNodes()[i]->getParent()->injSpec().surface_flow_max_rate_;
|
double parent_surface_rate = well_collection_.getLeafNodes()[i]->getParent()->injSpec().surface_flow_max_rate_;
|
||||||
@ -539,6 +538,8 @@ namespace Opm
|
|||||||
well_data[i].target = guide_rate * parent_surface_rate;
|
well_data[i].target = guide_rate * parent_surface_rate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1424,7 +1424,7 @@ struct WconprodLine
|
|||||||
WconprodLine() :
|
WconprodLine() :
|
||||||
open_shut_flag_("OPEN"), oil_max_rate_(1.0E20), water_max_rate_(1.0E20),
|
open_shut_flag_("OPEN"), oil_max_rate_(1.0E20), water_max_rate_(1.0E20),
|
||||||
gas_max_rate_(1.0E20), liquid_max_rate_(1.0E20),
|
gas_max_rate_(1.0E20), liquid_max_rate_(1.0E20),
|
||||||
fluid_volume_max_rate_(1.0E20), BHP_limit_(-1.0), THP_limit_(0.0),
|
fluid_volume_max_rate_(1.0E20), BHP_limit_(1e100), THP_limit_(0.0),
|
||||||
VFP_table_number_(0), artif_lift_quantity_(0.0)
|
VFP_table_number_(0), artif_lift_quantity_(0.0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user