Only flag a bhp producer/injector operable if the sum of IPR are negative/positive

This commit is contained in:
Tor Harald Sandve 2022-05-31 14:31:26 +02:00
parent 147fe77779
commit e965dac3ee
2 changed files with 11 additions and 9 deletions

View File

@ -1169,12 +1169,13 @@ namespace Opm
if ( bhp_limit_not_defaulted || !this->wellHasTHPConstraints(summaryState) ) {
// if the BHP limit is not defaulted or the well does not have a THP limit
// we need to check the BHP limit
double ipr_rate = 0;
double total_ipr_mass_rate = 0.0;
for (int p = 0; p < this->number_of_phases_; ++p) {
ipr_rate += this->ipr_a_[p] - this->ipr_b_[p] * bhp_limit;
const double ipr_rate = this->ipr_a_[p] - this->ipr_b_[p] * bhp_limit;
const double rho = FluidSystem::referenceDensity( p, Base::pvtRegionIdx() );
total_ipr_mass_rate += ipr_rate * rho;
}
if ( (this->isProducer() && ipr_rate < 0.) || (this->isInjector() && ipr_rate > 0.) ) {
if ( (this->isProducer() && total_ipr_mass_rate < 0.) || (this->isInjector() && total_ipr_mass_rate > 0.) ) {
this->operability_status_.operable_under_only_bhp_limit = false;
}

View File

@ -1100,13 +1100,14 @@ namespace Opm
if ( bhp_limit_not_defaulted || !this->wellHasTHPConstraints(summaryState) ) {
// if the BHP limit is not defaulted or the well does not have a THP limit
// we need to check the BHP limit
double total_ipr_mass_rate = 0.0;
for (int p = 0; p < this->number_of_phases_; ++p) {
const double ipr_rate = this->ipr_a_[p] - this->ipr_b_[p] * bhp_limit;
if ( (this->isProducer() && ipr_rate < 0.) || (this->isInjector() && ipr_rate > 0.) ) {
this->operability_status_.operable_under_only_bhp_limit = false;
break;
}
const double rho = FluidSystem::referenceDensity( p, Base::pvtRegionIdx() );
total_ipr_mass_rate += ipr_rate * rho;
}
if ( (this->isProducer() && total_ipr_mass_rate < 0.) || (this->isInjector() && total_ipr_mass_rate > 0.) ) {
this->operability_status_.operable_under_only_bhp_limit = false;
}
// checking whether running under BHP limit will violate THP limit