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],
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;
2031 forAll(pointNormals, patchPointi)
2033 label meshPointi = pp.meshPoints()[patchPointi];
2035 if (extrudeStatus[patchPointi] == NOEXTRUDE)
2038 patchNLayers[patchPointi] = 0;
2039 patchDisp[patchPointi] =
Zero;
2044 const vector&
n = pointNormals[patchPointi];
2050 Pout<<
"No valid normal for point " << meshPointi
2051 <<
' ' << pp.points()[meshPointi]
2052 <<
"; setting displacement to "
2053 << patchDisp[patchPointi]
2057 extrudeStatus[patchPointi] = EXTRUDEREMOVE;
2064 forAll(extrudeStatus, patchPointi)
2066 if (extrudeStatus[patchPointi] == EXTRUDEREMOVE)
2071 const labelList& pEdges = pp.pointEdges()[patchPointi];
2075 label edgei = pEdges[i];
2077 label otherPointi = pp.edges()[edgei].otherVertex(patchPointi);
2079 if (extrudeStatus[otherPointi] != NOEXTRUDE)
2081 avg += localPoints[otherPointi] + patchDisp[otherPointi];
2090 Pout<<
"Displacement at illegal point "
2091 << localPoints[patchPointi]
2093 << (avg /
nPoints - localPoints[patchPointi])
2097 patchDisp[patchPointi] =
2099 - localPoints[patchPointi];
2112 <<
" points with point normal pointing through faces." <<
nl
2113 <<
"Reset displacement at "
2115 <<
" points to average of surrounding points." <<
endl;
2118 syncPatchDisplacement
2131 bool Foam::snappyLayerDriver::sameEdgeNeighbour
2134 const label myGlobalFacei,
2135 const label nbrGlobFacei,
2139 const labelList& eFaces = globalEdgeFaces[edgei];
2140 if (eFaces.size() == 2)
2142 return edge(myGlobalFacei, nbrGlobFacei) == edge(eFaces[0], eFaces[1]);
2149 void Foam::snappyLayerDriver::getVertexString
2155 const label myGlobFacei,
2156 const label nbrGlobFacei,
2160 const labelList& fEdges = pp.faceEdges()[facei];
2161 label fp = fEdges.find(edgei);
2174 label prevFp = fEdges.rcIndex(startFp);
2194 label nextFp = fEdges.fcIndex(endFp);
2211 const face&
f = pp.localFaces()[facei];
2228 Foam::label Foam::snappyLayerDriver::truncateDisplacement
2230 const globalIndex& globalFaces,
2234 const faceSet& illegalPatchFaces,
2237 List<extrudeMode>& extrudeStatus
2240 const fvMesh&
mesh = meshRefiner_.mesh();
2244 const Map<label>& meshPointMap = pp.meshPointMap();
2246 for (
const label facei : illegalPatchFaces)
2251 <<
"Faceset " << illegalPatchFaces.name()
2252 <<
" contains internal face " << facei <<
nl
2261 const auto fnd = meshPointMap.cfind(
f[fp]);
2264 const label patchPointi = fnd.val();
2266 if (extrudeStatus[patchPointi] != NOEXTRUDE)
2281 forAll(patchDisp, patchPointi)
2283 if (
mag(patchDisp[patchPointi]) < minThickness[patchPointi])
2299 else if (extrudeStatus[patchPointi] == NOEXTRUDE)
2302 patchDisp[patchPointi] =
Zero;
2303 patchNLayers[patchPointi] = 0;
2308 const faceList& localFaces = pp.localFaces();
2312 syncPatchDisplacement
2333 const face& localF = localFaces[i];
2338 extrudeMode prevMode = extrudeStatus[localF.prevLabel(0)];
2342 extrudeMode fpMode = extrudeStatus[localF[fp]];
2344 if (prevMode == NOEXTRUDE && fpMode != NOEXTRUDE)
2371 reduce(nPinched, sumOp<label>());
2373 Info<<
"truncateDisplacement : Unextruded " << nPinched
2374 <<
" faces due to non-consecutive vertices being extruded." <<
endl;
2397 label nButterFly = 0;
2399 DynamicList<label> stringedVerts;
2400 forAll(pp.edges(), edgei)
2402 const labelList& globFaces = edgeGlobalFaces[edgei];
2404 if (globFaces.size() == 2)
2406 label myFacei = pp.edgeFaces()[edgei][0];
2407 label myGlobalFacei = globalFaces.toGlobal
2409 pp.addressing()[myFacei]
2411 label nbrGlobalFacei =
2413 globFaces[0] != myGlobalFacei
2430 extrudeStatus[stringedVerts[0]] != NOEXTRUDE
2431 || extrudeStatus[stringedVerts.last()] != NOEXTRUDE
2436 for (label i = 1; i < stringedVerts.size()-1; i++)
2438 if (extrudeStatus[stringedVerts[i]] == NOEXTRUDE)
2469 reduce(nButterFly, sumOp<label>());
2471 Info<<
"truncateDisplacement : Unextruded " << nButterFly
2472 <<
" faces due to stringed edges with inconsistent extrusion."
2483 label nDiffering = 0;
2527 if (nPinched+nButterFly+nDiffering == 0)
2539 void Foam::snappyLayerDriver::setupLayerInfoTruncation
2543 const List<extrudeMode>& extrudeStatus,
2544 const label nBufferCellsNoExtrude,
2549 Info<<
nl <<
"Setting up information for layer truncation ..." <<
endl;
2551 const fvMesh&
mesh = meshRefiner_.mesh();
2553 if (nBufferCellsNoExtrude < 0)
2555 Info<<
nl <<
"Performing no layer truncation."
2556 <<
" nBufferCellsNoExtrude set to less than 0 ..." <<
endl;
2559 forAll(pp.localFaces(), patchFacei)
2561 const face&
f = pp.localFaces()[patchFacei];
2565 const label nPointLayers = patchNLayers[
f[fp]];
2566 if (nPointLayers > 0)
2568 if (nPatchFaceLayers[patchFacei] == -1)
2570 nPatchFaceLayers[patchFacei] = nPointLayers;
2574 nPatchFaceLayers[patchFacei] =
min
2576 nPatchFaceLayers[patchFacei],
2583 nPatchPointLayers = patchNLayers;
2586 forAll(nPatchFaceLayers, patchFacei)
2588 if (nPatchFaceLayers[patchFacei] == -1)
2590 nPatchFaceLayers[patchFacei] = 0;
2599 forAll(pp.localFaces(), patchFacei)
2601 const face&
f = pp.localFaces()[patchFacei];
2606 bool noExtrude =
false;
2611 if (extrudeStatus[
f[fp]] == NOEXTRUDE)
2615 mLevel =
max(mLevel, patchNLayers[
f[fp]]);
2625 nPatchFaceLayers[patchFacei] = 1;
2626 maxLevel[patchFacei] = mLevel;
2630 maxLevel[patchFacei] = mLevel;
2642 label nLevels =
gMax(patchNLayers);
2645 for (label ilevel = 1; ilevel < nLevels; ilevel++)
2651 nBuffer = nBufferCellsNoExtrude - 1;
2655 nBuffer = nBufferCellsNoExtrude;
2658 for (label ibuffer = 0; ibuffer < nBuffer + 1; ibuffer++)
2660 labelList tempCounter(nPatchFaceLayers);
2662 boolList foundNeighbour(pp.nPoints(),
false);
2664 forAll(pp.meshPoints(), patchPointi)
2666 forAll(pointFaces[patchPointi], pointFacei)
2668 label facei = pointFaces[patchPointi][pointFacei];
2672 nPatchFaceLayers[facei] != -1
2673 && maxLevel[facei] > 0
2676 foundNeighbour[patchPointi] =
true;
2691 forAll(pp.meshPoints(), patchPointi)
2693 if (foundNeighbour[patchPointi])
2695 forAll(pointFaces[patchPointi], pointFacei)
2697 label facei = pointFaces[patchPointi][pointFacei];
2700 nPatchFaceLayers[facei] == -1
2701 && maxLevel[facei] > 0
2702 && ilevel < maxLevel[facei]
2705 tempCounter[facei] = ilevel;
2710 nPatchFaceLayers = tempCounter;
2714 forAll(pp.localFaces(), patchFacei)
2716 if (nPatchFaceLayers[patchFacei] == -1)
2718 nPatchFaceLayers[patchFacei] = maxLevel[patchFacei];
2722 forAll(pp.meshPoints(), patchPointi)
2724 if (extrudeStatus[patchPointi] != NOEXTRUDE)
2726 forAll(pointFaces[patchPointi], pointFacei)
2728 label face = pointFaces[patchPointi][pointFacei];
2729 nPatchPointLayers[patchPointi] =
max
2731 nPatchPointLayers[patchPointi],
2732 nPatchFaceLayers[face]
2738 nPatchPointLayers[patchPointi] = 0;
2754 bool Foam::snappyLayerDriver::cellsUseFace
2756 const polyMesh&
mesh,
2763 const cell& cFaces =
mesh.
cells()[cellLabels[i]];
2767 if (faces.found(cFaces[cFacei]))
2781 Foam::label Foam::snappyLayerDriver::checkAndUnmark
2783 const addPatchCellLayer& addLayer,
2784 const dictionary& meshQualityDict,
2785 const bool additionalReporting,
2786 const List<labelPair>& baffles,
2788 const fvMesh& newMesh,
2792 List<extrudeMode>& extrudeStatus
2796 Info<<
nl <<
"Checking mesh with layer ..." <<
endl;
2797 faceSet wrongFaces(newMesh,
"wrongFaces", newMesh.nFaces()/1000);
2810 <<
" (concave, zero area or negative cell pyramid volume)"
2824 addLayer.layerFaces()
2832 const label nReportMax = 10;
2833 DynamicField<point> disabledFaceCentres(nReportMax);
2835 forAll(addedCells, oldPatchFacei)
2839 const labelList& fCells = addedCells[oldPatchFacei];
2841 if (cellsUseFace(newMesh, fCells, wrongFaces))
2848 pp.localFaces()[oldPatchFacei],
2855 if (additionalReporting && (nChanged < nReportMax))
2857 disabledFaceCentres.
append
2859 pp.faceCentres()[oldPatchFacei]
2869 label nChangedTotal =
returnReduce(nChanged, sumOp<label>());
2871 if (additionalReporting)
2880 label nReportLocal = nChanged;
2881 if (nChangedTotal > nReportMax)
2896 Pout<<
"Checked mesh with layers. Disabled extrusion at " <<
endl;
2897 for (label i=0; i < nReportLocal; i++)
2899 Pout<<
" " << disabledFaceCentres[i] <<
endl;
2903 label nReportTotal =
returnReduce(nReportLocal, sumOp<label>());
2905 if (nReportTotal < nChangedTotal)
2907 Info<<
"Suppressed disabled extrusion message for other "
2908 << nChangedTotal - nReportTotal <<
" faces." <<
endl;
2912 return nChangedTotal;
2917 Foam::label Foam::snappyLayerDriver::countExtrusion
2920 const List<extrudeMode>& extrudeStatus
2924 label nExtruded = 0;
2926 const faceList& localFaces = pp.localFaces();
2930 const face& localFace = localFaces[i];
2934 if (extrudeStatus[localFace[fp]] != NOEXTRUDE)
2949 const polyMesh&
mesh,
2951 const List<labelPair>& baffles
2960 Map<label> baffleSet(4*baffles.size());
2963 baffleSet.insert(baffles[bafflei][0], bafflei);
2964 baffleSet.insert(baffles[bafflei][1], bafflei);
2968 List<labelPair> newBaffles(baffles.size(),
labelPair(-1, -1));
2976 label oldFacei = newToOldFaces[facei];
2978 const auto faceFnd = baffleSet.find(oldFacei);
2979 if (faceFnd.found())
2981 label bafflei = faceFnd();
2987 else if (
p[1] == -1)
2994 <<
"Problem:" << facei <<
" at:"
2996 <<
" is on same baffle as " <<
p[0]
3009 void Foam::snappyLayerDriver::getLayerCellsFaces
3011 const polyMesh&
mesh,
3012 const addPatchCellLayer& addLayer,
3022 faceRealThickness = 0;
3030 forAll(addedCells, oldPatchFacei)
3032 const labelList& added = addedCells[oldPatchFacei];
3034 const labelList& layer = layerFaces[oldPatchFacei];
3041 cellNLayers[added[i]] = layer.size()-1;
3046 forAll(layerFaces, oldPatchFacei)
3048 const labelList& layer = layerFaces[oldPatchFacei];
3049 const scalar realThickness = oldRealThickness[oldPatchFacei];
3055 for (label i = 1; i < layer.size(); i++)
3057 faceRealThickness[layer[i]] = realThickness;
3064 void Foam::snappyLayerDriver::printLayerData
3078 label maxPatchNameLen = 0;
3081 label patchi = patchIDs[i];
3082 word patchName = pbm[patchi].name();
3083 maxPatchNameLen =
max(maxPatchNameLen, label(patchName.size()));
3087 <<
setf(ios_base::left) <<
setw(maxPatchNameLen) <<
"patch"
3088 <<
setw(0) <<
" faces layers overall thickness" <<
nl
3089 <<
setf(ios_base::left) <<
setw(maxPatchNameLen) <<
" "
3090 <<
setw(0) <<
" [m] [%]" <<
nl
3091 <<
setf(ios_base::left) <<
setw(maxPatchNameLen) <<
"-----"
3092 <<
setw(0) <<
" ----- ------ --- ---" <<
endl;
3097 label patchi = patchIDs[i];
3098 const polyPatch& pp = pbm[patchi];
3100 label sumSize = pp.size();
3103 const labelList& faceCells = pp.faceCells();
3104 label sumNLayers = 0;
3107 sumNLayers += cellNLayers[faceCells[i]];
3120 scalar sumRealThickness =
sum(patchReal);
3121 scalar sumFraction = 0;
3124 if (patchWanted[i] > VSMALL)
3126 sumFraction += (patchReal[i]/patchWanted[i]);
3131 reduce(sumSize, sumOp<label>());
3132 reduce(sumNLayers, sumOp<label>());
3133 reduce(sumRealThickness, sumOp<scalar>());
3134 reduce(sumFraction, sumOp<scalar>());
3137 scalar avgLayers = 0;
3139 scalar avgFraction = 0;
3142 avgLayers = scalar(sumNLayers)/sumSize;
3143 avgReal = sumRealThickness/sumSize;
3144 avgFraction = sumFraction/sumSize;
3149 <<
" " <<
setw(8) << sumSize
3150 <<
" " <<
setw(8) << avgLayers
3151 <<
" " <<
setw(8) << avgReal
3152 <<
" " <<
setw(8) << 100*avgFraction
3159 bool Foam::snappyLayerDriver::writeLayerSets
3169 forAll(cellNLayers, celli)
3171 if (cellNLayers[celli] > 0)
3176 cellSet addedCellSet(
mesh,
"addedCells", nAdded);
3177 forAll(cellNLayers, celli)
3179 if (cellNLayers[celli] > 0)
3181 addedCellSet.insert(celli);
3184 addedCellSet.instance() = meshRefiner_.timeName();
3187 <<
" added cells to cellSet "
3188 << addedCellSet.name() <<
endl;
3189 bool ok = addedCellSet.
write();
3190 allOk = allOk && ok;
3196 if (faceRealThickness[facei] > 0)
3202 faceSet layerFacesSet(
mesh,
"layerFaces", nAdded);
3205 if (faceRealThickness[facei] > 0)
3207 layerFacesSet.insert(facei);
3210 layerFacesSet.instance() = meshRefiner_.timeName();
3213 <<
" faces inside added layer to faceSet "
3214 << layerFacesSet.name() <<
endl;
3215 bool ok = layerFacesSet.
write();
3216 allOk = allOk && ok;
3222 bool Foam::snappyLayerDriver::writeLayerData
3235 bool ok = writeLayerSets(
mesh, cellNLayers, faceRealThickness);
3236 allOk = allOk && ok;
3257 fixedValueFvPatchScalarField::typeName
3261 fld[celli] = cellNLayers[celli];
3263 volScalarField::Boundary& fldBf =
fld.boundaryFieldRef();
3268 label patchi = patchIDs[i];
3269 const polyPatch& pp = pbm[patchi];
3270 const labelList& faceCells = pp.faceCells();
3274 pfld[i] = cellNLayers[faceCells[i]];
3276 fldBf[patchi] == pfld;
3280 bool ok =
fld.write();
3281 allOk = allOk && ok;
3297 fixedValueFvPatchScalarField::typeName
3299 volScalarField::Boundary& fldBf =
fld.boundaryFieldRef();
3303 label patchi = patchIDs[i];
3304 fldBf[patchi] == pbm[patchi].patchSlice(faceRealThickness);
3308 bool ok =
fld.write();
3309 allOk = allOk && ok;
3316 "thicknessFraction",
3325 fixedValueFvPatchScalarField::typeName
3327 volScalarField::Boundary& fldBf =
fld.boundaryFieldRef();
3331 label patchi = patchIDs[i];
3346 if (patchWanted[i] > VSMALL)
3348 pfld[i] = patchReal[i]/patchWanted[i];
3352 fldBf[patchi] == pfld;
3355 <<
" : overall layer thickness (fraction"
3356 <<
" of desired thickness)" <<
endl;
3357 bool ok =
fld.write();
3358 allOk = allOk && ok;
3369 Foam::snappyLayerDriver::snappyLayerDriver
3377 meshRefiner_(meshRefiner),
3378 globalToMasterPatch_(globalToMasterPatch),
3379 globalToSlavePatch_(globalToSlavePatch),
3401 <<
"Merging all faces of a cell" <<
nl
3402 <<
"---------------------------" <<
nl
3403 <<
" - which are on the same patch" <<
nl
3404 <<
" - which make an angle < " << planarAngle
3406 <<
" (cos:" << minCos <<
')' <<
nl
3407 <<
" - as long as the resulting face doesn't become concave"
3410 <<
" (0=straight, 180=fully concave)" <<
nl
3421 duplicateFace[cpl[0]] = cpl[1];
3422 duplicateFace[cpl[1]] = cpl[0];
3425 label nChanged = meshRefiner_.mergePatchFacesUndo
3429 meshRefiner_.meshedPatches(),
3435 nChanged += meshRefiner_.mergeEdgesUndo(minCos, motionDict);
3444 const label nAllowableErrors,
3458 internalOrBaffleFaceZones = meshRefiner_.getZones(fzTypes);
3465 meshRefiner_.getZones
3480 meshRefiner_.createZoneBaffles
3490 Info<<
"Writing baffled mesh to time "
3491 << meshRefiner_.timeName() <<
endl;
3515 label f0 = reverseFaceMap[baffles[i].first()];
3516 label f1 = reverseFaceMap[baffles[i].second()];
3535 bool hasInfo = meshRefiner_.getFaceZoneInfo
3545 if (layerIDs.found(mpi) && !layerIDs.found(spi))
3549 <<
" adding layers to master patch " << pbm[mpi].
name()
3550 <<
" only. Freezing points on slave patch "
3554 else if (!layerIDs.found(mpi) && layerIDs.found(spi))
3558 <<
" adding layers to slave patch " << pbm[spi].
name()
3559 <<
" only. Freezing points on master patch "
3594 label nIdealTotAddedCells = 0;
3611 syncPatchDisplacement
3625 forAll(extrudeStatus, patchPointi)
3627 label pointi = pp().meshPoints()[patchPointi];
3628 minPatchState[pointi] = extrudeStatus[patchPointi];
3646 forAll(minPatchState, pointi)
3648 label state = minPatchState[pointi];
3649 if (state == EXTRUDE || state == EXTRUDEREMOVE)
3656 forAll(minPatchState, pointi)
3658 label state = minPatchState[pointi];
3659 if (state == EXTRUDE || state == EXTRUDEREMOVE)
3661 candidatePoints[
n++] = pointi;
3679 bool hasInfo = meshRefiner_.getFaceZoneInfo
3686 if (hasInfo && !layerIDs.found(mpi) && !layerIDs.found(spi))
3688 nonDupZones.append(zonei);
3712 const labelList& pointMap = map().pointMap();
3713 const labelList& reversePointMap = map().reversePointMap();
3717 label oldPointi = pointMap[pointi];
3718 label newMasterPointi = reversePointMap[oldPointi];
3720 if (newMasterPointi != pointi)
3723 pointToMaster[pointi] = newMasterPointi;
3724 pointToMaster[newMasterPointi] = newMasterPointi;
3730 const labelList& reverseFaceMap = map().reverseFaceMap();
3733 label f0 = reverseFaceMap[baffles[i].first()];
3734 label f1 = reverseFaceMap[baffles[i].second()];
3743 Info<<
"Writing point-duplicate mesh to time "
3744 << meshRefiner_.timeName() <<
endl;
3760 /
"duplicatePoints_"
3761 + meshRefiner_.timeName()
3764 Info<<
"Writing point-duplicates to " << str.name() <<
endl;
3768 label newMasteri = reversePointMap[pointMap[pointi]];
3770 if (newMasteri != pointi)
3823 determineSidePatches
3848 label nIdealTotAddedCells = 0;
3877 handleNonStringConnected
3921 const scalar edge0Len =
3922 meshRefiner_.meshCutter().level0EdgeLength();
3923 const labelList& cellLevel = meshRefiner_.meshCutter().cellLevel();
3954 for (label i = 0; i < layerParams.
nGrow(); i++)
3968 const scalar edge0Len = meshRefiner_.meshCutter().level0EdgeLength();
3969 const labelList& cellLevel = meshRefiner_.meshCutter().cellLevel();
3979 meshRefiner_.timeName(),
3986 calculateLayerThickness
4013 avgPointData(*pp, thickness);
4021 makeLayerDisplacementField
4034 combinedDict.
merge(motionDict);
4036 combinedDict.add(
"minThicknessName", minThickness.name());
4064 if (errorMsg.size() || IOerrorMsg.size())
4073 <<
"Missing/incorrect required dictionary entries:"
4075 << IOerrorMsg.c_str() <<
nl
4076 << errorMsg.c_str() <<
nl <<
nl
4077 <<
"Exiting dry-run" <<
nl <<
endl;
4081 Perr<<
"\nFOAM parallel run exiting\n" <<
endl;
4099 label iteration = 0;
4105 <<
"Layer addition iteration " << iteration <<
nl
4106 <<
"--------------------------" <<
endl;
4114 : motionDict.
subDict(
"relaxed")
4119 Info<<
"Switched to relaxed meshQuality constraints." <<
endl;
4128 syncPatchDisplacement
4138 getPatchDisplacement
4154 const pointField oldPatchPos(pp().localPoints());
4159 patchDisp = -patchDisp;
4178 combinedDict.
merge(motionDict);
4180 combinedDict.merge(meshQualityDict);
4182 combinedDict.add(
"minThicknessName", minThickness.name());
4185 medialAxisMoverPtr().move
4195 patchDisp = oldPatchPos - pp().localPoints();
4202 truncateDisplacement
4227 Info<<
"Writing shrunk mesh to time "
4228 << meshRefiner_.timeName() <<
endl;
4257 labelList nPatchFaceLayers(pp().size(), -1);
4258 setupLayerInfoTruncation
4272 forAll(nPatchPointLayers, i)
4276 nPatchPointLayers[i],
4279 finalDisp[i] = ratio*patchDisp[i];
4283 const scalarField invExpansionRatio(1.0/expansionRatio);
4314 savedMeshMod = meshMod;
4336 fvMesh& newMesh = *newMeshPtr;
4340 addProfiling(grow,
"snappyHexMesh::layers::updateMesh");
4362 avgPointData(*pp,
mag(patchDisp))(),
4370 label nAddedCells = 0;
4371 forAll(cellNLayers, celli)
4373 if (cellNLayers[celli] > 0)
4382 Info<<
"Writing layer mesh to time " << meshRefiner_.timeName()
4385 writeLayerSets(newMesh, cellNLayers, faceRealThickness);
4404 facei < newMesh.
nFaces();
4408 label newMeshFacei = map.
faceMap()[facei];
4409 if (newMeshFacei != -1)
4411 meshToNewMesh[newMeshFacei] = facei;
4422 meshToNewMesh[
p[0]],
4425 if (newMeshBaffle[0] != -1 && newMeshBaffle[1] != -1)
4427 newMeshBaffles[newi++] = newMeshBaffle;
4430 newMeshBaffles.setSize(newi);
4441 <<
" baffles across faceZones of type internal" <<
nl
4445 label nTotChanged = checkAndUnmark
4459 label nTotExtruded = countExtrusion(*pp, extrudeStatus);
4463 Info<<
"Extruding " << nTotExtruded
4464 <<
" out of " << nTotFaces
4465 <<
" faces (" << 100.0*nTotExtruded/nTotFaces <<
"%)."
4466 <<
" Removed extrusion at " << nTotChanged <<
" faces."
4468 <<
"Added " << nTotAddedCells <<
" out of "
4469 << nIdealTotAddedCells
4470 <<
" cells (" << 100.0*nTotAddedCells/nIdealTotAddedCells
4473 if (nTotChanged == 0)
4481 medialAxisMoverPtr().movePoints(
mesh.
points());
4484 for (label i = 0; i < layerParams.
nGrow(); i++)
4529 meshRefiner_.updateMesh(map,
labelList(0));
4546 faceWantedThickness,
4555 Info<<
"Writing mesh with layers but disconnected to time "
4556 << meshRefiner_.timeName() <<
endl;
4583 oldBaffleFace.set(baffle[0]);
4584 oldBaffleFace.set(baffle[1]);
4597 label oldFacei = map.
faceMap()[facei];
4598 if (oldFacei != -1 && oldBaffleFace.test(oldFacei))
4603 label pointi =
f[fp];
4604 label oldPointi = map.
pointMap()[pointi];
4606 if (pointToMaster[oldPointi] != -1)
4608 candidates.
append(pointi);
4625 meshRefiner_.mergeDistance(),
4641 const labelList& oldPoints = newToOld[newi];
4642 if (oldPoints.size() > 1)
4648 label masteri =
min(meshPoints);
4651 pointToMaster[meshPoints[i]] = masteri;
4663 label nPointPairs = 0;
4664 forAll(pointToMaster, pointi)
4666 label otherPointi = pointToMaster[pointi];
4667 if (otherPointi != -1)
4673 if (nPointPairs > 0)
4676 Info<<
"Merging " << nPointPairs <<
" duplicated points ..." <<
endl;
4684 + meshRefiner_.timeName()
4687 Info<<
"Points to be merged to " << str.name() <<
endl;
4688 forAll(pointToMaster, pointi)
4690 label otherPointi = pointToMaster[pointi];
4691 if (otherPointi != -1)
4706 const labelList& reverseFaceMap = map().reverseFaceMap();
4710 Info<<
"Merged points in = "
4718 Info<<
"Converting baffles back into zoned faces ..."
4736 forAll(newFaceRealThickness, facei)
4738 label oldFacei =
faceMap[facei];
4741 scalar& realThick = newFaceRealThickness[facei];
4742 realThick =
max(realThick, faceRealThickness[oldFacei]);
4743 scalar& wanted = newFaceWantedThickness[facei];
4744 wanted =
max(wanted, faceWantedThickness[oldFacei]);
4747 faceRealThickness.transfer(newFaceRealThickness);
4748 faceWantedThickness.transfer(newFaceWantedThickness);
4751 Info<<
"Converted baffles in = "
4752 << meshRefiner_.mesh().time().cpuTimeIncrement()
4762 <<
"Doing final balancing" <<
nl
4763 <<
"---------------------" <<
nl
4782 map().distributeCellData(cellNLayers);
4783 map().distributeFaceData(faceWantedThickness);
4784 map().distributeFaceData(faceRealThickness);
4798 faceWantedThickness,
4811 const bool preBalance,
4820 <<
"Shrinking and layer addition phase" <<
nl
4821 <<
"----------------------------------" <<
nl
4825 Info<<
"Using mesh parameters " << motionDict <<
nl <<
endl;
4830 mergeType == meshRefinement::FaceMergeType::GEOMETRIC
4831 || mergeType == meshRefinement::FaceMergeType::IGNOREPATCH
4834 mergePatchFacesUndo(layerParams, motionDict, mergeType);
4843 label nFacesWithLayers = 0;
4844 forAll(numLayers, patchi)
4846 if (numLayers[patchi] > 0)
4858 <<
"Ignoring layers on coupled patch " << pp.
name()
4870 meshRefiner_.getFaceZoneInfo(fZones[zonei].
name(), mpi, spi, fzType);
4872 if (numLayers[mpi] > 0)
4874 nFacesWithLayers += fZones[zonei].size();
4876 if (numLayers[spi] > 0)
4878 nFacesWithLayers += fZones[zonei].size();
4887 Info<<
nl <<
"No layers to generate ..." <<
endl;
4892 checkMeshManifold();
4895 Info<<
"Checking initial mesh ..." <<
endl;
4904 Info<<
"Detected " << nInitErrors <<
" illegal faces"
4905 <<
" (concave, zero area or negative cell pyramid volume)"
4909 bool faceZoneOnCoupledFace =
false;
4923 const faceZone& fZone = fZones[zonei];
4928 meshRefiner_.getFaceZoneInfo(fzName, mpi, spi, fzType);
4930 if (numLayers[mpi] > 0 || numLayers[spi])
4932 isExtrudedZoneFace.set(fZone);
4949 if (intOrCoupled[facei] && isExtrudedZoneFace.
test(facei))
4951 faceZoneOnCoupledFace =
true;
4966 <<
"Doing initial balancing" <<
nl
4967 <<
"-----------------------" <<
nl
4971 forAll(numLayers, patchi)
4973 if (numLayers[patchi] > 0)
4978 cellWeights[pp.
faceCells()[i]] += numLayers[patchi];
4987 const faceZone& fZone = fZones[zonei];
4992 meshRefiner_.getFaceZoneInfo(fzName, mpi, spi, fzType);
4994 if (numLayers[mpi] > 0)
5001 if (cellIDs[i] >= 0)
5003 cellWeights[cellIDs[i]] += numLayers[mpi];
5007 if (numLayers[spi] > 0)
5012 if (cellIDs[i] >= 0)
5014 cellWeights[cellIDs[i]] += numLayers[mpi];