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

More
3 years 4 months ago #3874 by place
i have made a generic wing shape using splines, it works as expected.

except....

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.)
Code:
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): spline.AddSegment([idxs[i],idxs[(i+1)%len(idxs)],idxs[(i+2)%len(pts)]],**args) return geo = SplineGeometry() geo.AddRectangle( (0, -2), (10, 2), bcs = ("top", "outlet", "bottom", "inlet")) pts=[(0.3,0),(1.1,0.02),(1.1,0),(1.1,-0.05),(0.6,-0.06),(0.2,-0.07),(0.2,-0.02),(0.2,0)] 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))
More
3 years 4 months ago - 3 years 4 months ago #3876 by matthiash
Hello,

The local mesh size is also affected by the edge curvature. You can reduce this factor like this:
Code:
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.

Best,
Matthias
Last edit: 3 years 4 months ago by matthiash.
The following user(s) said Thank You: place
More
3 years 4 months ago #3877 by place
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.

but...

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.
Time to create page: 0.104 seconds