Loading...
Searching...
No Matches
PPCG.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) 2019-2020 Mattijs Janssens
9 Copyright (C) 2020-2023 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::PPCG
29
30Description
31 Preconditioned pipelined conjugate gradient solver for symmetric
32 lduMatrices using a run-time selectable preconditioner.
33
34 Reference:
35 \verbatim
36 P. Ghysels, W. Vanroose.
37 "Hiding global synchronization latency in the
38 preconditioned Conjugate Gradient algorithm"
39 \endverbatim
40 and implementation details from
41 \verbatim
42 Paul Eller, William Gropp
43 "Scalable Non-blocking Preconditioned Conjugate Gradient Methods"
44 \endverbatim
45
46SourceFiles
47 PPCG.C
48
49\*---------------------------------------------------------------------------*/
50
51#ifndef Foam_PPCG_H
52#define Foam_PPCG_H
53
54#include "lduMatrix.H"
55
56// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
57
58namespace Foam
59{
61/*---------------------------------------------------------------------------*\
62 Class PPCG Declaration
63\*---------------------------------------------------------------------------*/
64
65class PPCG
66:
68{
69 // Private Member Data
70
71 //- Cached preconditioner
72 mutable autoPtr<lduMatrix::preconditioner> preconPtr_;
73
74
75 // Private Member Functions
76
77 //- Non-blocking version of sum(a*b), sum(a*c), sum(mag(sumMag))
78 static void gSumMagProd
79 (
81 const solveScalarField& a,
82 const solveScalarField& b,
83 const solveScalarField& c,
85 UPstream::Request& request,
86 const label comm
87 );
88
89 //- No copy construct
90 PPCG(const PPCG&) = delete;
91
92 //- No copy assignment
93 void operator=(const PPCG&) = delete;
94
95
96protected:
97
98 //- CG solver. Operates either in conjugate-gradient mode or
99 //- conjugate residual
101 (
103 const solveScalarField& source,
104 const direction cmpt,
105 const bool cgMode
106 ) const;
107
108
109public:
110
111 //- Runtime type information
112 TypeName("PPCG");
113
114
115 // Constructors
116
117 //- Construct from matrix components and solver controls
118 PPCG
120 const word& fieldName,
121 const lduMatrix& matrix,
125 const dictionary& solverControls
126 );
127
128
129 //- Destructor
130 virtual ~PPCG() = default;
131
132
133 // Member Functions
134
135 //- Solve the matrix with this solver
137 (
139 const scalarField& source,
140 const direction cmpt=0
141 ) const;
142};
143
144
145// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
146
147} // End namespace Foam
148
149// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
150
151#endif
152
153// ************************************************************************* //
A field of fields is a PtrList of fields with reference counting.
Definition FieldField.H:77
A 1D vector of objects of type <T> with a fixed length <N>.
Definition FixedList.H:73
solverPerformance scalarSolveCG(solveScalarField &psi, const solveScalarField &source, const direction cmpt, const bool cgMode) const
CG solver. Operates either in conjugate-gradient mode or conjugate residual.
Definition PPCG.C:75
virtual ~PPCG()=default
Destructor.
TypeName("PPCG")
Runtime type information.
An opaque wrapper for MPI_Request with a vendor-independent representation without any <mpi....
Definition UPstream.H:2919
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition autoPtr.H:65
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
Abstract base-class for lduMatrix solvers.
Definition lduMatrix.H:152
const FieldField< Field, scalar > & interfaceIntCoeffs() const noexcept
Definition lduMatrix.H:338
const lduInterfaceFieldPtrsList & interfaces() const noexcept
Definition lduMatrix.H:343
const lduMatrix & matrix() const noexcept
Definition lduMatrix.H:328
const FieldField< Field, scalar > & interfaceBouCoeffs() const noexcept
Definition lduMatrix.H:333
const word & fieldName() const noexcept
Definition lduMatrix.H:323
lduMatrix is a general matrix class in which the coefficients are stored as three arrays,...
Definition lduMatrix.H:81
A class for handling words, derived from Foam::string.
Definition word.H:66
const volScalarField & psi
Namespace for OpenFOAM.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Field< solveScalar > solveScalarField
uint8_t direction
Definition direction.H:49
UPtrList< const lduInterfaceField > lduInterfaceFieldPtrsList
List of coupled interface fields to be used in coupling.
SolverPerformance< scalar > solverPerformance
SolverPerformance instantiated for a scalar.
dimensioned< typename typeOfMag< Type >::type > sumMag(const DimensionedField< Type, GeoMesh > &f1, const label comm)
CEqn solve()
volScalarField & b
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68