snappy hex mesh

17
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

Upload: bala-murugan

Post on 08-Nov-2014

156 views

Category:

Documents


4 download

DESCRIPTION

about snappy hexmesh

TRANSCRIPT

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

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

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

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

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

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

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

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

….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

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

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

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

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

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

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

• 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

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