63 Foam::snappyRefineDriver::snappyRefineDriver
74 meshRefiner_(meshRefiner),
75 decomposer_(decomposer),
76 distributor_(distributor),
77 globalToMasterPatch_(globalToMasterPatch),
78 globalToSlavePatch_(globalToSlavePatch),
79 setFormatter_(setFormatter),
86 Foam::label Foam::snappyRefineDriver::featureEdgeRefine
88 const refinementParameters& refineParams,
98 if (refineParams.minRefineCells() == -1)
106 const fvMesh&
mesh = meshRefiner_.mesh();
110 if (meshRefiner_.features().size() && maxIter > 0)
112 for (; iter < maxIter; iter++)
115 <<
"Feature refinement iteration " << iter <<
nl 116 <<
"------------------------------" <<
nl 121 meshRefiner_.refineCandidates
123 refineParams.locationsInMesh(),
124 refineParams.curvature(),
125 refineParams.planarAngle(),
136 refineParams.maxGlobalCells(),
137 refineParams.maxLocalCells()
142 meshRefiner_.meshCutter().consistentRefinement
148 Info<<
"Determined cells to refine in = " 153 const label nCellsToRefine =
156 Info<<
"Selected for feature refinement : " << nCellsToRefine
160 if (nCellsToRefine <= minRefine)
162 Info<<
"Stopping refining since too few cells selected." 176 meshRefiner_.balanceAndRefine
178 "feature refinement iteration " +
name(iter),
182 refineParams.maxLoadUnbalance(),
183 refineParams.maxCellUnbalance()
188 meshRefiner_.refineAndBalance
190 "feature refinement iteration " +
name(iter),
194 refineParams.maxLoadUnbalance(),
195 refineParams.maxCellUnbalance()
204 Foam::label Foam::snappyRefineDriver::smallFeatureRefine
206 const refinementParameters& refineParams,
215 if (refineParams.minRefineCells() == -1)
222 addProfiling(feature,
"snappyHexMesh::refine::smallFeature");
223 const fvMesh&
mesh = meshRefiner_.mesh();
228 const labelList surfaceMaxLevel(meshRefiner_.surfaces().maxGapLevel());
229 const labelList shellMaxLevel(meshRefiner_.shells().maxGapLevel());
230 const labelList curvMaxLevel(meshRefiner_.surfaces().maxCurvatureLevel());
234 max(surfaceMaxLevel) == 0
235 &&
max(shellMaxLevel) == 0
236 &&
max(curvMaxLevel) == 0
242 for (; iter < maxIter; iter++)
245 <<
"Small surface feature refinement iteration " << iter <<
nl 246 <<
"--------------------------------------------" <<
nl 255 meshRefiner_.refineCandidates
257 refineParams.locationsInMesh(),
258 refineParams.curvature(),
259 refineParams.planarAngle(),
270 refineParams.maxGlobalCells(),
271 refineParams.maxLocalCells()
277 meshRefiner_.meshCutter().consistentRefinement
283 Info<<
"Determined cells to refine in = " 287 const label nCellsToRefine =
290 Info<<
"Selected for refinement : " << nCellsToRefine
296 if (nCellsToRefine == 0)
298 Info<<
"Stopping refining since too few cells selected." 312 meshRefiner_.balanceAndRefine
314 "small feature refinement iteration " +
name(iter),
318 refineParams.maxLoadUnbalance(),
319 refineParams.maxCellUnbalance()
324 meshRefiner_.refineAndBalance
326 "small feature refinement iteration " +
name(iter),
330 refineParams.maxLoadUnbalance(),
331 refineParams.maxCellUnbalance()
339 Foam::label Foam::snappyRefineDriver::surfaceOnlyRefine
341 const refinementParameters& refineParams,
343 const label leakBlockageIter
351 if (refineParams.minRefineCells() == -1)
359 const fvMesh&
mesh = meshRefiner_.mesh();
360 const refinementSurfaces& surfaces = meshRefiner_.surfaces();
364 label overallMaxLevel =
max(meshRefiner_.surfaces().maxLevel());
367 for (iter = 0; iter < maxIter; iter++)
370 <<
"Surface refinement iteration " << iter <<
nl 371 <<
"------------------------------" <<
nl 376 if (iter >= leakBlockageIter)
388 DynamicList<label> selectedSurfaces(unnamedSurfaces.size());
389 for (
const label surfi : unnamedSurfaces)
391 const label regioni = surfaces.globalRegion(surfi, 0);
396 if (iter > surfaces.leakLevel()[regioni])
398 selectedSurfaces.append(surfi);
404 selectedSurfaces.size()
405 && refineParams.locationsOutsideMesh().size()
408 meshRefiner_.blockLeakFaces
410 globalToMasterPatch_,
412 refineParams.locationsInMesh(),
413 refineParams.zonesInMesh(),
414 refineParams.locationsOutsideMesh(),
428 meshRefiner_.refineCandidates
430 refineParams.locationsInMesh(),
431 refineParams.curvature(),
432 refineParams.planarAngle(),
443 refineParams.maxGlobalCells(),
444 refineParams.maxLocalCells()
449 meshRefiner_.meshCutter().consistentRefinement
455 Info<<
"Determined cells to refine in = " 459 const label nCellsToRefine =
462 Info<<
"Selected for refinement : " << nCellsToRefine
472 iter >= overallMaxLevel
473 && nCellsToRefine <= refineParams.minRefineCells()
477 Info<<
"Stopping refining since too few cells selected." 491 meshRefiner_.balanceAndRefine
493 "surface refinement iteration " +
name(iter),
497 refineParams.maxLoadUnbalance(),
498 refineParams.maxCellUnbalance()
503 meshRefiner_.refineAndBalance
505 "surface refinement iteration " +
name(iter),
509 refineParams.maxLoadUnbalance(),
510 refineParams.maxCellUnbalance()
518 Foam::label Foam::snappyRefineDriver::gapOnlyRefine
520 const refinementParameters& refineParams,
529 if (refineParams.minRefineCells() == -1)
536 const fvMesh&
mesh = meshRefiner_.mesh();
541 label maxIncrement = 0;
542 const labelList& maxLevel = meshRefiner_.surfaces().maxLevel();
543 const labelList& gapLevel = meshRefiner_.surfaces().gapLevel();
547 maxIncrement =
max(maxIncrement, gapLevel[i]-maxLevel[i]);
552 if (maxIncrement == 0)
557 for (iter = 0; iter < maxIter; iter++)
560 <<
"Gap refinement iteration " << iter <<
nl 561 <<
"--------------------------" <<
nl 572 meshRefiner_.refineCandidates
574 refineParams.locationsInMesh(),
575 refineParams.curvature(),
576 refineParams.planarAngle(),
587 refineParams.maxGlobalCells(),
588 refineParams.maxLocalCells()
594 Pout<<
"Writing current mesh to time " 595 << meshRefiner_.timeName() <<
endl;
606 Pout<<
"Dumped mesh in = " 610 Pout<<
"Dumping " << candidateCells.size()
611 <<
" cells to cellSet candidateCellsFromGap." <<
endl;
612 cellSet
c(
mesh,
"candidateCellsFromGap", candidateCells);
613 c.instance() = meshRefiner_.timeName();
622 isCandidateCell[candidateCells[i]] =
true;
625 for (label i=0; i<1; i++)
627 boolList newIsCandidateCell(isCandidateCell);
635 if (isCandidateCell[own] != isCandidateCell[nei])
637 newIsCandidateCell[own] =
true;
638 newIsCandidateCell[nei] =
true;
662 if (isCandidateCell[own] != neiIsCandidateCell[bFacei])
664 newIsCandidateCell[own] =
true;
668 isCandidateCell.transfer(newIsCandidateCell);
672 forAll(isCandidateCell, celli)
674 if (isCandidateCell[celli])
679 candidateCells.setSize(
n);
681 forAll(isCandidateCell, celli)
683 if (isCandidateCell[celli])
685 candidateCells[
n++] = celli;
693 Pout<<
"Dumping " << candidateCells.size()
694 <<
" cells to cellSet candidateCellsFromGapPlusBuffer." <<
endl;
695 cellSet
c(
mesh,
"candidateCellsFromGapPlusBuffer", candidateCells);
696 c.instance() = meshRefiner_.timeName();
703 meshRefiner_.meshCutter().consistentRefinement
709 Info<<
"Determined cells to refine in = " 713 const label nCellsToRefine =
716 Info<<
"Selected for refinement : " << nCellsToRefine
727 && nCellsToRefine <= refineParams.minRefineCells()
731 Info<<
"Stopping refining since too few cells selected." 745 meshRefiner_.balanceAndRefine
747 "gap refinement iteration " +
name(iter),
751 refineParams.maxLoadUnbalance(),
752 refineParams.maxCellUnbalance()
757 meshRefiner_.refineAndBalance
759 "gap refinement iteration " +
name(iter),
763 refineParams.maxLoadUnbalance(),
764 refineParams.maxCellUnbalance()
772 Foam::label Foam::snappyRefineDriver::surfaceProximityBlock
774 const refinementParameters& refineParams,
778 if (refineParams.minRefineCells() == -1)
785 fvMesh&
mesh = meshRefiner_.mesh();
787 if (
min(meshRefiner_.surfaces().blockLevel()) ==
labelMax)
794 for (iter = 0; iter < maxIter; iter++)
797 <<
"Gap blocking iteration " << iter <<
nl 798 <<
"------------------------" <<
nl 805 meshRefiner_.removeGapCells
807 refineParams.planarAngle(),
808 meshRefiner_.surfaces().blockLevel(),
809 globalToMasterPatch_,
810 refineParams.nFilterIter()
816 Pout<<
"Writing gap blocking iteration " 817 << iter <<
" mesh to time " << meshRefiner_.timeName()
835 Foam::label Foam::snappyRefineDriver::bigGapOnlyRefine
837 const refinementParameters& refineParams,
838 const bool spreadGapSize,
842 if (refineParams.minRefineCells() == -1)
854 const fvMesh&
mesh = meshRefiner_.mesh();
859 labelList surfaceMaxLevel(meshRefiner_.surfaces().maxGapLevel());
860 labelList shellMaxLevel(meshRefiner_.shells().maxGapLevel());
862 label overallMaxLevel(
max(
max(surfaceMaxLevel),
max(shellMaxLevel)));
864 if (overallMaxLevel == 0)
870 for (; iter < maxIter; iter++)
873 <<
"Big gap refinement iteration " << iter <<
nl 874 <<
"------------------------------" <<
nl 883 meshRefiner_.refineCandidates
885 refineParams.locationsInMesh(),
886 refineParams.curvature(),
887 refineParams.planarAngle(),
898 refineParams.maxGlobalCells(),
899 refineParams.maxLocalCells()
906 Pout<<
"Writing current mesh to time " 907 << meshRefiner_.timeName() <<
endl;
918 Pout<<
"Dumped mesh in = " 921 Pout<<
"Dumping " << candidateCells.size()
922 <<
" cells to cellSet candidateCellsFromBigGap." <<
endl;
923 cellSet
c(
mesh,
"candidateCellsFromBigGap", candidateCells);
924 c.instance() = meshRefiner_.timeName();
930 meshRefiner_.meshCutter().consistentRefinement
936 Info<<
"Determined cells to refine in = " 940 const label nCellsToRefine =
943 Info<<
"Selected for refinement : " << nCellsToRefine
953 iter >= overallMaxLevel
954 && nCellsToRefine <= refineParams.minRefineCells()
958 Info<<
"Stopping refining since too few cells selected." 972 meshRefiner_.balanceAndRefine
974 "big gap refinement iteration " +
name(iter),
978 refineParams.maxLoadUnbalance(),
979 refineParams.maxCellUnbalance()
984 meshRefiner_.refineAndBalance
986 "big gap refinement iteration " +
name(iter),
990 refineParams.maxLoadUnbalance(),
991 refineParams.maxCellUnbalance()
999 Foam::label Foam::snappyRefineDriver::danglingCellRefine
1001 const refinementParameters& refineParams,
1006 if (refineParams.minRefineCells() == -1)
1018 addProfiling(dangling,
"snappyHexMesh::refine::danglingCell");
1019 const fvMesh&
mesh = meshRefiner_.mesh();
1022 for (iter = 0; iter < maxIter; iter++)
1025 <<
"Dangling coarse cells refinement iteration " << iter <<
nl 1026 <<
"--------------------------------------------" <<
nl 1038 cellSet candidateCellSet(
mesh,
"candidateCells",
cells.
size()/1000);
1042 label nIntFaces = 0;
1043 for (
const label meshFacei :
cells[celli])
1053 if (nIntFaces == nFaces)
1055 candidateCellSet.insert(celli);
1061 Pout<<
"Dumping " << candidateCellSet.size()
1062 <<
" cells to cellSet candidateCellSet." <<
endl;
1063 candidateCellSet.instance() = meshRefiner_.timeName();
1064 candidateCellSet.
write();
1066 candidateCells = candidateCellSet.toc();
1073 meshRefiner_.meshCutter().consistentRefinement
1079 Info<<
"Determined cells to refine in = " 1083 const label nCellsToRefine =
1086 Info<<
"Selected for refinement : " << nCellsToRefine
1097 && nCellsToRefine <= refineParams.minRefineCells()
1101 Info<<
"Stopping refining since too few cells selected." 1104 if (refineParams.balanceAtEnd())
1106 Info<<
"Final mesh balancing" <<
endl;
1108 meshRefiner_.balance
1131 meshRefiner_.balanceAndRefine
1133 "coarse cell refinement iteration " +
name(iter),
1137 refineParams.maxLoadUnbalance(),
1138 refineParams.maxCellUnbalance()
1143 meshRefiner_.refineAndBalance
1145 "coarse cell refinement iteration " +
name(iter),
1149 refineParams.maxLoadUnbalance(),
1150 refineParams.maxCellUnbalance()
1160 Foam::label Foam::snappyRefineDriver::refinementInterfaceRefine
1162 const refinementParameters& refineParams,
1166 if (refineParams.minRefineCells() == -1)
1179 const fvMesh&
mesh = meshRefiner_.mesh();
1183 if (refineParams.interfaceRefine())
1185 for (;iter < maxIter; iter++)
1188 <<
"Refinement transition refinement iteration " << iter <<
nl 1189 <<
"--------------------------------------------" <<
nl 1192 const labelList& surfaceIndex = meshRefiner_.surfaceIndex();
1193 const hexRef8& cutter = meshRefiner_.meshCutter();
1207 cellSet transitionCells
1216 const cell& cFaces =
cells[celli];
1217 label cLevel = cutter.cellLevel()[celli];
1221 label facei = cFaces[cFacei];
1223 if (surfaceIndex[facei] != -1)
1225 label fLevel = cutter.faceLevel(facei);
1226 if (fLevel != cLevel)
1228 transitionCells.insert(celli);
1235 cellSet candidateCellSet
1356 for (
const label celli : transitionCells)
1358 const cell& cFaces =
cells[celli];
1359 label cLevel = cutter.cellLevel()[celli];
1362 bool foundOpposite =
false;
1366 label facei = cFaces[cFacei];
1370 surfaceIndex[facei] != -1
1371 && cutter.faceLevel(facei) > cLevel
1376 if (faceOwner[facei] != celli)
1384 label face2i = cFaces[cFaceI2];
1389 && surfaceIndex[face2i] != -1
1394 if (faceOwner[face2i] != celli)
1400 if ((
n&n2) < oppositeCos)
1402 foundOpposite =
true;
1418 candidateCellSet.insert(celli);
1424 Pout<<
"Dumping " << candidateCellSet.size()
1425 <<
" cells to cellSet candidateCellSet." <<
endl;
1426 candidateCellSet.instance() = meshRefiner_.timeName();
1427 candidateCellSet.
write();
1429 candidateCells = candidateCellSet.toc();
1436 meshRefiner_.meshCutter().consistentRefinement
1442 Info<<
"Determined cells to refine in = " 1446 const label nCellsToRefine =
1449 Info<<
"Selected for refinement : " << nCellsToRefine
1460 && nCellsToRefine <= refineParams.minRefineCells()
1464 Info<<
"Stopping refining since too few cells selected." 1478 meshRefiner_.balanceAndRefine
1480 "interface cell refinement iteration " +
name(iter),
1484 refineParams.maxLoadUnbalance(),
1485 refineParams.maxCellUnbalance()
1490 meshRefiner_.refineAndBalance
1492 "interface cell refinement iteration " +
name(iter),
1496 refineParams.maxLoadUnbalance(),
1497 refineParams.maxCellUnbalance()
1505 bool Foam::snappyRefineDriver::usesHigherLevel
1512 for (
const label pointi :
f)
1514 if (boundaryPointLevel[pointi] > cLevel)
1523 Foam::label Foam::snappyRefineDriver::boundaryRefinementInterfaceRefine
1525 const refinementParameters& refineParams,
1529 if (refineParams.minRefineCells() == -1)
1542 const fvMesh&
mesh = meshRefiner_.mesh();
1546 if (refineParams.interfaceRefine())
1548 for (;iter < maxIter; iter++)
1551 <<
"Boundary refinement iteration " << iter <<
nl 1552 <<
"-------------------------------" <<
nl 1555 const labelList& surfaceIndex = meshRefiner_.surfaceIndex();
1556 const hexRef8& cutter = meshRefiner_.meshCutter();
1557 const labelList& cellLevel = cutter.cellLevel();
1569 forAll(surfaceIndex, facei)
1571 if (surfaceIndex[facei] != -1)
1573 isBoundaryFace.set(facei);
1574 isBoundaryPoint.set(faces[facei]);
1577 const labelList meshPatchIDs(meshRefiner_.meshedPatches());
1578 for (
const label patchi : meshPatchIDs)
1583 isBoundaryFace.set(
pp.start()+i);
1584 isBoundaryPoint.set(
pp[i]);
1592 orEqOp<unsigned int>(),
1603 const cell& cFaces =
cells[celli];
1604 const label cLevel = cellLevel[celli];
1606 for (
const label facei : cFaces)
1608 if (isBoundaryFace(facei))
1610 const face&
f = faces[facei];
1611 for (
const label pointi :
f)
1613 boundaryPointLevel[pointi] =
1616 boundaryPointLevel[pointi],
1639 cellSet candidateCellSet
1648 const cell& cFaces =
cells[celli];
1649 const label cLevel = cellLevel[celli];
1651 bool isBoundaryCell =
false;
1652 for (
const label facei : cFaces)
1654 if (isBoundaryFace(facei))
1656 isBoundaryCell =
true;
1661 if (!isBoundaryCell)
1663 for (
const label facei : cFaces)
1666 if (usesHigherLevel(boundaryPointLevel,
f, cLevel))
1668 candidateCellSet.insert(celli);
1676 Pout<<
"Dumping " << candidateCellSet.size()
1677 <<
" cells to cellSet candidateCellSet." <<
endl;
1678 candidateCellSet.instance() = meshRefiner_.timeName();
1679 candidateCellSet.
write();
1681 candidateCells = candidateCellSet.toc();
1686 meshRefiner_.meshCutter().consistentRefinement
1692 Info<<
"Determined cells to refine in = " 1696 const label nCellsToRefine =
1699 Info<<
"Selected for refinement : " << nCellsToRefine
1714 Info<<
"Stopping refining since too few cells selected." 1728 meshRefiner_.balanceAndRefine
1730 "boundary cell refinement iteration " +
name(iter),
1734 refineParams.maxLoadUnbalance(),
1735 refineParams.maxCellUnbalance()
1740 meshRefiner_.refineAndBalance
1742 "boundary cell refinement iteration " +
name(iter),
1746 refineParams.maxLoadUnbalance(),
1747 refineParams.maxCellUnbalance()
1756 void Foam::snappyRefineDriver::removeInsideCells
1758 const refinementParameters& refineParams,
1759 const label nBufferLayers
1763 if (meshRefiner_.limitShells().shells().size() == 0 && nBufferLayers == 0)
1774 <<
"Removing mesh beyond surface intersections" <<
nl 1775 <<
"------------------------------------------" <<
nl 1778 const fvMesh&
mesh = meshRefiner_.mesh();
1786 if (meshRefiner_.limitShells().shells().size())
1788 meshRefiner_.removeLimitShells
1792 globalToMasterPatch_,
1793 globalToSlavePatch_,
1794 refineParams.locationsInMesh(),
1795 refineParams.zonesInMesh(),
1796 refineParams.locationsOutsideMesh()
1803 meshRefiner_.splitMesh
1806 refineParams.nErodeCellZone(),
1807 globalToMasterPatch_,
1808 globalToSlavePatch_,
1809 refineParams.locationsInMesh(),
1810 refineParams.zonesInMesh(),
1811 refineParams.locationsOutsideMesh(),
1812 !refineParams.useLeakClosure(),
1820 Pout<<
"Writing subsetted mesh to time " 1821 << meshRefiner_.timeName() <<
endl;
1832 Pout<<
"Dumped mesh in = " 1838 Foam::label Foam::snappyRefineDriver::shellRefine
1840 const refinementParameters& refineParams,
1849 if (refineParams.minRefineCells() == -1)
1857 const fvMesh&
mesh = meshRefiner_.mesh();
1860 meshRefiner_.userFaceData().setSize(1);
1864 meshRefiner_.userFaceData()[0].second() = ListOps::createWithValue<label>
1867 meshRefiner_.intersectedFaces(),
1875 label overallMaxShellLevel = meshRefiner_.shells().maxLevel();
1878 for (iter = 0; iter < maxIter; iter++)
1881 <<
"Shell refinement iteration " << iter <<
nl 1882 <<
"----------------------------" <<
nl 1887 meshRefiner_.refineCandidates
1889 refineParams.locationsInMesh(),
1890 refineParams.curvature(),
1891 refineParams.planarAngle(),
1902 refineParams.maxGlobalCells(),
1903 refineParams.maxLocalCells()
1909 Pout<<
"Dumping " << candidateCells.size()
1910 <<
" cells to cellSet candidateCellsFromShells." <<
endl;
1912 cellSet
c(
mesh,
"candidateCellsFromShells", candidateCells);
1913 c.instance() = meshRefiner_.timeName();
1926 findIndices(meshRefiner_.userFaceData()[0].second(), 0)
1934 if (refineParams.nBufferLayers() <= 2)
1936 cellsToRefine = meshRefiner_.meshCutter().consistentSlowRefinement
1938 refineParams.nBufferLayers(),
1942 meshRefiner_.intersectedPoints()
1947 cellsToRefine = meshRefiner_.meshCutter().consistentSlowRefinement2
1949 refineParams.nBufferLayers(),
1955 Info<<
"Determined cells to refine in = " 1959 const label nCellsToRefine =
1962 Info<<
"Selected for internal refinement : " << nCellsToRefine
1972 iter >= overallMaxShellLevel
1973 && nCellsToRefine <= refineParams.minRefineCells()
1977 Info<<
"Stopping refining since too few cells selected." 1990 meshRefiner_.balanceAndRefine
1992 "shell refinement iteration " +
name(iter),
1996 refineParams.maxLoadUnbalance(),
1997 refineParams.maxCellUnbalance()
2002 meshRefiner_.refineAndBalance
2004 "shell refinement iteration " +
name(iter),
2008 refineParams.maxLoadUnbalance(),
2009 refineParams.maxCellUnbalance()
2013 meshRefiner_.userFaceData().clear();
2019 Foam::label Foam::snappyRefineDriver::directionalShellRefine
2021 const refinementParameters& refineParams,
2030 addProfiling(shell,
"snappyHexMesh::refine::directionalShell");
2031 const fvMesh&
mesh = meshRefiner_.mesh();
2032 const shellSurfaces& shells = meshRefiner_.shells();
2035 const_cast<labelIOList&
>(meshRefiner_.meshCutter().cellLevel());
2037 const_cast<labelIOList&
>(meshRefiner_.meshCutter().pointLevel());
2042 const labelPairList dirSelect(shells.directionalSelectLevel());
2045 forAll(dirSelect, shelli)
2047 overallMinLevel =
min(dirSelect[shelli].first(), overallMinLevel);
2048 overallMaxLevel =
max(dirSelect[shelli].second(), overallMaxLevel);
2051 if (overallMinLevel > overallMaxLevel)
2057 List<labelVector> dirCellLevel(cellLevel.size());
2064 for (iter = 0; iter < maxIter; iter++)
2067 <<
"Directional shell refinement iteration " << iter <<
nl 2068 <<
"----------------------------------------" <<
nl 2071 label nAllRefine = 0;
2073 for (
direction dir = 0; dir < vector::nComponents; dir++)
2082 labelList currentLevel(dirCellLevel.size());
2083 forAll(dirCellLevel, celli)
2085 currentLevel[celli] = dirCellLevel[celli][dir];
2090 meshRefiner_.directionalRefineCandidates
2092 refineParams.maxGlobalCells(),
2093 refineParams.maxLocalCells(),
2102 meshRefiner_.meshCutter().consistentRefinement
2110 Info<<
"Determined cells to refine in = " 2113 const label nCellsToRefine =
2116 Info<<
"Selected for direction " << vector::componentNames[dir]
2117 <<
" refinement : " << nCellsToRefine
2121 nAllRefine += nCellsToRefine;
2125 if (nCellsToRefine > 0)
2132 const bitSet isRefineCell(
mesh.
nCells(), cellsToRefine);
2134 autoPtr<mapPolyMesh> map
2136 meshRefiner_.directionalRefine
2138 "directional refinement iteration " +
name(iter),
2144 Info<<
"Refined mesh in = " 2165 forAll(map().cellMap(), celli)
2167 if (isRefineCell[map().cellMap()[celli]])
2169 dirCellLevel[celli][dir]++;
2175 forAll(map().pointMap(), pointi)
2177 label oldPointi = map().pointMap()[pointi];
2178 if (map().reversePointMap()[oldPointi] != pointi)
2181 pointLevel[pointi]++;
2188 if (nAllRefine == 0)
2190 Info<<
"Stopping refining since no cells selected." 2195 meshRefiner_.printMeshInfo
2198 "After directional refinement iteration " +
name(iter)
2203 Pout<<
"Writing directional refinement iteration " 2204 << iter <<
" mesh to time " << meshRefiner_.timeName() <<
endl;
2226 cellLevel[celli] =
cmptMax(dirCellLevel[celli]);
2233 void Foam::snappyRefineDriver::mergeAndSmoothRatio
2236 const label nSmoothExpansion,
2237 List<Tuple2<scalar, scalar>>& keyAndValue
2242 SortableList<scalar> unmergedDist(allSeedPointDist);
2243 DynamicList<scalar> mergedDist;
2245 scalar prevDist = GREAT;
2248 scalar curDist = unmergedDist[i];
2249 scalar difference =
mag(curDist - prevDist);
2250 if (difference > meshRefiner_.mergeDistance())
2253 mergedDist.append(curDist);
2259 SortableList<scalar> sortedDist(mergedDist);
2260 labelList indexSet = sortedDist.indices();
2263 scalarList seedPointsNewLocation = sortedDist;
2265 scalar initResidual = 0.0;
2266 scalar prevIterResidual = GREAT;
2268 for (label iter = 0; iter < nSmoothExpansion; iter++)
2282 for(label i = 2; i<mergedDist.size()-1; i++)
2284 scalar oldX00 = sortedDist[i-2];
2285 scalar oldX1 = sortedDist[i+1];
2286 scalar curX0 = seedPointsNewLocation[i-1];
2287 seedPointsNewLocation[i] = curX0 + (oldX1 - oldX00)/3;
2290 const scalarField residual(seedPointsNewLocation-sortedDist);
2292 scalar res(
sumMag(residual));
2298 res /= initResidual;
2300 if (
mag(prevIterResidual - res) < SMALL)
2304 Pout<<
"Converged with iteration " << iter
2305 <<
" initResidual: " << initResidual
2306 <<
" final residual : " << res <<
endl;
2312 prevIterResidual = res;
2317 sortedDist = seedPointsNewLocation;
2321 keyAndValue.setSize(mergedDist.size());
2325 keyAndValue[i].first() = mergedDist[i];
2326 label index = indexSet[i];
2327 keyAndValue[i].second() = seedPointsNewLocation[index];
2332 Foam::label Foam::snappyRefineDriver::directionalSmooth
2334 const refinementParameters& refineParams
2339 <<
"Directional expansion ratio smoothing" <<
nl 2340 <<
"-------------------------------------" <<
nl 2343 fvMesh& baseMesh = meshRefiner_.mesh();
2344 const searchableSurfaces& geometry = meshRefiner_.surfaces().geometry();
2345 const shellSurfaces& shells = meshRefiner_.shells();
2349 forAll(shells.nSmoothExpansion(), shellI)
2353 shells.nSmoothExpansion()[shellI] > 0
2354 || shells.nSmoothPosition()[shellI] > 0
2357 label surfi = shells.shells()[shellI];
2358 const vector& userDirection = shells.smoothDirection()[shellI];
2365 List<volumeType> volType;
2366 geometry[surfi].getVolumeType(baseMesh.points(), volType);
2398 bitSet isXEdge(baseMesh.edges().size());
2400 const edgeList& edges = baseMesh.edges();
2403 const edge&
e = edges[edgei];
2404 vector eVec(
e.vec(baseMesh.points()));
2406 if (
mag(eVec&userDirection) > 0.9)
2415 const scalar totalLength =
2416 geometry[surfi].bounds().span()
2418 const scalar startPosition =
2419 geometry[surfi].bounds().min()
2426 normalizedPosition[i] =
2428 ((baseMesh.points()[pointi]&userDirection) - startPosition)
2436 DynamicList<scalar> seedPointDist;
2439 scalar prevDist = GREAT;
2442 label pointi = order[i];
2443 scalar curDist = normalizedPosition[pointi];
2444 if (
mag(curDist - prevDist) > meshRefiner_.mergeDistance())
2446 seedPointDist.append(curDist);
2460 ListListOps::combine<scalarList>
2462 gatheredDist, accessOp<scalarList>()
2467 bitSet isFrozenPoint(baseMesh.nPoints(),
true);
2470 scalar minSeed =
min(allSeedPointDist);
2471 scalar maxSeed =
max(allSeedPointDist);
2474 forAll(normalizedPosition, posI)
2476 const scalar
pos = normalizedPosition[posI];
2479 (
mag(
pos-minSeed) < meshRefiner_.mergeDistance())
2480 || (
mag(
pos-maxSeed) < meshRefiner_.mergeDistance())
2494 Info<<
"Smoothing " << geometry[surfi].name() <<
':' <<
nl 2495 <<
" Direction : " << userDirection <<
nl 2496 <<
" Number of points : " 2498 <<
" (out of " << baseMesh.globalData().nTotalPoints()
2500 <<
" Smooth expansion iterations : " 2501 << shells.nSmoothExpansion()[shellI] <<
nl 2502 <<
" Smooth position iterations : " 2503 << shells.nSmoothPosition()[shellI] <<
nl 2504 <<
" Number of planes : " 2505 << allSeedPointDist.size()
2509 List<Tuple2<scalar, scalar>> keyAndValue(allSeedPointDist.size());
2518 shells.nSmoothExpansion()[shellI],
2528 const interpolationTable<scalar> table
2540 const point& curPoint = baseMesh.points()[pointi];
2541 scalar curDist = normalizedPosition[i];
2542 scalar newDist = table(curDist);
2543 scalar newPosition = startPosition + newDist*totalLength;
2544 baseNewPoints[pointi] +=
2545 userDirection * (newPosition - (curPoint &userDirection));
2549 vectorField disp(baseNewPoints-baseMesh.points());
2554 maxMagSqrEqOp<vector>(),
2557 baseMesh.movePoints(baseMesh.points()+disp);
2560 baseMesh.moving(
false);
2564 const_cast<Time&
>(baseMesh.time())++;
2566 Pout<<
"Writing directional expansion ratio smoothed" 2567 <<
" mesh to time " << meshRefiner_.timeName() <<
endl;
2577 baseMesh.time().path()/meshRefiner_.timeName()
2584 pointField baseMeshPoints(baseMesh.points());
2585 scalar initResidual = 0.0;
2586 scalar prevIterResidual = GREAT;
2587 for (iter = 0; iter < shells.nSmoothPosition()[shellI]; iter++)
2590 const edgeList& edges = baseMesh.edges();
2600 const edge&
e = edges[edgei];
2602 (unsmoothedPoints[
e[1]]&userDirection);
2605 (unsmoothedPoints[
e[0]]&userDirection);
2626 if (nSumXEdges[pointi] < 2)
2630 const labelList& pEdges = pointEdges[pointi];
2633 label edgei = pEdges[pE];
2636 const edge&
e = edges[edgei];
2637 label otherPt =
e.otherVertex(pointi);
2638 nSumOther[pointi]--;
2641 unsmoothedPoints[otherPt]
2668 if ((nSumOther[pointi] >= 2) && !isFrozenPoint[pointi])
2673 (unsmoothedPoints[pointi]&userDirection)
2674 +sumOther[pointi]/nSumOther[pointi]
2677 vector& v = baseNewPoints[pointi];
2678 v += (smoothPos-(v&userDirection))*userDirection;
2682 const vectorField residual(baseNewPoints - baseMeshPoints);
2684 scalar res(
gSum(
mag(residual)));
2690 res /= initResidual;
2692 if (
mag(prevIterResidual - res) < SMALL)
2694 Info<<
"Converged smoothing in iteration " << iter
2695 <<
" initResidual: " << initResidual
2696 <<
" final residual : " << res <<
endl;
2701 prevIterResidual = res;
2706 baseMeshPoints = baseNewPoints;
2711 vectorField dispSmooth(baseMeshPoints-baseMesh.points());
2716 maxMagSqrEqOp<vector>(),
2719 baseMesh.movePoints(baseMesh.points()+dispSmooth);
2722 baseMesh.moving(
false);
2726 const_cast<Time&
>(baseMesh.time())++;
2728 Pout<<
"Writing positional smoothing iteration " 2729 << iter <<
" mesh to time " << meshRefiner_.timeName()
2739 baseMesh.time().path()/meshRefiner_.timeName()
2748 void Foam::snappyRefineDriver::baffleAndSplitMesh
2750 const refinementParameters& refineParams,
2751 const snapParameters& snapParams,
2752 const bool handleSnapProblems,
2753 const dictionary& motionDict
2763 <<
"Splitting mesh at surface intersections" <<
nl 2764 <<
"---------------------------------------" <<
nl 2767 const fvMesh&
mesh = meshRefiner_.mesh();
2777 meshRefiner_.baffleAndSplitMesh
2783 refineParams.useTopologicalSnapDetection(),
2786 refineParams.nErodeCellZone(),
2790 globalToMasterPatch_,
2791 globalToSlavePatch_,
2792 refineParams.locationsInMesh(),
2793 refineParams.zonesInMesh(),
2794 refineParams.locationsOutsideMesh(),
2795 !refineParams.useLeakClosure(),
2800 if (!handleSnapProblems)
2802 meshRefiner_.mergeFreeStandingBaffles
2805 refineParams.useTopologicalSnapDetection(),
2808 refineParams.planarAngle(),
2811 globalToMasterPatch_,
2812 globalToSlavePatch_,
2813 refineParams.locationsInMesh(),
2814 refineParams.locationsOutsideMesh()
2820 void Foam::snappyRefineDriver::zonify
2822 const refinementParameters& refineParams,
2837 namedSurfaces.size()
2838 || refineParams.zonesInMesh().size()
2842 <<
"Introducing zones for interfaces" <<
nl 2843 <<
"--------------------------------" <<
nl 2846 const fvMesh&
mesh = meshRefiner_.mesh();
2855 refineParams.allowFreeStandingZoneFaces(),
2856 refineParams.nErodeCellZone(),
2857 refineParams.locationsInMesh(),
2858 refineParams.zonesInMesh(),
2859 refineParams.locationsOutsideMesh(),
2860 !refineParams.useLeakClosure(),
2867 Pout<<
"Writing zoned mesh to time " 2868 << meshRefiner_.timeName() <<
endl;
2887 void Foam::snappyRefineDriver::splitAndMergeBaffles
2889 const refinementParameters& refineParams,
2890 const snapParameters& snapParams,
2891 const bool handleSnapProblems,
2892 const dictionary& motionDict
2901 <<
"Handling cells with snap problems" <<
nl 2902 <<
"---------------------------------" <<
nl 2905 const fvMesh&
mesh = meshRefiner_.mesh();
2913 const scalarField& perpAngle = meshRefiner_.surfaces().perpendicularAngle();
2915 meshRefiner_.baffleAndSplitMesh
2921 refineParams.useTopologicalSnapDetection(),
2924 refineParams.nErodeCellZone(),
2928 globalToMasterPatch_,
2929 globalToSlavePatch_,
2930 refineParams.locationsInMesh(),
2931 refineParams.zonesInMesh(),
2932 refineParams.locationsOutsideMesh(),
2933 !refineParams.useLeakClosure(),
2938 meshRefiner_.mergeFreeStandingBaffles
2941 refineParams.useTopologicalSnapDetection(),
2944 refineParams.planarAngle(),
2947 globalToMasterPatch_,
2948 globalToSlavePatch_,
2949 refineParams.locationsInMesh(),
2950 refineParams.locationsOutsideMesh()
2960 meshRefiner_.dupNonManifoldPoints();
2966 const label nCouples =
returnReduce(couples.size(), sumOp<label>());
2968 Info<<
"Detected unsplittable baffles : " << nCouples <<
endl;
2975 meshRefiner_.mergeBaffles(couples, Map<label>(0));
2980 meshRefiner_.checkData();
2984 meshRefiner_.splitMeshRegions
2986 globalToMasterPatch_,
2987 globalToSlavePatch_,
2988 refineParams.locationsInMesh(),
2989 refineParams.locationsOutsideMesh(),
2997 meshRefiner_.checkData();
3000 Info<<
"Merged free-standing baffles in = " 3006 Pout<<
"Writing handleProblemCells mesh to time " 3007 << meshRefiner_.timeName() <<
endl;
3024 meshRefinement& meshRefiner,
3025 const refinementParameters& refineParams,
3026 const HashTable<Pair<word>>& faceZoneToPatches
3029 if (faceZoneToPatches.size())
3032 <<
"Adding patches for face zones" <<
nl 3033 <<
"-----------------------------" <<
nl 3037 <<
setw(6) <<
"Patch" 3038 <<
setw(20) <<
"Type" 3039 <<
setw(30) <<
"Name" 3040 <<
setw(30) <<
"FaceZone" 3041 <<
setw(10) <<
"FaceType" 3043 <<
setw(6) <<
"-----" 3044 <<
setw(20) <<
"----" 3045 <<
setw(30) <<
"----" 3046 <<
setw(30) <<
"--------" 3047 <<
setw(10) <<
"--------" 3050 const polyMesh&
mesh = meshRefiner.mesh();
3055 const word& fzName = iter.key();
3060 dictionary patchInfo = refineParams.getZoneInfo(fzName, fzType);
3062 const word& masterName = fzName;
3067 label mpi = meshRefiner.addMeshedPatch(masterName, patchInfo);
3072 <<
setw(30) << masterName
3073 <<
setw(30) << fzName
3078 label sli = meshRefiner.addMeshedPatch(slaveName, patchInfo);
3083 <<
setw(30) << slaveName
3084 <<
setw(30) << fzName
3088 meshRefiner.addFaceZone(fzName, masterName, slaveName, fzType);
3096 void Foam::snappyRefineDriver::mergePatchFaces
3099 const refinementParameters& refineParams,
3100 const dictionary& motionDict
3110 <<
"Merge refined boundary faces" <<
nl 3111 <<
"----------------------------" <<
nl 3114 const fvMesh&
mesh = meshRefiner_.mesh();
3118 mergeType == meshRefinement::FaceMergeType::GEOMETRIC
3119 || mergeType == meshRefinement::FaceMergeType::IGNOREPATCH
3122 meshRefiner_.mergePatchFacesUndo
3126 meshRefiner_.meshedPatches(),
3135 meshRefiner_.mergePatchFaces
3140 meshRefiner_.meshedPatches(),
3141 meshRefinement::FaceMergeType::GEOMETRIC
3147 meshRefiner_.checkData();
3154 meshRefiner_.checkData();
3159 void Foam::snappyRefineDriver::deleteSmallRegions
3161 const refinementParameters& refineParams
3164 const fvMesh&
mesh = meshRefiner_.mesh();
3192 meshRefiner_.selectSeparatedCoupledFaces(isBlockedFace);
3196 if (ownPatch[facei] != -1)
3198 isBlockedFace[facei] =
true;
3205 for (
const auto& cz : czm)
3207 UIndirectList<label>(cellToZone, cz) = cz.index();
3211 const regionSplit cellRegion(
mesh, isBlockedFace);
3214 labelList nCellsPerRegion(cellRegion.nRegions(), 0);
3215 labelList regionToZone(cellRegion.nRegions(), -2);
3216 labelList nCellsPerZone(czm.size()+1, 0);
3217 forAll(cellRegion, celli)
3219 const label regioni = cellRegion[celli];
3220 const label zonei = cellToZone[celli];
3223 regionToZone[regioni] = zonei;
3225 nCellsPerRegion[regioni]++;
3226 nCellsPerZone[zonei]++;
3236 forAll(nCellsPerRegion, regioni)
3238 const label zonei = regionToZone[regioni];
3239 label& nRegionCells = nCellsPerRegion[regioni];
3243 nRegionCells < refineParams.minCellFraction()*nCellsPerZone[zonei]
3244 || nRegionCells < refineParams.nMinCells()
3247 Info<<
"Deleting region " << regioni
3248 <<
" (size " << nRegionCells
3249 <<
") of zone size " << nCellsPerZone[zonei]
3258 DynamicList<label> cellsToRemove(
mesh.
nCells()/128);
3259 forAll(cellRegion, celli)
3261 if (nCellsPerRegion[cellRegion[celli]] == 0)
3263 cellsToRemove.append(celli);
3268 cellsToRemove.size(),
3271 if (nTotCellsToRemove > 0)
3273 Info<<
"Deleting " << nTotCellsToRemove
3274 <<
" cells in small regions" <<
endl;
3276 removeCells cellRemover(
mesh);
3278 cellsToRemove.shrink();
3281 cellRemover.getExposedFaces(cellsToRemove)
3285 UIndirectList<label>(ownPatch, exposedFaces)
3287 (void)meshRefiner_.doRemoveCells
3300 const dictionary& refineDict,
3301 const refinementParameters& refineParams,
3302 const snapParameters& snapParams,
3303 const bool prepareForSnapping,
3305 const dictionary& motionDict
3310 <<
"Refinement phase" <<
nl 3311 <<
"----------------" <<
nl 3314 const fvMesh&
mesh = meshRefiner_.mesh();
3318 refineParams.findCells(
true,
mesh, refineParams.locationsInMesh());
3323 refineParams.findCells(
true,
mesh, refineParams.locationsOutsideMesh());
3329 snappyVoxelMeshDriver voxelDriver
3332 globalToMasterPatch_,
3335 voxelDriver.doRefine(refineParams);
3351 max(meshRefiner_.surfaces().maxGapLevel()) > 0
3352 ||
max(meshRefiner_.shells().maxGapLevel()) > 0
3353 ||
max(meshRefiner_.surfaces().maxCurvatureLevel()) > 0
3393 surfaceProximityBlock
3444 refinementInterfaceRefine
3451 directionalShellRefine
3458 if (refineParams.locationsOutsideMesh().size())
3466 meshRefiner_.surfaces().surfZones()
3469 if (unnamedSurfaces.size())
3471 meshRefiner_.blockLeakFaces
3473 globalToMasterPatch_,
3474 globalToSlavePatch_,
3475 refineParams.locationsInMesh(),
3476 refineParams.zonesInMesh(),
3477 refineParams.locationsOutsideMesh(),
3485 max(meshRefiner_.shells().nSmoothExpansion()) > 0
3486 ||
max(meshRefiner_.shells().nSmoothPosition()) > 0
3489 directionalSmooth(refineParams);
3517 zonify(refineParams, zonesToFaceZone);
3521 HashTable<Pair<word>> faceZoneToPatches(zonesToFaceZone.size());
3526 List<Pair<word>> czs(zonesToFaceZone.sortedToc());
3530 const Pair<word>& czNames = czs[i];
3531 const word& fzName = zonesToFaceZone[czNames];
3533 const word& masterName = fzName;
3534 const word slaveName = czNames.second() +
"_to_" + czNames.first();
3535 Pair<word>
patches(masterName, slaveName);
3536 faceZoneToPatches.insert(fzName,
patches);
3538 addFaceZones(meshRefiner_, refineParams, faceZoneToPatches);
3542 splitAndMergeBaffles
3551 if (prepareForSnapping)
3553 mergePatchFaces(mergeType, refineParams, motionDict);
3557 if (refineParams.minCellFraction() > 0 || refineParams.nMinCells() > 0)
3564 deleteSmallRegions(refineParams);
3571 <<
"Doing final balancing" <<
nl 3572 <<
"---------------------" <<
nl 3578 meshRefiner_.balance
List< scalar > scalarList
List of scalar.
const polyBoundaryMesh & pbm
dimensioned< typename typeOfMag< Type >::type > sumMag(const DimensionedField< Type, GeoMesh > &f1)
void size(const label n)
Older name for setAddressableSize.
void cmptMax(FieldField< Field, typename FieldField< Field, Type >::cmptType > &cf, const FieldField< Field, Type > &f)
const labelIOList & zoneIDs
#define addProfiling(name, descr)
Define profiling trigger with specified name and description string.
fileName path() const
Return path.
List< cell > cellList
List of cell.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
labelList pointLabels(nPoints, -1)
label nPoints() const noexcept
Number of mesh points.
Clamp value to the start/end value.
virtual const labelList & faceNeighbour() const
Return face neighbour.
List< edge > edgeList
List of edge.
labelList sortedOrder(const UList< T > &input)
Return the (stable) sort order for the list.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Unit conversion functions.
constexpr char nl
The newline '\n' character (0x0a)
bool coupled(solutionDict.getOrDefault("coupledEnergyField", false))
Ostream & endl(Ostream &os)
Add newline and flush stream.
const labelList & patchID() const
Per boundary face label the patch index.
static bool & parRun() noexcept
Test if this a parallel run.
static writeType writeLevel()
Get/set write level.
labelList findIndices(const ListType &input, typename ListType::const_reference val, label start=0)
Linear search to find all occurrences of given element.
interfaceProperties interface(alpha1, U, thermo->transportPropertiesDict())
List< labelPair > labelPairList
List of labelPair.
const cellList & cells() const
static const Enum< faceZoneType > faceZoneTypeNames
static int myProcNo(const label communicator=worldComm)
Rank of this process in the communicator (starting from masterNo()). Can be negative if the process i...
set value to -1 any face that was refined
const Time & time() const
Return the top-level database.
static label worldComm
Communicator for all ranks. May differ from commGlobal() if local worlds are in use.
label nFaces() const noexcept
Number of mesh faces.
T returnReduce(const T &value, const BinaryOp &bop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Perform reduction on a copy, using specified binary operation.
List< labelList > labelListList
List of labelList.
DynamicID< faceZoneMesh > faceZoneID
Foam::faceZoneID.
UList< label > labelUList
A UList of labels.
static void broadcast(Type &value, const label comm=UPstream::worldComm)
Broadcast content (contiguous or non-contiguous) to all processes in communicator.
static labelPairList findDuplicateFacePairs(const polyMesh &)
Helper routine to find all baffles (two boundary faces.
#define forAll(list, i)
Loop across all elements in list.
List< face > faceList
List of faces.
static void updateList(const labelList &newToOld, const T &nullValue, List< T > &elems)
Helper: reorder list according to map.
dimensionedScalar pos(const dimensionedScalar &ds)
static label nProcs(const label communicator=worldComm)
Number of ranks in parallel run (for given communicator). It is 1 for serial run. ...
Sends/receives parts of mesh+fvfields to neighbouring processors. Used in load balancing.
vectorField pointField
pointField is a vectorField.
static void gatherList(const List< commsStruct > &comms, List< T > &values, const int tag, const label comm)
Gather data, but keep individual values separate. Uses the specified communication schedule...
const dimensionedScalar e
Elementary charge.
IOList< label > labelIOList
IO for a List of label.
void setSize(const label n)
Alias for resize()
FaceMergeType
Enumeration for what to do with co-planar patch faces on a single.
Type gSum(const FieldField< Field, Type > &f)
dimensionedScalar cos(const dimensionedScalar &ds)
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
labelList identity(const label len, label start=0)
Return an identity map of the given length with (map[i] == i)
const polyBoundaryMesh & boundaryMesh() const noexcept
Return boundary mesh.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
label size() const noexcept
The number of entries in the list.
wordList patchNames(nPatches)
Base class for writing coordSet(s) and tracks with fields.
static void checkCoupledFaceZones(const polyMesh &)
Helper function: check that face zones are synced.
virtual const labelList & faceOwner() const
Return face owner.
virtual bool write(const token &tok)=0
Write token to stream or otherwise handle it.
Smanip< ios_base::fmtflags > setf(const ios_base::fmtflags flags)
const globalMeshData & globalData() const
Return parallel info.
Abstract base class for domain decomposition.
label nInternalFaces() const noexcept
Number of internal faces.
A location inside the volume.
virtual const faceList & faces() const
Return raw faces.
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
static labelList getUnnamedSurfaces(const PtrList< surfaceZonesInfo > &surfList)
Get indices of unnamed surfaces (surfaces without faceZoneName)
const wordList surface
Standard surface field types (scalar, vector, tensor, etc)
Istream and Ostream manipulators taking arguments.
int debug
Static debugging option.
const faceZoneMesh & faceZones() const noexcept
Return face zone mesh.
defineTypeNameAndDebug(combustionModel, 0)
label nTotalCells() const noexcept
Return total number of cells in decomposed mesh.
double cpuTimeIncrement() const
Return CPU time (in seconds) since last call to cpuTimeIncrement()
static void addFaceZones(meshRefinement &meshRefiner, const refinementParameters &refineParams, const HashTable< Pair< word >> &faceZoneToPatches)
Helper: add faceZones and patches.
static void broadcasts(const label comm, Type &arg1, Args &&... args)
Broadcast multiple items to all processes in communicator.
Helper class which maintains intersections of (changing) mesh with (static) surfaces.
static bool split(const std::string &line, std::string &key, std::string &val)
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.
vector point
Point is a vector.
label nCells() const noexcept
Number of mesh cells.
const vectorField & faceAreas() const
const dimensionedScalar c
Speed of light in a vacuum.
static bool master(const label communicator=worldComm)
True if process corresponds to the master rank in the communicator.
const polyBoundaryMesh & patches
const cellZoneMesh & cellZones() const noexcept
Return cell zone mesh.
static labelList getNamedSurfaces(const PtrList< surfaceZonesInfo > &surfList)
Get indices of named surfaces (surfaces with faceZoneName)
messageStream Info
Information stream (stdout output on master, null elsewhere)
static Vector< label > uniform(const label &s)
Return a VectorSpace with all elements = s.
writeType
Enumeration for what to write. Used as a bit-pattern.
Field< vector > vectorField
Specialisation of Field<T> for vector.
faceZoneType
What to do with faceZone faces.
debugType
Enumeration for what to debug. Used as a bit-pattern.
Vector< label > labelVector
Vector of labels.
Omanip< int > setw(const int i)
List< label > labelList
A List of labels.
T * first()
The first entry in the list.
bool returnReduceOr(const bool value, const label comm=UPstream::worldComm)
Perform logical (or) MPI Allreduce on a copy. Uses UPstream::reduceOr.
constexpr scalar degToRad(const scalar deg) noexcept
Conversion from degrees to radians.
List< bool > boolList
A List of bools.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
HashTable< word, wordPair, Foam::Hash< wordPair > > wordPairHashTable
HashTable of wordPair.
ZoneMesh< cellZone, polyMesh > cellZoneMesh
A ZoneMesh with the type cellZone.
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
forAllConstIters(mixture.phases(), phase)
static void listCombineReduce(List< T > &values, const CombineOp &cop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
After completion all processors have the same data.
static constexpr const zero Zero
Global zero (0)