TDILUPreconditioner.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-2016 OpenFOAM Foundation
9  Copyright (C) 2019 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
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 
27 Class
28  Foam::TDILUPreconditioner
29 
30 Description
31  Simplified diagonal-based incomplete LU preconditioner for asymmetric
32  matrices.
33 
34  The inverse (reciprocal for scalar) of the preconditioned diagonal is
35  calculated and stored.
36 
37 SourceFiles
38  TDILUPreconditioner.C
39 
40 \*---------------------------------------------------------------------------*/
41 
42 #ifndef TDILUPreconditioner_H
43 #define TDILUPreconditioner_H
44 
45 #include "LduMatrix.H"
46 
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 
49 namespace Foam
50 {
51 
52 /*---------------------------------------------------------------------------*\
53  Class TDILUPreconditioner Declaration
54 \*---------------------------------------------------------------------------*/
55 
56 template<class Type, class DType, class LUType>
58 :
59  public LduMatrix<Type, DType, LUType>::preconditioner
60 {
61  // Private data
62 
63  //- The inverse (reciprocal for scalar) preconditioned diagonal
64  Field<DType> rD_;
65 
66 
67 public:
68 
69  //- Runtime type information
70  TypeName("DILU");
71 
72 
73  // Constructors
74 
75  //- Construct from matrix components and preconditioner data dictionary
77  (
78  const typename LduMatrix<Type, DType, LUType>::solver& sol,
79  const dictionary& preconditionerDict
80  );
81 
82 
83  // Destructor
84 
85  virtual ~TDILUPreconditioner() = default;
86 
87 
88  // Member Functions
89 
90  //- Calculate the reciprocal of the preconditioned diagonal
91  static void calcInvD
92  (
93  Field<DType>& rD,
94  const LduMatrix<Type, DType, LUType>& matrix
95  );
96 
97  //- Return wA the preconditioned form of residual rA
98  virtual void precondition
99  (
100  Field<Type>& wA,
101  const Field<Type>& rA
102  ) const;
103 
104  //- Return wT the transpose-matrix preconditioned form of
105  // residual rT.
106  virtual void preconditionT
107  (
108  Field<Type>& wT,
109  const Field<Type>& rT
110  ) const;
111 };
112 
113 
114 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
115 
116 } // End namespace Foam
117 
118 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
119 
120 #ifdef NoRepository
121  #include "TDILUPreconditioner.C"
122 #endif
123 
124 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
125 
126 #endif
127 
128 // ************************************************************************* //
TDILUPreconditioner.C
Foam::TDILUPreconditioner::preconditionT
virtual void preconditionT(Field< Type > &wT, const Field< Type > &rT) const
Return wT the transpose-matrix preconditioned form of.
Definition: TDILUPreconditioner.C:133
Foam::TDILUPreconditioner::TypeName
TypeName("DILU")
Runtime type information.
Foam::LduMatrix
LduMatrix is a general matrix class in which the coefficients are stored as three arrays,...
Definition: LduMatrix.H:72
LduMatrix.H
Foam::TDILUPreconditioner
Simplified diagonal-based incomplete LU preconditioner for asymmetric matrices.
Definition: TDILUPreconditioner.H:56
Foam::LduMatrix::solver
Abstract base-class for LduMatrix solvers.
Definition: LduMatrix.H:115
Foam::Field< DType >
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::TDILUPreconditioner::~TDILUPreconditioner
virtual ~TDILUPreconditioner()=default
Foam::TDILUPreconditioner::calcInvD
static void calcInvD(Field< DType > &rD, const LduMatrix< Type, DType, LUType > &matrix)
Calculate the reciprocal of the preconditioned diagonal.
Definition: TDILUPreconditioner.C:50
Foam::TDILUPreconditioner::precondition
virtual void precondition(Field< Type > &wA, const Field< Type > &rA) const
Return wA the preconditioned form of residual rA.
Definition: TDILUPreconditioner.C:83
Foam::TDILUPreconditioner::TDILUPreconditioner
TDILUPreconditioner(const typename LduMatrix< Type, DType, LUType >::solver &sol, const dictionary &preconditionerDict)
Construct from matrix components and preconditioner data dictionary.
Definition: TDILUPreconditioner.C:34