76 void Foam::autoLayerDriver::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::autoLayerDriver::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::autoLayerDriver::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::autoLayerDriver::unmarkExtrusion
218 const label patchPointI,
221 List<extrudeMode>& extrudeStatus
224 if (extrudeStatus[patchPointI] == EXTRUDE)
226 extrudeStatus[patchPointI] = NOEXTRUDE;
227 patchNLayers[patchPointI] = 0;
231 else if (extrudeStatus[patchPointI] == EXTRUDEREMOVE)
233 extrudeStatus[patchPointI] = NOEXTRUDE;
234 patchNLayers[patchPointI] = 0;
246 bool Foam::autoLayerDriver::unmarkExtrusion
248 const face& localFace,
251 List<extrudeMode>& extrudeStatus
254 bool unextruded =
false;
277 void Foam::autoLayerDriver::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::autoLayerDriver::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::autoLayerDriver::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::autoLayerDriver::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();
709 label wantedLayers = patchToNLayers[patchI];
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::autoLayerDriver::makeLayerDisplacementField
808 const pointMesh& pMesh,
813 const pointBoundaryMesh& pointPatches = pMesh.boundary();
818 slipPointPatchVectorField::typeName
820 wordList actualPatchTypes(patchFieldTypes.size());
821 forAll(pointPatches, patchI)
823 actualPatchTypes[patchI] = pointPatches[patchI].type();
830 if (numLayers[patchI] == 0)
832 patchFieldTypes[patchI] =
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::autoLayerDriver::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)
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::autoLayerDriver::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++)
1020 label nbrProcI = patchToNbrProc[patchI];
1027 dictionary patchDict;
1028 patchDict.add(
"type", processorPolyPatch::typeName);
1030 patchDict.add(
"neighbProcNo", nbrProcI);
1031 patchDict.add(
"nFaces", 0);
1032 patchDict.add(
"startFace", mesh.nFaces());
1039 label procPatchI = meshRefiner_.appendPatch
1042 mesh.boundaryMesh().size(),
1046 wantedToAddedPatch.insert(patchI, procPatchI);
1052 label patchI = sidePatchID[i];
1054 if (fnd != wantedToAddedPatch.end())
1056 sidePatchID[i] = fnd();
1061 const_cast<polyBoundaryMesh&
>(mesh.boundaryMesh()).updateMesh();
1066 void Foam::autoLayerDriver::calculateLayerThickness
1070 const layerParameters& layerParams,
1073 const scalar edge0Len,
1080 const fvMesh& mesh = meshRefiner_.mesh();
1081 const polyBoundaryMesh& patches = mesh.boundaryMesh();
1088 scalarField firstLayerThickness(pp.nPoints(), GREAT);
1089 scalarField finalLayerThickness(pp.nPoints(), GREAT);
1093 minThickness.
setSize(pp.nPoints());
1094 minThickness = GREAT;
1098 label patchI = patchIDs[i];
1100 const labelList& meshPoints = patches[patchI].meshPoints();
1102 forAll(meshPoints, patchPointI)
1104 label ppPointI = pp.meshPointMap()[meshPoints[patchPointI]];
1106 firstLayerThickness[ppPointI] =
min 1108 firstLayerThickness[ppPointI],
1109 layerParams.firstLayerThickness()[patchI]
1111 finalLayerThickness[ppPointI] =
min 1113 finalLayerThickness[ppPointI],
1114 layerParams.finalLayerThickness()[patchI]
1116 totalThickness[ppPointI] =
min 1118 totalThickness[ppPointI],
1119 layerParams.thickness()[patchI]
1121 expRatio[ppPointI] =
min 1124 layerParams.expansionRatio()[patchI]
1126 minThickness[ppPointI] =
min 1128 minThickness[ppPointI],
1129 layerParams.minThickness()[patchI]
1138 firstLayerThickness,
1146 finalLayerThickness,
1184 if (layerParams.relativeSizes())
1188 min(layerParams.minThickness()) < 0
1189 ||
max(layerParams.minThickness()) > 2
1193 <<
"Thickness should be factor of local undistorted cell size." 1194 <<
" Valid values are [0..2]." << nl
1195 <<
" minThickness:" << layerParams.minThickness()
1207 label ownLevel = cellLevel[mesh.faceOwner()[pp.addressing()[i]]];
1209 const face& f = pp.localFaces()[i];
1213 maxPointLevel[f[fp]] =
max(maxPointLevel[f[fp]], ownLevel);
1227 forAll(maxPointLevel, pointI)
1230 scalar edgeLen = edge0Len/(1<<maxPointLevel[pointI]);
1231 firstLayerThickness[pointI] *= edgeLen;
1232 finalLayerThickness[pointI] *= edgeLen;
1233 totalThickness[pointI] *= edgeLen;
1234 minThickness[pointI] *= edgeLen;
1243 forAll(firstLayerThickness, pointI)
1245 thickness[pointI] = layerParams.layerThickness
1247 patchNLayers[pointI],
1248 firstLayerThickness[pointI],
1249 finalLayerThickness[pointI],
1250 totalThickness[pointI],
1254 expansionRatio[pointI] = layerParams.layerExpansionRatio
1256 patchNLayers[pointI],
1257 firstLayerThickness[pointI],
1258 finalLayerThickness[pointI],
1259 totalThickness[pointI],
1269 const polyBoundaryMesh& patches = mesh.boundaryMesh();
1271 int oldPrecision =
Info().precision();
1274 label maxPatchNameLen = 0;
1277 label patchI = patchIDs[i];
1278 word patchName = patches[patchI].name();
1279 maxPatchNameLen =
max(maxPatchNameLen,
label(patchName.size()));
1283 <<
setf(ios_base::left) <<
setw(maxPatchNameLen) <<
"patch" 1284 <<
setw(0) <<
" faces layers avg thickness[m]" << nl
1285 <<
setf(ios_base::left) <<
setw(maxPatchNameLen) <<
" " 1286 <<
setw(0) <<
" near-wall overall" << nl
1287 <<
setf(ios_base::left) <<
setw(maxPatchNameLen) <<
"-----" 1288 <<
setw(0) <<
" ----- ------ --------- -------" <<
endl;
1295 label patchI = patchIDs[i];
1297 const labelList& meshPoints = patches[patchI].meshPoints();
1299 scalar sumThickness = 0;
1300 scalar sumNearWallThickness = 0;
1301 label nMasterPoints = 0;
1303 forAll(meshPoints, patchPointI)
1305 label meshPointI = meshPoints[patchPointI];
1306 if (isMasterPoint[meshPointI])
1308 label ppPointI = pp.meshPointMap()[meshPointI];
1310 sumThickness += thickness[ppPointI];
1311 sumNearWallThickness += layerParams.firstLayerThickness
1313 patchNLayers[ppPointI],
1314 firstLayerThickness[ppPointI],
1315 finalLayerThickness[ppPointI],
1316 thickness[ppPointI],
1317 expansionRatio[ppPointI]
1326 scalar avgThickness = 0;
1327 scalar avgNearWallThickness = 0;
1334 avgNearWallThickness =
1342 <<
returnReduce(patches[patchI].size(), sumOp<scalar>())
1343 <<
" " <<
setw(6) << layerParams.numLayers()[patchI]
1344 <<
" " <<
setw(8) << avgNearWallThickness
1345 <<
" " <<
setw(8) << avgThickness
1354 void Foam::autoLayerDriver::syncPatchDisplacement
1360 List<extrudeMode>& extrudeStatus
1363 const fvMesh& mesh = meshRefiner_.mesh();
1364 const labelList& meshPoints = pp.meshPoints();
1366 label nChangedTotal = 0;
1378 minMagSqrEqOp<vector>(),
1385 if (
mag(patchDisp[i]) < minThickness[i])
1403 labelList syncPatchNLayers(patchNLayers);
1416 forAll(syncPatchNLayers, i)
1418 if (syncPatchNLayers[i] != patchNLayers[i])
1447 forAll(syncPatchNLayers, i)
1449 if (syncPatchNLayers[i] != patchNLayers[i])
1466 nChangedTotal += nChanged;
1485 void Foam::autoLayerDriver::getPatchDisplacement
1492 List<extrudeMode>& extrudeStatus
1495 Info<< nl <<
"Determining displacement for added points" 1496 <<
" according to pointNormal ..." <<
endl;
1498 const fvMesh& mesh = meshRefiner_.mesh();
1499 const vectorField& faceNormals = pp.faceNormals();
1501 const pointField& localPoints = pp.localPoints();
1513 patchDisp = thickness*pointNormals;
1516 label nNoVisNormal = 0;
1517 label nExtrudeRemove = 0;
1521 forAll(pointNormals, patchPointI)
1523 label meshPointI = pp.meshPoints()[patchPointI];
1525 if (extrudeStatus[patchPointI] == NOEXTRUDE)
1528 patchNLayers[patchPointI] = 0;
1534 const vector& n = pointNormals[patchPointI];
1540 Pout<<
"No valid normal for point " << meshPointI
1541 <<
' ' << pp.points()[meshPointI]
1542 <<
"; setting displacement to " 1543 << patchDisp[patchPointI]
1547 extrudeStatus[patchPointI] = EXTRUDEREMOVE;
1554 forAll(extrudeStatus, patchPointI)
1556 if (extrudeStatus[patchPointI] == EXTRUDEREMOVE)
1561 const labelList& pEdges = pp.pointEdges()[patchPointI];
1565 label edgeI = pEdges[i];
1567 label otherPointI = pp.edges()[edgeI].otherVertex(patchPointI);
1569 if (extrudeStatus[otherPointI] != NOEXTRUDE)
1571 avg += localPoints[otherPointI] + patchDisp[otherPointI];
1580 Pout<<
"Displacement at illegal point " 1581 << localPoints[patchPointI]
1583 << (avg / nPoints - localPoints[patchPointI])
1587 patchDisp[patchPointI] =
1589 - localPoints[patchPointI];
1602 <<
" points with point normal pointing through faces." << nl
1603 <<
"Reset displacement at " 1605 <<
" points to average of surrounding points." <<
endl;
1608 syncPatchDisplacement
1621 bool Foam::autoLayerDriver::sameEdgeNeighbour
1624 const label myGlobalFaceI,
1625 const label nbrGlobFaceI,
1629 const labelList& eFaces = globalEdgeFaces[edgeI];
1630 if (eFaces.size() == 2)
1632 return edge(myGlobalFaceI, nbrGlobFaceI) == edge(eFaces[0], eFaces[1]);
1641 void Foam::autoLayerDriver::getVertexString
1647 const label myGlobFaceI,
1648 const label nbrGlobFaceI,
1649 DynamicList<label>& vertices
1652 const labelList& fEdges = pp.faceEdges()[faceI];
1666 label prevFp = fEdges.rcIndex(startFp);
1686 label nextFp = fEdges.fcIndex(endFp);
1703 const face& f = pp.localFaces()[faceI];
1708 vertices.append(f[fp]);
1711 vertices.append(f[fp]);
1713 vertices.append(f[fp]);
1720 Foam::label Foam::autoLayerDriver::truncateDisplacement
1722 const globalIndex& globalFaces,
1726 const faceSet& illegalPatchFaces,
1729 List<extrudeMode>& extrudeStatus
1732 const fvMesh& mesh = meshRefiner_.mesh();
1736 const Map<label>& meshPointMap = pp.meshPointMap();
1740 label faceI = iter.key();
1742 if (mesh.isInternalFace(faceI))
1745 <<
"Faceset " << illegalPatchFaces.name()
1746 <<
" contains internal face " << faceI << nl
1750 const face& f = mesh.faces()[faceI];
1755 if (meshPointMap.found(f[fp]))
1757 label patchPointI = meshPointMap[f[fp]];
1759 if (extrudeStatus[patchPointI] != NOEXTRUDE)
1774 forAll(patchDisp, patchPointI)
1776 if (
mag(patchDisp[patchPointI]) < minThickness[patchPointI])
1792 else if (extrudeStatus[patchPointI] == NOEXTRUDE)
1796 patchNLayers[patchPointI] = 0;
1801 const faceList& localFaces = pp.localFaces();
1805 syncPatchDisplacement
1826 const face& localF = localFaces[i];
1831 extrudeMode prevMode = extrudeStatus[localF.prevLabel(0)];
1835 extrudeMode fpMode = extrudeStatus[localF[fp]];
1837 if (prevMode == NOEXTRUDE && fpMode != NOEXTRUDE)
1864 reduce(nPinched, sumOp<label>());
1866 Info<<
"truncateDisplacement : Unextruded " << nPinched
1867 <<
" faces due to non-consecutive vertices being extruded." <<
endl;
1890 label nButterFly = 0;
1892 DynamicList<label> stringedVerts;
1893 forAll(pp.edges(), edgeI)
1895 const labelList& globFaces = edgeGlobalFaces[edgeI];
1897 if (globFaces.size() == 2)
1899 label myFaceI = pp.edgeFaces()[edgeI][0];
1900 label myGlobalFaceI = globalFaces.toGlobal
1902 pp.addressing()[myFaceI]
1904 label nbrGlobalFaceI =
1906 globFaces[0] != myGlobalFaceI
1923 extrudeStatus[stringedVerts[0]] != NOEXTRUDE
1924 || extrudeStatus[stringedVerts.last()] != NOEXTRUDE
1929 for (
label i = 1; i < stringedVerts.size()-1; i++)
1933 extrudeStatus[stringedVerts[i]] == NOEXTRUDE
1965 reduce(nButterFly, sumOp<label>());
1967 Info<<
"truncateDisplacement : Unextruded " << nButterFly
1968 <<
" faces due to stringed edges with inconsistent extrusion." 1979 label nDiffering = 0;
2023 if (nPinched+nButterFly+nDiffering == 0)
2035 void Foam::autoLayerDriver::setupLayerInfoTruncation
2039 const List<extrudeMode>& extrudeStatus,
2040 const label nBufferCellsNoExtrude,
2045 Info<< nl <<
"Setting up information for layer truncation ..." <<
endl;
2047 const fvMesh& mesh = meshRefiner_.mesh();
2049 if (nBufferCellsNoExtrude < 0)
2051 Info<< nl <<
"Performing no layer truncation." 2052 <<
" nBufferCellsNoExtrude set to less than 0 ..." <<
endl;
2055 forAll(pp.localFaces(), patchFaceI)
2057 const face& f = pp.localFaces()[patchFaceI];
2061 if (patchNLayers[f[fp]] > 0)
2063 nPatchFaceLayers[patchFaceI] = patchNLayers[f[fp]];
2068 nPatchPointLayers = patchNLayers;
2071 forAll(nPatchFaceLayers, patchFaceI)
2073 if (nPatchFaceLayers[patchFaceI] == -1)
2075 nPatchFaceLayers[patchFaceI] = 0;
2084 forAll(pp.localFaces(), patchFaceI)
2086 const face& f = pp.localFaces()[patchFaceI];
2091 bool noExtrude =
false;
2096 if (extrudeStatus[f[fp]] == NOEXTRUDE)
2100 mLevel =
max(mLevel, patchNLayers[f[fp]]);
2110 nPatchFaceLayers[patchFaceI] = 1;
2111 maxLevel[patchFaceI] = mLevel;
2115 maxLevel[patchFaceI] = mLevel;
2130 for (
label ilevel = 1; ilevel < nLevels; ilevel++)
2136 nBuffer = nBufferCellsNoExtrude - 1;
2140 nBuffer = nBufferCellsNoExtrude;
2143 for (
label ibuffer = 0; ibuffer < nBuffer + 1; ibuffer++)
2145 labelList tempCounter(nPatchFaceLayers);
2147 boolList foundNeighbour(pp.nPoints(),
false);
2149 forAll(pp.meshPoints(), patchPointI)
2151 forAll(pointFaces[patchPointI], pointFaceI)
2153 label faceI = pointFaces[patchPointI][pointFaceI];
2157 nPatchFaceLayers[faceI] != -1
2158 && maxLevel[faceI] > 0
2161 foundNeighbour[patchPointI] =
true;
2176 forAll(pp.meshPoints(), patchPointI)
2178 if (foundNeighbour[patchPointI])
2180 forAll(pointFaces[patchPointI], pointFaceI)
2182 label faceI = pointFaces[patchPointI][pointFaceI];
2185 nPatchFaceLayers[faceI] == -1
2186 && maxLevel[faceI] > 0
2187 && ilevel < maxLevel[faceI]
2190 tempCounter[faceI] = ilevel;
2195 nPatchFaceLayers = tempCounter;
2199 forAll(pp.localFaces(), patchFaceI)
2201 if (nPatchFaceLayers[patchFaceI] == -1)
2203 nPatchFaceLayers[patchFaceI] = maxLevel[patchFaceI];
2207 forAll(pp.meshPoints(), patchPointI)
2209 if (extrudeStatus[patchPointI] != NOEXTRUDE)
2211 forAll(pointFaces[patchPointI], pointFaceI)
2213 label face = pointFaces[patchPointI][pointFaceI];
2214 nPatchPointLayers[patchPointI] =
max 2216 nPatchPointLayers[patchPointI],
2217 nPatchFaceLayers[face]
2223 nPatchPointLayers[patchPointI] = 0;
2239 bool Foam::autoLayerDriver::cellsUseFace
2241 const polyMesh& mesh,
2248 const cell& cFaces = mesh.cells()[cellLabels[i]];
2252 if (faces.found(cFaces[cFaceI]))
2267 const addPatchCellLayer& addLayer,
2268 const dictionary& meshQualityDict,
2269 const bool additionalReporting,
2270 const List<labelPair>& baffles,
2272 const fvMesh& newMesh,
2276 List<extrudeMode>& extrudeStatus
2280 Info<< nl <<
"Checking mesh with layer ..." <<
endl;
2281 faceSet wrongFaces(newMesh,
"wrongFaces", newMesh.nFaces()/1000);
2293 <<
" (concave, zero area or negative cell pyramid volume)" 2307 addLayer.layerFaces()
2315 const label nReportMax = 10;
2316 DynamicField<point> disabledFaceCentres(nReportMax);
2318 forAll(addedCells, oldPatchFaceI)
2322 const labelList& fCells = addedCells[oldPatchFaceI];
2324 if (cellsUseFace(newMesh, fCells, wrongFaces))
2331 pp.localFaces()[oldPatchFaceI],
2338 if (additionalReporting && (nChanged < nReportMax))
2340 disabledFaceCentres.
append 2342 pp.faceCentres()[oldPatchFaceI]
2354 if (additionalReporting)
2363 label nReportLocal = nChanged;
2364 if (nChangedTotal > nReportMax)
2379 Pout<<
"Checked mesh with layers. Disabled extrusion at " <<
endl;
2380 for (
label i=0; i < nReportLocal; i++)
2382 Pout<<
" " << disabledFaceCentres[i] <<
endl;
2388 if (nReportTotal < nChangedTotal)
2390 Info<<
"Suppressed disabled extrusion message for other " 2391 << nChangedTotal - nReportTotal <<
" faces." <<
endl;
2395 return nChangedTotal;
2403 const List<extrudeMode>& extrudeStatus
2407 label nExtruded = 0;
2409 const faceList& localFaces = pp.localFaces();
2413 const face& localFace = localFaces[i];
2417 if (extrudeStatus[localFace[fp]] != NOEXTRUDE)
2431 void Foam::autoLayerDriver::getLayerCellsFaces
2433 const polyMesh& mesh,
2434 const addPatchCellLayer& addLayer,
2441 cellNLayers.setSize(mesh.nCells());
2443 faceRealThickness.setSize(mesh.nFaces());
2444 faceRealThickness = 0;
2452 forAll(addedCells, oldPatchFaceI)
2454 const labelList& added = addedCells[oldPatchFaceI];
2456 const labelList& layer = layerFaces[oldPatchFaceI];
2462 cellNLayers[added[i]] = layer.size()-1;
2467 forAll(layerFaces, oldPatchFaceI)
2469 const labelList& layer = layerFaces[oldPatchFaceI];
2470 const scalar realThickness = oldRealThickness[oldPatchFaceI];
2476 for (
label i = 1; i < layer.size(); i++)
2478 faceRealThickness[layer[i]] = realThickness;
2485 void Foam::autoLayerDriver::printLayerData
2494 const polyBoundaryMesh& pbm = mesh.boundaryMesh();
2496 int oldPrecision =
Info().precision();
2499 label maxPatchNameLen = 0;
2502 label patchI = patchIDs[i];
2503 word patchName = pbm[patchI].name();
2504 maxPatchNameLen =
max(maxPatchNameLen,
label(patchName.size()));
2508 <<
setf(ios_base::left) <<
setw(maxPatchNameLen) <<
"patch" 2509 <<
setw(0) <<
" faces layers overall thickness" << nl
2510 <<
setf(ios_base::left) <<
setw(maxPatchNameLen) <<
" " 2511 <<
setw(0) <<
" [m] [%]" << nl
2512 <<
setf(ios_base::left) <<
setw(maxPatchNameLen) <<
"-----" 2513 <<
setw(0) <<
" ----- ------ --- ---" <<
endl;
2518 label patchI = patchIDs[i];
2519 const polyPatch& pp = pbm[patchI];
2521 label sumSize = pp.size();
2524 const labelList& faceCells = pp.faceCells();
2525 label sumNLayers = 0;
2528 sumNLayers += cellNLayers[faceCells[i]];
2541 scalar sumRealThickness =
sum(patchReal);
2542 scalar sumFraction = 0;
2545 if (patchWanted[i] > VSMALL)
2547 sumFraction += (patchReal[i]/patchWanted[i]);
2552 reduce(sumSize, sumOp<label>());
2553 reduce(sumNLayers, sumOp<label>());
2554 reduce(sumRealThickness, sumOp<scalar>());
2555 reduce(sumFraction, sumOp<scalar>());
2558 scalar avgLayers = 0;
2560 scalar avgFraction = 0;
2563 avgLayers = scalar(sumNLayers)/sumSize;
2564 avgReal = sumRealThickness/sumSize;
2565 avgFraction = sumFraction/sumSize;
2570 <<
" " <<
setw(8) << sumSize
2571 <<
" " <<
setw(8) << avgLayers
2572 <<
" " <<
setw(8) << avgReal
2573 <<
" " <<
setw(8) << 100*avgFraction
2580 bool Foam::autoLayerDriver::writeLayerData
2595 forAll(cellNLayers, cellI)
2597 if (cellNLayers[cellI] > 0)
2602 cellSet addedCellSet(mesh,
"addedCells", nAdded);
2603 forAll(cellNLayers, cellI)
2605 if (cellNLayers[cellI] > 0)
2607 addedCellSet.insert(cellI);
2610 addedCellSet.instance() = meshRefiner_.timeName();
2613 <<
" added cells to cellSet " 2614 << addedCellSet.name() <<
endl;
2615 bool ok = addedCellSet.
write();
2620 for (
label faceI = 0; faceI < mesh.nInternalFaces(); faceI++)
2622 if (faceRealThickness[faceI] > 0)
2628 faceSet layerFacesSet(mesh,
"layerFaces", nAdded);
2629 for (
label faceI = 0; faceI < mesh.nInternalFaces(); faceI++)
2631 if (faceRealThickness[faceI] > 0)
2633 layerFacesSet.insert(faceI);
2636 layerFacesSet.instance() = meshRefiner_.timeName();
2639 <<
" faces inside added layer to faceSet " 2640 << layerFacesSet.name() <<
endl;
2641 bool ok = layerFacesSet.
write();
2648 Info<< nl <<
"Writing fields with layer information:" <<
incrIndent 2656 mesh.time().timeName(),
2664 fixedValueFvPatchScalarField::typeName
2666 const polyBoundaryMesh& pbm = mesh.boundaryMesh();
2669 label patchI = patchIDs[i];
2670 const polyPatch& pp = pbm[patchI];
2671 const labelList& faceCells = pp.faceCells();
2675 pfld[i] = cellNLayers[faceCells[i]];
2677 fld.boundaryField()[patchI] == pfld;
2681 bool ok =
fld.write();
2690 mesh.time().timeName(),
2698 fixedValueFvPatchScalarField::typeName
2700 const polyBoundaryMesh& pbm = mesh.boundaryMesh();
2703 label patchI = patchIDs[i];
2704 fld.boundaryField()[patchI] == pbm[patchI].patchSlice
2711 bool ok =
fld.write();
2719 "thicknessFraction",
2720 mesh.time().timeName(),
2728 fixedValueFvPatchScalarField::typeName
2730 const polyBoundaryMesh& pbm = mesh.boundaryMesh();
2733 label patchI = patchIDs[i];
2748 if (patchWanted[i] > VSMALL)
2750 pfld[i] = patchReal[i]/patchWanted[i];
2754 fld.boundaryField()[patchI] == pfld;
2757 <<
" : overall layer thickness (fraction" 2758 <<
" of desired thickness)" <<
endl;
2759 bool ok =
fld.write();
2772 faceWantedThickness,
2783 Foam::autoLayerDriver::autoLayerDriver
2790 meshRefiner_(meshRefiner),
2791 globalToMasterPatch_(globalToMasterPatch),
2792 globalToSlavePatch_(globalToSlavePatch)
2812 <<
"Merging all faces of a cell" << nl
2813 <<
"---------------------------" << nl
2814 <<
" - which are on the same patch" << nl
2815 <<
" - which make an angle < " << planarAngle
2818 <<
" (cos:" << minCos <<
')' << nl
2819 <<
" - as long as the resulting face doesn't become concave" 2822 <<
" (0=straight, 180=fully concave)" << nl
2825 const fvMesh& mesh = meshRefiner_.mesh();
2833 duplicateFace[cpl[0]] = cpl[1];
2834 duplicateFace[cpl[1]] = cpl[0];
2837 label nChanged = meshRefiner_.mergePatchFacesUndo
2841 meshRefiner_.meshedPatches(),
2846 nChanged += meshRefiner_.mergeEdgesUndo(minCos, motionDict);
2855 const label nAllowableErrors,
2860 fvMesh& mesh = meshRefiner_.mesh();
2865 meshRefiner_.createZoneBaffles
2867 globalToMasterPatch_,
2868 globalToSlavePatch_,
2872 if (debug&meshRefinement::MESH)
2875 Info<<
"Writing baffled mesh to time " 2876 << meshRefiner_.timeName() <<
endl;
2885 mesh.
time().
path()/meshRefiner_.timeName()
2920 determineSidePatches
2941 label nIdealTotAddedCells = 0;
3001 const scalar edge0Len =
3002 meshRefiner_.meshCutter().level0EdgeLength();
3003 const labelList& cellLevel = meshRefiner_.meshCutter().cellLevel();
3032 for (
label i = 0; i < layerParams.
nGrow(); i++)
3046 const scalar edge0Len = meshRefiner_.meshCutter().level0EdgeLength();
3047 const labelList& cellLevel = meshRefiner_.meshCutter().cellLevel();
3057 meshRefiner_.timeName(),
3064 calculateLayerThickness
3083 makeLayerDisplacementField
3096 combinedDict.
merge(motionDict);
3098 combinedDict.add(
"minThicknessName", minThickness.name());
3126 avgPointData(pp, thickness);
3130 for (
label iteration = 0; iteration < layerParams.
nLayerIter(); iteration++)
3133 <<
"Layer addition iteration " << iteration << nl
3134 <<
"--------------------------" <<
endl;
3142 : motionDict.
subDict(
"relaxed")
3147 Info<<
"Switched to relaxed meshQuality constraints." <<
endl;
3153 syncPatchDisplacement
3163 getPatchDisplacement
3196 combinedDict.
merge(motionDict);
3198 combinedDict.merge(meshQualityDict);
3200 combinedDict.add(
"minThicknessName", minThickness.name());
3203 medialAxisMoverPtr().move
3210 pp().movePoints(mesh.
points());
3213 patchDisp = oldPatchPos - pp().localPoints();
3219 faceSet dummySet(mesh,
"wrongPatchFaces", 0);
3220 truncateDisplacement
3238 mesh.
time().
path()/
"layer_" + meshRefiner_.timeName(),
3245 Info<<
"Writing shrunk mesh to time " 3246 << meshRefiner_.timeName() <<
endl;
3259 mesh.
time().
path()/meshRefiner_.timeName()
3274 labelList nPatchFaceLayers(pp().size(), -1);
3275 setupLayerInfoTruncation
3289 forAll(nPatchPointLayers, i)
3293 nPatchPointLayers[i],
3296 finalDisp[i] = ratio*patchDisp[i];
3300 const scalarField invExpansionRatio(1.0/expansionRatio);
3325 savedMeshMod = meshMod;
3347 fvMesh& newMesh = newMeshPtr();
3369 newMeshBaffles[i][0] = map().reverseFaceMap()[p[0]];
3370 newMeshBaffles[i][1] = map().reverseFaceMap()[p[1]];
3378 avgPointData(pp,
mag(patchDisp))(),
3386 label nAddedCells = 0;
3387 forAll(cellNLayers, cellI)
3389 if (cellNLayers[cellI] > 0)
3396 if (debug&meshRefinement::MESH)
3398 Info<<
"Writing layer mesh to time " << meshRefiner_.timeName()
3402 cellSet addedCellSet(newMesh,
"addedCells", nAddedCells);
3403 forAll(cellNLayers, cellI)
3405 if (cellNLayers[cellI] > 0)
3407 addedCellSet.
insert(cellI);
3410 addedCellSet.
instance() = meshRefiner_.timeName();
3413 <<
" added cells to cellSet " << addedCellSet.
name() <<
endl;
3414 addedCellSet.
write();
3416 faceSet layerFacesSet(newMesh,
"layerFaces", newMesh.
nFaces()/100);
3419 if (faceRealThickness[faceI] > 0)
3421 layerFacesSet.
insert(faceI);
3424 layerFacesSet.instance() = meshRefiner_.timeName();
3427 <<
" faces inside added layer to faceSet " 3428 << layerFacesSet.name() <<
endl;
3429 layerFacesSet.
write();
3433 label nTotChanged = checkAndUnmark
3447 label nTotExtruded = countExtrusion(pp, extrudeStatus);
3451 Info<<
"Extruding " << nTotExtruded
3452 <<
" out of " << nTotFaces
3453 <<
" faces (" << 100.0*nTotExtruded/nTotFaces <<
"%)." 3454 <<
" Removed extrusion at " << nTotChanged <<
" faces." 3456 <<
"Added " << nTotAddedCells <<
" out of " << nIdealTotAddedCells
3457 <<
" cells (" << 100.0*nTotAddedCells/nIdealTotAddedCells <<
"%)." 3460 if (nTotChanged == 0)
3467 pp().movePoints(mesh.
points());
3470 for (
label i = 0; i < layerParams.
nGrow(); i++)
3499 if (map().hasMotionPoints())
3512 meshRefiner_.updateMesh(map,
labelList(0));
3521 p[0] = map().reverseFaceMap()[p[0]];
3522 p[1] = map().reverseFaceMap()[p[1]];
3530 Info<<
"Converting " << nBaffles
3531 <<
" baffles back into zoned faces ..." 3540 Info<<
"Converted baffles in = " 3541 << meshRefiner_.mesh().time().cpuTimeIncrement()
3542 <<
" s\n" << nl <<
endl;
3552 <<
"Doing final balancing" << nl
3553 <<
"---------------------" << nl
3572 map().distributeCellData(cellNLayers);
3573 map().distributeFaceData(faceWantedThickness);
3574 map().distributeFaceData(faceRealThickness);
3586 faceWantedThickness,
3597 const bool preBalance,
3602 const fvMesh& mesh = meshRefiner_.mesh();
3605 <<
"Shrinking and layer addition phase" << nl
3606 <<
"----------------------------------" << nl
3609 Info<<
"Using mesh parameters " << motionDict << nl <<
endl;
3612 mergePatchFacesUndo(layerParams, motionDict);
3619 label nFacesWithLayers = 0;
3620 forAll(numLayers, patchI)
3622 if (numLayers[patchI] > 0)
3633 WarningIn(
"autoLayerDriver::doLayers(..)")
3634 <<
"Ignoring layers on coupled patch " << pp.
name()
3643 Info<< nl <<
"No layers to generate ..." <<
endl;
3648 checkMeshManifold();
3651 Info<<
"Checking initial mesh ..." <<
endl;
3660 Info<<
"Detected " << nInitErrors <<
" illegal faces" 3661 <<
" (concave, zero area or negative cell pyramid volume)" 3669 <<
"Doing initial balancing" << nl
3670 <<
"-----------------------" << nl
3674 forAll(numLayers, patchI)
3676 if (numLayers[patchI] > 0)
3681 cellWeights[pp.
faceCells()[i]] += numLayers[patchI];
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
static bool & parRun()
Is this a parallel run?
virtual bool write() const
Write mesh using IO settings from time.
static void updateList(const labelList &newToOld, const T &nullValue, List< T > &elems)
Helper: reorder list according to map.
void mergePatchFacesUndo(const layerParameters &layerParams, const dictionary &motionDict)
Merge patch faces on same cell.
Smanip< ios_base::fmtflags > setf(const ios_base::fmtflags flags)
Mesh data needed to do the Finite Volume discretisation.
const word & name() const
Return reference to name.
label size() const
Return the number of elements in the PtrList.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
virtual bool coupled() const
Return true if this patch is geometrically coupled (i.e. faces and.
vector point
Point is a vector.
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurence of given element and return index,.
An ordered pair of two objects of type <T> with first() and second() elements.
void setInstance(const fileName &)
Set the instance for mesh files.
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
fileName path() const
Return path.
const word & name() const
Return name.
dimensioned< scalar > mag(const dimensioned< Type > &)
const edgeList & edges() const
Return mesh edges. Uses calcEdges.
word name(const complex &)
Return a string representation of a complex.
const labelListList & pointEdges() const
labelListList addedCells() const
Added cells given current mesh & layerfaces.
label nGrow() const
If points get not extruded do nGrow layers of connected faces.
static labelListList globalEdgeFaces(const polyMesh &, const globalIndex &globalFaces, const indirectPrimitivePatch &pp)
Per patch edge the pp faces (in global indices) using it. Uses.
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 pointMesh & New(const polyMesh &mesh)
static autoPtr< externalDisplacementMeshMover > New(const word &type, const dictionary &dict, const List< labelPair > &baffles, pointVectorField &pointDisplacement)
Return a reference to the selected meshMover model.
virtual tmp< scalarField > movePoints(const pointField &)
Move points, returns volumes swept by faces in motion.
Ostream & indent(Ostream &os)
Indent stream.
Simple container to keep together layer specific information.
void inplaceReorder(const labelUList &oldToNew, ListType &)
Inplace reorder the elements of a list.
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 labelUList & faceCells() const
Return face-cell addressing.
A collection of cell labels.
Calculates a unique integer (label so might not have enough room - 2G max) for processor + local inde...
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
void size(const label)
Override size to be inconsistent with allocated storage.
errorManipArg< error, int > exit(error &err, const int errNo=1)
const fileName & instance() const
bool relativeSizes() const
Are size parameters relative to inner cell size or.
static autoPtr< indirectPrimitivePatch > makePatch(const polyMesh &, const labelList &)
Create patch from set of patches.
static const Vector rootMax
PrimitivePatch< face, IndirectList, const pointField & > indirectPrimitivePatch
Foam::indirectPrimitivePatch.
static void syncEdgeList(const polyMesh &, List< T > &, const CombineOp &cop, const T &nullValue, const TransformOp &top)
Synchronize values on all mesh edges.
static PackedBoolList getMasterPoints(const polyMesh &)
Get per point whether it is uncoupled or a master of a.
A list of keyword definitions, which are a keyword followed by any number of values (e...
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
bool merge(const dictionary &)
Merge entries from the given dictionary.
Sends/receives parts of mesh+fvfields to neighbouring processors. Used in load balancing.
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
vectorField pointField
pointField is a vectorField.
virtual void updateMesh(const mapPolyMesh &mpm)
Update mesh corresponding to the given map.
void addLayers(const layerParameters &layerParams, const dictionary &motionDict, const labelList &patchIDs, const label nAllowableErrors, decompositionMethod &decomposer, fvMeshDistribute &distributor)
Add cell layers.
scalar concaveAngle() const
A patch is a list of labels that address the faces in the global face list.
const dictionary & dict() const
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
static labelPairList findDuplicateFacePairs(const polyMesh &)
Helper routine to find all baffles (two boundary faces.
const Time & time() const
Return the top-level database.
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
virtual bool write() const
Write using setting from DB.
Ostream & incrIndent(Ostream &os)
Increment the indent level.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
static label nProcs(const label communicator=0)
Number of processes in parallel run.
void setSize(const label)
Reset size of List.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Ostream & decrIndent(Ostream &os)
Decrement the indent level.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
#define WarningIn(functionName)
Report a warning using Foam::Warning.
virtual const pointField & points() const
Return raw points.
A List with indirect addressing.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Omanip< int > setprecision(const int i)
Abstract base class for decomposition.
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
Field< vector > vectorField
Specialisation of Field<T> for vector.
label nBufferCellsNoExtrude() const
Create buffer region for new layer terminations.
virtual Ostream & write(const token &)=0
Write next token to stream.
dimensionedScalar cos(const dimensionedScalar &ds)
Omanip< int > setw(const int i)
dimensioned< vector > dimensionedVector
Dimensioned vector obtained from generic dimensioned type.
Unit conversion functions.
static const label labelMin
labelList identity(const label len)
Create identity map (map[i] == i) of given length.
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
label size() const
Return number of elements in table.
errorManip< error > abort(error &err)
const word & name() const
Return name.
static int myProcNo(const label communicator=0)
Number of this process (starting from masterNo() = 0)
static void syncPointList(const polyMesh &, List< T > &, const CombineOp &cop, const T &nullValue, const TransformOp &top)
Synchronize values on all mesh points.
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 ))
Istream and Ostream manipulators taking arguments.
Adds layers of cells to outside of polyPatch. Can optionally create stand-alone extruded mesh (addToM...
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
#define FatalErrorIn(functionName)
Report an error message using Foam::FatalError.
HashSet< label, Hash< label > > labelHashSet
A HashSet with label keys.
static tmp< pointField > pointNormals(const polyMesh &, const PrimitivePatch< Face, FaceList, PointField, PointType > &)
Return parallel consistent point normals for patches using mesh points.
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.
static writeType writeLevel()
Get/set write level.
label nInternalFaces() const
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.
Mesh consisting of general polyhedral cells.
List< word > wordList
A List of words.
label nRelaxedIter() const
Number of iterations after which relaxed motion rules.
SubField< scalar > subField
Declare type of subField.
List< label > labelList
A List of labels.
void clearOut()
Clear all geometry and addressing.
scalar degToRad(const scalar deg)
Conversion from degrees to radians.
const Switch & additionalReporting() const
GeometricField< vector, pointPatchField, pointMesh > pointVectorField
Vector< scalar > vector
A scalar version of the templated Vector.
Direct mesh changes based on v1.3 polyTopoChange syntax.
scalar finalLayerThicknessRatio(const label nLayers, const scalar expansionRatio) const
Determine ratio of final layer thickness to.
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.
const dimensionSet dimless(0, 0, 0, 0, 0, 0, 0)
void append(const T &)
Append an element at the end of the list.
line< point, const point & > linePointRef
Line using referred points.
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
List< labelList > labelListList
A List of labelList.
scalar maxFaceThicknessRatio() const
Stop layer growth on highly warped cells.
label nLayerIter() const
Number of overall layer addition iterations.
Helper class which maintains intersections of (changing) mesh with (static) surfaces.
scalar featureAngle() const
HashTable< label, label, Hash< label > >::const_iterator const_iterator
void updateMesh(const mapPolyMesh &, const labelList &faceMap, const labelList &pointMap)
Update any locally stored mesh information. Gets additional.
const labelList & numLayers() const
How many layers to add.
Type gMax(const FieldField< Field, Type > &f)
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
A class for managing temporary objects.
const word & meshShrinker() const
Type of mesh shrinker.
static void setDisplacement(const labelList &patchIDs, const indirectPrimitivePatch &pp, pointField &patchDisp, pointVectorField &displacement)
Set displacement field from displacement on patch points.
defineTypeNameAndDebug(combustionModel, 0)
bool visNormal(const vector &n, const vectorField &faceNormals, const labelList &faceLabels)
Check if n is in same direction as normals of all faceLabels.
prefixOSstream Pout(cout,"Pout")
A primitive field of type <T> with automated input and output.
List< bool > boolList
Bool container classes.
static const label labelMax
bool insert(const Key &key)
Insert a new entry.