3.6-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
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 * See the file COPYING for full copying permissions. *
5 * *
6 * This program is free software: you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation, either version 3 of the License, or *
9 * (at your option) any later version. *
10 * *
11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU General Public License *
17 * along with this program. If not, see <http://www.gnu.org/licenses/>. *
18 *****************************************************************************/
24#ifndef DUMUX_POROUSMEDIUM_FLUXVARIABLESCACHE_HH
25#define DUMUX_POROUSMEDIUM_FLUXVARIABLESCACHE_HH
26
31
32namespace Dumux {
33
34// forward declaration
35template<class TypeTag, class DiscretizationMethod>
37
43
52template<class TypeTag>
54
57template<class TypeTag, class DM>
58class PorousMediumFluxVariablesCacheImplementation<TypeTag, DiscretizationMethods::CVFE<DM>>
59: public CVFEFluxVariablesCache<GetPropType<TypeTag, Properties::Scalar>, GetPropType<TypeTag, Properties::GridGeometry>>
60{
61public:
64};
65
66// the following classes choose the cache type: empty if the law disabled and the law's cache if it's enabled
67// if advections is disabled the advection type is still instantiated if we use std::conditional_t and has to be a full type
68// in order to prevent that instead of std::conditional_t we use this helper type is only dependent on the advection type
69// if advection is enabled otherwise its an empty cache type
70template<class TypeTag, bool EnableAdvection> class AdvectionCacheChooser : public FluxVariablesCaching::EmptyAdvectionCache {};
71template<class TypeTag> class AdvectionCacheChooser<TypeTag, true> : public GetPropType<TypeTag, Properties::AdvectionType>::Cache {};
72template<class TypeTag, bool EnableMolecularDiffusion> class DiffusionCacheChooser : public FluxVariablesCaching::EmptyDiffusionCache {};
73template<class TypeTag> class DiffusionCacheChooser<TypeTag, true> : public GetPropType<TypeTag, Properties::MolecularDiffusionType>::Cache {};
74template<class TypeTag, bool EnableEnergyBalance> class EnergyCacheChooser : public FluxVariablesCaching::EmptyHeatConductionCache {};
75template<class TypeTag> class EnergyCacheChooser<TypeTag, true> : public GetPropType<TypeTag, Properties::HeatConductionType>::Cache {};
76
77
78// specialization for the cell centered tpfa method
79template<class TypeTag>
80class PorousMediumFluxVariablesCacheImplementation<TypeTag, DiscretizationMethods::CCTpfa>
81: public AdvectionCacheChooser<TypeTag, GetPropType<TypeTag, Properties::ModelTraits>::enableAdvection()>
82, public DiffusionCacheChooser<TypeTag, GetPropType<TypeTag, Properties::ModelTraits>::enableMolecularDiffusion()>
83, public EnergyCacheChooser<TypeTag, GetPropType<TypeTag, Properties::ModelTraits>::enableEnergyBalance()>
84{
85public:
88};
89
92template<class TypeTag>
93class PorousMediumFluxVariablesCacheImplementation<TypeTag, DiscretizationMethods::CCMpfa>
94: public AdvectionCacheChooser<TypeTag, GetPropType<TypeTag, Properties::ModelTraits>::enableAdvection()>
95, public DiffusionCacheChooser<TypeTag, GetPropType<TypeTag, Properties::ModelTraits>::enableMolecularDiffusion()>
96, public EnergyCacheChooser<TypeTag, GetPropType<TypeTag, Properties::ModelTraits>::enableEnergyBalance()>
97{
99
101 static constexpr bool considerSecondary = MpfaHelper::considerSecondaryIVs();
102public:
105
107 bool isUpdated() const { return isUpdated_; }
108
111 template< bool doSecondary = considerSecondary, std::enable_if_t<!doSecondary, int> = 0>
112 constexpr bool usesSecondaryIv() const { return false; }
113
116 template< bool doSecondary = considerSecondary, std::enable_if_t<doSecondary, int> = 0>
117 bool usesSecondaryIv() const { return usesSecondaryIv_; }
118
120 GridIndexType ivIndexInContainer() const { return ivIndexInContainer_; }
122 unsigned int ivLocalFaceIndex() const { return ivLocalFaceIdx_; }
124 unsigned int indexInOutsideFaces() const { return idxInOutsideFaces_; }
125
127 void setUpdateStatus(bool status) { isUpdated_ = status; }
129 void setSecondaryIvUsage(bool status) { usesSecondaryIv_ = status; }
131 void setIvIndexInContainer(GridIndexType ivIndex) { ivIndexInContainer_ = ivIndex; }
133 void setIvLocalFaceIndex(unsigned int idx) { ivLocalFaceIdx_ = idx; }
135 void setIndexInOutsideFaces(unsigned int idx) { idxInOutsideFaces_ = idx; }
136
137private:
138
139 bool isUpdated_ = false; // returns true if cache has been fully updated
140 bool usesSecondaryIv_ = false; // returns true if scvf is embedded in secondary interaction volume
141
142 GridIndexType ivIndexInContainer_; // index of the iv (this scvf is embedded in) in its container
143 unsigned int ivLocalFaceIdx_; // the interaction volume-local face index of this scvf
144 unsigned int idxInOutsideFaces_; // index of scvf among outside scvfs of iv-local "positive" face (only surface grids)
145};
146
147} // end namespace Dumux
148
149#endif
The available discretization methods in Dumux.
Classes related to flux variables caching.
Adaption of the non-isothermal two-phase two-component flow model to problems with CO2.
Definition: adapt.hh:29
typename GetProp< TypeTag, Property >::type GetPropType
get the type alias defined in the property
Definition: propertysystem.hh:180
Flux variables cache class for control-volume finite element schemes. For control-volume finite eleme...
Definition: discretization/cvfe/fluxvariablescache.hh:39
Empty caches to use in a constitutive flux law/process, e.g. Darcy's law.
Definition: fluxvariablescaching.hh:66
Definition: fluxvariablescaching.hh:67
Definition: fluxvariablescaching.hh:68
Definition: porousmediumflow/fluxvariablescache.hh:36
GetPropType< TypeTag, Properties::Scalar > Scalar
export type used for scalar values
Definition: porousmediumflow/fluxvariablescache.hh:63
Definition: porousmediumflow/fluxvariablescache.hh:70
Definition: porousmediumflow/fluxvariablescache.hh:72
Definition: porousmediumflow/fluxvariablescache.hh:74
GetPropType< TypeTag, Properties::Scalar > Scalar
export type used for scalar values
Definition: porousmediumflow/fluxvariablescache.hh:87
bool usesSecondaryIv() const
Definition: porousmediumflow/fluxvariablescache.hh:117
void setIvLocalFaceIndex(unsigned int idx)
Sets the iv-local face index.
Definition: porousmediumflow/fluxvariablescache.hh:133
unsigned int ivLocalFaceIndex() const
Returns interaction volume-local face index.
Definition: porousmediumflow/fluxvariablescache.hh:122
constexpr bool usesSecondaryIv() const
Definition: porousmediumflow/fluxvariablescache.hh:112
void setUpdateStatus(bool status)
Sets the update status. When set to true, consecutive updates will be skipped.
Definition: porousmediumflow/fluxvariablescache.hh:127
unsigned int indexInOutsideFaces() const
Returns index of the face among "outside" faces of iv-local "positive" face.
Definition: porousmediumflow/fluxvariablescache.hh:124
GridIndexType ivIndexInContainer() const
Returns the index of the iv (this scvf is embedded in) in its container.
Definition: porousmediumflow/fluxvariablescache.hh:120
void setSecondaryIvUsage(bool status)
Sets if this cache is associated with a secondary iv.
Definition: porousmediumflow/fluxvariablescache.hh:129
void setIndexInOutsideFaces(unsigned int idx)
Sets the index of the face among the "positive" face's outside scvfs.
Definition: porousmediumflow/fluxvariablescache.hh:135
void setIvIndexInContainer(GridIndexType ivIndex)
Sets the index of the iv (this scvf is embedded in) in its container.
Definition: porousmediumflow/fluxvariablescache.hh:131
bool isUpdated() const
Returns whether or not this cache has been updated.
Definition: porousmediumflow/fluxvariablescache.hh:107
GetPropType< TypeTag, Properties::Scalar > Scalar
export type used for scalar values
Definition: porousmediumflow/fluxvariablescache.hh:104
Declares all properties used in Dumux.
Flux variables cache class for control-volume finite element schemes.