Sie sind auf Seite 1von 17

SnappyHexMesh

Type of mesh Hexahedral mesh Export STL file from blender SnappyHexMesh

H. AKIMOTO, Division of Ocean Systems Engineering (OSE), Korea Advanced Institute of Science and Technology

Variations of computational mesh


Structured mesh
Hexahedron Single mesh Blocks or overlapped

Unstructured
2D : quadrangular and triangle 3D : hexahedron, tetrahedron, prism, pyramid
H. AKIMOTO, Division of Ocean Systems Engineering (OSE), Korea Advanced Institute of Science and Technology

Hexahedron mesh
Higher accuracy and performance in structured mesh Difficulty in fitting to complex geometry Advantages of unstructured hexahedral mesh
H. AKIMOTO, Division of Ocean Systems Engineering (OSE), Korea Advanced Institute of Science and Technology

Prepare STL file in blender


Stereolithography file (or Standard Tessellation Language) for 3D CAD
Do not confuse with Standard Template Library (STL) of C++

For rapid prototyping


3D lithograph 3D printing

H. AKIMOTO, Division of Ocean Systems Engineering (OSE), Korea Advanced Institute of Science and Technology

Blender
Open source 3D CG animation creator http://www.blender. org/ Runs on Win & Linux

H. AKIMOTO, Division of Ocean Systems Engineering (OSE), Korea Advanced Institute of Science and Technology

Export STL file


Objects in blender should be joined to form a single STL (select all and then ctrl+j) File menu Export STL (.stl)
Check ASCII option Specify file name in the shared directory or create a file then copy it to the directory

Preview the STL file by paraview


Check the dimension of the object for later handling in snappyHexMesh
H. AKIMOTO, Division of Ocean Systems Engineering (OSE), Korea Advanced Institute of Science and Technology

Prepare OpenFOAM case dir


Make a copy of cavity flow case
$ cp -r $FOAM_TUTORIALS/incompressible/icoFoam/cavity myMesh

Copy two files from other cases to proper position under myMesh case
$FOAM_TUTORIALS/mesh/snappyHexMesh/motorBike/system/ snappyHexMeshDict $FOAM_TUTORIALS/mesh/snappyHexMesh/motorBike/system/ decomposeParDict

Make triSurface directory and place your STL file as


constant/triSurface/yourStlFile
H. AKIMOTO, Division of Ocean Systems Engineering (OSE), Korea Advanced Institute of Science and Technology

Setting of mesh
Edit blockMeshDict
Modify the block size to cover your STL obj

Execute blockMesh Edit snappyHexMeshDict as follows


castellatedMesh true; snap true; addLayers false; ...
H. AKIMOTO, Division of Ocean Systems Engineering (OSE), Korea Advanced Institute of Science and Technology

. . geometry castellatedMeshControls { { yourStlFile.stl maxLocalCells 100000; { maxGlobalCells 2000000; type triSurfaceMesh; minRefinementCells 0; name yourStlObjectName; nCellsBetweenLevels 1; } features }; ( . );
H. AKIMOTO, Division of Ocean Systems Engineering (OSE), Korea Advanced Institute of Science and Technology

refinementSurfaces { yourStlObjName { level (0 0); } } resolveFeatureAngle 30; refinementRegions { }

locationInMesh (0.01 0 0); allowFreeStandingZoneFace s true; } ...

This will determine which side of STL object (in or out) will be meshed

H. AKIMOTO, Division of Ocean Systems Engineering (OSE), Korea Advanced Institute of Science and Technology

10

Execute snappyHexMesh
Execute and check
$ snappyHexMesh [Enter]
Created two time sequences dir contain mesh

$ paraFoam
Preview the mesh

Execute meshing again and overwrite


$ snappyHexMesh -overwrite

If you want initialize mesh


$ foamClearPolyMesh
H. AKIMOTO, Division of Ocean Systems Engineering (OSE), Korea Advanced Institute of Science and Technology

11

Mesh improvement (sharp edge)


Sharp edge
1. Create feature edge file
$ surfaceFeatureExtract -includeAngle 150 -writeObj yourStlFileName yourStlObjectName (This will create yourStlObjectName.eMesh)

2. Edit features of castllateMeshControls in snappyHexMeshDict 3. Add nFeatureSnapIter setting to snapControls 4. Execute snappyHexMesh again

H. AKIMOTO, Division of Ocean Systems Engineering (OSE), Korea Advanced Institute of Science and Technology

12

Examples: snappyHexMeshDict
2. In castellatedMeshControl castellatedMeshControls { ... features ( { file yourStlObject.eMesh"; level 0; } ); ... }
H. AKIMOTO, Division of Ocean Systems Engineering (OSE), Korea Advanced Institute of Science and Technology

3 In snapControls snapControls { nFeatureSnapIter 10; }

13

Mesh improvement (boundary layer)


Edit addLayersConctrols in snappyHexMeshDict
addLayersControls { layers { yourStlObject_side" { nSurfaceLayers 3; } } ... }

Optional settings Spacing grow rate


expansionRatio 1.1;

Feature angle
featureAngle 60;

meshQualityControl
meshQualityControls { ... minTetQuality -1e30; ... }
14

H. AKIMOTO, Division of Ocean Systems Engineering (OSE), Korea Advanced Institute of Science and Technology

Mesh improvement (refinement)


Setting of refinementRegions castellatedMeshControls { ... refinementRegions { yourStlObjectName { mode distance; levels ((1e-4 1)); } } ...
H. AKIMOTO, Division of Ocean Systems Engineering (OSE), Korea Advanced Institute of Science and Technology

15

Alternative setting (by specifying the domain of refinement)


geometry { mixing_elbow.stl { type triSurfaceMesh; name yourStlObjectName; } refinementBox { type searchableBox; min (30e-3 -5e-3 -5e-3); max (50e-3 5e-3 15e-3); } };

castellatedMeshControls { ... refinementRegions { refinementBox { mode inside; levels ((1 1)); } } ...

First parameter is ignored

H. AKIMOTO, Division of Ocean Systems Engineering (OSE), Korea Advanced Institute of Science and Technology

16

Parallelization of snappyHexMesh
Reduce the time of meshing by multi CPUs
deconposePar mpirun np 4 snappyHexMesh parallel reconstructParMesh lastTime mergeTol 1e-6

H. AKIMOTO, Division of Ocean Systems Engineering (OSE), Korea Advanced Institute of Science and Technology

17

Das könnte Ihnen auch gefallen