1. Lagrange basis: coefficients are point values
Lagrange basis functions are nodal: phi_i equals 1 at
node i and 0 at every other node of the cell, so
alpha_i = u_h(node i). It is the usual
choice for FEM, where the value at a node is shared between the
cells that contain it.
from scimba_jax.linear_approximation.basis.analytic_bases import local_lagrange_basis
# Nodal basis: 1 at its own node, 0 at the other nodes of the cell, so a DOF
# is a point value. Default choice for FEM and DG.
basis = AnalyticBasis(
nb_basis=(order + 1) ** 2, # Q_p tensor-product
out_dim=1,
mesh=mesh,
local_basis=lambda y, i, m: local_lagrange_basis(y, i, m, order=order, out_dim=1),
basis_type="scalar",
)
2. Taylor basis: coefficients are derivatives
Taylor basis functions are modal: they are powers of the centred, rescaled coordinate. Since there are no nodes to share, this basis is only used for DG. Each coefficient has a direct interpretation: the coefficients successively give the cell average, its gradient and its curvature.
from scimba_jax.linear_approximation.basis.analytic_bases import local_taylor_basis
# Modal basis: powers of (x - x_center) / h, without nodes, so DG only.
# Mode 0 gives the cell average, mode 1 the gradient, and so on.
basis = AnalyticBasis(
nb_basis=(order + 1) ** 2,
out_dim=1,
mesh=mesh,
local_basis=lambda y, i, m: local_taylor_basis(y, i, m, order=order, out_dim=1),
basis_type="scalar",
)
# The powers use repeated multiplications, since x ** p with a traced p
# gives nan under vmap (derivative of 0 ** 0).
3. B-spline basis: coefficients are neither point values nor derivatives
This basis comes from isogeometric analysis. It is a smooth spline
of degree p with continuity r across cell
boundaries, evaluated on a sliding window of neighbouring cells
instead of a single cell. For r = 0, the space is
exactly the Lagrange space Q_p, written in a different
basis. The two bases then give bit-identical solutions, and this
property is used to test the B-spline basis.
from scimba_jax.linear_approximation.basis.analytic_bases import (
local_bspline_basis,
)
# B-spline basis: degree p, continuity r across cells (r = 0
# gives Lagrange Q_p).
# A DOF is a spline coefficient, read on a sliding window of
# cells.
basis = AnalyticBasis(
nb_basis=(order + 1) ** 2,
out_dim=1,
mesh=mesh,
local_basis=lambda y, i, m: local_bspline_basis(
y, i, m, order=order, regularity=order - 1, out_dim=1
),
spline_regularity=order - 1,
basis_type="scalar",
)
These three families do not depend on the type of mesh: they can be used in a FEM or DG scheme on structured, unstructured or block-structured meshes. Meshless bases (kernels and random features) are presented on the Collocation-based methods page.