35 namespace fvMeshDistributors
50 void Foam::fvMeshDistributors::loadBalancer::readDict()
54 const dictionary& distributorDict(
dict());
57 distributorDict.lookupOrDefault<Switch>(
"multiConstraint",
true);
83 bool redistributed =
false;
102 <<
"No CPU loads have been allocated" 110 scalar sumCpuLoad = 0;
119 (timeStepCpuTime - sumCpuLoad)/mesh.
nCells(),
124 const scalar processorCpuTime =
125 mesh.
nCells()*cellCFDCpuTime + sumCpuLoad;
128 const scalar averageProcessorCpuTime =
134 <<
" " << mesh.
nCells()*cellCFDCpuTime
135 <<
" " << processorCpuTime
136 <<
" " << averageProcessorCpuTime <<
endl;
140 mag(1 - processorCpuTime/averageProcessorCpuTime),
146 if (multiConstraint_)
148 const int nWeights = cpuLoads.
size() + 1;
154 weights[nWeights*i] = cellCFDCpuTime;
164 weights[nWeights*i + loadi] = cpuLoadField[i];
176 weights += iter()->field();
182 Info<<
"Redistributing mesh with imbalance " 183 << imbalance <<
endl;
193 redistributed =
true;
203 return redistributed;
scalar maxImbalance_
Maximum imbalance between the ideal number of cells per processor.
label redistributionInterval_
Time-step interval between redistribution calls.
#define forAll(list, i)
Loop across all elements in list.
errorManipArg< error, int > exit(error &err, const int errNo=1)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
#define forAllIter(Container, container, iter)
Iterate across all elements in the container object of type.
void readDict()
Read the projection parameters from dictionary.
Ostream & endl(Ostream &os)
Add newline and flush stream.
void distribute(const labelList &distribution)
Distribute the mesh and mesh data.
virtual ~loadBalancer()
Destructor.
virtual bool update()
Distribute the.
const Time & time() const
Return the top-level database.
label size() const
Return number of elements in table.
Macros for easy insertion into run-time selection tables.
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
addToRunTimeSelectionTable(fvMeshDistributor, none, fvMesh)
defineTypeNameAndDebug(none, 0)
double cpuTimeIncrement() const
Return CPU time (in seconds) since last call to cpuTimeIncrement()
fvMesh & mesh()
Return the fvMesh.
loadBalancer(fvMesh &mesh)
Construct from fvMesh.
Accumulating histogram of values. Specified bin resolution automatic generation of bins...
An STL-conforming hash table.
Dynamic mesh redistribution using the distributor specified in decomposeParDict.
void setSize(const label)
Reset size of List.
static label nProcs(const label communicator=0)
Number of processes in parallel run.
label timeIndex() const
Return current time index.
label timeIndex_
The time index used for updating.
prefixOSstream Pout(cout, "Pout")
Mesh data needed to do the Finite Volume discretisation.
dimensioned< scalar > mag(const dimensioned< Type > &)
autoPtr< decompositionMethod > distributor_
Cache the decomposer/distributor.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)