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.
import netgen.csg as csg
geo = csg.CSGeometry()
sphere = csg.Sphere(csg.Pnt(0, 0, 0), 3)
mesh = geo.GenerateMesh(maxh=1.5)
for the volume of the entire mesh, I would do
vol = Integrate(CoefficientFunction(1),mesh )
and if you need the volume element wise, see mesh element volume.
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”?