Refinement of subdomain


I am new to the forum and usually run FEM simulation on pavement layered systems. I set up my mesh using CSG.

My question is this: Assume I apply a square load in the center on top of a layered system. How do I control mesh refinement through depth without having to create additional materials under my area of interest and using small (-maxh)? Normally I carry additional “orhtobricks” under the layer so they can be more refined, however I’d like to simply have another option without the need for these additional “orthobricks”.

Any suggestions? Thanks

You could restrict the meshsize at a set of points:

mparam = meshsize.moderate
for x,y,z in restrict_points:


Thanks Christopher. Maybe I haven’t followed Netgen’s evolution too close. But I have one comment regarding the Python version. Is all the previous syntax using direct CSG commands such as these:

solid sec_0 = plane(0, 5, 0; 0, 1, 0) and plane(0, 0, 0; 0, -1, 0) and plane(0, 0, 0; -1, 0, 0) and plane(1.5, 0, 0; 1, 0, 0) and plane(0, 0, 0; 0, 0, -1) and plane(0, 0, 50; 0, 0, 1)

solid lane_0_cut_0 = plane (0, 4.9, 0; 0, -1, 0);

tlo lane3layer1;

Have they been discontinued from development and now Python is the current version? I have been considering attending the user meeting but not sure what the focus would be and if it would be relevant to my application. Any thoughts?

Thanks again.


Sry I didn’t see the line “I set up my geometry using CSG”.
You can do the same thing using a meshsize file as described in this documentation:

See 4.1 mesh size file.

I think all of the functionality of the CSG interface is now exported to Python as well. The syntax changed slightly, but internally the same C++ code is executed. It got more powerful, because you can use the full potential of Python.
The old geo files will be supported in the foreseeable future as well, but wont be further developed any more.
Basically your code in python would look like:

from netgen.csg import *
geo = CSGeometry()
sec_0 = Plane(Pnt(0, 5, 0), Vec(0, 1, 0)) * Plane(Pnt(0, 0, 0), Vec(0, -1, 0)) * Plane(Pnt(0, 0, 0), Vec(-1, 0, 0)) * Plane(Pnt(1.5, 0, 0), Vec(1, 0, 0)) * Plane(Pnt(0, 0, 0), Vec(0, 0, -1)) * Plane(Pnt(0, 0, 50), Vec(0, 0, 1))

The user meeting will mainly focus on NGSolve not Netgen. So if you are only interested in Netgen I would not recommend it. If you want to learn how to do FEM in NGSolve we will be happy to meet you in Portland :wink:
If you have need for (professional) Netgen support you can contact me at We started a university spin off this summer to support companies in using Netgen/NGSolve.


That’s great to hear. Thanks again for the reply.

Is the Python version faster than the previous one? I end up with lots of domains and it takes a while to generate mesh for all of them.

I will consider getting some support from you.


Since all computationally expensive parts are done in C++ the speed from python and geo files should be the same if you use the same version. We have made some improvements in the meshing and have parallelized the mesh optimization recently, so a recent version of Netgen should be faster than old ones.