CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Mesh Utilities (http://www.cfd-online.com/Forums/openfoam-meshing-utilities/)
-   -   SnappyHexMesh with local refinement of ONE STLfile (http://www.cfd-online.com/Forums/openfoam-meshing-utilities/61483-snappyhexmesh-local-refinement-one-stlfile.html)

wolle1982 February 18, 2009 08:46

Hallo all, while using the
 
Hallo all,

while using the great Tool snappyHexMesh one can quickly get too many cells. But if some level of refinement is required in only some special regions of the geometry, e.g. an airfoil nose, there is the possibility to let snappyHexMesh refine those special regions separately.

http://www.cfd-online.com/OpenFOAM_D...es/1/11255.jpg

Here's a little manual how to do so.

1. Create geometry in CAD Programm and split into so many region as different refinement levels are required. Export each File as separate STL file.

2. Copy-Paste single STL files into one STL file. In my example the file is names Input.stl. Inside the Input.stl file you have to name the different regions. Look at attached file-example. Regions named "NumberOne" and "NumberTwo".
http://www.cfd-online.com/OpenFOAM_D...hment_icon.gif Input.stl

3. In snappyHexMeshDict one has to define the regions as region and give the patches names (here: "shpere" and "ellipse"). See attached snappyHexMeshDict.

4. Under refinementSurfaces one now can define the separat refinement level for both regions ("NumberOne" and "NumberTwo"). See attached snappyHexMeshDict.

5. Under addLayerControls one can now define the separate layers to be added to the defined patches ("sphere" and "ellipse"). See attached snappyHexMeshDict.
http://www.cfd-online.com/OpenFOAM_D...hment_icon.gif snappyHexMeshDict

6. Doing sHM eather
a) as usual:
- blockMesh
- snappyHexMesh

or

b) in parallel computing
- blockMesh
- decomposePar
- foamJob -p -s snappyHexMesh
- reconstructParMesh -mergeTol 1e-06 -time 1
- reconstructParMesh -mergeTol 1e-06 -time 2
- reconstructParMesh -mergeTol 1e-06 -time 3

with the (very common) attached decomposeParDict.
http://www.cfd-online.com/OpenFOAM_D...hment_icon.gif decomposeParDict

As results you get a meshed surface with separate local refined regions which safes a lot of cells to compute.

Step one: Refining in different local refinementlevels
http://www.cfd-online.com/OpenFOAM_D...es/1/11256.jpg

Step two: Snapping to the surface
http://www.cfd-online.com/OpenFOAM_D...es/1/11257.jpg

Step three: Building boundary layer by adding structured cells to surface
http://www.cfd-online.com/OpenFOAM_D...es/1/11258.jpg

Notice: To view the single patches in paraView, you have to load in the given patches (as usual). Then change something in the markement of the patches (e.g. take away the inlet-patch) and update view, now you can see the defined single patches.

Notice: a different refinement level on the surface means that neighbour bounary layers have pourly a different thickness.

Notice: the triangle Cells are only a display mistake by paraView. In reality they are hexes and polyhexes. See picture

http://www.cfd-online.com/OpenFOAM_D...es/1/11259.jpg


Have fun with it!
Wolfgang

wolle1982 February 23, 2009 14:16

Add-on "Forces": To get the
 
Add-on "Forces":

To get the attacking Forces on the whole geometry use "forces"-function in controlDict (see other threads) and define patches separated with a sinlge blank:

functions
(
forces
{
type forces;
functionObjectLibs ("libforces.so");
patches (sphere ellipse);
rhoInf 1.225;
CofR (0.25 0 0);
}
);

The function simply sums all the forces of the multiple patches.

openfoam_user June 26, 2009 02:57

Hi Wolfgang,

till now I have never used SnappyHexMesh. I would like to try it with your case. Could you provide me with your STL geometry ?

One problem is that SHM does not respect sharp edges. Do you know if it will be improved into the next release ?

Best Regards,

Stephane Sanchi.

wolle1982 June 26, 2009 08:46

Hi Stephane,

I have no idea, if sHM will be improved in the next version. I'm only user, no programmer.

No, the STL-File is too large. But you can create your own one. Take a CAD Program and export as STL File.

If you don't have a CAD Program, you also can use Salome to create simple volumes. after creating the geometry in salome, mesh the surface with a triangle-only surface grid. that will be able to be exported as a STL file.

greetings

santos June 26, 2009 09:23

Hi,

You can export your mesh to STL directly from the 'Geometry' module of Salome, no need to create a mesh.

Regards,
Jose Santos

Novi March 17, 2011 03:56

Help Please
 
Hi, Your post regarding localize refinement using snappyHexMesh is very helpful. But I can't open the file that you attach. Is is possible to post the codes again?

Thank you :)

bigbang July 16, 2011 10:34

Great example. Thank you.

I'm just getting starting with openFoam and this is a good addition to the motorBike tutorial.

giuli@ October 20, 2011 03:31

Hi Wolgfang,
thank you for your post, you enlightened me :)

I am meshing a car, which geometry is composed by 10 parts. The local surface refinement works; however, sHM meshes also inside the volume of the car. If I mesh the car as one part, this problem does not occur. I guess ( :confused: ), the locationInMesh point doesn't see the geometry as a whole, when it is specified as an assembly of parts, and therefore all the cells are visible.

Did you have the same problem, or it actually removed the cells inside your volume?
Do you have any idea how to solve this?

Thank you and regards,
giuli@

PS: anybody with similar experience is welcome to comment :)

giuli@ October 20, 2011 03:58

Hi everybody,
I guess I found the problem (posted by me just above) - I think that it is just a matter of how close the parts of the geometry are. With a very coarse surface mesh (not refined enough to see eventual gaps among the parts) the volume mesh inside the car is removed!

cheers,

gg

michaelb December 15, 2011 06:52

Hi Giulia,

have you tried the ADMesh program yet?
https://sites.google.com/a/varlog.com/www/admesh-htm
I'm particularly thinking of the "-f" option which may help filling the gaps in between two solids. The sHM shouldn't mesh the inside of your solid anymore and you would be able to reach the required refinement.

Best,


Michael

giuli@ December 15, 2011 09:58

Hi Micheal,
thank you very much for your suggestion. I will try this program soon!

regards,

giuli@

hhh February 1, 2012 13:04

synappy hex mesh
 
Dear foamers,
i have problem in snappy hex mesh, i have cad model in stl format,how i solve in open foam,
1.how to import
2.how to create outer domain
3.how to mesh the model
4.how to set boundary condition,for my i consider to create domain to set
inlet velocity ,pressure outlet and remaining face is symmetry wall is cad model
5.how to run
i am begineer please give idea for to this problem

michaelb February 1, 2012 13:14

Hi hhh,

have you had a look at this tutorial ? :
http://www.hydroniumion.de/general/s...mesh-tutorial/
and this pdf ? :http://www.ats4i.com.br/en/publications/files/SnappyHexMesh_1stOpenFoamBRAZIL_linux.pdf

This might be a good starting point. Beyond that if you've any further questions I'm afraid I won't be able to help you since I'm also a beginner.

Cheers,

Michael

hhh February 2, 2012 01:34

snappy hex mesh
 
Dear michal,
thanks for response,its really useful for beginners, i hopes i get some idea to learn snappyhexmesh.




Warm Regards,
hhh

soonic March 24, 2012 17:33

starter
 
http://www.cfd-online.com/Forums/ope...ost351265.html

I wrote a how to split the stl to several regions, if somebody will need it )like me) to start this tutorial.

thanks for your tutorial.

sivakumar August 23, 2013 10:49

3 Attachment(s)
Hi There,
I am trying to use sHM utility, for that I have created .stl file.

* I have single STL file see fig1, the coloured one is the STL file, grey colour is blockMesh Box.

* For the same geometry I have done Meshing with 3 volumes (inlet volume, fan volume, outlet volume) using Gambit.

* For sHM I exported it as one STL.
* Is it necessary to split the STL file in to many STL???

* I havenít edit the STL file, but I used the STL face names in sHM.

STL file is

solid FACE.24
facet normal -0.922423 -0.386182 -0.000000
outer loop
vertex -0.215172 0.740366 6.000000
vertex -0.215172 0.740366 4.230000
vertex -0.160542 0.609881 6.000000
endloop
endfacet
................................
...............................
facet normal -0.922423 -0.386182 -0.000000
outer loop
vertex -0.087704 0.435900 1.870000
vertex -0.087704 0.435900 0.100000
vertex -0.033074 0.305414 0.100000
endloop
endfacet
endsolid FACE.24

solid FACE.23
facet normal 0.000000 0.000000 1.000000
outer loop
vertex 0.354461 0.684669 6.000000
vertex 0.337417 0.693227 6.000000
vertex 0.345089 0.611537 6.000000
endloop

..................................
..................................

facet normal 0.000000 0.000000 1.000000
outer loop
vertex -0.039209 0.398857 6.000000
vertex -0.072195 0.398857 6.000000
vertex -0.039209 0.320068 6.000000
endloop
endfacet
endsolid FACE.23

sHMDict is:

// Which of the steps to run
castellatedMesh true;
snap true;
addLayers false;

geometry
{
fanGeo.stl
{
type triSurfaceMesh;
regions
{
FACE.24
{
name inlet;
}

FACE.23
{
name outlet;
}
}

* I have generated the blockMesh with 3 volume as follows

convertToMeters 1;

vertices
(
(-0.4 0.2 -1.5)
(0.4 0.2 -1.5)
(0.4 0.8 -1.5)
(-0.4 0.8 -1.5)
(-0.4 0.2 -0.1)
(0.4 0.2 -0.1)
(0.4 0.8 -0.1)
(-0.4 0.8 -0.1)
(-0.4 0.2 0.2)
(0.4 0.2 0.2)
(0.4 0.8 0.2)
(-0.4 0.8 0.2)
(-0.4 0.2 6)
(0.4 0.2 6)
(0.4 0.8 6)
(-0.4 0.8 6)
);

blocks
(
hex (0 1 2 3 4 5 6 7) (15 15 50) simpleGrading (1 1 1)

hex (4 5 6 7 8 9 10 11)
fan
(15 15 10) simpleGrading (1 1 1)

hex (8 9 10 11 12 13 14 15) (15 15 100) simpleGrading (1 1 1)

);

edges
(
);


boundary
(
inlet
{
type patch;
faces
(
(0 3 2 1)
);
}

outlet
{
type patch;
faces
(
(12 13 14 15)
);
}

center0
{
type wall;
faces
(
(0 1 5 4)
);
}

fan
{
type wall;
faces
(
(4 5 9 8)
);
}

center1
{
type wall;
faces
(
(8 9 13 12)
);
}

ILR0
{
type cyclic;
neighbourPatch ILR1;
faces
(
(0 4 7 3)
);
}

ILR1
{
type cyclic;
neighbourPatch ILR0;
faces
(
(1 5 6 2)
);
}

CLR0
{
type cyclic;
neighbourPatch CLR1;
faces
(
(4 8 11 7)
);
}

CLR1
{
type cyclic;
neighbourPatch CLR0;
faces
(
(5 9 10 6)
);
}

OLR0
{
type cyclic;
neighbourPatch OLR1;
faces
(
(8 12 15 11)
);
}

OLR1
{
type cyclic;
neighbourPatch OLR0;
faces
(
(9 13 14 10)
);
}

top0
{
type wall;
faces
(
(3 7 6 2)
);
}

top2
{
type wall;
faces
(
(11 15 14 10)
);
}

top1
{
type wall;
faces
(
(7 11 10 6)
);
}

);

mergePatchPairs
(
);

after that I executed snappyHexMesh, its not all removing the unwanted region. I am confused.

But if I work with one hex block in the blockMesh it is working fine, but I not able to define the patches.

please help me to get rid of this problem


Thanks,
Sivakumar

sivakumar August 23, 2013 12:12

Hi there,
Sorry for the post, its working fine.

the problem was in the sHMDict

// Which of the steps to run
castellatedMesh true;
snap true;
addLayers false;

geometry
{
fanGeo.stl
{
type triSurfaceMesh;
name fanGeo; // I included this, that was the problem.
regions
{
FACE.24
{
name OLR0;
}

FACE.23
{
name outlet;
}

FACE.25
{
name top2;
}


Thanks,
Sivakumar


All times are GMT -4. The time now is 16:30.