pysdic.fem.compute_elements_areas#
- compute_elements_areas(vertices_coordinates, connectivity_array, element_type)[source]#
Compute the area of each surface element (\(K = 2\)) of a mesh.
The area is integrated with the Gauss points \(\Xi_g\) and weights \(w_g\) of the element type (see
pysdic.fem.get_gauss_points()):\[A = \int_{\hat{\Omega}} \sqrt{\det(J^T J)} \, d\Xi \approx \sum_{g} w_g \sqrt{\det(J(\Xi_g)^T J(\Xi_g))}\]where \(J\) is the Jacobian matrix of shape \((E, 2)\) of the element. The area is exact for the elements with a constant Jacobian (
triangle_3, parallelogramquadrangle_4) and approximated by the quadrature otherwise.Note
Input
vertices_coordinateswill be converted tonumpy.float64.Input
connectivity_arraywill be converted tonumpy.int64.
- Parameters:
vertices_coordinates (ArrayLike) – An array of shape \((N_v, E)\) with the coordinates of the vertices (\(E \geq 2\)).
connectivity_array (ArrayLike) – An array of shape \((N_e, N_{vpe})\) with the vertex indices of each element.
element_type (str) – The type of the elements (case insensitive), a surface element type (
'triangle_3','triangle_6','quadrangle_4'or'quadrangle_8').
- Returns:
areas – An array of shape \((N_e,)\) with the area of each element (NaN for the elements with non-finite vertices).
- Return type:
Examples
1import numpy 2from pysdic.fem import compute_elements_areas 3 4vertices_coordinates = numpy.array([[0, 0, 0], [1, 0, 0], [0, 1, 0], [0, 0, 1]]) 5connectivity_array = numpy.array([[0, 1, 2], [0, 1, 3], [0, 2, 3], [1, 2, 3]]) 6 7areas = compute_elements_areas(vertices_coordinates, connectivity_array, "triangle_3") 8print(areas)
[0.5 0.5 0.5 0.8660254]