64 Foam::snappyRefineDriver::snappyRefineDriver
76 meshRefiner_(meshRefiner),
77 decomposer_(decomposer),
78 distributor_(distributor),
79 globalToMasterPatch_(globalToMasterPatch),
80 globalToSlavePatch_(globalToSlavePatch),
81 setFormatter_(setFormatter),
82 surfFormatter_(surfFormatter),
89 Foam::label Foam::snappyRefineDriver::featureEdgeRefine
91 const refinementParameters& refineParams,
101 if (refineParams.minRefineCells() == -1)
109 const fvMesh&
mesh = meshRefiner_.mesh();
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()
207 Foam::label Foam::snappyRefineDriver::smallFeatureRefine
209 const refinementParameters& refineParams,
218 if (refineParams.minRefineCells() == -1)
225 addProfiling(feature,
"snappyHexMesh::refine::smallFeature");
226 const fvMesh&
mesh = meshRefiner_.mesh();
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()
342 Foam::label Foam::snappyRefineDriver::surfaceOnlyRefine
344 const refinementParameters& refineParams,
346 const label leakBlockageIter
354 if (refineParams.minRefineCells() == -1)
362 const fvMesh&
mesh = meshRefiner_.mesh();
363 const refinementSurfaces& surfaces = meshRefiner_.surfaces();
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)
391 DynamicList<label> selectedSurfaces(unnamedSurfaces.size());
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()
521 Foam::label Foam::snappyRefineDriver::gapOnlyRefine
523 const refinementParameters& refineParams,
532 if (refineParams.minRefineCells() == -1)
539 const fvMesh&
mesh = meshRefiner_.mesh();
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()
775 Foam::label Foam::snappyRefineDriver::surfaceProximityBlock
777 const refinementParameters& refineParams,
781 if (refineParams.minRefineCells() == -1)
788 fvMesh&
mesh = meshRefiner_.mesh();
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()
838 Foam::label Foam::snappyRefineDriver::bigGapOnlyRefine
840 const refinementParameters& refineParams,
841 const bool spreadGapSize,
845 if (refineParams.minRefineCells() == -1)
857 const fvMesh&
mesh = meshRefiner_.mesh();
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()
1002 Foam::label Foam::snappyRefineDriver::danglingCellRefine
1004 const refinementParameters& refineParams,
1009 if (refineParams.minRefineCells() == -1)
1021 addProfiling(dangling,
"snappyHexMesh::refine::danglingCell");
1022 const fvMesh&
mesh = meshRefiner_.mesh();
1025 for (iter = 0; iter < maxIter; iter++)
1028 <<
"Dangling coarse cells refinement iteration " << iter <<
nl 1029 <<
"--------------------------------------------" <<
nl 1041 cellSet candidateCellSet(
mesh,
"candidateCells",
cells.
size()/1000);
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()
1163 Foam::label Foam::snappyRefineDriver::refinementInterfaceRefine
1165 const refinementParameters& refineParams,
1169 if (refineParams.minRefineCells() == -1)
1182 const fvMesh&
mesh = meshRefiner_.mesh();
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();
1210 cellSet transitionCells
1219 const cell& cFaces =
cells[celli];
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);
1238 cellSet candidateCellSet
1359 for (
const label celli : transitionCells)
1361 const cell& cFaces =
cells[celli];
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()
1509 bool Foam::snappyRefineDriver::usesHigherLevel
1516 for (
const label pointi :
f)
1518 if (boundaryPointLevel[pointi] > cLevel)
1527 Foam::label Foam::snappyRefineDriver::boundaryRefinementInterfaceRefine
1529 const refinementParameters& refineParams,
1533 if (refineParams.minRefineCells() == -1)
1546 const fvMesh&
mesh = meshRefiner_.mesh();
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]);
1596 orEqOp<unsigned int>(),
1607 const cell& cFaces =
cells[celli];
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],
1643 cellSet candidateCellSet
1652 const cell& cFaces =
cells[celli];
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()
1760 void Foam::snappyRefineDriver::removeInsideCells
1762 const refinementParameters& refineParams,
1763 const label nBufferLayers
1767 if (meshRefiner_.limitShells().shells().size() == 0 && nBufferLayers == 0)
1778 <<
"Removing mesh beyond surface intersections" <<
nl 1779 <<
"------------------------------------------" <<
nl 1782 const fvMesh&
mesh = meshRefiner_.mesh();
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 = " 1843 Foam::label Foam::snappyRefineDriver::shellRefine
1845 const refinementParameters& refineParams,
1854 if (refineParams.minRefineCells() == -1)
1862 const fvMesh&
mesh = meshRefiner_.mesh();
1865 meshRefiner_.userFaceData().setSize(1);
1869 meshRefiner_.userFaceData()[0].second() = ListOps::createWithValue<label>
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();
2024 Foam::label Foam::snappyRefineDriver::directionalShellRefine
2026 const refinementParameters& refineParams,
2035 addProfiling(shell,
"snappyHexMesh::refine::directionalShell");
2036 const fvMesh&
mesh = meshRefiner_.mesh();
2037 const shellSurfaces& shells = meshRefiner_.shells();
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)
2062 List<labelVector> dirCellLevel(cellLevel.size());
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 =
2121 Info<<
"Selected for direction " << vector::componentNames[dir]
2122 <<
" refinement : " << nCellsToRefine
2126 nAllRefine += nCellsToRefine;
2130 if (nCellsToRefine > 0)
2137 const bitSet isRefineCell(
mesh.
nCells(), cellsToRefine);
2139 autoPtr<mapPolyMesh> map
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]);
2239 void Foam::snappyRefineDriver::mergeAndSmoothRatio
2242 const label nSmoothExpansion,
2243 List<Tuple2<scalar, scalar>>& keyAndValue
2248 SortableList<scalar> unmergedDist(allSeedPointDist);
2249 DynamicList<scalar> mergedDist;
2251 scalar prevDist = GREAT;
2254 scalar curDist = unmergedDist[i];
2255 scalar difference =
mag(curDist - prevDist);
2256 if (difference > meshRefiner_.mergeDistance())
2259 mergedDist.append(curDist);
2265 SortableList<scalar> sortedDist(mergedDist);
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];
2338 Foam::label Foam::snappyRefineDriver::directionalSmooth
2340 const refinementParameters& refineParams
2345 <<
"Directional expansion ratio smoothing" <<
nl 2346 <<
"-------------------------------------" <<
nl 2349 fvMesh& baseMesh = meshRefiner_.mesh();
2350 const searchableSurfaces& geometry = meshRefiner_.surfaces().geometry();
2351 const shellSurfaces& shells = meshRefiner_.shells();
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];
2371 List<volumeType> volType;
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)
2442 DynamicList<scalar> seedPointDist;
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);
2466 ListListOps::combine<scalarList>
2468 gatheredDist, accessOp<scalarList>()
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()
2515 List<Tuple2<scalar, scalar>> keyAndValue(allSeedPointDist.size());
2524 shells.nSmoothExpansion()[shellI],
2534 const interpolationTable<scalar> table
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());
2560 maxMagSqrEqOp<vector>(),
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(
gSum(
mag(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());
2722 maxMagSqrEqOp<vector>(),
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()
2754 void Foam::snappyRefineDriver::baffleAndSplitMesh
2756 const refinementParameters& refineParams,
2757 const snapParameters& snapParams,
2758 const bool handleSnapProblems,
2759 const dictionary& motionDict
2769 <<
"Splitting mesh at surface intersections" <<
nl 2770 <<
"---------------------------------------" <<
nl 2773 const fvMesh&
mesh = meshRefiner_.mesh();
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()
2842 void Foam::snappyRefineDriver::zonify
2844 const refinementParameters& refineParams,
2859 namedSurfaces.size()
2860 || refineParams.zonesInMesh().size()
2864 <<
"Introducing zones for interfaces" <<
nl 2865 <<
"--------------------------------" <<
nl 2868 const fvMesh&
mesh = meshRefiner_.mesh();
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;
2910 void Foam::snappyRefineDriver::splitAndMergeBaffles
2912 const refinementParameters& refineParams,
2913 const snapParameters& snapParams,
2914 const bool handleSnapProblems,
2915 const dictionary& motionDict
2924 <<
"Handling cells with snap problems" <<
nl 2925 <<
"---------------------------------" <<
nl 2928 const fvMesh&
mesh = meshRefiner_.mesh();
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();
3005 const label nCouples =
returnReduce(couples.size(), sumOp<label>());
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;
3061 void Foam::snappyRefineDriver::erodeNonManifoldZoneFaces
3063 const refinementParameters& refineParams
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());
3098 if (!refCast<const processorPolyPatch>(
pbm[patchi]).owner())
3100 isZoneFace.unset(
pbm[patchi].
range());
3106 const globalIndex globalFaces(
mesh.
nFaces());
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]);
3158 if (
returnReduce((nChanged-nOldChanged), sumOp<label>()) == 0)
3165 reduce(nChanged, sumOp<label>());
3170 fzs.clearAddressing();
3172 for (
auto& fz : fzs)
3174 DynamicList<label> addressing(fz.size());
3175 DynamicList<bool> flipMap(fz.size());
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);
3195 <<
" free-standing zone faces in = " 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;
3250 <<
setw(30) << masterName
3251 <<
setw(30) << fzName
3261 <<
setw(30) << slaveName
3262 <<
setw(30) << fzName
3266 meshRefiner.
addFaceZone(fzName, masterName, slaveName, fzType);
3274 void Foam::snappyRefineDriver::mergePatchFaces
3277 const refinementParameters& refineParams,
3278 const dictionary& motionDict
3288 <<
"Merge refined boundary faces" <<
nl 3289 <<
"----------------------------" <<
nl 3292 const fvMesh&
mesh = meshRefiner_.mesh();
3296 mergeType == meshRefinement::FaceMergeType::GEOMETRIC
3297 || mergeType == meshRefinement::FaceMergeType::IGNOREPATCH
3300 meshRefiner_.mergePatchFacesUndo
3304 meshRefiner_.meshedPatches(),
3313 meshRefiner_.mergePatchFaces
3318 meshRefiner_.meshedPatches(),
3319 meshRefinement::FaceMergeType::GEOMETRIC
3325 meshRefiner_.checkData();
3332 meshRefiner_.checkData();
3337 void Foam::snappyRefineDriver::deleteSmallRegions
3339 const refinementParameters& refineParams
3342 const fvMesh&
mesh = meshRefiner_.mesh();
3374 if (ownPatch[facei] != -1)
3383 for (
const auto& cz : czm)
3385 UIndirectList<label>(cellToZone, cz) = cz.index();
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]
3436 DynamicList<label> cellsToRemove(
mesh.
nCells()/128);
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;
3454 removeCells cellRemover(
mesh);
3456 cellsToRemove.shrink();
3459 cellRemover.getExposedFaces(cellsToRemove)
3463 UIndirectList<label>(ownPatch, exposedFaces)
3465 (void)meshRefiner_.doRemoveCells
3478 const dictionary& refineDict,
3479 const refinementParameters& refineParams,
3480 const snapParameters& snapParams,
3481 const bool prepareForSnapping,
3483 const dictionary& motionDict
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());
3507 snappyVoxelMeshDriver voxelDriver
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);
3699 HashTable<Pair<word>> faceZoneToPatches(zonesToFaceZone.size());
3704 List<Pair<word>> czs(zonesToFaceZone.sortedToc());
3708 const Pair<word>& czNames = czs[i];
3709 const word& fzName = zonesToFaceZone[czNames];
3711 const word& masterName = fzName;
3712 const word slaveName = czNames.second() +
"_to_" + czNames.first();
3713 Pair<word>
patches(masterName, slaveName);
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
List< scalar > scalarList
List of scalar.
const polyBoundaryMesh & pbm
label addFaceZone(const word &fzName, const word &masterPatch, const word &slavePatch, const surfaceZonesInfo::faceZoneType &fzType)
Add/lookup faceZone and update information. Return index of.
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.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
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.
PrimitivePatch< IndirectList< face >, const pointField & > indirectPrimitivePatch
A PrimitivePatch with an IndirectList for the faces, const reference for the point field...
Simple container to keep together refinement specific information.
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.
dictionary getZoneInfo(const word &fzName, surfaceZonesInfo::faceZoneType &faceType) const
Get patchInfo and faceType for faceZone.
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...
const fvMesh & mesh() const
Reference to mesh.
static labelPairList findDuplicateFacePairs(const polyMesh &)
Helper routine to find all baffles (two boundary faces.
virtual const pointField & points() const
Return raw points.
#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.
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.
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.
A class for handling words, derived from Foam::string.
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.
A HashTable similar to std::unordered_map.
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 T * set(const label i) const
Return const pointer to element (can be nullptr), or nullptr for out-of-range access (ie...
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 addMeshedPatch(const word &name, const dictionary &)
Add patch originating from meshing. Update meshedPatches_.
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)
const labelListList & faceEdges() const
Return face-edge addressing.
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.
Mesh consisting of general polyhedral cells.
Omanip< int > setw(const int i)
List< label > labelList
A List of labels.
T * first()
The first entry in the list.
label nNonProcessor() const
The number of patches before the first processor patch.
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.
void reduce(T &value, const BinaryOp &bop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Reduce inplace (cf. MPI Allreduce) using linear/tree communication schedule.
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)