13#ifndef DUMUX_IMMISCIBLE_LOCAL_RESIDUAL_HH
14#define DUMUX_IMMISCIBLE_LOCAL_RESIDUAL_HH
26template<
class TypeTag>
38 using SubControlVolume =
typename FVElementGeometry::SubControlVolume;
39 using SubControlVolumeFace =
typename FVElementGeometry::SubControlVolumeFace;
41 using Element =
typename GridView::template Codim<0>::Entity;
45 static constexpr int numPhases = ModelTraits::numFluidPhases();
46 static constexpr int conti0EqIdx = ModelTraits::Indices::conti0EqIdx;
49 using ParentType::ParentType;
64 const SubControlVolume& scv,
65 const VolumeVariables& volVars)
const
69 for (
int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx)
71 auto eqIdx = conti0EqIdx + phaseIdx;
72 storage[eqIdx] = volVars.porosity()
73 * volVars.density(phaseIdx)
74 * volVars.saturation(phaseIdx);
77 EnergyLocalResidual::fluidPhaseStorage(storage, scv, volVars, phaseIdx);
81 EnergyLocalResidual::solidPhaseStorage(storage, scv, volVars);
98 const Element& element,
99 const FVElementGeometry& fvGeometry,
100 const ElementVolumeVariables& elemVolVars,
101 const SubControlVolumeFace& scvf,
102 const ElementFluxVariablesCache& elemFluxVarsCache)
const
104 FluxVariables fluxVars;
105 fluxVars.init(problem, element, fvGeometry, elemVolVars, scvf, elemFluxVarsCache);
108 for (
int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx)
111 auto upwindTerm = [phaseIdx](
const auto& volVars)
112 {
return volVars.density(phaseIdx)*volVars.mobility(phaseIdx); };
114 auto eqIdx = conti0EqIdx + phaseIdx;
115 flux[eqIdx] = fluxVars.advectiveFlux(phaseIdx, upwindTerm);
118 EnergyLocalResidual::heatConvectionFlux(flux, fluxVars, phaseIdx);
122 EnergyLocalResidual::heatConductionFlux(flux, fluxVars);
Element-wise calculation of the residual for problems using the n-phase immiscible fully implicit mod...
Definition: porousmediumflow/immiscible/localresidual.hh:28
NumEqVector computeFlux(const Problem &problem, const Element &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const SubControlVolumeFace &scvf, const ElementFluxVariablesCache &elemFluxVarsCache) const
Evaluate the mass flux over a face of a sub control volume.
Definition: porousmediumflow/immiscible/localresidual.hh:97
NumEqVector computeStorage(const Problem &problem, const SubControlVolume &scv, const VolumeVariables &volVars) const
Evaluate the rate of change of all conservation quantites (e.g. phase mass) within a sub-control volu...
Definition: porousmediumflow/immiscible/localresidual.hh:63
Defines all properties used in Dumux.
typename NumEqVectorTraits< PrimaryVariables >::type NumEqVector
A vector with the same size as numbers of equations This is the default implementation and has to be ...
Definition: numeqvector.hh:34
typename GetProp< TypeTag, Property >::type GetPropType
get the type alias defined in the property
Definition: propertysystem.hh:296
A helper to deduce a vector with the same size as numbers of equations.