pysdic.fem.compute_elements_normals#

compute_elements_normals(vertices_coordinates, connectivity_array, element_type)[source]#

Compute the unit normal of each element of a 3D surface mesh (\(K = 2\), \(E = 3\)), at the center of the element.

The center is the center of the reference element (the mean of the Gauss points of the element type), and the normal is computed as in pysdic.fem.compute_integration_points_normals(). For flat elements, the normal is the same everywhere in the element.

Note

  • Input vertices_coordinates will be converted to numpy.float64.

  • Input connectivity_array will be converted to numpy.int64.

Parameters:
  • vertices_coordinates (ArrayLike) – An array of shape \((N_v, 3)\) with the coordinates of the vertices.

  • 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.

Returns:

normals – An array of shape \((N_e, 3)\) with the unit normal of each element (NaN for the degenerated elements).

Return type:

numpy.ndarray

Examples

1import numpy
2from pysdic.fem import compute_elements_normals
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
7normals = compute_elements_normals(vertices_coordinates, connectivity_array, "triangle_3")
8print(normals)
[[ 0.          0.          1.        ]
 [ 0.         -1.          0.        ]
 [ 1.          0.          0.        ]
 [ 0.57735027  0.57735027  0.57735027]]