mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Merge pull request #4331 from akva2/msw_avoid_mutable
MultisegmentWell: avoid mutable primary variables
This commit is contained in:
@@ -185,7 +185,7 @@ namespace Opm
|
|||||||
void updateWellState(const BVectorWell& dwells,
|
void updateWellState(const BVectorWell& dwells,
|
||||||
WellState& well_state,
|
WellState& well_state,
|
||||||
DeferredLogger& deferred_logger,
|
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
|
// computing the accumulation term for later use in well mass equations
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ initMatrixAndVectors(const int num_cells)
|
|||||||
template<typename FluidSystem, typename Indices, typename Scalar>
|
template<typename FluidSystem, typename Indices, typename Scalar>
|
||||||
void
|
void
|
||||||
MultisegmentWellEval<FluidSystem,Indices,Scalar>::
|
MultisegmentWellEval<FluidSystem,Indices,Scalar>::
|
||||||
initPrimaryVariablesEvaluation() const
|
initPrimaryVariablesEvaluation()
|
||||||
{
|
{
|
||||||
for (int seg = 0; seg < this->numberOfSegments(); ++seg) {
|
for (int seg = 0; seg < this->numberOfSegments(); ++seg) {
|
||||||
for (int eq_idx = 0; eq_idx < numWellEq; ++eq_idx) {
|
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>
|
template<typename FluidSystem, typename Indices, typename Scalar>
|
||||||
void
|
void
|
||||||
MultisegmentWellEval<FluidSystem,Indices,Scalar>::
|
MultisegmentWellEval<FluidSystem,Indices,Scalar>::
|
||||||
processFractions(const int seg) const
|
processFractions(const int seg)
|
||||||
{
|
{
|
||||||
static constexpr int Water = BlackoilPhases::Aqua;
|
static constexpr int Water = BlackoilPhases::Aqua;
|
||||||
static constexpr int Oil = BlackoilPhases::Liquid;
|
static constexpr int Oil = BlackoilPhases::Liquid;
|
||||||
@@ -261,7 +261,7 @@ MultisegmentWellEval<FluidSystem,Indices,Scalar>::
|
|||||||
updatePrimaryVariablesNewton(const BVectorWell& dwells,
|
updatePrimaryVariablesNewton(const BVectorWell& dwells,
|
||||||
const double relaxation_factor,
|
const double relaxation_factor,
|
||||||
const double dFLimit,
|
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_;
|
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>
|
template<typename FluidSystem, typename Indices, typename Scalar>
|
||||||
void
|
void
|
||||||
MultisegmentWellEval<FluidSystem,Indices,Scalar>::
|
MultisegmentWellEval<FluidSystem,Indices,Scalar>::
|
||||||
updatePrimaryVariables(const WellState& well_state) const
|
updatePrimaryVariables(const WellState& well_state)
|
||||||
{
|
{
|
||||||
static constexpr int Water = BlackoilPhases::Aqua;
|
static constexpr int Water = BlackoilPhases::Aqua;
|
||||||
static constexpr int Gas = BlackoilPhases::Vapour;
|
static constexpr int Gas = BlackoilPhases::Vapour;
|
||||||
|
|||||||
@@ -103,12 +103,11 @@ protected:
|
|||||||
MultisegmentWellEval(WellInterfaceIndices<FluidSystem,Indices,Scalar>& baseif);
|
MultisegmentWellEval(WellInterfaceIndices<FluidSystem,Indices,Scalar>& baseif);
|
||||||
|
|
||||||
void initMatrixAndVectors(const int num_cells);
|
void initMatrixAndVectors(const int num_cells);
|
||||||
void initPrimaryVariablesEvaluation() const;
|
void initPrimaryVariablesEvaluation();
|
||||||
|
|
||||||
void assembleDefaultPressureEq(const int seg,
|
void assembleDefaultPressureEq(const int seg,
|
||||||
WellState& well_state);
|
WellState& well_state);
|
||||||
|
|
||||||
|
|
||||||
// assemble pressure equation for ICD segments
|
// assemble pressure equation for ICD segments
|
||||||
void assembleICDPressureEq(const int seg,
|
void assembleICDPressureEq(const int seg,
|
||||||
const UnitSystem& unit_system,
|
const UnitSystem& unit_system,
|
||||||
@@ -133,9 +132,9 @@ protected:
|
|||||||
const bool relax_tolerance) const;
|
const bool relax_tolerance) const;
|
||||||
|
|
||||||
// handling the overshooting and undershooting of the fractions
|
// 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();
|
void updateUpwindingSegments();
|
||||||
|
|
||||||
@@ -143,7 +142,7 @@ protected:
|
|||||||
void updatePrimaryVariablesNewton(const BVectorWell& dwells,
|
void updatePrimaryVariablesNewton(const BVectorWell& dwells,
|
||||||
const double relaxation_factor,
|
const double relaxation_factor,
|
||||||
const double DFLimit,
|
const double DFLimit,
|
||||||
const double max_pressure_change) const;
|
const double max_pressure_change);
|
||||||
|
|
||||||
void computeSegmentFluidProperties(const EvalWell& temperature,
|
void computeSegmentFluidProperties(const EvalWell& temperature,
|
||||||
const EvalWell& saltConcentration,
|
const EvalWell& saltConcentration,
|
||||||
@@ -220,10 +219,10 @@ protected:
|
|||||||
|
|
||||||
// the values for the primary varibles
|
// the values for the primary varibles
|
||||||
// based on different solutioin strategies, the wells can have different primary variables
|
// 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
|
// 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
|
// the upwinding segment for each segment based on the flow direction
|
||||||
std::vector<int> upwinding_segments_;
|
std::vector<int> upwinding_segments_;
|
||||||
|
|||||||
@@ -610,7 +610,7 @@ namespace Opm
|
|||||||
updateWellState(const BVectorWell& dwells,
|
updateWellState(const BVectorWell& dwells,
|
||||||
WellState& well_state,
|
WellState& well_state,
|
||||||
DeferredLogger& deferred_logger,
|
DeferredLogger& deferred_logger,
|
||||||
const double relaxation_factor) const
|
const double relaxation_factor)
|
||||||
{
|
{
|
||||||
if (!this->isOperableAndSolvable() && !this->wellIsStopped()) return;
|
if (!this->isOperableAndSolvable() && !this->wellIsStopped()) return;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user