zoomy_core.model.derivation.system_extract

zoomy_core.model.derivation.system_extract#

Classifies the additive terms of a derivation Model’s residuals into SystemModel slots (mass matrix, flux, hydrostatic pressure, nonconservative matrix, source, diffusion matrix). It is the bridge from the derivation Model to SystemModel.from_model.

Module Contents#

Classes#

ViscousDiffusion

Opaque provenance marker wrapping a viscous diffusive flux d_x(ViscousDiffusion(D d_x Q_j)). It routes the whole rank-4 compound, including foreign-state cross pieces, into diffusion_matrix rather than flux.

HydrostaticPressure

Opaque marker wrapping a pressure-flux argument; d_x(HydrostaticPressure(P)) routes to hydrostatic_pressure while any other conservative d_x(F) routes to flux. The model applies it explicitly, never inferred from gravity.

Functions#

head_assumptions

Assumptions declared on a field’s Function head (real plus its strongest sign predicate), so that e.g. h > 0 survives into the SystemModel. Only declared fields inherit; derived aux symbols do not.

extract_system_operators

Extract the operator matrices (mass, flux, hydrostatic pressure, nonconservative, source, diffusion) from a Model’s residuals, one evolution row per state field. Raises ValueError for fields outside Q and Qaux, unresolved integrals, unroutable terms, and (unless dae) a mass matrix that is not the identity.

API#

class zoomy_core.model.derivation.system_extract.ViscousDiffusion#

Bases: sympy.Function

Opaque provenance marker wrapping a viscous diffusive flux d_x(ViscousDiffusion(D d_x Q_j)). It routes the whole rank-4 compound, including foreign-state cross pieces, into diffusion_matrix rather than flux.

nargs#

1

classmethod eval(arg)#

Leave the marker unevaluated; a zero argument collapses to zero.

class zoomy_core.model.derivation.system_extract.HydrostaticPressure#

Bases: sympy.Function

Opaque marker wrapping a pressure-flux argument; d_x(HydrostaticPressure(P)) routes to hydrostatic_pressure while any other conservative d_x(F) routes to flux. The model applies it explicitly, never inferred from gravity.

nargs#

1

classmethod eval(arg)#

Leave the marker unevaluated.

zoomy_core.model.derivation.system_extract.head_assumptions(field) → dict#

Assumptions declared on a field’s Function head (real plus its strongest sign predicate), so that e.g. h > 0 survives into the SystemModel. Only declared fields inherit; derived aux symbols do not.

zoomy_core.model.derivation.system_extract.extract_system_operators(model, Q, Qaux=None, dae=False)#

Extract the operator matrices (mass, flux, hydrostatic pressure, nonconservative, source, diffusion) from a Model’s residuals, one evolution row per state field. Raises ValueError for fields outside Q and Qaux, unresolved integrals, unroutable terms, and (unless dae) a mass matrix that is not the identity.

Args

  • model: Model after the full closure pipeline.

  • Q: Applied state fields, one per evolution row.

  • Qaux: Applied auxiliary fields; None takes every field not in Q.

  • dae: Keep a non-diagonal or singular mass matrix (index-1 DAE) instead of raising.

Returns

Dict of SystemModel keyword arguments (time, space, state, aux_state, parameters, flux, hydrostatic_pressure, nonconservative_matrix, source, mass_matrix, diffusion_matrix, ...) plus the unclassified remainders.