pysdic.fem.compute_strains#
- compute_strains(displacements, vertices_coordinates, connectivity_array, element_type, natural_coordinates, element_indices, *, allow_unlocated_points=False, tolerance=0.0, default=nan)[source]#
Compute the linear strain tensor of a displacement field at integration points.
\[\boldsymbol{\varepsilon} = \frac{1}{2} \left( \nabla U + (\nabla U)^T \right)\]where \(\nabla U\) of shape \((E, E)\) is the gradient of the displacements with respect to the global coordinates (see
pysdic.fem.compute_property_derivative()). For a surface embedded in 3D (\(K < E\)), it is the tangential gradient.Any element type is supported.
Note
Inputs
displacements,vertices_coordinatesandnatural_coordinateswill be converted tonumpy.float64.Inputs
connectivity_arrayandelement_indiceswill be converted tonumpy.int64.
- Parameters:
displacements (ArrayLike) – An array of shape \((N_v, E)\) with the displacement of each vertex.
vertices_coordinates (ArrayLike) – An array of shape \((N_v, E)\) 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).
natural_coordinates (ArrayLike) – An array of shape \((N_p, K)\) 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 the valuedefault. Otherwise, they raise an error.tolerance (Real, optional (default:
0.0)) – The tolerance to decide if a point is inside the reference element.default (Real, optional (default:
numpy.nan)) – The value of the unlocated points.
- Returns:
strains – An array of shape \((N_p, E, E)\) with the strain tensor at each point.
- Return type:
Examples
Strains at the centroid of each triangle of a tetrahedron surface.
1import numpy 2from pysdic.fem import compute_strains, get_gauss_points 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]]) 6displacements = 0.1 * vertices_coordinates 7 8natural_coordinates = numpy.repeat(get_gauss_points("triangle_3"), 4, axis=0) 9strains = compute_strains( 10 displacements, vertices_coordinates, connectivity_array, "triangle_3", 11 natural_coordinates, numpy.arange(4), 12) 13print(numpy.round(strains[0], 6))
[[0.1 0. 0. ] [0. 0.1 0. ] [0. 0. 0. ]]