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 Element =
typename GridView::template Codim<0>::Entity;
52 using SubControlVolumeFace =
typename FVElementGeometry::SubControlVolumeFace;
58 using ParentType::ParentType;
63 const Element& element,
64 const FVElementGeometry& fvGeometry,
65 const ElementVolumeVariables& elemVolVars,
66 const ElementBoundaryTypes& elemBcTypes,
67 const ElementFluxVariablesCache& elemFluxVarsCache,
68 const SubControlVolumeFace& scvf)
const
70 const auto flux =
evalFlux(
problem, element, fvGeometry, elemVolVars, elemBcTypes, elemFluxVarsCache, scvf);
73 if (!scvf.boundary() && !scvf.interiorBoundary())
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;
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() || scvf.interiorBoundary())
102 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()];
111 if (bcTypes.hasNeumann() && !bcTypes.hasDirichlet())
113 auto neumannFluxes = Deprecated::neumann(
problem, element, fvGeometry, elemVolVars, elemFluxVarsCache, scvf);
116 neumannFluxes *= scvf.area()*elemVolVars[scv].extrusionFactor();
118 flux += neumannFluxes;
123 else if (bcTypes.hasDirichlet() && !bcTypes.hasNeumann())
126 DUNE_THROW(Dune::NotImplemented,
"Mixed boundary conditions. Use pure boundary conditions by converting Dirichlet BCs to Robin BCs");
The element-wise residual for finite volume schemes.
make the local view function available whenever we use the grid geometry
Definition: adapt.hh:29
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: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
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: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: multidomain/facet/box/localresidual.hh:61
Declares all properties used in Dumux.