13#ifndef DUMUX_EXPERIMENTAL_FV_LOCAL_ASSEMBLER_BASE_HH
14#define DUMUX_EXPERIMENTAL_FV_LOCAL_ASSEMBLER_BASE_HH
16#include <dune/common/reservedvector.hh>
17#include <dune/grid/common/gridenums.hh>
18#include <dune/istl/matrixindexset.hh>
36template<
class TypeTag,
class Assembler,
class Implementation>
44 using SolutionVector =
typename Assembler::SolutionVector;
47 using SubControlVolume =
typename FVElementGeometry::SubControlVolume;
48 using SubControlVolumeFace =
typename FVElementGeometry::SubControlVolumeFace;
53 using Element =
typename GridView::template Codim<0>::Entity;
57 using LocalResidual = std::decay_t<decltype(std::declval<Assembler>().localResidual())>;
65 const SolutionVector&
curSol)
82 const SolutionVector&
curSol,
146 return localOperator_.evalFluxAndSource(element_, fvGeometry_, elemVolVars, elemFluxVarsCache_, elemBcTypes_);
156 return localOperator_.evalStorage(fvGeometry_, curElemVolVars_);
186 template<
typename ApplyFunction,
class P = Problem,
typename std::enable_if_t<P::enableInternalDirichletConstra
ints(),
int> = 0>
191 for (
const auto& scvI : scvs(this->
fvGeometry()))
193 const auto internalDirichletConstraints =
asImp_().problem().hasInternalDirichletConstraint(this->
element(), scvI);
194 if (internalDirichletConstraints.any())
196 const auto dirichletValues =
asImp_().problem().internalDirichlet(this->
element(), scvI);
198 for (
int eqIdx = 0; eqIdx < internalDirichletConstraints.size(); ++eqIdx)
199 if (internalDirichletConstraints[eqIdx])
200 applyDirichlet(scvI, dirichletValues, eqIdx, eqIdx);
205 template<
typename ApplyFunction,
class P = Problem,
typename std::enable_if_t<!P::enableInternalDirichletConstra
ints(),
int> = 0>
211 {
return assembler_.problem(); }
215 {
return assembler_; }
223 {
return elementIsGhost_; }
231 {
return fvGeometry_; }
235 {
return curElemVolVars_; }
239 {
return elemFluxVarsCache_; }
243 {
return localOperator_; }
247 {
return elemBcTypes_; }
251 {
return fvGeometry_; }
255 {
return curElemVolVars_; }
259 {
return elemFluxVarsCache_; }
263 {
return elemBcTypes_; }
267 {
return localOperator_; }
271 {
return isImplicit_; }
275 {
return *
static_cast<Implementation*
>(
this); }
278 {
return *
static_cast<const Implementation*
>(
this); }
280 template<class T = TypeTag, typename std::enable_if_t<!GetPropType<T, Properties::GridVariables>::GridVolumeVariables::cachingEnabled,
int> = 0>
281 VolumeVariables&
getVolVarAccess(GridVolumeVariables& gridVolVars, ElementVolumeVariables& elemVolVars,
const SubControlVolume& scv)
282 {
return elemVolVars[scv]; }
284 template<class T = TypeTag, typename std::enable_if_t<GetPropType<T, Properties::GridVariables>::GridVolumeVariables::cachingEnabled,
int> = 0>
285 VolumeVariables&
getVolVarAccess(GridVolumeVariables& gridVolVars, ElementVolumeVariables& elemVolVars,
const SubControlVolume& scv)
286 {
return gridVolVars.volVars(scv); }
290 const Assembler& assembler_;
291 const Element& element_;
292 const SolutionVector& curSol_;
294 FVElementGeometry fvGeometry_;
295 ElementVolumeVariables curElemVolVars_;
296 ElementFluxVariablesCache elemFluxVarsCache_;
297 ElementBoundaryTypes elemBcTypes_;
300 bool elementIsGhost_;
A base class for all local assemblers.
Definition: experimental/assembly/fvlocalassemblerbase.hh:38
const ElementBoundaryTypes & elemBcTypes() const
The element's boundary types.
Definition: experimental/assembly/fvlocalassemblerbase.hh:262
ElementVolumeVariables & curElemVolVars()
The current element volume variables.
Definition: experimental/assembly/fvlocalassemblerbase.hh:234
const ElementVolumeVariables & curElemVolVars() const
The current element volume variables.
Definition: experimental/assembly/fvlocalassemblerbase.hh:254
bool isImplicit() const
If the time stepping scheme is implicit.
Definition: experimental/assembly/fvlocalassemblerbase.hh:270
void bindLocalViews()
Convenience function bind and prepare all relevant variables required for the evaluation of the local...
Definition: experimental/assembly/fvlocalassemblerbase.hh:163
ElementResidualVector evalLocalResidual() const
Convenience function to evaluate the complete local residual for the current element....
Definition: experimental/assembly/fvlocalassemblerbase.hh:104
const ElementFluxVariablesCache & elemFluxVarsCache() const
The element flux variables cache.
Definition: experimental/assembly/fvlocalassemblerbase.hh:258
bool elementIsGhost() const
Returns if element is a ghost entity.
Definition: experimental/assembly/fvlocalassemblerbase.hh:222
ElementResidualVector evalLocalFluxAndSourceResidual() const
Convenience function to evaluate the flux and source terms (i.e, the terms without a time derivative)...
Definition: experimental/assembly/fvlocalassemblerbase.hh:133
ElementResidualVector evalStorage() const
Convenience function to evaluate storage term (i.e, the term with a time derivative) of the local res...
Definition: experimental/assembly/fvlocalassemblerbase.hh:154
const FVElementGeometry & fvGeometry() const
The finite volume geometry.
Definition: experimental/assembly/fvlocalassemblerbase.hh:250
const Problem & problem() const
The problem.
Definition: experimental/assembly/fvlocalassemblerbase.hh:210
LocalResidual & localResidual()
The local residual for the current element.
Definition: experimental/assembly/fvlocalassemblerbase.hh:242
const Implementation & asImp_() const
Definition: experimental/assembly/fvlocalassemblerbase.hh:277
void enforceInternalDirichletConstraints(const ApplyFunction &applyDirichlet)
Enforces Dirichlet constraints if enabled in the problem.
Definition: experimental/assembly/fvlocalassemblerbase.hh:187
VolumeVariables & getVolVarAccess(GridVolumeVariables &gridVolVars, ElementVolumeVariables &elemVolVars, const SubControlVolume &scv)
Definition: experimental/assembly/fvlocalassemblerbase.hh:281
const Element & element() const
The current element.
Definition: experimental/assembly/fvlocalassemblerbase.hh:218
ElementResidualVector evalLocalFluxAndSourceResidual(const ElementVolumeVariables &elemVolVars) const
Evaluates the flux and source terms (i.e, the terms without a time derivative) of the local residual ...
Definition: experimental/assembly/fvlocalassemblerbase.hh:144
const LocalResidual & localResidual() const
The local residual for the current element.
Definition: experimental/assembly/fvlocalassemblerbase.hh:266
const SolutionVector & curSol() const
The current solution.
Definition: experimental/assembly/fvlocalassemblerbase.hh:226
FVLocalAssemblerBase(const Assembler &assembler, const Element &element, const SolutionVector &curSol)
The constructor. Delegates to the general constructor.
Definition: experimental/assembly/fvlocalassemblerbase.hh:63
typename LocalResidual::ElementResidualVector ElementResidualVector
Definition: experimental/assembly/fvlocalassemblerbase.hh:58
ElementResidualVector evalLocalResidual(const ElementVolumeVariables &elemVolVars) const
Evaluates the complete local residual for the current element.
Definition: experimental/assembly/fvlocalassemblerbase.hh:116
const Assembler & assembler() const
The assembler.
Definition: experimental/assembly/fvlocalassemblerbase.hh:214
FVElementGeometry & fvGeometry()
The global finite volume geometry.
Definition: experimental/assembly/fvlocalassemblerbase.hh:230
Implementation & asImp_()
Definition: experimental/assembly/fvlocalassemblerbase.hh:274
ElementFluxVariablesCache & elemFluxVarsCache()
The element flux variables cache.
Definition: experimental/assembly/fvlocalassemblerbase.hh:238
FVLocalAssemblerBase(const Assembler &assembler, const Element &element, const SolutionVector &curSol, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &curElemVolVars, const ElementFluxVariablesCache &elemFluxVarsCache, const LocalResidual &localResidual, const bool elementIsGhost, const bool isImplicit)
The constructor. General version explicitly expecting each argument.
Definition: experimental/assembly/fvlocalassemblerbase.hh:80
ElementBoundaryTypes & elemBcTypes()
The element's boundary types.
Definition: experimental/assembly/fvlocalassemblerbase.hh:246
std::decay_t< decltype(std::declval< Assembler >().localResidual())> LocalResidual
Definition: experimental/assembly/fvlocalassemblerbase.hh:57
Defines all properties used in Dumux.
An enum class to define various differentiation methods available in order to compute the derivatives...
Helper classes to compute the integration elements.
GridCache::LocalView localView(const GridCache &gridCache)
Free function to get the local view of a grid cache object.
Definition: localview.hh:26
typename GetProp< TypeTag, Property >::type GetPropType
get the type alias defined in the property
Definition: propertysystem.hh:296
Definition: experimental/assembly/cclocalassembler.hh:36
Definition: common/pdesolver.hh:24
The infrastructure to retrieve run-time parameters from Dune::ParameterTrees.
A arithmetic block vector type based on DUNE's reserved vector.