26 #ifndef EWOMS_BLACK_OIL_LOCAL_RESIDUAL_HH
27 #define EWOMS_BLACK_OIL_LOCAL_RESIDUAL_HH
37 template <
class TypeTag>
40 typedef typename GET_PROP_TYPE(TypeTag, IntensiveQuantities) IntensiveQuantities;
41 typedef typename GET_PROP_TYPE(TypeTag, ExtensiveQuantities) ExtensiveQuantities;
42 typedef typename GET_PROP_TYPE(TypeTag, ElementContext) ElementContext;
43 typedef typename GET_PROP_TYPE(TypeTag, Indices) Indices;
44 typedef typename GET_PROP_TYPE(TypeTag, Evaluation) Evaluation;
45 typedef typename GET_PROP_TYPE(TypeTag, EqVector) EqVector;
46 typedef typename GET_PROP_TYPE(TypeTag, RateVector) RateVector;
48 enum { conti0EqIdx = Indices::conti0EqIdx };
53 typedef Opm::MathToolbox<Evaluation> Toolbox;
59 template <
class LhsEval>
61 const ElementContext &elemCtx,
66 typedef Opm::MathToolbox<LhsEval> LhsToolbox;
70 const IntensiveQuantities &intQuants = elemCtx.intensiveQuantities(dofIdx, timeIdx);
72 for (
int eqIdx = 0; eqIdx < numEq; ++eqIdx)
75 for (
int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
76 for (
int compIdx = 0; compIdx < numComponents; ++compIdx) {
77 storage[conti0EqIdx + compIdx] +=
78 Toolbox::template toLhs<LhsEval>(intQuants.porosity())
79 * Toolbox::template toLhs<LhsEval>(intQuants.fluidState().saturation(phaseIdx))
80 * Toolbox::template toLhs<LhsEval>(intQuants.fluidState().molarity(phaseIdx, compIdx));
81 assert(std::isfinite(LhsToolbox::value(storage[conti0EqIdx + compIdx])));
90 const ElementContext &elemCtx,
96 const ExtensiveQuantities &extQuants = elemCtx.extensiveQuantities(scvfIdx, timeIdx);
98 for (
int eqIdx=0; eqIdx < numEq; eqIdx++)
101 int interiorIdx = extQuants.interiorIndex();
102 for (
int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
103 int upIdx = extQuants.upstreamIndex(phaseIdx);
104 const IntensiveQuantities &up = elemCtx.intensiveQuantities(upIdx, 0);
109 if (upIdx == interiorIdx) {
111 up.fluidState().molarDensity(phaseIdx)
112 * extQuants.volumeFlux(phaseIdx);
114 for (
int compIdx = 0; compIdx < numComponents; ++compIdx) {
115 flux[conti0EqIdx + compIdx] +=
116 tmp*up.fluidState().moleFraction(phaseIdx, compIdx);
121 Toolbox::value(up.fluidState().molarDensity(phaseIdx))
122 * extQuants.volumeFlux(phaseIdx);
124 for (
int compIdx = 0; compIdx < numComponents; ++compIdx) {
125 flux[conti0EqIdx + compIdx] +=
126 tmp*Toolbox::value(up.fluidState().moleFraction(phaseIdx, compIdx));
136 const ElementContext &elemCtx,
141 elemCtx.problem().source(source, elemCtx, dofIdx, timeIdx);
Calculates the local residual of the black oil model.
Definition: blackoillocalresidual.hh:38
void computeFlux(RateVector &flux, const ElementContext &elemCtx, int scvfIdx, int timeIdx) const
Evaluates the total mass flux of all conservation quantities over a face of a sub-control volume...
Definition: blackoillocalresidual.hh:89
#define GET_PROP_VALUE(TypeTag, PropTagName)
Access the value attribute of a property for a type tag.
Definition: propertysystem.hh:468
#define GET_PROP_TYPE(TypeTag, PropTagName)
Access the type attribute of a property for a type tag.
Definition: propertysystem.hh:485
Declares the properties required by the black oil model.
Definition: baseauxiliarymodule.hh:35
void computeStorage(Dune::FieldVector< LhsEval, numEq > &storage, const ElementContext &elemCtx, int dofIdx, int timeIdx) const
Evaluate the amount all conservation quantities (e.g. phase mass) within a finite sub-control volume...
Definition: blackoillocalresidual.hh:60
void computeSource(RateVector &source, const ElementContext &elemCtx, int dofIdx, int timeIdx) const
Calculate the source term of the equation.
Definition: blackoillocalresidual.hh:135