25#ifndef DUMUX_CC_LOCAL_RESIDUAL_HH
26#define DUMUX_CC_LOCAL_RESIDUAL_HH
40template<
class TypeTag>
51 using FVElementGeometry =
typename GridGeometry::LocalView;
53 using SubControlVolumeFace =
typename FVElementGeometry::SubControlVolumeFace;
57 using ParentType::ParentType;
62 const Element& element,
63 const FVElementGeometry& fvGeometry,
64 const ElementVolumeVariables& elemVolVars,
65 const ElementBoundaryTypes& elemBcTypes,
66 const ElementFluxVariablesCache& elemFluxVarsCache,
67 const SubControlVolumeFace& scvf)
const
69 const auto& scv = fvGeometry.scv(scvf.insideScvIdx());
70 const auto localScvIdx = scv.localDofIndex();
71 residual[localScvIdx] += this->
asImp().evalFlux(problem, element, fvGeometry, elemVolVars, elemFluxVarsCache, scvf);
76 const Element& element,
77 const FVElementGeometry& fvGeometry,
78 const ElementVolumeVariables& elemVolVars,
79 const ElementFluxVariablesCache& elemFluxVarsCache,
80 const SubControlVolumeFace& scvf)
const
82 NumEqVector flux(0.0);
87 flux += this->
asImp().computeFlux(problem, element, fvGeometry, elemVolVars, scvf, elemFluxVarsCache);
93 const auto& bcTypes =
problem.boundaryTypes(element, scvf);
96 if (bcTypes.hasDirichlet() && !bcTypes.hasNeumann())
97 flux += this->
asImp().computeFlux(problem, element, fvGeometry, elemVolVars, scvf, elemFluxVarsCache);
100 else if (bcTypes.hasNeumann() && !bcTypes.hasDirichlet())
102 auto neumannFluxes =
problem.neumann(element, fvGeometry, elemVolVars, elemFluxVarsCache, scvf);
105 const auto& scv = fvGeometry.scv(scvf.insideScvIdx());
106 neumannFluxes *= Extrusion::area(scvf)*elemVolVars[scv].extrusionFactor();
108 flux += neumannFluxes;
112 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.
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
Calculates the element-wise residual for the cell-centered discretization schemes.
Definition: cclocalresidual.hh:42
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:75
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:60
typename ParentType::ElementResidualVector ElementResidualVector
Definition: cclocalresidual.hh:56
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
Declares all properties used in Dumux.