Meshing a small complex object from a .geo file


I’m trying to solve a problem set on an unbounded domain, which is truncated a long way from the region of interest. I’m running into a few difficulties, which I suspect are relatively easy to do, but I’m not sure what the correct procedure is:

  1. I’m running into issues when the inner model has a complex geometry (made up with multiple primitive objects and defined in a .geo file) and placed in a domain with truncation far from the object around 100 times the size of the object. In such cases, the Netgen gets stuck finding points or edges, but works when the outer boundary is placed closer to the object. Is there anything I could try to solve this?

  2. In an attempt to overcome 1), I’ve attempted to resize my domain. Eg consider a simple case where the inner region is a sphere and the outer truncation domain is also a sphere (of much larger radius) and considering the two cases

a) inner sphere radius 1, outer sphere radius 100
b) inner sphere radius 0.1, outer sphere radius 10

how can I best control the mesh spacing so that they result in a similar number of elements?

Kind regards,


Hi Ben,

  1. Could be that you just need to scale the bounding box of your CSGeometry properly to get it running.

If a part of your geometry reaches out of the default domain (should be a cube [-1000,1000]^3), the find edges algorithm might not succeed.

  1. When you scale everything properly (every maxh and the bounding box) you should get similar numbers of elements. See the attached file.



you can set the boundingbox in the geo file as well:

boundingbox(xmin,ymin,zmin; xmax, ymax, zmax)

Hello Both,

Thank you for your replies, that seems to have solved it. Thank you both!

Kind regards,