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 945b56920b
commit 52485ee5f7
5 changed files with 57 additions and 47 deletions

View File

@ -11,7 +11,8 @@ namespace Opm
water_production_target_(1e100), water_production_target_(1e100),
fluid_volume_max_rate_(1e100), fluid_volume_max_rate_(1e100),
BHP_limit_(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 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 enum Procedure
@ -21,7 +21,7 @@ namespace Opm
enum GuideRateType enum GuideRateType
{ {
OIL, RAT OIL, RAT, NONE_GRT
}; };
ProductionSpecification(); ProductionSpecification();

View File

@ -151,6 +151,8 @@ namespace Opm
if (well_bhp[index_of_well] - bhp_target > epsilon) { if (well_bhp[index_of_well] - bhp_target > epsilon) {
std::cout << "BHP not met" << std::endl; 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; return false;
} }
if(well_rate[index_of_well] - rate_target > epsilon) { if(well_rate[index_of_well] - rate_target > epsilon) {
@ -338,6 +340,9 @@ namespace Opm
return ProductionSpecification::ORAT; return ProductionSpecification::ORAT;
} }
if (type == "LRAT") {
return ProductionSpecification::LRAT;
}
if (type == "REIN") { if (type == "REIN") {
return ProductionSpecification::REIN; return ProductionSpecification::REIN;
} }
@ -444,11 +449,14 @@ namespace Opm
ProductionSpecification production_specification; ProductionSpecification production_specification;
if (deck.hasField("GCONPROD")) { if (deck.hasField("GCONPROD")) {
std::cout << "Searching in gconprod " << std::endl;
std::cout << "name= " << name << std::endl;
GCONPROD gconprod = deck.getGCONPROD(); GCONPROD gconprod = deck.getGCONPROD();
for (size_t i = 0; i < gconprod.gconprod.size(); i++) { for (size_t i = 0; i < gconprod.gconprod.size(); i++) {
if (gconprod.gconprod[i].group_ == name) { if (gconprod.gconprod[i].group_ == name) {
GconprodLine line = gconprod.gconprod[i]; GconprodLine line = gconprod.gconprod[i];
production_specification.oil_max_rate_ = line.oil_max_rate_; 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.control_mode_ = toProductionControlMode(line.control_mode_);
production_specification.water_production_target_ = line.water_max_rate_; production_specification.water_production_target_ = line.water_max_rate_;
production_specification.gas_max_rate_ = line.gas_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; = lines[i].phase_ == "OIL" ? ProductionSpecification::OIL : ProductionSpecification::RAT;
} }
} }
well_collection_.calculateGuideRates(); 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;
double parent_oil_rate = well_collection_.getLeafNodes()[i]->getParent()->prodSpec().oil_max_rate_; // Apply guide rates:
double guide_rate = well_collection_.getLeafNodes()[i]->prodSpec().guide_rate_; for (size_t i = 0; i < well_data.size(); i++) {
well_data[i].target = guide_rate * parent_oil_rate; 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. // Set up the Wells struct.
w_ = wells_create(num_wells, num_perfs); w_ = wells_create(num_wells, num_perfs);

View File

@ -1255,31 +1255,30 @@ struct GCONPROD : public SpecialBase
} }
std::vector<double> double_data(4, 1.0E20); std::vector<double> double_data(4, 1.0E20);
const int num_to_read = 4; const int num_to_read = 4;
int num_read = readDefaultedVectorData(is, double_data, num_to_read); int num_read = readDefaultedVectorData(is, double_data, num_to_read);
gconprod_line.oil_max_rate_ = double_data[0]; gconprod_line.oil_max_rate_ = double_data[0];
gconprod_line.water_max_rate_ = double_data[1]; gconprod_line.water_max_rate_ = double_data[1];
gconprod_line.gas_max_rate_ = double_data[2]; gconprod_line.gas_max_rate_ = double_data[2];
gconprod_line.liquid_max_rate_ = double_data[3]; gconprod_line.liquid_max_rate_ = double_data[3];
std::string procedure;
std::string procedure = readString(is); if (num_read == num_to_read) {
if (procedure[0] == '/') { procedure = readString(is);
is >> ignoreLine; if (procedure[0] == '/') {
break; is.putback('/');
} procedure = "NONE";
while (procedure.find("--") == 0) { }
// This line is a comment } else {
is >> ignoreLine; procedure = "NONE";
procedure = readString(is); }
}
gconprod_line.procedure_ = procedure; gconprod_line.procedure_ = procedure;
gconprod.push_back(gconprod_line); gconprod.push_back(gconprod_line);
// HACK! Ignore any further items // HACK! Ignore any further items
if (num_read == num_to_read) { if (num_read == num_to_read) {
ignoreSlashLine(is); ignoreSlashLine(is);
} }
} }
} }