Fixed reading of gconprod to handle defaulted arguments better
This commit is contained in:
parent
945b56920b
commit
52485ee5f7
@ -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)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
|
@ -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_;
|
||||
|
@ -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);
|
||||
|
@ -1255,31 +1255,30 @@ struct GCONPROD : public SpecialBase
|
||||
}
|
||||
std::vector<double> double_data(4, 1.0E20);
|
||||
const int num_to_read = 4;
|
||||
int num_read = readDefaultedVectorData(is, double_data, num_to_read);
|
||||
gconprod_line.oil_max_rate_ = double_data[0];
|
||||
gconprod_line.water_max_rate_ = double_data[1];
|
||||
gconprod_line.gas_max_rate_ = double_data[2];
|
||||
gconprod_line.liquid_max_rate_ = double_data[3];
|
||||
|
||||
|
||||
std::string procedure = readString(is);
|
||||
if (procedure[0] == '/') {
|
||||
is >> ignoreLine;
|
||||
break;
|
||||
}
|
||||
while (procedure.find("--") == 0) {
|
||||
// This line is a comment
|
||||
is >> ignoreLine;
|
||||
procedure = readString(is);
|
||||
}
|
||||
|
||||
int num_read = readDefaultedVectorData(is, double_data, num_to_read);
|
||||
gconprod_line.oil_max_rate_ = double_data[0];
|
||||
gconprod_line.water_max_rate_ = double_data[1];
|
||||
gconprod_line.gas_max_rate_ = double_data[2];
|
||||
gconprod_line.liquid_max_rate_ = double_data[3];
|
||||
|
||||
std::string procedure;
|
||||
if (num_read == num_to_read) {
|
||||
procedure = readString(is);
|
||||
if (procedure[0] == '/') {
|
||||
is.putback('/');
|
||||
procedure = "NONE";
|
||||
}
|
||||
} else {
|
||||
procedure = "NONE";
|
||||
}
|
||||
gconprod_line.procedure_ = procedure;
|
||||
|
||||
gconprod.push_back(gconprod_line);
|
||||
// HACK! Ignore any further items
|
||||
|
||||
gconprod.push_back(gconprod_line);
|
||||
// HACK! Ignore any further items
|
||||
if (num_read == num_to_read) {
|
||||
ignoreSlashLine(is);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user