14#ifndef DUMUX_2P1C_LOCAL_RESIDUAL_HH
15#define DUMUX_2P1C_LOCAL_RESIDUAL_HH
25template<
class TypeTag>
36 using SubControlVolume =
typename FVElementGeometry::SubControlVolume;
37 using SubControlVolumeFace =
typename FVElementGeometry::SubControlVolumeFace;
39 using Element =
typename GridView::template Codim<0>::Entity;
47 using ParentType::ParentType;
51 const SubControlVolume& scv,
52 const VolumeVariables& volVars)
const
54 NumEqVector storage(0.0);
56 for (
int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx)
58 storage[Indices::conti0EqIdx] +=
60 * volVars.saturation(phaseIdx) * volVars.density(phaseIdx);
62 EnergyLocalResidual::fluidPhaseStorage(storage, problem, scv, volVars, phaseIdx);
66 EnergyLocalResidual::solidPhaseStorage(storage, scv, volVars);
73 const Element& element,
74 const FVElementGeometry& fvGeometry,
75 const ElementVolumeVariables& elemVolVars,
76 const SubControlVolumeFace& scvf,
77 const ElementFluxVariablesCache& elemFluxVarsCache)
const
79 FluxVariables fluxVars;
80 fluxVars.init(problem, element, fvGeometry, elemVolVars, scvf, elemFluxVarsCache);
83 for (
int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx)
86 auto upwindTerm = [phaseIdx](
const auto& volVars)
87 {
return volVars.density(phaseIdx)*volVars.mobility(phaseIdx); };
89 flux[Indices::conti0EqIdx] += fluxVars.advectiveFlux(phaseIdx, upwindTerm);
92 EnergyLocalResidual::heatConvectionFlux(flux, fluxVars, phaseIdx);
96 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
Element-wise calculation of the residual for the fully implicit two-phase one-component flow model.
Definition: porousmediumflow/2p1c/localresidual.hh:27
NumEqVector computeFlux(const Problem &problem, const Element &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const SubControlVolumeFace &scvf, const ElementFluxVariablesCache &elemFluxVarsCache) const
Evaluate the fluxes over a face of a sub control volume.
Definition: porousmediumflow/2p1c/localresidual.hh:72
NumEqVector computeStorage(const Problem &problem, const SubControlVolume &scv, const VolumeVariables &volVars) const
Evaluate the storage term within a given scv.
Definition: porousmediumflow/2p1c/localresidual.hh:50
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.
Element-wise calculation of the residual for problems using the n-phase immiscible fully implicit mod...