Make consistent use of const for alq-related state.

A const well state was passed to functions that were modifying it by
calling setALQ(). Now the setALQ() method is made non-const, mutable
references to the well state are passed where sensible. The getALQ()
method uses map::at() instead of map::operator[] and no longer modifies
current_alq_. With this, it is now easy to see which methods modify the
well state and which don't. The alq-related members in the
WellStateFullyImplicitBlackoil class are no longer 'mutable'-qualified.
This commit is contained in:
Atgeirr Flø Rasmussen 2020-11-19 10:09:52 +01:00
parent 0ac2f922d3
commit 8a5203814b
7 changed files with 15 additions and 25 deletions

View File

@ -67,7 +67,7 @@ namespace Opm
const Simulator &ebos_simulator,
const SummaryState &summary_state,
DeferredLogger &deferred_logger,
const WellState &well_state,
WellState &well_state,
const Well::ProductionControls &controls
);
void runOptimize();
@ -97,7 +97,7 @@ namespace Opm
std::vector<double> potentials_;
const StdWell &std_well_;
const SummaryState &summary_state_;
const WellState &well_state_;
WellState &well_state_;
std::string well_name_;
bool debug; // extra debug output

View File

@ -35,7 +35,7 @@ GasLiftRuntime(
const Simulator &ebos_simulator,
const SummaryState &summary_state,
DeferredLogger &deferred_logger,
const WellState &well_state,
WellState &well_state,
const Well::ProductionControls &controls
) :
controls_{controls},

View File

@ -116,7 +116,7 @@ namespace Opm
virtual void initPrimaryVariablesEvaluation() const override;
virtual void maybeDoGasLiftOptimization (
const WellState&,
WellState&,
const Simulator&,
DeferredLogger&
) const override {

View File

@ -248,7 +248,7 @@ namespace Opm
) const;
virtual void maybeDoGasLiftOptimization (
const WellState& well_state,
WellState& well_state,
const Simulator& ebosSimulator,
DeferredLogger& deferred_logger
) const override;

View File

@ -2822,7 +2822,7 @@ namespace Opm
void
StandardWell<TypeTag>::
maybeDoGasLiftOptimization(
const WellState& well_state,
WellState& well_state,
const Simulator& ebos_simulator,
Opm::DeferredLogger& deferred_logger) const
{

View File

@ -171,7 +171,7 @@ namespace Opm
) = 0;
virtual void maybeDoGasLiftOptimization (
const WellState& well_state,
WellState& well_state,
const Simulator& ebosSimulator,
DeferredLogger& deferred_logger
) const = 0;

View File

@ -1135,25 +1135,15 @@ namespace Opm
return globalIsProductionGrup_[it->second] != 0;
}
void updateALQ( const WellStateFullyImplicitBlackoil &copy ) const
{
this->current_alq_ = copy.getCurrentALQ();
}
std::map<std::string, double> getCurrentALQ() const
{
return current_alq_;
}
double getALQ( const std::string& name) const
{
if (this->current_alq_.count(name) == 0) {
this->current_alq_[name] = this->default_alq_[name];
return this->default_alq_.at(name);
}
return this->current_alq_[name];
return this->current_alq_.at(name);
}
void setALQ( const std::string& name, double value) const
void setALQ( const std::string& name, double value)
{
this->current_alq_[name] = value;
}
@ -1162,11 +1152,11 @@ namespace Opm
return do_glift_optimization_;
}
void disableGliftOptimization() const {
void disableGliftOptimization() {
do_glift_optimization_ = false;
}
void enableGliftOptimization() const {
void enableGliftOptimization() {
do_glift_optimization_ = true;
}
@ -1197,9 +1187,9 @@ namespace Opm
std::map<std::string, double> injection_group_vrep_rates;
std::map<std::string, std::vector<double>> injection_group_rein_rates;
std::map<std::string, double> group_grat_target_from_sales;
mutable std::map<std::string, double> current_alq_;
mutable std::map<std::string, double> default_alq_;
mutable bool do_glift_optimization_;
std::map<std::string, double> current_alq_;
std::map<std::string, double> default_alq_;
bool do_glift_optimization_;
std::vector<double> perfRateSolvent_;