Netgen and revolving geometry

More
6 years 9 months ago #345 by pschroe
Hey guys,

I have a question related to rotationally symmetric geometries.

Suppose I want to construct a cylinder in 3D by revolving a rectangle with radius R=.1 (in x-direction) and height H=1 (in y-direction) around the y-axis defined by the points (0,0,0) and (0,1,0).

Attached you find a simple test which should do that in principle.
However, I have two problems:
1) Somehow I have to interchange the intuitive definitions of H and R. Why is that? Or, phrased differently: In which working plane am I defining the SplineCurve2D()?
2) I cannot build a mesh for the resulting geometry.

Thanks for your help!

Best, Philipp
Attachments:
More
6 years 9 months ago #346 by cwinters
Hi Philipp,

1) The SplineCurve2d has it's own local coordinate system, lets say the coordinates in this system are denoted by (x',y'). The defined spline is always rotated around this x'-axis!!
Now you can map the local coordinates to your 3d coordinate system. When you define the revolution object you define the axis of rotation by two points. This means your point (0',0') is mapped to the first point and the x'-axis is pointing in the direction of the second point.

2) The meshing fails for me as well. Sounds like the algorithm has problems to find the special points to start the meshing. I'll have to look into that.
Shifting the points which define the axis revolution might help for now. The following setting works for me.
Code:
H = 1 # why not H=1 here? R = 0.1 # why not R=.1 here? pnts = [ (0,0), (0,R), (H,R), (H,0) ] segs = [ (0,1), (1,2), (2,3), (3,0) ] for pnt in pnts: spline.AddPoint(*pnt) for seg in segs: spline.AddSegment(*seg) rev = Revolution(Pnt(0,1.2,0), Pnt(0,0.4,0), spline)

Which kind of geometry would you like to define? I'm surprised that the cylinder causes problems. I already used it to define way more complicated geometries and did not have these problems.

Best,
Christoph
More
6 years 9 months ago #350 by pschroe
Thank you very much, Christoph, for your reply!
My problem concerning the coordinate system is now resolved :)

Actually, I would like to be able to define a geometry, where, for example, one side is defined by a quadratic spline. I attached an example where I defined something resembling a flower vase ;)

Surprisingly, the meshing works for this example.
So why it fails for the cylinder example above, I have no idea.

Best, Philipp
More
6 years 9 months ago #351 by pschroe
I guess I've found the issue which results in problems with the mesh generation.
It seems that you cannot connect two points which lie on the x'-axis.

For the cylinder example, the following works for me:
Code:
pnts = [ (0,0), (0,R), (H,R), (H,0) ] segs = [ (0,1), (1,2), (2,3) ]

In the flower vase example, I (accidentally) forget to connect the last two points which is why it worked :)

Does this explanation make sense to you?

Best, Philipp
More
6 years 9 months ago #352 by cwinters
Hi Philipp,

if you do not close your 2d spline, it is assumed that the start point and the end point lie on the x'-axis.
So in your case, it seems to be the best way is to leave it open.

I had a quick look at the code and having a connection on the x'-axis could make problems.

Best,
Christoph
The following user(s) said Thank You: pschroe
Time to create page: 0.103 seconds