25#ifndef DUMUX_FACETCOUPLING_BOX_LOCAL_RESIDUAL_HH
26#define DUMUX_FACETCOUPLING_BOX_LOCAL_RESIDUAL_HH
28#include <dune/geometry/type.hh>
42template<
class TypeTag>
49 using FVElementGeometry =
typename GridGeometry::LocalView;
50 using SubControlVolumeFace =
typename GridGeometry::SubControlVolumeFace;
52 using GridView =
typename GridGeometry::GridView;
53 using Element =
typename GridView::template Codim<0>::Entity;
61 using ParentType::ParentType;
66 const Element& element,
67 const FVElementGeometry& fvGeometry,
68 const ElementVolumeVariables& elemVolVars,
69 const ElementBoundaryTypes& elemBcTypes,
70 const ElementFluxVariablesCache& elemFluxVarsCache,
71 const SubControlVolumeFace& scvf)
const
73 const auto flux =
evalFlux(
problem, element, fvGeometry, elemVolVars, elemBcTypes, elemFluxVarsCache, scvf);
76 if (!scvf.boundary() && !scvf.interiorBoundary())
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;
87 const auto& insideScv = fvGeometry.scv(scvf.insideScvIdx());
88 residual[insideScv.localDofIndex()] += flux;
94 const Element& element,
95 const FVElementGeometry& fvGeometry,
96 const ElementVolumeVariables& elemVolVars,
97 const ElementBoundaryTypes& elemBcTypes,
98 const ElementFluxVariablesCache& elemFluxVarsCache,
99 const SubControlVolumeFace& scvf)
const
101 NumEqVector flux(0.0);
104 if (!scvf.boundary() || scvf.interiorBoundary())
105 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()];
114 if (bcTypes.hasNeumann())
116 auto neumannFluxes =
problem.neumann(element, fvGeometry, elemVolVars, elemFluxVarsCache, scvf);
119 neumannFluxes *= Extrusion::area(scvf)*elemVolVars[scv].extrusionFactor();
122 for (
int eqIdx = 0; eqIdx < NumEqVector::dimension; ++eqIdx)
123 if (bcTypes.isNeumann(eqIdx))
124 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 finite volume schemes.
Definition: fvlocalresidual.hh:47
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:69
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:44
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:93
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:64
Declares all properties used in Dumux.