CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Open Source Meshers: Gmsh, Netgen, CGNS, ...

gmsh+stl+snappyHexMesh

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   August 19, 2011, 10:21
Default gmsh+stl+snappyHexMesh
  #1
Senior Member
 
Andrea Ferrari
Join Date: Dec 2010
Posts: 261
Rep Power: 6
Andrea_85 is on a distinguished road
Hi all,
I have a question regarding gmsh. I would like to construct a geometry using gmsh(only the geometry, not the mesh) and then use snappyHexMesh to construct the mesh around this geometry. Is possible using gmsh (maybe using the stl format output)? If yes, which are the steps?

thanks
andrea
Andrea_85 is offline   Reply With Quote

Old   August 21, 2011, 04:39
Default
  #2
Senior Member
 
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,880
Rep Power: 25
alberto will become famous soon enoughalberto will become famous soon enough
Yes, it is possible. Once you have the STL, put a box with blockMesh around it and mesh the box fine enough to intersect the details of your geometry. At this point you can follow one of the tutorials of snappyHexMesh to create the mesh.

Best,
__________________
Alberto

GeekoCFD - A free distribution based on openSUSE 64 bit with CFD tools, including OpenFOAM. Available as live DVD/USB, hard drive image and virtual image.
GeekoCFD 32bit - The 32bit edition of GeekoCFD.
GeekoCFD text mode - A smaller version of GeekoCFD, text-mode only, with only OpenFOAM. Available in a variety of virtual formats.
alberto is offline   Reply With Quote

Old   August 22, 2011, 04:58
Default
  #3
Senior Member
 
Andrea Ferrari
Join Date: Dec 2010
Posts: 261
Rep Power: 6
Andrea_85 is on a distinguished road
Hi Alberto,

thanks a lot

andrea
Andrea_85 is offline   Reply With Quote

Old   August 23, 2011, 06:24
Default
  #4
Senior Member
 
Andrea Ferrari
Join Date: Dec 2010
Posts: 261
Rep Power: 6
Andrea_85 is on a distinguished road
Hi again,
Is possible also for 2d geometries (1 cell in z direction)? If i want, for example, make a simple mesh of a box with an empty circle (disc with 1 cell in z direction) inside, how i have to construct my STL file using gmsh?

thanks

andrea
Andrea_85 is offline   Reply With Quote

Old   August 24, 2011, 05:28
Default
  #5
Senior Member
 
Andrea Ferrari
Join Date: Dec 2010
Posts: 261
Rep Power: 6
Andrea_85 is on a distinguished road
Hi,
following the "wingMotion" tutorial i've been able to create a 2D mesh of the simple geometry that i've mentioned in the previous post. Now, i would like to have a structured mesh as much as possible, at least away from the STL surface. So, why does snappy split cells in a way so weird, instead of dividing the square into four parts (see the attached pictures)? What should I do to keep the mesh structured?
(for example in this post 2D Cylinder mesh problems with Snappy there is a very similar example, in which the mesh away from the STL surface is completly structured).
Attached Images
File Type: jpg Disc.jpg (47.3 KB, 142 views)
File Type: jpg Disc_zoom1.jpg (55.0 KB, 115 views)
File Type: jpg Disc_zoom2.jpg (21.4 KB, 144 views)
Andrea_85 is offline   Reply With Quote

Old   August 24, 2011, 10:05
Default
  #6
Senior Member
 
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,880
Rep Power: 25
alberto will become famous soon enoughalberto will become famous soon enough
Do you see the same problem if you activate the option "use VTKkPolyhedron" in paraview? Paraview tends to show some cells as triangles, even when they are actually a single cell.
__________________
Alberto

GeekoCFD - A free distribution based on openSUSE 64 bit with CFD tools, including OpenFOAM. Available as live DVD/USB, hard drive image and virtual image.
GeekoCFD 32bit - The 32bit edition of GeekoCFD.
GeekoCFD text mode - A smaller version of GeekoCFD, text-mode only, with only OpenFOAM. Available in a variety of virtual formats.
alberto is offline   Reply With Quote

Old   August 24, 2011, 10:45
Default
  #7
Senior Member
 
Andrea Ferrari
Join Date: Dec 2010
Posts: 261
Rep Power: 6
Andrea_85 is on a distinguished road
Hi Alberto,
yes, i see the same problem. I made my test case even more simple: now the "hole" is a square. I've attached 2 pictures (with or without "Decompose Polyhedra"), my blockMeshDict and my snappyHexMeshDict.
Where am I doing wrong?

andrea
Attached Images
File Type: jpg withDecompose.jpg (49.6 KB, 96 views)
File Type: jpg withoutDecompose.jpg (52.8 KB, 85 views)
Attached Files
File Type: txt blockMeshDict.txt (1.4 KB, 16 views)
File Type: txt snappyHexMeshDict.txt (10.1 KB, 21 views)
Andrea_85 is offline   Reply With Quote

Old   August 24, 2011, 21:04
Default
  #8
Senior Member
 
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,880
Rep Power: 25
alberto will become famous soon enoughalberto will become famous soon enough
You can probably avoid the problem with a trick:

- Generate the mesh in snappyHexMesh without adding layers or refining around the surfaces.

- Use refineMesh to refine around objects. You basically define boxes where to refine in sequence.

P.S. Does this problem appear in OpenFOAM 2.0.x?

Best,
__________________
Alberto

GeekoCFD - A free distribution based on openSUSE 64 bit with CFD tools, including OpenFOAM. Available as live DVD/USB, hard drive image and virtual image.
GeekoCFD 32bit - The 32bit edition of GeekoCFD.
GeekoCFD text mode - A smaller version of GeekoCFD, text-mode only, with only OpenFOAM. Available in a variety of virtual formats.
alberto is offline   Reply With Quote

Old   August 25, 2011, 03:45
Default
  #9
Senior Member
 
Andrea Ferrari
Join Date: Dec 2010
Posts: 261
Rep Power: 6
Andrea_85 is on a distinguished road
Hi, and thanks
I've never used the utility refineMesh, do i need a dictionary?if yes, which one?
I'm using OF 1.7.1, i don't know for the new version.
thanks again

andrea
Andrea_85 is offline   Reply With Quote

Old   August 25, 2011, 09:53
Default
  #10
Senior Member
 
Andrea Ferrari
Join Date: Dec 2010
Posts: 261
Rep Power: 6
Andrea_85 is on a distinguished road
Hi,
I've played a bit with refineMesh and it works. I mean now the cells splitting is correct (all hexas, see the attached pictures) but the problem is that now all the mesh is refined. If i want to refine only a particular region (close to the obstacle for example), what i have to do? Is possible using this utility?

I am still a little bit confuse why it doesn't work using snappyHexMesh, i guess the cells splitting procedure should be the same...maybe there is something wrong in the snappyHexMeshDict...I've attached also my checkMesh for the previous case (snappy with refinement).


Code:
Time = 0.001

Mesh stats
    points:           22748
    faces:            46056
    internal faces:   26076
    cells:            11910
    boundary patches: 7
    point zones:      0
    face zones:       0
    cell zones:       0

Overall number of cells of each type:
    hexahedra:     11682
    prisms:        0
    wedges:        0
    pyramids:      0
    tet wedges:    0
    tetrahedra:    0
    polyhedra:     228

Checking topology...
    Boundary definition OK.
    Point usage OK.
    Upper triangular ordering OK.
    Face vertices OK.
    Number of regions: 1 (OK).

Checking patch topology for multiply connected surfaces ...
    Patch               Faces    Points   Surface topology                  
    left                100      202      ok (non-closed singly connected)  
    right               100      202      ok (non-closed singly connected)  
    top                 100      202      ok (non-closed singly connected)  
    bottom              100      202      ok (non-closed singly connected)  
    front               9390     9902     ok (non-closed singly connected)  
    back                9390     9902     ok (non-closed singly connected)  
    square_CreatedbyGmsh800      1200     ok (non-closed singly connected)  

Checking geometry...
    Overall domain bounding box (0 0 -1e-05) (0.001 0.001 1e-05)
    Mesh (non-empty, non-wedge) directions (1 1 0)
    Mesh (non-empty) directions (1 1 0)
    All edges aligned with or perpendicular to non-empty directions.
    Boundary openness (-3.59019e-17 3.6604e-17 5.67728e-14) OK.
    Max cell openness = 1.29247e-16 OK.
    Max aspect ratio = 1 OK.
    Minumum face area = 2.5e-11. Maximum face area = 2e-10.  Face area magnitudes OK.
    Min volume = 2.5e-16. Max volume = 2e-15.  Total volume = 1.5e-11.  Cell volumes OK.
    Mesh non-orthogonality Max: 36.6992 average: 6.69095
    Non-orthogonality check OK.
    Face pyramids OK.
    Max skewness = 2 OK.

Mesh OK.
Best

andrea
Attached Images
File Type: jpg afterSnappy.jpg (47.3 KB, 65 views)
File Type: jpg afterRefineMesh.jpg (55.3 KB, 88 views)
Andrea_85 is offline   Reply With Quote

Old   August 25, 2011, 11:17
Default
  #11
Senior Member
 
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,880
Rep Power: 25
alberto will become famous soon enoughalberto will become famous soon enough
SnappyHexMesh greatly improved in 2.0.x, as a consequence I strongly suggest to upgrade to the latest version. If you want more information: http://www.openfoam.com/news/snappyH...ature-edge.php

The refineMesh utility can use a cellSet to define the region where you want to apply the refinement. In OpenFOAM 1.7.x, you can select sells with cellSet (via dictionary, see OpenFOAM-1.7.x/applications/utilities/mesh/manipulation/cellSet/cellSetDict, while in OpenFOAM 2.0.x, the utility was merged into setSet.

In other words:

1. Generate with snappy
2. Define the region to refine via cellSet (or setSet)
3. Use refineMesh specifying the name of the cell set you created

You then repeat step 2 and 3 to add the layers. I find this procedure more reliable even if a bit more tricky, in comparison to a direct use of snappyHexMesh.

Best,
__________________
Alberto

GeekoCFD - A free distribution based on openSUSE 64 bit with CFD tools, including OpenFOAM. Available as live DVD/USB, hard drive image and virtual image.
GeekoCFD 32bit - The 32bit edition of GeekoCFD.
GeekoCFD text mode - A smaller version of GeekoCFD, text-mode only, with only OpenFOAM. Available in a variety of virtual formats.
alberto is offline   Reply With Quote

Old   August 26, 2011, 05:08
Default
  #12
Senior Member
 
Andrea Ferrari
Join Date: Dec 2010
Posts: 261
Rep Power: 6
Andrea_85 is on a distinguished road
Thanks Alberto.
Another question...in the cellSetDict i can, for example, specify a box using boxToCell:

topoSetSources
(
boxToCell
{
box (whatever) (whatever);
}
)

Is also possible to specify a patch? or a region around a patch?

Thanks
andrea
Andrea_85 is offline   Reply With Quote

Old   July 14, 2013, 11:25
Default
  #13
Member
 
Join Date: Aug 2011
Posts: 63
Rep Power: 5
idefix is on a distinguished road
Hello,

Ive got a question to refineMesh.
Could it be also used two times?

I made a mesh with snappyHexMesh. Afterwards I defined a box, saved the geometry in *.stl.
SnappyHexMesh creates a "0" folder
Then I used the command insideCells refinementbox.stl set
Afterwards: refineMesh -dict
Everything is working fine.
A "1" folder is created.

Now I defined a second (smaller) box.
I did: insideCells refinementbox2.stl set2
set2 is created in 1/polyMesh/sets

but the command refineMesh -dict is not working.
I get the error massage:
Create time

Create polyMesh for time = 1

#0 Foam::error:rintStack(Foam::Ostream&) in "OpenFOAM/OpenFOAM-2.1.1/platforms/linux64GccDPOpt/lib/libOpenFOAM.so"
#1 Foam::sigFpe::sigHandler(int) in "OpenFOAM/OpenFOAM-2.1.1/platforms/linux64GccDPOpt/lib/libOpenFOAM.so"
#2 in "/lib64/libc.so.6"
#3
in "OpenFOAM/OpenFOAM-2.1.1/platforms/linux64GccDPOpt/bin/refineMesh"
#4
in "OpenFOAM/OpenFOAM-2.1.1/platforms/linux64GccDPOpt/bin/refineMesh"
#5 __libc_start_main in "/lib64/libc.so.6"
#6
at /usr/src/packages/BUILD/glibc-2.11.2/csu/../sysdeps/x86_64/elf/start.S:116
Gleitkomma-Ausnahme


Can anybody help?

Thanks a lot
idefix
idefix is offline   Reply With Quote

Reply

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
stl and snappyHexMesh dimensions mismatch romant OpenFOAM Native Meshers: snappyHexMesh and Others 9 August 28, 2014 20:31
Patch Names in STL file for snappyHexMesh Kattie OpenFOAM Native Meshers: snappyHexMesh and Others 11 October 18, 2011 11:05
SnappyHexMesh meshes inside and outside of an STL geometry villier OpenFOAM Mesh Utilities 17 June 15, 2010 19:51
Import problem ARC Open Source Meshers: Gmsh, Netgen, CGNS, ... 0 February 27, 2010 10:56
STL to gmsh nomad OpenFOAM 2 August 10, 2009 04:09


All times are GMT -4. The time now is 00:53.