mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'master' of /home/dm4/OpenFOAM/OpenFOAM-dev
This commit is contained in:
@ -99,7 +99,7 @@
|
|||||||
scalar u0 = hs0 - p0/rho0;
|
scalar u0 = hs0 - p0/rho0;
|
||||||
scalar R0 = p0/(rho0*T0);
|
scalar R0 = p0/(rho0*T0);
|
||||||
Rspecific[0] = R0;
|
Rspecific[0] = R0;
|
||||||
|
|
||||||
scalar integratedHeat = 0.0;
|
scalar integratedHeat = 0.0;
|
||||||
|
|
||||||
Info << constProp << " will be held constant." << nl
|
Info << constProp << " will be held constant." << nl
|
||||||
|
|||||||
@ -8,7 +8,7 @@ using namespace Foam;
|
|||||||
|
|
||||||
void test(const vector& a, const vector& b, const scalar tolerance)
|
void test(const vector& a, const vector& b, const scalar tolerance)
|
||||||
{
|
{
|
||||||
Info<< "Vectors " << a << " and " << b
|
Info<< "Vectors " << a << " and " << b
|
||||||
<< " are (to tolerance of " << tolerance << "): ";
|
<< " are (to tolerance of " << tolerance << "): ";
|
||||||
|
|
||||||
if (vectorTools::areParallel(a, b, tolerance))
|
if (vectorTools::areParallel(a, b, tolerance))
|
||||||
|
|||||||
@ -252,4 +252,4 @@ public:
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -93,7 +93,7 @@ void Foam::CV2D::insertSurfaceNearPointPairs()
|
|||||||
|
|
||||||
nNearPoints++;
|
nNearPoints++;
|
||||||
|
|
||||||
// Correct the edge iterator for the change in the
|
// Correct the edge iterator for the change in the
|
||||||
// number of edges following the point-pair insertion
|
// number of edges following the point-pair insertion
|
||||||
eit = Finite_edges_iterator
|
eit = Finite_edges_iterator
|
||||||
(
|
(
|
||||||
|
|||||||
@ -20,7 +20,8 @@ EXE_LIBS = \
|
|||||||
$(CGAL_LIBS) \
|
$(CGAL_LIBS) \
|
||||||
-lconformalVoronoiMesh \
|
-lconformalVoronoiMesh \
|
||||||
-lmeshTools \
|
-lmeshTools \
|
||||||
-ldecompositionMethods -L$(FOAM_LIBBIN)/dummy -lscotchDecomp \
|
-ldecompositionMethods \
|
||||||
|
-L$(FOAM_LIBBIN)/dummy -lptscotchDecomp \
|
||||||
-ledgeMesh \
|
-ledgeMesh \
|
||||||
-ltriSurface \
|
-ltriSurface \
|
||||||
-ldynamicMesh
|
-ldynamicMesh
|
||||||
|
|||||||
@ -19,7 +19,6 @@ EXE_INC = \
|
|||||||
|
|
||||||
EXE_LIBS = \
|
EXE_LIBS = \
|
||||||
-lmeshTools \
|
-lmeshTools \
|
||||||
-ldecompositionMethods -L$(FOAM_LIBBIN)/dummy -lscotchDecomp \
|
|
||||||
-ledgeMesh \
|
-ledgeMesh \
|
||||||
-ltriSurface \
|
-ltriSurface \
|
||||||
-ldynamicMesh
|
-ldynamicMesh
|
||||||
|
|||||||
@ -63,7 +63,7 @@ Foam::fieldFromFile::fieldFromFile
|
|||||||
|
|
||||||
Foam::triSurfaceScalarField Foam::fieldFromFile::load()
|
Foam::triSurfaceScalarField Foam::fieldFromFile::load()
|
||||||
{
|
{
|
||||||
Info<< "Loading: " << fileName_ << endl;
|
Info<< indent << "Loading: " << fileName_ << endl;
|
||||||
|
|
||||||
triSurfaceScalarField surfaceCellSize
|
triSurfaceScalarField surfaceCellSize
|
||||||
(
|
(
|
||||||
|
|||||||
@ -82,9 +82,9 @@ Foam::nonUniformField::nonUniformField
|
|||||||
Info<< decrIndent;
|
Info<< decrIndent;
|
||||||
|
|
||||||
Info<< indent << "Cell size field statistics:" << nl
|
Info<< indent << "Cell size field statistics:" << nl
|
||||||
<< indent << " Minimum: " << min(surfaceCellSize_).value() << nl
|
<< indent << " Minimum: " << min(surfaceCellSize_).value() << nl
|
||||||
<< indent << " Average: " << average(surfaceCellSize_).value() << nl
|
<< indent << " Average: " << average(surfaceCellSize_).value() << nl
|
||||||
<< indent << " Maximum: " << max(surfaceCellSize_).value() << endl;
|
<< indent << " Maximum: " << max(surfaceCellSize_).value() << endl;
|
||||||
|
|
||||||
Info<< decrIndent;
|
Info<< decrIndent;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -46,7 +46,10 @@ Foam::surfaceCellSizeFunction::surfaceCellSizeFunction
|
|||||||
dictionary(surfaceCellSizeFunctionDict),
|
dictionary(surfaceCellSizeFunctionDict),
|
||||||
surface_(surface),
|
surface_(surface),
|
||||||
coeffsDict_(subDict(type + "Coeffs")),
|
coeffsDict_(subDict(type + "Coeffs")),
|
||||||
refinementFactor_(readScalar(lookup("refinementFactor")))
|
refinementFactor_
|
||||||
|
(
|
||||||
|
lookupOrDefault<scalar>("refinementFactor", 1.0)
|
||||||
|
)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
|
|||||||
@ -44,6 +44,142 @@ const Foam::scalar Foam::conformalVoronoiMesh::tolParallel = 1e-3;
|
|||||||
|
|
||||||
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::scalar Foam::conformalVoronoiMesh::requiredSize
|
||||||
|
(
|
||||||
|
const Foam::point& pt
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
pointIndexHit surfHit;
|
||||||
|
label hitSurface;
|
||||||
|
|
||||||
|
DynamicList<scalar> cellSizeHits;
|
||||||
|
|
||||||
|
geometryToConformTo_.findSurfaceNearest
|
||||||
|
(
|
||||||
|
pt,
|
||||||
|
sqr(GREAT),
|
||||||
|
surfHit,
|
||||||
|
hitSurface
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!surfHit.hit())
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"Foam::tensor Foam::conformalVoronoiMesh::requiredAlignment"
|
||||||
|
)
|
||||||
|
<< "findSurfaceNearest did not find a hit across the surfaces."
|
||||||
|
<< exit(FatalError) << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
cellSizeHits.append(cellSizeControl().cellSize(pt));
|
||||||
|
|
||||||
|
// Primary alignment
|
||||||
|
|
||||||
|
vectorField norm(1);
|
||||||
|
|
||||||
|
allGeometry_[hitSurface].getNormal
|
||||||
|
(
|
||||||
|
List<pointIndexHit>(1, surfHit),
|
||||||
|
norm
|
||||||
|
);
|
||||||
|
|
||||||
|
const vector np = norm[0];
|
||||||
|
|
||||||
|
// Generate equally spaced 'spokes' in a circle normal to the
|
||||||
|
// direction from the vertex to the closest point on the surface
|
||||||
|
// and look for a secondary intersection.
|
||||||
|
|
||||||
|
const vector d = surfHit.hitPoint() - pt;
|
||||||
|
|
||||||
|
const tensor Rp = rotationTensor(vector(0,0,1), np);
|
||||||
|
|
||||||
|
const label s = cvMeshControls().alignmentSearchSpokes();
|
||||||
|
|
||||||
|
const scalar spanMag = geometryToConformTo_.globalBounds().mag();
|
||||||
|
|
||||||
|
scalar totalDist = 0;
|
||||||
|
|
||||||
|
for (label i = 0; i < s; i++)
|
||||||
|
{
|
||||||
|
vector spoke
|
||||||
|
(
|
||||||
|
Foam::cos(i*constant::mathematical::twoPi/s),
|
||||||
|
Foam::sin(i*constant::mathematical::twoPi/s),
|
||||||
|
0
|
||||||
|
);
|
||||||
|
|
||||||
|
spoke *= spanMag;
|
||||||
|
|
||||||
|
spoke = Rp & spoke;
|
||||||
|
|
||||||
|
pointIndexHit spokeHit;
|
||||||
|
|
||||||
|
label spokeSurface = -1;
|
||||||
|
|
||||||
|
// internal spoke
|
||||||
|
|
||||||
|
geometryToConformTo_.findSurfaceNearestIntersection
|
||||||
|
(
|
||||||
|
pt,
|
||||||
|
pt + spoke,
|
||||||
|
spokeHit,
|
||||||
|
spokeSurface
|
||||||
|
);
|
||||||
|
|
||||||
|
if (spokeHit.hit())
|
||||||
|
{
|
||||||
|
const Foam::point& hitPt = spokeHit.hitPoint();
|
||||||
|
|
||||||
|
scalar spokeHitDistance = mag(hitPt - pt);
|
||||||
|
|
||||||
|
cellSizeHits.append
|
||||||
|
(
|
||||||
|
cellSizeControl().cellSize(hitPt)
|
||||||
|
);
|
||||||
|
|
||||||
|
totalDist += spokeHitDistance;
|
||||||
|
}
|
||||||
|
|
||||||
|
//external spoke
|
||||||
|
|
||||||
|
Foam::point mirrorPt = pt + 2*d;
|
||||||
|
|
||||||
|
geometryToConformTo_.findSurfaceNearestIntersection
|
||||||
|
(
|
||||||
|
mirrorPt,
|
||||||
|
mirrorPt + spoke,
|
||||||
|
spokeHit,
|
||||||
|
spokeSurface
|
||||||
|
);
|
||||||
|
|
||||||
|
if (spokeHit.hit())
|
||||||
|
{
|
||||||
|
const Foam::point& hitPt = spokeHit.hitPoint();
|
||||||
|
|
||||||
|
scalar spokeHitDistance = mag(hitPt - mirrorPt);
|
||||||
|
|
||||||
|
cellSizeHits.append
|
||||||
|
(
|
||||||
|
cellSizeControl().cellSize(hitPt)
|
||||||
|
);
|
||||||
|
|
||||||
|
totalDist += spokeHitDistance;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
scalar cellSize = 0;
|
||||||
|
|
||||||
|
forAll(cellSizeHits, hitI)
|
||||||
|
{
|
||||||
|
cellSize += cellSizeHits[hitI];
|
||||||
|
}
|
||||||
|
|
||||||
|
return cellSize/cellSizeHits.size();
|
||||||
|
//return cellSizeControl().cellSize(pt);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::tensor Foam::conformalVoronoiMesh::requiredAlignment
|
Foam::tensor Foam::conformalVoronoiMesh::requiredAlignment
|
||||||
(
|
(
|
||||||
const Foam::point& pt
|
const Foam::point& pt
|
||||||
@ -828,10 +964,7 @@ void Foam::conformalVoronoiMesh::storeSizesAndAlignments
|
|||||||
{
|
{
|
||||||
sizeAndAlignmentLocations_[i] = topoint(*pit);
|
sizeAndAlignmentLocations_[i] = topoint(*pit);
|
||||||
|
|
||||||
storedSizes_[i] = cellSizeControl().cellSize
|
storedSizes_[i] = requiredSize(sizeAndAlignmentLocations_[i]);
|
||||||
(
|
|
||||||
sizeAndAlignmentLocations_[i]
|
|
||||||
);
|
|
||||||
|
|
||||||
storedAlignments_[i] = requiredAlignment(sizeAndAlignmentLocations_[i]);
|
storedAlignments_[i] = requiredAlignment(sizeAndAlignmentLocations_[i]);
|
||||||
|
|
||||||
|
|||||||
@ -268,6 +268,9 @@ private:
|
|||||||
//- Return the local maximum surface protrusion distance
|
//- Return the local maximum surface protrusion distance
|
||||||
inline scalar maxSurfaceProtrusion(const Foam::point& pt) const;
|
inline scalar maxSurfaceProtrusion(const Foam::point& pt) const;
|
||||||
|
|
||||||
|
//- Return the required cell size at the given location
|
||||||
|
scalar requiredSize(const Foam::point& pt) const;
|
||||||
|
|
||||||
//- Return the required alignment directions at the given location
|
//- Return the required alignment directions at the given location
|
||||||
tensor requiredAlignment(const Foam::point& pt) const;
|
tensor requiredAlignment(const Foam::point& pt) const;
|
||||||
|
|
||||||
@ -533,6 +536,11 @@ private:
|
|||||||
const Delaunay::Finite_edges_iterator& eit
|
const Delaunay::Finite_edges_iterator& eit
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
boolList dualFaceBoundaryPoints
|
||||||
|
(
|
||||||
|
const Delaunay::Finite_edges_iterator& eit
|
||||||
|
) const;
|
||||||
|
|
||||||
//- Finds the maximum filterCount of the dual vertices
|
//- Finds the maximum filterCount of the dual vertices
|
||||||
// (Delaunay cells) that form the dual face produced by the
|
// (Delaunay cells) that form the dual face produced by the
|
||||||
// supplied edge
|
// supplied edge
|
||||||
@ -839,6 +847,13 @@ private:
|
|||||||
const Delaunay::Finite_facets_iterator& fit
|
const Delaunay::Finite_facets_iterator& fit
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
//- Merge adjacent edges that are not attached to other faces
|
||||||
|
label mergeNearlyParallelEdges
|
||||||
|
(
|
||||||
|
const pointField& pts,
|
||||||
|
const scalar maxCosAngle
|
||||||
|
);
|
||||||
|
|
||||||
//- Merge vertices that are very close together
|
//- Merge vertices that are very close together
|
||||||
void mergeCloseDualVertices
|
void mergeCloseDualVertices
|
||||||
(
|
(
|
||||||
|
|||||||
@ -212,6 +212,20 @@ void Foam::conformalVoronoiMesh::calcDualMesh
|
|||||||
Info<< nl << "Collapsing unnecessary faces" << endl;
|
Info<< nl << "Collapsing unnecessary faces" << endl;
|
||||||
|
|
||||||
collapseFaces(points, boundaryPts, deferredCollapseFaces);
|
collapseFaces(points, boundaryPts, deferredCollapseFaces);
|
||||||
|
|
||||||
|
const scalar maxCosAngle
|
||||||
|
= cos(degToRad(cvMeshControls().edgeMergeAngle()));
|
||||||
|
|
||||||
|
Info<< nl << "Merging adjacent edges which have an angle "
|
||||||
|
<< "of greater than "
|
||||||
|
<< cvMeshControls().edgeMergeAngle() << ": " << endl;
|
||||||
|
|
||||||
|
label nRemovedEdges =
|
||||||
|
mergeNearlyParallelEdges(points, maxCosAngle);
|
||||||
|
|
||||||
|
reduce(nRemovedEdges, sumOp<label>());
|
||||||
|
|
||||||
|
Info<< " Merged " << nRemovedEdges << " edges" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
labelHashSet wrongFaces = checkPolyMeshQuality(points);
|
labelHashSet wrongFaces = checkPolyMeshQuality(points);
|
||||||
@ -652,6 +666,113 @@ Foam::label Foam::conformalVoronoiMesh::mergeCloseDualVertices
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::label Foam::conformalVoronoiMesh::mergeNearlyParallelEdges
|
||||||
|
(
|
||||||
|
const pointField& pts,
|
||||||
|
const scalar maxCosAngle
|
||||||
|
)
|
||||||
|
{
|
||||||
|
List<HashSet<label> > pointFaceCount(number_of_cells());
|
||||||
|
labelList pointNeighbour(number_of_cells(), -1);
|
||||||
|
|
||||||
|
Map<label> dualPtIndexMap;
|
||||||
|
|
||||||
|
for
|
||||||
|
(
|
||||||
|
Delaunay::Finite_edges_iterator eit = finite_edges_begin();
|
||||||
|
eit != finite_edges_end();
|
||||||
|
++eit
|
||||||
|
)
|
||||||
|
{
|
||||||
|
Cell_handle c = eit->first;
|
||||||
|
Vertex_handle vA = c->vertex(eit->second);
|
||||||
|
Vertex_handle vB = c->vertex(eit->third);
|
||||||
|
|
||||||
|
if (isBoundaryDualFace(eit))
|
||||||
|
{
|
||||||
|
const face f = buildDualFace(eit);
|
||||||
|
|
||||||
|
forAll(f, pI)
|
||||||
|
{
|
||||||
|
const label pIndex = f[pI];
|
||||||
|
|
||||||
|
const label prevPointI = f.prevLabel(pI);
|
||||||
|
const label nextPointI = f.nextLabel(pI);
|
||||||
|
|
||||||
|
pointFaceCount[pIndex].insert(prevPointI);
|
||||||
|
pointFaceCount[pIndex].insert(nextPointI);
|
||||||
|
pointNeighbour[pIndex] = nextPointI;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if
|
||||||
|
(
|
||||||
|
vA->internalOrBoundaryPoint()
|
||||||
|
|| vB->internalOrBoundaryPoint()
|
||||||
|
)
|
||||||
|
{
|
||||||
|
const face f = buildDualFace(eit);
|
||||||
|
const boolList faceBoundaryPoints = dualFaceBoundaryPoints(eit);
|
||||||
|
|
||||||
|
forAll(f, pI)
|
||||||
|
{
|
||||||
|
const label pIndex = f[pI];
|
||||||
|
|
||||||
|
const label prevPointI = f.prevLabel(pI);
|
||||||
|
const label nextPointI = f.nextLabel(pI);
|
||||||
|
|
||||||
|
pointFaceCount[pIndex].insert(prevPointI);
|
||||||
|
pointFaceCount[pIndex].insert(nextPointI);
|
||||||
|
|
||||||
|
if (faceBoundaryPoints[pI] == false)
|
||||||
|
{
|
||||||
|
pointNeighbour[pIndex] = nextPointI;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (faceBoundaryPoints[prevPointI] == true)
|
||||||
|
{
|
||||||
|
pointNeighbour[pIndex] = prevPointI;
|
||||||
|
}
|
||||||
|
else if (faceBoundaryPoints[nextPointI] == true)
|
||||||
|
{
|
||||||
|
pointNeighbour[pIndex] = nextPointI;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pointNeighbour[pIndex] = pIndex;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
forAll(pointFaceCount, pI)
|
||||||
|
{
|
||||||
|
if (pointFaceCount[pI].size() == 2)
|
||||||
|
{
|
||||||
|
List<vector> edges(2, vector(0, 0, 0));
|
||||||
|
|
||||||
|
label count = 0;
|
||||||
|
forAllConstIter(HashSet<label>, pointFaceCount[pI], iter)
|
||||||
|
{
|
||||||
|
edges[count] = pts[pI] - pts[iter.key()];
|
||||||
|
edges[count] /= mag(edges[count]) + VSMALL;
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mag(edges[0] & edges[1]) > maxCosAngle)
|
||||||
|
{
|
||||||
|
dualPtIndexMap.insert(pI, pointNeighbour[pI]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
reindexDualVertices(dualPtIndexMap);
|
||||||
|
|
||||||
|
return dualPtIndexMap.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::conformalVoronoiMesh::smoothSurface
|
void Foam::conformalVoronoiMesh::smoothSurface
|
||||||
(
|
(
|
||||||
pointField& pts,
|
pointField& pts,
|
||||||
@ -696,7 +817,6 @@ void Foam::conformalVoronoiMesh::smoothSurface
|
|||||||
} while (nCollapsedFaces > 0);
|
} while (nCollapsedFaces > 0);
|
||||||
|
|
||||||
// Force all points of boundary faces to be on the surface
|
// Force all points of boundary faces to be on the surface
|
||||||
|
|
||||||
for
|
for
|
||||||
(
|
(
|
||||||
Delaunay::Finite_cells_iterator cit = finite_cells_begin();
|
Delaunay::Finite_cells_iterator cit = finite_cells_begin();
|
||||||
@ -917,6 +1037,7 @@ void Foam::conformalVoronoiMesh::collapseFaces
|
|||||||
|
|
||||||
mergeCloseDualVertices(pts, boundaryPts);
|
mergeCloseDualVertices(pts, boundaryPts);
|
||||||
|
|
||||||
|
|
||||||
if (nCollapsedFaces > 0)
|
if (nCollapsedFaces > 0)
|
||||||
{
|
{
|
||||||
Info<< " Collapsed " << nCollapsedFaces << " faces" << endl;
|
Info<< " Collapsed " << nCollapsedFaces << " faces" << endl;
|
||||||
@ -932,6 +1053,7 @@ void Foam::conformalVoronoiMesh::collapseFaces
|
|||||||
}
|
}
|
||||||
|
|
||||||
} while (nCollapsedFaces > 0);
|
} while (nCollapsedFaces > 0);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1064,6 +1186,25 @@ Foam::conformalVoronoiMesh::collapseFace
|
|||||||
|
|
||||||
bool allowEarlyCollapseToPoint = true;
|
bool allowEarlyCollapseToPoint = true;
|
||||||
|
|
||||||
|
|
||||||
|
// // Quick exit
|
||||||
|
// label smallEdges = 0;
|
||||||
|
// const edgeList& fEdges = f.edges();
|
||||||
|
// forAll(fEdges, eI)
|
||||||
|
// {
|
||||||
|
// const edge& e = fEdges[eI];
|
||||||
|
//
|
||||||
|
// if (e.mag(pts) < 0.2*targetFaceSize)
|
||||||
|
// {
|
||||||
|
// smallEdges++;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// if (smallEdges == 0)
|
||||||
|
// {
|
||||||
|
// return fcmNone;
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
// if (maxFC > cvMeshControls().filterCountSkipThreshold() - 3)
|
// if (maxFC > cvMeshControls().filterCountSkipThreshold() - 3)
|
||||||
// {
|
// {
|
||||||
// limitToQuadsOrTris = true;
|
// limitToQuadsOrTris = true;
|
||||||
@ -1071,6 +1212,7 @@ Foam::conformalVoronoiMesh::collapseFace
|
|||||||
// allowEarlyCollapseToPoint = false;
|
// allowEarlyCollapseToPoint = false;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
collapseSizeLimitCoeff *= pow
|
collapseSizeLimitCoeff *= pow
|
||||||
(
|
(
|
||||||
cvMeshControls().filterErrorReductionCoeff(),
|
cvMeshControls().filterErrorReductionCoeff(),
|
||||||
@ -1158,6 +1300,91 @@ Foam::conformalVoronoiMesh::collapseFace
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
scalar maxDist = 0;
|
||||||
|
scalar minDist = GREAT;
|
||||||
|
//
|
||||||
|
// if (f.size() <= 3)
|
||||||
|
// {
|
||||||
|
// const edgeList& fEdges = f.edges();
|
||||||
|
//
|
||||||
|
// forAll(fEdges, eI)
|
||||||
|
// {
|
||||||
|
// const edge& e = fEdges[eI];
|
||||||
|
// const scalar d = e.mag(pts);
|
||||||
|
//
|
||||||
|
// if (d > maxDist)
|
||||||
|
// {
|
||||||
|
// maxDist = d;
|
||||||
|
// collapseAxis = e.vec(pts);
|
||||||
|
// }
|
||||||
|
// else if (d < minDist && d != 0)
|
||||||
|
// {
|
||||||
|
// minDist = d;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// forAll(f, pI)
|
||||||
|
// {
|
||||||
|
// for (label i = pI + 1; i < f.size(); ++i)
|
||||||
|
// {
|
||||||
|
// if
|
||||||
|
// (
|
||||||
|
// f[i] != f.nextLabel(pI)
|
||||||
|
// && f[i] != f.prevLabel(pI)
|
||||||
|
// )
|
||||||
|
// {
|
||||||
|
// scalar d = mag(pts[f[pI]] - pts[f[i]]);
|
||||||
|
//
|
||||||
|
// if (d > maxDist)
|
||||||
|
// {
|
||||||
|
// maxDist = d;
|
||||||
|
// collapseAxis = pts[f[pI]] - pts[f[i]];
|
||||||
|
// }
|
||||||
|
// else if (d < minDist && d != 0)
|
||||||
|
// {
|
||||||
|
// minDist = d;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// const edgeList& fEdges = f.edges();
|
||||||
|
//
|
||||||
|
// scalar perimeter = 0;
|
||||||
|
//
|
||||||
|
// forAll(fEdges, eI)
|
||||||
|
// {
|
||||||
|
// const edge& e = fEdges[eI];
|
||||||
|
// const scalar d = e.mag(pts);
|
||||||
|
//
|
||||||
|
// perimeter += d;
|
||||||
|
//
|
||||||
|
//// collapseAxis += e.vec(pts);
|
||||||
|
//
|
||||||
|
// if (d > maxDist)
|
||||||
|
// {
|
||||||
|
// collapseAxis = e.vec(pts);
|
||||||
|
// maxDist = d;
|
||||||
|
// }
|
||||||
|
// else if (d < minDist && d != 0)
|
||||||
|
// {
|
||||||
|
// minDist = d;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// collapseAxis /= mag(collapseAxis);
|
||||||
|
//
|
||||||
|
//// Info<< f.size() << " " << minDist << " " << maxDist << " | "
|
||||||
|
//// << collapseAxis << endl;
|
||||||
|
//
|
||||||
|
// aspectRatio = maxDist/minDist;
|
||||||
|
//
|
||||||
|
// aspectRatio = min(aspectRatio, sqr(perimeter)/(16.0*fA));
|
||||||
|
|
||||||
if (magSqr(collapseAxis) < VSMALL)
|
if (magSqr(collapseAxis) < VSMALL)
|
||||||
{
|
{
|
||||||
WarningIn
|
WarningIn
|
||||||
@ -1170,9 +1397,9 @@ Foam::conformalVoronoiMesh::collapseFace
|
|||||||
// Output face and collapse axis for visualisation
|
// Output face and collapse axis for visualisation
|
||||||
|
|
||||||
Pout<< "# Aspect ratio = " << aspectRatio << nl
|
Pout<< "# Aspect ratio = " << aspectRatio << nl
|
||||||
<< "# inertia = " << J << nl
|
// << "# inertia = " << J << nl
|
||||||
<< "# determinant = " << detJ << nl
|
// << "# determinant = " << detJ << nl
|
||||||
<< "# eigenvalues = " << eigenValues(J) << nl
|
// << "# eigenvalues = " << eigenValues(J) << nl
|
||||||
<< "# collapseAxis = " << collapseAxis << nl
|
<< "# collapseAxis = " << collapseAxis << nl
|
||||||
<< "# facePts = " << facePts << nl
|
<< "# facePts = " << facePts << nl
|
||||||
<< endl;
|
<< endl;
|
||||||
@ -1280,8 +1507,6 @@ Foam::conformalVoronoiMesh::collapseFace
|
|||||||
{
|
{
|
||||||
scalar guardFraction = cvMeshControls().edgeCollapseGuardFraction();
|
scalar guardFraction = cvMeshControls().edgeCollapseGuardFraction();
|
||||||
|
|
||||||
cvMeshControls().maxCollapseFaceToPointSideLengthCoeff();
|
|
||||||
|
|
||||||
if
|
if
|
||||||
(
|
(
|
||||||
allowEarlyCollapseToPoint
|
allowEarlyCollapseToPoint
|
||||||
@ -1337,6 +1562,8 @@ Foam::conformalVoronoiMesh::collapseFace
|
|||||||
Foam::point collapseToPt =
|
Foam::point collapseToPt =
|
||||||
collapseAxis*(sum(dNeg)/dNeg.size() - dShift) + fC;
|
collapseAxis*(sum(dNeg)/dNeg.size() - dShift) + fC;
|
||||||
|
|
||||||
|
// DynamicList<label> faceBoundaryPts(f.size());
|
||||||
|
|
||||||
forAll(facePtsNeg, fPtI)
|
forAll(facePtsNeg, fPtI)
|
||||||
{
|
{
|
||||||
if (boundaryPts[facePtsNeg[fPtI]] == true)
|
if (boundaryPts[facePtsNeg[fPtI]] == true)
|
||||||
@ -1351,9 +1578,36 @@ Foam::conformalVoronoiMesh::collapseFace
|
|||||||
collapseToPt = pts[collapseToPtI];
|
collapseToPt = pts[collapseToPtI];
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
// faceBoundaryPts.append(facePtsNeg[fPtI]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if (!faceBoundaryPts.empty())
|
||||||
|
// {
|
||||||
|
// if (faceBoundaryPts.size() == 2)
|
||||||
|
// {
|
||||||
|
// collapseToPtI = faceBoundaryPts[0];
|
||||||
|
//
|
||||||
|
// collapseToPt =
|
||||||
|
// 0.5
|
||||||
|
// *(
|
||||||
|
// pts[faceBoundaryPts[0]]
|
||||||
|
// + pts[faceBoundaryPts[1]]
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
// else if (faceBoundaryPts.size() < f.size())
|
||||||
|
// {
|
||||||
|
// face bFace(faceBoundaryPts);
|
||||||
|
//
|
||||||
|
// collapseToPtI = faceBoundaryPts.first();
|
||||||
|
//
|
||||||
|
// collapseToPt = bFace.centre(pts);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// faceBoundaryPts.clear();
|
||||||
|
|
||||||
// ...otherwise arbitrarily choosing the most distant
|
// ...otherwise arbitrarily choosing the most distant
|
||||||
// point as the index to collapse to.
|
// point as the index to collapse to.
|
||||||
|
|
||||||
@ -1384,9 +1638,34 @@ Foam::conformalVoronoiMesh::collapseFace
|
|||||||
collapseToPt = pts[collapseToPtI];
|
collapseToPt = pts[collapseToPtI];
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
// faceBoundaryPts.append(facePtsNeg[fPtI]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if (!faceBoundaryPts.empty())
|
||||||
|
// {
|
||||||
|
// if (faceBoundaryPts.size() == 2)
|
||||||
|
// {
|
||||||
|
// collapseToPtI = faceBoundaryPts[0];
|
||||||
|
//
|
||||||
|
// collapseToPt =
|
||||||
|
// 0.5
|
||||||
|
// *(
|
||||||
|
// pts[faceBoundaryPts[0]]
|
||||||
|
// + pts[faceBoundaryPts[1]]
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
// else if (faceBoundaryPts.size() < f.size())
|
||||||
|
// {
|
||||||
|
// face bFace(faceBoundaryPts);
|
||||||
|
//
|
||||||
|
// collapseToPtI = faceBoundaryPts.first();
|
||||||
|
//
|
||||||
|
// collapseToPt = bFace.centre(pts);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
// ...otherwise arbitrarily choosing the most distant
|
// ...otherwise arbitrarily choosing the most distant
|
||||||
// point as the index to collapse to.
|
// point as the index to collapse to.
|
||||||
|
|
||||||
@ -1406,6 +1685,8 @@ Foam::conformalVoronoiMesh::collapseFace
|
|||||||
|
|
||||||
Foam::point collapseToPt = fC;
|
Foam::point collapseToPt = fC;
|
||||||
|
|
||||||
|
DynamicList<label> faceBoundaryPts(f.size());
|
||||||
|
|
||||||
forAll(facePts, fPtI)
|
forAll(facePts, fPtI)
|
||||||
{
|
{
|
||||||
if (boundaryPts[facePts[fPtI]] == true)
|
if (boundaryPts[facePts[fPtI]] == true)
|
||||||
@ -1415,11 +1696,32 @@ Foam::conformalVoronoiMesh::collapseFace
|
|||||||
// use the first boundary point encountered if
|
// use the first boundary point encountered if
|
||||||
// there are multiple boundary points.
|
// there are multiple boundary points.
|
||||||
|
|
||||||
collapseToPtI = facePts[fPtI];
|
// collapseToPtI = facePts[fPtI];
|
||||||
|
//
|
||||||
|
// collapseToPt = pts[collapseToPtI];
|
||||||
|
//
|
||||||
|
// break;
|
||||||
|
|
||||||
collapseToPt = pts[collapseToPtI];
|
faceBoundaryPts.append(facePts[fPtI]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
if (!faceBoundaryPts.empty())
|
||||||
|
{
|
||||||
|
if (faceBoundaryPts.size() == 2)
|
||||||
|
{
|
||||||
|
collapseToPtI = faceBoundaryPts[0];
|
||||||
|
|
||||||
|
collapseToPt =
|
||||||
|
0.5*(pts[faceBoundaryPts[0]] + pts[faceBoundaryPts[1]]);
|
||||||
|
}
|
||||||
|
else if (faceBoundaryPts.size() < f.size())
|
||||||
|
{
|
||||||
|
face bFace(faceBoundaryPts);
|
||||||
|
|
||||||
|
collapseToPtI = faceBoundaryPts.first();
|
||||||
|
|
||||||
|
collapseToPt = bFace.centre(pts);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1791,9 +2093,9 @@ void Foam::conformalVoronoiMesh::checkCellSizing()
|
|||||||
}
|
}
|
||||||
|
|
||||||
Info<< " Automatically re-sizing " << cellsToResize.size()
|
Info<< " Automatically re-sizing " << cellsToResize.size()
|
||||||
<< " cells that are attached to the bad faces: DISABLED" << endl;
|
<< " cells that are attached to the bad faces: " << endl;
|
||||||
|
|
||||||
//cellSizeControl_.setCellSizes(cellsToResize);
|
cellSizeControl_.setCellSizes(cellsToResize);
|
||||||
}
|
}
|
||||||
|
|
||||||
timeCheck("End of Cell Sizing");
|
timeCheck("End of Cell Sizing");
|
||||||
@ -1858,7 +2160,10 @@ Foam::labelHashSet Foam::conformalVoronoiMesh::findOffsetPatchFaces
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
offsetBoundaryCells.write();
|
if (cvMeshControls().objOutput())
|
||||||
|
{
|
||||||
|
offsetBoundaryCells.write();
|
||||||
|
}
|
||||||
|
|
||||||
return offsetBoundaryCells;
|
return offsetBoundaryCells;
|
||||||
}
|
}
|
||||||
@ -2092,13 +2397,7 @@ void Foam::conformalVoronoiMesh::indexDualVertices
|
|||||||
|
|
||||||
pts[dualVertI] = cit->dual();
|
pts[dualVertI] = cit->dual();
|
||||||
|
|
||||||
if
|
if (cit->boundaryDualVertex())
|
||||||
(
|
|
||||||
!cit->vertex(0)->internalOrBoundaryPoint()
|
|
||||||
|| !cit->vertex(1)->internalOrBoundaryPoint()
|
|
||||||
|| !cit->vertex(2)->internalOrBoundaryPoint()
|
|
||||||
|| !cit->vertex(3)->internalOrBoundaryPoint()
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
// This is a boundary dual vertex
|
// This is a boundary dual vertex
|
||||||
boundaryPts[dualVertI] = true;
|
boundaryPts[dualVertI] = true;
|
||||||
|
|||||||
@ -440,6 +440,10 @@ void Foam::conformalVoronoiMesh::buildSurfaceConformation
|
|||||||
existingSurfacePtLocations
|
existingSurfacePtLocations
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// vit->setInternal();
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
else if (vit->ppSlave() || vit->referredExternal())
|
else if (vit->ppSlave() || vit->referredExternal())
|
||||||
{
|
{
|
||||||
@ -477,6 +481,10 @@ void Foam::conformalVoronoiMesh::buildSurfaceConformation
|
|||||||
existingSurfacePtLocations
|
existingSurfacePtLocations
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// vit->setInternal();
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -719,12 +727,15 @@ bool Foam::conformalVoronoiMesh::dualCellSurfaceAllIntersections
|
|||||||
|
|
||||||
const Foam::point& p = infoList[hitI].hitPoint();
|
const Foam::point& p = infoList[hitI].hitPoint();
|
||||||
|
|
||||||
const scalar separationDistance
|
const scalar separationDistance =
|
||||||
= mag(p - info.hitPoint());
|
mag(p - info.hitPoint());
|
||||||
|
|
||||||
const scalar minSepDist
|
const scalar minSepDist =
|
||||||
= sqr(cvMeshControls().removalDistCoeff()
|
sqr
|
||||||
*targetCellSize(p));
|
(
|
||||||
|
cvMeshControls().removalDistCoeff()
|
||||||
|
*targetCellSize(p)
|
||||||
|
);
|
||||||
|
|
||||||
// Reject the point if it is too close to another
|
// Reject the point if it is too close to another
|
||||||
// surface point.
|
// surface point.
|
||||||
@ -2694,7 +2705,7 @@ void Foam::conformalVoronoiMesh::addSurfaceAndEdgeHits
|
|||||||
// NEED TO REMOVE FROM THE SURFACE TREE...
|
// NEED TO REMOVE FROM THE SURFACE TREE...
|
||||||
surfacePtLocationTreePtr_().remove
|
surfacePtLocationTreePtr_().remove
|
||||||
(
|
(
|
||||||
existingSurfacePtLocations.size()
|
existingSurfacePtLocations.size() - 1
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -366,6 +366,49 @@ inline bool Foam::conformalVoronoiMesh::isBoundaryDualFace
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline Foam::List<bool> Foam::conformalVoronoiMesh::dualFaceBoundaryPoints
|
||||||
|
(
|
||||||
|
const Delaunay::Finite_edges_iterator& eit
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
Cell_circulator ccStart = incident_cells(*eit);
|
||||||
|
Cell_circulator cc1 = ccStart;
|
||||||
|
Cell_circulator cc2 = cc1;
|
||||||
|
|
||||||
|
// Advance the second circulator so that it always stays on the next
|
||||||
|
// cell around the edge;
|
||||||
|
cc2++;
|
||||||
|
|
||||||
|
DynamicList<bool> tmpFaceBoundaryPoints;
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
label cc1I = cc1->cellIndex();
|
||||||
|
|
||||||
|
label cc2I = cc2->cellIndex();
|
||||||
|
|
||||||
|
if (cc1I != cc2I)
|
||||||
|
{
|
||||||
|
if (cc1->boundaryDualVertex())
|
||||||
|
{
|
||||||
|
tmpFaceBoundaryPoints.append(true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
tmpFaceBoundaryPoints.append(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cc1++;
|
||||||
|
|
||||||
|
cc2++;
|
||||||
|
|
||||||
|
} while (cc1 != ccStart);
|
||||||
|
|
||||||
|
return tmpFaceBoundaryPoints;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
inline Foam::List<Foam::label> Foam::conformalVoronoiMesh::processorsAttached
|
inline Foam::List<Foam::label> Foam::conformalVoronoiMesh::processorsAttached
|
||||||
(
|
(
|
||||||
const Delaunay::Finite_facets_iterator& fit
|
const Delaunay::Finite_facets_iterator& fit
|
||||||
|
|||||||
@ -291,6 +291,11 @@ Foam::cvControls::cvControls
|
|||||||
filteringDict.lookup("mergeClosenessCoeff")
|
filteringDict.lookup("mergeClosenessCoeff")
|
||||||
);
|
);
|
||||||
|
|
||||||
|
edgeMergeAngle_ = readScalar
|
||||||
|
(
|
||||||
|
filteringDict.lookup("edgeMergeAngle")
|
||||||
|
);
|
||||||
|
|
||||||
continueFilteringOnBadInitialPolyMesh_ = Switch
|
continueFilteringOnBadInitialPolyMesh_ = Switch
|
||||||
(
|
(
|
||||||
filteringDict.lookupOrDefault<Switch>
|
filteringDict.lookupOrDefault<Switch>
|
||||||
|
|||||||
@ -234,6 +234,11 @@ class cvControls
|
|||||||
// being merged, fraction of the local target cell size
|
// being merged, fraction of the local target cell size
|
||||||
scalar mergeClosenessCoeff_;
|
scalar mergeClosenessCoeff_;
|
||||||
|
|
||||||
|
//- If the angle between two dual edges that are connected by a single
|
||||||
|
// point is less than this angle, then the edges will be merged into a
|
||||||
|
// single edge.
|
||||||
|
scalar edgeMergeAngle_;
|
||||||
|
|
||||||
//- If the mesh quality criteria cannot be satisfied, continue
|
//- If the mesh quality criteria cannot be satisfied, continue
|
||||||
// with filtering anyway?
|
// with filtering anyway?
|
||||||
Switch continueFilteringOnBadInitialPolyMesh_;
|
Switch continueFilteringOnBadInitialPolyMesh_;
|
||||||
@ -405,6 +410,9 @@ public:
|
|||||||
//- Return the mergeClosenessCoeff
|
//- Return the mergeClosenessCoeff
|
||||||
inline scalar mergeClosenessCoeff() const;
|
inline scalar mergeClosenessCoeff() const;
|
||||||
|
|
||||||
|
//- Return the edgeMergeAngle
|
||||||
|
inline scalar edgeMergeAngle() const;
|
||||||
|
|
||||||
//- Return the continueFilteringOnBadInitialPolyMesh Switch
|
//- Return the continueFilteringOnBadInitialPolyMesh Switch
|
||||||
inline Switch continueFilteringOnBadInitialPolyMesh() const;
|
inline Switch continueFilteringOnBadInitialPolyMesh() const;
|
||||||
|
|
||||||
|
|||||||
@ -166,6 +166,12 @@ inline Foam::scalar Foam::cvControls::mergeClosenessCoeff() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline Foam::scalar Foam::cvControls::edgeMergeAngle() const
|
||||||
|
{
|
||||||
|
return edgeMergeAngle_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
inline Foam::Switch
|
inline Foam::Switch
|
||||||
Foam::cvControls::continueFilteringOnBadInitialPolyMesh() const
|
Foam::cvControls::continueFilteringOnBadInitialPolyMesh() const
|
||||||
{
|
{
|
||||||
|
|||||||
@ -36,7 +36,6 @@ Description
|
|||||||
(nonuniformTransform)cyclic \<zoneA\>_\<zoneB\>
|
(nonuniformTransform)cyclic \<zoneA\>_\<zoneB\>
|
||||||
- extrudes into master direction (i.e. away from the owner cell
|
- extrudes into master direction (i.e. away from the owner cell
|
||||||
if flipMap is false)
|
if flipMap is false)
|
||||||
- not parallel
|
|
||||||
|
|
||||||
\verbatim
|
\verbatim
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -330,4 +330,4 @@ void Foam::patchToPoly2DMesh::createMesh()
|
|||||||
// * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -162,4 +162,4 @@ public:
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
|
|||||||
@ -82,7 +82,7 @@ Foam::label Foam::checkTopology
|
|||||||
if (cFaces[i] < 0 || cFaces[i] >= mesh.nFaces())
|
if (cFaces[i] < 0 || cFaces[i] >= mesh.nFaces())
|
||||||
{
|
{
|
||||||
cells.insert(cellI);
|
cells.insert(cellI);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -142,14 +142,6 @@ int main(int argc, char *argv[])
|
|||||||
"additionalPatches",
|
"additionalPatches",
|
||||||
"((master2 slave2) .. (masterN slaveN))"
|
"((master2 slave2) .. (masterN slaveN))"
|
||||||
);
|
);
|
||||||
argList::addBoolOption("internalFacesOnly");
|
|
||||||
|
|
||||||
argList::addOption
|
|
||||||
(
|
|
||||||
"additionalPatches",
|
|
||||||
"(patch2 .. patchN)",
|
|
||||||
"specify additional patches for creating baffles"
|
|
||||||
);
|
|
||||||
argList::addBoolOption
|
argList::addBoolOption
|
||||||
(
|
(
|
||||||
"internalFacesOnly",
|
"internalFacesOnly",
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -2194,6 +2194,8 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
label regionI = -1;
|
label regionI = -1;
|
||||||
|
|
||||||
|
(void)mesh.tetBasePtIs();
|
||||||
|
|
||||||
label cellI = mesh.findCell(insidePoint);
|
label cellI = mesh.findCell(insidePoint);
|
||||||
|
|
||||||
Info<< nl << "Found point " << insidePoint << " in cell " << cellI
|
Info<< nl << "Found point " << insidePoint << " in cell " << cellI
|
||||||
|
|||||||
@ -47,12 +47,14 @@ formatOptions
|
|||||||
}
|
}
|
||||||
|
|
||||||
// interpolationScheme. choice of
|
// interpolationScheme. choice of
|
||||||
// cell : use cell-centre value only; constant over cells (default)
|
// cell : use cell-centre value only; constant over cells
|
||||||
|
// (default)
|
||||||
// cellPoint : use cell-centre and vertex values
|
// cellPoint : use cell-centre and vertex values
|
||||||
// cellPointFace : use cell-centre, vertex and face values.
|
// cellPointFace : use cell-centre, vertex and face values.
|
||||||
// pointMVC : use point values only (Mean Value Coordinates)
|
// pointMVC : use point values only (Mean Value Coordinates)
|
||||||
// cellPatchConstrained : use cell-centre except on boundary faces where
|
// cellPatchConstrained : like 'cell' but uses cell-centre except on
|
||||||
// it uses the boundary value. For use with e.g. patchCloudSet.
|
// boundary faces where it uses the boundary value.
|
||||||
|
// For use with e.g. patchCloudSet.
|
||||||
// 1] vertex values determined from neighbouring cell-centre values
|
// 1] vertex values determined from neighbouring cell-centre values
|
||||||
// 2] face values determined using the current face interpolation scheme
|
// 2] face values determined using the current face interpolation scheme
|
||||||
// for the field (linear, gamma, etc.)
|
// for the field (linear, gamma, etc.)
|
||||||
|
|||||||
@ -3,30 +3,25 @@ cd ${0%/*} || exit 1 # run from this directory
|
|||||||
|
|
||||||
set -x
|
set -x
|
||||||
|
|
||||||
if [ ! -e "Make/files" ] || [ ! -e "Make/options" ]
|
if [ -n "$CGAL_ARCH_PATH" ]
|
||||||
then
|
then
|
||||||
mkdir -p Make
|
echo
|
||||||
|
echo "Compiling surfaceFeatureExtract with CGAL curvature support"
|
||||||
|
echo
|
||||||
|
|
||||||
if [ -n "$CGAL_ARCH_PATH" ]
|
wmake "ENABLE_CURVATURE=-DENABLE_CURVATURE \
|
||||||
then
|
EXE_FROUNDING_MATH=-frounding-math \
|
||||||
cp -r MakeWithCGAL/* Make
|
USE_F2C=-DCGAL_USE_F2C \
|
||||||
|
CGAL_LIBDIR=-L$CGAL_ARCH_PATH/lib \
|
||||||
echo
|
LAPACK_LIB=-llapack \
|
||||||
echo Compiling surfaceFeatureExtract with CGAL support for curvature
|
BLAS_LIB=-lblas \
|
||||||
echo
|
CGAL_LIB=-lCGAL"
|
||||||
|
|
||||||
wmake
|
|
||||||
else
|
|
||||||
cp -r MakeWithoutCGAL/* Make
|
|
||||||
|
|
||||||
echo
|
|
||||||
echo Compiling surfaceFeatureExtract without CGAL support for curvature
|
|
||||||
echo
|
|
||||||
|
|
||||||
wmake
|
|
||||||
fi
|
|
||||||
else
|
else
|
||||||
echo surfaceFeatureExtract already has a Make folder
|
echo
|
||||||
|
echo "Compiling surfaceFeatureExtract without CGAL curvature support"
|
||||||
|
echo
|
||||||
|
|
||||||
|
wmake
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -53,7 +53,7 @@ namespace Foam
|
|||||||
{
|
{
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class buildCGALPolyhedron Declaration
|
Class buildCGALPolyhedron Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
class buildCGALPolyhedron
|
class buildCGALPolyhedron
|
||||||
@ -80,18 +80,56 @@ public:
|
|||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct with reference to triSurface
|
//- Construct with reference to triSurface
|
||||||
buildCGALPolyhedron(const triSurface& surf);
|
explicit buildCGALPolyhedron(const triSurface& surf)
|
||||||
|
:
|
||||||
|
CGAL::Modifier_base<HalfedgeDS>(),
|
||||||
|
surf_(surf)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
~buildCGALPolyhedron();
|
~buildCGALPolyhedron(){}
|
||||||
|
|
||||||
|
|
||||||
// Member Operators
|
// Member Operators
|
||||||
|
|
||||||
//- operator() of this `modifier' called by delegate function of
|
//- operator() of this `modifier' called by delegate function of
|
||||||
// Polyhedron
|
// Polyhedron
|
||||||
void operator()(HalfedgeDS& hds);
|
void operator()(HalfedgeDS& hds)
|
||||||
|
{
|
||||||
|
typedef HalfedgeDS::Traits Traits;
|
||||||
|
typedef Traits::Point_3 Point;
|
||||||
|
|
||||||
|
// Postcondition: `hds' is a valid polyhedral surface.
|
||||||
|
CGAL::Polyhedron_incremental_builder_3<HalfedgeDS> B(hds, false);
|
||||||
|
|
||||||
|
B.begin_surface
|
||||||
|
(
|
||||||
|
surf_.points().size(), // n points
|
||||||
|
surf_.size(), // n facets
|
||||||
|
2*surf_.edges().size() // n halfedges
|
||||||
|
);
|
||||||
|
|
||||||
|
forAll(surf_.points(), pI)
|
||||||
|
{
|
||||||
|
const Foam::point& p = surf_.points()[pI];
|
||||||
|
|
||||||
|
B.add_vertex(Point(p.x(), p.y(), p.z()));
|
||||||
|
}
|
||||||
|
|
||||||
|
forAll(surf_, fI)
|
||||||
|
{
|
||||||
|
B.begin_facet();
|
||||||
|
|
||||||
|
B.add_vertex_to_facet(surf_[fI][0]);
|
||||||
|
B.add_vertex_to_facet(surf_[fI][1]);
|
||||||
|
B.add_vertex_to_facet(surf_[fI][2]);
|
||||||
|
|
||||||
|
B.end_facet();
|
||||||
|
}
|
||||||
|
|
||||||
|
B.end_surface();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,11 @@
|
|||||||
|
include $(GENERAL_RULES)/CGAL
|
||||||
|
|
||||||
EXE_INC = \
|
EXE_INC = \
|
||||||
|
${ENABLE_CURVATURE}\
|
||||||
|
${EXE_FROUNDING_MATH} \
|
||||||
|
${USE_F2C} \
|
||||||
|
${CGAL_INC} \
|
||||||
|
-ICGALPolyhedron \
|
||||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||||
-I$(LIB_SRC)/edgeMesh/lnInclude \
|
-I$(LIB_SRC)/edgeMesh/lnInclude \
|
||||||
@ -7,6 +14,11 @@ EXE_INC = \
|
|||||||
-I$(LIB_SRC)/sampling/lnInclude
|
-I$(LIB_SRC)/sampling/lnInclude
|
||||||
|
|
||||||
EXE_LIBS = \
|
EXE_LIBS = \
|
||||||
|
$(CGAL_LIBS) \
|
||||||
|
${CGAL_LIBDIR} \
|
||||||
|
${LAPACK_LIB} \
|
||||||
|
${BLAS_LIB} \
|
||||||
|
${CGAL_LIB} \
|
||||||
-lmeshTools \
|
-lmeshTools \
|
||||||
-ledgeMesh \
|
-ledgeMesh \
|
||||||
-ltriSurface \
|
-ltriSurface \
|
||||||
|
|||||||
@ -1,4 +0,0 @@
|
|||||||
surfaceFeatureExtract.C
|
|
||||||
CGALPolyhedron/buildCGALPolyhedron.C
|
|
||||||
|
|
||||||
EXE = $(FOAM_APPBIN)/surfaceFeatureExtract
|
|
||||||
@ -1,29 +0,0 @@
|
|||||||
EXE_FROUNDING_MATH = -frounding-math
|
|
||||||
EXE_NDEBUG = -DNDEBUG
|
|
||||||
USE_F2C = -DCGAL_USE_F2C
|
|
||||||
include $(GENERAL_RULES)/CGAL
|
|
||||||
|
|
||||||
EXE_INC = \
|
|
||||||
-DENABLE_CURVATURE \
|
|
||||||
${EXE_FROUNDING_MATH} \
|
|
||||||
${EXE_NDEBUG} \
|
|
||||||
${USE_F2C} \
|
|
||||||
${CGAL_INC} \
|
|
||||||
-ICGALPolyhedron \
|
|
||||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
|
||||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
|
||||||
-I$(LIB_SRC)/edgeMesh/lnInclude \
|
|
||||||
-I$(LIB_SRC)/triSurface/lnInclude \
|
|
||||||
-I$(LIB_SRC)/surfMesh/lnInclude \
|
|
||||||
-I$(LIB_SRC)/sampling/lnInclude
|
|
||||||
|
|
||||||
EXE_LIBS = \
|
|
||||||
$(CGAL_LIBS) \
|
|
||||||
-L$(CGAL_ARCH_PATH)/lib \
|
|
||||||
-llapack \
|
|
||||||
-lblas \
|
|
||||||
-lCGAL \
|
|
||||||
-lmeshTools \
|
|
||||||
-ledgeMesh \
|
|
||||||
-ltriSurface \
|
|
||||||
-lsampling
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
surfaceFeatureExtract.C
|
|
||||||
|
|
||||||
EXE = $(FOAM_APPBIN)/surfaceFeatureExtract
|
|
||||||
@ -1,13 +0,0 @@
|
|||||||
EXE_INC = \
|
|
||||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
|
||||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
|
||||||
-I$(LIB_SRC)/edgeMesh/lnInclude \
|
|
||||||
-I$(LIB_SRC)/triSurface/lnInclude \
|
|
||||||
-I$(LIB_SRC)/surfMesh/lnInclude \
|
|
||||||
-I$(LIB_SRC)/sampling/lnInclude
|
|
||||||
|
|
||||||
EXE_LIBS = \
|
|
||||||
-lmeshTools \
|
|
||||||
-ledgeMesh \
|
|
||||||
-ltriSurface \
|
|
||||||
-lsampling
|
|
||||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,86 @@
|
|||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
|
| \\ / O peration | Version: dev |
|
||||||
|
| \\ / A nd | Web: www.OpenFOAM.org |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2.0;
|
||||||
|
format ascii;
|
||||||
|
class dictionary;
|
||||||
|
object surfaceFeatureExtractDict;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
surface1.stl
|
||||||
|
{
|
||||||
|
// extractFromFile || extractFromSurface
|
||||||
|
extractionMethod extractFromFile;
|
||||||
|
|
||||||
|
extractFromFile
|
||||||
|
{
|
||||||
|
// Load from an existing feature edge file
|
||||||
|
featureEdgeFile "constant/triSurface/featureEdges.nas";
|
||||||
|
}
|
||||||
|
|
||||||
|
trimFeatures
|
||||||
|
{
|
||||||
|
// Remove features with fewer than the specified number of edges
|
||||||
|
minElem 0;
|
||||||
|
|
||||||
|
// Remove features shorter than the specified cumulative length
|
||||||
|
minLen 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
subsetFeatures
|
||||||
|
{
|
||||||
|
// Use a plane to select feature edges
|
||||||
|
// (normal)(basePoint)
|
||||||
|
plane (1 0 0)(0 0 0);
|
||||||
|
|
||||||
|
// Select feature edges using a box
|
||||||
|
// (minPt)(maxPt)
|
||||||
|
insideBox (0 0 0)(1 1 1);
|
||||||
|
outsideBox (0 0 0)(1 1 1);
|
||||||
|
|
||||||
|
// Remove any non-manifold (open or > 2 connected faces) edges
|
||||||
|
manifoldEdges no;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Output the curvature of the surface
|
||||||
|
curvature no;
|
||||||
|
|
||||||
|
// Output the proximity of feature points and edges to each other
|
||||||
|
featureProximity no;
|
||||||
|
// The maximum search distance to use when looking for other feature
|
||||||
|
// points and edges
|
||||||
|
maxFeatureProximity 1;
|
||||||
|
|
||||||
|
// Out put the closeness of surface elements to other surface elements.
|
||||||
|
closeness no;
|
||||||
|
|
||||||
|
// Write options
|
||||||
|
writeVTK no;
|
||||||
|
writeObj yes;
|
||||||
|
writeFeatureEdgeMesh no;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
surface2.nas
|
||||||
|
{
|
||||||
|
extractionMethod extractFromSurface;
|
||||||
|
|
||||||
|
extractFromSurface
|
||||||
|
{
|
||||||
|
// Mark edges whose adjacent surface normals are at an angle less
|
||||||
|
// than includedAngle as features
|
||||||
|
// - 0 : selects no edges
|
||||||
|
// - 180: selects all edges
|
||||||
|
includedAngle 120;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -2832,7 +2832,7 @@ Foam::pointIndexHit Foam::indexedOctree<Type>::findNearest
|
|||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
label nearestShapeI = -1;
|
label nearestShapeI = -1;
|
||||||
point nearestPoint;
|
point nearestPoint = vector::zero;
|
||||||
|
|
||||||
if (nodes_.size())
|
if (nodes_.size())
|
||||||
{
|
{
|
||||||
@ -2847,10 +2847,6 @@ Foam::pointIndexHit Foam::indexedOctree<Type>::findNearest
|
|||||||
nearestPoint
|
nearestPoint
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
nearestPoint = vector::zero;
|
|
||||||
}
|
|
||||||
|
|
||||||
return pointIndexHit(nearestShapeI != -1, nearestPoint, nearestShapeI);
|
return pointIndexHit(nearestShapeI != -1, nearestPoint, nearestShapeI);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -36,7 +36,22 @@ Foam::UniformDimensionedField<Type>::UniformDimensionedField
|
|||||||
:
|
:
|
||||||
regIOobject(io),
|
regIOobject(io),
|
||||||
dimensioned<Type>(dt)
|
dimensioned<Type>(dt)
|
||||||
{}
|
{
|
||||||
|
// Read value
|
||||||
|
if
|
||||||
|
(
|
||||||
|
(
|
||||||
|
io.readOpt() == IOobject::MUST_READ
|
||||||
|
|| io.readOpt() == IOobject::MUST_READ_IF_MODIFIED
|
||||||
|
)
|
||||||
|
|| (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
|
||||||
|
)
|
||||||
|
{
|
||||||
|
dictionary dict(readStream(typeName));
|
||||||
|
this->dimensions().reset(dict.lookup("dimensions"));
|
||||||
|
dict.lookup("value") >> this->value();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -64,7 +64,7 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from components
|
//- Construct from components. Either reads or uses supplied value.
|
||||||
UniformDimensionedField(const IOobject&, const dimensioned<Type>&);
|
UniformDimensionedField(const IOobject&, const dimensioned<Type>&);
|
||||||
|
|
||||||
//- Construct as copy
|
//- Construct as copy
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -1745,6 +1745,7 @@ void Foam::hexRef8::setInstance(const fileName& inst)
|
|||||||
|
|
||||||
cellLevel_.instance() = inst;
|
cellLevel_.instance() = inst;
|
||||||
pointLevel_.instance() = inst;
|
pointLevel_.instance() = inst;
|
||||||
|
level0Edge_.instance() = inst;
|
||||||
history_.instance() = inst;
|
history_.instance() = inst;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1752,7 +1753,7 @@ void Foam::hexRef8::setInstance(const fileName& inst)
|
|||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
// Construct from mesh, read refinement data
|
// Construct from mesh, read refinement data
|
||||||
Foam::hexRef8::hexRef8(const polyMesh& mesh)
|
Foam::hexRef8::hexRef8(const polyMesh& mesh, const bool readHistory)
|
||||||
:
|
:
|
||||||
mesh_(mesh),
|
mesh_(mesh),
|
||||||
cellLevel_
|
cellLevel_
|
||||||
@ -1781,7 +1782,19 @@ Foam::hexRef8::hexRef8(const polyMesh& mesh)
|
|||||||
),
|
),
|
||||||
labelList(mesh_.nPoints(), 0)
|
labelList(mesh_.nPoints(), 0)
|
||||||
),
|
),
|
||||||
level0Edge_(getLevel0EdgeLength()),
|
level0Edge_
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"level0Edge",
|
||||||
|
mesh_.facesInstance(),
|
||||||
|
polyMesh::meshSubDir,
|
||||||
|
mesh_,
|
||||||
|
IOobject::READ_IF_PRESENT,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
dimensionedScalar("level0Edge", dimLength, getLevel0EdgeLength())
|
||||||
|
),
|
||||||
history_
|
history_
|
||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
@ -1790,15 +1803,24 @@ Foam::hexRef8::hexRef8(const polyMesh& mesh)
|
|||||||
mesh_.facesInstance(),
|
mesh_.facesInstance(),
|
||||||
polyMesh::meshSubDir,
|
polyMesh::meshSubDir,
|
||||||
mesh_,
|
mesh_,
|
||||||
IOobject::READ_IF_PRESENT,
|
IOobject::NO_READ,
|
||||||
IOobject::AUTO_WRITE
|
IOobject::AUTO_WRITE
|
||||||
),
|
),
|
||||||
mesh_.nCells() // All cells visible if could not be read
|
(readHistory ? mesh_.nCells() : 0) // All cells visible if not be read
|
||||||
),
|
),
|
||||||
faceRemover_(mesh_, GREAT), // merge boundary faces wherever possible
|
faceRemover_(mesh_, GREAT), // merge boundary faces wherever possible
|
||||||
savedPointLevel_(0),
|
savedPointLevel_(0),
|
||||||
savedCellLevel_(0)
|
savedCellLevel_(0)
|
||||||
{
|
{
|
||||||
|
if (readHistory)
|
||||||
|
{
|
||||||
|
history_.readOpt() = IOobject::READ_IF_PRESENT;
|
||||||
|
if (history_.headerOk())
|
||||||
|
{
|
||||||
|
history_.read();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (history_.active() && history_.visibleCells().size() != mesh_.nCells())
|
if (history_.active() && history_.visibleCells().size() != mesh_.nCells())
|
||||||
{
|
{
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
@ -1849,7 +1871,8 @@ Foam::hexRef8::hexRef8
|
|||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
const labelList& cellLevel,
|
const labelList& cellLevel,
|
||||||
const labelList& pointLevel,
|
const labelList& pointLevel,
|
||||||
const refinementHistory& history
|
const refinementHistory& history,
|
||||||
|
const scalar level0Edge
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
mesh_(mesh),
|
mesh_(mesh),
|
||||||
@ -1879,7 +1902,24 @@ Foam::hexRef8::hexRef8
|
|||||||
),
|
),
|
||||||
pointLevel
|
pointLevel
|
||||||
),
|
),
|
||||||
level0Edge_(getLevel0EdgeLength()),
|
level0Edge_
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"level0Edge",
|
||||||
|
mesh_.facesInstance(),
|
||||||
|
polyMesh::meshSubDir,
|
||||||
|
mesh_,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
dimensionedScalar
|
||||||
|
(
|
||||||
|
"level0Edge",
|
||||||
|
dimLength,
|
||||||
|
(level0Edge >= 0 ? level0Edge : getLevel0EdgeLength())
|
||||||
|
)
|
||||||
|
),
|
||||||
history_
|
history_
|
||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
@ -1945,7 +1985,8 @@ Foam::hexRef8::hexRef8
|
|||||||
(
|
(
|
||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
const labelList& cellLevel,
|
const labelList& cellLevel,
|
||||||
const labelList& pointLevel
|
const labelList& pointLevel,
|
||||||
|
const scalar level0Edge
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
mesh_(mesh),
|
mesh_(mesh),
|
||||||
@ -1975,7 +2016,24 @@ Foam::hexRef8::hexRef8
|
|||||||
),
|
),
|
||||||
pointLevel
|
pointLevel
|
||||||
),
|
),
|
||||||
level0Edge_(getLevel0EdgeLength()),
|
level0Edge_
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"level0Edge",
|
||||||
|
mesh_.facesInstance(),
|
||||||
|
polyMesh::meshSubDir,
|
||||||
|
mesh_,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
dimensionedScalar
|
||||||
|
(
|
||||||
|
"level0Edge",
|
||||||
|
dimLength,
|
||||||
|
(level0Edge >= 0 ? level0Edge : getLevel0EdgeLength())
|
||||||
|
)
|
||||||
|
),
|
||||||
history_
|
history_
|
||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
@ -2621,7 +2679,7 @@ Foam::labelList Foam::hexRef8::consistentSlowRefinement2
|
|||||||
<< "Value should be >= 1" << exit(FatalError);
|
<< "Value should be >= 1" << exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
const scalar level0Size = 2*maxFaceDiff*level0Edge_;
|
const scalar level0Size = 2*maxFaceDiff*level0EdgeLength();
|
||||||
|
|
||||||
|
|
||||||
// Bit tricky. Say we want a distance of three cells between two
|
// Bit tricky. Say we want a distance of three cells between two
|
||||||
@ -5514,7 +5572,10 @@ void Foam::hexRef8::setUnrefinement
|
|||||||
// Write refinement to polyMesh directory.
|
// Write refinement to polyMesh directory.
|
||||||
bool Foam::hexRef8::write() const
|
bool Foam::hexRef8::write() const
|
||||||
{
|
{
|
||||||
bool writeOk = cellLevel_.write() && pointLevel_.write();
|
bool writeOk =
|
||||||
|
cellLevel_.write()
|
||||||
|
&& pointLevel_.write()
|
||||||
|
&& level0Edge_.write();
|
||||||
|
|
||||||
if (history_.active())
|
if (history_.active())
|
||||||
{
|
{
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -43,6 +43,7 @@ SourceFiles
|
|||||||
#include "removeFaces.H"
|
#include "removeFaces.H"
|
||||||
#include "refinementHistory.H"
|
#include "refinementHistory.H"
|
||||||
#include "PackedBoolList.H"
|
#include "PackedBoolList.H"
|
||||||
|
#include "uniformDimensionedFields.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -74,7 +75,7 @@ class hexRef8
|
|||||||
labelIOList pointLevel_;
|
labelIOList pointLevel_;
|
||||||
|
|
||||||
//- Typical edge length between unrefined points
|
//- Typical edge length between unrefined points
|
||||||
const scalar level0Edge_;
|
uniformDimensionedScalarField level0Edge_;
|
||||||
|
|
||||||
//- Refinement history
|
//- Refinement history
|
||||||
refinementHistory history_;
|
refinementHistory history_;
|
||||||
@ -319,24 +320,29 @@ public:
|
|||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from mesh, read_if_present refinement data
|
//- Construct from mesh, read_if_present refinement data
|
||||||
// (from write below)
|
// (from write below). If readHistory is true does read_if_present
|
||||||
hexRef8(const polyMesh& mesh);
|
// of refinement history. If false clears all history
|
||||||
|
hexRef8(const polyMesh& mesh, const bool readHistory = true);
|
||||||
|
|
||||||
//- Construct from mesh and un/refinement data.
|
//- Construct from mesh and un/refinement data and optional size of
|
||||||
|
// starting cells
|
||||||
hexRef8
|
hexRef8
|
||||||
(
|
(
|
||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
const labelList& cellLevel,
|
const labelList& cellLevel,
|
||||||
const labelList& pointLevel,
|
const labelList& pointLevel,
|
||||||
const refinementHistory& history
|
const refinementHistory& history,
|
||||||
|
const scalar level0Edge = -GREAT
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct from mesh and refinement data.
|
//- Construct from mesh and refinement data and optional size of
|
||||||
|
// starting cells
|
||||||
hexRef8
|
hexRef8
|
||||||
(
|
(
|
||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
const labelList& cellLevel,
|
const labelList& cellLevel,
|
||||||
const labelList& pointLevel
|
const labelList& pointLevel,
|
||||||
|
const scalar level0Edge = -GREAT
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -367,7 +373,7 @@ public:
|
|||||||
//- Typical edge length between unrefined points
|
//- Typical edge length between unrefined points
|
||||||
scalar level0EdgeLength() const
|
scalar level0EdgeLength() const
|
||||||
{
|
{
|
||||||
return level0Edge_;
|
return level0Edge_.value();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Refinement
|
// Refinement
|
||||||
|
|||||||
@ -113,6 +113,17 @@ bool Foam::fileFormats::NASedgeFormat::read
|
|||||||
// discard groupID
|
// discard groupID
|
||||||
dynEdges.append(e);
|
dynEdges.append(e);
|
||||||
}
|
}
|
||||||
|
else if (cmd == "PLOTEL")
|
||||||
|
{
|
||||||
|
edge e;
|
||||||
|
|
||||||
|
// label groupId = readLabel(IStringStream(line.substr(16,8))());
|
||||||
|
e[0] = readLabel(IStringStream(line.substr(16,8))());
|
||||||
|
e[1] = readLabel(IStringStream(line.substr(24,8))());
|
||||||
|
|
||||||
|
// discard groupID
|
||||||
|
dynEdges.append(e);
|
||||||
|
}
|
||||||
else if (cmd == "GRID")
|
else if (cmd == "GRID")
|
||||||
{
|
{
|
||||||
label index = readLabel(IStringStream(line.substr(8,8))());
|
label index = readLabel(IStringStream(line.substr(8,8))());
|
||||||
|
|||||||
@ -28,6 +28,7 @@ License
|
|||||||
#include "addToRunTimeSelectionTable.H"
|
#include "addToRunTimeSelectionTable.H"
|
||||||
#include "addToMemberFunctionSelectionTable.H"
|
#include "addToMemberFunctionSelectionTable.H"
|
||||||
#include "ListOps.H"
|
#include "ListOps.H"
|
||||||
|
#include "EdgeMap.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -327,10 +328,7 @@ void Foam::edgeMesh::mergePoints(const scalar mergeDist)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Compact using a hashtable and commutative hash of edge.
|
// Compact using a hashtable and commutative hash of edge.
|
||||||
HashTable<label, edge, Hash<edge> > edgeToLabel
|
EdgeMap<label> edgeToLabel(2*edges_.size());
|
||||||
(
|
|
||||||
2*edges_.size()
|
|
||||||
);
|
|
||||||
|
|
||||||
label newEdgeI = 0;
|
label newEdgeI = 0;
|
||||||
|
|
||||||
@ -349,13 +347,7 @@ void Foam::edgeMesh::mergePoints(const scalar mergeDist)
|
|||||||
|
|
||||||
edges_.setSize(newEdgeI);
|
edges_.setSize(newEdgeI);
|
||||||
|
|
||||||
for
|
forAllConstIter(EdgeMap<label>, edgeToLabel, iter)
|
||||||
(
|
|
||||||
HashTable<label, edge, Hash<edge> >::const_iterator iter =
|
|
||||||
edgeToLabel.begin();
|
|
||||||
iter != edgeToLabel.end();
|
|
||||||
++iter
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
edges_[iter()] = iter.key();
|
edges_[iter()] = iter.key();
|
||||||
}
|
}
|
||||||
@ -363,4 +355,35 @@ void Foam::edgeMesh::mergePoints(const scalar mergeDist)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::edgeMesh::mergeEdges()
|
||||||
|
{
|
||||||
|
EdgeMap<label> existingEdges(2*edges_.size());
|
||||||
|
|
||||||
|
label curEdgeI = 0;
|
||||||
|
forAll(edges_, edgeI)
|
||||||
|
{
|
||||||
|
const edge& e = edges_[edgeI];
|
||||||
|
|
||||||
|
if (existingEdges.insert(e, curEdgeI))
|
||||||
|
{
|
||||||
|
curEdgeI++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Info<< "Merging duplicate edges: "
|
||||||
|
<< edges_.size() - existingEdges.size()
|
||||||
|
<< " edges will be deleted." << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
edges_.setSize(existingEdges.size());
|
||||||
|
|
||||||
|
forAllConstIter(EdgeMap<label>, existingEdges, iter)
|
||||||
|
{
|
||||||
|
edges_[iter()] = iter.key();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -246,6 +246,9 @@ public:
|
|||||||
//- Merge common points (points within mergeDist)
|
//- Merge common points (points within mergeDist)
|
||||||
void mergePoints(const scalar mergeDist);
|
void mergePoints(const scalar mergeDist);
|
||||||
|
|
||||||
|
//- Merge similar edges
|
||||||
|
void mergeEdges();
|
||||||
|
|
||||||
|
|
||||||
// Write
|
// Write
|
||||||
|
|
||||||
|
|||||||
@ -39,7 +39,7 @@ Description
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
If volumeMode =
|
If volumeMode =
|
||||||
- absolute: values are given as <quantity>
|
- absolute: values are given as <quantity>
|
||||||
- specific: values are given as <quantity>/m3
|
- specific: values are given as <quantity>/m3
|
||||||
|
|
||||||
|
|||||||
@ -38,7 +38,7 @@ Description
|
|||||||
gradPini gradPini [0 2 -2 0 0] 0; // initial pressure gradient
|
gradPini gradPini [0 2 -2 0 0] 0; // initial pressure gradient
|
||||||
flowDir (1 0 0); // flow direction
|
flowDir (1 0 0); // flow direction
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
pressureGradientExplicitSource.C
|
pressureGradientExplicitSource.C
|
||||||
|
|||||||
@ -202,7 +202,7 @@ protected:
|
|||||||
//- Maximum radius
|
//- Maximum radius
|
||||||
scalar rMax_;
|
scalar rMax_;
|
||||||
|
|
||||||
|
|
||||||
// Protected Member Functions
|
// Protected Member Functions
|
||||||
|
|
||||||
//- Check data
|
//- Check data
|
||||||
@ -247,7 +247,7 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
|
|
||||||
//- Construct from components
|
//- Construct from components
|
||||||
rotorDiskSource
|
rotorDiskSource
|
||||||
(
|
(
|
||||||
|
|||||||
@ -704,6 +704,7 @@ void Foam::vtkUnstructuredReader::read(ISstream& inFile)
|
|||||||
labelList faceVerts;
|
labelList faceVerts;
|
||||||
readBlock(inFile, nNumbers, faceVerts);
|
readBlock(inFile, nNumbers, faceVerts);
|
||||||
faces_.setSize(nFaces);
|
faces_.setSize(nFaces);
|
||||||
|
faceMap_.setSize(nFaces);
|
||||||
label elemI = 0;
|
label elemI = 0;
|
||||||
forAll(faces_, faceI)
|
forAll(faces_, faceI)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -124,6 +124,7 @@ $(derivedFvPatchFields)/mappedFixedPushedInternalValue/mappedFixedPushedInternal
|
|||||||
$(derivedFvPatchFields)/mappedFixedValue/mappedFixedValueFvPatchFields.C
|
$(derivedFvPatchFields)/mappedFixedValue/mappedFixedValueFvPatchFields.C
|
||||||
$(derivedFvPatchFields)/mappedVelocityFluxFixedValue/mappedVelocityFluxFixedValueFvPatchField.C
|
$(derivedFvPatchFields)/mappedVelocityFluxFixedValue/mappedVelocityFluxFixedValueFvPatchField.C
|
||||||
$(derivedFvPatchFields)/mappedFlowRate/mappedFlowRateFvPatchVectorField.C
|
$(derivedFvPatchFields)/mappedFlowRate/mappedFlowRateFvPatchVectorField.C
|
||||||
|
$(derivedFvPatchFields)/fixedMean/fixedMeanFvPatchFields.C
|
||||||
$(derivedFvPatchFields)/fan/fanFvPatchFields.C
|
$(derivedFvPatchFields)/fan/fanFvPatchFields.C
|
||||||
$(derivedFvPatchFields)/fanPressure/fanPressureFvPatchScalarField.C
|
$(derivedFvPatchFields)/fanPressure/fanPressureFvPatchScalarField.C
|
||||||
$(derivedFvPatchFields)/buoyantPressure/buoyantPressureFvPatchScalarField.C
|
$(derivedFvPatchFields)/buoyantPressure/buoyantPressureFvPatchScalarField.C
|
||||||
|
|||||||
@ -0,0 +1,142 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "fixedMeanFvPatchField.H"
|
||||||
|
#include "volFields.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
fixedMeanFvPatchField<Type>::fixedMeanFvPatchField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<Type, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchField<Type>(p, iF),
|
||||||
|
meanValue_(pTraits<Type>::zero)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
fixedMeanFvPatchField<Type>::fixedMeanFvPatchField
|
||||||
|
(
|
||||||
|
const fixedMeanFvPatchField<Type>& ptf,
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<Type, volMesh>& iF,
|
||||||
|
const fvPatchFieldMapper& mapper
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchField<Type>(ptf, p, iF, mapper),
|
||||||
|
meanValue_(ptf.meanValue_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
fixedMeanFvPatchField<Type>::fixedMeanFvPatchField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<Type, volMesh>& iF,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchField<Type>(p, iF, dict),
|
||||||
|
meanValue_(pTraits<Type>(dict.lookup("meanValue")))
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
fixedMeanFvPatchField<Type>::fixedMeanFvPatchField
|
||||||
|
(
|
||||||
|
const fixedMeanFvPatchField<Type>& ptf
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchField<Type>(ptf),
|
||||||
|
meanValue_(ptf.meanValue_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
fixedMeanFvPatchField<Type>::fixedMeanFvPatchField
|
||||||
|
(
|
||||||
|
const fixedMeanFvPatchField<Type>& ptf,
|
||||||
|
const DimensionedField<Type, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchField<Type>(ptf, iF),
|
||||||
|
meanValue_(ptf.meanValue_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void fixedMeanFvPatchField<Type>::updateCoeffs()
|
||||||
|
{
|
||||||
|
if (this->updated())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Field<Type> newValues(this->patchInternalField());
|
||||||
|
|
||||||
|
Type meanValuePsi =
|
||||||
|
gSum(this->patch().magSf()*newValues)
|
||||||
|
/gSum(this->patch().magSf());
|
||||||
|
|
||||||
|
if (mag(meanValue_) > SMALL && mag(meanValuePsi)/mag(meanValue_) > 0.5)
|
||||||
|
{
|
||||||
|
newValues *= mag(meanValue_)/mag(meanValuePsi);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
newValues += (meanValue_ - meanValuePsi);
|
||||||
|
}
|
||||||
|
|
||||||
|
this->operator==(newValues);
|
||||||
|
|
||||||
|
fixedValueFvPatchField<Type>::updateCoeffs();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void fixedMeanFvPatchField<Type>::write(Ostream& os) const
|
||||||
|
{
|
||||||
|
fvPatchField<Type>::write(os);
|
||||||
|
os.writeKeyword("meanValue") << meanValue_ << token::END_STATEMENT << nl;
|
||||||
|
this->writeEntry("value", os);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,158 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::fixedMeanFvPatchField
|
||||||
|
|
||||||
|
Description
|
||||||
|
Extrapolates field to the patch using the near-cell values and adjusts
|
||||||
|
the distribution to match the specified meanValue.
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
fixedMeanFvPatchField.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef fixedMeanFvPatchField_H
|
||||||
|
#define fixedMeanFvPatchField_H
|
||||||
|
|
||||||
|
#include "fixedValueFvPatchFields.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class fixedMeanFvPatch Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
class fixedMeanFvPatchField
|
||||||
|
:
|
||||||
|
public fixedValueFvPatchField<Type>
|
||||||
|
{
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Protected data
|
||||||
|
|
||||||
|
//- MeanValue value the field is adjusted to maintain
|
||||||
|
Type meanValue_;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("fixedMean");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from patch and internal field
|
||||||
|
fixedMeanFvPatchField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<Type, volMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct from patch, internal field and dictionary
|
||||||
|
fixedMeanFvPatchField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<Type, volMesh>&,
|
||||||
|
const dictionary&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct by mapping given fixedMeanFvPatchField
|
||||||
|
// onto a new patch
|
||||||
|
fixedMeanFvPatchField
|
||||||
|
(
|
||||||
|
const fixedMeanFvPatchField<Type>&,
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<Type, volMesh>&,
|
||||||
|
const fvPatchFieldMapper&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct as copy
|
||||||
|
fixedMeanFvPatchField
|
||||||
|
(
|
||||||
|
const fixedMeanFvPatchField<Type>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct and return a clone
|
||||||
|
virtual tmp<fvPatchField<Type> > clone() const
|
||||||
|
{
|
||||||
|
return tmp<fvPatchField<Type> >
|
||||||
|
(
|
||||||
|
new fixedMeanFvPatchField<Type>(*this)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Construct as copy setting internal field reference
|
||||||
|
fixedMeanFvPatchField
|
||||||
|
(
|
||||||
|
const fixedMeanFvPatchField<Type>&,
|
||||||
|
const DimensionedField<Type, volMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct and return a clone setting internal field reference
|
||||||
|
virtual tmp<fvPatchField<Type> > clone
|
||||||
|
(
|
||||||
|
const DimensionedField<Type, volMesh>& iF
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return tmp<fvPatchField<Type> >
|
||||||
|
(
|
||||||
|
new fixedMeanFvPatchField<Type>(*this, iF)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Member functions
|
||||||
|
|
||||||
|
// Evaluation functions
|
||||||
|
|
||||||
|
//- Update the coefficients associated with the patch field
|
||||||
|
virtual void updateCoeffs();
|
||||||
|
|
||||||
|
//- Write
|
||||||
|
virtual void write(Ostream&) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#ifdef NoRepository
|
||||||
|
# include "fixedMeanFvPatchField.C"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,43 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "fixedMeanFvPatchFields.H"
|
||||||
|
#include "volMesh.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
makePatchFields(fixedMean);
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,49 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef fixedMeanFvPatchFields_H
|
||||||
|
#define fixedMeanFvPatchFields_H
|
||||||
|
|
||||||
|
#include "fixedMeanFvPatchField.H"
|
||||||
|
#include "fieldTypes.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
makePatchTypeFieldTypedefs(fixedMean);
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -23,67 +23,28 @@ License
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "buildCGALPolyhedron.H"
|
#ifndef fixedMeanFvPatchFieldsFwd_H
|
||||||
|
#define fixedMeanFvPatchFieldsFwd_H
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
#include "fieldTypes.H"
|
||||||
|
|
||||||
Foam::buildCGALPolyhedron::buildCGALPolyhedron
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
(
|
|
||||||
const Foam::triSurface& surf
|
|
||||||
)
|
|
||||||
:
|
|
||||||
CGAL::Modifier_base<HalfedgeDS>(),
|
|
||||||
surf_(surf)
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
Foam::buildCGALPolyhedron::~buildCGALPolyhedron()
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
void Foam::buildCGALPolyhedron::operator()
|
|
||||||
(
|
|
||||||
HalfedgeDS& hds
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
typedef HalfedgeDS::Traits Traits;
|
|
||||||
typedef Traits::Point_3 Point;
|
|
||||||
|
|
||||||
// Postcondition: `hds' is a valid polyhedral surface.
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
CGAL::Polyhedron_incremental_builder_3<HalfedgeDS> B(hds, false);
|
|
||||||
|
|
||||||
B.begin_surface
|
template<class Type> class fixedMeanFvPatchField;
|
||||||
(
|
|
||||||
surf_.points().size(), // n points
|
|
||||||
surf_.size(), // n facets
|
|
||||||
2*surf_.edges().size() // n halfedges
|
|
||||||
);
|
|
||||||
|
|
||||||
forAll(surf_.points(), pI)
|
makePatchTypeFieldTypedefs(fixedMean);
|
||||||
{
|
|
||||||
const Foam::point& p = surf_.points()[pI];
|
|
||||||
|
|
||||||
B.add_vertex(Point(p.x(), p.y(), p.z()));
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
}
|
|
||||||
|
|
||||||
forAll(surf_, fI)
|
} // End namespace Foam
|
||||||
{
|
|
||||||
B.begin_facet();
|
|
||||||
|
|
||||||
B.add_vertex_to_facet(surf_[fI][0]);
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
B.add_vertex_to_facet(surf_[fI][1]);
|
|
||||||
B.add_vertex_to_facet(surf_[fI][2]);
|
|
||||||
|
|
||||||
B.end_facet();
|
|
||||||
}
|
|
||||||
|
|
||||||
B.end_surface();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
@ -181,7 +181,7 @@ void Foam::ParticleErosion<CloudType>::postPatch
|
|||||||
|
|
||||||
// particle direction of travel
|
// particle direction of travel
|
||||||
const vector& U = p.U();
|
const vector& U = p.U();
|
||||||
|
|
||||||
// quick reject if particle travelling away from the patch
|
// quick reject if particle travelling away from the patch
|
||||||
if ((-nw & U) < 0)
|
if ((-nw & U) < 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -112,7 +112,7 @@ public:
|
|||||||
|
|
||||||
//- Post-move hook
|
//- Post-move hook
|
||||||
virtual void postMove
|
virtual void postMove
|
||||||
(
|
(
|
||||||
const parcelType& p,
|
const parcelType& p,
|
||||||
const label cellI,
|
const label cellI,
|
||||||
const scalar dt
|
const scalar dt
|
||||||
|
|||||||
@ -285,7 +285,7 @@ void Foam::PairCollision<CloudType>::wallInteraction()
|
|||||||
);
|
);
|
||||||
|
|
||||||
flatSiteData.append(wSD);
|
flatSiteData.append(wSD);
|
||||||
|
|
||||||
particleHit = true;
|
particleHit = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -76,6 +76,9 @@ Foam::refinementParameters::refinementParameters(const dictionary& dict)
|
|||||||
Foam::labelList Foam::refinementParameters::findCells(const polyMesh& mesh)
|
Foam::labelList Foam::refinementParameters::findCells(const polyMesh& mesh)
|
||||||
const
|
const
|
||||||
{
|
{
|
||||||
|
// Force calculation of tet-diag decomposition (for use in findCell)
|
||||||
|
(void)mesh.tetBasePtIs();
|
||||||
|
|
||||||
// Global calculation engine
|
// Global calculation engine
|
||||||
globalIndex globalCells(mesh.nCells());
|
globalIndex globalCells(mesh.nCells());
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -877,49 +877,7 @@ Foam::meshRefinement::meshRefinement
|
|||||||
meshCutter_
|
meshCutter_
|
||||||
(
|
(
|
||||||
mesh,
|
mesh,
|
||||||
labelIOList
|
false // do not try to read history.
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
"cellLevel",
|
|
||||||
mesh_.facesInstance(),
|
|
||||||
fvMesh::meshSubDir,
|
|
||||||
mesh,
|
|
||||||
IOobject::READ_IF_PRESENT,
|
|
||||||
IOobject::NO_WRITE,
|
|
||||||
false
|
|
||||||
),
|
|
||||||
labelList(mesh_.nCells(), 0)
|
|
||||||
),
|
|
||||||
labelIOList
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
"pointLevel",
|
|
||||||
mesh_.facesInstance(),
|
|
||||||
fvMesh::meshSubDir,
|
|
||||||
mesh,
|
|
||||||
IOobject::READ_IF_PRESENT,
|
|
||||||
IOobject::NO_WRITE,
|
|
||||||
false
|
|
||||||
),
|
|
||||||
labelList(mesh_.nPoints(), 0)
|
|
||||||
),
|
|
||||||
refinementHistory
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
"refinementHistory",
|
|
||||||
mesh_.facesInstance(),
|
|
||||||
fvMesh::meshSubDir,
|
|
||||||
mesh_,
|
|
||||||
IOobject::NO_READ,
|
|
||||||
IOobject::NO_WRITE,
|
|
||||||
false
|
|
||||||
),
|
|
||||||
List<refinementHistory::splitCell8>(0),
|
|
||||||
labelList(0)
|
|
||||||
) // no unrefinement
|
|
||||||
),
|
),
|
||||||
surfaceIndex_
|
surfaceIndex_
|
||||||
(
|
(
|
||||||
@ -1819,6 +1777,9 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::splitMeshRegions
|
|||||||
const point& keepPoint
|
const point& keepPoint
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
// Force calculation of face decomposition (used in findCell)
|
||||||
|
(void)mesh_.tetBasePtIs();
|
||||||
|
|
||||||
// Determine connected regions. regionSplit is the labelList with the
|
// Determine connected regions. regionSplit is the labelList with the
|
||||||
// region per cell.
|
// region per cell.
|
||||||
regionSplit cellRegion(mesh_);
|
regionSplit cellRegion(mesh_);
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -1235,6 +1235,9 @@ void Foam::meshRefinement::findCellZoneInsideWalk
|
|||||||
blockedFace.clear();
|
blockedFace.clear();
|
||||||
|
|
||||||
|
|
||||||
|
// Force calculation of face decomposition (used in findCell)
|
||||||
|
(void)mesh_.tetBasePtIs();
|
||||||
|
|
||||||
// For all locationSurface find the cell
|
// For all locationSurface find the cell
|
||||||
forAll(locationSurfaces, i)
|
forAll(locationSurfaces, i)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -33,11 +33,15 @@ License
|
|||||||
#include "OFstream.H"
|
#include "OFstream.H"
|
||||||
#include "IFstream.H"
|
#include "IFstream.H"
|
||||||
#include "unitConversion.H"
|
#include "unitConversion.H"
|
||||||
|
#include "EdgeMap.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
defineTypeNameAndDebug(Foam::surfaceFeatures, 0);
|
defineTypeNameAndDebug(Foam::surfaceFeatures, 0);
|
||||||
|
|
||||||
|
const Foam::scalar Foam::surfaceFeatures::parallelTolerance =
|
||||||
|
sin(degToRad(1.0));
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -170,7 +174,10 @@ void Foam::surfaceFeatures::setFromStatus(const List<edgeStatus>& edgeStat)
|
|||||||
|
|
||||||
|
|
||||||
//construct feature points where more than 2 feature edges meet
|
//construct feature points where more than 2 feature edges meet
|
||||||
void Foam::surfaceFeatures::calcFeatPoints(const List<edgeStatus>& edgeStat)
|
void Foam::surfaceFeatures::calcFeatPoints
|
||||||
|
(
|
||||||
|
const List<edgeStatus>& edgeStat
|
||||||
|
)
|
||||||
{
|
{
|
||||||
DynamicList<label> featurePoints(surf_.nPoints()/1000);
|
DynamicList<label> featurePoints(surf_.nPoints()/1000);
|
||||||
|
|
||||||
@ -200,6 +207,60 @@ void Foam::surfaceFeatures::calcFeatPoints(const List<edgeStatus>& edgeStat)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::surfaceFeatures::classifyFeatureAngles
|
||||||
|
(
|
||||||
|
const labelListList& edgeFaces,
|
||||||
|
List<edgeStatus>& edgeStat,
|
||||||
|
const scalar minCos
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
const vectorField& faceNormals = surf_.faceNormals();
|
||||||
|
const pointField& points = surf_.points();
|
||||||
|
|
||||||
|
forAll(edgeFaces, edgeI)
|
||||||
|
{
|
||||||
|
const labelList& eFaces = edgeFaces[edgeI];
|
||||||
|
|
||||||
|
if (eFaces.size() != 2)
|
||||||
|
{
|
||||||
|
// Non-manifold. What to do here? Is region edge? external edge?
|
||||||
|
edgeStat[edgeI] = REGION;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
label face0 = eFaces[0];
|
||||||
|
label face1 = eFaces[1];
|
||||||
|
|
||||||
|
if (surf_[face0].region() != surf_[face1].region())
|
||||||
|
{
|
||||||
|
edgeStat[edgeI] = REGION;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ((faceNormals[face0] & faceNormals[face1]) < minCos)
|
||||||
|
{
|
||||||
|
|
||||||
|
// Check if convex or concave by looking at angle
|
||||||
|
// between face centres and normal
|
||||||
|
vector f0Tof1 =
|
||||||
|
surf_[face1].centre(points)
|
||||||
|
- surf_[face0].centre(points);
|
||||||
|
|
||||||
|
if ((f0Tof1 & faceNormals[face0]) > 0.0)
|
||||||
|
{
|
||||||
|
edgeStat[edgeI] = INTERNAL;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
edgeStat[edgeI] = EXTERNAL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Returns next feature edge connected to pointI with correct value.
|
// Returns next feature edge connected to pointI with correct value.
|
||||||
Foam::label Foam::surfaceFeatures::nextFeatEdge
|
Foam::label Foam::surfaceFeatures::nextFeatEdge
|
||||||
(
|
(
|
||||||
@ -436,6 +497,80 @@ Foam::surfaceFeatures::surfaceFeatures
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::surfaceFeatures::surfaceFeatures
|
||||||
|
(
|
||||||
|
const triSurface& surf,
|
||||||
|
const pointField& points,
|
||||||
|
const edgeList& edges,
|
||||||
|
const scalar mergeTol
|
||||||
|
)
|
||||||
|
:
|
||||||
|
surf_(surf),
|
||||||
|
featurePoints_(0),
|
||||||
|
featureEdges_(0),
|
||||||
|
externalStart_(0),
|
||||||
|
internalStart_(0)
|
||||||
|
{
|
||||||
|
// Match edge mesh edges with the triSurface edges
|
||||||
|
|
||||||
|
const labelListList& surfEdgeFaces = surf_.edgeFaces();
|
||||||
|
const edgeList& surfEdges = surf_.edges();
|
||||||
|
|
||||||
|
scalar mergeTolSqr = sqr(mergeTol);
|
||||||
|
|
||||||
|
EdgeMap<label> dynFeatEdges(2*edges.size());
|
||||||
|
DynamicList<labelList> dynFeatureEdgeFaces(edges.size());
|
||||||
|
|
||||||
|
labelList edgeLabel;
|
||||||
|
|
||||||
|
nearestFeatEdge
|
||||||
|
(
|
||||||
|
edges,
|
||||||
|
points,
|
||||||
|
mergeTolSqr,
|
||||||
|
edgeLabel // label of surface edge or -1
|
||||||
|
);
|
||||||
|
|
||||||
|
label count = 0;
|
||||||
|
forAll(edgeLabel, sEdgeI)
|
||||||
|
{
|
||||||
|
const label sEdge = edgeLabel[sEdgeI];
|
||||||
|
|
||||||
|
if (sEdge == -1)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
dynFeatEdges.insert(surfEdges[sEdge], count++);
|
||||||
|
dynFeatureEdgeFaces.append(surfEdgeFaces[sEdge]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Find whether an edge is external or internal
|
||||||
|
List<edgeStatus> edgeStat(dynFeatEdges.size(), NONE);
|
||||||
|
|
||||||
|
classifyFeatureAngles(dynFeatureEdgeFaces, edgeStat, GREAT);
|
||||||
|
|
||||||
|
// Transfer the edge status to a list encompassing all edges in the surface
|
||||||
|
// so that calcFeatPoints can be used.
|
||||||
|
List<edgeStatus> allEdgeStat(surf_.nEdges(), NONE);
|
||||||
|
|
||||||
|
forAll(allEdgeStat, eI)
|
||||||
|
{
|
||||||
|
EdgeMap<label>::const_iterator iter = dynFeatEdges.find(surfEdges[eI]);
|
||||||
|
|
||||||
|
if (iter != dynFeatEdges.end())
|
||||||
|
{
|
||||||
|
allEdgeStat[eI] = edgeStat[iter()];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
edgeStat.clear();
|
||||||
|
dynFeatEdges.clear();
|
||||||
|
|
||||||
|
setFromStatus(allEdgeStat);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//- Construct as copy
|
//- Construct as copy
|
||||||
Foam::surfaceFeatures::surfaceFeatures(const surfaceFeatures& sf)
|
Foam::surfaceFeatures::surfaceFeatures(const surfaceFeatures& sf)
|
||||||
:
|
:
|
||||||
@ -496,54 +631,10 @@ void Foam::surfaceFeatures::findFeatures(const scalar includedAngle)
|
|||||||
{
|
{
|
||||||
scalar minCos = Foam::cos(degToRad(180.0 - includedAngle));
|
scalar minCos = Foam::cos(degToRad(180.0 - includedAngle));
|
||||||
|
|
||||||
const labelListList& edgeFaces = surf_.edgeFaces();
|
|
||||||
const vectorField& faceNormals = surf_.faceNormals();
|
|
||||||
const pointField& points = surf_.points();
|
|
||||||
|
|
||||||
// Per edge whether is feature edge.
|
// Per edge whether is feature edge.
|
||||||
List<edgeStatus> edgeStat(surf_.nEdges(), NONE);
|
List<edgeStatus> edgeStat(surf_.nEdges(), NONE);
|
||||||
|
|
||||||
forAll(edgeFaces, edgeI)
|
classifyFeatureAngles(surf_.edgeFaces(), edgeStat, minCos);
|
||||||
{
|
|
||||||
const labelList& eFaces = edgeFaces[edgeI];
|
|
||||||
|
|
||||||
if (eFaces.size() != 2)
|
|
||||||
{
|
|
||||||
// Non-manifold. What to do here? Is region edge? external edge?
|
|
||||||
edgeStat[edgeI] = REGION;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
label face0 = eFaces[0];
|
|
||||||
label face1 = eFaces[1];
|
|
||||||
|
|
||||||
if (surf_[face0].region() != surf_[face1].region())
|
|
||||||
{
|
|
||||||
edgeStat[edgeI] = REGION;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ((faceNormals[face0] & faceNormals[face1]) < minCos)
|
|
||||||
{
|
|
||||||
|
|
||||||
// Check if convex or concave by looking at angle
|
|
||||||
// between face centres and normal
|
|
||||||
vector f0Tof1 =
|
|
||||||
surf_[face1].centre(points)
|
|
||||||
- surf_[face0].centre(points);
|
|
||||||
|
|
||||||
if ((f0Tof1 & faceNormals[face0]) > 0.0)
|
|
||||||
{
|
|
||||||
edgeStat[edgeI] = INTERNAL;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
edgeStat[edgeI] = EXTERNAL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
setFromStatus(edgeStat);
|
setFromStatus(edgeStat);
|
||||||
}
|
}
|
||||||
@ -1147,6 +1238,9 @@ void Foam::surfaceFeatures::nearestSurfEdge
|
|||||||
|
|
||||||
const pointField& localPoints = surf_.localPoints();
|
const pointField& localPoints = surf_.localPoints();
|
||||||
|
|
||||||
|
treeBoundBox searchDomain(localPoints);
|
||||||
|
searchDomain.inflate(0.1);
|
||||||
|
|
||||||
indexedOctree<treeDataEdge> ppTree
|
indexedOctree<treeDataEdge> ppTree
|
||||||
(
|
(
|
||||||
treeDataEdge
|
treeDataEdge
|
||||||
@ -1156,7 +1250,7 @@ void Foam::surfaceFeatures::nearestSurfEdge
|
|||||||
localPoints,
|
localPoints,
|
||||||
selectedEdges
|
selectedEdges
|
||||||
), // all information needed to do geometric checks
|
), // all information needed to do geometric checks
|
||||||
treeBoundBox(localPoints), // overall search domain
|
searchDomain, // overall search domain
|
||||||
8, // maxLevel
|
8, // maxLevel
|
||||||
10, // leafsize
|
10, // leafsize
|
||||||
3.0 // duplicity
|
3.0 // duplicity
|
||||||
@ -1216,6 +1310,8 @@ void Foam::surfaceFeatures::nearestSurfEdge
|
|||||||
pointOnEdge.setSize(selectedSampleEdges.size());
|
pointOnEdge.setSize(selectedSampleEdges.size());
|
||||||
pointOnFeature.setSize(selectedSampleEdges.size());
|
pointOnFeature.setSize(selectedSampleEdges.size());
|
||||||
|
|
||||||
|
treeBoundBox searchDomain(surf_.localPoints());
|
||||||
|
|
||||||
indexedOctree<treeDataEdge> ppTree
|
indexedOctree<treeDataEdge> ppTree
|
||||||
(
|
(
|
||||||
treeDataEdge
|
treeDataEdge
|
||||||
@ -1224,11 +1320,11 @@ void Foam::surfaceFeatures::nearestSurfEdge
|
|||||||
surf_.edges(),
|
surf_.edges(),
|
||||||
surf_.localPoints(),
|
surf_.localPoints(),
|
||||||
selectedEdges
|
selectedEdges
|
||||||
), // all information needed to do geometric checks
|
), // all information needed to do geometric checks
|
||||||
treeBoundBox(surf_.localPoints()), // overall search domain
|
searchDomain, // overall search domain
|
||||||
8, // maxLevel
|
8, // maxLevel
|
||||||
10, // leafsize
|
10, // leafsize
|
||||||
3.0 // duplicity
|
3.0 // duplicity
|
||||||
);
|
);
|
||||||
|
|
||||||
forAll(selectedSampleEdges, i)
|
forAll(selectedSampleEdges, i)
|
||||||
@ -1262,6 +1358,67 @@ void Foam::surfaceFeatures::nearestSurfEdge
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::surfaceFeatures::nearestFeatEdge
|
||||||
|
(
|
||||||
|
const edgeList& edges,
|
||||||
|
const pointField& points,
|
||||||
|
scalar searchSpanSqr, // Search span
|
||||||
|
labelList& edgeLabel
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
edgeLabel = labelList(surf_.nEdges(), -1);
|
||||||
|
|
||||||
|
treeBoundBox searchDomain(points);
|
||||||
|
searchDomain.inflate(0.1);
|
||||||
|
|
||||||
|
indexedOctree<treeDataEdge> ppTree
|
||||||
|
(
|
||||||
|
treeDataEdge
|
||||||
|
(
|
||||||
|
false,
|
||||||
|
edges,
|
||||||
|
points,
|
||||||
|
identity(edges.size())
|
||||||
|
), // all information needed to do geometric checks
|
||||||
|
searchDomain, // overall search domain
|
||||||
|
8, // maxLevel
|
||||||
|
10, // leafsize
|
||||||
|
3.0 // duplicity
|
||||||
|
);
|
||||||
|
|
||||||
|
const edgeList& surfEdges = surf_.edges();
|
||||||
|
const pointField& surfLocalPoints = surf_.localPoints();
|
||||||
|
|
||||||
|
forAll(surfEdges, edgeI)
|
||||||
|
{
|
||||||
|
const edge& sample = surfEdges[edgeI];
|
||||||
|
|
||||||
|
const point& startPoint = surfLocalPoints[sample.start()];
|
||||||
|
const point& midPoint = sample.centre(surfLocalPoints);
|
||||||
|
|
||||||
|
pointIndexHit infoMid = ppTree.findNearest
|
||||||
|
(
|
||||||
|
midPoint,
|
||||||
|
searchSpanSqr
|
||||||
|
);
|
||||||
|
|
||||||
|
if (infoMid.hit())
|
||||||
|
{
|
||||||
|
const vector surfEdgeDir = midPoint - startPoint;
|
||||||
|
|
||||||
|
const edge& featEdge = edges[infoMid.index()];
|
||||||
|
const vector featEdgeDir = featEdge.vec(points);
|
||||||
|
|
||||||
|
// Check that the edges are nearly parallel
|
||||||
|
if (mag(surfEdgeDir ^ featEdgeDir) < parallelTolerance)
|
||||||
|
{
|
||||||
|
edgeLabel[edgeI] = edgeI;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::surfaceFeatures::operator=(const surfaceFeatures& rhs)
|
void Foam::surfaceFeatures::operator=(const surfaceFeatures& rhs)
|
||||||
|
|||||||
@ -95,6 +95,11 @@ private:
|
|||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Static data
|
||||||
|
|
||||||
|
//- Tolerance for determining whether two vectors are parallel
|
||||||
|
static const scalar parallelTolerance;
|
||||||
|
|
||||||
|
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
@ -130,6 +135,14 @@ private:
|
|||||||
//- Construct feature points where more than 2 feature edges meet
|
//- Construct feature points where more than 2 feature edges meet
|
||||||
void calcFeatPoints(const List<edgeStatus>&);
|
void calcFeatPoints(const List<edgeStatus>&);
|
||||||
|
|
||||||
|
//- Classify the angles of the feature edges
|
||||||
|
void classifyFeatureAngles
|
||||||
|
(
|
||||||
|
const labelListList& edgeFaces,
|
||||||
|
List<edgeStatus>& edgeStat,
|
||||||
|
const scalar minCos
|
||||||
|
) const;
|
||||||
|
|
||||||
//- Choose next unset feature edge.
|
//- Choose next unset feature edge.
|
||||||
label nextFeatEdge
|
label nextFeatEdge
|
||||||
(
|
(
|
||||||
@ -186,6 +199,15 @@ public:
|
|||||||
//- Construct from file
|
//- Construct from file
|
||||||
surfaceFeatures(const triSurface&, const fileName& fName);
|
surfaceFeatures(const triSurface&, const fileName& fName);
|
||||||
|
|
||||||
|
//- Construct from pointField and edgeList (edgeMesh)
|
||||||
|
surfaceFeatures
|
||||||
|
(
|
||||||
|
const triSurface&,
|
||||||
|
const pointField& points,
|
||||||
|
const edgeList& edges,
|
||||||
|
const scalar mergeTol = 1e-6
|
||||||
|
);
|
||||||
|
|
||||||
//- Construct as copy
|
//- Construct as copy
|
||||||
surfaceFeatures(const surfaceFeatures&);
|
surfaceFeatures(const surfaceFeatures&);
|
||||||
|
|
||||||
@ -327,9 +349,8 @@ public:
|
|||||||
pointField& edgePoint
|
pointField& edgePoint
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
|
||||||
//- Find nearest surface edge (out of selectedEdges) for each
|
//- Find nearest surface edge (out of selectedEdges) for each
|
||||||
// sample edge.
|
// sample edge.
|
||||||
// Sets:
|
// Sets:
|
||||||
// - edgeLabel : label of surface edge.
|
// - edgeLabel : label of surface edge.
|
||||||
// - pointOnEdge : exact position of nearest point on edge.
|
// - pointOnEdge : exact position of nearest point on edge.
|
||||||
@ -347,6 +368,16 @@ public:
|
|||||||
pointField& pointOnFeature // point on sample edge
|
pointField& pointOnFeature // point on sample edge
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
//- Find nearest feature edge to each surface edge. Uses the
|
||||||
|
// mid-point of the surface edges.
|
||||||
|
void nearestFeatEdge
|
||||||
|
(
|
||||||
|
const edgeList& edges,
|
||||||
|
const pointField& points,
|
||||||
|
scalar searchSpanSqr,
|
||||||
|
labelList& edgeLabel
|
||||||
|
) const;
|
||||||
|
|
||||||
|
|
||||||
// Write
|
// Write
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -49,11 +49,11 @@ namespace Foam
|
|||||||
Foam::structuredDecomp::structuredDecomp(const dictionary& decompositionDict)
|
Foam::structuredDecomp::structuredDecomp(const dictionary& decompositionDict)
|
||||||
:
|
:
|
||||||
decompositionMethod(decompositionDict),
|
decompositionMethod(decompositionDict),
|
||||||
methodDict_(decompositionDict_.subDict(typeName + "Coeffs"))
|
methodDict_(decompositionDict_.subDict(typeName + "Coeffs")),
|
||||||
|
patches_(methodDict_.lookup("patches"))
|
||||||
{
|
{
|
||||||
methodDict_.set("numberOfSubdomains", nDomains());
|
methodDict_.set("numberOfSubdomains", nDomains());
|
||||||
method_ = decompositionMethod::New(methodDict_);
|
method_ = decompositionMethod::New(methodDict_);
|
||||||
patches_ = wordList(methodDict_.lookup("patches"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -72,29 +72,20 @@ Foam::labelList Foam::structuredDecomp::decompose
|
|||||||
const scalarField& cWeights
|
const scalarField& cWeights
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
labelList patchIDs(patches_.size());
|
|
||||||
const polyBoundaryMesh& pbm = mesh.boundaryMesh();
|
const polyBoundaryMesh& pbm = mesh.boundaryMesh();
|
||||||
|
const labelHashSet patchIDs(pbm.patchSet(patches_));
|
||||||
|
|
||||||
label nFaces = 0;
|
label nFaces = 0;
|
||||||
forAll(patches_, i)
|
forAllConstIter(labelHashSet, patchIDs, iter)
|
||||||
{
|
{
|
||||||
patchIDs[i] = pbm.findPatchID(patches_[i]);
|
nFaces += pbm[iter.key()].size();
|
||||||
|
|
||||||
if (patchIDs[i] == -1)
|
|
||||||
{
|
|
||||||
FatalErrorIn("structuredDecomp::decompose(..)")
|
|
||||||
<< "Cannot find patch " << patches_[i] << endl
|
|
||||||
<< "Valid patches are " << pbm.names()
|
|
||||||
<< exit(FatalError);
|
|
||||||
}
|
|
||||||
nFaces += pbm[patchIDs[i]].size();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Extract a submesh.
|
// Extract a submesh.
|
||||||
labelHashSet patchCells(2*nFaces);
|
labelHashSet patchCells(2*nFaces);
|
||||||
forAll(patchIDs, i)
|
forAllConstIter(labelHashSet, patchIDs, iter)
|
||||||
{
|
{
|
||||||
const labelUList& fc = pbm[patchIDs[i]].faceCells();
|
const labelUList& fc = pbm[iter.key()].faceCells();
|
||||||
forAll(fc, i)
|
forAll(fc, i)
|
||||||
{
|
{
|
||||||
patchCells.insert(fc[i]);
|
patchCells.insert(fc[i]);
|
||||||
@ -127,9 +118,9 @@ Foam::labelList Foam::structuredDecomp::decompose
|
|||||||
labelList patchFaces(nFaces);
|
labelList patchFaces(nFaces);
|
||||||
List<topoDistanceData> patchData(nFaces);
|
List<topoDistanceData> patchData(nFaces);
|
||||||
nFaces = 0;
|
nFaces = 0;
|
||||||
forAll(patchIDs, i)
|
forAllConstIter(labelHashSet, patchIDs, iter)
|
||||||
{
|
{
|
||||||
const polyPatch& pp = pbm[patchIDs[i]];
|
const polyPatch& pp = pbm[iter.key()];
|
||||||
const labelUList& fc = pp.faceCells();
|
const labelUList& fc = pp.faceCells();
|
||||||
forAll(fc, i)
|
forAll(fc, i)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -25,7 +25,7 @@ Class
|
|||||||
Foam::structuredDecomp
|
Foam::structuredDecomp
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Decomposition given using consecutive application of decomposers.
|
Decomposition by walking out decomposition of patch cells mesh.
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
structuredDecomp.C
|
structuredDecomp.C
|
||||||
@ -52,9 +52,9 @@ class structuredDecomp
|
|||||||
|
|
||||||
dictionary methodDict_;
|
dictionary methodDict_;
|
||||||
|
|
||||||
autoPtr<decompositionMethod> method_;
|
wordReList patches_;
|
||||||
|
|
||||||
wordList patches_;
|
autoPtr<decompositionMethod> method_;
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|||||||
@ -26,7 +26,7 @@ functions
|
|||||||
|
|
||||||
fields
|
fields
|
||||||
(
|
(
|
||||||
R
|
R
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -28,7 +28,7 @@ Description
|
|||||||
Calculates pressure coefficient, c_p
|
Calculates pressure coefficient, c_p
|
||||||
|
|
||||||
c_p = p/p_dyn,inf
|
c_p = p/p_dyn,inf
|
||||||
|
|
||||||
where:
|
where:
|
||||||
|
|
||||||
p_dyn,inf = 0.5*rho*mag(U_inf)^2
|
p_dyn,inf = 0.5*rho*mag(U_inf)^2
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -202,7 +202,7 @@ void Foam::meshToMesh::calcAddressing()
|
|||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "meshToMesh::calculateAddressing() : "
|
Info<< "meshToMesh::calculateAddressing() : "
|
||||||
<< "finished calculating mesh-to-mesh acell ddressing" << endl;
|
<< "finished calculating mesh-to-mesh cell addressing" << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -128,6 +128,18 @@ bool Foam::fileFormats::VTKsurfaceFormat<Face>::read
|
|||||||
zones[i] = label(region[i]);
|
zones[i] = label(region[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (reader.cellData().foundObject<scalarIOField>("STLSolidLabeling"))
|
||||||
|
{
|
||||||
|
const scalarIOField& region =
|
||||||
|
reader.cellData().lookupObject<scalarIOField>
|
||||||
|
(
|
||||||
|
"STLSolidLabeling"
|
||||||
|
);
|
||||||
|
forAll(region, i)
|
||||||
|
{
|
||||||
|
zones[i] = label(region[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Create zone names
|
// Create zone names
|
||||||
const label nZones = max(zones)+1;
|
const label nZones = max(zones)+1;
|
||||||
|
|||||||
@ -284,24 +284,7 @@ Foam::radiation::greyMeanAbsorptionEmission::aCont(const label bandI) const
|
|||||||
Foam::tmp<Foam::volScalarField>
|
Foam::tmp<Foam::volScalarField>
|
||||||
Foam::radiation::greyMeanAbsorptionEmission::eCont(const label bandI) const
|
Foam::radiation::greyMeanAbsorptionEmission::eCont(const label bandI) const
|
||||||
{
|
{
|
||||||
tmp<volScalarField> e
|
return aCont(bandI);
|
||||||
(
|
|
||||||
new volScalarField
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
"eCont" + name(bandI),
|
|
||||||
mesh().time().timeName(),
|
|
||||||
mesh(),
|
|
||||||
IOobject::NO_READ,
|
|
||||||
IOobject::NO_WRITE
|
|
||||||
),
|
|
||||||
mesh(),
|
|
||||||
dimensionedScalar("e", dimless/dimLength, 0.0)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
return e;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -231,24 +231,7 @@ Foam::radiation::wideBandAbsorptionEmission::aCont(const label bandI) const
|
|||||||
Foam::tmp<Foam::volScalarField>
|
Foam::tmp<Foam::volScalarField>
|
||||||
Foam::radiation::wideBandAbsorptionEmission::eCont(const label bandI) const
|
Foam::radiation::wideBandAbsorptionEmission::eCont(const label bandI) const
|
||||||
{
|
{
|
||||||
tmp<volScalarField> e
|
return aCont(bandI);
|
||||||
(
|
|
||||||
new volScalarField
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
"e",
|
|
||||||
mesh().time().timeName(),
|
|
||||||
mesh(),
|
|
||||||
IOobject::NO_READ,
|
|
||||||
IOobject::NO_WRITE
|
|
||||||
),
|
|
||||||
mesh(),
|
|
||||||
dimensionedScalar("e", dimless/dimLength, 0.0)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
return e;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -268,7 +268,7 @@ kOmegaSST::kOmegaSST
|
|||||||
/ max
|
/ max
|
||||||
(
|
(
|
||||||
a1_*omega_,
|
a1_*omega_,
|
||||||
F2()*sqrt(2.0*magSqr(symm(fvc::grad(U_))))
|
F2()*sqrt(2.0)*mag(symm(fvc::grad(U_)))
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
mut_.correctBoundaryConditions();
|
mut_.correctBoundaryConditions();
|
||||||
@ -365,7 +365,7 @@ void kOmegaSST::correct()
|
|||||||
// Re-calculate viscosity
|
// Re-calculate viscosity
|
||||||
mut_ =
|
mut_ =
|
||||||
a1_*rho_*k_
|
a1_*rho_*k_
|
||||||
/max(a1_*omega_, F2()*sqrt(2.0*magSqr(symm(fvc::grad(U_)))));
|
/max(a1_*omega_, F2()*sqrt(2.0)*mag(symm(fvc::grad(U_))));
|
||||||
mut_.correctBoundaryConditions();
|
mut_.correctBoundaryConditions();
|
||||||
|
|
||||||
// Re-calculate thermal diffusivity
|
// Re-calculate thermal diffusivity
|
||||||
|
|||||||
@ -137,6 +137,61 @@ greyMeanAbsorptionEmissionCoeffs
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
O2
|
||||||
|
{
|
||||||
|
Tcommon 300;
|
||||||
|
invTemp true;
|
||||||
|
Tlow 200;
|
||||||
|
Thigh 2500;
|
||||||
|
|
||||||
|
loTcoeffs
|
||||||
|
(
|
||||||
|
0
|
||||||
|
0
|
||||||
|
0
|
||||||
|
0
|
||||||
|
0
|
||||||
|
0
|
||||||
|
);
|
||||||
|
hiTcoeffs
|
||||||
|
(
|
||||||
|
0.1
|
||||||
|
0
|
||||||
|
0
|
||||||
|
0
|
||||||
|
0
|
||||||
|
0
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
N2
|
||||||
|
{
|
||||||
|
Tcommon 300;
|
||||||
|
invTemp true;
|
||||||
|
Tlow 200;
|
||||||
|
Thigh 2500;
|
||||||
|
|
||||||
|
loTcoeffs
|
||||||
|
(
|
||||||
|
0
|
||||||
|
0
|
||||||
|
0
|
||||||
|
0
|
||||||
|
0
|
||||||
|
0
|
||||||
|
);
|
||||||
|
hiTcoeffs
|
||||||
|
(
|
||||||
|
0.1
|
||||||
|
0
|
||||||
|
0
|
||||||
|
0
|
||||||
|
0
|
||||||
|
0
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
scatterModel constantScatter;
|
scatterModel constantScatter;
|
||||||
|
|||||||
@ -43,7 +43,7 @@ absorptionEmissionModel greyMeanAbsorptionEmission;
|
|||||||
constantAbsorptionEmissionCoeffs
|
constantAbsorptionEmissionCoeffs
|
||||||
{
|
{
|
||||||
a a [ 0 -1 0 0 0 0 0 ] 0.01;
|
a a [ 0 -1 0 0 0 0 0 ] 0.01;
|
||||||
e e [ 0 -1 0 0 0 0 0 ] 0;
|
e e [ 0 -1 0 0 0 0 0 ] 0.01;
|
||||||
E E [ 1 -1 -3 0 0 0 0 ] 0;
|
E E [ 1 -1 -3 0 0 0 0 ] 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -134,6 +134,61 @@ greyMeanAbsorptionEmissionCoeffs
|
|||||||
0
|
0
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
O2
|
||||||
|
{
|
||||||
|
Tcommon 300;
|
||||||
|
invTemp true;
|
||||||
|
Tlow 200;
|
||||||
|
Thigh 2500;
|
||||||
|
|
||||||
|
loTcoeffs
|
||||||
|
(
|
||||||
|
0
|
||||||
|
0
|
||||||
|
0
|
||||||
|
0
|
||||||
|
0
|
||||||
|
0
|
||||||
|
);
|
||||||
|
hiTcoeffs
|
||||||
|
(
|
||||||
|
0.1
|
||||||
|
0
|
||||||
|
0
|
||||||
|
0
|
||||||
|
0
|
||||||
|
0
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
N2
|
||||||
|
{
|
||||||
|
Tcommon 300;
|
||||||
|
invTemp true;
|
||||||
|
Tlow 200;
|
||||||
|
Thigh 2500;
|
||||||
|
|
||||||
|
loTcoeffs
|
||||||
|
(
|
||||||
|
0
|
||||||
|
0
|
||||||
|
0
|
||||||
|
0
|
||||||
|
0
|
||||||
|
0
|
||||||
|
);
|
||||||
|
hiTcoeffs
|
||||||
|
(
|
||||||
|
0.1
|
||||||
|
0
|
||||||
|
0
|
||||||
|
0
|
||||||
|
0
|
||||||
|
0
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
scatterModel constantScatter;
|
scatterModel constantScatter;
|
||||||
|
|||||||
@ -135,6 +135,61 @@ greyMeanAbsorptionEmissionCoeffs
|
|||||||
0
|
0
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
O2
|
||||||
|
{
|
||||||
|
Tcommon 300;
|
||||||
|
invTemp true;
|
||||||
|
Tlow 200;
|
||||||
|
Thigh 2500;
|
||||||
|
|
||||||
|
loTcoeffs
|
||||||
|
(
|
||||||
|
0
|
||||||
|
0
|
||||||
|
0
|
||||||
|
0
|
||||||
|
0
|
||||||
|
0
|
||||||
|
);
|
||||||
|
hiTcoeffs
|
||||||
|
(
|
||||||
|
0.1
|
||||||
|
0
|
||||||
|
0
|
||||||
|
0
|
||||||
|
0
|
||||||
|
0
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
N2
|
||||||
|
{
|
||||||
|
Tcommon 300;
|
||||||
|
invTemp true;
|
||||||
|
Tlow 200;
|
||||||
|
Thigh 2500;
|
||||||
|
|
||||||
|
loTcoeffs
|
||||||
|
(
|
||||||
|
0
|
||||||
|
0
|
||||||
|
0
|
||||||
|
0
|
||||||
|
0
|
||||||
|
0
|
||||||
|
);
|
||||||
|
hiTcoeffs
|
||||||
|
(
|
||||||
|
0.1
|
||||||
|
0
|
||||||
|
0
|
||||||
|
0
|
||||||
|
0
|
||||||
|
0
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
scatterModel constantScatter;
|
scatterModel constantScatter;
|
||||||
|
|||||||
@ -6,7 +6,6 @@ cd ${0%/*} || exit 1 # run from this directory
|
|||||||
|
|
||||||
runApplication blockMesh
|
runApplication blockMesh
|
||||||
runApplication cvMesh
|
runApplication cvMesh
|
||||||
runApplication collapseEdges 1e-3 45
|
|
||||||
runApplication snappyHexMesh
|
runApplication snappyHexMesh
|
||||||
runApplication checkMesh -constant -allGeometry -allTopology
|
runApplication checkMesh -constant -allGeometry -allTopology
|
||||||
|
|
||||||
|
|||||||
@ -59,7 +59,6 @@ initialPoints
|
|||||||
|
|
||||||
autoDensityCoeffs
|
autoDensityCoeffs
|
||||||
{
|
{
|
||||||
minCellSizeLimit 0.04;
|
|
||||||
minLevels 0;
|
minLevels 0;
|
||||||
maxSizeRatio 5.0;
|
maxSizeRatio 5.0;
|
||||||
sampleResolution 5;
|
sampleResolution 5;
|
||||||
@ -150,21 +149,20 @@ motionControl
|
|||||||
{
|
{
|
||||||
priority 1;
|
priority 1;
|
||||||
mode bothSides;
|
mode bothSides;
|
||||||
|
|
||||||
surfaceCellSizeFunction uniformValue;
|
surfaceCellSizeFunction uniformValue;
|
||||||
uniformValueCoeffs
|
uniformValueCoeffs
|
||||||
{
|
{
|
||||||
surfaceCellSize 0.04;
|
surfaceCellSize 0.04;
|
||||||
}
|
}
|
||||||
refinementFactor 1;
|
|
||||||
|
|
||||||
cellSizeFunction uniformDistance;
|
cellSizeFunction uniformDistance;
|
||||||
uniformDistanceCoeffs
|
uniformDistanceCoeffs
|
||||||
{
|
{
|
||||||
distance 0.1;
|
distance 0.1;
|
||||||
}
|
}
|
||||||
linearDistanceCoeffs
|
linearDistanceCoeffs
|
||||||
{
|
{
|
||||||
surfaceCellSize 0.02;
|
|
||||||
distanceCellSize $defaultCellSize;
|
distanceCellSize $defaultCellSize;
|
||||||
distance 0.1;
|
distance 0.1;
|
||||||
}
|
}
|
||||||
@ -217,14 +215,15 @@ polyMeshFiltering
|
|||||||
{
|
{
|
||||||
writeTetDualMesh false;
|
writeTetDualMesh false;
|
||||||
filterSizeCoeff 0.2;
|
filterSizeCoeff 0.2;
|
||||||
mergeClosenessCoeff 1e-9;
|
mergeClosenessCoeff 1e-3;
|
||||||
|
edgeMergeAngle 45;
|
||||||
continueFilteringOnBadInitialPolyMesh true;
|
continueFilteringOnBadInitialPolyMesh true;
|
||||||
filterErrorReductionCoeff 0.5;
|
filterErrorReductionCoeff 0.5;
|
||||||
filterCountSkipThreshold 4;
|
filterCountSkipThreshold 4;
|
||||||
surfaceStepFaceAngle 80;
|
surfaceStepFaceAngle 80;
|
||||||
maxCollapseIterations 25;
|
maxCollapseIterations 25;
|
||||||
maxConsecutiveEqualFaceSets 5;
|
maxConsecutiveEqualFaceSets 5;
|
||||||
edgeCollapseGuardFraction 0.3;
|
edgeCollapseGuardFraction 0.1;
|
||||||
maxCollapseFaceToPointSideLengthCoeff 0.35;
|
maxCollapseFaceToPointSideLengthCoeff 0.35;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -17,8 +17,8 @@ FoamFile
|
|||||||
|
|
||||||
numberOfSubdomains 8;
|
numberOfSubdomains 8;
|
||||||
|
|
||||||
method scotch;
|
//method scotch;
|
||||||
// method ptscotch;
|
method ptscotch;
|
||||||
// method hierarchical;
|
// method hierarchical;
|
||||||
|
|
||||||
simpleCoeffs
|
simpleCoeffs
|
||||||
|
|||||||
Reference in New Issue
Block a user