zoomy_core.model.models.vam_model module

zoomy_core.model.models.vam_model module#

VAM – Viscous Alignment Model (non-hydrostatic shallow moments).

Derivation chain (class hierarchy):

INSModel(DerivedModel)
  -> derives FullINS (continuity, x_momentum, z_momentum)

VAMModel(INSModel)
  -> keeps z_momentum (non-hydrostatic, unlike SME which drops it)
  -> applies material model (Inviscid by default)
  -> depth-integrates all three equations
  -> applies kinematic BCs + atmospheric pressure gauge
The VAM extends SME with:
  • w-moments (vertical velocity basis expansion)

  • Pressure treated as unknown (not substituted hydrostatically)

  • Cross-momentum flux (u*w coupling)

  • Poisson pressure constraint for implicit step

State vector layout:

Q = [b, h, hu0..huL, hw0..hwL]
     0   1   2..(2+n_u-1)  (2+n_u)..(2+n_u+n_w-1)

where n_u = n_w = level + 1

Auxiliary variables (for pressure splitting):

Qaux = [hw_closure, hp0..hpL, dbdx, dhdx, dhp0dx..dhpLdx]

Usage:

model = VAMModel(level=1)
model.describe()

# Compile for evaluation
from zoomy_core.transformation.to_numpy import NumpyRuntimeModel
rt = NumpyRuntimeModel(model)

# Generate C code
from zoomy_core.transformation.to_c import CppModel
CppModel(model).create_code()
class zoomy_core.model.models.vam_model.VAMModel(level=0, n_layers=1, basis_type=<class 'zoomy_core.model.models.basisfunctions.Legendre_shifted'>, eigenvalue_mode='symbolic', dimension=None, **kwargs)#

Bases: INSModel

Non-hydrostatic shallow moment model with vertical velocity moments.

Derivation: INS -> material model -> depth integrate -> kinematic BCs. Unlike SMEModel, z-momentum is kept and pressure is NOT substituted.

The state vector includes both horizontal velocity moments (alpha_k) and vertical velocity moments (gamma_k), giving the cross-momentum coupling that characterises the VAM.

projectable = True#
derive_model()#

Override to build/refine the equation system.

Root classes: call self._init_system(...) to create equations. Child classes: call super().derive_model() then self.apply(...) to transform.

get_primitives()#

Extract primitive variables from the state vector.

Returns (b, h, alpha, gamma, hinv) where:

alpha[k] = hu_k / h (horizontal velocity moments) gamma[k] = hw_k / h (vertical velocity moments)

flux()#

Flux F(Q) with M^{-1} applied.

Layout:

F[0, :] = 0 (b: bathymetry, no flux) F[1, 0] = h * u_mean (mass flux in x) F[2..n_u+1, 0] = h A alpha alpha (u-momentum advection) F[w_start.., 0] = h A alpha gamma (cross u*w advection)

For 2D (hdim=2), additional y-fluxes and v-momentum are included.

hydrostatic_pressure()#

Hydrostatic pressure contribution (same as SME).

In VAM the full pressure is solved via Poisson, but the hydrostatic part still enters the advective flux splitting.

nonconservative_matrix()#

Non-conservative matrix B(Q) dQ/dx.

Includes:
  • Topography: g*h on db/dx (u-momentum)

  • Vertical advection NC coupling (B matrix, u-momentum)

  • Mean velocity NC (u-momentum)

  • Vertical advection NC (w-momentum, from d(uw)/dz IBP)

source()#

Source terms.

w-momentum gets gravity: g * phi_int[l] (projected) u-momentum: no source in inviscid case (viscosity added by subclass)

source_implicit()#

Pressure source from auxiliary variables hp0..hpL.

x-momentum: d(h*pi_k)/dx terms (Leibniz of depth-integrated pressure) z-momentum: IBP of dp/dz against test function (volume + boundary)

These enter the implicit pressure-correction step.

eigenvalues()#

Approximate eigenvalues for the VAM system.

Uses analytical eigenvalues when possible (L0, L1), falls back to numerical mode for higher levels.

mass_matrix()#

Return the basis mass matrix M.

mass_matrix_inverse()#

Return M^{-1}.

print_equations()#
class zoomy_core.model.models.vam_model.VAMNewtonian(level=0, n_layers=1, basis_type=<class 'zoomy_core.model.models.basisfunctions.Legendre_shifted'>, eigenvalue_mode='symbolic', dimension=None, **kwargs)#

Bases: VAMModel

VAM with Newtonian viscosity (adds viscous + slip source terms).

Same non-hydrostatic derivation as VAMModel, but applies Newtonian constitutive model instead of Inviscid. The source term includes viscous diffusion (D matrix) and Navier-slip friction (phib).

derive_model()#

Override to build/refine the equation system.

Root classes: call self._init_system(...) to create equations. Child classes: call super().derive_model() then self.apply(...) to transform.

source()#

Source = gravity + Newtonian viscosity + Navier slip.