Forum Message

 

 

We have moved the forum to https://forum.ngsolve.org . This is an archived version of the topics until 05/05/23. All the topics were moved to the new forum and conversations can be continued there. This forum is just kept as legacy to not invalidate old links. If you want to continue a conversation just look for the topic in the new forum.

Notice

The forum is in read only mode.

Creating different shapes in netgen

More
1 year 11 months ago - 1 year 11 months ago #4308 by s.mokbel
Hello,

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.
Last edit: 1 year 11 months ago by s.mokbel.
More
1 year 11 months ago #4310 by s.mokbel
Nevermind, I think I mostly figured out the issue. I had to add leftdomain and rightdomain arguments. 
Time to create page: 0.104 seconds