37 template<
class Type,
class TrackingData>
40 template<
class Type,
class TrackingData>
43 template<
class Type,
class TrackingData>
49 template<
class Type,
class TrackingData>
50 template<
class ListList>
66 template<
class Type,
class TrackingData>
67 template<
class ListList,
class Value>
74 ListList ll(s.
size());
77 ll[i] =
typename ListList::value_type(s[i], value);
85 template<
class Type,
class TrackingData>
92 patchAndFacei.
first() == -1
93 ? internalFaceInfo_[patchAndFacei.
second()]
94 : patchFaceInfo_[patchAndFacei.
first()][patchAndFacei.
second()];
98 template<
class Type,
class TrackingData>
105 patchAndFacei.
first() == -1
106 ? internalFaceInfo_[patchAndFacei.
second()]
107 : patchFaceInfo_[patchAndFacei.
first()][patchAndFacei.
second()];
111 template<
class Type,
class TrackingData>
119 patchAndFacei.
first() == -1
120 ? internalFaceChanged_[patchAndFacei.
second()]
121 : patchFaceChanged_[patchAndFacei.
first()][patchAndFacei.
second()];
125 template<
class Type,
class TrackingData>
126 Foam::PackedBoolList::iteratorBase
133 patchAndFacei.
first() == -1
134 ? internalFaceChanged_[patchAndFacei.
second()]
135 : patchFaceChanged_[patchAndFacei.
first()][patchAndFacei.
second()];
139 template<
class Type,
class TrackingData>
144 const Type& neighbourInfo,
154 neighbourPatchAndFacei,
162 if (!cellChanged_[celli])
164 cellChanged_[celli] =
true;
165 changedCells_.append(celli);
173 template<
class Type,
class TrackingData>
177 const label neighbourCelli,
178 const Type& neighbourInfo,
196 PackedBoolList::iteratorBase changed = faceChanged(patchAndFacei);
201 changedPatchAndFaces_.append(patchAndFacei);
209 template<
class Type,
class TrackingData>
213 const Type& neighbourInfo,
230 PackedBoolList::iteratorBase changed = faceChanged(patchAndFacei);
235 changedPatchAndFaces_.append(patchAndFacei);
243 template<
class Type,
class TrackingData>
250 refCast<const cyclicFvPatch>(patch).nbrPatch();
254 const Type& info = faceInfo({patch.
index(), patchFacei});
255 const Type& nbrInfo = faceInfo({nbrPatch.
index(), patchFacei});
257 const bool changed = faceChanged({patch.
index(), patchFacei});
258 const bool nbrChanged = faceChanged({nbrPatch.
index(), patchFacei});
260 if (!info.sameGeometry(mesh_, nbrInfo, geomTol_, td_))
263 <<
" faceInfo:" << info
264 <<
" otherfaceInfo:" << nbrInfo
268 if (changed != nbrChanged)
271 <<
" faceInfo:" << info
272 <<
" otherfaceInfo:" << nbrInfo
273 <<
" changedFace:" << changed
274 <<
" otherchangedFace:" << nbrChanged
281 template<
class Type,
class TrackingData>
282 template<
class PatchType>
287 if (isA<PatchType>(mesh_.boundary()[
patchi]))
297 template<
class Type,
class TrackingData>
306 for (
label changedFacei = 0; changedFacei < nFaces; changedFacei ++)
308 const label patchFacei = changedPatchFaces[changedFacei];
310 Type& info = faceInfo({patch.
index(), patchFacei});
311 const Type& neighbourInfo = changedPatchFacesInfo[changedFacei];
313 if (!info.equal(neighbourInfo, td_))
317 {patch.
index(), patchFacei},
327 template<
class Type,
class TrackingData>
343 if (patchFaceChanged_[patch.
index()][patchFacei])
345 changedPatchFaces[i] = patchFacei;
346 changedPatchFacesInfo[i] = faceInfo({patch.
index(), patchFacei});
355 template<
class Type,
class TrackingData>
365 for (
label i = 0; i < nFaces; i++)
367 faceInfo[i].transform(patch, patchFaces[i], transform, td_);
372 template<
class Type,
class TrackingData>
378 const labelList& procPatches = mesh_.globalData().processorPatches();
387 refCast<const processorFvPatch>(mesh_.boundary()[
patchi]);
405 Pout<<
" Processor patch " << patchi <<
' ' << procPatch.
name()
407 <<
" Sending:" << nSendFaces
426 refCast<const processorFvPatch>(mesh_.boundary()[
patchi]);
435 fromNeighbour >> receiveFaces >> receiveFacesInfo;
440 Pout<<
" Processor patch " << patchi <<
' ' << procPatch.
name()
442 <<
" Receiving:" << receiveFaces.size()
468 template<
class Type,
class TrackingData>
478 if (!isA<cyclicFvPatch>(patch))
continue;
480 const cyclicFvPatch& cycPatch = refCast<const cyclicFvPatch>(patch);
500 <<
" Changed : " << nReceiveFaces
525 checkCyclic(cycPatch);
531 template<
class Type,
class TrackingData>
558 const label patchFacei,
563 if (y.valid(solver_.
data()))
568 {patch_.
index(), patchFacei},
584 if (isA<cyclicAMIFvPatch>(patch))
587 refCast<const cyclicAMIFvPatch>(patch);
595 List<Type> sendInfo(patchFaceInfo_[nbrPatch.index()]);
607 if (cycPatch.
owner())
622 cycPatch.
AMIs()[i].interpolateToSource
632 cycPatch.
AMIs()[i].interpolateToSource
644 forAll(nbrPatch.AMIs(), i)
646 if (nbrPatch.AMITransforms()[i].transformsPosition())
654 nbrPatch.AMITransforms()[i],
680 forAll(receiveInfo, patchFacei)
682 if (receiveInfo[patchFacei].valid(td_))
684 if (receiveFaces.size() != patchFacei)
686 receiveInfo[receiveFaces.size()] =
687 receiveInfo[patchFacei];
689 receiveFaces.
append(patchFacei);
721 template<
class Type,
class TrackingData>
732 internalFaceInfo_(internalFaceInfo),
733 patchFaceInfo_(patchFaceInfo),
738 mesh_.nInternalFaces(),
745 listListSizes(mesh_.boundary()),
754 changedPatchAndFaces_(mesh_.nInternalFaces()),
755 changedCells_(mesh_.nCells()),
756 hasCyclicPatches_(hasPatch<cyclicFvPatch>()),
757 hasCyclicAMIPatches_(hasPatch<cyclicAMIFvPatch>())
761 internalFaceInfo.
size() != mesh_.nInternalFaces()
762 || listListSizes(patchFaceInfo) != listListSizes(mesh_.boundary())
763 || cellInfo.
size() != mesh_.nCells()
767 <<
"Storage does not match the size of the mesh:" <<
endl 768 <<
" internalFaceInfo:" << internalFaceInfo.
size() <<
endl 769 <<
" mesh_.nInternalFaces():" << mesh_.nInternalFaces() <<
endl 770 <<
" patchFaceInfo[i]:" << listListSizes(patchFaceInfo)
772 <<
"mesh_.boundary()[i].size():" << listListSizes(mesh_.boundary())
774 <<
" cellInfo:" << cellInfo.
size() <<
endl 775 <<
" mesh_.nCells():" << mesh_.nCells()
781 template<
class Type,
class TrackingData>
804 setFaceInfo(initialChangedPatchAndFaces, initialChangedFacesInfo);
807 const label iter = iterate(maxIter);
810 if ((maxIter > 0) && (iter >= maxIter))
813 <<
"Maximum number of iterations reached. Increase maxIter." <<
endl 814 <<
" maxIter:" << maxIter <<
endl 815 <<
" changedCells_.size():" << changedCells_.size() <<
endl 816 <<
"changedPatchAndFaces_.size():" << changedPatchAndFaces_.size()
824 template<
class Type,
class TrackingData>
831 forAll(changedPatchAndFaces, i)
833 const labelPair& patchAndFacei = changedPatchAndFaces[i];
835 Type& info = faceInfo(patchAndFacei);
836 PackedBoolList::iteratorBase changed = faceChanged(patchAndFacei);
839 info = changedFacesInfo[i];
843 changedPatchAndFaces_.
append(patchAndFacei);
848 template<
class Type,
class TrackingData>
852 const labelList& neighbour = mesh_.neighbour();
854 forAll(changedPatchAndFaces_, changedFacei)
856 const labelPair& patchAndFacei = changedPatchAndFaces_[changedFacei];
860 if (!faceChanged(patchAndFacei))
863 <<
"Patch and face " << patchAndFacei
864 <<
" not marked as having been changed" 868 const Type& info = faceInfo(patchAndFacei);
872 const label ownerCelli =
875 : mesh_.boundary()[
patchi].faceCells()[facei];
877 Type& ownerInfo = cellInfo_[ownerCelli];
879 if (!ownerInfo.equal(info, td_))
895 const label neighbourCelli = neighbour[facei];
897 Type& neighbourInfo = cellInfo_[neighbourCelli];
899 if (!neighbourInfo.equal(info, td_))
913 faceChanged(patchAndFacei) =
false;
917 changedPatchAndFaces_.
clear();
921 Pout<<
" Changed cells : " << changedCells_.size() <<
endl;
928 template<
class Type,
class TrackingData>
933 forAll(changedCells_, changedCelli)
935 const label celli = changedCells_[changedCelli];
937 if (!cellChanged_[celli])
940 <<
"Cell " << celli <<
" not marked as having been changed" 944 const Type& info = cellInfo_[celli];
947 forAll(cells[celli], cellFacei)
950 label polyFacei = cells[celli][cellFacei];
954 if (polyFacei < mesh_.nInternalFaces())
956 static label noPatchi = -1;
962 const label polyBFacei = polyFacei - mesh_.nInternalFaces();
963 patches.
shallowCopy(mesh_.polyBFacePatches()[polyBFacei]);
964 faces.
shallowCopy(mesh_.polyBFacePatchFaces()[polyBFacei]);
970 Type& connectedInfo = faceInfo({patches[i], faces[i]});
972 if (!connectedInfo.equal(info, td_))
976 {patches[i], faces[i]},
987 cellChanged_[celli] =
false;
991 changedCells_.
clear();
993 if (hasCyclicPatches_)
996 handleCyclicPatches();
999 if (hasCyclicAMIPatches_)
1002 handleCyclicAMIPatches();
1005 if (Pstream::parRun())
1008 handleProcPatches();
1013 Pout<<
" Changed faces : " 1014 << changedPatchAndFaces_.size() <<
endl;
1021 template<
class Type,
class TrackingData>
1027 if (hasCyclicPatches_)
1030 handleCyclicPatches();
1033 if (hasCyclicAMIPatches_)
1036 handleCyclicAMIPatches();
1039 if (Pstream::parRun())
1042 handleProcPatches();
1047 while (iter < maxIter)
1049 if (debug)
Info<<
" Iteration " << iter <<
endl;
1053 if (debug)
Info<<
" Total changed cells : " << nCells <<
endl;
1062 if (debug)
Info<<
" Total changed faces : " << nFaces <<
nl;
const fvPatchList & patches
#define forAll(list, i)
Loop across all elements in list.
Wave propagation of information through grid. Every iteration information goes through one layer of c...
Inter-processor communication reduction functions.
bool updateCell(const fvMesh &, const label thisCelli, const labelPair &neighbourPatchAndFacei, const FvWallInfoBase< WallInfo, Derived > &neighbourInfo, const scalar tol, TrackingData &td)
Influence of neighbouring face.
void finishedSends(const bool block=true)
Mark all sends as having been done. This will start receives.
const UIndirectList< T > patchInternalList(const UList< T > &internalValues) const
Extract face cell data.
errorManipArg< error, int > exit(error &err, const int errNo=1)
label index() const
Return the index of this patch in the fvBoundaryMesh.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Cyclic patch for Arbitrary Mesh Interface (AMI)
void size(const label)
Override size to be inconsistent with allocated storage.
const TrackingData & data() const
Additional data to be passed into container.
Ostream & endl(Ostream &os)
Add newline and flush stream.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
virtual const transformer & transform() const
Return transformation between the coupled patches.
labelList identity(const label len)
Create identity map (map[i] == i) of given length.
static scalar propagationTol()
Access to tolerance.
static labelList listListSizes(const ListList &ll)
...
UList< label > labelUList
bool updateCell(const label celli, const labelPair &neighbourPatchAndFacei, const Type &neighbourInfo, const scalar tol, Type &cellInfo)
Updates cellInfo with information from neighbour. Updates all.
virtual int neighbProcNo() const
Return neighbour processor number.
bool updateFace(const fvMesh &, const labelPair &thisPatchAndFacei, const label neighbourCelli, const FvWallInfoBase< WallInfo, Derived > &neighbourInfo, const scalar tol, TrackingData &td)
Influence of neighbouring cell.
void handleCyclicAMIPatches()
Merge data from across AMI cyclics.
virtual bool applyLowWeightCorrection() const
Return true if applying the low weight correction.
A topoSetSource to select a faceSet from cells.
Input inter-processor communications stream operating on external buffer.
A List obtained as a section of another List.
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
An ordered pair of two objects of type <T> with first() and second() elements.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects...
void clear()
Clear the list, i.e. set size to zero.
const polyPatch & patch() const
Return the polyPatch.
A topoSetSource to select cells based on usage in faces.
virtual const PtrList< AMIInterpolation > & AMIs() const
Return a reference to the AMI interpolators.
void append(const T &)
Append an element at the end of the list.
bool hasPatch() const
Has cyclic patch?
void handleCyclicPatches()
Merge data from across cyclics.
label getChangedPatchFaces(const fvPatch &patch, labelList &changedPatchFaces, List< Type > &changedPatchFacesInfo) const
Extract info for single patch only.
errorManip< error > abort(error &err)
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
virtual label size() const
Return size.
Output inter-processor communications stream operating on external buffer.
void setFaceInfo(const List< labelPair > &changedPatchAndFaces, const List< Type > &changedFacesInfo)
Set initial changed faces.
static ListList sizesListList(const labelList &s, const Value &value)
...
void handleProcPatches()
Merge data from across processor boundaries.
Buffers for inter-processor communications streams (UOPstream, UIPstream).
bool updateFace(const labelPair &patchAndFacei, const label neighbourCelli, const Type &neighbourInfo, const scalar tol, Type &faceInfo)
Updates faceInfo with information from neighbour. Updates all.
virtual const transformer & transform() const
Return transformation between the coupled patches.
FvFaceCellWave(const fvMesh &mesh, List< Type > &internalFaceInfo, List< List< Type >> &patchFaceInfo, List< Type > &cellInfo, TrackingData &td=defaultTrackingData_)
const Type & second() const
Return second.
virtual const transformer & transform() const
Return transformation between the coupled patches.
void mergeFaceInfo(const fvPatch &patch, const label nFaces, const labelList &, const List< Type > &)
Merge received patch data into global data.
virtual label cellToFace()
Propagate from cell to face. Returns total number of faces.
virtual bool owner() const
Is this side the owner?
void shallowCopy(const UList< T > &)
Copy the pointer held by the given UList.
virtual const cyclicAMIFvPatch & nbrPatch() const
Return the neighbour patch.
virtual const cyclicFvPatch & nbrPatch() const
Return processor number.
void transform(const fvPatch &patch, const label nFaces, const labelList &patchFaces, const transformer &transform, List< Type > &faceInfo)
Transform across an interface.
prefixOSstream Pout(cout, "Pout")
Mesh data needed to do the Finite Volume discretisation.
const Type & faceInfo(const labelPair &patchAndFacei) const
...
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
virtual label faceToCell()
Propagate from face to cell. Returns total number of cells.
const fvMesh & mesh() const
Access mesh.
virtual const word & name() const
Return name.
void checkCyclic(const fvPatch &patch) const
Debugging: check info on both sides of cyclic.
virtual label iterate(const label maxIter)
Iterate until no changes or maxIter reached. Returns actual.
const Type & first() const
Return first.
const dimensionedScalar e
Elementary charge.
bool faceChanged(const labelPair &patchAndFacei) const
...
dimensionSet transform(const dimensionSet &)
treeBoundBox combine(const treeBoundBox &a, const treeBoundBox &b)
virtual const List< transformer > & AMITransforms() const
Return a reference to the AMI transforms.