25#ifndef DUMUX_FACECENTERED_LOCAL_RESIDUAL_HH
26#define DUMUX_FACECENTERED_LOCAL_RESIDUAL_HH
28#include <dune/geometry/type.hh>
29#include <dune/istl/matrix.hh>
44template<
class TypeTag>
51 using GridView =
typename GridGeometry::GridView;
52 using Element =
typename GridView::template Codim<0>::Entity;
54 using FVElementGeometry =
typename GridGeometry::LocalView;
56 using SubControlVolume =
typename FVElementGeometry::SubControlVolume;
57 using SubControlVolumeFace =
typename FVElementGeometry::SubControlVolumeFace;
64 using ParentType::ParentType;
69 const Element& element,
70 const FVElementGeometry& fvGeometry,
71 const ElementVolumeVariables& elemVolVars,
72 const ElementBoundaryTypes& elemBcTypes,
73 const ElementFluxVariablesCache& elemFluxVarsCache,
74 const SubControlVolumeFace& scvf)
const
76 const auto flux =
evalFlux(
problem, element, fvGeometry, elemVolVars, elemBcTypes, elemFluxVarsCache, scvf);
77 const auto& insideScv = fvGeometry.scv(scvf.insideScvIdx());
78 residual[insideScv.localDofIndex()] += flux;
83 const Element& element,
84 const FVElementGeometry& fvGeometry,
85 const ElementVolumeVariables& elemVolVars,
86 const ElementBoundaryTypes& elemBcTypes,
87 const ElementFluxVariablesCache& elemFluxVarsCache,
88 const SubControlVolumeFace& scvf)
const
90 if (elemBcTypes.hasDirichlet())
91 return this->
asImp().maybeHandleDirichletBoundary(problem, element, fvGeometry, elemVolVars, elemBcTypes, elemFluxVarsCache, scvf);
93 if (elemBcTypes.hasNeumann())
94 return this->
asImp().maybeHandleNeumannBoundary(problem, element, fvGeometry, elemVolVars, elemBcTypes, elemFluxVarsCache, scvf);
96 return this->
asImp().computeFlux(problem, element, fvGeometry, elemVolVars, scvf, elemFluxVarsCache, elemBcTypes);
113 const Element& element,
114 const FVElementGeometry& fvGeometry,
115 const ElementVolumeVariables& elemVolVars,
116 const SubControlVolume& scv)
const
118 NumEqVector source(0.0);
121 source +=
problem.source(element, fvGeometry, elemVolVars, scv)[scv.dofAxis()];
124 source +=
problem.scvPointSources(element, fvGeometry, elemVolVars, scv)[scv.dofAxis()];
148 const Element& element,
149 const FVElementGeometry& fvGeometry,
150 const ElementVolumeVariables& prevElemVolVars,
151 const ElementVolumeVariables& curElemVolVars,
152 const SubControlVolume& scv)
const
154 const auto& curVolVars = curElemVolVars[scv];
155 const auto& prevVolVars = prevElemVolVars[scv];
163 NumEqVector prevStorage = this->
asImp().computeStorage(problem, scv, prevVolVars,
true);
164 NumEqVector storage = this->
asImp().computeStorage(problem, scv, curVolVars,
false);
166 prevStorage *= prevVolVars.extrusionFactor();
167 storage *= curVolVars.extrusionFactor();
169 storage -= prevStorage;
173 residual[scv.localDofIndex()] += storage;
The element-wise residual for finite volume schemes.
A helper to deduce a vector with the same size as numbers of equations.
Helper classes to compute the integration elements.
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:46
typename Extrusion< T >::type Extrusion_t
Convenience alias for obtaining the extrusion type.
Definition: extrusion.hh:177
typename Properties::Detail::GetPropImpl< TypeTag, Property >::type::type GetPropType
get the type alias defined in the property
Definition: propertysystem.hh:150
Scalar volume(Shape shape, Scalar inscribedRadius)
Returns the volume of a given geometry based on the inscribed radius.
Definition: poreproperties.hh:73
The element-wise residual for the box scheme.
Definition: fclocalresidual.hh:46
void evalStorage(ElementResidualVector &residual, const Problem &problem, const Element &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &prevElemVolVars, const ElementVolumeVariables &curElemVolVars, const SubControlVolume &scv) const
Compute the storage local residual, i.e. the deviation of the storage term from zero for instationary...
Definition: fclocalresidual.hh:146
typename ParentType::ElementResidualVector ElementResidualVector
Definition: fclocalresidual.hh:63
void evalFlux(ElementResidualVector &residual, const Problem &problem, const Element &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const ElementBoundaryTypes &elemBcTypes, const ElementFluxVariablesCache &elemFluxVarsCache, const SubControlVolumeFace &scvf) const
evaluate flux residuals for one sub control volume face and add to residual
Definition: fclocalresidual.hh:67
NumEqVector evalFlux(const Problem &problem, const Element &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const ElementBoundaryTypes &elemBcTypes, const ElementFluxVariablesCache &elemFluxVarsCache, const SubControlVolumeFace &scvf) const
evaluate flux residuals for one sub control volume face
Definition: fclocalresidual.hh:82
NumEqVector computeSource(const Problem &problem, const Element &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const SubControlVolume &scv) const
Calculate the source term of the equation.
Definition: fclocalresidual.hh:112
The element-wise residual for finite volume schemes.
Definition: fvlocalresidual.hh:47
Implementation & asImp()
Definition: fvlocalresidual.hh:501
const Problem & problem() const
the problem
Definition: fvlocalresidual.hh:486
ReservedBlockVector< NumEqVector, FVElementGeometry::maxNumElementScvs > ElementResidualVector
the container storing all element residuals
Definition: fvlocalresidual.hh:69
const TimeLoop & timeLoop() const
Definition: fvlocalresidual.hh:491
ElementResidualVector evalStorage(const Problem &problem, const Element &element, const GridGeometry &gridGeometry, const GridVariables &gridVariables, const SolutionVector &sol) const
Compute the storage term for the current solution.
Definition: fvlocalresidual.hh:98
virtual Scalar timeStepSize() const =0
Returns the suggested time step length .
Declares all properties used in Dumux.