Fixed reading of gconprod to handle defaulted arguments better

This commit is contained in:
Kjetil Olsen Lye 2012-04-16 17:10:17 +02:00
parent bc72ea9a44
commit dedc60d92d
4 changed files with 37 additions and 26 deletions

View File

@ -11,7 +11,8 @@ namespace Opm
water_production_target_(1e100),
fluid_volume_max_rate_(1e100),
BHP_limit_(1e100),
guide_rate_(1)
guide_rate_(1),
guide_rate_type_(NONE_GRT)
{
}

View File

@ -11,7 +11,7 @@ namespace Opm
enum ControlMode
{
NONE_CM, ORAT, WRAT, REIN, RESV, VREP, WGRA, FLD, GRUP
NONE_CM, ORAT, WRAT, LRAT, REIN, RESV, VREP, WGRA, FLD, GRUP
};
enum Procedure
@ -21,7 +21,7 @@ namespace Opm
enum GuideRateType
{
OIL, RAT
OIL, RAT, NONE_GRT
};
ProductionSpecification();

View File

@ -151,6 +151,8 @@ namespace Opm
if (well_bhp[index_of_well] - bhp_target > epsilon) {
std::cout << "BHP not met" << std::endl;
std::cout << "BHP limit was " << bhp_target << std::endl;
std::cout << "Actual bhp was " << well_bhp[index_of_well] << std::endl;
return false;
}
if(well_rate[index_of_well] - rate_target > epsilon) {
@ -338,6 +340,9 @@ namespace Opm
return ProductionSpecification::ORAT;
}
if (type == "LRAT") {
return ProductionSpecification::LRAT;
}
if (type == "REIN") {
return ProductionSpecification::REIN;
}
@ -444,11 +449,14 @@ namespace Opm
ProductionSpecification production_specification;
if (deck.hasField("GCONPROD")) {
std::cout << "Searching in gconprod " << std::endl;
std::cout << "name= " << name << std::endl;
GCONPROD gconprod = deck.getGCONPROD();
for (size_t i = 0; i < gconprod.gconprod.size(); i++) {
if (gconprod.gconprod[i].group_ == name) {
GconprodLine line = gconprod.gconprod[i];
production_specification.oil_max_rate_ = line.oil_max_rate_;
std::cout << "control_mode = " << line.control_mode_ << std::endl;
production_specification.control_mode_ = toProductionControlMode(line.control_mode_);
production_specification.water_production_target_ = line.water_max_rate_;
production_specification.gas_max_rate_ = line.gas_max_rate_;

View File

@ -513,33 +513,35 @@ namespace Opm
= lines[i].phase_ == "OIL" ? ProductionSpecification::OIL : ProductionSpecification::RAT;
}
}
well_collection_.calculateGuideRates();
// Apply guide rates:
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().guide_rate_type_ == ProductionSpecification::OIL) {
well_data[i].control = RATE;
well_collection_.calculateGuideRates();
double parent_oil_rate = well_collection_.getLeafNodes()[i]->getParent()->prodSpec().oil_max_rate_;
double guide_rate = well_collection_.getLeafNodes()[i]->prodSpec().guide_rate_;
well_data[i].target = guide_rate * parent_oil_rate;
}
// Apply guide rates:
for (size_t i = 0; i < well_data.size(); i++) {
if (well_collection_.getLeafNodes()[i]->prodSpec().control_mode_ == ProductionSpecification::GRUP) {
switch (well_collection_.getLeafNodes()[i]->prodSpec().guide_rate_type_ ) {
case ProductionSpecification::OIL:
{
well_data[i].control = RATE;
double parent_oil_rate = well_collection_.getLeafNodes()[i]->getParent()->prodSpec().oil_max_rate_;
double guide_rate = well_collection_.getLeafNodes()[i]->prodSpec().guide_rate_;
well_data[i].target = guide_rate * parent_oil_rate;
break;
}
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].type = INJECTOR;
double parent_surface_rate = well_collection_.getLeafNodes()[i]->getParent()->injSpec().surface_flow_max_rate_;
double guide_rate = well_collection_.getLeafNodes()[i]->prodSpec().guide_rate_;
well_data[i].target = guide_rate * parent_surface_rate;
}
}
}
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].type = INJECTOR;
double parent_surface_rate = well_collection_.getLeafNodes()[i]->getParent()->injSpec().surface_flow_max_rate_;
double guide_rate = well_collection_.getLeafNodes()[i]->prodSpec().guide_rate_;
well_data[i].target = guide_rate * parent_surface_rate;
}
}
}
// Set up the Wells struct.
w_ = wells_create(num_wells, num_perfs);