63 Foam::snappyRefineDriver::snappyRefineDriver
75 meshRefiner_(meshRefiner),
76 decomposer_(decomposer),
77 distributor_(distributor),
78 globalToMasterPatch_(globalToMasterPatch),
79 globalToSlavePatch_(globalToSlavePatch),
80 setFormatter_(setFormatter),
81 surfFormatter_(surfFormatter),
88 Foam::label Foam::snappyRefineDriver::featureEdgeRefine
90 const refinementParameters& refineParams,
100 if (refineParams.minRefineCells() == -1)
108 const fvMesh&
mesh = meshRefiner_.mesh();
112 if (meshRefiner_.features().size() && maxIter > 0)
114 for (; iter < maxIter; iter++)
117 <<
"Feature refinement iteration " << iter <<
nl 118 <<
"------------------------------" <<
nl 123 meshRefiner_.refineCandidates
125 refineParams.locationsInMesh(),
126 refineParams.curvature(),
127 refineParams.planarAngle(),
138 refineParams.maxGlobalCells(),
139 refineParams.maxLocalCells()
144 meshRefiner_.meshCutter().consistentRefinement
150 Info<<
"Determined cells to refine in = " 155 const label nCellsToRefine =
158 Info<<
"Selected for feature refinement : " << nCellsToRefine
162 if (nCellsToRefine <= minRefine)
164 Info<<
"Stopping refining since too few cells selected." 178 meshRefiner_.balanceAndRefine
180 "feature refinement iteration " +
name(iter),
184 refineParams.maxLoadUnbalance(),
185 refineParams.maxCellUnbalance()
190 meshRefiner_.refineAndBalance
192 "feature refinement iteration " +
name(iter),
196 refineParams.maxLoadUnbalance(),
197 refineParams.maxCellUnbalance()
206 Foam::label Foam::snappyRefineDriver::smallFeatureRefine
208 const refinementParameters& refineParams,
217 if (refineParams.minRefineCells() == -1)
224 addProfiling(feature,
"snappyHexMesh::refine::smallFeature");
225 const fvMesh&
mesh = meshRefiner_.mesh();
230 const labelList surfaceMaxLevel(meshRefiner_.surfaces().maxGapLevel());
231 const labelList shellMaxLevel(meshRefiner_.shells().maxGapLevel());
232 const labelList curvMaxLevel(meshRefiner_.surfaces().maxCurvatureLevel());
236 max(surfaceMaxLevel) == 0
237 &&
max(shellMaxLevel) == 0
238 &&
max(curvMaxLevel) == 0
244 for (; iter < maxIter; iter++)
247 <<
"Small surface feature refinement iteration " << iter <<
nl 248 <<
"--------------------------------------------" <<
nl 257 meshRefiner_.refineCandidates
259 refineParams.locationsInMesh(),
260 refineParams.curvature(),
261 refineParams.planarAngle(),
272 refineParams.maxGlobalCells(),
273 refineParams.maxLocalCells()
279 meshRefiner_.meshCutter().consistentRefinement
285 Info<<
"Determined cells to refine in = " 289 const label nCellsToRefine =
292 Info<<
"Selected for refinement : " << nCellsToRefine
298 if (nCellsToRefine == 0)
300 Info<<
"Stopping refining since too few cells selected." 314 meshRefiner_.balanceAndRefine
316 "small feature refinement iteration " +
name(iter),
320 refineParams.maxLoadUnbalance(),
321 refineParams.maxCellUnbalance()
326 meshRefiner_.refineAndBalance
328 "small feature refinement iteration " +
name(iter),
332 refineParams.maxLoadUnbalance(),
333 refineParams.maxCellUnbalance()
341 Foam::label Foam::snappyRefineDriver::surfaceOnlyRefine
343 const refinementParameters& refineParams,
345 const label leakBlockageIter
353 if (refineParams.minRefineCells() == -1)
361 const fvMesh&
mesh = meshRefiner_.mesh();
362 const refinementSurfaces& surfaces = meshRefiner_.surfaces();
366 label overallMaxLevel =
max(meshRefiner_.surfaces().maxLevel());
369 for (iter = 0; iter < maxIter; iter++)
372 <<
"Surface refinement iteration " << iter <<
nl 373 <<
"------------------------------" <<
nl 378 if (iter >= leakBlockageIter)
390 DynamicList<label> selectedSurfaces(unnamedSurfaces.size());
391 for (
const label surfi : unnamedSurfaces)
393 const label regioni = surfaces.globalRegion(surfi, 0);
398 if (iter > surfaces.leakLevel()[regioni])
400 selectedSurfaces.append(surfi);
406 selectedSurfaces.size()
407 && refineParams.locationsOutsideMesh().size()
410 meshRefiner_.blockLeakFaces
412 globalToMasterPatch_,
414 refineParams.locationsInMesh(),
415 refineParams.zonesInMesh(),
416 refineParams.locationsOutsideMesh(),
430 meshRefiner_.refineCandidates
432 refineParams.locationsInMesh(),
433 refineParams.curvature(),
434 refineParams.planarAngle(),
445 refineParams.maxGlobalCells(),
446 refineParams.maxLocalCells()
451 meshRefiner_.meshCutter().consistentRefinement
457 Info<<
"Determined cells to refine in = " 461 const label nCellsToRefine =
464 Info<<
"Selected for refinement : " << nCellsToRefine
474 iter >= overallMaxLevel
475 && nCellsToRefine <= refineParams.minRefineCells()
479 Info<<
"Stopping refining since too few cells selected." 493 meshRefiner_.balanceAndRefine
495 "surface refinement iteration " +
name(iter),
499 refineParams.maxLoadUnbalance(),
500 refineParams.maxCellUnbalance()
505 meshRefiner_.refineAndBalance
507 "surface refinement iteration " +
name(iter),
511 refineParams.maxLoadUnbalance(),
512 refineParams.maxCellUnbalance()
520 Foam::label Foam::snappyRefineDriver::gapOnlyRefine
522 const refinementParameters& refineParams,
531 if (refineParams.minRefineCells() == -1)
538 const fvMesh&
mesh = meshRefiner_.mesh();
543 label maxIncrement = 0;
544 const labelList& maxLevel = meshRefiner_.surfaces().maxLevel();
545 const labelList& gapLevel = meshRefiner_.surfaces().gapLevel();
549 maxIncrement =
max(maxIncrement, gapLevel[i]-maxLevel[i]);
554 if (maxIncrement == 0)
559 for (iter = 0; iter < maxIter; iter++)
562 <<
"Gap refinement iteration " << iter <<
nl 563 <<
"--------------------------" <<
nl 574 meshRefiner_.refineCandidates
576 refineParams.locationsInMesh(),
577 refineParams.curvature(),
578 refineParams.planarAngle(),
589 refineParams.maxGlobalCells(),
590 refineParams.maxLocalCells()
596 Pout<<
"Writing current mesh to time " 597 << meshRefiner_.timeName() <<
endl;
608 Pout<<
"Dumped mesh in = " 612 Pout<<
"Dumping " << candidateCells.size()
613 <<
" cells to cellSet candidateCellsFromGap." <<
endl;
614 cellSet
c(
mesh,
"candidateCellsFromGap", candidateCells);
615 c.instance() = meshRefiner_.timeName();
624 isCandidateCell[candidateCells[i]] =
true;
627 for (label i=0; i<1; i++)
629 boolList newIsCandidateCell(isCandidateCell);
637 if (isCandidateCell[own] != isCandidateCell[nei])
639 newIsCandidateCell[own] =
true;
640 newIsCandidateCell[nei] =
true;
664 if (isCandidateCell[own] != neiIsCandidateCell[bFacei])
666 newIsCandidateCell[own] =
true;
670 isCandidateCell.transfer(newIsCandidateCell);
674 forAll(isCandidateCell, celli)
676 if (isCandidateCell[celli])
681 candidateCells.setSize(
n);
683 forAll(isCandidateCell, celli)
685 if (isCandidateCell[celli])
687 candidateCells[
n++] = celli;
695 Pout<<
"Dumping " << candidateCells.size()
696 <<
" cells to cellSet candidateCellsFromGapPlusBuffer." <<
endl;
697 cellSet
c(
mesh,
"candidateCellsFromGapPlusBuffer", candidateCells);
698 c.instance() = meshRefiner_.timeName();
705 meshRefiner_.meshCutter().consistentRefinement
711 Info<<
"Determined cells to refine in = " 715 const label nCellsToRefine =
718 Info<<
"Selected for refinement : " << nCellsToRefine
729 && nCellsToRefine <= refineParams.minRefineCells()
733 Info<<
"Stopping refining since too few cells selected." 747 meshRefiner_.balanceAndRefine
749 "gap refinement iteration " +
name(iter),
753 refineParams.maxLoadUnbalance(),
754 refineParams.maxCellUnbalance()
759 meshRefiner_.refineAndBalance
761 "gap refinement iteration " +
name(iter),
765 refineParams.maxLoadUnbalance(),
766 refineParams.maxCellUnbalance()
774 Foam::label Foam::snappyRefineDriver::surfaceProximityBlock
776 const refinementParameters& refineParams,
780 if (refineParams.minRefineCells() == -1)
787 fvMesh&
mesh = meshRefiner_.mesh();
789 if (
min(meshRefiner_.surfaces().blockLevel()) ==
labelMax)
796 for (iter = 0; iter < maxIter; iter++)
799 <<
"Gap blocking iteration " << iter <<
nl 800 <<
"------------------------" <<
nl 807 meshRefiner_.removeGapCells
809 refineParams.planarAngle(),
810 meshRefiner_.surfaces().blockLevel(),
811 globalToMasterPatch_,
812 refineParams.nFilterIter()
818 Pout<<
"Writing gap blocking iteration " 819 << iter <<
" mesh to time " << meshRefiner_.timeName()
837 Foam::label Foam::snappyRefineDriver::bigGapOnlyRefine
839 const refinementParameters& refineParams,
840 const bool spreadGapSize,
844 if (refineParams.minRefineCells() == -1)
856 const fvMesh&
mesh = meshRefiner_.mesh();
861 labelList surfaceMaxLevel(meshRefiner_.surfaces().maxGapLevel());
862 labelList shellMaxLevel(meshRefiner_.shells().maxGapLevel());
864 label overallMaxLevel(
max(
max(surfaceMaxLevel),
max(shellMaxLevel)));
866 if (overallMaxLevel == 0)
872 for (; iter < maxIter; iter++)
875 <<
"Big gap refinement iteration " << iter <<
nl 876 <<
"------------------------------" <<
nl 885 meshRefiner_.refineCandidates
887 refineParams.locationsInMesh(),
888 refineParams.curvature(),
889 refineParams.planarAngle(),
900 refineParams.maxGlobalCells(),
901 refineParams.maxLocalCells()
908 Pout<<
"Writing current mesh to time " 909 << meshRefiner_.timeName() <<
endl;
920 Pout<<
"Dumped mesh in = " 923 Pout<<
"Dumping " << candidateCells.size()
924 <<
" cells to cellSet candidateCellsFromBigGap." <<
endl;
925 cellSet
c(
mesh,
"candidateCellsFromBigGap", candidateCells);
926 c.instance() = meshRefiner_.timeName();
932 meshRefiner_.meshCutter().consistentRefinement
938 Info<<
"Determined cells to refine in = " 942 const label nCellsToRefine =
945 Info<<
"Selected for refinement : " << nCellsToRefine
955 iter >= overallMaxLevel
956 && nCellsToRefine <= refineParams.minRefineCells()
960 Info<<
"Stopping refining since too few cells selected." 974 meshRefiner_.balanceAndRefine
976 "big gap refinement iteration " +
name(iter),
980 refineParams.maxLoadUnbalance(),
981 refineParams.maxCellUnbalance()
986 meshRefiner_.refineAndBalance
988 "big gap refinement iteration " +
name(iter),
992 refineParams.maxLoadUnbalance(),
993 refineParams.maxCellUnbalance()
1001 Foam::label Foam::snappyRefineDriver::danglingCellRefine
1003 const refinementParameters& refineParams,
1008 if (refineParams.minRefineCells() == -1)
1020 addProfiling(dangling,
"snappyHexMesh::refine::danglingCell");
1021 const fvMesh&
mesh = meshRefiner_.mesh();
1024 for (iter = 0; iter < maxIter; iter++)
1027 <<
"Dangling coarse cells refinement iteration " << iter <<
nl 1028 <<
"--------------------------------------------" <<
nl 1040 cellSet candidateCellSet(
mesh,
"candidateCells",
cells.
size()/1000);
1044 label nIntFaces = 0;
1045 for (
const label meshFacei :
cells[celli])
1055 if (nIntFaces == nFaces)
1057 candidateCellSet.insert(celli);
1063 Pout<<
"Dumping " << candidateCellSet.size()
1064 <<
" cells to cellSet candidateCellSet." <<
endl;
1065 candidateCellSet.instance() = meshRefiner_.timeName();
1066 candidateCellSet.
write();
1068 candidateCells = candidateCellSet.toc();
1075 meshRefiner_.meshCutter().consistentRefinement
1081 Info<<
"Determined cells to refine in = " 1085 const label nCellsToRefine =
1088 Info<<
"Selected for refinement : " << nCellsToRefine
1099 && nCellsToRefine <= refineParams.minRefineCells()
1103 Info<<
"Stopping refining since too few cells selected." 1106 if (refineParams.balanceAtEnd())
1108 Info<<
"Final mesh balancing" <<
endl;
1110 meshRefiner_.balance
1133 meshRefiner_.balanceAndRefine
1135 "coarse cell refinement iteration " +
name(iter),
1139 refineParams.maxLoadUnbalance(),
1140 refineParams.maxCellUnbalance()
1145 meshRefiner_.refineAndBalance
1147 "coarse cell refinement iteration " +
name(iter),
1151 refineParams.maxLoadUnbalance(),
1152 refineParams.maxCellUnbalance()
1162 Foam::label Foam::snappyRefineDriver::refinementInterfaceRefine
1164 const refinementParameters& refineParams,
1168 if (refineParams.minRefineCells() == -1)
1181 const fvMesh&
mesh = meshRefiner_.mesh();
1185 if (refineParams.interfaceRefine())
1187 for (;iter < maxIter; iter++)
1190 <<
"Refinement transition refinement iteration " << iter <<
nl 1191 <<
"--------------------------------------------" <<
nl 1194 const labelList& surfaceIndex = meshRefiner_.surfaceIndex();
1195 const hexRef8& cutter = meshRefiner_.meshCutter();
1209 cellSet transitionCells
1218 const cell& cFaces =
cells[celli];
1219 label cLevel = cutter.cellLevel()[celli];
1223 label facei = cFaces[cFacei];
1225 if (surfaceIndex[facei] != -1)
1227 label fLevel = cutter.faceLevel(facei);
1228 if (fLevel != cLevel)
1230 transitionCells.insert(celli);
1237 cellSet candidateCellSet
1358 for (
const label celli : transitionCells)
1360 const cell& cFaces =
cells[celli];
1361 label cLevel = cutter.cellLevel()[celli];
1364 bool foundOpposite =
false;
1368 label facei = cFaces[cFacei];
1372 surfaceIndex[facei] != -1
1373 && cutter.faceLevel(facei) > cLevel
1378 if (faceOwner[facei] != celli)
1386 label face2i = cFaces[cFaceI2];
1391 && surfaceIndex[face2i] != -1
1392 && cutter.faceLevel(face2i) > cLevel
1397 if (faceOwner[face2i] != celli)
1403 if ((
n&n2) < oppositeCos)
1405 foundOpposite =
true;
1421 candidateCellSet.insert(celli);
1427 Pout<<
"Dumping " << candidateCellSet.size()
1428 <<
" cells to cellSet candidateCellSet." <<
endl;
1429 candidateCellSet.instance() = meshRefiner_.timeName();
1430 candidateCellSet.
write();
1432 candidateCells = candidateCellSet.toc();
1439 meshRefiner_.meshCutter().consistentRefinement
1445 Info<<
"Determined cells to refine in = " 1449 const label nCellsToRefine =
1452 Info<<
"Selected for refinement : " << nCellsToRefine
1463 && nCellsToRefine <= refineParams.minRefineCells()
1467 Info<<
"Stopping refining since too few cells selected." 1481 meshRefiner_.balanceAndRefine
1483 "interface cell refinement iteration " +
name(iter),
1487 refineParams.maxLoadUnbalance(),
1488 refineParams.maxCellUnbalance()
1493 meshRefiner_.refineAndBalance
1495 "interface cell refinement iteration " +
name(iter),
1499 refineParams.maxLoadUnbalance(),
1500 refineParams.maxCellUnbalance()
1508 bool Foam::snappyRefineDriver::usesHigherLevel
1515 for (
const label pointi :
f)
1517 if (boundaryPointLevel[pointi] > cLevel)
1526 Foam::label Foam::snappyRefineDriver::boundaryRefinementInterfaceRefine
1528 const refinementParameters& refineParams,
1532 if (refineParams.minRefineCells() == -1)
1545 const fvMesh&
mesh = meshRefiner_.mesh();
1549 if (refineParams.interfaceRefine())
1551 for (;iter < maxIter; iter++)
1554 <<
"Boundary refinement iteration " << iter <<
nl 1555 <<
"-------------------------------" <<
nl 1558 const labelList& surfaceIndex = meshRefiner_.surfaceIndex();
1559 const hexRef8& cutter = meshRefiner_.meshCutter();
1560 const labelList& cellLevel = cutter.cellLevel();
1572 forAll(surfaceIndex, facei)
1574 if (surfaceIndex[facei] != -1)
1576 isBoundaryFace.set(facei);
1577 isBoundaryPoint.set(faces[facei]);
1580 const labelList meshPatchIDs(meshRefiner_.meshedPatches());
1581 for (
const label patchi : meshPatchIDs)
1586 isBoundaryFace.set(
pp.start()+i);
1587 isBoundaryPoint.set(
pp[i]);
1595 orEqOp<unsigned int>(),
1606 const cell& cFaces =
cells[celli];
1607 const label cLevel = cellLevel[celli];
1609 for (
const label facei : cFaces)
1611 if (isBoundaryFace(facei))
1613 const face&
f = faces[facei];
1614 for (
const label pointi :
f)
1616 boundaryPointLevel[pointi] =
1619 boundaryPointLevel[pointi],
1642 cellSet candidateCellSet
1651 const cell& cFaces =
cells[celli];
1652 const label cLevel = cellLevel[celli];
1654 bool isBoundaryCell =
false;
1655 for (
const label facei : cFaces)
1657 if (isBoundaryFace(facei))
1659 isBoundaryCell =
true;
1664 if (!isBoundaryCell)
1666 for (
const label facei : cFaces)
1669 if (usesHigherLevel(boundaryPointLevel,
f, cLevel))
1671 candidateCellSet.insert(celli);
1679 Pout<<
"Dumping " << candidateCellSet.size()
1680 <<
" cells to cellSet candidateCellSet." <<
endl;
1681 candidateCellSet.instance() = meshRefiner_.timeName();
1682 candidateCellSet.
write();
1684 candidateCells = candidateCellSet.toc();
1689 meshRefiner_.meshCutter().consistentRefinement
1695 Info<<
"Determined cells to refine in = " 1699 const label nCellsToRefine =
1702 Info<<
"Selected for refinement : " << nCellsToRefine
1717 Info<<
"Stopping refining since too few cells selected." 1731 meshRefiner_.balanceAndRefine
1733 "boundary cell refinement iteration " +
name(iter),
1737 refineParams.maxLoadUnbalance(),
1738 refineParams.maxCellUnbalance()
1743 meshRefiner_.refineAndBalance
1745 "boundary cell refinement iteration " +
name(iter),
1749 refineParams.maxLoadUnbalance(),
1750 refineParams.maxCellUnbalance()
1759 void Foam::snappyRefineDriver::removeInsideCells
1761 const refinementParameters& refineParams,
1762 const label nBufferLayers
1766 if (meshRefiner_.limitShells().shells().size() == 0 && nBufferLayers == 0)
1777 <<
"Removing mesh beyond surface intersections" <<
nl 1778 <<
"------------------------------------------" <<
nl 1781 const fvMesh&
mesh = meshRefiner_.mesh();
1789 if (meshRefiner_.limitShells().shells().size())
1791 meshRefiner_.removeLimitShells
1795 globalToMasterPatch_,
1796 globalToSlavePatch_,
1797 refineParams.locationsInMesh(),
1798 refineParams.zonesInMesh(),
1799 refineParams.locationsOutsideMesh()
1806 meshRefiner_.splitMesh
1809 refineParams.nErodeCellZone(),
1810 globalToMasterPatch_,
1811 globalToSlavePatch_,
1812 refineParams.locationsInMesh(),
1813 refineParams.zonesInMesh(),
1814 refineParams.locationsOutsideMesh(),
1815 !refineParams.useLeakClosure(),
1824 Pout<<
"Writing subsetted mesh to time " 1825 << meshRefiner_.timeName() <<
endl;
1836 Pout<<
"Dumped mesh in = " 1842 Foam::label Foam::snappyRefineDriver::shellRefine
1844 const refinementParameters& refineParams,
1853 if (refineParams.minRefineCells() == -1)
1861 const fvMesh&
mesh = meshRefiner_.mesh();
1864 meshRefiner_.userFaceData().setSize(1);
1868 meshRefiner_.userFaceData()[0].second() = ListOps::createWithValue<label>
1871 meshRefiner_.intersectedFaces(),
1879 label overallMaxShellLevel = meshRefiner_.shells().maxLevel();
1882 for (iter = 0; iter < maxIter; iter++)
1885 <<
"Shell refinement iteration " << iter <<
nl 1886 <<
"----------------------------" <<
nl 1891 meshRefiner_.refineCandidates
1893 refineParams.locationsInMesh(),
1894 refineParams.curvature(),
1895 refineParams.planarAngle(),
1906 refineParams.maxGlobalCells(),
1907 refineParams.maxLocalCells()
1913 Pout<<
"Dumping " << candidateCells.size()
1914 <<
" cells to cellSet candidateCellsFromShells." <<
endl;
1916 cellSet
c(
mesh,
"candidateCellsFromShells", candidateCells);
1917 c.instance() = meshRefiner_.timeName();
1930 findIndices(meshRefiner_.userFaceData()[0].second(), 0)
1938 if (refineParams.nBufferLayers() <= 2)
1940 cellsToRefine = meshRefiner_.meshCutter().consistentSlowRefinement
1942 refineParams.nBufferLayers(),
1946 meshRefiner_.intersectedPoints()
1951 cellsToRefine = meshRefiner_.meshCutter().consistentSlowRefinement2
1953 refineParams.nBufferLayers(),
1959 Info<<
"Determined cells to refine in = " 1963 const label nCellsToRefine =
1966 Info<<
"Selected for internal refinement : " << nCellsToRefine
1976 iter >= overallMaxShellLevel
1977 && nCellsToRefine <= refineParams.minRefineCells()
1981 Info<<
"Stopping refining since too few cells selected." 1994 meshRefiner_.balanceAndRefine
1996 "shell refinement iteration " +
name(iter),
2000 refineParams.maxLoadUnbalance(),
2001 refineParams.maxCellUnbalance()
2006 meshRefiner_.refineAndBalance
2008 "shell refinement iteration " +
name(iter),
2012 refineParams.maxLoadUnbalance(),
2013 refineParams.maxCellUnbalance()
2017 meshRefiner_.userFaceData().clear();
2023 Foam::label Foam::snappyRefineDriver::directionalShellRefine
2025 const refinementParameters& refineParams,
2034 addProfiling(shell,
"snappyHexMesh::refine::directionalShell");
2035 const fvMesh&
mesh = meshRefiner_.mesh();
2036 const shellSurfaces& shells = meshRefiner_.shells();
2039 const_cast<labelIOList&
>(meshRefiner_.meshCutter().cellLevel());
2041 const_cast<labelIOList&
>(meshRefiner_.meshCutter().pointLevel());
2046 const labelPairList dirSelect(shells.directionalSelectLevel());
2049 forAll(dirSelect, shelli)
2051 overallMinLevel =
min(dirSelect[shelli].first(), overallMinLevel);
2052 overallMaxLevel =
max(dirSelect[shelli].second(), overallMaxLevel);
2055 if (overallMinLevel > overallMaxLevel)
2061 List<labelVector> dirCellLevel(cellLevel.size());
2068 for (iter = 0; iter < maxIter; iter++)
2071 <<
"Directional shell refinement iteration " << iter <<
nl 2072 <<
"----------------------------------------" <<
nl 2075 label nAllRefine = 0;
2086 labelList currentLevel(dirCellLevel.size());
2087 forAll(dirCellLevel, celli)
2089 currentLevel[celli] = dirCellLevel[celli][dir];
2094 meshRefiner_.directionalRefineCandidates
2096 refineParams.maxGlobalCells(),
2097 refineParams.maxLocalCells(),
2106 meshRefiner_.meshCutter().consistentRefinement
2114 Info<<
"Determined cells to refine in = " 2117 const label nCellsToRefine =
2120 Info<<
"Selected for direction " << vector::componentNames[dir]
2121 <<
" refinement : " << nCellsToRefine
2125 nAllRefine += nCellsToRefine;
2129 if (nCellsToRefine > 0)
2136 const bitSet isRefineCell(
mesh.
nCells(), cellsToRefine);
2138 autoPtr<mapPolyMesh> map
2140 meshRefiner_.directionalRefine
2142 "directional refinement iteration " +
name(iter),
2148 Info<<
"Refined mesh in = " 2169 forAll(map().cellMap(), celli)
2171 if (isRefineCell[map().cellMap()[celli]])
2173 dirCellLevel[celli][dir]++;
2179 forAll(map().pointMap(), pointi)
2181 label oldPointi = map().pointMap()[pointi];
2182 if (map().reversePointMap()[oldPointi] != pointi)
2185 pointLevel[pointi]++;
2192 if (nAllRefine == 0)
2194 Info<<
"Stopping refining since no cells selected." 2199 meshRefiner_.printMeshInfo
2202 "After directional refinement iteration " +
name(iter),
2208 Pout<<
"Writing directional refinement iteration " 2209 << iter <<
" mesh to time " << meshRefiner_.timeName() <<
endl;
2231 cellLevel[celli] =
cmptMax(dirCellLevel[celli]);
2238 void Foam::snappyRefineDriver::mergeAndSmoothRatio
2241 const label nSmoothExpansion,
2242 List<Tuple2<scalar, scalar>>& keyAndValue
2247 SortableList<scalar> unmergedDist(allSeedPointDist);
2248 DynamicList<scalar> mergedDist;
2250 scalar prevDist = GREAT;
2253 scalar curDist = unmergedDist[i];
2254 scalar difference =
mag(curDist - prevDist);
2255 if (difference > meshRefiner_.mergeDistance())
2258 mergedDist.append(curDist);
2264 SortableList<scalar> sortedDist(mergedDist);
2265 labelList indexSet = sortedDist.indices();
2268 scalarList seedPointsNewLocation = sortedDist;
2270 scalar initResidual = 0.0;
2271 scalar prevIterResidual = GREAT;
2273 for (label iter = 0; iter < nSmoothExpansion; iter++)
2287 for(label i = 2; i<mergedDist.size()-1; i++)
2289 scalar oldX00 = sortedDist[i-2];
2290 scalar oldX1 = sortedDist[i+1];
2291 scalar curX0 = seedPointsNewLocation[i-1];
2292 seedPointsNewLocation[i] = curX0 + (oldX1 - oldX00)/3;
2295 const scalarField residual(seedPointsNewLocation-sortedDist);
2297 scalar res(
sumMag(residual));
2303 res /= initResidual;
2305 if (
mag(prevIterResidual - res) < SMALL)
2309 Pout<<
"Converged with iteration " << iter
2310 <<
" initResidual: " << initResidual
2311 <<
" final residual : " << res <<
endl;
2317 prevIterResidual = res;
2322 sortedDist = seedPointsNewLocation;
2326 keyAndValue.setSize(mergedDist.size());
2330 keyAndValue[i].first() = mergedDist[i];
2331 label index = indexSet[i];
2332 keyAndValue[i].second() = seedPointsNewLocation[index];
2337 Foam::label Foam::snappyRefineDriver::directionalSmooth
2339 const refinementParameters& refineParams
2344 <<
"Directional expansion ratio smoothing" <<
nl 2345 <<
"-------------------------------------" <<
nl 2348 fvMesh& baseMesh = meshRefiner_.mesh();
2349 const searchableSurfaces& geometry = meshRefiner_.surfaces().geometry();
2350 const shellSurfaces& shells = meshRefiner_.shells();
2354 forAll(shells.nSmoothExpansion(), shellI)
2358 shells.nSmoothExpansion()[shellI] > 0
2359 || shells.nSmoothPosition()[shellI] > 0
2362 label surfi = shells.shells()[shellI];
2363 const vector& userDirection = shells.smoothDirection()[shellI];
2370 List<volumeType> volType;
2371 geometry[surfi].getVolumeType(baseMesh.points(), volType);
2403 bitSet isXEdge(baseMesh.edges().size());
2405 const edgeList& edges = baseMesh.edges();
2408 const edge&
e = edges[edgei];
2409 vector eVec(
e.vec(baseMesh.points()));
2411 if (
mag(eVec&userDirection) > 0.9)
2420 const scalar totalLength =
2421 geometry[surfi].bounds().span()
2423 const scalar startPosition =
2424 geometry[surfi].bounds().min()
2431 normalizedPosition[i] =
2433 ((baseMesh.points()[pointi]&userDirection) - startPosition)
2441 DynamicList<scalar> seedPointDist;
2444 scalar prevDist = GREAT;
2447 label pointi = order[i];
2448 scalar curDist = normalizedPosition[pointi];
2449 if (
mag(curDist - prevDist) > meshRefiner_.mergeDistance())
2451 seedPointDist.append(curDist);
2465 ListListOps::combine<scalarList>
2467 gatheredDist, accessOp<scalarList>()
2472 bitSet isFrozenPoint(baseMesh.nPoints(),
true);
2475 scalar minSeed =
min(allSeedPointDist);
2476 scalar maxSeed =
max(allSeedPointDist);
2479 forAll(normalizedPosition, posI)
2481 const scalar
pos = normalizedPosition[posI];
2484 (
mag(
pos-minSeed) < meshRefiner_.mergeDistance())
2485 || (
mag(
pos-maxSeed) < meshRefiner_.mergeDistance())
2499 Info<<
"Smoothing " << geometry[surfi].name() <<
':' <<
nl 2500 <<
" Direction : " << userDirection <<
nl 2501 <<
" Number of points : " 2503 <<
" (out of " << baseMesh.globalData().nTotalPoints()
2505 <<
" Smooth expansion iterations : " 2506 << shells.nSmoothExpansion()[shellI] <<
nl 2507 <<
" Smooth position iterations : " 2508 << shells.nSmoothPosition()[shellI] <<
nl 2509 <<
" Number of planes : " 2510 << allSeedPointDist.size()
2514 List<Tuple2<scalar, scalar>> keyAndValue(allSeedPointDist.size());
2523 shells.nSmoothExpansion()[shellI],
2533 const interpolationTable<scalar> table
2545 const point& curPoint = baseMesh.points()[pointi];
2546 scalar curDist = normalizedPosition[i];
2547 scalar newDist = table(curDist);
2548 scalar newPosition = startPosition + newDist*totalLength;
2549 baseNewPoints[pointi] +=
2550 userDirection * (newPosition - (curPoint &userDirection));
2554 vectorField disp(baseNewPoints-baseMesh.points());
2559 maxMagSqrEqOp<vector>(),
2562 baseMesh.movePoints(baseMesh.points()+disp);
2565 baseMesh.moving(
false);
2569 const_cast<Time&
>(baseMesh.time())++;
2571 Pout<<
"Writing directional expansion ratio smoothed" 2572 <<
" mesh to time " << meshRefiner_.timeName() <<
endl;
2582 baseMesh.time().path()/meshRefiner_.timeName()
2589 pointField baseMeshPoints(baseMesh.points());
2590 scalar initResidual = 0.0;
2591 scalar prevIterResidual = GREAT;
2592 for (iter = 0; iter < shells.nSmoothPosition()[shellI]; iter++)
2595 const edgeList& edges = baseMesh.edges();
2605 const edge&
e = edges[edgei];
2607 (unsmoothedPoints[
e[1]]&userDirection);
2610 (unsmoothedPoints[
e[0]]&userDirection);
2631 if (nSumXEdges[pointi] < 2)
2635 const labelList& pEdges = pointEdges[pointi];
2638 label edgei = pEdges[pE];
2641 const edge&
e = edges[edgei];
2642 label otherPt =
e.otherVertex(pointi);
2643 nSumOther[pointi]--;
2646 unsmoothedPoints[otherPt]
2673 if ((nSumOther[pointi] >= 2) && !isFrozenPoint[pointi])
2678 (unsmoothedPoints[pointi]&userDirection)
2679 +sumOther[pointi]/nSumOther[pointi]
2682 vector& v = baseNewPoints[pointi];
2683 v += (smoothPos-(v&userDirection))*userDirection;
2687 const vectorField residual(baseNewPoints - baseMeshPoints);
2689 scalar res(
gSum(
mag(residual)));
2695 res /= initResidual;
2697 if (
mag(prevIterResidual - res) < SMALL)
2699 Info<<
"Converged smoothing in iteration " << iter
2700 <<
" initResidual: " << initResidual
2701 <<
" final residual : " << res <<
endl;
2706 prevIterResidual = res;
2711 baseMeshPoints = baseNewPoints;
2716 vectorField dispSmooth(baseMeshPoints-baseMesh.points());
2721 maxMagSqrEqOp<vector>(),
2724 baseMesh.movePoints(baseMesh.points()+dispSmooth);
2727 baseMesh.moving(
false);
2731 const_cast<Time&
>(baseMesh.time())++;
2733 Pout<<
"Writing positional smoothing iteration " 2734 << iter <<
" mesh to time " << meshRefiner_.timeName()
2744 baseMesh.time().path()/meshRefiner_.timeName()
2753 void Foam::snappyRefineDriver::baffleAndSplitMesh
2755 const refinementParameters& refineParams,
2756 const snapParameters& snapParams,
2757 const bool handleSnapProblems,
2758 const dictionary& motionDict
2768 <<
"Splitting mesh at surface intersections" <<
nl 2769 <<
"---------------------------------------" <<
nl 2772 const fvMesh&
mesh = meshRefiner_.mesh();
2782 meshRefiner_.baffleAndSplitMesh
2788 refineParams.useTopologicalSnapDetection(),
2791 refineParams.nErodeCellZone(),
2795 globalToMasterPatch_,
2796 globalToSlavePatch_,
2797 refineParams.locationsInMesh(),
2798 refineParams.zonesInMesh(),
2799 refineParams.locationsOutsideMesh(),
2800 !refineParams.useLeakClosure(),
2806 if (!handleSnapProblems)
2808 meshRefiner_.mergeFreeStandingBaffles
2811 refineParams.useTopologicalSnapDetection(),
2814 refineParams.planarAngle(),
2817 globalToMasterPatch_,
2818 globalToSlavePatch_,
2819 refineParams.locationsInMesh(),
2820 refineParams.locationsOutsideMesh()
2826 void Foam::snappyRefineDriver::zonify
2828 const refinementParameters& refineParams,
2843 namedSurfaces.size()
2844 || refineParams.zonesInMesh().size()
2848 <<
"Introducing zones for interfaces" <<
nl 2849 <<
"--------------------------------" <<
nl 2852 const fvMesh&
mesh = meshRefiner_.mesh();
2861 refineParams.allowFreeStandingZoneFaces(),
2862 refineParams.nErodeCellZone(),
2863 refineParams.locationsInMesh(),
2864 refineParams.zonesInMesh(),
2865 refineParams.locationsOutsideMesh(),
2866 !refineParams.useLeakClosure(),
2874 Pout<<
"Writing zoned mesh to time " 2875 << meshRefiner_.timeName() <<
endl;
2894 void Foam::snappyRefineDriver::splitAndMergeBaffles
2896 const refinementParameters& refineParams,
2897 const snapParameters& snapParams,
2898 const bool handleSnapProblems,
2899 const dictionary& motionDict
2908 <<
"Handling cells with snap problems" <<
nl 2909 <<
"---------------------------------" <<
nl 2912 const fvMesh&
mesh = meshRefiner_.mesh();
2920 const scalarField& perpAngle = meshRefiner_.surfaces().perpendicularAngle();
2922 meshRefiner_.baffleAndSplitMesh
2928 refineParams.useTopologicalSnapDetection(),
2931 refineParams.nErodeCellZone(),
2935 globalToMasterPatch_,
2936 globalToSlavePatch_,
2937 refineParams.locationsInMesh(),
2938 refineParams.zonesInMesh(),
2939 refineParams.locationsOutsideMesh(),
2940 !refineParams.useLeakClosure(),
2946 meshRefiner_.mergeFreeStandingBaffles
2949 refineParams.useTopologicalSnapDetection(),
2952 refineParams.planarAngle(),
2955 globalToMasterPatch_,
2956 globalToSlavePatch_,
2957 refineParams.locationsInMesh(),
2958 refineParams.locationsOutsideMesh()
2968 meshRefiner_.dupNonManifoldPoints();
2974 const label nCouples =
returnReduce(couples.size(), sumOp<label>());
2976 Info<<
"Detected unsplittable baffles : " << nCouples <<
endl;
2983 meshRefiner_.mergeBaffles(couples, Map<label>(0));
2988 meshRefiner_.checkData();
2992 meshRefiner_.splitMeshRegions
2994 globalToMasterPatch_,
2995 globalToSlavePatch_,
2996 refineParams.locationsInMesh(),
2997 refineParams.locationsOutsideMesh(),
3005 meshRefiner_.checkData();
3008 Info<<
"Merged free-standing baffles in = " 3014 Pout<<
"Writing handleProblemCells mesh to time " 3015 << meshRefiner_.timeName() <<
endl;
3032 meshRefinement& meshRefiner,
3033 const refinementParameters& refineParams,
3034 const HashTable<Pair<word>>& faceZoneToPatches
3037 if (faceZoneToPatches.size())
3040 <<
"Adding patches for face zones" <<
nl 3041 <<
"-----------------------------" <<
nl 3045 <<
setw(6) <<
"Patch" 3046 <<
setw(20) <<
"Type" 3047 <<
setw(30) <<
"Name" 3048 <<
setw(30) <<
"FaceZone" 3049 <<
setw(10) <<
"FaceType" 3051 <<
setw(6) <<
"-----" 3052 <<
setw(20) <<
"----" 3053 <<
setw(30) <<
"----" 3054 <<
setw(30) <<
"--------" 3055 <<
setw(10) <<
"--------" 3058 const polyMesh&
mesh = meshRefiner.mesh();
3063 const word& fzName = iter.key();
3068 dictionary patchInfo = refineParams.getZoneInfo(fzName, fzType);
3070 const word& masterName = fzName;
3075 label mpi = meshRefiner.addMeshedPatch(masterName, patchInfo);
3080 <<
setw(30) << masterName
3081 <<
setw(30) << fzName
3086 label sli = meshRefiner.addMeshedPatch(slaveName, patchInfo);
3091 <<
setw(30) << slaveName
3092 <<
setw(30) << fzName
3096 meshRefiner.addFaceZone(fzName, masterName, slaveName, fzType);
3104 void Foam::snappyRefineDriver::mergePatchFaces
3107 const refinementParameters& refineParams,
3108 const dictionary& motionDict
3118 <<
"Merge refined boundary faces" <<
nl 3119 <<
"----------------------------" <<
nl 3122 const fvMesh&
mesh = meshRefiner_.mesh();
3126 mergeType == meshRefinement::FaceMergeType::GEOMETRIC
3127 || mergeType == meshRefinement::FaceMergeType::IGNOREPATCH
3130 meshRefiner_.mergePatchFacesUndo
3134 meshRefiner_.meshedPatches(),
3143 meshRefiner_.mergePatchFaces
3148 meshRefiner_.meshedPatches(),
3149 meshRefinement::FaceMergeType::GEOMETRIC
3155 meshRefiner_.checkData();
3162 meshRefiner_.checkData();
3167 void Foam::snappyRefineDriver::deleteSmallRegions
3169 const refinementParameters& refineParams
3172 const fvMesh&
mesh = meshRefiner_.mesh();
3204 if (ownPatch[facei] != -1)
3213 for (
const auto& cz : czm)
3215 UIndirectList<label>(cellToZone, cz) = cz.index();
3222 labelList nCellsPerRegion(cellRegion.nRegions(), 0);
3223 labelList regionToZone(cellRegion.nRegions(), -2);
3224 labelList nCellsPerZone(czm.size()+1, 0);
3225 forAll(cellRegion, celli)
3227 const label regioni = cellRegion[celli];
3228 const label zonei = cellToZone[celli];
3231 regionToZone[regioni] = zonei;
3233 nCellsPerRegion[regioni]++;
3234 nCellsPerZone[zonei]++;
3244 forAll(nCellsPerRegion, regioni)
3246 const label zonei = regionToZone[regioni];
3247 label& nRegionCells = nCellsPerRegion[regioni];
3251 nRegionCells < refineParams.minCellFraction()*nCellsPerZone[zonei]
3252 || nRegionCells < refineParams.nMinCells()
3255 Info<<
"Deleting region " << regioni
3256 <<
" (size " << nRegionCells
3257 <<
") of zone size " << nCellsPerZone[zonei]
3266 DynamicList<label> cellsToRemove(
mesh.
nCells()/128);
3267 forAll(cellRegion, celli)
3269 if (nCellsPerRegion[cellRegion[celli]] == 0)
3271 cellsToRemove.append(celli);
3276 cellsToRemove.size(),
3279 if (nTotCellsToRemove > 0)
3281 Info<<
"Deleting " << nTotCellsToRemove
3282 <<
" cells in small regions" <<
endl;
3284 removeCells cellRemover(
mesh);
3286 cellsToRemove.shrink();
3289 cellRemover.getExposedFaces(cellsToRemove)
3293 UIndirectList<label>(ownPatch, exposedFaces)
3295 (void)meshRefiner_.doRemoveCells
3308 const dictionary& refineDict,
3309 const refinementParameters& refineParams,
3310 const snapParameters& snapParams,
3311 const bool prepareForSnapping,
3313 const dictionary& motionDict
3318 <<
"Refinement phase" <<
nl 3319 <<
"----------------" <<
nl 3322 const fvMesh&
mesh = meshRefiner_.mesh();
3326 refineParams.findCells(
true,
mesh, refineParams.locationsInMesh());
3331 refineParams.findCells(
true,
mesh, refineParams.locationsOutsideMesh());
3337 snappyVoxelMeshDriver voxelDriver
3340 globalToMasterPatch_,
3343 voxelDriver.doRefine(refineParams);
3359 max(meshRefiner_.surfaces().maxGapLevel()) > 0
3360 ||
max(meshRefiner_.shells().maxGapLevel()) > 0
3361 ||
max(meshRefiner_.surfaces().maxCurvatureLevel()) > 0
3401 surfaceProximityBlock
3452 refinementInterfaceRefine
3459 directionalShellRefine
3466 if (refineParams.locationsOutsideMesh().size())
3474 meshRefiner_.surfaces().surfZones()
3477 if (unnamedSurfaces.size() && !dryRun_)
3479 meshRefiner_.blockLeakFaces
3481 globalToMasterPatch_,
3482 globalToSlavePatch_,
3483 refineParams.locationsInMesh(),
3484 refineParams.zonesInMesh(),
3485 refineParams.locationsOutsideMesh(),
3493 max(meshRefiner_.shells().nSmoothExpansion()) > 0
3494 ||
max(meshRefiner_.shells().nSmoothPosition()) > 0
3497 directionalSmooth(refineParams);
3525 zonify(refineParams, zonesToFaceZone);
3529 HashTable<Pair<word>> faceZoneToPatches(zonesToFaceZone.size());
3534 List<Pair<word>> czs(zonesToFaceZone.sortedToc());
3538 const Pair<word>& czNames = czs[i];
3539 const word& fzName = zonesToFaceZone[czNames];
3541 const word& masterName = fzName;
3542 const word slaveName = czNames.second() +
"_to_" + czNames.first();
3543 Pair<word>
patches(masterName, slaveName);
3544 faceZoneToPatches.insert(fzName,
patches);
3546 addFaceZones(meshRefiner_, refineParams, faceZoneToPatches);
3550 splitAndMergeBaffles
3559 if (prepareForSnapping)
3561 mergePatchFaces(mergeType, refineParams, motionDict);
3565 if (refineParams.minCellFraction() > 0 || refineParams.nMinCells() > 0)
3572 deleteSmallRegions(refineParams);
3579 <<
"Doing final balancing" <<
nl 3580 <<
"---------------------" <<
nl 3586 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
fileName path() const
Return path = rootPath/caseName. Same as TimePaths::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.
const bitSet isBlockedFace(intersectedFaces())
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)
Ostream & endl(Ostream &os)
Add newline and flush stream.
static void gatherList(const UList< commsStruct > &comms, UList< T > &values, const int tag, const label comm)
Gather data, but keep individual values separate. Uses the specified communication schedule...
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.
#define addProfiling(Name,...)
Define profiling trigger with specified name and description string. The description is generated by ...
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
::Foam::direction nComponents(const expressions::valueTypeCode) noexcept
The number of components associated with given valueTypeCode.
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.
A class for managing references or pointers (no reference counting)
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 communicator ranks. Does nothing in non-paral...
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.
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 expressions::valueTypeCode::INVALID.
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...
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.
const globalMeshData & globalData() const
Return parallel info (demand-driven)
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.
Smanip< std::ios_base::fmtflags > setf(std::ios_base::fmtflags flags)
int debug
Static debugging option.
const faceZoneMesh & faceZones() const noexcept
Return face zone mesh.
defineTypeNameAndDebug(combustionModel, 0)
label nTotalCells() const noexcept
Total global number of mesh cells.
double cpuTimeIncrement() const
Return CPU time [seconds] since last call to cpuTimeIncrement(), resetCpuTimeIncrement().
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 communicator ranks. Does nothing in non-parallel. ...
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)
Combines List elements. After completion all processors have the same data.
static constexpr const zero Zero
Global zero (0)