mirror of
https://github.com/OPM/opm-simulators.git
synced 2024-12-28 18:21:00 -06:00
use rates for potentials for pressure controlled (bhp or thp) controled wells
This commit is contained in:
parent
d83b06c74b
commit
cccece4104
@ -542,32 +542,31 @@ namespace Opm
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If the well is pressure controlled the potential equals the rate.
|
// If the well is pressure controlled the potential equals the rate.
|
||||||
/* {
|
bool pressure_controlled_well = false;
|
||||||
bool pressure_controlled_well = false;
|
if (this->isInjector()) {
|
||||||
if (this->isInjector()) {
|
const Well::InjectorCMode& current = well_state.currentInjectionControl(index_of_well_);
|
||||||
const Well::InjectorCMode& current = well_state.currentInjectionControl()[index_of_well_];
|
if (current == Well::InjectorCMode::BHP || current == Well::InjectorCMode::THP) {
|
||||||
if (current == Well::InjectorCMode::BHP || current == Well::InjectorCMode::THP) {
|
pressure_controlled_well = true;
|
||||||
pressure_controlled_well = true;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
const Well::ProducerCMode& current = well_state.currentProductionControls()[index_of_well_];
|
|
||||||
if (current == Well::ProducerCMode::BHP || current == Well::ProducerCMode::THP) {
|
|
||||||
pressure_controlled_well = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (pressure_controlled_well) {
|
} else {
|
||||||
for (int compIdx = 0; compIdx < num_components_; ++compIdx) {
|
const Well::ProducerCMode& current = well_state.currentProductionControl(index_of_well_);
|
||||||
const EvalWell rate = this->getQs(compIdx);
|
if (current == Well::ProducerCMode::BHP || current == Well::ProducerCMode::THP) {
|
||||||
well_potentials[ebosCompIdxToFlowCompIdx(compIdx)] = rate.value();
|
pressure_controlled_well = true;
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
} */
|
}
|
||||||
|
if (pressure_controlled_well) {
|
||||||
|
// initialized the well rates with the potentials i.e. the well rates based on bhp
|
||||||
|
const double sign = this->well_ecl_.isInjector() ? 1.0 : -1.0;
|
||||||
|
for (int phase = 0; phase < np; ++phase){
|
||||||
|
well_potentials[phase] = sign * well_state.wellRates(index_of_well_)[phase];
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
debug_cost_counter_ = 0;
|
debug_cost_counter_ = 0;
|
||||||
// does the well have a THP related constraint?
|
// does the well have a THP related constraint?
|
||||||
const auto& summaryState = ebosSimulator.vanguard().summaryState();
|
const auto& summaryState = ebosSimulator.vanguard().summaryState();
|
||||||
auto current_control = well_state.currentProductionControl(this->index_of_well_);
|
if (!Base::wellHasTHPConstraints(summaryState)) {
|
||||||
if ( !Base::wellHasTHPConstraints(summaryState) || current_control == Well::ProducerCMode::BHP) {
|
|
||||||
computeWellRatesAtBhpLimit(ebosSimulator, well_potentials, deferred_logger);
|
computeWellRatesAtBhpLimit(ebosSimulator, well_potentials, deferred_logger);
|
||||||
} else {
|
} else {
|
||||||
well_potentials = computeWellPotentialWithTHP(ebosSimulator, deferred_logger);
|
well_potentials = computeWellPotentialWithTHP(ebosSimulator, deferred_logger);
|
||||||
|
@ -2690,6 +2690,28 @@ namespace Opm
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If the well is pressure controlled the potential equals the rate.
|
||||||
|
bool pressure_controlled_well = false;
|
||||||
|
if (this->isInjector()) {
|
||||||
|
const Well::InjectorCMode& current = well_state.currentInjectionControl(index_of_well_);
|
||||||
|
if (current == Well::InjectorCMode::BHP || current == Well::InjectorCMode::THP) {
|
||||||
|
pressure_controlled_well = true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
const Well::ProducerCMode& current = well_state.currentProductionControl(index_of_well_);
|
||||||
|
if (current == Well::ProducerCMode::BHP || current == Well::ProducerCMode::THP) {
|
||||||
|
pressure_controlled_well = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (pressure_controlled_well) {
|
||||||
|
// initialized the well rates with the potentials i.e. the well rates based on bhp
|
||||||
|
const double sign = this->well_ecl_.isInjector() ? 1.0 : -1.0;
|
||||||
|
for (int phase = 0; phase < np; ++phase){
|
||||||
|
well_potentials[phase] = sign * well_state.wellRates(index_of_well_)[phase];
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// creating a copy of the well itself, to avoid messing up the explicit informations
|
// creating a copy of the well itself, to avoid messing up the explicit informations
|
||||||
// during this copy, the only information not copied properly is the well controls
|
// during this copy, the only information not copied properly is the well controls
|
||||||
StandardWell<TypeTag> well(*this);
|
StandardWell<TypeTag> well(*this);
|
||||||
@ -2697,8 +2719,7 @@ namespace Opm
|
|||||||
|
|
||||||
// does the well have a THP related constraint?
|
// does the well have a THP related constraint?
|
||||||
const auto& summaryState = ebosSimulator.vanguard().summaryState();
|
const auto& summaryState = ebosSimulator.vanguard().summaryState();
|
||||||
auto current_control = well_state.currentProductionControl(this->index_of_well_);
|
if (!well.Base::wellHasTHPConstraints(summaryState)) {
|
||||||
if ( !well.Base::wellHasTHPConstraints(summaryState) || current_control == Well::ProducerCMode::BHP ) {
|
|
||||||
// get the bhp value based on the bhp constraints
|
// get the bhp value based on the bhp constraints
|
||||||
const double bhp = well.mostStrictBhpFromBhpLimits(summaryState);
|
const double bhp = well.mostStrictBhpFromBhpLimits(summaryState);
|
||||||
assert(std::abs(bhp) != std::numeric_limits<double>::max());
|
assert(std::abs(bhp) != std::numeric_limits<double>::max());
|
||||||
|
Loading…
Reference in New Issue
Block a user