solid geometry

Hii,
When we create geometries with Netgen, they are hollow structures. Like for example I made a cylinder like:

algebraic3d
solid cyl = cylinder (0,0,0; 30,0,0;10);
tlo cyl;

So, I got a hollow cylinder. So, how can I get a solid cylinder? (Like one which is filled inside)

Hi,
you have to cut the (infinite cylinder), for example with planes.
Have a look at the documenation:
https://ngsolve.org/docu/latest/netgen_tutorials/define_3d_geometries.html
and
https://ngsolve.org/docu/latest/i-tutorials/unit-4.2-csg/csg.html

I would consider using the python interface if you are just starting using Netgen, since it is the actively developed interface (and it has the nicer Syntax - and programmability).

Best
Christopher

Hi,

the points of the cylinder call just define the axis. You have to cut it to the desired length using planes.

Using the python interface, it would look like this:

from netgen.csg import *

cyl = Cylinder(Pnt(0,0,0),Pnt(30,0,0),10)
p1 = Plane(Pnt(0,0,0),Vec(-1,0,0)) # point and normal vector
p2 = Plane(Pnt(30,0,0),Vec(1,0,0))
solidcyl = cyl*p1*p2

geo = CSGeometry()
geo.Add(solidcyl)

You can still use the geo-file. There you have to add two planes as solid and make the union using “and” between the solids.

Best regards,
Christoph

Thank you!!That was indeed helpful.

Hii,
So, if I create a structure like an ellipse and cut out a sphere and make it in a hemi-structure by cutting by a plane, I will be getting a solid structure. For example,

algebraic3d
solid s1=sphere(0,0,0;50);
solid p1= plane(0,0,0;0,-1,0);
solid e= ellipse(0,0,0;51,0,0;0,55,0;0,0,51);
solid geo= e and p1 and not s1;
tlo geo;

Would the structure be filled within???
Thankyou in advance.

Hi,

since it is an 3d object, you want to use an ellipsoid(…).

algebraic3d
solid s1=sphere(0,0,0;50);
solid p1= plane(0,0,0;0,-1,0);
solid e= ellipsoid(0,0,0;51,0,0;0,55,0;0,0,51);
solid geo= e and p1 and not s1;
tlo geo -maxh=10;

When you run this code and mesh it, you get a mesh which consists of surface elements and volume elements (between sphere and ellipsoid). At the bottom of the GUI you should see the numbers for “Elements” (volume) and “Surf Elements”.

Christoph