CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Mesh Generation & Pre-Processing Software > enGrid

engrid -> save as .stl with boundarie codes

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 25, 2010, 05:15
Default
  #21
Member
 
Join Date: May 2010
Posts: 42
Rep Power: 16
Zymon is on a distinguished road
Hi elvis,

Yes, it is an in-house file format based on unstructured dataformat. I don't know much about it yet. I'll get it one of the next weeks.

Right now I am dealing with some stability problems of OpenFOAM. With the fine Mesh (enGrid) the time steps get too low as the courant number increases. With the snappy Mesh the simulation works fine. I guess the problems occurs due to the too fine mesh and the already mentioned high number of severly non-orthogonal faces. Btw. I am using icoFoam right now. By switching the number of non-orthogonal-correctors higher the problem even gets worse. This is quite strange to me. I'll now try the advices of philippose to get a better grid.
Zymon is offline   Reply With Quote

Old   May 25, 2010, 09:24
Default
  #22
Senior Member
 
Elvis
Join Date: Mar 2009
Location: Sindelfingen, Germany
Posts: 620
Blog Entries: 6
Rep Power: 24
elvis will become famous soon enough
Quote:
Originally Posted by Zymon View Post
Yes, it is an in-house file format based on unstructured dataformat. .
If you deal with unstructured grids, take a look at http://www.vtk.org/VTK/img/file-formats.pdf
read page 8 and following for unstructured grid.

It is rather easy to write VTK-files. And of course you can convert (via paraview or mayavi) VTK-files easiliy to other file formats like STL and so on.

=>You can use Filters like extract, this is really a benefit if you want to extract only surfaces and get rid of other parts of a mesh.

I tried freecad 0.09 it offers to import OBJ-files and STL-files.
But I had no luck when i tried it!

elvis
elvis is offline   Reply With Quote

Old   May 25, 2010, 16:18
Default
  #23
Senior Member
 
Pei-Ying Hsieh
Join Date: Mar 2009
Posts: 334
Rep Power: 18
phsieh2005 is on a distinguished road
Hi, philippose,

Can you point a direction where I can get the format for the *.msz file? I might give it a try using perl. Thanks!

Pei

Quote:
Originally Posted by philippose View Post
Hello there,

I was looking through your posts on this thread, and was interested to see that Netgen and Engrid seem to be the centre of discussion :-)! So I thought I would put in a post from my side too :-)!

The geometry that you are trying to simulate looks cool.... :-)!

I was basically an "end-user" of Netgen till about 2 years ago, when I decided to actually take part in the development of Netgen too..... I must say, that I have not seen a mesher which is more robust and faster than Netgen in the Open-Source universe for automated meshing.

Again here too, the main problem why people face difficulties is the extreme lack of Documentation, and I would love to change that (and have been doing so, however at a very slow pace), except for the fact that my normal "day" job eats up most of my time and energy.

Anyway, coming to the point of control over the mesh generation in Netgen..... There are a couple of points to notice, which may not be apparent...:

1. When using OCC geometry, the meshing option STL/STEP/IGES - close edges has an inverse effect.... the smaller the number, the finer the mesh near edges which are close to each other.... however, when you select a coarser mesh setting in "Mesh Granularity", it automatically makes this number smaller...... which is a bug which has not yet been corrected (shall do it as soon as possible).

2. The Maximum and Minimum Mesh size settings do work quite well..... However, the values which you change in the GUI are the actual maximum and minimum edge lengths (in millimetre) of the elements.... Hence, if the topology of your geometry causes Netgen to automatically select a smaller mesh size than the currently selected maximum mesh size, you will not see any changes when you vary the maximum mesh size, unless you vary it to a value smaller than the largest automatic value determined by Netgen.

3. If you are using one of the later versions of Netgen (if I remember right, ver 4.9.11 upwards), you can colourize the generated mesh based on the local mesh size. This option can be enabled in the "View -> Viewing Options... -> Mesh" tab, by checking "Colored Meshsize visualization". Using this mode, you can easily see what minimum and maximum mesh sizes Netgen is using, and then you can modify the size constraints based on that. (Note: After selecting this option and clicking on "Done", you need to Double-Click somewhere in the graphics view to update the mesh display)

4. If you want a more uniform mesh, set a small value (smallest value in the GUI is 0.1) for the mesh-size grading option, move the slider to a large value and remove the tick for the option - STL/IGES/STEP - Close edges

5. If you close the gap between the Minimum and Maximum mesh size limits after performing option 4, you can get a mesh almost completely uniform.

6. Now for the cool bit..... I strongly suggest that you try the option of using a mesh size file. You can use the mesh size file to limit the mesh size at very specific locations by explicitly limiting the size at points or along lines. I have created a small excel program in which I put in the diagonally opposite (x,y,z) co-ordinates of a Cuboid, along with a resolution, and the maximum mesh size within this cuboid. I then generate a point cloud and limit the mesh size at each of those points within the cuboid using VBA (Visual Basic for Applications). By adding multiple such cuboids (or other forms) into one MSZ file, you can dictate exactly how the mesh has to look....... When using a Mesh size file, the size limitation specified by the mesh size file at a point has the highest priority, and overrides all other automatically determined mesh sizes.

7. And finally, if required, you can directly export from Netgen into OpenFOAM by selecting "OpenFOAM 1.5+ Format" under the Export Filetype option, and exporting the mesh generated using the Export Mesh... option both of which can be found under the "File" menu.


Here are some screenshots of some of the points I mentioned above. If you (or anyone else for that matter) requires more assistance, I would be glad to try and help.

If you need more details regarding the Mesh size file, let me know...

Hope this helps.....

Have a nice weekend!

Philippose
phsieh2005 is offline   Reply With Quote

Old   May 25, 2010, 18:04
Default
  #24
Senior Member
 
Philippose Rajan
Join Date: Mar 2009
Location: Germany
Posts: 552
Rep Power: 25
philippose will become famous soon enough
Hello Pei,

A Good Evening to you!!

Sorry for not having replied to your earlier post yet.....

Yes.... the idea of calling the library version of Netgen (nglib) from OpenFOAM has also been my idea for over a year now :-)! Unfortunately, I have never had the time or the opportunity to sit down in a focused manner, and define the interface(s) and concepts required to make that work.....

It would be great if someone actually had the requirement to do something like that coupled with the dedicated time to implement it.......!



As for your question regarding the MSZ file format..... its a very simple format..... and goes like this:

# ------ Start of MSZ file format ------
<num of points>
x1 y1 z1 h1
x2 y2 z2 h2
x3 y3 z3 h3
.....
.....
.....
.....
xn yn zn hn
<num of lines>
x11 y11 z11 x12 y12 z12 h1
x21 y21 z21 x22 y22 z22 h2
x31 y31 z31 x32 y32 z32 h3
.....
.....
.....
.....
xn1 yn1 zn1 xn2 yn2 yn2 hn
# ------ End of MSZ file format ------


In the above format:
* <num of points> is the number of points you want to specify at which the mesh size should be limited.

* each of the following co-ordinates (x,y,z) define the point in 3D

* "h" is the maximum mesh size at the specified point

* After the list of points, you can optionally also limit the size of a mesh along lines.... here, you need to provide the (x,y,z) co-ordinates of the start and the end of the line, followed by the maximum mesh size allowed.

* Discretising the line into points along the line is done internally by Netgen.

* In case you only want to limit the mesh size along lines, then specify "0" as number of points, and in the next line, directly specify the number of lines, followed by the line definitions themselves.....

As an example.... here is a snippet for limiting at points:

6766
0.000000 -0.000000 -0.000000 0.500000
20.000000 -0.000000 -0.000000 0.500000
0.000000 -0.000000 -20.000000 0.500000
20.000000 -0.000000 -20.000000 0.500000
0.000000 20.000000 -20.000000 0.500000
20.000000 20.000000 -20.000000 0.500000
0.000000 20.000000 0.000000 0.500000
20.000000 20.000000 0.000000 0.500000
1.000000 -0.000000 -0.000000 0.500000
2.000000 -0.000000 -0.000000 0.500000
3.000000 -0.000000 -0.000000 0.500000
4.000000 -0.000000 -0.000000 0.500000
5.000000 -0.000000 -0.000000 0.500000
6.000000 -0.000000 -0.000000 0.500000
7.000000 -0.000000 -0.000000 0.500000
8.000000 -0.000000 -0.000000 0.500000
9.000000 -0.000000 -0.000000 0.500000
10.000000 -0.000000 -0.000000 0.500000
11.000000 -0.000000 -0.000000 0.500000
12.000000 -0.000000 -0.000000 0.500000
13.000000 -0.000000 -0.000000 0.500000
14.000000 -0.000000 -0.000000 0.500000
15.000000 -0.000000 -0.000000 0.500000
16.000000 -0.000000 -0.000000 0.500000
17.000000 -0.000000 -0.000000 0.500000
18.000000 -0.000000 -0.000000 0.500000
19.000000 -0.000000 -0.000000 0.500000
0.000000 -0.000000 -1.000000 0.500000
0.000000 -0.000000 -2.000000 0.500000
0.000000 -0.000000 -3.020000 0.500000
0.000000 -0.000000 -4.020000 0.500000
0.000000 -0.000000 -5.000000 0.500000
0.000000 -0.000000 -6.000000 0.500000
0.000000 -0.000000 -7.020000 0.500000
0.000000 -0.000000 -8.020000 0.500000
0.000000 -0.000000 -9.020000 0.500000
0.000000 -0.000000 -10.000000 0.500000
0.000000 -0.000000 -11.000000 0.500000
0.000000 -0.000000 -12.000000 0.500000
0.000000 -0.000000 -13.000000 0.500000
0.000000 -0.000000 -14.020000 0.500000
0.000000 -0.000000 -15.020000 0.500000
......
......
......


Hope this helps....!

Have a great day ahead!

Philippose
philippose is offline   Reply With Quote

Old   May 26, 2010, 09:35
Default
  #25
Senior Member
 
Pei-Ying Hsieh
Join Date: Mar 2009
Posts: 334
Rep Power: 18
phsieh2005 is on a distinguished road
Hi, Philippose,

Thanks a lot for the MSZ format! I will give it a try as soon as possible.

I believe that the library version of netgen will be very helpful for dynamic mesh cases. I do not think that I am capable of helping the development part, but, I will be glad to help in testing.

We are all very busy at work. So, thank you for spending your personal time on netgen development + helping others how to use it.

Pei
phsieh2005 is offline   Reply With Quote

Old   May 26, 2010, 12:38
Default
  #26
Member
 
Join Date: May 2010
Posts: 42
Rep Power: 16
Zymon is on a distinguished road
I have now a rather good Surface Mesh (with Netgen), what you can see in picture 1 and 2. But the Volume Mesh generated with Netgen is a catastrophe. The element sizes and positions are ordered almost randomly. In picture 3 you can see a detailed view of the mesh around the orifice. And in picture 4 you can see what I mean. Is this common? And does the min mesh-size also hold for cell elements (because this doesn't seem so)? A satisfying numerical simulation is of course not possible with this mesh. The snappyHexMesh Generator has at least some structure in its mesh. I am still wondering if the surface mesh of the model has any effect on the result of snappy. As long as I have understood the algorithm this is not the case.

Btw. I now have another solution to my very first question. It is also possible with paraview to save certain parts of the model as an stl file. The OpenFOAM export of Netgen works also fine. At first I tried to save it to C:\documents and settings\... . It then wants to save it in C:\documents what doesn't exist, so it can't handle spaces.
Attached Images
File Type: jpg 1.jpg (76.2 KB, 40 views)
File Type: jpg 2.jpg (88.3 KB, 43 views)
File Type: jpg 3.jpg (103.6 KB, 47 views)
File Type: jpg 4.jpg (34.1 KB, 37 views)
Zymon is offline   Reply With Quote

Old   May 26, 2010, 14:27
Default
  #27
Senior Member
 
Philippose Rajan
Join Date: Mar 2009
Location: Germany
Posts: 552
Rep Power: 25
philippose will become famous soon enough
Hello there,

What you are seeing are artefacts created by ParaView :-)! And not the real cell structure within the mesh.... you really didn't believe that the internal mesh generated by Netgen looked like that did you :-) !? If that was the case, checkMesh (the mesh checking utility in OpenFOAM which you should always be using), would scream so loud that it will drown out a concorde :-) :-)!

You are post-processing the mesh using ParaView, and using the option of showing the mesh along with the edges in a cut or slice view..... this mode shows the edges of all the cells along the depth direction, and not just those visible at the top plane.....ending up in basically what looks like a "jumble of lines" rather than reality....

I think the best way to look at the structure of the internal mesh created by Netgen is to use Netgen itself.....

The following screenshots show you how you can make a clipping plane through the mesh generated within Netgen, and switch on the internal Mesh view. For performance reasons, a graphical output of the internal mesh is not enabled by default....

And yes.... the size controls and size limitations specified in Netgen are valid for both, the surface mesh as well as the internal tetrahedral mesh.

Have a nice day....!

Philippose
Attached Images
File Type: jpg netgen_view_001.jpg (74.0 KB, 44 views)
File Type: jpg netgen_view_002.jpg (51.3 KB, 49 views)
philippose is offline   Reply With Quote

Old   May 27, 2010, 06:05
Default
  #28
Member
 
Join Date: May 2010
Posts: 42
Rep Power: 16
Zymon is on a distinguished road
Yeah, I knew that it is not a good idea to evaluate the quality of the mesh by looking at slides, because of the 3D effects you already mentioned. But I thought that it should at least give an impression of the structure of the cells. And such structures, as seen in my picture, seemed strange to me. And actually I didn't know another way to look at the mesh , so thanks! It would be nice, if one could set the values in the clipping plane option directly and not just sliding them. The sliding is a bit imprecise. CheckMesh is always the first thing I do, when dealing with a new mesh.

Now I have done a simulation and am doing the post-processing in paraview by slicing the object. It is quite good, but I am not yet happy with the interpolation of the results around the orifice, it is rather edged. But most likely a finer mesh here would improve this. I think I now know enough to play around a bit Thanks for all the help! But I guess new questions will arise soon...

What I really would like to know (it's also important for my thesis) is what algorithms is used for the meshing in Netgen. Did you stick to some published papers or books or did you create an in-house algorithm? I should have a look at the source code, but this is quite time-consuming.

Best wishes,
Zymon
Attached Images
File Type: jpg simulation.jpg (24.6 KB, 27 views)
Zymon is offline   Reply With Quote

Old   May 27, 2010, 07:50
Default
  #29
Senior Member
 
Philippose Rajan
Join Date: Mar 2009
Location: Germany
Posts: 552
Rep Power: 25
philippose will become famous soon enough
Hello and a Good day to you :-)!

Nice to see that you were able to perform a half-way ok looking simulation with the mesh....

I think you should atleast double the mesh density at the orifice.... since your geometry is not too complex, I think the easiest method is to use an MSZ (mesh size file.... as detailed in a post below) file to define a point cloud around the orifice where you limit the maximum mesh size..... that will help keep the mesh density in the other non-critical parts of the geometry small.

As for the meshing algorithms used..... I must make it clear, that I am not one of the original developers of Netgen :-)! I only joined the team around 2 years ago, and help mainly with the Opencascade parts, Windows porting and the library version of Netgen (nglib).

The core meshing parts are a product of Dr. Joachim Schoeberl and his team, who is currently head of the "Computational Mathematics in Engineering" department at TU-Wien (Austria).

The main paper which details the algorithms used in Netgen can be downloaded from the following location:

http://www.asc.tuwien.ac.at/~schoebe...p/Publications

Check publication number 40: NETGEN - An advancing front 2D/3D-mesh generator based on abstract rules.

Hope this helps...!

have a nice day!

Philippose
philippose is offline   Reply With Quote

Old   May 28, 2010, 06:17
Default
  #30
Member
 
Join Date: May 2010
Posts: 42
Rep Power: 16
Zymon is on a distinguished road
The MSZ is awesome! It really works great. I now did the file semi-automatic with Excel, mine is not the best solution to do it yet. But when I use this for the complex geometry, I'll write a Matlab tool. Like your littel prgramm with the cuboids, but maybe with more complex geometries. But as I have seen it, it is not important that the defined points lie inside the model. So it would be enough to specify a cuboid or a hexahedron (for the point cloud) around several parts of the model, right? Hmm, maybe it is not even necessary to use more complex geometries.

With the MSZ I refined the orifice and the right area behind it. Right now I am running a simulation with it. It seems to be stable, quite slow due to the fine mesh of course.
Attached Images
File Type: jpg overview.JPG (69.1 KB, 43 views)
File Type: jpg detail.jpg (91.4 KB, 53 views)
Zymon is offline   Reply With Quote

Old   May 28, 2010, 15:12
Default
  #31
Senior Member
 
Philippose Rajan
Join Date: Mar 2009
Location: Germany
Posts: 552
Rep Power: 25
philippose will become famous soon enough
Hi there,

Happy I was able to help you :-)!

I think your internal mesh in the "non-critical" parts are unnecessarily fine.... so if your simulation is too slow, I guess you should make those parts coarser as a first step...

Have a nice day ahead!

Philippose
philippose is offline   Reply With Quote

Old   August 29, 2011, 14:40
Default
  #32
New Member
 
Luke Ionno
Join Date: May 2010
Posts: 1
Rep Power: 0
Luke_Ionno is on a distinguished road
Philippose,

Quick question about the MSZ file interpretation... When generating a point-cloud for use in the MSZ file, I'm assuming the 3D separation of the points should be roughly the desired element size, correct? (i.e. the longest line between any two adjacent points should be less than or equal to the specified element size.)

Also, what is the proper method to save a meshing case in Netgen? Is there a "native" Netgen format, or should I just export a neutral-format mesh, and then import it back into Netgen to continue working on it?

Thanks!

~Luke
Luke_Ionno 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
CAD -> gMsh -> enGrid -> OpenFOAM Problem AlGates OpenFOAM 7 August 6, 2010 13:46


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