Creating different shapes in netgen


I am using netgen to create a geometry for 2D flow around a cylinder. It is quite easy to do this with netgen, as I just use the AddRectangle method, and use AddCircle after that. This creates an immersed circle as I want it to.

However, I have been trying to create different types of immersed shapes - like an ellipse or a square. I thought I was doing this correctly using splines, but I constantly get a “mesh failed” error with no context. This is what I created for the ellipse:

def MakeEllipse (geo, c, r):
cx,cy = c
rx,ry = r
pts = [geo.AppendPoint(*p) for p in [(cx,cy-ry), (cx+rx,cy-ry), (cx+rx,cy), (cx+rx,cy+ry), (cx,cy+ry), (cx-rx,cy+ry), (cx-rx,cy), (cx-rx,cy-ry)]]
for p1,p2,p3 in [(0,1,2), (2,3,4), (4, 5, 6), (6, 7, 0)]:
geo.Append( [“spline3”, pts[p1], pts[p2], pts[p3]])

import netgen.geom2d as ngeo import netgen geo = ngeo.SplineGeometry() geo.AddRectangle((0, 0), (2, 1), bcs=(“wall”, “outlet”, “wall”, “inlet”), maxh=maxh_walls)
MakeEllipse(geo, (0.5, 0.5), (0.1, 0.05))

I basically followed the AddCircle implementation, except now, I have a radius for y and a radius for x - thus, the spline should be more of an ellipse arc. What am I doing wrong? What is the best way to add different types of immersed object shapes?
Thank you.

Nevermind, I think I mostly figured out the issue. I had to add leftdomain and rightdomain arguments.