43 MGridGenGAMGAgglomeration,
51 void Foam::MGridGenGAMGAgglomeration::swap
55 PtrList<labelList>& nbrValues
63 if (interfaces.set(inti))
65 interfaces[inti].initInternalFieldTransfer
79 nbrValues.setSize(interfaces.size());
82 if (interfaces.set(inti))
89 interfaces[inti].internalFieldTransfer
101 void Foam::MGridGenGAMGAgglomeration::getNbrAgglom
103 const lduAddressing& addr,
105 const PtrList<labelList>& nbrGlobalAgglom,
109 cellToNbrAgglom.setSize(addr.size());
110 cellToNbrAgglom = -1;
114 if (interfaces.set(inti))
116 if (isA<processorLduInterface>(interfaces[inti]))
118 const processorLduInterface& pldui =
119 refCast<const processorLduInterface>(interfaces[inti]);
121 if (pldui.myProcNo() > pldui.neighbProcNo())
124 interfaces[inti].faceCells();
125 const labelList& nbrData = nbrGlobalAgglom[inti];
129 cellToNbrAgglom[faceCells[i]] = nbrData[i];
138 void Foam::MGridGenGAMGAgglomeration::detectSharedFaces
150 sharedFaces.reserve(addr.lowerAddr().size()/100);
155 label lowerData = value[
lower[facei]];
156 label upperData = value[
upper[facei]];
158 if (lowerData != -1 && lowerData == upperData)
160 sharedFaces.insert(facei);
168 Foam::MGridGenGAMGAgglomeration::MGridGenGAMGAgglomeration
178 nProcConsistencyIter_
195 void Foam::MGridGenGAMGAgglomeration::agglomerate
197 const label nCellsInCoarsestLevel,
198 const label startLevel,
200 const bool doProcessorAgglomerate
220 const labelList& own = fvMesh_.faceOwner();
225 if (!fvMesh_.isInternalFace(facei))
227 magSb[own[facei]] +=
mag(Sf[facei]);
235 label nCreatedLevels = 0;
237 while (nCreatedLevels < maxLevels_ - 1)
239 label nCoarseCells = -1;
241 tmp<labelField> finalAgglomPtr = agglomerate
246 meshLevel(nCreatedLevels).lduAddr(),
253 for (
int i=0; i<nProcConsistencyIter_; i++)
255 const lduMesh&
mesh = meshLevel(nCreatedLevels);
262 const globalIndex globalNumbering(nCoarseCells);
267 globalAgglom[celli] = globalNumbering.toGlobal(agglom[celli]);
271 PtrList<labelList> nbrGlobalAgglom;
272 swap(interfaces, globalAgglom, nbrGlobalAgglom);
278 getNbrAgglom(addr, interfaces, nbrGlobalAgglom, cellToNbrAgglom);
283 detectSharedFaces(
mesh, cellToNbrAgglom, sharedFaces);
290 for (
const label facei : sharedFaces)
292 weights[facei] *= 2.0;
296 finalAgglomPtr = agglomerate
301 meshLevel(nCreatedLevels).lduAddr(),
310 continueAgglomerating
312 nCellsInCoarsestLevel_,
313 finalAgglomPtr().size(),
315 meshLevel(nCreatedLevels).comm()
319 nCells_[nCreatedLevels] = nCoarseCells;
320 restrictAddressing_.set(nCreatedLevels, finalAgglomPtr);
327 agglomerateLduAddressing(nCreatedLevels);
333 new scalarField(meshLevels_[nCreatedLevels].size())
337 restrictField(*aggVPtr, *VPtr, nCreatedLevels,
false);
353 meshLevels_[nCreatedLevels].upperAddr().size(),
358 restrictFaceField(*aggMagSfPtr, *magSfPtr, nCreatedLevels);
365 magSfPtr = aggMagSfPtr;
372 new scalarField(meshLevels_[nCreatedLevels].size())
376 restrictField(*aggMagSbPtr, *magSbPtr, nCreatedLevels,
false);
379 magSbPtr = aggMagSbPtr;
386 compactLevels(nCreatedLevels, doProcessorAgglomerate);
List< ReturnType > get(const UPtrList< T > &list, const AccessOp &aop)
List of values generated by applying the access operation to each list item.
Field< label > labelField
Specialisation of Field<T> for label.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
static label nRequests() noexcept
Number of outstanding requests (on the internal list of requests)
Type & refCast(U &obj)
A dynamic_cast (for references) to Type reference.
static const Field< scalar > & null() noexcept
Return a null Field (reference to a nullObject). Behaves like an empty Field.
dimensionedScalar sqrt(const dimensionedScalar &ds)
string upper(const std::string &s)
Return string copy transformed with std::toupper on each character.
static void waitRequests()
Wait for all requests to finish.
Macros for easy insertion into run-time selection tables.
UList< label > labelUList
A UList of labels.
#define forAll(list, i)
Loop across all elements in list.
HashSet< label, Hash< label > > labelHashSet
A HashSet of labels, uses label hasher.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
virtual const lduAddressing & lduAddr() const
Return ldu addressing.
UPtrList< const lduInterface > lduInterfacePtrsList
Store lists of lduInterface as a UPtrList.
runTime controlDict().readEntry("adjustTimeStep"
The central control dictionary, the contents of which are either taken directly from the FOAM_CONTROL...
defineTypeNameAndDebug(combustionModel, 0)
string lower(const std::string &s)
Return string copy transformed with std::tolower on each character.
virtual lduInterfacePtrsList interfaces() const
Return a list of pointers for each patch.
"nonBlocking" (immediate) : (MPI_Isend, MPI_Irecv)
List< label > labelList
A List of labels.
addToRunTimeSelectionTable(functionObject, pointHistory, dictionary)
static constexpr const zero Zero
Global zero (0)