Elements¤
tatva.element.Element
¤
Abstract base class for all finite elements in tatva. Subclasses must implement methods to compute shape functions, their derivatives, and the Jacobian.
Elements are to be used as static objects only in jax transformations! Considered immutable. Do not mutate.
Parameters:
-
(quad_points¤Array | None, default:None) –An array of shape (n_q, n_dim) containing the quadrature points in local coordinates.
-
(quad_weights¤Array | None, default:None) –An array of shape (n_q,) containing the quadrature weights.
Methods:
-
shape_function–Returns the shape functions and their derivatives at a point.
-
shape_function_derivative–Returns the derivative of the shape functions with respect to the local coordinates.
-
get_jacobian– -
interpolate– -
gradient–Returns the gradient of the nodal values at the local coordinates xi.
-
get_local_values–Returns a tuple containing the interpolated value, gradient, and determinant of the Jacobian.
Attributes:
-
quad_points(Array) – -
quad_weights(Array) –
shape_function
abstractmethod
¤
Returns the shape functions and their derivatives at a point.
shape_function_derivative
abstractmethod
¤
Returns the derivative of the shape functions with respect to the local coordinates.
gradient
¤
Returns the gradient of the nodal values at the local coordinates xi.
Parameters:
-
(xi¤Array) –Local coordinates (shape: (n_dim,)).
-
(nodal_values¤Array) –Values at the nodes of the element (shape: (n_nodes, n_values)).
-
(nodal_coords¤Array) –Coordinates of the nodes of the element (shape: (n_nodes, n_dim)).
Returns:
-
Array–Gradient of the nodal values at the local coordinates (shape: (n_values, n_dim)).
get_local_values
¤
get_local_values(
xi: Array, nodal_values: Array, nodal_coords: Array
) -> tuple[Array, Array, Array]
Returns a tuple containing the interpolated value, gradient, and determinant of the Jacobian.
Parameters:
-
(xi¤Array) –Local coordinates (shape: (n_dim,)).
-
(nodal_values¤Array) –Values at the nodes of the element (shape: (n_nodes, n_values)).
-
(nodal_coords¤Array) –Coordinates of the nodes of the element (shape: (n_nodes, n_dim)).
Returns:
-
tuple[Array, Array, Array]–A tuple containing: - Interpolated value at the local coordinates (shape: (n_values,)). - Gradient of the nodal values at the local coordinates (shape: (n_values, n_dim)). - Determinant of the Jacobian (scalar).
tatva.element.Line2
¤
A 2-node linear interval element.
Parameters:
-
(quad_points¤Array | None, default:None) –An array of shape (n_q, n_dim) containing the quadrature points in local coordinates.
-
(quad_weights¤Array | None, default:None) –An array of shape (n_q,) containing the quadrature weights.
Methods:
-
interpolate– -
shape_function– -
shape_function_derivative–Returns the derivative of the shape functions with respect to the local coordinates.
-
get_jacobian– -
gradient– -
get_local_values–
Attributes:
-
quad_points(Array) – -
quad_weights(Array) –
tatva.element.Line3
¤
3-node quadratic line element.
Parameters:
-
(quad_points¤Array | None, default:None) –An array of shape (n_q, n_dim) containing the quadrature points in local coordinates.
-
(quad_weights¤Array | None, default:None) –An array of shape (n_q,) containing the quadrature weights.
Methods:
-
interpolate– -
shape_function– -
shape_function_derivative– -
get_jacobian– -
gradient– -
get_local_values–
Attributes:
-
quad_points(Array) – -
quad_weights(Array) –
get_local_values
¤
get_local_values(
xi: Array, nodal_values: Array, nodal_coords: Array
) -> tuple[Array, Array, Array]
tatva.element.Tri3
¤
A 3-node linear triangular element.
Parameters:
-
(quad_points¤Array | None, default:None) –An array of shape (n_q, n_dim) containing the quadrature points in local coordinates.
-
(quad_weights¤Array | None, default:None) –An array of shape (n_q,) containing the quadrature weights.
Methods:
-
get_jacobian– -
interpolate– -
gradient–Returns the gradient of the nodal values at the local coordinates xi.
-
get_local_values–Returns a tuple containing the interpolated value, gradient, and determinant of the Jacobian.
-
shape_function–Returns the shape functions evaluated at the local coordinates (xi, eta).
-
shape_function_derivative–Returns the derivative of the shape functions with respect to the local coordinates (xi, eta).
Attributes:
-
quad_points(Array) – -
quad_weights(Array) –
gradient
¤
Returns the gradient of the nodal values at the local coordinates xi.
Parameters:
-
(xi¤Array) –Local coordinates (shape: (n_dim,)).
-
(nodal_values¤Array) –Values at the nodes of the element (shape: (n_nodes, n_values)).
-
(nodal_coords¤Array) –Coordinates of the nodes of the element (shape: (n_nodes, n_dim)).
Returns:
-
Array–Gradient of the nodal values at the local coordinates (shape: (n_values, n_dim)).
get_local_values
¤
get_local_values(
xi: Array, nodal_values: Array, nodal_coords: Array
) -> tuple[Array, Array, Array]
Returns a tuple containing the interpolated value, gradient, and determinant of the Jacobian.
Parameters:
-
(xi¤Array) –Local coordinates (shape: (n_dim,)).
-
(nodal_values¤Array) –Values at the nodes of the element (shape: (n_nodes, n_values)).
-
(nodal_coords¤Array) –Coordinates of the nodes of the element (shape: (n_nodes, n_dim)).
Returns:
-
tuple[Array, Array, Array]–A tuple containing: - Interpolated value at the local coordinates (shape: (n_values,)). - Gradient of the nodal values at the local coordinates (shape: (n_values, n_dim)). - Determinant of the Jacobian (scalar).
shape_function
¤
Returns the shape functions evaluated at the local coordinates (xi, eta).
shape_function_derivative
¤
Returns the derivative of the shape functions with respect to the local coordinates (xi, eta).
tatva.element.Tri6
¤
A 6-node quadratic triangular element Node ordering: 3 vertices then 3 edge midpoints. 0:(0,0), 1:(1,0), 2:(0,1), 3:(0.5,0), 4:(0.5,0.5), 5:(0,0.5)
Parameters:
-
(quad_points¤Array | None, default:None) –An array of shape (n_q, n_dim) containing the quadrature points in local coordinates.
-
(quad_weights¤Array | None, default:None) –An array of shape (n_q,) containing the quadrature weights.
Methods:
-
get_jacobian– -
interpolate– -
gradient–Returns the gradient of the nodal values at the local coordinates xi.
-
get_local_values–Returns a tuple containing the interpolated value, gradient, and determinant of the Jacobian.
-
shape_function– -
shape_function_derivative–Returns the derivative of the shape functions with respect to the local coordinates of shape (2, 6).
Attributes:
-
quad_points(Array) – -
quad_weights(Array) –
gradient
¤
Returns the gradient of the nodal values at the local coordinates xi.
Parameters:
-
(xi¤Array) –Local coordinates (shape: (n_dim,)).
-
(nodal_values¤Array) –Values at the nodes of the element (shape: (n_nodes, n_values)).
-
(nodal_coords¤Array) –Coordinates of the nodes of the element (shape: (n_nodes, n_dim)).
Returns:
-
Array–Gradient of the nodal values at the local coordinates (shape: (n_values, n_dim)).
get_local_values
¤
get_local_values(
xi: Array, nodal_values: Array, nodal_coords: Array
) -> tuple[Array, Array, Array]
Returns a tuple containing the interpolated value, gradient, and determinant of the Jacobian.
Parameters:
-
(xi¤Array) –Local coordinates (shape: (n_dim,)).
-
(nodal_values¤Array) –Values at the nodes of the element (shape: (n_nodes, n_values)).
-
(nodal_coords¤Array) –Coordinates of the nodes of the element (shape: (n_nodes, n_dim)).
Returns:
-
tuple[Array, Array, Array]–A tuple containing: - Interpolated value at the local coordinates (shape: (n_values,)). - Gradient of the nodal values at the local coordinates (shape: (n_values, n_dim)). - Determinant of the Jacobian (scalar).
shape_function_derivative
¤
Returns the derivative of the shape functions with respect to the local coordinates of shape (2, 6).
tatva.element.Quad4
¤
A 4-node bilinear quadrilateral element.
Parameters:
-
(quad_points¤Array | None, default:None) –An array of shape (n_q, n_dim) containing the quadrature points in local coordinates.
-
(quad_weights¤Array | None, default:None) –An array of shape (n_q,) containing the quadrature weights.
Methods:
-
get_jacobian– -
interpolate– -
gradient–Returns the gradient of the nodal values at the local coordinates xi.
-
get_local_values–Returns a tuple containing the interpolated value, gradient, and determinant of the Jacobian.
-
shape_function– -
shape_function_derivative–Returns the derivative of the shape functions with respect to the local coordinates (xi, eta).
Attributes:
-
quad_points(Array) – -
quad_weights(Array) –
gradient
¤
Returns the gradient of the nodal values at the local coordinates xi.
Parameters:
-
(xi¤Array) –Local coordinates (shape: (n_dim,)).
-
(nodal_values¤Array) –Values at the nodes of the element (shape: (n_nodes, n_values)).
-
(nodal_coords¤Array) –Coordinates of the nodes of the element (shape: (n_nodes, n_dim)).
Returns:
-
Array–Gradient of the nodal values at the local coordinates (shape: (n_values, n_dim)).
get_local_values
¤
get_local_values(
xi: Array, nodal_values: Array, nodal_coords: Array
) -> tuple[Array, Array, Array]
Returns a tuple containing the interpolated value, gradient, and determinant of the Jacobian.
Parameters:
-
(xi¤Array) –Local coordinates (shape: (n_dim,)).
-
(nodal_values¤Array) –Values at the nodes of the element (shape: (n_nodes, n_values)).
-
(nodal_coords¤Array) –Coordinates of the nodes of the element (shape: (n_nodes, n_dim)).
Returns:
-
tuple[Array, Array, Array]–A tuple containing: - Interpolated value at the local coordinates (shape: (n_values,)). - Gradient of the nodal values at the local coordinates (shape: (n_values, n_dim)). - Determinant of the Jacobian (scalar).
shape_function_derivative
¤
Returns the derivative of the shape functions with respect to the local coordinates (xi, eta).
tatva.element.Quad8
¤
An 8-node biquadratic quadrilateral element.
Parameters:
-
(quad_points¤Array | None, default:None) –An array of shape (n_q, n_dim) containing the quadrature points in local coordinates.
-
(quad_weights¤Array | None, default:None) –An array of shape (n_q,) containing the quadrature weights.
Methods:
-
get_jacobian– -
interpolate– -
gradient–Returns the gradient of the nodal values at the local coordinates xi.
-
get_local_values–Returns a tuple containing the interpolated value, gradient, and determinant of the Jacobian.
-
shape_function– -
shape_function_derivative–dN/d(r,s) as array of shape (2, 8).
Attributes:
-
quad_points(Array) – -
quad_weights(Array) –
gradient
¤
Returns the gradient of the nodal values at the local coordinates xi.
Parameters:
-
(xi¤Array) –Local coordinates (shape: (n_dim,)).
-
(nodal_values¤Array) –Values at the nodes of the element (shape: (n_nodes, n_values)).
-
(nodal_coords¤Array) –Coordinates of the nodes of the element (shape: (n_nodes, n_dim)).
Returns:
-
Array–Gradient of the nodal values at the local coordinates (shape: (n_values, n_dim)).
get_local_values
¤
get_local_values(
xi: Array, nodal_values: Array, nodal_coords: Array
) -> tuple[Array, Array, Array]
Returns a tuple containing the interpolated value, gradient, and determinant of the Jacobian.
Parameters:
-
(xi¤Array) –Local coordinates (shape: (n_dim,)).
-
(nodal_values¤Array) –Values at the nodes of the element (shape: (n_nodes, n_values)).
-
(nodal_coords¤Array) –Coordinates of the nodes of the element (shape: (n_nodes, n_dim)).
Returns:
-
tuple[Array, Array, Array]–A tuple containing: - Interpolated value at the local coordinates (shape: (n_values,)). - Gradient of the nodal values at the local coordinates (shape: (n_values, n_dim)). - Determinant of the Jacobian (scalar).
shape_function_derivative
¤
dN/d(r,s) as array of shape (2, 8).
tatva.element.Tetrahedron4
¤
A 4-node linear tetrahedral element.
Parameters:
-
(quad_points¤Array | None, default:None) –An array of shape (n_q, n_dim) containing the quadrature points in local coordinates.
-
(quad_weights¤Array | None, default:None) –An array of shape (n_q,) containing the quadrature weights.
Methods:
-
get_jacobian– -
interpolate– -
gradient–Returns the gradient of the nodal values at the local coordinates xi.
-
get_local_values–Returns a tuple containing the interpolated value, gradient, and determinant of the Jacobian.
-
shape_function–Returns the shape functions evaluated at the local coordinates (xi, eta, zeta).
-
shape_function_derivative–Returns the derivative of the shape functions with respect to the local coordinates (xi, eta, zeta).
Attributes:
-
quad_points(Array) – -
quad_weights(Array) –
gradient
¤
Returns the gradient of the nodal values at the local coordinates xi.
Parameters:
-
(xi¤Array) –Local coordinates (shape: (n_dim,)).
-
(nodal_values¤Array) –Values at the nodes of the element (shape: (n_nodes, n_values)).
-
(nodal_coords¤Array) –Coordinates of the nodes of the element (shape: (n_nodes, n_dim)).
Returns:
-
Array–Gradient of the nodal values at the local coordinates (shape: (n_values, n_dim)).
get_local_values
¤
get_local_values(
xi: Array, nodal_values: Array, nodal_coords: Array
) -> tuple[Array, Array, Array]
Returns a tuple containing the interpolated value, gradient, and determinant of the Jacobian.
Parameters:
-
(xi¤Array) –Local coordinates (shape: (n_dim,)).
-
(nodal_values¤Array) –Values at the nodes of the element (shape: (n_nodes, n_values)).
-
(nodal_coords¤Array) –Coordinates of the nodes of the element (shape: (n_nodes, n_dim)).
Returns:
-
tuple[Array, Array, Array]–A tuple containing: - Interpolated value at the local coordinates (shape: (n_values,)). - Gradient of the nodal values at the local coordinates (shape: (n_values, n_dim)). - Determinant of the Jacobian (scalar).
shape_function
¤
Returns the shape functions evaluated at the local coordinates (xi, eta, zeta).
shape_function_derivative
¤
Returns the derivative of the shape functions with respect to the local coordinates (xi, eta, zeta).
tatva.element.Hexahedron8
¤
A 8-node linear hexahedral element.
Parameters:
-
(quad_points¤Array | None, default:None) –An array of shape (n_q, n_dim) containing the quadrature points in local coordinates.
-
(quad_weights¤Array | None, default:None) –An array of shape (n_q,) containing the quadrature weights.
Methods:
-
get_jacobian– -
interpolate– -
gradient–Returns the gradient of the nodal values at the local coordinates xi.
-
get_local_values–Returns a tuple containing the interpolated value, gradient, and determinant of the Jacobian.
-
shape_function–Returns the shape functions evaluated at the local coordinates (xi, eta, zeta).
-
shape_function_derivative–Returns the derivative of the shape functions.
Attributes:
-
quad_points(Array) – -
quad_weights(Array) –
gradient
¤
Returns the gradient of the nodal values at the local coordinates xi.
Parameters:
-
(xi¤Array) –Local coordinates (shape: (n_dim,)).
-
(nodal_values¤Array) –Values at the nodes of the element (shape: (n_nodes, n_values)).
-
(nodal_coords¤Array) –Coordinates of the nodes of the element (shape: (n_nodes, n_dim)).
Returns:
-
Array–Gradient of the nodal values at the local coordinates (shape: (n_values, n_dim)).
get_local_values
¤
get_local_values(
xi: Array, nodal_values: Array, nodal_coords: Array
) -> tuple[Array, Array, Array]
Returns a tuple containing the interpolated value, gradient, and determinant of the Jacobian.
Parameters:
-
(xi¤Array) –Local coordinates (shape: (n_dim,)).
-
(nodal_values¤Array) –Values at the nodes of the element (shape: (n_nodes, n_values)).
-
(nodal_coords¤Array) –Coordinates of the nodes of the element (shape: (n_nodes, n_dim)).
Returns:
-
tuple[Array, Array, Array]–A tuple containing: - Interpolated value at the local coordinates (shape: (n_values,)). - Gradient of the nodal values at the local coordinates (shape: (n_values, n_dim)). - Determinant of the Jacobian (scalar).
shape_function
¤
Returns the shape functions evaluated at the local coordinates (xi, eta, zeta).
shape_function_derivative
¤
Returns the derivative of the shape functions.