zoomy_core.model.models.vam_projected_model module#
VAM Derivation: Phase 3 – Concrete model assembly.
Produces two Model objects from the VAM projection:
VAMProjectedHyperbolic: advective flux + gravity (explicit), pressure source (implicit via aux variables from Poisson solve).
VAMProjectedPoisson: constraint equations I1, I2 for pressure, derived from the splitting approach (predictor U* → pressure correction).
Each velocity component (u, w) and pressure (p) can use a different basis and level. By default all share the same Legendre basis.
At L1 with Legendre, these reproduce the hardcoded VAMHyperbolic/VAMPoissonFull.
- Usage:
state = StateSpace(dimension=2) vam = derive_vam_moments(state) hyp = VAMProjectedHyperbolic(vam, level=1) poi = VAMProjectedPoisson(hyp)
- class zoomy_core.model.models.vam_projected_model.VAMProjectedHyperbolic(projected, basis_type=<class 'zoomy_core.model.models.basisfunctions.Legendre_shifted'>, w_basis_type=None, p_basis_type=None, level=1, eigenvalue_mode='symbolic', **kwargs)#
Bases:
ModelHyperbolic part of the VAM.
State vector Q = [h, hu0..huL, hw0..hwL, b] Auxiliary: hw_{L+1} (closure), hp0..hpL, dbdx, dhdx, dhp_k_dx
u, w, p can each use a different basis (default: all Legendre). w automatically gets one extra closure mode from continuity.
- level = 1#
- basis_type#
alias of
Legendre_shifted
- get_primitives()#
- flux()#
F[0] = h * sum c_k alpha_k (mass) F[1..n_u] = M_u^{-1} h A_u alpha alpha (u-advection) F[n_u+1..end] = M_w^{-1} h A_uw alpha gamma (cross u*w, incl. closure)
- nonconservative_matrix()#
B(Q) dQ/dx coupling: - u-momentum: gravity (g*h on dh/dx and db/dx) + vertical advection NC - w-momentum: vertical advection NC from d(uw)/dz IBP
- source_implicit()#
Pressure source from aux variables hp0..hpL.
- x-momentum: projection of (1/rho) dp/dx
mode l: d(h*pi_k*M_lk)/dx + boundary terms from p*db/dx After Leibniz + simplification:
raw_l = sum_k dhp_k_dx * M[l,k] / h + pressure * boundary terms
- z-momentum: projection of (1/rho) dp/dz via IBP
int phi_l dp/dz dz = [p phi_l]_b^eta - int p dphi_l/dz dz volume: -sum_k pi_k * D1[l,k] (D1[l,k] = int phi_l dphi_k/dz) boundary at zeta=1: p(eta)*phi_l(1) = 0 (gauge) boundary at zeta=0: -p(b)*phi_l(0)
- eigenvalues()#
Eigenvalues of the normal-projected quasilinear matrix.
In ‘symbolic’ mode: solves the characteristic polynomial in SymPy. In ‘numerical’ mode: returns an empty ZArray (eigenvalues computed at runtime by the Numerics class via np.linalg.eigvals).
- mass_matrix()#
- mass_matrix_inverse()#
- class zoomy_core.model.models.vam_projected_model.VAMProjectedPoisson(hyp_model)#
Bases:
objectPressure Poisson model for VAM.
Derives the constraint equations I1, I2 from: 1. Depth-integrated continuity (I1) 2. Depth-integrated vorticity constraint (I2)
After the splitting: U* = predictor (hyperbolic step), U^{n+1} = U* - dt * tau(hp), substitute into constraints and solve for hp0, hp1.
This is NOT a Model subclass — it provides the symbolic constraint equations that the solver uses for the implicit step.
- Parameters:
hyp_model (VAMProjectedHyperbolic) –
- get_constraints()#
Return (I1, I2) as sympy expressions.
- get_residual_equations()#
Return the Poisson residual: R[0] = I1+I2, R[1] = I1-I2.
These are the equations that must be solved for hp0, hp1.
- make_derivative_symbols(expr)#
Replace Derivative objects with Symbol objects for code generation.
- E.g. Derivative(hp0(x), x) → dhp0dx
Derivative(hp0(x), (x, 2)) → ddhp0dxx
- print_equations()#
Print the Poisson constraints in readable form.