25#ifndef DUMUX_BOX_LOCAL_RESIDUAL_HH
26#define DUMUX_BOX_LOCAL_RESIDUAL_HH
28#include <dune/geometry/type.hh>
29#include <dune/istl/matrix.hh>
44template<
class TypeTag>
51 using Element =
typename GridView::template Codim<0>::Entity;
54 using FVElementGeometry =
typename GridGeometry::LocalView;
57 using SubControlVolumeFace =
typename FVElementGeometry::SubControlVolumeFace;
63 using ParentType::ParentType;
68 const Element& element,
69 const FVElementGeometry& fvGeometry,
70 const ElementVolumeVariables& elemVolVars,
71 const ElementBoundaryTypes& elemBcTypes,
72 const ElementFluxVariablesCache& elemFluxVarsCache,
73 const SubControlVolumeFace& scvf)
const
75 const auto flux =
evalFlux(
problem, element, fvGeometry, elemVolVars, elemBcTypes, elemFluxVarsCache, scvf);
78 const auto& insideScv = fvGeometry.scv(scvf.insideScvIdx());
79 const auto& outsideScv = fvGeometry.scv(scvf.outsideScvIdx());
80 residual[insideScv.localDofIndex()] += flux;
81 residual[outsideScv.localDofIndex()] -= flux;
85 const auto& insideScv = fvGeometry.scv(scvf.insideScvIdx());
86 residual[insideScv.localDofIndex()] += flux;
92 const Element& element,
93 const FVElementGeometry& fvGeometry,
94 const ElementVolumeVariables& elemVolVars,
95 const ElementBoundaryTypes& elemBcTypes,
96 const ElementFluxVariablesCache& elemFluxVarsCache,
97 const SubControlVolumeFace& scvf)
const
99 NumEqVector flux(0.0);
102 if (!scvf.boundary())
104 flux += this->
asImp().computeFlux(problem, element, fvGeometry, elemVolVars, scvf, elemFluxVarsCache);
110 const auto& scv = fvGeometry.scv(scvf.insideScvIdx());
111 const auto& bcTypes = elemBcTypes[scv.localDofIndex()];
116 if (bcTypes.hasNeumann())
118 auto neumannFluxes =
problem.neumann(element, fvGeometry, elemVolVars, elemFluxVarsCache, scvf);
121 neumannFluxes *= Extrusion::area(scvf)*elemVolVars[scv].extrusionFactor();
124 for (
int eqIdx = 0; eqIdx < NumEqVector::dimension; ++eqIdx)
125 if (bcTypes.isNeumann(eqIdx))
126 flux[eqIdx] += neumannFluxes[eqIdx];
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
The element-wise residual for the box scheme.
Definition: boxlocalresidual.hh:46
typename ParentType::ElementResidualVector ElementResidualVector
Definition: boxlocalresidual.hh:62
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: boxlocalresidual.hh:91
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: boxlocalresidual.hh:66
The element-wise residual for finite volume schemes.
Definition: fvlocalresidual.hh:47
Implementation & asImp()
Definition: fvlocalresidual.hh:504
const Problem & problem() const
the problem
Definition: fvlocalresidual.hh:489
ReservedBlockVector< NumEqVector, FVElementGeometry::maxNumElementScvs > ElementResidualVector
the container storing all element residuals
Definition: fvlocalresidual.hh:69
Declares all properties used in Dumux.