zoomy_core.model.legacy.numerical_model module#
NumericalModel: wraps any analytical Model for numerical simulation.
- Two-level regularization:
eps (small, ~1e-8) : regularizes 1/h → 1/(h+eps) in flux/source/quasilinear eps_wet (larger, ~1e-3) : wet/dry threshold for eigenvalue skip and momentum deletion
Momentum ramp: update_variables zeros out momentum-like variables when h < eps_wet, preventing unphysical velocities at near-dry cells from driving the solution.
- Usage:
analytical = GeneratedShallowModel(…) numerical = NumericalModel(analytical)
- zoomy_core.model.legacy.numerical_model.regularize_denominators(expr, h_sym, eps_sym)#
Replace h^(-n) with (h + eps)^(-n) for n > 0.
- zoomy_core.model.legacy.numerical_model.regularize_sqrt_arguments(expr, h_sym, eps_sym)#
Replace h inside fractional powers with (h + eps) to prevent sqrt(negative).
- class zoomy_core.model.legacy.numerical_model.NumericalModel(analytical_model, eigenvalue_proxy_level=None, **kwargs)#
Bases:
ModelWraps an analytical Model for numerical simulation.
Regularization: - 1/h → 1/(h + eps) in all compiled expressions - Momentum zeroed when h < eps_wet (via conditional in update_variables) - Eigenvalues use conditional(h > eps_wet, ev, 0) for symbolic path
- flux()#
Flux.
- hydrostatic_pressure()#
Hydrostatic pressure.
- nonconservative_matrix()#
Nonconservative matrix.
- source()#
Source.
- quasilinear_matrix()#
Quasilinear matrix.
- eigenvalues()#
Eigenvalues for the model. Used by the backend’s max_wavespeed implementation. No dry-cell guard here — that belongs in the backend function, not in the symbolic expressions.
- update_variables()#
Wet/dry treatment applied every timestep via opaque numerical functions: 1. clamp_positive(h) — prevents negative water depth 2. clamp_momentum(hu, h, u_max) — caps velocity at sqrt(g*h) + eps_wet 3. Linear ramp via conditional — zeros momentum below eps_wet
- get_field_map()#
- property wet_dry_threshold#
- property eigenvalue_regularization_eps#