pysdic.fem.get_gauss_points#

get_gauss_points(element_type, *, return_weights=False)[source]#

Get the natural coordinates and weights of Gauss quadrature points for a specified element type.

The integral of a function \(f\) over the reference element is approximated by:

\[\int_{\hat{\Omega}} f(\xi) \, d\xi \approx \sum_{g=1}^{N_{gp}} w_g f(\xi_g)\]
Parameters:
  • element_type (str) –

    Type of the finite element (case insensitive). Supported types are:

    • 'segment_2': 2-node segment element.

    • 'segment_3': 3-node segment element.

    • 'triangle_3': 3-node triangle element.

    • 'triangle_6': 6-node triangle element.

    • 'quadrangle_4': 4-node quadrangle element.

    • 'quadrangle_8': 8-node (serendipity) quadrangle element.

  • return_weights (bool, optional (default: False)) – If True, the function will also return the weights associated with each Gauss point.

Returns:

  • gauss_points (numpy.ndarray) – Natural coordinates of the Gauss points. The shape of the returned array is \((N_{gp}, K)\), where \(N_{gp}\) is the number of Gauss points for the specified element type and \(K\) is the topological dimension of the element.

  • weights (numpy.ndarray) – Only returned if return_weights is True. Weights associated with each Gauss point, with shape \((N_{gp},)\). They sum to the measure of the reference element.

Return type:

ndarray | Tuple[ndarray, ndarray]

See also

pysdic.fem.get_segment_2_gauss_points

Gauss points for 2-node segment elements.

pysdic.fem.get_segment_3_gauss_points

Gauss points for 3-node segment elements.

pysdic.fem.get_triangle_3_gauss_points

Gauss points for 3-node triangle elements.

pysdic.fem.get_triangle_6_gauss_points

Gauss points for 6-node triangle elements.

pysdic.fem.get_quadrangle_4_gauss_points

Gauss points for 4-node quadrangle elements.

pysdic.fem.get_quadrangle_8_gauss_points

Gauss points for 8-node quadrangle elements.

pysdic.fem.compute_shape_functions

Shape functions for any supported element type.

Examples

Get the Gauss points for a 3-node triangle element:

1import numpy
2from pysdic.fem import get_gauss_points
3
4gauss_points_array = get_gauss_points("triangle_3")
5print("Gauss points for triangle_3:")
6print(gauss_points_array)
Gauss points for triangle_3:
[[0.33333333 0.33333333]]

Integrate \(f(\xi, \eta) = \xi \eta\) over the reference triangle (exact value \(\frac{1}{24}\)):

1points, weights = get_gauss_points("triangle_6", return_weights=True)
2integral = numpy.sum(weights * points[:, 0] * points[:, 1])
3print(integral, 1.0 / 24.0)
0.041666666666666664 0.041666666666666664