zoomy_core.model.derivation.projection

zoomy_core.model.derivation.projection#

Galerkin-projection operations on the modal ansatz: sum expansion, test-function projection, bracket extraction and basis resolution. They carry a Model derivation from the unexpanded ansatz to basis-resolved moment equations.

Module Contents#

Classes#

ExpandSums

Merge products and integer powers of unexpanded Sum factors into one multi-index Sum with distinct dummies. Apply after the ansatz substitution and before Project.

EvaluateSums

Unroll every finite Sum (concrete integer bound) to explicit modes, leaving Integral and Derivative deferred. Narrower than a bare doit().

Integrate

Purely abstract definite integral: wrap each additive term in an unevaluated Integral(term, (var, lo, hi)). Evaluation is left to ResolveIntegral or ExtractBrackets; a running integral (var in the bounds) gets a fresh dummy variable.

Project

Galerkin projection: multiply by the test function, then integrate over (zeta, 0, 1) through the unexpanded Sum. The opaque basis brackets stay unevaluated.

PullConstants

Pull operator-independent factors out of every Integral and Derivative (see pull_out). Run before ExtractBrackets so that only purely zeta-dependent bodies remain under a bracket.

ExtractBrackets

Name Galerkin brackets: a zeta-independent factor comes out as a constant, int phi_i c phi_l becomes Gram(i, l), int c phi_l becomes Weight(l), any other pure-zeta body stays an explicit Integral. A non-zeta d_x wrapping the product commutes out (conservative flux).

ResolveBasis

Resolve every Galerkin bracket to a number against a concrete basis via Basisfunction.resolve. Apply after ResolveModes has made every bracket index an integer.

Functions#

bracket_atoms

All named-bracket (Gram/Weight) atoms present in expr.

pull_out

Pull every factor independent of a binding operator’s variable out of that derivative or integral, to a fixpoint. Gentle: never applies the product rule to a variable-dependent product.

Data#

API#

zoomy_core.model.derivation.projection.Gram#

‘_mk_bracket(…)’

zoomy_core.model.derivation.projection.Weight#

‘_mk_bracket(…)’

zoomy_core.model.derivation.projection.bracket_atoms(expr)#

All named-bracket (Gram/Weight) atoms present in expr.

class zoomy_core.model.derivation.projection.ExpandSums(name='expand_sums')#

Bases: zoomy_core.model.operations.Operation

Merge products and integer powers of unexpanded Sum factors into one multi-index Sum with distinct dummies. Apply after the ansatz substitution and before Project.

Initialization

Create the operation.

whole_leaf_op#

True

class zoomy_core.model.derivation.projection.EvaluateSums(name='evaluate_sums')#

Bases: zoomy_core.model.operations.Operation

Unroll every finite Sum (concrete integer bound) to explicit modes, leaving Integral and Derivative deferred. Narrower than a bare doit().

Initialization

Create the operation.

whole_leaf_op#

True

class zoomy_core.model.derivation.projection.Integrate(var=None, bounds=(0, 1), dummy=None, name='integrate')#

Bases: zoomy_core.model.operations.Operation

Purely abstract definite integral: wrap each additive term in an unevaluated Integral(term, (var, lo, hi)). Evaluation is left to ResolveIntegral or ExtractBrackets; a running integral (var in the bounds) gets a fresh dummy variable.

Initialization

Create the operation.

Args

  • var: Integration variable (default zeta).

  • bounds: Integration interval.

  • dummy: Symbol to bind the integrand to (default: a fresh dummy only when var is in the bounds).

whole_leaf_op#

True

class zoomy_core.model.derivation.projection.Project(test_function, var=None, bounds=(0, 1), name='project')#

Bases: zoomy_core.model.operations.Operation

Galerkin projection: multiply by the test function, then integrate over (zeta, 0, 1) through the unexpanded Sum. The opaque basis brackets stay unevaluated.

Args

  • test_function: Full test weight, e.g. c(zeta) * phi(l, zeta).

  • var: Integration variable (default zeta).

  • bounds: Integration interval.

References

  • Kowalski, Torrilhon 2019, https://doi.org/10.4208/cicp.OA-2017-0263

Initialization

Create the operation.

whole_leaf_op#

True

zoomy_core.model.derivation.projection.pull_out(expr)#

Pull every factor independent of a binding operator’s variable out of that derivative or integral, to a fixpoint. Gentle: never applies the product rule to a variable-dependent product.

class zoomy_core.model.derivation.projection.PullConstants(name='pull_constants')#

Bases: zoomy_core.model.operations.Operation

Pull operator-independent factors out of every Integral and Derivative (see pull_out). Run before ExtractBrackets so that only purely zeta-dependent bodies remain under a bracket.

Initialization

Create the operation.

whole_leaf_op#

True

class zoomy_core.model.derivation.projection.ExtractBrackets(basis, var=None, weight_name=None, name='extract_brackets')#

Bases: zoomy_core.model.operations.Operation

Name Galerkin brackets: a zeta-independent factor comes out as a constant, int phi_i c phi_l becomes Gram(i, l), int c phi_l becomes Weight(l), any other pure-zeta body stays an explicit Integral. A non-zeta d_x wrapping the product commutes out (conservative flux).

Args

  • basis: Opaque basis whose phi head is recognised.

  • var: Integration variable (default zeta).

  • weight_name: Name of the weight Function c (default read off the basis).

Initialization

Create the operation.

whole_leaf_op#

True

class zoomy_core.model.derivation.projection.ResolveBasis(basis, var=None, name='resolve_basis')#

Bases: zoomy_core.model.operations.Operation

Resolve every Galerkin bracket to a number against a concrete basis via Basisfunction.resolve. Apply after ResolveModes has made every bracket index an integer.

Initialization

Create the operation.

whole_leaf_op#

True