Data Structures | |
class | laplaceSmoother |
Public Member Functions | |
meshOptimizer (polyMeshGen &mesh) | |
Construct from mesh. More... | |
~meshOptimizer () | |
void | enforceConstraints (const word subsetName="badPoints") |
template<class labelListType > | |
void | lockCells (const labelListType &) |
lock the cells which shall not be modified More... | |
void | lockCellsInSubset (const word &subsetName) |
template<class labelListType > | |
void | lockFaces (const labelListType &) |
lock the faces whih shall not be modified More... | |
void | lockFacesInSubset (const word &subsetName) |
template<class labelListType > | |
void | lockPoints (const labelListType &) |
lock points which shall not be moved More... | |
void | lockPointsInSubset (const word &subsetName) |
void | removeUserConstraints () |
reset to default constraints More... | |
void | optimizeSurface (const meshOctree &) |
smooth surface vertices More... | |
void | untangleMeshFV (const label maxNumGlobalIterations=10, const label maxNumIterations=50, const label maxNumSurfaceIterations=2, const bool relaxedCheck=false) |
void | optimizeBoundaryLayer (const bool addBufferLayer=true) |
void | untangleBoundaryLayer () |
void | optimizeLowQualityFaces (const label maxNumIterations=10) |
void | optimizeMeshNearBoundaries (const label maxNumIterations=10, const label numLayersOfCells=2) |
void | optimizeMeshFV (const label numLaplaceIterations=5, const label maxNumGlobalIterations=10, const label maxNumIterations=50, const label maxNumSurfaceIterations=2) |
final optimisation More... | |
void | optimizeMeshFVBestQuality (const label maxNumIterations=50, const scalar threshold=0.1) |
greedy optimisation until the mesh can be improved More... | |
Private Types | |
enum | vertexType_ { INSIDE = 1, BOUNDARY = 2, EDGE = 4, CORNER = 8, PARALLELBOUNDARY = 16, LOCKED = 32 } |
Private Member Functions | |
const meshSurfaceEngine & | meshSurface () const |
return mesh surface More... | |
void | clearSurface () |
label | findBadFaces (labelHashSet &, const boolList &) const |
find problematic faces More... | |
label | findLowQualityFaces (labelHashSet &, const boolList &) const |
void | calculatePointLocations () |
mark point locations More... | |
meshOptimizer (const meshOptimizer &) | |
Disallow default bitwise copy construct. More... | |
void | operator= (const meshOptimizer &) |
Disallow default bitwise assignment. More... | |
Private Attributes | |
polyMeshGen & | mesh_ |
reference to the mesh More... | |
List< direction > | vertexLocation_ |
location of vertex (internal, boundary, edge, corner) More... | |
labelLongList | lockedFaces_ |
locked faces which shall not be changed More... | |
meshSurfaceEngine * | msePtr_ |
mesh surface More... | |
bool | enforceConstraints_ |
enforce constraints More... | |
word | badPointsSubsetName_ |
name of the subset contaning tangled points More... | |
Definition at line 60 of file meshOptimizer.H.
|
private |
Enumerator | |
---|---|
INSIDE | |
BOUNDARY | |
EDGE | |
CORNER | |
PARALLELBOUNDARY | |
LOCKED |
Definition at line 191 of file meshOptimizer.H.
|
private |
Disallow default bitwise copy construct.
meshOptimizer | ( | polyMeshGen & | mesh | ) |
Construct from mesh.
Definition at line 171 of file meshOptimizer.C.
References meshOptimizer::calculatePointLocations().
~meshOptimizer | ( | ) |
Definition at line 185 of file meshOptimizer.C.
References meshOptimizer::clearSurface().
|
private |
return mesh surface
Definition at line 45 of file meshOptimizer.C.
References meshOptimizer::mesh_, and meshOptimizer::msePtr_.
Referenced by meshOptimizer::calculatePointLocations(), meshOptimizer::optimizeBoundaryLayer(), and meshOptimizer::optimizeSurface().
|
private |
Definition at line 53 of file meshOptimizer.C.
References Foam::deleteDemandDrivenData(), and meshOptimizer::msePtr_.
Referenced by meshOptimizer::optimizeBoundaryLayer(), meshOptimizer::optimizeSurface(), and meshOptimizer::~meshOptimizer().
|
private |
find problematic faces
Definition at line 59 of file meshOptimizer.C.
References Foam::polyMeshGenChecks::checkCellPartTetrahedra(), Foam::polyMeshGenChecks::checkFaceAreas(), Foam::polyMeshGenChecks::checkFaceFlatness(), Foam::polyMeshGenChecks::checkFacePyramids(), HashTable::clear(), Foam::returnReduce(), and HashTable::size().
|
private |
Definition at line 108 of file meshOptimizer.C.
References Foam::polyMeshGenChecks::checkFaceDotProduct(), Foam::polyMeshGenChecks::checkFaceSkewness(), HashTable::clear(), Foam::returnReduce(), and HashTable::size().
|
private |
mark point locations
mark boundary vertices
mark edge vertices
mark corner vertices
Definition at line 136 of file meshOptimizer.C.
References polyMeshGenCells::addressingData(), meshOptimizer::BOUNDARY, meshSurfaceEngine::boundaryPoints(), meshOptimizer::CORNER, meshSurfacePartitioner::corners(), meshOptimizer::EDGE, meshSurfacePartitioner::edgePoints(), forAll, forAllConstIter(), meshOptimizer::INSIDE, meshOptimizer::mesh_, meshOptimizer::meshSurface(), meshOptimizer::PARALLELBOUNDARY, UPstream::parRun(), polyMeshGenAddressing::pointAtProcs(), polyMeshGenPoints::points(), List::setSize(), pointFieldPMG::size(), VRWGraph::sizeOfRow(), and meshOptimizer::vertexLocation_.
Referenced by meshOptimizer::meshOptimizer(), and meshOptimizer::optimizeBoundaryLayer().
|
private |
Disallow default bitwise assignment.
void enforceConstraints | ( | const word | subsetName = "badPoints" | ) |
Flag stopping the meshing process if it is not possible to untangle the surface without sacrificing geometry constraints Points which must be moved away from the required position are stored into a point subset
Definition at line 192 of file meshOptimizer.C.
References meshOptimizer::badPointsSubsetName_, and meshOptimizer::enforceConstraints_.
Referenced by tetMeshGenerator::optimiseFinalMesh(), voronoiMeshGenerator::optimiseFinalMesh(), and cartesianMeshGenerator::optimiseFinalMesh().
|
inline |
lock the cells which shall not be modified
Finally, mark locked points and faces
Definition at line 39 of file meshOptimizerI.H.
References polyMeshGenFaces::addFaceSubset(), polyMeshGenFaces::addFaceToSubset(), polyMeshGenPoints::addPointSubset(), polyMeshGenPoints::addPointToSubset(), LongList< T, Offset >::append(), UPstream::blocking, LongList< T, Offset >::byteSize(), Foam::constant::universal::c, cells, polyMeshGenCells::cells(), f(), polyMeshGenFaces::faces(), forAll, meshOptimizer::LOCKED, meshOptimizer::lockedFaces_, meshOptimizer::mesh_, UPstream::parRun(), polyMeshGenFaces::procBoundaries(), faceListPMG::size(), and meshOptimizer::vertexLocation_.
Referenced by meshOptimizer::lockCellsInSubset(), meshOptimizer::lockPointsInSubset(), and meshOptimizer::optimizeBoundaryLayer().
void lockCellsInSubset | ( | const word & | subsetName | ) |
lock cells which shall not be modified contained inside the specified subset
lock the points in the cell subset with the given name
Definition at line 199 of file meshOptimizer.C.
References polyMeshGenCells::cellsInSubset(), polyMeshGenCells::cellSubsetIndex(), Foam::endl(), meshOptimizer::lockCells(), meshOptimizer::mesh_, and Foam::Warning.
Referenced by main().
|
inline |
lock the faces whih shall not be modified
Finally, mark locked points and faces
Definition at line 123 of file meshOptimizerI.H.
References polyMeshGenFaces::addFaceSubset(), polyMeshGenFaces::addFaceToSubset(), polyMeshGenPoints::addPointSubset(), polyMeshGenPoints::addPointToSubset(), LongList< T, Offset >::append(), UPstream::blocking, LongList< T, Offset >::byteSize(), f(), polyMeshGenFaces::faces(), forAll, meshOptimizer::LOCKED, meshOptimizer::lockedFaces_, meshOptimizer::mesh_, UPstream::parRun(), polyMeshGenFaces::procBoundaries(), faceListPMG::size(), and meshOptimizer::vertexLocation_.
Referenced by meshOptimizer::lockFacesInSubset().
void lockFacesInSubset | ( | const word & | subsetName | ) |
lock faces which shall not be modified stored in a face subset
lock the points in the face subset with the given name
Definition at line 217 of file meshOptimizer.C.
References Foam::endl(), polyMeshGenFaces::facesInSubset(), polyMeshGenFaces::faceSubsetIndex(), meshOptimizer::lockFaces(), meshOptimizer::mesh_, and Foam::Warning.
|
inline |
lock points which shall not be moved
Definition at line 203 of file meshOptimizerI.H.
References polyMeshGenPoints::addPointSubset(), polyMeshGenPoints::addPointToSubset(), LongList< T, Offset >::append(), UPstream::blocking, LongList< T, Offset >::byteSize(), f(), polyMeshGenFaces::faces(), forAll, meshOptimizer::LOCKED, meshOptimizer::mesh_, UPstream::parRun(), polyMeshGenFaces::procBoundaries(), and meshOptimizer::vertexLocation_.
Referenced by cartesianMeshGenerator::refBoundaryLayers(), tetMeshGenerator::refBoundaryLayers(), and voronoiMeshGenerator::refBoundaryLayers().
void lockPointsInSubset | ( | const word & | subsetName | ) |
lock points which shall not be modified given as a point subset
lock the points in the point subset with the given name
Definition at line 235 of file meshOptimizer.C.
References Foam::endl(), meshOptimizer::lockCells(), meshOptimizer::mesh_, polyMeshGenPoints::pointsInSubset(), polyMeshGenPoints::pointSubsetIndex(), and Foam::Warning.
void removeUserConstraints | ( | ) |
reset to default constraints
unlock points
Definition at line 253 of file meshOptimizer.C.
References forAll, meshOptimizer::LOCKED, meshOptimizer::lockedFaces_, LongList< T, Offset >::setSize(), and meshOptimizer::vertexLocation_.
Referenced by meshOptimizer::optimizeBoundaryLayer(), and meshOptimizer::untangleBoundaryLayer().
void optimizeSurface | ( | const meshOctree & | octree | ) |
smooth surface vertices
Definition at line 44 of file meshOptimizerOptimizeSurface.C.
References meshOptimizer::badPointsSubsetName_, meshOptimizer::clearSurface(), Foam::endl(), meshOptimizer::enforceConstraints_, Foam::Info, meshSurfaceMapper::mapVerticesOntoSurfacePatches(), and meshOptimizer::meshSurface().
Referenced by tetMeshGenerator::optimiseFinalMesh().
void untangleMeshFV | ( | const label | maxNumGlobalIterations = 10 , |
const label | maxNumIterations = 50 , |
||
const label | maxNumSurfaceIterations = 2 , |
||
const bool | relaxedCheck = false |
||
) |
performs mesh untangling based on detected negative normals a global iteration consists of maxNumIterations iterations when only internal points are moved and maxNumSurfaceIterations when surface points are moved
check if any points in the tet mesh shall not move
perform optimisation
create a tet mesh from the mesh and the labels of bad faces
construct tetMeshOptimisation and improve positions of points in the tet mesh
update points in the mesh from the coordinates in the tet mesh
perform optimisation
create tethrahedral mesh from the cells which shall be smoothed
contruct tetMeshOptimisation
the point stays in the plane determined by the point normal
move points without any constraints on the movement
move boundary points without any constraints
Definition at line 57 of file optimizeMeshFV.C.
References Foam::abort(), LongList< T, Offset >::append(), partTetMesh::createPolyMesh(), Foam::endl(), f(), polyMeshGenFaces::faces(), Foam::FatalError, FatalErrorIn, Foam::polyMeshGenChecks::findBadFaces(), Foam::polyMeshGenChecks::findBadFacesRelaxed(), forAll, forAllConstIter(), forAllRow, Foam::Info, polyMeshGenFaces::neighbour(), tetMeshOptimisation::optimiseBoundarySurfaceLaplace(), tetMeshOptimisation::optimiseBoundaryVolumeOptimizer(), tetMeshOptimisation::optimiseUsingKnuppMetric(), tetMeshOptimisation::optimiseUsingMeshUntangler(), tetMeshOptimisation::optimiseUsingVolumeOptimizer(), polyMeshGenPoints::points(), partTetMesh::points(), partTetMesh::pointTets(), polyMeshGenModifier::removeUnusedVertices(), Foam::returnReduce(), faceListPMG::size(), pointFieldPMG::size(), partTetMesh::smoothVertex(), partTetMesh::tets(), partTetMesh::updateOrigMesh(), and WarningIn.
Referenced by main(), meshOptimisation(), tetMeshGenerator::optimiseFinalMesh(), voronoiMeshGenerator::optimiseFinalMesh(), cartesianMeshGenerator::optimiseFinalMesh(), meshOptimizer::optimizeBoundaryLayer(), and meshOptimizer::untangleBoundaryLayer().
void optimizeBoundaryLayer | ( | const bool | addBufferLayer = true | ) |
performs optimisation of boundary layer cells it is applied to the first boundary layer, only
create a buffer layer which will not be modified by the smoother
check if the bnd layer is tangled somewhere
lock boundary layer points, faces and cells
optimize mesh quality
untangle remaining faces and lock the boundary layer cells
unlock bnd layer points
Definition at line 302 of file optimizeMeshFV.C.
References Foam::abort(), refineBoundaryLayers::activateSpecialMode(), polyMeshGenCells::addCellSubset(), polyMeshGenCells::addCellToSubset(), LongList< T, Offset >::append(), meshOptimizer::calculatePointLocations(), polyMeshGenCells::clearAddressingData(), meshOptimizer::clearSurface(), Foam::endl(), meshSurfaceEngine::faceOwners(), Foam::FatalError, forAll, dictionary::found(), objectRegistry::foundObject(), Foam::Info, boundaryLayerOptimisation::isBaseFace(), meshOptimizer::lockCells(), meshOptimizer::LOCKED, dictionary::lookup(), objectRegistry::lookupObject(), Foam::mag(), meshOptimizer::mesh_, meshOptimizer::meshSurface(), boundaryLayerOptimisation::optimiseLayer(), meshOptimizer::optimizeMeshFV(), polyMeshGenPoints::points(), Foam::readBool(), boundaryLayerOptimisation::readSettings(), refineBoundaryLayers::readSettings(), refineBoundaryLayers::refineLayers(), meshOptimizer::removeUserConstraints(), polyMeshGenPoints::returnTime(), pointFieldPMG::size(), dictionary::subDict(), meshOptimizer::untangleMeshFV(), and meshOptimizer::vertexLocation_.
Referenced by meshOptimisation(), tetMeshGenerator::optimiseFinalMesh(), voronoiMeshGenerator::optimiseFinalMesh(), and cartesianMeshGenerator::optimiseFinalMesh().
void untangleBoundaryLayer | ( | ) |
performs untangling of boundary layer cells if the user requests for it
Definition at line 405 of file optimizeMeshFV.C.
References polyMeshGenCells::addCellSubset(), polyMeshGenCells::addCellToSubset(), Foam::polyMeshGenChecks::checkFacePyramids(), forAllConstIter(), dictionary::found(), objectRegistry::foundObject(), dictionary::lookup(), objectRegistry::lookupObject(), meshOptimizer::mesh_, polyMeshGenFaces::neighbour(), meshOptimizer::optimizeLowQualityFaces(), polyMeshGenFaces::owner(), Foam::readBool(), meshOptimizer::removeUserConstraints(), Foam::returnReduce(), polyMeshGenPoints::returnTime(), HashTable::size(), dictionary::subDict(), and meshOptimizer::untangleMeshFV().
Referenced by layerRefinement(), cartesianMeshGenerator::refBoundaryLayers(), tetMeshGenerator::refBoundaryLayers(), and voronoiMeshGenerator::refBoundaryLayers().
void optimizeLowQualityFaces | ( | const label | maxNumIterations = 10 | ) |
performs mesh optimisation for faces with high non-orthogonality and skewness
check if any points in the tet mesh shall not move
perform optimisation
construct tetMeshOptimisation and improve positions of points in the tet mesh
update points in the mesh from the new coordinates in the tet mesh
Definition at line 469 of file optimizeMeshFV.C.
References LongList< T, Offset >::append(), Foam::endl(), polyMeshGenFaces::faces(), Foam::polyMeshGenChecks::findLowQualityFaces(), forAll, forAllConstIter(), Foam::Info, meshOptimizer::LOCKED, meshOptimizer::mesh_, tetMeshOptimisation::optimiseUsingVolumeOptimizer(), faceListPMG::size(), partTetMesh::updateOrigMesh(), and meshOptimizer::vertexLocation_.
Referenced by meshOptimisation(), tetMeshGenerator::optimiseFinalMesh(), voronoiMeshGenerator::optimiseFinalMesh(), cartesianMeshGenerator::optimiseFinalMesh(), and meshOptimizer::untangleBoundaryLayer().
void optimizeMeshNearBoundaries | ( | const label | maxNumIterations = 10 , |
const label | numLayersOfCells = 2 |
||
) |
perform optimization of cells near the boundary the use shall specify the number of iterations and the number of cell layers which shall be taken into account
check if any points in the tet mesh shall not move
Definition at line 522 of file optimizeMeshFV.C.
References LongList< T, Offset >::append(), Foam::endl(), Foam::flush(), forAll, Foam::Info, tetMeshOptimisation::optimiseUsingVolumeOptimizer(), faceListPMG::size(), and partTetMesh::updateOrigMesh().
void optimizeMeshFV | ( | const label | numLaplaceIterations = 5 , |
const label | maxNumGlobalIterations = 10 , |
||
const label | maxNumIterations = 50 , |
||
const label | maxNumSurfaceIterations = 2 |
||
) |
final optimisation
Definition at line 557 of file optimizeMeshFV.C.
References Foam::endl(), Foam::Info, and meshOptimizer::laplaceSmoother::optimizeLaplacianPC().
Referenced by main(), meshOptimisation(), tetMeshGenerator::optimiseFinalMesh(), voronoiMeshGenerator::optimiseFinalMesh(), cartesianMeshGenerator::optimiseFinalMesh(), and meshOptimizer::optimizeBoundaryLayer().
void optimizeMeshFVBestQuality | ( | const label | maxNumIterations = 50 , |
const scalar | threshold = 0.1 |
||
) |
greedy optimisation until the mesh can be improved
check if any points in the tet mesh shall not move
perform optimisation
update the iteration number when the minimum is achieved
construct tetMeshOptimisation and improve positions of points in the tet mesh
update points in the mesh from the new coordinates in the tet mesh
Definition at line 580 of file optimizeMeshFV.C.
References LongList< T, Offset >::append(), Foam::endl(), Foam::polyMeshGenChecks::findWorstQualityFaces(), forAll, forAllConstIter(), Foam::Info, tetMeshOptimisation::optimiseUsingVolumeOptimizer(), faceListPMG::size(), and partTetMesh::updateOrigMesh().
Referenced by main().
|
private |
reference to the mesh
Definition at line 64 of file meshOptimizer.H.
Referenced by meshOptimizer::calculatePointLocations(), meshOptimizer::lockCells(), meshOptimizer::lockCellsInSubset(), meshOptimizer::lockFaces(), meshOptimizer::lockFacesInSubset(), meshOptimizer::lockPoints(), meshOptimizer::lockPointsInSubset(), meshOptimizer::meshSurface(), meshOptimizer::optimizeBoundaryLayer(), meshOptimizer::optimizeLowQualityFaces(), and meshOptimizer::untangleBoundaryLayer().
location of vertex (internal, boundary, edge, corner)
Definition at line 67 of file meshOptimizer.H.
Referenced by meshOptimizer::calculatePointLocations(), meshOptimizer::lockCells(), meshOptimizer::lockFaces(), meshOptimizer::lockPoints(), meshOptimizer::optimizeBoundaryLayer(), meshOptimizer::laplaceSmoother::optimizeLaplacian(), meshOptimizer::laplaceSmoother::optimizeLaplacianPC(), meshOptimizer::laplaceSmoother::optimizeLaplacianWPC(), meshOptimizer::optimizeLowQualityFaces(), and meshOptimizer::removeUserConstraints().
|
private |
locked faces which shall not be changed
Definition at line 70 of file meshOptimizer.H.
Referenced by meshOptimizer::lockCells(), meshOptimizer::lockFaces(), and meshOptimizer::removeUserConstraints().
|
mutableprivate |
mesh surface
Definition at line 73 of file meshOptimizer.H.
Referenced by meshOptimizer::clearSurface(), and meshOptimizer::meshSurface().
|
private |
enforce constraints
Definition at line 76 of file meshOptimizer.H.
Referenced by meshOptimizer::enforceConstraints(), and meshOptimizer::optimizeSurface().
|
private |
name of the subset contaning tangled points
Definition at line 79 of file meshOptimizer.H.
Referenced by meshOptimizer::enforceConstraints(), and meshOptimizer::optimizeSurface().
Copyright © 2011-2018 OpenFOAM | OPENFOAM® is a registered trademark of OpenCFD Ltd.