23#ifndef OPM_STANDARDWELL_PRIMARY_VARIABLES_HEADER_INCLUDED
24#define OPM_STANDARDWELL_PRIMARY_VARIABLES_HEADER_INCLUDED
26#include <opm/material/densead/Evaluation.hpp>
28#include <opm/simulators/wells/StandardWellEquations.hpp>
38template<
typename Scalar,
typename IndexTraits>
class WellState;
41template<
class Flu
idSystem,
class Indices>
80 static constexpr bool has_wfrac_variable = Indices::waterEnabled && Indices::oilEnabled;
81 static constexpr bool has_gfrac_variable = Indices::gasEnabled && Indices::numPhases > 1;
82 static constexpr int WFrac = has_wfrac_variable ? 1 : -1000;
83 static constexpr int GFrac = has_gfrac_variable ? has_wfrac_variable + 1 : -1000;
84 static constexpr int SFrac = !Indices::enableSolvent ? -1000 : has_wfrac_variable+has_gfrac_variable+1;
86 using Scalar =
typename FluidSystem::Scalar;
87 using IndexTraits =
typename FluidSystem::IndexTraitsType;
89 using EvalWell = DenseAd::DynamicEvaluation<Scalar, numStaticWellEq + Indices::numEq + 1>;
90 using BVectorWell =
typename StandardWellEquations<Scalar, IndexTraits, Indices::numEq>::BVectorWell;
105 const bool stop_or_zero_rate_target,
113 const bool stop_or_zero_rate_target,
114 const Scalar dFLimit,
115 const Scalar dBHPLimit,
142 {
return value_[idx]; }
146 {
return evaluation_[idx]; }
150 { value_[idx] = val; }
154 void setEvaluationsFromValues();
158 Scalar relaxationFactorFractionsProducer(
const BVectorWell& dwells,
162 EvalWell volumeFraction(
const int compIdx)
const;
165 void processFractions();
169 std::vector<Scalar> value_;
173 std::vector<EvalWell> evaluation_;
Definition DeferredLogger.hpp:57
void updateNewtonPolyMW(const BVectorWell &dwells)
Update polymer molecular weight values from newton update vector.
Definition StandardWellPrimaryVariables.cpp:325
EvalWell surfaceVolumeFraction(const int compIdx) const
Returns surface volume fraction for a component.
Definition StandardWellPrimaryVariables.cpp:521
int numWellEq() const
Returns number of well equations.
Definition StandardWellPrimaryVariables.hpp:101
void resize(const int numWellEq)
Resize values and evaluations.
Definition StandardWellPrimaryVariables.cpp:115
DenseAd::DynamicEvaluation< Scalar, numStaticWellEq+Indices::numEq+1 > EvalWell
Evaluation for the well equations.
Definition StandardWellPrimaryVariables.hpp:89
Scalar value(const int idx) const
Returns a value.
Definition StandardWellPrimaryVariables.hpp:141
void updateNewton(const BVectorWell &dwells, const bool stop_or_zero_rate_target, const Scalar dFLimit, const Scalar dBHPLimit, DeferredLogger &deferred_logger)
Update values from newton update vector.
Definition StandardWellPrimaryVariables.cpp:262
static constexpr int numWellControlEq
Number of the well control equations.
Definition StandardWellPrimaryVariables.hpp:63
void update(const WellState< Scalar, IndexTraits > &well_state, const bool stop_or_zero_rate_target, DeferredLogger &deferred_logger)
Copy values from well state.
Definition StandardWellPrimaryVariables.cpp:124
static constexpr int WQTotal
The index for the weighted total rate.
Definition StandardWellPrimaryVariables.hpp:73
void updatePolyMW(const WellState< Scalar, IndexTraits > &well_state)
Copy polymer molecular weigt values from well state.
Definition StandardWellPrimaryVariables.cpp:245
const EvalWell & eval(const int idx) const
Returns a const ref to an evaluation.
Definition StandardWellPrimaryVariables.hpp:145
static constexpr int numStaticWellEq
Number of the well equations that will always be used.
Definition StandardWellPrimaryVariables.hpp:71
EvalWell getQs(const int compIdx) const
Returns scaled rate for a component.
Definition StandardWellPrimaryVariables.cpp:536
void setValue(const int idx, const Scalar val)
Set a value. Note that this does not also set the corresponding evaluation.
Definition StandardWellPrimaryVariables.hpp:149
void copyToWellState(WellState< Scalar, IndexTraits > &well_state, DeferredLogger &deferred_logger) const
Copy values to well state.
Definition StandardWellPrimaryVariables.cpp:345
EvalWell volumeFractionScaled(const int compIdx) const
Returns scaled volume fraction for a component.
Definition StandardWellPrimaryVariables.cpp:507
static constexpr int numWellConservationEq
Number of the conservation equations.
Definition StandardWellPrimaryVariables.hpp:67
void checkFinite(DeferredLogger &deferred_logger, std::string_view context) const
Check that all values are finite.
Definition StandardWellPrimaryVariables.cpp:753
StandardWellPrimaryVariables(const WellInterfaceIndices< FluidSystem, Indices > &well)
Constructor initializes reference to well interface.
Definition StandardWellPrimaryVariables.hpp:93
static constexpr int Bhp
The index for Bhp in primary variables and the index of well control equation.
Definition StandardWellPrimaryVariables.hpp:78
void copyToWellStatePolyMW(WellState< Scalar, IndexTraits > &well_state) const
Copy polymer molecular weight values to well state.
Definition StandardWellPrimaryVariables.cpp:453
Definition WellInterfaceIndices.hpp:34
The state of a set of wells, tailored for use by the fully implicit blackoil simulator.
Definition WellState.hpp:66
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition blackoilbioeffectsmodules.hh:45