TDILUPreconditioner.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::TDILUPreconditioner
26 
27 Description
28  Simplified diagonal-based incomplete LU preconditioner for asymmetric
29  matrices.
30 
31  The inverse (reciprocal for scalar) of the preconditioned diagonal is
32  calculated and stored.
33 
34 SourceFiles
35  TDILUPreconditioner.C
36 
37 \*---------------------------------------------------------------------------*/
38 
39 #ifndef TDILUPreconditioner_H
40 #define TDILUPreconditioner_H
41 
42 #include "LduMatrix.H"
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 /*---------------------------------------------------------------------------*\
50  Class TDILUPreconditioner Declaration
51 \*---------------------------------------------------------------------------*/
52 
53 template<class Type, class DType, class LUType>
55 :
56  public LduMatrix<Type, DType, LUType>::preconditioner
57 {
58  // Private Data
59 
60  //- The inverse (reciprocal for scalar) preconditioned diagonal
61  Field<DType> rD_;
62 
63 
64 public:
65 
66  //- Runtime type information
67  TypeName("DILU");
68 
69 
70  // Constructors
71 
72  //- Construct from matrix components and preconditioner data dictionary
74  (
75  const typename LduMatrix<Type, DType, LUType>::solver& sol,
76  const dictionary& preconditionerDict
77  );
78 
79 
80  // Destructor
81 
82  virtual ~TDILUPreconditioner()
83  {}
84 
85 
86  // Member Functions
87 
88  //- Calculate the reciprocal of the preconditioned diagonal
89  static void calcInvD
90  (
91  Field<DType>& rD,
92  const LduMatrix<Type, DType, LUType>& matrix
93  );
94 
95  //- Return wA the preconditioned form of residual rA
96  virtual void precondition
97  (
98  Field<Type>& wA,
99  const Field<Type>& rA
100  ) const;
101 
102  //- Return wT the transpose-matrix preconditioned form of
103  // residual rT.
104  virtual void preconditionT
105  (
106  Field<Type>& wT,
107  const Field<Type>& rT
108  ) const;
109 };
110 
111 
112 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
113 
114 } // End namespace Foam
115 
116 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
117 
118 #ifdef NoRepository
119  #include "TDILUPreconditioner.C"
120 #endif
121 
122 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
123 
124 #endif
125 
126 // ************************************************************************* //
Abstract base-class for LduMatrix solvers.
Definition: LduMatrix.H:113
LduMatrix is a general matrix class in which the coefficients are stored as three arrays,...
Definition: LduMatrix.H:85
Simplified diagonal-based incomplete LU preconditioner for asymmetric matrices.
TypeName("DILU")
Runtime type information.
static void calcInvD(Field< DType > &rD, const LduMatrix< Type, DType, LUType > &matrix)
Calculate the reciprocal of the preconditioned diagonal.
virtual void precondition(Field< Type > &wA, const Field< Type > &rA) const
Return wA the preconditioned form of residual rA.
TDILUPreconditioner(const typename LduMatrix< Type, DType, LUType >::solver &sol, const dictionary &preconditionerDict)
Construct from matrix components and preconditioner data dictionary.
virtual void preconditionT(Field< Type > &wT, const Field< Type > &rT) const
Return wT the transpose-matrix preconditioned form of.
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:162
Namespace for OpenFOAM.