CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   enGrid (https://www.cfd-online.com/Forums/engrid/)
-   -   engrid -> save as .stl with boundarie codes (https://www.cfd-online.com/Forums/engrid/76255-engrid-save-stl-boundarie-codes.html)

Zymon May 19, 2010 09:49

engrid -> save as .stl with boundarie codes
 
Hallo Foamers,

I have a question concerning enGrid. Maybe it is a stupid question, but I tried it all day and couldn't find a solution, nor any solution on the web.

So, I have a .stl file and want to put boundary conditions to it for the snappyHexMesh utility. I know that I have to split the model in several parts within the .stl file. In enGrid I can set the boundary code perfectly but when I export it again to .stl file the model isn't split up in parts (as in the motorBike example). So I decided to export the parts (inlet, outlet,...) seperatly and put the files together afterwards. But in enGrid I can't delete part of the model. Does anybody know if it works or should I use another program? I tried to install Netgen, but it doesn't work at the moment.

Thanks!

AlanR May 19, 2010 17:25

Zymon,

I'm not familiar with enGrid, but you could just import your geometry and set up the boundaries in blockMesh. If you look at the motorBike tutorial blockMeshDict file, you will see how to do it. You set up blockMesh as a box around your geometry and define the boundaries. After that, you use snappy to 'adjust' the mesh to your .stl geometry. Depending on your model, you don't have to split the CAD geometry into multiple parts for snappy (like in the motorBike tutorial). If the geometry is simple (like a box or a single bottom surface), you can use a single file.

Alan

phsieh2005 May 19, 2010 22:37

Hi, Zymon,

I do not use enGrid. In stead, I use cgx (www.calculix.de). Type the following command to load the stl file into cgx:
cgx -stl filename.stl

then, do "plot e all". this will display all the elements.
For inlet, type "qadd inlet", then, select all the triangles that belong to the inlet patch. repeat the same for the other patches interested.

For each patch, after selecting them into the proper name, you have to do
comp inlet do
comp inlet do

This will put the nodes into the inlet patch set (repeat the same for all the patches). Then, export each patch using
send inlet stl

This will save all the triangles you selected into inlet patch to inlet.stl
repeat the same for all the patches.

Now that you have each patch in each file, you might want to edit each stl and add, for example, "inlet" to the first line after solid so that snappyHexMesh knows the name.

Hope this helps.

Pei

Zymon May 20, 2010 03:18

Ah, thanks Pei! I am gonna try it today. My solution for yesterday was that I set the surrounding box for snappy tight to my modell (btw. I have an inner flow), so that it touches the inlet and outlet boundaries. This does work for my simple model at the moment, but when it gets complex this won't be the perfect solution, I guess. So I'll try it with your software.

elvis May 20, 2010 12:06

Hello,

what about using discretizer http://www.discretizer.org/
It has two programms discretizer_setup.sh discretizer.sh

what you need to master your snappyhexmesh stuff is discretizer_setup.sh
looks like http://www.discretizer.org/files/boxdialog.jpg

But I'm wondering why don't you ask your engrid concernd questions on
http://engits.eu/phpBB3/ there is a forum for engrid.

But maybe you should contact Oliver Gloth user "ogloth" in this forum
he is the "Spiritus Rector" of engrid :)
see http://www.cfd-online.com/Forums/ope...generator.html

elvis

Zymon May 20, 2010 14:17

Hey, thanks for your advices. Btw. what Meshing-Tool do you take? Snappy works ok, but the problem with the edges is quite annoying. Engrid and NETGEN doesn't produce the desired results at the moment. Tomorrow I'll try your discretizer tool.

elvis May 20, 2010 15:31

Quote:

Originally Posted by Zymon (Post 259590)
Hey, thanks for your advices. Btw. what Meshing-Tool do you take? Snappy works ok, but the problem with the edges is quite annoying. Engrid and NETGEN doesn't produce the desired results at the moment. Tomorrow I'll try your discretizer tool.

Do not underestimate SnappyHexMesh (SHM)!
Well it depends on what you are going to simulate.
But SHM is the underlying technology for a commercial meshing tool
ICON FOAMpro. (I am not affiliated with ICON).
snappyhexmesh is a joint development of icon and opencfd
If creating a snappyhexmeshdict (that creates great results) would be that obvious. Why do people pay money for Consultancy?

Engrid has its merits as well (I am not affiliated with Engits).
But the Spiritus Rector of Engrid makes his living thru Consultancy, besides getting some funding by ESA.

So take some time to dig into learning how to master Engrid/SHMdict, or take some money to get Consultancy.

If you read carefully Stuff related to meshing on http://www.opensourcecfd.com this leads in the direction what is missing in your SHMdict

elvis

ogloth May 21, 2010 03:11

Hello,

it appears as if I should write a comment ;-)

It is true that consultancy is a core source of income for enGits. But we are not really looking for customers that just want user support for enGrid, although we would provide that if asked for. What we do is either customised developments or "complete" CFD consultancy using enGrid and OpenFOAM. With complete consultancy I mean we help our customers to get the task done themselves. Obviously there are issues sometimes (e.g. bugs in enGrid) and those we address quickly in order to meet the commercial deadlines.

Generally we are quite happy to give support on the forum. This is, of course, free of charge. Since enGits is a small company it is not always possible to answer quickly, because sometimes commercial projects are pressing.

Now to your actual meshing problem: If you want you can send me your geometry together with a description on what kind of mesh you would like to have and I'll have a go at it. Ideally, as mentioned above, you would do that on the enGrid forum (http://engits.eu/forum).

Regards,
Oliver

P.S. I am affiliated with enGits ... ;-)

Zymon May 21, 2010 08:52

5 Attachment(s)
Thanks a lot for your support Oliver. I am working on my diploma thesis and so I should really learn all the meshing stuff an do it on my own. Right now I just work on a quite simple model I made to get into meshing and OpenFOAM. Later on I'll get the complex model and I hope that I'll can apply my experiences then. The model right now is 3D, but actually I did it 2D and lenghtened it in the Z-direction. So there are quite a lot sharp edges and I have problems with snappy to get rid of it. So I also try to do it with enGrid.

I attached some pictures of my work untill now:

The first picture shows my original surface mesh, not decend enough for enGrid. So I created a better surface mesh with NETGEN. This can be seen in picture 2 and 3 (3D view). NETGENE produces partly too big meshes and other parts are refined too much. Is it possible to refine parts of the mesh? The max-mesh size option in the Meshing Options does not work at all. Picture 4 shows a slice of the grid (detailed around the orifice). It does look quite ok, but with 400k cells too fine, in my opinion. CheckMesh says all right, despite the number of severly non-orthogonal faces is 371. Due to my sharp edges I can't use the divide prismatic boundary layer tool, otherwise I get highly skew faces and the ckeckMesh fails. Picture 5 shows a fast potentialFoam simulation and the whole grid. You can see that at the parts where NETGEN didn't work that well (upper and lower parts of the chamber, see picture 3), the volumemesh is very bad too. Do you know a better surface mesher than NETGEN (or one with a better documentation)?

(Pictures in next comment, I can upload just 5 pics)
I also did a mesh with snappy what can be seen in picture 6. CheckMesh says everything is ok. But the result of the simulation (picture 7) is not satisfying. I did the refinement of the region with the distance mode. I think the lack in quality of the simulation is due to a missing grading of the mesh quality around the orifice. So the interpolation of the results at the nodes does not work properly. Is there an opportunity for grading between the defined levels in snappy? And is the quality of the surface mesh important for snappy anyway?

I also have some questions concerning enGrid:
- What boundaries should I select for the 'create prismatic boundary layers'? Just the inlet, outlet or all walls? I guess it is all walls and so I did it.
- What does 'total badness' mean? It doesn't sound positive and the number is very high what concerns me a bit.
- When I click 'fix surface triangulation' the program crashs. A usual bug or a problem with my mesh?

Sorry for so much text and so many questions. Nobody around me has any experiences with meshing or CFD simulations. So I am quite on my own except your support. Btw. the OpenFOAM export of enGrid works perfectly, well done!

Zymon May 21, 2010 08:54

2 Attachment(s)
The rest of the pictures.

ogloth May 21, 2010 10:16

Zymon,

Quote:

Originally Posted by Zymon (Post 259728)
The first picture shows my original surface mesh, not decend enough for enGrid. So I created a better surface mesh with NETGEN. This can be seen in picture 2 and 3 (3D view). NETGENE produces partly too big meshes and other parts are refined too much. Is it possible to refine parts of the mesh? The max-mesh size option in the Meshing Options does not work at all. Picture 4 shows a slice of the grid (detailed around the orifice). It does look quite ok, but with 400k cells too fine, in my opinion. CheckMesh says all right, despite the number of severly non-orthogonal faces is 371. Due to my sharp edges I can't use the divide prismatic boundary layer tool, otherwise I get highly skew faces and the ckeckMesh fails. Picture 5 shows a fast potentialFoam simulation and the whole grid. You can see that at the parts where NETGEN didn't work that well (upper and lower parts of the chamber, see picture 3), the volumemesh is very bad too. Do you know a better surface mesher than NETGEN (or one with a better documentation)?

Well, what is better or worse is usually a personal preference. I have used Gmsh and NETGEN as surface meshers for enGrid and usually I got better control with Gmsh. Having said that, enGrid has its own surface mesher now. If you have a discrete geometry (e.g. STL file), you can import that into enGrid and do all meshing tasks within enGrid. Blender is a nice open-source tool to create such a discrete geometry. If you have to rely on STEP or IGES CAD files, you will have to first convert the file. You can also load an existing surface mesh into enGrid and improve it further; this option, however, can be a bit slow sometimes because the search algorithm for the surface projection is not the best (will improve).

Skewness cannot be avoided for sharp corners and high aspect ratios -- simply impossible. But it possibly doesn't have a big impact on your computation. My advice would be to ignore skewness errors in the boundary layer.

Quote:

Originally Posted by Zymon (Post 259728)
- What boundaries should I select for the 'create prismatic boundary layers'? Just the inlet, outlet or all walls? I guess it is all walls and so I did it.

correct!

Quote:

Originally Posted by Zymon (Post 259728)
- What does 'total badness' mean? It doesn't sound positive and the number is very high what concerns me a bit.

That is just NETGEN's output piped into the window. To be honest, I don't know myself. It is some kind of quality measure for the tetras -- simply ignore it.

Quote:

Originally Posted by Zymon (Post 259728)
- When I click 'fix surface triangulation' the program crashs. A usual bug or a problem with my mesh?

Both ;-) it should not crash, but it also indicates (possibly) a problem in your surface mesh.

Quote:

Originally Posted by Zymon (Post 259728)
Sorry for so much text and so many questions. Nobody around me has any experiences with meshing or CFD simulations. So I am quite on my own except your support. Btw. the OpenFOAM export of enGrid works perfectly, well done!

Thanks!

Sorry about the lack of documentation ... it will improve, honestly ... ;-)

Regards,
Oliver

elvis May 21, 2010 11:26

Quote:

If you have to rely on STEP or IGES CAD files, you will have to first convert the file.
In my opinion Salome http://www.salome-platform.org/ can do the job of converting STEP and IGES -> STL for you.
Ofcourse it can do a lot more, as it has a meshing section (based on Netgen and gmsh or commercial plugins) and some more stuff.
http://www.caelinux.org/wiki/index.p...ELinux_2007.29 for an impression

also very helpful might be meshlab http://meshlab.sourceforge.net/
import:PLY, STL, OFF, OBJ, 3DS, COLLADA, PTX, V3D, PTS, APTS, XYZ, GTS, TRI, ASC, X3D, X3DV, VRML, ALN
export:PLY, STL, OFF, OBJ, 3DS, COLLADA, VRML, DXF, GTS, U3D, IDTF, X3D

elvis

Zymon May 21, 2010 11:49

Yeah, thanks. I have already heard about SALOME. I'll install it this weekend. At this company the geometry is defined by an own format. We think about writing an exporter to the .stl format, because the format is quite simple and well supported by OpenFOAM and the meshing tools. Is there a possibility to import .stl files to SALOME in order to change the geometry if required (or a converter to a supported format)?

So, what do you think about my mesh, is it ok?

edit: I have already installed Meshlab. Is one of the export formats readable by SALOME?

philippose May 21, 2010 17:55

5 Attachment(s)
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 May 21, 2010 23:00

Hi, philippose,

Your post is very helpful! I was quite confused about some of the settings you mentioned.

Quite some time ago, you mentioned about calling netgen as library from OpenFOAM. Is there anything happening in this area? I believe that this will be quite helpful for dynamic mesh cases (and Fluid-structure interaction cases).

Pei

Zymon May 22, 2010 05:33

Hi Philippose,

Wow, thanks a lot, this is very helpful. This weekend I'll deal with the theoretical part of CFD, but next week, when I am back at the company, I'll try all your suggested points. I'll most certainly come up with some more questions.

Right now I have two concerns: After the meshing of the surface Netgen automatically detects and defines boundaries. In the left chamber of my model I just want the upper part of the right, upper curvature to be defined as the outlet, but Netgen defines the whole curvature as one boundary. In enGrid you can set a feature angle when setting boundary codes. With a small angle (0.2 degrees) it works fine at this boundary. Is there something comparable in Netgen? Or can I select certain triangles and assign them to a boundary group (e.g. outlet)? This would be most appreciated, but I haven't found such an option yet. My second concern relates to the export to the OpenFOAM Format, you also mentioned. I tried this, but it doesn't save anything. After chosing a directory and saving there aren't any files in the directory. I just tried this twice, maybe the next time it works. But maybe it is a known bug.

A documentation would be really great. This is indeed a problem of Netgen. I have no doubt that this tool is very powerful, but when you don't know how to use it, there is no point in it.

philippose May 22, 2010 08:49

Hello again :-)!

Great that I was able to clarify some doubts (and possibly wake up some more :-)!)....

For your new questions.....

1. By default, Netgen assigns the number of the underlying face of the geometry as the boundary condition number for the triangles of the generated surface mesh. If Netgen is applying a common boundary number to the entire right side curvature, it would imply that the geometry of the entire curvature has been created as one continuous surface without an edge between the curved part, and the straight part (which you want to define as an output).

As of now, there is no way of selecting individual surface triangles and manually assigning a boundary condition number to them....

So.... possible solutions...:

1a. Explicitly create a break in that surface separating the part you want to define as an output so that it is identified as a separate surface directly in the software you use the create your geometry.

1b. Netgen also has another method of applying boundary numbers..... based on the colour of the underlying surface.... but even that will technically only work if you have two separate surfaces, because you cannot apply multiple colours on one surface.

Its always difficult to come to a decision as to what features are expected to be provided by the meshing tool, and what features can be assumed to be a part of the geometry generation phase.


2. As for the OpenFOAM Export from Netgen...... I just tried the export feature using Netgen-4.9.13 in both, Windows and Linux, and it worked fine.... Basically, you need to select a folder, and within this folder, Netgen creates a folder structure "constant -> polyMesh". The individual files (boundary, owner, neighbour, points, faces) are then written into the subfolder "polyMesh"


Have a great weekend ahead!

Philippose

elvis May 22, 2010 10:13

Quote:

Originally Posted by Zymon (Post 259758)
Yeah, thanks. I have already heard about SALOME. I'll install it this weekend. At this company the geometry is defined by an own format. We think about writing an exporter to the .stl format, because the format is quite simple and well supported by OpenFOAM and the meshing tools. Is there a possibility to import .stl files to SALOME in order to change the geometry if required (or a converter to a supported format)?

So, what do you think about my mesh, is it ok?

edit: I have already installed Meshlab. Is one of the export formats readable by SALOME?

Salome
Geometrie Import
Brep Boundary Representation (more or less the Standard Salome file format)
IGES
STEP
ACIS .sat

Geometrie Export
Brep Boundary Representation (more or less the Standard Salome file format)
IGES
STEP
ACIS .sat
and STL (binary and Ascii)

Import Meshing
DAT-file
UNV-file
MED-file

Export Meshing
DAT-file
UNV-file
MED-file
and STL

elvis

Zymon May 22, 2010 11:37

Ah, ok, so do you know a STL to IGES, STEP or ACIS converter? A quick research revealed that this is not that easy. The 3D Data expert (http://www.deskartes.com/data%20mani...a%20expert.htm) should work, despite I have not tried it. But I don't know yet if I have to change the geometry anyway. And I still think that STL is a good format to start with.

elvis May 23, 2010 05:49

Quote:

Originally Posted by Zymon (Post 259836)
Ah, ok, so do you know a STL to IGES, STEP or ACIS converter?

I do not know if it reaaly works, because if have no experience with freecad
http://sourceforge.net/apps/mediawik...itle=Main_Page

but if the statement is correct
Import/export to standard formats such as STEP, IGES, OBJ, DXF or SVG
(but never tried it)

then I would use meshlab to convert STL -> OBJ, and after that
Freecad to convert OBJ -> STEP, IGES

salome and freecad use both OpenCasCade http://www.opencascade.org/

What does the file format you have to convert look like?
Is it taken from some inhouse simulation software that is based on sttructured or unstrucktured dataformat? maybe you should also take a look at VTK
It has many reader or programmable filter => very stable and useful stuff

elvis

Zymon May 25, 2010 04:15

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.

elvis May 25, 2010 08:24

Quote:

Originally Posted by Zymon (Post 260080)
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

phsieh2005 May 25, 2010 15:18

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 (Post 259780)
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


philippose May 25, 2010 17:04

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

phsieh2005 May 26, 2010 08:35

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

Zymon May 26, 2010 11:38

4 Attachment(s)
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.

philippose May 26, 2010 13:27

2 Attachment(s)
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

Zymon May 27, 2010 05:05

1 Attachment(s)
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

philippose May 27, 2010 06:50

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

Zymon May 28, 2010 05:17

2 Attachment(s)
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.

philippose May 28, 2010 14:12

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

Luke_Ionno August 29, 2011 13:40

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


All times are GMT -4. The time now is 14:44.