zoomy_core.model.models.swe

zoomy_core.model.models.swe#

Shallow water equations with bed (SWE), 1D or 2D, as a Model with state [b, h, hu(, hv)]. Level-0 member of the moment hierarchy; lifted to a SystemModel via SystemModel.from_model.

Module Contents#

Classes#

SWE

Shallow water + bed + optional Manning friction, written directly as depth-averaged operators. Declares the function groups interpolate / project / reconstruction and the boundaries wall (free slip) and inflow.

API#

class zoomy_core.model.models.swe.SWE(**kw)#

Bases: zoomy_core.model.derivative_workflow.StructuredDerivativeModel

Shallow water + bed + optional Manning friction, written directly as depth-averaged operators. Declares the function groups interpolate / project / reconstruction and the boundaries wall (free slip) and inflow.

Initialization

Build the model; dimension=2 adds hv, and parameters overrides defaults one by one.

dimension#

‘Integer(…)’

variables#

[‘b’, (‘h’, ‘nonnegative’), ‘hu’]

parameters#

None

reconstruction_variables()#

Well-balanced reconstruction map: replace h by the free surface b + h, other fields unchanged.

flux()#

Conservative flux of mass and momentum, hu^2/h + g h^2/2 on the diagonal.

nonconservative_matrix()#

Bed-slope product: the momentum rows pick up g h d_d b.

source()#

Manning friction on the momentum rows (zero for n_m = 0), with vel_eps regularizing |u| so the source Jacobian stays finite at rest.

update_variables()#

Cap each momentum component to h_wet * 4 sqrt(g h) (h_wet = max(h - wet_dry_eps, 0)) at the wet/dry front; h and b are never modified.

update_variables_jacobian_wrt_variables()#

Zero Jacobian of update_variables (only the IMEX Newton consumes it, and it does not apply the cap).

declare_system_roles(sm)#

Declare the free-surface roles (depth h, bed b, gravity g, momentum hu/hv) on the SystemModel sm.