76 void Foam::snappyLayerDriver::dumpDisplacement
78 const fileName& prefix,
81 const List<extrudeMode>& extrudeStatus
84 OBJstream dispStr(prefix +
"_disp.obj");
85 Info<<
"Writing all displacements to " << dispStr.name() <<
endl;
87 forAll(patchDisp, patchPointi)
89 const point& pt = pp.localPoints()[patchPointi];
90 dispStr.write(
linePointRef(pt, pt + patchDisp[patchPointi]));
94 OBJstream illStr(prefix +
"_illegal.obj");
95 Info<<
"Writing invalid displacements to " << illStr.name() <<
endl;
97 forAll(patchDisp, patchPointi)
99 if (extrudeStatus[patchPointi] != EXTRUDE)
101 const point& pt = pp.localPoints()[patchPointi];
102 illStr.write(
linePointRef(pt, pt + patchDisp[patchPointi]));
114 tmp<scalarField> tfaceFld(
new scalarField(pp.size(), 0.0));
117 forAll(pp.localFaces(), facei)
119 const face& f = pp.localFaces()[facei];
124 faceFld[facei] += pointFld[f[fp]];
126 faceFld[facei] /= f.size();
135 void Foam::snappyLayerDriver::checkManifold
138 pointSet& nonManifoldPoints
142 fp.checkPointManifold(
false, &nonManifoldPoints);
149 const labelList& eFaces = edgeFaces[edgeI];
151 if (eFaces.size() > 2)
153 const edge& e = fp.edges()[edgeI];
155 nonManifoldPoints.insert(fp.meshPoints()[e[0]]);
156 nonManifoldPoints.insert(fp.meshPoints()[e[1]]);
162 void Foam::snappyLayerDriver::checkMeshManifold()
const 164 const fvMesh& mesh = meshRefiner_.mesh();
166 Info<< nl <<
"Checking mesh manifoldness ..." <<
endl;
169 labelList outsideFaces(mesh.nFaces() - mesh.nInternalFaces());
171 for (
label facei = mesh.nInternalFaces(); facei < mesh.nFaces(); facei++)
173 outsideFaces[facei - mesh.nInternalFaces()] = facei;
176 pointSet nonManifoldPoints
188 IndirectList<face>(mesh.faces(), outsideFaces),
198 Info<<
"Outside of mesh is multiply connected across edges or" 200 <<
"This is not a fatal error but might cause some unexpected" 201 <<
" behaviour." << nl
216 bool Foam::snappyLayerDriver::unmarkExtrusion
218 const label patchPointi,
221 List<extrudeMode>& extrudeStatus
224 if (extrudeStatus[patchPointi] == EXTRUDE)
226 extrudeStatus[patchPointi] = NOEXTRUDE;
227 patchNLayers[patchPointi] = 0;
228 patchDisp[patchPointi] =
Zero;
231 else if (extrudeStatus[patchPointi] == EXTRUDEREMOVE)
233 extrudeStatus[patchPointi] = NOEXTRUDE;
234 patchNLayers[patchPointi] = 0;
235 patchDisp[patchPointi] =
Zero;
246 bool Foam::snappyLayerDriver::unmarkExtrusion
248 const face& localFace,
251 List<extrudeMode>& extrudeStatus
254 bool unextruded =
false;
277 void Foam::snappyLayerDriver::handleNonManifolds
284 List<extrudeMode>& extrudeStatus
287 const fvMesh& mesh = meshRefiner_.mesh();
289 Info<< nl <<
"Handling non-manifold points ..." <<
endl;
292 Info<< nl <<
"Checking patch manifoldness ..." <<
endl;
294 pointSet nonManifoldPoints(mesh,
"nonManifoldPoints", pp.nPoints());
297 checkManifold(pp, nonManifoldPoints);
300 forAll(edgeGlobalFaces, edgeI)
304 pp.edgeFaces()[edgeI].size() == 1
305 && edgeGlobalFaces[edgeI].size() > 2
311 const edge& e = pp.edges()[edgeI];
312 nonManifoldPoints.insert(pp.meshPoints()[e[0]]);
313 nonManifoldPoints.insert(pp.meshPoints()[e[1]]);
319 PackedBoolList isCoupledEdge(mesh.nEdges());
321 const labelList& cpEdges = mesh.globalData().coupledPatchMeshEdges();
324 isCoupledEdge[cpEdges[i]] =
true;
330 orEqOp<unsigned int>(),
334 forAll(edgeGlobalFaces, edgeI)
336 label meshEdgeI = meshEdges[edgeI];
340 pp.edgeFaces()[edgeI].size() == 1
341 && edgeGlobalFaces[edgeI].size() == 1
342 && isCoupledEdge[meshEdgeI]
346 const edge& e = pp.edges()[edgeI];
350 nonManifoldPoints.insert(pp.meshPoints()[e[0]]);
351 nonManifoldPoints.insert(pp.meshPoints()[e[1]]);
360 Info<<
"Outside of local patch is multiply connected across edges or" 361 <<
" points at " << nNonManif <<
" points." <<
endl;
365 const labelList& meshPoints = pp.meshPoints();
367 forAll(meshPoints, patchPointi)
369 if (nonManifoldPoints.found(meshPoints[patchPointi]))
382 Info<<
"Set displacement to zero for all " << nNonManif
383 <<
" non-manifold points" <<
endl;
388 void Foam::snappyLayerDriver::handleFeatureAngle
395 List<extrudeMode>& extrudeStatus
398 const fvMesh& mesh = meshRefiner_.mesh();
400 Info<< nl <<
"Handling feature edges ..." <<
endl;
402 if (minCos < 1-SMALL)
411 const labelList& eFaces = pp.edgeFaces()[edgeI];
413 label meshEdgeI = meshEdges[edgeI];
419 edgeNormal[meshEdgeI],
420 pp.faceNormals()[eFaces[i]]
433 autoPtr<OBJstream> str;
434 if (debug&meshRefinement::MESH)
442 + meshRefiner_.timeName()
446 Info<<
"Writing feature edges to " << str().name() <<
endl;
455 const labelList& eFaces = pp.edgeFaces()[edgeI];
457 label meshEdgeI = meshEdges[edgeI];
459 const vector& n = edgeNormal[meshEdgeI];
463 scalar cos = n & pp.faceNormals()[eFaces[0]];
467 const edge& e = pp.edges()[edgeI];
488 const point& p0 = pp.localPoints()[e[0]];
489 const point& p1 = pp.localPoints()[e[1]];
496 Info<<
"Set displacement to zero for points on " 498 <<
" feature edges" <<
endl;
507 void Foam::snappyLayerDriver::handleWarpedFaces
510 const scalar faceRatio,
511 const scalar edge0Len,
515 List<extrudeMode>& extrudeStatus
518 const fvMesh& mesh = meshRefiner_.mesh();
520 Info<< nl <<
"Handling cells with warped patch faces ..." <<
nl;
524 label nWarpedFaces = 0;
528 const face& f = pp[i];
532 label facei = pp.addressing()[i];
534 label ownLevel = cellLevel[mesh.faceOwner()[facei]];
535 scalar edgeLen = edge0Len/(1<<ownLevel);
538 const point& fc = mesh.faceCentres()[facei];
539 const vector& fn = pp.faceNormals()[i];
545 vector n = points[f[fp]] - fc;
546 vProj[fp] = (n & fn);
550 scalar minVal =
min(vProj);
551 scalar maxVal =
max(vProj);
553 if ((maxVal - minVal) > faceRatio * edgeLen)
572 Info<<
"Set displacement to zero on " 574 <<
" warped faces since layer would be > " << faceRatio
575 <<
" of the size of the bounding box." <<
endl;
682 void Foam::snappyLayerDriver::setNumLayers
689 List<extrudeMode>& extrudeStatus,
693 const fvMesh& mesh = meshRefiner_.mesh();
695 Info<< nl <<
"Handling points with inconsistent layer specification ..." 705 label patchi = patchIDs[i];
707 const labelList& meshPoints = mesh.boundaryMesh()[
patchi].meshPoints();
711 forAll(meshPoints, patchPointi)
713 label ppPointi = pp.meshPointMap()[meshPoints[patchPointi]];
715 maxLayers[ppPointi] =
max(wantedLayers, maxLayers[ppPointi]);
716 minLayers[ppPointi] =
min(wantedLayers, minLayers[ppPointi]);
747 <<
"Patchpoint:" << i <<
" coord:" << pp.localPoints()[i]
748 <<
" maxLayers:" << maxLayers
749 <<
" minLayers:" << minLayers
752 else if (maxLayers[i] == minLayers[i])
755 patchNLayers[i] = maxLayers[i];
773 patchNLayers[i] = maxLayers[i];
780 forAll(pp.localFaces(), facei)
782 const face& f = pp.localFaces()[facei];
788 nCells =
max(nCells, patchNLayers[f[fp]]);
791 nAddedCells += nCells;
793 reduce(nAddedCells, sumOp<label>());
806 Foam::snappyLayerDriver::makeLayerDisplacementField
808 const pointMesh& pMesh,
813 const pointBoundaryMesh& pointPatches = pMesh.boundary();
818 slipPointPatchVectorField::typeName
820 wordList actualPatchTypes(patchFieldTypes.size());
821 forAll(pointPatches, patchi)
830 if (numLayers[patchi] == 0)
833 zeroFixedValuePointPatchVectorField::typeName;
835 else if (numLayers[patchi] > 0)
837 patchFieldTypes[
patchi] = fixedValuePointPatchVectorField::typeName;
841 forAll(pointPatches, patchi)
843 if (isA<processorPointPatch>(pointPatches[patchi]))
845 patchFieldTypes[
patchi] = calculatedPointPatchVectorField::typeName;
847 else if (isA<cyclicPointPatch>(pointPatches[patchi]))
849 patchFieldTypes[
patchi] = cyclicSlipPointPatchVectorField::typeName;
854 const polyMesh& mesh = pMesh();
858 tmp<pointVectorField> tfld
865 mesh.time().timeName(),
880 void Foam::snappyLayerDriver::growNoExtrusion
885 List<extrudeMode>& extrudeStatus
888 Info<< nl <<
"Growing non-extrusion points by one layer ..." <<
endl;
890 List<extrudeMode> grownExtrudeStatus(extrudeStatus);
892 const faceList& localFaces = pp.localFaces();
898 const face& f = localFaces[facei];
900 bool hasSqueeze =
false;
903 if (extrudeStatus[f[fp]] == NOEXTRUDE)
917 extrudeStatus[f[fp]] == EXTRUDE
918 && grownExtrudeStatus[f[fp]] != NOEXTRUDE
921 grownExtrudeStatus[f[fp]] = NOEXTRUDE;
928 extrudeStatus.transfer(grownExtrudeStatus);
937 status[i] = extrudeStatus[i];
949 extrudeStatus[i] = extrudeMode(status[i]);
954 forAll(extrudeStatus, patchPointi)
956 if (extrudeStatus[patchPointi] == NOEXTRUDE)
958 patchDisp[patchPointi] =
Zero;
959 patchNLayers[patchPointi] = 0;
963 reduce(nGrown, sumOp<label>());
965 Info<<
"Set displacement to zero for an additional " << nGrown
966 <<
" points." <<
endl;
970 void Foam::snappyLayerDriver::determineSidePatches
972 const globalIndex& globalFaces,
985 fvMesh& mesh = meshRefiner_.mesh();
991 Map<label> nbrProcToPatch;
992 Map<label> patchToNbrProc;
1006 label nOldPatches = mesh.boundaryMesh().size();
1008 Info<< nl <<
"Adding in total " << nAdded/2 <<
" inter-processor patches to" 1009 <<
" handle extrusion of non-manifold processor boundaries." 1016 Map<label> wantedToAddedPatch;
1018 for (
label patchi = nOldPatches; patchi <
nPatches; patchi++)
1026 dictionary patchDict;
1027 patchDict.add(
"type", processorPolyPatch::typeName);
1029 patchDict.add(
"neighbProcNo", nbrProci);
1030 patchDict.add(
"nFaces", 0);
1031 patchDict.add(
"startFace", mesh.nFaces());
1033 label procPatchi = meshRefiner_.appendPatch
1036 mesh.boundaryMesh().size(),
1040 wantedToAddedPatch.insert(patchi, procPatchi);
1046 label patchi = sidePatchID[i];
1048 if (fnd != wantedToAddedPatch.end())
1050 sidePatchID[i] = fnd();
1055 const_cast<polyBoundaryMesh&
>(mesh.boundaryMesh()).updateMesh();
1060 void Foam::snappyLayerDriver::calculateLayerThickness
1064 const layerParameters& layerParams,
1067 const scalar edge0Len,
1074 const fvMesh& mesh = meshRefiner_.mesh();
1075 const polyBoundaryMesh& patches = mesh.boundaryMesh();
1082 scalarField firstLayerThickness(pp.nPoints(), GREAT);
1083 scalarField finalLayerThickness(pp.nPoints(), GREAT);
1087 minThickness.
setSize(pp.nPoints());
1088 minThickness = GREAT;
1092 label patchi = patchIDs[i];
1096 forAll(meshPoints, patchPointi)
1098 label ppPointi = pp.meshPointMap()[meshPoints[patchPointi]];
1100 firstLayerThickness[ppPointi] =
min 1102 firstLayerThickness[ppPointi],
1103 layerParams.firstLayerThickness()[
patchi]
1105 finalLayerThickness[ppPointi] =
min 1107 finalLayerThickness[ppPointi],
1108 layerParams.finalLayerThickness()[
patchi]
1110 totalThickness[ppPointi] =
min 1112 totalThickness[ppPointi],
1113 layerParams.thickness()[
patchi]
1115 expRatio[ppPointi] =
min 1118 layerParams.expansionRatio()[
patchi]
1120 minThickness[ppPointi] =
min 1122 minThickness[ppPointi],
1123 layerParams.minThickness()[
patchi]
1132 firstLayerThickness,
1140 finalLayerThickness,
1178 if (layerParams.relativeSizes())
1182 min(layerParams.minThickness()) < 0
1183 ||
max(layerParams.minThickness()) > 2
1187 <<
"Thickness should be factor of local undistorted cell size." 1188 <<
" Valid values are [0..2]." << nl
1189 <<
" minThickness:" << layerParams.minThickness()
1201 label ownLevel = cellLevel[mesh.faceOwner()[pp.addressing()[i]]];
1203 const face& f = pp.localFaces()[i];
1207 maxPointLevel[f[fp]] =
max(maxPointLevel[f[fp]], ownLevel);
1221 forAll(maxPointLevel, pointi)
1224 scalar edgeLen = edge0Len/(1<<maxPointLevel[pointi]);
1225 firstLayerThickness[pointi] *= edgeLen;
1226 finalLayerThickness[pointi] *= edgeLen;
1227 totalThickness[pointi] *= edgeLen;
1228 minThickness[pointi] *= edgeLen;
1237 forAll(firstLayerThickness, pointi)
1239 thickness[pointi] = layerParams.layerThickness
1241 patchNLayers[pointi],
1242 firstLayerThickness[pointi],
1243 finalLayerThickness[pointi],
1244 totalThickness[pointi],
1248 expansionRatio[pointi] = layerParams.layerExpansionRatio
1250 patchNLayers[pointi],
1251 firstLayerThickness[pointi],
1252 finalLayerThickness[pointi],
1253 totalThickness[pointi],
1263 const polyBoundaryMesh& patches = mesh.boundaryMesh();
1265 int oldPrecision =
Info().precision();
1268 label maxPatchNameLen = 0;
1271 label patchi = patchIDs[i];
1272 word patchName = patches[
patchi].name();
1273 maxPatchNameLen =
max(maxPatchNameLen,
label(patchName.size()));
1277 <<
setf(ios_base::left) <<
setw(maxPatchNameLen) <<
"patch" 1278 <<
setw(0) <<
" faces layers avg thickness[m]" << nl
1279 <<
setf(ios_base::left) <<
setw(maxPatchNameLen) <<
" " 1280 <<
setw(0) <<
" near-wall overall" << nl
1281 <<
setf(ios_base::left) <<
setw(maxPatchNameLen) <<
"-----" 1282 <<
setw(0) <<
" ----- ------ --------- -------" <<
endl;
1289 label patchi = patchIDs[i];
1293 scalar sumThickness = 0;
1294 scalar sumNearWallThickness = 0;
1295 label nMasterPoints = 0;
1297 forAll(meshPoints, patchPointi)
1299 label meshPointi = meshPoints[patchPointi];
1300 if (isMasterPoint[meshPointi])
1302 label ppPointi = pp.meshPointMap()[meshPointi];
1304 sumThickness += thickness[ppPointi];
1305 sumNearWallThickness += layerParams.firstLayerThickness
1307 patchNLayers[ppPointi],
1308 firstLayerThickness[ppPointi],
1309 finalLayerThickness[ppPointi],
1310 thickness[ppPointi],
1311 expansionRatio[ppPointi]
1320 scalar avgThickness = 0;
1321 scalar avgNearWallThickness = 0;
1328 avgNearWallThickness =
1336 <<
returnReduce(patches[patchi].size(), sumOp<scalar>())
1337 <<
" " <<
setw(6) << layerParams.numLayers()[
patchi]
1338 <<
" " <<
setw(8) << avgNearWallThickness
1339 <<
" " <<
setw(8) << avgThickness
1348 void Foam::snappyLayerDriver::syncPatchDisplacement
1354 List<extrudeMode>& extrudeStatus
1357 const fvMesh& mesh = meshRefiner_.mesh();
1358 const labelList& meshPoints = pp.meshPoints();
1360 label nChangedTotal = 0;
1372 minMagSqrEqOp<vector>(),
1379 if (
mag(patchDisp[i]) < minThickness[i])
1397 labelList syncPatchNLayers(patchNLayers);
1410 forAll(syncPatchNLayers, i)
1412 if (syncPatchNLayers[i] != patchNLayers[i])
1441 forAll(syncPatchNLayers, i)
1443 if (syncPatchNLayers[i] != patchNLayers[i])
1460 nChangedTotal += nChanged;
1479 void Foam::snappyLayerDriver::getPatchDisplacement
1486 List<extrudeMode>& extrudeStatus
1489 Info<< nl <<
"Determining displacement for added points" 1490 <<
" according to pointNormal ..." <<
endl;
1492 const fvMesh& mesh = meshRefiner_.mesh();
1493 const vectorField& faceNormals = pp.faceNormals();
1495 const pointField& localPoints = pp.localPoints();
1507 patchDisp = thickness*pointNormals;
1510 label nNoVisNormal = 0;
1511 label nExtrudeRemove = 0;
1515 forAll(pointNormals, patchPointi)
1517 label meshPointi = pp.meshPoints()[patchPointi];
1519 if (extrudeStatus[patchPointi] == NOEXTRUDE)
1522 patchNLayers[patchPointi] = 0;
1523 patchDisp[patchPointi] =
Zero;
1528 const vector& n = pointNormals[patchPointi];
1534 Pout<<
"No valid normal for point " << meshPointi
1535 <<
' ' << pp.points()[meshPointi]
1536 <<
"; setting displacement to " 1537 << patchDisp[patchPointi]
1541 extrudeStatus[patchPointi] = EXTRUDEREMOVE;
1548 forAll(extrudeStatus, patchPointi)
1550 if (extrudeStatus[patchPointi] == EXTRUDEREMOVE)
1555 const labelList& pEdges = pp.pointEdges()[patchPointi];
1559 label edgeI = pEdges[i];
1561 label otherPointi = pp.edges()[edgeI].otherVertex(patchPointi);
1563 if (extrudeStatus[otherPointi] != NOEXTRUDE)
1565 avg += localPoints[otherPointi] + patchDisp[otherPointi];
1574 Pout<<
"Displacement at illegal point " 1575 << localPoints[patchPointi]
1577 << (avg / nPoints - localPoints[patchPointi])
1581 patchDisp[patchPointi] =
1583 - localPoints[patchPointi];
1596 <<
" points with point normal pointing through faces." << nl
1597 <<
"Reset displacement at " 1599 <<
" points to average of surrounding points." <<
endl;
1602 syncPatchDisplacement
1615 bool Foam::snappyLayerDriver::sameEdgeNeighbour
1618 const label myGlobalFacei,
1619 const label nbrGlobFacei,
1623 const labelList& eFaces = globalEdgeFaces[edgeI];
1624 if (eFaces.size() == 2)
1626 return edge(myGlobalFacei, nbrGlobFacei) == edge(eFaces[0], eFaces[1]);
1635 void Foam::snappyLayerDriver::getVertexString
1641 const label myGlobFacei,
1642 const label nbrGlobFacei,
1643 DynamicList<label>& vertices
1646 const labelList& fEdges = pp.faceEdges()[facei];
1660 label prevFp = fEdges.rcIndex(startFp);
1680 label nextFp = fEdges.fcIndex(endFp);
1697 const face& f = pp.localFaces()[facei];
1702 vertices.append(f[fp]);
1705 vertices.append(f[fp]);
1707 vertices.append(f[fp]);
1714 Foam::label Foam::snappyLayerDriver::truncateDisplacement
1716 const globalIndex& globalFaces,
1720 const faceSet& illegalPatchFaces,
1723 List<extrudeMode>& extrudeStatus
1726 const fvMesh& mesh = meshRefiner_.mesh();
1730 const Map<label>& meshPointMap = pp.meshPointMap();
1734 label facei = iter.key();
1736 if (mesh.isInternalFace(facei))
1739 <<
"Faceset " << illegalPatchFaces.name()
1740 <<
" contains internal face " << facei << nl
1744 const face& f = mesh.faces()[facei];
1749 if (meshPointMap.found(f[fp]))
1751 label patchPointi = meshPointMap[f[fp]];
1753 if (extrudeStatus[patchPointi] != NOEXTRUDE)
1768 forAll(patchDisp, patchPointi)
1770 if (
mag(patchDisp[patchPointi]) < minThickness[patchPointi])
1786 else if (extrudeStatus[patchPointi] == NOEXTRUDE)
1789 patchDisp[patchPointi] =
Zero;
1790 patchNLayers[patchPointi] = 0;
1795 const faceList& localFaces = pp.localFaces();
1799 syncPatchDisplacement
1820 const face& localF = localFaces[i];
1825 extrudeMode prevMode = extrudeStatus[localF.prevLabel(0)];
1829 extrudeMode fpMode = extrudeStatus[localF[fp]];
1831 if (prevMode == NOEXTRUDE && fpMode != NOEXTRUDE)
1858 reduce(nPinched, sumOp<label>());
1860 Info<<
"truncateDisplacement : Unextruded " << nPinched
1861 <<
" faces due to non-consecutive vertices being extruded." <<
endl;
1884 label nButterFly = 0;
1886 DynamicList<label> stringedVerts;
1887 forAll(pp.edges(), edgeI)
1889 const labelList& globFaces = edgeGlobalFaces[edgeI];
1891 if (globFaces.size() == 2)
1893 label myFacei = pp.edgeFaces()[edgeI][0];
1894 label myGlobalFacei = globalFaces.toGlobal
1896 pp.addressing()[myFacei]
1898 label nbrGlobalFacei =
1900 globFaces[0] != myGlobalFacei
1917 extrudeStatus[stringedVerts[0]] != NOEXTRUDE
1918 || extrudeStatus[stringedVerts.last()] != NOEXTRUDE
1923 for (
label i = 1; i < stringedVerts.size()-1; i++)
1927 extrudeStatus[stringedVerts[i]] == NOEXTRUDE
1959 reduce(nButterFly, sumOp<label>());
1961 Info<<
"truncateDisplacement : Unextruded " << nButterFly
1962 <<
" faces due to stringed edges with inconsistent extrusion." 1973 label nDiffering = 0;
2017 if (nPinched+nButterFly+nDiffering == 0)
2029 void Foam::snappyLayerDriver::setupLayerInfoTruncation
2033 const List<extrudeMode>& extrudeStatus,
2034 const label nBufferCellsNoExtrude,
2039 Info<< nl <<
"Setting up information for layer truncation ..." <<
endl;
2041 const fvMesh& mesh = meshRefiner_.mesh();
2043 if (nBufferCellsNoExtrude < 0)
2045 Info<< nl <<
"Performing no layer truncation." 2046 <<
" nBufferCellsNoExtrude set to less than 0 ..." <<
endl;
2049 forAll(pp.localFaces(), patchFacei)
2051 const face& f = pp.localFaces()[patchFacei];
2055 if (patchNLayers[f[fp]] > 0)
2057 nPatchFaceLayers[patchFacei] = patchNLayers[f[fp]];
2062 nPatchPointLayers = patchNLayers;
2065 forAll(nPatchFaceLayers, patchFacei)
2067 if (nPatchFaceLayers[patchFacei] == -1)
2069 nPatchFaceLayers[patchFacei] = 0;
2078 forAll(pp.localFaces(), patchFacei)
2080 const face& f = pp.localFaces()[patchFacei];
2085 bool noExtrude =
false;
2090 if (extrudeStatus[f[fp]] == NOEXTRUDE)
2094 mLevel =
max(mLevel, patchNLayers[f[fp]]);
2104 nPatchFaceLayers[patchFacei] = 1;
2105 maxLevel[patchFacei] = mLevel;
2109 maxLevel[patchFacei] = mLevel;
2124 for (
label ilevel = 1; ilevel < nLevels; ilevel++)
2130 nBuffer = nBufferCellsNoExtrude - 1;
2134 nBuffer = nBufferCellsNoExtrude;
2137 for (
label ibuffer = 0; ibuffer < nBuffer + 1; ibuffer++)
2139 labelList tempCounter(nPatchFaceLayers);
2141 boolList foundNeighbour(pp.nPoints(),
false);
2143 forAll(pp.meshPoints(), patchPointi)
2145 forAll(pointFaces[patchPointi], pointFacei)
2147 label facei = pointFaces[patchPointi][pointFacei];
2151 nPatchFaceLayers[facei] != -1
2152 && maxLevel[facei] > 0
2155 foundNeighbour[patchPointi] =
true;
2170 forAll(pp.meshPoints(), patchPointi)
2172 if (foundNeighbour[patchPointi])
2174 forAll(pointFaces[patchPointi], pointFacei)
2176 label facei = pointFaces[patchPointi][pointFacei];
2179 nPatchFaceLayers[facei] == -1
2180 && maxLevel[facei] > 0
2181 && ilevel < maxLevel[facei]
2184 tempCounter[facei] = ilevel;
2189 nPatchFaceLayers = tempCounter;
2193 forAll(pp.localFaces(), patchFacei)
2195 if (nPatchFaceLayers[patchFacei] == -1)
2197 nPatchFaceLayers[patchFacei] = maxLevel[patchFacei];
2201 forAll(pp.meshPoints(), patchPointi)
2203 if (extrudeStatus[patchPointi] != NOEXTRUDE)
2205 forAll(pointFaces[patchPointi], pointFacei)
2207 label face = pointFaces[patchPointi][pointFacei];
2208 nPatchPointLayers[patchPointi] =
max 2210 nPatchPointLayers[patchPointi],
2211 nPatchFaceLayers[face]
2217 nPatchPointLayers[patchPointi] = 0;
2233 bool Foam::snappyLayerDriver::cellsUseFace
2235 const polyMesh& mesh,
2242 const cell& cFaces = mesh.cells()[cellLabels[i]];
2246 if (faces.found(cFaces[cFacei]))
2259 Foam::label Foam::snappyLayerDriver::checkAndUnmark
2261 const addPatchCellLayer& addLayer,
2262 const dictionary& meshQualityDict,
2263 const bool additionalReporting,
2264 const List<labelPair>& baffles,
2266 const fvMesh& newMesh,
2270 List<extrudeMode>& extrudeStatus
2274 Info<< nl <<
"Checking mesh with layer ..." <<
endl;
2275 faceSet wrongFaces(newMesh,
"wrongFaces", newMesh.nFaces()/1000);
2287 <<
" (concave, zero area or negative cell pyramid volume)" 2301 addLayer.layerFaces()
2309 const label nReportMax = 10;
2310 DynamicField<point> disabledFaceCentres(nReportMax);
2312 forAll(addedCells, oldPatchFacei)
2316 const labelList& fCells = addedCells[oldPatchFacei];
2318 if (cellsUseFace(newMesh, fCells, wrongFaces))
2325 pp.localFaces()[oldPatchFacei],
2332 if (additionalReporting && (nChanged < nReportMax))
2334 disabledFaceCentres.
append 2336 pp.faceCentres()[oldPatchFacei]
2348 if (additionalReporting)
2357 label nReportLocal = nChanged;
2358 if (nChangedTotal > nReportMax)
2373 Pout<<
"Checked mesh with layers. Disabled extrusion at " <<
endl;
2374 for (
label i=0; i < nReportLocal; i++)
2376 Pout<<
" " << disabledFaceCentres[i] <<
endl;
2382 if (nReportTotal < nChangedTotal)
2384 Info<<
"Suppressed disabled extrusion message for other " 2385 << nChangedTotal - nReportTotal <<
" faces." <<
endl;
2389 return nChangedTotal;
2393 Foam::label Foam::snappyLayerDriver::countExtrusion
2396 const List<extrudeMode>& extrudeStatus
2400 label nExtruded = 0;
2402 const faceList& localFaces = pp.localFaces();
2406 const face& localFace = localFaces[i];
2410 if (extrudeStatus[localFace[fp]] != NOEXTRUDE)
2424 void Foam::snappyLayerDriver::getLayerCellsFaces
2426 const polyMesh& mesh,
2427 const addPatchCellLayer& addLayer,
2434 cellNLayers.setSize(mesh.nCells());
2436 faceRealThickness.setSize(mesh.nFaces());
2437 faceRealThickness = 0;
2445 forAll(addedCells, oldPatchFacei)
2447 const labelList& added = addedCells[oldPatchFacei];
2449 const labelList& layer = layerFaces[oldPatchFacei];
2455 cellNLayers[added[i]] = layer.size()-1;
2460 forAll(layerFaces, oldPatchFacei)
2462 const labelList& layer = layerFaces[oldPatchFacei];
2463 const scalar realThickness = oldRealThickness[oldPatchFacei];
2469 for (
label i = 1; i < layer.size(); i++)
2471 faceRealThickness[layer[i]] = realThickness;
2478 void Foam::snappyLayerDriver::printLayerData
2487 const polyBoundaryMesh& pbm = mesh.boundaryMesh();
2489 int oldPrecision =
Info().precision();
2492 label maxPatchNameLen = 0;
2495 label patchi = patchIDs[i];
2496 word patchName = pbm[
patchi].name();
2497 maxPatchNameLen =
max(maxPatchNameLen,
label(patchName.size()));
2501 <<
setf(ios_base::left) <<
setw(maxPatchNameLen) <<
"patch" 2502 <<
setw(0) <<
" faces layers overall thickness" << nl
2503 <<
setf(ios_base::left) <<
setw(maxPatchNameLen) <<
" " 2504 <<
setw(0) <<
" [m] [%]" << nl
2505 <<
setf(ios_base::left) <<
setw(maxPatchNameLen) <<
"-----" 2506 <<
setw(0) <<
" ----- ------ --- ---" <<
endl;
2511 label patchi = patchIDs[i];
2512 const polyPatch& pp = pbm[
patchi];
2514 label sumSize = pp.size();
2517 const labelList& faceCells = pp.faceCells();
2518 label sumNLayers = 0;
2521 sumNLayers += cellNLayers[faceCells[i]];
2534 scalar sumRealThickness =
sum(patchReal);
2535 scalar sumFraction = 0;
2538 if (patchWanted[i] > VSMALL)
2540 sumFraction += (patchReal[i]/patchWanted[i]);
2545 reduce(sumSize, sumOp<label>());
2546 reduce(sumNLayers, sumOp<label>());
2547 reduce(sumRealThickness, sumOp<scalar>());
2548 reduce(sumFraction, sumOp<scalar>());
2551 scalar avgLayers = 0;
2553 scalar avgFraction = 0;
2556 avgLayers = scalar(sumNLayers)/sumSize;
2557 avgReal = sumRealThickness/sumSize;
2558 avgFraction = sumFraction/sumSize;
2563 <<
" " <<
setw(8) << sumSize
2564 <<
" " <<
setw(8) << avgLayers
2565 <<
" " <<
setw(8) << avgReal
2566 <<
" " <<
setw(8) << 100*avgFraction
2573 bool Foam::snappyLayerDriver::writeLayerData
2588 forAll(cellNLayers, celli)
2590 if (cellNLayers[celli] > 0)
2595 cellSet addedCellSet(mesh,
"addedCells", nAdded);
2596 forAll(cellNLayers, celli)
2598 if (cellNLayers[celli] > 0)
2600 addedCellSet.insert(celli);
2603 addedCellSet.instance() = meshRefiner_.timeName();
2606 <<
" added cells to cellSet " 2607 << addedCellSet.name() <<
endl;
2608 bool ok = addedCellSet.
write();
2613 for (
label facei = 0; facei < mesh.nInternalFaces(); facei++)
2615 if (faceRealThickness[facei] > 0)
2621 faceSet layerFacesSet(mesh,
"layerFaces", nAdded);
2622 for (
label facei = 0; facei < mesh.nInternalFaces(); facei++)
2624 if (faceRealThickness[facei] > 0)
2626 layerFacesSet.insert(facei);
2629 layerFacesSet.instance() = meshRefiner_.timeName();
2632 <<
" faces inside added layer to faceSet " 2633 << layerFacesSet.name() <<
endl;
2634 bool ok = layerFacesSet.
write();
2641 Info<< nl <<
"Writing fields with layer information:" <<
incrIndent 2649 mesh.time().timeName(),
2657 fixedValueFvPatchScalarField::typeName
2659 const polyBoundaryMesh& pbm = mesh.boundaryMesh();
2661 volScalarField::Boundary& fldBf =
2662 fld.boundaryFieldRef();
2666 label patchi = patchIDs[i];
2667 const polyPatch& pp = pbm[
patchi];
2668 const labelList& faceCells = pp.faceCells();
2672 pfld[i] = cellNLayers[faceCells[i]];
2678 bool ok =
fld.write();
2687 mesh.time().timeName(),
2695 fixedValueFvPatchScalarField::typeName
2698 const polyBoundaryMesh& pbm = mesh.boundaryMesh();
2700 volScalarField::Boundary& fldBf =
2701 fld.boundaryFieldRef();
2705 label patchi = patchIDs[i];
2713 bool ok =
fld.write();
2721 "thicknessFraction",
2722 mesh.time().timeName(),
2730 fixedValueFvPatchScalarField::typeName
2733 const polyBoundaryMesh& pbm = mesh.boundaryMesh();
2735 volScalarField::Boundary& fldBf =
2736 fld.boundaryFieldRef();
2740 label patchi = patchIDs[i];
2755 if (patchWanted[i] > VSMALL)
2757 pfld[i] = patchReal[i]/patchWanted[i];
2764 <<
" : overall layer thickness (fraction" 2765 <<
" of desired thickness)" <<
endl;
2766 bool ok =
fld.write();
2779 faceWantedThickness,
2790 Foam::snappyLayerDriver::snappyLayerDriver
2797 meshRefiner_(meshRefiner),
2798 globalToMasterPatch_(globalToMasterPatch),
2799 globalToSlavePatch_(globalToSlavePatch)
2819 <<
"Merging all faces of a cell" << nl
2820 <<
"---------------------------" << nl
2821 <<
" - which are on the same patch" << nl
2822 <<
" - which make an angle < " << planarAngle
2825 <<
" (cos:" << minCos <<
')' << nl
2826 <<
" - as long as the resulting face doesn't become concave" 2829 <<
" (0=straight, 180=fully concave)" << nl
2832 const fvMesh& mesh = meshRefiner_.mesh();
2840 duplicateFace[cpl[0]] = cpl[1];
2841 duplicateFace[cpl[1]] = cpl[0];
2844 label nChanged = meshRefiner_.mergePatchFacesUndo
2848 meshRefiner_.meshedPatches(),
2853 nChanged += meshRefiner_.mergeEdgesUndo(minCos, motionDict);
2862 const label nAllowableErrors,
2867 fvMesh& mesh = meshRefiner_.mesh();
2872 meshRefiner_.createZoneBaffles
2874 globalToMasterPatch_,
2875 globalToSlavePatch_,
2879 if (debug&meshRefinement::MESH)
2882 Info<<
"Writing baffled mesh to time " 2883 << meshRefiner_.timeName() <<
endl;
2892 mesh.
time().
path()/meshRefiner_.timeName()
2927 determineSidePatches
2948 label nIdealTotAddedCells = 0;
3008 const scalar edge0Len =
3009 meshRefiner_.meshCutter().level0EdgeLength();
3010 const labelList& cellLevel = meshRefiner_.meshCutter().cellLevel();
3039 for (
label i = 0; i < layerParams.
nGrow(); i++)
3053 const scalar edge0Len = meshRefiner_.meshCutter().level0EdgeLength();
3054 const labelList& cellLevel = meshRefiner_.meshCutter().cellLevel();
3064 meshRefiner_.timeName(),
3071 calculateLayerThickness
3090 makeLayerDisplacementField
3103 combinedDict.
merge(motionDict);
3105 combinedDict.add(
"minThicknessName", minThickness.name());
3133 avgPointData(pp, thickness);
3137 for (
label iteration = 0; iteration < layerParams.
nLayerIter(); iteration++)
3140 <<
"Layer addition iteration " << iteration << nl
3141 <<
"--------------------------" <<
endl;
3149 : motionDict.
subDict(
"relaxed")
3154 Info<<
"Switched to relaxed meshQuality constraints." <<
endl;
3160 syncPatchDisplacement
3170 getPatchDisplacement
3203 combinedDict.
merge(motionDict);
3205 combinedDict.merge(meshQualityDict);
3207 combinedDict.add(
"minThicknessName", minThickness.name());
3210 medialAxisMoverPtr().move
3217 pp().movePoints(mesh.
points());
3220 patchDisp = oldPatchPos - pp().localPoints();
3226 faceSet dummySet(mesh,
"wrongPatchFaces", 0);
3227 truncateDisplacement
3245 mesh.
time().
path()/
"layer_" + meshRefiner_.timeName(),
3252 Info<<
"Writing shrunk mesh to time " 3253 << meshRefiner_.timeName() <<
endl;
3266 mesh.
time().
path()/meshRefiner_.timeName()
3281 labelList nPatchFaceLayers(pp().size(), -1);
3282 setupLayerInfoTruncation
3296 forAll(nPatchPointLayers, i)
3300 nPatchPointLayers[i],
3303 finalDisp[i] = ratio*patchDisp[i];
3307 const scalarField invExpansionRatio(1.0/expansionRatio);
3332 savedMeshMod = meshMod;
3354 fvMesh& newMesh = newMeshPtr();
3376 newMeshBaffles[i][0] = map().reverseFaceMap()[p[0]];
3377 newMeshBaffles[i][1] = map().reverseFaceMap()[p[1]];
3385 avgPointData(pp,
mag(patchDisp))(),
3393 label nAddedCells = 0;
3394 forAll(cellNLayers, celli)
3396 if (cellNLayers[celli] > 0)
3403 if (debug&meshRefinement::MESH)
3405 Info<<
"Writing layer mesh to time " << meshRefiner_.timeName()
3409 cellSet addedCellSet(newMesh,
"addedCells", nAddedCells);
3410 forAll(cellNLayers, celli)
3412 if (cellNLayers[celli] > 0)
3414 addedCellSet.
insert(celli);
3417 addedCellSet.
instance() = meshRefiner_.timeName();
3420 <<
" added cells to cellSet " << addedCellSet.
name() <<
endl;
3421 addedCellSet.
write();
3423 faceSet layerFacesSet(newMesh,
"layerFaces", newMesh.
nFaces()/100);
3426 if (faceRealThickness[facei] > 0)
3428 layerFacesSet.
insert(facei);
3431 layerFacesSet.instance() = meshRefiner_.timeName();
3434 <<
" faces inside added layer to faceSet " 3435 << layerFacesSet.name() <<
endl;
3436 layerFacesSet.
write();
3440 label nTotChanged = checkAndUnmark
3454 label nTotExtruded = countExtrusion(pp, extrudeStatus);
3458 Info<<
"Extruding " << nTotExtruded
3459 <<
" out of " << nTotFaces
3460 <<
" faces (" << 100.0*nTotExtruded/nTotFaces <<
"%)." 3461 <<
" Removed extrusion at " << nTotChanged <<
" faces." 3463 <<
"Added " << nTotAddedCells <<
" out of " << nIdealTotAddedCells
3464 <<
" cells (" << 100.0*nTotAddedCells/nIdealTotAddedCells <<
"%)." 3467 if (nTotChanged == 0)
3474 pp().movePoints(mesh.
points());
3477 for (
label i = 0; i < layerParams.
nGrow(); i++)
3506 if (map().hasMotionPoints())
3519 meshRefiner_.updateMesh(map,
labelList(0));
3528 p[0] = map().reverseFaceMap()[p[0]];
3529 p[1] = map().reverseFaceMap()[p[1]];
3537 Info<<
"Converting " << nBaffles
3538 <<
" baffles back into zoned faces ..." 3547 Info<<
"Converted baffles in = " 3548 << meshRefiner_.mesh().time().cpuTimeIncrement()
3549 <<
" s\n" << nl <<
endl;
3559 <<
"Doing final balancing" << nl
3560 <<
"---------------------" << nl
3579 map().distributeCellData(cellNLayers);
3580 map().distributeFaceData(faceWantedThickness);
3581 map().distributeFaceData(faceRealThickness);
3593 faceWantedThickness,
3604 const bool preBalance,
3609 const fvMesh& mesh = meshRefiner_.mesh();
3612 <<
"Shrinking and layer addition phase" << nl
3613 <<
"----------------------------------" << nl
3616 Info<<
"Using mesh parameters " << motionDict << nl <<
endl;
3619 mergePatchFacesUndo(layerParams, motionDict);
3626 label nFacesWithLayers = 0;
3627 forAll(numLayers, patchi)
3629 if (numLayers[patchi] > 0)
3641 <<
"Ignoring layers on coupled patch " << pp.
name()
3650 Info<< nl <<
"No layers to generate ..." <<
endl;
3655 checkMeshManifold();
3658 Info<<
"Checking initial mesh ..." <<
endl;
3667 Info<<
"Detected " << nInitErrors <<
" illegal faces" 3668 <<
" (concave, zero area or negative cell pyramid volume)" 3676 <<
"Doing initial balancing" << nl
3677 <<
"-----------------------" << nl
3681 forAll(numLayers, patchi)
3683 if (numLayers[patchi] > 0)
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 const Vector< scalar > max
List< labelList > labelListList
A List of labelList.
void clearOut()
Clear all geometry and addressing.
void inplaceReorder(const labelUList &oldToNew, ListType &)
Inplace reorder the elements of a list.
const labelList & numLayers() const
How many layers to add:
scalar featureAngle() const
#define forAll(list, i)
Loop across all elements in list.
Simple container to keep together layer specific information.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
label nLayerIter() const
Number of overall layer addition iterations.
Ostream & indent(Ostream &os)
Indent stream.
errorManipArg< error, int > exit(error &err, const int errNo=1)
A list of keyword definitions, which are a keyword followed by any number of values (e...
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
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.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
static void setDisplacement(const labelList &patchIDs, const indirectPrimitivePatch &pp, pointField &patchDisp, pointVectorField &displacement)
Set displacement field from displacement on patch points.
const dictionary & dict() const
Unit conversion functions.
static autoPtr< externalDisplacementMeshMover > New(const word &type, const dictionary &dict, const List< labelPair > &baffles, pointVectorField &pointDisplacement)
Return a reference to the selected meshMover model.
const edgeList & edges() const
Return mesh edges. Uses calcEdges.
void size(const label)
Override size to be inconsistent with allocated storage.
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
static int myProcNo(const label communicator=0)
Number of this process (starting from masterNo() = 0)
dimensioned< vector > dimensionedVector
Dimensioned vector obtained from generic dimensioned type.
static word newName(const label myProcNo, const label neighbProcNo)
Return the name of a processorPolyPatch.
Ostream & endl(Ostream &os)
Add newline and flush stream.
static const Vector< scalar > rootMax
static writeType writeLevel()
Get/set write level.
labelList identity(const label len)
Create identity map (map[i] == i) of given length.
bool relativeSizes() const
Are size parameters relative to inner cell size or.
HashTable< label, label, Hash< label > >::const_iterator const_iterator
void addLayers(const layerParameters &layerParams, const dictionary &motionDict, const labelList &patchIDs, const label nAllowableErrors, decompositionMethod &decomposer, fvMeshDistribute &distributor)
Add cell layers.
label nRelaxedIter() const
Number of iterations after which relaxed motion rules.
static const Vector< scalar > one
label size() const
Return number of elements in table.
Vector< scalar > vector
A scalar version of the templated Vector.
PrimitivePatch< face, IndirectList, const pointField & > indirectPrimitivePatch
Foam::indirectPrimitivePatch.
bool insert(const Key &key)
Insert a new entry.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
scalar degToRad(const scalar deg)
Conversion from degrees to radians.
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
static labelPairList findDuplicateFacePairs(const polyMesh &)
Helper routine to find all baffles (two boundary faces.
virtual const pointField & points() const
Return raw points.
static const pointMesh & New(const polyMesh &mesh)
List< bool > boolList
Bool container classes.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
HashSet< label, Hash< label > > labelHashSet
A HashSet with label keys.
static void updateList(const labelList &newToOld, const T &nullValue, List< T > &elems)
Helper: reorder list according to map.
Omanip< int > setprecision(const int i)
Calculates a unique integer (label so might not have enough room - 2G max) for processor + local inde...
Sends/receives parts of mesh+fvfields to neighbouring processors. Used in load balancing.
vectorField pointField
pointField is a vectorField.
virtual void updateMesh(const mapPolyMesh &mpm)
Update mesh corresponding to the given map.
An ordered pair of two objects of type <T> with first() and second() elements.
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))
dimensionedScalar cos(const dimensionedScalar &ds)
line< point, const point & > linePointRef
Line using referred points.
scalar maxFaceThicknessRatio() const
Stop layer growth on highly warped cells.
virtual bool coupled() const
Return true if this patch is geometrically coupled (i.e. faces and.
Adds layers of cells to outside of polyPatch. Can optionally create stand-alone extruded mesh (addToM...
void doLayers(const dictionary &shrinkDict, const dictionary &motionDict, const layerParameters &layerParams, const bool preBalance, decompositionMethod &decomposer, fvMeshDistribute &distributor)
Add layers according to the dictionary settings.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
const Switch & additionalReporting() const
void append(const T &)
Append an element at the end of the list.
label nGrow() const
If points get not extruded do nGrow layers of connected faces.
Smanip< ios_base::fmtflags > setf(const ios_base::fmtflags flags)
static const label labelMax
List< label > labelList
A List of labels.
const labelListList & pointEdges() const
Abstract base class for decomposition.
const word & name() const
Return name.
labelListList addedCells() const
Added cells given current mesh & layerfaces.
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
errorManip< error > abort(error &err)
const word & meshShrinker() const
Type of mesh shrinker.
prefixOSstream Pout(cout,"Pout")
Istream and Ostream manipulators taking arguments.
Type gMax(const FieldField< Field, Type > &f)
defineTypeNameAndDebug(combustionModel, 0)
Ostream & decrIndent(Ostream &os)
Decrement the indent level.
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurence of given element and return index,.
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
static autoPtr< indirectPrimitivePatch > makePatch(const polyMesh &, const labelList &)
Create patch from set of patches.
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
word name(const complex &)
Return a string representation of a complex.
scalar finalLayerThicknessRatio(const label nLayers, const scalar expansionRatio) const
Determine ratio of final layer thickness to.
void setInstance(const fileName &)
Set the instance for mesh files.
Helper class which maintains intersections of (changing) mesh with (static) surfaces.
virtual tmp< scalarField > movePoints(const pointField &)
Move points, returns volumes swept by faces in motion.
void updateMesh(const mapPolyMesh &, const labelList &faceMap, const labelList &pointMap)
Update any locally stored mesh information. Gets additional.
List< word > wordList
A List of words.
void setSize(const label)
Reset size of List.
static bool & parRun()
Is this a parallel run?
static label nProcs(const label communicator=0)
Number of processes in parallel run.
const dimensionSet dimless(0, 0, 0, 0, 0, 0, 0)
vector point
Point is a vector.
#define WarningInFunction
Report a warning using Foam::Warning.
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
const labelUList & faceCells() const
Return face-cell addressing.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
A collection of cell labels.
Mesh data needed to do the Finite Volume discretisation.
A List with indirect addressing.
Direct mesh changes based on v1.3 polyTopoChange syntax.
scalar concaveAngle() const
GeometricField< vector, pointPatchField, pointMesh > pointVectorField
virtual bool write() const
Write using setting from DB.
void mergePatchFacesUndo(const layerParameters &layerParams, const dictionary &motionDict)
Merge patch faces on same cell.
SubField< scalar > subField
Declare type of subField.
bool merge(const dictionary &)
Merge entries from the given dictionary.
dimensioned< scalar > mag(const dimensioned< Type > &)
static labelListList globalEdgeFaces(const polyMesh &, const globalIndex &globalFaces, const indirectPrimitivePatch &pp)
Per patch edge the pp faces (in global indices) using it. Uses.
Field< vector > vectorField
Specialisation of Field<T> for vector.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
virtual Ostream & write(const token &)=0
Write next token to stream.
Mesh consisting of general polyhedral cells.
Omanip< int > setw(const int i)
A class for managing temporary objects.
A patch is a list of labels that address the faces in the global face list.
fileName path() const
Return path.
Ostream & incrIndent(Ostream &os)
Increment the indent level.
void setRefinement(const globalIndex &globalFaces, const labelListList &globalEdgeFaces, const scalarField &expansionRatio, const indirectPrimitivePatch &pp, const labelList &sidePatchID, const labelList &exposedPatchID, const labelList &nFaceLayers, const labelList &nPointLayers, const vectorField &firstLayerDisp, polyTopoChange &meshMod)
Play commands into polyTopoChange to create layers on top.
label nBufferCellsNoExtrude() const
Create buffer region for new layer terminations.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
static void calcSidePatch(const polyMesh &, const globalIndex &globalFaces, const labelListList &globalEdgeFaces, const indirectPrimitivePatch &pp, labelList &sidePatchID, label &nPatches, Map< label > &nbrProcToPatch, Map< label > &patchToNbrProc)
Boundary edges get extruded into boundary faces. Determine patch.
const fileName & instance() const
label nInternalFaces() const
A primitive field of type <T> with automated input and output.
virtual bool write() const
Write mesh using IO settings from time.
const word & name() const
Return reference to name.
static const label labelMin
const word & name() const
Return name.
const Time & time() const
Return the top-level database.
label size() const
Return the number of elements in the UPtrList.