78 void Foam::snappyLayerDriver::dumpDisplacement
80 const fileName& prefix,
83 const List<extrudeMode>& extrudeStatus
86 OBJstream dispStr(prefix +
"_disp.obj");
87 Info<<
"Writing all displacements to " << dispStr.name() <<
endl;
89 forAll(patchDisp, patchPointi)
91 const point& pt =
pp.localPoints()[patchPointi];
92 dispStr.writeLine(pt, pt + patchDisp[patchPointi]);
96 OBJstream illStr(prefix +
"_illegal.obj");
97 Info<<
"Writing invalid displacements to " << illStr.name() <<
endl;
99 forAll(patchDisp, patchPointi)
101 if (extrudeStatus[patchPointi] !=
EXTRUDE)
103 const point& pt =
pp.localPoints()[patchPointi];
104 illStr.writeLine(pt, pt + patchDisp[patchPointi]);
117 auto& faceFld = tfaceFld.ref();
126 faceFld[facei] += pointFld[
f[fp]];
128 faceFld[facei] /=
f.
size();
137 void Foam::snappyLayerDriver::checkManifold
140 pointSet& nonManifoldPoints
144 fp.checkPointManifold(
false, &nonManifoldPoints);
151 const labelList& eFaces = edgeFaces[edgei];
153 if (eFaces.size() > 2)
155 const edge&
e = fp.edges()[edgei];
157 nonManifoldPoints.insert(fp.meshPoints()[
e[0]]);
158 nonManifoldPoints.insert(fp.meshPoints()[
e[1]]);
164 void Foam::snappyLayerDriver::checkMeshManifold()
const 166 const fvMesh&
mesh = meshRefiner_.mesh();
168 Info<<
nl <<
"Checking mesh manifoldness ..." <<
endl;
170 pointSet nonManifoldPoints
192 label nNonManif =
returnReduce(nonManifoldPoints.size(), sumOp<label>());
196 Info<<
"Outside of mesh is multiply connected across edges or" 198 <<
"This is not a fatal error but might cause some unexpected" 199 <<
" behaviour." <<
nl 214 bool Foam::snappyLayerDriver::unmarkExtrusion
216 const label patchPointi,
219 List<extrudeMode>& extrudeStatus
222 if (extrudeStatus[patchPointi] == EXTRUDE)
224 extrudeStatus[patchPointi] = NOEXTRUDE;
225 patchNLayers[patchPointi] = 0;
226 patchDisp[patchPointi] =
Zero;
229 else if (extrudeStatus[patchPointi] == EXTRUDEREMOVE)
231 extrudeStatus[patchPointi] = NOEXTRUDE;
232 patchNLayers[patchPointi] = 0;
233 patchDisp[patchPointi] =
Zero;
242 bool Foam::snappyLayerDriver::unmarkExtrusion
244 const face& localFace,
247 List<extrudeMode>& extrudeStatus
250 bool unextruded =
false;
272 Foam::label Foam::snappyLayerDriver::constrainFp(
const label sz,
const label fp)
289 void Foam::snappyLayerDriver::countCommonPoints
294 Map<label>& nCommonPoints
300 const face&
f = localFaces[facei];
302 nCommonPoints.
clear();
306 label pointi =
f[fp];
311 label nbFacei =
pFaces[pFacei];
316 ++(nCommonPoints(nbFacei, 0));
323 bool Foam::snappyLayerDriver::checkCommonOrder
333 const label nb = nbFace.find(curFace[fp]);
347 label fpPlus1 = curFace.fcIndex(fp);
348 label fpMin1 = curFace.rcIndex(fp);
351 label nbPlus1 = nbFace.fcIndex(nb);
352 label nbMin1 = nbFace.rcIndex(nb);
359 if (nbFace[nbPlus1] == curFace[fpPlus1])
364 else if (nbFace[nbPlus1] == curFace[fpMin1])
369 else if (nbFace[nbMin1] == curFace[fpMin1])
387 curFp = constrainFp(curFace.size(), curFp+curInc);
388 curNb = constrainFp(nbFace.size(), curNb+nbInc);
389 }
while (curFace[curFp] == nbFace[curNb]);
397 for (label commonI = 0; commonI < nCommon; commonI++)
399 curFp = constrainFp(curFace.size(), curFp+curInc);
400 curNb = constrainFp(nbFace.size(), curNb+nbInc);
402 if (curFace[curFp] != nbFace[curNb])
418 void Foam::snappyLayerDriver::checkCommonOrder
422 const Map<label>& nCommonPoints,
425 List<extrudeMode>& extrudeStatus
430 const label nbFacei = iter.key();
431 const label nCommon = iter.val();
433 const face& curFace =
pp[facei];
434 const face& nbFace =
pp[nbFacei];
439 && nCommon != nbFace.size()
440 && nCommon != curFace.size()
443 bool stringOk = checkCommonOrder(nCommon, curFace, nbFace);
469 void Foam::snappyLayerDriver::handleNonStringConnected
474 List<extrudeMode>& extrudeStatus
482 List<extrudeMode> oldExtrudeStatus;
483 autoPtr<OBJstream> str;
486 oldExtrudeStatus = extrudeStatus;
491 meshRefiner_.mesh().time().path()
492 /
"nonStringConnected.obj" 495 Pout<<
"Dumping string edges to " << str().
name();
500 Map<label> nCommonPoints(128);
504 countCommonPoints(
pp, facei, nCommonPoints);
527 forAll(extrudeStatus, pointi)
529 if (extrudeStatus[pointi] != oldExtrudeStatus[pointi])
542 void Foam::snappyLayerDriver::handleNonManifolds
549 List<extrudeMode>& extrudeStatus
552 const fvMesh&
mesh = meshRefiner_.mesh();
554 Info<<
nl <<
"Handling non-manifold points ..." <<
endl;
557 Info<<
nl <<
"Checking patch manifoldness ..." <<
endl;
559 pointSet nonManifoldPoints(
mesh,
"nonManifoldPoints",
pp.
nPoints());
572 const labelList& eFaces = edgeFaces[edgei];
573 if (eFaces.size() > 2)
583 forAll(edgeGlobalFaces, edgei)
585 if (edgeGlobalFaces[edgei].size() > 2)
597 label nNonManif =
returnReduce(nonManifoldPoints.size(), sumOp<label>());
599 Info<<
"Outside of local patch is multiply connected across edges or" 600 <<
" points at " << nNonManif <<
" points." <<
endl;
607 nonManifoldPoints.sync(
mesh);
611 forAll(meshPoints, patchPointi)
613 if (nonManifoldPoints.found(meshPoints[patchPointi]))
626 Info<<
"Set displacement to zero for all " << nNonManif
627 <<
" non-manifold points" <<
endl;
637 label nBaffleFaces = 0;
642 const labelList& fEdges = faceEdges[facei];
644 const labelList& globFaces0 = edgeGlobalFaces[fEdges[0]];
645 if (globFaces0.size() == 2)
647 const edge e0(globFaces0[0], globFaces0[1]);
648 bool isBaffle =
true;
649 for (label fp = 1; fp < fEdges.size(); fp++)
651 const labelList& globFaces = edgeGlobalFaces[fEdges[fp]];
654 (globFaces.size() != 2)
655 || (edge(globFaces[0], globFaces[1]) != e0)
665 bool unextrude = unmarkExtrusion
685 reduce(nBaffleFaces, sumOp<label>());
689 Info<<
"Set displacement to zero for all points on " << nBaffleFaces
690 <<
" baffle faces" <<
endl;
697 void Foam::snappyLayerDriver::handleFeatureAngle
701 const scalar minAngle,
704 List<extrudeMode>& extrudeStatus
707 const fvMesh&
mesh = meshRefiner_.mesh();
711 Info<<
nl <<
"Handling feature edges (angle < " << minAngle
714 if (minCos < 1-SMALL && minCos > -1+SMALL)
725 label meshEdgei = meshEdges[edgei];
731 edgeNormal[meshEdgei],
745 autoPtr<OBJstream> str;
754 + meshRefiner_.timeName()
758 Info<<
"Writing feature edges to " << str().name() <<
endl;
769 label meshEdgei = meshEdges[edgei];
771 const vector&
n = edgeNormal[meshEdgei];
806 Info<<
"Set displacement to zero for points on " 808 <<
" feature edges" <<
endl;
817 void Foam::snappyLayerDriver::handleWarpedFaces
820 const scalar faceRatio,
822 const scalar edge0Len,
826 List<extrudeMode>& extrudeStatus
829 const fvMesh&
mesh = meshRefiner_.mesh();
832 Info<<
nl <<
"Handling cells with warped patch faces ..." <<
nl;
840 label nWarpedFaces = 0;
844 const face&
f =
pp[i];
845 label faceI =
pp.addressing()[i];
851 if (relativeSizes[patchI] &&
f.
size() > 3)
854 scalar edgeLen = edge0Len/(1<<ownLevel);
857 const point& fc = faceCentres[faceI];
865 vProj[fp] = (
n & fn);
869 scalar minVal =
min(vProj);
870 scalar maxVal =
max(vProj);
872 if ((maxVal - minVal) > faceRatio * edgeLen)
891 Info<<
"Set displacement to zero on " 893 <<
" warped faces since layer would be > " << faceRatio
894 <<
" of the size of the bounding box." <<
endl;
1001 void Foam::snappyLayerDriver::setNumLayers
1003 meshRefinement& meshRefiner,
1008 List<extrudeMode>& extrudeStatus,
1012 const fvMesh&
mesh = meshRefiner.mesh();
1014 Info<<
nl <<
"Handling points with inconsistent layer specification ..." 1028 label wantedLayers = patchToNLayers[patchi];
1030 forAll(meshPoints, patchPointi)
1034 maxLayers[ppPointi] =
max(wantedLayers, maxLayers[ppPointi]);
1035 minLayers[ppPointi] =
min(wantedLayers, minLayers[ppPointi]);
1067 <<
" maxLayers:" << maxLayers
1068 <<
" minLayers:" << minLayers
1071 else if (maxLayers[i] == minLayers[i])
1074 patchNLayers[i] = maxLayers[i];
1092 patchNLayers[i] = maxLayers[i];
1107 nCells =
max(nCells, patchNLayers[
f[fp]]);
1110 nAddedCells += nCells;
1112 reduce(nAddedCells, sumOp<label>());
1125 Foam::snappyLayerDriver::makeLayerDisplacementField
1127 const pointMesh& pMesh,
1132 const pointBoundaryMesh& pointPatches = pMesh.boundary();
1136 pointPatches.size(),
1137 slipPointPatchVectorField::typeName
1139 wordList actualPatchTypes(patchFieldTypes.size());
1140 forAll(pointPatches, patchi)
1142 actualPatchTypes[patchi] = pointPatches[patchi].type();
1145 forAll(numLayers, patchi)
1149 if (numLayers[patchi] == 0)
1151 patchFieldTypes[patchi] =
1152 zeroFixedValuePointPatchVectorField::typeName;
1154 else if (numLayers[patchi] > 0)
1156 patchFieldTypes[patchi] = fixedValuePointPatchVectorField::typeName;
1160 forAll(pointPatches, patchi)
1162 if (isA<processorPointPatch>(pointPatches[patchi]))
1164 patchFieldTypes[patchi] = calculatedPointPatchVectorField::typeName;
1166 else if (isA<cyclicPointPatch>(pointPatches[patchi]))
1168 patchFieldTypes[patchi] = cyclicSlipPointPatchVectorField::typeName;
1173 const polyMesh&
mesh = pMesh();
1182 "pointDisplacement",
1196 void Foam::snappyLayerDriver::growNoExtrusion
1201 List<extrudeMode>& extrudeStatus
1204 Info<<
nl <<
"Growing non-extrusion points by one layer ..." <<
endl;
1206 List<extrudeMode> grownExtrudeStatus(extrudeStatus);
1212 forAll(localFaces, facei)
1214 const face&
f = localFaces[facei];
1216 bool hasSqueeze =
false;
1219 if (extrudeStatus[
f[fp]] == NOEXTRUDE)
1233 extrudeStatus[
f[fp]] == EXTRUDE
1234 && grownExtrudeStatus[
f[fp]] != NOEXTRUDE
1237 grownExtrudeStatus[
f[fp]] = NOEXTRUDE;
1244 extrudeStatus.transfer(grownExtrudeStatus);
1253 status[i] = extrudeStatus[i];
1257 meshRefiner_.mesh(),
1265 extrudeStatus[i] = extrudeMode(status[i]);
1270 forAll(extrudeStatus, patchPointi)
1272 if (extrudeStatus[patchPointi] == NOEXTRUDE)
1274 patchDisp[patchPointi] =
Zero;
1275 patchNLayers[patchPointi] = 0;
1279 reduce(nGrown, sumOp<label>());
1281 Info<<
"Set displacement to zero for an additional " << nGrown
1282 <<
" points." <<
endl;
1336 Info<<
nl <<
"Adding in total " << nAdded/2 <<
" inter-processor patches to" 1337 <<
" handle extrusion of non-manifold processor boundaries." 1346 for (label patchi = nOldPatches; patchi <
nPatches; patchi++)
1348 label nbrProci = patchToNbrProc[patchi];
1355 patchDict.
add(
"type", processorPolyPatch::typeName);
1357 patchDict.
add(
"neighbProcNo", nbrProci);
1358 patchDict.
add(
"nFaces", 0);
1373 wantedToAddedPatch.
insert(patchi, procPatchi);
1379 label patchi = edgePatchID[i];
1380 const auto fnd = wantedToAddedPatch.
cfind(patchi);
1383 edgePatchID[i] = fnd.val();
1393 void Foam::snappyLayerDriver::calculateLayerThickness
1397 const layerParameters& layerParams,
1400 const scalar edge0Len,
1407 const fvMesh&
mesh = meshRefiner_.mesh();
1421 minThickness = GREAT;
1427 expansionRatio = GREAT;
1429 for (
const label patchi :
patchIDs)
1433 forAll(meshPoints, patchPointi)
1437 firstLayerThickness[ppPointi] =
min 1439 firstLayerThickness[ppPointi],
1440 layerParams.firstLayerThickness()[patchi]
1442 finalLayerThickness[ppPointi] =
min 1444 finalLayerThickness[ppPointi],
1445 layerParams.finalLayerThickness()[patchi]
1447 totalThickness[ppPointi] =
min 1449 totalThickness[ppPointi],
1450 layerParams.thickness()[patchi]
1452 expRatio[ppPointi] =
min 1455 layerParams.expansionRatio()[patchi]
1457 minThickness[ppPointi] =
min 1459 minThickness[ppPointi],
1460 layerParams.minThickness()[patchi]
1469 firstLayerThickness,
1477 finalLayerThickness,
1523 maxPointLevel[
f[fp]] =
max(maxPointLevel[
f[fp]], ownLevel);
1551 for (
const label patchi :
patchIDs)
1555 layerParams.layerModels()[patchi];
1556 const bool relSize = layerParams.relativeSizes()[patchi];
1558 for (
const label meshPointi : meshPoints)
1565 edgeLen[ppPointi] =
min 1568 edge0Len/(1<<maxPointLevel[ppPointi])
1570 spec[ppPointi] =
max(spec[ppPointi], patchSpec);
1571 isRelativePoint[meshPointi] =
1572 isRelativePoint[meshPointi]
1597 orEqOp<unsigned int>(),
1614 finalLayerThickness[pointi] *= edgeLen[pointi];
1615 if (isRelativePoint[meshPointi])
1617 totalThickness[pointi] *= edgeLen[pointi];
1618 minThickness[pointi] *= edgeLen[pointi];
1621 else if (isRelativePoint[meshPointi])
1623 firstLayerThickness[pointi] *= edgeLen[pointi];
1624 finalLayerThickness[pointi] *= edgeLen[pointi];
1625 totalThickness[pointi] *= edgeLen[pointi];
1626 minThickness[pointi] *= edgeLen[pointi];
1629 thickness[pointi] =
min 1635 patchNLayers[pointi],
1636 firstLayerThickness[pointi],
1637 finalLayerThickness[pointi],
1638 totalThickness[pointi],
1642 expansionRatio[pointi] =
min 1644 expansionRatio[pointi],
1645 layerParameters::layerExpansionRatio
1648 patchNLayers[pointi],
1649 firstLayerThickness[pointi],
1650 finalLayerThickness[pointi],
1651 totalThickness[pointi],
1688 label maxPatchNameLen = 0;
1693 maxPatchNameLen =
max(maxPatchNameLen, label(patchName.size()));
1697 <<
setf(ios_base::left) <<
setw(maxPatchNameLen) <<
"patch" 1698 <<
setw(0) <<
" faces layers avg thickness[m]" <<
nl 1699 <<
setf(ios_base::left) <<
setw(maxPatchNameLen) <<
" " 1700 <<
setw(0) <<
" near-wall overall" <<
nl 1701 <<
setf(ios_base::left) <<
setw(maxPatchNameLen) <<
"-----" 1702 <<
setw(0) <<
" ----- ------ --------- -------" <<
endl;
1713 layerParams.layerModels()[patchi];
1715 scalar sumThickness = 0;
1716 scalar sumNearWallThickness = 0;
1717 label nMasterPoints = 0;
1719 forAll(meshPoints, patchPointi)
1721 label meshPointi = meshPoints[patchPointi];
1722 if (isMasterPoint[meshPointi])
1726 sumThickness += thickness[ppPointi];
1727 sumNearWallThickness += layerParams.firstLayerThickness
1730 patchNLayers[ppPointi],
1731 firstLayerThickness[ppPointi],
1732 finalLayerThickness[ppPointi],
1733 thickness[ppPointi],
1734 expansionRatio[ppPointi]
1740 label totNPoints =
returnReduce(nMasterPoints, sumOp<label>());
1743 scalar avgThickness = 0;
1744 scalar avgNearWallThickness = 0;
1751 avgNearWallThickness =
1760 <<
" " <<
setw(6) << layerParams.numLayers()[patchi]
1761 <<
" " <<
setw(8) << avgNearWallThickness
1762 <<
" " <<
setw(8) << avgThickness
1771 void Foam::snappyLayerDriver::syncPatchDisplacement
1778 List<extrudeMode>& extrudeStatus
1796 minMagSqrEqOp<vector>(),
1803 if (
mag(patchDisp[i]) < minThickness[i])
1821 labelList syncPatchNLayers(patchNLayers);
1834 forAll(syncPatchNLayers, i)
1836 if (syncPatchNLayers[i] != patchNLayers[i])
1865 forAll(syncPatchNLayers, i)
1867 if (syncPatchNLayers[i] != patchNLayers[i])
1903 void Foam::snappyLayerDriver::getPatchDisplacement
1912 List<extrudeMode>& extrudeStatus
1915 Info<<
nl <<
"Determining displacement for added points" 1916 <<
" according to pointNormal ..." <<
endl;
1918 const fvMesh&
mesh = meshRefiner_.mesh();
1933 patchDisp = thickness*pointNormals;
1936 label nNoVisNormal = 0;
1937 label nExtrudeRemove = 0;
2022 forAll(pointNormals, patchPointi)
2026 if (extrudeStatus[patchPointi] == NOEXTRUDE)
2029 patchNLayers[patchPointi] = 0;
2030 patchDisp[patchPointi] =
Zero;
2035 const vector&
n = pointNormals[patchPointi];
2041 Pout<<
"No valid normal for point " << meshPointi
2043 <<
"; setting displacement to " 2044 << patchDisp[patchPointi]
2048 extrudeStatus[patchPointi] = EXTRUDEREMOVE;
2055 forAll(extrudeStatus, patchPointi)
2057 if (extrudeStatus[patchPointi] == EXTRUDEREMOVE)
2066 label edgei = pEdges[i];
2068 label otherPointi =
pp.
edges()[edgei].otherVertex(patchPointi);
2070 if (extrudeStatus[otherPointi] != NOEXTRUDE)
2072 avg += localPoints[otherPointi] + patchDisp[otherPointi];
2081 Pout<<
"Displacement at illegal point " 2082 << localPoints[patchPointi]
2084 << (avg /
nPoints - localPoints[patchPointi])
2088 patchDisp[patchPointi] =
2090 - localPoints[patchPointi];
2103 <<
" points with point normal pointing through faces." <<
nl 2104 <<
"Reset displacement at " 2106 <<
" points to average of surrounding points." <<
endl;
2109 syncPatchDisplacement
2123 bool Foam::snappyLayerDriver::sameEdgeNeighbour
2126 const label myGlobalFacei,
2127 const label nbrGlobFacei,
2131 const labelList& eFaces = globalEdgeFaces[edgei];
2132 if (eFaces.size() == 2)
2134 return edge(myGlobalFacei, nbrGlobFacei) == edge(eFaces[0], eFaces[1]);
2141 void Foam::snappyLayerDriver::getVertexString
2147 const label myGlobFacei,
2148 const label nbrGlobFacei,
2153 label fp = fEdges.
find(edgei);
2166 label prevFp = fEdges.rcIndex(startFp);
2186 label nextFp = fEdges.fcIndex(endFp);
2220 Foam::label Foam::snappyLayerDriver::truncateDisplacement
2222 const globalIndex& globalFaces,
2226 const faceSet& illegalPatchFaces,
2229 List<extrudeMode>& extrudeStatus
2232 const fvMesh&
mesh = meshRefiner_.mesh();
2238 for (
const label facei : illegalPatchFaces)
2243 <<
"Faceset " << illegalPatchFaces.name()
2244 <<
" contains internal face " << facei <<
nl 2253 const auto fnd = meshPointMap.cfind(
f[fp]);
2256 const label patchPointi = fnd.val();
2258 if (extrudeStatus[patchPointi] != NOEXTRUDE)
2273 forAll(patchDisp, patchPointi)
2275 if (
mag(patchDisp[patchPointi]) < minThickness[patchPointi])
2291 else if (extrudeStatus[patchPointi] == NOEXTRUDE)
2294 patchDisp[patchPointi] =
Zero;
2295 patchNLayers[patchPointi] = 0;
2304 syncPatchDisplacement
2326 const face& localF = localFaces[i];
2331 extrudeMode prevMode = extrudeStatus[localF.prevLabel(0)];
2335 extrudeMode fpMode = extrudeStatus[localF[fp]];
2337 if (prevMode == NOEXTRUDE && fpMode != NOEXTRUDE)
2364 reduce(nPinched, sumOp<label>());
2366 Info<<
"truncateDisplacement : Unextruded " << nPinched
2367 <<
" faces due to non-consecutive vertices being extruded." <<
endl;
2390 label nButterFly = 0;
2392 DynamicList<label> stringedVerts;
2395 const labelList& globFaces = edgeGlobalFaces[edgei];
2397 if (globFaces.size() == 2)
2400 label myGlobalFacei = globalFaces.toGlobal
2402 pp.addressing()[myFacei]
2404 label nbrGlobalFacei =
2406 globFaces[0] != myGlobalFacei
2423 extrudeStatus[stringedVerts[0]] != NOEXTRUDE
2424 || extrudeStatus[stringedVerts.last()] != NOEXTRUDE
2429 for (label i = 1; i < stringedVerts.size()-1; i++)
2431 if (extrudeStatus[stringedVerts[i]] == NOEXTRUDE)
2462 reduce(nButterFly, sumOp<label>());
2464 Info<<
"truncateDisplacement : Unextruded " << nButterFly
2465 <<
" faces due to stringed edges with inconsistent extrusion." 2476 label nDiffering = 0;
2520 if (nPinched+nButterFly+nDiffering == 0)
2532 void Foam::snappyLayerDriver::setupLayerInfoTruncation
2536 const List<extrudeMode>& extrudeStatus,
2537 const label nBufferCellsNoExtrude,
2542 Info<<
nl <<
"Setting up information for layer truncation ..." <<
endl;
2544 const fvMesh&
mesh = meshRefiner_.mesh();
2546 if (nBufferCellsNoExtrude < 0)
2548 Info<<
nl <<
"Performing no layer truncation." 2549 <<
" nBufferCellsNoExtrude set to less than 0 ..." <<
endl;
2558 const label nPointLayers = patchNLayers[
f[fp]];
2559 if (nPointLayers > 0)
2561 if (nPatchFaceLayers[patchFacei] == -1)
2563 nPatchFaceLayers[patchFacei] = nPointLayers;
2567 nPatchFaceLayers[patchFacei] =
min 2569 nPatchFaceLayers[patchFacei],
2576 nPatchPointLayers = patchNLayers;
2579 forAll(nPatchFaceLayers, patchFacei)
2581 if (nPatchFaceLayers[patchFacei] == -1)
2583 nPatchFaceLayers[patchFacei] = 0;
2599 bool noExtrude =
false;
2604 if (extrudeStatus[
f[fp]] == NOEXTRUDE)
2608 mLevel =
max(mLevel, patchNLayers[
f[fp]]);
2618 nPatchFaceLayers[patchFacei] = 1;
2619 maxLevel[patchFacei] = mLevel;
2623 maxLevel[patchFacei] = mLevel;
2635 label nLevels =
gMax(patchNLayers);
2638 for (label ilevel = 1; ilevel < nLevels; ilevel++)
2644 nBuffer = nBufferCellsNoExtrude - 1;
2648 nBuffer = nBufferCellsNoExtrude;
2651 for (label ibuffer = 0; ibuffer < nBuffer + 1; ibuffer++)
2653 labelList tempCounter(nPatchFaceLayers);
2659 forAll(pointFaces[patchPointi], pointFacei)
2661 label facei = pointFaces[patchPointi][pointFacei];
2665 nPatchFaceLayers[facei] != -1
2666 && maxLevel[facei] > 0
2669 foundNeighbour[patchPointi] =
true;
2686 if (foundNeighbour[patchPointi])
2688 forAll(pointFaces[patchPointi], pointFacei)
2690 label facei = pointFaces[patchPointi][pointFacei];
2693 nPatchFaceLayers[facei] == -1
2694 && maxLevel[facei] > 0
2695 && ilevel < maxLevel[facei]
2698 tempCounter[facei] = ilevel;
2703 nPatchFaceLayers = tempCounter;
2709 if (nPatchFaceLayers[patchFacei] == -1)
2711 nPatchFaceLayers[patchFacei] = maxLevel[patchFacei];
2717 if (extrudeStatus[patchPointi] != NOEXTRUDE)
2719 forAll(pointFaces[patchPointi], pointFacei)
2721 label face = pointFaces[patchPointi][pointFacei];
2722 nPatchPointLayers[patchPointi] =
max 2724 nPatchPointLayers[patchPointi],
2725 nPatchFaceLayers[face]
2731 nPatchPointLayers[patchPointi] = 0;
2747 bool Foam::snappyLayerDriver::cellsUseFace
2749 const polyMesh&
mesh,
2756 const cell& cFaces =
mesh.
cells()[cellLabels[i]];
2760 if (faces.found(cFaces[cFacei]))
2774 Foam::label Foam::snappyLayerDriver::checkAndUnmark
2776 const addPatchCellLayer& addLayer,
2777 const dictionary& meshQualityDict,
2778 const bool additionalReporting,
2779 const List<labelPair>& baffles,
2781 const fvMesh& newMesh,
2785 List<extrudeMode>& extrudeStatus
2789 Info<<
nl <<
"Checking mesh with layer ..." <<
endl;
2790 faceSet wrongFaces(newMesh,
"wrongFaces", newMesh.nFaces()/1000);
2803 <<
" (concave, zero area or negative cell pyramid volume)" 2817 addLayer.layerFaces()
2825 const label nReportMax = 10;
2826 DynamicField<point> disabledFaceCentres(nReportMax);
2828 forAll(addedCells, oldPatchFacei)
2832 const labelList& fCells = addedCells[oldPatchFacei];
2834 if (cellsUseFace(newMesh, fCells, wrongFaces))
2848 if (additionalReporting && (nChanged < nReportMax))
2850 disabledFaceCentres.
append 2862 label nChangedTotal =
returnReduce(nChanged, sumOp<label>());
2864 if (additionalReporting)
2873 label nReportLocal = nChanged;
2874 if (nChangedTotal > nReportMax)
2889 Pout<<
"Checked mesh with layers. Disabled extrusion at " <<
endl;
2890 for (label i=0; i < nReportLocal; i++)
2892 Pout<<
" " << disabledFaceCentres[i] <<
endl;
2896 label nReportTotal =
returnReduce(nReportLocal, sumOp<label>());
2898 if (nReportTotal < nChangedTotal)
2900 Info<<
"Suppressed disabled extrusion message for other " 2901 << nChangedTotal - nReportTotal <<
" faces." <<
endl;
2905 return nChangedTotal;
2910 Foam::label Foam::snappyLayerDriver::countExtrusion
2913 const List<extrudeMode>& extrudeStatus
2917 label nExtruded = 0;
2923 const face& localFace = localFaces[i];
2927 if (extrudeStatus[localFace[fp]] != NOEXTRUDE)
2942 const polyMesh&
mesh,
2944 const List<labelPair>& baffles
2953 Map<label> baffleSet(4*baffles.size());
2956 baffleSet.insert(baffles[bafflei][0], bafflei);
2957 baffleSet.insert(baffles[bafflei][1], bafflei);
2961 List<labelPair> newBaffles(baffles.size(),
labelPair(-1, -1));
2969 label oldFacei = newToOldFaces[facei];
2971 const auto faceFnd = baffleSet.find(oldFacei);
2974 label bafflei = faceFnd();
2980 else if (
p[1] == -1)
2987 <<
"Problem:" << facei <<
" at:" 2989 <<
" is on same baffle as " <<
p[0]
3002 void Foam::snappyLayerDriver::getLayerCellsFaces
3004 const polyMesh&
mesh,
3005 const addPatchCellLayer& addLayer,
3015 faceRealThickness = 0;
3023 forAll(addedCells, oldPatchFacei)
3025 const labelList& added = addedCells[oldPatchFacei];
3027 const labelList& layer = layerFaces[oldPatchFacei];
3034 cellNLayers[added[i]] = layer.size()-1;
3039 forAll(layerFaces, oldPatchFacei)
3041 const labelList& layer = layerFaces[oldPatchFacei];
3042 const scalar realThickness = oldRealThickness[oldPatchFacei];
3048 for (label i = 1; i < layer.size(); i++)
3050 faceRealThickness[layer[i]] = realThickness;
3057 void Foam::snappyLayerDriver::printLayerData
3064 const layerParameters& layerParams
3072 label maxPatchNameLen = 0;
3076 word patchName =
pbm[patchi].
name();
3077 maxPatchNameLen =
max(maxPatchNameLen, label(patchName.size()));
3081 meshRefiner_.printMeshInfo(
false,
"Mesh with layers",
false);
3084 <<
setf(ios_base::left) <<
setw(maxPatchNameLen) <<
"patch" 3085 <<
setw(0) <<
" faces layers overall thickness" <<
nl 3086 <<
setf(ios_base::left) <<
setw(maxPatchNameLen) <<
" " 3087 <<
setw(0) <<
" target mesh [m] [%]" <<
nl 3088 <<
setf(ios_base::left) <<
setw(maxPatchNameLen) <<
"-----" 3089 <<
setw(0) <<
" ----- ----- ---- --- ---" <<
endl;
3095 const polyPatch&
pp =
pbm[patchi];
3097 label sumSize =
pp.size();
3101 label sumNLayers = 0;
3104 sumNLayers += cellNLayers[faceCells[i]];
3117 scalar sumRealThickness =
sum(patchReal);
3118 scalar sumFraction = 0;
3121 if (patchWanted[i] > VSMALL)
3123 sumFraction += (patchReal[i]/patchWanted[i]);
3128 reduce(sumSize, sumOp<label>());
3129 reduce(sumNLayers, sumOp<label>());
3130 reduce(sumRealThickness, sumOp<scalar>());
3131 reduce(sumFraction, sumOp<scalar>());
3134 scalar avgLayers = 0;
3136 scalar avgFraction = 0;
3139 avgLayers = scalar(sumNLayers)/sumSize;
3140 avgReal = sumRealThickness/sumSize;
3141 avgFraction = sumFraction/sumSize;
3146 <<
" " <<
setw(8) << sumSize
3147 <<
" " <<
setw(8) << layerParams.numLayers()[patchi]
3148 <<
" " <<
setw(8) << avgLayers
3149 <<
" " <<
setw(8) << avgReal
3150 <<
" " <<
setw(8) << 100*avgFraction
3157 bool Foam::snappyLayerDriver::writeLayerSets
3167 forAll(cellNLayers, celli)
3169 if (cellNLayers[celli] > 0)
3174 cellSet addedCellSet(
mesh,
"addedCells", nAdded);
3175 forAll(cellNLayers, celli)
3177 if (cellNLayers[celli] > 0)
3179 addedCellSet.insert(celli);
3182 addedCellSet.instance() = meshRefiner_.timeName();
3185 <<
" added cells to cellSet " 3186 << addedCellSet.name() <<
endl;
3187 bool ok = addedCellSet.
write();
3188 allOk = allOk && ok;
3194 if (faceRealThickness[facei] > 0)
3200 faceSet layerFacesSet(
mesh,
"layerFaces", nAdded);
3203 if (faceRealThickness[facei] > 0)
3205 layerFacesSet.insert(facei);
3208 layerFacesSet.instance() = meshRefiner_.timeName();
3211 <<
" faces inside added layer to faceSet " 3212 << layerFacesSet.name() <<
endl;
3213 bool ok = layerFacesSet.
write();
3214 allOk = allOk && ok;
3220 bool Foam::snappyLayerDriver::writeLayerData
3233 bool ok = writeLayerSets(
mesh, cellNLayers, faceRealThickness);
3234 allOk = allOk && ok;
3255 fixedValueFvPatchScalarField::typeName
3259 fld[celli] = cellNLayers[celli];
3267 const polyPatch&
pp =
pbm[patchi];
3272 pfld[i] = cellNLayers[faceCells[i]];
3274 fldBf[patchi] == pfld;
3278 bool ok =
fld.write();
3279 allOk = allOk && ok;
3295 fixedValueFvPatchScalarField::typeName
3302 fldBf[patchi] ==
pbm[patchi].patchSlice(faceRealThickness);
3306 bool ok =
fld.write();
3307 allOk = allOk && ok;
3314 "thicknessFraction",
3323 fixedValueFvPatchScalarField::typeName
3344 if (patchWanted[i] > VSMALL)
3346 pfld[i] = patchReal[i]/patchWanted[i];
3350 fldBf[patchi] == pfld;
3353 <<
" : overall layer thickness (fraction" 3354 <<
" of desired thickness)" <<
endl;
3355 bool ok =
fld.write();
3356 allOk = allOk && ok;
3398 label nIdealTotAddedCells = 0;
3415 syncPatchDisplacement
3430 forAll(extrudeStatus, patchPointi)
3433 minPatchState[pointi] = extrudeStatus[patchPointi];
3451 forAll(minPatchState, pointi)
3453 label state = minPatchState[pointi];
3454 if (state == EXTRUDE || state == EXTRUDEREMOVE)
3461 forAll(minPatchState, pointi)
3463 label state = minPatchState[pointi];
3464 if (state == EXTRUDE || state == EXTRUDEREMOVE)
3466 candidatePoints[
n++] = pointi;
3491 if (hasInfo && !layerIDs.found(mpi) && !layerIDs.found(spi))
3493 nonDupZones.append(zonei);
3505 const localPointRegion regionSide(
mesh, nonDupBaffles, candidatePoints);
3517 const labelList& pointMap = map().pointMap();
3518 const labelList& reversePointMap = map().reversePointMap();
3522 label oldPointi = pointMap[pointi];
3523 label newMasterPointi = reversePointMap[oldPointi];
3525 if (newMasterPointi != pointi)
3528 pointToMaster[pointi] = newMasterPointi;
3529 pointToMaster[newMasterPointi] = newMasterPointi;
3535 const labelList& reverseFaceMap = map().reverseFaceMap();
3538 label f0 = reverseFaceMap[baffles[i].
first()];
3539 label f1 = reverseFaceMap[baffles[i].second()];
3548 Info<<
"Writing point-duplicate mesh to time " 3565 /
"duplicatePoints_" 3569 Info<<
"Writing point-duplicates to " << str.name() <<
endl;
3573 label newMasteri = reversePointMap[pointMap[pointi]];
3575 if (newMasteri != pointi)
3577 str.writeLine(
p[pointi],
p[newMasteri]);
3586 void Foam::snappyLayerDriver::mergeFaceZonePoints
3597 fvMesh&
mesh = meshRefiner_.mesh();
3600 label nPointPairs = 0;
3601 forAll(pointToMaster, pointi)
3603 label otherPointi = pointToMaster[pointi];
3604 if (otherPointi != -1)
3609 reduce(nPointPairs, sumOp<label>());
3610 if (nPointPairs > 0)
3613 Info<<
"Merging " << nPointPairs <<
" duplicated points ..." <<
endl;
3621 + meshRefiner_.timeName()
3624 Info<<
"Points to be merged to " << str.name() <<
endl;
3625 forAll(pointToMaster, pointi)
3627 label otherPointi = pointToMaster[pointi];
3628 if (otherPointi != -1)
3632 str.writeLine(pt, otherPt);
3638 autoPtr<mapPolyMesh> map = meshRefiner_.mergePoints(pointToMaster);
3643 const labelList& reverseFaceMap = map().reverseFaceMap();
3647 Info<<
"Merged points in = " 3655 Info<<
"Converting baffles back into zoned faces ..." 3658 autoPtr<mapPolyMesh> map = meshRefiner_.mergeZoneBaffles
3673 forAll(newFaceRealThickness, facei)
3675 label oldFacei =
faceMap[facei];
3678 scalar& realThick = newFaceRealThickness[facei];
3679 realThick =
max(realThick, faceRealThickness[oldFacei]);
3680 scalar& wanted = newFaceWantedThickness[facei];
3681 wanted =
max(wanted, faceWantedThickness[oldFacei]);
3684 faceRealThickness.transfer(newFaceRealThickness);
3685 faceWantedThickness.transfer(newFaceWantedThickness);
3688 Info<<
"Converted baffles in = " 3689 << meshRefiner_.mesh().time().cpuTimeIncrement()
3695 Foam::label Foam::snappyLayerDriver::setPointNumLayers
3697 const layerParameters& layerParams,
3706 List<extrudeMode>& extrudeStatus
3709 fvMesh&
mesh = meshRefiner_.mesh();
3712 patchDisp =
vector(GREAT, GREAT, GREAT);
3717 patchNLayers =
Zero;
3720 label nIdealTotAddedCells = 0;
3724 extrudeStatus = EXTRUDE;
3749 handleNonStringConnected
3779 layerParams.featureAngle(),
3790 if (!layerParams.relativeSizes().found(
false))
3793 const scalar edge0Len =
3794 meshRefiner_.meshCutter().level0EdgeLength();
3795 const labelList& cellLevel = meshRefiner_.meshCutter().cellLevel();
3800 layerParams.maxFaceThicknessRatio(),
3801 layerParams.relativeSizes(),
3826 for (label i = 0; i < layerParams.nGrow(); i++)
3836 return nIdealTotAddedCells;
3841 Foam::snappyLayerDriver::makeMeshMover
3843 const layerParameters& layerParams,
3844 const dictionary& motionDict,
3852 fvMesh&
mesh = meshRefiner_.mesh();
3858 combinedDict.merge(motionDict);
3860 combinedDict.add(
"minThicknessName", minThickness.name());
3862 const List<labelPair> internalBaffles
3874 autoPtr<Foam::externalDisplacementMeshMover> medialAxisMoverPtr
3878 layerParams.meshShrinker(),
3891 if (errorMsg.size() || IOerrorMsg.size())
3900 <<
"Missing/incorrect required dictionary entries:" 3902 << IOerrorMsg.c_str() <<
nl 3903 << errorMsg.c_str() <<
nl <<
nl 3904 <<
"Exiting dry-run" <<
nl <<
endl;
3908 Perr<<
"\nFOAM parallel run exiting\n" <<
endl;
3918 return medialAxisMoverPtr;
3925 const label nLayerIter,
3929 const label nRelaxedIter,
3930 const label nAllowableErrors,
3936 const label nIdealTotAddedCells,
3977 makeLayerDisplacementField
4001 for (label iteration = 0; iteration < nLayerIter; iteration++)
4004 <<
"Layer addition iteration " << iteration <<
nl 4005 <<
"--------------------------" <<
endl;
4011 iteration < nRelaxedIter
4013 : motionDict.
subDict(
"relaxed")
4016 if (iteration >= nRelaxedIter)
4018 Info<<
"Switched to relaxed meshQuality constraints." <<
endl;
4027 syncPatchDisplacement
4038 getPatchDisplacement
4059 patchDisp = -patchDisp;
4078 combinedDict.
merge(motionDict);
4080 combinedDict.merge(meshQualityDict);
4082 combinedDict.add(
"minThicknessName", minThickness.
name());
4085 medialAxisMoverPtr().move
4105 truncateDisplacement
4130 Info<<
"Writing shrunk mesh to time " 4131 << meshRefiner_.timeName() <<
endl;
4161 setupLayerInfoTruncation
4175 forAll(nPatchPointLayers, i)
4179 nPatchPointLayers[i],
4182 finalDisp[i] = ratio*patchDisp[i];
4186 const scalarField invExpansionRatio(1.0/expansionRatio);
4221 savedMeshMod = meshMod;
4243 fvMesh& newMesh = *newMeshPtr;
4247 addProfiling(grow,
"snappyHexMesh::layers::updateMesh");
4280 avgPointData(
pp,
mag(patchDisp))(),
4288 label nAddedCells = 0;
4289 forAll(cellNLayers, celli)
4291 if (cellNLayers[celli] > 0)
4300 Info<<
"Writing layer mesh to time " << meshRefiner_.timeName()
4303 writeLayerSets(newMesh, cellNLayers, faceRealThickness);
4322 facei < newMesh.
nFaces();
4326 label newMeshFacei = map.
faceMap()[facei];
4327 if (newMeshFacei != -1)
4329 meshToNewMesh[newMeshFacei] = facei;
4340 meshToNewMesh[
p[0]],
4343 if (newMeshBaffle[0] != -1 && newMeshBaffle[1] != -1)
4345 newMeshBaffles[newi++] = newMeshBaffle;
4359 <<
" baffles across faceZones of type internal" <<
nl 4363 label nTotChanged = checkAndUnmark
4377 label nTotExtruded = countExtrusion(
pp, extrudeStatus);
4381 Info<<
"Extruding " << nTotExtruded
4382 <<
" out of " << nTotFaces
4383 <<
" faces (" << 100.0*nTotExtruded/nTotFaces <<
"%)." 4384 <<
" Removed extrusion at " << nTotChanged <<
" faces." 4386 <<
"Added " << nTotAddedCells <<
" out of " 4387 << nIdealTotAddedCells
4388 <<
" cells (" << 100.0*nTotAddedCells/nIdealTotAddedCells
4391 if (nTotChanged == 0)
4399 medialAxisMoverPtr().movePoints(
mesh.
points());
4405 for (label i = 0; i < layerParams.
nGrow(); i++)
4450 oldFaceToBaffle.insert(baffle[0], i);
4451 oldFaceToBaffle.insert(baffle[1], i);
4463 const label oldFacei = map.
faceMap()[facei];
4464 const auto iter = oldFaceToBaffle.
find(oldFacei);
4465 if (oldFacei != -1 && iter.good())
4467 const label bafflei = iter();
4468 auto& newBaffle = newBaffles[bafflei];
4469 if (newBaffle[0] == -1)
4471 newBaffle[0] = facei;
4473 else if (newBaffle[1] == -1)
4475 newBaffle[1] = facei;
4481 <<
" already maps to baffle faces:" 4484 <<
" and " << newBaffle[1]
4492 label pointi =
f[fp];
4493 label oldPointi = map.
pointMap()[pointi];
4495 if (pointToMaster[oldPointi] != -1)
4497 candidates.
append(pointi);
4509 const labelPair& newBaffle = newBaffles[i];
4510 if (newBaffle[0] != -1 && newBaffle[1] != -1)
4512 newBaffles[
n++] = newBaffle;
4547 const labelList& oldPoints = newToOld[newi];
4548 if (oldPoints.
size() > 1)
4554 label masteri =
min(meshPoints);
4557 pointToMaster[meshPoints[i]] = masteri;
4565 void Foam::snappyLayerDriver::updatePatch
4588 newToOldPatchPoints = -1;
4591 const labelList& newMeshPoints = newPp().meshPoints();
4595 const label newMeshPointi = newMeshPoints[
newPointi];
4596 const label oldMeshPointi =
4598 const auto iter = baseMap.
find(oldMeshPointi);
4601 newToOldPatchPoints[
newPointi] = iter();
4610 pp = std::move(newPp);
4620 Foam::snappyLayerDriver::snappyLayerDriver
4628 meshRefiner_(meshRefiner),
4629 globalToMasterPatch_(globalToMasterPatch),
4630 globalToSlavePatch_(globalToSlavePatch),
4652 <<
"Merging all faces of a cell" <<
nl 4653 <<
"---------------------------" <<
nl 4654 <<
" - which are on the same patch" <<
nl 4655 <<
" - which make an angle < " << planarAngle
4657 <<
" (cos:" << minCos <<
')' <<
nl 4658 <<
" - as long as the resulting face doesn't become concave" 4661 <<
" (0=straight, 180=fully concave)" <<
nl 4672 duplicateFace[cpl[0]] = cpl[1];
4673 duplicateFace[cpl[1]] = cpl[0];
4676 label nChanged = meshRefiner_.mergePatchFacesUndo
4680 meshRefiner_.meshedPatches(),
4686 nChanged += meshRefiner_.mergeEdgesUndo(minCos, motionDict);
4697 const label nAllowableErrors,
4705 const scalar edge0Len = meshRefiner_.meshCutter().level0EdgeLength();
4713 internalOrBaffleFaceZones = meshRefiner_.getZones(fzTypes);
4720 meshRefiner_.getZones
4735 meshRefiner_.createZoneBaffles
4745 Info<<
"Writing baffled mesh to time " 4746 << meshRefiner_.timeName() <<
endl;
4770 label f0 = reverseFaceMap[baffles[i].first()];
4771 label f1 = reverseFaceMap[baffles[i].second()];
4790 bool hasInfo = meshRefiner_.getFaceZoneInfo
4800 if (layerIDs.
found(mpi) && !layerIDs.
found(spi))
4804 <<
" adding layers to master patch " <<
pbm[mpi].
name()
4805 <<
" only. Freezing points on slave patch " 4809 else if (!layerIDs.
found(mpi) && layerIDs.
found(spi))
4813 <<
" adding layers to slave patch " <<
pbm[spi].
name()
4814 <<
" only. Freezing points on master patch " 4890 const label nIdealTotAddedCells = setPointNumLayers
4912 meshRefiner_.timeName(),
4920 calculateLayerThickness
4925 meshRefiner_.meshCutter().cellLevel(),
4943 avgPointData(
pp(), baseThickness);
4951 (basePatchNLayers+layerParams.
nOuterIter()-1)
4959 for (label layeri = 0; layeri < layerParams.
nOuterIter(); layeri++)
4971 const label nToAdd =
gSum(deltaNLayers);
4973 <<
"Outer iteration : " << layeri <<
nl 4974 <<
"-------------------" <<
endl;
4977 Info<<
"Layers to add in current iteration : " << nToAdd <<
endl;
4992 determineSidePatches
5030 forAll(baseThickness, pointi)
5034 basePatchNLayers[pointi],
5035 baseThickness[pointi],
5036 baseExpansionRatio[pointi],
5037 basePatchNLayers[pointi]
5038 -nAddedLayers[pointi]
5039 -patchNLayers[pointi],
5040 patchNLayers[pointi]
5068 nIdealTotAddedCells,
5094 sliceFaceRealThickness
5099 const label nTotalAdded =
gSum(patchNLayers);
5102 Info<<
nl <<
"Added in current iteration : " << nTotalAdded
5103 <<
" out of : " <<
gSum(deltaNLayers) <<
endl;
5105 if (nTotalAdded == 0)
5112 forAll(patchNLayers, pointi)
5114 nAddedLayers[pointi] += patchNLayers[pointi];
5116 if (patchNLayers[pointi] == 0)
5127 basePatchNLayers[pointi] = nAddedLayers[pointi];
5128 deltaNLayers[pointi] = 0;
5136 deltaNLayers[pointi] =
max 5141 deltaNLayers[pointi],
5142 basePatchNLayers[pointi] - nAddedLayers[pointi]
5179 meshRefiner_.updateMesh(map,
labelList(0));
5182 cellNLayers.setSize(map.
nOldCells(), 0);
5191 cellNLayers[i] += sliceCellNLayers[i];
5194 faceRealThickness.setSize(map.
nOldFaces(), scalar(0));
5201 faceRealThickness += sliceFaceRealThickness;
5217 faceWantedThickness,
5227 Info<<
"Writing mesh with layers but disconnected to time " 5228 << meshRefiner_.timeName() <<
endl;
5243 mapFaceZonePoints(meshRefiner_, map, baffles, pointToMaster);
5247 updatePatch(
patchIDs, map,
pp, newToOldPatchPoints);
5263 newToOldPatchPoints,
5264 vector::uniform(-1),
5269 newToOldPatchPoints,
5275 newToOldPatchPoints,
5276 extrudeMode::NOEXTRUDE,
5281 newToOldPatchPoints,
5287 newToOldPatchPoints,
5293 newToOldPatchPoints,
5299 newToOldPatchPoints,
5305 newToOldPatchPoints,
5329 <<
"Doing final balancing" <<
nl 5330 <<
"---------------------" <<
nl 5350 map().distributeCellData(cellNLayers);
5351 map().distributeFaceData(faceWantedThickness);
5352 map().distributeFaceData(faceRealThickness);
5366 faceWantedThickness,
5379 const bool preBalance,
5388 <<
"Shrinking and layer addition phase" <<
nl 5389 <<
"----------------------------------" <<
nl 5393 Info<<
"Using mesh parameters " << motionDict <<
nl <<
endl;
5398 mergeType == meshRefinement::FaceMergeType::GEOMETRIC
5399 || mergeType == meshRefinement::FaceMergeType::IGNOREPATCH
5402 mergePatchFacesUndo(layerParams, motionDict, mergeType);
5411 label nFacesWithLayers = 0;
5412 forAll(numLayers, patchi)
5414 if (numLayers[patchi] > 0)
5426 <<
"Ignoring layers on coupled patch " <<
pp.name()
5438 meshRefiner_.getFaceZoneInfo(fZones[zonei].
name(), mpi, spi, fzType);
5440 if (numLayers[mpi] > 0)
5442 nFacesWithLayers += fZones[zonei].
size();
5444 if (numLayers[spi] > 0)
5446 nFacesWithLayers += fZones[zonei].
size();
5455 Info<<
nl <<
"No layers to generate ..." <<
endl;
5460 checkMeshManifold();
5463 Info<<
"Checking initial mesh ..." <<
endl;
5472 Info<<
"Detected " << nInitErrors <<
" illegal faces" 5473 <<
" (concave, zero area or negative cell pyramid volume)" 5477 bool faceZoneOnCoupledFace =
false;
5491 const faceZone& fZone = fZones[zonei];
5496 meshRefiner_.getFaceZoneInfo(fzName, mpi, spi, fzType);
5498 if (numLayers[mpi] > 0 || numLayers[spi])
5500 isExtrudedZoneFace.set(fZone);
5517 if (intOrCoupled[facei] && isExtrudedZoneFace.
test(facei))
5519 faceZoneOnCoupledFace =
true;
5534 forAll(numLayers, patchi)
5536 if (numLayers[patchi] > 0)
5539 for (
const label celli :
pp.faceCells())
5541 cellWeights[celli] += numLayers[patchi];
5550 const faceZone& fZone = fZones[zonei];
5555 meshRefiner_.getFaceZoneInfo(fzName, mpi, spi, fzType);
5557 if (numLayers[mpi] > 0)
5566 cellWeights[
cellIDs[i]] += numLayers[mpi];
5570 if (numLayers[spi] > 0)
5577 cellWeights[
cellIDs[i]] += numLayers[mpi];
5586 meshRefiner_.printMeshInfo
5589 "Before layer addition",
5595 const scalar nNewCells =
sum(cellWeights);
5596 const scalar nNewCellsAll =
5601 mag(1.0-nNewCells/nIdealNewCells),
5605 Info<<
"Ideal layer addition" 5606 <<
" : cells:" << nNewCellsAll
5607 <<
" unbalance:" << unbalance
5612 if (preBalance || faceZoneOnCoupledFace)
5615 <<
"Doing initial balancing" <<
nl 5616 <<
"-----------------------" <<
nl
const labelListList & pointEdges() const
Return point-edge addressing.
static bool checkMesh(const bool report, const polyMesh &mesh, const dictionary &dict, labelHashSet &wrongFaces, const bool dryRun=false)
Check mesh with mesh settings in dict. Collects incorrect faces.
const labelList patchIDs(pbm.indices(polyPatchNames, true))
const polyBoundaryMesh & pbm
prefixOSstream Perr
OSstream wrapped stderr (std::cerr) with parallel prefix.
label nPoints() const
Number of points supporting patch faces.
const List< face_type > & localFaces() const
Return patch faces addressing into local point list.
void size(const label n)
Older name for setAddressableSize.
fileName path() const
Return path = rootPath/caseName. Same as TimePaths::path()
Simple container to keep together layer specific information.
Ostream & indent(Ostream &os)
Indent stream.
errorManipArg< error, int > exit(error &err, const int errNo=1)
A face is a list of labels corresponding to mesh vertices.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
const Field< point_type > & localPoints() const
Return pointField of points in patch.
void transfer(List< T > &list)
Transfer the contents of the argument List into this list and annul the argument list.
label nPoints() const noexcept
Number of mesh points.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
scalar concaveAngle() const
void append(const T &val)
Append an element at the end of the list.
bool found(const Key &key) const
Same as contains()
bool getFaceZoneInfo(const word &fzName, label &masterPatchID, label &slavePatchID, surfaceZonesInfo::faceZoneType &fzType) const
Lookup faceZone information. Return false if no information.
const word & name() const noexcept
Return the object name.
const labelListList & pointEdges() const
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Unit conversion functions.
static FOAM_NO_DANGLING_REFERENCE const pointMesh & New(const polyMesh &mesh, Args &&... args)
Get existing or create MeshObject registered with typeName.
constexpr char nl
The newline '\n' character (0x0a)
void inplaceReorder(const labelUList &oldToNew, ListType &input, const bool prune=false)
Inplace reorder the elements of a list.
UIndirectList< label > labelUIndList
UIndirectList of labels.
T & first()
Access first element of the list, position [0].
dimensioned< vector > dimensionedVector
Dimensioned vector obtained from generic dimensioned type.
static word newName(const label myProcNo, const label neighbProcNo)
Return the name of a processorPolyPatch ("procBoundary..") constructed from the pair of processor IDs...
Ostream & endl(Ostream &os)
Add newline and flush stream.
const labelList & patchID() const
Per boundary face label the patch index.
virtual void movePoints(const pointField &)
Move points, returns volumes swept by faces in motion.
static void calcExtrudeInfo(const bool zoneFromAnyFace, const polyMesh &, const globalIndex &globalFaces, const labelListList &globalEdgeFaces, const indirectPrimitivePatch &pp, labelList &edgePatchID, label &nPatches, Map< label > &nbrProcToPatch, Map< label > &patchToNbrProc, labelList &edgeZoneID, boolList &edgeFlip, labelList &inflateFaceID)
Determine extrude information per patch edge:
static bool & parRun() noexcept
Test if this a parallel run.
scalar mergePatchFacesAngle() const
#define addProfiling(Name,...)
Define profiling trigger with specified name and description string. The description is generated by ...
static writeType writeLevel()
Get/set write level.
void clearOut(const bool isMeshUpdate=false)
Clear all geometry and addressing.
GeometricField< vector, pointPatchField, pointMesh > pointVectorField
label nBufferCellsNoExtrude() const
Create buffer region for new layer terminations.
labelRange range() const noexcept
The face range for all boundary faces.
List< labelPair > labelPairList
List of labelPair.
const cellList & cells() const
entry * add(entry *entryPtr, bool mergeEntry=false)
Add a new entry.
GeometricBoundaryField< scalar, fvPatchField, volMesh > Boundary
Type of boundary fields.
const labelList & slaveCells() const
Deprecated(2023-09) same as backCells.
const dictionary & dict() const
static List< labelPair > subsetBaffles(const polyMesh &mesh, const labelList &zoneIDs, const List< labelPair > &baffles)
Subset baffles according to zones.
Ignore writing from objectRegistry::writeObject()
IOField< scalar > scalarIOField
IO for a Field of scalar.
const dimensionSet dimless
Dimensionless.
static int myProcNo(const label communicator=worldComm)
Rank of this process in the communicator (starting from masterNo()). Negative if the process is not a...
const Time & time() const
Return the top-level database.
label nFaces() const noexcept
Number of mesh faces.
PrimitivePatch< IndirectList< face >, const pointField & > indirectPrimitivePatch
A PrimitivePatch with an IndirectList for the faces, const reference for the point field...
virtual const fileName & name() const override
Get the name of the output serial stream. (eg, the name of the Fstream file name) ...
List< labelList > labelListList
List of labelList.
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &f1, const label comm)
const dictionary & subDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a sub-dictionary.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
const labelList & numLayers() const
How many layers to add.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
bool isInternalFace(const label faceIndex) const noexcept
Return true if given face label is internal to the mesh.
UList< label > labelUList
A UList of labels.
void setSize(const label n)
Dummy function, to make FixedList consistent with List.
const labelList & meshPoints() const
Return labelList of mesh points in patch.
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
const fvMesh & mesh() const
Reference to mesh.
static labelPairList findDuplicateFacePairs(const polyMesh &)
Helper routine to find all baffles (two boundary faces.
void reduce(T &value, [[maybe_unused]] BinaryOp bop, [[maybe_unused]] const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Reduce inplace (cf. MPI Allreduce)
virtual const pointField & points() const
Return raw points.
label nRelaxedIter() const
Number of iterations after which relaxed motion rules.
#define forAll(list, i)
Loop across all elements in list.
const labelList & reverseFaceMap() const noexcept
Reverse face map.
label fcIndex(const label i) const noexcept
The forward circular index. The next index in the list which returns to the first at the end of the l...
label mergePoints(const PointList &points, labelList &pointToUnique, labelList &uniquePoints, const scalar mergeTol=SMALL, const bool verbose=false)
Calculate merge mapping, preserving the original point order. All points closer/equal mergeTol are to...
GeometricField< scalar, fvPatchField, volMesh > volScalarField
HashSet< label, Hash< label > > labelHashSet
A HashSet of labels, uses label hasher.
static label appendPatch(fvMesh &, const label insertPatchi, const word &, const dictionary &)
Helper:append patch to end of mesh.
bool insert(const Key &key, const T &obj)
Copy insert a new entry, not overwriting existing entries.
virtual void movePoints(const Field< point_type > &)
Correct patch after moving points.
const Field< point_type > & faceNormals() const
Return face unit normals for patch.
List< face > faceList
List of faces.
pointField vertices(const blockVertexList &bvl)
static void updateList(const labelList &newToOld, const T &nullValue, List< T > &elems)
Helper: reorder list according to map.
bool merge(const dictionary &dict)
Merge entries from the given dictionary.
const labelList & masterCells() const
Deprecated(2023-09) same as frontCells.
A list of faces which address into the list of points.
Omanip< int > setprecision(const int i)
Calculates a unique integer (label so might not have enough room - 2G max) for processor + local inde...
static label nProcs(const label communicator=worldComm)
Number of ranks in parallel run (for given communicator). It is 1 for serial run. ...
Sends/receives parts of mesh+fvfields to neighbouring processors. Used in load balancing.
bool additionalReporting() const
Any additional reporting requested?
const Map< label > & meshPointMap() const
Mesh point map.
vectorField pointField
pointField is a vectorField.
const dimensionedScalar e
Elementary charge.
static labelListList globalEdgeFaces(const polyMesh &, const globalIndex &globalFaces, const indirectPrimitivePatch &pp, const bitSet &orientation)
Per patch edge the pp faces (in global indices) using it.
void setSize(const label n)
Alias for resize()
virtual void updateMesh(const mapPolyMesh &mpm)
Update mesh corresponding to the given map.
FaceMergeType
Enumeration for what to do with co-planar patch faces on a single.
static void exit(int errNo=1)
Shutdown (finalize) MPI as required and exit program with errNo.
Type gSum(const FieldField< Field, Type > &f)
dimensionedScalar cos(const dimensionedScalar &ds)
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
autoPtr< mapPolyMesh > makeMesh(autoPtr< Type > &newMesh, const IOobject &io, const polyMesh &mesh, const labelUList &patchMap, const bool syncParallel=true, const bool orderCells=false, const bool orderPoints=false)
Create new mesh with old mesh patches. Additional dictionaries.
const labelList & cellMap() const noexcept
Old cell map.
labelListList invertOneToMany(const label len, const labelUList &map)
Invert one-to-many map. Unmapped elements will be size 0.
const_iterator cfind(const Key &key) const
Find and return an const_iterator set at the hashed entry.
labelList identity(const label len, label start=0)
Return an identity map of the given length with (map[i] == i), works like std::iota() but returning a...
void clear()
Clear the list, i.e. set size to zero.
virtual int precision() const override
Get precision of output field.
Adds layers of cells to outside (or inside) of polyMesh. Can optionally create stand-alone extruded m...
const polyBoundaryMesh & boundaryMesh() const noexcept
Return boundary mesh.
A class for handling words, derived from Foam::string.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
iterator find(const Key &key)
Find and return an iterator set at the hashed entry.
const labelList & pointMap() const noexcept
Old point map.
label size() const noexcept
The number of entries in the list.
string message() const
The accumulated error message.
const Field< point_type > & faceCentres() const
Return face centres for patch.
virtual const labelList & faceOwner() const
Return face owner.
Reading is optional [identical to LAZY_READ].
static void setDisplacement(const labelList &patchIDs, const indirectPrimitivePatch &pp, pointField &patchDisp, pointVectorField &displacement)
Set displacement field from displacement on patch points.
label nOuterIter() const
Outer loop to add layer by layer. Can be set to >= max layers.
static tmp< T > New(Args &&... args)
Construct tmp with forwarding arguments.
virtual bool write(const token &tok)=0
Write token to stream or otherwise handle it.
const labelListList & edgeFaces() const
Return edge-face addressing.
Info<< "Finished reading KIVA file"<< endl;cellShapeList cellShapes(nPoints);labelList cellZoning(nPoints, -1);const cellModel &hex=cellModel::ref(cellModel::HEX);labelList hexLabels(8);label activeCells=0;labelList pointMap(nPoints);forAll(pointMap, i){ pointMap[i]=i;}for(label i=0;i< nPoints;i++){ if(f[i] > 0.0) { hexLabels[0]=i;hexLabels[1]=i1tab[i];hexLabels[2]=i3tab[i1tab[i]];hexLabels[3]=i3tab[i];hexLabels[4]=i8tab[i];hexLabels[5]=i1tab[i8tab[i]];hexLabels[6]=i3tab[i1tab[i8tab[i]]];hexLabels[7]=i3tab[i8tab[i]];cellShapes[activeCells].reset(hex, hexLabels);edgeList edges=cellShapes[activeCells].edges();forAll(edges, ei) { if(edges[ei].mag(points)< SMALL) { label start=pointMap[edges[ei].start()];while(start !=pointMap[start]) { start=pointMap[start];} label end=pointMap[edges[ei].end()];while(end !=pointMap[end]) { end=pointMap[end];} pointMap[start]=pointMap[end]=Foam::min(start, end);} } cellZoning[activeCells]=idreg[i];activeCells++;}}cellShapes.setSize(activeCells);cellZoning.setSize(activeCells);forAll(cellShapes, celli){ cellShape &cs=cellShapes[celli];forAll(cs, i) { cs[i]=pointMap[cs[i]];} cs.collapse();}label bcIDs[11]={-1, 0, 2, 4, -1, 5, -1, 6, 7, 8, 9};constexpr label nBCs=12;const word *kivaPatchTypes[nBCs]={ &wallPolyPatch::typeName, &wallPolyPatch::typeName, &wallPolyPatch::typeName, &wallPolyPatch::typeName, &symmetryPolyPatch::typeName, &wedgePolyPatch::typeName, &polyPatch::typeName, &polyPatch::typeName, &polyPatch::typeName, &polyPatch::typeName, &symmetryPolyPatch::typeName, &oldCyclicPolyPatch::typeName};enum patchTypeNames{ PISTON, VALVE, LINER, CYLINDERHEAD, AXIS, WEDGE, INFLOW, OUTFLOW, PRESIN, PRESOUT, SYMMETRYPLANE, CYCLIC};const char *kivaPatchNames[nBCs]={ "piston", "valve", "liner", "cylinderHead", "axis", "wedge", "inflow", "outflow", "presin", "presout", "symmetryPlane", "cyclic"};List< DynamicList< face > > pFaces[nBCs]
T returnReduce(const T &value, BinaryOp bop, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Perform reduction on a copy, using specified binary operation.
const edgeList & edges() const
Return list of edges, address into LOCAL point list.
Abstract base class for domain decomposition.
label nInternalFaces() const noexcept
Number of internal faces.
OSstream & stream(OSstream *alternative=nullptr, int communicator=-1)
Return OSstream for output operations.
const Field< point_type > & points() const noexcept
Return reference to global points.
void shrink()
Shrink storage (does not remove any elements; just compacts dynamic lists.
virtual const faceList & faces() const
Return raw faces.
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
void setRefinement(const globalIndex &globalFaces, const labelListList &globalEdgeFaces, const scalarField &expansionRatio, const indirectPrimitivePatch &pp, const bitSet &flip, const labelList &sidePatchID, const labelList &sideZoneID, const boolList &sideFlip, const labelList &inflateFaceID, const labelList &exposedPatchID, const labelList &nFaceLayers, const labelList &nPointLayers, const vectorField &firstLayerDisp, polyTopoChange &meshMod)
Play commands into polyTopoChange to create layers on top.
bool returnReduceOr(const bool value, const int communicator=UPstream::worldComm)
Perform logical (or) MPI Allreduce on a copy. Uses UPstream::reduceOr.
errorManip< error > abort(error &err)
label nEdges() const
Number of mesh edges.
bool test(const label pos) const
Test for True value at specified position, never auto-vivify entries.
label find(const T &val) const
Find index of the first occurrence of the value.
virtual bool write(const bool writeOnProc=true) const
Write mesh using IO settings from time.
label nLayerIter() const
Number of overall layer addition iterations.
word timeName() const
Replacement for Time::timeName() that returns oldInstance (if overwrite_)
A polyBoundaryMesh is a polyPatch list with registered IO, a reference to the associated polyMesh...
const labelListList & pointFaces() const
Return point-face addressing.
Istream and Ostream manipulators taking arguments.
static scalar finalLayerThicknessRatio(const label nLayers, const scalar expansionRatio)
Determine ratio of final layer thickness to.
static word timeName(const scalar t, const int precision=precision_)
Return a time name for the given scalar time value formatted with the given precision.
Smanip< std::ios_base::fmtflags > setf(std::ios_base::fmtflags flags)
int debug
Static debugging option.
static void mapFaceZonePoints(meshRefinement &meshRefiner, const mapPolyMesh &map, labelPairList &baffles, labelList &pointToMaster)
Map numbering after adding cell layers.
Pair< label > labelPair
A pair of labels.
Type gMax(const FieldField< Field, Type > &f)
const faceZoneMesh & faceZones() const noexcept
Return face zone mesh.
void doLayers(const dictionary &shrinkDict, const dictionary &motionDict, const layerParameters &layerParams, const meshRefinement::FaceMergeType mergeType, const bool preBalance, decompositionMethod &decomposer, fvMeshDistribute &distributor)
Add layers according to the dictionary settings.
defineTypeNameAndDebug(combustionModel, 0)
label nOldCells() const noexcept
Number of old cells.
Ostream & decrIndent(Ostream &os)
Decrement the indent level.
static autoPtr< indirectPrimitivePatch > makePatch(const polyMesh &, const labelList &)
Create patch from set of patches.
double cpuTimeIncrement() const
Return CPU time [seconds] since last call to cpuTimeIncrement(), resetCpuTimeIncrement().
static void determineSidePatches(meshRefinement &meshRefiner, const globalIndex &globalFaces, const labelListList &edgeGlobalFaces, const indirectPrimitivePatch &pp, labelList &edgePatchID, labelList &edgeZoneID, boolList &edgeFlip, labelList &inflateFaceID)
Helper: see what zones and patches edges should be extruded into.
bool hasMotionPoints() const noexcept
Has valid preMotionPoints?
scalar mergeDistance() const
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< ' ';}gmvFile<< nl;for(const word &name :lagrangianScalarNames){ IOField< scalar > fld(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
Helper class which maintains intersections of (changing) mesh with (static) surfaces.
void updateMesh(const mapPolyMesh &, const labelList &faceMap, const labelList &pointMap)
Update any locally stored mesh information. Gets additional.
bool moving() const noexcept
Is mesh moving.
const edgeList & edges() const
Return mesh edges. Uses calcEdges.
thicknessModelType
Enumeration defining the layer specification:
const vectorField & faceCentres() const
List< word > wordList
List of word.
label mergePatchFacesUndo(const layerParameters &layerParams, const dictionary &motionDict, const meshRefinement::FaceMergeType mergeType)
Merge patch faces on same cell. Return total number of faces/edges changed.
label nGrow() const
If points get not extruded do nGrow layers of connected faces.
vector point
Point is a vector.
void setInstance(const fileName &instance, const IOobjectOption::writeOption wOpt=IOobject::AUTO_WRITE)
Set the instance for mesh files.
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
#define WarningInFunction
Report a warning using Foam::Warning.
const word & name() const
Return reference to name.
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
label nCells() const noexcept
Number of mesh cells.
autoPtr< mapPolyMesh > dupNonManifoldPoints(const localPointRegion &)
Find boundary points that connect to more than one cell.
labelList meshEdges(const edgeList &allEdges, const labelListList &cellEdges, const labelList &faceCells) const
Return labels of patch edges in the global edge list using cell addressing.
Mesh data needed to do the Finite Volume discretisation.
A List with indirect addressing. Like IndirectList but does not store addressing. ...
Direct mesh changes based on v1.3 polyTopoChange syntax.
const polyBoundaryMesh & patches
const word & name() const noexcept
The zone name.
static autoPtr< externalDisplacementMeshMover > New(const word &type, const dictionary &dict, const List< labelPair > &baffles, pointVectorField &pointDisplacement, const bool dryRun=false)
Return a reference to the selected meshMover model.
Automatically write from objectRegistry::writeObject()
static scalar layerThickness(const thicknessModelType, const label nLayers, const scalar firstLayerThickness, const scalar finalLayerThickness, const scalar totalThickness, const scalar expansionRatio)
Determine overall thickness. Uses two of the four parameters.
messageStream Info
Information stream (stdout output on master, null elsewhere)
const labelListList & faceEdges() const
Return face-edge addressing.
SubField< scalar > subField
Declare type of subField.
writeType
Enumeration for what to write. Used as a bit-pattern.
labelListList addedCells() const
Added cells given current mesh & layerfaces.
Field< vector > vectorField
Specialisation of Field<T> for vector.
label nOldFaces() const noexcept
Number of old faces.
faceZoneType
What to do with faceZone faces.
#define IOWarningInFunction(ios)
Report an IO warning using Foam::Warning.
debugType
Enumeration for what to debug. Used as a bit-pattern.
void addLayers(const layerParameters &layerParams, const label nLayerIter, const dictionary &motionDict, const label nRelaxedIter, const label nAllowableErrors, const labelList &patchIDs, const labelList &internalFaceZones, const List< labelPair > &baffles, const labelList &numLayers, const label nIdealTotAddedCells, const globalIndex &globalFaces, indirectPrimitivePatch &pp, const labelListList &edgeGlobalFaces, const labelList &edgePatchID, const labelList &edgeZoneID, const boolList &edgeFlip, const labelList &inflateFaceID, const scalarField &thickness, const scalarIOField &minThickness, const scalarField &expansionRatio, vectorField &patchDisp, labelList &patchNLayers, List< extrudeMode > &extrudeStatus, polyTopoChange &savedMeshMod, labelList &cellNLayers, scalarField &faceRealThickness)
Mesh consisting of general polyhedral cells.
Omanip< int > setw(const int i)
A subset of mesh faces organised as a primitive patch.
const labelList & faceMap() const noexcept
Old face map.
bool write() const
Write mesh and all data.
List< label > labelList
A List of labels.
A class for managing temporary objects.
A patch is a list of labels that address the faces in the global face list.
static autoPtr< mapPolyMesh > dupFaceZonePoints(meshRefinement &meshRefiner, const labelList &patchIDs, const labelList &numLayers, List< labelPair > baffles, labelList &pointToMaster)
Duplicate points on faceZones with layers. Re-used when adding buffer layers. Can be made private aga...
Ostream & incrIndent(Ostream &os)
Increment the indent level.
static void reduceOr(bool &value, const int communicator=worldComm)
Logical (or) reduction (MPI_AllReduce)
constexpr scalar degToRad(const scalar deg) noexcept
Conversion from degrees to radians.
Defines the attributes of an object for which implicit objectRegistry management is supported...
List< bool > boolList
A List of bools.
A primitive field of type <T> with automated input and output.
const pointField & preMotionPoints() const noexcept
Pre-motion point positions.
static const List< label > & null() noexcept
Return a null List (reference to a nullObject). Behaves like an empty List.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
Do not request registration (bool: false)
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
forAllConstIters(mixture.phases(), phase)
IOerror FatalIOError
Error stream (stdout output on all processes), with additional 'FOAM FATAL IO ERROR' header text and ...
static constexpr const zero Zero
Global zero (0)