Intersecting two cylinders

Hello,

I am trying to intersect two cylinders and I have found some issues with the result, as NetGen is not able to mesh it. Could you provide any help with this? I

I am attaching the simple .geo file to generate the geometry.

Kind Regards,

Marcos.

https://ngsolve.org/media/kunena/attachments/1048/new.geo

Attachment: new.geo

Hi Marcos,

Here is a Python script that I think does what you want. I don’t know much about the .geo file format. Maybe someone else can help with that. I think it is not necessary to intersect the cylinders with planes first since the intersection of the two cylinders will be finite.

from netgen.csg import * cyl1 = Cylinder(Pnt(0, 0, -10), Pnt(0,0,10), 4) cyl2 = Cylinder(Pnt(-10, 0, 0), Pnt(10,0,0), 5) cutcone2 = cyl1 * cyl2 geo = CSGeometry() geo.Add(cutcone2) mesh = geo.GenerateMesh(maxh=.5)

Best,
Dow

Hi Dow,

thank you for your answer. I have never used Python to generate Netgen geometries or meshes. Is there any documentation available that I can use as a reference for this?

Also, does someone else what is the problem with the .geo file?

Kind Regards,

Marcos.

Hi Marcos,

There is some information here: In Documentation > Tutorials:

https://ngsolve.org/docu/latest/netgen_tutorials/define_3d_geometries.html

There are also some very good interactive “iTutorials” in the Documentation menu. These used to be individually hosted, but now the link has changed to a direct download link. They require jupyter notebook, which can be installed via pip.

Hope that helps!

Best,
Dow

Hi, for the Usermeeting we changed the link of the i-tutorials to download the new updated version. I changed the link back to the old one, we will upload the new version in the coming days.
Have a look at section 4 there.

Best
Christopher

Hi Marcos,

The problem with your .geo file is, that the cutting planes for ‘fincylz’ coincide with the radius of the second cylinder ‘fincylx’.
I think Netgen has a problem with two geometric objects having the identical normal vectors at a point.

So one solution is, as Dow suggested, to completely remove the cutting planes. See
https://ngsolve.org/media/kunena/attachments/828/new_no_planes.geo.
If you need the cutting planes for something else, you can slightly adjust their position or also slightly adjust the radius of ‘fincylx’. See
https://ngsolve.org/media/kunena/attachments/828/new_adj_radius.geo.

Best,
Bernd

Attachment: new_no_planes.geo

Attachment: new_adj_radius.geo