fvMeshDistributorsLoadBalancer.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-2022 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 fvMeshDistributorsLoadBalancer_H
55 #define fvMeshDistributorsLoadBalancer_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 distrubutor 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 distrubutor.
84  // Defaults to true.
85  Switch multiConstraint_;
86 
87 
88  // Private Member Functions
89 
90  //- Read the projection parameters from dictionary
91  void readDict();
92 
93 
94 public:
95 
96  //- Runtime type information
97  TypeName("loadBalancer");
98 
99 
100  // Constructors
101 
102  //- Construct from fvMesh
103  explicit loadBalancer(fvMesh& mesh);
104 
105 
106  //- Destructor
107  virtual ~loadBalancer();
108 
109 
110  // Member Functions
111 
112  //- Distribute the
113  virtual bool update();
114 };
115 
116 
117 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
118 
119 } // End namespace fvMeshDistributors
120 } // End namespace Foam
121 
122 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
123 
124 #endif
125 
126 // ************************************************************************* //
A simple wrapper around bool so that it can be read as a word: true/false, on/off, yes/no, y/n, t/f, or none/any.
Definition: Switch.H:60
TypeName("loadBalancer")
Runtime type information.
Dynamic mesh redistribution using the distributor specified in decomposeParDict.
fvMesh & mesh()
Return the fvMesh.
loadBalancer(fvMesh &mesh)
Construct from fvMesh.
Dynamic mesh redistribution using the distributor specified in decomposeParDict.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:95
Starts timing CPU usage and return elapsed time from start.
Definition: cpuTime.H:54
Namespace for OpenFOAM.