pysdic.fem.compute_integration_points_normals#
- compute_integration_points_normals(vertices_coordinates, connectivity_array, element_type, natural_coordinates, element_indices, *, allow_unlocated_points=False, tolerance=0.0)[source]#
Compute the unit normal of a 3D surface mesh (\(K = 2\), \(E = 3\)) at integration points.
The normal is the normalized cross product of the columns of the Jacobian matrix \(J = \frac{\partial X}{\partial \Xi}\) of the element:
\[\vec{n} = \frac{\frac{\partial X}{\partial \xi} \times \frac{\partial X}{\partial \eta}} {\| \frac{\partial X}{\partial \xi} \times \frac{\partial X}{\partial \eta} \|}\]Its orientation follows the order of the vertices in the elements (right-hand rule).
Note
Inputs
vertices_coordinatesandnatural_coordinateswill be converted tonumpy.float64.Inputs
connectivity_arrayandelement_indiceswill be converted tonumpy.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.
natural_coordinates (ArrayLike) – An array of shape \((N_p, 2)\) with the natural coordinates of the points.
element_indices (ArrayLike) – An array of shape \((N_p,)\) with the element index of each point.
allow_unlocated_points (bool, optional (default:
False)) – If True, the points with element index-1get NaN normals. Otherwise, they raise an error.tolerance (Real, optional (default:
0.0)) – The tolerance to decide if a point is inside the reference element.
- Returns:
normals – An array of shape \((N_p, 3)\) with the unit normals. The normal is NaN for the unlocated points and where the element is degenerated (\(\frac{\partial X}{\partial \xi} \times \frac{\partial X}{\partial \eta} = 0\)).
- Return type:
Examples
1import numpy 2from pysdic.fem import compute_integration_points_normals 3 4vertices_coordinates = numpy.array([[-1, -1, 0], [1, -1, 0], [1, 1, 1], [-1, 1, 1]]) 5connectivity_array = numpy.array([[0, 1, 2, 3]]) 6 7normals = compute_integration_points_normals( 8 vertices_coordinates, connectivity_array, "quadrangle_4", 9 natural_coordinates=[[0.0, 0.0]], element_indices=[0], 10) 11print(normals)
[[ 0. -0.4472136 0.89442719]]