3.3.0
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
linearsolvertraits.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_LINEAR_SOLVER_TRAITS_HH
25#define DUMUX_LINEAR_SOLVER_TRAITS_HH
26
27#include <dune/istl/schwarz.hh>
28#include <dune/istl/novlpschwarz.hh>
29#include <dune/istl/owneroverlapcopy.hh>
30#include <dune/istl/paamg/pinfo.hh>
31#include <dune/istl/preconditioners.hh>
32#include <dune/grid/common/capabilities.hh>
33
35
36// TODO: The following is a temporary solution to make the parallel AMG work
37// for UGGrid. Once it is resolved upstream
38// (https://gitlab.dune-project.org/core/dune-grid/issues/78),
39// it should be guarded by a DUNE_VERSION macro and removed later.
40
41#if HAVE_UG
42#include <dune/grid/uggrid.hh>
43#endif // HAVE_UG
44
46
47template<class Grid, int codim>
49{
50 static const bool v = false;
51};
52
53#if HAVE_UG
54template<int dim, int codim>
55struct canCommunicate<Dune::UGGrid<dim>, codim>
56{
57 static const bool v = true;
58};
59#endif // HAVE_UG
60
61} // namespace Dumux::Temp::Capabilities
62// end workaround
63
64namespace Dumux {
65
67template<class GridGeometry, DiscretizationMethod discMethod>
69
71template<class GridGeometry>
73
75template<class MType, class VType>
77{
78 using Matrix = MType;
79 using Vector = VType;
80 using LinearOperator = Dune::MatrixAdapter<MType, VType, VType>;
81 using ScalarProduct = Dune::SeqScalarProduct<VType>;
82
83 template<class SeqPreconditioner>
84 using Preconditioner = SeqPreconditioner;
85};
86
87#if HAVE_MPI
88template <class MType, class VType>
90{
91public:
92 using Matrix = MType;
93 using Vector = VType;
94 using Comm = Dune::OwnerOverlapCopyCommunication<Dune::bigunsignedint<96>, int>;
95 using LinearOperator = Dune::NonoverlappingSchwarzOperator<MType, VType, VType, Comm>;
96 using ScalarProduct = Dune::NonoverlappingSchwarzScalarProduct<VType, Comm>;
97 static constexpr bool isNonOverlapping = true;
98
99 template<class SeqPreconditioner>
100 using Preconditioner = Dune::NonoverlappingBlockPreconditioner<Comm, SeqPreconditioner>;
101};
102
103template <class MType, class VType>
105{
106public:
107 using Matrix = MType;
108 using Vector = VType;
109 using Comm = Dune::OwnerOverlapCopyCommunication<Dune::bigunsignedint<96>, int>;
110 using LinearOperator = Dune::OverlappingSchwarzOperator<MType, VType, VType, Comm>;
111 using ScalarProduct = Dune::OverlappingSchwarzScalarProduct<VType, Comm>;
112 static constexpr bool isNonOverlapping = false;
113
114 template<class SeqPreconditioner>
115 using Preconditioner = Dune::BlockPreconditioner<VType, VType, Comm, SeqPreconditioner>;
116};
117#endif
118
119template<class GridGeometry>
121{
122 using GridView = typename GridGeometry::GridView;
123 using Grid = typename GridGeometry::GridView::Traits::Grid;
124
125 template<class Matrix, class Vector>
127
128#if HAVE_MPI
129 template<class Matrix, class Vector>
131
132 template<class Matrix, class Vector>
134#endif
135};
136
138template<class GridGeometry>
140: public LinearSolverTraitsBase<GridGeometry>
141{
142 using DofMapper = typename GridGeometry::VertexMapper;
143 using Grid = typename GridGeometry::GridView::Traits::Grid;
144 static constexpr int dofCodim = Grid::dimension;
145
146 // TODO: see above for description of this workaround, remove second line if fixed upstream
147 static constexpr bool canCommunicate =
148 Dune::Capabilities::canCommunicate<Grid, dofCodim>::v
150
151 template<class GridView>
152 static bool isNonOverlapping(const GridView& gridView)
153 { return gridView.overlapSize(0) == 0; }
154};
155
157template<class GridGeometry>
159: public LinearSolverTraitsBase<GridGeometry>
160{
161 using DofMapper = typename GridGeometry::ElementMapper;
162 using Grid = typename GridGeometry::GridView::Traits::Grid;
163 static constexpr int dofCodim = 0;
164
165 // TODO: see above for description of this workaround, remove second line if fixed upstream
166 static constexpr bool canCommunicate =
167 Dune::Capabilities::canCommunicate<Grid, dofCodim>::v
169
170 template<class GridView>
171 static bool isNonOverlapping(const GridView& gridView)
172 { return false; }
173};
174
176template<class GridGeometry>
178: public LinearSolverTraitsImpl<GridGeometry, DiscretizationMethod::cctpfa> {};
179
181template<class GridGeometry>
183: public LinearSolverTraitsImpl<GridGeometry, DiscretizationMethod::cctpfa> {};
184
185} // end namespace Dumux
186
187#endif
The available discretization methods in Dumux.
DiscretizationMethod
The available discretization methods in Dumux.
Definition: method.hh:37
Definition: adapt.hh:29
Definition: common/pdesolver.hh:35
Definition: linearsolvertraits.hh:45
Definition: linearsolvertraits.hh:49
static const bool v
Definition: linearsolvertraits.hh:50
The implementation is specialized for the different discretizations.
Definition: linearsolvertraits.hh:68
sequential solver traits
Definition: linearsolvertraits.hh:77
MType Matrix
Definition: linearsolvertraits.hh:78
VType Vector
Definition: linearsolvertraits.hh:79
Dune::MatrixAdapter< MType, VType, VType > LinearOperator
Definition: linearsolvertraits.hh:80
SeqPreconditioner Preconditioner
Definition: linearsolvertraits.hh:84
Dune::SeqScalarProduct< VType > ScalarProduct
Definition: linearsolvertraits.hh:81
Definition: linearsolvertraits.hh:90
Dune::NonoverlappingSchwarzOperator< MType, VType, VType, Comm > LinearOperator
Definition: linearsolvertraits.hh:95
MType Matrix
Definition: linearsolvertraits.hh:92
Dune::NonoverlappingBlockPreconditioner< Comm, SeqPreconditioner > Preconditioner
Definition: linearsolvertraits.hh:100
Dune::NonoverlappingSchwarzScalarProduct< VType, Comm > ScalarProduct
Definition: linearsolvertraits.hh:96
VType Vector
Definition: linearsolvertraits.hh:93
Dune::OwnerOverlapCopyCommunication< Dune::bigunsignedint< 96 >, int > Comm
Definition: linearsolvertraits.hh:94
static constexpr bool isNonOverlapping
Definition: linearsolvertraits.hh:97
Definition: linearsolvertraits.hh:105
static constexpr bool isNonOverlapping
Definition: linearsolvertraits.hh:112
Dune::OverlappingSchwarzOperator< MType, VType, VType, Comm > LinearOperator
Definition: linearsolvertraits.hh:110
MType Matrix
Definition: linearsolvertraits.hh:107
Dune::BlockPreconditioner< VType, VType, Comm, SeqPreconditioner > Preconditioner
Definition: linearsolvertraits.hh:115
VType Vector
Definition: linearsolvertraits.hh:108
Dune::OwnerOverlapCopyCommunication< Dune::bigunsignedint< 96 >, int > Comm
Definition: linearsolvertraits.hh:109
Dune::OverlappingSchwarzScalarProduct< VType, Comm > ScalarProduct
Definition: linearsolvertraits.hh:111
Definition: linearsolvertraits.hh:121
typename GridGeometry::GridView::Traits::Grid Grid
Definition: linearsolvertraits.hh:123
typename GridGeometry::GridView GridView
Definition: linearsolvertraits.hh:122
static bool isNonOverlapping(const GridView &gridView)
Definition: linearsolvertraits.hh:152
typename GridGeometry::VertexMapper DofMapper
Definition: linearsolvertraits.hh:142
static bool isNonOverlapping(const GridView &gridView)
Definition: linearsolvertraits.hh:171
typename GridGeometry::ElementMapper DofMapper
Definition: linearsolvertraits.hh:161