spline segment refinement parameter ('maxh') not working?

i have made a generic wing shape using splines, it works as expected.


the splines have an unreasonably small mesh division but when i alter the ‘maxh’ parameter on the ‘AddSegment’ call, it makes exactly no difference.

am i doing it right? any examples of altering mesh size on splines?

code for images. (many other cut-down/simplified things tried.)

from netgen.geom2d import SplineGeometry

def AddSpline(spline,pts,**args):
	idxs=[geo.AppendPoint(*pnt) for pnt in pts]
	for i in range(0,len(idxs),2):

geo = SplineGeometry()

geo.AddRectangle( (0, -2), (10, 2), bcs = ("top", "outlet", "bottom", "inlet"))
AddSpline(geo,[[pt[0],pt[1]+.25] for pt in pts],bc="obstruction",maxh=4.0,leftdomain=1, rightdomain=0)
AddSpline(geo,[[pt[0],-pt[1]-.25] for pt in pts],bc="obstruction",maxh=4.0,leftdomain=0, rightdomain=1)  # reflection so swap domains

mesh = Mesh( geo.GenerateMesh(maxh=4.0))


The local mesh size is also affected by the edge curvature. You can reduce this factor like this:

mesh = Mesh( geo.GenerateMesh(maxh=4.0, curvaturesafety=0.1))

But be aware that too large elements at strongly curved regions might lead to meshing failures or odd results after curving elements.


thanks, that’s a ~100x speedup. (~5x element count reduction) with the 0.1 value of ‘curvaturesafety’, with the result visually very similar, but i will check the effect it has on bulk stuff, lift/drag.

from what i can tell, and from its name, ‘curvaturesafety’ operates to ‘switch on’ extra refinement when/where some curve-edge fit error is above a threshold.


this goes to explain the behaviour that ‘maxh’ has no effect if ‘curvaturesafety’ has already refined smaller, but only if is being applied first. i would have expected ‘maxh’ to be applied first then ‘curvaturesafety’ as a safety-net after, can these be applied the other way round? or am i misunderstand completely.