version 3.8
porousmediumflow/fluxvariablescache.hh
Go to the documentation of this file.
1// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2// vi: set et ts=4 sw=4 sts=4:
3//
4// SPDX-FileCopyrightInfo: Copyright © DuMux Project contributors, see AUTHORS.md in root folder
5// SPDX-License-Identifier: GPL-3.0-or-later
6//
12#ifndef DUMUX_POROUSMEDIUM_FLUXVARIABLESCACHE_HH
13#define DUMUX_POROUSMEDIUM_FLUXVARIABLESCACHE_HH
14
19
20namespace Dumux {
21
22// forward declaration
23template<class TypeTag, class DiscretizationMethod>
25
31
40template<class TypeTag>
42
45template<class TypeTag, class DM>
46class PorousMediumFluxVariablesCacheImplementation<TypeTag, DiscretizationMethods::CVFE<DM>>
47: public CVFEFluxVariablesCache<GetPropType<TypeTag, Properties::Scalar>, GetPropType<TypeTag, Properties::GridGeometry>>
48{
49public:
52};
53
54// the following classes choose the cache type: empty if the law disabled and the law's cache if it's enabled
55// if advections is disabled the advection type is still instantiated if we use std::conditional_t and has to be a full type
56// in order to prevent that instead of std::conditional_t we use this helper type is only dependent on the advection type
57// if advection is enabled otherwise its an empty cache type
58template<class TypeTag, bool EnableAdvection> class AdvectionCacheChooser : public FluxVariablesCaching::EmptyAdvectionCache {};
59template<class TypeTag> class AdvectionCacheChooser<TypeTag, true> : public GetPropType<TypeTag, Properties::AdvectionType>::Cache {};
60template<class TypeTag, bool EnableMolecularDiffusion> class DiffusionCacheChooser : public FluxVariablesCaching::EmptyDiffusionCache {};
61template<class TypeTag> class DiffusionCacheChooser<TypeTag, true> : public GetPropType<TypeTag, Properties::MolecularDiffusionType>::Cache {};
62template<class TypeTag, bool EnableEnergyBalance> class EnergyCacheChooser : public FluxVariablesCaching::EmptyHeatConductionCache {};
63template<class TypeTag> class EnergyCacheChooser<TypeTag, true> : public GetPropType<TypeTag, Properties::HeatConductionType>::Cache {};
64
65
66// specialization for the cell centered tpfa method
67template<class TypeTag>
68class PorousMediumFluxVariablesCacheImplementation<TypeTag, DiscretizationMethods::CCTpfa>
69: public AdvectionCacheChooser<TypeTag, GetPropType<TypeTag, Properties::ModelTraits>::enableAdvection()>
70, public DiffusionCacheChooser<TypeTag, GetPropType<TypeTag, Properties::ModelTraits>::enableMolecularDiffusion()>
71, public EnergyCacheChooser<TypeTag, GetPropType<TypeTag, Properties::ModelTraits>::enableEnergyBalance()>
72{
73public:
76};
77
80template<class TypeTag>
81class PorousMediumFluxVariablesCacheImplementation<TypeTag, DiscretizationMethods::CCMpfa>
82: public AdvectionCacheChooser<TypeTag, GetPropType<TypeTag, Properties::ModelTraits>::enableAdvection()>
83, public DiffusionCacheChooser<TypeTag, GetPropType<TypeTag, Properties::ModelTraits>::enableMolecularDiffusion()>
84, public EnergyCacheChooser<TypeTag, GetPropType<TypeTag, Properties::ModelTraits>::enableEnergyBalance()>
85{
87
89 static constexpr bool considerSecondary = MpfaHelper::considerSecondaryIVs();
90public:
93
95 bool isUpdated() const { return isUpdated_; }
96
99 template< bool doSecondary = considerSecondary, std::enable_if_t<!doSecondary, int> = 0>
100 constexpr bool usesSecondaryIv() const { return false; }
101
104 template< bool doSecondary = considerSecondary, std::enable_if_t<doSecondary, int> = 0>
105 bool usesSecondaryIv() const { return usesSecondaryIv_; }
106
108 GridIndexType ivIndexInContainer() const { return ivIndexInContainer_; }
110 unsigned int ivLocalFaceIndex() const { return ivLocalFaceIdx_; }
112 unsigned int indexInOutsideFaces() const { return idxInOutsideFaces_; }
113
115 void setUpdateStatus(bool status) { isUpdated_ = status; }
117 void setSecondaryIvUsage(bool status) { usesSecondaryIv_ = status; }
119 void setIvIndexInContainer(GridIndexType ivIndex) { ivIndexInContainer_ = ivIndex; }
121 void setIvLocalFaceIndex(unsigned int idx) { ivLocalFaceIdx_ = idx; }
123 void setIndexInOutsideFaces(unsigned int idx) { idxInOutsideFaces_ = idx; }
124
125private:
126
127 bool isUpdated_ = false; // returns true if cache has been fully updated
128 bool usesSecondaryIv_ = false; // returns true if scvf is embedded in secondary interaction volume
129
130 GridIndexType ivIndexInContainer_; // index of the iv (this scvf is embedded in) in its container
131 unsigned int ivLocalFaceIdx_; // the interaction volume-local face index of this scvf
132 unsigned int idxInOutsideFaces_; // index of scvf among outside scvfs of iv-local "positive" face (only surface grids)
133};
134
135} // end namespace Dumux
136
137#endif
Definition: porousmediumflow/fluxvariablescache.hh:58
Flux variables cache class for control-volume finite element schemes. For control-volume finite eleme...
Definition: discretization/cvfe/fluxvariablescache.hh:27
Definition: porousmediumflow/fluxvariablescache.hh:60
Definition: porousmediumflow/fluxvariablescache.hh:62
GetPropType< TypeTag, Properties::Scalar > Scalar
export type used for scalar values
Definition: porousmediumflow/fluxvariablescache.hh:51
bool usesSecondaryIv() const
Definition: porousmediumflow/fluxvariablescache.hh:105
void setIvLocalFaceIndex(unsigned int idx)
Sets the iv-local face index.
Definition: porousmediumflow/fluxvariablescache.hh:121
unsigned int ivLocalFaceIndex() const
Returns interaction volume-local face index.
Definition: porousmediumflow/fluxvariablescache.hh:110
constexpr bool usesSecondaryIv() const
Definition: porousmediumflow/fluxvariablescache.hh:100
void setUpdateStatus(bool status)
Sets the update status. When set to true, consecutive updates will be skipped.
Definition: porousmediumflow/fluxvariablescache.hh:115
unsigned int indexInOutsideFaces() const
Returns index of the face among "outside" faces of iv-local "positive" face.
Definition: porousmediumflow/fluxvariablescache.hh:112
GridIndexType ivIndexInContainer() const
Returns the index of the iv (this scvf is embedded in) in its container.
Definition: porousmediumflow/fluxvariablescache.hh:108
void setSecondaryIvUsage(bool status)
Sets if this cache is associated with a secondary iv.
Definition: porousmediumflow/fluxvariablescache.hh:117
void setIndexInOutsideFaces(unsigned int idx)
Sets the index of the face among the "positive" face's outside scvfs.
Definition: porousmediumflow/fluxvariablescache.hh:123
void setIvIndexInContainer(GridIndexType ivIndex)
Sets the index of the iv (this scvf is embedded in) in its container.
Definition: porousmediumflow/fluxvariablescache.hh:119
bool isUpdated() const
Returns whether or not this cache has been updated.
Definition: porousmediumflow/fluxvariablescache.hh:95
GetPropType< TypeTag, Properties::Scalar > Scalar
export type used for scalar values
Definition: porousmediumflow/fluxvariablescache.hh:92
GetPropType< TypeTag, Properties::Scalar > Scalar
export type used for scalar values
Definition: porousmediumflow/fluxvariablescache.hh:75
Definition: porousmediumflow/fluxvariablescache.hh:24
Defines all properties used in Dumux.
Flux variables cache class for control-volume finite element schemes.
Classes related to flux variables caching.
typename GetProp< TypeTag, Property >::type GetPropType
get the type alias defined in the property
Definition: propertysystem.hh:296
The available discretization methods in Dumux.
Definition: adapt.hh:17
Empty caches to use in a constitutive flux law/process, e.g. Darcy's law.
Definition: fluxvariablescaching.hh:54
Definition: fluxvariablescaching.hh:55
Definition: fluxvariablescaching.hh:56