- Thank you received: 0
How to get the volume of a geometry and/or a mesh?
5 years 2 months ago #1892
by MA
How to get the volume of a geometry and/or a mesh? was created by MA
Attached is a simple example of a geometry object (sphere) and a surface mesh.
Can you please let me know if it's possible to get the volume of a geometry object or a 3D closed surface mesh?
As you can imagine, I need to calculate the volume of more complicated shapes.
Thanks for your help.
MA
import netgen.csg as csg
geo = csg.CSGeometry()
sphere = csg.Sphere(csg.Pnt(0, 0, 0), 3)
geo.Add(sphere)
mesh = geo.GenerateMesh(maxh=1.5)
Can you please let me know if it's possible to get the volume of a geometry object or a 3D closed surface mesh?
As you can imagine, I need to calculate the volume of more complicated shapes.
Thanks for your help.
MA
import netgen.csg as csg
geo = csg.CSGeometry()
sphere = csg.Sphere(csg.Pnt(0, 0, 0), 3)
geo.Add(sphere)
mesh = geo.GenerateMesh(maxh=1.5)
5 years 2 months ago #1894
by hvwahl
Replied by hvwahl on topic How to get the volume of a geometry and/or a mesh?
Hi MA,
for the volume of the entire mesh, I would do
and if you need the volume element wise, see
mesh element volume
.
Best wishes,
Henry
for the volume of the entire mesh, I would do
Code:
vol = Integrate(CoefficientFunction(1),mesh )
Best wishes,
Henry
5 years 1 month ago #1897
by MA
Replied by MA on topic How to get the volume of a geometry and/or a mesh?
Thank you for the prompt answer. I really appreciate it.
The "Integrate" method is only available on "ngsolve" and requires a volume mesh. However, is their a way to get the volume of a closed surface (in stl format for instance) without building a volume mesh and using "netgen"?
Thanks.
MA
The "Integrate" method is only available on "ngsolve" and requires a volume mesh. However, is their a way to get the volume of a closed surface (in stl format for instance) without building a volume mesh and using "netgen"?
Thanks.
MA
Time to create page: 0.107 seconds