pysdic.Mesh.compute_shape_functions#

Mesh.compute_shape_functions(integration_points, *, return_derivatives=False, default=0.0, tolerance=0.0)[source]#

Compute the shape functions of the elements of the mesh at integration points.

Shortcut for pysdic.fem.compute_shape_functions() with the element type of the mesh and the natural coordinates of integration_points (see this function for the conventions on default and tolerance).

Parameters:
  • integration_points (pysdic.IntegrationPoints) – The integration points, consistent with the mesh (see validate_integration_points()).

  • return_derivatives (bool, optional (default: False)) – If True, the derivatives of the shape functions with respect to the natural coordinates are also returned.

  • default (Optional[Real], optional (default: 0.0)) – The value of the shape functions at the points outside the reference element.

  • tolerance (Real, optional (default: 0.0)) – The tolerance to decide if a point is inside the reference element.

Returns:

  • shape_functions (numpy.ndarray) – An array of shape \((N_p, N_{vpe})\).

  • shape_function_derivatives (numpy.ndarray) – Only returned if return_derivatives is True. An array of shape \((N_p, N_{vpe}, K)\).

Return type:

ndarray | Tuple[ndarray, ndarray]

Examples

1from pysdic import Mesh, IntegrationPoints
2
3mesh = Mesh([[0, 0, 0], [1, 0, 0], [0, 1, 0]], [[0, 1, 2]], element_type="triangle_3")
4integration_points = IntegrationPoints.from_gauss_points("triangle_3", mesh.n_elements)
5
6print(mesh.compute_shape_functions(integration_points))  # [[0.33333333 0.33333333 0.33333333]]