Merge pull request #4331 from akva2/msw_avoid_mutable

MultisegmentWell: avoid mutable primary variables
This commit is contained in:
Bård Skaflestad 2022-12-19 12:34:13 +01:00 committed by GitHub
commit c50cdc2454
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 13 deletions

View File

@ -185,7 +185,7 @@ namespace Opm
void updateWellState(const BVectorWell& dwells,
WellState& well_state,
DeferredLogger& deferred_logger,
const double relaxation_factor=1.0) const;
const double relaxation_factor = 1.0);
// computing the accumulation term for later use in well mass equations

View File

@ -83,7 +83,7 @@ initMatrixAndVectors(const int num_cells)
template<typename FluidSystem, typename Indices, typename Scalar>
void
MultisegmentWellEval<FluidSystem,Indices,Scalar>::
initPrimaryVariablesEvaluation() const
initPrimaryVariablesEvaluation()
{
for (int seg = 0; seg < this->numberOfSegments(); ++seg) {
for (int eq_idx = 0; eq_idx < numWellEq; ++eq_idx) {
@ -188,7 +188,7 @@ getWellConvergence(const WellState& well_state,
template<typename FluidSystem, typename Indices, typename Scalar>
void
MultisegmentWellEval<FluidSystem,Indices,Scalar>::
processFractions(const int seg) const
processFractions(const int seg)
{
static constexpr int Water = BlackoilPhases::Aqua;
static constexpr int Oil = BlackoilPhases::Liquid;
@ -261,7 +261,7 @@ MultisegmentWellEval<FluidSystem,Indices,Scalar>::
updatePrimaryVariablesNewton(const BVectorWell& dwells,
const double relaxation_factor,
const double dFLimit,
const double max_pressure_change) const
const double max_pressure_change)
{
const std::vector<std::array<double, numWellEq> > old_primary_variables = primary_variables_;
@ -307,7 +307,7 @@ updatePrimaryVariablesNewton(const BVectorWell& dwells,
template<typename FluidSystem, typename Indices, typename Scalar>
void
MultisegmentWellEval<FluidSystem,Indices,Scalar>::
updatePrimaryVariables(const WellState& well_state) const
updatePrimaryVariables(const WellState& well_state)
{
static constexpr int Water = BlackoilPhases::Aqua;
static constexpr int Gas = BlackoilPhases::Vapour;

View File

@ -103,12 +103,11 @@ protected:
MultisegmentWellEval(WellInterfaceIndices<FluidSystem,Indices,Scalar>& baseif);
void initMatrixAndVectors(const int num_cells);
void initPrimaryVariablesEvaluation() const;
void initPrimaryVariablesEvaluation();
void assembleDefaultPressureEq(const int seg,
WellState& well_state);
// assemble pressure equation for ICD segments
void assembleICDPressureEq(const int seg,
const UnitSystem& unit_system,
@ -133,9 +132,9 @@ protected:
const bool relax_tolerance) const;
// handling the overshooting and undershooting of the fractions
void processFractions(const int seg) const;
void processFractions(const int seg);
void updatePrimaryVariables(const WellState& well_state) const;
void updatePrimaryVariables(const WellState& well_state);
void updateUpwindingSegments();
@ -143,7 +142,7 @@ protected:
void updatePrimaryVariablesNewton(const BVectorWell& dwells,
const double relaxation_factor,
const double DFLimit,
const double max_pressure_change) const;
const double max_pressure_change);
void computeSegmentFluidProperties(const EvalWell& temperature,
const EvalWell& saltConcentration,
@ -220,10 +219,10 @@ protected:
// the values for the primary varibles
// based on different solutioin strategies, the wells can have different primary variables
mutable std::vector<std::array<double, numWellEq> > primary_variables_;
std::vector<std::array<double, numWellEq> > primary_variables_;
// the Evaluation for the well primary variables, which contain derivativles and are used in AD calculation
mutable std::vector<std::array<EvalWell, numWellEq> > primary_variables_evaluation_;
std::vector<std::array<EvalWell, numWellEq> > primary_variables_evaluation_;
// the upwinding segment for each segment based on the flow direction
std::vector<int> upwinding_segments_;

View File

@ -610,7 +610,7 @@ namespace Opm
updateWellState(const BVectorWell& dwells,
WellState& well_state,
DeferredLogger& deferred_logger,
const double relaxation_factor) const
const double relaxation_factor)
{
if (!this->isOperableAndSolvable() && !this->wellIsStopped()) return;