zoomy_core.model.equation module#
Equation primitives — Term, _TermGroup, Equation.
Direct port of the framework developed in the transparent-derivation
notebooks (thesis/notebooks/legacy/modeling/transparent_derivations/
sme_clean.py etc.). Same classes, same auto-history mechanics, same
simplify pipeline (sp.expand → pull var-independent factors out of
Derivative atoms → recover fluxes by pulling var-independent coeffs back
inside Derivative arguments).
Lives in its own module so the Model class (in basemodel.py) and the derivation subclasses (sigmaref.py, sme.py, vam.py) can import Equation without dragging in the full operations / state surface.
- class zoomy_core.model.equation.Term(expr, tag=None, parent=None)#
Bases:
objectOne additive term of an
Equation.- expr#
- tag#
- apply(*args, **kwargs)#
- class zoomy_core.model.equation.Equation(expression, name='eq', model=None)#
Bases:
objectLinear list of
Termcarrying the LHS of one PDE/algebraic equation.applydelegates toExpression.apply(the library operation-dispatch layer) and auto-records a history entry on the parentModelif one is set.- property solver_tags#
Dict of solver tags (canonical names) → sub-expression, or empty dict if none set.
- get_solver_tag(name)#
Return the sp.Expr for a solver tag, or None if not set.
nameis normalised throughcanonical_solver_tag.
- untagged_remainder()#
Return
self.expr - sum(solver_tags.values()), simplified. Zero ⇒ every term has been routed to a solver tag; non-zero drivescollect_solver_tag’suntagged_policy.
- static to_terms(expression)#
- static to_expression(terms)#
- property expr#
- property terms#
- apply(*args, **kwargs)#
- simplify()#
Canonical form (three sub-steps):
sp.expand— flatten Mul/Add nesting and combine like terms.Pull var-independent factors out of every Derivative argument:
Derivative(g·h, x) → g·Derivative(h, x),Derivative(0, x) → 0.Recover fluxes — for each term
c · Derivative(_, x)wherecis var-independent, pullcback inside so the tagger sees the conservative atom.