archimedes.approximation.PiecewiseBasis¶
- class archimedes.approximation.PiecewiseBasis( )¶
A
Basisconstructed by tiling a local basis across elements.This constructs a finite (or spectral) element basis by partitioning the domain into subintervals, each of which has a basis of local support.
The domain partitioning is determined by
breakpoints, defined on the reference domain \([-1, 1]\).Continuity. Tiling alone produces a discontinuous (\(C^{-1}\)) basis. A \(C^0\) basis is continuous at element boundaries, i.e. neighboring elements share endpoint DOFs. A \(C^1\) basis additionally has continuous first derivatives at element boundaries. These choices correspond to
continuity={-1, 0, 1}.Element ownership at a breakpoint. When the basis functions are two-valued at interior breakpoints (e.g. the value of a \(C^{-1}\) function or the derivative of a \(C^0\) function), the
sideargument ("left"or"right") of evaluation determines which value is returned. This is useful for instance with discontinuous Galerkin (DG) numerical flux construction, which uses \(u^-\) and \(u^+\) at each interface.This class is typically not used directly; instead, it is constructed as part of the
FunctionSpace.piecewise()constructor. However, it can be used for customized piecewise bases not supported by that high-level constructor.See also
FunctionSpace.piecewiseConvenience constructor for a
FunctionSpaceusing common piecewise bases (e.g. “lagrange”, “legendre”, “hermite”).
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 at arbitrary points, resolving breakpoints by
side.Attributes
The target-domain parameters this basis expects.
Continuity at element boundaries.
Whether this basis is orthonormal with respect to a probability measure (unit mass) rather than the raw weight of the associated
Measure.Number of elements.
Number of independent variables the basis functions take.
Local basis, defined on the reference interval
[-1, 1].Element boundaries on the reference domain
- __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
Nonewhere 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 at arbitrary points, resolving breakpoints by
side.- Parameters:
x (array_like, int, optional) – As for
Basis.evaluate().deriv (array_like, int, optional) – As for
Basis.evaluate().a (float, optional) – Target-domain endpoints; default the reference domain
[-1, 1].b (float, optional) – Target-domain endpoints; default the reference domain
[-1, 1].side ({"right", "left"}, optional) – Which one-sided limit to take at a point lying exactly on an interior breakpoint, where this basis is two-valued.
"right"(default) makes ownership half-open[lo, hi);"left"makes it(lo, hi]. Irrelevant away from breakpoints and forderiv=0on a \(C^0\) basis. See the class docstring.
- property Parameters: type¶
The target-domain parameters this basis expects.
A
Parameterssubclass (e.g.UnitInterval.Parameters). Returns the type, not an instance.Determines which reference domain the basis is defined on, for example:
UnitIntervalfor \([-1, 1]\).HalfLinefor \([0, \infty)\).RealLinefor \((-\infty, \infty)\).
- breakpoints: ndarray¶
Element boundaries on the reference domain
Shape
(k + 1,)forkelements. Must be strictly increasing and span[-1, 1]exactly.
- continuity: int = 0¶
Continuity at element boundaries.
-1for discontinuous,0for value continuity,1for first-derivative continuity.
- 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 particularOrthogonalPolynomialBasis); other families should leave thisFalse.
- property n_basis: int¶
- property n_elements: int¶
Number of elements.
- ndim: int = 1¶
Number of independent variables the basis functions take.
Typically 1, since most bases are univariate.
TensorBasisis the exception, with one variable per tensored factor.