25#ifndef DUMUX_FACETCOUPLING_BOX_LOCAL_RESIDUAL_HH
26#define DUMUX_FACETCOUPLING_BOX_LOCAL_RESIDUAL_HH
28#include <dune/geometry/type.hh>
41template<
class TypeTag>
48 using FVElementGeometry =
typename GridGeometry::LocalView;
49 using SubControlVolumeFace =
typename GridGeometry::SubControlVolumeFace;
51 using GridView =
typename GridGeometry::GridView;
52 using Element =
typename GridView::template Codim<0>::Entity;
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 if (!scvf.boundary() && !scvf.interiorBoundary())
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;
86 const auto& insideScv = fvGeometry.scv(scvf.insideScvIdx());
87 residual[insideScv.localDofIndex()] += flux;
93 const Element& element,
94 const FVElementGeometry& fvGeometry,
95 const ElementVolumeVariables& elemVolVars,
96 const ElementBoundaryTypes& elemBcTypes,
97 const ElementFluxVariablesCache& elemFluxVarsCache,
98 const SubControlVolumeFace& scvf)
const
100 NumEqVector flux(0.0);
103 if (!scvf.boundary() || scvf.interiorBoundary())
104 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()];
113 if (bcTypes.hasNeumann())
115 auto neumannFluxes =
problem.neumann(element, fvGeometry, elemVolVars, elemFluxVarsCache, scvf);
118 neumannFluxes *= Extrusion::area(scvf)*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.
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 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
A arithmetic block vector type based on DUNE's reserved vector.
Definition: reservedblockvector.hh:38
The element-wise residual for the box scheme.
Definition: multidomain/facet/box/localresidual.hh:43
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: multidomain/facet/box/localresidual.hh:92
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: multidomain/facet/box/localresidual.hh:63
Declares all properties used in Dumux.