64Foam::snappyRefineDriver::snappyRefineDriver
76 meshRefiner_(meshRefiner),
77 decomposer_(decomposer),
78 distributor_(distributor),
79 globalToMasterPatch_(globalToMasterPatch),
80 globalToSlavePatch_(globalToSlavePatch),
81 setFormatter_(setFormatter),
82 surfFormatter_(surfFormatter),
89Foam::label Foam::snappyRefineDriver::featureEdgeRefine
91 const refinementParameters& refineParams,
101 if (refineParams.minRefineCells() == -1)
113 if (meshRefiner_.features().size() && maxIter > 0)
115 for (; iter < maxIter; iter++)
118 <<
"Feature refinement iteration " << iter <<
nl
119 <<
"------------------------------" <<
nl
124 meshRefiner_.refineCandidates
126 refineParams.locationsInMesh(),
127 refineParams.curvature(),
128 refineParams.planarAngle(),
139 refineParams.maxGlobalCells(),
140 refineParams.maxLocalCells()
145 meshRefiner_.meshCutter().consistentRefinement
151 Info<<
"Determined cells to refine in = "
156 const label nCellsToRefine =
159 Info<<
"Selected for feature refinement : " << nCellsToRefine
163 if (nCellsToRefine <= minRefine)
165 Info<<
"Stopping refining since too few cells selected."
179 meshRefiner_.balanceAndRefine
181 "feature refinement iteration " +
name(iter),
185 refineParams.maxLoadUnbalance(),
186 refineParams.maxCellUnbalance()
191 meshRefiner_.refineAndBalance
193 "feature refinement iteration " +
name(iter),
197 refineParams.maxLoadUnbalance(),
198 refineParams.maxCellUnbalance()
207Foam::label Foam::snappyRefineDriver::smallFeatureRefine
218 if (refineParams.minRefineCells() == -1)
225 addProfiling(feature,
"snappyHexMesh::refine::smallFeature");
231 const labelList surfaceMaxLevel(meshRefiner_.surfaces().maxGapLevel());
232 const labelList shellMaxLevel(meshRefiner_.shells().maxGapLevel());
233 const labelList curvMaxLevel(meshRefiner_.surfaces().maxCurvatureLevel());
237 max(surfaceMaxLevel) == 0
238 &&
max(shellMaxLevel) == 0
239 &&
max(curvMaxLevel) == 0
245 for (; iter < maxIter; iter++)
248 <<
"Small surface feature refinement iteration " << iter <<
nl
249 <<
"--------------------------------------------" <<
nl
258 meshRefiner_.refineCandidates
260 refineParams.locationsInMesh(),
261 refineParams.curvature(),
262 refineParams.planarAngle(),
273 refineParams.maxGlobalCells(),
274 refineParams.maxLocalCells()
280 meshRefiner_.meshCutter().consistentRefinement
286 Info<<
"Determined cells to refine in = "
290 const label nCellsToRefine =
293 Info<<
"Selected for refinement : " << nCellsToRefine
299 if (nCellsToRefine == 0)
301 Info<<
"Stopping refining since too few cells selected."
315 meshRefiner_.balanceAndRefine
317 "small feature refinement iteration " +
name(iter),
321 refineParams.maxLoadUnbalance(),
322 refineParams.maxCellUnbalance()
327 meshRefiner_.refineAndBalance
329 "small feature refinement iteration " +
name(iter),
333 refineParams.maxLoadUnbalance(),
334 refineParams.maxCellUnbalance()
342Foam::label Foam::snappyRefineDriver::surfaceOnlyRefine
346 const label leakBlockageIter
354 if (refineParams.minRefineCells() == -1)
361 addProfiling(surface,
"snappyHexMesh::refine::surface");
367 label overallMaxLevel =
max(meshRefiner_.surfaces().maxLevel());
370 for (iter = 0; iter < maxIter; iter++)
373 <<
"Surface refinement iteration " << iter <<
nl
374 <<
"------------------------------" <<
nl
379 if (iter >= leakBlockageIter)
392 for (
const label surfi : unnamedSurfaces)
394 const label regioni = surfaces.globalRegion(surfi, 0);
399 if (iter > surfaces.leakLevel()[regioni])
401 selectedSurfaces.append(surfi);
407 selectedSurfaces.size()
408 && refineParams.locationsOutsideMesh().size()
411 meshRefiner_.blockLeakFaces
413 globalToMasterPatch_,
415 refineParams.locationsInMesh(),
416 refineParams.zonesInMesh(),
417 refineParams.locationsOutsideMesh(),
431 meshRefiner_.refineCandidates
433 refineParams.locationsInMesh(),
434 refineParams.curvature(),
435 refineParams.planarAngle(),
446 refineParams.maxGlobalCells(),
447 refineParams.maxLocalCells()
452 meshRefiner_.meshCutter().consistentRefinement
458 Info<<
"Determined cells to refine in = "
462 const label nCellsToRefine =
465 Info<<
"Selected for refinement : " << nCellsToRefine
475 iter >= overallMaxLevel
476 && nCellsToRefine <= refineParams.minRefineCells()
480 Info<<
"Stopping refining since too few cells selected."
494 meshRefiner_.balanceAndRefine
496 "surface refinement iteration " +
name(iter),
500 refineParams.maxLoadUnbalance(),
501 refineParams.maxCellUnbalance()
506 meshRefiner_.refineAndBalance
508 "surface refinement iteration " +
name(iter),
512 refineParams.maxLoadUnbalance(),
513 refineParams.maxCellUnbalance()
521Foam::label Foam::snappyRefineDriver::gapOnlyRefine
532 if (refineParams.minRefineCells() == -1)
544 label maxIncrement = 0;
545 const labelList& maxLevel = meshRefiner_.surfaces().maxLevel();
546 const labelList& gapLevel = meshRefiner_.surfaces().gapLevel();
550 maxIncrement =
max(maxIncrement, gapLevel[i]-maxLevel[i]);
555 if (maxIncrement == 0)
560 for (iter = 0; iter < maxIter; iter++)
563 <<
"Gap refinement iteration " << iter <<
nl
564 <<
"--------------------------" <<
nl
575 meshRefiner_.refineCandidates
577 refineParams.locationsInMesh(),
578 refineParams.curvature(),
579 refineParams.planarAngle(),
590 refineParams.maxGlobalCells(),
591 refineParams.maxLocalCells()
597 Pout<<
"Writing current mesh to time "
598 << meshRefiner_.timeName() <<
endl;
609 Pout<<
"Dumped mesh in = "
613 Pout<<
"Dumping " << candidateCells.size()
614 <<
" cells to cellSet candidateCellsFromGap." <<
endl;
615 cellSet c(
mesh,
"candidateCellsFromGap", candidateCells);
616 c.instance() = meshRefiner_.timeName();
625 isCandidateCell[candidateCells[i]] =
true;
628 for (label i=0; i<1; i++)
630 boolList newIsCandidateCell(isCandidateCell);
638 if (isCandidateCell[own] != isCandidateCell[nei])
640 newIsCandidateCell[own] =
true;
641 newIsCandidateCell[nei] =
true;
665 if (isCandidateCell[own] != neiIsCandidateCell[bFacei])
667 newIsCandidateCell[own] =
true;
671 isCandidateCell.transfer(newIsCandidateCell);
675 forAll(isCandidateCell, celli)
677 if (isCandidateCell[celli])
682 candidateCells.setSize(
n);
684 forAll(isCandidateCell, celli)
686 if (isCandidateCell[celli])
688 candidateCells[
n++] = celli;
696 Pout<<
"Dumping " << candidateCells.size()
697 <<
" cells to cellSet candidateCellsFromGapPlusBuffer." <<
endl;
698 cellSet c(
mesh,
"candidateCellsFromGapPlusBuffer", candidateCells);
699 c.instance() = meshRefiner_.timeName();
706 meshRefiner_.meshCutter().consistentRefinement
712 Info<<
"Determined cells to refine in = "
716 const label nCellsToRefine =
719 Info<<
"Selected for refinement : " << nCellsToRefine
730 && nCellsToRefine <= refineParams.minRefineCells()
734 Info<<
"Stopping refining since too few cells selected."
748 meshRefiner_.balanceAndRefine
750 "gap refinement iteration " +
name(iter),
754 refineParams.maxLoadUnbalance(),
755 refineParams.maxCellUnbalance()
760 meshRefiner_.refineAndBalance
762 "gap refinement iteration " +
name(iter),
766 refineParams.maxLoadUnbalance(),
767 refineParams.maxCellUnbalance()
775Foam::label Foam::snappyRefineDriver::surfaceProximityBlock
781 if (refineParams.minRefineCells() == -1)
790 if (
min(meshRefiner_.surfaces().blockLevel()) ==
labelMax)
797 for (iter = 0; iter < maxIter; iter++)
800 <<
"Gap blocking iteration " << iter <<
nl
801 <<
"------------------------" <<
nl
808 meshRefiner_.removeGapCells
810 refineParams.planarAngle(),
811 meshRefiner_.surfaces().blockLevel(),
812 globalToMasterPatch_,
813 refineParams.nFilterIter()
819 Pout<<
"Writing gap blocking iteration "
820 << iter <<
" mesh to time " << meshRefiner_.timeName()
838Foam::label Foam::snappyRefineDriver::bigGapOnlyRefine
841 const bool spreadGapSize,
845 if (refineParams.minRefineCells() == -1)
862 labelList surfaceMaxLevel(meshRefiner_.surfaces().maxGapLevel());
863 labelList shellMaxLevel(meshRefiner_.shells().maxGapLevel());
865 label overallMaxLevel(
max(
max(surfaceMaxLevel),
max(shellMaxLevel)));
867 if (overallMaxLevel == 0)
873 for (; iter < maxIter; iter++)
876 <<
"Big gap refinement iteration " << iter <<
nl
877 <<
"------------------------------" <<
nl
886 meshRefiner_.refineCandidates
888 refineParams.locationsInMesh(),
889 refineParams.curvature(),
890 refineParams.planarAngle(),
901 refineParams.maxGlobalCells(),
902 refineParams.maxLocalCells()
909 Pout<<
"Writing current mesh to time "
910 << meshRefiner_.timeName() <<
endl;
921 Pout<<
"Dumped mesh in = "
924 Pout<<
"Dumping " << candidateCells.size()
925 <<
" cells to cellSet candidateCellsFromBigGap." <<
endl;
926 cellSet c(
mesh,
"candidateCellsFromBigGap", candidateCells);
927 c.instance() = meshRefiner_.timeName();
933 meshRefiner_.meshCutter().consistentRefinement
939 Info<<
"Determined cells to refine in = "
943 const label nCellsToRefine =
946 Info<<
"Selected for refinement : " << nCellsToRefine
956 iter >= overallMaxLevel
957 && nCellsToRefine <= refineParams.minRefineCells()
961 Info<<
"Stopping refining since too few cells selected."
975 meshRefiner_.balanceAndRefine
977 "big gap refinement iteration " +
name(iter),
981 refineParams.maxLoadUnbalance(),
982 refineParams.maxCellUnbalance()
987 meshRefiner_.refineAndBalance
989 "big gap refinement iteration " +
name(iter),
993 refineParams.maxLoadUnbalance(),
994 refineParams.maxCellUnbalance()
1002Foam::label Foam::snappyRefineDriver::danglingCellRefine
1009 if (refineParams.minRefineCells() == -1)
1021 addProfiling(dangling,
"snappyHexMesh::refine::danglingCell");
1025 for (iter = 0; iter < maxIter; iter++)
1028 <<
"Dangling coarse cells refinement iteration " << iter <<
nl
1029 <<
"--------------------------------------------" <<
nl
1045 label nIntFaces = 0;
1046 for (
const label meshFacei :
cells[celli])
1056 if (nIntFaces == nFaces)
1058 candidateCellSet.insert(celli);
1064 Pout<<
"Dumping " << candidateCellSet.size()
1065 <<
" cells to cellSet candidateCellSet." <<
endl;
1066 candidateCellSet.instance() = meshRefiner_.timeName();
1067 candidateCellSet.write();
1069 candidateCells = candidateCellSet.toc();
1076 meshRefiner_.meshCutter().consistentRefinement
1082 Info<<
"Determined cells to refine in = "
1086 const label nCellsToRefine =
1089 Info<<
"Selected for refinement : " << nCellsToRefine
1100 && nCellsToRefine <= refineParams.minRefineCells()
1104 Info<<
"Stopping refining since too few cells selected."
1107 if (refineParams.balanceAtEnd())
1109 Info<<
"Final mesh balancing" <<
endl;
1111 meshRefiner_.balance
1134 meshRefiner_.balanceAndRefine
1136 "coarse cell refinement iteration " +
name(iter),
1140 refineParams.maxLoadUnbalance(),
1141 refineParams.maxCellUnbalance()
1146 meshRefiner_.refineAndBalance
1148 "coarse cell refinement iteration " +
name(iter),
1152 refineParams.maxLoadUnbalance(),
1153 refineParams.maxCellUnbalance()
1163Foam::label Foam::snappyRefineDriver::refinementInterfaceRefine
1169 if (refineParams.minRefineCells() == -1)
1186 if (refineParams.interfaceRefine())
1188 for (;iter < maxIter; iter++)
1191 <<
"Refinement transition refinement iteration " << iter <<
nl
1192 <<
"--------------------------------------------" <<
nl
1195 const labelList& surfaceIndex = meshRefiner_.surfaceIndex();
1196 const hexRef8& cutter = meshRefiner_.meshCutter();
1220 label cLevel = cutter.cellLevel()[celli];
1224 label facei = cFaces[cFacei];
1226 if (surfaceIndex[facei] != -1)
1228 label fLevel = cutter.faceLevel(facei);
1229 if (fLevel != cLevel)
1231 transitionCells.insert(celli);
1359 for (
const label celli : transitionCells)
1362 label cLevel = cutter.cellLevel()[celli];
1365 bool foundOpposite =
false;
1369 label facei = cFaces[cFacei];
1373 surfaceIndex[facei] != -1
1374 && cutter.faceLevel(facei) > cLevel
1379 if (faceOwner[facei] != celli)
1387 label face2i = cFaces[cFaceI2];
1392 && surfaceIndex[face2i] != -1
1393 && cutter.faceLevel(face2i) > cLevel
1398 if (faceOwner[face2i] != celli)
1404 if ((
n&n2) < oppositeCos)
1406 foundOpposite =
true;
1422 candidateCellSet.insert(celli);
1428 Pout<<
"Dumping " << candidateCellSet.size()
1429 <<
" cells to cellSet candidateCellSet." <<
endl;
1430 candidateCellSet.instance() = meshRefiner_.timeName();
1431 candidateCellSet.write();
1433 candidateCells = candidateCellSet.
toc();
1440 meshRefiner_.meshCutter().consistentRefinement
1446 Info<<
"Determined cells to refine in = "
1450 const label nCellsToRefine =
1453 Info<<
"Selected for refinement : " << nCellsToRefine
1464 && nCellsToRefine <= refineParams.minRefineCells()
1468 Info<<
"Stopping refining since too few cells selected."
1482 meshRefiner_.balanceAndRefine
1484 "interface cell refinement iteration " +
name(iter),
1488 refineParams.maxLoadUnbalance(),
1489 refineParams.maxCellUnbalance()
1494 meshRefiner_.refineAndBalance
1496 "interface cell refinement iteration " +
name(iter),
1500 refineParams.maxLoadUnbalance(),
1501 refineParams.maxCellUnbalance()
1509bool Foam::snappyRefineDriver::usesHigherLevel
1516 for (
const label pointi :
f)
1518 if (boundaryPointLevel[pointi] > cLevel)
1527Foam::label Foam::snappyRefineDriver::boundaryRefinementInterfaceRefine
1533 if (refineParams.minRefineCells() == -1)
1550 if (refineParams.interfaceRefine())
1552 for (;iter < maxIter; iter++)
1555 <<
"Boundary refinement iteration " << iter <<
nl
1556 <<
"-------------------------------" <<
nl
1559 const labelList& surfaceIndex = meshRefiner_.surfaceIndex();
1560 const hexRef8& cutter = meshRefiner_.meshCutter();
1561 const labelList& cellLevel = cutter.cellLevel();
1573 forAll(surfaceIndex, facei)
1575 if (surfaceIndex[facei] != -1)
1577 isBoundaryFace.set(facei);
1578 isBoundaryPoint.set(faces[facei]);
1581 const labelList meshPatchIDs(meshRefiner_.meshedPatches());
1582 for (
const label patchi : meshPatchIDs)
1587 isBoundaryFace.
set(
pp.start()+i);
1588 isBoundaryPoint.set(
pp[i]);
1608 const label cLevel = cellLevel[celli];
1610 for (
const label facei : cFaces)
1612 if (isBoundaryFace(facei))
1614 const face&
f = faces[facei];
1615 for (
const label pointi :
f)
1617 boundaryPointLevel[pointi] =
1620 boundaryPointLevel[pointi],
1653 const label cLevel = cellLevel[celli];
1655 bool isBoundaryCell =
false;
1656 for (
const label facei : cFaces)
1658 if (isBoundaryFace(facei))
1660 isBoundaryCell =
true;
1665 if (!isBoundaryCell)
1667 for (
const label facei : cFaces)
1670 if (usesHigherLevel(boundaryPointLevel,
f, cLevel))
1672 candidateCellSet.insert(celli);
1680 Pout<<
"Dumping " << candidateCellSet.size()
1681 <<
" cells to cellSet candidateCellSet." <<
endl;
1682 candidateCellSet.instance() = meshRefiner_.timeName();
1683 candidateCellSet.write();
1685 candidateCells = candidateCellSet.toc();
1690 meshRefiner_.meshCutter().consistentRefinement
1696 Info<<
"Determined cells to refine in = "
1700 const label nCellsToRefine =
1703 Info<<
"Selected for refinement : " << nCellsToRefine
1718 Info<<
"Stopping refining since too few cells selected."
1732 meshRefiner_.balanceAndRefine
1734 "boundary cell refinement iteration " +
name(iter),
1738 refineParams.maxLoadUnbalance(),
1739 refineParams.maxCellUnbalance()
1744 meshRefiner_.refineAndBalance
1746 "boundary cell refinement iteration " +
name(iter),
1750 refineParams.maxLoadUnbalance(),
1751 refineParams.maxCellUnbalance()
1760void Foam::snappyRefineDriver::removeInsideCells
1763 const label nBufferLayers
1767 if (meshRefiner_.limitShells().shells().size() == 0 && nBufferLayers == 0)
1778 <<
"Removing mesh beyond surface intersections" <<
nl
1779 <<
"------------------------------------------" <<
nl
1790 if (meshRefiner_.limitShells().shells().size())
1792 meshRefiner_.removeLimitShells
1796 globalToMasterPatch_,
1797 globalToSlavePatch_,
1798 refineParams.locationsInMesh(),
1799 refineParams.zonesInMesh(),
1800 refineParams.locationsOutsideMesh()
1807 meshRefiner_.splitMesh
1810 refineParams.nErodeCellZone(),
1811 globalToMasterPatch_,
1812 globalToSlavePatch_,
1813 refineParams.locationsInMesh(),
1814 refineParams.zonesInMesh(),
1815 refineParams.locationsOutsideMesh(),
1816 !refineParams.useLeakClosure(),
1825 Pout<<
"Writing subsetted mesh to time "
1826 << meshRefiner_.timeName() <<
endl;
1837 Pout<<
"Dumped mesh in = "
1843Foam::label Foam::snappyRefineDriver::shellRefine
1854 if (refineParams.minRefineCells() == -1)
1865 meshRefiner_.userFaceData().setSize(1);
1872 meshRefiner_.intersectedFaces(),
1880 label overallMaxShellLevel = meshRefiner_.shells().maxLevel();
1883 for (iter = 0; iter < maxIter; iter++)
1886 <<
"Shell refinement iteration " << iter <<
nl
1887 <<
"----------------------------" <<
nl
1892 meshRefiner_.refineCandidates
1894 refineParams.locationsInMesh(),
1895 refineParams.curvature(),
1896 refineParams.planarAngle(),
1907 refineParams.maxGlobalCells(),
1908 refineParams.maxLocalCells()
1914 Pout<<
"Dumping " << candidateCells.size()
1915 <<
" cells to cellSet candidateCellsFromShells." <<
endl;
1917 cellSet c(
mesh,
"candidateCellsFromShells", candidateCells);
1918 c.instance() = meshRefiner_.timeName();
1931 findIndices(meshRefiner_.userFaceData()[0].second(), 0)
1939 if (refineParams.nBufferLayers() <= 2)
1941 cellsToRefine = meshRefiner_.meshCutter().consistentSlowRefinement
1943 refineParams.nBufferLayers(),
1947 meshRefiner_.intersectedPoints()
1952 cellsToRefine = meshRefiner_.meshCutter().consistentSlowRefinement2
1954 refineParams.nBufferLayers(),
1960 Info<<
"Determined cells to refine in = "
1964 const label nCellsToRefine =
1967 Info<<
"Selected for internal refinement : " << nCellsToRefine
1977 iter >= overallMaxShellLevel
1978 && nCellsToRefine <= refineParams.minRefineCells()
1982 Info<<
"Stopping refining since too few cells selected."
1995 meshRefiner_.balanceAndRefine
1997 "shell refinement iteration " +
name(iter),
2001 refineParams.maxLoadUnbalance(),
2002 refineParams.maxCellUnbalance()
2007 meshRefiner_.refineAndBalance
2009 "shell refinement iteration " +
name(iter),
2013 refineParams.maxLoadUnbalance(),
2014 refineParams.maxCellUnbalance()
2018 meshRefiner_.userFaceData().clear();
2024Foam::label Foam::snappyRefineDriver::directionalShellRefine
2035 addProfiling(shell,
"snappyHexMesh::refine::directionalShell");
2040 const_cast<labelIOList&
>(meshRefiner_.meshCutter().cellLevel());
2042 const_cast<labelIOList&
>(meshRefiner_.meshCutter().pointLevel());
2047 const labelPairList dirSelect(shells.directionalSelectLevel());
2050 forAll(dirSelect, shelli)
2052 overallMinLevel =
min(dirSelect[shelli].first(), overallMinLevel);
2053 overallMaxLevel =
max(dirSelect[shelli].second(), overallMaxLevel);
2056 if (overallMinLevel > overallMaxLevel)
2069 for (iter = 0; iter < maxIter; iter++)
2072 <<
"Directional shell refinement iteration " << iter <<
nl
2073 <<
"----------------------------------------" <<
nl
2076 label nAllRefine = 0;
2087 labelList currentLevel(dirCellLevel.size());
2088 forAll(dirCellLevel, celli)
2090 currentLevel[celli] = dirCellLevel[celli][dir];
2095 meshRefiner_.directionalRefineCandidates
2097 refineParams.maxGlobalCells(),
2098 refineParams.maxLocalCells(),
2107 meshRefiner_.meshCutter().consistentRefinement
2115 Info<<
"Determined cells to refine in = "
2118 const label nCellsToRefine =
2122 <<
" refinement : " << nCellsToRefine
2126 nAllRefine += nCellsToRefine;
2130 if (nCellsToRefine > 0)
2141 meshRefiner_.directionalRefine
2143 "directional refinement iteration " +
name(iter),
2149 Info<<
"Refined mesh in = "
2170 forAll(map().cellMap(), celli)
2172 if (isRefineCell[map().cellMap()[celli]])
2174 dirCellLevel[celli][dir]++;
2180 forAll(map().pointMap(), pointi)
2182 label oldPointi = map().pointMap()[pointi];
2183 if (map().reversePointMap()[oldPointi] != pointi)
2186 pointLevel[pointi]++;
2193 if (nAllRefine == 0)
2195 Info<<
"Stopping refining since no cells selected."
2200 meshRefiner_.printMeshInfo
2203 "After directional refinement iteration " +
name(iter),
2209 Pout<<
"Writing directional refinement iteration "
2210 << iter <<
" mesh to time " << meshRefiner_.timeName() <<
endl;
2232 cellLevel[celli] =
cmptMax(dirCellLevel[celli]);
2239void Foam::snappyRefineDriver::mergeAndSmoothRatio
2242 const label nSmoothExpansion,
2251 scalar prevDist = GREAT;
2254 scalar curDist = unmergedDist[i];
2255 scalar difference =
mag(curDist - prevDist);
2256 if (difference > meshRefiner_.mergeDistance())
2259 mergedDist.append(curDist);
2266 labelList indexSet = sortedDist.indices();
2269 scalarList seedPointsNewLocation = sortedDist;
2271 scalar initResidual = 0.0;
2272 scalar prevIterResidual = GREAT;
2274 for (label iter = 0; iter < nSmoothExpansion; iter++)
2288 for(label i = 2; i<mergedDist.size()-1; i++)
2290 scalar oldX00 = sortedDist[i-2];
2291 scalar oldX1 = sortedDist[i+1];
2292 scalar curX0 = seedPointsNewLocation[i-1];
2293 seedPointsNewLocation[i] = curX0 + (oldX1 - oldX00)/3;
2296 const scalarField residual(seedPointsNewLocation-sortedDist);
2298 scalar res(
sumMag(residual));
2304 res /= initResidual;
2306 if (
mag(prevIterResidual - res) < SMALL)
2310 Pout<<
"Converged with iteration " << iter
2311 <<
" initResidual: " << initResidual
2312 <<
" final residual : " << res <<
endl;
2318 prevIterResidual = res;
2323 sortedDist = seedPointsNewLocation;
2327 keyAndValue.setSize(mergedDist.size());
2331 keyAndValue[i].first() = mergedDist[i];
2332 label index = indexSet[i];
2333 keyAndValue[i].second() = seedPointsNewLocation[index];
2338Foam::label Foam::snappyRefineDriver::directionalSmooth
2345 <<
"Directional expansion ratio smoothing" <<
nl
2346 <<
"-------------------------------------" <<
nl
2349 fvMesh& baseMesh = meshRefiner_.mesh();
2355 forAll(shells.nSmoothExpansion(), shellI)
2359 shells.nSmoothExpansion()[shellI] > 0
2360 || shells.nSmoothPosition()[shellI] > 0
2363 label surfi = shells.shells()[shellI];
2364 const vector& userDirection = shells.smoothDirection()[shellI];
2372 geometry[surfi].getVolumeType(baseMesh.points(), volType);
2404 bitSet isXEdge(baseMesh.edges().size());
2406 const edgeList& edges = baseMesh.edges();
2409 const edge&
e = edges[edgei];
2410 vector eVec(
e.vec(baseMesh.points()));
2412 if (
mag(eVec&userDirection) > 0.9)
2421 const scalar totalLength =
2422 geometry[surfi].bounds().span()
2424 const scalar startPosition =
2425 geometry[surfi].bounds().min()
2432 normalizedPosition[i] =
2434 ((baseMesh.points()[pointi]&userDirection) - startPosition)
2445 scalar prevDist = GREAT;
2448 label pointi = order[i];
2449 scalar curDist = normalizedPosition[pointi];
2450 if (
mag(curDist - prevDist) > meshRefiner_.mergeDistance())
2452 seedPointDist.append(curDist);
2473 bitSet isFrozenPoint(baseMesh.nPoints(),
true);
2476 scalar minSeed =
min(allSeedPointDist);
2477 scalar maxSeed =
max(allSeedPointDist);
2480 forAll(normalizedPosition, posI)
2482 const scalar
pos = normalizedPosition[posI];
2485 (
mag(
pos-minSeed) < meshRefiner_.mergeDistance())
2486 || (
mag(
pos-maxSeed) < meshRefiner_.mergeDistance())
2500 Info<<
"Smoothing " << geometry[surfi].name() <<
':' <<
nl
2501 <<
" Direction : " << userDirection <<
nl
2502 <<
" Number of points : "
2504 <<
" (out of " << baseMesh.globalData().nTotalPoints()
2506 <<
" Smooth expansion iterations : "
2507 << shells.nSmoothExpansion()[shellI] <<
nl
2508 <<
" Smooth position iterations : "
2509 << shells.nSmoothPosition()[shellI] <<
nl
2510 <<
" Number of planes : "
2511 << allSeedPointDist.size()
2524 shells.nSmoothExpansion()[shellI],
2546 const point& curPoint = baseMesh.points()[pointi];
2547 scalar curDist = normalizedPosition[i];
2548 scalar newDist = table(curDist);
2549 scalar newPosition = startPosition + newDist*totalLength;
2550 baseNewPoints[pointi] +=
2551 userDirection * (newPosition - (curPoint &userDirection));
2555 vectorField disp(baseNewPoints-baseMesh.points());
2563 baseMesh.movePoints(baseMesh.points()+disp);
2566 baseMesh.moving(
false);
2570 const_cast<Time&
>(baseMesh.time())++;
2572 Pout<<
"Writing directional expansion ratio smoothed"
2573 <<
" mesh to time " << meshRefiner_.timeName() <<
endl;
2583 baseMesh.time().path()/meshRefiner_.timeName()
2590 pointField baseMeshPoints(baseMesh.points());
2591 scalar initResidual = 0.0;
2592 scalar prevIterResidual = GREAT;
2593 for (iter = 0; iter < shells.nSmoothPosition()[shellI]; iter++)
2596 const edgeList& edges = baseMesh.edges();
2606 const edge&
e = edges[edgei];
2608 (unsmoothedPoints[
e[1]]&userDirection);
2611 (unsmoothedPoints[
e[0]]&userDirection);
2632 if (nSumXEdges[pointi] < 2)
2636 const labelList& pEdges = pointEdges[pointi];
2639 label edgei = pEdges[pE];
2642 const edge&
e = edges[edgei];
2643 label otherPt =
e.otherVertex(pointi);
2644 nSumOther[pointi]--;
2647 unsmoothedPoints[otherPt]
2674 if ((nSumOther[pointi] >= 2) && !isFrozenPoint[pointi])
2679 (unsmoothedPoints[pointi]&userDirection)
2680 +sumOther[pointi]/nSumOther[pointi]
2683 vector& v = baseNewPoints[pointi];
2684 v += (smoothPos-(v&userDirection))*userDirection;
2688 const vectorField residual(baseNewPoints - baseMeshPoints);
2690 scalar res(
gSumMag(residual));
2696 res /= initResidual;
2698 if (
mag(prevIterResidual - res) < SMALL)
2700 Info<<
"Converged smoothing in iteration " << iter
2701 <<
" initResidual: " << initResidual
2702 <<
" final residual : " << res <<
endl;
2707 prevIterResidual = res;
2712 baseMeshPoints = baseNewPoints;
2717 vectorField dispSmooth(baseMeshPoints-baseMesh.points());
2725 baseMesh.movePoints(baseMesh.points()+dispSmooth);
2728 baseMesh.moving(
false);
2732 const_cast<Time&
>(baseMesh.time())++;
2734 Pout<<
"Writing positional smoothing iteration "
2735 << iter <<
" mesh to time " << meshRefiner_.timeName()
2745 baseMesh.time().path()/meshRefiner_.timeName()
2754void Foam::snappyRefineDriver::baffleAndSplitMesh
2758 const bool handleSnapProblems,
2769 <<
"Splitting mesh at surface intersections" <<
nl
2770 <<
"---------------------------------------" <<
nl
2783 meshRefiner_.baffleAndSplitMesh
2789 refineParams.useTopologicalSnapDetection(),
2792 refineParams.nErodeCellZone(),
2796 globalToMasterPatch_,
2797 globalToSlavePatch_,
2798 refineParams.locationsInMesh(),
2799 refineParams.zonesInMesh(),
2800 refineParams.locationsOutsideMesh(),
2801 !refineParams.useLeakClosure(),
2807 if (!handleSnapProblems)
2812 const auto mt = meshRefiner_.meshType();
2813 const bool mergeSameOnly
2823 meshRefiner_.mergeFreeStandingBaffles
2827 refineParams.useTopologicalSnapDetection(),
2830 refineParams.planarAngle(),
2833 globalToMasterPatch_,
2834 globalToSlavePatch_,
2835 refineParams.locationsInMesh(),
2836 refineParams.locationsOutsideMesh()
2842void Foam::snappyRefineDriver::zonify
2859 namedSurfaces.size()
2860 || refineParams.zonesInMesh().size()
2864 <<
"Introducing zones for interfaces" <<
nl
2865 <<
"--------------------------------" <<
nl
2877 refineParams.allowFreeStandingZoneFaces(),
2878 refineParams.nErodeCellZone(),
2879 refineParams.locationsInMesh(),
2880 refineParams.zonesInMesh(),
2881 refineParams.locationsOutsideMesh(),
2882 !refineParams.useLeakClosure(),
2890 Pout<<
"Writing zoned mesh to time "
2891 << meshRefiner_.timeName() <<
endl;
2910void Foam::snappyRefineDriver::splitAndMergeBaffles
2914 const bool handleSnapProblems,
2924 <<
"Handling cells with snap problems" <<
nl
2925 <<
"---------------------------------" <<
nl
2936 const scalarField& perpAngle = meshRefiner_.surfaces().perpendicularAngle();
2938 meshRefiner_.baffleAndSplitMesh
2944 refineParams.useTopologicalSnapDetection(),
2947 refineParams.nErodeCellZone(),
2951 globalToMasterPatch_,
2952 globalToSlavePatch_,
2953 refineParams.locationsInMesh(),
2954 refineParams.zonesInMesh(),
2955 refineParams.locationsOutsideMesh(),
2956 !refineParams.useLeakClosure(),
2965 const auto mt = meshRefiner_.meshType();
2966 const bool mergeSameOnly
2976 meshRefiner_.mergeFreeStandingBaffles
2980 refineParams.useTopologicalSnapDetection(),
2983 refineParams.planarAngle(),
2986 globalToMasterPatch_,
2987 globalToSlavePatch_,
2988 refineParams.locationsInMesh(),
2989 refineParams.locationsOutsideMesh()
2999 meshRefiner_.dupNonManifoldPoints();
3007 Info<<
"Detected unsplittable baffles : " << nCouples <<
endl;
3014 meshRefiner_.mergeBaffles(couples,
Map<label>(0));
3019 meshRefiner_.checkData();
3023 meshRefiner_.splitMeshRegions
3025 globalToMasterPatch_,
3026 globalToSlavePatch_,
3027 refineParams.locationsInMesh(),
3028 refineParams.locationsOutsideMesh(),
3036 meshRefiner_.checkData();
3039 Info<<
"Merged free-standing baffles in = "
3045 Pout<<
"Writing handleProblemCells mesh to time "
3046 << meshRefiner_.timeName() <<
endl;
3061void Foam::snappyRefineDriver::erodeNonManifoldZoneFaces
3073 <<
"Erode non-manifold zone faces" <<
nl
3074 <<
"-----------------------------" <<
nl
3077 auto&
mesh = meshRefiner_.mesh();
3089 for (
const auto& fz : fzs)
3091 isZoneFace.set(fz.addressing());
3100 isZoneFace.unset(
pbm[patchi].
range());
3112 const labelList meshFaces(isZoneFace.sortedToc());
3134 const label nOldChanged = nChanged;
3139 label nNonManif = 0;
3140 for (
const label edgei :
pp.
faceEdges()[patchFacei])
3142 if (edgeGlobalFaces[edgei].size() == 1)
3146 else if (edgeGlobalFaces[edgei].size() > 2)
3151 if (nNonManif > 0 && nOpen > 0)
3153 isZoneFace.unset(meshFaces[patchFacei]);
3170 fzs.clearAddressing();
3172 for (
auto& fz : fzs)
3177 forAll(fz.addressing(), i)
3179 if (isZoneFace[fz.addressing()[i]])
3181 addressing.append(fz.addressing()[i]);
3182 flipMap.append(fz.flipMap()[i]);
3190 fz.resetAddressing(addressing, flipMap);
3194 Info<<
"Eroded " << nChanged
3195 <<
" free-standing zone faces in = "
3196 <<
mesh.time().cpuTimeIncrement() <<
" s." <<
endl;
3207 if (faceZoneToPatches.size())
3210 <<
"Adding patches for face zones" <<
nl
3211 <<
"-----------------------------" <<
nl
3215 <<
setw(6) <<
"Patch"
3216 <<
setw(20) <<
"Type"
3217 <<
setw(30) <<
"Name"
3218 <<
setw(30) <<
"FaceZone"
3219 <<
setw(10) <<
"FaceType"
3221 <<
setw(6) <<
"-----"
3222 <<
setw(20) <<
"----"
3223 <<
setw(30) <<
"----"
3224 <<
setw(30) <<
"--------"
3225 <<
setw(10) <<
"--------"
3233 const word& fzName = iter.key();
3240 const word& masterName = fzName;
3249 <<
setw(20) <<
mesh.boundaryMesh()[mpi].type()
3250 <<
setw(30) << masterName
3251 <<
setw(30) << fzName
3260 <<
setw(20) <<
mesh.boundaryMesh()[sli].type()
3261 <<
setw(30) << slaveName
3262 <<
setw(30) << fzName
3266 meshRefiner.
addFaceZone(fzName, masterName, slaveName, fzType);
3274void Foam::snappyRefineDriver::mergePatchFaces
3288 <<
"Merge refined boundary faces" <<
nl
3289 <<
"----------------------------" <<
nl
3300 meshRefiner_.mergePatchFacesUndo
3304 meshRefiner_.meshedPatches(),
3313 meshRefiner_.mergePatchFaces
3318 meshRefiner_.meshedPatches(),
3325 meshRefiner_.checkData();
3332 meshRefiner_.checkData();
3337void Foam::snappyRefineDriver::deleteSmallRegions
3374 if (ownPatch[facei] != -1)
3383 for (
const auto& cz : czm)
3392 labelList nCellsPerRegion(cellRegion.nRegions(), 0);
3393 labelList regionToZone(cellRegion.nRegions(), -2);
3394 labelList nCellsPerZone(czm.size()+1, 0);
3395 forAll(cellRegion, celli)
3397 const label regioni = cellRegion[celli];
3398 const label zonei = cellToZone[celli];
3401 regionToZone[regioni] = zonei;
3403 nCellsPerRegion[regioni]++;
3404 nCellsPerZone[zonei]++;
3414 forAll(nCellsPerRegion, regioni)
3416 const label zonei = regionToZone[regioni];
3417 label& nRegionCells = nCellsPerRegion[regioni];
3421 nRegionCells < refineParams.minCellFraction()*nCellsPerZone[zonei]
3422 || nRegionCells < refineParams.nMinCells()
3425 Info<<
"Deleting region " << regioni
3426 <<
" (size " << nRegionCells
3427 <<
") of zone size " << nCellsPerZone[zonei]
3437 forAll(cellRegion, celli)
3439 if (nCellsPerRegion[cellRegion[celli]] == 0)
3441 cellsToRemove.append(celli);
3446 cellsToRemove.size(),
3449 if (nTotCellsToRemove > 0)
3451 Info<<
"Deleting " << nTotCellsToRemove
3452 <<
" cells in small regions" <<
endl;
3456 cellsToRemove.shrink();
3459 cellRemover.getExposedFaces(cellsToRemove)
3465 (void)meshRefiner_.doRemoveCells
3479 const refinementParameters& refineParams,
3480 const snapParameters& snapParams,
3481 const bool prepareForSnapping,
3488 <<
"Refinement phase" <<
nl
3489 <<
"----------------" <<
nl
3492 const fvMesh&
mesh = meshRefiner_.mesh();
3496 refineParams.findCells(
true,
mesh, refineParams.locationsInMesh());
3501 refineParams.findCells(
true,
mesh, refineParams.locationsOutsideMesh());
3510 globalToMasterPatch_,
3513 voxelDriver.doRefine(refineParams);
3529 max(meshRefiner_.surfaces().maxGapLevel()) > 0
3530 ||
max(meshRefiner_.shells().maxGapLevel()) > 0
3531 ||
max(meshRefiner_.surfaces().maxCurvatureLevel()) > 0
3571 surfaceProximityBlock
3622 refinementInterfaceRefine
3629 directionalShellRefine
3636 if (refineParams.locationsOutsideMesh().size())
3644 meshRefiner_.surfaces().surfZones()
3647 if (unnamedSurfaces.size() && !dryRun_)
3649 meshRefiner_.blockLeakFaces
3651 globalToMasterPatch_,
3652 globalToSlavePatch_,
3653 refineParams.locationsInMesh(),
3654 refineParams.zonesInMesh(),
3655 refineParams.locationsOutsideMesh(),
3663 max(meshRefiner_.shells().nSmoothExpansion()) > 0
3664 ||
max(meshRefiner_.shells().nSmoothPosition()) > 0
3667 directionalSmooth(refineParams);
3695 zonify(refineParams, zonesToFaceZone);
3709 const word& fzName = zonesToFaceZone[czNames];
3711 const word& masterName = fzName;
3712 const word slaveName = czNames.second() +
"_to_" + czNames.first();
3714 faceZoneToPatches.insert(fzName,
patches);
3716 addFaceZones(meshRefiner_, refineParams, faceZoneToPatches);
3720 splitAndMergeBaffles
3730 if (prepareForSnapping)
3732 const auto mt = meshRefiner_.meshType();
3735 meshRefiner_.mesh().faceZones().size()
3742 erodeNonManifoldZoneFaces(refineParams);
3745 mergePatchFaces(mergeType, refineParams, motionDict);
3749 if (refineParams.minCellFraction() > 0 || refineParams.nMinCells() > 0)
3756 deleteSmallRegions(refineParams);
3763 <<
"Doing final balancing" <<
nl
3764 <<
"---------------------" <<
nl
3775 const bool hasBufferLayer =
false;
3817 meshRefiner_.balance
Istream and Ostream manipulators taking arguments.
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
const polyBoundaryMesh & pbm
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
A HashTable similar to std::unordered_map.
List< Key > sortedToc() const
The table of contents (the keys) in sorted order.
List< Key > toc() const
The table of contents (the keys) in unsorted order.
bool insert(const Key &key, const T &obj)
Copy insert a new entry, not overwriting existing entries.
label size() const noexcept
The number of elements in table.
A List with indirect addressing.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
void setSize(label n)
Alias for resize().
A HashTable to objects of type <T> with a label key.
An ordered pair of two objects of type <T> with first() and second() elements.
const T & first() const noexcept
Access the first element.
const T & second() const noexcept
Access the second element.
const labelListList & faceEdges() const
Return face-edge addressing.
static void listReduce(UList< T > &values, BinaryOp bop, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Reduce list elements (list must be equal size on all ranks), applying bop to each list element.
static void broadcasts(const int communicator, Type &value, Args &&... values)
Broadcast multiple items to all communicator ranks. Does nothing in non-parallel.
const T * set(const label i) const
Return const pointer to element (can be nullptr), or nullptr for out-of-range access (ie,...
A list that is sorted upon construction or when explicitly requested with the sort() method.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
fileName path() const
The path for the case = rootPath/caseName.
A 2-tuple for storing two objects of dissimilar types. The container is similar in purpose to std::pa...
T * first()
The first entry in the list.
A List with indirect addressing. Like IndirectList but does not store addressing.
void size(const label n)
Older name for setAddressableSize.
static int myProcNo(const label communicator=worldComm)
Rank of this process in the communicator (starting from masterNo()). Negative if the process is not a...
static bool parRun(const bool on) noexcept
Set as parallel run on/off.
static bool master(const label communicator=worldComm)
True if process corresponds to the master rank in the communicator.
static label nProcs(const label communicator=worldComm)
Number of ranks in parallel run (for given communicator). It is 1 for serial run.
static label worldComm
Communicator for all ranks. May differ from commGlobal() if local worlds are in use.
@ gatherList
gatherList [manual algorithm]
@ broadcast
broadcast [MPI]
label size() const noexcept
The number of entries in the list.
static const char *const componentNames[]
static constexpr direction nComponents
Number of components in this vector space.
static Form uniform(const Cmpt &s)
Return a VectorSpace with all elements = s.
static labelListList globalEdgeFaces(const polyMesh &, const globalIndex &globalFaces, const indirectPrimitivePatch &pp, const bitSet &orientation)
Per patch edge the pp faces (in global indices) using it.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
labelList sortedToc() const
The indices of the on bits as a sorted labelList.
void set(const bitSet &bitset)
Set specified bits from another bitset.
A collection of cell labels.
A cell is defined as a list of faces with extra functionality.
Base class for writing coordSet(s) and tracks with fields.
double cpuTimeIncrement() const
Return CPU time [seconds] since last call to cpuTimeIncrement(), resetCpuTimeIncrement().
Abstract base class for domain decomposition.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
An edge is a list of two vertex labels. This can correspond to a directed graph edge or an edge on a ...
A face is a list of labels corresponding to mesh vertices.
Sends/receives parts of mesh+fvfields to neighbouring processors. Used in load balancing.
Mesh data needed to do the Finite Volume discretisation.
const Time & time() const
Return the top-level database.
Calculates a non-overlapping list of offsets based on an input size (eg, number of cells) from differ...
label nTotalCells() const noexcept
Total global number of mesh cells.
Refinement of (split) hexes using polyTopoChange.
An interpolation/look-up table of scalar vs <Type> values. The reference scalar values must be monoto...
static labelPairList findDuplicateFacePairs(const polyMesh &)
Helper routine to find all baffles (two boundary faces.
Helper class which maintains intersections of (changing) mesh with (static) surfaces.
label addFaceZone(const word &fzName, const word &masterPatch, const word &slavePatch, const surfaceZonesInfo::faceZoneType &fzType)
Add/lookup faceZone and update information. Return index of.
@ CASTELLATEDBUFFERLAYER2
writeType
Enumeration for what to write. Used as a bit-pattern.
@ REMOVE
set value to -1 any face that was refined
debugType
Enumeration for what to debug. Used as a bit-pattern.
static void checkCoupledFaceZones(const polyMesh &)
Helper function: check that face zones are synced.
label addMeshedPatch(const word &name, const dictionary &)
Add patch originating from meshing. Update meshedPatches_.
const fvMesh & mesh() const
Reference to mesh.
FaceMergeType
Enumeration for what to do with co-planar patch faces on a single.
static void updateList(const labelList &newToOld, const T &nullValue, List< T > &elems)
Helper: reorder list according to map.
static writeType writeLevel()
Get/set write level.
A polyBoundaryMesh is a polyPatch list with registered IO, a reference to the associated polyMesh,...
label nNonProcessor() const
The number of patches before the first processor patch.
const labelList & patchID() const
Per boundary face label the patch index.
Mesh consisting of general polyhedral cells.
const polyBoundaryMesh & boundaryMesh() const noexcept
Return boundary mesh.
const faceZoneMesh & faceZones() const noexcept
Return face zone mesh.
virtual const faceList & faces() const
Return raw faces.
virtual const labelList & faceOwner() const
Return face owner.
const globalMeshData & globalData() const
Return parallel info (demand-driven).
const cellZoneMesh & cellZones() const noexcept
Return cell zone mesh.
virtual const labelList & faceNeighbour() const
Return face neighbour.
virtual const pointField & points() const
Return raw points.
A patch is a list of labels that address the faces in the global face list.
label nInternalFaces() const noexcept
Number of internal faces.
label nPoints() const noexcept
Number of mesh points.
label nCells() const noexcept
Number of mesh cells.
label nFaces() const noexcept
Number of mesh faces.
const vectorField & faceAreas() const
const cellList & cells() const
A class for managing references or pointers (no reference counting).
Simple container to keep together refinement specific information.
scalar planarAngle() const
Angle when two intersections are considered to be planar.
label maxLocalCells() const
Per processor max number of cells.
scalar curvature() const
Curvature.
scalar minCellFraction() const
When are disconnected regions small. Fraction of overall size.
label minRefineCells() const
When to stop refining.
label nMinCells() const
When are disconnected regions small. Absolute number of cells.
const pointField & locationsOutsideMesh() const
Optional points which are checked to be outside the mesh.
static labelList findCells(const bool checkInsideMesh, const polyMesh &, const pointField &locations)
Checks that cells are in mesh. Returns cells (or -1) they.
const pointField & locationsInMesh() const
Areas to keep.
dictionary getZoneInfo(const word &fzName, surfaceZonesInfo::faceZoneType &faceType) const
Get patchInfo and faceType for faceZone.
label maxCellUnbalance() const
Trigger cell count to start balancing.
scalar maxLoadUnbalance() const
Allowed load unbalance.
label maxGlobalCells() const
Total number of cells.
const wordList & zonesInMesh() const
Per area the zone name.
Container for data on surfaces used for surface-driven refinement. Contains all the data about the le...
const labelList & surfaces() const
This class separates the mesh into distinct unconnected regions, each of which is then given a label ...
Given list of cells to remove, insert all the topology changes.
Container for searchableSurfaces. The collection is specified as a dictionary. For example,...
Encapsulates queries for volume refinement ('refine all cells within shell').
const labelList & shells() const
Indices of surfaces that are shells.
Simple container to keep together snap specific information.
static void addFaceZones(meshRefinement &meshRefiner, const refinementParameters &refineParams, const HashTable< Pair< word > > &faceZoneToPatches)
Helper: add faceZones and patches.
void doRefine(const dictionary &refineDict, const refinementParameters &refineParams, const snapParameters &snapParams, const bool prepareForSnapping, const meshRefinement::FaceMergeType mergeType, const dictionary &motionDict)
Do all the refinement.
Equivalent of snappyRefineDriver but operating on a voxel mesh.
void doRefine(const refinementParameters &refineParams)
static labelList getUnnamedSurfaces(const PtrList< surfaceZonesInfo > &surfList)
Get indices of unnamed surfaces (surfaces without faceZoneName).
faceZoneType
What to do with faceZone faces.
static const Enum< faceZoneType > faceZoneTypeNames
static labelList getNamedSurfaces(const PtrList< surfaceZonesInfo > &surfList)
Get indices of named surfaces (surfaces with faceZoneName).
@ INSIDE
A location inside the volume.
A class for handling words, derived from Foam::string.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
const polyBoundaryMesh & patches
static bool split(const std::string &line, std::string &key, std::string &val)
const labelIOList & zoneIDs
const bitSet isBlockedFace(intersectedFaces())
AccessType combine(const UList< T > &lists, AccessOp aop=accessOp< T >())
Combines sub-lists into a single list.
List< T > createWithValue(const label len, const labelUList &locations, const T &val, const T &deflt=T())
Create a List filled with default values and various locations with another specified value.
@ CLAMP
Clamp value to the start/end value.
const dimensionedScalar c
Speed of light in a vacuum.
Namespace for handling debugging switches.
List< edge > edgeList
List of edge.
dimensionedScalar pos(const dimensionedScalar &ds)
Type & refCast(U &obj)
A dynamic_cast (for references) to Type reference.
bool returnReduceOr(const bool value, const int communicator=UPstream::worldComm)
Perform logical (or) MPI Allreduce on a copy. Uses UPstream::reduceOr.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
HashTable< word, wordPair, Foam::Hash< wordPair > > wordPairHashTable
HashTable of wordPair.
List< labelPair > labelPairList
List of labelPair.
List< labelList > labelListList
List of labelList.
List< label > labelList
A List of labels.
Vector< label > labelVector
Vector of labels.
IOList< label > labelIOList
IO for a List of label.
Smanip< std::ios_base::fmtflags > setf(std::ios_base::fmtflags flags)
messageStream Info
Information stream (stdout output on master, null elsewhere).
List< face > faceList
List of faces.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
T returnReduce(const T &value, BinaryOp bop, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Perform reduction on a copy, using specified binary operation.
Omanip< int > setw(const int i)
Ostream & endl(Ostream &os)
Add newline and flush stream.
constexpr scalar degToRad() noexcept
Multiplication factor for degrees to radians conversion.
List< cell > cellList
List of cell.
ZoneMesh< cellZone, polyMesh > cellZoneMesh
A ZoneMesh with cellZone content on a polyMesh.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
labelList sortedOrder(const UList< T > &input)
Return the (stable) sort order for the list.
void reduce(T &value, BinaryOp bop, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Reduce inplace (cf. MPI Allreduce).
PrimitivePatch< IndirectList< face >, const pointField & > indirectPrimitivePatch
A PrimitivePatch with an IndirectList for the faces, const reference for the point field.
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
labelList identity(const label len, label start=0)
Return an identity map of the given length with (map[i] == i), works like std::iota() but returning a...
Field< vector > vectorField
Specialisation of Field<T> for vector.
vector point
Point is a vector.
List< bool > boolList
A List of bools.
void cmptMax(FieldField< Field, typename FieldField< Field, Type >::cmptType > &cf, const FieldField< Field, Type > &f)
static constexpr const zero Zero
Global zero (0).
typeOfMag< Type >::type gSumMag(const FieldField< Field, Type > &f)
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
vectorField pointField
pointField is a vectorField.
labelList findIndices(const ListType &input, typename ListType::const_reference val, label start=0)
Linear search to find all occurrences of given element.
UList< label > labelUList
A UList of labels.
List< scalar > scalarList
List of scalar.
DynamicID< faceZoneMesh > faceZoneID
Foam::faceZoneID.
dimensionedScalar cos(const dimensionedScalar &ds)
constexpr char nl
The newline '\n' character (0x0a).
dimensioned< typename typeOfMag< Type >::type > sumMag(const DimensionedField< Type, GeoMesh > &f1, const label comm)
#define addProfiling(Name,...)
Define profiling trigger with specified name and description string. The description is generated by ...
wordList patchNames(nPatches)
labelList pointLabels(nPoints, -1)
interfaceProperties interface(alpha1, U, thermo->transportPropertiesDict())
#define forAll(list, i)
Loop across all elements in list.
#define forAllConstIters(container, iter)
Iterate across all elements of the container object with const access.
Object access operator or list access operator (default is pass-through).
Unit conversion functions.