mirror of
https://github.com/OPM/opm-simulators.git
synced 2026-08-13 08:34:49 -05:00
a little more generalized implementation of BHP determination
for well potentials calculation, not caring much about how many THP/BHP constraints exist.
This commit is contained in:
@@ -1664,16 +1664,22 @@ namespace Opm {
|
|||||||
|
|
||||||
for (int w = 0; w < nw; ++w) {
|
for (int w = 0; w < nw; ++w) {
|
||||||
// bhp needs to be determined for the well potential calculation
|
// bhp needs to be determined for the well potential calculation
|
||||||
|
// There can be more than one BHP/THP constraints.
|
||||||
|
// TODO: there is an option to ignore the THP limit when calculating well potentials,
|
||||||
|
// we are not handling it for the moment, while easy to incorporate
|
||||||
|
|
||||||
// default bhp constraints
|
// the bhp will be used to compute well potentials
|
||||||
|
double bhp;
|
||||||
|
|
||||||
|
// type of the well, INJECTOR or PRODUCER
|
||||||
const WellType& well_type = wells().type[w];
|
const WellType& well_type = wells().type[w];
|
||||||
double bhp = 0.;
|
// initial bhp value, making the value not usable
|
||||||
switch(well_type) {
|
switch(well_type) {
|
||||||
case INJECTOR:
|
case INJECTOR:
|
||||||
bhp = 6.895e8; // defaulted high limit
|
bhp = std::numeric_limits<double>::max();
|
||||||
break;
|
break;
|
||||||
case PRODUCER:
|
case PRODUCER:
|
||||||
bhp = 1.013e5; // defaulted low limit
|
bhp = -std::numeric_limits<double>::max();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
OPM_THROW(std::logic_error, "Expected PRODUCER or INJECTOR type for well " << wells().name[w]);
|
OPM_THROW(std::logic_error, "Expected PRODUCER or INJECTOR type for well " << wells().name[w]);
|
||||||
@@ -1681,51 +1687,32 @@ namespace Opm {
|
|||||||
|
|
||||||
// the well controls
|
// the well controls
|
||||||
const WellControls* well_control = wells().ctrls[w];
|
const WellControls* well_control = wells().ctrls[w];
|
||||||
// The number of the well controls
|
// The number of the well controls/constraints
|
||||||
const int nwc = well_controls_get_num(well_control);
|
const int nwc = well_controls_get_num(well_control);
|
||||||
|
|
||||||
// Finding BHP control or THP controls, not sure whether there can be more than one BHP controls, THP can be more than one
|
|
||||||
// IF we find a THP control, we calculate the BHP value.
|
|
||||||
// TODO: there is option to ignore the THP limit when calculating well potentials,
|
|
||||||
// we are not handling it for the moment.
|
|
||||||
|
|
||||||
// getting the bhp constraints from the well control
|
|
||||||
double bhp_from_wellcontrol = -1.e5; // intial nagative value, assumming we can not specify negative BHP constraints
|
|
||||||
for (int ctrl_index = 0; ctrl_index < nwc; ++ctrl_index) {
|
for (int ctrl_index = 0; ctrl_index < nwc; ++ctrl_index) {
|
||||||
|
// finding a BHP constraint
|
||||||
if (well_controls_iget_type(well_control, ctrl_index) == BHP) {
|
if (well_controls_iget_type(well_control, ctrl_index) == BHP) {
|
||||||
// get the bhp constraint value, it should always be postive assummingly
|
// get the bhp constraint value, it should always be postive assummingly
|
||||||
const double bhp_target = well_controls_iget_target(well_control, ctrl_index);
|
const double bhp_target = well_controls_iget_target(well_control, ctrl_index);
|
||||||
|
|
||||||
// assuming we can not specify negative bhp constraints
|
switch(well_type) {
|
||||||
assert(bhp_target > 0.);
|
case INJECTOR: // using the lower bhp contraint from Injectors
|
||||||
|
if (bhp_target < bhp) {
|
||||||
if (bhp_from_wellcontrol < 0.) {
|
bhp = bhp_target;
|
||||||
bhp_from_wellcontrol = bhp_target; // first time finding a bhp constraint
|
}
|
||||||
} else {
|
break;
|
||||||
switch(well_type) {
|
case PRODUCER:
|
||||||
case INJECTOR: // using the lower bhp contraint from Injectors
|
if (bhp_target > bhp) {
|
||||||
if (bhp_target < bhp_from_wellcontrol) {
|
bhp = bhp_target;
|
||||||
bhp_from_wellcontrol = bhp_target;
|
}
|
||||||
}
|
break;
|
||||||
break;
|
default:
|
||||||
case PRODUCER:
|
OPM_THROW(std::logic_error, "Expected PRODUCER or INJECTOR type for well " << wells().name[w]);
|
||||||
if (bhp_target > bhp_from_wellcontrol) {
|
} // end of switch
|
||||||
bhp_from_wellcontrol = bhp_target;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
OPM_THROW(std::logic_error, "Expected PRODUCER or INJECTOR type for well " << wells().name[w]);
|
|
||||||
} // end of switch
|
|
||||||
} // end of else
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (bhp_from_wellcontrol > 0.) { // finding at least one bhp constaint
|
// finding a THP constraint
|
||||||
bhp = bhp_from_wellcontrol;
|
|
||||||
}
|
|
||||||
|
|
||||||
// checking for bhp contraints resulting from thp constraints
|
|
||||||
for (int ctrl_index = 0; ctrl_index < nwc; ++ctrl_index) {
|
|
||||||
if (well_controls_iget_type(well_control, ctrl_index) == THP) {
|
if (well_controls_iget_type(well_control, ctrl_index) == THP) {
|
||||||
double aqua = 0.0;
|
double aqua = 0.0;
|
||||||
double liquid = 0.0;
|
double liquid = 0.0;
|
||||||
@@ -1767,15 +1754,18 @@ namespace Opm {
|
|||||||
wellPerforationDensities()[first_perf], gravity_);
|
wellPerforationDensities()[first_perf], gravity_);
|
||||||
const double bhp_calculated = vfp_properties_->getProd()->bhp(vfp, aqua, liquid, vapour, thp, alq) - dp;
|
const double bhp_calculated = vfp_properties_->getProd()->bhp(vfp, aqua, liquid, vapour, thp, alq) - dp;
|
||||||
// apply the strictest of the bhp controlls i.e. largest bhp for producers
|
// apply the strictest of the bhp controlls i.e. largest bhp for producers
|
||||||
if (bhp_calculated > bhp) {
|
if (bhp_calculated > bhp) {
|
||||||
bhp = bhp_calculated;
|
bhp = bhp_calculated;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
OPM_THROW(std::logic_error, "Expected PRODUCER or INJECTOR type of well");
|
OPM_THROW(std::logic_error, "Expected PRODUCER or INJECTOR type of well");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// there should be always some avaible bhp/thp constraints there
|
||||||
|
assert(std::abs(bhp) != std::numeric_limits<double>::max());
|
||||||
|
|
||||||
// Should we consider crossflow when calculating well potentionals?
|
// Should we consider crossflow when calculating well potentionals?
|
||||||
const bool allow_cf = allow_cross_flow(w, ebosSimulator);
|
const bool allow_cf = allow_cross_flow(w, ebosSimulator);
|
||||||
for (int perf = wells().well_connpos[w]; perf < wells().well_connpos[w+1]; ++perf) {
|
for (int perf = wells().well_connpos[w]; perf < wells().well_connpos[w+1]; ++perf) {
|
||||||
|
|||||||
Reference in New Issue
Block a user