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;
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
297 const faceList& localFaces = pp.localFaces();
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);
451 pp.localFaces()[facei],
458 pp.localFaces()[nbFacei],
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])
533 meshRefiner_.mesh().points()[pp.meshPoints()[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)
575 const edge&
e = pp.edges()[edgei];
576 nonManifoldPoints.insert(pp.meshPoints()[
e[0]]);
577 nonManifoldPoints.insert(pp.meshPoints()[
e[1]]);
583 forAll(edgeGlobalFaces, edgei)
585 if (edgeGlobalFaces[edgei].size() > 2)
590 const edge&
e = pp.edges()[edgei];
591 nonManifoldPoints.insert(pp.meshPoints()[
e[0]]);
592 nonManifoldPoints.insert(pp.meshPoints()[
e[1]]);
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);
609 const labelList& meshPoints = pp.meshPoints();
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
667 pp.localFaces()[facei],
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)
723 const labelList& eFaces = pp.edgeFaces()[edgei];
725 label meshEdgei = meshEdges[edgei];
731 edgeNormal[meshEdgei],
732 pp.faceNormals()[eFaces[i]]
745 autoPtr<OBJstream> str;
754 + meshRefiner_.timeName()
758 Info<<
"Writing feature edges to " << str().name() <<
endl;
767 const labelList& eFaces = pp.edgeFaces()[edgei];
769 label meshEdgei = meshEdges[edgei];
771 const vector&
n = edgeNormal[meshEdgei];
775 scalar
cos =
n & pp.faceNormals()[eFaces[0]];
779 const edge&
e = pp.edges()[edgei];
800 const point&
p0 = pp.localPoints()[
e[0]];
801 const point& p1 = pp.localPoints()[
e[1]];
808 Info<<
"Set displacement to zero for points on "
810 <<
" feature edges" <<
endl;
819 void Foam::snappyLayerDriver::handleWarpedFaces
822 const scalar faceRatio,
824 const scalar edge0Len,
828 List<extrudeMode>& extrudeStatus
831 const fvMesh&
mesh = meshRefiner_.mesh();
834 Info<<
nl <<
"Handling cells with warped patch faces ..." <<
nl;
842 label nWarpedFaces = 0;
846 const face&
f = pp[i];
847 label faceI = pp.addressing()[i];
853 if (relativeSizes[patchI] &&
f.size() > 3)
856 scalar edgeLen = edge0Len/(1<<ownLevel);
859 const point& fc = faceCentres[faceI];
860 const vector& fn = pp.faceNormals()[i];
867 vProj[fp] = (
n & fn);
871 scalar minVal =
min(vProj);
872 scalar maxVal =
max(vProj);
874 if ((maxVal - minVal) > faceRatio * edgeLen)
893 Info<<
"Set displacement to zero on "
895 <<
" warped faces since layer would be > " << faceRatio
896 <<
" of the size of the bounding box." <<
endl;
1003 void Foam::snappyLayerDriver::setNumLayers
1010 List<extrudeMode>& extrudeStatus,
1014 const fvMesh&
mesh = meshRefiner_.mesh();
1016 Info<<
nl <<
"Handling points with inconsistent layer specification ..."
1026 label patchi = patchIDs[i];
1030 label wantedLayers = patchToNLayers[patchi];
1032 forAll(meshPoints, patchPointi)
1034 label ppPointi = pp.meshPointMap()[meshPoints[patchPointi]];
1036 maxLayers[ppPointi] =
max(wantedLayers, maxLayers[ppPointi]);
1037 minLayers[ppPointi] =
min(wantedLayers, minLayers[ppPointi]);
1068 <<
"Patchpoint:" << i <<
" coord:" << pp.localPoints()[i]
1069 <<
" maxLayers:" << maxLayers
1070 <<
" minLayers:" << minLayers
1073 else if (maxLayers[i] == minLayers[i])
1076 patchNLayers[i] = maxLayers[i];
1094 patchNLayers[i] = maxLayers[i];
1101 forAll(pp.localFaces(), facei)
1103 const face&
f = pp.localFaces()[facei];
1109 nCells =
max(nCells, patchNLayers[
f[fp]]);
1112 nAddedCells += nCells;
1114 reduce(nAddedCells, sumOp<label>());
1127 Foam::snappyLayerDriver::makeLayerDisplacementField
1129 const pointMesh& pMesh,
1134 const pointBoundaryMesh& pointPatches = pMesh.boundary();
1138 pointPatches.size(),
1139 slipPointPatchVectorField::typeName
1141 wordList actualPatchTypes(patchFieldTypes.size());
1142 forAll(pointPatches, patchi)
1144 actualPatchTypes[patchi] = pointPatches[patchi].type();
1147 forAll(numLayers, patchi)
1151 if (numLayers[patchi] == 0)
1153 patchFieldTypes[patchi] =
1154 zeroFixedValuePointPatchVectorField::typeName;
1156 else if (numLayers[patchi] > 0)
1158 patchFieldTypes[patchi] = fixedValuePointPatchVectorField::typeName;
1162 forAll(pointPatches, patchi)
1164 if (isA<processorPointPatch>(pointPatches[patchi]))
1166 patchFieldTypes[patchi] = calculatedPointPatchVectorField::typeName;
1168 else if (isA<cyclicPointPatch>(pointPatches[patchi]))
1170 patchFieldTypes[patchi] = cyclicSlipPointPatchVectorField::typeName;
1175 const polyMesh&
mesh = pMesh();
1184 "pointDisplacement",
1198 void Foam::snappyLayerDriver::growNoExtrusion
1203 List<extrudeMode>& extrudeStatus
1206 Info<<
nl <<
"Growing non-extrusion points by one layer ..." <<
endl;
1208 List<extrudeMode> grownExtrudeStatus(extrudeStatus);
1210 const faceList& localFaces = pp.localFaces();
1214 forAll(localFaces, facei)
1216 const face&
f = localFaces[facei];
1218 bool hasSqueeze =
false;
1221 if (extrudeStatus[
f[fp]] == NOEXTRUDE)
1235 extrudeStatus[
f[fp]] == EXTRUDE
1236 && grownExtrudeStatus[
f[fp]] != NOEXTRUDE
1239 grownExtrudeStatus[
f[fp]] = NOEXTRUDE;
1246 extrudeStatus.transfer(grownExtrudeStatus);
1255 status[i] = extrudeStatus[i];
1259 meshRefiner_.mesh(),
1267 extrudeStatus[i] = extrudeMode(status[i]);
1272 forAll(extrudeStatus, patchPointi)
1274 if (extrudeStatus[patchPointi] == NOEXTRUDE)
1276 patchDisp[patchPointi] =
Zero;
1277 patchNLayers[patchPointi] = 0;
1281 reduce(nGrown, sumOp<label>());
1283 Info<<
"Set displacement to zero for an additional " << nGrown
1284 <<
" points." <<
endl;
1288 void Foam::snappyLayerDriver::determineSidePatches
1290 const globalIndex& globalFaces,
1306 fvMesh&
mesh = meshRefiner_.mesh();
1315 Map<label> nbrProcToPatch;
1316 Map<label> patchToNbrProc;
1337 Info<<
nl <<
"Adding in total " << nAdded/2 <<
" inter-processor patches to"
1338 <<
" handle extrusion of non-manifold processor boundaries."
1345 Map<label> wantedToAddedPatch;
1347 for (label patchi = nOldPatches; patchi <
nPatches; patchi++)
1349 label nbrProci = patchToNbrProc[patchi];
1355 dictionary patchDict;
1356 patchDict.add(
"type", processorPolyPatch::typeName);
1358 patchDict.add(
"neighbProcNo", nbrProci);
1359 patchDict.add(
"nFaces", 0);
1367 label procPatchi = meshRefiner_.appendPatch
1374 wantedToAddedPatch.insert(patchi, procPatchi);
1380 label patchi = edgePatchID[i];
1381 const auto fnd = wantedToAddedPatch.cfind(patchi);
1384 edgePatchID[i] = fnd.val();
1394 void Foam::snappyLayerDriver::calculateLayerThickness
1398 const layerParameters& layerParams,
1401 const scalar edge0Len,
1408 const fvMesh&
mesh = meshRefiner_.mesh();
1416 scalarField firstLayerThickness(pp.nPoints(), GREAT);
1417 scalarField finalLayerThickness(pp.nPoints(), GREAT);
1421 minThickness.setSize(pp.nPoints());
1422 minThickness = GREAT;
1424 thickness.setSize(pp.nPoints());
1427 expansionRatio.setSize(pp.nPoints());
1428 expansionRatio = GREAT;
1430 for (
const label patchi : patchIDs)
1434 forAll(meshPoints, patchPointi)
1436 label ppPointi = pp.meshPointMap()[meshPoints[patchPointi]];
1438 firstLayerThickness[ppPointi] =
min
1440 firstLayerThickness[ppPointi],
1441 layerParams.firstLayerThickness()[patchi]
1443 finalLayerThickness[ppPointi] =
min
1445 finalLayerThickness[ppPointi],
1446 layerParams.finalLayerThickness()[patchi]
1448 totalThickness[ppPointi] =
min
1450 totalThickness[ppPointi],
1451 layerParams.thickness()[patchi]
1453 expRatio[ppPointi] =
min
1456 layerParams.expansionRatio()[patchi]
1458 minThickness[ppPointi] =
min
1460 minThickness[ppPointi],
1461 layerParams.minThickness()[patchi]
1470 firstLayerThickness,
1478 finalLayerThickness,
1518 label ownLevel = cellLevel[
mesh.
faceOwner()[pp.addressing()[i]]];
1520 const face&
f = pp.localFaces()[i];
1524 maxPointLevel[
f[fp]] =
max(maxPointLevel[
f[fp]], ownLevel);
1552 for (
const label patchi : patchIDs)
1556 layerParams.layerModels()[patchi];
1557 const bool relSize = layerParams.relativeSizes()[patchi];
1559 for (
const label meshPointi : meshPoints)
1561 const label ppPointi = pp.meshPointMap()[meshPointi];
1566 edgeLen[ppPointi] =
min
1569 edge0Len/(1<<maxPointLevel[ppPointi])
1571 spec[ppPointi] =
max(spec[ppPointi], patchSpec);
1572 isRelativePoint[meshPointi] =
1573 isRelativePoint[meshPointi]
1598 orEqOp<unsigned int>(),
1605 forAll(pp.meshPoints(), pointi)
1607 const label meshPointi = pp.meshPoints()[pointi];
1615 finalLayerThickness[pointi] *= edgeLen[pointi];
1616 if (isRelativePoint[meshPointi])
1618 totalThickness[pointi] *= edgeLen[pointi];
1619 minThickness[pointi] *= edgeLen[pointi];
1622 else if (isRelativePoint[meshPointi])
1624 firstLayerThickness[pointi] *= edgeLen[pointi];
1625 finalLayerThickness[pointi] *= edgeLen[pointi];
1626 totalThickness[pointi] *= edgeLen[pointi];
1627 minThickness[pointi] *= edgeLen[pointi];
1630 thickness[pointi] =
min
1636 patchNLayers[pointi],
1637 firstLayerThickness[pointi],
1638 finalLayerThickness[pointi],
1639 totalThickness[pointi],
1643 expansionRatio[pointi] =
min
1645 expansionRatio[pointi],
1646 layerParameters::layerExpansionRatio
1649 patchNLayers[pointi],
1650 firstLayerThickness[pointi],
1651 finalLayerThickness[pointi],
1652 totalThickness[pointi],
1687 int oldPrecision =
Info().precision();
1690 label maxPatchNameLen = 0;
1693 label patchi = patchIDs[i];
1695 maxPatchNameLen =
max(maxPatchNameLen, label(patchName.size()));
1699 <<
setf(ios_base::left) <<
setw(maxPatchNameLen) <<
"patch"
1700 <<
setw(0) <<
" faces layers avg thickness[m]" <<
nl
1701 <<
setf(ios_base::left) <<
setw(maxPatchNameLen) <<
" "
1702 <<
setw(0) <<
" near-wall overall" <<
nl
1703 <<
setf(ios_base::left) <<
setw(maxPatchNameLen) <<
"-----"
1704 <<
setw(0) <<
" ----- ------ --------- -------" <<
endl;
1711 label patchi = patchIDs[i];
1715 layerParams.layerModels()[patchi];
1717 scalar sumThickness = 0;
1718 scalar sumNearWallThickness = 0;
1719 label nMasterPoints = 0;
1721 forAll(meshPoints, patchPointi)
1723 label meshPointi = meshPoints[patchPointi];
1724 if (isMasterPoint[meshPointi])
1726 label ppPointi = pp.meshPointMap()[meshPointi];
1728 sumThickness += thickness[ppPointi];
1729 sumNearWallThickness += layerParams.firstLayerThickness
1732 patchNLayers[ppPointi],
1733 firstLayerThickness[ppPointi],
1734 finalLayerThickness[ppPointi],
1735 thickness[ppPointi],
1736 expansionRatio[ppPointi]
1742 label totNPoints =
returnReduce(nMasterPoints, sumOp<label>());
1745 scalar avgThickness = 0;
1746 scalar avgNearWallThickness = 0;
1753 avgNearWallThickness =
1762 <<
" " <<
setw(6) << layerParams.numLayers()[patchi]
1763 <<
" " <<
setw(8) << avgNearWallThickness
1764 <<
" " <<
setw(8) << avgThickness
1773 void Foam::snappyLayerDriver::syncPatchDisplacement
1779 List<extrudeMode>& extrudeStatus
1782 const fvMesh&
mesh = meshRefiner_.mesh();
1783 const labelList& meshPoints = pp.meshPoints();
1785 label nChangedTotal = 0;
1797 minMagSqrEqOp<vector>(),
1804 if (
mag(patchDisp[i]) < minThickness[i])
1822 labelList syncPatchNLayers(patchNLayers);
1835 forAll(syncPatchNLayers, i)
1837 if (syncPatchNLayers[i] != patchNLayers[i])
1866 forAll(syncPatchNLayers, i)
1868 if (syncPatchNLayers[i] != patchNLayers[i])
1885 nChangedTotal += nChanged;
1904 void Foam::snappyLayerDriver::getPatchDisplacement
1913 List<extrudeMode>& extrudeStatus
1916 Info<<
nl <<
"Determining displacement for added points"
1917 <<
" according to pointNormal ..." <<
endl;
1919 const fvMesh&
mesh = meshRefiner_.mesh();
1922 const pointField& localPoints = pp.localPoints();
1934 patchDisp = thickness*pointNormals;
1937 label nNoVisNormal = 0;
1938 label nExtrudeRemove = 0;
2034 forAll(pointNormals, patchPointi)
2036 label meshPointi = pp.meshPoints()[patchPointi];
2038 if (extrudeStatus[patchPointi] == NOEXTRUDE)
2041 patchNLayers[patchPointi] = 0;
2042 patchDisp[patchPointi] =
Zero;
2047 const vector&
n = pointNormals[patchPointi];
2053 Pout<<
"No valid normal for point " << meshPointi
2054 <<
' ' << pp.points()[meshPointi]
2055 <<
"; setting displacement to "
2056 << patchDisp[patchPointi]
2060 extrudeStatus[patchPointi] = EXTRUDEREMOVE;
2067 forAll(extrudeStatus, patchPointi)
2069 if (extrudeStatus[patchPointi] == EXTRUDEREMOVE)
2074 const labelList& pEdges = pp.pointEdges()[patchPointi];
2078 label edgei = pEdges[i];
2080 label otherPointi = pp.edges()[edgei].otherVertex(patchPointi);
2082 if (extrudeStatus[otherPointi] != NOEXTRUDE)
2084 avg += localPoints[otherPointi] + patchDisp[otherPointi];
2093 Pout<<
"Displacement at illegal point "
2094 << localPoints[patchPointi]
2096 << (avg /
nPoints - localPoints[patchPointi])
2100 patchDisp[patchPointi] =
2102 - localPoints[patchPointi];
2115 <<
" points with point normal pointing through faces." <<
nl
2116 <<
"Reset displacement at "
2118 <<
" points to average of surrounding points." <<
endl;
2121 syncPatchDisplacement
2134 bool Foam::snappyLayerDriver::sameEdgeNeighbour
2137 const label myGlobalFacei,
2138 const label nbrGlobFacei,
2142 const labelList& eFaces = globalEdgeFaces[edgei];
2143 if (eFaces.size() == 2)
2145 return edge(myGlobalFacei, nbrGlobFacei) == edge(eFaces[0], eFaces[1]);
2152 void Foam::snappyLayerDriver::getVertexString
2158 const label myGlobFacei,
2159 const label nbrGlobFacei,
2163 const labelList& fEdges = pp.faceEdges()[facei];
2164 label fp = fEdges.find(edgei);
2177 label prevFp = fEdges.rcIndex(startFp);
2197 label nextFp = fEdges.fcIndex(endFp);
2214 const face&
f = pp.localFaces()[facei];
2231 Foam::label Foam::snappyLayerDriver::truncateDisplacement
2233 const globalIndex& globalFaces,
2237 const faceSet& illegalPatchFaces,
2240 List<extrudeMode>& extrudeStatus
2243 const fvMesh&
mesh = meshRefiner_.mesh();
2247 const Map<label>& meshPointMap = pp.meshPointMap();
2249 for (
const label facei : illegalPatchFaces)
2254 <<
"Faceset " << illegalPatchFaces.name()
2255 <<
" contains internal face " << facei <<
nl
2264 const auto fnd = meshPointMap.cfind(
f[fp]);
2267 const label patchPointi = fnd.val();
2269 if (extrudeStatus[patchPointi] != NOEXTRUDE)
2284 forAll(patchDisp, patchPointi)
2286 if (
mag(patchDisp[patchPointi]) < minThickness[patchPointi])
2302 else if (extrudeStatus[patchPointi] == NOEXTRUDE)
2305 patchDisp[patchPointi] =
Zero;
2306 patchNLayers[patchPointi] = 0;
2311 const faceList& localFaces = pp.localFaces();
2315 syncPatchDisplacement
2336 const face& localF = localFaces[i];
2341 extrudeMode prevMode = extrudeStatus[localF.prevLabel(0)];
2345 extrudeMode fpMode = extrudeStatus[localF[fp]];
2347 if (prevMode == NOEXTRUDE && fpMode != NOEXTRUDE)
2374 reduce(nPinched, sumOp<label>());
2376 Info<<
"truncateDisplacement : Unextruded " << nPinched
2377 <<
" faces due to non-consecutive vertices being extruded." <<
endl;
2400 label nButterFly = 0;
2402 DynamicList<label> stringedVerts;
2403 forAll(pp.edges(), edgei)
2405 const labelList& globFaces = edgeGlobalFaces[edgei];
2407 if (globFaces.size() == 2)
2409 label myFacei = pp.edgeFaces()[edgei][0];
2410 label myGlobalFacei = globalFaces.toGlobal
2412 pp.addressing()[myFacei]
2414 label nbrGlobalFacei =
2416 globFaces[0] != myGlobalFacei
2433 extrudeStatus[stringedVerts[0]] != NOEXTRUDE
2434 || extrudeStatus[stringedVerts.last()] != NOEXTRUDE
2439 for (label i = 1; i < stringedVerts.size()-1; i++)
2441 if (extrudeStatus[stringedVerts[i]] == NOEXTRUDE)
2472 reduce(nButterFly, sumOp<label>());
2474 Info<<
"truncateDisplacement : Unextruded " << nButterFly
2475 <<
" faces due to stringed edges with inconsistent extrusion."
2486 label nDiffering = 0;
2530 if (nPinched+nButterFly+nDiffering == 0)
2542 void Foam::snappyLayerDriver::setupLayerInfoTruncation
2546 const List<extrudeMode>& extrudeStatus,
2547 const label nBufferCellsNoExtrude,
2552 Info<<
nl <<
"Setting up information for layer truncation ..." <<
endl;
2554 const fvMesh&
mesh = meshRefiner_.mesh();
2556 if (nBufferCellsNoExtrude < 0)
2558 Info<<
nl <<
"Performing no layer truncation."
2559 <<
" nBufferCellsNoExtrude set to less than 0 ..." <<
endl;
2562 forAll(pp.localFaces(), patchFacei)
2564 const face&
f = pp.localFaces()[patchFacei];
2568 const label nPointLayers = patchNLayers[
f[fp]];
2569 if (nPointLayers > 0)
2571 if (nPatchFaceLayers[patchFacei] == -1)
2573 nPatchFaceLayers[patchFacei] = nPointLayers;
2577 nPatchFaceLayers[patchFacei] =
min
2579 nPatchFaceLayers[patchFacei],
2586 nPatchPointLayers = patchNLayers;
2589 forAll(nPatchFaceLayers, patchFacei)
2591 if (nPatchFaceLayers[patchFacei] == -1)
2593 nPatchFaceLayers[patchFacei] = 0;
2602 forAll(pp.localFaces(), patchFacei)
2604 const face&
f = pp.localFaces()[patchFacei];
2609 bool noExtrude =
false;
2614 if (extrudeStatus[
f[fp]] == NOEXTRUDE)
2618 mLevel =
max(mLevel, patchNLayers[
f[fp]]);
2628 nPatchFaceLayers[patchFacei] = 1;
2629 maxLevel[patchFacei] = mLevel;
2633 maxLevel[patchFacei] = mLevel;
2645 label nLevels =
gMax(patchNLayers);
2648 for (label ilevel = 1; ilevel < nLevels; ilevel++)
2654 nBuffer = nBufferCellsNoExtrude - 1;
2658 nBuffer = nBufferCellsNoExtrude;
2661 for (label ibuffer = 0; ibuffer < nBuffer + 1; ibuffer++)
2663 labelList tempCounter(nPatchFaceLayers);
2665 boolList foundNeighbour(pp.nPoints(),
false);
2667 forAll(pp.meshPoints(), patchPointi)
2669 forAll(pointFaces[patchPointi], pointFacei)
2671 label facei = pointFaces[patchPointi][pointFacei];
2675 nPatchFaceLayers[facei] != -1
2676 && maxLevel[facei] > 0
2679 foundNeighbour[patchPointi] =
true;
2694 forAll(pp.meshPoints(), patchPointi)
2696 if (foundNeighbour[patchPointi])
2698 forAll(pointFaces[patchPointi], pointFacei)
2700 label facei = pointFaces[patchPointi][pointFacei];
2703 nPatchFaceLayers[facei] == -1
2704 && maxLevel[facei] > 0
2705 && ilevel < maxLevel[facei]
2708 tempCounter[facei] = ilevel;
2713 nPatchFaceLayers = tempCounter;
2717 forAll(pp.localFaces(), patchFacei)
2719 if (nPatchFaceLayers[patchFacei] == -1)
2721 nPatchFaceLayers[patchFacei] = maxLevel[patchFacei];
2725 forAll(pp.meshPoints(), patchPointi)
2727 if (extrudeStatus[patchPointi] != NOEXTRUDE)
2729 forAll(pointFaces[patchPointi], pointFacei)
2731 label face = pointFaces[patchPointi][pointFacei];
2732 nPatchPointLayers[patchPointi] =
max
2734 nPatchPointLayers[patchPointi],
2735 nPatchFaceLayers[face]
2741 nPatchPointLayers[patchPointi] = 0;
2757 bool Foam::snappyLayerDriver::cellsUseFace
2759 const polyMesh&
mesh,
2766 const cell& cFaces =
mesh.
cells()[cellLabels[i]];
2770 if (faces.found(cFaces[cFacei]))
2784 Foam::label Foam::snappyLayerDriver::checkAndUnmark
2786 const addPatchCellLayer& addLayer,
2787 const dictionary& meshQualityDict,
2788 const bool additionalReporting,
2789 const List<labelPair>& baffles,
2791 const fvMesh& newMesh,
2795 List<extrudeMode>& extrudeStatus
2799 Info<<
nl <<
"Checking mesh with layer ..." <<
endl;
2800 faceSet wrongFaces(newMesh,
"wrongFaces", newMesh.nFaces()/1000);
2813 <<
" (concave, zero area or negative cell pyramid volume)"
2827 addLayer.layerFaces()
2835 const label nReportMax = 10;
2836 DynamicField<point> disabledFaceCentres(nReportMax);
2838 forAll(addedCells, oldPatchFacei)
2842 const labelList& fCells = addedCells[oldPatchFacei];
2844 if (cellsUseFace(newMesh, fCells, wrongFaces))
2851 pp.localFaces()[oldPatchFacei],
2858 if (additionalReporting && (nChanged < nReportMax))
2860 disabledFaceCentres.
append
2862 pp.faceCentres()[oldPatchFacei]
2872 label nChangedTotal =
returnReduce(nChanged, sumOp<label>());
2874 if (additionalReporting)
2883 label nReportLocal = nChanged;
2884 if (nChangedTotal > nReportMax)
2899 Pout<<
"Checked mesh with layers. Disabled extrusion at " <<
endl;
2900 for (label i=0; i < nReportLocal; i++)
2902 Pout<<
" " << disabledFaceCentres[i] <<
endl;
2906 label nReportTotal =
returnReduce(nReportLocal, sumOp<label>());
2908 if (nReportTotal < nChangedTotal)
2910 Info<<
"Suppressed disabled extrusion message for other "
2911 << nChangedTotal - nReportTotal <<
" faces." <<
endl;
2915 return nChangedTotal;
2920 Foam::label Foam::snappyLayerDriver::countExtrusion
2923 const List<extrudeMode>& extrudeStatus
2927 label nExtruded = 0;
2929 const faceList& localFaces = pp.localFaces();
2933 const face& localFace = localFaces[i];
2937 if (extrudeStatus[localFace[fp]] != NOEXTRUDE)
2952 const polyMesh&
mesh,
2954 const List<labelPair>& baffles
2963 Map<label> baffleSet(4*baffles.size());
2966 baffleSet.insert(baffles[bafflei][0], bafflei);
2967 baffleSet.insert(baffles[bafflei][1], bafflei);
2971 List<labelPair> newBaffles(baffles.size(),
labelPair(-1, -1));
2979 label oldFacei = newToOldFaces[facei];
2981 const auto faceFnd = baffleSet.find(oldFacei);
2982 if (faceFnd.found())
2984 label bafflei = faceFnd();
2990 else if (
p[1] == -1)
2997 <<
"Problem:" << facei <<
" at:"
2999 <<
" is on same baffle as " <<
p[0]
3012 void Foam::snappyLayerDriver::getLayerCellsFaces
3014 const polyMesh&
mesh,
3015 const addPatchCellLayer& addLayer,
3025 faceRealThickness = 0;
3033 forAll(addedCells, oldPatchFacei)
3035 const labelList& added = addedCells[oldPatchFacei];
3037 const labelList& layer = layerFaces[oldPatchFacei];
3044 cellNLayers[added[i]] = layer.size()-1;
3049 forAll(layerFaces, oldPatchFacei)
3051 const labelList& layer = layerFaces[oldPatchFacei];
3052 const scalar realThickness = oldRealThickness[oldPatchFacei];
3058 for (label i = 1; i < layer.size(); i++)
3060 faceRealThickness[layer[i]] = realThickness;
3067 void Foam::snappyLayerDriver::printLayerData
3078 int oldPrecision =
Info().precision();
3081 label maxPatchNameLen = 0;
3084 label patchi = patchIDs[i];
3085 word patchName = pbm[patchi].name();
3086 maxPatchNameLen =
max(maxPatchNameLen, label(patchName.size()));
3090 <<
setf(ios_base::left) <<
setw(maxPatchNameLen) <<
"patch"
3091 <<
setw(0) <<
" faces layers overall thickness" <<
nl
3092 <<
setf(ios_base::left) <<
setw(maxPatchNameLen) <<
" "
3093 <<
setw(0) <<
" [m] [%]" <<
nl
3094 <<
setf(ios_base::left) <<
setw(maxPatchNameLen) <<
"-----"
3095 <<
setw(0) <<
" ----- ------ --- ---" <<
endl;
3100 label patchi = patchIDs[i];
3101 const polyPatch& pp = pbm[patchi];
3103 label sumSize = pp.size();
3106 const labelList& faceCells = pp.faceCells();
3107 label sumNLayers = 0;
3110 sumNLayers += cellNLayers[faceCells[i]];
3123 scalar sumRealThickness =
sum(patchReal);
3124 scalar sumFraction = 0;
3127 if (patchWanted[i] > VSMALL)
3129 sumFraction += (patchReal[i]/patchWanted[i]);
3134 reduce(sumSize, sumOp<label>());
3135 reduce(sumNLayers, sumOp<label>());
3136 reduce(sumRealThickness, sumOp<scalar>());
3137 reduce(sumFraction, sumOp<scalar>());
3140 scalar avgLayers = 0;
3142 scalar avgFraction = 0;
3145 avgLayers = scalar(sumNLayers)/sumSize;
3146 avgReal = sumRealThickness/sumSize;
3147 avgFraction = sumFraction/sumSize;
3152 <<
" " <<
setw(8) << sumSize
3153 <<
" " <<
setw(8) << avgLayers
3154 <<
" " <<
setw(8) << avgReal
3155 <<
" " <<
setw(8) << 100*avgFraction
3162 bool Foam::snappyLayerDriver::writeLayerSets
3172 forAll(cellNLayers, celli)
3174 if (cellNLayers[celli] > 0)
3179 cellSet addedCellSet(
mesh,
"addedCells", nAdded);
3180 forAll(cellNLayers, celli)
3182 if (cellNLayers[celli] > 0)
3184 addedCellSet.insert(celli);
3187 addedCellSet.instance() = meshRefiner_.timeName();
3190 <<
" added cells to cellSet "
3191 << addedCellSet.name() <<
endl;
3192 bool ok = addedCellSet.
write();
3193 allOk = allOk && ok;
3199 if (faceRealThickness[facei] > 0)
3205 faceSet layerFacesSet(
mesh,
"layerFaces", nAdded);
3208 if (faceRealThickness[facei] > 0)
3210 layerFacesSet.insert(facei);
3213 layerFacesSet.instance() = meshRefiner_.timeName();
3216 <<
" faces inside added layer to faceSet "
3217 << layerFacesSet.name() <<
endl;
3218 bool ok = layerFacesSet.
write();
3219 allOk = allOk && ok;
3225 bool Foam::snappyLayerDriver::writeLayerData
3238 bool ok = writeLayerSets(
mesh, cellNLayers, faceRealThickness);
3239 allOk = allOk && ok;
3260 fixedValueFvPatchScalarField::typeName
3264 fld[celli] = cellNLayers[celli];
3266 volScalarField::Boundary& fldBf =
fld.boundaryFieldRef();
3271 label patchi = patchIDs[i];
3272 const polyPatch& pp = pbm[patchi];
3273 const labelList& faceCells = pp.faceCells();
3277 pfld[i] = cellNLayers[faceCells[i]];
3279 fldBf[patchi] == pfld;
3283 bool ok =
fld.write();
3284 allOk = allOk && ok;
3300 fixedValueFvPatchScalarField::typeName
3302 volScalarField::Boundary& fldBf =
fld.boundaryFieldRef();
3306 label patchi = patchIDs[i];
3307 fldBf[patchi] == pbm[patchi].patchSlice(faceRealThickness);
3311 bool ok =
fld.write();
3312 allOk = allOk && ok;
3319 "thicknessFraction",
3328 fixedValueFvPatchScalarField::typeName
3330 volScalarField::Boundary& fldBf =
fld.boundaryFieldRef();
3334 label patchi = patchIDs[i];
3349 if (patchWanted[i] > VSMALL)
3351 pfld[i] = patchReal[i]/patchWanted[i];
3355 fldBf[patchi] == pfld;
3358 <<
" : overall layer thickness (fraction"
3359 <<
" of desired thickness)" <<
endl;
3360 bool ok =
fld.write();
3361 allOk = allOk && ok;
3372 Foam::snappyLayerDriver::snappyLayerDriver
3380 meshRefiner_(meshRefiner),
3381 globalToMasterPatch_(globalToMasterPatch),
3382 globalToSlavePatch_(globalToSlavePatch),
3404 <<
"Merging all faces of a cell" <<
nl
3405 <<
"---------------------------" <<
nl
3406 <<
" - which are on the same patch" <<
nl
3407 <<
" - which make an angle < " << planarAngle
3409 <<
" (cos:" << minCos <<
')' <<
nl
3410 <<
" - as long as the resulting face doesn't become concave"
3413 <<
" (0=straight, 180=fully concave)" <<
nl
3424 duplicateFace[cpl[0]] = cpl[1];
3425 duplicateFace[cpl[1]] = cpl[0];
3428 label nChanged = meshRefiner_.mergePatchFacesUndo
3432 meshRefiner_.meshedPatches(),
3438 nChanged += meshRefiner_.mergeEdgesUndo(minCos, motionDict);
3447 const label nAllowableErrors,
3461 internalOrBaffleFaceZones = meshRefiner_.getZones(fzTypes);
3468 meshRefiner_.getZones
3483 meshRefiner_.createZoneBaffles
3493 Info<<
"Writing baffled mesh to time "
3494 << meshRefiner_.timeName() <<
endl;
3518 label f0 = reverseFaceMap[baffles[i].first()];
3519 label f1 = reverseFaceMap[baffles[i].second()];
3538 bool hasInfo = meshRefiner_.getFaceZoneInfo
3548 if (layerIDs.
found(mpi) && !layerIDs.
found(spi))
3552 <<
" adding layers to master patch " << pbm[mpi].
name()
3553 <<
" only. Freezing points on slave patch "
3557 else if (!layerIDs.
found(mpi) && layerIDs.
found(spi))
3561 <<
" adding layers to slave patch " << pbm[spi].
name()
3562 <<
" only. Freezing points on master patch "
3597 label nIdealTotAddedCells = 0;
3614 syncPatchDisplacement
3628 forAll(extrudeStatus, patchPointi)
3630 label pointi = pp().meshPoints()[patchPointi];
3631 minPatchState[pointi] = extrudeStatus[patchPointi];
3649 forAll(minPatchState, pointi)
3651 label state = minPatchState[pointi];
3652 if (state == EXTRUDE || state == EXTRUDEREMOVE)
3659 forAll(minPatchState, pointi)
3661 label state = minPatchState[pointi];
3662 if (state == EXTRUDE || state == EXTRUDEREMOVE)
3664 candidatePoints[
n++] = pointi;
3682 bool hasInfo = meshRefiner_.getFaceZoneInfo
3689 if (hasInfo && !layerIDs.found(mpi) && !layerIDs.found(spi))
3691 nonDupZones.append(zonei);
3715 const labelList& pointMap = map().pointMap();
3716 const labelList& reversePointMap = map().reversePointMap();
3720 label oldPointi = pointMap[pointi];
3721 label newMasterPointi = reversePointMap[oldPointi];
3723 if (newMasterPointi != pointi)
3726 pointToMaster[pointi] = newMasterPointi;
3727 pointToMaster[newMasterPointi] = newMasterPointi;
3733 const labelList& reverseFaceMap = map().reverseFaceMap();
3736 label f0 = reverseFaceMap[baffles[i].first()];
3737 label f1 = reverseFaceMap[baffles[i].second()];
3746 Info<<
"Writing point-duplicate mesh to time "
3747 << meshRefiner_.timeName() <<
endl;
3763 /
"duplicatePoints_"
3764 + meshRefiner_.timeName()
3767 Info<<
"Writing point-duplicates to " << str.name() <<
endl;
3771 label newMasteri = reversePointMap[pointMap[pointi]];
3773 if (newMasteri != pointi)
3826 determineSidePatches
3851 label nIdealTotAddedCells = 0;
3880 handleNonStringConnected
3924 const scalar edge0Len =
3925 meshRefiner_.meshCutter().level0EdgeLength();
3926 const labelList& cellLevel = meshRefiner_.meshCutter().cellLevel();
3957 for (label i = 0; i < layerParams.
nGrow(); i++)
3971 const scalar edge0Len = meshRefiner_.meshCutter().level0EdgeLength();
3972 const labelList& cellLevel = meshRefiner_.meshCutter().cellLevel();
3982 meshRefiner_.timeName(),
3989 calculateLayerThickness
4016 avgPointData(*pp, thickness);
4024 makeLayerDisplacementField
4037 combinedDict.
merge(motionDict);
4039 combinedDict.add(
"minThicknessName", minThickness.name());
4067 if (errorMsg.size() || IOerrorMsg.size())
4076 <<
"Missing/incorrect required dictionary entries:"
4078 << IOerrorMsg.c_str() <<
nl
4079 << errorMsg.c_str() <<
nl <<
nl
4080 <<
"Exiting dry-run" <<
nl <<
endl;
4084 Perr<<
"\nFOAM parallel run exiting\n" <<
endl;
4102 label iteration = 0;
4108 <<
"Layer addition iteration " << iteration <<
nl
4109 <<
"--------------------------" <<
endl;
4117 : motionDict.
subDict(
"relaxed")
4122 Info<<
"Switched to relaxed meshQuality constraints." <<
endl;
4131 syncPatchDisplacement
4141 getPatchDisplacement
4157 const pointField oldPatchPos(pp().localPoints());
4162 patchDisp = -patchDisp;
4181 combinedDict.
merge(motionDict);
4183 combinedDict.merge(meshQualityDict);
4185 combinedDict.add(
"minThicknessName", minThickness.name());
4188 medialAxisMoverPtr().move
4198 patchDisp = oldPatchPos - pp().localPoints();
4205 truncateDisplacement
4230 Info<<
"Writing shrunk mesh to time "
4231 << meshRefiner_.timeName() <<
endl;
4260 labelList nPatchFaceLayers(pp().size(), -1);
4261 setupLayerInfoTruncation
4275 forAll(nPatchPointLayers, i)
4279 nPatchPointLayers[i],
4282 finalDisp[i] = ratio*patchDisp[i];
4286 const scalarField invExpansionRatio(1.0/expansionRatio);
4317 savedMeshMod = meshMod;
4339 fvMesh& newMesh = *newMeshPtr;
4343 addProfiling(grow,
"snappyHexMesh::layers::updateMesh");
4365 avgPointData(*pp,
mag(patchDisp))(),
4373 label nAddedCells = 0;
4374 forAll(cellNLayers, celli)
4376 if (cellNLayers[celli] > 0)
4385 Info<<
"Writing layer mesh to time " << meshRefiner_.timeName()
4388 writeLayerSets(newMesh, cellNLayers, faceRealThickness);
4407 facei < newMesh.
nFaces();
4411 label newMeshFacei = map.
faceMap()[facei];
4412 if (newMeshFacei != -1)
4414 meshToNewMesh[newMeshFacei] = facei;
4425 meshToNewMesh[
p[0]],
4428 if (newMeshBaffle[0] != -1 && newMeshBaffle[1] != -1)
4430 newMeshBaffles[newi++] = newMeshBaffle;
4433 newMeshBaffles.setSize(newi);
4444 <<
" baffles across faceZones of type internal" <<
nl
4448 label nTotChanged = checkAndUnmark
4462 label nTotExtruded = countExtrusion(*pp, extrudeStatus);
4466 Info<<
"Extruding " << nTotExtruded
4467 <<
" out of " << nTotFaces
4468 <<
" faces (" << 100.0*nTotExtruded/nTotFaces <<
"%)."
4469 <<
" Removed extrusion at " << nTotChanged <<
" faces."
4471 <<
"Added " << nTotAddedCells <<
" out of "
4472 << nIdealTotAddedCells
4473 <<
" cells (" << 100.0*nTotAddedCells/nIdealTotAddedCells
4476 if (nTotChanged == 0)
4484 medialAxisMoverPtr().movePoints(
mesh.
points());
4487 for (label i = 0; i < layerParams.
nGrow(); i++)
4532 meshRefiner_.updateMesh(map,
labelList(0));
4549 faceWantedThickness,
4558 Info<<
"Writing mesh with layers but disconnected to time "
4559 << meshRefiner_.timeName() <<
endl;
4586 oldBaffleFace.set(baffle[0]);
4587 oldBaffleFace.set(baffle[1]);
4600 label oldFacei = map.
faceMap()[facei];
4601 if (oldFacei != -1 && oldBaffleFace.test(oldFacei))
4606 label pointi =
f[fp];
4607 label oldPointi = map.
pointMap()[pointi];
4609 if (pointToMaster[oldPointi] != -1)
4611 candidates.
append(pointi);
4628 meshRefiner_.mergeDistance(),
4644 const labelList& oldPoints = newToOld[newi];
4645 if (oldPoints.size() > 1)
4651 label masteri =
min(meshPoints);
4654 pointToMaster[meshPoints[i]] = masteri;
4666 label nPointPairs = 0;
4667 forAll(pointToMaster, pointi)
4669 label otherPointi = pointToMaster[pointi];
4670 if (otherPointi != -1)
4676 if (nPointPairs > 0)
4679 Info<<
"Merging " << nPointPairs <<
" duplicated points ..." <<
endl;
4687 + meshRefiner_.timeName()
4690 Info<<
"Points to be merged to " << str.name() <<
endl;
4691 forAll(pointToMaster, pointi)
4693 label otherPointi = pointToMaster[pointi];
4694 if (otherPointi != -1)
4709 const labelList& reverseFaceMap = map().reverseFaceMap();
4713 Info<<
"Merged points in = "
4721 Info<<
"Converting baffles back into zoned faces ..."
4739 forAll(newFaceRealThickness, facei)
4741 label oldFacei =
faceMap[facei];
4744 scalar& realThick = newFaceRealThickness[facei];
4745 realThick =
max(realThick, faceRealThickness[oldFacei]);
4746 scalar& wanted = newFaceWantedThickness[facei];
4747 wanted =
max(wanted, faceWantedThickness[oldFacei]);
4750 faceRealThickness.transfer(newFaceRealThickness);
4751 faceWantedThickness.transfer(newFaceWantedThickness);
4754 Info<<
"Converted baffles in = "
4755 << meshRefiner_.mesh().time().cpuTimeIncrement()
4765 <<
"Doing final balancing" <<
nl
4766 <<
"---------------------" <<
nl
4785 map().distributeCellData(cellNLayers);
4786 map().distributeFaceData(faceWantedThickness);
4787 map().distributeFaceData(faceRealThickness);
4801 faceWantedThickness,
4814 const bool preBalance,
4823 <<
"Shrinking and layer addition phase" <<
nl
4824 <<
"----------------------------------" <<
nl
4828 Info<<
"Using mesh parameters " << motionDict <<
nl <<
endl;
4833 mergeType == meshRefinement::FaceMergeType::GEOMETRIC
4834 || mergeType == meshRefinement::FaceMergeType::IGNOREPATCH
4837 mergePatchFacesUndo(layerParams, motionDict, mergeType);
4846 label nFacesWithLayers = 0;
4847 forAll(numLayers, patchi)
4849 if (numLayers[patchi] > 0)
4861 <<
"Ignoring layers on coupled patch " << pp.
name()
4873 meshRefiner_.getFaceZoneInfo(fZones[zonei].
name(), mpi, spi, fzType);
4875 if (numLayers[mpi] > 0)
4877 nFacesWithLayers += fZones[zonei].size();
4879 if (numLayers[spi] > 0)
4881 nFacesWithLayers += fZones[zonei].size();
4890 Info<<
nl <<
"No layers to generate ..." <<
endl;
4895 checkMeshManifold();
4898 Info<<
"Checking initial mesh ..." <<
endl;
4907 Info<<
"Detected " << nInitErrors <<
" illegal faces"
4908 <<
" (concave, zero area or negative cell pyramid volume)"
4912 bool faceZoneOnCoupledFace =
false;
4926 const faceZone& fZone = fZones[zonei];
4931 meshRefiner_.getFaceZoneInfo(fzName, mpi, spi, fzType);
4933 if (numLayers[mpi] > 0 || numLayers[spi])
4935 isExtrudedZoneFace.set(fZone);
4952 if (intOrCoupled[facei] && isExtrudedZoneFace.
test(facei))
4954 faceZoneOnCoupledFace =
true;
4969 <<
"Doing initial balancing" <<
nl
4970 <<
"-----------------------" <<
nl
4974 forAll(numLayers, patchi)
4976 if (numLayers[patchi] > 0)
4981 cellWeights[pp.
faceCells()[i]] += numLayers[patchi];
4990 const faceZone& fZone = fZones[zonei];
4995 meshRefiner_.getFaceZoneInfo(fzName, mpi, spi, fzType);
4997 if (numLayers[mpi] > 0)
5004 if (cellIDs[i] >= 0)
5006 cellWeights[cellIDs[i]] += numLayers[mpi];
5010 if (numLayers[spi] > 0)
5015 if (cellIDs[i] >= 0)
5017 cellWeights[cellIDs[i]] += numLayers[mpi];