Loading...
Searching...
No Matches
FPCG.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 Copyright (C) 2023 Huawei (Yu Ankun)
11-------------------------------------------------------------------------------
12License
13 This file is part of OpenFOAM.
14
15 OpenFOAM is free software: you can redistribute it and/or modify it
16 under the terms of the GNU General Public License as published by
17 the Free Software Foundation, either version 3 of the License, or
18 (at your option) any later version.
19
20 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
21 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
22 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
23 for more details.
24
25 You should have received a copy of the GNU General Public License
26 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
27
28Class
29 Foam::FPCG
30
31Group
32 grpLduMatrixSolvers
33
34Description
35 A 'faster' preconditioned conjugate gradient solver for
36 symmetric lduMatrices using a run-time selectable preconditioner.
37
38 This is termed \em "faster" than the regular PCG since it combines
39 global reductions.
40
41SourceFiles
42 FPCG.C
43
44\*---------------------------------------------------------------------------*/
45
46#ifndef Foam_FPCG_H
47#define Foam_FPCG_H
48
49#include "lduMatrix.H"
50
51// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
52
53namespace Foam
54{
56/*---------------------------------------------------------------------------*\
57 Class FPCG Declaration
58\*---------------------------------------------------------------------------*/
59
60class FPCG
61:
63{
64 // Private Member Data
65
66 //- Cached preconditioner
67 mutable autoPtr<lduMatrix::preconditioner> preconPtr_;
68
69
70 // Private Member Functions
71
72 //- Blocking version of sum(a*b), sum(mag(b))
73 static void gSumMagProd
74 (
76 const solveScalarField& a,
77 const solveScalarField& b,
78 const label comm
79 );
80
81 //- No copy construct
82 FPCG(const FPCG&) = delete;
83
84 //- No copy assignment
85 void operator=(const FPCG&) = delete;
86
87
88public:
89
90 //- Runtime type information
91 TypeName("FPCG");
92
93
94 // Constructors
95
96 //- Construct from matrix components and solver controls
97 FPCG
98 (
99 const word& fieldName,
100 const lduMatrix& matrix,
104 const dictionary& solverControls
105 );
106
107
108 //- Destructor
109 virtual ~FPCG() = default;
110
111
112 // Member Functions
113
114 //- Solve the matrix with this solver
116 (
118 const solveScalarField& source,
119 const direction cmpt=0
120 ) const;
121
122 //- Solve the matrix with this solver
124 (
126 const scalarField& source,
127 const direction cmpt=0
128 ) const;
129};
130
131
132// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
133
134} // End namespace Foam
135
136// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
137
138#endif
139
140// ************************************************************************* //
virtual solverPerformance scalarSolve(solveScalarField &psi, const solveScalarField &source, const direction cmpt=0) const
Solve the matrix with this solver.
Definition FPCG.C:93
TypeName("FPCG")
Runtime type information.
virtual ~FPCG()=default
Destructor.
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
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.
CEqn solve()
volScalarField & b
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68