CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Meshing & Mesh Conversion

[snappyHexMesh] SnappyHexMesh with local refinement of ONE STLfile

Register Blogs Community New Posts Updated Threads Search

Like Tree18Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 18, 2009, 08:46
Default SnappyHexMesh with local refinement of ONE STLfile
  #1
Senior Member
 
Wolfgang Heydlauff
Join Date: Mar 2009
Location: Germany
Posts: 136
Rep Power: 21
wolle1982 will become famous soon enough
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.



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


Step two: Snapping to the surface


Step three: Building boundary layer by adding structured cells to surface


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




Have fun with it!
Wolfgang
wolle1982 is offline   Reply With Quote

Old   February 23, 2009, 14:16
Default Add-on "Forces": To get the
  #2
Senior Member
 
Wolfgang Heydlauff
Join Date: Mar 2009
Location: Germany
Posts: 136
Rep Power: 21
wolle1982 will become famous soon enough
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.
wolle1982 is offline   Reply With Quote

Old   June 26, 2009, 03:57
Default
  #3
Senior Member
 
stephane sanchi
Join Date: Mar 2009
Posts: 314
Rep Power: 18
openfoam_user is on a distinguished road
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.
openfoam_user is offline   Reply With Quote

Old   June 26, 2009, 09:46
Default
  #4
Senior Member
 
Wolfgang Heydlauff
Join Date: Mar 2009
Location: Germany
Posts: 136
Rep Power: 21
wolle1982 will become famous soon enough
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
wolle1982 is offline   Reply With Quote

Old   June 26, 2009, 10:23
Default
  #5
Senior Member
 
santos's Avatar
 
Jose Luis Santos
Join Date: Mar 2009
Location: Portugal
Posts: 215
Rep Power: 18
santos is on a distinguished road
Send a message via Skype™ to santos
Hi,

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

Regards,
Jose Santos
santos is offline   Reply With Quote

Old   March 17, 2011, 03:56
Default Help Please
  #6
New Member
 
Noviyani Lim
Join Date: Oct 2010
Posts: 5
Rep Power: 16
Novi is on a distinguished road
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
Novi is offline   Reply With Quote

Old   July 16, 2011, 11:34
Default
  #7
Member
 
Alex
Join Date: Jun 2010
Location: Planet Earth
Posts: 43
Rep Power: 16
bigbang is on a distinguished road
Great example. Thank you.

I'm just getting starting with openFoam and this is a good addition to the motorBike tutorial.
bigbang is offline   Reply With Quote

Old   October 20, 2011, 04:31
Default
  #8
New Member
 
FlowLy
Join Date: Aug 2010
Location: Germany
Posts: 18
Rep Power: 16
giuli@ is on a distinguished road
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 ( ), 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@ is offline   Reply With Quote

Old   October 20, 2011, 04:58
Default
  #9
New Member
 
FlowLy
Join Date: Aug 2010
Location: Germany
Posts: 18
Rep Power: 16
giuli@ is on a distinguished road
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
giuli@ is offline   Reply With Quote

Old   December 15, 2011, 06:52
Default
  #10
New Member
 
Michael Bruckner
Join Date: Apr 2009
Location: France
Posts: 27
Rep Power: 17
michaelb is on a distinguished road
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
michaelb is offline   Reply With Quote

Old   December 15, 2011, 09:58
Default
  #11
New Member
 
FlowLy
Join Date: Aug 2010
Location: Germany
Posts: 18
Rep Power: 16
giuli@ is on a distinguished road
Hi Micheal,
thank you very much for your suggestion. I will try this program soon!

regards,

giuli@
giuli@ is offline   Reply With Quote

Old   February 1, 2012, 13:04
Default synappy hex mesh
  #12
hhh
Senior Member
 
kunar
Join Date: Nov 2011
Posts: 117
Rep Power: 15
hhh is on a distinguished road
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
hhh is offline   Reply With Quote

Old   February 1, 2012, 13:14
Default
  #13
New Member
 
Michael Bruckner
Join Date: Apr 2009
Location: France
Posts: 27
Rep Power: 17
michaelb is on a distinguished road
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
elvis and dhananjay1287 like this.
michaelb is offline   Reply With Quote

Old   February 2, 2012, 01:34
Default snappy hex mesh
  #14
hhh
Senior Member
 
kunar
Join Date: Nov 2011
Posts: 117
Rep Power: 15
hhh is on a distinguished road
Dear michal,
thanks for response,its really useful for beginners, i hopes i get some idea to learn snappyhexmesh.




Warm Regards,
hhh
hhh is offline   Reply With Quote

Old   March 24, 2012, 17:33
Default starter
  #15
New Member
 
soonic's Avatar
 
Peter
Join Date: Apr 2010
Location: Brno, Czech Republic
Posts: 24
Rep Power: 16
soonic is on a distinguished road
Send a message via ICQ to soonic Send a message via AIM to soonic Send a message via Skype™ to soonic
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.

Last edited by soonic; March 24, 2012 at 17:34. Reason: typo
soonic is offline   Reply With Quote

Old   August 23, 2013, 11:49
Default
  #16
Senior Member
 
sivakumar selvaraju
Join Date: Mar 2009
Location: India
Posts: 205
Rep Power: 18
sivakumar is on a distinguished road
Send a message via Skype™ to sivakumar
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
Attached Images
File Type: jpg Fig1.jpg (24.9 KB, 320 views)
Attached Files
File Type: txt blockMeshDict.txt (3.1 KB, 36 views)
File Type: txt snappyHexMeshDict.txt (3.8 KB, 114 views)
sivakumar is offline   Reply With Quote

Old   August 23, 2013, 13:12
Default
  #17
Senior Member
 
sivakumar selvaraju
Join Date: Mar 2009
Location: India
Posts: 205
Rep Power: 18
sivakumar is on a distinguished road
Send a message via Skype™ to sivakumar
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
sivakumar is offline   Reply With Quote

Old   July 28, 2017, 08:35
Default
  #18
Member
 
Ashish Magar
Join Date: Jul 2016
Location: Mumbai, India
Posts: 81
Rep Power: 10
ashishmagar600 is on a distinguished road
Hello, everyone.

I don't know if this is the right thread to ask (I am sorry), guess this thread gives info about sHM, that's why. I was just figuring out how to define or control the size of the grid inside the refinement box. Actually, I needed this to verify independence of the grid, but I don't really know how a certain level will give me a grid size I want.

thanks in anticipation
ashishmagar600 is offline   Reply With Quote

Old   May 1, 2020, 06:09
Default
  #19
Senior Member
 
Franco
Join Date: Nov 2019
Location: Compiègne, France
Posts: 129
Rep Power: 7
otaolafr is on a distinguished road
Quote:
Originally Posted by ashishmagar600 View Post
Hello, everyone.

I don't know if this is the right thread to ask (I am sorry), guess this thread gives info about sHM, that's why. I was just figuring out how to define or control the size of the grid inside the refinement box. Actually, I needed this to verify independence of the grid, but I don't really know how a certain level will give me a grid size I want.

thanks in anticipation
hello! i would go with doing the simulation and use mapFields to use the last t output as input for a smaller grid and repeat it hope it helps
otaolafr is offline   Reply With Quote

Old   May 1, 2020, 06:19
Default
  #20
Senior Member
 
Franco
Join Date: Nov 2019
Location: Compiègne, France
Posts: 129
Rep Power: 7
otaolafr is on a distinguished road
hello,
I am looking at this method of introducing STLs and I find it really simple instead of what I am doing at the moment, but I am having a big issue. the STL is not watertight after doing the cat of the files. I am sure that the original ones were watertight as they were a solid in my CAD file. here is an image of the model, note that all the faces in the same color I exported in a single stl (so in total i have: red, blue, yellow and with blue stls) (the withe bluish in the first and end lines of the squares are an error from the image only and not a superposition of the faces or anything related.)


I think that maybe the issue comes from the red and blue stls that are composed of several surfaces that are not connected between each other?. I would really appreciate any help.
best regards, franco
otaolafr is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[snappyHexMesh] SnappyHexMesh running killed! Mark JIN OpenFOAM Meshing & Mesh Conversion 7 June 14, 2022 02:37
pimpleDyMFoam computation randomly stops babapeti OpenFOAM Running, Solving & CFD 5 January 24, 2018 06:28
[snappyHexMesh] snappyHexMesh aborting Tobi OpenFOAM Meshing & Mesh Conversion 0 November 10, 2010 04:23
[blockMesh] BlockMeshmergePatchPairs hjasak OpenFOAM Meshing & Mesh Conversion 11 August 15, 2008 08:36
Could anybody help me see this error and give help liugx212 OpenFOAM Running, Solving & CFD 3 January 4, 2006 19:07


All times are GMT -4. The time now is 03:35.