Merge pull request #5696 from totto82/speedup_gaslift

Dont iterate when computing bhp from thp for computing of the well potentials for gaslift optimization
This commit is contained in:
Kai Bao 2024-11-06 14:46:24 +01:00 committed by GitHub
commit dd0fbbdede
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 23 additions and 10 deletions

View File

@ -143,7 +143,8 @@ computeBhpAtThpLimit_(Scalar alq, bool debug_output) const
this->simulator_,
this->summary_state_,
alq,
this->deferred_logger_);
this->deferred_logger_,
/*iterate_if_no_solution */ false);
if (bhp_at_thp_limit) {
if (*bhp_at_thp_limit < this->controls_.bhp_limit) {
if (debug_output && this->debug) {

View File

@ -157,7 +157,8 @@ namespace Opm {
computeBhpAtThpLimitProdWithAlq(const Simulator& simulator,
const SummaryState& summary_state,
const Scalar alq_value,
DeferredLogger& deferred_logger) const override;
DeferredLogger& deferred_logger,
bool iterate_if_no_solution) const override;
std::vector<Scalar> getPrimaryVars() const override;

View File

@ -2042,7 +2042,8 @@ namespace Opm
simulator,
summary_state,
this->getALQ(well_state),
deferred_logger);
deferred_logger,
/*iterate_if_no_solution */ true);
}
@ -2053,7 +2054,8 @@ namespace Opm
computeBhpAtThpLimitProdWithAlq(const Simulator& simulator,
const SummaryState& summary_state,
const Scalar alq_value,
DeferredLogger& deferred_logger) const
DeferredLogger& deferred_logger,
bool iterate_if_no_solution) const
{
// Make the frates() function.
auto frates = [this, &simulator, &deferred_logger](const Scalar bhp) {
@ -2079,6 +2081,9 @@ namespace Opm
if (bhpAtLimit)
return bhpAtLimit;
if (!iterate_if_no_solution)
return std::nullopt;
auto fratesIter = [this, &simulator, &deferred_logger](const Scalar bhp) {
// Solver the well iterations to see if we are
// able to get a solution with an update

View File

@ -234,7 +234,8 @@ namespace Opm
computeBhpAtThpLimitProdWithAlq(const Simulator& ebos_simulator,
const SummaryState& summary_state,
const Scalar alq_value,
DeferredLogger& deferred_logger) const override;
DeferredLogger& deferred_logger,
bool iterate_if_no_solution) const override;
void updateIPRImplicit(const Simulator& simulator,
WellState<Scalar>& well_state,

View File

@ -1699,7 +1699,7 @@ namespace Opm
{
Scalar bhp;
auto bhp_at_thp_limit = computeBhpAtThpLimitProdWithAlq(
simulator, summary_state, alq, deferred_logger);
simulator, summary_state, alq, deferred_logger, /*iterate_if_no_solution */ true);
if (bhp_at_thp_limit) {
const auto& controls = this->well_ecl_.productionControls(summary_state);
bhp = std::max(*bhp_at_thp_limit,
@ -2213,7 +2213,8 @@ namespace Opm
return computeBhpAtThpLimitProdWithAlq(simulator,
summary_state,
this->getALQ(well_state),
deferred_logger);
deferred_logger,
/*iterate_if_no_solution */ true);
}
template<typename TypeTag>
@ -2222,7 +2223,8 @@ namespace Opm
computeBhpAtThpLimitProdWithAlq(const Simulator& simulator,
const SummaryState& summary_state,
const Scalar alq_value,
DeferredLogger& deferred_logger) const
DeferredLogger& deferred_logger,
bool iterate_if_no_solution) const
{
// Make the frates() function.
auto frates = [this, &simulator, &deferred_logger](const Scalar bhp) {
@ -2260,6 +2262,8 @@ namespace Opm
}
}
if (!iterate_if_no_solution)
return std::nullopt;
auto fratesIter = [this, &simulator, &deferred_logger](const Scalar bhp) {
// Solver the well iterations to see if we are

View File

@ -190,7 +190,8 @@ public:
computeBhpAtThpLimitProdWithAlq(const Simulator& ebos_simulator,
const SummaryState& summary_state,
const Scalar alq_value,
DeferredLogger& deferred_logger) const = 0;
DeferredLogger& deferred_logger,
bool iterate_if_no_solution) const = 0;
/// using the solution x to recover the solution xw for wells and applying
/// xw to update Well State

View File

@ -1886,7 +1886,7 @@ namespace Opm
const auto& summary_state = simulator.vanguard().summaryState();
auto bhp_at_thp_limit = computeBhpAtThpLimitProdWithAlq(
simulator, summary_state, this->getALQ(well_state), deferred_logger);
simulator, summary_state, this->getALQ(well_state), deferred_logger, /*iterate_if_no_solution */ true);
if (bhp_at_thp_limit) {
std::vector<Scalar> rates(this->number_of_phases_, 0.0);
if (thp_update_iterations) {