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],
1689 label maxPatchNameLen = 0;
1694 maxPatchNameLen =
max(maxPatchNameLen, label(patchName.size()));
1698 <<
setf(ios_base::left) <<
setw(maxPatchNameLen) <<
"patch" 1699 <<
setw(0) <<
" faces layers avg thickness[m]" <<
nl 1700 <<
setf(ios_base::left) <<
setw(maxPatchNameLen) <<
" " 1701 <<
setw(0) <<
" near-wall overall" <<
nl 1702 <<
setf(ios_base::left) <<
setw(maxPatchNameLen) <<
"-----" 1703 <<
setw(0) <<
" ----- ------ --------- -------" <<
endl;
1714 layerParams.layerModels()[patchi];
1716 scalar sumThickness = 0;
1717 scalar sumNearWallThickness = 0;
1718 label nMasterPoints = 0;
1720 forAll(meshPoints, patchPointi)
1722 label meshPointi = meshPoints[patchPointi];
1723 if (isMasterPoint[meshPointi])
1727 sumThickness += thickness[ppPointi];
1728 sumNearWallThickness += layerParams.firstLayerThickness
1731 patchNLayers[ppPointi],
1732 firstLayerThickness[ppPointi],
1733 finalLayerThickness[ppPointi],
1734 thickness[ppPointi],
1735 expansionRatio[ppPointi]
1741 label totNPoints =
returnReduce(nMasterPoints, sumOp<label>());
1744 scalar avgThickness = 0;
1745 scalar avgNearWallThickness = 0;
1752 avgNearWallThickness =
1761 <<
" " <<
setw(6) << layerParams.numLayers()[patchi]
1762 <<
" " <<
setw(8) << avgNearWallThickness
1763 <<
" " <<
setw(8) << avgThickness
1772 void Foam::snappyLayerDriver::syncPatchDisplacement
1779 List<extrudeMode>& extrudeStatus
1797 minMagSqrEqOp<vector>(),
1804 if (
mag(patchDisp[i]) < minThickness[i])
1822 labelList syncPatchNLayers(patchNLayers);
1835 forAll(syncPatchNLayers, i)
1837 if (syncPatchNLayers[i] != patchNLayers[i])
1866 forAll(syncPatchNLayers, i)
1868 if (syncPatchNLayers[i] != patchNLayers[i])
1904 void Foam::snappyLayerDriver::getPatchDisplacement
1913 List<extrudeMode>& extrudeStatus
1916 Info<<
nl <<
"Determining displacement for added points" 1917 <<
" according to pointNormal ..." <<
endl;
1919 const fvMesh&
mesh = meshRefiner_.mesh();
1934 patchDisp = thickness*pointNormals;
1937 label nNoVisNormal = 0;
1938 label nExtrudeRemove = 0;
2023 forAll(pointNormals, patchPointi)
2027 if (extrudeStatus[patchPointi] == NOEXTRUDE)
2030 patchNLayers[patchPointi] = 0;
2031 patchDisp[patchPointi] =
Zero;
2036 const vector&
n = pointNormals[patchPointi];
2042 Pout<<
"No valid normal for point " << meshPointi
2044 <<
"; setting displacement to " 2045 << patchDisp[patchPointi]
2049 extrudeStatus[patchPointi] = EXTRUDEREMOVE;
2056 forAll(extrudeStatus, patchPointi)
2058 if (extrudeStatus[patchPointi] == EXTRUDEREMOVE)
2067 label edgei = pEdges[i];
2069 label otherPointi =
pp.
edges()[edgei].otherVertex(patchPointi);
2071 if (extrudeStatus[otherPointi] != NOEXTRUDE)
2073 avg += localPoints[otherPointi] + patchDisp[otherPointi];
2082 Pout<<
"Displacement at illegal point " 2083 << localPoints[patchPointi]
2085 << (avg /
nPoints - localPoints[patchPointi])
2089 patchDisp[patchPointi] =
2091 - localPoints[patchPointi];
2104 <<
" points with point normal pointing through faces." <<
nl 2105 <<
"Reset displacement at " 2107 <<
" points to average of surrounding points." <<
endl;
2110 syncPatchDisplacement
2124 bool Foam::snappyLayerDriver::sameEdgeNeighbour
2127 const label myGlobalFacei,
2128 const label nbrGlobFacei,
2132 const labelList& eFaces = globalEdgeFaces[edgei];
2133 if (eFaces.size() == 2)
2135 return edge(myGlobalFacei, nbrGlobFacei) == edge(eFaces[0], eFaces[1]);
2142 void Foam::snappyLayerDriver::getVertexString
2148 const label myGlobFacei,
2149 const label nbrGlobFacei,
2154 label fp = fEdges.
find(edgei);
2167 label prevFp = fEdges.rcIndex(startFp);
2187 label nextFp = fEdges.fcIndex(endFp);
2221 Foam::label Foam::snappyLayerDriver::truncateDisplacement
2223 const globalIndex& globalFaces,
2227 const faceSet& illegalPatchFaces,
2230 List<extrudeMode>& extrudeStatus
2233 const fvMesh&
mesh = meshRefiner_.mesh();
2239 for (
const label facei : illegalPatchFaces)
2244 <<
"Faceset " << illegalPatchFaces.name()
2245 <<
" contains internal face " << facei <<
nl 2254 const auto fnd = meshPointMap.cfind(
f[fp]);
2257 const label patchPointi = fnd.val();
2259 if (extrudeStatus[patchPointi] != NOEXTRUDE)
2274 forAll(patchDisp, patchPointi)
2276 if (
mag(patchDisp[patchPointi]) < minThickness[patchPointi])
2292 else if (extrudeStatus[patchPointi] == NOEXTRUDE)
2295 patchDisp[patchPointi] =
Zero;
2296 patchNLayers[patchPointi] = 0;
2305 syncPatchDisplacement
2327 const face& localF = localFaces[i];
2332 extrudeMode prevMode = extrudeStatus[localF.prevLabel(0)];
2336 extrudeMode fpMode = extrudeStatus[localF[fp]];
2338 if (prevMode == NOEXTRUDE && fpMode != NOEXTRUDE)
2365 reduce(nPinched, sumOp<label>());
2367 Info<<
"truncateDisplacement : Unextruded " << nPinched
2368 <<
" faces due to non-consecutive vertices being extruded." <<
endl;
2391 label nButterFly = 0;
2393 DynamicList<label> stringedVerts;
2396 const labelList& globFaces = edgeGlobalFaces[edgei];
2398 if (globFaces.size() == 2)
2401 label myGlobalFacei = globalFaces.toGlobal
2403 pp.addressing()[myFacei]
2405 label nbrGlobalFacei =
2407 globFaces[0] != myGlobalFacei
2424 extrudeStatus[stringedVerts[0]] != NOEXTRUDE
2425 || extrudeStatus[stringedVerts.last()] != NOEXTRUDE
2430 for (label i = 1; i < stringedVerts.size()-1; i++)
2432 if (extrudeStatus[stringedVerts[i]] == NOEXTRUDE)
2463 reduce(nButterFly, sumOp<label>());
2465 Info<<
"truncateDisplacement : Unextruded " << nButterFly
2466 <<
" faces due to stringed edges with inconsistent extrusion." 2477 label nDiffering = 0;
2521 if (nPinched+nButterFly+nDiffering == 0)
2533 void Foam::snappyLayerDriver::setupLayerInfoTruncation
2537 const List<extrudeMode>& extrudeStatus,
2538 const label nBufferCellsNoExtrude,
2543 Info<<
nl <<
"Setting up information for layer truncation ..." <<
endl;
2545 const fvMesh&
mesh = meshRefiner_.mesh();
2547 if (nBufferCellsNoExtrude < 0)
2549 Info<<
nl <<
"Performing no layer truncation." 2550 <<
" nBufferCellsNoExtrude set to less than 0 ..." <<
endl;
2559 const label nPointLayers = patchNLayers[
f[fp]];
2560 if (nPointLayers > 0)
2562 if (nPatchFaceLayers[patchFacei] == -1)
2564 nPatchFaceLayers[patchFacei] = nPointLayers;
2568 nPatchFaceLayers[patchFacei] =
min 2570 nPatchFaceLayers[patchFacei],
2577 nPatchPointLayers = patchNLayers;
2580 forAll(nPatchFaceLayers, patchFacei)
2582 if (nPatchFaceLayers[patchFacei] == -1)
2584 nPatchFaceLayers[patchFacei] = 0;
2600 bool noExtrude =
false;
2605 if (extrudeStatus[
f[fp]] == NOEXTRUDE)
2609 mLevel =
max(mLevel, patchNLayers[
f[fp]]);
2619 nPatchFaceLayers[patchFacei] = 1;
2620 maxLevel[patchFacei] = mLevel;
2624 maxLevel[patchFacei] = mLevel;
2636 label nLevels =
gMax(patchNLayers);
2639 for (label ilevel = 1; ilevel < nLevels; ilevel++)
2645 nBuffer = nBufferCellsNoExtrude - 1;
2649 nBuffer = nBufferCellsNoExtrude;
2652 for (label ibuffer = 0; ibuffer < nBuffer + 1; ibuffer++)
2654 labelList tempCounter(nPatchFaceLayers);
2660 forAll(pointFaces[patchPointi], pointFacei)
2662 label facei = pointFaces[patchPointi][pointFacei];
2666 nPatchFaceLayers[facei] != -1
2667 && maxLevel[facei] > 0
2670 foundNeighbour[patchPointi] =
true;
2687 if (foundNeighbour[patchPointi])
2689 forAll(pointFaces[patchPointi], pointFacei)
2691 label facei = pointFaces[patchPointi][pointFacei];
2694 nPatchFaceLayers[facei] == -1
2695 && maxLevel[facei] > 0
2696 && ilevel < maxLevel[facei]
2699 tempCounter[facei] = ilevel;
2704 nPatchFaceLayers = tempCounter;
2710 if (nPatchFaceLayers[patchFacei] == -1)
2712 nPatchFaceLayers[patchFacei] = maxLevel[patchFacei];
2718 if (extrudeStatus[patchPointi] != NOEXTRUDE)
2720 forAll(pointFaces[patchPointi], pointFacei)
2722 label face = pointFaces[patchPointi][pointFacei];
2723 nPatchPointLayers[patchPointi] =
max 2725 nPatchPointLayers[patchPointi],
2726 nPatchFaceLayers[face]
2732 nPatchPointLayers[patchPointi] = 0;
2748 bool Foam::snappyLayerDriver::cellsUseFace
2750 const polyMesh&
mesh,
2757 const cell& cFaces =
mesh.
cells()[cellLabels[i]];
2761 if (faces.found(cFaces[cFacei]))
2775 Foam::label Foam::snappyLayerDriver::checkAndUnmark
2777 const addPatchCellLayer& addLayer,
2778 const dictionary& meshQualityDict,
2779 const bool additionalReporting,
2780 const List<labelPair>& baffles,
2782 const fvMesh& newMesh,
2786 List<extrudeMode>& extrudeStatus
2790 Info<<
nl <<
"Checking mesh with layer ..." <<
endl;
2791 faceSet wrongFaces(newMesh,
"wrongFaces", newMesh.nFaces()/1000);
2804 <<
" (concave, zero area or negative cell pyramid volume)" 2818 addLayer.layerFaces()
2826 const label nReportMax = 10;
2827 DynamicField<point> disabledFaceCentres(nReportMax);
2829 forAll(addedCells, oldPatchFacei)
2833 const labelList& fCells = addedCells[oldPatchFacei];
2835 if (cellsUseFace(newMesh, fCells, wrongFaces))
2849 if (additionalReporting && (nChanged < nReportMax))
2851 disabledFaceCentres.
append 2863 label nChangedTotal =
returnReduce(nChanged, sumOp<label>());
2865 if (additionalReporting)
2874 label nReportLocal = nChanged;
2875 if (nChangedTotal > nReportMax)
2890 Pout<<
"Checked mesh with layers. Disabled extrusion at " <<
endl;
2891 for (label i=0; i < nReportLocal; i++)
2893 Pout<<
" " << disabledFaceCentres[i] <<
endl;
2897 label nReportTotal =
returnReduce(nReportLocal, sumOp<label>());
2899 if (nReportTotal < nChangedTotal)
2901 Info<<
"Suppressed disabled extrusion message for other " 2902 << nChangedTotal - nReportTotal <<
" faces." <<
endl;
2906 return nChangedTotal;
2911 Foam::label Foam::snappyLayerDriver::countExtrusion
2914 const List<extrudeMode>& extrudeStatus
2918 label nExtruded = 0;
2924 const face& localFace = localFaces[i];
2928 if (extrudeStatus[localFace[fp]] != NOEXTRUDE)
2943 const polyMesh&
mesh,
2945 const List<labelPair>& baffles
2954 Map<label> baffleSet(4*baffles.size());
2957 baffleSet.insert(baffles[bafflei][0], bafflei);
2958 baffleSet.insert(baffles[bafflei][1], bafflei);
2962 List<labelPair> newBaffles(baffles.size(),
labelPair(-1, -1));
2970 label oldFacei = newToOldFaces[facei];
2972 const auto faceFnd = baffleSet.find(oldFacei);
2975 label bafflei = faceFnd();
2981 else if (
p[1] == -1)
2988 <<
"Problem:" << facei <<
" at:" 2990 <<
" is on same baffle as " <<
p[0]
3003 void Foam::snappyLayerDriver::getLayerCellsFaces
3005 const polyMesh&
mesh,
3006 const addPatchCellLayer& addLayer,
3016 faceRealThickness = 0;
3024 forAll(addedCells, oldPatchFacei)
3026 const labelList& added = addedCells[oldPatchFacei];
3028 const labelList& layer = layerFaces[oldPatchFacei];
3035 cellNLayers[added[i]] = layer.size()-1;
3040 forAll(layerFaces, oldPatchFacei)
3042 const labelList& layer = layerFaces[oldPatchFacei];
3043 const scalar realThickness = oldRealThickness[oldPatchFacei];
3049 for (label i = 1; i < layer.size(); i++)
3051 faceRealThickness[layer[i]] = realThickness;
3058 void Foam::snappyLayerDriver::printLayerData
3065 const layerParameters& layerParams
3073 label maxPatchNameLen = 0;
3077 word patchName =
pbm[patchi].
name();
3078 maxPatchNameLen =
max(maxPatchNameLen, label(patchName.size()));
3082 meshRefiner_.printMeshInfo(
false,
"Mesh with layers",
false);
3085 <<
setf(ios_base::left) <<
setw(maxPatchNameLen) <<
"patch" 3086 <<
setw(0) <<
" faces layers overall thickness" <<
nl 3087 <<
setf(ios_base::left) <<
setw(maxPatchNameLen) <<
" " 3088 <<
setw(0) <<
" target mesh [m] [%]" <<
nl 3089 <<
setf(ios_base::left) <<
setw(maxPatchNameLen) <<
"-----" 3090 <<
setw(0) <<
" ----- ----- ---- --- ---" <<
endl;
3096 const polyPatch&
pp =
pbm[patchi];
3098 label sumSize =
pp.size();
3102 label sumNLayers = 0;
3105 sumNLayers += cellNLayers[faceCells[i]];
3118 scalar sumRealThickness =
sum(patchReal);
3119 scalar sumFraction = 0;
3122 if (patchWanted[i] > VSMALL)
3124 sumFraction += (patchReal[i]/patchWanted[i]);
3129 reduce(sumSize, sumOp<label>());
3130 reduce(sumNLayers, sumOp<label>());
3131 reduce(sumRealThickness, sumOp<scalar>());
3132 reduce(sumFraction, sumOp<scalar>());
3135 scalar avgLayers = 0;
3137 scalar avgFraction = 0;
3140 avgLayers = scalar(sumNLayers)/sumSize;
3141 avgReal = sumRealThickness/sumSize;
3142 avgFraction = sumFraction/sumSize;
3147 <<
" " <<
setw(8) << sumSize
3148 <<
" " <<
setw(8) << layerParams.numLayers()[patchi]
3149 <<
" " <<
setw(8) << avgLayers
3150 <<
" " <<
setw(8) << avgReal
3151 <<
" " <<
setw(8) << 100*avgFraction
3158 bool Foam::snappyLayerDriver::writeLayerSets
3168 forAll(cellNLayers, celli)
3170 if (cellNLayers[celli] > 0)
3175 cellSet addedCellSet(
mesh,
"addedCells", nAdded);
3176 forAll(cellNLayers, celli)
3178 if (cellNLayers[celli] > 0)
3180 addedCellSet.insert(celli);
3183 addedCellSet.instance() = meshRefiner_.timeName();
3186 <<
" added cells to cellSet " 3187 << addedCellSet.name() <<
endl;
3188 bool ok = addedCellSet.
write();
3189 allOk = allOk && ok;
3195 if (faceRealThickness[facei] > 0)
3201 faceSet layerFacesSet(
mesh,
"layerFaces", nAdded);
3204 if (faceRealThickness[facei] > 0)
3206 layerFacesSet.insert(facei);
3209 layerFacesSet.instance() = meshRefiner_.timeName();
3212 <<
" faces inside added layer to faceSet " 3213 << layerFacesSet.name() <<
endl;
3214 bool ok = layerFacesSet.
write();
3215 allOk = allOk && ok;
3221 bool Foam::snappyLayerDriver::writeLayerData
3234 bool ok = writeLayerSets(
mesh, cellNLayers, faceRealThickness);
3235 allOk = allOk && ok;
3256 fixedValueFvPatchScalarField::typeName
3260 fld[celli] = cellNLayers[celli];
3268 const polyPatch&
pp =
pbm[patchi];
3273 pfld[i] = cellNLayers[faceCells[i]];
3275 fldBf[patchi] == pfld;
3279 bool ok =
fld.write();
3280 allOk = allOk && ok;
3296 fixedValueFvPatchScalarField::typeName
3303 fldBf[patchi] ==
pbm[patchi].patchSlice(faceRealThickness);
3307 bool ok =
fld.write();
3308 allOk = allOk && ok;
3315 "thicknessFraction",
3324 fixedValueFvPatchScalarField::typeName
3345 if (patchWanted[i] > VSMALL)
3347 pfld[i] = patchReal[i]/patchWanted[i];
3351 fldBf[patchi] == pfld;
3354 <<
" : overall layer thickness (fraction" 3355 <<
" of desired thickness)" <<
endl;
3356 bool ok =
fld.write();
3357 allOk = allOk && ok;
3399 label nIdealTotAddedCells = 0;
3416 syncPatchDisplacement
3431 forAll(extrudeStatus, patchPointi)
3434 minPatchState[pointi] = extrudeStatus[patchPointi];
3452 forAll(minPatchState, pointi)
3454 label state = minPatchState[pointi];
3455 if (state == EXTRUDE || state == EXTRUDEREMOVE)
3462 forAll(minPatchState, pointi)
3464 label state = minPatchState[pointi];
3465 if (state == EXTRUDE || state == EXTRUDEREMOVE)
3467 candidatePoints[
n++] = pointi;
3492 if (hasInfo && !layerIDs.found(mpi) && !layerIDs.found(spi))
3494 nonDupZones.append(zonei);
3506 const localPointRegion regionSide(
mesh, nonDupBaffles, candidatePoints);
3518 const labelList& pointMap = map().pointMap();
3519 const labelList& reversePointMap = map().reversePointMap();
3523 label oldPointi = pointMap[pointi];
3524 label newMasterPointi = reversePointMap[oldPointi];
3526 if (newMasterPointi != pointi)
3529 pointToMaster[pointi] = newMasterPointi;
3530 pointToMaster[newMasterPointi] = newMasterPointi;
3536 const labelList& reverseFaceMap = map().reverseFaceMap();
3539 label f0 = reverseFaceMap[baffles[i].
first()];
3540 label f1 = reverseFaceMap[baffles[i].second()];
3549 Info<<
"Writing point-duplicate mesh to time " 3566 /
"duplicatePoints_" 3570 Info<<
"Writing point-duplicates to " << str.name() <<
endl;
3574 label newMasteri = reversePointMap[pointMap[pointi]];
3576 if (newMasteri != pointi)
3578 str.writeLine(
p[pointi],
p[newMasteri]);
3587 void Foam::snappyLayerDriver::mergeFaceZonePoints
3598 fvMesh&
mesh = meshRefiner_.mesh();
3601 label nPointPairs = 0;
3602 forAll(pointToMaster, pointi)
3604 label otherPointi = pointToMaster[pointi];
3605 if (otherPointi != -1)
3610 reduce(nPointPairs, sumOp<label>());
3611 if (nPointPairs > 0)
3614 Info<<
"Merging " << nPointPairs <<
" duplicated points ..." <<
endl;
3622 + meshRefiner_.timeName()
3625 Info<<
"Points to be merged to " << str.name() <<
endl;
3626 forAll(pointToMaster, pointi)
3628 label otherPointi = pointToMaster[pointi];
3629 if (otherPointi != -1)
3633 str.writeLine(pt, otherPt);
3639 autoPtr<mapPolyMesh> map = meshRefiner_.mergePoints(pointToMaster);
3644 const labelList& reverseFaceMap = map().reverseFaceMap();
3648 Info<<
"Merged points in = " 3656 Info<<
"Converting baffles back into zoned faces ..." 3659 autoPtr<mapPolyMesh> map = meshRefiner_.mergeZoneBaffles
3674 forAll(newFaceRealThickness, facei)
3676 label oldFacei =
faceMap[facei];
3679 scalar& realThick = newFaceRealThickness[facei];
3680 realThick =
max(realThick, faceRealThickness[oldFacei]);
3681 scalar& wanted = newFaceWantedThickness[facei];
3682 wanted =
max(wanted, faceWantedThickness[oldFacei]);
3685 faceRealThickness.transfer(newFaceRealThickness);
3686 faceWantedThickness.transfer(newFaceWantedThickness);
3689 Info<<
"Converted baffles in = " 3690 << meshRefiner_.mesh().time().cpuTimeIncrement()
3696 Foam::label Foam::snappyLayerDriver::setPointNumLayers
3698 const layerParameters& layerParams,
3707 List<extrudeMode>& extrudeStatus
3710 fvMesh&
mesh = meshRefiner_.mesh();
3713 patchDisp =
vector(GREAT, GREAT, GREAT);
3718 patchNLayers =
Zero;
3721 label nIdealTotAddedCells = 0;
3725 extrudeStatus = EXTRUDE;
3750 handleNonStringConnected
3780 layerParams.featureAngle(),
3791 if (!layerParams.relativeSizes().found(
false))
3794 const scalar edge0Len =
3795 meshRefiner_.meshCutter().level0EdgeLength();
3796 const labelList& cellLevel = meshRefiner_.meshCutter().cellLevel();
3801 layerParams.maxFaceThicknessRatio(),
3802 layerParams.relativeSizes(),
3827 for (label i = 0; i < layerParams.nGrow(); i++)
3837 return nIdealTotAddedCells;
3842 Foam::snappyLayerDriver::makeMeshMover
3844 const layerParameters& layerParams,
3845 const dictionary& motionDict,
3853 fvMesh&
mesh = meshRefiner_.mesh();
3859 combinedDict.merge(motionDict);
3861 combinedDict.add(
"minThicknessName", minThickness.name());
3863 const List<labelPair> internalBaffles
3875 autoPtr<Foam::externalDisplacementMeshMover> medialAxisMoverPtr
3879 layerParams.meshShrinker(),
3892 if (errorMsg.size() || IOerrorMsg.size())
3901 <<
"Missing/incorrect required dictionary entries:" 3903 << IOerrorMsg.c_str() <<
nl 3904 << errorMsg.c_str() <<
nl <<
nl 3905 <<
"Exiting dry-run" <<
nl <<
endl;
3909 Perr<<
"\nFOAM parallel run exiting\n" <<
endl;
3919 return medialAxisMoverPtr;
3926 const label nLayerIter,
3930 const label nRelaxedIter,
3931 const label nAllowableErrors,
3937 const label nIdealTotAddedCells,
3978 makeLayerDisplacementField
4002 for (label iteration = 0; iteration < nLayerIter; iteration++)
4005 <<
"Layer addition iteration " << iteration <<
nl 4006 <<
"--------------------------" <<
endl;
4012 iteration < nRelaxedIter
4014 : motionDict.
subDict(
"relaxed")
4017 if (iteration >= nRelaxedIter)
4019 Info<<
"Switched to relaxed meshQuality constraints." <<
endl;
4028 syncPatchDisplacement
4039 getPatchDisplacement
4060 patchDisp = -patchDisp;
4079 combinedDict.
merge(motionDict);
4081 combinedDict.merge(meshQualityDict);
4083 combinedDict.add(
"minThicknessName", minThickness.
name());
4086 medialAxisMoverPtr().move
4106 truncateDisplacement
4131 Info<<
"Writing shrunk mesh to time " 4132 << meshRefiner_.timeName() <<
endl;
4162 setupLayerInfoTruncation
4176 forAll(nPatchPointLayers, i)
4180 nPatchPointLayers[i],
4183 finalDisp[i] = ratio*patchDisp[i];
4187 const scalarField invExpansionRatio(1.0/expansionRatio);
4222 savedMeshMod = meshMod;
4244 fvMesh& newMesh = *newMeshPtr;
4248 addProfiling(grow,
"snappyHexMesh::layers::updateMesh");
4281 avgPointData(
pp,
mag(patchDisp))(),
4289 label nAddedCells = 0;
4290 forAll(cellNLayers, celli)
4292 if (cellNLayers[celli] > 0)
4301 Info<<
"Writing layer mesh to time " << meshRefiner_.timeName()
4304 writeLayerSets(newMesh, cellNLayers, faceRealThickness);
4323 facei < newMesh.
nFaces();
4327 label newMeshFacei = map.
faceMap()[facei];
4328 if (newMeshFacei != -1)
4330 meshToNewMesh[newMeshFacei] = facei;
4341 meshToNewMesh[
p[0]],
4344 if (newMeshBaffle[0] != -1 && newMeshBaffle[1] != -1)
4346 newMeshBaffles[newi++] = newMeshBaffle;
4360 <<
" baffles across faceZones of type internal" <<
nl 4364 label nTotChanged = checkAndUnmark
4378 label nTotExtruded = countExtrusion(
pp, extrudeStatus);
4382 Info<<
"Extruding " << nTotExtruded
4383 <<
" out of " << nTotFaces
4384 <<
" faces (" << 100.0*nTotExtruded/nTotFaces <<
"%)." 4385 <<
" Removed extrusion at " << nTotChanged <<
" faces." 4387 <<
"Added " << nTotAddedCells <<
" out of " 4388 << nIdealTotAddedCells
4389 <<
" cells (" << 100.0*nTotAddedCells/nIdealTotAddedCells
4392 if (nTotChanged == 0)
4400 medialAxisMoverPtr().movePoints(
mesh.
points());
4406 for (label i = 0; i < layerParams.
nGrow(); i++)
4451 oldFaceToBaffle.insert(baffle[0], i);
4452 oldFaceToBaffle.insert(baffle[1], i);
4464 const label oldFacei = map.
faceMap()[facei];
4465 const auto iter = oldFaceToBaffle.
find(oldFacei);
4466 if (oldFacei != -1 && iter.good())
4468 const label bafflei = iter();
4469 auto& newBaffle = newBaffles[bafflei];
4470 if (newBaffle[0] == -1)
4472 newBaffle[0] = facei;
4474 else if (newBaffle[1] == -1)
4476 newBaffle[1] = facei;
4482 <<
" already maps to baffle faces:" 4485 <<
" and " << newBaffle[1]
4493 label pointi =
f[fp];
4494 label oldPointi = map.
pointMap()[pointi];
4496 if (pointToMaster[oldPointi] != -1)
4498 candidates.
append(pointi);
4510 const labelPair& newBaffle = newBaffles[i];
4511 if (newBaffle[0] != -1 && newBaffle[1] != -1)
4513 newBaffles[
n++] = newBaffle;
4548 const labelList& oldPoints = newToOld[newi];
4549 if (oldPoints.
size() > 1)
4555 label masteri =
min(meshPoints);
4558 pointToMaster[meshPoints[i]] = masteri;
4566 void Foam::snappyLayerDriver::updatePatch
4589 newToOldPatchPoints = -1;
4592 const labelList& newMeshPoints = newPp().meshPoints();
4596 const label newMeshPointi = newMeshPoints[
newPointi];
4597 const label oldMeshPointi =
4599 const auto iter = baseMap.
find(oldMeshPointi);
4602 newToOldPatchPoints[
newPointi] = iter();
4611 pp = std::move(newPp);
4621 Foam::snappyLayerDriver::snappyLayerDriver
4629 meshRefiner_(meshRefiner),
4630 globalToMasterPatch_(globalToMasterPatch),
4631 globalToSlavePatch_(globalToSlavePatch),
4653 <<
"Merging all faces of a cell" <<
nl 4654 <<
"---------------------------" <<
nl 4655 <<
" - which are on the same patch" <<
nl 4656 <<
" - which make an angle < " << planarAngle
4658 <<
" (cos:" << minCos <<
')' <<
nl 4659 <<
" - as long as the resulting face doesn't become concave" 4662 <<
" (0=straight, 180=fully concave)" <<
nl 4673 duplicateFace[cpl[0]] = cpl[1];
4674 duplicateFace[cpl[1]] = cpl[0];
4677 label nChanged = meshRefiner_.mergePatchFacesUndo
4681 meshRefiner_.meshedPatches(),
4687 nChanged += meshRefiner_.mergeEdgesUndo(minCos, motionDict);
4696 const label nAllowableErrors,
4704 const scalar edge0Len = meshRefiner_.meshCutter().level0EdgeLength();
4712 internalOrBaffleFaceZones = meshRefiner_.getZones(fzTypes);
4719 meshRefiner_.getZones
4734 meshRefiner_.createZoneBaffles
4744 Info<<
"Writing baffled mesh to time " 4745 << meshRefiner_.timeName() <<
endl;
4769 label f0 = reverseFaceMap[baffles[i].first()];
4770 label f1 = reverseFaceMap[baffles[i].second()];
4789 bool hasInfo = meshRefiner_.getFaceZoneInfo
4799 if (layerIDs.
found(mpi) && !layerIDs.
found(spi))
4803 <<
" adding layers to master patch " <<
pbm[mpi].
name()
4804 <<
" only. Freezing points on slave patch " 4808 else if (!layerIDs.
found(mpi) && layerIDs.
found(spi))
4812 <<
" adding layers to slave patch " <<
pbm[spi].
name()
4813 <<
" only. Freezing points on master patch " 4889 const label nIdealTotAddedCells = setPointNumLayers
4911 meshRefiner_.timeName(),
4919 calculateLayerThickness
4924 meshRefiner_.meshCutter().cellLevel(),
4942 avgPointData(
pp(), baseThickness);
4950 (basePatchNLayers+layerParams.
nOuterIter()-1)
4958 for (label layeri = 0; layeri < layerParams.
nOuterIter(); layeri++)
4970 const label nToAdd =
gSum(deltaNLayers);
4972 <<
"Outer iteration : " << layeri <<
nl 4973 <<
"-------------------" <<
endl;
4976 Info<<
"Layers to add in current iteration : " << nToAdd <<
endl;
4991 determineSidePatches
5029 forAll(baseThickness, pointi)
5033 basePatchNLayers[pointi],
5034 baseThickness[pointi],
5035 baseExpansionRatio[pointi],
5036 basePatchNLayers[pointi]
5037 -nAddedLayers[pointi]
5038 -patchNLayers[pointi],
5039 patchNLayers[pointi]
5067 nIdealTotAddedCells,
5093 sliceFaceRealThickness
5098 const label nTotalAdded =
gSum(patchNLayers);
5101 Info<<
nl <<
"Added in current iteration : " << nTotalAdded
5102 <<
" out of : " <<
gSum(deltaNLayers) <<
endl;
5104 if (nTotalAdded == 0)
5111 forAll(patchNLayers, pointi)
5113 nAddedLayers[pointi] += patchNLayers[pointi];
5115 if (patchNLayers[pointi] == 0)
5126 basePatchNLayers[pointi] = nAddedLayers[pointi];
5127 deltaNLayers[pointi] = 0;
5135 deltaNLayers[pointi] =
max 5140 deltaNLayers[pointi],
5141 basePatchNLayers[pointi] - nAddedLayers[pointi]
5178 meshRefiner_.updateMesh(map,
labelList(0));
5181 cellNLayers.setSize(map.
nOldCells(), 0);
5190 cellNLayers[i] += sliceCellNLayers[i];
5193 faceRealThickness.setSize(map.
nOldFaces(), scalar(0));
5200 faceRealThickness += sliceFaceRealThickness;
5216 faceWantedThickness,
5226 Info<<
"Writing mesh with layers but disconnected to time " 5227 << meshRefiner_.timeName() <<
endl;
5242 mapFaceZonePoints(meshRefiner_, map, baffles, pointToMaster);
5246 updatePatch(
patchIDs, map,
pp, newToOldPatchPoints);
5262 newToOldPatchPoints,
5263 vector::uniform(-1),
5268 newToOldPatchPoints,
5274 newToOldPatchPoints,
5275 extrudeMode::NOEXTRUDE,
5280 newToOldPatchPoints,
5286 newToOldPatchPoints,
5292 newToOldPatchPoints,
5298 newToOldPatchPoints,
5304 newToOldPatchPoints,
5328 <<
"Doing final balancing" <<
nl 5329 <<
"---------------------" <<
nl 5349 map().distributeCellData(cellNLayers);
5350 map().distributeFaceData(faceWantedThickness);
5351 map().distributeFaceData(faceRealThickness);
5365 faceWantedThickness,
5378 const bool preBalance,
5387 <<
"Shrinking and layer addition phase" <<
nl 5388 <<
"----------------------------------" <<
nl 5392 Info<<
"Using mesh parameters " << motionDict <<
nl <<
endl;
5397 mergeType == meshRefinement::FaceMergeType::GEOMETRIC
5398 || mergeType == meshRefinement::FaceMergeType::IGNOREPATCH
5401 mergePatchFacesUndo(layerParams, motionDict, mergeType);
5410 label nFacesWithLayers = 0;
5411 forAll(numLayers, patchi)
5413 if (numLayers[patchi] > 0)
5425 <<
"Ignoring layers on coupled patch " <<
pp.name()
5437 meshRefiner_.getFaceZoneInfo(fZones[zonei].
name(), mpi, spi, fzType);
5439 if (numLayers[mpi] > 0)
5441 nFacesWithLayers += fZones[zonei].
size();
5443 if (numLayers[spi] > 0)
5445 nFacesWithLayers += fZones[zonei].
size();
5454 Info<<
nl <<
"No layers to generate ..." <<
endl;
5459 checkMeshManifold();
5462 Info<<
"Checking initial mesh ..." <<
endl;
5471 Info<<
"Detected " << nInitErrors <<
" illegal faces" 5472 <<
" (concave, zero area or negative cell pyramid volume)" 5476 bool faceZoneOnCoupledFace =
false;
5490 const faceZone& fZone = fZones[zonei];
5495 meshRefiner_.getFaceZoneInfo(fzName, mpi, spi, fzType);
5497 if (numLayers[mpi] > 0 || numLayers[spi])
5499 isExtrudedZoneFace.set(fZone);
5516 if (intOrCoupled[facei] && isExtrudedZoneFace.
test(facei))
5518 faceZoneOnCoupledFace =
true;
5533 forAll(numLayers, patchi)
5535 if (numLayers[patchi] > 0)
5540 cellWeights[
pp.faceCells()[i]] += numLayers[patchi];
5549 const faceZone& fZone = fZones[zonei];
5554 meshRefiner_.getFaceZoneInfo(fzName, mpi, spi, fzType);
5556 if (numLayers[mpi] > 0)
5565 cellWeights[
cellIDs[i]] += numLayers[mpi];
5569 if (numLayers[spi] > 0)
5576 cellWeights[
cellIDs[i]] += numLayers[mpi];
5585 meshRefiner_.printMeshInfo
5588 "Before layer addition",
5594 const scalar nNewCells =
sum(cellWeights);
5595 const scalar nNewCellsAll =
5600 mag(1.0-nNewCells/nIdealNewCells),
5604 Info<<
"Ideal layer addition" 5605 <<
" : cells:" << nNewCellsAll
5606 <<
" unbalance:" << unbalance
5611 if (preBalance || faceZoneOnCoupledFace)
5614 <<
"Doing initial balancing" <<
nl 5615 <<
"-----------------------" <<
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.
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &f1)
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
static const pointMesh & New(const polyMesh &mesh, Args &&... args)
Get existing or create MeshObject registered with typeName.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Unit conversion functions.
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.
static void reduceOr(bool &value, const label communicator=worldComm)
Logical (or) reduction (MPI_AllReduce)
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()). Can be negative if the process i...
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) ...
T returnReduce(const T &value, const BinaryOp &bop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Perform reduction on a copy, using specified binary operation.
List< labelList > labelListList
List of labelList.
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.
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.
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.
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.
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.
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 additional search methods and registered IO...
OSstream & stream(OSstream *alternative=nullptr)
Return OSstream for output operations.
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.
void mergePatchFacesUndo(const layerParameters &layerParams, const dictionary &motionDict, const meshRefinement::FaceMergeType mergeType)
Merge patch faces on same cell.
Ostream & decrIndent(Ostream &os)
Decrement the indent level.
static autoPtr< indirectPrimitivePatch > makePatch(const polyMesh &, const labelList &)
Create patch from set of patches.
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];} label minLabel=min(start, end);pointMap[start]=pointMap[end]=minLabel;} } 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};const 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< SLList< face > > pFaces[nBCs]
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 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...
bool returnReduceOr(const bool value, const label comm=UPstream::worldComm)
Perform logical (or) MPI Allreduce on a copy. Uses UPstream::reduceOr.
Ostream & incrIndent(Ostream &os)
Increment the indent level.
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)
void reduce(T &value, const BinaryOp &bop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Reduce inplace (cf. MPI Allreduce) using linear/tree communication schedule.
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)