Skip to content

Elements¤

tatva.element.Element ¤

Element(
    quad_points: Array | None = None,
    quad_weights: Array | None = None,
)

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:

Attributes:

quad_points instance-attribute ¤

quad_points: Array

quad_weights instance-attribute ¤

quad_weights: Array

shape_function abstractmethod ¤

shape_function(xi: Array) -> Array

Returns the shape functions and their derivatives at a point.

shape_function_derivative abstractmethod ¤

shape_function_derivative(xi: Array) -> Array

Returns the derivative of the shape functions with respect to the local coordinates.

get_jacobian ¤

get_jacobian(
    xi: Array, nodal_coords: Array
) -> tuple[Array, Array]

interpolate ¤

interpolate(
    xi: Array, nodal_values: Array, nodal_coords: Array
) -> Array

gradient ¤

gradient(
    xi: Array, nodal_values: Array, nodal_coords: Array
) -> Array

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 ¤

Line2(
    quad_points: Array | None = None,
    quad_weights: Array | None = None,
)

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:

Attributes:

quad_points instance-attribute ¤

quad_points: Array

quad_weights instance-attribute ¤

quad_weights: Array

interpolate ¤

interpolate(
    xi: Array, nodal_values: Array, nodal_coords: Array
) -> Array

shape_function ¤

shape_function(xi: Array) -> Array

shape_function_derivative ¤

shape_function_derivative(xi: Array) -> Array

Returns the derivative of the shape functions with respect to the local coordinates.

get_jacobian ¤

get_jacobian(
    xi: Array, nodal_coords: Array
) -> tuple[Array, Array]

gradient ¤

gradient(
    xi: Array, nodal_values: Array, nodal_coords: Array
) -> Array

get_local_values ¤

get_local_values(
    xi: Array, nodal_values: Array, nodal_coords: Array
) -> tuple[Array, Array, Array]

tatva.element.Line3 ¤

Line3(
    quad_points: Array | None = None,
    quad_weights: Array | None = None,
)

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:

Attributes:

quad_points instance-attribute ¤

quad_points: Array

quad_weights instance-attribute ¤

quad_weights: Array

interpolate ¤

interpolate(
    xi: Array, nodal_values: Array, nodal_coords: Array
) -> Array

shape_function ¤

shape_function(xi: Array) -> Array

shape_function_derivative ¤

shape_function_derivative(xi: Array) -> Array

get_jacobian ¤

get_jacobian(
    xi: Array, nodal_coords: Array
) -> tuple[Array, Array]

gradient ¤

gradient(
    xi: Array, nodal_values: Array, nodal_coords: Array
) -> Array

get_local_values ¤

get_local_values(
    xi: Array, nodal_values: Array, nodal_coords: Array
) -> tuple[Array, Array, Array]

tatva.element.Tri3 ¤

Tri3(
    quad_points: Array | None = None,
    quad_weights: Array | None = None,
)

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 instance-attribute ¤

quad_points: Array

quad_weights instance-attribute ¤

quad_weights: Array

get_jacobian ¤

get_jacobian(
    xi: Array, nodal_coords: Array
) -> tuple[Array, Array]

interpolate ¤

interpolate(
    xi: Array, nodal_values: Array, nodal_coords: Array
) -> Array

gradient ¤

gradient(
    xi: Array, nodal_values: Array, nodal_coords: Array
) -> Array

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 ¤

shape_function(xi: Array) -> Array

Returns the shape functions evaluated at the local coordinates (xi, eta).

shape_function_derivative ¤

shape_function_derivative(*_args, **_kwargs) -> Array

Returns the derivative of the shape functions with respect to the local coordinates (xi, eta).

tatva.element.Tri6 ¤

Tri6(
    quad_points: Array | None = None,
    quad_weights: Array | None = None,
)

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:

Attributes:

quad_points instance-attribute ¤

quad_points: Array

quad_weights instance-attribute ¤

quad_weights: Array

get_jacobian ¤

get_jacobian(
    xi: Array, nodal_coords: Array
) -> tuple[Array, Array]

interpolate ¤

interpolate(
    xi: Array, nodal_values: Array, nodal_coords: Array
) -> Array

gradient ¤

gradient(
    xi: Array, nodal_values: Array, nodal_coords: Array
) -> Array

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 ¤

shape_function(xi: Array) -> Array

shape_function_derivative ¤

shape_function_derivative(xi: Array) -> Array

Returns the derivative of the shape functions with respect to the local coordinates of shape (2, 6).

tatva.element.Quad4 ¤

Quad4(
    quad_points: Array | None = None,
    quad_weights: Array | None = None,
)

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:

Attributes:

quad_points instance-attribute ¤

quad_points: Array

quad_weights instance-attribute ¤

quad_weights: Array

get_jacobian ¤

get_jacobian(
    xi: Array, nodal_coords: Array
) -> tuple[Array, Array]

interpolate ¤

interpolate(
    xi: Array, nodal_values: Array, nodal_coords: Array
) -> Array

gradient ¤

gradient(
    xi: Array, nodal_values: Array, nodal_coords: Array
) -> Array

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 ¤

shape_function(xi: Array) -> Array

shape_function_derivative ¤

shape_function_derivative(xi: Array) -> Array

Returns the derivative of the shape functions with respect to the local coordinates (xi, eta).

tatva.element.Quad8 ¤

Quad8(
    quad_points: Array | None = None,
    quad_weights: Array | None = None,
)

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:

Attributes:

quad_points instance-attribute ¤

quad_points: Array

quad_weights instance-attribute ¤

quad_weights: Array

get_jacobian ¤

get_jacobian(
    xi: Array, nodal_coords: Array
) -> tuple[Array, Array]

interpolate ¤

interpolate(
    xi: Array, nodal_values: Array, nodal_coords: Array
) -> Array

gradient ¤

gradient(
    xi: Array, nodal_values: Array, nodal_coords: Array
) -> Array

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 ¤

shape_function(xi: Array) -> Array

shape_function_derivative ¤

shape_function_derivative(xi: Array) -> Array

dN/d(r,s) as array of shape (2, 8).

tatva.element.Tetrahedron4 ¤

Tetrahedron4(
    quad_points: Array | None = None,
    quad_weights: Array | None = None,
)

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 instance-attribute ¤

quad_points: Array

quad_weights instance-attribute ¤

quad_weights: Array

get_jacobian ¤

get_jacobian(
    xi: Array, nodal_coords: Array
) -> tuple[Array, Array]

interpolate ¤

interpolate(
    xi: Array, nodal_values: Array, nodal_coords: Array
) -> Array

gradient ¤

gradient(
    xi: Array, nodal_values: Array, nodal_coords: Array
) -> Array

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 ¤

shape_function(xi: Array) -> Array

Returns the shape functions evaluated at the local coordinates (xi, eta, zeta).

shape_function_derivative ¤

shape_function_derivative(*_args, **_kwargs) -> Array

Returns the derivative of the shape functions with respect to the local coordinates (xi, eta, zeta).

tatva.element.Hexahedron8 ¤

Hexahedron8(
    quad_points: Array | None = None,
    quad_weights: Array | None = None,
)

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:

Attributes:

quad_points instance-attribute ¤

quad_points: Array

quad_weights instance-attribute ¤

quad_weights: Array

get_jacobian ¤

get_jacobian(
    xi: Array, nodal_coords: Array
) -> tuple[Array, Array]

interpolate ¤

interpolate(
    xi: Array, nodal_values: Array, nodal_coords: Array
) -> Array

gradient ¤

gradient(
    xi: Array, nodal_values: Array, nodal_coords: Array
) -> Array

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 ¤

shape_function(xi: Array) -> Array

Returns the shape functions evaluated at the local coordinates (xi, eta, zeta).

shape_function_derivative ¤

shape_function_derivative(xi: Array) -> Array

Returns the derivative of the shape functions.