zoomy_core.model.state module

zoomy_core.model.state module#

StateSpace + MassMomentum — physical-coordinate flow scaffolding.

Per the new design:

  • StateSpace declares only coordinatest, x, y (if dim >= 2), z. Parameters (g, rho, nu, lambda) live on the Model, not here. σ-frame coordinates (zeta, zeta_ref) are registered later by SigmaTransform when it is applied; the pristine StateSpace knows nothing about σ-frame.

  • MassMomentum owns ALL physics state (flow fields u, v, w, p; stress tensor tau; free-surface geometry h, b, eta) and builds the continuity / momentum.x / momentum.z balance equations. Its constructor takes the Model’s parameters Zstruct so the gravity / density Symbols are the same Symbol identity as on the Model — no translation maps needed downstream.

Minimal reimplementation: matches the canonical notebook usage (thesis/notebooks/legacy/modeling/transparent_derivations/{sme,vam, ml_sme,ml_vam}_clean.py), no legacy import.

class zoomy_core.model.state.StateSpace(dimension=2)#

Bases: object

Coordinate scaffold — t, x, [y,] z.

Carries only the spatial / temporal coordinate Symbols. No flow fields, no parameters, no σ-frame. σ-frame coordinates (zeta, zeta_ref) get attached by SigmaTransform when applied.

property has_y#
property coords_h#
property args_h#
property args_3d#
class zoomy_core.model.state.MassMomentum(state, parameters)#

Bases: object

The free-surface incompressible mass + momentum balance.

Owns the physics state of the system — flow fields, depth / bathymetry / free-surface, stress tensor — and builds the continuity / momentum.x / momentum.z balance equations using the Model’s parameters (gravity g, density rho).

Parameters:
  • state (StateSpace) – Coordinate scaffold. Read-only on this end.

  • parameters (Zstruct) – The Model’s parameter Symbols Zstruct. Must contain at least g (gravity) and rho (density). These Symbols flow directly into the balance equations — no copies, no remap.

  • attributes (Exposed) –

  • ------------------

  • self.state

  • self.parameters

  • self.u

  • self.v

  • self.w

  • (t (self.p (Function calls on) –

  • x

  • [y

  • ]z))

  • components) (self.tau (Zstruct of stress-tensor) –

  • self.h

  • self.b

  • (depth (self.eta) –

  • bathymetry

  • surface) (free) –

:param self.continuity (Expression): :param self.momentum (Zstruct with .x [: :param .y]: :param .z Expressions):

register_on(model)#

Register continuity, momentum.x (and .y if 3D), momentum.z, and the trivial ∂_t b = 0 bottom equation on model — and expose model.momentum as a vector-of- equations proxy so the legacy model.momentum.x / model.momentum.z access pattern (from the old System API in models/legacy/derived_system.py) keeps working.

After register_on(model):

  • model.continuityEquation for the continuity balance.

  • model.momentum.x / model.momentum.z (and .y in 3D) — Equation per axis.

  • model.momentum.remove("z") — drop a single axis (calls through to Model.remove_equation()).

  • model.bottom — trivial ∂_t b = 0 leaf.

Returns self so the construction chains:

m.src = MassMomentum(state, params, h_positive=True).register_on(m)