loadBalancer_fvMeshDistributor.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) 2021-2024 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::fvMeshDistributors::loadBalancer
26 
27 Description
28  Dynamic mesh redistribution using the distributor specified in
29  decomposeParDict
30 
31 Usage
32  Example of single field based refinement in all cells:
33  \verbatim
34  distributor
35  {
36  type loadBalancer;
37 
38  libs ("libfvMeshDistributors.so");
39 
40  // How often to redistribute
41  redistributionInterval 10;
42 
43  // Maximum fractional cell distribution imbalance
44  // before rebalancing
45  maxImbalance 0.1;
46  }
47  \endverbatim
48 
49 SourceFiles
50  fvMeshDistributorsloadBalancer.C
51 
52 \*---------------------------------------------------------------------------*/
53 
54 #ifndef loadBalancer_fvMeshDistributor_H
55 #define loadBalancer_fvMeshDistributor_H
56 
58 #include "cpuTime.H"
59 
60 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
61 
62 namespace Foam
63 {
64 namespace fvMeshDistributors
65 {
66 
67 /*---------------------------------------------------------------------------*\
68  Class loadBalancer Declaration
69 \*---------------------------------------------------------------------------*/
70 
71 class loadBalancer
72 :
73  public distributor
74 {
75  // Private Member Data
76 
77  //- CPU time consumed during the time-step
78  cpuTime cpuTime_;
79 
80  //- Enable multi-constraint load-balancing in which separate weights
81  // are provided to the distributor for each of the CPU loads.
82  // When disabled the CPU loads are summed and a single weight per cell
83  // is provided to the distributor.
84  // Defaults to true.
85  Switch multiConstraint_;
86 
87 
88 public:
89 
90  //- Runtime type information
91  TypeName("loadBalancer");
92 
93 
94  // Constructors
95 
96  //- Construct from fvMesh and dictionary
98 
99 
100  //- Destructor
101  virtual ~loadBalancer();
102 
103 
104  // Member Functions
105 
106  //- Distribute the
107  virtual bool update();
108 };
109 
110 
111 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
112 
113 } // End namespace fvMeshDistributors
114 } // End namespace Foam
115 
116 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
117 
118 #endif
119 
120 // ************************************************************************* //
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
Definition: Switch.H:61
Starts timing CPU usage and return elapsed time from start.
Definition: cpuTime.H:55
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
fvMesh & mesh()
Return the fvMesh.
Dynamic mesh redistribution using the distributor specified in decomposeParDict.
Dynamic mesh redistribution using the distributor specified in decomposeParDict.
TypeName("loadBalancer")
Runtime type information.
loadBalancer(fvMesh &mesh, const dictionary &dict)
Construct from fvMesh and dictionary.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:96
Namespace for OpenFOAM.
dictionary dict