mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: Add automatic feature extraction to foamyHexMesh
This commit is contained in:
@ -47,8 +47,8 @@ surfaceConformation
|
||||
{
|
||||
flange
|
||||
{
|
||||
featureMethod extendedFeatureEdgeMesh;
|
||||
extendedFeatureEdgeMesh "flange.extendedFeatureEdgeMesh";
|
||||
featureMethod extractFeatures;
|
||||
includedAngle 140;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,38 +0,0 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: dev |
|
||||
| \\ / A nd | Web: www.OpenFOAM.org |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object surfaceFeatureExtractDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
flange.obj
|
||||
{
|
||||
extractionMethod extractFromSurface;
|
||||
|
||||
extractFromSurfaceCoeffs
|
||||
{
|
||||
// Mark edges whose adjacent surface normals are at an angle less
|
||||
// than includedAngle as features
|
||||
// - 0 : selects no edges
|
||||
// - 180: selects all edges
|
||||
includedAngle 100;
|
||||
}
|
||||
|
||||
|
||||
// Write options
|
||||
|
||||
// Write features to obj format for postprocessing
|
||||
writeObj yes;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -35,7 +35,7 @@ runApplication surfaceFeatureExtract
|
||||
|
||||
# Generate aligned points (in constant/internalDelaunayVertices) and a
|
||||
# mesh from that.
|
||||
runApplication cvMesh
|
||||
runApplication foamyHexMesh
|
||||
|
||||
# Generate some sets for a bit of mesh inspection
|
||||
runApplication topoSet -time 0:100
|
||||
|
||||
@ -1,368 +0,0 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: dev |
|
||||
| \\ / A nd | Web: www.OpenFOAM.org |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object cvMeshDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
/*
|
||||
|
||||
Control dictionary for cvMesh - polyhedral mesh generator.
|
||||
|
||||
cvMesh phases:
|
||||
1. fill volume with initial points (initialPoints subdictionary). An option
|
||||
is to reread from previous set of points.
|
||||
|
||||
2. internal point motion (motionControl subdictionary)
|
||||
|
||||
3. every once in a while add point duplets/triplets to conform to
|
||||
surfaces and features (surfaceConformation subdictionary)
|
||||
|
||||
4. back to 2
|
||||
|
||||
5. construct polyMesh.
|
||||
- filter (polyMeshFiltering subdictionary)
|
||||
- check (meshQualityControls subdictionary) and undo filtering
|
||||
|
||||
|
||||
See also cvControls.H in the conformalVoronoiMesh library
|
||||
|
||||
*/
|
||||
|
||||
|
||||
// Important:
|
||||
// ----------
|
||||
// Any scalar with a name <name>Coeff specifies a value that will be implemented
|
||||
// as a faction of the 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_clean_orient.obj
|
||||
{
|
||||
name coneAndSphere;
|
||||
type triSurfaceMesh;
|
||||
}
|
||||
|
||||
// Outside of domain
|
||||
domain_clean_orient.stl
|
||||
{
|
||||
name domain;
|
||||
type triSurfaceMesh;
|
||||
regions
|
||||
{
|
||||
ascii{ name domain_patch0; }
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Controls for conforming to the surfaces.
|
||||
surfaceConformation
|
||||
{
|
||||
// A point inside surfaces that is inside mesh.
|
||||
locationInMesh (0 -0.5 0);
|
||||
|
||||
// How far apart are point-duplets generated. 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;
|
||||
|
||||
// Mixed feature edges - both inside and outside edges. Recreated
|
||||
// by inserting triplets of points to recreate a single edge. Done for
|
||||
// all edges emanating from point. triplets of points get inserted
|
||||
// mixedFeaturePointPPDistanceCoeff distance away from feature point.
|
||||
mixedFeaturePointPPDistanceCoeff 5.0;
|
||||
|
||||
// Distance to a feature point within which surface and edge
|
||||
// conformation points are excluded - fraction of the local target
|
||||
// cell size
|
||||
featurePointExclusionDistanceCoeff 0.6;
|
||||
|
||||
// Distance to an existing feature edge conformation location
|
||||
// within which other edge conformation location are excluded -
|
||||
// fraction of the local target cell size
|
||||
featureEdgeExclusionDistanceCoeff 0.6;
|
||||
|
||||
// Optimisation: do not check for surface intersection (of dual edges)
|
||||
// for points near to surface.
|
||||
surfaceSearchDistanceCoeff 2.5;
|
||||
|
||||
// Maximum allowable protrusion through the surface before
|
||||
// conformation points are added - fraction of the local target
|
||||
// cell size. These small protusions are (hopefully) done by mesh filtering
|
||||
// instead.
|
||||
maxSurfaceProtrusionCoeff 0.1;
|
||||
|
||||
// If feature edge with large angle (so more than 125 degrees) introduce
|
||||
// additional points to create two half angled cells (= mitering).
|
||||
maxQuadAngle 125;
|
||||
|
||||
// Frequency to redo surface conformation (expensive).
|
||||
surfaceConformationRebuildFrequency 10;
|
||||
|
||||
// Specialised feature point handling
|
||||
specialiseFeaturePoints on;
|
||||
|
||||
// Initial and intermediate controls
|
||||
conformationControls
|
||||
{
|
||||
// We've got a point poking through the surface. Don't do any
|
||||
// surface conformation if near feature edge (since feature edge
|
||||
// conformation should have priority)
|
||||
|
||||
// distance to search for near feature edges
|
||||
edgeSearchDistCoeff 2;
|
||||
|
||||
// Proximity to a feature edge where a surface hit is
|
||||
// not created, only the edge conformation is created
|
||||
// - fraction of the local target cell size. Coarse
|
||||
// conformation, initial protrusion tests.
|
||||
surfacePtReplaceDistCoeff 0.5;
|
||||
|
||||
|
||||
surfacePtExclusionDistanceCoeff 0.5;
|
||||
|
||||
// Stop either at maxIterations or if the number of surface pokes
|
||||
// is very small (iterationToInitialHitRatioLimit * initial number)
|
||||
// Note: perhaps iterationToInitialHitRatioLimit should be absolute
|
||||
// count?
|
||||
maxIterations 15;
|
||||
|
||||
iterationToInitialHitRatioLimit 0.001;
|
||||
}
|
||||
|
||||
// Geometry to mesh to
|
||||
geometryToConformTo
|
||||
{
|
||||
coneAndSphere
|
||||
{
|
||||
featureMethod extendedFeatureEdgeMesh;
|
||||
extendedFeatureEdgeMesh "coneAndSphere_clean_orient.extendedFeatureEdgeMesh";
|
||||
}
|
||||
|
||||
domain
|
||||
{
|
||||
featureMethod extendedFeatureEdgeMesh;
|
||||
extendedFeatureEdgeMesh "domain_clean_orient.extendedFeatureEdgeMesh";
|
||||
}
|
||||
}
|
||||
|
||||
additionalFeatures
|
||||
{}
|
||||
}
|
||||
|
||||
|
||||
// Controls for seeding initial points and general control of the target
|
||||
// cell size (used everywhere)
|
||||
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.
|
||||
autoDensityCoeffs
|
||||
{
|
||||
minCellSizeLimit 0.1;
|
||||
// Initial number of refinement levels. Needs to be enough to pick
|
||||
// up features due to size ratio. If not enough it will take longer
|
||||
// to determine point seeding.
|
||||
minLevels 4;
|
||||
// Split box if ratio of min to max cell size larger than maxSizeRatio
|
||||
maxSizeRatio 5.0;
|
||||
// Per box sample 3x3x3 internally
|
||||
sampleResolution 3;
|
||||
// Additionally per face of the box sample 3
|
||||
surfaceSampleResolution 3;
|
||||
}
|
||||
|
||||
uniformGridCoeffs
|
||||
{
|
||||
// Absolute cell size.
|
||||
initialCellSize 0.0015;
|
||||
randomiseInitialGrid yes;
|
||||
randomPerturbationCoeff 0.02;
|
||||
}
|
||||
|
||||
bodyCentredCubicCoeffs
|
||||
{
|
||||
initialCellSize 0.0015;
|
||||
randomiseInitialGrid no;
|
||||
randomPerturbationCoeff 0.1;
|
||||
}
|
||||
|
||||
pointFileCoeffs
|
||||
{
|
||||
// Reads points from file. Still rejects points that are too
|
||||
// close to the surface (minimumSurfaceDistanceCoeff) or on the
|
||||
// wrong side of the surfaces.
|
||||
pointFile "constant/internalDelaunayVertices";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Control size of voronoi cells i.e. distance between points. This
|
||||
// determines the target cell size which is used everywhere.
|
||||
// It determines the cell size given a location. It then uses all
|
||||
// the rules
|
||||
// - defaultCellSize
|
||||
// - cellSizeControlGeometry
|
||||
// to determine target cell size. Rule with highest priority wins. If same
|
||||
// priority smallest cell size wins.
|
||||
motionControl
|
||||
{
|
||||
// Absolute cell size of back ground mesh. This is the maximum cell size.
|
||||
defaultCellSize 0.1;
|
||||
|
||||
minimumCellSizeCoeff 0;
|
||||
|
||||
// For background cell size and alignment grid
|
||||
maxSmoothingIterations 100;
|
||||
|
||||
maxRefinementIterations 0;
|
||||
|
||||
shapeControlFunctions
|
||||
{
|
||||
coneAndSphere
|
||||
{
|
||||
type searchableSurfaceControl;
|
||||
priority 1;
|
||||
mode bothSides;
|
||||
|
||||
surfaceCellSizeFunction uniformValue;
|
||||
uniformValueCoeffs
|
||||
{
|
||||
surfaceCellSizeCoeff 0.75;
|
||||
}
|
||||
|
||||
cellSizeFunction uniform;
|
||||
uniformCoeffs
|
||||
{}
|
||||
}
|
||||
|
||||
domain
|
||||
{
|
||||
type searchableSurfaceControl;
|
||||
priority 1;
|
||||
mode bothSides;
|
||||
|
||||
surfaceCellSizeFunction uniformValue;
|
||||
uniformValueCoeffs
|
||||
{
|
||||
surfaceCellSizeCoeff 1;
|
||||
}
|
||||
|
||||
cellSizeFunction uniform;
|
||||
uniformCoeffs
|
||||
{}
|
||||
}
|
||||
}
|
||||
|
||||
cellAspectRatioControl
|
||||
{
|
||||
aspectRatio 1.0;
|
||||
aspectRatioDirection (0 0 0);
|
||||
}
|
||||
|
||||
// Underrelaxation for point motion. Simulated annealing: starts off at 1
|
||||
// and lowers to 0 (at simulation endTime) to converge points.
|
||||
// adaptiveLinear is preferred choice.
|
||||
// Points move by e.g. 10% of tet size.
|
||||
relaxationModel adaptiveLinear; //rampHoldFall
|
||||
|
||||
adaptiveLinearCoeffs
|
||||
{
|
||||
relaxationStart 1.0;
|
||||
relaxationEnd 0.0;
|
||||
}
|
||||
|
||||
// Output lots and lots of .obj files
|
||||
objOutput no;
|
||||
|
||||
// Timing and memory usage.
|
||||
timeChecks no;
|
||||
|
||||
// For each delaunay edge (between two vertices, becomes
|
||||
// the Voronoi face normal) snap to the alignment direction if within
|
||||
// alignmentAcceptanceAngle. Slightly > 45 is a good choice - prevents
|
||||
// flipping.
|
||||
alignmentAcceptanceAngle 48;
|
||||
|
||||
// When to insert points. Not advisable change to
|
||||
// these settings.
|
||||
pointInsertionCriteria
|
||||
{
|
||||
// If edge larger than 1.75 target cell size
|
||||
// (so tets too large/stretched) insert point
|
||||
cellCentreDistCoeff 1.75;
|
||||
// Do not insert point if voronoi face (on edge) very small.
|
||||
faceAreaRatioCoeff 0.0025;
|
||||
// Insert point only if edge closely aligned to local alignment
|
||||
// direction.
|
||||
acceptanceAngle 21.5;
|
||||
}
|
||||
|
||||
// Opposite: remove point if mesh too compressed. Do not change these
|
||||
// settings.
|
||||
pointRemovalCriteria
|
||||
{
|
||||
cellCentreDistCoeff 0.65;
|
||||
}
|
||||
|
||||
// How to determine the point motion. All edges got some direction.
|
||||
// Sum all edge contributions to determine point motion. Weigh by
|
||||
// face area so motion is preferentially determined by large faces
|
||||
// (or more importantly ignore contribution from small faces).
|
||||
// Do not change these settings.
|
||||
faceAreaWeightModel piecewiseLinearRamp;
|
||||
|
||||
piecewiseLinearRampCoeffs
|
||||
{
|
||||
lowerAreaFraction 0.5;
|
||||
upperAreaFraction 1.0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// After simulation, when converting to polyMesh, filter out small faces/edges.
|
||||
// Do not change. See cvControls.H
|
||||
polyMeshFiltering
|
||||
{
|
||||
filterEdges on;
|
||||
filterFaces on;
|
||||
writeTetDualMesh false;
|
||||
}
|
||||
|
||||
|
||||
#include "meshQualityDict";
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
203
tutorials/mesh/foamyHexMesh/simpleShapes/system/foamyHexMeshDict
Normal file
203
tutorials/mesh/foamyHexMesh/simpleShapes/system/foamyHexMeshDict
Normal file
@ -0,0 +1,203 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: dev |
|
||||
| \\ / A nd | Web: www.OpenFOAM.org |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object foamyHexMeshDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// Include defaults parameters from master dictionary
|
||||
#include "$WM_PROJECT_DIR/etc/caseDicts/foamyHexMeshDict"
|
||||
|
||||
geometry
|
||||
{
|
||||
// Internal shape
|
||||
coneAndSphere_clean_orient.obj
|
||||
{
|
||||
name coneAndSphere;
|
||||
type triSurfaceMesh;
|
||||
}
|
||||
|
||||
// Outside of domain
|
||||
domain_clean_orient.stl
|
||||
{
|
||||
name domain;
|
||||
type triSurfaceMesh;
|
||||
regions
|
||||
{
|
||||
ascii{ name domain_patch0; }
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Controls for conforming to the surfaces.
|
||||
surfaceConformation
|
||||
{
|
||||
// A point inside surfaces that is inside mesh.
|
||||
locationInMesh (0 -0.5 0);
|
||||
|
||||
// Geometry to mesh to
|
||||
geometryToConformTo
|
||||
{
|
||||
coneAndSphere
|
||||
{
|
||||
featureMethod extractFeatures;
|
||||
includedAngle 140;
|
||||
featureMethod extendedFeatureEdgeMesh;
|
||||
extendedFeatureEdgeMesh "coneAndSphere_clean_orient.extendedFeatureEdgeMesh";
|
||||
}
|
||||
|
||||
domain
|
||||
{
|
||||
featureMethod extractFeatures;
|
||||
includedAngle 125;
|
||||
featureMethod extendedFeatureEdgeMesh;
|
||||
extendedFeatureEdgeMesh "domain_clean_orient.extendedFeatureEdgeMesh";
|
||||
}
|
||||
}
|
||||
|
||||
additionalFeatures
|
||||
{}
|
||||
}
|
||||
|
||||
|
||||
// Controls for seeding initial points and general control of the target
|
||||
// cell size (used everywhere)
|
||||
initialPoints
|
||||
{
|
||||
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.
|
||||
autoDensityCoeffs
|
||||
{
|
||||
minCellSizeLimit 0.1;
|
||||
// Initial number of refinement levels. Needs to be enough to pick
|
||||
// up features due to size ratio. If not enough it will take longer
|
||||
// to determine point seeding.
|
||||
minLevels 4;
|
||||
// Split box if ratio of min to max cell size larger than maxSizeRatio
|
||||
maxSizeRatio 5.0;
|
||||
// Per box sample 3x3x3 internally
|
||||
sampleResolution 3;
|
||||
// Additionally per face of the box sample 3
|
||||
surfaceSampleResolution 3;
|
||||
}
|
||||
|
||||
uniformGridCoeffs
|
||||
{
|
||||
// Absolute cell size.
|
||||
initialCellSize 0.0015;
|
||||
randomiseInitialGrid yes;
|
||||
randomPerturbationCoeff 0.02;
|
||||
}
|
||||
|
||||
bodyCentredCubicCoeffs
|
||||
{
|
||||
initialCellSize 0.0015;
|
||||
randomiseInitialGrid no;
|
||||
randomPerturbationCoeff 0.1;
|
||||
}
|
||||
|
||||
pointFileCoeffs
|
||||
{
|
||||
// Reads points from file. Still rejects points that are too
|
||||
// close to the surface (minimumSurfaceDistanceCoeff) or on the
|
||||
// wrong side of the surfaces.
|
||||
pointFile "constant/internalDelaunayVertices";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Control size of voronoi cells i.e. distance between points. This
|
||||
// determines the target cell size which is used everywhere.
|
||||
// It determines the cell size given a location. It then uses all
|
||||
// the rules
|
||||
// - defaultCellSize
|
||||
// - cellSizeControlGeometry
|
||||
// to determine target cell size. Rule with highest priority wins. If same
|
||||
// priority smallest cell size wins.
|
||||
motionControl
|
||||
{
|
||||
// Absolute cell size of back ground mesh. This is the maximum cell size.
|
||||
defaultCellSize 0.1;
|
||||
|
||||
minimumCellSizeCoeff 0;
|
||||
|
||||
// For background cell size and alignment grid
|
||||
maxSmoothingIterations 100;
|
||||
|
||||
maxRefinementIterations 0;
|
||||
|
||||
shapeControlFunctions
|
||||
{
|
||||
coneAndSphere
|
||||
{
|
||||
type searchableSurfaceControl;
|
||||
priority 1;
|
||||
mode bothSides;
|
||||
|
||||
surfaceCellSizeFunction uniformValue;
|
||||
uniformValueCoeffs
|
||||
{
|
||||
surfaceCellSizeCoeff 0.75;
|
||||
}
|
||||
|
||||
cellSizeFunction uniform;
|
||||
uniformCoeffs
|
||||
{}
|
||||
}
|
||||
|
||||
domain
|
||||
{
|
||||
type searchableSurfaceControl;
|
||||
priority 1;
|
||||
mode bothSides;
|
||||
|
||||
surfaceCellSizeFunction uniformValue;
|
||||
uniformValueCoeffs
|
||||
{
|
||||
surfaceCellSizeCoeff 1;
|
||||
}
|
||||
|
||||
cellSizeFunction uniform;
|
||||
uniformCoeffs
|
||||
{}
|
||||
}
|
||||
}
|
||||
|
||||
// Output lots and lots of .obj files
|
||||
objOutput no;
|
||||
|
||||
// Timing and memory usage.
|
||||
timeChecks no;
|
||||
}
|
||||
|
||||
|
||||
// After simulation, when converting to polyMesh, filter out small faces/edges.
|
||||
// Do not change. See cvControls.H
|
||||
polyMeshFiltering
|
||||
{
|
||||
filterEdges on;
|
||||
filterFaces on;
|
||||
writeTetDualMesh false;
|
||||
}
|
||||
|
||||
|
||||
#include "meshQualityDict";
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
Reference in New Issue
Block a user