diagonalPreconditioner.H
Go to the documentation of this file.
1/*---------------------------------------------------------------------------*\
2 ========= |
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 \\ / O peration |
5 \\ / A nd | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2011 OpenFOAM Foundation
9 Copyright (C) 2019 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27Class
28 Foam::diagonalPreconditioner
29
30Group
31 grpLduMatrixPreconditioners
32
33Description
34 Diagonal preconditioner for both symmetric and asymmetric matrices.
35
36 The reciprocal of the diagonal is calculated and stored for reuse
37 because on most systems '*' is faster than '/'.
38
39SourceFiles
40 diagonalPreconditioner.C
41
42\*---------------------------------------------------------------------------*/
43
44#ifndef diagonalPreconditioner_H
45#define diagonalPreconditioner_H
46
47#include "lduMatrix.H"
48
49// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50
51namespace Foam
52{
53
54/*---------------------------------------------------------------------------*\
55 Class diagonalPreconditioner Declaration
56\*---------------------------------------------------------------------------*/
59:
61{
62 // Private data
63
64 //- The reciprocal diagonal
66
67
68 // Private Member Functions
69
70 //- No copy construct
72
73 //- No copy assignment
74 void operator=(const diagonalPreconditioner&) = delete;
75
76
77public:
78
79 //- Runtime type information
80 TypeName("diagonal");
81
82
83 // Constructors
84
85 //- Construct from matrix components and preconditioner solver controls
87 (
88 const lduMatrix::solver&,
89 const dictionary& solverControlsUnused
90 );
91
92
93 //- Destructor
94 virtual ~diagonalPreconditioner() = default;
95
96
97 // Member Functions
98
99 //- Return wA the preconditioned form of residual rA
100 virtual void precondition
101 (
103 const solveScalarField& rA,
104 const direction cmpt=0
105 ) const;
106
107 //- Return wT the transpose-matrix preconditioned form of residual rT.
108 virtual void preconditionT
109 (
111 const solveScalarField& rT,
112 const direction cmpt=0
113 ) const
114 {
115 return precondition(wT, rT, cmpt);
116 }
117};
118
119
120// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
121
122} // End namespace Foam
123
124// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
125
126#endif
127
128// ************************************************************************* //
Diagonal preconditioner for both symmetric and asymmetric matrices.
TypeName("diagonal")
Runtime type information.
virtual void precondition(solveScalarField &wA, const solveScalarField &rA, const direction cmpt=0) const
Return wA the preconditioned form of residual rA.
virtual void preconditionT(solveScalarField &wT, const solveScalarField &rT, const direction cmpt=0) const
Return wT the transpose-matrix preconditioned form of residual rT.
virtual ~diagonalPreconditioner()=default
Destructor.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
Abstract base-class for lduMatrix preconditioners.
Definition: lduMatrix.H:434
Abstract base-class for lduMatrix solvers.
Definition: lduMatrix.H:99
Namespace for OpenFOAM.
uint8_t direction
Definition: direction.H:56
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73