3.5-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
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 * 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 *****************************************************************************/
25#ifndef DUMUX_DISCRETIZATION_CC_MPFA_INTERACTIONVOLUMEDATAHANDLE_HH
26#define DUMUX_DISCRETIZATION_CC_MPFA_INTERACTIONVOLUMEDATAHANDLE_HH
27
28#include <cassert>
29#include <vector>
30
31#include <dune/common/dynvector.hh>
32
34
35namespace Dumux {
36namespace CCMpfaDataHandleBases {
37
59template<class MVT, int size1, int size2>
61{
62 using AMatrix = typename MVT::AMatrix;
63 using BMatrix = typename MVT::BMatrix;
64 using CMatrix = typename MVT::CMatrix;
65 using TMatrix = typename MVT::TMatrix;
66 using CellVector = typename MVT::CellVector;
67 using OutsideTij = std::vector< std::vector<CellVector> >;
68 using OmegaStorage = typename MVT::OmegaStorage;
69
70public:
72 const CMatrix& CA() const { return CA_[contextIdx1_][contextIdx2_]; }
73 CMatrix& CA() { return CA_[contextIdx1_][contextIdx2_]; }
74
75 const AMatrix& A() const { return A_[contextIdx1_][contextIdx2_]; }
76 AMatrix& A() { return A_[contextIdx1_][contextIdx2_]; }
77
78 const BMatrix& AB() const { return AB_[contextIdx1_][contextIdx2_]; }
79 BMatrix& AB() { return AB_[contextIdx1_][contextIdx2_]; }
80
81 const TMatrix& T() const { return T_[contextIdx1_][contextIdx2_]; }
82 TMatrix& T() { return T_[contextIdx1_][contextIdx2_]; }
83
84 const OutsideTij& tijOutside() const { return tijOutside_[contextIdx1_][contextIdx2_]; }
85 OutsideTij& tijOutside() { return tijOutside_[contextIdx1_][contextIdx2_]; }
86
87 const OmegaStorage& omegas() const { return wijk_[contextIdx1_][contextIdx2_]; }
88 OmegaStorage& omegas() { return wijk_[contextIdx1_][contextIdx2_]; }
89
91 void setContextIndex1(unsigned int idx) const { assert(idx < size1); contextIdx1_ = idx; }
92 void setContextIndex2(unsigned int idx) const { assert(idx < size2); contextIdx2_ = idx; }
93
94protected:
96 mutable unsigned int contextIdx1_{0};
97 mutable unsigned int contextIdx2_{0};
98
99 std::array< std::array<OmegaStorage, size2>, size1 > wijk_;
100
101 std::array< std::array<TMatrix, size2>, size1 > T_;
102 std::array< std::array<AMatrix, size2>, size1 > A_;
103 std::array< std::array<BMatrix, size2>, size1 > AB_;
104 std::array< std::array<CMatrix, size2>, size1 > CA_;
105 std::array< std::array<OutsideTij, size2>, size1 > tijOutside_;
106};
107
117template<class MVT, int size1, int size2>
119{
120 using CellVector = typename MVT::CellVector;
121
122public:
124 const CellVector& uj() const { return u_[contextIdx1_][contextIdx2_]; }
125 CellVector& uj() { return u_[contextIdx1_][contextIdx2_]; }
126
127protected:
129 void setContextIndex1(unsigned int idx) const { assert(idx < size1); contextIdx1_ = idx; }
130 void setContextIndex2(unsigned int idx) const { assert(idx < size2); contextIdx2_ = idx; }
131
133 mutable unsigned int contextIdx1_{0};
134 mutable unsigned int contextIdx2_{0};
135
137 std::array< std::array<CellVector, size2>, size1 > u_;
138};
139
140} // end namespace CCMpfaDataHandleBases
141
144
146template<class MatVecTraits, class PhysicsTraits, bool EnableAdvection>
148: public CCMpfaDataHandleBases::SystemMatricesHandle<MatVecTraits, 1, 1>
149, public CCMpfaDataHandleBases::SystemVectorsHandle<MatVecTraits, PhysicsTraits::numPhases, 1>
150{
151 // we only have one local system for all phases since we
152 // solve them w.r.t. permeability tensor (unique for all phases)
154
155 // we do have cell/Dirichlet values for all phases though!
156 static constexpr int numPhases = PhysicsTraits::numPhases;
158
159 using UnknownVector = typename MatVecTraits::AMatrix::row_type;
160 using FaceVector = typename MatVecTraits::FaceVector;
161 using FaceScalar = typename FaceVector::value_type;
162 using OutsideGravityStorage = std::vector< std::vector<FaceScalar> >;
163
164public:
166 void setPhaseIndex(unsigned int phaseIdx) const { Base2::setContextIndex1(phaseIdx); }
167
169 const FaceVector& g() const { return g_[Base2::contextIdx1_]; }
170 FaceVector& g() { return g_[Base2::contextIdx1_]; }
171
173 const UnknownVector& deltaG() const { return deltaG_[Base2::contextIdx1_]; }
174 UnknownVector& deltaG() { return deltaG_[Base2::contextIdx1_]; }
175
177 const OutsideGravityStorage& gOutside() const { return outsideG_[Base2::contextIdx1_]; }
178 OutsideGravityStorage& gOutside() { return outsideG_[Base2::contextIdx1_]; }
179
180private:
181 std::array< FaceVector, numPhases > g_;
182 std::array< UnknownVector, numPhases > deltaG_;
183 std::array< OutsideGravityStorage, numPhases > outsideG_;
184};
185
187template<class MatVecTraits, class PhysicsTraits, bool EnableDiffusion>
189: public CCMpfaDataHandleBases::SystemMatricesHandle<MatVecTraits, PhysicsTraits::numPhases, PhysicsTraits::numComponents>
190, public CCMpfaDataHandleBases::SystemVectorsHandle<MatVecTraits, PhysicsTraits::numPhases, PhysicsTraits::numComponents>
191{
192 static constexpr int numPhases = PhysicsTraits::numPhases;
193 static constexpr int numComponents = PhysicsTraits::numComponents;
196
197public:
199 void setPhaseIndex(unsigned int phaseIdx) const
200 { Base1::setContextIndex1(phaseIdx); Base2::setContextIndex1(phaseIdx); }
201 void setComponentIndex(unsigned int compIdx) const
203};
204
206template<class MatVecTraits, class PhysicsTraits, bool enableHeatConduction>
208: public CCMpfaDataHandleBases::SystemMatricesHandle<MatVecTraits, 1, 1>
209, public CCMpfaDataHandleBases::SystemVectorsHandle<MatVecTraits, 1, 1>
210{};
211
213template<class MatVecTraits, class PhysicsTraits>
214class AdvectionDataHandle<MatVecTraits, PhysicsTraits, false> : public EmptyDataHandle {};
215template<class MatVecTraits, class PhysicsTraits>
216class DiffusionDataHandle<MatVecTraits, PhysicsTraits, false> : public EmptyDataHandle {};
217template<class MatVecTraits, class PhysicsTraits>
218class HeatConductionDataHandle<MatVecTraits, PhysicsTraits, false> : public EmptyDataHandle {};
219
227template<class MVT, class PT>
229{
230
231public:
236
238 const AdvectionHandle& advectionHandle() const { return advectionHandle_; }
239 AdvectionHandle& advectionHandle() { return advectionHandle_; }
240
242 const DiffusionHandle& diffusionHandle() const { return diffusionHandle_; }
243 DiffusionHandle& diffusionHandle() { return diffusionHandle_; }
244
246 const HeatConductionHandle& heatConductionHandle() const { return heatConductionHandle_; }
247 HeatConductionHandle& heatConductionHandle() { return heatConductionHandle_; }
248
249private:
250 AdvectionHandle advectionHandle_;
251 DiffusionHandle diffusionHandle_;
252 HeatConductionHandle heatConductionHandle_;
253};
254
255} // end namespace Dumux
256
257#endif
The infrastructure to retrieve run-time parameters from Dune::ParameterTrees.
Definition: adapt.hh:29
Common base class to all handles. Stores arrays of the matrices involved in the interaction volume-lo...
Definition: interactionvolumedatahandle.hh:61
std::array< std::array< OutsideTij, size2 >, size1 > tijOutside_
The transmissibilities for "outside" faces (on surface grids)
Definition: interactionvolumedatahandle.hh:105
std::array< std::array< CMatrix, size2 >, size1 > CA_
A_ right multiplied to C.
Definition: interactionvolumedatahandle.hh:104
void setContextIndex1(unsigned int idx) const
functionality to set the context indices
Definition: interactionvolumedatahandle.hh:91
std::array< std::array< TMatrix, size2 >, size1 > T_
The transmissibility matrix.
Definition: interactionvolumedatahandle.hh:101
unsigned int contextIdx2_
Definition: interactionvolumedatahandle.hh:97
const OmegaStorage & omegas() const
Definition: interactionvolumedatahandle.hh:87
BMatrix & AB()
Definition: interactionvolumedatahandle.hh:79
OutsideTij & tijOutside()
Definition: interactionvolumedatahandle.hh:85
std::array< std::array< BMatrix, size2 >, size1 > AB_
A_ left multiplied to B.
Definition: interactionvolumedatahandle.hh:103
const OutsideTij & tijOutside() const
Definition: interactionvolumedatahandle.hh:84
TMatrix & T()
Definition: interactionvolumedatahandle.hh:82
CMatrix & CA()
Definition: interactionvolumedatahandle.hh:73
const BMatrix & AB() const
Definition: interactionvolumedatahandle.hh:78
unsigned int contextIdx1_
indices to be set before accessing data
Definition: interactionvolumedatahandle.hh:96
AMatrix & A()
Definition: interactionvolumedatahandle.hh:76
std::array< std::array< OmegaStorage, size2 >, size1 > wijk_
The omega factors that form the entries of the matrices.
Definition: interactionvolumedatahandle.hh:99
const CMatrix & CA() const
Access functions to context-dependent data.
Definition: interactionvolumedatahandle.hh:72
std::array< std::array< AMatrix, size2 >, size1 > A_
Inverse of the iv-local system matrix.
Definition: interactionvolumedatahandle.hh:102
const AMatrix & A() const
Definition: interactionvolumedatahandle.hh:75
OmegaStorage & omegas()
Definition: interactionvolumedatahandle.hh:88
void setContextIndex2(unsigned int idx) const
Definition: interactionvolumedatahandle.hh:92
const TMatrix & T() const
Definition: interactionvolumedatahandle.hh:81
Common base class to all handles. Stores arrays of the vectors involved in the interaction volume-loc...
Definition: interactionvolumedatahandle.hh:119
unsigned int contextIdx1_
indices to be set before accessing data
Definition: interactionvolumedatahandle.hh:133
CellVector & uj()
Definition: interactionvolumedatahandle.hh:125
std::array< std::array< CellVector, size2 >, size1 > u_
The interaction volume-local known values.
Definition: interactionvolumedatahandle.hh:137
void setContextIndex2(unsigned int idx) const
Definition: interactionvolumedatahandle.hh:130
const CellVector & uj() const
Access to the iv-wide known cell/Dirichlet values.
Definition: interactionvolumedatahandle.hh:124
unsigned int contextIdx2_
Definition: interactionvolumedatahandle.hh:134
void setContextIndex1(unsigned int idx) const
functionality to set the context indices
Definition: interactionvolumedatahandle.hh:129
Empty data handle class.
Definition: interactionvolumedatahandle.hh:143
Data handle for quantities related to advection.
Definition: interactionvolumedatahandle.hh:150
const UnknownVector & deltaG() const
The deltaG vector for gravity within the iv-local eq-system.
Definition: interactionvolumedatahandle.hh:173
const OutsideGravityStorage & gOutside() const
The gravitational acceleration for one phase on "outside" faces (used on surface grids)
Definition: interactionvolumedatahandle.hh:177
void setPhaseIndex(unsigned int phaseIdx) const
Set the phase index of the context.
Definition: interactionvolumedatahandle.hh:166
OutsideGravityStorage & gOutside()
Definition: interactionvolumedatahandle.hh:178
UnknownVector & deltaG()
Definition: interactionvolumedatahandle.hh:174
const FaceVector & g() const
The gravitational flux contributions for a phase on all faces.
Definition: interactionvolumedatahandle.hh:169
FaceVector & g()
Definition: interactionvolumedatahandle.hh:170
Data handle for quantities related to diffusion.
Definition: interactionvolumedatahandle.hh:191
void setComponentIndex(unsigned int compIdx) const
Definition: interactionvolumedatahandle.hh:201
void setPhaseIndex(unsigned int phaseIdx) const
diffusion caches need to set phase and component index
Definition: interactionvolumedatahandle.hh:199
Data handle for quantities related to heat conduction.
Definition: interactionvolumedatahandle.hh:210
Class for the interaction volume data handle.
Definition: interactionvolumedatahandle.hh:229
HeatConductionDataHandle< MVT, PT, PT::enableHeatConduction > HeatConductionHandle
Definition: interactionvolumedatahandle.hh:235
DiffusionDataHandle< MVT, PT, PT::enableMolecularDiffusion > DiffusionHandle
Definition: interactionvolumedatahandle.hh:234
DiffusionHandle & diffusionHandle()
Definition: interactionvolumedatahandle.hh:243
HeatConductionHandle & heatConductionHandle()
Definition: interactionvolumedatahandle.hh:247
const HeatConductionHandle & heatConductionHandle() const
return references to the handle containing data related to heat conduction
Definition: interactionvolumedatahandle.hh:246
AdvectionHandle & advectionHandle()
Definition: interactionvolumedatahandle.hh:239
const DiffusionHandle & diffusionHandle() const
return references to the handle containing data related to diffusion
Definition: interactionvolumedatahandle.hh:242
AdvectionDataHandle< MVT, PT, PT::enableAdvection > AdvectionHandle
export the underlying process-specific handle types
Definition: interactionvolumedatahandle.hh:233
const AdvectionHandle & advectionHandle() const
return references to the handle containing data related to advection
Definition: interactionvolumedatahandle.hh:238