23 #ifndef OPM_STANDARDWELL_EVAL_HEADER_INCLUDED
24 #define OPM_STANDARDWELL_EVAL_HEADER_INCLUDED
26 #include <opm/simulators/wells/StandardWellGeneric.hpp>
28 #include <opm/material/densead/DynamicEvaluation.hpp>
36 class ConvergenceReport;
41 class WellContributions;
42 template<
class Flu
idSystem,
class Indices,
class Scalar>
class WellInterfaceIndices;
45 template<
class Flu
idSystem,
class Indices,
class Scalar>
50 static constexpr
int numWellConservationEq = Indices::numPhases + Indices::numSolvents;
52 static constexpr
int numWellControlEq = 1;
55 static constexpr
int numStaticWellEq = numWellConservationEq + numWellControlEq;
59 static constexpr
int Bhp = numStaticWellEq - numWellControlEq;
79 static const int WQTotal = 0;
84 static const bool waterEnabled = Indices::waterEnabled;
85 static const bool gasEnabled = Indices::gasEnabled;
86 static const bool oilEnabled = Indices::oilEnabled;
88 static constexpr
bool has_wfrac_variable = Indices::waterEnabled && Indices::oilEnabled;
89 static constexpr
bool has_gfrac_variable = Indices::gasEnabled && Indices::numPhases > 1;
90 static constexpr
int WFrac = has_wfrac_variable ? 1 : -1000;
91 static constexpr
int GFrac = has_gfrac_variable ? has_wfrac_variable + 1 : -1000;
92 static constexpr
int SFrac = !Indices::enableSolvent ? -1000 : 3;
95 using EvalWell = DenseAd::DynamicEvaluation<Scalar, numStaticWellEq + Indices::numEq + 1>;
96 using Eval = DenseAd::Evaluation<Scalar, Indices::numEq>;
97 using BVectorWell =
typename StandardWellGeneric<Scalar>::BVectorWell;
107 void initPrimaryVariablesEvaluation()
const;
109 const EvalWell& getBhp()
const
111 return primary_variables_evaluation_[Bhp];
114 const EvalWell& getWQTotal()
const
116 return primary_variables_evaluation_[WQTotal];
119 EvalWell extendEval(
const Eval& in)
const;
120 EvalWell getQs(
const int compIdx)
const;
121 EvalWell wellSurfaceVolumeFraction(
const int compIdx)
const;
122 EvalWell wellVolumeFraction(
const unsigned compIdx)
const;
123 EvalWell wellVolumeFractionScaled(
const int phase)
const;
127 static double relaxationFactorFractionsProducer(
const std::vector<double>& primary_variables,
128 const BVectorWell& dwells);
130 void assembleControlEq(
const WellState& well_state,
132 const Schedule& schedule,
133 const SummaryState& summaryState,
137 void computeAccumWell();
141 void computeConnectionDensities(
const std::vector<double>& perfComponentRates,
142 const std::vector<double>& b_perf,
143 const std::vector<double>& rsmax_perf,
144 const std::vector<double>& rvmax_perf,
145 const std::vector<double>& rvwmax_perf,
146 const std::vector<double>& surf_dens_perf,
150 const std::vector<double>& B_avg,
151 const double maxResidualAllowed,
152 const double tol_wells,
153 const double relaxed_tolerance_flow,
154 const bool relax_tolerance,
155 std::vector<double>& res,
158 void init(std::vector<double>& perf_depth,
159 const std::vector<double>& depth_arg,
161 const bool has_polymermw);
164 void processFractions()
const;
166 void updatePrimaryVariables(
const WellState& well_state,
169 void updatePrimaryVariablesPolyMW(
const BVectorWell& dwells)
const;
171 void updateWellStateFromPrimaryVariables(
WellState& well_state,
174 void updatePrimaryVariablesNewton(
const BVectorWell& dwells,
175 const double dFLimit,
176 const double dBHPLimit)
const;
178 void updateWellStateFromPrimaryVariablesPolyMW(
WellState& well_state)
const;
185 int numWellEq_ = numStaticWellEq;
189 mutable std::vector<double> primary_variables_;
192 mutable std::vector<EvalWell> primary_variables_evaluation_;
195 std::vector<double> F0_;
Represents the convergence status of the whole simulator, to make it possible to query and store the ...
Definition: ConvergenceReport.hpp:36
Definition: DeferredLogger.hpp:57
Definition: GroupState.hpp:34
Definition: StandardWellEval.hpp:47
void addWellContribution(WellContributions &wellContribs) const
add the contribution (C, D^-1, B matrices) of this Well to the WellContributions object
Definition: StandardWellEval.cpp:1120
Definition: StandardWellGeneric.hpp:50
This class serves to eliminate the need to include the WellContributions into the matrix (with –matri...
Definition: WellContributions.hpp:53
Definition: WellInterfaceIndices.hpp:35
The state of a set of wells, tailored for use by the fully implicit blackoil simulator.
Definition: WellState.hpp:56
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition: BlackoilPhases.hpp:27