Mesh

2 months 3 weeks ago - 2 months 3 weeks ago #2563 by Yongbin
Hi, everyone! I want to add a square obstacle in the channel. Now, the following code is obviously wrong,
######
from netgen.geom2d import SplineGeometry
geo = SplineGeometry()
geo.AddRectangle( (0, 0), (40, 10), bcs = ("wall", "outlet", "wall", "inlet"))
geo.AddRectangle((5, 0), (6, 1))
mesh = Mesh( geo.GenerateMesh(maxh=0.6))

Many thanks!
Yongbin Han

Please Log in or Create an account to join the conversation.

2 months 3 weeks ago #2564 by mneunteufel
Hi Yongbin,

you have to use the leftdomain, rightdomain flag to label your boundaries, e.g.
from ngsolve import *
from netgen.geom2d import SplineGeometry
geo = SplineGeometry()
geo.AddRectangle( (0, 0), (40, 10), bcs = ("wall", "outlet", "wall", "inlet"), leftdomain=1, rightdomain=0)
geo.AddRectangle((5, 0.2), (6, 1), leftdomain=0, rightdomain=1)
mesh = Mesh( geo.GenerateMesh(maxh=0.6))

Secondly, in your code the rectangles have a shared edge, which is not allowed. I refer to this post a solution by adding your geometry edge by edge.

Best
Michael
The following user(s) said Thank You: Yongbin

Please Log in or Create an account to join the conversation.

2 months 2 weeks ago #2576 by Yongbin
Hi,mneunteufel, I have now finished this code with your help.
Thank you very much!

Yongbin Han

Please Log in or Create an account to join the conversation.

© 2019 Netgen/NGSolve