zoomy_core.model.kernel_functions#
Opaque SymPy functions (eigensystem, solve, pick, conditional, …) that every backend realises numerically. Each kernel must be registered in the backend’s function table (NumPy, JAX, C).
Module Contents#
Classes#
Opaque full eigendecomposition |
|
Opaque upper bound on |
|
Opaque eigenvalue-only spectrum of the row-major |
|
Opaque per-cell linear solve |
|
Component |
|
Opaque non-local spatial derivative |
|
Vector-aware differentiable |
Functions#
Rewrite |
Data#
API#
- class zoomy_core.model.kernel_functions.eigensystem#
Bases:
sympy.FunctionOpaque full eigendecomposition
[lambda, R, L=R^-1]of the row-majorn*nmatrixA_flat, packed in one vector. Components are read throughpick(eigensystem(*a), idx); used by the Roe scheme.Args
A_flat: then*nmatrix entries, row-major.
- is_commutative#
True
- is_real#
True
- classmethod eval(*args)#
Keep the call unevaluated.
- class zoomy_core.model.kernel_functions.gelfand_bound#
Bases:
sympy.FunctionOpaque upper bound on
rho(A), the symbolic solvers’ wave speed:||A^m||^(1/m),m = 2^j, sharpened by a Collatz-Wielandt step on|A^m|;+inffor a non-finite entry. Called asgelfand_bound(j, delta, *A_flat),A_flatrow-major,deltathe offset of the Collatz-Wielandt vector (SystemModel.spectral_cw_offset).References
Horn, Johnson 2012 (sections 5.6, 8.1), https://doi.org/10.1017/CBO9781139020411
- is_commutative#
True
- is_real#
True
- classmethod eval(*args)#
Keep the call unevaluated.
- class zoomy_core.model.kernel_functions.eigenvalues#
Bases:
sympy.FunctionOpaque eigenvalue-only spectrum of the row-major
n*nmatrixA_flat, read throughpick(eigenvalues(*a), idx). Cheaper companion ofeigensystemfor wave-speed bounds when no closed-form spectrum exists.- is_commutative#
True
- is_real#
True
- classmethod eval(*args)#
Keep the call unevaluated.
- class zoomy_core.model.kernel_functions.solve#
Bases:
sympy.FunctionOpaque per-cell linear solve
A^-1 b, called assolve(*A_flat, *b_flat)and read throughpick(solve(*a), idx). Used by the point-implicit source treatment of the NumericalSystemModel.- is_commutative#
True
- is_real#
True
- classmethod eval(*args)#
Keep the call unevaluated.
- class zoomy_core.model.kernel_functions.pick#
Bases:
sympy.FunctionComponent
idxof a packed opaque-kernel result (eigensystem,eigenvalues,solve). Per-component backends restoreK(idx, *a)throughlower_pick_to_component.- is_commutative#
True
- is_real#
True
- classmethod eval(*args)#
Keep the call unevaluated.
- zoomy_core.model.kernel_functions.lower_pick_to_component(expr)#
Rewrite
pick(K(*a), idx)into the per-component formK(idx, *a)required by the C/C++ and UFL printers.Returns
The expression (or array/matrix) with every
pickof a per-component kernel swapped structurally.
- class zoomy_core.model.kernel_functions.compute_derivative#
Bases:
sympy.FunctionOpaque non-local spatial derivative
compute_derivative(field, *multi_index);(h, 1, 0)is d h / d x. The solver injects the backend’s LSQ-gradient implementation; it is emitted byexpose_auxintoupdate_aux_variables.- is_commutative#
True
- is_real#
True
- classmethod eval(*args)#
Keep the call unevaluated.
- class zoomy_core.model.kernel_functions.conditional#
Bases:
sympy.FunctionVector-aware differentiable
conditional(c, t, f): a symbolic node for scalars, aZArrayof nodes for vector branches. Differentiation follows the active branch and ignores the jump at the condition.- nargs#
3
- is_commutative#
True
- classmethod eval(condition, true_val, false_val)#
The branch itself once the condition is a boolean constant (e.g. after
subs).
- zoomy_core.model.kernel_functions.REQUIRED_KERNELS#
‘frozenset(…)’