25#ifndef DUMUX_CC_LOCAL_RESIDUAL_HH
26#define DUMUX_CC_LOCAL_RESIDUAL_HH
41template<
class TypeTag>
52 using FVElementGeometry =
typename GridGeometry::LocalView;
54 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& scv = fvGeometry.scv(scvf.insideScvIdx());
71 const auto localScvIdx = scv.localDofIndex();
72 residual[localScvIdx] += this->
asImp().evalFlux(problem, element, fvGeometry, elemVolVars, elemFluxVarsCache, scvf);
77 const Element& element,
78 const FVElementGeometry& fvGeometry,
79 const ElementVolumeVariables& elemVolVars,
80 const ElementFluxVariablesCache& elemFluxVarsCache,
81 const SubControlVolumeFace& scvf)
const
83 NumEqVector flux(0.0);
88 flux += this->
asImp().computeFlux(problem, element, fvGeometry, elemVolVars, scvf, elemFluxVarsCache);
94 const auto& bcTypes =
problem.boundaryTypes(element, scvf);
97 if (bcTypes.hasDirichlet() && !bcTypes.hasNeumann())
98 flux += this->
asImp().computeFlux(problem, element, fvGeometry, elemVolVars, scvf, elemFluxVarsCache);
101 else if (bcTypes.hasNeumann() && !bcTypes.hasDirichlet())
103 auto neumannFluxes =
problem.neumann(element, fvGeometry, elemVolVars, elemFluxVarsCache, scvf);
106 const auto& scv = fvGeometry.scv(scvf.insideScvIdx());
107 neumannFluxes *= Extrusion::area(scvf)*elemVolVars[scv].extrusionFactor();
109 flux += neumannFluxes;
113 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.
A arithmetic block vector type based on DUNE's reserved vector.
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
Calculates the element-wise residual for the cell-centered discretization schemes.
Definition: cclocalresidual.hh:43
NumEqVector evalFlux(const Problem &problem, const Element &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const ElementFluxVariablesCache &elemFluxVarsCache, const SubControlVolumeFace &scvf) const
evaluate the flux residual for a sub control volume face
Definition: cclocalresidual.hh:76
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 the flux residual for a sub control volume face and add to residual
Definition: cclocalresidual.hh:61
typename ParentType::ElementResidualVector ElementResidualVector
Definition: cclocalresidual.hh:57
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
Declares all properties used in Dumux.