zoomy_core.model.derivation.symbolic_integrator

zoomy_core.model.derivation.symbolic_integrator#

Exact symbolic integration of basis-function products over the basis domain, with strategy dispatch (sympy, knot spans, orthogonality, quadrature). Used by the basis matrices (mass, triple product, derivative products) of the Galerkin projection.

Module Contents#

Classes#

SymbolicIntegrator

Integrates basis-function expressions symbolically; quadrature only when requested explicitly. A single integral exceeding integral_timeout seconds raises TimeoutError.

API#

class zoomy_core.model.derivation.symbolic_integrator.SymbolicIntegrator(basis, strategy='auto', n_workers=1, integral_timeout=_DEFAULT_INTEGRAL_TIMEOUT)#

Integrates basis-function expressions symbolically; quadrature only when requested explicitly. A single integral exceeding integral_timeout seconds raises TimeoutError.

Initialization

Select the integration strategy for basis.

Args

  • basis: Basisfunction providing bounds(), weight(z) and eval(k, z).

  • strategy: 'auto' (knot spans, orthogonal or sympy by basis capability), 'sympy', 'knot_spans' or 'quadrature'.

  • n_workers: Parallel workers for matrix computation (1 = serial).

  • integral_timeout: Seconds allowed per integral; None disables the timeout.

property strategy#

The resolved strategy name.

integrate(expr, var, domain=None)#

Integrate expr over var in domain (default: the basis bounds), exactly unless the strategy is 'quadrature'.

Returns

Symbolic value of the integral.

mass_matrix(level)#

M[k,i] = int(phi_k phi_i w) over the domain (symmetric).

triple_product(level)#

A[k,i,j] = int(phi_k phi_i phi_j w) over the domain, fully symmetric in (k,i,j).

derivative_product(level)#

D[k,i] = int(phi_k' phi_i' w) over the domain (symmetric).

boundary_values(level)#

phib[k] = phi_k at the lower bound.

compute_all_matrices(level)#

All standard basis matrices (phib, M, A, B, D, Dxi, Dxi2, DD, D1, DT) for level, exploiting their symmetries.

Returns

Dict of the matrices plus _elapsed and _strategy.

project(expr, test_index, weight=None)#

Galerkin projection of expr onto phi_test_index: int(expr phi_k w) / M[k,k].