zoomy_core.model.models.sme module#
SME — Shallow Moment Equations (Kowalski–Torrilhon 2019).
Inherits SigmaReference (which gives the σ-mapped INS
reference + KBCs), and extends derive_model with the full SME
post-σ pipeline: modal ansatz, Galerkin projection, σ-integration,
KBC modal closure, CoV u → q/h, opaque-basis resolution,
integral evaluation, gravity self-pair fold, higher-mode w closure,
mass-matrix inversion.
After derive_model finishes, the equations are in Symbol form
(self.variables.h, self.variables.q_0, …) and self._variable_map
maps equation names to row indices in the operator-API matrices.
SystemModel.from_model(sme) then extracts flux / source /
nonconservative_matrix via the basemodel default tag-extraction.
Output equation set matches K&T (4.17).
- class zoomy_core.model.models.sme.SME(N=2, *, basis_factory=None, **kwargs)#
Bases:
SigmaReferenceShallow Moment Equations at level
N.Default
N = 2matches K&T (4.17): 4 dynamic equations (continuity_0forh,momentum_x_0..2forq_0..q_2).- Parameters:
N (int) – Per-layer moment level — number of u-modes is
N + 1.basis_factory (callable, optional) –
basis_factory(level) → Basisfunction. Used to construct the u-basis (levelN) and the w-basis (levelN + 1). Default:Legendre_shifted(level=level). Subclasses such asMLSMEswap this for a multi-layer basis (LayeredBasis) without touching the pipeline.
- derive_model()#
Build reference equations (via SigmaReference) and run the SME post-σ pipeline. Equations are left in Function form (
h(t, x),q_fn(k, t, x)) so optional closures can manipulate them; the Function → Symbol substitution happens in_prepare_for_systemmodel(called automatically bySystemModel.from_model).
- project_2d_to_3d()#
Reconstruct the 3D fields
(b, h, u, v, w, p)at positionself.position[2] = zfrom the SME modal solution.Returns a sympy
Matrix([b, h, u_3d, v_3d, w_3d, p_3d]).u_3d(t, x, z) = Σ_k (q_k / h) · φ_k(σ)withσ = (z − b) / h.v_3d = 0(SME is 1D-x; multi-D needs the correspondingq_y_kmodes — TODO).w_3dreconstructed from depth-integrated continuity∂_z w = −∂_x u_3d, withw(z = b) = ∂_t b + u(b)·∂_x b.p_3d = ρ · g · (η − z)(hydrostatic — SME’s defining assumption).
- apply_slip_newton_friction()#
Close the open
τ_xzBC + Integral atoms with the slip-Newton constitutive law.- Substitutions per K&T 2019 §4.3:
Newtonian bulk:
τ_xz(σ) = (ν/h) · ∂_σ u(σ);Free-surface BC:
τ_xz(σ=1) = 0;Navier-slip bottom BC:
τ_xz(σ=0) = (ν/λ) · u(σ=0).
Reads
ν,λfrom the Model’s parameters Zstruct — the caller must declare them at construction:- sme = SME(N=2, parameters={
“g”: 9.81, “rho”: 1.0, “nu”: 1e-3, “lambda”: 1e-2,
}, …) sme.apply_slip_newton_friction()
After this call, the equations carry algebraic friction terms in
ν, λ, ρinstead of unresolvedIntegral(τ_xz, …)atoms. Tags are re-computed;SystemModel.from_modelpicks up the closed source.
- history: list#