45 label nChangedFaces(0);
52 const label start =
patch.start();
55 changedFaces[nChangedFaces++] = start + faceI;
63 fvMeshSubset subSetMesh(
mesh_, zoneCells);
64 const fvMesh& subMesh = subSetMesh.subMesh();
68 const label
patchID(subMesh.boundaryMesh().findPatchID(patchName));
69 const polyPatch& subMeshPatch = subMesh.boundaryMesh()[
patchID];
72 const label start = subMeshPatch.start();
76 forAll(subMeshPatch.faceCentres(), faceI)
78 changedFaces[nChangedFaces++] =
faceMap[start + faceI];
85 for (label faceI : zoneFaces)
87 changedFaces[nChangedFaces++] = faceI;
90 changedFaces.
setSize(nChangedFaces);
91 List<wallPointData<bool>> changedFacesInfo(nChangedFaces);
95 changedFacesInfo[fI] =
96 wallPointData<bool>(faceCentres[changedFaces[fI]],
true, 0.0);
99 meshWave_.setFaceInfo(changedFaces, changedFacesInfo);
108 if (!isFixedCell_[cellID])
110 isActiveCell_[cellID] =
true;
111 activeCells_.append(cellID);
124 if (nVisited < marchingStep_ + 1)
126 const labelList& cellCells = mesh_.cellCells()[cI];
127 for (label neiCellI : cellCells)
129 if (!isFixedCell_[neiCellI])
131 if (!isActiveCell_[neiCellI])
133 isActiveCell_[neiCellI] =
true;
134 newlyAddedCells.
append(neiCellI);
136 march(nVisited, neiCellI, newlyAddedCells);
145 Foam::marchingCells::marchingCells
148 const dictionary&
dict 154 mesh_.boundaryMesh().patchSet
156 dict.getOrDefault<wordRes>(
"seedPatches", wordRes(0))
161 mesh_.cellZones().indices
163 dict.getOrDefault<wordRes>(
"seedCellZones", wordRes(0))
168 mesh_.faceZones().indices
170 dict.getOrDefault<wordRes>(
"seedFaceZones", wordRes(0))
173 marchingStep_(
dict.
get<label>(
"marchingStep")),
174 isActiveCell_(mesh_.nCells(), false),
175 isFixedCell_(mesh_.nCells(), false),
180 allFaceInfo_(mesh_.nFaces()),
182 meshWave_(mesh_, allFaceInfo_, allCellInfo_)
197 meshWave_.iterate(
iters*marchingStep_);
200 addedCells_ =
labelList(mesh_.nCells(), -1);
201 label nAddedCells(0);
204 if (allCellInfo_[cI].data() && !isActiveCell_[cI] && !isFixedCell_[cI])
206 addedCells_[nAddedCells++] = cI;
207 isActiveCell_[cI] =
true;
210 addedCells_.setSize(nAddedCells);
213 activeCells_.append(addedCells_);
218 cellSet activeCellList
221 "activeCells" +
name(nIters_),
224 for (label cellI : activeCells_)
226 activeCellList.insert(cellI);
228 activeCellList.write();
241 for (
const label
cellZoneID : fixedCellZoneIDs)
245 isFixedCell_[cI] =
true;
246 isActiveCell_[cI] =
false;
254 for (
const label cI : fixedCellIDs)
256 isFixedCell_[cI] =
true;
257 isActiveCell_[cI] =
false;
List< ReturnType > get(const UPtrList< T > &list, const AccessOp &aop)
List of values generated by applying the access operation to each list item.
static bool initialised_(false)
void append(const T &val)
Append an element at the end of the list.
FaceCellWave< wallPointData< bool > > meshWave_
Engine propagating the active cells.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
label nFaces() const noexcept
Number of mesh faces.
DynamicID< faceZoneMesh > faceZoneID
Foam::faceZoneID.
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
labelHashSet seedPatches_
Patches used as seeds in the marching algorithm.
#define forAll(list, i)
Loop across all elements in list.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
labelList seedFaceZoneIDs_
Face zones used as seeds in the marching algorithm.
void addFixedCells(const cellZoneMesh &cellZoneMesh, const labelList &fixedCellZoneIDs)
Add fixed cells through cellZone IDs.
void update(const label iters=1)
Update active cells.
bool initialised_
Has the initial seeding been conducted.
int debug
Static debugging option.
const faceZoneMesh & faceZones() const noexcept
Return face zone mesh.
defineTypeNameAndDebug(combustionModel, 0)
void appendSeedCell(const label cellID)
Append cell to seed cells.
void setSize(const label newLen)
Same as resize()
DynamicID< cellZoneMesh > cellZoneID
Foam::cellZoneID.
const vectorField & faceCentres() const
static word exposedPatchName
Name for exposed internal faces (default: oldInternalFaces)
loopControl iters(runTime, aMesh.solutionDict(), "solution")
const std::string patch
OpenFOAM patch number as a std::string.
void initialise()
Initialise the active cells from the seeding patches.
const cellZoneMesh & cellZones() const noexcept
Return cell zone mesh.
const fvBoundaryMesh & boundary() const noexcept
Return reference to boundary mesh.
Field< vector > vectorField
Specialisation of Field<T> for vector.
void march(label nVisited, const label cI, labelList &newlyAddedCells)
List< label > labelList
A List of labels.
ZoneMesh< cellZone, polyMesh > cellZoneMesh
A ZoneMesh with the type cellZone.
labelList seedCellZoneIDs_
Cell zones, the boundary faces of which are used as seeds in the marching algorithm.