version 3.8
interactionvolumedatahandle.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//
13#ifndef DUMUX_DISCRETIZATION_CC_MPFA_INTERACTIONVOLUMEDATAHANDLE_HH
14#define DUMUX_DISCRETIZATION_CC_MPFA_INTERACTIONVOLUMEDATAHANDLE_HH
15
16#include <cassert>
17#include <vector>
18
19#include <dune/common/dynvector.hh>
20
22
23namespace Dumux {
24namespace CCMpfaDataHandleBases {
25
47template<class MVT, int size1, int size2>
49{
50 using AMatrix = typename MVT::AMatrix;
51 using BMatrix = typename MVT::BMatrix;
52 using CMatrix = typename MVT::CMatrix;
53 using TMatrix = typename MVT::TMatrix;
54 using CellVector = typename MVT::CellVector;
55 using OutsideTij = std::vector< std::vector<CellVector> >;
56 using OmegaStorage = typename MVT::OmegaStorage;
57
58public:
60 const CMatrix& CA() const { return CA_[contextIdx1_][contextIdx2_]; }
61 CMatrix& CA() { return CA_[contextIdx1_][contextIdx2_]; }
62
63 const AMatrix& A() const { return A_[contextIdx1_][contextIdx2_]; }
64 AMatrix& A() { return A_[contextIdx1_][contextIdx2_]; }
65
66 const BMatrix& AB() const { return AB_[contextIdx1_][contextIdx2_]; }
67 BMatrix& AB() { return AB_[contextIdx1_][contextIdx2_]; }
68
69 const TMatrix& T() const { return T_[contextIdx1_][contextIdx2_]; }
70 TMatrix& T() { return T_[contextIdx1_][contextIdx2_]; }
71
72 const OutsideTij& tijOutside() const { return tijOutside_[contextIdx1_][contextIdx2_]; }
73 OutsideTij& tijOutside() { return tijOutside_[contextIdx1_][contextIdx2_]; }
74
75 const OmegaStorage& omegas() const { return wijk_[contextIdx1_][contextIdx2_]; }
76 OmegaStorage& omegas() { return wijk_[contextIdx1_][contextIdx2_]; }
77
79 void setContextIndex1(unsigned int idx) const { assert(idx < size1); contextIdx1_ = idx; }
80 void setContextIndex2(unsigned int idx) const { assert(idx < size2); contextIdx2_ = idx; }
81
82protected:
84 mutable unsigned int contextIdx1_{0};
85 mutable unsigned int contextIdx2_{0};
86
87 std::array< std::array<OmegaStorage, size2>, size1 > wijk_;
88
89 std::array< std::array<TMatrix, size2>, size1 > T_;
90 std::array< std::array<AMatrix, size2>, size1 > A_;
91 std::array< std::array<BMatrix, size2>, size1 > AB_;
92 std::array< std::array<CMatrix, size2>, size1 > CA_;
93 std::array< std::array<OutsideTij, size2>, size1 > tijOutside_;
94};
95
105template<class MVT, int size1, int size2>
107{
108 using CellVector = typename MVT::CellVector;
109
110public:
112 const CellVector& uj() const { return u_[contextIdx1_][contextIdx2_]; }
113 CellVector& uj() { return u_[contextIdx1_][contextIdx2_]; }
114
115protected:
117 void setContextIndex1(unsigned int idx) const { assert(idx < size1); contextIdx1_ = idx; }
118 void setContextIndex2(unsigned int idx) const { assert(idx < size2); contextIdx2_ = idx; }
119
121 mutable unsigned int contextIdx1_{0};
122 mutable unsigned int contextIdx2_{0};
123
125 std::array< std::array<CellVector, size2>, size1 > u_;
126};
127
128} // end namespace CCMpfaDataHandleBases
129
132
137template<class MatVecTraits, class PhysicsTraits, bool EnableAdvection>
139: public CCMpfaDataHandleBases::SystemMatricesHandle<MatVecTraits, 1, 1>
140, public CCMpfaDataHandleBases::SystemVectorsHandle<MatVecTraits, PhysicsTraits::numPhases, 1>
141{
142 // we only have one local system for all phases since we
143 // solve them w.r.t. permeability tensor (unique for all phases)
145
146 // we do have cell/Dirichlet values for all phases though!
147 static constexpr int numPhases = PhysicsTraits::numPhases;
149
150 using UnknownVector = typename MatVecTraits::AMatrix::row_type;
151 using FaceVector = typename MatVecTraits::FaceVector;
152 using FaceScalar = typename FaceVector::value_type;
153 using OutsideGravityStorage = std::vector< std::vector<FaceScalar> >;
154
155public:
157 void setPhaseIndex(unsigned int phaseIdx) const { Base2::setContextIndex1(phaseIdx); }
158
160 const FaceVector& g() const { return g_[Base2::contextIdx1_]; }
161 FaceVector& g() { return g_[Base2::contextIdx1_]; }
162
164 const UnknownVector& deltaG() const { return deltaG_[Base2::contextIdx1_]; }
165 UnknownVector& deltaG() { return deltaG_[Base2::contextIdx1_]; }
166
168 const OutsideGravityStorage& gOutside() const { return outsideG_[Base2::contextIdx1_]; }
169 OutsideGravityStorage& gOutside() { return outsideG_[Base2::contextIdx1_]; }
170
171private:
172 std::array< FaceVector, numPhases > g_;
173 std::array< UnknownVector, numPhases > deltaG_;
174 std::array< OutsideGravityStorage, numPhases > outsideG_;
175};
176
181template<class MatVecTraits, class PhysicsTraits, bool EnableDiffusion>
183: public CCMpfaDataHandleBases::SystemMatricesHandle<MatVecTraits, PhysicsTraits::numPhases, PhysicsTraits::numComponents>
184, public CCMpfaDataHandleBases::SystemVectorsHandle<MatVecTraits, PhysicsTraits::numPhases, PhysicsTraits::numComponents>
185{
186 static constexpr int numPhases = PhysicsTraits::numPhases;
187 static constexpr int numComponents = PhysicsTraits::numComponents;
190
191public:
193 void setPhaseIndex(unsigned int phaseIdx) const
194 { Base1::setContextIndex1(phaseIdx); Base2::setContextIndex1(phaseIdx); }
195 void setComponentIndex(unsigned int compIdx) const
197};
198
203template<class MatVecTraits, class PhysicsTraits, bool enableHeatConduction>
205: public CCMpfaDataHandleBases::SystemMatricesHandle<MatVecTraits, 1, 1>
206, public CCMpfaDataHandleBases::SystemVectorsHandle<MatVecTraits, 1, 1>
207{};
208
210template<class MatVecTraits, class PhysicsTraits>
211class AdvectionDataHandle<MatVecTraits, PhysicsTraits, false> : public EmptyDataHandle {};
212template<class MatVecTraits, class PhysicsTraits>
213class DiffusionDataHandle<MatVecTraits, PhysicsTraits, false> : public EmptyDataHandle {};
214template<class MatVecTraits, class PhysicsTraits>
215class HeatConductionDataHandle<MatVecTraits, PhysicsTraits, false> : public EmptyDataHandle {};
216
224template<class MVT, class PT>
226{
227
228public:
233
235 const AdvectionHandle& advectionHandle() const { return advectionHandle_; }
236 AdvectionHandle& advectionHandle() { return advectionHandle_; }
237
239 const DiffusionHandle& diffusionHandle() const { return diffusionHandle_; }
240 DiffusionHandle& diffusionHandle() { return diffusionHandle_; }
241
243 const HeatConductionHandle& heatConductionHandle() const { return heatConductionHandle_; }
244 HeatConductionHandle& heatConductionHandle() { return heatConductionHandle_; }
245
246private:
247 AdvectionHandle advectionHandle_;
248 DiffusionHandle diffusionHandle_;
249 HeatConductionHandle heatConductionHandle_;
250};
251
252} // end namespace Dumux
253
254#endif
Data handle for quantities related to advection.
Definition: interactionvolumedatahandle.hh:141
const UnknownVector & deltaG() const
The deltaG vector for gravity within the iv-local eq-system.
Definition: interactionvolumedatahandle.hh:164
const OutsideGravityStorage & gOutside() const
The gravitational acceleration for one phase on "outside" faces (used on surface grids)
Definition: interactionvolumedatahandle.hh:168
void setPhaseIndex(unsigned int phaseIdx) const
Set the phase index of the context.
Definition: interactionvolumedatahandle.hh:157
OutsideGravityStorage & gOutside()
Definition: interactionvolumedatahandle.hh:169
UnknownVector & deltaG()
Definition: interactionvolumedatahandle.hh:165
const FaceVector & g() const
The gravitational flux contributions for a phase on all faces.
Definition: interactionvolumedatahandle.hh:160
FaceVector & g()
Definition: interactionvolumedatahandle.hh:161
Common base class to all handles. Stores arrays of the matrices involved in the interaction volume-lo...
Definition: interactionvolumedatahandle.hh:49
std::array< std::array< OutsideTij, size2 >, size1 > tijOutside_
The transmissibilities for "outside" faces (on surface grids)
Definition: interactionvolumedatahandle.hh:93
std::array< std::array< CMatrix, size2 >, size1 > CA_
A_ right multiplied to C.
Definition: interactionvolumedatahandle.hh:92
void setContextIndex1(unsigned int idx) const
functionality to set the context indices
Definition: interactionvolumedatahandle.hh:79
std::array< std::array< TMatrix, size2 >, size1 > T_
The transmissibility matrix.
Definition: interactionvolumedatahandle.hh:89
unsigned int contextIdx2_
Definition: interactionvolumedatahandle.hh:85
const OmegaStorage & omegas() const
Definition: interactionvolumedatahandle.hh:75
BMatrix & AB()
Definition: interactionvolumedatahandle.hh:67
OutsideTij & tijOutside()
Definition: interactionvolumedatahandle.hh:73
std::array< std::array< BMatrix, size2 >, size1 > AB_
A_ left multiplied to B.
Definition: interactionvolumedatahandle.hh:91
const OutsideTij & tijOutside() const
Definition: interactionvolumedatahandle.hh:72
TMatrix & T()
Definition: interactionvolumedatahandle.hh:70
CMatrix & CA()
Definition: interactionvolumedatahandle.hh:61
const BMatrix & AB() const
Definition: interactionvolumedatahandle.hh:66
unsigned int contextIdx1_
indices to be set before accessing data
Definition: interactionvolumedatahandle.hh:84
AMatrix & A()
Definition: interactionvolumedatahandle.hh:64
std::array< std::array< OmegaStorage, size2 >, size1 > wijk_
The omega factors that form the entries of the matrices.
Definition: interactionvolumedatahandle.hh:87
const CMatrix & CA() const
Access functions to context-dependent data.
Definition: interactionvolumedatahandle.hh:60
std::array< std::array< AMatrix, size2 >, size1 > A_
Inverse of the iv-local system matrix.
Definition: interactionvolumedatahandle.hh:90
const AMatrix & A() const
Definition: interactionvolumedatahandle.hh:63
OmegaStorage & omegas()
Definition: interactionvolumedatahandle.hh:76
void setContextIndex2(unsigned int idx) const
Definition: interactionvolumedatahandle.hh:80
const TMatrix & T() const
Definition: interactionvolumedatahandle.hh:69
Common base class to all handles. Stores arrays of the vectors involved in the interaction volume-loc...
Definition: interactionvolumedatahandle.hh:107
unsigned int contextIdx1_
indices to be set before accessing data
Definition: interactionvolumedatahandle.hh:121
CellVector & uj()
Definition: interactionvolumedatahandle.hh:113
std::array< std::array< CellVector, size2 >, size1 > u_
The interaction volume-local known values.
Definition: interactionvolumedatahandle.hh:125
void setContextIndex2(unsigned int idx) const
Definition: interactionvolumedatahandle.hh:118
const CellVector & uj() const
Access to the iv-wide known cell/Dirichlet values.
Definition: interactionvolumedatahandle.hh:112
unsigned int contextIdx2_
Definition: interactionvolumedatahandle.hh:122
void setContextIndex1(unsigned int idx) const
functionality to set the context indices
Definition: interactionvolumedatahandle.hh:117
Data handle for quantities related to diffusion.
Definition: interactionvolumedatahandle.hh:185
void setComponentIndex(unsigned int compIdx) const
Definition: interactionvolumedatahandle.hh:195
void setPhaseIndex(unsigned int phaseIdx) const
diffusion caches need to set phase and component index
Definition: interactionvolumedatahandle.hh:193
Empty data handle class.
Definition: interactionvolumedatahandle.hh:131
Data handle for quantities related to heat conduction.
Definition: interactionvolumedatahandle.hh:207
Class for the interaction volume data handle.
Definition: interactionvolumedatahandle.hh:226
HeatConductionDataHandle< MVT, PT, PT::enableHeatConduction > HeatConductionHandle
Definition: interactionvolumedatahandle.hh:232
DiffusionDataHandle< MVT, PT, PT::enableMolecularDiffusion > DiffusionHandle
Definition: interactionvolumedatahandle.hh:231
DiffusionHandle & diffusionHandle()
Definition: interactionvolumedatahandle.hh:240
HeatConductionHandle & heatConductionHandle()
Definition: interactionvolumedatahandle.hh:244
const HeatConductionHandle & heatConductionHandle() const
return references to the handle containing data related to heat conduction
Definition: interactionvolumedatahandle.hh:243
AdvectionHandle & advectionHandle()
Definition: interactionvolumedatahandle.hh:236
const DiffusionHandle & diffusionHandle() const
return references to the handle containing data related to diffusion
Definition: interactionvolumedatahandle.hh:239
AdvectionDataHandle< MVT, PT, PT::enableAdvection > AdvectionHandle
export the underlying process-specific handle types
Definition: interactionvolumedatahandle.hh:230
const AdvectionHandle & advectionHandle() const
return references to the handle containing data related to advection
Definition: interactionvolumedatahandle.hh:235
Definition: adapt.hh:17
The infrastructure to retrieve run-time parameters from Dune::ParameterTrees.