opm-simulators
Toggle main menu visibility
Loading...
Searching...
No Matches
parallelistlbackend.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
This file is part of the Open Porous Media project (OPM).
5
6
OPM 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 2 of the License, or
9
(at your option) any later version.
10
11
OPM 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 OPM. If not, see <http://www.gnu.org/licenses/>.
18
19
Consult the COPYING file in the top-level source directory of this
20
module for the precise wording of the license and the list of
21
copyright holders.
22
*/
27
#ifndef EWOMS_PARALLEL_ISTL_BACKEND_HH
28
#define EWOMS_PARALLEL_ISTL_BACKEND_HH
29
30
#include "
linalgproperties.hh
"
31
#include "
parallelbasebackend.hh
"
32
#include "
istlsolverwrappers.hh
"
33
#include "
istlsparsematrixadapter.hh
"
34
35
#include <dune/common/version.hh>
36
37
namespace
Opm::Properties::TTag
{
38
39
// Create new type tag
40
struct
ParallelIstlLinearSolver
{
using
InheritsFrom = std::tuple<ParallelBaseLinearSolver>; };
41
42
}
// namespace Opm::Properties::TTag
43
44
namespace
Opm::Linear {
80
template
<
class
TypeTag>
81
class
ParallelIstlSolverBackend :
public
ParallelBaseBackend<TypeTag>
82
{
83
using
ParentType = ParallelBaseBackend<TypeTag>;
84
85
using
Scalar =
GetPropType<TypeTag, Properties::Scalar>
;
86
using
Simulator =
GetPropType<TypeTag, Properties::Simulator>
;
87
using
LinearSolverWrapper =
GetPropType<TypeTag, Properties::LinearSolverWrapper>
;
88
using
SparseMatrixAdapter =
GetPropType<TypeTag, Properties::SparseMatrixAdapter>
;
89
90
using
ParallelOperator =
typename
ParentType::ParallelOperator;
91
using
OverlappingVector =
typename
ParentType::OverlappingVector;
92
using
ParallelPreconditioner =
typename
ParentType::ParallelPreconditioner;
93
using
ParallelScalarProduct =
typename
ParentType::ParallelScalarProduct;
94
95
using
MatrixBlock =
typename
SparseMatrixAdapter::MatrixBlock;
96
using
RawLinearSolver =
typename
LinearSolverWrapper::RawSolver;
97
98
static_assert
(std::is_same<SparseMatrixAdapter, IstlSparseMatrixAdapter<MatrixBlock> >::value,
99
"The ParallelIstlSolverBackend linear solver backend requires the IstlSparseMatrixAdapter"
);
100
101
public
:
102
explicit
ParallelIstlSolverBackend(
const
Simulator& simulator)
103
: ParentType(simulator)
104
{ }
105
109
static
void
registerParameters
()
110
{
111
ParentType::registerParameters
();
112
113
LinearSolverWrapper::registerParameters();
114
}
115
116
protected
:
117
friend
ParentType;
118
119
std::shared_ptr<RawLinearSolver> prepareSolver_(ParallelOperator& parOperator,
120
ParallelScalarProduct& parScalarProduct,
121
ParallelPreconditioner& parPreCond)
122
{
123
return
solverWrapper_.get(parOperator,
124
parScalarProduct,
125
parPreCond);
126
}
127
128
void
cleanupSolver_()
129
{
130
solverWrapper_.cleanup();
131
}
132
133
std::pair<bool, int> runSolver_(std::shared_ptr<RawLinearSolver> solver)
134
{
135
Dune::InverseOperatorResult result;
136
solver->apply(*this->overlappingx_, *this->overlappingb_, result);
137
return
std::make_pair(result.converged, result.iterations);
138
}
139
140
LinearSolverWrapper solverWrapper_;
141
};
142
143
}
// namespace Opm::Linear
144
145
namespace
Opm::Properties {
146
147
template
<
class
TypeTag>
148
struct
LinearSolverBackend
<TypeTag,
TTag
::ParallelIstlLinearSolver>
149
{
using
type =
Opm::Linear::ParallelIstlSolverBackend<TypeTag>
; };
150
151
template
<
class
TypeTag>
152
struct
LinearSolverWrapper
<TypeTag,
TTag
::ParallelIstlLinearSolver>
153
{
using
type = Opm::Linear::SolverWrapperBiCGStab<TypeTag>; };
154
155
template
<
class
TypeTag>
156
struct
PreconditionerWrapper
<TypeTag,
TTag
::ParallelIstlLinearSolver>
157
{
using
type =
Opm::Linear::PreconditionerWrapperILU<TypeTag>
; };
158
159
}
// namespace Opm::Properties
160
161
#endif
Opm::Linear::ParallelBaseBackend::registerParameters
static void registerParameters()
Register all run-time parameters for the linear solver.
Definition
parallelbasebackend.hh:153
Opm::Linear::ParallelIstlSolverBackend
Provides all unmodified linear solvers from dune-istl.
Definition
parallelistlbackend.hh:82
Opm::Linear::ParallelIstlSolverBackend::registerParameters
static void registerParameters()
Register all run-time parameters for the linear solver.
Definition
parallelistlbackend.hh:109
Opm::Linear::PreconditionerWrapperILU
Definition
istlpreconditionerwrappers.hh:153
istlsolverwrappers.hh
Provides wrapper classes for the iterative linear solvers available in dune-istl.
istlsparsematrixadapter.hh
A sparse matrix interface backend for BCRSMatrix from dune-istl.
linalgproperties.hh
Declares the properties required by the black oil model.
Opm::Properties::TTag
The generic type tag for problems using the immiscible multi-phase model.
Definition
blackoilmodel.hh:81
Opm::GetPropType
typename Properties::Detail::GetPropImpl< TypeTag, Property >::type::type GetPropType
get the type alias defined in the property (equivalent to old macro GET_PROP_TYPE(....
Definition
propertysystem.hh:233
parallelbasebackend.hh
Provides the common code which is required by most linear solvers.
Opm::Properties::LinearSolverBackend
The type of the linear solver to be used.
Definition
linalgproperties.hh:38
Opm::Properties::LinearSolverWrapper
Definition
linalgproperties.hh:57
Opm::Properties::PreconditionerWrapper
the preconditioner used by the linear solver
Definition
linalgproperties.hh:42
Opm::Properties::TTag::ParallelIstlLinearSolver
Definition
parallelistlbackend.hh:40
opm
simulators
linalg
parallelistlbackend.hh
Generated by
1.17.0