zoomy_core.transformation.to_numpy module

zoomy_core.transformation.to_numpy module#

Module zoomy_core.transformation.to_numpy.

class zoomy_core.transformation.to_numpy.NumpyRuntimeModel(model, module=None, printer=None, kernel=None)#

Bases: object

Runtime model generated from a symbolic Model.

Instead of assuming hardcoded attributes (e.g. _flux), this class compiles all functions registered in model.functions and exposes them as callable runtime attributes.

Parameters:
  • model (Model) –

  • module (Optional[Dict[str, Callable]]) –

  • printer (Optional[str]) –

module = {'array': <built-in function array>, 'clamp_momentum': <function NumpyRuntimeModel.<lambda>>, 'clamp_positive': <function NumpyRuntimeModel.<lambda>>, 'conditional': <function NumpyRuntimeModel.<lambda>>, 'max_wavespeed': None, 'ones_like': <function ones_like>, 'squeeze': <function squeeze>, 'zeros_like': <function zeros_like>}#
printer = 'numpy'#
classmethod from_system_model(sm, *, module=None, printer=None)#

Build a runtime by lambdifying a SystemModel’s stored matrices.

Lightweight adapter that mirrors the operator-API surface of the runtime built from a Model: the resulting object has flux, nonconservative_matrix, source, hydrostatic_pressure, mass_matrix callable attributes, each accepting (Q, Qaux, p) and returning the corresponding numpy array.

For most solver code paths the existing NumpyRuntimeModel(model) flow is still preferred because it carries the model’s full function registry (boundary_conditions kernel etc.) — this factory is the right entry point when the analysis or transformation pipeline starts from a SystemModel that may not have a backing Model (e.g. SystemModel constructed from scratch).

class zoomy_core.transformation.to_numpy.NumpyRuntimeSymbolic(symbolic_obj, module=None, printer=None)#

Bases: NumpyRuntimeModel

Runtime wrapper for generic symbolic registrars (e.g. Numerics).

Compiles all entries from symbolic_obj.functions using the same lambdify/argument-flattening machinery as NumpyRuntimeModel.

Parameters:
  • module (Optional[Dict[str, Callable]]) –

  • printer (Optional[str]) –