archimedes.approximation.CubicHermiteBasis

class archimedes.approximation.CubicHermiteBasis

A basis of cubic Hermite shape functions

This basis includes both value and derivative degrees of freedom at each of the two element endpoints.

The basis functions are \(\{\phi_{00}, \phi_{10}, \phi_{01}, \phi_{11}\}\), where \(\phi_{i0}\) is the value-type function at endpoint \(i\) and \(\phi_{i1}\) the derivative-type one, so a Function u on this basis has coefficients [u(a), u'(a), u(b), u'(b)]. See [1] for more details.

Typically used to construct piecewise-cubic bases, in which case it can produce a globally \(C^1\) space. See PiecewiseBasis.

Derivatives leave this family: for a piecewise cubic Hermite Function f, f.derivative() is a piecewise quadratic function in a LagrangeBasis (Gauss-Lobatto nodes), since there is no smaller Hermite space for the derivative to live in.

See also

FunctionSpace.piecewise

Convenience constructor for a FunctionSpace that supports piecewise cubic Hermite elements.

Notes

The reference functions on \(t \in [-1, 1]\) are built from the classical cubic Hermite basis on \(\tau \in [0, 1]\) (\(\tau = (t+1)/2\)),

\[\begin{split}\begin{align} H_{00}(\tau) &= 2\tau^3 - 3\tau^2 + 1, \\ H_{10}(\tau) &= \tau^3 - 2\tau^2 + \tau, \\ H_{01}(\tau) &= -2\tau^3 + 3\tau^2, \\ H_{11}(\tau) &= \tau^3 - \tau^2, \end{align}\end{split}\]

via \(\phi_{i0}(t) = H_{i0}(\tau)\) and \(\phi_{i1}(t) = 2 H_{i1}(\tau)\).

References

Methods

boundary_dofs([order])

Indices of the degrees of freedom at the left/right ends of the domain.

evaluate(x[, deriv, a, b, side])

Evaluate all n_basis basis functions at x.

Attributes

Parameters

The target-domain parameters this basis expects.

density

Whether this basis is orthonormal with respect to a probability measure (unit mass) rather than the raw weight of the associated Measure.

n_basis

a value and a slope at each endpoint.

ndim

Number of independent variables the basis functions take.

__init__() → None
boundary_dofs(order: int = 0) → tuple[int | None, int | None]

Indices of the degrees of freedom at the left/right ends of the domain.

Can be used for example to set boundary conditions or enforce continuity at the domain endpoints.

Parameters:

order (int, optional) – Derivative order to look up. Default 0 (the endpoint value).

Returns:

left, right – Index into this basis’s functions, or None where there is no degree of freedom of that order at that end.

Return type:

int or None

Notes

Only meaningful for nodal families (e.g. LagrangeBasis) with nodes at the endpoints. Modal families (e.g. OrthogonalPolynomialBasis) and nodal bases with interior-only nodes (Gauss-Legendre points, for instance) do not have boundary DOFs.

evaluate(x, deriv: int = 0, *, a=None, b=None, side: str = RIGHT)

Evaluate all n_basis basis functions at x.

Parameters:
  • x (array_like) – Evaluation points, shape (npts,).

  • deriv (int, optional) – Order of derivative to evaluate. Default 0.

  • side ({"right", "left"}, optional) – Which one-sided limit to take where the basis is two-valued. Default "right". Irrelevant for smooth bases.

  • **domain_kwargs – Target-domain parameters; see the subclass docstring.

Returns:

phi – Basis values (or deriv-th derivatives), shape (npts, n_basis).

Return type:

ndarray

property Parameters: type

The target-domain parameters this basis expects.

A Parameters subclass (e.g. UnitInterval.Parameters). Returns the type, not an instance.

Determines which reference domain the basis is defined on, for example:

density: bool = False

Whether this basis is orthonormal with respect to a probability measure (unit mass) rather than the raw weight of the associated Measure.

Only meaningful for orthogonal polynomial families based on a Measure (in particular OrthogonalPolynomialBasis); other families should leave this False.

property n_basis: int

a value and a slope at each endpoint.

Type:

Always 4

ndim: int = 1

Number of independent variables the basis functions take.

Typically 1, since most bases are univariate. TensorBasis is the exception, with one variable per tensored factor.