mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'cvm' of /home/noisy3/OpenFOAM/OpenFOAM-dev into cvm
This commit is contained in:
@ -302,6 +302,7 @@ DebugSwitches
|
||||
ash 0;
|
||||
atomizationModel 0;
|
||||
attachDetach 0;
|
||||
autoDensity 0;
|
||||
autoHexMeshDriver 0;
|
||||
autoLayerDriver 0;
|
||||
autoRefineDriver 0;
|
||||
@ -530,7 +531,6 @@ DebugSwitches
|
||||
hhuMixtureThermo<veryInhomogeneousMixture<constTransport<specieThermo<hConstThermo<perfectGas>>>>> 0;
|
||||
hhuMixtureThermo<veryInhomogeneousMixture<sutherlandTransport<specieThermo<janafThermo<perfectGas>>>>> 0;
|
||||
hierarchical 0;
|
||||
hierarchicalDensityWeightedStochastic 0;
|
||||
hollowConeInjector 0;
|
||||
iC3H8O 0;
|
||||
indexedOctree 0;
|
||||
|
||||
@ -27,8 +27,7 @@ initialPointsMethod/uniformGrid/uniformGrid.C
|
||||
initialPointsMethod/bodyCentredCubic/bodyCentredCubic.C
|
||||
initialPointsMethod/faceCentredCubic/faceCentredCubic.C
|
||||
initialPointsMethod/pointFile/pointFile.C
|
||||
initialPointsMethod/densityWeightedStochastic/densityWeightedStochastic.C
|
||||
initialPointsMethod/hierarchicalDensityWeightedStochastic/hierarchicalDensityWeightedStochastic.C
|
||||
initialPointsMethod/autoDensity/autoDensity.C
|
||||
|
||||
relaxationModel/relaxationModel/relaxationModel.C
|
||||
relaxationModel/adaptiveLinear/adaptiveLinear.C
|
||||
|
||||
@ -989,11 +989,11 @@ Foam::backgroundMeshDecomposition::distribute
|
||||
|
||||
if (newCellI == -1)
|
||||
{
|
||||
Pout<< "findCell backgroundMeshDecomposition "
|
||||
<< v << " "
|
||||
<< oldCellI
|
||||
<< newCellI
|
||||
<< " find nearest cellI ";
|
||||
// Pout<< "findCell backgroundMeshDecomposition "
|
||||
// << v << " "
|
||||
// << oldCellI
|
||||
// << newCellI
|
||||
// << " find nearest cellI ";
|
||||
|
||||
newCellI = cellSearch.findNearestCell(v);
|
||||
|
||||
@ -1150,6 +1150,14 @@ Foam::boolList Foam::backgroundMeshDecomposition::positionOnThisProcessor
|
||||
return posProc;
|
||||
}
|
||||
|
||||
bool Foam::backgroundMeshDecomposition::overlapsThisProcessor
|
||||
(
|
||||
const treeBoundBox& box
|
||||
) const
|
||||
{
|
||||
return !bFTreePtr_().findBox(box).empty();
|
||||
}
|
||||
|
||||
|
||||
Foam::pointIndexHit Foam::backgroundMeshDecomposition::findLine
|
||||
(
|
||||
|
||||
@ -225,6 +225,10 @@ public:
|
||||
//- Are the given positions inside the domain of this decomposition
|
||||
boolList positionOnThisProcessor(const List<point>& pts) const;
|
||||
|
||||
//- Does the given box overlap the faces of the bounday of this
|
||||
// processor
|
||||
bool overlapsThisProcessor(const treeBoundBox& box) const;
|
||||
|
||||
//- Find nearest intersection of line between start and end, (exposing
|
||||
// underlying indexedOctree)
|
||||
pointIndexHit findLine
|
||||
|
||||
@ -1331,12 +1331,13 @@ bool Foam::conformalVoronoiMesh::distributeBackground()
|
||||
|
||||
if (cellI == -1)
|
||||
{
|
||||
Pout<< "findCell conformalVoronoiMesh::distribute findCell "
|
||||
<< vit->type() << " "
|
||||
<< vit->index() << " "
|
||||
<< v << " "
|
||||
<< cellI
|
||||
<< " find nearest cellI ";
|
||||
// Pout<< "findCell conformalVoronoiMesh::distribute "
|
||||
// << "findCell "
|
||||
// << vit->type() << " "
|
||||
// << vit->index() << " "
|
||||
// << v << " "
|
||||
// << cellI
|
||||
// << " find nearest cellI ";
|
||||
|
||||
cellI = cellSearch.findNearestCell(v);
|
||||
|
||||
@ -1916,7 +1917,7 @@ Foam::conformalVoronoiMesh::conformalVoronoiMesh
|
||||
|
||||
// Report any Delaunay vertices that do not think that they are in the
|
||||
// domain the processor they are on.
|
||||
reportProcessorOccupancy();
|
||||
// reportProcessorOccupancy();
|
||||
|
||||
if(cvMeshControls().objOutput())
|
||||
{
|
||||
|
||||
@ -472,6 +472,17 @@ Foam::conformalVoronoiMesh::geometryToConformTo() const
|
||||
inline const Foam::backgroundMeshDecomposition&
|
||||
Foam::conformalVoronoiMesh::decomposition() const
|
||||
{
|
||||
if (!Pstream::parRun())
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"inline const Foam::backgroundMeshDecomposition& "
|
||||
"Foam::conformalVoronoiMesh::decomposition() const"
|
||||
)
|
||||
<< "The backgroundMeshDecomposition cannot be asked for in serial."
|
||||
<< exit(FatalError) << endl;
|
||||
}
|
||||
|
||||
return decomposition_();
|
||||
}
|
||||
|
||||
|
||||
@ -23,7 +23,7 @@ License
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "hierarchicalDensityWeightedStochastic.H"
|
||||
#include "autoDensity.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -33,17 +33,17 @@ namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(hierarchicalDensityWeightedStochastic, 0);
|
||||
defineTypeNameAndDebug(autoDensity, 0);
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
initialPointsMethod,
|
||||
hierarchicalDensityWeightedStochastic,
|
||||
autoDensity,
|
||||
dictionary
|
||||
);
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::hierarchicalDensityWeightedStochastic::writeOBJ
|
||||
void Foam::autoDensity::writeOBJ
|
||||
(
|
||||
const treeBoundBox& bb,
|
||||
fileName name
|
||||
@ -68,8 +68,114 @@ void Foam::hierarchicalDensityWeightedStochastic::writeOBJ
|
||||
}
|
||||
}
|
||||
|
||||
bool Foam::autoDensity::combinedOverlaps(const treeBoundBox& box) const
|
||||
{
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
return
|
||||
cvMesh_.decomposition().overlapsThisProcessor(box)
|
||||
|| cvMesh_.geometryToConformTo().overlaps(box);
|
||||
}
|
||||
|
||||
void Foam::hierarchicalDensityWeightedStochastic::recurseAndFill
|
||||
return cvMesh_.geometryToConformTo().overlaps(box);
|
||||
}
|
||||
|
||||
|
||||
bool Foam::autoDensity::combinedInside(const point& p) const
|
||||
{
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
return
|
||||
cvMesh_.decomposition().positionOnThisProcessor(p)
|
||||
&& cvMesh_.geometryToConformTo().inside(p);
|
||||
}
|
||||
|
||||
return cvMesh_.geometryToConformTo().inside(p);
|
||||
}
|
||||
|
||||
|
||||
Foam::Field<bool> Foam::autoDensity::combinedWellInside
|
||||
(
|
||||
const pointField& pts,
|
||||
const scalarField& sizes
|
||||
) const
|
||||
{
|
||||
if (!Pstream::parRun())
|
||||
{
|
||||
return cvMesh_.geometryToConformTo().wellInside
|
||||
(
|
||||
pts,
|
||||
minimumSurfaceDistanceCoeffSqr_*sqr(sizes)
|
||||
);
|
||||
}
|
||||
|
||||
Field<bool> inside(pts.size(), true);
|
||||
|
||||
// Perform AND operation between testing the surfaces and the previous
|
||||
// field, i.e the parallel result, or in serial, with true.
|
||||
|
||||
Field<bool> insideA
|
||||
(
|
||||
cvMesh_.geometryToConformTo().wellInside
|
||||
(
|
||||
pts,
|
||||
minimumSurfaceDistanceCoeffSqr_*sqr(sizes)
|
||||
)
|
||||
);
|
||||
|
||||
Field<bool> insideB(cvMesh_.decomposition().positionOnThisProcessor(pts));
|
||||
|
||||
// inside = insideA && insideB;
|
||||
|
||||
// Pout<< insideA << nl << insideB << endl;
|
||||
|
||||
forAll(inside, i)
|
||||
{
|
||||
// if (inside[i] != (insideA[i] && insideB[i]))
|
||||
// {
|
||||
// Pout<< i << " not equal " << " "
|
||||
// << pts[i] << " " << sizes[i] << " "
|
||||
// << insideA[i] << " "
|
||||
// << insideB[i] << " "
|
||||
// << inside[i]
|
||||
// << endl;
|
||||
// }
|
||||
|
||||
inside[i] = (insideA[i] && insideB[i]);
|
||||
}
|
||||
|
||||
return inside;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::autoDensity::combinedWellInside
|
||||
(
|
||||
const point& p,
|
||||
scalar size
|
||||
) const
|
||||
{
|
||||
bool inside = true;
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
inside = cvMesh_.decomposition().positionOnThisProcessor(p);
|
||||
}
|
||||
|
||||
// Perform AND operation between testing the surfaces and the previous
|
||||
// result, i.e the parallel result, or in serial, with true.
|
||||
inside =
|
||||
inside
|
||||
&& cvMesh_.geometryToConformTo().wellInside
|
||||
(
|
||||
p,
|
||||
minimumSurfaceDistanceCoeffSqr_*sqr(size)
|
||||
);
|
||||
|
||||
return inside;
|
||||
}
|
||||
|
||||
|
||||
void Foam::autoDensity::recurseAndFill
|
||||
(
|
||||
std::list<Vb::Point>& initialPoints,
|
||||
const treeBoundBox& bb,
|
||||
@ -77,8 +183,6 @@ void Foam::hierarchicalDensityWeightedStochastic::recurseAndFill
|
||||
word recursionName
|
||||
) const
|
||||
{
|
||||
const conformationSurfaces& geometry = cvMesh_.geometryToConformTo();
|
||||
|
||||
for (direction i = 0; i < 8; i++)
|
||||
{
|
||||
treeBoundBox subBB = bb.subBbox(i);
|
||||
@ -90,7 +194,7 @@ void Foam::hierarchicalDensityWeightedStochastic::recurseAndFill
|
||||
cvMesh_.timeCheck(newName);
|
||||
}
|
||||
|
||||
if (geometry.overlaps(subBB))
|
||||
if (combinedOverlaps(subBB))
|
||||
{
|
||||
if (levelLimit > 0)
|
||||
{
|
||||
@ -104,14 +208,14 @@ void Foam::hierarchicalDensityWeightedStochastic::recurseAndFill
|
||||
}
|
||||
else
|
||||
{
|
||||
// writeOBJ
|
||||
// (
|
||||
// subBB,
|
||||
// word(newName + "_overlap")
|
||||
// );
|
||||
|
||||
if (debug)
|
||||
{
|
||||
writeOBJ
|
||||
(
|
||||
subBB,
|
||||
word(newName + "_overlap")
|
||||
);
|
||||
|
||||
Pout<< newName + "_overlap " << subBB << endl;
|
||||
}
|
||||
|
||||
@ -127,16 +231,16 @@ void Foam::hierarchicalDensityWeightedStochastic::recurseAndFill
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (geometry.inside(subBB.midpoint()))
|
||||
else if (combinedInside(subBB.midpoint()))
|
||||
{
|
||||
// writeOBJ
|
||||
// (
|
||||
// subBB,
|
||||
// newName + "_inside"
|
||||
// );
|
||||
|
||||
if (debug)
|
||||
{
|
||||
writeOBJ
|
||||
(
|
||||
subBB,
|
||||
newName + "_inside"
|
||||
);
|
||||
|
||||
Pout<< newName + "_inside " << subBB << endl;
|
||||
}
|
||||
|
||||
@ -153,24 +257,27 @@ void Foam::hierarchicalDensityWeightedStochastic::recurseAndFill
|
||||
}
|
||||
else
|
||||
{
|
||||
// writeOBJ
|
||||
// (
|
||||
// subBB,
|
||||
// newName + "_outside"
|
||||
// );
|
||||
if (debug)
|
||||
{
|
||||
writeOBJ
|
||||
(
|
||||
subBB,
|
||||
newName + "_outside"
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool Foam::hierarchicalDensityWeightedStochastic::fillBox
|
||||
bool Foam::autoDensity::fillBox
|
||||
(
|
||||
std::list<Vb::Point>& initialPoints,
|
||||
const treeBoundBox& bb,
|
||||
bool overlapping
|
||||
) const
|
||||
{
|
||||
const conformationSurfaces& geometry = cvMesh_.geometryToConformTo();
|
||||
const conformationSurfaces& geometry(cvMesh_.geometryToConformTo());
|
||||
|
||||
Random& rnd = cvMesh_.rndGen();
|
||||
|
||||
@ -214,7 +321,10 @@ bool Foam::hierarchicalDensityWeightedStochastic::fillBox
|
||||
|
||||
if (!surfHit.hit())
|
||||
{
|
||||
// Pout<< "box wellInside, no need to sample surface." << endl;
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "box wellInside, no need to sample surface." << endl;
|
||||
}
|
||||
|
||||
wellInside = true;
|
||||
}
|
||||
@ -235,11 +345,7 @@ bool Foam::hierarchicalDensityWeightedStochastic::fillBox
|
||||
List<bool>(8, false)
|
||||
);
|
||||
|
||||
Field<bool> insideCorners = geometry.wellInside
|
||||
(
|
||||
corners,
|
||||
minimumSurfaceDistanceCoeffSqr_*sqr(cornerSizes)
|
||||
);
|
||||
Field<bool> insideCorners = combinedWellInside(corners, cornerSizes);
|
||||
|
||||
// Pout<< corners << nl << cornerSizes << nl << insideCorners << endl;
|
||||
|
||||
@ -260,11 +366,14 @@ bool Foam::hierarchicalDensityWeightedStochastic::fillBox
|
||||
|
||||
if (maxCellSize/minCellSize > maxSizeRatio_)
|
||||
{
|
||||
// Pout<< "Abort fill at corner sample stage,"
|
||||
// << " minCellSize " << minCellSize
|
||||
// << " maxCellSize " << maxCellSize
|
||||
// << " maxSizeRatio " << maxCellSize/minCellSize
|
||||
// << endl;
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "Abort fill at corner sample stage,"
|
||||
<< " minCellSize " << minCellSize
|
||||
<< " maxCellSize " << maxCellSize
|
||||
<< " maxSizeRatio " << maxCellSize/minCellSize
|
||||
<< endl;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
@ -274,9 +383,12 @@ bool Foam::hierarchicalDensityWeightedStochastic::fillBox
|
||||
// If one or more corners is not "wellInside", then treat this
|
||||
// as an overlapping box.
|
||||
|
||||
// Pout<< "Inside box found to have some non-wellInside "
|
||||
// << "corners, using overlapping fill."
|
||||
// << endl;
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "Inside box found to have some non-wellInside "
|
||||
<< "corners, using overlapping fill."
|
||||
<< endl;
|
||||
}
|
||||
|
||||
overlapping = true;
|
||||
|
||||
@ -294,8 +406,6 @@ bool Foam::hierarchicalDensityWeightedStochastic::fillBox
|
||||
|
||||
scalarField lineSizes(nLine, 0.0);
|
||||
|
||||
Field<bool> insideLines(nLine, true);
|
||||
|
||||
for (label i = 0; i < surfRes_; i++)
|
||||
{
|
||||
label lPI = 0;
|
||||
@ -348,10 +458,10 @@ bool Foam::hierarchicalDensityWeightedStochastic::fillBox
|
||||
List<bool>(nLine, false)
|
||||
);
|
||||
|
||||
insideLines = geometry.wellInside
|
||||
Field<bool> insideLines = combinedWellInside
|
||||
(
|
||||
linePoints,
|
||||
minimumSurfaceDistanceCoeffSqr_*sqr(lineSizes)
|
||||
lineSizes
|
||||
);
|
||||
|
||||
forAll(insideLines, i)
|
||||
@ -371,11 +481,14 @@ bool Foam::hierarchicalDensityWeightedStochastic::fillBox
|
||||
|
||||
if (maxCellSize/minCellSize > maxSizeRatio_)
|
||||
{
|
||||
// Pout<< "Abort fill at surface sample stage, "
|
||||
// << " minCellSize " << minCellSize
|
||||
// << " maxCellSize " << maxCellSize
|
||||
// << " maxSizeRatio " << maxCellSize/minCellSize
|
||||
// << endl;
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "Abort fill at surface sample stage, "
|
||||
<< " minCellSize " << minCellSize
|
||||
<< " maxCellSize " << maxCellSize
|
||||
<< " maxSizeRatio " << maxCellSize/minCellSize
|
||||
<< endl;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
@ -386,10 +499,13 @@ bool Foam::hierarchicalDensityWeightedStochastic::fillBox
|
||||
// then treat this as an overlapping box.
|
||||
overlapping = true;
|
||||
|
||||
// Pout<< "Inside box found to have some non-"
|
||||
// << "wellInside surface points, using "
|
||||
// << "overlapping fill."
|
||||
// << endl;
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "Inside box found to have some non-"
|
||||
<< "wellInside surface points, using "
|
||||
<< "overlapping fill."
|
||||
<< endl;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
@ -445,10 +561,10 @@ bool Foam::hierarchicalDensityWeightedStochastic::fillBox
|
||||
List<bool>(samplePoints.size(), false)
|
||||
);
|
||||
|
||||
Field<bool> insidePoints = geometry.wellInside
|
||||
Field<bool> insidePoints = combinedWellInside
|
||||
(
|
||||
samplePoints,
|
||||
minimumSurfaceDistanceCoeffSqr_*sqr(sampleSizes)
|
||||
sampleSizes
|
||||
);
|
||||
|
||||
label nInside = 0;
|
||||
@ -473,11 +589,14 @@ bool Foam::hierarchicalDensityWeightedStochastic::fillBox
|
||||
|
||||
if (maxCellSize/minCellSize > maxSizeRatio_)
|
||||
{
|
||||
// Pout<< "Abort fill at sample stage,"
|
||||
// << " minCellSize " << minCellSize
|
||||
// << " maxCellSize " << maxCellSize
|
||||
// << " maxSizeRatio " << maxCellSize/minCellSize
|
||||
// << endl;
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "Abort fill at sample stage,"
|
||||
<< " minCellSize " << minCellSize
|
||||
<< " maxCellSize " << maxCellSize
|
||||
<< " maxSizeRatio " << maxCellSize/minCellSize
|
||||
<< endl;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
@ -486,17 +605,26 @@ bool Foam::hierarchicalDensityWeightedStochastic::fillBox
|
||||
|
||||
if (nInside == 0)
|
||||
{
|
||||
// Pout<< "No sample points found inside box" << endl;
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "No sample points found inside box" << endl;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Pout<< scalar(nInside)/scalar(samplePoints.size())
|
||||
// << " full overlapping box" << endl;
|
||||
if (debug)
|
||||
{
|
||||
Pout<< scalar(nInside)/scalar(samplePoints.size())
|
||||
<< " full overlapping box" << endl;
|
||||
}
|
||||
|
||||
totalVolume *= scalar(nInside)/scalar(samplePoints.size());
|
||||
|
||||
// Pout<< "Total volume to fill = " << totalVolume << endl;
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "Total volume to fill = " << totalVolume << endl;
|
||||
}
|
||||
|
||||
// Using the sampledPoints as the first test locations as they are
|
||||
// randomly shuffled, but unfiormly sampling space and have wellInside
|
||||
@ -540,12 +668,15 @@ bool Foam::hierarchicalDensityWeightedStochastic::fillBox
|
||||
|
||||
scalar r = rnd.scalar01();
|
||||
|
||||
// Pout<< "totalVolume " << totalVolume << nl
|
||||
// << "volumeAdded " << volumeAdded << nl
|
||||
// << "localVolume " << localVolume << nl
|
||||
// << "addProbability " << addProbability << nl
|
||||
// << "random " << r
|
||||
// << endl;
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "totalVolume " << totalVolume << nl
|
||||
<< "volumeAdded " << volumeAdded << nl
|
||||
<< "localVolume " << localVolume << nl
|
||||
<< "addProbability " << addProbability << nl
|
||||
<< "random " << r
|
||||
<< endl;
|
||||
}
|
||||
|
||||
if (addProbability > r)
|
||||
{
|
||||
@ -576,9 +707,12 @@ bool Foam::hierarchicalDensityWeightedStochastic::fillBox
|
||||
|
||||
if (volumeAdded < totalVolume)
|
||||
{
|
||||
// Pout<< "Adding random points, remaining volume "
|
||||
// << totalVolume - volumeAdded
|
||||
// << endl;
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "Adding random points, remaining volume "
|
||||
<< totalVolume - volumeAdded
|
||||
<< endl;
|
||||
}
|
||||
|
||||
maxDensity = 1/pow3(max(minCellSize, SMALL));
|
||||
|
||||
@ -599,11 +733,7 @@ bool Foam::hierarchicalDensityWeightedStochastic::fillBox
|
||||
else
|
||||
{
|
||||
// Determine if the point is "wellInside" the domain
|
||||
insidePoint = geometry.wellInside
|
||||
(
|
||||
p,
|
||||
minimumSurfaceDistanceCoeffSqr_*sqr(localSize)
|
||||
);
|
||||
insidePoint = combinedWellInside(p, localSize);
|
||||
}
|
||||
|
||||
if (insidePoint)
|
||||
@ -626,11 +756,14 @@ bool Foam::hierarchicalDensityWeightedStochastic::fillBox
|
||||
|
||||
if (maxCellSize/minCellSize > maxSizeRatio_)
|
||||
{
|
||||
// Pout<< "Abort fill at random fill stage,"
|
||||
// << " minCellSize " << minCellSize
|
||||
// << " maxCellSize " << maxCellSize
|
||||
// << " maxSizeRatio " << maxCellSize/minCellSize
|
||||
// << endl;
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "Abort fill at random fill stage,"
|
||||
<< " minCellSize " << minCellSize
|
||||
<< " maxCellSize " << maxCellSize
|
||||
<< " maxSizeRatio " << maxCellSize/minCellSize
|
||||
<< endl;
|
||||
}
|
||||
|
||||
// Discard any points already filled into this box by
|
||||
// setting size of initialPoints back to its starting value
|
||||
@ -658,12 +791,15 @@ bool Foam::hierarchicalDensityWeightedStochastic::fillBox
|
||||
|
||||
scalar r = rnd.scalar01();
|
||||
|
||||
// Pout<< "totalVolume " << totalVolume << nl
|
||||
// << "volumeAdded " << volumeAdded << nl
|
||||
// << "localVolume " << localVolume << nl
|
||||
// << "addProbability " << addProbability << nl
|
||||
// << "random " << r
|
||||
// << endl;
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "totalVolume " << totalVolume << nl
|
||||
<< "volumeAdded " << volumeAdded << nl
|
||||
<< "localVolume " << localVolume << nl
|
||||
<< "addProbability " << addProbability << nl
|
||||
<< "random " << r
|
||||
<< endl;
|
||||
}
|
||||
|
||||
if (addProbability > r)
|
||||
{
|
||||
@ -694,16 +830,19 @@ bool Foam::hierarchicalDensityWeightedStochastic::fillBox
|
||||
|
||||
globalTrialPoints_ += trialPoints;
|
||||
|
||||
// Pout<< trialPoints
|
||||
// << " locations queried, " << initialPoints.size() - initialSize
|
||||
// << " points placed, ("
|
||||
// << scalar(initialPoints.size() - initialSize)
|
||||
// /scalar(max(trialPoints, 1))
|
||||
// << " success rate)." << nl
|
||||
// << "minCellSize " << minCellSize
|
||||
// << ", maxCellSize " << maxCellSize
|
||||
// << ", ratio " << maxCellSize/minCellSize
|
||||
// << nl << endl;
|
||||
if (debug)
|
||||
{
|
||||
Pout<< trialPoints
|
||||
<< " locations queried, " << initialPoints.size() - initialSize
|
||||
<< " points placed, ("
|
||||
<< scalar(initialPoints.size() - initialSize)
|
||||
/scalar(max(trialPoints, 1))
|
||||
<< " success rate)." << nl
|
||||
<< "minCellSize " << minCellSize
|
||||
<< ", maxCellSize " << maxCellSize
|
||||
<< ", ratio " << maxCellSize/minCellSize
|
||||
<< nl << endl;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -711,7 +850,7 @@ bool Foam::hierarchicalDensityWeightedStochastic::fillBox
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
hierarchicalDensityWeightedStochastic::hierarchicalDensityWeightedStochastic
|
||||
autoDensity::autoDensity
|
||||
(
|
||||
const dictionary& initialPointsDict,
|
||||
const conformalVoronoiMesh& cvMesh
|
||||
@ -737,8 +876,7 @@ hierarchicalDensityWeightedStochastic::hierarchicalDensityWeightedStochastic
|
||||
|
||||
WarningIn
|
||||
(
|
||||
"hierarchicalDensityWeightedStochastic::"
|
||||
"hierarchicalDensityWeightedStochastic"
|
||||
"autoDensity::autoDensity"
|
||||
"("
|
||||
"const dictionary& initialPointsDict,"
|
||||
"const conformalVoronoiMesh& cvMesh"
|
||||
@ -753,15 +891,25 @@ hierarchicalDensityWeightedStochastic::hierarchicalDensityWeightedStochastic
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
std::list<Vb::Point>
|
||||
hierarchicalDensityWeightedStochastic::initialPoints() const
|
||||
std::list<Vb::Point> autoDensity::initialPoints() const
|
||||
{
|
||||
const conformationSurfaces& geometry = cvMesh_.geometryToConformTo();
|
||||
treeBoundBox hierBB;
|
||||
|
||||
treeBoundBox hierBB = geometry.globalBounds().extend
|
||||
(
|
||||
cvMesh_.rndGen(), 1e-6
|
||||
);
|
||||
// Pick up the bounds of this processor, or the whole geometry, depending
|
||||
// on whether this is a parallel run.
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
hierBB = cvMesh_.decomposition().procBounds();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Extend the global box to move it off large plane surfaces
|
||||
hierBB = cvMesh_.geometryToConformTo().globalBounds().extend
|
||||
(
|
||||
cvMesh_.rndGen(),
|
||||
1e-6
|
||||
);
|
||||
}
|
||||
|
||||
std::list<Vb::Point> initialPoints;
|
||||
|
||||
@ -22,19 +22,19 @@ License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::hierarchicalDensityWeightedStochastic
|
||||
Foam::autoDensity
|
||||
|
||||
Description
|
||||
Choose random points inside the domain and place them with a probability
|
||||
proportional to the target density of points.
|
||||
|
||||
SourceFiles
|
||||
hierarchicalDensityWeightedStochastic.C
|
||||
autoDensity.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef hierarchicalDensityWeightedStochastic_H
|
||||
#define hierarchicalDensityWeightedStochastic_H
|
||||
#ifndef autoDensity_H
|
||||
#define autoDensity_H
|
||||
|
||||
#include "initialPointsMethod.H"
|
||||
#include "treeBoundBox.H"
|
||||
@ -45,10 +45,10 @@ namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class hierarchicalDensityWeightedStochastic Declaration
|
||||
Class autoDensity Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class hierarchicalDensityWeightedStochastic
|
||||
class autoDensity
|
||||
:
|
||||
public initialPointsMethod
|
||||
{
|
||||
@ -82,6 +82,30 @@ private:
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Check if the given box overlaps the geometry or, in parallel, the
|
||||
// backgroundMeshDecomposition
|
||||
bool combinedOverlaps(const treeBoundBox& box) const;
|
||||
|
||||
//- Check if the given point is inside the geometry and, in parallel,
|
||||
// the backgroundMeshDecomposition
|
||||
bool combinedInside(const point& p) const;
|
||||
|
||||
//- Check if the given points are wellInside the geometry and, in
|
||||
// parallel, inside the backgroundMeshDecomposition
|
||||
Field<bool> combinedWellInside
|
||||
(
|
||||
const pointField& pts,
|
||||
const scalarField& sizes
|
||||
) const;
|
||||
|
||||
//- Check if the given points are wellInside the geometry and, in
|
||||
// parallel, inside the backgroundMeshDecomposition
|
||||
bool combinedWellInside
|
||||
(
|
||||
const point& p,
|
||||
scalar size
|
||||
) const;
|
||||
|
||||
//- Write boundBox as obj
|
||||
void writeOBJ
|
||||
(
|
||||
@ -112,12 +136,12 @@ private:
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("hierarchicalDensityWeightedStochastic");
|
||||
TypeName("autoDensity");
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
hierarchicalDensityWeightedStochastic
|
||||
autoDensity
|
||||
(
|
||||
const dictionary& initialPointsDict,
|
||||
const conformalVoronoiMesh& cvMesh
|
||||
@ -125,7 +149,7 @@ public:
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~hierarchicalDensityWeightedStochastic()
|
||||
virtual ~autoDensity()
|
||||
{}
|
||||
|
||||
|
||||
@ -58,19 +58,30 @@ bodyCentredCubic::bodyCentredCubic
|
||||
|
||||
std::list<Vb::Point> bodyCentredCubic::initialPoints() const
|
||||
{
|
||||
const boundBox& bb = cvMesh_.geometryToConformTo().globalBounds();
|
||||
boundBox bb;
|
||||
|
||||
// Pick up the bounds of this processor, or the whole geometry, depending
|
||||
// on whether this is a parallel run.
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
bb = cvMesh_.decomposition().procBounds();
|
||||
}
|
||||
else
|
||||
{
|
||||
bb = cvMesh_.geometryToConformTo().globalBounds();
|
||||
}
|
||||
|
||||
scalar x0 = bb.min().x();
|
||||
scalar xR = bb.max().x() - x0;
|
||||
label ni = label(xR/initialCellSize_) + 1;
|
||||
label ni = label(xR/initialCellSize_);
|
||||
|
||||
scalar y0 = bb.min().y();
|
||||
scalar yR = bb.max().y() - y0;
|
||||
label nj = label(yR/initialCellSize_) + 1;
|
||||
label nj = label(yR/initialCellSize_);
|
||||
|
||||
scalar z0 = bb.min().z();
|
||||
scalar zR = bb.max().z() - z0;
|
||||
label nk = label(zR/initialCellSize_) + 1;
|
||||
label nk = label(zR/initialCellSize_);
|
||||
|
||||
vector delta(xR/ni, yR/nj, zR/nk);
|
||||
|
||||
@ -82,8 +93,6 @@ std::list<Vb::Point> bodyCentredCubic::initialPoints() const
|
||||
|
||||
std::list<Vb::Point> initialPoints;
|
||||
|
||||
List<bool> isSurfacePoint(2*nk, false);
|
||||
|
||||
for (label i = 0; i < ni; i++)
|
||||
{
|
||||
for (label j = 0; j < nj; j++)
|
||||
@ -114,7 +123,19 @@ std::list<Vb::Point> bodyCentredCubic::initialPoints() const
|
||||
pA.z() += pert*(rndGen.scalar01() - 0.5);
|
||||
}
|
||||
|
||||
points[pI++] = pA;
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
if (cvMesh_.decomposition().positionOnThisProcessor(pA))
|
||||
{
|
||||
// Add this point in parallel only if this position is
|
||||
// on this processor.
|
||||
points[pI++] = pA;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
points[pI++] = pA;
|
||||
}
|
||||
|
||||
if (randomiseInitialGrid_)
|
||||
{
|
||||
@ -123,14 +144,35 @@ std::list<Vb::Point> bodyCentredCubic::initialPoints() const
|
||||
pB.z() += pert*(rndGen.scalar01() - 0.5);
|
||||
}
|
||||
|
||||
points[pI++] = pB;
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
if (cvMesh_.decomposition().positionOnThisProcessor(pB))
|
||||
{
|
||||
// Add this point in parallel only if this position is
|
||||
// on this processor.
|
||||
points[pI++] = pB;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
points[pI++] = pB;
|
||||
}
|
||||
}
|
||||
|
||||
points.setSize(pI);
|
||||
|
||||
Field<bool> insidePoints = cvMesh_.geometryToConformTo().wellInside
|
||||
(
|
||||
points,
|
||||
minimumSurfaceDistanceCoeffSqr_
|
||||
*sqr(cvMesh_.cellSizeControl().cellSize(points, isSurfacePoint))
|
||||
*sqr
|
||||
(
|
||||
cvMesh_.cellSizeControl().cellSize
|
||||
(
|
||||
points,
|
||||
List<bool>(points.size(), false)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
forAll(insidePoints, i)
|
||||
|
||||
@ -1,147 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
|
||||
\\/ 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 "densityWeightedStochastic.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(densityWeightedStochastic, 0);
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
initialPointsMethod,
|
||||
densityWeightedStochastic,
|
||||
dictionary
|
||||
);
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
densityWeightedStochastic::densityWeightedStochastic
|
||||
(
|
||||
const dictionary& initialPointsDict,
|
||||
const conformalVoronoiMesh& cvMesh
|
||||
)
|
||||
:
|
||||
initialPointsMethod(typeName, initialPointsDict, cvMesh),
|
||||
totalVolume_(readScalar(detailsDict().lookup("totalVolume"))),
|
||||
minCellSize_
|
||||
(
|
||||
detailsDict().lookupOrDefault<scalar>("minCellSize", GREAT)
|
||||
),
|
||||
minCellSizeLimit_
|
||||
(
|
||||
detailsDict().lookupOrDefault<scalar>("minCellSizeLimit", 0.0)
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
std::list<Vb::Point> densityWeightedStochastic::initialPoints() const
|
||||
{
|
||||
const boundBox& bb = cvMesh_.geometryToConformTo().globalBounds();
|
||||
|
||||
Random& rndGen = cvMesh_.rndGen();
|
||||
|
||||
std::list<Vb::Point> initialPoints;
|
||||
|
||||
scalar volumeAdded = 0.0;
|
||||
|
||||
const point& min = bb.min();
|
||||
|
||||
vector span = bb.span();
|
||||
|
||||
label trialPoints = 0;
|
||||
|
||||
scalar maxDensity = 1/pow3(max(minCellSize_, SMALL));
|
||||
|
||||
while (volumeAdded < totalVolume_)
|
||||
{
|
||||
trialPoints++;
|
||||
|
||||
point p =
|
||||
min
|
||||
+ vector
|
||||
(
|
||||
span.x()*rndGen.scalar01(),
|
||||
span.y()*rndGen.scalar01(),
|
||||
span.z()*rndGen.scalar01()
|
||||
);
|
||||
|
||||
scalar localSize = cvMesh_.cellSizeControl().cellSize(p);
|
||||
|
||||
if (localSize < minCellSize_)
|
||||
{
|
||||
minCellSize_ = max(localSize, minCellSizeLimit_);
|
||||
|
||||
// 1/(minimum cell size)^3, gives the maximum permissible point
|
||||
// density
|
||||
maxDensity = 1/pow3(max(minCellSize_, SMALL));
|
||||
}
|
||||
|
||||
scalar localDensity = 1/pow3(max(localSize, SMALL));
|
||||
|
||||
// Accept possible placements proportional to the relative local density
|
||||
if (localDensity/maxDensity > rndGen.scalar01())
|
||||
{
|
||||
// Determine if the point is "wellInside" the domain
|
||||
if
|
||||
(
|
||||
cvMesh_.geometryToConformTo().wellInside
|
||||
(
|
||||
p,
|
||||
minimumSurfaceDistanceCoeffSqr_*sqr(localSize)
|
||||
)
|
||||
)
|
||||
{
|
||||
initialPoints.push_back(Vb::Point(p.x(), p.y(), p.z()));
|
||||
|
||||
volumeAdded += 1/localDensity;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Info<< nl << " " << typeName << nl
|
||||
<< " " << initialPoints.size() << " points placed" << nl
|
||||
<< " " << trialPoints << " locations queried" << nl
|
||||
<< " " << scalar(initialPoints.size())/scalar(trialPoints)
|
||||
<< " success rate" << nl
|
||||
<< " minCellSize " << minCellSize_
|
||||
<< endl;
|
||||
|
||||
return initialPoints;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,106 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
|
||||
\\/ 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::densityWeightedStochastic
|
||||
|
||||
Description
|
||||
Choose random points inside the domain and place them with a probability
|
||||
proportional to the target density of points.
|
||||
|
||||
SourceFiles
|
||||
densityWeightedStochastic.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef densityWeightedStochastic_H
|
||||
#define densityWeightedStochastic_H
|
||||
|
||||
#include "initialPointsMethod.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class densityWeightedStochastic Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class densityWeightedStochastic
|
||||
:
|
||||
public initialPointsMethod
|
||||
{
|
||||
|
||||
private:
|
||||
|
||||
// Private data
|
||||
|
||||
//- The total volume to be filled
|
||||
scalar totalVolume_;
|
||||
|
||||
//- Working variable for minimum cell size, a starting value may be
|
||||
// specified in the dictionary
|
||||
mutable scalar minCellSize_;
|
||||
|
||||
//- Smallest minimum cell size allowed, i.e. to avoid high initial
|
||||
// population of areas of small size
|
||||
scalar minCellSizeLimit_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("densityWeightedStochastic");
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
densityWeightedStochastic
|
||||
(
|
||||
const dictionary& initialPointsDict,
|
||||
const conformalVoronoiMesh& cvMesh
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~densityWeightedStochastic()
|
||||
{}
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return the initial points for the conformalVoronoiMesh
|
||||
virtual std::list<Vb::Point> initialPoints() const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -58,19 +58,30 @@ faceCentredCubic::faceCentredCubic
|
||||
|
||||
std::list<Vb::Point> faceCentredCubic::initialPoints() const
|
||||
{
|
||||
const boundBox& bb = cvMesh_.geometryToConformTo().globalBounds();
|
||||
boundBox bb;
|
||||
|
||||
// Pick up the bounds of this processor, or the whole geometry, depending
|
||||
// on whether this is a parallel run.
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
bb = cvMesh_.decomposition().procBounds();
|
||||
}
|
||||
else
|
||||
{
|
||||
bb = cvMesh_.geometryToConformTo().globalBounds();
|
||||
}
|
||||
|
||||
scalar x0 = bb.min().x();
|
||||
scalar xR = bb.max().x() - x0;
|
||||
label ni = label(xR/initialCellSize_) + 1;
|
||||
label ni = label(xR/initialCellSize_);
|
||||
|
||||
scalar y0 = bb.min().y();
|
||||
scalar yR = bb.max().y() - y0;
|
||||
label nj = label(yR/initialCellSize_) + 1;
|
||||
label nj = label(yR/initialCellSize_);
|
||||
|
||||
scalar z0 = bb.min().z();
|
||||
scalar zR = bb.max().z() - z0;
|
||||
label nk = label(zR/initialCellSize_) + 1;
|
||||
label nk = label(zR/initialCellSize_);
|
||||
|
||||
vector delta(xR/ni, yR/nj, zR/nk);
|
||||
|
||||
@ -82,8 +93,6 @@ std::list<Vb::Point> faceCentredCubic::initialPoints() const
|
||||
|
||||
std::list<Vb::Point> initialPoints;
|
||||
|
||||
List<bool> isSurfacePoint(4*nk, false);
|
||||
|
||||
for (label i = 0; i < ni; i++)
|
||||
{
|
||||
for (label j = 0; j < nj; j++)
|
||||
@ -112,7 +121,19 @@ std::list<Vb::Point> faceCentredCubic::initialPoints() const
|
||||
p.z() += pert*(rndGen.scalar01() - 0.5);
|
||||
}
|
||||
|
||||
points[pI++] = p;
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
if (cvMesh_.decomposition().positionOnThisProcessor(p))
|
||||
{
|
||||
// Add this point in parallel only if this position is
|
||||
// on this processor.
|
||||
points[pI++] = p;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
points[pI++] = p;
|
||||
}
|
||||
|
||||
p = point
|
||||
(
|
||||
@ -128,7 +149,19 @@ std::list<Vb::Point> faceCentredCubic::initialPoints() const
|
||||
p.z() += pert*(rndGen.scalar01() - 0.5);
|
||||
}
|
||||
|
||||
points[pI++] = p;
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
if (cvMesh_.decomposition().positionOnThisProcessor(p))
|
||||
{
|
||||
// Add this point in parallel only if this position is
|
||||
// on this processor.
|
||||
points[pI++] = p;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
points[pI++] = p;
|
||||
}
|
||||
|
||||
p = point
|
||||
(
|
||||
@ -144,7 +177,19 @@ std::list<Vb::Point> faceCentredCubic::initialPoints() const
|
||||
p.z() += pert*(rndGen.scalar01() - 0.5);
|
||||
}
|
||||
|
||||
points[pI++] = p;
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
if (cvMesh_.decomposition().positionOnThisProcessor(p))
|
||||
{
|
||||
// Add this point in parallel only if this position is
|
||||
// on this processor.
|
||||
points[pI++] = p;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
points[pI++] = p;
|
||||
}
|
||||
|
||||
p = point
|
||||
(
|
||||
@ -160,14 +205,35 @@ std::list<Vb::Point> faceCentredCubic::initialPoints() const
|
||||
p.z() += pert*(rndGen.scalar01() - 0.5);
|
||||
}
|
||||
|
||||
points[pI++] = p;
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
if (cvMesh_.decomposition().positionOnThisProcessor(p))
|
||||
{
|
||||
// Add this point in parallel only if this position is
|
||||
// on this processor.
|
||||
points[pI++] = p;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
points[pI++] = p;
|
||||
}
|
||||
}
|
||||
|
||||
points.setSize(pI);
|
||||
|
||||
Field<bool> insidePoints = cvMesh_.geometryToConformTo().wellInside
|
||||
(
|
||||
points,
|
||||
minimumSurfaceDistanceCoeffSqr_
|
||||
*sqr(cvMesh_.cellSizeControl().cellSize(points, isSurfacePoint))
|
||||
*sqr
|
||||
(
|
||||
cvMesh_.cellSizeControl().cellSize
|
||||
(
|
||||
points,
|
||||
List<bool>(points.size(), false)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
forAll(insidePoints, i)
|
||||
|
||||
@ -146,7 +146,7 @@ std::list<Vb::Point> uniformGrid::initialPoints() const
|
||||
cvMesh_.cellSizeControl().cellSize
|
||||
(
|
||||
points,
|
||||
List<bool>(pI, false)
|
||||
List<bool>(points.size(), false)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
@ -109,14 +109,17 @@ initialPoints
|
||||
{
|
||||
minimumSurfaceDistanceCoeff 0.55;
|
||||
|
||||
initialPointsMethod densityWeightedStochastic;
|
||||
initialPointsMethod autoDensity;
|
||||
// initialPointsMethod uniformGrid;
|
||||
// initialPointsMethod bodyCentredCubic;
|
||||
// initialPointsMethod pointFile;
|
||||
|
||||
densityWeightedStochasticDetails
|
||||
autoDensityDetails
|
||||
{
|
||||
totalVolume 1.56e-05;
|
||||
minLevels 1;
|
||||
maxSizeRatio 2.0;
|
||||
sampleResolution 5;
|
||||
surfaceSampleResolution 5;
|
||||
}
|
||||
|
||||
uniformGridDetails
|
||||
|
||||
@ -109,30 +109,8 @@ initialPoints
|
||||
{
|
||||
minimumSurfaceDistanceCoeff 0.55;
|
||||
|
||||
// initialPointsMethod densityWeightedStochastic;
|
||||
// initialPointsMethod uniformGrid;
|
||||
// initialPointsMethod bodyCentredCubic;
|
||||
initialPointsMethod pointFile;
|
||||
|
||||
densityWeightedStochasticDetails
|
||||
{
|
||||
totalVolume 1.56e-05;
|
||||
}
|
||||
|
||||
uniformGridDetails
|
||||
{
|
||||
initialCellSize 0.0015;
|
||||
randomiseInitialGrid yes;
|
||||
randomPerturbationCoeff 0.02;
|
||||
}
|
||||
|
||||
bodyCentredCubicDetails
|
||||
{
|
||||
initialCellSize 0.0015;
|
||||
randomiseInitialGrid no;
|
||||
randomPerturbationCoeff 0.1;
|
||||
}
|
||||
|
||||
pointFileDetails
|
||||
{
|
||||
pointFile "constant/internalDelaunayVertices";
|
||||
|
||||
@ -6,18 +6,10 @@ cd ${0%/*} || exit 1 # run from this directory
|
||||
|
||||
# Generate aligned points (in constant/internalDelaunayVertices) and a
|
||||
# mesh from that.
|
||||
#cp system/controlDict-generatePoints system/controlDict
|
||||
#cp system/cvMeshDict-generatePoints system/cvMeshDict
|
||||
runApplication surfaceFeatureExtract constant/triSurface/coneAndSphere.obj coneAndSphere -includedAngle 125
|
||||
runApplication surfaceFeatureExtract constant/triSurface/domain.stl domain -includedAngle 125
|
||||
runApplication cvMesh
|
||||
|
||||
# Use pre-generated aligned points (constant/internalDelaunayVertices)
|
||||
# to generate a mesh
|
||||
# cp system/controlDict-usePoints system/controlDict
|
||||
# cp system/cvMeshDict-usePoints system/cvMeshDict
|
||||
# runApplication cvMesh
|
||||
|
||||
# Generate some sets for a bit of mesh inspection
|
||||
runApplication topoSet
|
||||
|
||||
|
||||
@ -1,54 +0,0 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: dev |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
|
||||
root "";
|
||||
case "";
|
||||
instance "";
|
||||
local "";
|
||||
|
||||
class dictionary;
|
||||
object controlDict;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
startFrom latestTime;
|
||||
|
||||
startTime 0;
|
||||
|
||||
stopAt endTime;
|
||||
|
||||
endTime 80;
|
||||
|
||||
deltaT 1;
|
||||
|
||||
writeControl timeStep;
|
||||
|
||||
writeInterval 1000; //10 to see the meshing steps
|
||||
|
||||
purgeWrite 0;
|
||||
|
||||
writeFormat ascii;
|
||||
|
||||
writePrecision 10;
|
||||
|
||||
writeCompression uncompressed;
|
||||
|
||||
timeFormat general;
|
||||
|
||||
timePrecision 6;
|
||||
|
||||
runTimeModifiable yes;
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,54 +0,0 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: dev |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
|
||||
root "";
|
||||
case "";
|
||||
instance "";
|
||||
local "";
|
||||
|
||||
class dictionary;
|
||||
object controlDict;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
startFrom latestTime;
|
||||
|
||||
startTime 0;
|
||||
|
||||
stopAt endTime;
|
||||
|
||||
endTime 0;
|
||||
|
||||
deltaT 1;
|
||||
|
||||
writeControl timeStep;
|
||||
|
||||
writeInterval 1000; //10 to see the meshing steps
|
||||
|
||||
purgeWrite 0;
|
||||
|
||||
writeFormat ascii;
|
||||
|
||||
writePrecision 10;
|
||||
|
||||
writeCompression uncompressed;
|
||||
|
||||
timeFormat general;
|
||||
|
||||
timePrecision 6;
|
||||
|
||||
runTimeModifiable yes;
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1 +0,0 @@
|
||||
cvMeshDict-generatePoints
|
||||
280
tutorials/mesh/cvMesh/simpleShapes/system/cvMeshDict
Normal file
280
tutorials/mesh/cvMesh/simpleShapes/system/cvMeshDict
Normal file
@ -0,0 +1,280 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: dev |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
|
||||
root "";
|
||||
case "";
|
||||
instance "";
|
||||
local "";
|
||||
|
||||
class dictionary;
|
||||
object cvMeshDict;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
// Important:
|
||||
// ----------
|
||||
// Any scalar with a name <name>Coeff specifies a value that will be implemented
|
||||
// as a faction of the local target cell size
|
||||
// Any scalar with a name <name>Size specifies an absolute size.
|
||||
|
||||
|
||||
// Geometry. Definition of all surfaces. All surfaces are of class
|
||||
// searchableSurface.
|
||||
// Surfaces need to be (almost) closed - use closedTriSurfaceMesh
|
||||
// if they are not topologically closed. Surfaces need to be oriented so
|
||||
// the space to be meshed is always on the inside of all surfaces. Use e.g.
|
||||
// surfaceOrient.
|
||||
geometry
|
||||
{
|
||||
// Internal shape
|
||||
coneAndSphere.obj
|
||||
{
|
||||
name coneAndSphere;
|
||||
type triSurfaceMesh;
|
||||
tolerance 0.00001;
|
||||
}
|
||||
|
||||
// // Internal shape
|
||||
// coneAndSphere
|
||||
// {
|
||||
// type searchableSurfaceWithGaps;
|
||||
// surface coneAndSphere.obj;
|
||||
// gap 0.001;
|
||||
// }
|
||||
|
||||
// Bounds of domain
|
||||
domain.stl
|
||||
{
|
||||
type triSurfaceMesh;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
surfaceConformation
|
||||
{
|
||||
// Point that is inside wanted part of geometry.
|
||||
locationInMesh (0 -0.5 0);
|
||||
|
||||
// Balance this between
|
||||
// - very low distance: little chance of interference from other
|
||||
// surfaces
|
||||
// - largish distance: less non-orthogonality in final cell
|
||||
// (circumcentre far away from centroid)
|
||||
pointPairDistanceCoeff 0.1;
|
||||
|
||||
mixedFeaturePointPPDistanceCoeff 5.0;
|
||||
|
||||
featurePointExclusionDistanceCoeff 0.4;
|
||||
|
||||
featureEdgeExclusionDistanceCoeff 0.2;
|
||||
|
||||
surfaceSearchDistanceCoeff 2.5;
|
||||
|
||||
maxSurfaceProtrusionCoeff 0.1;
|
||||
|
||||
maxQuadAngle 125;
|
||||
|
||||
surfaceConformationRebuildFrequency 10;
|
||||
|
||||
coarseConformationControls
|
||||
{
|
||||
initial
|
||||
{
|
||||
edgeSearchDistCoeff 1.1;
|
||||
surfacePtReplaceDistCoeff 0.5;
|
||||
}
|
||||
|
||||
iteration
|
||||
{
|
||||
edgeSearchDistCoeff 1.25;
|
||||
surfacePtReplaceDistCoeff 0.7;
|
||||
}
|
||||
|
||||
maxIterations 15;
|
||||
|
||||
iterationToInitialHitRatioLimit 0.001;
|
||||
}
|
||||
|
||||
fineConformationControls
|
||||
{
|
||||
initial
|
||||
{
|
||||
edgeSearchDistCoeff 1.1;
|
||||
surfacePtReplaceDistCoeff 0.5;
|
||||
}
|
||||
|
||||
iteration
|
||||
{
|
||||
edgeSearchDistCoeff 1.25;
|
||||
surfacePtReplaceDistCoeff 0.7;
|
||||
}
|
||||
|
||||
maxIterations 15;
|
||||
|
||||
iterationToInitialHitRatioLimit 0.001;
|
||||
}
|
||||
|
||||
geometryToConformTo
|
||||
{
|
||||
coneAndSphere
|
||||
{
|
||||
featureMethod extendedFeatureEdgeMesh;
|
||||
extendedFeatureEdgeMesh "coneAndSphere.extendedFeatureEdgeMesh";
|
||||
}
|
||||
|
||||
domain.stl
|
||||
{
|
||||
featureMethod extendedFeatureEdgeMesh;
|
||||
extendedFeatureEdgeMesh "domain.extendedFeatureEdgeMesh";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
additionalFeatures {}
|
||||
}
|
||||
|
||||
|
||||
initialPoints
|
||||
{
|
||||
// Do not place point closer than minimumSurfaceDistanceCoeff
|
||||
// to the surface. Is fraction of local target cell size (see below)
|
||||
minimumSurfaceDistanceCoeff 0.55;
|
||||
|
||||
initialPointsMethod autoDensity;
|
||||
// initialPointsMethod uniformGrid;
|
||||
// initialPointsMethod bodyCentredCubic;
|
||||
// initialPointsMethod pointFile;
|
||||
|
||||
// Take boundbox of all geometry. Samples with this box. If too much
|
||||
// samples (due to target cell size) in box split box.
|
||||
autoDensityDetails
|
||||
{
|
||||
// Number of refinement levels. Needs to be enough to pick up features
|
||||
// due to size ratio.
|
||||
minLevels 2;
|
||||
// Split box if ratio of min to max size larger than maxSizeRatio
|
||||
maxSizeRatio 5.0;
|
||||
// Per box sample 3x3x3 internally
|
||||
sampleResolution 3;
|
||||
// Additionally per face of the box sample 3
|
||||
surfaceSampleResolution 3;
|
||||
}
|
||||
|
||||
uniformGridDetails
|
||||
{
|
||||
initialCellSize 0.0015;
|
||||
randomiseInitialGrid yes;
|
||||
randomPerturbationCoeff 0.02;
|
||||
}
|
||||
|
||||
bodyCentredCubicDetails
|
||||
{
|
||||
initialCellSize 0.0015;
|
||||
randomiseInitialGrid no;
|
||||
randomPerturbationCoeff 0.1;
|
||||
}
|
||||
|
||||
pointFileDetails
|
||||
{
|
||||
pointFile "constant/internalDelaunayVertices";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
motionControl
|
||||
{
|
||||
defaultCellSize 0.1;
|
||||
|
||||
// Assign a priority to all requests for cell sizes, the highest overrules.
|
||||
defaultPriority 0;
|
||||
|
||||
cellSizeControlGeometry
|
||||
{
|
||||
}
|
||||
|
||||
relaxationModel adaptiveLinear;
|
||||
|
||||
adaptiveLinearCoeffs
|
||||
{
|
||||
relaxationStart 1.0;
|
||||
relaxationEnd 0.0;
|
||||
}
|
||||
|
||||
objOutput no;
|
||||
|
||||
timeChecks yes;
|
||||
|
||||
alignmentSearchSpokes 36;
|
||||
|
||||
alignmentAcceptanceAngle 48;
|
||||
|
||||
sizeAndAlignmentRebuildFrequency 20;
|
||||
|
||||
pointInsertionCriteria
|
||||
{
|
||||
cellCentreDistCoeff 1.75;
|
||||
faceAreaRatioCoeff 0.0025;
|
||||
acceptanceAngle 21.5;
|
||||
}
|
||||
|
||||
pointRemovalCriteria
|
||||
{
|
||||
cellCentreDistCoeff 0.65;
|
||||
}
|
||||
|
||||
faceAreaWeightModel piecewiseLinearRamp;
|
||||
|
||||
piecewiseLinearRampCoeffs
|
||||
{
|
||||
lowerAreaFraction 0.5;
|
||||
upperAreaFraction 1.0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
polyMeshFiltering
|
||||
{
|
||||
filterSizeCoeff 0.2;
|
||||
mergeClosenessCoeff 1e-4;
|
||||
continueFilteringOnBadInitialPolyMesh true;
|
||||
filterErrorReductionCoeff 0.5;
|
||||
filterCountSkipThreshold 4;
|
||||
maxCollapseIterations 25;
|
||||
maxConsecutiveEqualFaceSets 5;
|
||||
surfaceStepFaceAngle 80;
|
||||
edgeCollapseGuardFraction 0.3;
|
||||
maxCollapseFaceToPointSideLengthCoeff 0.35;
|
||||
}
|
||||
|
||||
|
||||
meshQualityControls
|
||||
{
|
||||
maxNonOrtho 65;
|
||||
maxBoundarySkewness 50;
|
||||
maxInternalSkewness 10;
|
||||
maxConcave 80;
|
||||
minTetQuality 1e-30;
|
||||
minVol 0;
|
||||
minArea -1;
|
||||
minTwist 0.02;
|
||||
minDeterminant 0.001;
|
||||
minFaceWeight 0.02;
|
||||
minVolRatio 0.01;
|
||||
minTriangleTwist -1;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,287 +0,0 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: dev |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
|
||||
root "";
|
||||
case "";
|
||||
instance "";
|
||||
local "";
|
||||
|
||||
class dictionary;
|
||||
object cvMeshDict;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
// Important:
|
||||
// ----------
|
||||
// Any scalar with a name <name>Coeff specifies a value that will be implemented
|
||||
// as a faction of the local target cell size
|
||||
// Any scalar with a name <name>Size specifies an absolute size.
|
||||
|
||||
|
||||
// Geometry. Definition of all surfaces. All surfaces are of class
|
||||
// searchableSurface.
|
||||
// Surfaces need to be (almost) closed - use closedTriSurfaceMesh
|
||||
// if they are not topologically closed. Surfaces need to be oriented so
|
||||
// the space to be meshed is always on the inside of all surfaces. Use e.g.
|
||||
// surfaceOrient.
|
||||
geometry
|
||||
{
|
||||
// Internal shape
|
||||
coneAndSphere.obj
|
||||
{
|
||||
name coneAndSphere;
|
||||
type triSurfaceMesh;
|
||||
tolerance 0.00001;
|
||||
}
|
||||
|
||||
// // Internal shape
|
||||
// coneAndSphere
|
||||
// {
|
||||
// type searchableSurfaceWithGaps;
|
||||
// surface coneAndSphere.obj;
|
||||
// gap 0.001;
|
||||
// }
|
||||
|
||||
// Bounds of domain
|
||||
domain.stl
|
||||
{
|
||||
type triSurfaceMesh;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
surfaceConformation
|
||||
{
|
||||
// Point that is inside wanted part of geometry.
|
||||
locationInMesh (0 -0.5 0);
|
||||
|
||||
// Balance this between
|
||||
// - very low distance: little chance of interference from other
|
||||
// surfaces
|
||||
// - largish distance: less non-orthogonality in final cell
|
||||
// (circumcentre far away from centroid)
|
||||
pointPairDistanceCoeff 0.1;
|
||||
|
||||
mixedFeaturePointPPDistanceCoeff 5.0;
|
||||
|
||||
featurePointExclusionDistanceCoeff 0.4;
|
||||
|
||||
featureEdgeExclusionDistanceCoeff 0.2;
|
||||
|
||||
surfaceSearchDistanceCoeff 2.5;
|
||||
|
||||
maxSurfaceProtrusionCoeff 0.1;
|
||||
|
||||
maxQuadAngle 125;
|
||||
|
||||
surfaceConformationRebuildFrequency 10;
|
||||
|
||||
coarseConformationControls
|
||||
{
|
||||
initial
|
||||
{
|
||||
edgeSearchDistCoeff 1.1;
|
||||
surfacePtReplaceDistCoeff 0.5;
|
||||
}
|
||||
|
||||
iteration
|
||||
{
|
||||
edgeSearchDistCoeff 1.25;
|
||||
surfacePtReplaceDistCoeff 0.7;
|
||||
}
|
||||
|
||||
maxIterations 15;
|
||||
|
||||
iterationToInitialHitRatioLimit 0.001;
|
||||
}
|
||||
|
||||
fineConformationControls
|
||||
{
|
||||
initial
|
||||
{
|
||||
edgeSearchDistCoeff 1.1;
|
||||
surfacePtReplaceDistCoeff 0.5;
|
||||
}
|
||||
|
||||
iteration
|
||||
{
|
||||
edgeSearchDistCoeff 1.25;
|
||||
surfacePtReplaceDistCoeff 0.7;
|
||||
}
|
||||
|
||||
maxIterations 15;
|
||||
|
||||
iterationToInitialHitRatioLimit 0.001;
|
||||
}
|
||||
|
||||
geometryToConformTo
|
||||
{
|
||||
coneAndSphere
|
||||
{
|
||||
featureMethod extendedFeatureEdgeMesh;
|
||||
extendedFeatureEdgeMesh "coneAndSphere.extendedFeatureEdgeMesh";
|
||||
}
|
||||
|
||||
domain.stl
|
||||
{
|
||||
featureMethod extendedFeatureEdgeMesh;
|
||||
extendedFeatureEdgeMesh "domain.extendedFeatureEdgeMesh";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
additionalFeatures {}
|
||||
}
|
||||
|
||||
|
||||
initialPoints
|
||||
{
|
||||
// Do not place point closer than minimumSurfaceDistanceCoeff
|
||||
// to the surface. Is fraction of local target cell size (see below)
|
||||
minimumSurfaceDistanceCoeff 0.55;
|
||||
|
||||
initialPointsMethod hierarchicalDensityWeightedStochastic;
|
||||
//initialPointsMethod densityWeightedStochastic;
|
||||
// initialPointsMethod uniformGrid;
|
||||
// initialPointsMethod bodyCentredCubic;
|
||||
// initialPointsMethod pointFile;
|
||||
|
||||
|
||||
// Take boundbox of all geometry. Samples with this box. If too much
|
||||
// samples (due to target cell size) in box split box.
|
||||
hierarchicalDensityWeightedStochasticDetails
|
||||
{
|
||||
// Number of refinement levels. Needs to be enough to pick up features
|
||||
// due to size ratio.
|
||||
minLevels 2;
|
||||
// Split box if ratio of min to max size larger than maxSizeRatio
|
||||
maxSizeRatio 5.0;
|
||||
// Per box sample 3x3x3 internally
|
||||
sampleResolution 3;
|
||||
// Additionally per face of the box sample 3
|
||||
surfaceSampleResolution 3;
|
||||
}
|
||||
|
||||
densityWeightedStochasticDetails
|
||||
{
|
||||
totalVolume 1.56e-05;
|
||||
}
|
||||
|
||||
uniformGridDetails
|
||||
{
|
||||
initialCellSize 0.0015;
|
||||
randomiseInitialGrid yes;
|
||||
randomPerturbationCoeff 0.02;
|
||||
}
|
||||
|
||||
bodyCentredCubicDetails
|
||||
{
|
||||
initialCellSize 0.0015;
|
||||
randomiseInitialGrid no;
|
||||
randomPerturbationCoeff 0.1;
|
||||
}
|
||||
|
||||
pointFileDetails
|
||||
{
|
||||
pointFile "constant/internalDelaunayVertices";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
motionControl
|
||||
{
|
||||
defaultCellSize 0.1;
|
||||
|
||||
// Assign a priority to all requests for cell sizes, the highest overrules.
|
||||
defaultPriority 0;
|
||||
|
||||
cellSizeControlGeometry
|
||||
{
|
||||
}
|
||||
|
||||
relaxationModel adaptiveLinear;
|
||||
|
||||
adaptiveLinearCoeffs
|
||||
{
|
||||
relaxationStart 1.0;
|
||||
relaxationEnd 0.0;
|
||||
}
|
||||
|
||||
objOutput no;
|
||||
|
||||
timeChecks yes;
|
||||
|
||||
alignmentSearchSpokes 36;
|
||||
|
||||
alignmentAcceptanceAngle 48;
|
||||
|
||||
sizeAndAlignmentRebuildFrequency 20;
|
||||
|
||||
pointInsertionCriteria
|
||||
{
|
||||
cellCentreDistCoeff 1.75;
|
||||
faceAreaRatioCoeff 0.0025;
|
||||
acceptanceAngle 21.5;
|
||||
}
|
||||
|
||||
pointRemovalCriteria
|
||||
{
|
||||
cellCentreDistCoeff 0.65;
|
||||
}
|
||||
|
||||
faceAreaWeightModel piecewiseLinearRamp;
|
||||
|
||||
piecewiseLinearRampCoeffs
|
||||
{
|
||||
lowerAreaFraction 0.5;
|
||||
upperAreaFraction 1.0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
polyMeshFiltering
|
||||
{
|
||||
filterSizeCoeff 0.2;
|
||||
mergeClosenessCoeff 1e-4;
|
||||
continueFilteringOnBadInitialPolyMesh true;
|
||||
filterErrorReductionCoeff 0.5;
|
||||
filterCountSkipThreshold 4;
|
||||
maxCollapseIterations 25;
|
||||
maxConsecutiveEqualFaceSets 5;
|
||||
surfaceStepFaceAngle 80;
|
||||
edgeCollapseGuardFraction 0.3;
|
||||
maxCollapseFaceToPointSideLengthCoeff 0.35;
|
||||
}
|
||||
|
||||
|
||||
meshQualityControls
|
||||
{
|
||||
maxNonOrtho 65;
|
||||
maxBoundarySkewness 50;
|
||||
maxInternalSkewness 10;
|
||||
maxConcave 80;
|
||||
minTetQuality 1e-30;
|
||||
minVol 0;
|
||||
minArea -1;
|
||||
minTwist 0.02;
|
||||
minDeterminant 0.001;
|
||||
minFaceWeight 0.02;
|
||||
minVolRatio 0.01;
|
||||
minTriangleTwist -1;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,226 +0,0 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: dev |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
|
||||
root "";
|
||||
case "";
|
||||
instance "";
|
||||
local "";
|
||||
|
||||
class dictionary;
|
||||
object cvMeshDict;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// Any scalar with a name <name>Coeff specifies a value that will be implemented
|
||||
// as a faction of the local target cell size
|
||||
|
||||
geometry
|
||||
{
|
||||
flange.obj
|
||||
{
|
||||
type triSurfaceMesh;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
surfaceConformation
|
||||
{
|
||||
locationInMesh (0 0 0);
|
||||
|
||||
pointPairDistanceCoeff 0.1;
|
||||
|
||||
mixedFeaturePointPPDistanceCoeff 5.0;
|
||||
|
||||
featurePointExclusionDistanceCoeff 0.4;
|
||||
|
||||
featureEdgeExclusionDistanceCoeff 0.2;
|
||||
|
||||
surfaceSearchDistanceCoeff 2.5;
|
||||
|
||||
maxSurfaceProtrusionCoeff 0.1;
|
||||
|
||||
maxQuadAngle 125;
|
||||
|
||||
surfaceConformationRebuildFrequency 10;
|
||||
|
||||
coarseConformationControls
|
||||
{
|
||||
initial
|
||||
{
|
||||
edgeSearchDistCoeff 1.1;
|
||||
surfacePtReplaceDistCoeff 0.5;
|
||||
}
|
||||
|
||||
iteration
|
||||
{
|
||||
edgeSearchDistCoeff 1.25;
|
||||
surfacePtReplaceDistCoeff 0.7;
|
||||
}
|
||||
|
||||
maxIterations 15;
|
||||
|
||||
iterationToInitialHitRatioLimit 0.001;
|
||||
}
|
||||
|
||||
fineConformationControls
|
||||
{
|
||||
initial
|
||||
{
|
||||
edgeSearchDistCoeff 1.1;
|
||||
surfacePtReplaceDistCoeff 0.5;
|
||||
}
|
||||
|
||||
iteration
|
||||
{
|
||||
edgeSearchDistCoeff 1.25;
|
||||
surfacePtReplaceDistCoeff 0.7;
|
||||
}
|
||||
|
||||
maxIterations 15;
|
||||
|
||||
iterationToInitialHitRatioLimit 0.001;
|
||||
}
|
||||
|
||||
geometryToConformTo
|
||||
{
|
||||
flange.obj
|
||||
{
|
||||
featureMethod extendedFeatureEdgeMesh;
|
||||
extendedFeatureEdgeMesh "flange.extendedFeatureEdgeMesh";
|
||||
}
|
||||
}
|
||||
|
||||
additionalFeatures {}
|
||||
}
|
||||
|
||||
|
||||
initialPoints
|
||||
{
|
||||
minimumSurfaceDistanceCoeff 0.55;
|
||||
|
||||
// initialPointsMethod densityWeightedStochastic;
|
||||
// initialPointsMethod uniformGrid;
|
||||
// initialPointsMethod bodyCentredCubic;
|
||||
initialPointsMethod pointFile;
|
||||
|
||||
densityWeightedStochasticDetails
|
||||
{
|
||||
totalVolume 1.56e-05;
|
||||
}
|
||||
|
||||
uniformGridDetails
|
||||
{
|
||||
initialCellSize 0.0015;
|
||||
randomiseInitialGrid yes;
|
||||
randomPerturbationCoeff 0.02;
|
||||
}
|
||||
|
||||
bodyCentredCubicDetails
|
||||
{
|
||||
initialCellSize 0.0015;
|
||||
randomiseInitialGrid no;
|
||||
randomPerturbationCoeff 0.1;
|
||||
}
|
||||
|
||||
pointFileDetails
|
||||
{
|
||||
pointFile "constant/internalDelaunayVertices";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
motionControl
|
||||
{
|
||||
defaultCellSize 0.00075;
|
||||
|
||||
// Assign a priority to all requests for cell sizes, the highest overrules.
|
||||
defaultPriority 0;
|
||||
|
||||
cellSizeControlGeometry
|
||||
{
|
||||
}
|
||||
|
||||
relaxationModel adaptiveLinear;
|
||||
|
||||
adaptiveLinearCoeffs
|
||||
{
|
||||
relaxationStart 1.0;
|
||||
relaxationEnd 0.0;
|
||||
}
|
||||
|
||||
objOutput no;
|
||||
|
||||
timeChecks yes;
|
||||
|
||||
alignmentSearchSpokes 36;
|
||||
|
||||
alignmentAcceptanceAngle 48;
|
||||
|
||||
sizeAndAlignmentRebuildFrequency 20;
|
||||
|
||||
pointInsertionCriteria
|
||||
{
|
||||
cellCentreDistCoeff 1.75;
|
||||
faceAreaRatioCoeff 0.0025;
|
||||
acceptanceAngle 21.5;
|
||||
}
|
||||
|
||||
pointRemovalCriteria
|
||||
{
|
||||
cellCentreDistCoeff 0.65;
|
||||
}
|
||||
|
||||
faceAreaWeightModel piecewiseLinearRamp;
|
||||
|
||||
piecewiseLinearRampCoeffs
|
||||
{
|
||||
lowerAreaFraction 0.5;
|
||||
upperAreaFraction 1.0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
polyMeshFiltering
|
||||
{
|
||||
filterSizeCoeff 0.2;
|
||||
mergeClosenessCoeff 1e-4;
|
||||
continueFilteringOnBadInitialPolyMesh true;
|
||||
filterErrorReductionCoeff 0.5;
|
||||
filterCountSkipThreshold 4;
|
||||
maxCollapseIterations 25;
|
||||
maxConsecutiveEqualFaceSets 5;
|
||||
surfaceStepFaceAngle 80;
|
||||
edgeCollapseGuardFraction 0.3;
|
||||
maxCollapseFaceToPointSideLengthCoeff 0.35;
|
||||
}
|
||||
|
||||
|
||||
meshQualityControls
|
||||
{
|
||||
maxNonOrtho 65;
|
||||
maxBoundarySkewness 50;
|
||||
maxInternalSkewness 10;
|
||||
maxConcave 80;
|
||||
minTetQuality 1e-30;
|
||||
minVol 0;
|
||||
minArea -1;
|
||||
minTwist 0.02;
|
||||
minDeterminant 0.001;
|
||||
minFaceWeight 0.02;
|
||||
minVolRatio 0.01;
|
||||
minTriangleTwist -1;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
Reference in New Issue
Block a user