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;
54 using SubControlVolumeFace =
typename FVElementGeometry::SubControlVolumeFace;
60 using ParentType::ParentType;
65 const Element& element,
66 const FVElementGeometry& fvGeometry,
67 const ElementVolumeVariables& elemVolVars,
68 const ElementBoundaryTypes& elemBcTypes,
69 const ElementFluxVariablesCache& elemFluxVarsCache,
70 const SubControlVolumeFace& scvf)
const
72 const auto flux =
evalFlux(
problem, element, fvGeometry, elemVolVars, elemBcTypes, elemFluxVarsCache, scvf);
75 const auto& insideScv = fvGeometry.scv(scvf.insideScvIdx());
76 const auto& outsideScv = fvGeometry.scv(scvf.outsideScvIdx());
77 residual[insideScv.localDofIndex()] += flux;
78 residual[outsideScv.localDofIndex()] -= flux;
82 const auto& insideScv = fvGeometry.scv(scvf.insideScvIdx());
83 residual[insideScv.localDofIndex()] += flux;
89 const Element& element,
90 const FVElementGeometry& fvGeometry,
91 const ElementVolumeVariables& elemVolVars,
92 const ElementBoundaryTypes& elemBcTypes,
93 const ElementFluxVariablesCache& elemFluxVarsCache,
94 const SubControlVolumeFace& scvf)
const
96 NumEqVector flux(0.0);
101 flux += this->
asImp().computeFlux(problem, element, fvGeometry, elemVolVars, scvf, elemFluxVarsCache);
107 const auto& scv = fvGeometry.scv(scvf.insideScvIdx());
108 const auto& bcTypes = elemBcTypes[scv.localDofIndex()];
113 if (bcTypes.hasNeumann())
115 auto neumannFluxes =
problem.neumann(element, fvGeometry, elemVolVars, elemFluxVarsCache, scvf);
118 neumannFluxes *= scvf.area()*elemVolVars[scv].extrusionFactor();
121 for (
int eqIdx = 0; eqIdx < NumEqVector::dimension; ++eqIdx)
122 if (bcTypes.isNeumann(eqIdx))
123 flux[eqIdx] += neumannFluxes[eqIdx];
The element-wise residual for finite volume schemes.
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:59
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:88
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:63
The element-wise residual for finite volume schemes.
Definition: fvlocalresidual.hh:45
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:66
Declares all properties used in Dumux.