Go to the documentation of this file.
50 #include "PatchTools.H"
83 Info<<
"Writing all displacements to " << dispStr.
name() <<
endl;
85 forAll(patchDisp, patchPointI)
92 OBJstream illStr(prefix +
"_illegal.obj");
93 Info<<
"Writing invalid displacements to " << illStr.
name() <<
endl;
95 forAll(patchDisp, patchPointI)
97 if (extrudeStatus[patchPointI] != EXTRUDE)
122 faceFld[faceI] += pointFld[
f[fp]];
124 faceFld[faceI] /=
f.size();
147 const labelList& eFaces = edgeFaces[edgeI];
149 if (eFaces.
size() > 2)
164 Info<<
nl <<
"Checking mesh manifoldness ..." <<
endl;
169 for (
label faceI =
mesh.nInternalFaces(); faceI <
mesh.nFaces(); faceI++)
171 outsideFaces[faceI -
mesh.nInternalFaces()] = faceI;
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
216 const label patchPointI,
222 if (extrudeStatus[patchPointI] == EXTRUDE)
224 extrudeStatus[patchPointI] = NOEXTRUDE;
225 patchNLayers[patchPointI] = 0;
229 else if (extrudeStatus[patchPointI] == EXTRUDEREMOVE)
231 extrudeStatus[patchPointI] = NOEXTRUDE;
232 patchNLayers[patchPointI] = 0;
246 const face& localFace,
252 bool unextruded =
false;
287 Info<<
nl <<
"Handling non-manifold points ..." <<
endl;
290 Info<<
nl <<
"Checking patch manifoldness ..." <<
endl;
295 checkManifold(pp, nonManifoldPoints);
298 forAll(edgeGlobalFaces, edgeI)
303 && edgeGlobalFaces[edgeI].
size() > 2
322 isCoupledEdge[cpEdges[i]] =
true;
332 forAll(edgeGlobalFaces, edgeI)
334 label meshEdgeI = meshEdges[edgeI];
339 && edgeGlobalFaces[edgeI].
size() == 1
340 && isCoupledEdge[meshEdgeI]
358 Info<<
"Outside of local patch is multiply connected across edges or"
359 <<
" points at " << nNonManif <<
" points." <<
endl;
365 forAll(meshPoints, patchPointI)
367 if (nonManifoldPoints.
found(meshPoints[patchPointI]))
380 Info<<
"Set displacement to zero for all " << nNonManif
381 <<
" non-manifold points" <<
endl;
398 Info<<
nl <<
"Handling feature edges ..." <<
endl;
400 if (minCos < 1-SMALL)
411 label meshEdgeI = meshEdges[edgeI];
417 edgeNormal[meshEdgeI],
440 + meshRefiner_.timeName()
444 Info<<
"Writing feature edges to " << str().name() <<
endl;
455 label meshEdgeI = meshEdges[edgeI];
457 const vector&
n = edgeNormal[meshEdgeI];
494 Info<<
"Set displacement to zero for points on "
496 <<
" feature edges" <<
endl;
508 const scalar faceRatio,
509 const scalar edge0Len,
518 Info<<
nl <<
"Handling cells with warped patch faces ..." <<
nl;
522 label nWarpedFaces = 0;
526 const face&
f = pp[i];
530 label faceI = pp.addressing()[i];
533 scalar edgeLen = edge0Len/(1<<ownLevel);
544 vProj[fp] = (
n & fn);
548 scalar minVal =
min(vProj);
549 scalar maxVal =
max(vProj);
551 if ((maxVal - minVal) > faceRatio * edgeLen)
570 Info<<
"Set displacement to zero on "
572 <<
" warped faces since layer would be > " << faceRatio
573 <<
" of the size of the bounding box." <<
endl;
693 Info<<
nl <<
"Handling points with inconsistent layer specification ..."
703 label patchI = patchIDs[i];
707 label wantedLayers = patchToNLayers[patchI];
709 forAll(meshPoints, patchPointI)
713 maxLayers[ppPointI] =
max(wantedLayers, maxLayers[ppPointI]);
714 minLayers[ppPointI] =
min(wantedLayers, minLayers[ppPointI]);
745 <<
"Patchpoint:" << i <<
" coord:" << pp.
localPoints()[i]
746 <<
" maxLayers:" << maxLayers
747 <<
" minLayers:" << minLayers
750 else if (maxLayers[i] == minLayers[i])
753 patchNLayers[i] = maxLayers[i];
771 patchNLayers[i] = maxLayers[i];
786 nCells =
max(nCells, patchNLayers[
f[fp]]);
789 nAddedCells += nCells;
816 slipPointPatchVectorField::typeName
819 forAll(pointPatches, patchI)
821 actualPatchTypes[patchI] = pointPatches[patchI].type();
828 if (numLayers[patchI] == 0)
830 patchFieldTypes[patchI] =
831 zeroFixedValuePointPatchVectorField::typeName;
833 else if (numLayers[patchI] > 0)
835 patchFieldTypes[patchI] = fixedValuePointPatchVectorField::typeName;
839 forAll(pointPatches, patchI)
841 if (isA<processorPointPatch>(pointPatches[patchI]))
843 patchFieldTypes[patchI] = calculatedPointPatchVectorField::typeName;
845 else if (isA<cyclicPointPatch>(pointPatches[patchI]))
847 patchFieldTypes[patchI] = cyclicSlipPointPatchVectorField::typeName;
886 Info<<
nl <<
"Growing non-extrusion points by one layer ..." <<
endl;
896 const face&
f = localFaces[faceI];
898 bool hasSqueeze =
false;
901 if (extrudeStatus[
f[fp]] == NOEXTRUDE)
915 extrudeStatus[
f[fp]] == EXTRUDE
916 && grownExtrudeStatus[
f[fp]] != NOEXTRUDE
919 grownExtrudeStatus[
f[fp]] = NOEXTRUDE;
926 extrudeStatus.
transfer(grownExtrudeStatus);
935 status[i] = extrudeStatus[i];
952 forAll(extrudeStatus, patchPointI)
954 if (extrudeStatus[patchPointI] == NOEXTRUDE)
957 patchNLayers[patchPointI] = 0;
963 Info<<
"Set displacement to zero for an additional " << nGrown
964 <<
" points." <<
endl;
1014 Info<<
nl <<
"Adding in total " << nAdded/2 <<
" inter-processor patches to"
1015 <<
" handle extrusion of non-manifold processor boundaries."
1024 for (
label patchI = nOldPatches; patchI <
nPatches; patchI++)
1026 label nbrProcI = patchToNbrProc[patchI];
1034 patchDict.
add(
"type", processorPolyPatch::typeName);
1036 patchDict.
add(
"neighbProcNo", nbrProcI);
1037 patchDict.
add(
"nFaces", 0);
1045 label procPatchI = meshRefiner_.appendPatch
1052 wantedToAddedPatch.insert(patchI, procPatchI);
1058 label patchI = edgePatchID[i];
1060 if (fnd != wantedToAddedPatch.end())
1062 edgePatchID[i] = fnd();
1079 const scalar edge0Len,
1099 minThickness.setSize(pp.
nPoints());
1100 minThickness = GREAT;
1104 label patchI = patchIDs[i];
1108 forAll(meshPoints, patchPointI)
1112 firstLayerThickness[ppPointI] =
min
1114 firstLayerThickness[ppPointI],
1117 finalLayerThickness[ppPointI] =
min
1119 finalLayerThickness[ppPointI],
1122 totalThickness[ppPointI] =
min
1124 totalThickness[ppPointI],
1127 expRatio[ppPointI] =
min
1132 minThickness[ppPointI] =
min
1134 minThickness[ppPointI],
1144 firstLayerThickness,
1152 finalLayerThickness,
1199 <<
"Thickness should be factor of local undistorted cell size."
1200 <<
" Valid values are [0..2]." <<
nl
1219 maxPointLevel[
f[fp]] =
max(maxPointLevel[
f[fp]], ownLevel);
1233 forAll(maxPointLevel, pointI)
1236 scalar edgeLen = edge0Len/(1<<maxPointLevel[pointI]);
1237 firstLayerThickness[pointI] *= edgeLen;
1238 finalLayerThickness[pointI] *= edgeLen;
1239 totalThickness[pointI] *= edgeLen;
1240 minThickness[pointI] *= edgeLen;
1249 forAll(firstLayerThickness, pointI)
1253 patchNLayers[pointI],
1254 firstLayerThickness[pointI],
1255 finalLayerThickness[pointI],
1256 totalThickness[pointI],
1262 patchNLayers[pointI],
1263 firstLayerThickness[pointI],
1264 finalLayerThickness[pointI],
1265 totalThickness[pointI],
1277 int oldPrecision =
Info().precision();
1280 label maxPatchNameLen = 0;
1283 label patchI = patchIDs[i];
1285 maxPatchNameLen =
max(maxPatchNameLen,
label(patchName.size()));
1289 <<
setf(ios_base::left) <<
setw(maxPatchNameLen) <<
"patch"
1290 <<
setw(0) <<
" faces layers avg thickness[m]" <<
nl
1291 <<
setf(ios_base::left) <<
setw(maxPatchNameLen) <<
" "
1292 <<
setw(0) <<
" near-wall overall" <<
nl
1293 <<
setf(ios_base::left) <<
setw(maxPatchNameLen) <<
"-----"
1294 <<
setw(0) <<
" ----- ------ --------- -------" <<
endl;
1301 label patchI = patchIDs[i];
1305 scalar sumThickness = 0;
1306 scalar sumNearWallThickness = 0;
1307 label nMasterPoints = 0;
1309 forAll(meshPoints, patchPointI)
1311 label meshPointI = meshPoints[patchPointI];
1312 if (isMasterPoint[meshPointI])
1316 sumThickness += thickness[ppPointI];
1319 patchNLayers[ppPointI],
1320 firstLayerThickness[ppPointI],
1321 finalLayerThickness[ppPointI],
1322 thickness[ppPointI],
1323 expansionRatio[ppPointI]
1332 scalar avgThickness = 0;
1333 scalar avgNearWallThickness = 0;
1340 avgNearWallThickness =
1350 <<
" " <<
setw(8) << avgNearWallThickness
1351 <<
" " <<
setw(8) << avgThickness
1372 label nChangedTotal = 0;
1391 if (
mag(patchDisp[i]) < minThickness[i])
1409 labelList syncPatchNLayers(patchNLayers);
1422 forAll(syncPatchNLayers, i)
1424 if (syncPatchNLayers[i] != patchNLayers[i])
1453 forAll(syncPatchNLayers, i)
1455 if (syncPatchNLayers[i] != patchNLayers[i])
1472 nChangedTotal += nChanged;
1501 Info<<
nl <<
"Determining displacement for added points"
1502 <<
" according to pointNormal ..." <<
endl;
1519 patchDisp = thickness*pointNormals;
1522 label nNoVisNormal = 0;
1523 label nExtrudeRemove = 0;
1527 forAll(pointNormals, patchPointI)
1531 if (extrudeStatus[patchPointI] == NOEXTRUDE)
1534 patchNLayers[patchPointI] = 0;
1540 const vector&
n = pointNormals[patchPointI];
1546 Pout<<
"No valid normal for point " << meshPointI
1547 <<
' ' << pp.
points()[meshPointI]
1548 <<
"; setting displacement to "
1549 << patchDisp[patchPointI]
1553 extrudeStatus[patchPointI] = EXTRUDEREMOVE;
1560 forAll(extrudeStatus, patchPointI)
1562 if (extrudeStatus[patchPointI] == EXTRUDEREMOVE)
1571 label edgeI = pEdges[i];
1573 label otherPointI = pp.
edges()[edgeI].otherVertex(patchPointI);
1575 if (extrudeStatus[otherPointI] != NOEXTRUDE)
1577 avg += localPoints[otherPointI] + patchDisp[otherPointI];
1586 Pout<<
"Displacement at illegal point "
1587 << localPoints[patchPointI]
1589 << (avg /
nPoints - localPoints[patchPointI])
1593 patchDisp[patchPointI] =
1595 - localPoints[patchPointI];
1608 <<
" points with point normal pointing through faces." <<
nl
1609 <<
"Reset displacement at "
1611 <<
" points to average of surrounding points." <<
endl;
1614 syncPatchDisplacement
1630 const label myGlobalFaceI,
1631 const label nbrGlobFaceI,
1635 const labelList& eFaces = globalEdgeFaces[edgeI];
1636 if (eFaces.
size() == 2)
1638 return edge(myGlobalFaceI, nbrGlobFaceI) ==
edge(eFaces[0], eFaces[1]);
1653 const label myGlobFaceI,
1654 const label nbrGlobFaceI,
1672 label prevFp = fEdges.rcIndex(startFp);
1692 label nextFp = fEdges.fcIndex(endFp);
1732 const faceSet& illegalPatchFaces,
1746 label faceI = iter.key();
1751 <<
"Faceset " << illegalPatchFaces.
name()
1752 <<
" contains internal face " << faceI <<
nl
1761 if (meshPointMap.found(
f[fp]))
1763 label patchPointI = meshPointMap[
f[fp]];
1765 if (extrudeStatus[patchPointI] != NOEXTRUDE)
1780 forAll(patchDisp, patchPointI)
1782 if (
mag(patchDisp[patchPointI]) < minThickness[patchPointI])
1798 else if (extrudeStatus[patchPointI] == NOEXTRUDE)
1802 patchNLayers[patchPointI] = 0;
1811 syncPatchDisplacement
1832 const face& localF = localFaces[i];
1843 if (prevMode == NOEXTRUDE && fpMode != NOEXTRUDE)
1872 Info<<
"truncateDisplacement : Unextruded " << nPinched
1873 <<
" faces due to non-consecutive vertices being extruded." <<
endl;
1896 label nButterFly = 0;
1901 const labelList& globFaces = edgeGlobalFaces[edgeI];
1903 if (globFaces.
size() == 2)
1908 pp.addressing()[myFaceI]
1910 label nbrGlobalFaceI =
1912 globFaces[0] != myGlobalFaceI
1929 extrudeStatus[stringedVerts[0]] != NOEXTRUDE
1930 || extrudeStatus[stringedVerts.last()] != NOEXTRUDE
1935 for (
label i = 1; i < stringedVerts.size()-1; i++)
1939 extrudeStatus[stringedVerts[i]] == NOEXTRUDE
1973 Info<<
"truncateDisplacement : Unextruded " << nButterFly
1974 <<
" faces due to stringed edges with inconsistent extrusion."
1985 label nDiffering = 0;
2029 if (nPinched+nButterFly+nDiffering == 0)
2046 const label nBufferCellsNoExtrude,
2051 Info<<
nl <<
"Setting up information for layer truncation ..." <<
endl;
2055 if (nBufferCellsNoExtrude < 0)
2057 Info<<
nl <<
"Performing no layer truncation."
2058 <<
" nBufferCellsNoExtrude set to less than 0 ..." <<
endl;
2067 if (patchNLayers[
f[fp]] > 0)
2069 nPatchFaceLayers[patchFaceI] = patchNLayers[
f[fp]];
2074 nPatchPointLayers = patchNLayers;
2077 forAll(nPatchFaceLayers, patchFaceI)
2079 if (nPatchFaceLayers[patchFaceI] == -1)
2081 nPatchFaceLayers[patchFaceI] = 0;
2097 bool noExtrude =
false;
2102 if (extrudeStatus[
f[fp]] == NOEXTRUDE)
2106 mLevel =
max(mLevel, patchNLayers[
f[fp]]);
2116 nPatchFaceLayers[patchFaceI] = 1;
2117 maxLevel[patchFaceI] = mLevel;
2121 maxLevel[patchFaceI] = mLevel;
2136 for (
label ilevel = 1; ilevel < nLevels; ilevel++)
2142 nBuffer = nBufferCellsNoExtrude - 1;
2146 nBuffer = nBufferCellsNoExtrude;
2149 for (
label ibuffer = 0; ibuffer < nBuffer + 1; ibuffer++)
2151 labelList tempCounter(nPatchFaceLayers);
2157 forAll(pointFaces[patchPointI], pointFaceI)
2159 label faceI = pointFaces[patchPointI][pointFaceI];
2163 nPatchFaceLayers[faceI] != -1
2164 && maxLevel[faceI] > 0
2167 foundNeighbour[patchPointI] =
true;
2184 if (foundNeighbour[patchPointI])
2186 forAll(pointFaces[patchPointI], pointFaceI)
2188 label faceI = pointFaces[patchPointI][pointFaceI];
2191 nPatchFaceLayers[faceI] == -1
2192 && maxLevel[faceI] > 0
2193 && ilevel < maxLevel[faceI]
2196 tempCounter[faceI] = ilevel;
2201 nPatchFaceLayers = tempCounter;
2207 if (nPatchFaceLayers[patchFaceI] == -1)
2209 nPatchFaceLayers[patchFaceI] = maxLevel[patchFaceI];
2215 if (extrudeStatus[patchPointI] != NOEXTRUDE)
2217 forAll(pointFaces[patchPointI], pointFaceI)
2219 label face = pointFaces[patchPointI][pointFaceI];
2220 nPatchPointLayers[patchPointI] =
max
2222 nPatchPointLayers[patchPointI],
2223 nPatchFaceLayers[
face]
2229 nPatchPointLayers[patchPointI] = 0;
2258 if (faces.
found(cFaces[cFaceI]))
2275 const bool additionalReporting,
2286 Info<<
nl <<
"Checking mesh with layer ..." <<
endl;
2287 faceSet wrongFaces(newMesh,
"wrongFaces", newMesh.
nFaces()/1000);
2299 <<
" (concave, zero area or negative cell pyramid volume)"
2321 const label nReportMax = 10;
2324 forAll(addedCells, oldPatchFaceI)
2328 const labelList& fCells = addedCells[oldPatchFaceI];
2330 if (cellsUseFace(newMesh, fCells, wrongFaces))
2344 if (additionalReporting && (nChanged < nReportMax))
2346 disabledFaceCentres.
append
2360 if (additionalReporting)
2369 label nReportLocal = nChanged;
2370 if (nChangedTotal > nReportMax)
2385 Pout<<
"Checked mesh with layers. Disabled extrusion at " <<
endl;
2386 for (
label i=0; i < nReportLocal; i++)
2388 Pout<<
" " << disabledFaceCentres[i] <<
endl;
2394 if (nReportTotal < nChangedTotal)
2396 Info<<
"Suppressed disabled extrusion message for other "
2397 << nChangedTotal - nReportTotal <<
" faces." <<
endl;
2401 return nChangedTotal;
2413 label nExtruded = 0;
2419 const face& localFace = localFaces[i];
2423 if (extrudeStatus[localFace[fp]] != NOEXTRUDE)
2452 baffleSet.insert(baffles[baffleI][0], baffleI);
2453 baffleSet.insert(baffles[baffleI][1], baffleI);
2465 label oldFaceI = newToOldFaces[faceI];
2468 if (faceFnd != baffleSet.end())
2470 label baffleI = faceFnd();
2476 else if (
p[1] == -1)
2483 <<
"Problem:" << faceI <<
" at:"
2485 <<
" is on same baffle as " <<
p[0]
2511 faceRealThickness = 0;
2519 forAll(addedCells, oldPatchFaceI)
2521 const labelList& added = addedCells[oldPatchFaceI];
2523 const labelList& layer = layerFaces[oldPatchFaceI];
2530 cellNLayers[added[i]] = layer.
size()-1;
2535 forAll(layerFaces, oldPatchFaceI)
2537 const labelList& layer = layerFaces[oldPatchFaceI];
2538 const scalar realThickness = oldRealThickness[oldPatchFaceI];
2544 for (
label i = 1; i < layer.
size(); i++)
2546 faceRealThickness[layer[i]] = realThickness;
2564 int oldPrecision =
Info().precision();
2567 label maxPatchNameLen = 0;
2570 label patchI = patchIDs[i];
2571 word patchName = pbm[patchI].
name();
2572 maxPatchNameLen =
max(maxPatchNameLen,
label(patchName.size()));
2576 <<
setf(ios_base::left) <<
setw(maxPatchNameLen) <<
"patch"
2577 <<
setw(0) <<
" faces layers overall thickness" <<
nl
2578 <<
setf(ios_base::left) <<
setw(maxPatchNameLen) <<
" "
2579 <<
setw(0) <<
" [m] [%]" <<
nl
2580 <<
setf(ios_base::left) <<
setw(maxPatchNameLen) <<
"-----"
2581 <<
setw(0) <<
" ----- ------ --- ---" <<
endl;
2586 label patchI = patchIDs[i];
2589 label sumSize = pp.size();
2593 label sumNLayers = 0;
2596 sumNLayers += cellNLayers[faceCells[i]];
2609 scalar sumRealThickness =
sum(patchReal);
2610 scalar sumFraction = 0;
2613 if (patchWanted[i] > VSMALL)
2615 sumFraction += (patchReal[i]/patchWanted[i]);
2626 scalar avgLayers = 0;
2628 scalar avgFraction = 0;
2631 avgLayers = scalar(sumNLayers)/sumSize;
2632 avgReal = sumRealThickness/sumSize;
2633 avgFraction = sumFraction/sumSize;
2638 <<
" " <<
setw(8) << sumSize
2639 <<
" " <<
setw(8) << avgLayers
2640 <<
" " <<
setw(8) << avgReal
2641 <<
" " <<
setw(8) << 100*avgFraction
2658 forAll(cellNLayers, cellI)
2660 if (cellNLayers[cellI] > 0)
2666 forAll(cellNLayers, cellI)
2668 if (cellNLayers[cellI] > 0)
2670 addedCellSet.
insert(cellI);
2673 addedCellSet.
instance() = meshRefiner_.timeName();
2676 <<
" added cells to cellSet "
2678 bool ok = addedCellSet.
write();
2679 allOk = allOk && ok;
2685 if (faceRealThickness[faceI] > 0)
2691 faceSet layerFacesSet(
mesh,
"layerFaces", nAdded);
2694 if (faceRealThickness[faceI] > 0)
2696 layerFacesSet.
insert(faceI);
2699 layerFacesSet.
instance() = meshRefiner_.timeName();
2702 <<
" faces inside added layer to faceSet "
2704 bool ok = layerFacesSet.
write();
2705 allOk = allOk && ok;
2724 bool ok = writeLayerSets(
mesh, cellNLayers, faceRealThickness);
2725 allOk = allOk && ok;
2746 fixedValueFvPatchScalarField::typeName
2750 fld[cellI] = cellNLayers[cellI];
2755 label patchI = patchIDs[i];
2761 pfld[i] = cellNLayers[faceCells[i]];
2763 fld.boundaryField()[patchI] == pfld;
2767 bool ok =
fld.write();
2768 allOk = allOk && ok;
2784 fixedValueFvPatchScalarField::typeName
2789 label patchI = patchIDs[i];
2790 fld.boundaryField()[patchI] == pbm[patchI].patchSlice
2797 bool ok =
fld.write();
2798 allOk = allOk && ok;
2805 "thicknessFraction",
2814 fixedValueFvPatchScalarField::typeName
2819 label patchI = patchIDs[i];
2834 if (patchWanted[i] > VSMALL)
2836 pfld[i] = patchReal[i]/patchWanted[i];
2840 fld.boundaryField()[patchI] == pfld;
2843 <<
" : overall layer thickness (fraction"
2844 <<
" of desired thickness)" <<
endl;
2845 bool ok =
fld.write();
2846 allOk = allOk && ok;
2864 meshRefiner_(meshRefiner),
2865 globalToMasterPatch_(globalToMasterPatch),
2866 globalToSlavePatch_(globalToSlavePatch)
2886 <<
"Merging all faces of a cell" <<
nl
2887 <<
"---------------------------" <<
nl
2888 <<
" - which are on the same patch" <<
nl
2889 <<
" - which make an angle < " << planarAngle
2891 <<
" (cos:" << minCos <<
')' <<
nl
2892 <<
" - as long as the resulting face doesn't become concave"
2895 <<
" (0=straight, 180=fully concave)" <<
nl
2906 duplicateFace[cpl[0]] = cpl[1];
2907 duplicateFace[cpl[1]] = cpl[0];
2910 label nChanged = meshRefiner_.mergePatchFacesUndo
2914 meshRefiner_.meshedPatches(),
2919 nChanged += meshRefiner_.mergeEdgesUndo(minCos, motionDict);
2928 const label nAllowableErrors,
2942 internalOrBaffleFaceZones = meshRefiner_.getZones(fzTypes);
2949 meshRefiner_.getZones
2964 meshRefiner_.createZoneBaffles
2974 Info<<
"Writing baffled mesh to time "
2975 << meshRefiner_.timeName() <<
endl;
2996 const labelList& reverseFaceMap = map().reverseFaceMap();
2999 label f0 = reverseFaceMap[baffles[i].first()];
3000 label f1 = reverseFaceMap[baffles[i].second()];
3019 bool hasInfo = meshRefiner_.getFaceZoneInfo
3029 if (layerIDs.
found(mpI) && !layerIDs.
found(spI))
3033 <<
" adding layers to master patch " << pbm[mpI].
name()
3034 <<
" only. Freezing points on slave patch "
3038 else if (!layerIDs.
found(mpI) && layerIDs.
found(spI))
3042 <<
" adding layers to slave patch " << pbm[spI].
name()
3043 <<
" only. Freezing points on master patch "
3076 label nIdealTotAddedCells = 0;
3093 syncPatchDisplacement
3102 forAll(extrudeStatus, patchPointI)
3104 if (extrudeStatus[patchPointI] != NOEXTRUDE)
3106 duplicatePoint[pp().meshPoints()[patchPointI]] = 1;
3123 forAll(duplicatePoint, pointI)
3125 if (duplicatePoint[pointI])
3127 candidatePoints[
n++] = pointI;
3144 bool hasInfo = meshRefiner_.getFaceZoneInfo
3151 if (hasInfo && !layerIDs.
found(mpI) && !layerIDs.
found(spI))
3153 nonDupZones.
append(zoneI);
3177 const labelList& pointMap = map().pointMap();
3178 const labelList& reversePointMap = map().reversePointMap();
3182 label oldPointI = pointMap[pointI];
3183 label newMasterPointI = reversePointMap[oldPointI];
3185 if (newMasterPointI != pointI)
3188 pointToDuplicate[pointI] = newMasterPointI;
3189 pointToDuplicate[newMasterPointI] = newMasterPointI;
3195 const labelList& reverseFaceMap = map().reverseFaceMap();
3198 label f0 = reverseFaceMap[baffles[i].first()];
3199 label f1 = reverseFaceMap[baffles[i].second()];
3208 Info<<
"Writing point-duplicate mesh to time "
3209 << meshRefiner_.timeName() <<
endl;
3225 /
"duplicatePoints_"
3226 + meshRefiner_.timeName()
3229 Info<<
"Writing point-duplicates to " << str.
name() <<
endl;
3233 label newMasterI = reversePointMap[pointMap[pointI]];
3235 if (newMasterI != pointI)
3288 determineSidePatches
3313 label nIdealTotAddedCells = 0;
3373 const scalar edge0Len =
3374 meshRefiner_.meshCutter().level0EdgeLength();
3375 const labelList& cellLevel = meshRefiner_.meshCutter().cellLevel();
3404 for (
label i = 0; i < layerParams.
nGrow(); i++)
3418 const scalar edge0Len = meshRefiner_.meshCutter().level0EdgeLength();
3419 const labelList& cellLevel = meshRefiner_.meshCutter().cellLevel();
3429 meshRefiner_.timeName(),
3436 calculateLayerThickness
3463 avgPointData(pp, thickness);
3471 makeLayerDisplacementField
3484 combinedDict.
merge(motionDict);
3486 combinedDict.
add(
"minThicknessName", minThickness.
name());
3515 label iteration = 0;
3521 <<
"Layer addition iteration " << iteration <<
nl
3522 <<
"--------------------------" <<
endl;
3530 : motionDict.
subDict(
"relaxed")
3535 Info<<
"Switched to relaxed meshQuality constraints." <<
endl;
3544 syncPatchDisplacement
3554 getPatchDisplacement
3568 const pointField oldPatchPos(pp().localPoints());
3573 patchDisp = -patchDisp;
3592 combinedDict.
merge(motionDict);
3594 combinedDict.
merge(meshQualityDict);
3596 combinedDict.
add(
"minThicknessName", minThickness.
name());
3599 medialAxisMoverPtr().move
3609 patchDisp = oldPatchPos - pp().localPoints();
3616 truncateDisplacement
3641 Info<<
"Writing shrunk mesh to time "
3642 << meshRefiner_.timeName() <<
endl;
3671 labelList nPatchFaceLayers(pp().size(), -1);
3672 setupLayerInfoTruncation
3686 forAll(nPatchPointLayers, i)
3690 nPatchPointLayers[i],
3693 finalDisp[i] = ratio*patchDisp[i];
3697 const scalarField invExpansionRatio(1.0/expansionRatio);
3728 savedMeshMod = meshMod;
3750 fvMesh& newMesh = newMeshPtr();
3772 avgPointData(pp,
mag(patchDisp))(),
3780 label nAddedCells = 0;
3781 forAll(cellNLayers, cellI)
3783 if (cellNLayers[cellI] > 0)
3792 Info<<
"Writing layer mesh to time " << meshRefiner_.timeName()
3795 writeLayerSets(newMesh, cellNLayers, faceRealThickness);
3814 faceI < newMesh.
nFaces();
3818 label newMeshFaceI = map().faceMap()[faceI];
3819 if (newMeshFaceI != -1)
3821 meshToNewMesh[newMeshFaceI] = faceI;
3832 meshToNewMesh[
p[0]],
3835 if (newMeshBaffle[0] != -1 && newMeshBaffle[1] != -1)
3837 newMeshBaffles[newI++] = newMeshBaffle;
3851 <<
" baffles across faceZones of type internal" <<
nl
3855 label nTotChanged = checkAndUnmark
3869 label nTotExtruded = countExtrusion(pp, extrudeStatus);
3873 Info<<
"Extruding " << nTotExtruded
3874 <<
" out of " << nTotFaces
3875 <<
" faces (" << 100.0*nTotExtruded/nTotFaces <<
"%)."
3876 <<
" Removed extrusion at " << nTotChanged <<
" faces."
3878 <<
"Added " << nTotAddedCells <<
" out of "
3879 << nIdealTotAddedCells
3880 <<
" cells (" << 100.0*nTotAddedCells/nIdealTotAddedCells
3883 if (nTotChanged == 0)
3891 medialAxisMoverPtr().movePoints(
mesh.
points());
3894 for (
label i = 0; i < layerParams.
nGrow(); i++)
3925 if (map().hasMotionPoints())
3938 meshRefiner_.updateMesh(map,
labelList(0));
3955 faceWantedThickness,
3964 Info<<
"Writing mesh with layers but disconnected to time "
3965 << meshRefiner_.timeName() <<
endl;
3985 labelList oldMeshToNewMesh(map().nOldFaces(), -1);
3993 label oldFaceI = map().faceMap()[faceI];
3997 oldMeshToNewMesh[oldFaceI] = faceI;
4006 labelPair newB(oldMeshToNewMesh[
p[0]], oldMeshToNewMesh[
p[1]]);
4007 if (newB[0] != -1 && newB[1] != -1)
4009 baffles[newI++] = newB;
4030 internalOrBaffleFaceZones,
4036 <<
" baffles to merge points across" <<
nl <<
endl;
4039 label nPointPairs = 0;
4040 forAll(pointToDuplicate, oldPointI)
4042 label otherOldPointI = pointToDuplicate[oldPointI];
4043 if (otherOldPointI != -1)
4049 const labelList& pointMap = map().pointMap();
4053 Map<label> oldPointToBoundaryPoint(2*nPointPairs);
4055 forAll(mergePointBaffles, i)
4057 const labelPair& baffle = mergePointBaffles[i];
4064 label oldPointI = pointMap[pointI];
4065 if (pointToDuplicate[oldPointI] != -1)
4067 oldPointToBoundaryPoint.insert(oldPointI, pointI);
4079 forAll(mergePointBaffles, i)
4081 const labelPair& baffle = mergePointBaffles[i];
4088 label oldPointI = pointMap[pointI];
4089 label oldDupI = oldPointToDuplicate[oldPointI];
4092 label newPointI = oldPointToBoundaryPoint[oldDupI];
4093 pointToDuplicate[pointI] = newPointI;
4101 forAll(pointToDuplicate, pointI)
4103 label dupI = pointToDuplicate[pointI];
4108 if (
mag(pt-dupPt) > meshRefiner_.mergeDistance())
4111 <<
"Trying to merge points "
4112 << pointI <<
" at:" << pt
4113 <<
"and " << dupI <<
" at:" << dupPt
4114 <<
" distance " <<
mag(pt-dupPt)
4123 label nPointPairs = 0;
4124 forAll(pointToDuplicate, pointI)
4126 label otherPointI = pointToDuplicate[pointI];
4127 if (otherPointI != -1)
4133 if (nPointPairs > 0)
4136 Info<<
"Merging " << nPointPairs <<
" duplicated points ..." <<
endl;
4144 + meshRefiner_.timeName()
4147 Info<<
"Points to be merged to " << str.
name() <<
endl;
4148 forAll(pointToDuplicate, pointI)
4150 label otherPointI = pointToDuplicate[pointI];
4151 if (otherPointI != -1)
4166 const labelList& reverseFaceMap = map().reverseFaceMap();
4170 Info<<
"Merged points in = "
4178 Info<<
"Converting baffles back into zoned faces ..."
4196 forAll(newFaceRealThickness, faceI)
4201 scalar& realThick = newFaceRealThickness[faceI];
4202 realThick =
max(realThick, faceRealThickness[oldFaceI]);
4203 scalar& wanted = newFaceWantedThickness[faceI];
4204 wanted =
max(wanted, faceWantedThickness[oldFaceI]);
4207 faceRealThickness.transfer(newFaceRealThickness);
4208 faceWantedThickness.transfer(newFaceWantedThickness);
4211 Info<<
"Converted baffles in = "
4212 << meshRefiner_.mesh().time().cpuTimeIncrement()
4222 <<
"Doing final balancing" <<
nl
4223 <<
"---------------------" <<
nl
4242 map().distributeCellData(cellNLayers);
4243 map().distributeFaceData(faceWantedThickness);
4244 map().distributeFaceData(faceRealThickness);
4256 faceWantedThickness,
4268 const bool preBalance,
4276 <<
"Shrinking and layer addition phase" <<
nl
4277 <<
"----------------------------------" <<
nl
4281 Info<<
"Using mesh parameters " << motionDict <<
nl <<
endl;
4286 mergePatchFacesUndo(layerParams, motionDict);
4295 label nFacesWithLayers = 0;
4296 forAll(numLayers, patchI)
4298 if (numLayers[patchI] > 0)
4310 <<
"Ignoring layers on coupled patch " << pp.
name()
4322 meshRefiner_.getFaceZoneInfo(fZones[zoneI].
name(), mpI, spI, fzType);
4324 if (numLayers[mpI] > 0)
4326 nFacesWithLayers += fZones[zoneI].size();
4328 if (numLayers[spI] > 0)
4330 nFacesWithLayers += fZones[zoneI].size();
4339 Info<<
nl <<
"No layers to generate ..." <<
endl;
4344 checkMeshManifold();
4347 Info<<
"Checking initial mesh ..." <<
endl;
4356 Info<<
"Detected " << nInitErrors <<
" illegal faces"
4357 <<
" (concave, zero area or negative cell pyramid volume)"
4365 <<
"Doing initial balancing" <<
nl
4366 <<
"-----------------------" <<
nl
4370 forAll(numLayers, patchI)
4372 if (numLayers[patchI] > 0)
4377 cellWeights[pp.
faceCells()[i]] += numLayers[patchI];
4386 const faceZone& fZone = fZones[zoneI];
4391 meshRefiner_.getFaceZoneInfo(fzName, mpI, spI, fzType);
4393 if (numLayers[mpI] > 0)
4400 cellWeights[cellIDs[i]] += numLayers[mpI];
4403 if (numLayers[spI] > 0)
4408 cellWeights[cellIDs[i]] += numLayers[mpI];
label nGrow() const
If points get not extruded do nGrow layers of connected faces.
Smanip< ios_base::fmtflags > setf(const ios_base::fmtflags flags)
virtual const pointField & points() const
Return raw points.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
void mergePatchFacesUndo(const layerParameters &layerParams, const dictionary &motionDict)
Merge patch faces on same cell.
const labelListList & pointFaces() const
Return point-face addressing.
scalar layerExpansionRatio(const label n, const scalar totalOverFirst) const
Calculate expansion ratio from overall size v.s. thickness of.
void doLayers(const dictionary &shrinkDict, const dictionary &motionDict, const layerParameters &layerParams, const bool mergePatchFaces, const bool preBalance, decompositionMethod &decomposer, fvMeshDistribute &distributor)
Add layers according to the dictionary settings.
Takes mesh with 'baffles' (= boundary faces sharing points). Determines for selected points on bounda...
const pointBoundaryMesh & boundary() const
Return reference to boundary mesh.
const dimensionSet dimless(0, 0, 0, 0, 0, 0, 0)
static void getLayerCellsFaces(const polyMesh &, const addPatchCellLayer &, const scalarField &oldRealThickness, labelList &cellStatus, scalarField &faceRealThickness)
Collect layer faces and layer cells into bools.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
void determineSidePatches(const globalIndex &globalFaces, const labelListList &edgeGlobalFaces, const indirectPrimitivePatch &pp, labelList &edgePatchID, labelList &edgeZoneID, boolList &edgeFlip, labelList &inflateFaceID)
See what zones and patches edges should be extruded into.
bool sameEdgeNeighbour(const labelListList &globalEdgeFaces, const label myGlobalFaceI, const label nbrGlobFaceI, const label edgeI) const
For truncateDisplacement: find strings of edges.
faceZoneType
What to do with faceZone faces.
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
const Field< PointType > & points() const
Return reference to global points.
const labelListList & edgeFaces() const
Return edge-face addressing.
void growNoExtrusion(const indirectPrimitivePatch &pp, pointField &patchDisp, labelList &patchNLayers, List< extrudeMode > &extrudeStatus) const
Grow no-extrusion layer.
A class for handling words, derived from string.
A class for handling file names.
A primitive field of type <T> with automated input and output.
List< label > labelList
A List of labels.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
OFstream which keeps track of vertices.
const edgeList & edges() const
Return list of edges, address into LOCAL point list.
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
double cpuTimeIncrement() const
Return CPU time (in seconds) since last call to cpuTimeIncrement()
#define forAll(list, i)
Loop across all elements in list.
const dictionary & dict() const
A class for managing temporary objects.
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurence of given element and return index,.
void checkMeshManifold() const
Check that mesh outside is not multiply connected.
static labelListList globalEdgeFaces(const polyMesh &, const globalIndex &globalFaces, const indirectPrimitivePatch &pp)
Per patch edge the pp faces (in global indices) using it. Uses.
autoPtr< mapPolyMesh > changeMesh(polyMesh &mesh, const bool inflate, const bool syncParallel=true, const bool orderCells=false, const bool orderPoints=false)
Inplace changes mesh without change of patches.
Xfer< List< T > > xfer()
Transfer contents to the Xfer container.
virtual Ostream & write(const char)
Write character.
scalar maxFaceThicknessRatio() const
Stop layer growth on highly warped cells.
const Field< PointType > & localPoints() const
Return pointField of points in patch.
static const label labelMax
static label nProcs(const label communicator=0)
Number of processes in parallel run.
static writeType writeLevel()
Get/set write level.
virtual bool coupled() const
Return true if this patch is geometrically coupled (i.e. faces and.
static bool & parRun()
Is this a parallel run?
const cellList & cells() const
Direct mesh changes based on v1.3 polyTopoChange syntax.
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
label nRelaxedIter() const
Number of iterations after which relaxed motion rules.
void transfer(List< T > &)
Transfer the contents of the argument List into this list.
label truncateDisplacement(const globalIndex &globalFaces, const labelListList &edgeGlobalFaces, const indirectPrimitivePatch &pp, const scalarField &minThickness, const faceSet &illegalPatchFaces, pointField &patchDisp, labelList &patchNLayers, List< extrudeMode > &extrudeStatus) const
Truncates displacement.
static bool unmarkExtrusion(const label patchPointI, pointField &patchDisp, labelList &patchNLayers, List< extrudeMode > &extrudeStatus)
Unset extrusion on point. Returns true if anything unset.
Unit conversion functions.
virtual bool write() const
Write using setting from DB.
extrudeMode
Extrusion controls.
void addLayers(const layerParameters &layerParams, const dictionary &motionDict, const labelList &patchIDs, const label nAllowableErrors, decompositionMethod &decomposer, fvMeshDistribute &distributor)
Add cell layers.
virtual tmp< scalarField > movePoints(const pointField &)
Move points, returns volumes swept by faces in motion.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
Ostream & endl(Ostream &os)
Add newline and flush stream.
const edgeList & edges() const
Return mesh edges. Uses calcEdges.
const labelListList & faceEdges() const
Return face-edge addressing.
dimensioned< scalar > mag(const dimensioned< Type > &)
const labelListList & pointEdges() const
const fileName & instance() const
writeOption writeOpt() const
const fvMesh & mesh() const
Reference to mesh.
Ostream & incrIndent(Ostream &os)
Increment the indent level.
void setupLayerInfoTruncation(const indirectPrimitivePatch &pp, const labelList &patchNLayers, const List< extrudeMode > &extrudeStatus, const label nBufferCellsNoExtrude, labelList &nPatchPointLayers, labelList &nPatchFaceLayers) const
Setup layer information (at points and faces) to.
void calculateLayerThickness(const indirectPrimitivePatch &pp, const labelList &patchIDs, const layerParameters &layerParams, const labelList &cellLevel, const labelList &patchNLayers, const scalar edge0Len, scalarField &thickness, scalarField &minThickness, scalarField &expansionRatio) const
Calculate pointwise wanted and minimum thickness.
faceList mergePatchFaces(const List< DynList< label > > &pfcs, const pointField &polyPoints)
Mesh consisting of general polyhedral cells.
static void updateList(const labelList &newToOld, const T &nullValue, List< T > &elems)
Helper: reorder list according to map.
static const pointMesh & New(const polyMesh &mesh)
label nLayerIter() const
Number of overall layer addition iterations.
void syncPatchDisplacement(const indirectPrimitivePatch &pp, const scalarField &minThickness, pointField &patchDisp, labelList &patchNLayers, List< extrudeMode > &extrudeStatus) const
Synchronize displacement among coupled patches.
static List< labelPair > subsetBaffles(const polyMesh &mesh, const labelList &zoneIDs, const List< labelPair > &baffles)
Subset baffles according to zones.
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
const faceZoneMesh & faceZones() const
Return face zone mesh.
Pre-declare related SubField type.
static tmp< scalarField > avgPointData(const indirectPrimitivePatch &, const scalarField &pointFld)
Average point wise data to face wise.
virtual bool write() const
Write mesh using IO settings from time.
void getPatchDisplacement(const indirectPrimitivePatch &pp, const scalarField &thickness, const scalarField &minThickness, pointField &patchDisp, labelList &patchNLayers, List< extrudeMode > &extrudeStatus) const
Get nearest point on surface to snap to.
static void dumpDisplacement(const fileName &, const indirectPrimitivePatch &, const vectorField &, const List< extrudeMode > &)
For debugging: Dump displacement to .obj files.
const scalarField & minThickness() const
Minimum overall thickness of cell layer. If for any reason layer.
bool writeLayerSets(const fvMesh &mesh, const labelList &cellNLayers, const scalarField &faceRealThickness) const
Write cellSet,faceSet for layers.
Determines the 'side' for every face and connected to a singly-connected (through edges) region of fa...
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
static const label labelMin
label nBufferCellsNoExtrude() const
Create buffer region for new layer terminations.
void inplaceReorder(const labelUList &oldToNew, ListType &)
Inplace reorder the elements of a list.
bool writeLayerData(const fvMesh &mesh, const labelList &patchIDs, const labelList &cellNLayers, const scalarField &faceWantedThickness, const scalarField &faceRealThickness) const
Write volFields,cellSet,faceSet for layers depending.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Pre-declare SubField and related Field type.
A subset of mesh faces organised as a primitive patch.
void getVertexString(const indirectPrimitivePatch &pp, const labelListList &globalEdgeFaces, const label faceI, const label edgeI, const label myGlobFaceI, const label nbrGlobFaceI, DynamicList< label > &vertices) const
For truncateDisplacement: find strings of edges.
virtual Ostream & write(const token &)=0
Write next token to stream.
A patch is a list of labels that address the faces in the global face list.
static label countExtrusion(const indirectPrimitivePatch &pp, const List< extrudeMode > &extrudeStatus)
Count global number of extruded faces.
static autoPtr< externalDisplacementMeshMover > New(const word &type, const dictionary &dict, const List< labelPair > &baffles, pointVectorField &pointDisplacement)
Return a reference to the selected meshMover model.
autoPtr< mapPolyMesh > makeMesh(autoPtr< fvMesh > &newMesh, const IOobject &io, const polyMesh &mesh, const bool syncParallel=true, const bool orderCells=false, const bool orderPoints=false)
Create new mesh with old mesh patches.
const labelList & coupledPatchMeshEdges() const
Return map from coupledPatch edges to mesh edges.
const labelListList & pointEdges() const
Return point-edge addressing.
void clear()
Clear the addressed list, i.e. set the size to zero.
virtual const labelList & faceOwner() const
Return face owner.
DynamicField< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
scalar mergePatchFacesAngle() const
A List with indirect addressing.
virtual void updateMesh(const mapPolyMesh &mpm)
Update mesh corresponding to the given map.
const labelList & slaveCells() const
Return labels of slave cells.
Istream and Ostream manipulators taking arguments.
bool merge(const dictionary &)
Merge entries from the given dictionary.
const word & name() const
Return name.
unsigned int count() const
Count number of bits set, O(log(n))
DynamicList< T, SizeInc, SizeMult, SizeDiv > & shrink()
Shrink the allocated space to the number of elements used.
static label checkAndUnmark(const addPatchCellLayer &addLayer, const dictionary &motionDict, const bool additionalReporting, const List< labelPair > &baffles, const indirectPrimitivePatch &pp, const fvMesh &, pointField &patchDisp, labelList &patchNLayers, List< extrudeMode > &extrudeStatus)
Checks the newly added cells and locally unmarks points.
static List< labelPair > getBafflesOnAddedMesh(const polyMesh &mesh, const labelList &newToOldFaces, const List< labelPair > &baffles)
After adding to mesh get the new baffles.
Simple container to keep together layer specific information.
labelList identity(const label len)
Create identity map (map[i] == i) of given length.
label nPoints() const
Return number of points supporting patch faces.
A list of keyword definitions, which are a keyword followed by any number of values (e....
label size() const
Return number of elements in table.
label nInternalFaces() const
static autoPtr< indirectPrimitivePatch > makePatch(const polyMesh &, const labelList &)
Create patch from set of patches.
Adds layers of cells to outside of polyPatch. Can optionally create stand-alone extruded mesh (addToM...
const labelList & numLayers() const
How many layers to add.
void handleWarpedFaces(const indirectPrimitivePatch &pp, const scalar faceRatio, const scalar edge0Len, const labelList &cellLevel, pointField &patchDisp, labelList &patchNLayers, List< extrudeMode > &extrudeStatus) const
No extrusion on warped faces.
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< ' ';}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< ' ';}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< ' ';}gmvFile<< nl;forAll(lagrangianScalarNames, i){ const word &name=lagrangianScalarNames[i];IOField< scalar > fld(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
autoLayerDriver(const autoLayerDriver &)
Disallow default bitwise copy construct.
Generic dimensioned Type class.
Abstract base class for decomposition.
bool found(const Key &) const
Return true if hashedEntry is found in table.
Mesh data needed to do the Finite Volume discretisation.
Mesh representing a set of points created from polyMesh.
scalar layerThickness(const label nLayers, const scalar firstLayerThickess, const scalar finalLayerThickess, const scalar totalThickness, const scalar expansionRatio) const
Determine overall thickness. Uses two of the four parameters.
Ostream & decrIndent(Ostream &os)
Decrement the indent level.
errorManip< error > abort(error &err)
const labelUList & faceCells() const
Return face-cell addressing.
const word & name() const
Return name.
Omanip< int > setw(const int i)
A collection of cell labels.
Calculates a unique integer (label so might not have enough room - 2G max) for processor + local inde...
const double e
Elementary charge.
Ostream & indent(Ostream &os)
Indent stream.
Vector< scalar > vector
A scalar version of the templated Vector.
void updateMesh(const mapPolyMesh &, const labelList &faceMap, const labelList &pointMap)
Update any locally stored mesh information. Gets additional.
meshRefinement & meshRefiner_
Mesh+surface.
const Switch & additionalReporting() const
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
errorManipArg< error, int > exit(error &err, const int errNo=1)
static int myProcNo(const label communicator=0)
Number of this process (starting from masterNo() = 0)
const labelListList & layerFaces() const
Layer faces per patch face. See above.
void setInstance(const fileName &)
Set the instance for mesh files.
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
Omanip< int > setprecision(const int i)
void setSize(const label)
Reset size of List.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
void handleNonManifolds(const indirectPrimitivePatch &pp, const labelList &meshEdges, const labelListList &edgeGlobalFaces, pointField &patchDisp, labelList &patchNLayers, List< extrudeMode > &extrudeStatus) const
No extrusion at non-manifold points.
scalar finalLayerThicknessRatio(const label nLayers, const scalar expansionRatio) const
Determine ratio of final layer thickness to.
static tmp< pointVectorField > makeLayerDisplacementField(const pointMesh &pMesh, const labelList &numLayers)
Helper function to make a pointVectorField with correct.
label prevLabel(const label i) const
Previous vertex on face.
const labelList & masterCells() const
Return labels of master cells (cells next to the master face.
line< point, const point & > linePointRef
Line using referred points.
virtual const faceList & faces() const
Return raw faces.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
scalar featureAngle() const
static bool cellsUseFace(const polyMesh &mesh, const labelList &cellLabels, const labelHashSet &faces)
Does any of the cells use a face from faces?
An ordered pair of two objects of type <T> with first() and second() elements.
fileName path() const
Return path.
prefixOSstream Pout(cout, "Pout")
const Field< PointType > & faceNormals() const
Return face normals for patch.
static bool checkMesh(const bool report, const polyMesh &mesh, const dictionary &dict, labelHashSet &wrongFaces)
Check mesh with mesh settings in dict. Collects incorrect faces.
static word timeName(const scalar, const int precision=precision_)
Return time name of given scalar time.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
static void calcExtrudeInfo(const bool zoneFromAnyFace, const polyMesh &, const globalIndex &globalFaces, const labelListList &globalEdgeFaces, const indirectPrimitivePatch &pp, labelList &edgePatchID, label &nPatches, Map< label > &nbrProcToPatch, Map< label > &patchToNbrProc, labelList &edgeZoneID, boolList &edgeFlip, labelList &inflateFaceID)
Determine extrude information per patch edge:
volScalarField scalarField(fieldObject, mesh)
bool isInternalFace(const label faceIndex) const
Return true if given face label is internal to the mesh.
const vectorField & faceCentres() const
const Field< PointType > & faceCentres() const
Return face centres for patch.
Helper class which maintains intersections of (changing) mesh with (static) surfaces.
bool valid() const
Return true if the autoPtr valid (ie, the pointer is set).
static void setDisplacement(const labelList &patchIDs, const indirectPrimitivePatch &pp, pointField &patchDisp, pointVectorField &displacement)
Set displacement field from displacement on patch points.
static const Vector rootMax
const scalarField & firstLayerThickness() const
Wanted thickness of the layer nearest to the wall.
const dimensionedScalar e
Elementary charge.
label size() const
Return the number of elements in the PtrList.
bool insert(const Key &key)
Insert a new entry.
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
const scalarField & expansionRatio() const
const scalarField & thickness() const
Wanted overall thickness of all layers.
static void checkManifold(const indirectPrimitivePatch &, pointSet &nonManifoldPoints)
Check that primitivePatch is not multiply connected.
void reset(T *=0)
If object pointer already set, delete object and set to given.
const Time & time() const
Return the top-level database.
const List< Face > & localFaces() const
Return patch faces addressing into local point list.
A List with indirect addressing.
void printLayerData(const fvMesh &mesh, const labelList &patchIDs, const labelList &cellNLayers, const scalarField &faceWantedThickness, const scalarField &faceRealThickness) const
Print layer coverage table.
A face is a list of labels corresponding to mesh vertices.
const fileName & name() const
Return the name of the stream.
void size(const label)
Override size to be inconsistent with allocated storage.
bool relativeSizes() const
Are size parameters relative to inner cell size or.
void handleFeatureAngle(const indirectPrimitivePatch &pp, const labelList &meshEdges, const scalar minCos, pointField &patchDisp, labelList &patchNLayers, List< extrudeMode > &extrudeStatus) const
No extrusion on feature edges. Assumes non-manifold.
const globalMeshData & globalData() const
Return parallel info.
const Map< label > & meshPointMap() const
Mesh point map. Given the global point index find its.
Combine operator class to combine normal with other normal.
const scalarField & finalLayerThickness() const
Wanted thickness of the layer furthest away.
const labelList & meshPoints() const
Return labelList of mesh points in patch.
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
Generic GeometricField class.
const word & meshShrinker() const
Type of mesh shrinker.
bool checkPointManifold(const bool report=false, labelHashSet *setPtr=NULL) const
Checks primitivePatch for faces sharing point but not edge.
void setNumLayers(const labelList &patchToNLayers, const labelList &patchIDs, const indirectPrimitivePatch &pp, pointField &patchDisp, labelList &patchNLayers, List< extrudeMode > &extrudeStatus, label &nIdealAddedCells) const
Determine the number of layers per point from the number of.
defineTypeNameAndDebug(combustionModel, 0)
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
const word & name() const
Return name.
#define WarningInFunction
Report a warning using Foam::Warning.
A cell is defined as a list of faces with extra functionality.
Sends/receives parts of mesh+fvfields to neighbouring processors. Used in load balancing.
Pair< label > labelPair
Label pair.
Type gMax(const FieldField< Field, Type > &f)
word name(const complex &)
Return a string representation of a complex.
static labelPairList findDuplicateFacePairs(const polyMesh &)
Helper routine to find all baffles (two boundary faces.
bool add(entry *, bool mergeEntry=false)
Add a new entry.
void clearOut()
Clear all geometry and addressing.
label toGlobal(const label i) const
From local to global.
scalar concaveAngle() const
const word & name() const
Return reference to name.
A list of faces which address into the list of points.
scalar degToRad(const scalar deg)
Conversion from degrees to radians.
void setRefinement(const globalIndex &globalFaces, const labelListList &globalEdgeFaces, const scalarField &expansionRatio, const indirectPrimitivePatch &pp, const labelList &sidePatchID, const labelList &sideZoneID, const boolList &sideFlip, const labelList &inflateFaceID, const labelList &exposedPatchID, const labelList &nFaceLayers, const labelList &nPointLayers, const vectorField &firstLayerDisp, polyTopoChange &meshMod)
Play commands into polyTopoChange to create layers on top.
dimensionedScalar cos(const dimensionedScalar &ds)
labelListList addedCells() const
Added cells given current mesh & layerfaces.