PCG.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-2012 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::PCG
29 
30 Group
31  grpLduMatrixSolvers
32 
33 Description
34  Preconditioned conjugate gradient solver for symmetric lduMatrices
35  using a run-time selectable preconditioner.
36 
37 SourceFiles
38  PCG.C
39 
40 \*---------------------------------------------------------------------------*/
41 
42 #ifndef PCG_H
43 #define PCG_H
44 
45 #include "lduMatrix.H"
46 
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 
49 namespace Foam
50 {
51 
52 /*---------------------------------------------------------------------------*\
53  Class PCG Declaration
54 \*---------------------------------------------------------------------------*/
55 
56 class PCG
57 :
58  public lduMatrix::solver
59 {
60  // Private Member Data
61 
62  //- Cached preconditioner
63  mutable autoPtr<lduMatrix::preconditioner> preconPtr_;
64 
65 
66  // Private Member Functions
67 
68  //- No copy construct
69  PCG(const PCG&) = delete;
70 
71  //- No copy assignment
72  void operator=(const PCG&) = delete;
73 
74 
75 public:
76 
77  //- Runtime type information
78  TypeName("PCG");
79 
80 
81  // Constructors
82 
83  //- Construct from matrix components and solver controls
84  PCG
85  (
86  const word& fieldName,
87  const lduMatrix& matrix,
91  const dictionary& solverControls
92  );
93 
94 
95  //- Destructor
96  virtual ~PCG() = default;
97 
98 
99  // Member Functions
100 
101  //- Solve the matrix with this solver
103  (
105  const solveScalarField& source,
106  const direction cmpt=0
107  ) const;
108 
109  //- Solve the matrix with this solver
110  virtual solverPerformance solve
111  (
112  scalarField& psi,
113  const scalarField& source,
114  const direction cmpt=0
115  ) const;
116 };
117 
118 
119 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
120 
121 } // End namespace Foam
122 
123 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
124 
125 #endif
126 
127 // ************************************************************************* //
const FieldField< Field, scalar > & interfaceBouCoeffs() const noexcept
Definition: lduMatrix.H:323
uint8_t direction
Definition: direction.H:46
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
const lduMatrix & matrix() const noexcept
Definition: lduMatrix.H:318
virtual solverPerformance solve(scalarField &psi, const scalarField &source, const direction cmpt=0) const
Solve the matrix with this solver.
Definition: PCG.C:214
A field of fields is a PtrList of fields with reference counting.
Definition: FieldField.H:51
A class for handling words, derived from Foam::string.
Definition: word.H:63
SolverPerformance is the class returned by the LduMatrix solver containing performance statistics...
TypeName("PCG")
Runtime type information.
Abstract base-class for lduMatrix solvers.
Definition: lduMatrix.H:141
const lduInterfaceFieldPtrsList & interfaces() const noexcept
Definition: lduMatrix.H:333
virtual solverPerformance scalarSolve(solveScalarField &psi, const solveScalarField &source, const direction cmpt=0) const
Solve the matrix with this solver.
Definition: PCG.C:63
lduMatrix is a general matrix class in which the coefficients are stored as three arrays...
Definition: lduMatrix.H:80
const FieldField< Field, scalar > & interfaceIntCoeffs() const noexcept
Definition: lduMatrix.H:328
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Definition: HashPtrTable.H:48
const volScalarField & psi
Preconditioned conjugate gradient solver for symmetric lduMatrices using a run-time selectable precon...
Definition: PCG.H:51
const word & fieldName() const noexcept
Definition: lduMatrix.H:313
Namespace for OpenFOAM.
virtual ~PCG()=default
Destructor.