Top Banner
SꜳHM SꜳHM SꜳHM SꜳHM H. AKIMOTO, Division of Ocean Systems Engineering (OSE), Korea Advanced Institute of Science and Technology • Type of mesh •Hexahedral mesh • Export STL file from blender • SnappyHexMesh 1
17

Snappy Hex Mesh

Nov 08, 2014

Download

Documents

Bala Murugan

about snappy hexmesh
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Snappy Hex Mesh

SnappyHexMeshSnappyHexMeshSnappyHexMeshSnappyHexMesh

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

• Type of mesh•Hexahedral mesh• Export STL file from blender• SnappyHexMesh

1

Page 2: Snappy Hex Mesh

Variations of computational mesh

• Structured mesh▫ Hexahedron▫ Single mesh▫ Blocks or overlapped

• Unstructured

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

• Unstructured▫ 2D : quadrangular and

triangle▫ 3D : hexahedron,

tetrahedron, prism, pyramid

2

Page 3: Snappy Hex Mesh

Hexahedron mesh

• Higher accuracy and performance in structured mesh

• Difficulty in fitting to complex

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

to complex geometry

• Advantages of unstructured hexahedral mesh

3

Page 4: Snappy Hex Mesh

Prepare STL file in blender

• Stereolithography file (or Standard Tessellation Language) for 3D CAD▫ Do not confuse with “Standard Template Library

(STL)” of C++

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

• For rapid prototyping▫ 3D lithograph▫ 3D printing

4

Page 5: Snappy Hex Mesh

Blender

• Open source 3D CG animation creator

• http://www.blender.org/

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

org/• Runs on Win &

Linux

5

Page 6: Snappy Hex Mesh

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

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

▫ Specify file name in the shared directoryor 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

6

Page 7: Snappy Hex Mesh

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

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

snappyHexMeshDict$FOAM_TUTORIALS/mesh/snappyHexMesh/motorBike/system/ ¥decomposeParDict

• Make “triSurface” directory and place your STL file asconstant/triSurface/yourStlFile

7

Page 8: Snappy Hex Mesh

Setting of mesh

• Edit blockMeshDict▫ Modify the block size to cover your STL obj

• Execute blockMesh• Edit snappyHexMeshDict as follows

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

castellatedMesh true;snap true;addLayers false;...

8

Page 9: Snappy Hex Mesh

….geometry{

yourStlFile.stl{

type triSurfaceMesh;

….castellatedMeshControls{

maxLocalCells 100000;maxGlobalCells 2000000;minRefinementCells 0;

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

type triSurfaceMesh;name yourStlObjectName;

}};….

minRefinementCells 0;nCellsBetweenLevels 1;features();

……

9

Page 10: Snappy Hex Mesh

refinementSurfaces{

yourStlObjName{

level (0 0);}

locationInMesh (0.01 0 0);

allowFreeStandingZoneFaces true;}...

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

}}resolveFeatureAngle 30;

refinementRegions{}

...

10

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

Page 11: Snappy Hex Mesh

Execute snappyHexMesh

• Execute and check▫ $ snappyHexMesh [Enter]

• Created two time sequences dir contain mesh

▫ $ paraFoam• Preview the mesh

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

• Preview the mesh

• Execute meshing again and overwrite▫ $ snappyHexMesh -overwrite

If you want initialize mesh▫ $ foamClearPolyMesh

11

Page 12: Snappy Hex Mesh

Mesh improvement (sharp edge)

• Sharp edge1. Create “feature edge” file

$ surfaceFeatureExtract -includeAngle 150 -writeObjyourStlFileName yourStlObjectName

(This will create “yourStlObjectName.eMesh”)

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

2. Edit “features” of “castllateMeshControls” in snappyHexMeshDict

3. Add “nFeatureSnapIter” setting to “snapControls”

4. Execute snappyHexMesh again

12

Page 13: Snappy Hex Mesh

Examples: snappyHexMeshDict

2. In castellatedMeshControl

castellatedMeshControls{

...

features

3 In snapControls

snapControls{

nFeatureSnapIter 10;}

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

features(

{file “yourStlObject.eMesh";level 0;

});...

}

13

Page 14: Snappy Hex Mesh

Mesh improvement (boundary layer)• Edit “addLayersConctrols”

in snappyHexMeshDict

addLayersControls{

layers{

Optional settings▫ Spacing grow rate

expansionRatio 1.1;

▫ Feature anglefeatureAngle 60;

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

{“yourStlObject_side"

{nSurfaceLayers 3;

}}...

}

featureAngle 60;

▫ meshQualityControlmeshQualityControls{

...minTetQuality -1e30;...

}

14

Page 15: Snappy Hex Mesh

Mesh improvement (refinement)• Setting of refinementRegions

castellatedMeshControls{

...refinementRegions{

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

{yourStlObjectName{

mode distance;levels ((1e-4 1));

}}...

15

Page 16: Snappy Hex Mesh

• Alternative setting (by specifying the domain of refinement)

geometry{

mixing_elbow.stl{

type triSurfaceMesh;name yourStlObjectName;

castellatedMeshControls{

...

refinementRegions{

refinementBox

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

}

refinementBox{

type searchableBox;min (30e-3 -5e-3 -5e-3);max (50e-3 5e-3 15e-3);

}};

refinementBox{

mode inside;levels ((1 1));

}}

...

16

First parameter is ignored

Page 17: Snappy Hex Mesh

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