zoomy_core.model.models.projected_model module

zoomy_core.model.models.projected_model module#

Two-Pass PDE Model Derivation: Pass 2.

Takes PreProjectedEquations (basis-independent) + a basis + level, projects onto the basis, applies M^-1, and produces a Model-compatible class.

Usage:

from zoomy_core.model.models.model_derivation import derive_shallow_moments from zoomy_core.model.models.projected_model import ProjectedModel

state = StateSpace(dimension=2) pre = derive_shallow_moments(state) model = ProjectedModel(pre, basis_type=Legendre_shifted, level=2) # model has flux(), source(), eigenvalues(), etc.

zoomy_core.model.models.projected_model.get_cached_matrices(basis, level, integrator)#
zoomy_core.model.models.projected_model.clear_matrix_cache()#
class zoomy_core.model.models.projected_model.ProjectedModel(pre_projected=None, basis_type=<class 'zoomy_core.model.models.basisfunctions.Legendre_shifted'>, level=0, n_layers=1, eigenvalue_mode='symbolic', dimension=2, material='newtonian', slip_length=None, **kwargs)#

Bases: Model

Model produced by projecting PreProjectedEquations onto a specific basis.

Construction modes:

  1. From pre-computed equations (notebook / advanced):

    ProjectedModel(pre_projected, level=2)

  2. From simple config (GUI / server / CLI):

    ProjectedModel(dimension=2, level=2, n_layers=1)

    Auto-runs Phase 1 (derive_shallow_moments).

The projection uses the SymbolicIntegrator to compute basis matrices (M, A, D, phib) and assembles the Model functions (flux, source, NC matrix) from the tagged terms.

M^{-1} is applied once to all non-temporal terms. The user can inspect both raw (with M) and resolved (with M^{-1}) forms.

level = 0#
n_layers = 1#
basis_type#

alias of Legendre_shifted

material = 'newtonian'#
get_primitives()#

Extract primitive variables from the state vector.

flux()#

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

Built from the tagged ‘flux’ terms in PreProjectedEquations: - Mass flux: h * Σ c_k α_k (from continuity) - Momentum advection: Σ α_i α_j A[k,i,j] (from u² term) - Hydrostatic pressure: g*h²/2 * c_mean (from pressure term)

hydrostatic_pressure()#

Hydrostatic pressure with M^{-1} applied. Separated from advective flux for well-balanced numerical schemes. Raw: P_l = g*ez*h²/2 * c_mean[l]

nonconservative_matrix()#

Non-conservative matrix B_x with M^{-1} applied.

Built from tagged ‘nonconservative’ terms: - Topography: g*h * db/dx - Vertical advection coupling (B matrix terms)

source()#

Source = 0 by default. Override to add gravity, friction, viscosity.

newtonian()#

Newtonian viscous source with M^{-1} applied.

From tagged ‘newtonian_viscosity’ term: Raw: S_l = -nu/h * Σ_i α_i * D[i,l] Resolved: S_k = Σ_l Minv[k,l] * S_l

slip()#

Navier-slip friction with M^{-1} applied.

From tagged ‘navier_slip’ term: Raw: S_l = -(1/(λρ)) * u_b * φ_l(0) where u_b = Σ_i α_i * φ_i(0) Resolved: S_k = Σ_l Minv[k,l] * S_l

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()#

Return the raw mass matrix M.

mass_matrix_inverse()#

Return M^{-1}.

mean_coefficients()#

Return c_k such that Σ c_k φ_k = 1.

print_equations()#