pysdic.compute_quadrangle_8_shape_functions#
- compute_quadrangle_8_shape_functions(natural_coordinates, return_derivatives=False, *, default=0.0)[source]#
Compute the shape functions for a 8-node quadrangle for given
natural_coordinates\((\xi, \eta)\).Note
Input
natural_coordinateswill be converted tonumpy.float64.Output arrays will be
numpy.float64.
- Parameters:
natural_coordinates (ArrayLike) – Natural coordinates where to evaluate the shape functions. The array must have shape \((N_{p}, 2)\), where \(N_{p}\) is the number of points to evaluate.
return_derivatives (
bool, optional) – IfTrue, the function will also return the first derivatives of the shape functions with respect to the natural coordinates. By default,False.default (Real, optional) – Default value to assign to shape functions when the input natural coordinates are out of the valid range (i.e., not in \(\xi, \eta \in [-1, 1]\)). By default,
0.0.
- Returns:
shape_functions (
numpy.ndarray) – Shape functions evaluated at the given natural coordinates. The returned array has shape \((N_{p}, 8)\), where each row corresponds to a point and each column to a node.shape_function_derivatives (
numpy.ndarray, optional) – Ifreturn_derivativesisTrue, the function also returns an array of the first derivatives of the shape functions with respect to the natural coordinates. The returned array has shape \((N_{p}, 8, 2)\).
- Return type:
Notes
An 8-node quadrangle represented in the figure below has the following shape functions:
Node No.
\((\xi, \eta)\)
Shape Function \(N\)
First Derivative \((\frac{dN}{d\xi}, \frac{dN}{d\eta})\)
1
\((-1, -1)\)
\(N_1(\xi, \eta) = \frac{1}{4}(1 - \xi)(1 - \eta)(- \xi - \eta - 1)\)
\((\frac{1}{4}(1 - \eta)(2\xi + \eta), \frac{1}{4}(1 - \xi)(\xi + 2\eta))\)
2
\((1, -1)\)
\(N_2(\xi, \eta) = \frac{1}{4}(1 + \xi)(1 - \eta)(\xi - \eta - 1)\)
\((\frac{1}{4}(1 - \eta)(2\xi - \eta), -\frac{1}{4}(1 + \xi)(\xi - 2\eta))\)
3
\((1, 1)\)
\(N_3(\xi, \eta) = \frac{1}{4}(1 + \xi)(1 + \eta)(\xi + \eta - 1)\)
\((\frac{1}{4}(1 + \eta)(2\xi + \eta), \frac{1}{4}(1 + \xi)(\xi + 2\eta))\)
4
\((-1, 1)\)
\(N_4(\xi, \eta) = \frac{1}{4}(1 - \xi)(1 + \eta)(- \xi + \eta - 1)\)
\((\frac{1}{4}(1 + \eta)(2\xi - \eta), \frac{1}{4}(1 - \xi)(- \xi + 2\eta))\)
5
\((0, -1)\)
\(N_5(\xi, \eta) = \frac{1}{2}(1 - \xi^2)(1 - \eta)\)
\((-\xi(1 - \eta), -\frac{1}{2}(1 - \xi^2))\)
6
\((1, 0)\)
\(N_6(\xi, \eta) = \frac{1}{2}(1 + \xi)(1 - \eta^2)\)
\((\frac{1}{2}(1 - \eta^2), -\eta(1 + \xi))\)
7
\((0, 1)\)
\(N_7(\xi, \eta) = \frac{1}{2}(1 - \xi^2)(1 + \eta)\)
\((-\xi(1 + \eta), \frac{1}{2}(1 - \xi^2))\)
8
\((-1, 0)\)
\(N_8(\xi, \eta) = \frac{1}{2}(1 - \xi)(1 - \eta^2)\)
\((-\frac{1}{2}(1 - \eta^2), -\eta(1 - \xi))\)
See also
pysdic.compute_quadrangle_4_shape_functionsShape functions for 4-node quadrangle 2D-elements.
pysdic.get_quadrangle_8_gauss_pointsGauss integration points for 8-node quadrangle 2D-elements.
Examples
Compute shape functions without derivatives for 3 valid points and 1 invalid point:
1import numpy 2from pysdic import compute_quadrangle_8_shape_functions 3 4coords = numpy.array([[-1.0, -1.0], [0.0, -1.0], [1.0, 0.0], [1.5, 0.5]]) 5shape_functions = compute_quadrangle_8_shape_functions(coords) 6print("Shape function values:") 7print(shape_functions)
Shape function values: [[ 1. -0. -0. -0. 0. 0. 0. 0.] [ 0. 0. -0. -0. 1. 0. 0. 0.] [-0. 0. 0. -0. 0. 1. 0. 0.] [ 0. 0. 0. 0. 0. 0. 0. 0.]]