59 DynamicList<label> adaptPatchIDs;
62 const pointPatchField<vector>& patchFld =
65 if (
isA<valuePointPatchField<vector>>(patchFld))
67 if (
isA<zeroFixedValuePointPatchField<vector>>(patchFld))
74 adaptPatchIDs.append(
patchi);
84 Foam::medialAxisMeshMover::getPatch
90 const polyBoundaryMesh&
patches = mesh.boundaryMesh();
97 const polyPatch& pp =
patches[patchIDs[i]];
108 const polyPatch& pp =
patches[patchIDs[i]];
110 label meshFacei = pp.start();
114 addressing[nFaces++] = meshFacei++;
118 return autoPtr<indirectPrimitivePatch>
122 IndirectList<face>(mesh.faces(), addressing),
129 void Foam::medialAxisMeshMover::smoothPatchNormals
131 const label nSmoothDisp,
132 const PackedBoolList& isPatchMasterPoint,
133 const PackedBoolList& isPatchMasterEdge,
139 const labelList& meshPoints = pp.meshPoints();
142 Info<< typeName <<
" : Smoothing normals ..." <<
endl;
158 for (
label iter = 0; iter < nSmoothDisp; iter++)
173 if ((iter % 10) == 0)
180 Info<<
" Iteration " << iter <<
" residual " << resid <<
endl;
188 normals[pointi] =
average[pointi];
189 normals[pointi] /=
mag(normals[pointi]) + vSmall;
196 void Foam::medialAxisMeshMover::smoothNormals
198 const label nSmoothDisp,
199 const PackedBoolList& isMeshMasterPoint,
200 const PackedBoolList& isMeshMasterEdge,
207 <<
" : Smoothing normals in interior ..." <<
endl;
209 const edgeList& edges = mesh().edges();
212 PackedBoolList isFixedPoint(mesh().
nPoints());
217 label meshPointi = fixedPoints[i];
218 isFixedPoint.set(meshPointi, 1);
244 for (
label iter = 0; iter < nSmoothDisp; iter++)
259 if ((iter % 10) == 0)
266 Info<<
" Iteration " << iter <<
" residual " << resid <<
endl;
273 if (isFixedPoint.get(pointi) == 0)
277 normals[pointi] =
average[pointi];
278 normals[pointi] /=
mag(normals[pointi]) + vSmall;
287 bool Foam::medialAxisMeshMover::isMaxEdge
289 const List<pointData>& pointWallDist,
298 const edge&
e = mesh().edges()[edgei];
301 scalar magV0(
mag(v0));
309 scalar magV1(
mag(v1));
334 if ((pointWallDist[
e[0]].v() & pointWallDist[
e[1]].v()) < minCos)
345 void Foam::medialAxisMeshMover::update(
const dictionary& coeffDict)
348 <<
" : Calculating distance to Medial Axis ..." <<
endl;
353 const labelList& meshPoints = pp.meshPoints();
360 const label nSmoothSurfaceNormals =
361 coeffDict.lookup<
label>(
"nSmoothSurfaceNormals");
364 const scalar minMedialAxisAngleCos =
367 coeffDict.lookupBackwardsCompatible<scalar>
369 {
"minMedialAxisAngle",
"minMedianAxisAngle"},
375 const scalar featureAngle =
376 coeffDict.lookup<scalar>(
"featureAngle",
unitDegrees);
379 const scalar slipFeatureAngle =
380 coeffDict.lookupOrDefault
388 const label nSmoothNormals =
389 coeffDict.lookup<
label>(
"nSmoothNormals");
392 const label nMedialAxisIter = coeffDict.lookupOrDefault<
label>
395 mesh().globalData().nTotalPoints()
417 const PackedBoolList isPatchMasterPoint
425 const PackedBoolList isPatchMasterEdge
442 nSmoothSurfaceNormals,
453 List<pointData> pointWallDist(mesh().
nPoints());
456 int dummyTrackData = 0;
462 List<pointData> wallInfo(meshPoints.size());
464 forAll(meshPoints, patchPointi)
466 label pointi = meshPoints[patchPointi];
467 wallInfo[patchPointi] = pointData
472 pointNormals[patchPointi]
477 List<pointData> edgeWallDist(mesh().nEdges());
478 PointEdgeWave<pointData> wallDistCalc
488 wallDistCalc.iterate(nMedialAxisIter);
492 wallDistCalc.getUnsetPoints(),
498 if (nMedialAxisIter > 0)
501 <<
" : Limited walk to " << nMedialAxisIter
502 <<
" steps. Not visited " << nUnvisit
503 <<
" out of " << mesh().globalData().nTotalPoints()
504 <<
" points" <<
endl;
509 <<
"Walking did not visit all points." <<
nl
510 <<
" Did not visit " << nUnvisit
511 <<
" out of " << mesh().globalData().nTotalPoints()
512 <<
" points. This is not necessarily a problem" <<
nl
513 <<
" and might be due to faceZones splitting of part"
514 <<
" of the domain." <<
nl <<
endl;
523 List<pointData> pointMedialDist(mesh().
nPoints());
524 List<pointData> edgeMedialDist(mesh().nEdges());
527 DynamicList<pointData> maxInfo(meshPoints.size());
528 DynamicList<label> maxPoints(meshPoints.size());
532 const edgeList& edges = mesh().edges();
536 const edge&
e = edges[edgei];
540 !pointWallDist[
e[0]].
valid(dummyTrackData)
541 || !pointWallDist[
e[1]].
valid(dummyTrackData)
549 if (!pointMedialDist[pointi].
valid(dummyTrackData))
551 maxPoints.append(pointi);
562 pointMedialDist[pointi] = maxInfo.last();
567 else if (isMaxEdge(pointWallDist, edgei, minMedialAxisAngleCos))
575 scalar eMag =
mag(eVec);
583 scalar dist0 = (p0-pointWallDist[
e[0]].origin()) & eVec;
584 scalar dist1 = (pointWallDist[
e[1]].origin()-p1) & eVec;
585 scalar
s = 0.5*(dist1+eMag+dist0);
592 else if (
s >= dist0+eMag)
598 medialAxisPt = p0+(
s-dist0)*eVec;
605 if (!pointMedialDist[pointi].
valid(dummyTrackData))
607 maxPoints.append(pointi);
618 pointMedialDist[pointi] = maxInfo.last();
627 const polyBoundaryMesh&
patches = mesh().boundaryMesh();
636 pointDisplacement().boundaryField()[
patchi];
641 && !isA<emptyPolyPatch>(pp)
642 && !adaptPatches.found(
patchi)
645 const labelList& meshPoints = pp.meshPoints();
652 if (pvf.fixesValue())
656 <<
" : Inserting all points on patch " << pp.name()
661 label pointi = meshPoints[i];
662 if (!pointMedialDist[pointi].
valid(dummyTrackData))
664 maxPoints.append(pointi);
675 pointMedialDist[pointi] = maxInfo.last();
687 <<
" : Inserting points on patch " << pp.name()
688 <<
" if angle to nearest layer patch > "
691 scalar slipFeatureAngleCos =
Foam::cos(slipFeatureAngle);
699 label pointi = meshPoints[i];
703 pointWallDist[pointi].
valid(dummyTrackData)
704 && !pointMedialDist[pointi].
valid(dummyTrackData)
710 -pointWallDist[pointi].v()
713 if (cosAngle > slipFeatureAngleCos)
718 maxPoints.append(pointi);
729 pointMedialDist[pointi] = maxInfo.last();
746 PointEdgeWave<pointData> medialDistCalc
757 medialDistCalc.iterate(2*nMedialAxisIter);
761 forAll(pointMedialDist, pointi)
763 if (pointMedialDist[pointi].
valid(dummyTrackData))
767 pointMedialDist[pointi].distSqr()
769 medialVec_[pointi] = pointMedialDist[pointi].origin();
774 medialDist_[pointi] = 0.0;
775 medialVec_[pointi] =
point(1, 0, 0);
783 if (!pointWallDist[i].
valid(dummyTrackData))
785 dispVec_[i] =
vector(1, 0, 0);
789 dispVec_[i] = pointWallDist[i].v();
804 forAll(medialRatio_, pointi)
806 if (!pointWallDist[pointi].
valid(dummyTrackData))
808 medialRatio_[pointi] = 0.0;
812 scalar wDist2 = pointWallDist[pointi].distSqr();
813 scalar mDist = medialDist_[pointi];
815 if (wDist2 <
sqr(small) && mDist < small)
822 medialRatio_[pointi] = 0.0;
826 medialRatio_[pointi] = mDist / (
Foam::sqrt(wDist2) + mDist);
835 <<
" : Writing medial axis fields:" <<
nl
837 <<
"ratio of medial distance to wall distance : "
838 << medialRatio_.
name() <<
nl
839 <<
"distance to nearest medial axis : "
840 << medialDist_.name() <<
nl
841 <<
"nearest medial axis location : "
842 << medialVec_.name() <<
nl
843 <<
"normal at nearest wall : "
844 << dispVec_.name() <<
nl
849 medialRatio_.
write();
856 bool Foam::medialAxisMeshMover::unmarkExtrusion
858 const label patchPointi,
860 List<snappyLayerDriver::extrudeMode>& extrudeStatus
866 patchDisp[patchPointi] =
Zero;
872 patchDisp[patchPointi] =
Zero;
882 void Foam::medialAxisMeshMover::syncPatchDisplacement
886 List<snappyLayerDriver::extrudeMode>& extrudeStatus
890 const labelList& meshPoints = pp.meshPoints();
902 minMagSqrEqOp<vector>(),
909 if (
mag(patchDisp[i]) < minThickness[i])
911 if (unmarkExtrusion(i, patchDisp, extrudeStatus))
926 void Foam::medialAxisMeshMover::minSmoothField
928 const label nSmoothDisp,
929 const PackedBoolList& isPatchMasterPoint,
930 const PackedBoolList& isPatchMasterEdge,
937 const labelList& meshPoints = pp.meshPoints();
952 Info<< typeName <<
" : Smoothing field ..." <<
endl;
954 for (
label iter = 0; iter < nSmoothDisp; iter++)
978 average[pointi] < field[pointi]
979 &&
average[pointi] >= fieldMin[pointi]
982 field[pointi] =
average[pointi];
987 if ((iter % 10) == 0)
994 Info<<
" Iteration " << iter <<
" residual " << resid <<
endl;
1001 void Foam::medialAxisMeshMover::
1002 handleFeatureAngleLayerTerminations
1004 const scalar minCos,
1005 const PackedBoolList& isPatchMasterPoint,
1007 List<snappyLayerDriver::extrudeMode>& extrudeStatus,
1009 label& nPointCounter
1017 boolList extrudedFaces(pp.size(),
true);
1019 forAll(pp.localFaces(), facei)
1021 const face&
f = pp.localFaces()[facei];
1027 extrudedFaces[facei] =
false;
1042 List<List<point>> edgeFaceNormals(pp.nEdges());
1043 List<List<bool>> edgeFaceExtrude(pp.nEdges());
1046 const vectorField& faceNormals = pp.faceNormals();
1050 const labelList& eFaces = edgeFaces[edgei];
1052 edgeFaceNormals[edgei].
setSize(eFaces.size());
1053 edgeFaceExtrude[edgei].setSize(eFaces.size());
1056 label facei = eFaces[i];
1057 edgeFaceNormals[edgei][i] = faceNormals[facei];
1058 edgeFaceExtrude[edgei][i] = extrudedFaces[facei];
1067 globalMeshData::ListPlusEqOp<List<point>>(),
1076 globalMeshData::ListPlusEqOp<List<bool>>(),
1081 forAll(edgeFaceNormals, edgei)
1083 const List<point>& eFaceNormals = edgeFaceNormals[edgei];
1084 const List<bool>& eFaceExtrude = edgeFaceExtrude[edgei];
1086 if (eFaceNormals.size() == 2)
1088 const edge&
e = pp.edges()[edgei];
1098 if (!eFaceExtrude[0] || !eFaceExtrude[1])
1100 const vector& n0 = eFaceNormals[0];
1101 const vector& n1 = eFaceNormals[1];
1103 if ((n0 & n1) < minCos)
1105 if (unmarkExtrusion(v0, patchDisp, extrudeStatus))
1107 if (isPatchMasterPoint[v0])
1112 if (unmarkExtrusion(v1, patchDisp, extrudeStatus))
1114 if (isPatchMasterPoint[v1])
1133 void Foam::medialAxisMeshMover::findIsolatedRegions
1135 const scalar minCosLayerTermination,
1136 const bool detectExtrusionIsland,
1137 const PackedBoolList& isPatchMasterPoint,
1138 const PackedBoolList& isPatchMasterEdge,
1141 List<snappyLayerDriver::extrudeMode>& extrudeStatus,
1147 const labelList& meshPoints = pp.meshPoints();
1149 Info<< typeName <<
" : Removing isolated regions ..." <<
endl;
1152 label nPointCounter = 0;
1155 autoPtr<OBJstream> str;
1162 mesh().time().path()
1163 /
"islandExcludePoints_"
1164 + mesh().time().
name()
1169 <<
" : Writing points surrounded by non-extruded points to "
1170 << str().name() <<
endl;
1177 handleFeatureAngleLayerTerminations
1179 minCosLayerTermination,
1188 syncPatchDisplacement(minThickness, patchDisp, extrudeStatus);
1199 boolList keptPoints(pp.nPoints(),
false);
1201 if (detectExtrusionIsland)
1210 const face&
f = pp.localFaces()[facei];
1216 if (islandPoint[facei] == -1)
1219 islandPoint[facei] =
f[fp];
1221 else if (islandPoint[facei] != -2)
1224 islandPoint[facei] = -2;
1236 forAll(pointFaces, patchPointi)
1245 if (islandPoint[facei] != patchPointi)
1247 keptPoints[patchPointi] =
true;
1260 boolList extrudedFaces(pp.size(),
true);
1261 forAll(pp.localFaces(), facei)
1263 const face&
f = pp.localFaces()[facei];
1268 extrudedFaces[facei] =
false;
1276 forAll(keptPoints, patchPointi)
1283 if (extrudedFaces[facei])
1285 keptPoints[patchPointi] =
true;
1304 forAll(keptPoints, patchPointi)
1306 if (!keptPoints[patchPointi])
1308 if (unmarkExtrusion(patchPointi, patchDisp, extrudeStatus))
1315 str().write(pp.points()[meshPoints[patchPointi]]);
1328 const edgeList& edges = pp.edges();
1334 labelList isolatedPoint(pp.nPoints(),0);
1338 if (isPatchMasterEdge[edgei])
1340 const edge&
e = edges[edgei];
1347 isolatedPoint[v0] += 1;
1351 isolatedPoint[v1] += 1;
1369 const face&
f = pp.localFaces()[facei];
1370 bool failed =
false;
1373 if (isolatedPoint[
f[fp]] > 2)
1379 bool allPointsExtruded =
true;
1386 allPointsExtruded =
false;
1391 if (allPointsExtruded)
1409 str().write(pp.points()[meshPoints[
f[fp]]]);
1417 reduce(nPointCounter, sumOp<label>());
1419 <<
" : Number of isolated points extrusion stopped : "<< nPointCounter
1424 void Foam::medialAxisMeshMover::smoothLambdaMuDisplacement
1426 const label nSmoothDisp,
1427 const PackedBoolList& isMeshMasterPoint,
1428 const PackedBoolList& isMeshMasterEdge,
1432 const edgeList& edges = mesh().edges();
1451 Info<< typeName <<
" : Smoothing displacement ..." <<
endl;
1453 const scalar
lambda = 0.33;
1454 const scalar
mu = -0.34;
1458 for (
label iter = 0; iter < nSmoothDisp; iter++)
1474 if (medialRatio_[i] > small && medialRatio_[i] < 1-small)
1495 if (medialRatio_[i] > small && medialRatio_[i] < 1-small)
1497 displacement[i] = (1-
mu)*displacement[i]+
mu*
average[i];
1503 if ((iter % 10) == 0)
1510 Info<<
" Iteration " << iter <<
" residual " << resid <<
endl;
1526 adaptPatchIndices_(getFixedValueBCs(pointDisplacement)),
1527 adaptPatchPtr_(getPatch(mesh(), adaptPatchIndices_)),
1533 pointDisplacement.time().
name(),
1534 pointDisplacement.db(),
1541 oldPoints_(mesh().
points()),
1558 pointDisplacement.time().
name(),
1559 pointDisplacement.db(),
1572 pointDisplacement.time().
name(),
1573 pointDisplacement.db(),
1586 pointDisplacement.time().
name(),
1587 pointDisplacement.db(),
1600 pointDisplacement.time().
name(),
1601 pointDisplacement.db(),
1622 void Foam::medialAxisMeshMover::calculateDisplacement
1630 Info<< typeName <<
" : Smoothing using Medial Axis ..." <<
endl;
1642 "nSmoothDisplacement",
1647 const scalar maxThicknessToMedialRatio =
1648 coeffDict.
lookup<scalar>(
"maxThicknessToMedialRatio");
1651 const scalar featureAngle =
1655 const scalar minCosLayerTermination =
Foam::cos(featureAngle/2);
1658 const label nSmoothPatchThickness =
1665 mesh().globalData().nTotalPoints()
1671 "detectExtrusionIsland",
1710 thickness =
mag(patchDisp);
1712 forAll(thickness, patchPointi)
1716 thickness[patchPointi] = 0.0;
1720 label numThicknessRatioExclude = 0;
1725 autoPtr<OBJstream> str;
1732 mesh().time().path()
1733 /
"thicknessRatioExcludePoints_"
1734 + mesh().time().
name()
1739 <<
" : Writing points with too large an extrusion distance to "
1740 << str().name() <<
endl;
1743 autoPtr<OBJstream> medialVecStr;
1750 mesh().time().path()
1751 /
"thicknessRatioExcludeMedialVec_"
1752 + mesh().time().
name()
1757 <<
" : Writing medial axis vectors on points with too large"
1758 <<
" an extrusion distance to " << medialVecStr().name() <<
endl;
1761 forAll(meshPoints, patchPointi)
1765 label pointi = meshPoints[patchPointi];
1769 scalar mDist = medialDist_[pointi];
1770 scalar thicknessRatio = thickness[patchPointi]/(mDist+vSmall);
1775 patchDisp[patchPointi]
1776 / (
mag(patchDisp[patchPointi]) + vSmall);
1777 vector mVec = mesh().points()[pointi]-medialVec_[pointi];
1778 mVec /=
mag(mVec)+vSmall;
1779 thicknessRatio *= (
n&mVec);
1781 if (thicknessRatio > maxThicknessToMedialRatio)
1786 Pout<<
"truncating displacement at "
1787 << mesh().points()[pointi]
1788 <<
" from " << thickness[patchPointi]
1792 minThickness[patchPointi]
1793 +thickness[patchPointi]
1795 <<
" medial direction:" << mVec
1796 <<
" extrusion direction:" <<
n
1797 <<
" with thicknessRatio:" << thicknessRatio
1801 thickness[patchPointi] =
1802 0.5*(minThickness[patchPointi]+thickness[patchPointi]);
1804 patchDisp[patchPointi] = thickness[patchPointi]*
n;
1806 if (isPatchMasterPoint[patchPointi])
1808 numThicknessRatioExclude++;
1813 const point& pt = mesh().points()[pointi];
1814 str().write(
linePointRef(pt, pt+patchDisp[patchPointi]));
1816 if (medialVecStr.valid())
1818 const point& pt = mesh().points()[pointi];
1819 medialVecStr().write
1832 reduce(numThicknessRatioExclude, sumOp<label>());
1833 Info<< typeName <<
" : Reducing layer thickness at "
1834 << numThicknessRatioExclude
1835 <<
" nodes where thickness to medial axis distance is large " <<
endl;
1842 minCosLayerTermination,
1843 detectExtrusionIsland,
1855 forAll(thickness, patchPointi)
1859 thickness[patchPointi] = 0.0;
1867 nSmoothPatchThickness,
1877 int dummyTrackData = 0;
1879 List<pointData> pointWallDist(mesh().
nPoints());
1886 List<pointData> edgeWallDist(mesh().nEdges());
1890 List<pointData> wallInfo(meshPoints.
size());
1892 forAll(meshPoints, patchPointi)
1894 label pointi = meshPoints[patchPointi];
1895 wallPoints[patchPointi] = pointi;
1896 wallInfo[patchPointi] = pointData
1900 thickness[patchPointi],
1906 PointEdgeWave<pointData> wallDistCalc
1916 wallDistCalc.iterate(nMedialAxisIter);
1921 pointField& displacement = pointDisplacement_;
1923 forAll(displacement, pointi)
1925 if (!pointWallDist[pointi].
valid(dummyTrackData))
1927 displacement[pointi] =
Zero;
1936 displacement[pointi] =
1937 -medialRatio_[pointi]
1938 *pointWallDist[pointi].s()
1945 if (nSmoothDisplacement > 0)
1947 smoothLambdaMuDisplacement
1949 nSmoothDisplacement,
1958 bool Foam::medialAxisMeshMover::shrinkMesh
1960 const dictionary& meshQualityDict,
1961 const label nAllowableErrors,
1966 const label nSnap = meshQualityDict.lookup<
label>(
"nRelaxIter");
1970 meshMover_.setDisplacementPatchFields();
1972 Info<< typeName <<
" : Moving mesh ..." <<
endl;
1973 scalar oldErrorReduction = -1;
1975 bool meshOk =
false;
1977 for (
label iter = 0; iter < 2*nSnap ; iter++)
1980 <<
" : Iteration " << iter <<
endl;
1984 <<
" : Displacement scaling for error reduction set to 0."
1986 oldErrorReduction = meshMover_.setErrorReduction(0.0);
1991 meshMover_.scaleMesh
1995 meshMover_.paramDict(),
2002 Info<< typeName <<
" : Successfully moved mesh" <<
endl;
2008 if (oldErrorReduction >= 0)
2010 meshMover_.setErrorReduction(oldErrorReduction);
2013 Info<< typeName <<
" : Finished moving mesh ..." <<
endl;
2022 const label nAllowableErrors,
2030 const word minThicknessName =
word(moveDict.
lookup(
"minThicknessName"));
2035 movePoints(mesh().
points());
2045 if (minThicknessName ==
"none")
2051 (minThicknessName ==
"none")
2053 : mesh().lookupObject<
scalarField>(minThicknessName)
2059 pointDisplacement_.primitiveField(),
2068 forAll(extrudeStatus, pointi)
2070 if (
mag(patchDisp[pointi]) <= minThickness[pointi]+small)
2078 calculateDisplacement(moveDict, minThickness, extrudeStatus, patchDisp);
2095 adaptPatchPtr_().clearGeom();
2098 meshMover_.movePoints();
2101 meshMover_.correct();
#define forAll(list, i)
Loop across all elements in list.
Macros for easy insertion into run-time selection tables.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
virtual const fileName & name() const
Return the name of the stream.
void size(const label)
Override size to be inconsistent with allocated storage.
void setSize(const label)
Reset size of List.
virtual Ostream & write(const char)=0
Write character.
label nPoints() const
Return number of points supporting patch faces.
labelList meshEdges(const edgeList &allEdges, const labelListList &cellEdges, const labelList &faceCells) const
Return labels of patch edges in the global edge list using.
const labelList & meshPoints() const
Return labelList of mesh points in patch. They are constructed.
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
label size() const
Return the number of elements in the UPtrList.
static const Form rootMax
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
A list of keyword definitions, which are a keyword followed by any number of values (e....
T lookupOrDefault(const word &, const T &, bool recursive=false, bool patternMatch=true) const
Find and return a T, if not found return the given default.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
Virtual base class for mesh movers with externally provided displacement field giving the boundary co...
virtual void movePoints(const pointField &)
Update local data for geometry changes.
static void calculateEdgeWeights(const polyMesh &mesh, const PackedBoolList &isMasterEdge, const labelList &meshPoints, const edgeList &edges, scalarField &edgeWeights, scalarField &invSumWeight)
Helper: calculate edge weights (1/length)
static T gAverage(const PackedBoolList &isMasterElem, const UList< T > &values)
Helper: calculate average.
static PackedBoolList getMasterEdges(const polyMesh &mesh, const labelList &meshEdges)
Determine master edge for subset of edges. If coupled.
static PackedBoolList getMasterPoints(const polyMesh &mesh, const labelList &meshPoints)
Determine master point for subset of points. If coupled.
static void weightedSum(const polyMesh &mesh, const PackedBoolList &isMasterEdge, const labelList &meshPoints, const edgeList &edges, const scalarField &edgeWeights, const Field< Type > &data, Field< Type > &sum)
Helper: weighted sum (over all subset of mesh points) by.
Mesh representing a set of points created from polyMesh.
Mesh consisting of general polyhedral cells.
@ NOEXTRUDE
Do not extrude. No layers added.
A class for handling words, derived from string.
gmvFile<< "tracers "<< particles.size()<< nl;{ pointField positions(particles.size());label particlei=0;forAllConstIter(Cloud< passiveParticle >, particles, iter) { positions[particlei++]=iter().position(mesh);} for(i=0;i< pTraits< point >::nComponents;i++) { forAll(positions, particlei) { gmvFile<< component(positions[particlei], i)<< ' ';} gmvFile<< nl;}}forAll(lagrangianScalarNames, i){ const word &name=lagrangianScalarNames[i];IOField< scalar > fld(IOobject(name, runTime.name(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.name(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
const fvPatchList & patches
dimensionedScalar lambda(viscosity->lookup("lambda"))
#define WarningInFunction
Report a warning using Foam::Warning.
bool valid(const PtrList< ModelType > &l)
const dimensionedScalar mu
Atomic mass unit.
scalar radToDeg(const scalar rad)
Convert radians to degrees.
Ostream & decrIndent(Ostream &os)
Decrement the indent level.
List< label > labelList
A List of labels.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
addToRunTimeSelectionTable(polyPatch, mergedCyclicPolyPatch, word)
dimensionedSymmTensor sqr(const dimensionedVector &dv)
Ostream & endl(Ostream &os)
Add newline and flush stream.
line< point, const point & > linePointRef
Line using referred points.
word name(const bool)
Return a word representation of a bool.
const dimensionSet dimless
const dimensionSet dimLength
vectorField pointField
pointField is a vectorField.
dimensioned< Type > average(const DimensionedField< Type, GeoMesh > &df)
Ostream & incrIndent(Ostream &os)
Increment the indent level.
List< bool > boolList
Bool container classes.
vector point
Point is a vector.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Vector< scalar > vector
A scalar version of the templated Vector.
bool isA(const Type &t)
Check if a dynamic_cast to typeid is possible.
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
dimensionedScalar sqrt(const dimensionedScalar &ds)
List< labelList > labelListList
A List of labelList.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
dimensioned< scalar > mag(const dimensioned< Type > &)
defineTypeNameAndDebug(combustionModel, 0)
PointField< vector > pointVectorField
Field< vector > vectorField
Specialisation of Field<T> for vector.
pointPatchField< vector > pointPatchVectorField
prefixOSstream Pout(cout, "Pout")
HashSet< label, Hash< label > > labelHashSet
A HashSet with label keys.
labelList identityMap(const label len)
Create identity map (map[i] == i) of given length.
PrimitivePatch< IndirectList< face >, const pointField & > indirectPrimitivePatch
Foam::indirectPrimitivePatch.
dimensioned< scalar > magSqr(const dimensioned< Type > &)
dimensionedScalar cos(const dimensionedScalar &ds)
const unitConversion unitDegrees
Info<< "Finished reading KIVA file"<< endl;cellShapeList cellShapes(nPoints);labelList cellZoning(nPoints, -1);const cellModel &hex=*(cellModeller::lookup("hex"));labelList hexLabels(8);label activeCells=0;labelList pointMap(nPoints);forAll(pointMap, i){ pointMap[i]=i;}for(label i=0;i< nPoints;i++){ if(f[i] > 0.0) { hexLabels[0]=i;hexLabels[1]=i1tab[i];hexLabels[2]=i3tab[i1tab[i]];hexLabels[3]=i3tab[i];hexLabels[4]=i8tab[i];hexLabels[5]=i1tab[i8tab[i]];hexLabels[6]=i3tab[i1tab[i8tab[i]]];hexLabels[7]=i3tab[i8tab[i]];cellShapes[activeCells]=cellShape(hex, hexLabels);edgeList edges=cellShapes[activeCells].edges();forAll(edges, ei) { if(edges[ei].mag(points)< small) { label start=pointMap[edges[ei].start()];while(start !=pointMap[start]) { start=pointMap[start];} label end=pointMap[edges[ei].end()];while(end !=pointMap[end]) { end=pointMap[end];} label minLabel=min(start, end);pointMap[start]=pointMap[end]=minLabel;} } cellZoning[activeCells]=idreg[i];activeCells++;}}cellShapes.setSize(activeCells);cellZoning.setSize(activeCells);forAll(cellShapes, celli){ cellShape &cs=cellShapes[celli];forAll(cs, i) { cs[i]=pointMap[cs[i]];} cs.collapse();}label bcIDs[11]={-1, 0, 2, 4, -1, 5, -1, 6, 7, 8, 9};const label nBCs=12;const word *kivaPatchTypes[nBCs]={ &wallPolyPatch::typeName, &wallPolyPatch::typeName, &wallPolyPatch::typeName, &wallPolyPatch::typeName, &symmetryPolyPatch::typeName, &wedgePolyPatch::typeName, &polyPatch::typeName, &polyPatch::typeName, &polyPatch::typeName, &polyPatch::typeName, &symmetryPolyPatch::typeName, &mergedCyclicPolyPatch::typeName};enum patchTypeNames{ PISTON, VALVE, LINER, CYLINDERHEAD, AXIS, WEDGE, INFLOW, OUTFLOW, PRESIN, PRESOUT, SYMMETRYPLANE, CYCLIC};const char *kivaPatchNames[nBCs]={ "piston", "valve", "liner", "cylinderHead", "axis", "wedge", "inflow", "outflow", "presin", "presout", "symmetryPlane", "cyclic"};List< SLList< face > > pFaces[nBCs]