13#ifndef DUMUX_FACECENTERED_LOCAL_RESIDUAL_HH
14#define DUMUX_FACECENTERED_LOCAL_RESIDUAL_HH
16#include <dune/geometry/type.hh>
17#include <dune/istl/matrix.hh>
32template<
class TypeTag>
39 using GridView =
typename GridGeometry::GridView;
40 using Element =
typename GridView::template Codim<0>::Entity;
42 using FVElementGeometry =
typename GridGeometry::LocalView;
44 using SubControlVolume =
typename FVElementGeometry::SubControlVolume;
45 using SubControlVolumeFace =
typename FVElementGeometry::SubControlVolumeFace;
52 using ParentType::ParentType;
57 const Element& element,
58 const FVElementGeometry& fvGeometry,
59 const ElementVolumeVariables& elemVolVars,
60 const ElementBoundaryTypes& elemBcTypes,
61 const ElementFluxVariablesCache& elemFluxVarsCache,
62 const SubControlVolumeFace& scvf)
const
64 const auto flux =
evalFlux(
problem, element, fvGeometry, elemVolVars, elemBcTypes, elemFluxVarsCache, scvf);
65 const auto& insideScv = fvGeometry.scv(scvf.insideScvIdx());
66 residual[insideScv.localDofIndex()] += flux;
71 const Element& element,
72 const FVElementGeometry& fvGeometry,
73 const ElementVolumeVariables& elemVolVars,
74 const ElementBoundaryTypes& elemBcTypes,
75 const ElementFluxVariablesCache& elemFluxVarsCache,
76 const SubControlVolumeFace& scvf)
const
78 if (elemBcTypes.hasDirichlet())
79 return this->
asImp().maybeHandleDirichletBoundary(problem, element, fvGeometry, elemVolVars, elemBcTypes, elemFluxVarsCache, scvf);
81 if (elemBcTypes.hasNeumann())
82 return this->
asImp().maybeHandleNeumannBoundary(problem, element, fvGeometry, elemVolVars, elemBcTypes, elemFluxVarsCache, scvf);
84 return this->
asImp().computeFlux(problem, element, fvGeometry, elemVolVars, scvf, elemFluxVarsCache, elemBcTypes);
101 const Element& element,
102 const FVElementGeometry& fvGeometry,
103 const ElementVolumeVariables& elemVolVars,
104 const SubControlVolume& scv)
const
106 NumEqVector source(0.0);
109 source +=
problem.source(element, fvGeometry, elemVolVars, scv)[scv.dofAxis()];
112 source +=
problem.scvPointSources(element, fvGeometry, elemVolVars, scv)[scv.dofAxis()];
136 const Element& element,
137 const FVElementGeometry& fvGeometry,
138 const ElementVolumeVariables& prevElemVolVars,
139 const ElementVolumeVariables& curElemVolVars,
140 const SubControlVolume& scv)
const
142 const auto& curVolVars = curElemVolVars[scv];
143 const auto& prevVolVars = prevElemVolVars[scv];
151 NumEqVector prevStorage = this->
asImp().computeStorage(problem, scv, prevVolVars,
true);
152 NumEqVector storage = this->
asImp().computeStorage(problem, scv, curVolVars,
false);
154 prevStorage *= prevVolVars.extrusionFactor();
155 storage *= curVolVars.extrusionFactor();
157 storage -= prevStorage;
161 residual[scv.localDofIndex()] += storage;
The element-wise residual for finite volume schemes.
Definition: fvlocalresidual.hh:35
Implementation & asImp()
Definition: fvlocalresidual.hh:487
const Problem & problem() const
the problem
Definition: fvlocalresidual.hh:472
ReservedBlockVector< NumEqVector, FVElementGeometry::maxNumElementScvs > ElementResidualVector
the container storing all element residuals
Definition: fvlocalresidual.hh:57
const TimeLoop & timeLoop() const
Definition: fvlocalresidual.hh:477
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:86
The element-wise residual for the box scheme.
Definition: fclocalresidual.hh:34
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:134
typename ParentType::ElementResidualVector ElementResidualVector
Definition: fclocalresidual.hh:51
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:55
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:70
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:100
virtual Scalar timeStepSize() const =0
Returns the suggested time step length .
Defines all properties used in Dumux.
Helper classes to compute the integration elements.
The element-wise residual for finite volume schemes.
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
auto volume(const Geometry &geo, unsigned int integrationOrder=4)
The volume of a given geometry.
Definition: volume.hh:159
typename GetProp< TypeTag, Property >::type GetPropType
get the type alias defined in the property
Definition: propertysystem.hh:296
typename Extrusion< T >::type Extrusion_t
Convenience alias for obtaining the extrusion type.
Definition: extrusion.hh:166
A helper to deduce a vector with the same size as numbers of equations.