mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: distributedTriSurfaceMesh: auto-decomposition; inside/outside support
This commit is contained in:
@ -471,6 +471,12 @@ public:
|
||||
return nodes_[0].bb_;
|
||||
}
|
||||
|
||||
//- Per node, per octant whether is fully inside/outside/mixed.
|
||||
PackedList<2>& nodeTypes() const
|
||||
{
|
||||
return nodeTypes_;
|
||||
}
|
||||
|
||||
|
||||
// Conversions for entries in subNodes_.
|
||||
|
||||
|
||||
@ -330,10 +330,10 @@ public:
|
||||
mapDistribute();
|
||||
|
||||
//- Copy construct
|
||||
mapDistribute(const mapDistribute& map);
|
||||
explicit mapDistribute(const mapDistribute& map);
|
||||
|
||||
//- Move construct
|
||||
mapDistribute(mapDistribute&& map);
|
||||
explicit mapDistribute(mapDistribute&& map);
|
||||
|
||||
//- Move construct from components
|
||||
mapDistribute
|
||||
|
||||
@ -128,6 +128,11 @@ public:
|
||||
{
|
||||
return true;
|
||||
}
|
||||
//- What is type of points outside bounds
|
||||
virtual volumeType outsideVolumeType() const
|
||||
{
|
||||
return volumeType::OUTSIDE;
|
||||
}
|
||||
|
||||
//- Range of local indices that can be returned.
|
||||
virtual label size() const
|
||||
|
||||
@ -186,6 +186,12 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
//- What is type of points outside bounds
|
||||
virtual volumeType outsideVolumeType() const
|
||||
{
|
||||
return volumeType::OUTSIDE;
|
||||
}
|
||||
|
||||
//- Range of local indices that can be returned.
|
||||
virtual label size() const
|
||||
{
|
||||
|
||||
@ -158,6 +158,12 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
//- What is type of points outside bounds
|
||||
virtual volumeType outsideVolumeType() const
|
||||
{
|
||||
return volumeType::OUTSIDE;
|
||||
}
|
||||
|
||||
//- Range of local indices that can be returned.
|
||||
virtual label size() const
|
||||
{
|
||||
|
||||
@ -141,6 +141,12 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
//- What is type of points outside bounds
|
||||
virtual volumeType outsideVolumeType() const
|
||||
{
|
||||
return volumeType::UNKNOWN;
|
||||
}
|
||||
|
||||
//- Range of local indices that can be returned.
|
||||
virtual label size() const
|
||||
{
|
||||
|
||||
@ -124,6 +124,12 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
//- What is type of points outside bounds
|
||||
virtual volumeType outsideVolumeType() const
|
||||
{
|
||||
return volumeType::OUTSIDE;
|
||||
}
|
||||
|
||||
//- Range of local indices that can be returned.
|
||||
virtual label size() const;
|
||||
|
||||
|
||||
@ -126,6 +126,12 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
//- What is type of points outside bounds
|
||||
virtual volumeType outsideVolumeType() const
|
||||
{
|
||||
return volumeType::UNKNOWN;
|
||||
}
|
||||
|
||||
//- Range of local indices that can be returned.
|
||||
virtual label size() const
|
||||
{
|
||||
|
||||
@ -152,6 +152,12 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
//- What is type of points outside bounds
|
||||
virtual volumeType outsideVolumeType() const
|
||||
{
|
||||
return volumeType::UNKNOWN;
|
||||
}
|
||||
|
||||
//- Range of local indices that can be returned.
|
||||
virtual label size() const
|
||||
{
|
||||
|
||||
@ -131,6 +131,12 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
//- What is type of points outside bounds
|
||||
virtual volumeType outsideVolumeType() const
|
||||
{
|
||||
return volumeType::OUTSIDE;
|
||||
}
|
||||
|
||||
//- Range of local indices that can be returned.
|
||||
virtual label size() const
|
||||
{
|
||||
|
||||
@ -144,6 +144,12 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
//- What is type of points outside bounds
|
||||
virtual volumeType outsideVolumeType() const
|
||||
{
|
||||
return volumeType::OUTSIDE;
|
||||
}
|
||||
|
||||
//- Range of local indices that can be returned.
|
||||
virtual label size() const
|
||||
{
|
||||
|
||||
@ -176,13 +176,13 @@ public:
|
||||
}
|
||||
|
||||
//- Return const reference to boundBox
|
||||
const boundBox& bounds() const
|
||||
virtual const boundBox& bounds() const
|
||||
{
|
||||
return bounds_;
|
||||
}
|
||||
|
||||
//- Return non-const access to the boundBox to allow it to be set.
|
||||
boundBox& bounds()
|
||||
virtual boundBox& bounds()
|
||||
{
|
||||
return bounds_;
|
||||
}
|
||||
@ -194,6 +194,10 @@ public:
|
||||
// This is false for the base class.
|
||||
virtual bool hasVolumeType() const;
|
||||
|
||||
//- If surface supports volume queries, what is type of points outside
|
||||
// bounds
|
||||
virtual volumeType outsideVolumeType() const = 0;
|
||||
|
||||
//- Range of local indices that can be returned
|
||||
virtual label size() const = 0;
|
||||
|
||||
|
||||
@ -181,6 +181,12 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
//- What is type of points outside bounds
|
||||
virtual volumeType outsideVolumeType() const
|
||||
{
|
||||
return volumeType::UNKNOWN;
|
||||
}
|
||||
|
||||
//- Range of local indices that can be returned.
|
||||
virtual label size() const;
|
||||
|
||||
|
||||
@ -166,6 +166,12 @@ public:
|
||||
return surface().hasVolumeType();
|
||||
}
|
||||
|
||||
//- What is type of points outside bounds
|
||||
virtual volumeType outsideVolumeType() const
|
||||
{
|
||||
return surface().outsideVolumeType();
|
||||
}
|
||||
|
||||
//- Range of local indices that can be returned.
|
||||
virtual label size() const
|
||||
{
|
||||
|
||||
@ -71,7 +71,7 @@ Foam::fileName Foam::triSurfaceMesh::checkFile
|
||||
|
||||
Foam::fileName Foam::triSurfaceMesh::relativeFilePath
|
||||
(
|
||||
const regIOobject& io,
|
||||
const IOobject& io,
|
||||
const fileName& f,
|
||||
const bool isGlobal
|
||||
)
|
||||
@ -96,7 +96,7 @@ Foam::fileName Foam::triSurfaceMesh::relativeFilePath
|
||||
|
||||
Foam::fileName Foam::triSurfaceMesh::checkFile
|
||||
(
|
||||
const regIOobject& io,
|
||||
const IOobject& io,
|
||||
const dictionary& dict,
|
||||
const bool isGlobal
|
||||
)
|
||||
@ -156,6 +156,13 @@ bool Foam::triSurfaceMesh::addFaceToEdge
|
||||
|
||||
bool Foam::triSurfaceMesh::isSurfaceClosed() const
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "triSurfaceMesh::isSurfaceClosed:"
|
||||
<< " determining closedness for surface with "
|
||||
<< triSurface::size() << " triangles" << endl;
|
||||
}
|
||||
|
||||
const pointField& pts = triSurface::points();
|
||||
|
||||
// Construct pointFaces. Let's hope surface has compact point
|
||||
@ -196,6 +203,11 @@ bool Foam::triSurfaceMesh::isSurfaceClosed() const
|
||||
|
||||
if (!okFace)
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "triSurfaceMesh::isSurfaceClosed :"
|
||||
<< " surface is open" << endl;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -213,6 +225,11 @@ bool Foam::triSurfaceMesh::isSurfaceClosed() const
|
||||
|
||||
if (!okFace)
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "triSurfaceMesh::isSurfaceClosed :"
|
||||
<< " surface is open" << endl;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -223,11 +240,21 @@ bool Foam::triSurfaceMesh::isSurfaceClosed() const
|
||||
{
|
||||
if (iter.val() != 2)
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "triSurfaceMesh::isSurfaceClosed :"
|
||||
<< " surface is open" << endl;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "triSurfaceMesh::isSurfaceClosed :"
|
||||
<< " surface is closed" << endl;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -358,7 +385,7 @@ Foam::triSurfaceMesh::triSurfaceMesh
|
||||
}
|
||||
|
||||
|
||||
Foam::triSurfaceMesh::triSurfaceMesh(const IOobject& io, const bool isGlobal)
|
||||
Foam::triSurfaceMesh::triSurfaceMesh(const IOobject& io, const readAction r)
|
||||
:
|
||||
// Find instance for triSurfaceMesh
|
||||
searchableSurface(io),
|
||||
@ -376,18 +403,79 @@ Foam::triSurfaceMesh::triSurfaceMesh(const IOobject& io, const bool isGlobal)
|
||||
false // searchableSurface already registered under name
|
||||
)
|
||||
),
|
||||
triSurface
|
||||
(
|
||||
checkFile(static_cast<const searchableSurface&>(*this), isGlobal)
|
||||
),
|
||||
triSurface(), // construct null
|
||||
triSurfaceRegionSearch(static_cast<const triSurface&>(*this)),
|
||||
minQuality_(-1),
|
||||
surfaceClosed_(-1),
|
||||
outsideVolType_(volumeType::UNKNOWN)
|
||||
{
|
||||
const pointField& pts = triSurface::points();
|
||||
// Check IO flags
|
||||
if (io.readOpt() != IOobject::NO_READ)
|
||||
{
|
||||
const bool searchGlobal(r == localOrGlobal || r == masterOnly);
|
||||
|
||||
bounds() = boundBox(pts, isGlobal);
|
||||
const fileName actualFile
|
||||
(
|
||||
searchGlobal
|
||||
? io.globalFilePath(typeName)
|
||||
: io.localFilePath(typeName)
|
||||
);
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "triSurfaceMesh(const IOobject& io) :"
|
||||
<< " loading surface " << io.objectPath()
|
||||
<< " local filePath:" << io.localFilePath(typeName)
|
||||
<< " from:" << actualFile << endl;
|
||||
}
|
||||
|
||||
if (searchGlobal && Pstream::parRun())
|
||||
{
|
||||
// Check where surface was found
|
||||
const fileName localFile(io.localFilePath(typeName));
|
||||
|
||||
if (r == masterOnly && (actualFile != localFile))
|
||||
{
|
||||
// Found undecomposed surface. Load on master only
|
||||
if (Pstream::master())
|
||||
{
|
||||
triSurface s2(actualFile);
|
||||
triSurface::transfer(s2);
|
||||
}
|
||||
Pstream::scatter(triSurface::patches());
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "triSurfaceMesh(const IOobject& io) :"
|
||||
<< " loaded triangles:" << triSurface::size() << endl;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Read on all processors
|
||||
triSurface s2(actualFile);
|
||||
triSurface::transfer(s2);
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "triSurfaceMesh(const IOobject& io) :"
|
||||
<< " loaded triangles:" << triSurface::size() << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Read on all processors
|
||||
triSurface s2(actualFile);
|
||||
triSurface::transfer(s2);
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "triSurfaceMesh(const IOobject& io) :"
|
||||
<< " loaded triangles:" << triSurface::size() << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const pointField& pts = triSurface::points();
|
||||
bounds() = boundBox(pts, false);
|
||||
}
|
||||
|
||||
|
||||
@ -395,7 +483,7 @@ Foam::triSurfaceMesh::triSurfaceMesh
|
||||
(
|
||||
const IOobject& io,
|
||||
const dictionary& dict,
|
||||
const bool isGlobal
|
||||
const readAction r
|
||||
)
|
||||
:
|
||||
searchableSurface(io),
|
||||
@ -413,15 +501,24 @@ Foam::triSurfaceMesh::triSurfaceMesh
|
||||
false // searchableSurface already registered under name
|
||||
)
|
||||
),
|
||||
triSurface
|
||||
(
|
||||
checkFile(static_cast<const searchableSurface&>(*this), dict, isGlobal)
|
||||
),
|
||||
triSurface(), // construct null
|
||||
triSurfaceRegionSearch(static_cast<const triSurface&>(*this), dict),
|
||||
minQuality_(-1),
|
||||
surfaceClosed_(-1),
|
||||
outsideVolType_(volumeType::UNKNOWN)
|
||||
{
|
||||
// Check IO flags
|
||||
if (io.readOpt() != IOobject::NO_READ)
|
||||
{
|
||||
const bool searchGlobal(r == localOrGlobal || r == masterOnly);
|
||||
|
||||
fileName actualFile
|
||||
(
|
||||
searchGlobal
|
||||
? io.globalFilePath(typeName)
|
||||
: io.localFilePath(typeName)
|
||||
);
|
||||
|
||||
// Reading from supplied file name instead of objectPath/filePath
|
||||
if (dict.readIfPresent("file", fName_, keyType::LITERAL))
|
||||
{
|
||||
@ -429,10 +526,66 @@ Foam::triSurfaceMesh::triSurfaceMesh
|
||||
(
|
||||
static_cast<const searchableSurface&>(*this),
|
||||
fName_,
|
||||
isGlobal
|
||||
searchGlobal
|
||||
);
|
||||
actualFile = fName_;
|
||||
}
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "triSurfaceMesh(const IOobject& io, const dictionary&) :"
|
||||
<< " loading surface " << io.objectPath()
|
||||
<< " local filePath:" << io.localFilePath(typeName)
|
||||
<< " from:" << actualFile << endl;
|
||||
}
|
||||
|
||||
if (searchGlobal && Pstream::parRun())
|
||||
{
|
||||
// Check where surface was found
|
||||
const fileName localFile(io.localFilePath(typeName));
|
||||
|
||||
if (r == masterOnly && (actualFile != localFile))
|
||||
{
|
||||
// Surface not loaded from processor directories -> undecomposed
|
||||
// surface. Load on master only
|
||||
if (Pstream::master())
|
||||
{
|
||||
triSurface s2(actualFile);
|
||||
triSurface::transfer(s2);
|
||||
}
|
||||
Pstream::scatter(triSurface::patches());
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "triSurfaceMesh(const IOobject& io) :"
|
||||
<< " loaded triangles:" << triSurface::size() << endl;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Read on all processors
|
||||
triSurface s2(actualFile);
|
||||
triSurface::transfer(s2);
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "triSurfaceMesh(const IOobject& io) :"
|
||||
<< " loaded triangles:" << triSurface::size() << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Read on all processors
|
||||
triSurface s2(actualFile);
|
||||
triSurface::transfer(s2);
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "triSurfaceMesh(const IOobject& io) :"
|
||||
<< " loaded triangles:" << triSurface::size() << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
scalar scaleFactor = 0;
|
||||
|
||||
// Allow rescaling of the surface points
|
||||
@ -445,8 +598,7 @@ Foam::triSurfaceMesh::triSurfaceMesh
|
||||
}
|
||||
|
||||
const pointField& pts = triSurface::points();
|
||||
|
||||
bounds() = boundBox(pts, isGlobal);
|
||||
bounds() = boundBox(pts, false);
|
||||
|
||||
// Have optional minimum quality for normal calculation
|
||||
if (dict.readIfPresent("minQuality", minQuality_) && minQuality_ > 0)
|
||||
@ -468,7 +620,7 @@ Foam::triSurfaceMesh::~triSurfaceMesh()
|
||||
|
||||
void Foam::triSurfaceMesh::clearOut()
|
||||
{
|
||||
outsideVolType_ = volumeType::UNKNOWN;
|
||||
// Do not clear closedness status
|
||||
triSurfaceRegionSearch::clearOut();
|
||||
edgeTree_.clear();
|
||||
triSurface::clearOut();
|
||||
@ -539,7 +691,14 @@ bool Foam::triSurfaceMesh::overlaps(const boundBox& bb) const
|
||||
|
||||
void Foam::triSurfaceMesh::movePoints(const pointField& newPoints)
|
||||
{
|
||||
outsideVolType_ = volumeType::UNKNOWN;
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "triSurfaceMesh::movePoints :"
|
||||
<< " moving at time " << objectRegistry::time().timeName()
|
||||
<< endl;
|
||||
}
|
||||
|
||||
// Preserve topological point status (surfaceClosed_, outsideVolType_)
|
||||
|
||||
// Update local information (instance, event number)
|
||||
searchableSurface::instance() = objectRegistry::time().timeName();
|
||||
@ -555,6 +714,10 @@ void Foam::triSurfaceMesh::movePoints(const pointField& newPoints)
|
||||
triSurface::movePoints(newPoints);
|
||||
|
||||
bounds() = boundBox(triSurface::points(), false);
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "triSurfaceMesh::movePoints: finished moving points" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -563,6 +726,13 @@ Foam::triSurfaceMesh::edgeTree() const
|
||||
{
|
||||
if (edgeTree_.empty())
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "triSurfaceMesh::edgeTree :"
|
||||
<< " constructing tree for " << nEdges() - nInternalEdges()
|
||||
<< " boundary edges" << endl;
|
||||
}
|
||||
|
||||
// Boundary edges
|
||||
labelList bEdges
|
||||
(
|
||||
@ -592,6 +762,13 @@ Foam::triSurfaceMesh::edgeTree() const
|
||||
bb.max() += point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
|
||||
}
|
||||
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "triSurfaceMesh::edgeTree : "
|
||||
<< "calculating edge tree for bb:" << bb << endl;
|
||||
}
|
||||
|
||||
scalar oldTol = indexedOctree<treeDataEdge>::perturbTol();
|
||||
indexedOctree<treeDataEdge>::perturbTol() = tolerance();
|
||||
|
||||
@ -614,6 +791,14 @@ Foam::triSurfaceMesh::edgeTree() const
|
||||
);
|
||||
|
||||
indexedOctree<treeDataEdge>::perturbTol() = oldTol;
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "triSurfaceMesh::edgeTree :"
|
||||
<< " finished constructing tree for "
|
||||
<< nEdges() - nInternalEdges()
|
||||
<< " boundary edges" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
return *edgeTree_;
|
||||
@ -652,6 +837,40 @@ bool Foam::triSurfaceMesh::hasVolumeType() const
|
||||
}
|
||||
|
||||
|
||||
Foam::volumeType Foam::triSurfaceMesh::outsideVolumeType() const
|
||||
{
|
||||
if (outsideVolType_ == volumeType::UNKNOWN)
|
||||
{
|
||||
// Get point outside bounds()
|
||||
const point outsidePt(bounds().max() + 0.5*bounds().span());
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "triSurfaceMesh::outsideVolumeType :"
|
||||
<< " triggering outsidePoint:" << outsidePt
|
||||
<< " orientation" << endl;
|
||||
}
|
||||
|
||||
//outsideVolType_ = tree().shapes().getVolumeType(tree(), outsidePt);
|
||||
// Note: do not use tree directly so e.g. distributedTriSurfaceMesh
|
||||
// has opportunity to intercept
|
||||
List<volumeType> outsideVolTypes;
|
||||
getVolumeType(pointField(1, outsidePt), outsideVolTypes);
|
||||
outsideVolType_ = outsideVolTypes[0];
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "triSurfaceMesh::outsideVolumeType :"
|
||||
<< " finished outsidePoint:" << outsidePt
|
||||
<< " orientation:" << volumeType::names[outsideVolType_]
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
|
||||
return outsideVolType_;
|
||||
}
|
||||
|
||||
|
||||
void Foam::triSurfaceMesh::findNearest
|
||||
(
|
||||
const pointField& samples,
|
||||
@ -659,7 +878,21 @@ void Foam::triSurfaceMesh::findNearest
|
||||
List<pointIndexHit>& info
|
||||
) const
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "triSurfaceMesh::findNearest :"
|
||||
<< " trying to find nearest for " << samples.size()
|
||||
<< " samples with max sphere "
|
||||
<< (samples.size() ? Foam::sqrt(max(nearestDistSqr)) : Zero)
|
||||
<< endl;
|
||||
}
|
||||
triSurfaceSearch::findNearest(samples, nearestDistSqr, info);
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "triSurfaceMesh::findNearest :"
|
||||
<< " finished trying to find nearest for " << samples.size()
|
||||
<< " samples" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -671,6 +904,14 @@ void Foam::triSurfaceMesh::findNearest
|
||||
List<pointIndexHit>& info
|
||||
) const
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "triSurfaceMesh::findNearest :"
|
||||
<< " trying to find nearest and region for " << samples.size()
|
||||
<< " samples with max sphere "
|
||||
<< (samples.size() ? Foam::sqrt(max(nearestDistSqr)) : Zero)
|
||||
<< endl;
|
||||
}
|
||||
triSurfaceRegionSearch::findNearest
|
||||
(
|
||||
samples,
|
||||
@ -678,6 +919,12 @@ void Foam::triSurfaceMesh::findNearest
|
||||
regionIndices,
|
||||
info
|
||||
);
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "triSurfaceMesh::findNearest :"
|
||||
<< " finished trying to find nearest and region for "
|
||||
<< samples.size() << " samples" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -688,7 +935,19 @@ void Foam::triSurfaceMesh::findLine
|
||||
List<pointIndexHit>& info
|
||||
) const
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "triSurfaceMesh::findLine :"
|
||||
<< " intersecting with "
|
||||
<< start.size() << " rays" << endl;
|
||||
}
|
||||
triSurfaceSearch::findLine(start, end, info);
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "triSurfaceMesh::findLine :"
|
||||
<< " finished intersecting with "
|
||||
<< start.size() << " rays" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -699,7 +958,19 @@ void Foam::triSurfaceMesh::findLineAny
|
||||
List<pointIndexHit>& info
|
||||
) const
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "triSurfaceMesh::findLineAny :"
|
||||
<< " intersecting with "
|
||||
<< start.size() << " rays" << endl;
|
||||
}
|
||||
triSurfaceSearch::findLineAny(start, end, info);
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "triSurfaceMesh::findLineAny :"
|
||||
<< " finished intersecting with "
|
||||
<< start.size() << " rays" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -710,7 +981,19 @@ void Foam::triSurfaceMesh::findLineAll
|
||||
List<List<pointIndexHit>>& info
|
||||
) const
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "triSurfaceMesh::findLineAll :"
|
||||
<< " intersecting with "
|
||||
<< start.size() << " rays" << endl;
|
||||
}
|
||||
triSurfaceSearch::findLineAll(start, end, info);
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "triSurfaceMesh::findLineAll :"
|
||||
<< " finished intersecting with "
|
||||
<< start.size() << " rays" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -720,6 +1003,12 @@ void Foam::triSurfaceMesh::getRegion
|
||||
labelList& region
|
||||
) const
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "triSurfaceMesh::getRegion :"
|
||||
<< " getting region for "
|
||||
<< info.size() << " triangles" << endl;
|
||||
}
|
||||
region.setSize(info.size());
|
||||
forAll(info, i)
|
||||
{
|
||||
@ -732,6 +1021,12 @@ void Foam::triSurfaceMesh::getRegion
|
||||
region[i] = -1;
|
||||
}
|
||||
}
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "triSurfaceMesh::getRegion :"
|
||||
<< " finished getting region for "
|
||||
<< info.size() << " triangles" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -741,6 +1036,13 @@ void Foam::triSurfaceMesh::getNormal
|
||||
vectorField& normal
|
||||
) const
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "triSurfaceMesh::getNormal :"
|
||||
<< " getting normal for "
|
||||
<< info.size() << " triangles" << endl;
|
||||
}
|
||||
|
||||
const triSurface& s = *this;
|
||||
const pointField& pts = s.points();
|
||||
|
||||
@ -803,6 +1105,12 @@ void Foam::triSurfaceMesh::getNormal
|
||||
}
|
||||
}
|
||||
}
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "triSurfaceMesh::getNormal :"
|
||||
<< " finished getting normal for "
|
||||
<< info.size() << " triangles" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -835,6 +1143,12 @@ void Foam::triSurfaceMesh::setField(const labelList& values)
|
||||
// Store field on triMesh
|
||||
fldPtr->store();
|
||||
}
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "triSurfaceMesh::setField :"
|
||||
<< " finished setting field for "
|
||||
<< values.size() << " triangles" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -860,6 +1174,12 @@ void Foam::triSurfaceMesh::getField
|
||||
}
|
||||
}
|
||||
}
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "triSurfaceMesh::setField :"
|
||||
<< " finished getting field for "
|
||||
<< info.size() << " triangles" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -872,6 +1192,13 @@ void Foam::triSurfaceMesh::getVolumeType
|
||||
const scalar oldTol = indexedOctree<treeDataTriSurface>::perturbTol();
|
||||
indexedOctree<treeDataTriSurface>::perturbTol() = tolerance();
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "triSurfaceMesh::getVolumeType :"
|
||||
<< " finding orientation for " << points.size()
|
||||
<< " samples" << endl;
|
||||
}
|
||||
|
||||
volType.setSize(points.size());
|
||||
|
||||
forAll(points, pointi)
|
||||
@ -900,6 +1227,12 @@ void Foam::triSurfaceMesh::getVolumeType
|
||||
}
|
||||
|
||||
indexedOctree<treeDataTriSurface>::perturbTol() = oldTol;
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "triSurfaceMesh::getVolumeType :"
|
||||
<< " finished finding orientation for " << points.size()
|
||||
<< " samples" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -52,8 +52,8 @@ SourceFiles
|
||||
#ifndef triSurfaceMesh_H
|
||||
#define triSurfaceMesh_H
|
||||
|
||||
#include "treeBoundBox.H"
|
||||
#include "searchableSurface.H"
|
||||
#include "treeBoundBox.H"
|
||||
#include "objectRegistry.H"
|
||||
#include "indexedOctree.H"
|
||||
#include "treeDataTriSurface.H"
|
||||
@ -79,6 +79,8 @@ class triSurfaceMesh
|
||||
public triSurface,
|
||||
public triSurfaceRegionSearch
|
||||
{
|
||||
protected:
|
||||
|
||||
// Private member data
|
||||
|
||||
//- Supplied fileName override
|
||||
@ -110,7 +112,7 @@ class triSurfaceMesh
|
||||
// IOobject
|
||||
static fileName relativeFilePath
|
||||
(
|
||||
const regIOobject&,
|
||||
const IOobject&,
|
||||
const fileName&,
|
||||
const bool isGlobal
|
||||
);
|
||||
@ -118,7 +120,7 @@ class triSurfaceMesh
|
||||
//- Return fileName to load IOobject from. Optional override of fileName
|
||||
static fileName checkFile
|
||||
(
|
||||
const regIOobject&,
|
||||
const IOobject&,
|
||||
const dictionary&,
|
||||
const bool isGlobal
|
||||
);
|
||||
@ -179,15 +181,22 @@ public:
|
||||
|
||||
|
||||
// Special constructors for use by distributedTriSurface. File search
|
||||
// status (local/global) supplied.
|
||||
// method supplied:
|
||||
|
||||
triSurfaceMesh(const IOobject& io, const bool isGlobal);
|
||||
enum readAction
|
||||
{
|
||||
localOnly, // load from (processor-)local file only
|
||||
localOrGlobal, // load from (processor-)local or global file
|
||||
masterOnly // as localOrGlobal but only load on master
|
||||
};
|
||||
|
||||
triSurfaceMesh(const IOobject& io, const readAction r);
|
||||
|
||||
triSurfaceMesh
|
||||
(
|
||||
const IOobject& io,
|
||||
const dictionary& dict,
|
||||
const bool isGlobal
|
||||
const readAction r
|
||||
);
|
||||
|
||||
|
||||
@ -216,6 +225,9 @@ public:
|
||||
//- Whether supports volume type (below) - i.e. whether is closed.
|
||||
virtual bool hasVolumeType() const;
|
||||
|
||||
//- If surface is closed, what is type of points outside bounds
|
||||
virtual volumeType outsideVolumeType() const;
|
||||
|
||||
//- Range of local indices that can be returned.
|
||||
virtual label size() const
|
||||
{
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2015-2018 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
| Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
@ -42,6 +42,15 @@ Description
|
||||
more communication.
|
||||
- frozen : no change
|
||||
|
||||
Note: addressing used:
|
||||
distributedTriSurfaceMesh: none
|
||||
|
||||
triSurfaceMesh:
|
||||
- surf.pointFaces() : edge addressing (for volume tests only)
|
||||
- surf.edges() : edgeTree
|
||||
- surf.faceFaces() : only if minQuality > 0
|
||||
|
||||
|
||||
SourceFiles
|
||||
distributedTriSurfaceMesh.C
|
||||
|
||||
@ -55,6 +64,7 @@ SourceFiles
|
||||
#include "IOdictionary.H"
|
||||
#include "Pair.H"
|
||||
#include "globalIndex.H"
|
||||
#include "DynamicField.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -86,7 +96,8 @@ public:
|
||||
{
|
||||
FOLLOW = 0,
|
||||
INDEPENDENT = 1,
|
||||
FROZEN = 2
|
||||
DISTRIBUTED = 2,
|
||||
FROZEN = 3
|
||||
};
|
||||
|
||||
static const Enum<distributionType> distributionTypeNames_;
|
||||
@ -112,14 +123,22 @@ private:
|
||||
//- Global triangle numbering
|
||||
mutable autoPtr<globalIndex> globalTris_;
|
||||
|
||||
//- The distribution type.
|
||||
//- The (wanted) distribution type.
|
||||
distributionType distType_;
|
||||
|
||||
//- The (current) distribution type. Used to trigger re-distribution
|
||||
// when starting from undecomposed surface.
|
||||
distributionType currentDistType_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
// Read
|
||||
|
||||
//- Search for io.local directory (=triSurface) either in case
|
||||
// directory or in parent directory
|
||||
static word findLocalInstance(const IOobject& io);
|
||||
|
||||
//- Read my additional data
|
||||
bool read();
|
||||
|
||||
@ -183,6 +202,9 @@ private:
|
||||
|
||||
// Triangle index
|
||||
|
||||
//- Helper: convert local triangle indices to global ones
|
||||
void convertTriIndices(List<pointIndexHit>& info) const;
|
||||
|
||||
//- Obtains global indices from pointIndexHit and swaps them back
|
||||
// to their original processor. Used to calculate local region
|
||||
// and normal.
|
||||
@ -195,6 +217,24 @@ private:
|
||||
|
||||
// Nearest
|
||||
|
||||
//- Is location inside any of the bounding boxes
|
||||
bool contains
|
||||
(
|
||||
const List<treeBoundBox>& bbs,
|
||||
const point& sample
|
||||
) const;
|
||||
|
||||
//- Is location inside any of the processors bb or if not
|
||||
// does it overlap
|
||||
Tuple2<label, scalar> findBestProcs
|
||||
(
|
||||
const point& centre,
|
||||
const scalar radiusSqr,
|
||||
boolList& procContains,
|
||||
boolList& procOverlaps,
|
||||
label& minProci
|
||||
) const;
|
||||
|
||||
label calcOverlappingProcs
|
||||
(
|
||||
const point& centre,
|
||||
@ -202,8 +242,10 @@ private:
|
||||
boolList& overlaps
|
||||
) const;
|
||||
|
||||
//- Calculate map to send centres+radius to processors
|
||||
autoPtr<mapDistribute> calcLocalQueries
|
||||
(
|
||||
const bool includeLocalProcessor,
|
||||
const pointField& centres,
|
||||
const scalarField& radiusSqr,
|
||||
|
||||
@ -213,8 +255,71 @@ private:
|
||||
) const;
|
||||
|
||||
|
||||
// Side
|
||||
|
||||
//- Side of nearest point w.r.t. edge between face0 and face1
|
||||
volumeType edgeSide
|
||||
(
|
||||
const point& sample,
|
||||
const point& nearestPoint,
|
||||
const label face0,
|
||||
const label face1
|
||||
) const;
|
||||
|
||||
//- Find edge-connected face
|
||||
label findOtherFace
|
||||
(
|
||||
const labelListList& pointFaces,
|
||||
const label nearFacei,
|
||||
const label nearLabel
|
||||
) const;
|
||||
|
||||
//- Side of nearest point on faces w.r.t. samples. Handles nearest
|
||||
// on edge/point
|
||||
void surfaceSide
|
||||
(
|
||||
const pointField& samples,
|
||||
const List<pointIndexHit>& nearestInfo,
|
||||
List<volumeType>& region
|
||||
) const;
|
||||
|
||||
|
||||
// Caching of volume type (based on indexedOctree)
|
||||
|
||||
//- Collect mid points of tree boxes
|
||||
void collectLeafMids
|
||||
(
|
||||
const label nodeI,
|
||||
DynamicField<point>& midPoints
|
||||
) const;
|
||||
|
||||
//- Find volume type of tree boxes
|
||||
volumeType calcVolumeType
|
||||
(
|
||||
const List<volumeType>& midPointTypes,
|
||||
label& index,
|
||||
PackedList<2>& nodeTypes,
|
||||
const label nodeI
|
||||
) const;
|
||||
|
||||
//- Look up any cached data. Return unknown if cannot be determined.
|
||||
volumeType cachedVolumeType
|
||||
(
|
||||
const label nodeI,
|
||||
const point& sample
|
||||
) const;
|
||||
|
||||
|
||||
// Surface redistribution
|
||||
|
||||
//- Calculate face-faces
|
||||
static void calcFaceFaces
|
||||
(
|
||||
const triSurface& s,
|
||||
const labelListList& pointFaces,
|
||||
labelListList& faceFaces
|
||||
);
|
||||
|
||||
//- Finds new bounds based on an independent decomposition.
|
||||
List<List<treeBoundBox>> independentlyDistributedBbs
|
||||
(
|
||||
@ -344,13 +449,6 @@ public:
|
||||
|
||||
// searchableSurface implementation
|
||||
|
||||
//- Whether supports volume type below. I.e. whether is closed.
|
||||
// Not supported.
|
||||
virtual bool hasVolumeType() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//- Range of global indices that can be returned.
|
||||
virtual label globalSize() const
|
||||
{
|
||||
@ -364,6 +462,16 @@ public:
|
||||
List<pointIndexHit>&
|
||||
) const;
|
||||
|
||||
//- Find the nearest locations for the supplied points to a
|
||||
// particular region in the searchable surface.
|
||||
virtual void findNearest
|
||||
(
|
||||
const pointField& samples,
|
||||
const scalarField& nearestDistSqr,
|
||||
const labelList& regionIndices,
|
||||
List<pointIndexHit>& info
|
||||
) const;
|
||||
|
||||
virtual void findLine
|
||||
(
|
||||
const pointField& start,
|
||||
@ -434,6 +542,14 @@ public:
|
||||
// indices) get the specified field. Misses do not get set.
|
||||
virtual void getField(const List<pointIndexHit>&, labelList&) const;
|
||||
|
||||
//- Calculate the triangles that are overlapping bounds.
|
||||
static void overlappingSurface
|
||||
(
|
||||
const triSurface&,
|
||||
const List<treeBoundBox>&,
|
||||
boolList& includedFace
|
||||
);
|
||||
|
||||
//- Subset the part of surface that is overlapping bounds.
|
||||
static triSurface overlappingSurface
|
||||
(
|
||||
|
||||
@ -19,7 +19,8 @@ runApplication $decompDict decomposePar
|
||||
if foamDictionary -entry geometry -value system/snappyHexMeshDict | \
|
||||
grep -q distributedTriSurfaceMesh
|
||||
then
|
||||
runParallel $decompDict surfaceRedistributePar motorBike.obj independent
|
||||
echo "surfaceRedistributePar does not need to be run anymore"
|
||||
echo " - distributedTriSurfaceMesh will do on-the-fly redistribution"
|
||||
fi
|
||||
|
||||
runParallel $decompDict snappyHexMesh -overwrite
|
||||
|
||||
9
tutorials/mesh/snappyHexMesh/distributedTriSurfaceMesh/Allclean
Executable file
9
tutorials/mesh/snappyHexMesh/distributedTriSurfaceMesh/Allclean
Executable file
@ -0,0 +1,9 @@
|
||||
#!/bin/sh
|
||||
cd ${0%/*} || exit 1 # Run from this directory
|
||||
. $WM_PROJECT_DIR/bin/tools/CleanFunctions # Tutorial clean functions
|
||||
|
||||
cleanCase
|
||||
|
||||
(cd constant/triSurface && rm -f box_12_*.obj box.obj box_trans.obj)
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
53
tutorials/mesh/snappyHexMesh/distributedTriSurfaceMesh/Allrun
Executable file
53
tutorials/mesh/snappyHexMesh/distributedTriSurfaceMesh/Allrun
Executable file
@ -0,0 +1,53 @@
|
||||
#!/bin/sh
|
||||
cd ${0%/*} || exit 1 # Run from this directory
|
||||
. $WM_PROJECT_DIR/bin/tools/RunFunctions # Tutorial run functions
|
||||
|
||||
runApplication blockMesh
|
||||
|
||||
# Create fine surface
|
||||
runApplication -s 1 surfaceRefineRedGreen \
|
||||
constant/triSurface/box_12.obj constant/triSurface/box_12_1.obj
|
||||
|
||||
runApplication -s 2 surfaceRefineRedGreen \
|
||||
constant/triSurface/box_12_1.obj constant/triSurface/box_12_2.obj
|
||||
|
||||
runApplication -s 3 surfaceRefineRedGreen \
|
||||
constant/triSurface/box_12_2.obj constant/triSurface/box_12_3.obj
|
||||
|
||||
runApplication -s 4 surfaceRefineRedGreen \
|
||||
constant/triSurface/box_12_3.obj constant/triSurface/box_12_4.obj
|
||||
|
||||
runApplication -s 5 surfaceRefineRedGreen \
|
||||
constant/triSurface/box_12_4.obj constant/triSurface/box_12_5.obj
|
||||
|
||||
runApplication -s 6 surfaceRefineRedGreen \
|
||||
constant/triSurface/box_12_5.obj constant/triSurface/box_12_6.obj
|
||||
|
||||
runApplication -s 7 surfaceRefineRedGreen \
|
||||
constant/triSurface/box_12_6.obj constant/triSurface/box_12_7.obj
|
||||
|
||||
runApplication -s 8 surfaceRefineRedGreen \
|
||||
constant/triSurface/box_12_7.obj constant/triSurface/box_12_8.obj
|
||||
|
||||
runApplication -s 9 surfaceRefineRedGreen \
|
||||
constant/triSurface/box_12_8.obj constant/triSurface/box_12_9.obj
|
||||
|
||||
runApplication -s 10 surfaceRefineRedGreen \
|
||||
constant/triSurface/box_12_9.obj constant/triSurface/box.obj
|
||||
|
||||
|
||||
runApplication surfaceTransformPoints \
|
||||
-rotate '((1 0 0)(1 0.8 0.9))' \
|
||||
-translate '(0.1 0.101 0.103)' \
|
||||
constant/triSurface/box.obj constant/triSurface/box_trans.obj
|
||||
|
||||
|
||||
# Run non-parallel
|
||||
runApplication snappyHexMesh
|
||||
|
||||
# Run parallel
|
||||
runApplication decomposePar
|
||||
|
||||
runParallel -s parallel snappyHexMesh
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
@ -0,0 +1,34 @@
|
||||
# Wavefront OBJ file written 2018-09-13T12:59:07
|
||||
o box_12
|
||||
|
||||
# points : 8
|
||||
# faces : 12
|
||||
# zones : 1
|
||||
# 0 patch0 (nFaces: 12)
|
||||
|
||||
# <points count="8">
|
||||
v -0.420753 -0.63726 -0.408494
|
||||
v 0.228766 -0.76226 0.341506
|
||||
v 0.420753 0.63726 0.408494
|
||||
v -0.228766 0.76226 -0.341506
|
||||
v -0.204247 -0.0122595 0.841506
|
||||
v 0.204247 0.0122595 -0.841506
|
||||
v -0.853766 0.11274 0.0915064
|
||||
v 0.853766 -0.11274 -0.0915064
|
||||
# </points>
|
||||
|
||||
# <faces count="12">
|
||||
g patch0
|
||||
f 7 1 5
|
||||
f 2 5 1
|
||||
f 8 6 3
|
||||
f 4 3 6
|
||||
f 8 2 6
|
||||
f 1 6 2
|
||||
f 7 5 4
|
||||
f 3 4 5
|
||||
f 4 6 7
|
||||
f 1 7 6
|
||||
f 2 8 5
|
||||
f 3 5 8
|
||||
# </faces>
|
||||
@ -0,0 +1,98 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v1806 |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object blockMeshDict;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
scale 1;
|
||||
|
||||
vertices
|
||||
(
|
||||
(-1 -1 -1)
|
||||
( 1 -1 -1)
|
||||
( 1 1 -1)
|
||||
(-1 1 -1)
|
||||
(-1 -1 1)
|
||||
( 1 -1 1)
|
||||
( 1 1 1)
|
||||
(-1 1 1)
|
||||
);
|
||||
|
||||
blocks
|
||||
(
|
||||
hex (0 1 2 3 4 5 6 7) (4 4 4) simpleGrading (1 1 1)
|
||||
);
|
||||
|
||||
edges
|
||||
(
|
||||
);
|
||||
|
||||
boundary
|
||||
(
|
||||
maxY
|
||||
{
|
||||
type patch;
|
||||
faces
|
||||
(
|
||||
(3 7 6 2)
|
||||
);
|
||||
}
|
||||
|
||||
minX
|
||||
{
|
||||
type patch;
|
||||
faces
|
||||
(
|
||||
(0 4 7 3)
|
||||
);
|
||||
}
|
||||
|
||||
maxX
|
||||
{
|
||||
type patch;
|
||||
faces
|
||||
(
|
||||
(2 6 5 1)
|
||||
);
|
||||
}
|
||||
|
||||
minY
|
||||
{
|
||||
type patch;
|
||||
faces
|
||||
(
|
||||
(1 5 4 0)
|
||||
);
|
||||
}
|
||||
|
||||
minZ
|
||||
{
|
||||
type patch;
|
||||
faces
|
||||
(
|
||||
(0 3 2 1)
|
||||
);
|
||||
}
|
||||
|
||||
maxZ
|
||||
{
|
||||
type patch;
|
||||
faces
|
||||
(
|
||||
(4 5 6 7)
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,57 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v1806 s |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
location "system";
|
||||
object controlDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
DebugSwitches
|
||||
{
|
||||
//triSurfaceMesh 1;
|
||||
//distributedTriSurfaceMesh 1;
|
||||
//triSurface 1;
|
||||
//PrimitivePatch 1;
|
||||
}
|
||||
|
||||
application snappyHexMesh;
|
||||
|
||||
startFrom startTime;
|
||||
|
||||
startTime 0;
|
||||
|
||||
stopAt endTime;
|
||||
|
||||
endTime 2000;
|
||||
|
||||
deltaT 1;
|
||||
|
||||
writeControl timeStep;
|
||||
|
||||
writeInterval 100;
|
||||
|
||||
purgeWrite 0;
|
||||
|
||||
writeFormat binary;
|
||||
|
||||
writePrecision 6;
|
||||
|
||||
writeCompression off;
|
||||
|
||||
timeFormat general;
|
||||
|
||||
timePrecision 6;
|
||||
|
||||
runTimeModifiable true;
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,27 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v1806 |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object decomposeParDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
numberOfSubdomains 8;
|
||||
|
||||
method hierarchical;
|
||||
|
||||
coeffs
|
||||
{
|
||||
n (2 2 2);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,57 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v1806 |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
location "system";
|
||||
object fvSchemes;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
ddtSchemes
|
||||
{
|
||||
default steadyState;
|
||||
}
|
||||
|
||||
gradSchemes
|
||||
{
|
||||
default Gauss linear;
|
||||
}
|
||||
|
||||
divSchemes
|
||||
{
|
||||
default none;
|
||||
|
||||
div(phi,U) bounded Gauss upwind;
|
||||
div(phi,T) bounded Gauss upwind;
|
||||
div(phi,k) bounded Gauss upwind;
|
||||
div(phi,epsilon) bounded Gauss upwind;
|
||||
div(phi,R) bounded Gauss upwind;
|
||||
div(R) Gauss linear;
|
||||
div((nuEff*dev(T(grad(U))))) Gauss linear;
|
||||
}
|
||||
|
||||
laplacianSchemes
|
||||
{
|
||||
default Gauss linear limited corrected 0.333;
|
||||
}
|
||||
|
||||
interpolationSchemes
|
||||
{
|
||||
default linear;
|
||||
}
|
||||
|
||||
snGradSchemes
|
||||
{
|
||||
default limited corrected 0.333;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,69 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v1806 |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
location "system";
|
||||
object fvSolution;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
solvers
|
||||
{
|
||||
p_rgh
|
||||
{
|
||||
solver PCG;
|
||||
preconditioner DIC;
|
||||
tolerance 1e-08;
|
||||
relTol 0.01;
|
||||
}
|
||||
|
||||
"(U|T|k|epsilon)"
|
||||
{
|
||||
solver PBiCGStab;
|
||||
preconditioner DILU;
|
||||
tolerance 1e-07;
|
||||
relTol 0.1;
|
||||
}
|
||||
}
|
||||
|
||||
SIMPLE
|
||||
{
|
||||
nNonOrthogonalCorrectors 2;
|
||||
pRefCell 0;
|
||||
pRefValue 0;
|
||||
|
||||
residualControl
|
||||
{
|
||||
p_rgh 1e-2;
|
||||
U 1e-4;
|
||||
T 1e-3;
|
||||
|
||||
// possibly check turbulence fields
|
||||
"(k|epsilon|omega)" 1e-3;
|
||||
}
|
||||
}
|
||||
|
||||
relaxationFactors
|
||||
{
|
||||
fields
|
||||
{
|
||||
p_rgh 0.7;
|
||||
}
|
||||
equations
|
||||
{
|
||||
U 0.2;
|
||||
T 0.5;
|
||||
"(k|epsilon)" 0.7;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,21 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v1806 |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object meshQualityDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// Include defaults parameters from master dictionary
|
||||
#includeEtc "caseDicts/meshQualityDict"
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,287 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v1806 |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object snappyHexMeshDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// Which of the steps to run
|
||||
castellatedMesh true;
|
||||
snap true;
|
||||
addLayers false;
|
||||
|
||||
|
||||
// Geometry. Definition of all surfaces. All surfaces are of class
|
||||
// searchableSurface.
|
||||
// Surfaces are used
|
||||
// - to specify refinement for any mesh cell intersecting it
|
||||
// - to specify refinement for any mesh cell inside/outside/near
|
||||
// - to 'snap' the mesh boundary to the surface
|
||||
geometry
|
||||
{
|
||||
box
|
||||
{
|
||||
type distributedTriSurfaceMesh;
|
||||
file "box.obj"; //"box_12_2.obj";
|
||||
}
|
||||
box_trans
|
||||
{
|
||||
file "box_trans.obj";
|
||||
type distributedTriSurfaceMesh;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
// Settings for the castellatedMesh generation.
|
||||
castellatedMeshControls
|
||||
{
|
||||
|
||||
// Refinement parameters
|
||||
// ~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
// If local number of cells is >= maxLocalCells on any processor
|
||||
// switches from from refinement followed by balancing
|
||||
// (current method) to (weighted) balancing before refinement.
|
||||
maxLocalCells 100000;
|
||||
|
||||
// Overall cell limit (approximately). Refinement will stop immediately
|
||||
// upon reaching this number so a refinement level might not complete.
|
||||
// Note that this is the number of cells before removing the part which
|
||||
// is not 'visible' from the keepPoint. The final number of cells might
|
||||
// actually be a lot less.
|
||||
maxGlobalCells 20000000;
|
||||
|
||||
// The surface refinement loop might spend lots of iterations refining just a
|
||||
// few cells. This setting will cause refinement to stop if <= minimumRefine
|
||||
// are selected for refinement. Note: it will at least do one iteration
|
||||
// (unless the number of cells to refine is 0)
|
||||
minRefinementCells 0;
|
||||
|
||||
// Number of buffer layers between different levels.
|
||||
// 1 means normal 2:1 refinement restriction, larger means slower
|
||||
// refinement.
|
||||
nCellsBetweenLevels 1;
|
||||
|
||||
|
||||
|
||||
// Explicit feature edge refinement
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
// Specifies a level for any cell intersected by its edges.
|
||||
// This is a featureEdgeMesh, read from constant/triSurface for now.
|
||||
features
|
||||
(
|
||||
);
|
||||
|
||||
|
||||
|
||||
// Surface based refinement
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
// Specifies two levels for every surface. The first is the minimum level,
|
||||
// every cell intersecting a surface gets refined up to the minimum level.
|
||||
// The second level is the maximum level. Cells that 'see' multiple
|
||||
// intersections where the intersections make an
|
||||
// angle > resolveFeatureAngle get refined up to the maximum level.
|
||||
|
||||
refinementSurfaces
|
||||
{
|
||||
box
|
||||
{
|
||||
// Surface-wise min and max refinement level
|
||||
level (4 4);
|
||||
}
|
||||
box_trans
|
||||
{
|
||||
level (5 5);
|
||||
faceZone box_trans;
|
||||
cellZone box_trans;
|
||||
cellZoneInside inside;
|
||||
}
|
||||
}
|
||||
|
||||
// Resolve sharp angles
|
||||
resolveFeatureAngle 60;
|
||||
|
||||
|
||||
// Region-wise refinement
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
// Specifies refinement level for cells in relation to a surface. One of
|
||||
// three modes
|
||||
// - distance. 'levels' specifies per distance to the surface the
|
||||
// wanted refinement level. The distances need to be specified in
|
||||
// descending order.
|
||||
// - inside. 'levels' is only one entry and only the level is used. All
|
||||
// cells inside the surface get refined up to the level. The surface
|
||||
// needs to be closed for this to be possible.
|
||||
// - outside. Same but cells outside.
|
||||
|
||||
refinementRegions
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// Mesh selection
|
||||
// ~~~~~~~~~~~~~~
|
||||
|
||||
// After refinement patches get added for all refinementSurfaces and
|
||||
// all cells intersecting the surfaces get put into these patches. The
|
||||
// section reachable from the locationInMesh is kept.
|
||||
// NOTE: This point should never be on a face, always inside a cell, even
|
||||
// after refinement.
|
||||
locationInMesh (1e-5 1e-5 1e-5);
|
||||
|
||||
|
||||
// Whether any faceZones (as specified in the refinementSurfaces)
|
||||
// are only on the boundary of corresponding cellZones or also allow
|
||||
// free-standing zone faces. Not used if there are no faceZones.
|
||||
allowFreeStandingZoneFaces false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Settings for the snapping.
|
||||
snapControls
|
||||
{
|
||||
//- Number of patch smoothing iterations before finding correspondence
|
||||
// to surface
|
||||
nSmoothPatch 3;
|
||||
|
||||
//- Relative distance for points to be attracted by surface feature point
|
||||
// or edge. True distance is this factor times local
|
||||
// maximum edge length.
|
||||
tolerance 1.0;
|
||||
|
||||
//- Number of mesh displacement relaxation iterations.
|
||||
nSolveIter 30;
|
||||
|
||||
//- Maximum number of snapping relaxation iterations. Should stop
|
||||
// before upon reaching a correct mesh.
|
||||
nRelaxIter 5;
|
||||
|
||||
|
||||
// Feature snapping
|
||||
|
||||
//- Number of feature edge snapping iterations.
|
||||
// Leave out altogether to disable.
|
||||
nFeatureSnapIter 2;
|
||||
|
||||
//- Detect (geometric) features by sampling the surface (default=false)
|
||||
implicitFeatureSnap true;
|
||||
|
||||
//- Use castellatedMeshControls::features (default = true)
|
||||
explicitFeatureSnap false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Settings for the layer addition.
|
||||
addLayersControls
|
||||
{
|
||||
// Are the thickness parameters below relative to the undistorted
|
||||
// size of the refined cell outside layer (true) or absolute sizes (false).
|
||||
relativeSizes true;
|
||||
|
||||
// Per final patch (so not geometry!) the layer information
|
||||
layers
|
||||
{
|
||||
}
|
||||
|
||||
// Expansion factor for layer mesh
|
||||
expansionRatio 1.0;
|
||||
|
||||
// Wanted thickness of final added cell layer. If multiple layers
|
||||
// is the thickness of the layer furthest away from the wall.
|
||||
// Relative to undistorted size of cell outside layer.
|
||||
// is the thickness of the layer furthest away from the wall.
|
||||
// See relativeSizes parameter.
|
||||
finalLayerThickness 0.5;
|
||||
|
||||
// Minimum thickness of cell layer. If for any reason layer
|
||||
// cannot be above minThickness do not add layer.
|
||||
// Relative to undistorted size of cell outside layer.
|
||||
// See relativeSizes parameter.
|
||||
minThickness 0.25;
|
||||
|
||||
// If points get not extruded do nGrow layers of connected faces that are
|
||||
// also not grown. This helps convergence of the layer addition process
|
||||
// close to features.
|
||||
// Note: changed(corrected) w.r.t 1.7.x! (didn't do anything in 1.7.x)
|
||||
nGrow 0;
|
||||
|
||||
|
||||
// Advanced settings
|
||||
|
||||
// When not to extrude surface. 0 is flat surface, 90 is when two faces
|
||||
// are perpendicular
|
||||
featureAngle 60;
|
||||
|
||||
// Maximum number of snapping relaxation iterations. Should stop
|
||||
// before upon reaching a correct mesh.
|
||||
nRelaxIter 5;
|
||||
|
||||
// Number of smoothing iterations of surface normals
|
||||
nSmoothSurfaceNormals 1;
|
||||
|
||||
// Number of smoothing iterations of interior mesh movement direction
|
||||
nSmoothNormals 3;
|
||||
|
||||
// Smooth layer thickness over surface patches
|
||||
nSmoothThickness 10;
|
||||
|
||||
// Stop layer growth on highly warped cells
|
||||
maxFaceThicknessRatio 0.5;
|
||||
|
||||
// Reduce layer growth where ratio thickness to medial
|
||||
// distance is large
|
||||
maxThicknessToMedialRatio 0.3;
|
||||
|
||||
// Angle used to pick up medial axis points
|
||||
// Note: changed(corrected) w.r.t 16x! 90 degrees corresponds to 130 in 16x.
|
||||
minMedianAxisAngle 90;
|
||||
|
||||
// Create buffer region for new layer terminations
|
||||
nBufferCellsNoExtrude 0;
|
||||
|
||||
|
||||
// Overall max number of layer addition iterations. The mesher will exit
|
||||
// if it reaches this number of iterations; possibly with an illegal
|
||||
// mesh.
|
||||
nLayerIter 50;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Generic mesh quality settings. At any undoable phase these determine
|
||||
// where to undo.
|
||||
meshQualityControls
|
||||
{
|
||||
#include "meshQualityDict"
|
||||
|
||||
// Advanced
|
||||
|
||||
//- Number of error distribution iterations
|
||||
nSmoothScale 4;
|
||||
//- amount to scale back displacement at error points
|
||||
errorReduction 0.75;
|
||||
}
|
||||
|
||||
|
||||
// Advanced
|
||||
|
||||
// Merge tolerance. Is fraction of overall bounding box of initial mesh.
|
||||
// Note: the write tolerance needs to be higher than this.
|
||||
mergeTolerance 1e-6;
|
||||
|
||||
// ************************************************************************* //
|
||||
Reference in New Issue
Block a user