35 namespace fvMeshDistributors
50 void Foam::fvMeshDistributors::loadBalancer::readDict()
54 const dictionary& distributorDict(
dict());
57 distributorDict.lookupOrDefault<Switch>(
"multiConstraint",
true);
81 const fvMesh& mesh = this->mesh();
83 bool redistributed =
false;
94 const scalar timeStepCpuTime = cpuTime_.cpuTimeIncrement();
102 <<
"No CPU loads have been allocated"
110 scalar sumCpuLoad = 0;
114 sumCpuLoad +=
sum(iter()->field());
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();
180 if (imbalance > maxImbalance_)
182 Info<<
"Redistributing mesh with imbalance "
183 << imbalance <<
endl;
188 distributor_->decompose(mesh, weights)
193 redistributed =
true;
203 return redistributed;
#define forAll(list, i)
Loop across all elements in list.
#define forAllIter(Container, container, iter)
Iterate across all elements in the container object of type.
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
Macros for easy insertion into run-time selection tables.
An STL-conforming hash table.
label size() const
Return number of elements in table.
void setSize(const label)
Reset size of List.
label timeIndex() const
Return current time index.
static label nProcs(const label communicator=0)
Number of processes in parallel run.
Accumulating histogram of values. Specified bin resolution automatic generation of bins.
Abstract base class for fvMesh movers.
const dictionary & dict() const
Return the dynamicMeshDict/distributor sub-dict.
Dynamic mesh redistribution using the distributor specified in decomposeParDict.
void readDict()
Read the projection parameters from dictionary.
Dynamic mesh redistribution using the distributor specified in decomposeParDict.
loadBalancer(fvMesh &mesh)
Construct from fvMesh.
virtual bool update()
Distribute the.
virtual ~loadBalancer()
Destructor.
Mesh data needed to do the Finite Volume discretisation.
const Time & time() const
Return the top-level database.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
defineTypeNameAndDebug(none, 0)
addToRunTimeSelectionTable(fvMeshDistributor, none, fvMesh)
errorManipArg< error, int > exit(error &err, const int errNo=1)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & endl(Ostream &os)
Add newline and flush stream.
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
dimensioned< scalar > mag(const dimensioned< Type > &)
prefixOSstream Pout(cout, "Pout")