mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Merge pull request #1088 from GitPaean/correcting_bhp_limits_for_well_potentials
more careful determination of the most restrictive bhp value
This commit is contained in:
commit
553f345670
@ -1650,22 +1650,55 @@ 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
|
||||||
double bhp = 0.;
|
// 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
|
||||||
|
|
||||||
|
// 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];
|
||||||
|
// initial bhp value, making the value not usable
|
||||||
|
switch(well_type) {
|
||||||
|
case INJECTOR:
|
||||||
|
bhp = std::numeric_limits<double>::max();
|
||||||
|
break;
|
||||||
|
case PRODUCER:
|
||||||
|
bhp = -std::numeric_limits<double>::max();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
OPM_THROW(std::logic_error, "Expected PRODUCER or INJECTOR type for well " << wells().name[w]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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 a BHP control or a THP control
|
|
||||||
// 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.
|
|
||||||
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) {
|
||||||
// set bhp to the bhp value
|
// get the bhp constraint value, it should always be postive assummingly
|
||||||
bhp = well_controls_iget_target(well_control, ctrl_index);
|
const double bhp_target = well_controls_iget_target(well_control, ctrl_index);
|
||||||
|
|
||||||
|
switch(well_type) {
|
||||||
|
case INJECTOR: // using the lower bhp contraint from Injectors
|
||||||
|
if (bhp_target < bhp) {
|
||||||
|
bhp = bhp_target;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case PRODUCER:
|
||||||
|
if (bhp_target > bhp) {
|
||||||
|
bhp = bhp_target;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
OPM_THROW(std::logic_error, "Expected PRODUCER or INJECTOR type for well " << wells().name[w]);
|
||||||
|
} // end of switch
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// finding a THP constraint
|
||||||
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;
|
||||||
@ -1707,16 +1740,17 @@ 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");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(bhp != 0.0);
|
// 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);
|
||||||
|
Loading…
Reference in New Issue
Block a user