adjusting OperabilityStatus of WellInterface

hopefully, it improves the readability
This commit is contained in:
Kai Bao 2018-11-18 15:08:17 +01:00
parent bf9b5367d9
commit 8330c3a6a7
3 changed files with 28 additions and 26 deletions

View File

@ -1326,8 +1326,9 @@ namespace Opm
checkOperabilityUnderTHPLimitProducer(ebos_simulator);
}
// checking whether the well can not produce or something else
this->operability_status_.negative_well_rates = allDrawDownWrongDirection(ebos_simulator);
// checking whether the well can not produce/inject
this->operability_status_.existing_drawdown_correct_direction =
! allDrawDownWrongDirection(ebos_simulator);
const bool well_operable = this->operability_status_.isOperable();
@ -1365,7 +1366,7 @@ namespace Opm
if (this->operability_status_.operable_under_only_bhp_limit && this->wellHasTHPConstraints()) {
// option 1: calculate well rates based on the BHP limit.
// option 2: stick with the above IPR curve
// TODO: most likely, we can use IPR here
// we use IPR here
const double bhp_limit = mostStrictBhpFromBhpLimits();
std::vector<double> well_rates_bhp_limit;
computeWellRatesWithBhp(ebos_simulator, bhp_limit, well_rates_bhp_limit);
@ -1373,8 +1374,8 @@ namespace Opm
const double thp = calculateThpFromBhp(well_rates_bhp_limit, bhp_limit);
const double thp_limit = this->getTHPConstraint();
if (thp < thp_limit || thp > bhp_limit) {
this->operability_status_.violate_thp_limit_under_bhp_limit = true;
if (thp < thp_limit) {
this->operability_status_.obey_thp_limit_under_bhp_limit = false;
}
}
} else {
@ -1386,7 +1387,7 @@ namespace Opm
// we assume we can operate under thi BHP limit and will violate the THP limit
// when operating under this BHP limit
this->operability_status_.operable_under_only_bhp_limit = true;
this->operability_status_.violate_thp_limit_under_bhp_limit = true;
this->operability_status_.obey_thp_limit_under_bhp_limit = false;
}
}
@ -1415,7 +1416,7 @@ namespace Opm
vfp_properties_->getProd()->operabilityCheckingUnderTHP(ipr_a_, ipr_b_, bhp_limit,
table_id, thp_limit, alq, dp,
this->operability_status_.obtain_solution_with_thp_limit,
this->operability_status_.violate_bhp_limit_with_thp_limit );
this->operability_status_.obey_bhp_limit_with_thp_limit );
}

View File

@ -263,14 +263,14 @@ operabilityCheckingUnderTHP(const std::vector<double>& ipr_a,
const double alq,
const double dp,
bool& obtain_solution_with_thp_limit,
bool& violate_bhp_limit_with_thp_limit) const
bool& obey_bhp_limit_with_thp_limit) const
{
const double obtain_bhp = calculateBhpWithTHPTarget(ipr_a, ipr_b, bhp_limit, thp_table_id, thp_limit, alq, dp);
if (obtain_bhp > 0.) {
obtain_solution_with_thp_limit = true;
violate_bhp_limit_with_thp_limit = (obtain_bhp < bhp_limit);
obey_bhp_limit_with_thp_limit = (obtain_bhp >= bhp_limit);
if (obtain_bhp < thp_limit) {
const std::string msg = " obtained bhp " + std::to_string(obtain_bhp / 1.e5) +
@ -282,7 +282,7 @@ operabilityCheckingUnderTHP(const std::vector<double>& ipr_a,
obtain_solution_with_thp_limit = false;
OpmLog::debug(" COULD NOT find bhp value under thp_limit " + std::to_string(thp_limit / 1.e5) +
", the well might need to be closed ");
violate_bhp_limit_with_thp_limit = false;
obey_bhp_limit_with_thp_limit = true;
}
}

View File

@ -391,45 +391,46 @@ namespace Opm
if (!operable_under_only_bhp_limit) {
return false;
} else {
return !negative_well_rates && (isOperableUnderBHPLimit() || isOperableUnderTHPLimit());
return existing_drawdown_correct_direction &&
(isOperableUnderBHPLimit() || isOperableUnderTHPLimit());
}
}
bool isOperableUnderBHPLimit() const {
return operable_under_only_bhp_limit && !violate_thp_limit_under_bhp_limit;
return operable_under_only_bhp_limit && obey_thp_limit_under_bhp_limit;
}
bool isOperableUnderTHPLimit() const {
return obtain_solution_with_thp_limit && !violate_bhp_limit_with_thp_limit;
return obtain_solution_with_thp_limit && obey_bhp_limit_with_thp_limit;
}
void reset() {
operable_under_only_bhp_limit = true;
violate_thp_limit_under_bhp_limit = false;
obey_thp_limit_under_bhp_limit = true;
obtain_solution_with_thp_limit = true;
violate_bhp_limit_with_thp_limit = false;
obey_bhp_limit_with_thp_limit = true;
// TODO: the following one might need to be treated differently
negative_well_rates = false;
existing_drawdown_correct_direction = true;
}
// TODO: re-design the boolean variables so that they have meaning in the same directions.
// For example, true are all for positive situation, and false are all for negative circumstances.
// whether the well can be operated under bhp limit
// without considering other limits.
// if it is false, then the well is not operable for sure.
bool operable_under_only_bhp_limit = true;
// if the well can be operated under bhp limit, will it violate
// if the well can be operated under bhp limit, will it obey(not violate)
// the thp limit when operated under bhp limit
bool violate_thp_limit_under_bhp_limit = false;
bool obey_thp_limit_under_bhp_limit = true;
// whether the well operate under the thp limit only
bool obtain_solution_with_thp_limit = true;
// whether the well violate bhp limit when operated under thp limit
bool violate_bhp_limit_with_thp_limit = false;
// whether the well obey bhp limit when operated under thp limit
bool obey_bhp_limit_with_thp_limit = true;
// we get negatvie well rates
// currently, we are trying to address the one result from updateWellStateWithTHPTargetIPR
bool negative_well_rates = false;
// there is some drawdown with correct sign/direction
// if all the drawdown are with wrong sign/direction, it means producer can not produce
// and injector can not inject.
// TODO: even not all the drawdown are with wrong sign, it is still possible that
// producer can not produce and injector can not inject if the crossflow is allowed
bool existing_drawdown_correct_direction = true;
// could not get converged, maybe at the end of the time step, after chopping for some steps.
// TODO: the best way is that this well can not get converged during local iterations.