pairGAMGProcAgglomeration.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) 2013-2025 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::pairGAMGProcAgglomeration
26 
27 Description
28  Pair-wise processor agglomerator.
29 
30  Neighbouring pairs of processors are agglomerated when the number of
31  agglomerated cells per processor in the level is below \c
32  minCellsPerProcessor and the pairs chosen based on the largest number of
33  connecting processor faces.
34 
35 Usage
36  Example of GAMG solver settings with pair-wise processor agglomeration
37  \verbatim
38  p
39  {
40  solver GAMG;
41  smoother GaussSeidel;
42 
43  processorAgglomeration
44  {
45  agglomerator pair;
46  minCellsPerProcessor 300;
47  }
48 
49  tolerance 1e-8;
50  relTol 0;
51  }
52  \endverbatim
53 
54 SourceFiles
55  pairGAMGProcAgglomeration.C
56 
57 \*---------------------------------------------------------------------------*/
58 
59 #ifndef pairGAMGProcAgglomeration_H
60 #define pairGAMGProcAgglomeration_H
61 
62 #include "GAMGProcAgglomeration.H"
63 #include "DynamicList.H"
64 #include "labelField.H"
65 
66 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
67 
68 namespace Foam
69 {
70 
71 class lduPrimitiveMesh;
72 
73 /*---------------------------------------------------------------------------*\
74  Class pairGAMGProcAgglomeration Declaration
75 \*---------------------------------------------------------------------------*/
76 
78 :
80 {
81  // Private Data
82 
83  //- When to processor agglomerate
84  const label minCellsPerProcessor_;
85 
86  //- Allocated communicators
87  DynamicList<label> comms_;
88 
89  // Private Member Functions
90 
91  //- Return (on master) all single-cell meshes collected. single-cell
92  // meshes are just one cell with all proc faces intact.
93  autoPtr<lduPrimitiveMesh> singleCellMesh
94  (
95  const label singleCellMeshComm,
96  const lduMesh& mesh,
98  ) const;
99 
100  //- Construct processor agglomeration: for every processor the
101  // coarse processor-cluster it agglomerates onto
102  tmp<labelField> processorAgglomeration(const lduMesh&) const;
103 
104  //- Do we need to agglomerate across processors?
105  bool doProcessorAgglomeration(const lduMesh&) const;
106 
107 
108 public:
109 
110  //- Runtime type information
111  TypeName("pair");
112 
113 
114  // Constructors
115 
116  //- Construct given agglomerator and controls
118  (
119  GAMGAgglomeration& agglom,
120  const dictionary& dict
121  );
122 
123  //- Disallow default bitwise copy construction
125  (
127  ) = delete;
128 
129 
130  //- Destructor
131  virtual ~pairGAMGProcAgglomeration();
132 
133 
134  // Member Functions
135 
136  //- Modify agglomeration. Return true if modified
137  virtual bool agglomerate();
138 
139 
140  // Member Operators
141 
142  //- Disallow default bitwise assignment
143  void operator=(const pairGAMGProcAgglomeration&) = delete;
144 };
145 
146 
147 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
148 
149 } // End namespace Foam
150 
151 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
152 
153 #endif
154 
155 // ************************************************************************* //
Geometric agglomerated algebraic multigrid agglomeration class.
Processor agglomeration of GAMGAgglomerations.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
Abstract base class for meshes which provide LDU addressing for the construction of lduMatrix and LDU...
Definition: lduMesh.H:60
Pair-wise processor agglomerator.
pairGAMGProcAgglomeration(GAMGAgglomeration &agglom, const dictionary &dict)
Construct given agglomerator and controls.
TypeName("pair")
Runtime type information.
void operator=(const pairGAMGProcAgglomeration &)=delete
Disallow default bitwise assignment.
virtual bool agglomerate()
Modify agglomeration. Return true if modified.
A class for managing temporary objects.
Definition: tmp.H:55
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
tmp< scalarField > faceWeights(const polyMesh &mesh, const vectorField &fCtrs, const vectorField &fAreas, const vectorField &cellCtrs)
Generate interpolation factors field.
Namespace for OpenFOAM.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
dictionary dict