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.

Currently, equality and hash are based on object identity, meaning two elements are only equal if they are the same object in memory. Even if two elements have the same type and quad rule.

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 ¤

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

get_local_values ¤

get_local_values(
    xi: Array, nodal_values: Array, nodal_coords: Array
) -> tuple[jax.Array, jax.Array, jax.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_dim, n_values)). - Determinant of the Jacobian (scalar).

gradient ¤

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

interpolate ¤

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

shape_function ¤

shape_function(xi: Array) -> Array

Returns the shape functions and their derivatives at a point.

shape_function_derivative ¤

shape_function_derivative(xi: Array) -> Array

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

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:

interpolate ¤

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

get_jacobian ¤

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

get_local_values ¤

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

gradient ¤

gradient(
    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.

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 ¤

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

get_local_values ¤

get_local_values(
    xi: Array, nodal_values: Array, nodal_coords: Array
) -> tuple[jax.Array, jax.Array, jax.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_dim, n_values)). - Determinant of the Jacobian (scalar).

gradient ¤

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

interpolate ¤

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

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.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:

get_jacobian ¤

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

get_local_values ¤

get_local_values(
    xi: Array, nodal_values: Array, nodal_coords: Array
) -> tuple[jax.Array, jax.Array, jax.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_dim, n_values)). - Determinant of the Jacobian (scalar).

gradient ¤

gradient(
    xi: Array, nodal_values: Array, nodal_coords: Array
) -> 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 (xi, eta).

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 ¤

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

get_local_values ¤

get_local_values(
    xi: Array, nodal_values: Array, nodal_coords: Array
) -> tuple[jax.Array, jax.Array, jax.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_dim, n_values)). - Determinant of the Jacobian (scalar).

gradient ¤

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

interpolate ¤

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

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:

get_jacobian ¤

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

get_local_values ¤

get_local_values(
    xi: Array, nodal_values: Array, nodal_coords: Array
) -> tuple[jax.Array, jax.Array, jax.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_dim, n_values)). - Determinant of the Jacobian (scalar).

gradient ¤

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

interpolate ¤

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

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.