foamyHexMesh is a new mesh generator added in OpenFOAM 2.3.0.
In this post, I tried foamyHexMesh for simple shapes (a box and a sphere).
Thinking of foamyHexMesh as a meshing tool for air-flow simulations about a car, I created the box as the computational domain which has inlet and outlet, and the sphere as a substitute of a car.
Box
Sphere
I exported these shapes as STL files. Box.stl is separated into 4 parts (inlet, outlet, side, and ground).
The diagonal points of the box is (-1, -1, 0) and (1, 1, 1). And the center of the sphere is (0, 0, 0) and the radius of the sphere is 0.5.
Box.stl
Sphere.stl
Here are the steps of using foamyHexMesh.
1. Modify orientations of the faces of STL files at first
$ surfaceOrient constant/triSurface/Sphere.stl -inside '(-0.9 0 0.1)' constant/triSurface/Sphere.stl
$ surfaceOrient constant/triSurface/Box.stl -inside '(-0.9 0 0.1)' constant/triSurface/Box.stl
2. Create intersections of the 2 shapes
$ surfaceBooleanFeatures intersection constant/triSurface/Sphere.stl constant/triSurface/Box.stl
3. Run foamyHexMesh
$ foamyHexMesh4. Run collapseEdges
$ surfaceBooleanFeatures intersection constant/triSurface/Sphere.stl constant/triSurface/Box.stlThe resulting mesh is as follows.
$ collapseEdges -latestTime -collapseFaces
If there are 2 or more parts in STL files, they turn into different mesh regions.
In this case, faces on the Box.stl are separated into 4 mesh regions ('box_inlet', 'box_outlet', 'box_side', 'box_ground').
Mesh surfaces
Mesh surfaces
Mesh surfaces and edges
Mesh surfaces and edges
I copied foamyHexMeshDict from the simpleShapes tutorial case, and editted it for the case of this post.
surfaceCellSizeCoeff seems to be the relative size of the cell against the defaultCellSize.
In this case, defaultCellSize = 0.05 and surfaceCellSizeCoeff = 1 (box), 0.5 (sphere).
Therefore the cell size on the surface = 0.05 (box), 0.025(sphere).
I changed some other parameters but I just found very few differences.
========
foamyHexMeshDict:
// Include defaults parameters from master dictionary
#include "$WM_PROJECT_DIR/etc/caseDicts/foamyHexMeshDict"
geometry
{
Sphere.stl
{
name sphere;
type triSurfaceMesh;
}
Box.stl
{
name box;
type triSurfaceMesh;
}
}
surfaceConformation
{
locationInMesh (-0.9 0 0.1);
featurePointControls
{
specialiseFeaturePoints off;
edgeAiming off;
guardFeaturePoints off;
snapFeaturePoints off;
circulateEdges off;
}
// Geometry to mesh to
geometryToConformTo
{
sphere
{
featureMethod none;
patchInfo
{
type wall;
inGroups (groupSphere);
}
}
box
{
featureMethod extractFeatures;
includedAngle 140;
mode outside;
patchInfo
{
type wall;
inGroups (groupBox);
}
}
}
additionalFeatures
{
boxSphereIntersection
{
featureMethod extendedFeatureEdgeMesh;
extendedFeatureEdgeMesh "Sphere_Box_intersection.extendedFeatureEdgeMesh";
}
}
}
initialPoints
{
initialPointsMethod autoDensity;
autoDensityCoeffs
{
minCellSizeLimit 0.01;
minLevels 0;
maxSizeRatio 2;
sampleResolution 1;
surfaceSampleResolution 1;
}
}
motionControl
{
defaultCellSize 0.05;
minimumCellSizeCoeff 0;
// For background cell size and alignment grid
maxSmoothingIterations 100;
maxRefinementIterations 0;
shapeControlFunctions
{
sphere
{
type searchableSurfaceControl;
priority 2;
mode outside;
surfaceCellSizeFunction uniformValue;
uniformValueCoeffs
{
surfaceCellSizeCoeff 0.5;
}
cellSizeFunction linearDistance;
linearDistanceCoeffs
{
distanceCellSizeCoeff 1;
distanceCoeff 1;
}
}
box
{
type searchableSurfaceControl;
priority 1;
mode bothSides;
surfaceCellSizeFunction uniformValue;
uniformValueCoeffs
{
surfaceCellSizeCoeff 1.0;
}
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;
}
meshQualityControls
{
#include "meshQualityDict"
}
Comments
Post a Comment