CFD Online Discussion Forums

CFD Online Discussion Forums (
-   Open Source Meshers: Gmsh, Netgen, CGNS, ... (
-   -   Netgen refinement regions (

danvica January 3, 2013 05:49

Netgen refinement regions
Is there any equivalent way to refine a region within Netgen ?

Something as refinementRegions in snappyHexMesh.


philippose January 3, 2013 09:29

Hello there,

A Good day to you!

Yes, there is a way of locally refining meshes in netgen.

If you look into the Meshing options, in the second tab, under the basic mesh size settings, you have a box where you can specify a "mesh size file". This file is a simple text-file with the extension ".msz", with the following format:

<num of points>
<x1> <y1> <z1> <maxH1>
<x2> <y2> <z2> <maxH2>
<x3> <y3> <z3> <maxH3>
<xN> <yN> <zN> <maxHN>
<num of lines>
<x11> <y11> <z11> <x12> <y12> <z12> <maxH1>
<x21> <y21> <z21> <x22> <y22> <z22> <maxH2>
<x31> <y31> <z31> <x32> <y32> <z32> <maxH3>
<xN1> <yN1> <zN1> <xN2> <yN2> <zN2> <maxHN>

The first set of points basically specifies the maximum mesh size at the given points, and the second set limits the maximum mesh size along the specified lines to the given values.

In case you do not want to limit mesh sizes along lines, specify a "0" for the "<num of lines>" followed by a new line.

Now.... the values specified in the mesh size file is taken into consideration after all the other mesh size definition functions, and hence, the mesh size file only needs to have those points where you really want the mesh to be locally refined.... all the other parts of the mesh will be meshed with the normal settings.

Be careful to specify the mesh sizes in the units in which the mesh geometry is defined :-)!

Hope this helps.... if you have any questions, feel free to put them up here, and I shall try to clarify them.

Have a nice day ahead!


danvica January 3, 2013 10:44

Thanks for the fast reply !

I already knew about points refinements but I missed the lines option.

Some questions:

- What does "locally" means ? How can you set the control distance of the points/lines ?

- Any plan to add a box option ? (Hey, you've got point and line: it seems natural to have all 3 dimensions... :D)

I could simulate a box option by N lines... but how to calculate N (see first question) ?


danvica January 3, 2013 10:48

BTW, I forgot to ask you why in Netgen 5.0 there's no more the "Edit Face mesh size" voice.

On the release notes there's an indication regarding an automatic refinement but I don't understand how to manual modify a surface mesh size.

philippose January 3, 2013 11:26

Hello again,

In answer to your previous post....

When you specify a mesh size file, Netgen internally constrains the maximum element mesh size around the specified areas (in the case of a line, an internal resolution is used... cant remember the actual value now) for both... the surface mesh as well as the volume elements (tets).

The function was put in on a "need-to" basis, and I guess the requirement for a "box" type mesh restriction never came up (though, I know that there is an internal function which already does exactly this.... except, as of now... it is only used internally :-)!)

For example.... in my cases so far, I have almost always only required annular cylindrical areas in which the mesh should be refined, and for that, I wrote a small python script which writes a ".msz" file (essentially a point-cloud with mesh sizes)

As for your last post regarding the "Edit Face Mesh Size" option :-)! When I implemented this function a couple of years ago, it was purely for either "STEP" or "IGES" files.

Did you compile Netgen 5.0 from scratch yourself? And which platform are you using? It looks like in your case, the OpenCascade support for Netgen 5.0 has not been enabled / compiled.


danvica January 3, 2013 12:14

Thanks for the answers, I'll have to play a little with phyton...

Regarding Netgen 5.0, I just downloaded Netgen-5.0.0_x64.exe (

There's a dev release but I haven't try it...

All times are GMT -4. The time now is 09:07.