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>
43template<
class TypeTag>
50 using Element =
typename GridView::template Codim<0>::Entity;
53 using FVElementGeometry =
typename GridGeometry::LocalView;
56 using SubControlVolumeFace =
typename FVElementGeometry::SubControlVolumeFace;
62 using ParentType::ParentType;
67 const Element& element,
68 const FVElementGeometry& fvGeometry,
69 const ElementVolumeVariables& elemVolVars,
70 const ElementBoundaryTypes& elemBcTypes,
71 const ElementFluxVariablesCache& elemFluxVarsCache,
72 const SubControlVolumeFace& scvf)
const
74 const auto flux =
evalFlux(
problem, element, fvGeometry, elemVolVars, elemBcTypes, elemFluxVarsCache, scvf);
77 const auto& insideScv = fvGeometry.scv(scvf.insideScvIdx());
78 const auto& outsideScv = fvGeometry.scv(scvf.outsideScvIdx());
79 residual[insideScv.localDofIndex()] += flux;
80 residual[outsideScv.localDofIndex()] -= flux;
84 const auto& insideScv = fvGeometry.scv(scvf.insideScvIdx());
85 residual[insideScv.localDofIndex()] += flux;
91 const Element& element,
92 const FVElementGeometry& fvGeometry,
93 const ElementVolumeVariables& elemVolVars,
94 const ElementBoundaryTypes& elemBcTypes,
95 const ElementFluxVariablesCache& elemFluxVarsCache,
96 const SubControlVolumeFace& scvf)
const
98 NumEqVector flux(0.0);
101 if (!scvf.boundary())
103 flux += this->
asImp().computeFlux(problem, element, fvGeometry, elemVolVars, scvf, elemFluxVarsCache);
109 const auto& scv = fvGeometry.scv(scvf.insideScvIdx());
110 const auto& bcTypes = elemBcTypes[scv.localDofIndex()];
115 if (bcTypes.hasNeumann())
117 auto neumannFluxes =
problem.neumann(element, fvGeometry, elemVolVars, elemFluxVarsCache, scvf);
120 neumannFluxes *= Extrusion::area(scvf)*elemVolVars[scv].extrusionFactor();
123 for (
int eqIdx = 0; eqIdx < NumEqVector::dimension; ++eqIdx)
124 if (bcTypes.isNeumann(eqIdx))
125 flux[eqIdx] += neumannFluxes[eqIdx];
The element-wise residual for finite volume schemes.
Helper classes to compute the integration elements.
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 (equivalent to old macro GET_PROP_TYPE(....
Definition: propertysystem.hh:149
The element-wise residual for the box scheme.
Definition: boxlocalresidual.hh:45
typename ParentType::ElementResidualVector ElementResidualVector
Definition: boxlocalresidual.hh:61
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:90
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:65
The element-wise residual for finite volume schemes.
Definition: fvlocalresidual.hh:46
Implementation & asImp()
Definition: fvlocalresidual.hh:503
const Problem & problem() const
the problem
Definition: fvlocalresidual.hh:488
ReservedBlockVector< NumEqVector, FVElementGeometry::maxNumElementScvs > ElementResidualVector
the container storing all element residuals
Definition: fvlocalresidual.hh:68
Declares all properties used in Dumux.