mesh.Mesh.volumes#

Mesh.volumes()#

Return the signed volume of the elements in Mesh of level 3.

Returns#

array | None

For a level 3 Mesh, the signed volume of the elements. If the elements are of eltype ‘tet4’, the volumes are exact. For other eltypes, a conversion to ‘tet4’ is done before computing the volumes. This can produce an exact result, an approximate result or no result (if the conversion fails). If successful, returns an (n_elems,) float array with the volumes.

Returns None if the Mesh level is < 3, or the conversion to ‘tet4’ does not succeed.

Examples#

>>> nx, ny, nz = 2, 2, 1
>>> M = Mesh(eltype='hex8').subdivide(nx, ny, nz)
>>> a = M.volumes()
>>> print(a)        # each equals 1. / (nx * ny * nz)
[0.25 0.25 0.25 0.25]
>>> print(a.sum())
1.0