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.write(
linePointRef(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.write(
linePointRef(pt, pt + patchDisp[patchPointi]));
119 forAll(pp.localFaces(), facei)
121 const face&
f = pp.localFaces()[facei];
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;
176 pointSet nonManifoldPoints
188 IndirectList<face>(
mesh.
faces(), outsideFaces),
198 Info<<
"Outside of mesh is multiply connected across edges or"
200 <<
"This is not a fatal error but might cause some unexpected"
201 <<
" behaviour." <<
nl
216 bool Foam::snappyLayerDriver::unmarkExtrusion
218 const label patchPointi,
221 List<extrudeMode>& extrudeStatus
224 if (extrudeStatus[patchPointi] == EXTRUDE)
226 extrudeStatus[patchPointi] = NOEXTRUDE;
227 patchNLayers[patchPointi] = 0;
228 patchDisp[patchPointi] =
Zero;
231 else if (extrudeStatus[patchPointi] == EXTRUDEREMOVE)
233 extrudeStatus[patchPointi] = NOEXTRUDE;
234 patchNLayers[patchPointi] = 0;
235 patchDisp[patchPointi] =
Zero;
244 bool Foam::snappyLayerDriver::unmarkExtrusion
246 const face& localFace,
249 List<extrudeMode>& extrudeStatus
252 bool unextruded =
false;
291 void Foam::snappyLayerDriver::countCommonPoints
296 Map<label>& nCommonPoints
299 const faceList& localFaces = pp.localFaces();
302 const face&
f = localFaces[facei];
304 nCommonPoints.
clear();
318 ++(nCommonPoints(nbFacei, 0));
325 bool Foam::snappyLayerDriver::checkCommonOrder
335 const label nb = nbFace.find(curFace[fp]);
349 label fpPlus1 = curFace.fcIndex(fp);
350 label fpMin1 = curFace.rcIndex(fp);
353 label nbPlus1 = nbFace.fcIndex(nb);
354 label nbMin1 = nbFace.rcIndex(nb);
361 if (nbFace[nbPlus1] == curFace[fpPlus1])
366 else if (nbFace[nbPlus1] == curFace[fpMin1])
371 else if (nbFace[nbMin1] == curFace[fpMin1])
389 curFp = constrainFp(curFace.size(), curFp+curInc);
390 curNb = constrainFp(nbFace.size(), curNb+nbInc);
391 }
while (curFace[curFp] == nbFace[curNb]);
399 for (
label commonI = 0; commonI < nCommon; commonI++)
401 curFp = constrainFp(curFace.size(), curFp+curInc);
402 curNb = constrainFp(nbFace.size(), curNb+nbInc);
404 if (curFace[curFp] != nbFace[curNb])
420 void Foam::snappyLayerDriver::checkCommonOrder
424 const Map<label>& nCommonPoints,
427 List<extrudeMode>& extrudeStatus
432 const label nbFacei = iter.key();
433 const label nCommon = iter.val();
435 const face& curFace = pp[facei];
436 const face& nbFace = pp[nbFacei];
441 && nCommon != nbFace.size()
442 && nCommon != curFace.size()
445 bool stringOk = checkCommonOrder(nCommon, curFace, nbFace);
453 pp.localFaces()[facei],
460 pp.localFaces()[nbFacei],
471 void Foam::snappyLayerDriver::handleNonStringConnected
476 List<extrudeMode>& extrudeStatus
484 List<extrudeMode> oldExtrudeStatus;
485 autoPtr<OBJstream> str;
488 oldExtrudeStatus = extrudeStatus;
493 meshRefiner_.mesh().time().path()
494 /
"nonStringConnected.obj"
497 Pout<<
"Dumping string edges to " << str().
name();
502 Map<label> nCommonPoints(128);
506 countCommonPoints(pp, facei, nCommonPoints);
529 forAll(extrudeStatus, pointi)
531 if (extrudeStatus[pointi] != oldExtrudeStatus[pointi])
535 meshRefiner_.mesh().points()[pp.meshPoints()[pointi]]
544 void Foam::snappyLayerDriver::handleNonManifolds
551 List<extrudeMode>& extrudeStatus
554 const fvMesh&
mesh = meshRefiner_.mesh();
556 Info<<
nl <<
"Handling non-manifold points ..." <<
endl;
559 Info<<
nl <<
"Checking patch manifoldness ..." <<
endl;
561 pointSet nonManifoldPoints(
mesh,
"nonManifoldPoints", pp.
nPoints());
574 const labelList& eFaces = edgeFaces[edgei];
575 if (eFaces.size() > 2)
577 const edge&
e = pp.edges()[edgei];
578 nonManifoldPoints.insert(pp.meshPoints()[
e[0]]);
579 nonManifoldPoints.insert(pp.meshPoints()[
e[1]]);
585 forAll(edgeGlobalFaces, edgei)
589 pp.edgeFaces()[edgei].size() == 1
590 && edgeGlobalFaces[edgei].size() > 2
596 const edge&
e = pp.edges()[edgei];
597 nonManifoldPoints.insert(pp.meshPoints()[
e[0]]);
598 nonManifoldPoints.insert(pp.meshPoints()[
e[1]]);
607 isCoupledEdge.
set(cpEdges);
613 orEqOp<unsigned int>(),
617 forAll(edgeGlobalFaces, edgei)
619 label meshEdgei = meshEdges[edgei];
623 pp.edgeFaces()[edgei].size() == 1
624 && edgeGlobalFaces[edgei].size() == 1
625 && isCoupledEdge.test(meshEdgei)
629 const edge&
e = pp.edges()[edgei];
633 nonManifoldPoints.insert(pp.meshPoints()[
e[0]]);
634 nonManifoldPoints.insert(pp.meshPoints()[
e[1]]);
643 Info<<
"Outside of local patch is multiply connected across edges or"
644 <<
" points at " << nNonManif <<
" points." <<
endl;
648 const labelList& meshPoints = pp.meshPoints();
650 forAll(meshPoints, patchPointi)
652 if (nonManifoldPoints.found(meshPoints[patchPointi]))
665 Info<<
"Set displacement to zero for all " << nNonManif
666 <<
" non-manifold points" <<
endl;
676 label nBaffleFaces = 0;
681 const labelList& fEdges = faceEdges[facei];
683 const labelList& globFaces0 = edgeGlobalFaces[fEdges[0]];
684 if (globFaces0.size() == 2)
686 const edge e0(globFaces0[0], globFaces0[1]);
687 bool isBaffle =
true;
688 for (
label fp = 1; fp < fEdges.size(); fp++)
690 const labelList& globFaces = edgeGlobalFaces[fEdges[fp]];
693 (globFaces.size() != 2)
694 || (edge(globFaces[0], globFaces[1]) != e0)
704 bool unextrude = unmarkExtrusion
706 pp.localFaces()[facei],
724 reduce(nBaffleFaces, sumOp<label>());
728 Info<<
"Set displacement to zero for all points on " << nBaffleFaces
729 <<
" baffle faces" <<
endl;
736 void Foam::snappyLayerDriver::handleFeatureAngle
740 const scalar minAngle,
743 List<extrudeMode>& extrudeStatus
746 const fvMesh&
mesh = meshRefiner_.mesh();
750 Info<<
nl <<
"Handling feature edges (angle < " << minAngle
753 if (minCos < 1-SMALL && minCos > -1+SMALL)
762 const labelList& eFaces = pp.edgeFaces()[edgei];
764 label meshEdgei = meshEdges[edgei];
770 edgeNormal[meshEdgei],
771 pp.faceNormals()[eFaces[i]]
784 autoPtr<OBJstream> str;
793 + meshRefiner_.timeName()
797 Info<<
"Writing feature edges to " << str().name() <<
endl;
806 const labelList& eFaces = pp.edgeFaces()[edgei];
808 label meshEdgei = meshEdges[edgei];
810 const vector&
n = edgeNormal[meshEdgei];
814 scalar
cos =
n & pp.faceNormals()[eFaces[0]];
818 const edge&
e = pp.edges()[edgei];
839 const point&
p0 = pp.localPoints()[
e[0]];
840 const point& p1 = pp.localPoints()[
e[1]];
847 Info<<
"Set displacement to zero for points on "
849 <<
" feature edges" <<
endl;
858 void Foam::snappyLayerDriver::handleWarpedFaces
861 const scalar faceRatio,
862 const scalar edge0Len,
866 List<extrudeMode>& extrudeStatus
869 const fvMesh&
mesh = meshRefiner_.mesh();
871 Info<<
nl <<
"Handling cells with warped patch faces ..." <<
nl;
875 label nWarpedFaces = 0;
879 const face&
f = pp[i];
883 label facei = pp.addressing()[i];
886 scalar edgeLen = edge0Len/(1<<ownLevel);
890 const vector& fn = pp.faceNormals()[i];
897 vProj[fp] = (
n & fn);
901 scalar minVal =
min(vProj);
902 scalar maxVal =
max(vProj);
904 if ((maxVal - minVal) > faceRatio * edgeLen)
923 Info<<
"Set displacement to zero on "
925 <<
" warped faces since layer would be > " << faceRatio
926 <<
" of the size of the bounding box." <<
endl;
1033 void Foam::snappyLayerDriver::setNumLayers
1040 List<extrudeMode>& extrudeStatus,
1044 const fvMesh&
mesh = meshRefiner_.mesh();
1046 Info<<
nl <<
"Handling points with inconsistent layer specification ..."
1056 label patchi = patchIDs[i];
1060 label wantedLayers = patchToNLayers[patchi];
1062 forAll(meshPoints, patchPointi)
1064 label ppPointi = pp.meshPointMap()[meshPoints[patchPointi]];
1066 maxLayers[ppPointi] =
max(wantedLayers, maxLayers[ppPointi]);
1067 minLayers[ppPointi] =
min(wantedLayers, minLayers[ppPointi]);
1098 <<
"Patchpoint:" << i <<
" coord:" << pp.localPoints()[i]
1099 <<
" maxLayers:" << maxLayers
1100 <<
" minLayers:" << minLayers
1103 else if (maxLayers[i] == minLayers[i])
1106 patchNLayers[i] = maxLayers[i];
1124 patchNLayers[i] = maxLayers[i];
1131 forAll(pp.localFaces(), facei)
1133 const face&
f = pp.localFaces()[facei];
1139 nCells =
max(nCells, patchNLayers[
f[fp]]);
1142 nAddedCells += nCells;
1144 reduce(nAddedCells, sumOp<label>());
1157 Foam::snappyLayerDriver::makeLayerDisplacementField
1159 const pointMesh& pMesh,
1164 const pointBoundaryMesh& pointPatches = pMesh.boundary();
1168 pointPatches.size(),
1169 slipPointPatchVectorField::typeName
1171 wordList actualPatchTypes(patchFieldTypes.size());
1172 forAll(pointPatches, patchi)
1174 actualPatchTypes[patchi] = pointPatches[patchi].type();
1177 forAll(numLayers, patchi)
1181 if (numLayers[patchi] == 0)
1183 patchFieldTypes[patchi] =
1184 zeroFixedValuePointPatchVectorField::typeName;
1186 else if (numLayers[patchi] > 0)
1188 patchFieldTypes[patchi] = fixedValuePointPatchVectorField::typeName;
1192 forAll(pointPatches, patchi)
1194 if (isA<processorPointPatch>(pointPatches[patchi]))
1196 patchFieldTypes[patchi] = calculatedPointPatchVectorField::typeName;
1198 else if (isA<cyclicPointPatch>(pointPatches[patchi]))
1200 patchFieldTypes[patchi] = cyclicSlipPointPatchVectorField::typeName;
1205 const polyMesh&
mesh = pMesh();
1214 "pointDisplacement",
1228 void Foam::snappyLayerDriver::growNoExtrusion
1233 List<extrudeMode>& extrudeStatus
1236 Info<<
nl <<
"Growing non-extrusion points by one layer ..." <<
endl;
1238 List<extrudeMode> grownExtrudeStatus(extrudeStatus);
1240 const faceList& localFaces = pp.localFaces();
1244 forAll(localFaces, facei)
1246 const face&
f = localFaces[facei];
1248 bool hasSqueeze =
false;
1251 if (extrudeStatus[
f[fp]] == NOEXTRUDE)
1265 extrudeStatus[
f[fp]] == EXTRUDE
1266 && grownExtrudeStatus[
f[fp]] != NOEXTRUDE
1269 grownExtrudeStatus[
f[fp]] = NOEXTRUDE;
1276 extrudeStatus.transfer(grownExtrudeStatus);
1285 status[i] = extrudeStatus[i];
1289 meshRefiner_.mesh(),
1297 extrudeStatus[i] = extrudeMode(status[i]);
1302 forAll(extrudeStatus, patchPointi)
1304 if (extrudeStatus[patchPointi] == NOEXTRUDE)
1306 patchDisp[patchPointi] =
Zero;
1307 patchNLayers[patchPointi] = 0;
1311 reduce(nGrown, sumOp<label>());
1313 Info<<
"Set displacement to zero for an additional " << nGrown
1314 <<
" points." <<
endl;
1318 void Foam::snappyLayerDriver::determineSidePatches
1320 const globalIndex& globalFaces,
1336 fvMesh&
mesh = meshRefiner_.mesh();
1342 Map<label> nbrProcToPatch;
1343 Map<label> patchToNbrProc;
1364 Info<<
nl <<
"Adding in total " << nAdded/2 <<
" inter-processor patches to"
1365 <<
" handle extrusion of non-manifold processor boundaries."
1372 Map<label> wantedToAddedPatch;
1374 for (
label patchi = nOldPatches; patchi <
nPatches; patchi++)
1376 label nbrProci = patchToNbrProc[patchi];
1382 dictionary patchDict;
1383 patchDict.add(
"type", processorPolyPatch::typeName);
1385 patchDict.add(
"neighbProcNo", nbrProci);
1386 patchDict.add(
"nFaces", 0);
1394 label procPatchi = meshRefiner_.appendPatch
1401 wantedToAddedPatch.insert(patchi, procPatchi);
1407 label patchi = edgePatchID[i];
1408 const auto fnd = wantedToAddedPatch.cfind(patchi);
1411 edgePatchID[i] = fnd.val();
1421 void Foam::snappyLayerDriver::calculateLayerThickness
1425 const layerParameters& layerParams,
1428 const scalar edge0Len,
1435 const fvMesh&
mesh = meshRefiner_.mesh();
1443 scalarField firstLayerThickness(pp.nPoints(), GREAT);
1444 scalarField finalLayerThickness(pp.nPoints(), GREAT);
1448 minThickness.setSize(pp.nPoints());
1449 minThickness = GREAT;
1453 label patchi = patchIDs[i];
1457 forAll(meshPoints, patchPointi)
1459 label ppPointi = pp.meshPointMap()[meshPoints[patchPointi]];
1461 firstLayerThickness[ppPointi] =
min
1463 firstLayerThickness[ppPointi],
1464 layerParams.firstLayerThickness()[patchi]
1466 finalLayerThickness[ppPointi] =
min
1468 finalLayerThickness[ppPointi],
1469 layerParams.finalLayerThickness()[patchi]
1471 totalThickness[ppPointi] =
min
1473 totalThickness[ppPointi],
1474 layerParams.thickness()[patchi]
1476 expRatio[ppPointi] =
min
1479 layerParams.expansionRatio()[patchi]
1481 minThickness[ppPointi] =
min
1483 minThickness[ppPointi],
1484 layerParams.minThickness()[patchi]
1493 firstLayerThickness,
1501 finalLayerThickness,
1539 if (layerParams.relativeSizes())
1543 min(layerParams.minThickness()) < 0
1544 ||
max(layerParams.minThickness()) > 2
1548 <<
"Thickness should be factor of local undistorted cell size."
1549 <<
" Valid values are [0..2]." <<
nl
1550 <<
" minThickness:" << layerParams.minThickness()
1564 const face&
f = pp.localFaces()[i];
1568 maxPointLevel[
f[fp]] =
max(maxPointLevel[
f[fp]], ownLevel);
1582 forAll(maxPointLevel, pointi)
1585 scalar edgeLen = edge0Len/(1<<maxPointLevel[pointi]);
1586 firstLayerThickness[pointi] *= edgeLen;
1587 finalLayerThickness[pointi] *= edgeLen;
1588 totalThickness[pointi] *= edgeLen;
1589 minThickness[pointi] *= edgeLen;
1598 forAll(firstLayerThickness, pointi)
1600 thickness[pointi] = layerParams.layerThickness
1602 patchNLayers[pointi],
1603 firstLayerThickness[pointi],
1604 finalLayerThickness[pointi],
1605 totalThickness[pointi],
1609 expansionRatio[pointi] = layerParams.layerExpansionRatio
1611 patchNLayers[pointi],
1612 firstLayerThickness[pointi],
1613 finalLayerThickness[pointi],
1614 totalThickness[pointi],
1626 int oldPrecision =
Info().precision();
1629 label maxPatchNameLen = 0;
1632 label patchi = patchIDs[i];
1634 maxPatchNameLen =
max(maxPatchNameLen,
label(patchName.size()));
1638 <<
setf(ios_base::left) <<
setw(maxPatchNameLen) <<
"patch"
1639 <<
setw(0) <<
" faces layers avg thickness[m]" <<
nl
1640 <<
setf(ios_base::left) <<
setw(maxPatchNameLen) <<
" "
1641 <<
setw(0) <<
" near-wall overall" <<
nl
1642 <<
setf(ios_base::left) <<
setw(maxPatchNameLen) <<
"-----"
1643 <<
setw(0) <<
" ----- ------ --------- -------" <<
endl;
1650 label patchi = patchIDs[i];
1654 scalar sumThickness = 0;
1655 scalar sumNearWallThickness = 0;
1656 label nMasterPoints = 0;
1658 forAll(meshPoints, patchPointi)
1660 label meshPointi = meshPoints[patchPointi];
1661 if (isMasterPoint[meshPointi])
1663 label ppPointi = pp.meshPointMap()[meshPointi];
1665 sumThickness += thickness[ppPointi];
1666 sumNearWallThickness += layerParams.firstLayerThickness
1668 patchNLayers[ppPointi],
1669 firstLayerThickness[ppPointi],
1670 finalLayerThickness[ppPointi],
1671 thickness[ppPointi],
1672 expansionRatio[ppPointi]
1681 scalar avgThickness = 0;
1682 scalar avgNearWallThickness = 0;
1689 avgNearWallThickness =
1698 <<
" " <<
setw(6) << layerParams.numLayers()[patchi]
1699 <<
" " <<
setw(8) << avgNearWallThickness
1700 <<
" " <<
setw(8) << avgThickness
1709 void Foam::snappyLayerDriver::syncPatchDisplacement
1715 List<extrudeMode>& extrudeStatus
1718 const fvMesh&
mesh = meshRefiner_.mesh();
1719 const labelList& meshPoints = pp.meshPoints();
1721 label nChangedTotal = 0;
1733 minMagSqrEqOp<vector>(),
1740 if (
mag(patchDisp[i]) < minThickness[i])
1758 labelList syncPatchNLayers(patchNLayers);
1771 forAll(syncPatchNLayers, i)
1773 if (syncPatchNLayers[i] != patchNLayers[i])
1802 forAll(syncPatchNLayers, i)
1804 if (syncPatchNLayers[i] != patchNLayers[i])
1821 nChangedTotal += nChanged;
1840 void Foam::snappyLayerDriver::getPatchDisplacement
1847 List<extrudeMode>& extrudeStatus
1850 Info<<
nl <<
"Determining displacement for added points"
1851 <<
" according to pointNormal ..." <<
endl;
1853 const fvMesh&
mesh = meshRefiner_.mesh();
1856 const pointField& localPoints = pp.localPoints();
1868 patchDisp = thickness*pointNormals;
1871 label nNoVisNormal = 0;
1872 label nExtrudeRemove = 0;
1876 forAll(pointNormals, patchPointi)
1878 label meshPointi = pp.meshPoints()[patchPointi];
1880 if (extrudeStatus[patchPointi] == NOEXTRUDE)
1883 patchNLayers[patchPointi] = 0;
1884 patchDisp[patchPointi] =
Zero;
1889 const vector&
n = pointNormals[patchPointi];
1895 Pout<<
"No valid normal for point " << meshPointi
1896 <<
' ' << pp.points()[meshPointi]
1897 <<
"; setting displacement to "
1898 << patchDisp[patchPointi]
1902 extrudeStatus[patchPointi] = EXTRUDEREMOVE;
1909 forAll(extrudeStatus, patchPointi)
1911 if (extrudeStatus[patchPointi] == EXTRUDEREMOVE)
1916 const labelList& pEdges = pp.pointEdges()[patchPointi];
1920 label edgei = pEdges[i];
1922 label otherPointi = pp.edges()[edgei].otherVertex(patchPointi);
1924 if (extrudeStatus[otherPointi] != NOEXTRUDE)
1926 avg += localPoints[otherPointi] + patchDisp[otherPointi];
1935 Pout<<
"Displacement at illegal point "
1936 << localPoints[patchPointi]
1938 << (avg /
nPoints - localPoints[patchPointi])
1942 patchDisp[patchPointi] =
1944 - localPoints[patchPointi];
1957 <<
" points with point normal pointing through faces." <<
nl
1958 <<
"Reset displacement at "
1960 <<
" points to average of surrounding points." <<
endl;
1963 syncPatchDisplacement
1976 bool Foam::snappyLayerDriver::sameEdgeNeighbour
1979 const label myGlobalFacei,
1980 const label nbrGlobFacei,
1984 const labelList& eFaces = globalEdgeFaces[edgei];
1985 if (eFaces.size() == 2)
1987 return edge(myGlobalFacei, nbrGlobFacei) == edge(eFaces[0], eFaces[1]);
1994 void Foam::snappyLayerDriver::getVertexString
2000 const label myGlobFacei,
2001 const label nbrGlobFacei,
2005 const labelList& fEdges = pp.faceEdges()[facei];
2006 label fp = fEdges.find(edgei);
2019 label prevFp = fEdges.rcIndex(startFp);
2039 label nextFp = fEdges.fcIndex(endFp);
2056 const face&
f = pp.localFaces()[facei];
2073 Foam::label Foam::snappyLayerDriver::truncateDisplacement
2075 const globalIndex& globalFaces,
2079 const faceSet& illegalPatchFaces,
2082 List<extrudeMode>& extrudeStatus
2085 const fvMesh&
mesh = meshRefiner_.mesh();
2089 const Map<label>& meshPointMap = pp.meshPointMap();
2091 for (
const label facei : illegalPatchFaces)
2096 <<
"Faceset " << illegalPatchFaces.name()
2097 <<
" contains internal face " << facei <<
nl
2106 const auto fnd = meshPointMap.cfind(
f[fp]);
2109 const label patchPointi = fnd.val();
2111 if (extrudeStatus[patchPointi] != NOEXTRUDE)
2126 forAll(patchDisp, patchPointi)
2128 if (
mag(patchDisp[patchPointi]) < minThickness[patchPointi])
2144 else if (extrudeStatus[patchPointi] == NOEXTRUDE)
2147 patchDisp[patchPointi] =
Zero;
2148 patchNLayers[patchPointi] = 0;
2153 const faceList& localFaces = pp.localFaces();
2157 syncPatchDisplacement
2178 const face& localF = localFaces[i];
2183 extrudeMode prevMode = extrudeStatus[localF.prevLabel(0)];
2187 extrudeMode fpMode = extrudeStatus[localF[fp]];
2189 if (prevMode == NOEXTRUDE && fpMode != NOEXTRUDE)
2216 reduce(nPinched, sumOp<label>());
2218 Info<<
"truncateDisplacement : Unextruded " << nPinched
2219 <<
" faces due to non-consecutive vertices being extruded." <<
endl;
2242 label nButterFly = 0;
2244 DynamicList<label> stringedVerts;
2245 forAll(pp.edges(), edgei)
2247 const labelList& globFaces = edgeGlobalFaces[edgei];
2249 if (globFaces.size() == 2)
2251 label myFacei = pp.edgeFaces()[edgei][0];
2252 label myGlobalFacei = globalFaces.toGlobal
2254 pp.addressing()[myFacei]
2256 label nbrGlobalFacei =
2258 globFaces[0] != myGlobalFacei
2275 extrudeStatus[stringedVerts[0]] != NOEXTRUDE
2276 || extrudeStatus[stringedVerts.last()] != NOEXTRUDE
2281 for (
label i = 1; i < stringedVerts.size()-1; i++)
2283 if (extrudeStatus[stringedVerts[i]] == NOEXTRUDE)
2314 reduce(nButterFly, sumOp<label>());
2316 Info<<
"truncateDisplacement : Unextruded " << nButterFly
2317 <<
" faces due to stringed edges with inconsistent extrusion."
2328 label nDiffering = 0;
2372 if (nPinched+nButterFly+nDiffering == 0)
2384 void Foam::snappyLayerDriver::setupLayerInfoTruncation
2388 const List<extrudeMode>& extrudeStatus,
2389 const label nBufferCellsNoExtrude,
2394 Info<<
nl <<
"Setting up information for layer truncation ..." <<
endl;
2396 const fvMesh&
mesh = meshRefiner_.mesh();
2398 if (nBufferCellsNoExtrude < 0)
2400 Info<<
nl <<
"Performing no layer truncation."
2401 <<
" nBufferCellsNoExtrude set to less than 0 ..." <<
endl;
2404 forAll(pp.localFaces(), patchFacei)
2406 const face&
f = pp.localFaces()[patchFacei];
2410 if (patchNLayers[
f[fp]] > 0)
2412 nPatchFaceLayers[patchFacei] = patchNLayers[
f[fp]];
2417 nPatchPointLayers = patchNLayers;
2420 forAll(nPatchFaceLayers, patchFacei)
2422 if (nPatchFaceLayers[patchFacei] == -1)
2424 nPatchFaceLayers[patchFacei] = 0;
2433 forAll(pp.localFaces(), patchFacei)
2435 const face&
f = pp.localFaces()[patchFacei];
2440 bool noExtrude =
false;
2445 if (extrudeStatus[
f[fp]] == NOEXTRUDE)
2449 mLevel =
max(mLevel, patchNLayers[
f[fp]]);
2459 nPatchFaceLayers[patchFacei] = 1;
2460 maxLevel[patchFacei] = mLevel;
2464 maxLevel[patchFacei] = mLevel;
2479 for (
label ilevel = 1; ilevel < nLevels; ilevel++)
2485 nBuffer = nBufferCellsNoExtrude - 1;
2489 nBuffer = nBufferCellsNoExtrude;
2492 for (
label ibuffer = 0; ibuffer < nBuffer + 1; ibuffer++)
2494 labelList tempCounter(nPatchFaceLayers);
2496 boolList foundNeighbour(pp.nPoints(),
false);
2498 forAll(pp.meshPoints(), patchPointi)
2500 forAll(pointFaces[patchPointi], pointFacei)
2502 label facei = pointFaces[patchPointi][pointFacei];
2506 nPatchFaceLayers[facei] != -1
2507 && maxLevel[facei] > 0
2510 foundNeighbour[patchPointi] =
true;
2525 forAll(pp.meshPoints(), patchPointi)
2527 if (foundNeighbour[patchPointi])
2529 forAll(pointFaces[patchPointi], pointFacei)
2531 label facei = pointFaces[patchPointi][pointFacei];
2534 nPatchFaceLayers[facei] == -1
2535 && maxLevel[facei] > 0
2536 && ilevel < maxLevel[facei]
2539 tempCounter[facei] = ilevel;
2544 nPatchFaceLayers = tempCounter;
2548 forAll(pp.localFaces(), patchFacei)
2550 if (nPatchFaceLayers[patchFacei] == -1)
2552 nPatchFaceLayers[patchFacei] = maxLevel[patchFacei];
2556 forAll(pp.meshPoints(), patchPointi)
2558 if (extrudeStatus[patchPointi] != NOEXTRUDE)
2560 forAll(pointFaces[patchPointi], pointFacei)
2562 label face = pointFaces[patchPointi][pointFacei];
2563 nPatchPointLayers[patchPointi] =
max
2565 nPatchPointLayers[patchPointi],
2566 nPatchFaceLayers[face]
2572 nPatchPointLayers[patchPointi] = 0;
2588 bool Foam::snappyLayerDriver::cellsUseFace
2590 const polyMesh&
mesh,
2597 const cell& cFaces =
mesh.
cells()[cellLabels[i]];
2601 if (faces.found(cFaces[cFacei]))
2615 Foam::label Foam::snappyLayerDriver::checkAndUnmark
2617 const addPatchCellLayer& addLayer,
2618 const dictionary& meshQualityDict,
2619 const bool additionalReporting,
2620 const List<labelPair>& baffles,
2622 const fvMesh& newMesh,
2626 List<extrudeMode>& extrudeStatus
2630 Info<<
nl <<
"Checking mesh with layer ..." <<
endl;
2631 faceSet wrongFaces(newMesh,
"wrongFaces", newMesh.nFaces()/1000);
2644 <<
" (concave, zero area or negative cell pyramid volume)"
2658 addLayer.layerFaces()
2666 const label nReportMax = 10;
2667 DynamicField<point> disabledFaceCentres(nReportMax);
2669 forAll(addedCells, oldPatchFacei)
2673 const labelList& fCells = addedCells[oldPatchFacei];
2675 if (cellsUseFace(newMesh, fCells, wrongFaces))
2682 pp.localFaces()[oldPatchFacei],
2689 if (additionalReporting && (nChanged < nReportMax))
2691 disabledFaceCentres.
append
2693 pp.faceCentres()[oldPatchFacei]
2705 if (additionalReporting)
2714 label nReportLocal = nChanged;
2715 if (nChangedTotal > nReportMax)
2730 Pout<<
"Checked mesh with layers. Disabled extrusion at " <<
endl;
2731 for (
label i=0; i < nReportLocal; i++)
2733 Pout<<
" " << disabledFaceCentres[i] <<
endl;
2739 if (nReportTotal < nChangedTotal)
2741 Info<<
"Suppressed disabled extrusion message for other "
2742 << nChangedTotal - nReportTotal <<
" faces." <<
endl;
2746 return nChangedTotal;
2751 Foam::label Foam::snappyLayerDriver::countExtrusion
2754 const List<extrudeMode>& extrudeStatus
2758 label nExtruded = 0;
2760 const faceList& localFaces = pp.localFaces();
2764 const face& localFace = localFaces[i];
2768 if (extrudeStatus[localFace[fp]] != NOEXTRUDE)
2783 const polyMesh&
mesh,
2785 const List<labelPair>& baffles
2794 Map<label> baffleSet(4*baffles.size());
2797 baffleSet.insert(baffles[bafflei][0], bafflei);
2798 baffleSet.insert(baffles[bafflei][1], bafflei);
2802 List<labelPair> newBaffles(baffles.size(),
labelPair(-1, -1));
2810 label oldFacei = newToOldFaces[facei];
2812 const auto faceFnd = baffleSet.find(oldFacei);
2813 if (faceFnd.found())
2815 label bafflei = faceFnd();
2821 else if (
p[1] == -1)
2828 <<
"Problem:" << facei <<
" at:"
2830 <<
" is on same baffle as " <<
p[0]
2843 void Foam::snappyLayerDriver::getLayerCellsFaces
2845 const polyMesh&
mesh,
2846 const addPatchCellLayer& addLayer,
2856 faceRealThickness = 0;
2864 forAll(addedCells, oldPatchFacei)
2866 const labelList& added = addedCells[oldPatchFacei];
2868 const labelList& layer = layerFaces[oldPatchFacei];
2875 cellNLayers[added[i]] = layer.size()-1;
2880 forAll(layerFaces, oldPatchFacei)
2882 const labelList& layer = layerFaces[oldPatchFacei];
2883 const scalar realThickness = oldRealThickness[oldPatchFacei];
2889 for (
label i = 1; i < layer.size(); i++)
2891 faceRealThickness[layer[i]] = realThickness;
2898 void Foam::snappyLayerDriver::printLayerData
2909 int oldPrecision =
Info().precision();
2912 label maxPatchNameLen = 0;
2915 label patchi = patchIDs[i];
2916 word patchName = pbm[patchi].name();
2917 maxPatchNameLen =
max(maxPatchNameLen,
label(patchName.size()));
2921 <<
setf(ios_base::left) <<
setw(maxPatchNameLen) <<
"patch"
2922 <<
setw(0) <<
" faces layers overall thickness" <<
nl
2923 <<
setf(ios_base::left) <<
setw(maxPatchNameLen) <<
" "
2924 <<
setw(0) <<
" [m] [%]" <<
nl
2925 <<
setf(ios_base::left) <<
setw(maxPatchNameLen) <<
"-----"
2926 <<
setw(0) <<
" ----- ------ --- ---" <<
endl;
2931 label patchi = patchIDs[i];
2932 const polyPatch& pp = pbm[patchi];
2934 label sumSize = pp.size();
2937 const labelList& faceCells = pp.faceCells();
2938 label sumNLayers = 0;
2941 sumNLayers += cellNLayers[faceCells[i]];
2954 scalar sumRealThickness =
sum(patchReal);
2955 scalar sumFraction = 0;
2958 if (patchWanted[i] > VSMALL)
2960 sumFraction += (patchReal[i]/patchWanted[i]);
2965 reduce(sumSize, sumOp<label>());
2966 reduce(sumNLayers, sumOp<label>());
2967 reduce(sumRealThickness, sumOp<scalar>());
2968 reduce(sumFraction, sumOp<scalar>());
2971 scalar avgLayers = 0;
2973 scalar avgFraction = 0;
2976 avgLayers = scalar(sumNLayers)/sumSize;
2977 avgReal = sumRealThickness/sumSize;
2978 avgFraction = sumFraction/sumSize;
2983 <<
" " <<
setw(8) << sumSize
2984 <<
" " <<
setw(8) << avgLayers
2985 <<
" " <<
setw(8) << avgReal
2986 <<
" " <<
setw(8) << 100*avgFraction
2993 bool Foam::snappyLayerDriver::writeLayerSets
3003 forAll(cellNLayers, celli)
3005 if (cellNLayers[celli] > 0)
3010 cellSet addedCellSet(
mesh,
"addedCells", nAdded);
3011 forAll(cellNLayers, celli)
3013 if (cellNLayers[celli] > 0)
3015 addedCellSet.insert(celli);
3018 addedCellSet.instance() = meshRefiner_.timeName();
3021 <<
" added cells to cellSet "
3022 << addedCellSet.name() <<
endl;
3023 bool ok = addedCellSet.
write();
3024 allOk = allOk && ok;
3030 if (faceRealThickness[facei] > 0)
3036 faceSet layerFacesSet(
mesh,
"layerFaces", nAdded);
3039 if (faceRealThickness[facei] > 0)
3041 layerFacesSet.insert(facei);
3044 layerFacesSet.instance() = meshRefiner_.timeName();
3047 <<
" faces inside added layer to faceSet "
3048 << layerFacesSet.name() <<
endl;
3049 bool ok = layerFacesSet.
write();
3050 allOk = allOk && ok;
3056 bool Foam::snappyLayerDriver::writeLayerData
3069 bool ok = writeLayerSets(
mesh, cellNLayers, faceRealThickness);
3070 allOk = allOk && ok;
3091 fixedValueFvPatchScalarField::typeName
3095 fld[celli] = cellNLayers[celli];
3097 volScalarField::Boundary& fldBf =
fld.boundaryFieldRef();
3102 label patchi = patchIDs[i];
3103 const polyPatch& pp = pbm[patchi];
3104 const labelList& faceCells = pp.faceCells();
3108 pfld[i] = cellNLayers[faceCells[i]];
3110 fldBf[patchi] == pfld;
3114 bool ok =
fld.write();
3115 allOk = allOk && ok;
3131 fixedValueFvPatchScalarField::typeName
3133 volScalarField::Boundary& fldBf =
fld.boundaryFieldRef();
3137 label patchi = patchIDs[i];
3138 fldBf[patchi] == pbm[patchi].patchSlice(faceRealThickness);
3142 bool ok =
fld.write();
3143 allOk = allOk && ok;
3150 "thicknessFraction",
3159 fixedValueFvPatchScalarField::typeName
3161 volScalarField::Boundary& fldBf =
fld.boundaryFieldRef();
3165 label patchi = patchIDs[i];
3180 if (patchWanted[i] > VSMALL)
3182 pfld[i] = patchReal[i]/patchWanted[i];
3186 fldBf[patchi] == pfld;
3189 <<
" : overall layer thickness (fraction"
3190 <<
" of desired thickness)" <<
endl;
3191 bool ok =
fld.write();
3192 allOk = allOk && ok;
3203 Foam::snappyLayerDriver::snappyLayerDriver
3211 meshRefiner_(meshRefiner),
3212 globalToMasterPatch_(globalToMasterPatch),
3213 globalToSlavePatch_(globalToSlavePatch),
3235 <<
"Merging all faces of a cell" <<
nl
3236 <<
"---------------------------" <<
nl
3237 <<
" - which are on the same patch" <<
nl
3238 <<
" - which make an angle < " << planarAngle
3240 <<
" (cos:" << minCos <<
')' <<
nl
3241 <<
" - as long as the resulting face doesn't become concave"
3244 <<
" (0=straight, 180=fully concave)" <<
nl
3255 duplicateFace[cpl[0]] = cpl[1];
3256 duplicateFace[cpl[1]] = cpl[0];
3259 label nChanged = meshRefiner_.mergePatchFacesUndo
3263 meshRefiner_.meshedPatches(),
3269 nChanged += meshRefiner_.mergeEdgesUndo(minCos, motionDict);
3278 const label nAllowableErrors,
3292 internalOrBaffleFaceZones = meshRefiner_.getZones(fzTypes);
3299 meshRefiner_.getZones
3314 meshRefiner_.createZoneBaffles
3324 Info<<
"Writing baffled mesh to time "
3325 << meshRefiner_.timeName() <<
endl;
3346 const labelList& reverseFaceMap = map().reverseFaceMap();
3349 label f0 = reverseFaceMap[baffles[i].first()];
3350 label f1 = reverseFaceMap[baffles[i].second()];
3369 bool hasInfo = meshRefiner_.getFaceZoneInfo
3379 if (layerIDs.
found(mpi) && !layerIDs.
found(spi))
3383 <<
" adding layers to master patch " << pbm[mpi].
name()
3384 <<
" only. Freezing points on slave patch "
3388 else if (!layerIDs.
found(mpi) && layerIDs.
found(spi))
3392 <<
" adding layers to slave patch " << pbm[spi].
name()
3393 <<
" only. Freezing points on master patch "
3428 label nIdealTotAddedCells = 0;
3445 syncPatchDisplacement
3459 forAll(extrudeStatus, patchPointi)
3461 label pointi = pp().meshPoints()[patchPointi];
3462 minPatchState[pointi] = extrudeStatus[patchPointi];
3480 forAll(minPatchState, pointi)
3482 label state = minPatchState[pointi];
3483 if (state == EXTRUDE || state == EXTRUDEREMOVE)
3490 forAll(minPatchState, pointi)
3492 label state = minPatchState[pointi];
3493 if (state == EXTRUDE || state == EXTRUDEREMOVE)
3495 candidatePoints[
n++] = pointi;
3513 bool hasInfo = meshRefiner_.getFaceZoneInfo
3520 if (hasInfo && !layerIDs.found(mpi) && !layerIDs.found(spi))
3522 nonDupZones.append(zonei);
3546 const labelList& pointMap = map().pointMap();
3547 const labelList& reversePointMap = map().reversePointMap();
3551 label oldPointi = pointMap[pointi];
3552 label newMasterPointi = reversePointMap[oldPointi];
3554 if (newMasterPointi != pointi)
3557 pointToMaster[pointi] = newMasterPointi;
3558 pointToMaster[newMasterPointi] = newMasterPointi;
3564 const labelList& reverseFaceMap = map().reverseFaceMap();
3567 label f0 = reverseFaceMap[baffles[i].first()];
3568 label f1 = reverseFaceMap[baffles[i].second()];
3577 Info<<
"Writing point-duplicate mesh to time "
3578 << meshRefiner_.timeName() <<
endl;
3594 /
"duplicatePoints_"
3595 + meshRefiner_.timeName()
3598 Info<<
"Writing point-duplicates to " << str.name() <<
endl;
3602 label newMasteri = reversePointMap[pointMap[pointi]];
3604 if (newMasteri != pointi)
3657 determineSidePatches
3682 label nIdealTotAddedCells = 0;
3711 handleNonStringConnected
3755 const scalar edge0Len =
3756 meshRefiner_.meshCutter().level0EdgeLength();
3757 const labelList& cellLevel = meshRefiner_.meshCutter().cellLevel();
3787 for (
label i = 0; i < layerParams.
nGrow(); i++)
3801 const scalar edge0Len = meshRefiner_.meshCutter().level0EdgeLength();
3802 const labelList& cellLevel = meshRefiner_.meshCutter().cellLevel();
3812 meshRefiner_.timeName(),
3819 calculateLayerThickness
3846 avgPointData(*pp, thickness);
3854 makeLayerDisplacementField
3867 combinedDict.
merge(motionDict);
3869 combinedDict.add(
"minThicknessName", minThickness.name());
3897 if (errorMsg.size() || IOerrorMsg.size())
3906 <<
"Missing/incorrect required dictionary entries:"
3908 << IOerrorMsg.c_str() <<
nl
3909 << errorMsg.c_str() <<
nl <<
nl
3910 <<
"Exiting dry-run" <<
nl <<
endl;
3914 Perr<<
"\nFOAM parallel run exiting\n" <<
endl;
3932 label iteration = 0;
3938 <<
"Layer addition iteration " << iteration <<
nl
3939 <<
"--------------------------" <<
endl;
3947 : motionDict.
subDict(
"relaxed")
3952 Info<<
"Switched to relaxed meshQuality constraints." <<
endl;
3961 syncPatchDisplacement
3971 getPatchDisplacement
3985 const pointField oldPatchPos(pp().localPoints());
3990 patchDisp = -patchDisp;
4009 combinedDict.
merge(motionDict);
4011 combinedDict.merge(meshQualityDict);
4013 combinedDict.add(
"minThicknessName", minThickness.name());
4016 medialAxisMoverPtr().move
4026 patchDisp = oldPatchPos - pp().localPoints();
4033 truncateDisplacement
4058 Info<<
"Writing shrunk mesh to time "
4059 << meshRefiner_.timeName() <<
endl;
4088 labelList nPatchFaceLayers(pp().size(), -1);
4089 setupLayerInfoTruncation
4103 forAll(nPatchPointLayers, i)
4107 nPatchPointLayers[i],
4110 finalDisp[i] = ratio*patchDisp[i];
4114 const scalarField invExpansionRatio(1.0/expansionRatio);
4145 savedMeshMod = meshMod;
4167 fvMesh& newMesh = *newMeshPtr;
4171 addProfiling(grow,
"snappyHexMesh::layers::updateMesh");
4193 avgPointData(*pp,
mag(patchDisp))(),
4201 label nAddedCells = 0;
4202 forAll(cellNLayers, celli)
4204 if (cellNLayers[celli] > 0)
4213 Info<<
"Writing layer mesh to time " << meshRefiner_.timeName()
4216 writeLayerSets(newMesh, cellNLayers, faceRealThickness);
4235 facei < newMesh.
nFaces();
4240 if (newMeshFacei != -1)
4242 meshToNewMesh[newMeshFacei] = facei;
4253 meshToNewMesh[
p[0]],
4256 if (newMeshBaffle[0] != -1 && newMeshBaffle[1] != -1)
4258 newMeshBaffles[newi++] = newMeshBaffle;
4261 newMeshBaffles.setSize(newi);
4272 <<
" baffles across faceZones of type internal" <<
nl
4276 label nTotChanged = checkAndUnmark
4290 label nTotExtruded = countExtrusion(*pp, extrudeStatus);
4294 Info<<
"Extruding " << nTotExtruded
4295 <<
" out of " << nTotFaces
4296 <<
" faces (" << 100.0*nTotExtruded/nTotFaces <<
"%)."
4297 <<
" Removed extrusion at " << nTotChanged <<
" faces."
4299 <<
"Added " << nTotAddedCells <<
" out of "
4300 << nIdealTotAddedCells
4301 <<
" cells (" << 100.0*nTotAddedCells/nIdealTotAddedCells
4304 if (nTotChanged == 0)
4312 medialAxisMoverPtr().movePoints(
mesh.
points());
4315 for (
label i = 0; i < layerParams.
nGrow(); i++)
4360 meshRefiner_.updateMesh(map,
labelList(0));
4377 faceWantedThickness,
4386 Info<<
"Writing mesh with layers but disconnected to time "
4387 << meshRefiner_.timeName() <<
endl;
4414 oldBaffleFace.set(baffle[0]);
4415 oldBaffleFace.set(baffle[1]);
4429 if (oldFacei != -1 && oldBaffleFace.test(oldFacei))
4437 if (pointToMaster[oldPointi] != -1)
4439 candidates.
append(pointi);
4456 meshRefiner_.mergeDistance(),
4472 const labelList& oldPoints = newToOld[newi];
4473 if (oldPoints.size() > 1)
4482 pointToMaster[meshPoints[i]] = masteri;
4494 label nPointPairs = 0;
4495 forAll(pointToMaster, pointi)
4497 label otherPointi = pointToMaster[pointi];
4498 if (otherPointi != -1)
4504 if (nPointPairs > 0)
4507 Info<<
"Merging " << nPointPairs <<
" duplicated points ..." <<
endl;
4515 + meshRefiner_.timeName()
4518 Info<<
"Points to be merged to " << str.name() <<
endl;
4519 forAll(pointToMaster, pointi)
4521 label otherPointi = pointToMaster[pointi];
4522 if (otherPointi != -1)
4537 const labelList& reverseFaceMap = map().reverseFaceMap();
4541 Info<<
"Merged points in = "
4549 Info<<
"Converting baffles back into zoned faces ..."
4567 forAll(newFaceRealThickness, facei)
4572 scalar& realThick = newFaceRealThickness[facei];
4573 realThick =
max(realThick, faceRealThickness[oldFacei]);
4574 scalar& wanted = newFaceWantedThickness[facei];
4575 wanted =
max(wanted, faceWantedThickness[oldFacei]);
4578 faceRealThickness.transfer(newFaceRealThickness);
4579 faceWantedThickness.transfer(newFaceWantedThickness);
4582 Info<<
"Converted baffles in = "
4583 << meshRefiner_.mesh().time().cpuTimeIncrement()
4593 <<
"Doing final balancing" <<
nl
4594 <<
"---------------------" <<
nl
4613 map().distributeCellData(cellNLayers);
4614 map().distributeFaceData(faceWantedThickness);
4615 map().distributeFaceData(faceRealThickness);
4629 faceWantedThickness,
4642 const bool preBalance,
4651 <<
"Shrinking and layer addition phase" <<
nl
4652 <<
"----------------------------------" <<
nl
4656 Info<<
"Using mesh parameters " << motionDict <<
nl <<
endl;
4661 mergeType == meshRefinement::FaceMergeType::GEOMETRIC
4662 || mergeType == meshRefinement::FaceMergeType::IGNOREPATCH
4665 mergePatchFacesUndo(layerParams, motionDict, mergeType);
4674 label nFacesWithLayers = 0;
4675 forAll(numLayers, patchi)
4677 if (numLayers[patchi] > 0)
4689 <<
"Ignoring layers on coupled patch " << pp.
name()
4701 meshRefiner_.getFaceZoneInfo(fZones[zonei].
name(), mpi, spi, fzType);
4703 if (numLayers[mpi] > 0)
4705 nFacesWithLayers += fZones[zonei].size();
4707 if (numLayers[spi] > 0)
4709 nFacesWithLayers += fZones[zonei].size();
4718 Info<<
nl <<
"No layers to generate ..." <<
endl;
4723 checkMeshManifold();
4726 Info<<
"Checking initial mesh ..." <<
endl;
4735 Info<<
"Detected " << nInitErrors <<
" illegal faces"
4736 <<
" (concave, zero area or negative cell pyramid volume)"
4740 bool faceZoneOnCoupledFace =
false;
4754 const faceZone& fZone = fZones[zonei];
4759 meshRefiner_.getFaceZoneInfo(fzName, mpi, spi, fzType);
4761 if (numLayers[mpi] > 0 || numLayers[spi])
4763 isExtrudedZoneFace.set(fZone);
4780 if (intOrCoupled[facei] && isExtrudedZoneFace.
test(facei))
4782 faceZoneOnCoupledFace =
true;
4797 <<
"Doing initial balancing" <<
nl
4798 <<
"-----------------------" <<
nl
4802 forAll(numLayers, patchi)
4804 if (numLayers[patchi] > 0)
4809 cellWeights[pp.
faceCells()[i]] += numLayers[patchi];
4818 const faceZone& fZone = fZones[zonei];
4823 meshRefiner_.getFaceZoneInfo(fzName, mpi, spi, fzType);
4825 if (numLayers[mpi] > 0)
4832 if (cellIDs[i] >= 0)
4834 cellWeights[cellIDs[i]] += numLayers[mpi];
4838 if (numLayers[spi] > 0)
4843 if (cellIDs[i] >= 0)
4845 cellWeights[cellIDs[i]] += numLayers[mpi];