26 #ifndef EWOMS_IMMISCIBLE_LOCAL_RESIDUAL_BASE_HH
27 #define EWOMS_IMMISCIBLE_LOCAL_RESIDUAL_BASE_HH
40 template <
class TypeTag>
43 typedef typename GET_PROP_TYPE(TypeTag, LocalResidual) Implementation;
45 typedef typename GET_PROP_TYPE(TypeTag, Evaluation) Evaluation;
46 typedef typename GET_PROP_TYPE(TypeTag, IntensiveQuantities) IntensiveQuantities;
47 typedef typename GET_PROP_TYPE(TypeTag, ExtensiveQuantities) ExtensiveQuantities;
48 typedef typename GET_PROP_TYPE(TypeTag, ElementContext) ElementContext;
49 typedef typename GET_PROP_TYPE(TypeTag, Indices) Indices;
50 typedef typename GET_PROP_TYPE(TypeTag, EqVector) EqVector;
51 typedef typename GET_PROP_TYPE(TypeTag, RateVector) RateVector;
53 enum { conti0EqIdx = Indices::conti0EqIdx };
59 typedef Opm::MathToolbox<Evaluation> Toolbox;
70 template <
class LhsEval>
72 const ElementContext &elemCtx,
79 const IntensiveQuantities &intQuants = elemCtx.intensiveQuantities(dofIdx, timeIdx);
80 const auto &fs = intQuants.fluidState();
82 storage[conti0EqIdx + phaseIdx] =
83 Toolbox::template toLhs<LhsEval>(intQuants.porosity())
84 * Toolbox::template toLhs<LhsEval>(fs.saturation(phaseIdx))
85 * Toolbox::template toLhs<LhsEval>(fs.density(phaseIdx));
87 EnergyModule::addPhaseStorage(storage, intQuants, phaseIdx);
93 template <
class LhsEval>
95 const ElementContext &elemCtx,
99 typedef Opm::MathToolbox<LhsEval> LhsToolbox;
101 storage = LhsToolbox::createConstant(0.0);
102 for (
int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx)
103 asImp_().addPhaseStorage(storage, elemCtx, dofIdx, timeIdx, phaseIdx);
105 EnergyModule::addSolidHeatStorage(storage, elemCtx.intensiveQuantities(dofIdx, timeIdx));
112 int scvfIdx,
int timeIdx)
const
114 flux = Toolbox::createConstant(0.0);
115 asImp_().addAdvectiveFlux(flux, elemCtx, scvfIdx, timeIdx);
116 asImp_().addDiffusiveFlux(flux, elemCtx, scvfIdx, timeIdx);
125 const ElementContext &elemCtx,
129 const ExtensiveQuantities &extQuants = elemCtx.extensiveQuantities(scvfIdx, timeIdx);
134 int interiorIdx = extQuants.interiorIndex();
135 for (
int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
137 int upIdx = extQuants.upstreamIndex(phaseIdx);
139 const IntensiveQuantities &up = elemCtx.intensiveQuantities(upIdx, 0);
143 const Evaluation& rho = up.fluidState().density(phaseIdx);
144 if (interiorIdx == upIdx)
145 flux[conti0EqIdx + phaseIdx] += extQuants.volumeFlux(phaseIdx)*rho;
147 flux[conti0EqIdx + phaseIdx] += extQuants.volumeFlux(phaseIdx)*Toolbox::value(rho);
150 EnergyModule::addAdvectiveFlux(flux, elemCtx, scvfIdx, timeIdx);
163 int scvfIdx,
int timeIdx)
const
168 EnergyModule::addDiffusiveFlux(flux, elemCtx, scvfIdx, timeIdx);
178 const ElementContext &elemCtx,
182 Valgrind::SetUndefined(source);
183 elemCtx.problem().source(source, elemCtx, dofIdx, timeIdx);
184 Valgrind::CheckDefined(source);
188 const Implementation &asImp_()
const
189 {
return *
static_cast<const Implementation *
>(
this); }
#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
Calculates the local residual of the immiscible multi-phase model.
Definition: immisciblelocalresidual.hh:41
Defines the properties required for the immiscible multi-phase model.
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: immisciblelocalresidual.hh:111
Provides the auxiliary methods required for consideration of the energy equation. ...
Definition: energymodule.hh:54
Definition: baseauxiliarymodule.hh:35
void computeSource(RateVector &source, const ElementContext &elemCtx, int dofIdx, int timeIdx) const
Calculate the source term of the equation.
Definition: immisciblelocalresidual.hh:177
void addAdvectiveFlux(RateVector &flux, const ElementContext &elemCtx, int scvfIdx, int timeIdx) const
Add the advective mass flux at a given flux integration point.
Definition: immisciblelocalresidual.hh:124
void addPhaseStorage(Dune::FieldVector< LhsEval, numEq > &storage, const ElementContext &elemCtx, int dofIdx, int timeIdx, int phaseIdx) const
Adds the amount all conservation quantities (e.g. phase mass) within a single fluid phase...
Definition: immisciblelocalresidual.hh:71
void addDiffusiveFlux(RateVector &flux, const ElementContext &elemCtx, int scvfIdx, int timeIdx) const
Adds the diffusive flux at a given flux integration point.
Definition: immisciblelocalresidual.hh:162
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: immisciblelocalresidual.hh:94
Contains the classes required to consider energy as a conservation quantity in a multi-phase module...