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
1007 List<extrudeMode>& extrudeStatus,
1011 const fvMesh&
mesh = meshRefiner_.mesh();
1013 Info<<
nl <<
"Handling points with inconsistent layer specification ..." 1027 label wantedLayers = patchToNLayers[patchi];
1029 forAll(meshPoints, patchPointi)
1033 maxLayers[ppPointi] =
max(wantedLayers, maxLayers[ppPointi]);
1034 minLayers[ppPointi] =
min(wantedLayers, minLayers[ppPointi]);
1066 <<
" maxLayers:" << maxLayers
1067 <<
" minLayers:" << minLayers
1070 else if (maxLayers[i] == minLayers[i])
1073 patchNLayers[i] = maxLayers[i];
1091 patchNLayers[i] = maxLayers[i];
1106 nCells =
max(nCells, patchNLayers[
f[fp]]);
1109 nAddedCells += nCells;
1111 reduce(nAddedCells, sumOp<label>());
1124 Foam::snappyLayerDriver::makeLayerDisplacementField
1126 const pointMesh& pMesh,
1131 const pointBoundaryMesh& pointPatches = pMesh.boundary();
1135 pointPatches.size(),
1136 slipPointPatchVectorField::typeName
1138 wordList actualPatchTypes(patchFieldTypes.size());
1139 forAll(pointPatches, patchi)
1141 actualPatchTypes[patchi] = pointPatches[patchi].type();
1144 forAll(numLayers, patchi)
1148 if (numLayers[patchi] == 0)
1150 patchFieldTypes[patchi] =
1151 zeroFixedValuePointPatchVectorField::typeName;
1153 else if (numLayers[patchi] > 0)
1155 patchFieldTypes[patchi] = fixedValuePointPatchVectorField::typeName;
1159 forAll(pointPatches, patchi)
1161 if (isA<processorPointPatch>(pointPatches[patchi]))
1163 patchFieldTypes[patchi] = calculatedPointPatchVectorField::typeName;
1165 else if (isA<cyclicPointPatch>(pointPatches[patchi]))
1167 patchFieldTypes[patchi] = cyclicSlipPointPatchVectorField::typeName;
1172 const polyMesh&
mesh = pMesh();
1181 "pointDisplacement",
1195 void Foam::snappyLayerDriver::growNoExtrusion
1200 List<extrudeMode>& extrudeStatus
1203 Info<<
nl <<
"Growing non-extrusion points by one layer ..." <<
endl;
1205 List<extrudeMode> grownExtrudeStatus(extrudeStatus);
1211 forAll(localFaces, facei)
1213 const face&
f = localFaces[facei];
1215 bool hasSqueeze =
false;
1218 if (extrudeStatus[
f[fp]] == NOEXTRUDE)
1232 extrudeStatus[
f[fp]] == EXTRUDE
1233 && grownExtrudeStatus[
f[fp]] != NOEXTRUDE
1236 grownExtrudeStatus[
f[fp]] = NOEXTRUDE;
1243 extrudeStatus.transfer(grownExtrudeStatus);
1252 status[i] = extrudeStatus[i];
1256 meshRefiner_.mesh(),
1264 extrudeStatus[i] = extrudeMode(status[i]);
1269 forAll(extrudeStatus, patchPointi)
1271 if (extrudeStatus[patchPointi] == NOEXTRUDE)
1273 patchDisp[patchPointi] =
Zero;
1274 patchNLayers[patchPointi] = 0;
1278 reduce(nGrown, sumOp<label>());
1280 Info<<
"Set displacement to zero for an additional " << nGrown
1281 <<
" points." <<
endl;
1285 void Foam::snappyLayerDriver::determineSidePatches
1287 const globalIndex& globalFaces,
1303 fvMesh&
mesh = meshRefiner_.mesh();
1312 Map<label> nbrProcToPatch;
1313 Map<label> patchToNbrProc;
1334 Info<<
nl <<
"Adding in total " << nAdded/2 <<
" inter-processor patches to" 1335 <<
" handle extrusion of non-manifold processor boundaries." 1342 Map<label> wantedToAddedPatch;
1344 for (label patchi = nOldPatches; patchi <
nPatches; patchi++)
1346 label nbrProci = patchToNbrProc[patchi];
1353 patchDict.add(
"type", processorPolyPatch::typeName);
1355 patchDict.add(
"neighbProcNo", nbrProci);
1356 patchDict.add(
"nFaces", 0);
1364 label procPatchi = meshRefiner_.appendPatch
1371 wantedToAddedPatch.insert(patchi, procPatchi);
1377 label patchi = edgePatchID[i];
1378 const auto fnd = wantedToAddedPatch.cfind(patchi);
1381 edgePatchID[i] = fnd.val();
1391 void Foam::snappyLayerDriver::calculateLayerThickness
1395 const layerParameters& layerParams,
1398 const scalar edge0Len,
1405 const fvMesh&
mesh = meshRefiner_.mesh();
1419 minThickness = GREAT;
1425 expansionRatio = GREAT;
1427 for (
const label patchi :
patchIDs)
1431 forAll(meshPoints, patchPointi)
1435 firstLayerThickness[ppPointi] =
min 1437 firstLayerThickness[ppPointi],
1438 layerParams.firstLayerThickness()[patchi]
1440 finalLayerThickness[ppPointi] =
min 1442 finalLayerThickness[ppPointi],
1443 layerParams.finalLayerThickness()[patchi]
1445 totalThickness[ppPointi] =
min 1447 totalThickness[ppPointi],
1448 layerParams.thickness()[patchi]
1450 expRatio[ppPointi] =
min 1453 layerParams.expansionRatio()[patchi]
1455 minThickness[ppPointi] =
min 1457 minThickness[ppPointi],
1458 layerParams.minThickness()[patchi]
1467 firstLayerThickness,
1475 finalLayerThickness,
1521 maxPointLevel[
f[fp]] =
max(maxPointLevel[
f[fp]], ownLevel);
1549 for (
const label patchi :
patchIDs)
1553 layerParams.layerModels()[patchi];
1554 const bool relSize = layerParams.relativeSizes()[patchi];
1556 for (
const label meshPointi : meshPoints)
1563 edgeLen[ppPointi] =
min 1566 edge0Len/(1<<maxPointLevel[ppPointi])
1568 spec[ppPointi] =
max(spec[ppPointi], patchSpec);
1569 isRelativePoint[meshPointi] =
1570 isRelativePoint[meshPointi]
1595 orEqOp<unsigned int>(),
1612 finalLayerThickness[pointi] *= edgeLen[pointi];
1613 if (isRelativePoint[meshPointi])
1615 totalThickness[pointi] *= edgeLen[pointi];
1616 minThickness[pointi] *= edgeLen[pointi];
1619 else if (isRelativePoint[meshPointi])
1621 firstLayerThickness[pointi] *= edgeLen[pointi];
1622 finalLayerThickness[pointi] *= edgeLen[pointi];
1623 totalThickness[pointi] *= edgeLen[pointi];
1624 minThickness[pointi] *= edgeLen[pointi];
1627 thickness[pointi] =
min 1633 patchNLayers[pointi],
1634 firstLayerThickness[pointi],
1635 finalLayerThickness[pointi],
1636 totalThickness[pointi],
1640 expansionRatio[pointi] =
min 1642 expansionRatio[pointi],
1643 layerParameters::layerExpansionRatio
1646 patchNLayers[pointi],
1647 firstLayerThickness[pointi],
1648 finalLayerThickness[pointi],
1649 totalThickness[pointi],
1687 label maxPatchNameLen = 0;
1692 maxPatchNameLen =
max(maxPatchNameLen, label(patchName.size()));
1696 <<
setf(ios_base::left) <<
setw(maxPatchNameLen) <<
"patch" 1697 <<
setw(0) <<
" faces layers avg thickness[m]" <<
nl 1698 <<
setf(ios_base::left) <<
setw(maxPatchNameLen) <<
" " 1699 <<
setw(0) <<
" near-wall overall" <<
nl 1700 <<
setf(ios_base::left) <<
setw(maxPatchNameLen) <<
"-----" 1701 <<
setw(0) <<
" ----- ------ --------- -------" <<
endl;
1712 layerParams.layerModels()[patchi];
1714 scalar sumThickness = 0;
1715 scalar sumNearWallThickness = 0;
1716 label nMasterPoints = 0;
1718 forAll(meshPoints, patchPointi)
1720 label meshPointi = meshPoints[patchPointi];
1721 if (isMasterPoint[meshPointi])
1725 sumThickness += thickness[ppPointi];
1726 sumNearWallThickness += layerParams.firstLayerThickness
1729 patchNLayers[ppPointi],
1730 firstLayerThickness[ppPointi],
1731 finalLayerThickness[ppPointi],
1732 thickness[ppPointi],
1733 expansionRatio[ppPointi]
1739 label totNPoints =
returnReduce(nMasterPoints, sumOp<label>());
1742 scalar avgThickness = 0;
1743 scalar avgNearWallThickness = 0;
1750 avgNearWallThickness =
1759 <<
" " <<
setw(6) << layerParams.numLayers()[patchi]
1760 <<
" " <<
setw(8) << avgNearWallThickness
1761 <<
" " <<
setw(8) << avgThickness
1770 void Foam::snappyLayerDriver::syncPatchDisplacement
1776 List<extrudeMode>& extrudeStatus
1779 const fvMesh&
mesh = meshRefiner_.mesh();
1794 minMagSqrEqOp<vector>(),
1801 if (
mag(patchDisp[i]) < minThickness[i])
1819 labelList syncPatchNLayers(patchNLayers);
1832 forAll(syncPatchNLayers, i)
1834 if (syncPatchNLayers[i] != patchNLayers[i])
1863 forAll(syncPatchNLayers, i)
1865 if (syncPatchNLayers[i] != patchNLayers[i])
1901 void Foam::snappyLayerDriver::getPatchDisplacement
1910 List<extrudeMode>& extrudeStatus
1913 Info<<
nl <<
"Determining displacement for added points" 1914 <<
" according to pointNormal ..." <<
endl;
1916 const fvMesh&
mesh = meshRefiner_.mesh();
1931 patchDisp = thickness*pointNormals;
1934 label nNoVisNormal = 0;
1935 label nExtrudeRemove = 0;
2020 forAll(pointNormals, patchPointi)
2024 if (extrudeStatus[patchPointi] == NOEXTRUDE)
2027 patchNLayers[patchPointi] = 0;
2028 patchDisp[patchPointi] =
Zero;
2033 const vector&
n = pointNormals[patchPointi];
2039 Pout<<
"No valid normal for point " << meshPointi
2041 <<
"; setting displacement to " 2042 << patchDisp[patchPointi]
2046 extrudeStatus[patchPointi] = EXTRUDEREMOVE;
2053 forAll(extrudeStatus, patchPointi)
2055 if (extrudeStatus[patchPointi] == EXTRUDEREMOVE)
2064 label edgei = pEdges[i];
2066 label otherPointi =
pp.
edges()[edgei].otherVertex(patchPointi);
2068 if (extrudeStatus[otherPointi] != NOEXTRUDE)
2070 avg += localPoints[otherPointi] + patchDisp[otherPointi];
2079 Pout<<
"Displacement at illegal point " 2080 << localPoints[patchPointi]
2082 << (avg /
nPoints - localPoints[patchPointi])
2086 patchDisp[patchPointi] =
2088 - localPoints[patchPointi];
2101 <<
" points with point normal pointing through faces." <<
nl 2102 <<
"Reset displacement at " 2104 <<
" points to average of surrounding points." <<
endl;
2107 syncPatchDisplacement
2120 bool Foam::snappyLayerDriver::sameEdgeNeighbour
2123 const label myGlobalFacei,
2124 const label nbrGlobFacei,
2128 const labelList& eFaces = globalEdgeFaces[edgei];
2129 if (eFaces.size() == 2)
2131 return edge(myGlobalFacei, nbrGlobFacei) == edge(eFaces[0], eFaces[1]);
2138 void Foam::snappyLayerDriver::getVertexString
2144 const label myGlobFacei,
2145 const label nbrGlobFacei,
2150 label fp = fEdges.
find(edgei);
2163 label prevFp = fEdges.rcIndex(startFp);
2183 label nextFp = fEdges.fcIndex(endFp);
2217 Foam::label Foam::snappyLayerDriver::truncateDisplacement
2219 const globalIndex& globalFaces,
2223 const faceSet& illegalPatchFaces,
2226 List<extrudeMode>& extrudeStatus
2229 const fvMesh&
mesh = meshRefiner_.mesh();
2235 for (
const label facei : illegalPatchFaces)
2240 <<
"Faceset " << illegalPatchFaces.name()
2241 <<
" contains internal face " << facei <<
nl 2250 const auto fnd = meshPointMap.cfind(
f[fp]);
2253 const label patchPointi = fnd.val();
2255 if (extrudeStatus[patchPointi] != NOEXTRUDE)
2270 forAll(patchDisp, patchPointi)
2272 if (
mag(patchDisp[patchPointi]) < minThickness[patchPointi])
2288 else if (extrudeStatus[patchPointi] == NOEXTRUDE)
2291 patchDisp[patchPointi] =
Zero;
2292 patchNLayers[patchPointi] = 0;
2301 syncPatchDisplacement
2322 const face& localF = localFaces[i];
2327 extrudeMode prevMode = extrudeStatus[localF.prevLabel(0)];
2331 extrudeMode fpMode = extrudeStatus[localF[fp]];
2333 if (prevMode == NOEXTRUDE && fpMode != NOEXTRUDE)
2360 reduce(nPinched, sumOp<label>());
2362 Info<<
"truncateDisplacement : Unextruded " << nPinched
2363 <<
" faces due to non-consecutive vertices being extruded." <<
endl;
2386 label nButterFly = 0;
2388 DynamicList<label> stringedVerts;
2391 const labelList& globFaces = edgeGlobalFaces[edgei];
2393 if (globFaces.size() == 2)
2396 label myGlobalFacei = globalFaces.toGlobal
2398 pp.addressing()[myFacei]
2400 label nbrGlobalFacei =
2402 globFaces[0] != myGlobalFacei
2419 extrudeStatus[stringedVerts[0]] != NOEXTRUDE
2420 || extrudeStatus[stringedVerts.last()] != NOEXTRUDE
2425 for (label i = 1; i < stringedVerts.size()-1; i++)
2427 if (extrudeStatus[stringedVerts[i]] == NOEXTRUDE)
2458 reduce(nButterFly, sumOp<label>());
2460 Info<<
"truncateDisplacement : Unextruded " << nButterFly
2461 <<
" faces due to stringed edges with inconsistent extrusion." 2472 label nDiffering = 0;
2516 if (nPinched+nButterFly+nDiffering == 0)
2528 void Foam::snappyLayerDriver::setupLayerInfoTruncation
2532 const List<extrudeMode>& extrudeStatus,
2533 const label nBufferCellsNoExtrude,
2538 Info<<
nl <<
"Setting up information for layer truncation ..." <<
endl;
2540 const fvMesh&
mesh = meshRefiner_.mesh();
2542 if (nBufferCellsNoExtrude < 0)
2544 Info<<
nl <<
"Performing no layer truncation." 2545 <<
" nBufferCellsNoExtrude set to less than 0 ..." <<
endl;
2554 const label nPointLayers = patchNLayers[
f[fp]];
2555 if (nPointLayers > 0)
2557 if (nPatchFaceLayers[patchFacei] == -1)
2559 nPatchFaceLayers[patchFacei] = nPointLayers;
2563 nPatchFaceLayers[patchFacei] =
min 2565 nPatchFaceLayers[patchFacei],
2572 nPatchPointLayers = patchNLayers;
2575 forAll(nPatchFaceLayers, patchFacei)
2577 if (nPatchFaceLayers[patchFacei] == -1)
2579 nPatchFaceLayers[patchFacei] = 0;
2595 bool noExtrude =
false;
2600 if (extrudeStatus[
f[fp]] == NOEXTRUDE)
2604 mLevel =
max(mLevel, patchNLayers[
f[fp]]);
2614 nPatchFaceLayers[patchFacei] = 1;
2615 maxLevel[patchFacei] = mLevel;
2619 maxLevel[patchFacei] = mLevel;
2631 label nLevels =
gMax(patchNLayers);
2634 for (label ilevel = 1; ilevel < nLevels; ilevel++)
2640 nBuffer = nBufferCellsNoExtrude - 1;
2644 nBuffer = nBufferCellsNoExtrude;
2647 for (label ibuffer = 0; ibuffer < nBuffer + 1; ibuffer++)
2649 labelList tempCounter(nPatchFaceLayers);
2655 forAll(pointFaces[patchPointi], pointFacei)
2657 label facei = pointFaces[patchPointi][pointFacei];
2661 nPatchFaceLayers[facei] != -1
2662 && maxLevel[facei] > 0
2665 foundNeighbour[patchPointi] =
true;
2682 if (foundNeighbour[patchPointi])
2684 forAll(pointFaces[patchPointi], pointFacei)
2686 label facei = pointFaces[patchPointi][pointFacei];
2689 nPatchFaceLayers[facei] == -1
2690 && maxLevel[facei] > 0
2691 && ilevel < maxLevel[facei]
2694 tempCounter[facei] = ilevel;
2699 nPatchFaceLayers = tempCounter;
2705 if (nPatchFaceLayers[patchFacei] == -1)
2707 nPatchFaceLayers[patchFacei] = maxLevel[patchFacei];
2713 if (extrudeStatus[patchPointi] != NOEXTRUDE)
2715 forAll(pointFaces[patchPointi], pointFacei)
2717 label face = pointFaces[patchPointi][pointFacei];
2718 nPatchPointLayers[patchPointi] =
max 2720 nPatchPointLayers[patchPointi],
2721 nPatchFaceLayers[face]
2727 nPatchPointLayers[patchPointi] = 0;
2743 bool Foam::snappyLayerDriver::cellsUseFace
2745 const polyMesh&
mesh,
2752 const cell& cFaces =
mesh.
cells()[cellLabels[i]];
2756 if (faces.found(cFaces[cFacei]))
2770 Foam::label Foam::snappyLayerDriver::checkAndUnmark
2772 const addPatchCellLayer& addLayer,
2773 const dictionary& meshQualityDict,
2774 const bool additionalReporting,
2775 const List<labelPair>& baffles,
2777 const fvMesh& newMesh,
2781 List<extrudeMode>& extrudeStatus
2785 Info<<
nl <<
"Checking mesh with layer ..." <<
endl;
2786 faceSet wrongFaces(newMesh,
"wrongFaces", newMesh.nFaces()/1000);
2799 <<
" (concave, zero area or negative cell pyramid volume)" 2813 addLayer.layerFaces()
2821 const label nReportMax = 10;
2822 DynamicField<point> disabledFaceCentres(nReportMax);
2824 forAll(addedCells, oldPatchFacei)
2828 const labelList& fCells = addedCells[oldPatchFacei];
2830 if (cellsUseFace(newMesh, fCells, wrongFaces))
2844 if (additionalReporting && (nChanged < nReportMax))
2846 disabledFaceCentres.
append 2858 label nChangedTotal =
returnReduce(nChanged, sumOp<label>());
2860 if (additionalReporting)
2869 label nReportLocal = nChanged;
2870 if (nChangedTotal > nReportMax)
2885 Pout<<
"Checked mesh with layers. Disabled extrusion at " <<
endl;
2886 for (label i=0; i < nReportLocal; i++)
2888 Pout<<
" " << disabledFaceCentres[i] <<
endl;
2892 label nReportTotal =
returnReduce(nReportLocal, sumOp<label>());
2894 if (nReportTotal < nChangedTotal)
2896 Info<<
"Suppressed disabled extrusion message for other " 2897 << nChangedTotal - nReportTotal <<
" faces." <<
endl;
2901 return nChangedTotal;
2906 Foam::label Foam::snappyLayerDriver::countExtrusion
2909 const List<extrudeMode>& extrudeStatus
2913 label nExtruded = 0;
2919 const face& localFace = localFaces[i];
2923 if (extrudeStatus[localFace[fp]] != NOEXTRUDE)
2938 const polyMesh&
mesh,
2940 const List<labelPair>& baffles
2949 Map<label> baffleSet(4*baffles.size());
2952 baffleSet.insert(baffles[bafflei][0], bafflei);
2953 baffleSet.insert(baffles[bafflei][1], bafflei);
2957 List<labelPair> newBaffles(baffles.size(),
labelPair(-1, -1));
2965 label oldFacei = newToOldFaces[facei];
2967 const auto faceFnd = baffleSet.find(oldFacei);
2970 label bafflei = faceFnd();
2976 else if (
p[1] == -1)
2983 <<
"Problem:" << facei <<
" at:" 2985 <<
" is on same baffle as " <<
p[0]
2998 void Foam::snappyLayerDriver::getLayerCellsFaces
3000 const polyMesh&
mesh,
3001 const addPatchCellLayer& addLayer,
3011 faceRealThickness = 0;
3019 forAll(addedCells, oldPatchFacei)
3021 const labelList& added = addedCells[oldPatchFacei];
3023 const labelList& layer = layerFaces[oldPatchFacei];
3030 cellNLayers[added[i]] = layer.size()-1;
3035 forAll(layerFaces, oldPatchFacei)
3037 const labelList& layer = layerFaces[oldPatchFacei];
3038 const scalar realThickness = oldRealThickness[oldPatchFacei];
3044 for (label i = 1; i < layer.size(); i++)
3046 faceRealThickness[layer[i]] = realThickness;
3053 void Foam::snappyLayerDriver::printLayerData
3060 const layerParameters& layerParams
3068 label maxPatchNameLen = 0;
3072 word patchName =
pbm[patchi].
name();
3073 maxPatchNameLen =
max(maxPatchNameLen, label(patchName.size()));
3077 meshRefiner_.printMeshInfo(
false,
"Mesh with layers",
false);
3080 <<
setf(ios_base::left) <<
setw(maxPatchNameLen) <<
"patch" 3081 <<
setw(0) <<
" faces layers overall thickness" <<
nl 3082 <<
setf(ios_base::left) <<
setw(maxPatchNameLen) <<
" " 3083 <<
setw(0) <<
" target mesh [m] [%]" <<
nl 3084 <<
setf(ios_base::left) <<
setw(maxPatchNameLen) <<
"-----" 3085 <<
setw(0) <<
" ----- ----- ---- --- ---" <<
endl;
3091 const polyPatch&
pp =
pbm[patchi];
3093 label sumSize =
pp.size();
3097 label sumNLayers = 0;
3100 sumNLayers += cellNLayers[faceCells[i]];
3113 scalar sumRealThickness =
sum(patchReal);
3114 scalar sumFraction = 0;
3117 if (patchWanted[i] > VSMALL)
3119 sumFraction += (patchReal[i]/patchWanted[i]);
3124 reduce(sumSize, sumOp<label>());
3125 reduce(sumNLayers, sumOp<label>());
3126 reduce(sumRealThickness, sumOp<scalar>());
3127 reduce(sumFraction, sumOp<scalar>());
3130 scalar avgLayers = 0;
3132 scalar avgFraction = 0;
3135 avgLayers = scalar(sumNLayers)/sumSize;
3136 avgReal = sumRealThickness/sumSize;
3137 avgFraction = sumFraction/sumSize;
3142 <<
" " <<
setw(8) << sumSize
3143 <<
" " <<
setw(8) << layerParams.numLayers()[patchi]
3144 <<
" " <<
setw(8) << avgLayers
3145 <<
" " <<
setw(8) << avgReal
3146 <<
" " <<
setw(8) << 100*avgFraction
3153 bool Foam::snappyLayerDriver::writeLayerSets
3163 forAll(cellNLayers, celli)
3165 if (cellNLayers[celli] > 0)
3170 cellSet addedCellSet(
mesh,
"addedCells", nAdded);
3171 forAll(cellNLayers, celli)
3173 if (cellNLayers[celli] > 0)
3175 addedCellSet.insert(celli);
3178 addedCellSet.instance() = meshRefiner_.timeName();
3181 <<
" added cells to cellSet " 3182 << addedCellSet.name() <<
endl;
3183 bool ok = addedCellSet.
write();
3184 allOk = allOk && ok;
3190 if (faceRealThickness[facei] > 0)
3196 faceSet layerFacesSet(
mesh,
"layerFaces", nAdded);
3199 if (faceRealThickness[facei] > 0)
3201 layerFacesSet.insert(facei);
3204 layerFacesSet.instance() = meshRefiner_.timeName();
3207 <<
" faces inside added layer to faceSet " 3208 << layerFacesSet.name() <<
endl;
3209 bool ok = layerFacesSet.
write();
3210 allOk = allOk && ok;
3216 bool Foam::snappyLayerDriver::writeLayerData
3229 bool ok = writeLayerSets(
mesh, cellNLayers, faceRealThickness);
3230 allOk = allOk && ok;
3251 fixedValueFvPatchScalarField::typeName
3255 fld[celli] = cellNLayers[celli];
3263 const polyPatch&
pp =
pbm[patchi];
3268 pfld[i] = cellNLayers[faceCells[i]];
3270 fldBf[patchi] == pfld;
3274 bool ok =
fld.write();
3275 allOk = allOk && ok;
3291 fixedValueFvPatchScalarField::typeName
3298 fldBf[patchi] ==
pbm[patchi].patchSlice(faceRealThickness);
3302 bool ok =
fld.write();
3303 allOk = allOk && ok;
3310 "thicknessFraction",
3319 fixedValueFvPatchScalarField::typeName
3340 if (patchWanted[i] > VSMALL)
3342 pfld[i] = patchReal[i]/patchWanted[i];
3346 fldBf[patchi] == pfld;
3349 <<
" : overall layer thickness (fraction" 3350 <<
" of desired thickness)" <<
endl;
3351 bool ok =
fld.write();
3352 allOk = allOk && ok;
3361 void Foam::snappyLayerDriver::dupFaceZonePoints
3365 List<labelPair> baffles,
3370 fvMesh&
mesh = meshRefiner_.mesh();
3379 autoPtr<indirectPrimitivePatch>
pp 3393 label nIdealTotAddedCells = 0;
3394 List<extrudeMode> extrudeStatus(
pp().
nPoints(), EXTRUDE);
3409 syncPatchDisplacement
3423 forAll(extrudeStatus, patchPointi)
3426 minPatchState[pointi] = extrudeStatus[patchPointi];
3444 forAll(minPatchState, pointi)
3446 label state = minPatchState[pointi];
3447 if (state == EXTRUDE || state == EXTRUDEREMOVE)
3452 candidatePoints.setSize(
n);
3454 forAll(minPatchState, pointi)
3456 label state = minPatchState[pointi];
3457 if (state == EXTRUDE || state == EXTRUDEREMOVE)
3459 candidatePoints[
n++] = pointi;
3477 bool hasInfo = meshRefiner_.getFaceZoneInfo
3484 if (hasInfo && !layerIDs.found(mpi) && !layerIDs.found(spi))
3486 nonDupZones.append(zonei);
3498 const localPointRegion regionSide(
mesh, nonDupBaffles, candidatePoints);
3500 autoPtr<mapPolyMesh> map = meshRefiner_.dupNonManifoldPoints
3510 const labelList& pointMap = map().pointMap();
3511 const labelList& reversePointMap = map().reversePointMap();
3515 label oldPointi = pointMap[pointi];
3516 label newMasterPointi = reversePointMap[oldPointi];
3518 if (newMasterPointi != pointi)
3521 pointToMaster[pointi] = newMasterPointi;
3522 pointToMaster[newMasterPointi] = newMasterPointi;
3528 const labelList& reverseFaceMap = map().reverseFaceMap();
3531 label f0 = reverseFaceMap[baffles[i].first()];
3532 label f1 = reverseFaceMap[baffles[i].second()];
3541 Info<<
"Writing point-duplicate mesh to time " 3542 << meshRefiner_.timeName() <<
endl;
3558 /
"duplicatePoints_" 3559 + meshRefiner_.timeName()
3562 Info<<
"Writing point-duplicates to " << str.name() <<
endl;
3566 label newMasteri = reversePointMap[pointMap[pointi]];
3568 if (newMasteri != pointi)
3570 str.writeLine(
p[pointi],
p[newMasteri]);
3578 void Foam::snappyLayerDriver::mergeFaceZonePoints
3589 fvMesh&
mesh = meshRefiner_.mesh();
3592 label nPointPairs = 0;
3593 forAll(pointToMaster, pointi)
3595 label otherPointi = pointToMaster[pointi];
3596 if (otherPointi != -1)
3601 reduce(nPointPairs, sumOp<label>());
3602 if (nPointPairs > 0)
3605 Info<<
"Merging " << nPointPairs <<
" duplicated points ..." <<
endl;
3613 + meshRefiner_.timeName()
3616 Info<<
"Points to be merged to " << str.name() <<
endl;
3617 forAll(pointToMaster, pointi)
3619 label otherPointi = pointToMaster[pointi];
3620 if (otherPointi != -1)
3624 str.writeLine(pt, otherPt);
3630 autoPtr<mapPolyMesh> map = meshRefiner_.mergePoints(pointToMaster);
3635 const labelList& reverseFaceMap = map().reverseFaceMap();
3639 Info<<
"Merged points in = " 3647 Info<<
"Converting baffles back into zoned faces ..." 3650 autoPtr<mapPolyMesh> map = meshRefiner_.mergeZoneBaffles
3665 forAll(newFaceRealThickness, facei)
3667 label oldFacei =
faceMap[facei];
3670 scalar& realThick = newFaceRealThickness[facei];
3671 realThick =
max(realThick, faceRealThickness[oldFacei]);
3672 scalar& wanted = newFaceWantedThickness[facei];
3673 wanted =
max(wanted, faceWantedThickness[oldFacei]);
3676 faceRealThickness.transfer(newFaceRealThickness);
3677 faceWantedThickness.transfer(newFaceWantedThickness);
3680 Info<<
"Converted baffles in = " 3681 << meshRefiner_.mesh().time().cpuTimeIncrement()
3687 Foam::label Foam::snappyLayerDriver::setPointNumLayers
3689 const layerParameters& layerParams,
3698 List<extrudeMode>& extrudeStatus
3701 fvMesh&
mesh = meshRefiner_.mesh();
3704 patchDisp =
vector(GREAT, GREAT, GREAT);
3709 patchNLayers =
Zero;
3712 label nIdealTotAddedCells = 0;
3716 extrudeStatus = EXTRUDE;
3740 handleNonStringConnected
3770 layerParams.featureAngle(),
3781 if (!layerParams.relativeSizes().found(
false))
3784 const scalar edge0Len =
3785 meshRefiner_.meshCutter().level0EdgeLength();
3786 const labelList& cellLevel = meshRefiner_.meshCutter().cellLevel();
3791 layerParams.maxFaceThicknessRatio(),
3792 layerParams.relativeSizes(),
3817 for (label i = 0; i < layerParams.nGrow(); i++)
3827 return nIdealTotAddedCells;
3832 Foam::snappyLayerDriver::makeMeshMover
3834 const layerParameters& layerParams,
3835 const dictionary& motionDict,
3843 fvMesh&
mesh = meshRefiner_.mesh();
3849 combinedDict.merge(motionDict);
3851 combinedDict.add(
"minThicknessName", minThickness.name());
3853 const List<labelPair> internalBaffles
3865 autoPtr<Foam::externalDisplacementMeshMover> medialAxisMoverPtr
3869 layerParams.meshShrinker(),
3882 if (errorMsg.size() || IOerrorMsg.size())
3891 <<
"Missing/incorrect required dictionary entries:" 3893 << IOerrorMsg.c_str() <<
nl 3894 << errorMsg.c_str() <<
nl <<
nl 3895 <<
"Exiting dry-run" <<
nl <<
endl;
3899 Perr<<
"\nFOAM parallel run exiting\n" <<
endl;
3909 return medialAxisMoverPtr;
3916 const label nLayerIter,
3920 const label nRelaxedIter,
3921 const label nAllowableErrors,
3927 const label nIdealTotAddedCells,
3968 makeLayerDisplacementField
3992 for (label iteration = 0; iteration < nLayerIter; iteration++)
3995 <<
"Layer addition iteration " << iteration <<
nl 3996 <<
"--------------------------" <<
endl;
4002 iteration < nRelaxedIter
4004 : motionDict.
subDict(
"relaxed")
4007 if (iteration >= nRelaxedIter)
4009 Info<<
"Switched to relaxed meshQuality constraints." <<
endl;
4018 syncPatchDisplacement
4028 getPatchDisplacement
4049 patchDisp = -patchDisp;
4068 combinedDict.
merge(motionDict);
4070 combinedDict.merge(meshQualityDict);
4072 combinedDict.add(
"minThicknessName", minThickness.
name());
4075 medialAxisMoverPtr().move
4095 truncateDisplacement
4120 Info<<
"Writing shrunk mesh to time " 4121 << meshRefiner_.timeName() <<
endl;
4151 setupLayerInfoTruncation
4165 forAll(nPatchPointLayers, i)
4169 nPatchPointLayers[i],
4172 finalDisp[i] = ratio*patchDisp[i];
4176 const scalarField invExpansionRatio(1.0/expansionRatio);
4211 savedMeshMod = meshMod;
4233 fvMesh& newMesh = *newMeshPtr;
4237 addProfiling(grow,
"snappyHexMesh::layers::updateMesh");
4270 avgPointData(
pp,
mag(patchDisp))(),
4278 label nAddedCells = 0;
4279 forAll(cellNLayers, celli)
4281 if (cellNLayers[celli] > 0)
4290 Info<<
"Writing layer mesh to time " << meshRefiner_.timeName()
4293 writeLayerSets(newMesh, cellNLayers, faceRealThickness);
4312 facei < newMesh.
nFaces();
4316 label newMeshFacei = map.
faceMap()[facei];
4317 if (newMeshFacei != -1)
4319 meshToNewMesh[newMeshFacei] = facei;
4330 meshToNewMesh[
p[0]],
4333 if (newMeshBaffle[0] != -1 && newMeshBaffle[1] != -1)
4335 newMeshBaffles[newi++] = newMeshBaffle;
4349 <<
" baffles across faceZones of type internal" <<
nl 4353 label nTotChanged = checkAndUnmark
4367 label nTotExtruded = countExtrusion(
pp, extrudeStatus);
4371 Info<<
"Extruding " << nTotExtruded
4372 <<
" out of " << nTotFaces
4373 <<
" faces (" << 100.0*nTotExtruded/nTotFaces <<
"%)." 4374 <<
" Removed extrusion at " << nTotChanged <<
" faces." 4376 <<
"Added " << nTotAddedCells <<
" out of " 4377 << nIdealTotAddedCells
4378 <<
" cells (" << 100.0*nTotAddedCells/nIdealTotAddedCells
4381 if (nTotChanged == 0)
4389 medialAxisMoverPtr().movePoints(
mesh.
points());
4395 for (label i = 0; i < layerParams.
nGrow(); i++)
4411 void Foam::snappyLayerDriver::mapFaceZonePoints
4413 const mapPolyMesh& map,
4418 fvMesh&
mesh = meshRefiner_.mesh();
4426 DynamicList<label> candidates(baffles.size()*4);
4435 Map<label> oldFaceToBaffle(2*baffles.size());
4439 oldFaceToBaffle.insert(baffle[0], i);
4440 oldFaceToBaffle.insert(baffle[1], i);
4452 const label oldFacei = map.faceMap()[facei];
4453 const auto iter = oldFaceToBaffle.find(oldFacei);
4454 if (oldFacei != -1 && iter.good())
4456 const label bafflei = iter();
4457 auto& newBaffle = newBaffles[bafflei];
4458 if (newBaffle[0] == -1)
4460 newBaffle[0] = facei;
4462 else if (newBaffle[1] == -1)
4464 newBaffle[1] = facei;
4470 <<
" already maps to baffle faces:" 4473 <<
" and " << newBaffle[1]
4481 label pointi =
f[fp];
4482 label oldPointi = map.pointMap()[pointi];
4484 if (pointToMaster[oldPointi] != -1)
4486 candidates.
append(pointi);
4498 const labelPair& newBaffle = newBaffles[i];
4499 if (newBaffle[0] != -1 && newBaffle[1] != -1)
4501 newBaffles[
n++] = newBaffle;
4506 baffles.transfer(newBaffles);
4519 UIndirectList<point>(
mesh.
points(), candidates),
4520 meshRefiner_.mergeDistance(),
4536 const labelList& oldPoints = newToOld[newi];
4537 if (oldPoints.size() > 1)
4543 label masteri =
min(meshPoints);
4546 pointToMaster[meshPoints[i]] = masteri;
4554 void Foam::snappyLayerDriver::updatePatch
4557 const mapPolyMesh& map,
4558 autoPtr<indirectPrimitivePatch>&
pp,
4564 fvMesh&
mesh = meshRefiner_.mesh();
4566 autoPtr<indirectPrimitivePatch> newPp
4576 newToOldPatchPoints.setSize(newPp().
nPoints());
4577 newToOldPatchPoints = -1;
4580 const labelList& newMeshPoints = newPp().meshPoints();
4584 const label newMeshPointi = newMeshPoints[
newPointi];
4585 const label oldMeshPointi =
4586 map.pointMap()[newMeshPointi];
4587 const auto iter = baseMap.find(oldMeshPointi);
4590 newToOldPatchPoints[
newPointi] = iter();
4599 pp = std::move(newPp);
4609 Foam::snappyLayerDriver::snappyLayerDriver
4617 meshRefiner_(meshRefiner),
4618 globalToMasterPatch_(globalToMasterPatch),
4619 globalToSlavePatch_(globalToSlavePatch),
4641 <<
"Merging all faces of a cell" <<
nl 4642 <<
"---------------------------" <<
nl 4643 <<
" - which are on the same patch" <<
nl 4644 <<
" - which make an angle < " << planarAngle
4646 <<
" (cos:" << minCos <<
')' <<
nl 4647 <<
" - as long as the resulting face doesn't become concave" 4650 <<
" (0=straight, 180=fully concave)" <<
nl 4661 duplicateFace[cpl[0]] = cpl[1];
4662 duplicateFace[cpl[1]] = cpl[0];
4665 label nChanged = meshRefiner_.mergePatchFacesUndo
4669 meshRefiner_.meshedPatches(),
4675 nChanged += meshRefiner_.mergeEdgesUndo(minCos, motionDict);
4684 const label nAllowableErrors,
4692 const scalar edge0Len = meshRefiner_.meshCutter().level0EdgeLength();
4700 internalOrBaffleFaceZones = meshRefiner_.getZones(fzTypes);
4707 meshRefiner_.getZones
4722 meshRefiner_.createZoneBaffles
4732 Info<<
"Writing baffled mesh to time " 4733 << meshRefiner_.timeName() <<
endl;
4757 label f0 = reverseFaceMap[baffles[i].first()];
4758 label f1 = reverseFaceMap[baffles[i].second()];
4777 bool hasInfo = meshRefiner_.getFaceZoneInfo
4787 if (layerIDs.
found(mpi) && !layerIDs.
found(spi))
4791 <<
" adding layers to master patch " <<
pbm[mpi].
name()
4792 <<
" only. Freezing points on slave patch " 4796 else if (!layerIDs.
found(mpi) && layerIDs.
found(spi))
4800 <<
" adding layers to slave patch " <<
pbm[spi].
name()
4801 <<
" only. Freezing points on master patch " 4876 const label nIdealTotAddedCells = setPointNumLayers
4898 meshRefiner_.timeName(),
4906 calculateLayerThickness
4911 meshRefiner_.meshCutter().cellLevel(),
4929 avgPointData(
pp(), baseThickness);
4937 (basePatchNLayers+layerParams.
nOuterIter()-1)
4945 for (label layeri = 0; layeri < layerParams.
nOuterIter(); layeri++)
4957 const label nToAdd =
gSum(deltaNLayers);
4959 <<
"Outer iteration : " << layeri <<
nl 4960 <<
"-------------------" <<
endl;
4963 Info<<
" Layers to add in current iteration : " << nToAdd <<
endl;
4978 determineSidePatches
5015 forAll(baseThickness, pointi)
5019 basePatchNLayers[pointi],
5020 baseThickness[pointi],
5021 baseExpansionRatio[pointi],
5022 basePatchNLayers[pointi]
5023 -nAddedLayers[pointi]
5024 -patchNLayers[pointi],
5025 patchNLayers[pointi]
5053 nIdealTotAddedCells,
5079 sliceFaceRealThickness
5084 const label nTotalAdded =
gSum(patchNLayers);
5087 Info<<
nl <<
" Added in current iteration : " << nTotalAdded
5088 <<
" out of : " <<
gSum(deltaNLayers) <<
endl;
5090 if (nTotalAdded == 0)
5097 forAll(patchNLayers, pointi)
5099 nAddedLayers[pointi] += patchNLayers[pointi];
5101 if (patchNLayers[pointi] == 0)
5112 basePatchNLayers[pointi] = nAddedLayers[pointi];
5113 deltaNLayers[pointi] = 0;
5121 deltaNLayers[pointi] =
max 5126 deltaNLayers[pointi],
5127 basePatchNLayers[pointi] - nAddedLayers[pointi]
5164 meshRefiner_.updateMesh(map,
labelList(0));
5167 cellNLayers.setSize(map.
nOldCells(), 0);
5176 cellNLayers[i] += sliceCellNLayers[i];
5179 faceRealThickness.setSize(map.
nOldFaces(), scalar(0));
5186 faceRealThickness += sliceFaceRealThickness;
5202 faceWantedThickness,
5212 Info<<
"Writing mesh with layers but disconnected to time " 5213 << meshRefiner_.timeName() <<
endl;
5228 mapFaceZonePoints(map, baffles, pointToMaster);
5232 updatePatch(
patchIDs, map,
pp, newToOldPatchPoints);
5248 newToOldPatchPoints,
5249 vector::uniform(-1),
5254 newToOldPatchPoints,
5260 newToOldPatchPoints,
5261 extrudeMode::NOEXTRUDE,
5266 newToOldPatchPoints,
5272 newToOldPatchPoints,
5278 newToOldPatchPoints,
5284 newToOldPatchPoints,
5290 newToOldPatchPoints,
5314 <<
"Doing final balancing" <<
nl 5315 <<
"---------------------" <<
nl 5334 map().distributeCellData(cellNLayers);
5335 map().distributeFaceData(faceWantedThickness);
5336 map().distributeFaceData(faceRealThickness);
5350 faceWantedThickness,
5363 const bool preBalance,
5372 <<
"Shrinking and layer addition phase" <<
nl 5373 <<
"----------------------------------" <<
nl 5377 Info<<
"Using mesh parameters " << motionDict <<
nl <<
endl;
5382 mergeType == meshRefinement::FaceMergeType::GEOMETRIC
5383 || mergeType == meshRefinement::FaceMergeType::IGNOREPATCH
5386 mergePatchFacesUndo(layerParams, motionDict, mergeType);
5395 label nFacesWithLayers = 0;
5396 forAll(numLayers, patchi)
5398 if (numLayers[patchi] > 0)
5410 <<
"Ignoring layers on coupled patch " <<
pp.name()
5422 meshRefiner_.getFaceZoneInfo(fZones[zonei].
name(), mpi, spi, fzType);
5424 if (numLayers[mpi] > 0)
5426 nFacesWithLayers += fZones[zonei].
size();
5428 if (numLayers[spi] > 0)
5430 nFacesWithLayers += fZones[zonei].
size();
5439 Info<<
nl <<
"No layers to generate ..." <<
endl;
5444 checkMeshManifold();
5447 Info<<
"Checking initial mesh ..." <<
endl;
5456 Info<<
"Detected " << nInitErrors <<
" illegal faces" 5457 <<
" (concave, zero area or negative cell pyramid volume)" 5461 bool faceZoneOnCoupledFace =
false;
5475 const faceZone& fZone = fZones[zonei];
5480 meshRefiner_.getFaceZoneInfo(fzName, mpi, spi, fzType);
5482 if (numLayers[mpi] > 0 || numLayers[spi])
5484 isExtrudedZoneFace.set(fZone);
5501 if (intOrCoupled[facei] && isExtrudedZoneFace.
test(facei))
5503 faceZoneOnCoupledFace =
true;
5518 forAll(numLayers, patchi)
5520 if (numLayers[patchi] > 0)
5525 cellWeights[
pp.faceCells()[i]] += numLayers[patchi];
5534 const faceZone& fZone = fZones[zonei];
5539 meshRefiner_.getFaceZoneInfo(fzName, mpi, spi, fzType);
5541 if (numLayers[mpi] > 0)
5550 cellWeights[
cellIDs[i]] += numLayers[mpi];
5554 if (numLayers[spi] > 0)
5561 cellWeights[
cellIDs[i]] += numLayers[mpi];
5570 meshRefiner_.printMeshInfo
5573 "Before layer addition",
5579 const scalar nNewCells =
sum(cellWeights);
5580 const scalar nNewCellsAll =
5585 mag(1.0-nNewCells/nIdealNewCells),
5589 Info<<
"Ideal layer addition" 5590 <<
" : cells:" << nNewCellsAll
5591 <<
" unbalance:" << unbalance
5596 if (preBalance || faceZoneOnCoupledFace)
5599 <<
"Doing initial balancing" <<
nl 5600 <<
"-----------------------" <<
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)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
const Field< point_type > & localPoints() const
Return pointField of points in patch.
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()
const word & name() const noexcept
Return the object name.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
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.
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
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)
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.
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.
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.
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 of polyPatch. Can optionally create stand-alone extruded mesh (addToM...
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.
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.
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.
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().
bool hasMotionPoints() const noexcept
Has valid preMotionPoints?
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.
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.
static labelListList globalEdgeFaces(const polyMesh &, const globalIndex &globalFaces, const indirectPrimitivePatch &pp)
Per patch edge the pp faces (in global indices) using it.
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.
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.
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.
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)