Introduction
The shallow water equations with variable bottom topography are the canonical hyperbolic balance law of computational hydraulics. Unlike the homogeneous conservation laws for which most shock-capturing methods were designed, they admit non-trivial steady states in which the flux gradient and the geometric source cancel exactly while neither vanishes separately. The most important of these is the lake at rest, a horizontal free surface over motionless water. A discretisation that fails to reproduce this cancellation generates spurious waves whose amplitude scales with the truncation error of the bed treatment and which, over realistic bathymetries, can exceed the physical signal. Methods that reproduce it exactly are called well balanced, or said to satisfy the exact conservation property (C -property) [1 ] , and the requirement has shaped the numerical literature on this system since its early analyses [2 , 3 ] . In the finite-volume and discontinuous Galerkin setting, two mechanisms achieve this property. The first modifies the reconstruction so that the discrete flux and source balance by construction, as in the hydrostatic reconstruction [4 ] and in central-upwind schemes [5 , 6 ] . The second changes variables so that the equilibrium becomes trivial: the surface-gradient method [7 ] and the pre-balanced formulation [8 ] reconstruct the free-surface elevation rather than the depth, after which the lake at rest is a constant state. High-order extensions of both routes exist [9 , 10 ] , together with path-conservative formulations [11 , 12 , 13 ] , and well-balanced schemes have since been extended to moving equilibria , characterised by constancy of the discharge and of the total head [14 , 15 ] . Surveys are given in [16 , 17 ] . Two features common to these methods do not transfer to a neural formulation: the equilibrium is preserved by an explicit update rule acting on cell averages, and the mechanism that preserves it is tied to the mesh through the reconstruction operator. The second feature has been addressed in [18 ] , which gives a necessary and sufficient criterion for exact preservation of the lake at rest in mesh-based and meshless schemes alike, by pairing a mimetic design of the discrete derivative operators with a compatible averaging of the depth in the source. That criterion is formulated for the strong form, requires a discrete bed derivative and is developed for smooth topography.
The problem is more delicate when the bed itself is discontinuous. The source − g h ∂ x b -gh \partial_x b − g h ∂ x b is then a measure supported on the bed jump, multiplied by a solution that is generally discontinuous at the same location, and the resulting nonconservative product is not determined by the equations; its definition requires additional structure, such as a family of paths [19 ] . Conservation of discharge and of total head at the step was adopted in [20 ] , where the wet-bed solutions of the Riemann problem are classified into five configurations and closed-form solutions are derived for a complete family of test problems. A momentum-based closure, which yields different intermediate states, leads to the exact solutions of [21 ] ; the conditions under which the momentum balance can be closed at a discontinuous bed are examined in [22 ] , and the problem is studied within the theory of nonconservative systems in [23 ] . These analyses identify regimes in which the solution is not unique, and the system is resonant where a characteristic speed approaches the vanishing speed of the stationary wave [24 , 25 , 26 ] . Any method for this problem must therefore select a closure explicitly, and it inherits whatever multiplicity that closure carries. Wetting and drying constitutes a further body of work [27 , 28 , 13 , 29 , 30 ] ; the present construction assumes a strictly wet bed and does not address it.
Physics-informed neural networks (PINNs) [31 ] replace the marching update by the minimisation of a residual functional over the parameters of a network defined on the whole space–time domain. For hyperbolic problems the standard formulation is structurally inadequate: the strong-form residual presupposes pointwise derivatives that do not exist across a shock and diverges as a smooth approximation sharpens towards a discontinuous entropy solution, whereas suitable weak residual norms remain bounded [32 ] . Moreover, the resulting optimisation problem does not favour the entropy solution [33 ] , and standard formulations smear discontinuities and misplace shocks on canonical benchmarks [34 , 35 ] . Three families of remedies have emerged. Stabilised strong-form residuals (training points clustered near discontinuities [36 ] , localised artificial viscosity [37 ] , gradient annihilation [38 ] , lift-and-embed formulations [39 ] , explicit enforcement of jump conditions [40 ] , interface flux continuity in a domain decomposition [41 ] ) retain pointwise differential information, and with it a sensitivity to hyperparameters and, in some cases, to prior knowledge of where the discontinuities lie. Finite-volume-informed objectives [42 , 43 , 44 , 45 ] embed a discrete update rule, an approximate Riemann solver or a mesh-dependent stabilisation into the loss, and thereby reintroduce the discretisation choices that the neural representation was meant to avoid; in a well-balanced Roe finite-volume loss for the shallow water equations [46 ] , the balance is inherited from the embedded scheme, at the price of an unstructured mesh and of a loss landscape on which purely physics-based training fails unless sparse measurements are supplied. Weak and dual formulations [32 , 47 , 48 , 33 ] avoid differentiating the approximation but introduce auxiliary test-function networks, potentials or saddle-point problems.
Neural solvers for the shallow water system with topography are recent, and the discrete equilibrium structure has received uneven attention. Label-free networks have been shown to be competitive with a finite-volume model on the accuracy–cost trade-off [49 ] , in a comparison that does not address that structure. The two-dimensional equations with topographic and rainfall sources have been solved in strong form over smooth beds [50 ] , with well-balancedness treated as an empirical training difficulty. To address well-balancedness directly, [51 ] builds it into the network ansatz through a small-weight initialisation, which keeps the solution near the equilibrium rather than exactly at it; the network uses the depth and velocity rather than the free surface, and all topographies are smooth. For discontinuous beds, [52 ] adds the bed elevation as a network output and obtains its slope by automatic differentiation, which makes the free surface continuous; by Theorem 2 below, such a free surface cannot satisfy the head condition at a bed step with non-zero discharge.
Across this body of work, the equilibrium is approached by training, imposed approximately through the ansatz, or inherited from an embedded mesh-based scheme, but in no case is it satisfied exactly by the residual itself; and wherever the bed-slope source is treated explicitly, the bed is differentiated, an operation without meaning where it jumps. The gap is structural rather than one of measured accuracy.
The WE-PINN framework [53 ] , on which we build, belongs to the weak family and uses no auxiliary networks. It enforces the space–time divergence identity over sampled control volumes, evaluates the resulting boundary integrals by Gauss–Legendre quadrature, imposes the initial condition exactly through a temporal ansatz, supplements the conservation residual by integral Kružkov entropy inequalities and a total-variation control, and trains with Adam followed by L-BFGS. It is, however, built on an identity for a homogeneous law and on a globally continuous approximation, and both hypotheses fail here. We therefore separate what is inherited, what is adapted and what is new. Inherited are the control-volume residual, the face quadrature, the exact initial condition and the training schedule, together with the use of overlapping control volumes. Here these are placed at random and form no partition of the space–time domain, so that the method is mesh-free: no mesh is generated, and no property of the method depends on one. Adapted from shallow water theory are the free-surface change of variables, which plays the role it plays in surface-gradient and pre-balanced schemes [7 , 8 ] , and the energy closure at a bed step [20 ] , of whose two conditions one is forced by mass conservation and the other is a modelling choice.
New are three constructions and their analysis. The first is the evaluation of the geometric source over a space–time control volume by means of the elementary Leibniz identity b ∂ x η = ∂ x ( b η ) − η ∂ x b b\,\partial_x\eta= \partial_x(b\,\eta)-\eta\,\partial_xb b ∂ x η = ∂ x ( b η ) − η ∂ x b , an integration by parts that transfers the derivative from the solution to the bed; the residual therefore never differentiates the network and remains defined for η ∈ L ∞ \eta\in L^\infty η ∈ L ∞ . The second is a cell-local shift of the bed slope, defined so that the quadrature reproduces the exact bed increment across the cell, which makes the lake-at-rest cancellation exact for any control-volume family, any quadrature order and any nominal bed slope. The principle behind it, that the source must be discretised consistently with the flux so that the two balance exactly at equilibrium, is the classical principle of well-balanced schemes [1 , 3 ] ; what is new is its realisation inside a quadrature rule on arbitrary space–time cells. In contrast with the criterion of [18 ] , which constrains discrete derivative operators in the strong form and presupposes a smooth bed and a bed derivative, the shift acts inside a quadrature rule in the weak form, requires no bed derivative, holds for an arbitrary and even inconsistent nominal slope, tolerates a discontinuous b b b , and admits into the residual no information about the bathymetry beyond the values of b b b at the two lateral faces of the cell. Well-balancedness is thereby decoupled from the mesh and from the accuracy, and indeed the existence, of a bed derivative. The third construction is a decomposition of the domain into sub-domains of smooth bed, located from the bathymetry alone, which are parameterised independently and coupled through the stationary step transition, so that the free surface can jump exactly where the exact solution requires. Unlike the domain decompositions of cPINN [41 ] and XPINN [54 ] , whose interfaces are chosen freely and coupled by continuity of the flux or of the solution, the interfaces here are dictated by the bed discontinuities and coupled by the hydraulic step closure, across which the free surface jumps.
On the theoretical side, we prove that the common zeros of the continuous residuals are the weak solutions of the balance law; that the fully discrete residual vanishes identically on the lake at rest, so that the equilibrium is an exactly representable global minimiser of the training objective; that the bed-slope correction is of the order of the quadrature error it cancels; that no approximation with a continuous free surface can satisfy the head condition at a bed step at non-zero discharge, with an explicit lower bound on the defect; and that the formulation reduces exactly to the original one when the bed is constant. Classical results used along the way (the free-surface form of the equations, the conjugate-depth structure at a step, integration by parts for functions of bounded variation, Gauss–Legendre error bounds, floating-point error analysis and the momentum balance across a step) are stated with their sources, and their proofs, where given, are included only to keep the paper self-contained. The limitations of the analysis, notably the absence of a convergence estimate for the trained network and of a mechanism selecting among non-unique step transitions, are discussed in § 4.6 .
The numerical experiments test the analysis directly. On four lake-at-rest configurations, over smooth, discontinuous, compound and tabulated beds, the exact equilibrium is fed through the residual operator, which annihilates it bitwise or to a round-off floor identified by its dependence on the working precision; the trained network approaches the equilibrium to a level set by the optimisation budget alone. Seven Riemann problems at a bottom step with closed-form solutions, covering sub-, super- and critical transitions and both signs of the free-surface jump, show that the trained network recovers the stationary transition and the surrounding wave pattern, and a dam break over a smooth bump confirms that without a bed jump the decomposition and interface terms vanish and only the source treatment remains.
The paper is organised as follows. Section 2 sets out the system, its equilibria, the closure at a bed discontinuity and the standing assumptions. Section 3 develops the formulation, Section 4 its analysis, and Section 5 the implementation details required for reproduction. Section 6 reports the numerical experiments and Section 7 concludes. The appendices give the tabulated bathymetry of one test case, the exact Riemann solver at a bottom step and the well-balanced finite-volume reference.
Governing equations and mathematical model
The shallow water equations in free-surface variables
Let Ω x = ( x L , x R ) \Omega_x = (x_L, x_R) Ω x = ( x L , x R ) with L : = ∣ Ω x ∣ L := |\Omega_x| L := ∣ Ω x ∣ , let T > 0 T > 0 T > 0 and set Ω = Ω x × ( 0 , T ) \Omega= \Omega_x \times(0,T) Ω = Ω x × ( 0 , T ) . Over a fixed bed b : Ω x ‾ → R b : \overline{\Omega_x} \to\mathbb{R} b : Ω x → R the one-dimensional shallow water equations read
∂ t h + ∂ x q = 0 , ∂ t q + ∂ x ( q 2 h + 1 2 g h 2 ) = − g h ∂ x b , (1) \partial_t h + \partial_x q = 0, \qquad\partial_t q + \partial_x \left(\frac{q^2}{h} + \frac{1}{2}gh^2\right) = -gh\partial_x b, \tag*{(1)} ∂ t h + ∂ x q = 0 , ∂ t q + ∂ x ( h q 2 + 2 1 g h 2 ) = − g h ∂ x b , (1)
with depth h > 0 h > 0 h > 0 , discharge q = h u q = hu q = h u , velocity u u u and gravitational acceleration g g g ; c = g h c = \sqrt{gh} c = g h is the celerity and F = u / c F = u/c F = u / c the Froude number. Throughout, the free-surface elevation η : = h + b \eta:= h + b η := h + b replaces the depth as the first unknown.
The following reformulation is classical [7 , 8 ] ; we record it with its short proof because the construction relies on its exact form.
Lemma 1 (Free-surface form [7 , 8 ] ). Let b ∈ C 1 ( Ω x ) b \in C^1(\Omega_x) b ∈ C 1 ( Ω x ) and let ( h , q ) (h, q) ( h , q ) be a classical solution of (1) with h > 0 h > 0 h > 0 . Then ( η , q ) (\eta, q) ( η , q ) , η = h + b \eta= h + b η = h + b , is a classical solution of
∂ t η + ∂ x q = 0 , ∂ t q + ∂ x Φ = g b ∂ x η , Φ : = q 2 h + 1 2 g η 2 , h = η − b , (2) \partial_t \eta+ \partial_x q = 0, \qquad\partial_t q + \partial_x \Phi= gb\partial_x\eta, \qquad\Phi:= \frac{q^2}{h} + \frac{1}{2}g\eta^2, \qquad h = \eta- b, \tag*{(2)} ∂ t η + ∂ x q = 0 , ∂ t q + ∂ x Φ = g b ∂ x η , Φ := h q 2 + 2 1 g η 2 , h = η − b , (2) and conversely.
Proof. Since b b b is independent of time, ∂ t η = ∂ t h \partial_t\eta= \partial_t h ∂ t η = ∂ t h and the mass equations coincide. Substituting h = η − b h = \eta- b h = η − b in the hydrostatic term gives
∂ x ( 1 2 g h 2 ) = ∂ x ( 1 2 g η 2 ) − g b ∂ x η − g η ∂ x b + g b ∂ x b , − g h ∂ x b = − g η ∂ x b + g b ∂ x b . \partial_x\left(\frac{1}{2}gh^2\right) = \partial_x\left(\frac{1}{2}g\eta^2\right) - gb\partial_x\eta- g\eta\partial_x b + gb\partial_x b, \qquad-gh\partial_x b = -g\eta\partial_x b + gb\partial_x b. ∂ x ( 2 1 g h 2 ) = ∂ x ( 2 1 g η 2 ) − g b ∂ x η − g η ∂ x b + g b ∂ x b , − g h ∂ x b = − g η ∂ x b + g b ∂ x b .
The terms − g η ∂ x b -g\eta\partial_x b − g η ∂ x b and g b ∂ x b gb\partial_x b g b ∂ x b appear on both sides of the momentum equation and cancel, leaving the second equation of (2). Each step is an algebraic identity between C 1 C^1 C 1 functions and can be read in either direction. □ \square □
This change of variables underlies the surface-gradient and pre-balanced finite-volume formulations. The momentum flux Φ \Phi Φ and the right-hand side g b ∂ x η gb\partial_x\eta g b ∂ x η of (2) are the two quantities on which the construction of Section 3 operates.
Steady states and the lake at rest
As is well known [55 , 16 ] , setting ∂ t ≡ 0 \partial_t \equiv0 ∂ t ≡ 0 in (2) characterises smooth steady states by constancy of the discharge q q q and of the total head
H : = η + u 2 2 g . (3) H := \eta+ \frac{u^2}{2g}. \tag*{(3)} H := η + 2 g u 2 . (3)
Among them, the lake at rest
q ≡ 0 , η ≡ η ⋆ > max Ω x b (4) q \equiv0, \qquad\eta\equiv\eta^\star> \max_{\Omega_x} b \tag*{(4)} q ≡ 0 , η ≡ η ⋆ > Ω x max b (4)
is the state whose exact preservation defines the C C C -property. The two formulations realise (4) differently. In the conservative variables, ∂ x ( 1 2 g h 2 ) = − g h ∂ x b ≠ 0 \partial_x\left(\frac{1}{2}gh^2\right) = -gh\,\partial_x b \ne0 ∂ x ( 2 1 g h 2 ) = − g h ∂ x b = 0 wherever ∂ x b ≠ 0 \partial_x b \ne0 ∂ x b = 0 , so the flux gradient and the source are individually non-zero and cancel only in sum; a discretisation must reproduce that cancellation. In the free-surface variables,
Φ ≡ 1 2 g ( η ⋆ ) 2 , ∂ x Φ ≡ 0 , g b ∂ x η ≡ 0 , (5) \Phi\equiv\frac{1}{2}g(\eta^\star)^2, \qquad\partial_x\Phi\equiv0, \qquad gb\,\partial_x\eta\equiv0, \tag*{(5)} Φ ≡ 2 1 g ( η ⋆ ) 2 , ∂ x Φ ≡ 0 , g b ∂ x η ≡ 0 , (5)
so both sides of the momentum equation vanish separately and pointwise, for every bed, with no cancellation between large quantities; this observation is the basis of the surface-gradient and pre-balanced schemes [7 , 8 ] . Preserving (4) is therefore a matter of not destroying a structure the continuous equations already possess. The reformulation has one cost: the right-hand side of (2) is not a flux divergence, so the space–time divergence theorem does not convert it into a boundary integral. That conversion is precisely the hypothesis on which the inherited WE-PINN residual rests, and § 3.4 restores the missing structure.
The stationary step transition
Let b b b be discontinuous at x 0 ∈ Ω x x_0 \in\Omega_x x 0 ∈ Ω x . For a function v v v with one-sided limits at x 0 x_0 x 0 we write v ± : = v ( x 0 ± ) v_\pm:= v(x_0^\pm) v ± := v ( x 0 ± ) and ⟦ v ⟧ : = v + − v − \llbracket v \rrbracket:= v_+ - v_- [ [ v ] ] := v + − v − , and assume ⟦ b ⟧ ≠ 0 \llbracket b \rrbracket\ne0 [ [ b ] ] = 0 . The exact solution then carries a stationary wave pinned at x 0 x_0 x 0 . The two conditions satisfied by this wave have different logical status.
The mass equation of (2) is in divergence form and contains no product with b b b ; it therefore holds across x 0 x_0 x 0 in D ′ ( Ω ) \mathcal{D}'(\Omega) D ′ ( Ω ) , and its Rankine–Hugoniot condition [56 ] for a discontinuity of speed s s s is − s ⟦ η ⟧ + ⟦ q ⟧ = 0 -s\llbracket\eta\rrbracket+ \llbracket q \rrbracket= 0 − s [ [ η ] ] + [ [ q ] ] = 0 . The wave is pinned to the bed, so s = 0 s=0 s = 0 and
⟦ q ⟧ = 0. (6) \llbracket q \rrbracket= 0. \tag*{(6)} [ [ q ] ] = 0. (6)
Condition (6) is a consequence of the equations. The momentum equation supplies no counterpart: its right-hand side is the nonconservative product g b ∂ x η gb\,\partial_x\eta g b ∂ x η , in which a function discontinuous at x 0 x_0 x 0 multiplies a measure charging x 0 x_0 x 0 , and such a product is not determined by (2) [19 ] . A closure must be prescribed. Following [20 ] we impose conservation of the total head,
\llbracket H \rrbracket= \left\llbracket\eta+ \frac{u^2}{2g} \right\rrbracket= 0, \tag*{(7)}
which, since η \eta η carries the bed elevation, is the classical energy-conserving (Bernoulli) condition of open-channel hydraulics [55 , 57 ] , h − + b − + u − 2 / ( 2 g ) = h + + b + + u + 2 / ( 2 g ) h_- + b_- + u_-^2/(2g) = h_+ + b_+ + u_+^2/(2g) h − + b − + u − 2 / ( 2 g ) = h + + b + + u + 2 / ( 2 g ) . We call (6) –(7) the stationary step transition . It does not conserve momentum; the defect, recalled in Proposition 7, equals the horizontal force exerted by the step on the flow, which the one-dimensional equations do not determine [21 , 22 ] . The momentum-based closure of [21 ] is equally admissible and produces different intermediate states; in the formulation below the closure enters through a single residual, so replacing (7) modifies one term of the objective and nothing else. In resonant regimes the closure carries its own non-uniqueness [24 , 25 ] , which the method inherits.
Eliminating u + = q / h + u_+ = q/h_+ u + = q / h + between (6) and (7) reduces the transition to a scalar equation for the conjugate depth. The following lemma is the classical specific-energy analysis of open-channel hydraulics [55 , 57 ] , used in the same form in [20 ] ; we include a short proof for completeness.
Lemma 2 (Conjugate depths at a step [55 , 20 ] ). Let q ≠ 0 q \ne0 q = 0 , let H − H_{-} H − be the head of the left trace and set A : = H − − b + A := H_{-} - b_{+} A := H − − b + . A depth h + > 0 h_{+} > 0 h + > 0 satisfies (6)–(7) if and only if
f ( h + ) = 0 , f ( h ) : = h 3 − A h 2 + q 2 2 g . (8) f(h_{+}) = 0, \qquad f(h) := h^{3} - A h^{2} + \frac{q^{2}}{2g}. \tag*{(8)} f ( h + ) = 0 , f ( h ) := h 3 − A h 2 + 2 g q 2 . (8) Assume A > 0 A > 0 A > 0 . Then f f f has two positive roots, counted with multiplicity, if and only if
q 2 2 g A 3 ≤ 4 27 , (9) \frac{q^{2}}{2gA^{3}} \le\frac{4}{27}, \tag*{(9)} 2 g A 3 q 2 ≤ 27 4 , (9) and none otherwise. When (9) is strict, the roots satisfy 0 < h s u p < 2 3 A < h s u b < A 0 < h^{\mathrm{sup}} < \frac{2}{3} A < h^{\mathrm{sub}} < A 0 < h sup < 3 2 A < h sub < A , and the Froude number of the corresponding state is
F 2 = q 2 g h 3 = 2 ( A − h ) h , (10) F^{2} = \frac{q^{2}}{g h^{3}} = \frac{2(A-h)}{h}, \tag*{(10)} F 2 = g h 3 q 2 = h 2 ( A − h ) , (10) so that h s u p h^{\mathrm{sup}} h sup is supercritical and h s u b h^{\mathrm{sub}} h sub subcritical. Equality in (9) holds exactly when the roots coalesce at the critical depth 2 3 A = ( q 2 / g ) 1 / 3 \frac{2}{3} A = (q^{2}/g)^{1/3} 3 2 A = ( q 2 / g ) 1/3 .
Proof. With u + = q / h + u_{+} = q/h_{+} u + = q / h + , (7) reads h + − A + q 2 / ( 2 g h + 2 ) = 0 h_{+} - A + q^{2}/(2g h_{+}^{2}) = 0 h + − A + q 2 / ( 2 g h + 2 ) = 0 , and multiplication by h + 2 > 0 h_{+}^{2} > 0 h + 2 > 0 gives (8). Since f ′ ( h ) = h ( 3 h − 2 A ) f'(h) = h(3h - 2A) f ′ ( h ) = h ( 3 h − 2 A ) , f f f has a local maximum f ( 0 ) = q 2 / ( 2 g ) > 0 f(0) = q^{2}/(2g) > 0 f ( 0 ) = q 2 / ( 2 g ) > 0 and a local minimum f ( 2 3 A ) = q 2 / ( 2 g ) − 4 27 A 3 f(\frac{2}{3}A) = q^{2}/(2g) - \frac{4}{27}A^{3} f ( 3 2 A ) = q 2 / ( 2 g ) − 27 4 A 3 ; the product of the three roots is − q 2 / ( 2 g ) < 0 -q^{2}/(2g) < 0 − q 2 / ( 2 g ) < 0 , so exactly one root is negative, and f f f has two positive roots if and only if f ( 2 3 A ) ≤ 0 f(\frac{2}{3}A) \le0 f ( 3 2 A ) ≤ 0 , which is (9). If the inequality is strict, f ( 0 ) > 0 f(0) > 0 f ( 0 ) > 0 , f ( 2 3 A ) < 0 f(\frac{2}{3}A) < 0 f ( 3 2 A ) < 0 and f ( A ) = q 2 / ( 2 g ) > 0 f(A) = q^{2}/(2g) > 0 f ( A ) = q 2 / ( 2 g ) > 0 locate the roots. At a root, q 2 / ( 2 g ) = h 2 ( A − h ) q^{2}/(2g) = h^{2}(A-h) q 2 / ( 2 g ) = h 2 ( A − h ) , whence (10), which exceeds one if and only if h < 2 3 A h < \frac{2}{3}A h < 3 2 A . At equality, 2 3 A \frac{2}{3}A 3 2 A is a double root and q 2 = 2 g ⋅ 4 9 A 2 ⋅ 2 3 A = g h 3 q^{2} = 2g \cdot\frac{4}{9}A^{2} \cdot\frac{2}{3}A = gh^{3} q 2 = 2 g ⋅ 9 4 A 2 ⋅ 3 2 A = g h 3 , i.e. F = 1 F = 1 F = 1 .
Combining Lemma 2 with the wave curves of the homogeneous system yields the five wet-bed configurations of the Riemann problem at a step classified in [20 ] . For the construction that follows, the essential consequence of (6)–(7) is that only q q q and H H H are continuous across x 0 x_{0} x 0 , whereas [ [ η ] ] = [ [ h ] ] + [ [ b ] ] ≠ 0 [\![\eta]\!] = [\![h]\!] + [\![b]\!] \ne0 [ [ η ] ] = [ [ h ] ] + [ [ b ] ] = 0 in general. Theorem 2 converts this observation into a quantitative obstruction for approximation spaces with a continuous free surface.
Standing assumptions and notation
The bed is allowed finitely many jump discontinuities x L = e 0 < e 1 < ⋯ < e M < e M + 1 = x R x_{L} = e_{0} < e_{1} < \cdots< e_{M} < e_{M+1} = x_{R} x L = e 0 < e 1 < ⋯ < e M < e M + 1 = x R and is smooth between them. We set
Ω k : = ( e k , e k + 1 ) , Ω k T : = Ω k × ( 0 , T ) , k = 0 , … , M . \Omega_{k} := (e_{k},e_{k+1}), \qquad\Omega_{k}^{T} := \Omega_{k} \times(0,T), \qquad k = 0,\ldots,M. Ω k := ( e k , e k + 1 ) , Ω k T := Ω k × ( 0 , T ) , k = 0 , … , M .
The jump abscissae are not supplied to the method; § 3.2 recovers them from b b b .
Assumption 1 (Bathymetry). b ∣ Ω k b|_{\Omega_{k}} b ∣ Ω k extends to a function of C 1 ( Ω k ‾ ) C^{1}(\overline{\Omega_{k}}) C 1 ( Ω k ) for every k k k , and b b b is evaluated exactly at every node used below.
Assumption 2 (Admissible states). ( η , q ) ∈ L ∞ ( ( Ω k T ) 2 ) (\eta,q) \in L^{\infty}((\Omega_{k}^{T})^{2}) ( η , q ) ∈ L ∞ (( Ω k T ) 2 ) and h : = η − b ≥ h min > 0 h := \eta-b \ge h_{\min} > 0 h := η − b ≥ h m i n > 0 almost everywhere on Ω k T \Omega_{k}^{T} Ω k T , for every k k k .
The positive constant h min h_{\min} h m i n is the depth floor of § 3.6 . Under Assumptions 1–2, Φ ∈ L ∞ ( Ω k T ) \Phi\in L^{\infty}(\Omega_{k}^{T}) Φ ∈ L ∞ ( Ω k T ) . The implementation evaluates the momentum flux through the regularised depth h δ : = max { η − b , h min } h_{\delta} := \max\{\eta-b,h_{\min}\} h δ := max { η − b , h m i n } , which equals h h h under Assumption 2, so the analysis concerns the residual that is actually assembled. Dry states (h → 0 h \to0 h → 0 ) are excluded.
The admissible control volumes on Ω k \Omega_{k} Ω k are the axis-aligned rectangles
K k : = { K = [ x 1 , x 2 ] × [ t 1 , t 2 ] : [ x 1 , x 2 ] ⊂ Ω ‾ k , [ t 1 , t 2 ] ⊂ [ 0 , T ] , x 1 < x 2 , t 1 < t 2 } , (11) \mathcal{K}_{k} := \left\{K = [x_{1},x_{2}] \times[t_{1},t_{2}] : [x_{1},x_{2}] \subset\overline{\Omega}_{k},\ [t_{1},t_{2}] \subset[0,T],\ x_{1} < x_{2},\ t_{1} < t_{2}\right\}, \tag*{(11)} K k := { K = [ x 1 , x 2 ] × [ t 1 , t 2 ] : [ x 1 , x 2 ] ⊂ Ω k , [ t 1 , t 2 ] ⊂ [ 0 , T ] , x 1 < x 2 , t 1 < t 2 } , (11)
parameterised by ( x 1 , x 2 , t 1 , t 2 ) ∈ R 4 (x_{1},x_{2},t_{1},t_{2}) \in\mathbb{R}^{4} ( x 1 , x 2 , t 1 , t 2 ) ∈ R 4 ; a property holds for almost every K ∈ K k K \in\mathcal{K}_{k} K ∈ K k when it holds for almost every parameter with respect to four-dimensional Lebesgue measure. For K ∈ K k K \in\mathcal{K}_{k} K ∈ K k we write Δ x = x 2 − x 1 \Delta x = x_{2} - x_{1} Δ x = x 2 − x 1 , Δ t = t 2 − t 1 \Delta t = t_2 - t_1 Δ t = t 2 − t 1 and ∣ K ∣ = Δ x Δ t |K| = \Delta x \Delta t ∣ K ∣ = Δ x Δ t . These are the extents of the single control volume K K K , not the spacing of a mesh: the control volumes of Section 3.3 are placed at random, overlap, and form no structured grid, so that Δ x \Delta x Δ x and Δ t \Delta t Δ t are attributes of each cell and no neighbouring cell, node spacing or grid index is implied. The Gauss–Legendre nodes and weights on [ − 1 , 1 ] [-1,1] [ − 1 , 1 ] are { ξ p , w p } p = 1 Q \{\xi_p,w_p\}_{p=1}^{Q} { ξ p , w p } p = 1 Q , normalised by
∑ p = 1 Q w p = 2 , (12) \sum_{p=1}^{Q} w_p = 2, \tag*{(12)} p = 1 ∑ Q w p = 2 , (12)
and their images on K K K are x p = 1 2 ( x 1 + x 2 ) + Δ x 2 ξ p x_p = \frac{1}{2}(x_1+x_2) + \frac{\Delta x}{2}\xi_p x p = 2 1 ( x 1 + x 2 ) + 2 Δ x ξ p and t p = 1 2 ( t 1 + t 2 ) + Δ t 2 ξ p t_p = \frac{1}{2}(t_1+t_2) + \frac{\Delta t}{2}\xi_p t p = 2 1 ( t 1 + t 2 ) + 2 Δ t ξ p .
Method
The inherited weak space–time residual
For a homogeneous system ∂ t U + ∂ x F ( U ) = 0 \partial_t U + \partial_x F(U) = 0 ∂ t U + ∂ x F ( U ) = 0 , the space–time flux J ( U ) : = ( F ( U ) , U ) J(U) := (F(U),U) J ( U ) := ( F ( U ) , U ) turns the law into ∇ x , t ⋅ J ( U ) = 0 \nabla_{x,t}\cdot J(U) = 0 ∇ x , t ⋅ J ( U ) = 0 , whose integral form over an axis-aligned rectangle D = [ x 1 , x 2 ] × [ t 1 , t 2 ] ⊂ Ω ‾ D = [x_1,x_2] \times[t_1,t_2] \subset\overline{\Omega} D = [ x 1 , x 2 ] × [ t 1 , t 2 ] ⊂ Ω is the classical integral conservation law [56 , 58 ]
∫ x 1 x 2 [ U ( x , t 2 ) − U ( x , t 1 ) ] d x + ∫ t 1 t 2 [ F ( U ( x 2 , t ) ) − F ( U ( x 1 , t ) ) ] d t = 0. (13) \int_{x_1}^{x_2} [U(x,t_2)-U(x,t_1)]\,\mathrm{d}x+\int_{t_1}^{t_2}[F(U(x_2,t))-F(U(x_1,t))]\,\mathrm{d}t=0. \tag*{(13)} ∫ x 1 x 2 [ U ( x , t 2 ) − U ( x , t 1 )] d x + ∫ t 1 t 2 [ F ( U ( x 2 , t )) − F ( U ( x 1 , t ))] d t = 0. (13)
Three properties of (13) are used unchanged. It involves only the traces of U U U and F ( U ) F(U) F ( U ) on the four faces of D D D , so it is meaningful for U ∈ L ∞ U \in L^\infty U ∈ L ∞ and requires no derivative of the approximation; it remains bounded when U U U is discontinuous and encodes the Rankine–Hugoniot conditions implicitly; and it holds on every bounded Lipschitz region, so a family of test volumes need not form a partition of Ω \Omega Ω . WE-PINNs [53 ] penalise the volume-weighted mean square of the left-hand side of (13) over a sampled family of control volumes, evaluate the face integrals by Gauss–Legendre quadrature, and impose the initial condition exactly through a temporal ansatz U θ = ( 1 − τ ) U 0 + τ N θ U_\theta= (1-\tau)U_0+\tau\mathcal{N}_\theta U θ = ( 1 − τ ) U 0 + τ N θ with τ ( 0 ) = 0 \tau(0)=0 τ ( 0 ) = 0 .
Three hypotheses of that construction fail for (2). The law is not homogeneous, so (13) is not available; the ansatz is globally continuous in x x x , whereas § 2.3 requires [ [ η ] ] ≠ 0 [[\eta]] \ne0 [[ η ]] = 0 at a bed step; and the entropy machinery has no established counterpart for a stationary wave at a bed discontinuity. The first two failures are addressed in § 3.4 –§ 3.5 and § 3.2 , respectively. The entropy and total-variation terms of the original framework are not used in the formulation analysed here.
The input of the method is Ω x \Omega_x Ω x , T T T , the bed b b b and the initial conditions η 0 \eta_0 η 0 , u 0 u_0 u 0 , each supplied as a function that can be evaluated pointwise. No information about the solution is used: the number and position of the bed discontinuities, the domain decomposition, the normalisation scales and the boundary treatment are all derived from these inputs.
Locating the bed discontinuities and decomposing the domain
The discontinuities of b b b are a property of the data, not of the flow, so locating them requires no knowledge of the solution; the operation is the analogue of a finite-volume code evaluating b b b at cell interfaces. With osc ( b ) : = max Ω x b − min Ω x b \operatorname{osc}(b) := \max_{\Omega_x} b - \min_{\Omega_x} b osc ( b ) := max Ω x b − min Ω x b , set
tol : = max { 10 − 4 max { osc ( b ) , 1 } , 10 − 12 } . (14) \operatorname{tol} := \max\left\{10^{-4}\max\{\operatorname{osc}(b),1\},10^{-12}\right\}. \tag*{(14)} tol := max { 1 0 − 4 max { osc ( b ) , 1 } , 1 0 − 12 } . (14)
The detector scans b b b on a uniform grid, flags every interval across which the increment of b b b exceeds tol, bisects it to a candidate abscissa x 0 x_0 x 0 , and confirms the candidate by comparing the symmetric increments j k : = b ( x 0 + d k ) − b ( x 0 − d k ) j_k := b(x_0+d_k)-b(x_0-d_k) j k := b ( x 0 + d k ) − b ( x 0 − d k ) at the probe distances d 1 = 10 − 7 L d_1=10^{-7}L d 1 = 1 0 − 7 L and d 2 = 10 − 2 d 1 d_2=10^{-2}d_1 d 2 = 1 0 − 2 d 1 , accepting when
∣ j 2 ∣ ≥ 1 2 ∣ j 1 ∣ and ∣ j 2 ∣ ≥ tol . (15) |j_2| \ge\frac{1}{2}|j_1| \qquad\text{and} \qquad|j_2| \ge\operatorname{tol}. \tag*{(15)} ∣ j 2 ∣ ≥ 2 1 ∣ j 1 ∣ and ∣ j 2 ∣ ≥ tol . (15)
At a genuine jump j k → [ b ] ≠ 0 j_k \to[b] \ne0 j k → [ b ] = 0 , so j 2 / j 1 → 1 j_2/j_1 \to1 j 2 / j 1 → 1 and both inequalities hold. If instead b b b is Lipschitz with constant L b L_b L b near x 0 x_0 x 0 , then ∣ j 2 ∣ ≤ 2 L b d 2 = 2 L b × 10 − 9 L |j_2| \le2L_b d_2 = 2L_b \times10^{-9}L ∣ j 2 ∣ ≤ 2 L b d 2 = 2 L b × 1 0 − 9 L and the second inequality fails whenever $2L_b d_2 < \operatorname{tol}, that is, unless the slope exceeds tol / ( 2 d 2 ) \operatorname{tol}/(2d_{2}) tol / ( 2 d 2 ) . The confirmation test is thus exact in the limit d 1 → 0 d_{1} \to0 d 1 → 0 ; the bracketing stage that precedes it can still miss a genuine jump immediately preceded by a steep smooth feature, a situation in which the well-balanced property nevertheless survives (Remark 2).
The accepted abscissae define the sub-domains Ω k \Omega_{k} Ω k of § 2.4 . Each Ω k \Omega_{k} Ω k carries its own network, so the global approximation is smooth inside every sub-domain and admits a jump at every interior node e m e_{m} e m . A single total budget N N N of control volumes — a number of space–time cells, not a product of counts in x x x and in t t t — is shared among the sub-domains in proportion to their widths,
N k = max { 8 , ⌊ N ∣ Ω k ∣ L ⌉ } , (16) N_{k} = \max\left\{8,\left\lfloor N\frac{|\Omega_{k}|}{L}\right\rceil\right\}, \tag*{(16)} N k = max { 8 , ⌊ N L ∣ Ω k ∣ ⌉ } , (16)
where ⌊ ⋅ ⌉ \lfloor\cdot\rceil ⌊ ⋅ ⌉ denotes rounding to the nearest integer. Each sub-domain is flagged constant-bed or variable-bed by sampling b b b at interior points; the flag decides whether the volume term of the source is assembled. All bed and initial-condition values attached to Ω k \Omega_{k} Ω k are evaluated at abscissae pulled a distance 10 − 9 ∣ Ω k ∣ 10^{-9}|\Omega_{k}| 1 0 − 9 ∣ Ω k ∣ inside Ω k \Omega_{k} Ω k , which makes every trace one-sided at a bed jump; the shift is applied to the bed and the initial conditions, which genuinely jump, and never to the network input.
Space–time control volumes
On each sub-domain the control volumes are axis-aligned space–time rectangles of equal size centred on randomly placed points. With L x : = ∣ Ω k ∣ L_{x} := |\Omega_{k}| L x := ∣ Ω k ∣ and L t : = T L_{t} := T L t := T , the centres are
x i c = e k + L x U i , t i c = L t V i , i = 0 , … , N k − 1 , (17) x_{i}^{c} = e_{k} + L_{x}U_{i}, \qquad t_{i}^{c} = L_{t}V_{i}, \qquad i = 0,\ldots,N_{k}-1, \tag*{(17)} x i c = e k + L x U i , t i c = L t V i , i = 0 , … , N k − 1 , (17)
where U 0 , … , U N k − 1 , V 0 , … , V N k − 1 U_{0},\ldots,U_{N_{k}-1}, V_{0},\ldots,V_{N_{k}-1} U 0 , … , U N k − 1 , V 0 , … , V N k − 1 are independent random variables, uniformly distributed on [ 0 , 1 ] [0,1] [ 0 , 1 ] and drawn once with a fixed seed. The half-widths are
h x = min { L x n x e q γ 2 , L x 2 } , h t = min { L t n t e q γ 2 α c , L t 2 } , n x e q = N k L x L t , n t e q = N k L t L x , (18) h_{x} = \min\left\{\frac{L_{x}}{n_{x}^{\mathrm{eq}}}\frac{\gamma}{2},\frac{L_{x}}{2}\right\}, \qquad h_{t} = \min\left\{\frac{L_{t}}{n_{t}^{\mathrm{eq}}}\frac{\gamma}{2\alpha_{c}},\frac{L_{t}}{2}\right\}, \qquad n_{x}^{\mathrm{eq}} = \sqrt{\frac{N_{k}L_{x}}{L_{t}}}, \qquad n_{t}^{\mathrm{eq}} = \sqrt{\frac{N_{k}L_{t}}{L_{x}}}, \tag*{(18)} h x = min { n x eq L x 2 γ , 2 L x } , h t = min { n t eq L t 2 α c γ , 2 L t } , n x eq = L t N k L x , n t eq = L x N k L t , (18)
with overlap factor γ > 0 \gamma> 0 γ > 0 and aspect ratio α c > 0 \alpha_{c} > 0 α c > 0 , and the cell K i = [ x i 1 , x i 2 ] × [ t i 1 , t i 2 ] K_{i} = [x_{i}^{1},x_{i}^{2}] \times[t_{i}^{1},t_{i}^{2}] K i = [ x i 1 , x i 2 ] × [ t i 1 , t i 2 ] is obtained by clipping x i c ∓ h x x_{i}^{c} \mp h_{x} x i c ∓ h x to Ω k \Omega_{k} Ω k and t i c ∓ h t t_{i}^{c} \mp h_{t} t i c ∓ h t to [ 0 , T ] [0,T] [ 0 , T ] . The counts n x e q n_{x}^{\mathrm{eq}} n x eq and n t e q n_{t}^{\mathrm{eq}} n t eq are those of an equivalent lattice with N k N_{k} N k cells and serve only to fix the cell size; no such lattice is built. Every unclipped cell therefore has the same extents Δ x = 2 h x \Delta x = 2h_{x} Δ x = 2 h x , equal to γ L x L t / N k \gamma\sqrt{L_{x}L_{t}/N_{k}} γ L x L t / N k when the minimum in (18) is not active, and Δ t = 2 h t \Delta t = 2h_{t} Δ t = 2 h t , clipped cells near ∂ Ω k \partial\Omega_{k} ∂ Ω k or t ∈ { 0 , T } t \in\{0,T\} t ∈ { 0 , T } being smaller. In what follows Δ x \Delta x Δ x always denotes this cell width and never a grid spacing, and refining means increasing N k N_{k} N k , which shrinks the cells as N k − 1 / 2 N_{k}^{-1/2} N k − 1/2 while their centres remain random. For γ > 1 \gamma> 1 γ > 1 the cells overlap and, after clipping, may leave parts of Ω k T \Omega_{k}^{T} Ω k T uncovered. Both are admissible, since (13) holds on every bounded Lipschitz region: the family is a Monte Carlo collection of test regions, not a mesh (Figure 1 ). The random placement is compatible with the analysis of § 4 : the well-balanced property is proved cell by cell, and consistency is a statement about all rectangles. Coverage must nevertheless be monitored, because the weak identity is enforced only where a cell reaches. The family is constructed once from the geometry alone and is never adapted to the solution, which permits the pre-computation of § 5 . Clipping guarantees
Figure 1. An unstructured, overlapping space–time control-volume family for a domain with a single bed jump: cell centres (left) and a sample of the control volumes (right), coloured by sub-domain. The dashed line marks the bed jump; no cell straddles it. The family is generated once from the geometry alone, by placing the cell centres independently and uniformly at random.
K i ∈ K k , hence b ∈ C 1 ( K i ) (19) K_{i} \in\mathcal{K}_{k}, \qquad\text{hence} \qquad b \in C^{1}(K_{i}) \tag*{(19)} K i ∈ K k , hence b ∈ C 1 ( K i ) (19)
under Assumption 1, which is the hypothesis under which the integration by parts of § 3.4 is legitimate.
Remark 1 (Cell shape). Nothing in the formulation requires rectangles: any bounded Lipschitz region may serve as a test region. Rectangles are used because the boundary splits into four axis-aligned faces carrying one-dimensional Gauss–Legendre rules, because clipping delivers (19) immediately, and because the bed-slope correction takes an elementary form, the two horizontal faces sharing the abscissae x p x_p x p and the two lateral faces the instants t p t_p t p . For another shape, the boundary quadrature must reproduce ∫ ∂ K n d s = 0 \int_{\partial K} \mathbf{n}\,\mathrm{d}s=0 ∫ ∂ K n d s = 0 exactly for Theorem 1 to survive, and the shift (24) must be redefined accordingly.
A source term that never differentiates the network
Let K = [ x 1 , x 2 ] × [ t 1 , t 2 ] ∈ K k K=[x_1,x_2]\times[t_1,t_2]\in\mathcal{K}_k K = [ x 1 , x 2 ] × [ t 1 , t 2 ] ∈ K k and let ( η , q ) (\eta,q) ( η , q ) satisfy Assumption 2. Integrating (2) over K K K and applying the divergence theorem to the conservative part yields the weak residuals
R m ( K ) = ∫ x 1 x 2 [ η ( x , t 2 ) − η ( x , t 1 ) ] d x + ∫ t 1 t 2 [ q ( x 2 , t ) − q ( x 1 , t ) ] d t , (20) \mathcal{R}^{\mathrm{m}}(K)=\int_{x_1}^{x_2}\left[\eta(x,t_2)-\eta(x,t_1)\right]\mathrm{d}x+\int_{t_1}^{t_2}\left[q(x_2,t)-q(x_1,t)\right]\mathrm{d}t, \tag*{(20)} R m ( K ) = ∫ x 1 x 2 [ η ( x , t 2 ) − η ( x , t 1 ) ] d x + ∫ t 1 t 2 [ q ( x 2 , t ) − q ( x 1 , t ) ] d t , (20)
R p ( K ) = ∫ x 1 x 2 [ q ( x , t 2 ) − q ( x , t 1 ) ] d x + ∫ t 1 t 2 [ Φ ( x 2 , t ) − Φ ( x 1 , t ) ] d t − S ( K ) , (21) \mathcal{R}^{\mathrm{p}}(K)=\int_{x_1}^{x_2}\left[q(x,t_2)-q(x,t_1)\right]\mathrm{d}x+\int_{t_1}^{t_2}\left[\Phi(x_2,t)-\Phi(x_1,t)\right]\mathrm{d}t-S(K), \tag*{(21)} R p ( K ) = ∫ x 1 x 2 [ q ( x , t 2 ) − q ( x , t 1 ) ] d x + ∫ t 1 t 2 [ Φ ( x 2 , t ) − Φ ( x 1 , t ) ] d t − S ( K ) , (21)
in which S ( K ) S(K) S ( K ) represents ∫ K g b ∂ x η \int_K gb\,\partial_x\eta ∫ K g b ∂ x η . As it stands, this integral requires a derivative of the solution. We remove that requirement by integrating by parts in x x x (the elementary Leibniz identity), which is legitimate because b ∈ C 1 ( K ) b\in C^1(K) b ∈ C 1 ( K ) by (19), and which transfers the derivative from the solution onto the bed:
S ( K ) : = g ∫ t 1 t 2 [ b ( x 2 ) η ( x 2 , t ) − b ( x 1 ) η ( x 1 , t ) ] d t − g ∫ t 1 t 2 ∫ x 1 x 2 η ( x , t ) b ′ ( x ) d x d t . (22) S(K):=g\int_{t_1}^{t_2}\left[b(x_2)\eta(x_2,t)-b(x_1)\eta(x_1,t)\right]\mathrm{d}t-g\int_{t_1}^{t_2}\int_{x_1}^{x_2}\eta(x,t)b'(x)\,\mathrm{d}x\,\mathrm{d}t. \tag*{(22)} S ( K ) := g ∫ t 1 t 2 [ b ( x 2 ) η ( x 2 , t ) − b ( x 1 ) η ( x 1 , t ) ] d t − g ∫ t 1 t 2 ∫ x 1 x 2 η ( x , t ) b ′ ( x ) d x d t . (22)
The right-hand side of (22) is well defined for η ∈ L ∞ ( K ) \eta\in L^\infty(K) η ∈ L ∞ ( K ) , and Lemma 3 identifies it with the pairing of b b b against the distributional derivative D x η D_x\eta D x η , which is meaningful because b b b is continuous on the cell even where η \eta η is not. We take (22) as the definition of the source contribution. Consequently the residual pair (20)–(21) never differentiates the approximation and remains a statement about point values of η \eta η and q q q , whether or not the solution is discontinuous inside K K K ; by Proposition 1, its common zeros over K k \mathcal{K}_k K k are exactly the weak solutions of (2) on Ω k T \Omega_k^T Ω k T . When b = b 0 b=b_0 b = b 0 is constant on Ω k \Omega_k Ω k , the volume term vanishes identically and is not assembled, while the face term reduces to g b 0 ∫ t 1 t 2 [ η ( x 2 , t ) − η ( x 1 , t ) ] d t g b_0\int_{t_1}^{t_2}[\eta(x_2,t)-\eta(x_1,t)]\mathrm{d}t g b 0 ∫ t 1 t 2 [ η ( x 2 , t ) − η ( x 1 , t )] d t .
The quadrature-consistent bed-slope correction
This is the element that makes the method well balanced. It applies to a quadrature rule on arbitrary space–time cells the classical requirement that the discrete source balance the discrete flux exactly at equilibrium [1 , 3 , 10 ] . The face integrals of (22) are evaluated with the Q Q Q -point rule already used for the fluxes, and the volume term with the tensor-product Q × Q Q \times Q Q × Q rule:
S Q ( K ) = g Δ t 2 ∑ p w p [ b ( x 2 ) η ( x 2 , t p ) − b ( x 1 ) η ( x 1 , t p ) ] − g Δ x Δ t 4 ∑ p , r w p w r η ( x p , t r ) b ~ ′ ( x p ) . (23) S_Q(K) = \frac{g\Delta t}{2}\sum_p w_p\left[b(x_2)\eta(x_2,t_p)-b(x_1)\eta(x_1,t_p)\right]-\frac{g\Delta x\Delta t}{4}\sum_{p,r}w_pw_r\eta(x_p,t_r)\tilde{b}'(x_p). \tag*{(23)} S Q ( K ) = 2 g Δ t p ∑ w p [ b ( x 2 ) η ( x 2 , t p ) − b ( x 1 ) η ( x 1 , t p ) ] − 4 g Δ x Δ t p , r ∑ w p w r η ( x p , t r ) b ~ ′ ( x p ) . (23)
At the lake at rest, η ≡ η ⋆ \eta\equiv\eta^\star η ≡ η ⋆ , the first term collapses to g η ⋆ Δ t ( b ( x 2 ) − b ( x 1 ) ) g\eta^\star\Delta t\left(b(x_2)-b(x_1)\right) g η ⋆ Δ t ( b ( x 2 ) − b ( x 1 ) ) , the exact bed increment across the cell, while the second collapses to g η ⋆ Δ t Δ x 2 ∑ p w p b ~ ′ ( x p ) g\eta^\star\Delta t\frac{\Delta x}{2}\sum_p w_p\tilde{b}'(x_p) g η ⋆ Δ t 2 Δ x ∑ p w p b ~ ′ ( x p ) , a quadrature of the same increment. If b ~ ′ \tilde{b}' b ~ ′ were the nominal bed slope, the two would differ by the quadrature error and the C C C -property would be lost. The remedy is to make the quadrature exact for this one integrand by construction. Let b ′ ( x p ) b'(x_p) b ′ ( x p ) denote any available approximation of the bed derivative at the nodes, let G Q ( K ) = Δ x 2 ∑ p w p b ′ ( x p ) G_Q(K)=\frac{\Delta x}{2}\sum_p w_pb'(x_p) G Q ( K ) = 2 Δ x ∑ p w p b ′ ( x p ) be the corresponding approximation of ∫ x 1 x 2 b ′ , \int_{x_1}^{x_2}b'\,, ∫ x 1 x 2 b ′ , and use the shifted slope
b ~ ′ ( x p ) : = b ′ ( x p ) + ( b ( x 2 ) − b ( x 1 ) ) − G Q ( K ) Δ x , (24) \tilde{b}'(x_p):=b'(x_p)+\frac{\left(b(x_2)-b(x_1)\right)-G_Q(K)}{\Delta x}, \tag*{(24)} b ~ ′ ( x p ) := b ′ ( x p ) + Δ x ( b ( x 2 ) − b ( x 1 ) ) − G Q ( K ) , (24)
a shift by a constant on each cell, which by (12) satisfies
Δ x 2 ∑ p w p b ~ ′ ( x p ) = b ( x 2 ) − b ( x 1 ) . (25) \frac{\Delta x}{2}\sum_p w_p\tilde{b}'(x_p)=b(x_2)-b(x_1). \tag*{(25)} 2 Δ x p ∑ w p b ~ ′ ( x p ) = b ( x 2 ) − b ( x 1 ) . (25)
The two terms of (23) then cancel identically at the equilibrium. Identity (25) is the single algebraic fact behind Theorem 1, and three of its features deserve emphasis. First, the shift is defined from the computed value G Q ( K ) G_Q(K) G Q ( K ) , so the cancellation is exact whatever b ′ b' b ′ is, accurate or not, and indeed whether or not b b b is differentiable on the cell. Second, since Δ x \Delta x Δ x and the nodes are cell-dependent, (24) is defined for overlapping, non-uniform and unstructured families exactly as for a mesh. Third, the only information about the bathymetry entering the equilibrium cancellation is the pair of face values b ( x 1 ) b(x_1) b ( x 1 ) , b ( x 2 ) b(x_2) b ( x 2 ) . Consistency is unaffected: the shift is of the order of the quadrature error it cancels when b b b is smooth, and equals J / Δ x + O ( 1 ) J/\Delta x+O(1) J /Δ x + O ( 1 ) when b b b carries a jump of height J J J inside the cell (Propositions 3–4).
Coupling at a bed discontinuity, boundary conditions and positivity
At each detected jump e m e_m e m the traces of the two adjacent networks are coupled through the stationary step transition. Writing b ∓ = b ( e m ∓ ) b_\mp=b(e_m^\mp) b ∓ = b ( e m ∓ ) , η ∓ \eta_\mp η ∓ , q ∓ q_\mp q ∓ for the corresponding traces and u ∓ = q ∓ / max { η ∓ − b ∓ , h min } u_\mp=q_\mp/\max\{\eta_\mp-b_\mp,h_{\min}\} u ∓ = q ∓ / max { η ∓ − b ∓ , h m i n } , the interface residuals are
r q ( t ) = τ ( t ) ( q − − q + ) , r H ( t ) = τ ( t ) [ ( η − + u − 2 2 g ) − ( η + + u + 2 2 g ) ] , (26) r_q(t)=\tau(t)(q_--q_+),\qquad r_H(t)=\tau(t)\left[\left(\eta_-+\frac{u_-^2}{2g}\right)-\left(\eta_++\frac{u_+^2}{2g}\right)\right], \tag*{(26)} r q ( t ) = τ ( t ) ( q − − q + ) , r H ( t ) = τ ( t ) [ ( η − + 2 g u − 2 ) − ( η + + 2 g u + 2 ) ] , (26)
evaluated at N Γ Q N_\Gamma Q N Γ Q Gauss points in time, N Γ N_\Gamma N Γ being a prescribed number of time intervals on the interface, independent of the control-volume family and used for the outer boundary conditions as well. The factor τ \tau τ is the temporal blending of (29), with τ ( 0 ) = 0 \tau(0)=0 τ ( 0 ) = 0 and τ > 0 \tau>0 τ > 0 for t > 0 t>0 t > 0 . It deactivates the conditions at t = 0 t=0 t = 0 , where they are incompatible with a Riemann initial condition with q l ≠ q r q_l\ne q_r q l = q r ; (6)–(7) are in any case statements about t > 0 t>0 t > 0 . Both residuals vanish identically at the lake at rest, so the coupling does not interfere with the C C C -property.
At each outer boundary one scalar condition is imposed, matching the number of incoming characteristics for subcritical flow. The transmissive treatment is the standard characteristic condition [59 ] : it freezes the incoming Riemann invariant at the value carried by the initial condition,
( u + 2 g h ) ( x L , t ) = W L , ( u − 2 g h ) ( x R , t ) = W R , (27) \left(u+2\sqrt{gh}\right)(x_L,t)=W_L,\qquad\left(u-2\sqrt{gh}\right)(x_R,t)=W_R, \tag*{(27)} ( u + 2 g h ) ( x L , t ) = W L , ( u − 2 g h ) ( x R , t ) = W R , (27)
with W L = u 0 ( x L ) + 2 g h 0 ( x L ) W_L=u_0(x_L)+2\sqrt{gh_0(x_L)} W L = u 0 ( x L ) + 2 g h 0 ( x L ) and W R = u 0 ( x R ) − 2 g h 0 ( x R ) W_R=u_0(x_R)-2\sqrt{gh_0(x_R)} W R = u 0 ( x R ) − 2 g h 0 ( x R ) . This is exact for a Riemann problem truncated to a finite window as long as no wave has reached the boundary, and remains exact after a rarefaction has reached it, since u + 2 c u+2c u + 2 c is constant through a 1-rarefaction; it degrades only if a shock crosses the boundary. The wall treatment imposes q = 0 q=0 q = 0 at both ends, and a Dirichlet treatment pinning both components to the initial condition is also available. Positivity is encouraged by the one-sided quadratic barrier
L P = ⟨ ( max { 0 , h s a f e − h θ } ) 2 ⟩ , (28) \mathcal{L}_{P}=\left\langle\left(\max\{0,h_{\mathrm{safe}}-h_{\theta}\}\right)^2\right\rangle, \tag*{(28)} L P = ⟨ ( max { 0 , h safe − h θ } ) 2 ⟩ , (28)
averaged over the cell faces and the interface nodes, and the hard floor h min < h s a f e h_{\min}<h_{\mathrm{safe}} h m i n < h safe is applied inside q 2 / h q^2/h q 2 / h and q / h q/h q / h so that the objective remains finite. On wet beds satisfying Assumption 2 with h ≥ h s a f e h\ge h_{\mathrm{safe}} h ≥ h safe , both mechanisms are inactive.
Approximation and training objective
On Ω k \Omega_k Ω k the solution is represented by
η θ k = ( 1 − τ ( t ) ) η 0 + τ ( t ) N θ k ( 1 ) , q θ k = ( 1 − τ ( t ) ) q 0 + τ ( t ) N θ k ( 2 ) , τ ( t ) = tanh ( α t ) , α = c τ T , (29) \eta_{\theta k}=(1-\tau(t))\eta_0+\tau(t)\mathcal{N}_{\theta k}^{(1)},\qquad q_{\theta k}=(1-\tau(t))q_0+\tau(t)\mathcal{N}_{\theta k}^{(2)},\qquad\tau(t)=\tanh(\alpha t),\quad\alpha=\frac{c_{\tau}}{T}, \tag*{(29)} η θ k = ( 1 − τ ( t )) η 0 + τ ( t ) N θ k ( 1 ) , q θ k = ( 1 − τ ( t )) q 0 + τ ( t ) N θ k ( 2 ) , τ ( t ) = tanh ( α t ) , α = T c τ , (29)
where N θ k = ( N θ k ( 1 ) , N θ k ( 2 ) ) \mathcal{N}_{\theta k}=(\mathcal{N}_{\theta k}^{(1)},\mathcal{N}_{\theta k}^{(2)}) N θ k = ( N θ k ( 1 ) , N θ k ( 2 ) ) is a feedforward network acting on the affinely rescaled coordinates of Ω ‾ T k \overline{\Omega}_T^k Ω T k and q 0 = ( η 0 − b ) u 0 q_0=(\eta_0-b)u_0 q 0 = ( η 0 − b ) u 0 . Since τ ( 0 ) = 0 \tau(0)=0 τ ( 0 ) = 0 , the initial condition holds exactly and pointwise, including for discontinuous Riemann initial conditions, so no initial-condition term appears in the objective; since η 0 , q 0 \eta_0,q_0 η 0 , q 0 are read one-sidedly, the ansatz is discontinuous at a bed jump exactly where the initial conditions are. The constant c τ > 0 c_{\tau}>0 c τ > 0 concentrates the blending over the initial fraction 2 / c τ 2/c_{\tau} 2/ c τ of the window, so that the network is free to develop the solution early; it is an input and is not tied to the control volumes, which carry no layer structure in time.
The two cell residuals have different physical dimensions and may differ by orders of magnitude, so they are normalised by scales built from the initial conditions alone. With η s c = max Ω x ∣ η 0 ∣ \eta_{\mathrm{sc}}=\max_{\Omega_x}|\eta_0| η sc = max Ω x ∣ η 0 ∣ and u s c = g max Ω x h 0 u_{\mathrm{sc}}=\sqrt{g\max_{\Omega_x}h_0} u sc = g max Ω x h 0 ,
S m = η s c u s c L , S p = g η s c 2 L , S q = η s c u s c , S H = η s c , S W = u s c . (30) S_m=\frac{\eta_{\mathrm{sc}}u_{\mathrm{sc}}}{L},\qquad S_p=\frac{g\eta_{\mathrm{sc}}^2}{L},\qquad S_q=\eta_{\mathrm{sc}}u_{\mathrm{sc}},\qquad S_H=\eta_{\mathrm{sc}},\qquad S_W=u_{\mathrm{sc}}. \tag*{(30)} S m = L η sc u sc , S p = L g η sc 2 , S q = η sc u sc , S H = η sc , S W = u sc . (30)
Dividing a cell residual by ∣ K ∣ S |K|S ∣ K ∣ S compares it with the size of its constituent terms, uniformly over cells of different sizes. Denoting by { K i k } i = 1 N k \{K_i^k\}_{i=1}^{N_k} { K i k } i = 1 N k the cells of Ω k \Omega_k Ω k and by R Q m , R Q p \mathcal{R}_Q^m,\mathcal{R}_Q^p R Q m , R Q p the quadrature residuals of Definition 1, the objective is
L ( θ ) = L m + L p + λ I L I + λ B L B + λ P L P , (31) \mathcal{L}(\theta)=\mathcal{L}_m+\mathcal{L}_p+\lambda_I\mathcal{L}_I+\lambda_B\mathcal{L}_B+\lambda_P\mathcal{L}_P, \tag*{(31)} L ( θ ) = L m + L p + λ I L I + λ B L B + λ P L P , (31)
with
L m = 1 M + 1 ∑ k = 0 M 1 N k ∑ i = 1 N k ( R Q m ( K i k ) ∣ K i k ∣ S m ) 2 , L p = 1 M + 1 ∑ k = 0 M 1 N k ∑ i = 1 N k ( R Q p ( K i k ) ∣ K i k ∣ S p ) 2 , (32) \mathcal{L}_m=\frac{1}{M+1}\sum_{k=0}^{M}\frac{1}{N_k}\sum_{i=1}^{N_k}\left(\frac{\mathcal{R}_Q^m(K_i^k)}{|K_i^k|S_m}\right)^2,\qquad\mathcal{L}_p=\frac{1}{M+1}\sum_{k=0}^{M}\frac{1}{N_k}\sum_{i=1}^{N_k}\left(\frac{\mathcal{R}_Q^p(K_i^k)}{|K_i^k|S_p}\right)^2, \tag*{(32)} L m = M + 1 1 k = 0 ∑ M N k 1 i = 1 ∑ N k ( ∣ K i k ∣ S m R Q m ( K i k ) ) 2 , L p = M + 1 1 k = 0 ∑ M N k 1 i = 1 ∑ N k ( ∣ K i k ∣ S p R Q p ( K i k ) ) 2 , (32)
L I = ⟨ ( r q S q ) 2 ⟩ + ⟨ ( r H S H ) 2 ⟩ , L B = ∑ e n d s ⟨ r B 2 ⟩ . (33) \mathcal{L}_I=\left\langle\left(\frac{r_q}{S_q}\right)^2\right\rangle+\left\langle\left(\frac{r_H}{S_H}\right)^2\right\rangle,\qquad\mathcal{L}_B=\sum_{\mathrm{ends}}\left\langle r_B^2\right\rangle. \tag*{(33)} L I = ⟨ ( S q r q ) 2 ⟩ + ⟨ ( S H r H ) 2 ⟩ , L B = ends ∑ ⟨ r B 2 ⟩ . (33)
where ⟨ ⋅ ⟩ \langle\cdot\rangle ⟨ ⋅ ⟩ is the arithmetic mean over the corresponding node set and r B r_B r B is the boundary residual of Section 3.6, normalised by S W S_W S W for the transmissive and by S q S_q S q for the wall treatment. The well-balanced property, the interface closure and the boundary treatment are thus separate terms of one objective and can be modified independently. An entropy residual built on the classical energy–entropy pair [17 ] E = 1 2 q u + 1 2 g h 2 + g h b E=\frac{1}{2}qu+\frac{1}{2}gh^2+ghb E = 2 1 q u + 2 1 g h 2 + g hb , G = ( 1 2 q u + g h 2 + g h b ) u G=\left(\frac{1}{2}qu+gh^2+ghb\right)u G = ( 2 1 q u + g h 2 + g hb ) u is implemented but disabled throughout.
Theoretical analysis
This section establishes the properties on which the method rests. Section 4.1 identifies the source functional with the geometric source and characterises the zeros of the continuous residuals. Section 4.2 proves that the fully discrete residual annihilates the lake at rest under hypotheses weaker than those used to construct it, and deduces that the equilibrium is an exact global minimiser of the objective. Section 4.3 quantifies the perturbation introduced by the bed-slope correction, Section 4.4 proves that the sub-domain decomposition is necessary, and Section 4.5 records the reduction to the homogeneous formulation and the conservation properties. Section 4.6 discusses the limitations of the analysis and directions for future work.
The source pairing and consistency of the weak residual
For L ∞ L^\infty L ∞ data the traces in (20)–(22) exist, as limits of averages, for almost every K ∈ K k K \in\mathcal{K}_k K ∈ K k ; for the neural approximation (29) , which is continuous on Ω ‾ k T \overline{\Omega}_k^T Ω k T whenever ( η 0 , q 0 ) (\eta_0,q_0) ( η 0 , q 0 ) are continuous on Ω ‾ k \overline{\Omega}_k Ω k , they are then classical and every statement below holds for every K ∈ K k K \in\mathcal{K}_k K ∈ K k .
The next lemma is a direct consequence of the integration-by-parts formula for functions of bounded variation [60 Ch. 3] ; it identifies the functional (22) with the geometric source rather than with a substitute for it.
Lemma 3 (Source pairing). Let Assumption 1 hold, and let η ( ⋅ , t ) ∈ B V ( Ω k ) \eta(\cdot,t) \in BV(\Omega_k) η ( ⋅ , t ) ∈ B V ( Ω k ) for almost every t t t , with sup T T V ( η ( ⋅ , t ) ) < ∞ \sup_T TV(\eta(\cdot,t)) < \infty sup T T V ( η ( ⋅ , t )) < ∞ . Let K ∈ K k K \in\mathcal{K}_k K ∈ K k be such that, for almost every t ∈ [ t 1 , t 2 ] t \in[t_1,t_2] t ∈ [ t 1 , t 2 ] , x 1 x_1 x 1 and x 2 x_2 x 2 are points of approximate continuity of η ( ⋅ , t ) \eta(\cdot,t) η ( ⋅ , t ) . Then
S ( K ) = g ∫ t 1 t 2 ∫ [ x 1 , x 2 ] b ( x ) d ( D x η ( ⋅ , t ) ) ( x ) d t , (34) S(K) = g \int_{t_1}^{t_2} \int_{[x_1,x_2]} b(x)\,\mathrm{d}(D_x\eta(\cdot,t))(x)\,\mathrm{d}t, \tag*{(34)} S ( K ) = g ∫ t 1 t 2 ∫ [ x 1 , x 2 ] b ( x ) d ( D x η ( ⋅ , t )) ( x ) d t , (34) where D x η ( ⋅ , t ) D_x\eta(\cdot,t) D x η ( ⋅ , t ) is the distributional derivative of η ( ⋅ , t ) \eta(\cdot,t) η ( ⋅ , t ) , a finite Radon measure. In particular S ( K ) = ∫ K g b ∂ x η S(K) = \int_K g b \partial_x\eta S ( K ) = ∫ K g b ∂ x η whenever the latter is classically defined.
Proof. For fixed admissible t t t , the integration-by-parts formula for a B V BV B V function against b ∈ C 1 ( [ x 1 , x 2 ] ) b \in C^1([x_1,x_2]) b ∈ C 1 ([ x 1 , x 2 ]) [60 ] gives ∫ [ x 1 , x 2 ] b d ( D x η ( ⋅ , t ) ) = b ( x 2 ) η ( x 2 , t ) − b ( x 1 ) η ( x 1 , t ) − ∫ x 1 x 2 η b ′ d x \int_{[x_1,x_2]} b\,\mathrm{d}(D_x\eta(\cdot,t)) = b(x_2)\eta(x_2,t)-b(x_1)\eta(x_1,t)-\int_{x_1}^{x_2}\eta\,b'\,\mathrm{d}x ∫ [ x 1 , x 2 ] b d ( D x η ( ⋅ , t )) = b ( x 2 ) η ( x 2 , t ) − b ( x 1 ) η ( x 1 , t ) − ∫ x 1 x 2 η b ′ d x , the boundary terms being unambiguous at points of approximate continuity. The uniform total-variation bound makes the left-hand side bounded and measurable in t t t , and η b ′ ∈ L ∞ ( K ) \eta b' \in L^\infty(K) η b ′ ∈ L ∞ ( K ) justifies Fubini’s theorem for the last term; multiplying by g g g and integrating over [ t 1 , t 2 ] [t_1,t_2] [ t 1 , t 2 ] gives (34) .
For homogeneous conservation laws, the equivalence between the integral form (13) on rectangles and the distributional form is classical [61 , 58 ] . The next result extends it to (2) with the source in the form (22) , and licenses the use of (20)–(21) as a training residual. The proof follows the standard mollification argument; only the treatment of the source terms C C C and D D D below is specific to the present setting.
Proposition 1 (Consistency). Let Assumptions 1–2 hold. The following are equivalent:
(i) R m ( K ) = R p ( K ) = 0 \mathcal{R}^{\mathrm{m}}(K) = \mathcal{R}^{\mathrm{p}}(K) = 0 R m ( K ) = R p ( K ) = 0 for almost every K ∈ K k K \in\mathcal{K}_k K ∈ K k ;
(ii) for every φ ∈ C c 1 ( Ω k T ) \varphi\in C^1_c(\Omega_k^T) φ ∈ C c 1 ( Ω k T ) ,
∫ Ω k T ( η ∂ t φ + q ∂ x φ ) d x d t = 0 , (35) \int_{\Omega_k^T}(\eta\,\partial_t\varphi+ q\,\partial_x\varphi)\,\mathrm{d}x\,\mathrm{d}t = 0, \tag*{(35)} ∫ Ω k T ( η ∂ t φ + q ∂ x φ ) d x d t = 0 , (35) ∫ Ω k T ( q ∂ t φ + Φ ∂ x φ − g η ( b ∂ x φ + b ′ φ ) ) d x d t = 0. (36) \int_{\Omega_k^T}(q\,\partial_t\varphi+ \Phi\,\partial_x\varphi- g\eta(b\,\partial_x\varphi+ b'\varphi))\,\mathrm{d}x\,\mathrm{d}t = 0. \tag*{(36)} ∫ Ω k T ( q ∂ t φ + Φ ∂ x φ − g η ( b ∂ x φ + b ′ φ )) d x d t = 0. (36)
Identities (35)–(36) state that ( η , q ) (\eta,q) ( η , q ) solves (2) in D ′ ( Ω k T ) \mathcal{D}'(\Omega_k^T) D ′ ( Ω k T ) , the source being understood through the Leibniz identity g b ∂ x η = ∂ x ( g b η ) − g η b ′ g b \partial_x\eta= \partial_x(g b\eta) - g\eta b' g b ∂ x η = ∂ x ( g b η ) − g η b ′ , valid in D ′ ( Ω k T ) \mathcal{D}'(\Omega_k^T) D ′ ( Ω k T ) because b ∈ C 1 b \in C^1 b ∈ C 1 . If moreover ( η , q ) ∈ C ( Ω k T ‾ ) (\eta,q) \in C(\overline{\Omega_k^T}) ( η , q ) ∈ C ( Ω k T ) , “almost every” in (i) may be replaced by “every”.
Proof. Set A : = q A := q A := q , B : = Φ B := \Phi B := Φ , C : = g b η C := g b\eta C := g b η and D : = g η b ′ D := g\eta b' D := g η b ′ , all in L ∞ ( Ω k T ) L^\infty(\Omega_k^T) L ∞ ( Ω k T ) . By (21)–(22),
R p ( K ) = ∫ x 1 x 2 [ A ( x , t 2 ) − A ( x , t 1 ) ] d x + ∫ t 1 t 2 [ ( B − C ) ( x 2 , t ) − ( B − C ) ( x 1 , t ) ] d t + ∫ K D . (37) \mathcal{R}^{\mathrm{p}}(K) = \int_{x_1}^{x_2}[A(x,t_2)-A(x,t_1)]\,\mathrm{d}x + \int_{t_1}^{t_2}[(B-C)(x_2,t)-(B-C)(x_1,t)]\,\mathrm{d}t + \int_K D. \tag*{(37)} R p ( K ) = ∫ x 1 x 2 [ A ( x , t 2 ) − A ( x , t 1 )] d x + ∫ t 1 t 2 [( B − C ) ( x 2 , t ) − ( B − C ) ( x 1 , t )] d t + ∫ K D . (37)
Let ρ ε \rho_\varepsilon ρ ε be a standard mollifier supported in the ball of radius ε \varepsilon ε , write f ε : = f ∗ ρ ε f_\varepsilon:= f * \rho_\varepsilon f ε := f ∗ ρ ε , let ω ⊂ Ω k T \omega\subset\Omega_k^T ω ⊂ Ω k T with dist ( ω , ∂ Ω k T ) > ε \operatorname{dist}(\omega,\partial\Omega_k^T) > \varepsilon dist ( ω , ∂ Ω k T ) > ε , and denote by R ε m ( K ) , R ε p ( K ) \mathcal{R}^{\mathrm{m}}_\varepsilon(K), \mathcal{R}^{\mathrm{p}}_\varepsilon(K) R ε m ( K ) , R ε p ( K ) the residuals formed with the mollified functions for K ⊂ ω K \subset\omega K ⊂ ω .
( i ) ⇒ ( i i ) (i)\Rightarrow(ii) ( i ) ⇒ ( ii ) . Every term of (20) and (37) is an integral over a face of K K K or over K K K , so by Fubini’s theorem R ε m ( K ) = ∫ ρ ε ( z ) R m ( K − z ) d z \mathcal{R}^{\mathrm{m}}_\varepsilon(K) = \int\rho_\varepsilon(z)\mathcal{R}^{\mathrm{m}}(K-z)\,\mathrm{d}z R ε m ( K ) = ∫ ρ ε ( z ) R m ( K − z ) d z , and likewise for R p \mathcal{R}^{\mathrm{p}} R p . Translations preserve Lebesgue measure on the parameter space, so by (i) and Fubini’s theorem on the product set { ( K , z ) : R m ( K − z ) ≠ 0 } \{(K,z): \mathcal{R}^{\mathrm{m}}(K-z) \ne0\} {( K , z ) : R m ( K − z ) = 0 } , for almost every K K K one has R m ( K − z ) = 0 \mathcal{R}^{m}(K-z)=0 R m ( K − z ) = 0 for almost every z z z ; hence R m ( K ) = R p ( K ) = 0 \mathcal{R}^{m}(K)=\mathcal{R}^{p}(K)=0 R m ( K ) = R p ( K ) = 0 for almost every, and by continuity in the parameters for every, K ⊂ ω K\subset\omega K ⊂ ω . The mollified functions are smooth, so the fundamental theorem of calculus turns these identities into ∫ K ( ∂ t η ε + ∂ x q ε ) = 0 \int_K(\partial_t\eta_\varepsilon+\partial_xq_\varepsilon)=0 ∫ K ( ∂ t η ε + ∂ x q ε ) = 0 and ∫ K ( ∂ t A ε + ∂ x ( B ε − C ε ) + D ε ) = 0 \int_K(\partial_tA_\varepsilon+\partial_x(B_\varepsilon-C_\varepsilon)+D_\varepsilon)=0 ∫ K ( ∂ t A ε + ∂ x ( B ε − C ε ) + D ε ) = 0 for every rectangle K ⊂ ω K\subset\omega K ⊂ ω ; continuous integrands with vanishing integrals over all rectangles vanish identically, so
∂ t η ε + ∂ x q ε = 0 , ∂ t A ε + ∂ x ( B ε − C ε ) + D ε = 0 on ω . (38) \partial_t\eta_\varepsilon+\partial_xq_\varepsilon=0,\qquad\partial_tA_\varepsilon+\partial_x(B_\varepsilon-C_\varepsilon)+D_\varepsilon=0\qquad\text{on }\omega. \tag*{(38)} ∂ t η ε + ∂ x q ε = 0 , ∂ t A ε + ∂ x ( B ε − C ε ) + D ε = 0 on ω . (38)
Multiplying by φ ∈ C c 1 ( Ω k T ) \varphi\in C^1_c(\Omega^T_k) φ ∈ C c 1 ( Ω k T ) with supp φ ⊂ ω \operatorname{supp}\varphi\subset\omega supp φ ⊂ ω , integrating by parts and letting ε → 0 \varepsilon\to0 ε → 0 , using f ε → f f_\varepsilon\to f f ε → f in L l o c 1 L^1_{\mathrm{loc}} L loc 1 , gives (35)–(36).
(ii)⇒(i). Convolution commutes with constant-coefficient derivatives, so (ii) implies (38) on ω \omega ω , and integration over rectangles gives R ε m ( K ) = R ε p ( K ) = 0 \mathcal{R}^{m}_\varepsilon(K)=\mathcal{R}^{p}_\varepsilon(K)=0 R ε m ( K ) = R ε p ( K ) = 0 for every K ⊂ ω K\subset\omega K ⊂ ω . For f ∈ L ∞ ( Ω k T ) f\in L^\infty(\Omega^T_k) f ∈ L ∞ ( Ω k T ) , Fubini’s theorem and f ε → f f_\varepsilon\to f f ε → f in L 1 ( ω ) L^1(\omega) L 1 ( ω ) give, along a subsequence ε j → 0 \varepsilon_j\to0 ε j → 0 , convergence of the horizontal face integrals for almost every ( t 1 , t 2 ) (t_1,t_2) ( t 1 , t 2 ) and of the vertical ones for almost every ( x 1 , x 2 ) (x_1,x_2) ( x 1 , x 2 ) , while ∫ K D ε j → ∫ K D \int_KD_{\varepsilon_j}\to\int_KD ∫ K D ε j → ∫ K D for every K K K . Applying this to f ∈ { η , q , A , B − C } f\in\{\eta,q,A,B-C\} f ∈ { η , q , A , B − C } yields R m ( K ) = R p ( K ) = 0 \mathcal{R}^{m}(K)=\mathcal{R}^{p}(K)=0 R m ( K ) = R p ( K ) = 0 for almost every K ⊂ ω K\subset\omega K ⊂ ω , and exhausting Ω k T \Omega^T_k Ω k T by such ω \omega ω gives (i). If ( η , q ) (\eta,q) ( η , q ) , hence Φ \Phi Φ , are continuous on Ω k T \Omega^T_k Ω k T , both residuals are continuous in the parameters, and vanishing almost everywhere implies vanishing everywhere.
Proposition 1 concerns the continuous residual on the whole family K k \mathcal{K}_k K k , whereas (31) involves finitely many control volumes and a quadrature rule; it is a consistency statement, and a zero of L \mathcal{L} L is not by itself a weak solution. Two errors separate the two levels. The first is a sampling error, arising from the finiteness of the family and from incomplete coverage of Ω k T \Omega^T_k Ω k T . The second is a quadrature error, governed by the regularity of the integrand on each face. On a lateral face the integrand t ↦ Φ ( x j , t ) t\mapsto\Phi(x_j,t) t ↦ Φ ( x j , t ) is discontinuous whenever a wave of speed s s s crosses the cell, that is whenever
s Δ t Δ x ≳ 1 , (39) \frac{s\Delta t}{\Delta x}\gtrsim1, \tag*{(39)} Δ x s Δ t ≳ 1 , (39)
and, as is well known [62 ] , the Gauss–Legendre rule then converges at a rate governed by the discontinuity rather than by Q Q Q . The minimiser of the discrete objective is the network whose quadrature-visible residual vanishes, which need not resolve the discontinuity; this mechanism predicts a smearing of fast shocks that correlates with s max h t / h x s_{\max}h_t/h_x s m a x h t / h x and is absent when the lateral integrands are Lipschitz, as for rarefactions.
Exact preservation of the lake at rest
Definition 1 (Discrete residuals). Let K ∈ K k K\in\mathcal{K}_k K ∈ K k , Q ≥ 1 Q\geq1 Q ≥ 1 , and let β = ( β 1 , … , β Q ) ∈ R Q \beta=(\beta_1,\ldots,\beta_Q)\in\mathbb{R}^Q β = ( β 1 , … , β Q ) ∈ R Q be a nominal bed slope at the nodes x p x_p x p . Set
G Q ( K ; β ) : = Δ x 2 ∑ p = 1 Q w p β p , β ~ p : = β p + ( b ( x 2 ) − b ( x 1 ) ) − G Q ( K ; β ) Δ x , (40) G_Q(K;\beta):=\frac{\Delta x}{2}\sum_{p=1}^{Q}w_p\beta_p,\qquad\widetilde{\beta}_p:=\beta_p+\frac{(b(x_2)-b(x_1))-G_Q(K;\beta)}{\Delta x}, \tag*{(40)} G Q ( K ; β ) := 2 Δ x p = 1 ∑ Q w p β p , β p := β p + Δ x ( b ( x 2 ) − b ( x 1 )) − G Q ( K ; β ) , (40) and define
R Q m ( K ) : = Δ x 2 ∑ p w p [ η ( x p , t 2 ) − η ( x p , t 1 ) ] + Δ t 2 ∑ p w p [ q ( x 2 , t p ) − q ( x 1 , t p ) ] , (41) \mathcal{R}^{m}_Q(K):=\frac{\Delta x}{2}\sum_p w_p\left[\eta(x_p,t_2)-\eta(x_p,t_1)\right]+\frac{\Delta t}{2}\sum_p w_p\left[q(x_2,t_p)-q(x_1,t_p)\right], \tag*{(41)} R Q m ( K ) := 2 Δ x p ∑ w p [ η ( x p , t 2 ) − η ( x p , t 1 ) ] + 2 Δ t p ∑ w p [ q ( x 2 , t p ) − q ( x 1 , t p ) ] , (41) S Q ( K ) : = g Δ t 2 ∑ p w p [ b ( x 2 ) η ( x 2 , t p ) − b ( x 1 ) η ( x 1 , t p ) ] − g Δ x Δ t 4 ∑ p , r w p w r η ( x p , t r ) β ~ p , (42) \mathcal{S}_Q(K):=\frac{g\Delta t}{2}\sum_p w_p\left[b(x_2)\eta(x_2,t_p)-b(x_1)\eta(x_1,t_p)\right]-\frac{g\Delta x\Delta t}{4}\sum_{p,r}w_pw_r\eta(x_p,t_r)\widetilde{\beta}_p, \tag*{(42)} S Q ( K ) := 2 g Δ t p ∑ w p [ b ( x 2 ) η ( x 2 , t p ) − b ( x 1 ) η ( x 1 , t p ) ] − 4 g Δ x Δ t p , r ∑ w p w r η ( x p , t r ) β p , (42) R Q p ( K ) : = Δ x 2 ∑ p w p [ q ( x p , t 2 ) − q ( x p , t 1 ) ] + Δ t 2 ∑ p w p [ Φ ( x 2 , t p ) − Φ ( x 1 , t p ) ] − S Q ( K ) . (43) \mathcal{R}^{p}_Q(K):=\frac{\Delta x}{2}\sum_p w_p\left[q(x_p,t_2)-q(x_p,t_1)\right]+\frac{\Delta t}{2}\sum_p w_p\left[\Phi(x_2,t_p)-\Phi(x_1,t_p)\right]-\mathcal{S}_Q(K). \tag*{(43)} R Q p ( K ) := 2 Δ x p ∑ w p [ q ( x p , t 2 ) − q ( x p , t 1 ) ] + 2 Δ t p ∑ w p [ Φ ( x 2 , t p ) − Φ ( x 1 , t p ) ] − S Q ( K ) . (43) If the sub-domain carrying K K K is flagged constant-bed, the double sum in (42) is omitted.
Definition 1 is (23)–(24) with the nominal slope left unspecified: β \beta β is not required to approximate b ′ b' b ′ .
Lemma 4 (Exactness of the corrected quadrature). For every K ∈ K k K \in\mathcal{K}_k K ∈ K k , every Q ≥ 1 Q \ge1 Q ≥ 1 and every β ∈ R Q \beta\in\mathbb{R}^Q β ∈ R Q ,
Δ x 2 ∑ p = 1 Q w p β ~ p = b ( x 2 ) − b ( x 1 ) . (44) \frac{\Delta x}{2}\sum_{p=1}^{Q}w_p\widetilde{\beta}_p=b(x_2)-b(x_1). \tag*{(44)} 2 Δ x p = 1 ∑ Q w p β p = b ( x 2 ) − b ( x 1 ) . (44) Proof. By (40) and (12) , Δ x 2 ∑ p w p β ~ p = G Q ( K ; β ) + [ ( b ( x 2 ) − b ( x 1 ) ) − G Q ( K ; β ) ] 1 ∑ p w p ∑ p w p = b ( x 2 ) − b ( x 1 ) \frac{\Delta x}{2}\sum_p w_p\widetilde{\beta}_p=G_Q(K;\beta)+\left[(b(x_2)-b(x_1))-G_Q(K;\beta)\right]\frac{1}{\sum_p w_p}\sum_p w_p=b(x_2)-b(x_1) 2 Δ x ∑ p w p β p = G Q ( K ; β ) + [ ( b ( x 2 ) − b ( x 1 )) − G Q ( K ; β ) ] ∑ p w p 1 ∑ p w p = b ( x 2 ) − b ( x 1 ) . ∎
Theorem 1 (Exact discrete C C C -property). Let K K K be a space–time rectangle, Q ≥ 1 Q \ge1 Q ≥ 1 , and β ∈ R Q \beta\in\mathbb{R}^Q β ∈ R Q arbitrary. Let η ⋆ ∈ R \eta^\star\in\mathbb{R} η ⋆ ∈ R and assume that on K ‾ \overline{K} K
η ≡ η ⋆ , q ≡ 0 , η ⋆ − max K ‾ b ≥ h min . \eta\equiv\eta^\star,\qquad q \equiv0,\qquad\eta^\star-\max_{\overline{K}}b \ge h_{\min}. η ≡ η ⋆ , q ≡ 0 , η ⋆ − K max b ≥ h m i n . Then, in exact arithmetic, R Q m ( K ) = 0 R_Q^m(K)=0 R Q m ( K ) = 0 and R Q p ( K ) = 0 R_Q^p(K)=0 R Q p ( K ) = 0 . The conclusion holds whether or not b b b is continuous on K K K , whether or not β \beta β approximates b ′ b' b ′ , and for every control-volume family; the only quantities of the bathymetry that enter are b ( x 1 ) b(x_1) b ( x 1 ) and b ( x 2 ) b(x_2) b ( x 2 ) .
Proof. Mass residual. Since η \eta η is constant and q ≡ 0 q\equiv0 q ≡ 0 on K ‾ \overline{K} K , both sums of (41) vanish term by term, so R Q m ( K ) = 0 R_Q^m(K)=0 R Q m ( K ) = 0 .
Momentum residual, conservative part. The first sum of (43) vanishes because q ≡ 0 q\equiv0 q ≡ 0 . The hypothesis η ⋆ − max K ‾ b ≥ h min \eta^\star-\max_{\overline{K}}b\ge h_{\min} η ⋆ − max K b ≥ h m i n gives h δ = h ≥ h min > 0 h_\delta=h\ge h_{\min}>0 h δ = h ≥ h m i n > 0 , so Φ = q 2 / h + 1 2 g η 2 = 1 2 g ( η ⋆ ) 2 \Phi=q^2/h+\frac{1}{2}g\eta^2=\frac{1}{2}g(\eta^\star)^2 Φ = q 2 / h + 2 1 g η 2 = 2 1 g ( η ⋆ ) 2 at every node, a value independent of x x x and t t t , and the second sum vanishes term by term.
Source. Substituting η ≡ η ⋆ \eta\equiv\eta^\star η ≡ η ⋆ in (42) and using (12) twice,
S Q ( K ) = g η ⋆ Δ t ( b ( x 2 ) − b ( x 1 ) ) − g η ⋆ Δ t Δ x 2 ∑ p w p β ~ p , S_Q(K)=g\eta^\star\Delta t\left(b(x_2)-b(x_1)\right)-g\eta^\star\Delta t\frac{\Delta x}{2}\sum_p w_p\widetilde{\beta}_p, S Q ( K ) = g η ⋆ Δ t ( b ( x 2 ) − b ( x 1 ) ) − g η ⋆ Δ t 2 Δ x p ∑ w p β p , and the two terms coincide by Lemma 4. If the sub-domain is flagged constant-bed, the double sum is omitted and b ( x 1 ) = b ( x 2 ) b(x_1)=b(x_2) b ( x 1 ) = b ( x 2 ) , so the remaining face term vanishes. Hence S Q ( K ) = 0 S_Q(K)=0 S Q ( K ) = 0 and R Q p ( K ) = 0 R_Q^p(K)=0 R Q p ( K ) = 0 . ∎
Theorem 1 concerns a single control volume. Assembling it over the family gives a statement about the objective.
Lemma 5 (Exact representability of the equilibrium). Let η 0 = η ⋆ \eta_0=\eta^\star η 0 = η ⋆ and u 0 = 0 u_0=0 u 0 = 0 . There exists θ ⋆ \theta^\star θ ⋆ such that η θ ⋆ = η ⋆ \eta\theta^\star=\eta^\star η θ ⋆ = η ⋆ and q θ ⋆ = 0 q_{\theta^\star}=0 q θ ⋆ = 0 on Ω ‾ \overline{\Omega} Ω .
Proof. The argument is elementary. The last layer of each sub-domain network is affine, N θ k = W L σ ( ⋯ ) + c L N_{\theta_k}=W_L\sigma(\cdots)+c_L N θ k = W L σ ( ⋯ ) + c L . Choosing W L = 0 W_L=0 W L = 0 and c L = ( η ⋆ , 0 ) T c_L=(\eta^\star,0)^\mathsf{T} c L = ( η ⋆ , 0 ) T in every sub-domain gives N θ ⋆ = ( η ⋆ , 0 ) N_{\theta^\star}=(\eta^\star,0) N θ ⋆ = ( η ⋆ , 0 ) , irrespective of the hidden parameters, and (29) returns ( 1 − τ ) η ⋆ + τ η ⋆ = η ⋆ (1-\tau)\eta^\star+\tau\eta^\star=\eta^\star ( 1 − τ ) η ⋆ + τ η ⋆ = η ⋆ and 0 0 0 for every ( x , t ) (x,t) ( x , t ) . ∎
Corollary 1 (The equilibrium is an exact global minimiser). Let η 0 ≡ η ⋆ \eta_0 \equiv\eta^\star η 0 ≡ η ⋆ and u 0 ≡ 0 u_0 \equiv0 u 0 ≡ 0 with η ⋆ − max Ω x b ≥ h s a f e ≥ h min \eta^\star-\max_{\Omega_x} b \ge h_{\mathrm{safe}} \ge h_{\min} η ⋆ − max Ω x b ≥ h safe ≥ h m i n , and let θ ⋆ \theta^\star θ ⋆ be as in Lemma 5 . Then, for both the transmissive and the wall boundary treatment,
L ( θ ⋆ ) = 0 = min θ L ( θ ) . \mathcal{L}(\theta^\star)=0=\min_{\theta}\mathcal{L}(\theta). L ( θ ⋆ ) = 0 = θ min L ( θ ) . Proof. L m \mathcal{L}_{\mathrm{m}} L m and L p \mathcal{L}_{\mathrm{p}} L p vanish by Theorem 1 applied to each K i k K_i^k K i k . At every interface q − = q + = 0 q_-=q_+=0 q − = q + = 0 and η − = η + = η ⋆ \eta_-=\eta_+=\eta^\star η − = η + = η ⋆ , hence u ∓ = 0 u_\mp=0 u ∓ = 0 and r q = r H = 0 r_q=r_H=0 r q = r H = 0 by (26), whatever τ \tau τ . The barrier is inactive since h = η ⋆ b ≥ h s a f e h=\eta^\star b\ge h_{\mathrm{safe}} h = η ⋆ b ≥ h safe . For the wall treatment the boundary residual is q / S q = 0 q/S_q=0 q / S q = 0 ; for the transmissive treatment W L = 2 g ( η ⋆ − b ( x L ) ) = ( u + 2 g h ) ∣ x L W_L=2\sqrt{g(\eta^\star-b(x_L))}=(u+2\sqrt{gh})|_{x_L} W L = 2 g ( η ⋆ − b ( x L )) = ( u + 2 g h ) ∣ x L for all t t t , and symmetrically at x R x_R x R . Hence L ( θ ⋆ ) = 0 \mathcal{L}(\theta^\star)=0 L ( θ ⋆ ) = 0 , and L ≥ 0 \mathcal{L}\ge0 L ≥ 0 as a finite sum of squares and one-sided squares.
Corollary 1 is the variational counterpart of the C C C -property of a finite-volume scheme, and the analogy must be read precisely. In a finite-volume scheme the equilibrium is a fixed point of the update map and is preserved for all time by the algorithm itself. Here it is a global minimiser of the objective lying in the range of the parameterisation, but the training algorithm is not guaranteed to reach it. The deviation of a trained network from the lake at rest is therefore an optimisation error, not a discretisation error: it is controlled by no discretisation parameter, and further optimisation reduces it without the construction ever eliminating it. Uniqueness is not claimed: the zero set of L \mathcal{L} L contains at least the family obtained by varying the hidden parameters in Lemma 5 .
In finite precision the statement degrades in a way that is itself a diagnostic. The following proposition is an application of the standard rounding-error analysis of sums and inner products [63 ] to the residual of Definition 1.
Proposition 2 (Floating-point behaviour). Adopt the standard model of floating-point arithmetic [63 ] with unit round-off u u u and γ n : = n u / ( 1 − n u ) \gamma_n:=nu/(1-nu) γ n := n u / ( 1 − n u ) . Evaluate R Q m ( K ) R_Q^{\mathrm{m}}(K) R Q m ( K ) and R_Q^{\mathrm{p}}(K) at the state of Theorem 1, using the same stored values of b(x_1)$ and b ( x 2 ) b(x_2) b ( x 2 ) in the face term of (42) and in the shift (40), and let n Q = O ( Q 2 ) n_Q=O(Q^2) n Q = O ( Q 2 ) be the number of operations required by (42). Then
fl ( R Q m ( K ) ) = 0 , ∣ fl ( R Q p ( K ) ) ∣ ≤ γ c n Q g ∣ η ⋆ ∣ Δ t ( ∣ b ( x 1 ) ∣ + ∣ b ( x 2 ) ∣ + Δ x max p ∣ β p ∣ ) + O ( u 2 ) , (45) \operatorname{fl}\left(R_Q^{\mathrm{m}}(K)\right)=0,\qquad
\left|\operatorname{fl}\left(R_Q^{\mathrm{p}}(K)\right)\right|
\le\gamma_{c n_Q}g|\eta^\star|\Delta t\left(|b(x_1)|+|b(x_2)|+\Delta x\max_p|\beta_p|\right)+O(u^2), \tag*{(45)} fl ( R Q m ( K ) ) = 0 , fl ( R Q p ( K ) ) ≤ γ c n Q g ∣ η ⋆ ∣Δ t ( ∣ b ( x 1 ) ∣ + ∣ b ( x 2 ) ∣ + Δ x p max ∣ β p ∣ ) + O ( u 2 ) , (45) where c c c is a small absolute constant, and fl ( R Q p ( K ) ) = 0 \operatorname{fl}\left(R_Q^{\mathrm{p}}(K)\right)=0 fl ( R Q p ( K ) ) = 0 exactly on a constant-bed sub-domain.
Proof. Every term of (41) and of the two sums in (43) is a difference of identical stored values: q 2 / h δ q^2/h_\delta q 2 / h δ evaluates to 0 0 0 exactly whatever h δ h_\delta h δ , so Φ \Phi Φ evaluates to the single stored value fl ( 1 2 g ( η ⋆ ) 2 ) \operatorname{fl}\left(\frac{1}{2}g(\eta^\star)^2\right) fl ( 2 1 g ( η ⋆ ) 2 ) at every node. Hence fl ( R Q m ( K ) ) = 0 \operatorname{fl}(R_Q^{\mathrm{m}}(K))=0 fl ( R Q m ( K )) = 0 and fl ( R Q p ( K ) ) = − fl ( S Q ( K ) ) \operatorname{fl}(R_Q^{\mathrm{p}}(K))=-\operatorname{fl}(S_Q(K)) fl ( R Q p ( K )) = − fl ( S Q ( K )) . Write S Q ( K ) = T 1 − T 2 S_Q(K)=T_1-T_2 S Q ( K ) = T 1 − T 2 for the face and volume terms; in exact arithmetic T 1 = T 2 = g η ⋆ Δ t ( b ( x 2 ) − b ( x 1 ) ) T_1=T_2=g\eta^\star\Delta t\left(b(x_2)-b(x_1)\right) T 1 = T 2 = g η ⋆ Δ t ( b ( x 2 ) − b ( x 1 ) ) . Because T 1 T_1 T 1 and T 2 T_2 T 2 are differences of nearly equal products, no relative bound on fl ( T j ) \operatorname{fl}(T_j) fl ( T j ) is available; the rounding error is instead controlled by the absolute values of the summands. Each T j T_j T j is a sum of at most n Q n_Q n Q rounded products x i ( j ) x_i^{(j)} x i ( j ) , so that ∣ fl ( T j ) − T j ∣ ≤ γ n Q ∑ i ∣ x i ( j ) ∣ |\operatorname{fl}(T_j)-T_j|\le\gamma_{n_Q}\sum_i|x_i^{(j)}| ∣ fl ( T j ) − T j ∣ ≤ γ n Q ∑ i ∣ x i ( j ) ∣ [63 Ch. 3] . By (12), ∑ i ∣ x i ( 1 ) ∣ ≤ g ∣ η ⋆ ∣ Δ t ( ∣ b ( x 1 ) ∣ + ∣ b ( x 2 ) ∣ ) \sum_i|x_i^{(1)}|\le g|\eta^\star|\Delta t\left(|b(x_1)|+|b(x_2)|\right) ∑ i ∣ x i ( 1 ) ∣ ≤ g ∣ η ⋆ ∣Δ t ( ∣ b ( x 1 ) ∣ + ∣ b ( x 2 ) ∣ ) for the face term and ∑ i ∣ x i ( 2 ) ∣ ≤ g ∣ η ⋆ ∣ Δ t Δ x max p ∣ β p ∣ \sum_i|x_i^{(2)}|\le g|\eta^\star|\Delta t\Delta x\max_p|\beta_p| ∑ i ∣ x i ( 2 ) ∣ ≤ g ∣ η ⋆ ∣Δ t Δ x max p ∣ β p ∣ for the volume term. Forming the shift (40) perturbs each β p \beta_p β p by at most γ c Q ( 2 max p ∣ β p ∣ + ( ∣ b ( x 1 ) ∣ + ∣ b ( x 2 ) ∣ ) / Δ x ) \gamma_{cQ}\left(2\max_p|\beta_p|+\left(|b(x_1)|+|b(x_2)|\right)/\Delta x\right) γ c Q ( 2 max p ∣ β p ∣ + ( ∣ b ( x 1 ) ∣ + ∣ b ( x 2 ) ∣ ) /Δ x ) , and the stored weights satisfy ∑ p ( w p ) = 2 ( 1 + θ ) \sum_p(w_p)=2(1+\theta) ∑ p ( w p ) = 2 ( 1 + θ ) with ∣ θ ∣ ≤ Q |\theta|\le Q ∣ θ ∣ ≤ Q , which perturbs the identity of Lemma 4 by at most ∣ θ ∣ ( ∣ b ( x 1 ) ∣ + ∣ b ( x 2 ) ∣ + Δ x max p ∣ β p ∣ ) |\theta|\left(|b(x_1)|+|b(x_2)|+\Delta x\max_p|\beta_p|\right) ∣ θ ∣ ( ∣ b ( x 1 ) ∣ + ∣ b ( x 2 ) ∣ + Δ x max p ∣ β p ∣ ) . Since T 1 = T 2 T_1=T_2 T 1 = T 2 in exact arithmetic, the final subtraction adds only a factor 1 + ε 1+\varepsilon 1 + ε , ∣ ε ∣ ≤ u |\varepsilon|\le u ∣ ε ∣ ≤ u , and summing these contributions with Δ x max p ∣ β p ∣ ≤ 2 Δ x max p ∣ β p ∣ + ∣ b ( x 1 ) ∣ + ∣ b ( x 2 ) ∣ \Delta x\max_p|\beta_p|\le2\Delta x\max_p|\beta_p|+|b(x_1)|+|b(x_2)| Δ x max p ∣ β p ∣ ≤ 2Δ x max p ∣ β p ∣ + ∣ b ( x 1 ) ∣ + ∣ b ( x 2 ) ∣ gives (45). On a constant-bed sub-domain the double sum is not assembled and b ( x 1 ) , b ( x 2 ) b(x_1),b(x_2) b ( x 1 ) , b ( x 2 ) are the same stored number, so the face term is a difference of identical partial sums and fl ( S Q ( K ) ) = 0 \operatorname{fl}(S_Q(K))=0 fl ( S Q ( K )) = 0 .
Dividing (45) by ∣ K ∣ |K| ∣ K ∣ shows that the residual density at the equilibrium is bounded by γ c n Q g ∣ η ⋆ ∣ ( ∣ b ( x 1 ) ∣ + ∣ b ( x 2 ) ∣ + Δ x max p ∣ β p ∣ ) / Δ x \gamma_{c n_Q}g|\eta^\star|\left(|b(x_1)|+|b(x_2)|+\Delta x\max_p|\beta_p|\right)/\Delta x γ c n Q g ∣ η ⋆ ∣ ( ∣ b ( x 1 ) ∣ + ∣ b ( x 2 ) ∣ + Δ x max p ∣ β p ∣ ) /Δ x : it grows linearly in ∣ η ⋆ ∣ |\eta^\star| ∣ η ⋆ ∣ , scales with the unit round-off and grows like Δ x − 1 \Delta x^{-1} Δ x − 1 under refinement, while on a piecewise-constant bed the residual itself vanishes exactly, by the last statement of the proposition. The dependence on ∣ η ⋆ ∣ |\eta^\star| ∣ η ⋆ ∣ alone does not discriminate, since an unbalanced truncation error g η ⋆ Δ t [ ( b ( x 2 ) − b ( x 1 ) ) − G Q ] g\eta^\star\Delta t\left[(b(x_2)-b(x_1))-G_Q\right] g η ⋆ Δ t [ ( b ( x 2 ) − b ( x 1 )) − G Q ] is also linear in η ⋆ \eta^\star η ⋆ ; but such an error does not depend on the arithmetic. A measured residual that falls by u 64 / u 32 ≈ 1.86 × 10 − 9 u_{64}/u_{32}\approx1.86\times10^{-9} u 64 / u 32 ≈ 1.86 × 1 0 − 9 when the precision is raised is therefore a round-off floor, not an imbalance.
Consistency of the bed-slope correction
Theorem 1 says nothing about the size of the perturbation introduced by (40) away from equilibrium. The next two results show that it is of the order of the quadrature error already committed. Both rest on the classical Gauss–Legendre error formula [62 Sec. 2.7] : for f ∈ C 2 Q ( [ x 1 , x 2 ] ) f \in C^{2Q}([x_{1},x_{2}]) f ∈ C 2 Q ([ x 1 , x 2 ]) ,
∫ x 1 x 2 f − Δ x 2 ∑ p = 1 Q w p f ( x p ) = C Q Δ x 2 Q + 1 f ( 2 Q ) ( ζ ) , C Q = ( Q ! ) 4 ( 2 Q + 1 ) [ ( 2 Q ) ! ] 3 , (46) \int_{x_{1}}^{x_{2}} f-\frac{\Delta x}{2}\sum_{p=1}^{Q}w_{p}f(x_{p})=C_{Q}\Delta x^{2Q+1}f^{(2Q)}(\zeta),\qquad C_{Q}=\frac{(Q!)^{4}}{(2Q+1)[(2Q)!]^{3}}, \tag*{(46)} ∫ x 1 x 2 f − 2 Δ x p = 1 ∑ Q w p f ( x p ) = C Q Δ x 2 Q + 1 f ( 2 Q ) ( ζ ) , C Q = ( 2 Q + 1 ) [( 2 Q )! ] 3 ( Q ! ) 4 , (46)
for some ζ ∈ ( x 1 , x 2 ) \zeta\in(x_{1},x_{2}) ζ ∈ ( x 1 , x 2 ) .
Proposition 3 (Order of the shift). Let K ∈ K k K \in\mathcal{K}_{k} K ∈ K k and let δ K : = [ ( b ( x 2 ) − b ( x 1 ) ) − G Q ( K ; β ) ] / Δ x \delta_{K}:=[(b(x_{2})-b(x_{1}))-G_{Q}(K;\beta)]/\Delta x δ K := [( b ( x 2 ) − b ( x 1 )) − G Q ( K ; β )] /Δ x be the constant shift of (40) .
(i) If b ∈ C 2 Q + 1 ( [ x 1 , x 2 ] ) b \in C^{2Q+1}([x_{1},x_{2}]) b ∈ C 2 Q + 1 ([ x 1 , x 2 ]) and β p = b ′ ( x p ) \beta_{p}=b'(x_{p}) β p = b ′ ( x p ) , then
∣ δ K ∣ ≤ C Q Δ x 2 Q sup [ x 1 , x 2 ] ∣ b ( 2 Q + 1 ) ∣ , (47) |\delta_{K}|\leq C_{Q}\Delta x^{2Q}\sup_{[x_{1},x_{2}]}|b^{(2Q+1)}|, \tag*{(47)} ∣ δ K ∣ ≤ C Q Δ x 2 Q [ x 1 , x 2 ] sup ∣ b ( 2 Q + 1 ) ∣ , (47) (ii) If b b b is Lipschitz on [ x 1 , x 2 ] [x_{1},x_{2}] [ x 1 , x 2 ] with constant L b L_{b} L b and ∣ β p ∣ ≤ L b |\beta_{p}|\leq L_{b} ∣ β p ∣ ≤ L b for every p p p , then ∣ δ K ∣ ≤ 2 L b |\delta_{K}|\leq2L_{b} ∣ δ K ∣ ≤ 2 L b .
(iii) If b = b L i p + J 1 [ x ∗ , x 2 ] b=b_{\mathrm{Lip}}+J\,1_{[x_{*},x_{2}]} b = b Lip + J 1 [ x ∗ , x 2 ] on [ x 1 , x 2 ] [x_{1},x_{2}] [ x 1 , x 2 ] for some x ∗ ∈ ( x 1 , x 2 ) x_{*}\in(x_{1},x_{2}) x ∗ ∈ ( x 1 , x 2 ) and J ≠ 0 J\ne0 J = 0 , with b L i p b_{\mathrm{Lip}} b Lip Lipschitz of constant L b L_{b} L b and ∣ β p ∣ ≤ L b |\beta_{p}|\leq L_{b} ∣ β p ∣ ≤ L b , then
∣ J ∣ − 2 L b Δ x Δ x ≤ ∣ δ K ∣ ≤ ∣ J ∣ + 2 L b Δ x Δ x , (48) \frac{|J|-2L_{b}\Delta x}{\Delta x}\leq|\delta_{K}|\leq\frac{|J|+2L_{b}\Delta x}{\Delta x}, \tag*{(48)} Δ x ∣ J ∣ − 2 L b Δ x ≤ ∣ δ K ∣ ≤ Δ x ∣ J ∣ + 2 L b Δ x , (48) so that δ K = J / Δ x + O ( 1 ) \delta_{K}=J/\Delta x+O(1) δ K = J /Δ x + O ( 1 ) .
Proof. (i) Since b ( x 2 ) − b ( x 1 ) = ∫ x 1 x 2 b ′ b(x_{2})-b(x_{1})=\int_{x_{1}}^{x_{2}}b' b ( x 2 ) − b ( x 1 ) = ∫ x 1 x 2 b ′ , Δ x δ K \Delta x\,\delta_{K} Δ x δ K is the error of the Q Q Q -point Gauss–Legendre rule applied to b ′ ∈ C 2 Q b'\in C^{2Q} b ′ ∈ C 2 Q , and (46) with f = b ′ f=b' f = b ′ , divided by Δ x \Delta x Δ x , gives (47) . (ii) ∣ b ( x 2 ) − b ( x 1 ) ∣ ≤ L b Δ x |b(x_{2})-b(x_{1})|\leq L_{b}\Delta x ∣ b ( x 2 ) − b ( x 1 ) ∣ ≤ L b Δ x and, by (12) , ∣ G Q ( K ; β ) ∣ ≤ L b Δ x |G_{Q}(K;\beta)|\leq L_{b}\Delta x ∣ G Q ( K ; β ) ∣ ≤ L b Δ x . (iii) Here b ( x 2 ) − b ( x 1 ) = b L i p ( x 2 ) − b L i p ( x 1 ) + J b(x_{2})-b(x_{1})=b_{\mathrm{Lip}}(x_{2})-b_{\mathrm{Lip}}(x_{1})+J b ( x 2 ) − b ( x 1 ) = b Lip ( x 2 ) − b Lip ( x 1 ) + J , and the bounds of (ii) on the remaining terms give ∣ J ∣ − 2 L b Δ x ≤ ∣ Δ x δ K ∣ ≤ ∣ J ∣ + 2 L b Δ x |J|-2L_{b}\Delta x\leq|\Delta x\,\delta_{K}|\leq|J|+2L_{b}\Delta x ∣ J ∣ − 2 L b Δ x ≤ ∣Δ x δ K ∣ ≤ ∣ J ∣ + 2 L b Δ x .
Proposition 4 (Consistency of the modified source). Let b ∈ C 2 Q + 1 ( K ‾ ) b\in C^{2Q+1}(\overline{K}) b ∈ C 2 Q + 1 ( K ) with β p = b ′ ( x p ) \beta_{p}=b'(x_{p}) β p = b ′ ( x p ) , and let η ∈ C 2 Q + 1 ( K ‾ ) \eta\in C^{2Q+1}(\overline{K}) η ∈ C 2 Q + 1 ( K ) . Then
S Q ( K ) = ∫ K g b ∂ x η + E q u a d ( K ) − g δ K ∫ K η , (49) S_{Q}(K)=\int_{K}gb\,\partial_{x}\eta+\mathcal{E}_{\mathrm{quad}}(K)-g\delta_{K}\int_{K}\eta, \tag*{(49)} S Q ( K ) = ∫ K g b ∂ x η + E quad ( K ) − g δ K ∫ K η , (49) where the error of the uncorrected quadrature satisfies
∣ E q u a d ( K ) ∣ ≤ c Q g ∣ K ∣ ( Δ x 2 Q M x + Δ t 2 Q M t ) , (50) |\mathcal{E}_{\mathrm{quad}}(K)|\leq c_{Q}g|K|(\Delta x^{2Q}M_{x}+\Delta t^{2Q}M_{t}), \tag*{(50)} ∣ E quad ( K ) ∣ ≤ c Q g ∣ K ∣ ( Δ x 2 Q M x + Δ t 2 Q M t ) , (50) with M x , M t M_{x},M_{t} M x , M t the suprema over K ‾ \overline{K} K of the 2 Q 2Q 2 Q -th partial derivatives in x x x and t t t of the integrands and c Q c_{Q} c Q depending on Q Q Q only, and the correction term obeys
∣ g δ K ∫ K η ∣ ≤ g C Q Δ x 2 Q sup [ x 1 , x 2 ] ∣ b ( 2 Q + 1 ) ∣ ∥ η ∥ L ∞ ( K ) ∣ K ∣ . (51) \left|g\delta_{K}\int_{K}\eta\right|\leq gC_{Q}\Delta x^{2Q}\sup_{[x_{1},x_{2}]}|b^{(2Q+1)}|\|\eta\|_{L^{\infty}(K)}|K|. \tag*{(51)} g δ K ∫ K η ≤ g C Q Δ x 2 Q [ x 1 , x 2 ] sup ∣ b ( 2 Q + 1 ) ∣∥ η ∥ L ∞ ( K ) ∣ K ∣. (51) The correction is therefore of the same order in Δ x \Delta x Δ x as the quadrature error, and the modified source is consistent with ∫ K g b ∂ x η \int_{K}gb\,\partial_{x}\eta ∫ K g b ∂ x η at that order.
Proof. Inserting β ~ p = β p + δ K \widetilde{\beta}_{p}=\beta_{p}+\delta_{K} β p = β p + δ K in (42) splits S Q ( K ) = S Q 0 ( K ) − R δ S_{Q}(K)=S_{Q}^{0}(K)-R_{\delta} S Q ( K ) = S Q 0 ( K ) − R δ , where S Q 0 ( K ) S_{Q}^{0}(K) S Q 0 ( K ) is the uncorrected Gauss–Legendre approximation of (22) and R δ = g Δ x Δ t 4 δ K ∑ p , r w p w r η ( x p , t r ) R_{\delta}=\frac{g\Delta x\Delta t}{4}\delta_{K}\sum_{p,r}w_{p}w_{r}\eta(x_{p},t_{r}) R δ = 4 g Δ x Δ t δ K ∑ p , r w p w r η ( x p , t r ) . By Lemma 3 the exact value of (22) is ∫ K g b ∂ x η \int_{K}gb\,\partial_{x}\eta ∫ K g b ∂ x η , and the classical Gauss–Legendre error bound (46) [62 ] applied to each face integral and, in tensor-product form, to the volume integral gives S Q 0 ( K ) = ∫ K g b ∂ x η + E q u a d ( K ) S_{Q}^{0}(K)=\int_{K}gb\,\partial_{x}\eta+\mathcal{E}_{\mathrm{quad}}(K) S Q 0 ( K ) = ∫ K g b ∂ x η + E quad ( K ) with (50) . The same bound applied to η \eta η gives R δ = g δ K ∫ K η R_{\delta}=g\delta_{K}\int_{K}\eta R δ = g δ K ∫ K η up to a higher-order term absorbed into E q u a d \mathcal{E}_{\mathrm{quad}} E quad , and (51) follows from (47) .
Two qualifications apply. In the implementation, β p \beta_p β p is a second-order central difference of step ϵ b = 10 − 6 ∣ Ω k ∣ \epsilon_b = 10^{-6}|\Omega_k| ϵ b = 1 0 − 6 ∣ Ω k ∣ , which adds O ( ϵ b 2 sup ∣ b ′ ′ ′ ∣ ) O(\epsilon_b^2 \sup|b'''|) O ( ϵ b 2 sup ∣ b ′′′ ∣ ) to δ K \delta_K δ K , negligible beside (47) for smooth beds. For a bed obtained by piecewise-linear interpolation of tabulated data, b ∈ C 2 Q + 1 b \in C^{2Q+1} b ∈ C 2 Q + 1 fails and only part (ii) of Proposition 3 applies on cells containing a kink, so the source loses its formal order there. Neither case affects Theorem 1, which does not use β \beta β .
Necessity of the sub-domain decomposition
The construction assigns an independent network to each sub-domain of smooth bed, which multiplies the parameter count and requires the interface residuals (26). The following result, an elementary consequence of the head condition, shows that this is forced. The underlying fact, that the free surface must jump across a step carrying a non-zero discharge, is implicit in the exact solutions of [20 ] ; the contribution here is the explicit lower bound (52) and its interpretation as an obstruction for continuous parameterisations.
Theorem 2 (Incompatibility of a continuous free surface). Let x 0 x_0 x 0 be a bed discontinuity with ⟦ b ⟧ ≠ 0 \llbracket b \rrbracket\ne0 [ [ b ] ] = 0 , and let ( η , q ) (\eta,q) ( η , q ) possess one-sided traces at x 0 x_0 x 0 with h ± = η ± − b ± > 0 h_\pm= \eta_\pm-b_\pm> 0 h ± = η ± − b ± > 0 and u ± = q ± / h ± u_\pm= q_\pm/h_\pm u ± = q ± / h ± . Assume ⟦ q ⟧ = 0 \llbracket q \rrbracket= 0 [ [ q ] ] = 0 , write q q q for the common value, and assume that η \eta η is continuous at x 0 x_0 x 0 . Then
∣ ⟦ H ⟧ ∣ = q 2 2 g ( h − + h + ) ∣ ⟦ b ⟧ ∣ h − 2 h + 2 ≥ q 2 ∣ ⟦ b ⟧ ∣ 2 g h max 3 , h max : = max { h − , h + } , (52) \lvert\llbracket H \rrbracket\rvert= \frac{q^2}{2g}\frac{(h_-+h_+)\lvert\llbracket b \rrbracket\rvert}{h_-^2h_+^2} \ge\frac{q^2\lvert\llbracket b \rrbracket\rvert}{2g h_{\max}^3}, \qquad h_{\max}:=\max\{h_-,h_+\}, \tag*{(52)} ∣ [ [ H ] ] ∣ = 2 g q 2 h − 2 h + 2 ( h − + h + ) ∣ [ [ b ] ] ∣ ≥ 2 g h m a x 3 q 2 ∣ [ [ b ] ] ∣ , h m a x := max { h − , h + } , (52) and consequently ⟦ H ⟧ = 0 \llbracket H \rrbracket=0 [ [ H ] ] = 0 forces q = 0 q=0 q = 0 .
Proof. Continuity of η \eta η gives h + − h − = − ⟦ b ⟧ ≠ 0 h_+-h_-=-\llbracket b\rrbracket\ne0 h + − h − = − [ [ b ] ] = 0 . Since ⟦ η ⟧ = 0 \llbracket\eta\rrbracket=0 [ [ η ] ] = 0 and u ± = q / h ± u_\pm=q/h_\pm u ± = q / h ± ,
⟦ H ⟧ = q 2 2 g ( 1 h + 2 − 1 h − 2 ) = q 2 2 g ( h − + h + ) ( h − − h + ) h − 2 h + 2 . \llbracket H\rrbracket=\frac{q^2}{2g}\left(\frac{1}{h_+^2}-\frac{1}{h_-^2}\right)=\frac{q^2}{2g}\frac{(h_-+h_+)(h_--h_+)}{h_-^2h_+^2}. [ [ H ] ] = 2 g q 2 ( h + 2 1 − h − 2 1 ) = 2 g q 2 h − 2 h + 2 ( h − + h + ) ( h − − h + ) . and h − − h + = ⟦ b ⟧ h_--h_+=\llbracket b\rrbracket h − − h + = [ [ b ] ] gives the equality. The inequality follows from h − + h + ≥ h max h_-+h_+\ge h_{\max} h − + h + ≥ h m a x and h − 2 h + 2 ≤ h max 4 h_-^2h_+^2\le h_{\max}^4 h − 2 h + 2 ≤ h m a x 4 . If ⟦ H ⟧ = 0 \llbracket H\rrbracket=0 [ [ H ] ] = 0 , all other factors being non-zero, q = 0 q=0 q = 0 .
Theorem 2 applies to any parameterisation producing a free surface continuous at x 0 x_0 x 0 , in particular a single globally smooth network. If ⟦ q ⟧ = 0 \llbracket q\rrbracket=0 [ [ q ] ] = 0 is enforced, the head condition cannot be satisfied, and the objective retains a residual of size at least q 2 ∣ ⟦ b ⟧ ∣ / ( 2 g h max 3 ) q^2\lvert\llbracket b\rrbracket\rvert/(2gh_{\max}^3) q 2 ∣ [ [ b ] ] ∣ / ( 2 g h m a x 3 ) at that abscissa. A penalty formulation then trades the head condition against the continuity imposed by the parameterisation, and its minimiser solves a modified problem in which ⟦ η ⟧ = 0 \llbracket\eta\rrbracket=0 [ [ η ] ] = 0 has replaced $\llbracket H\rrbracket=0: it may converge cleanly, but to the solution of a different Riemann problem. The bound grows quadratically in the discharge and cubically in the inverse depth, so the obstruction is most severe for fast, shallow flow over a large step, and it vanishes at q = 0 q=0 q = 0 , which is why the lake at rest imposes no such requirement. For instance, for the exact states of configuration 6.3.3 of [20 ] , with q = − 3.468 m 2 s − 1 q=-3.468\ \mathrm{m^2\,s^{-1}} q = − 3.468 m 2 s − 1 , ⟦ b ⟧ = 1 m \llbracket b\rrbracket=1\ \mathrm{m} [ [ b ] ] = 1 m and h max = 2.634 m h_{\max}=2.634\ \mathrm{m} h m a x = 2.634 m , (52) gives ∣ ⟦ H ⟧ ∣ ≥ 3.3 × 10 − 2 m \lvert\llbracket H\rrbracket\rvert\ge3.3\times10^{-2}\ \mathrm{m} ∣ [ [ H ] ] ∣ ≥ 3.3 × 1 0 − 2 m against the exact value ∣ ⟦ H ⟧ ∣ = 0 \lvert\llbracket H\rrbracket\rvert=0 ∣ [ [ H ] ] ∣ = 0 .
Reduction, conservation and the momentum defect
Proposition 5 (Strict extension). Let b ≡ b 0 b\equiv b_0 b ≡ b 0 be constant on Ω K \Omega_\mathcal{K} Ω K . Then M = 0 M=0 M = 0 , the interface terms are absent, and for every K ∈ K 0 K\in\mathcal{K}_0 K ∈ K 0
R m ( K ) = ∫ x 1 x 2 [ h ( x , t 2 ) − h ( x , t 1 ) ] d x + ∫ t 1 t 2 [ q ( x 2 , t ) − q ( x 1 , t ) ] d t , \mathcal{R}^{m}(K)=\int_{x_1}^{x_2}[h(x,t_2)-h(x,t_1)]\,\mathrm{d}x+\int_{t_1}^{t_2}[q(x_2,t)-q(x_1,t)]\,\mathrm{d}t, R m ( K ) = ∫ x 1 x 2 [ h ( x , t 2 ) − h ( x , t 1 )] d x + ∫ t 1 t 2 [ q ( x 2 , t ) − q ( x 1 , t )] d t , R p ( K ) = ∫ x 1 x 2 [ q ( x , t 2 ) − q ( x , t 1 ) ] d x + ∫ t 1 t 2 [ F ( x 2 , t ) − F ( x 1 , t ) ] d t , F : = q 2 h + 1 2 g h 2 , \mathcal{R}^{p}(K)=\int_{x_1}^{x_2}[q(x,t_2)-q(x,t_1)]\,\mathrm{d}x+\int_{t_1}^{t_2}[\mathcal{F}(x_2,t)-\mathcal{F}(x_1,t)]\,\mathrm{d}t,\qquad\mathcal{F}:=\frac{q^2}{h}+\frac{1}{2}gh^2, R p ( K ) = ∫ x 1 x 2 [ q ( x , t 2 ) − q ( x , t 1 )] d x + ∫ t 1 t 2 [ F ( x 2 , t ) − F ( x 1 , t )] d t , F := h q 2 + 2 1 g h 2 , which is the weak residual (13) of the homogeneous shallow water system in the variables ( h , q ) (h,q) ( h , q ) . The same identities hold for the discrete residuals (41)–(43).
Proof. Since b b b is constant, η ( x , t 2 ) − η ( x , t 1 ) = h ( x , t 2 ) − h ( x , t 1 ) \eta(x,t_2)-\eta(x,t_1)=h(x,t_2)-h(x,t_1) η ( x , t 2 ) − η ( x , t 1 ) = h ( x , t 2 ) − h ( x , t 1 ) . The volume terms of (22) and (42) vanish (in the discrete case β = 0 \beta=0 β = 0 and b ( x 1 ) = b ( x 2 ) b(x_1)=b(x_2) b ( x 1 ) = b ( x 2 ) give β ~ = 0 \widetilde{\beta}=0 β = 0 ), and the lateral integrand of R p \mathcal{R}^{\mathrm{p}} R p becomes Φ − g b 0 η = q 2 / h + 1 2 g ( η − b 0 ) 2 − 1 2 g b 0 2 = F − 1 2 g b 0 2 \Phi-gb_0\eta=q^2/h+\frac{1}{2}g(\eta-b_0)^2-\frac{1}{2}gb_0^2=\mathcal{F}-\frac{1}{2}gb_0^2 Φ − g b 0 η = q 2 / h + 2 1 g ( η − b 0 ) 2 − 2 1 g b 0 2 = F − 2 1 g b 0 2 ; the constant cancels between the two lateral faces. The discrete statement follows node by node. □
If b b b is smooth but not constant, the decomposition still collapses to a single network and the method reduces to the inherited residual augmented only by the source treatment of § 3.4 –§ 3.5 . The global mass balance below is the usual telescoping property of the integral conservation law [56 ] , written for the decomposed domain so as to expose the interface defect.
Proposition 6 (Global mass balance). Let K k f u l l : = Ω ‾ k × [ 0 , T ] K_k^{\mathrm{full}}:=\overline{\Omega}_k\times[0,T] K k full := Ω k × [ 0 , T ] and assume R m ( K k f u l l ) = 0 \mathcal{R}^{\mathrm{m}}(K_k^{\mathrm{full}})=0 R m ( K k full ) = 0 for every k k k . Then
∫ Ω x [ η ( ⋅ , T ) − η ( ⋅ , 0 ) ] d x ⏟ storage + ∫ 0 T [ q ( x R , t ) − q ( x L , t ) ] d t ⏟ net outflux + ∑ m = 1 M ∫ 0 T ⟦ q ⟧ ( e m , t ) d t ⏟ interface defect = 0 (53) \underbrace{\int_{\Omega_x}[\eta(\cdot,T)-\eta(\cdot,0)]\,\mathrm{d}x}_{\text{storage}}+\underbrace{\int_0^T[q(x_R,t)-q(x_L,t)]\,\mathrm{d}t}_{\text{net outflux}}+\underbrace{\sum_{m=1}^{M}\int_0^T\llbracket q\rrbracket(e_m,t)\,\mathrm{d}t}_{\text{interface defect}}=0 \tag*{(53)} storage ∫ Ω x [ η ( ⋅ , T ) − η ( ⋅ , 0 )] d x + net outflux ∫ 0 T [ q ( x R , t ) − q ( x L , t )] d t + interface defect m = 1 ∑ M ∫ 0 T [ [ q ] ] ( e m , t ) d t = 0 (53) with ⟦ q ⟧ ( e m , t ) : = q ( e m − , t ) − q ( e m + , t ) \llbracket q\rrbracket(e_m,t):=q(e_m^-,t)-q(e_m^+,t) [ [ q ] ] ( e m , t ) := q ( e m − , t ) − q ( e m + , t ) . In particular, global mass is exactly conserved if (6) holds exactly at every interface.
Proof. Summing R m ( K k f u l l ) = 0 \mathcal{R}^{\mathrm{m}}(K_k^{\mathrm{full}})=0 R m ( K k full ) = 0 over k k k , the horizontal faces give the storage term, the sub-domains being disjoint with union Ω x \Omega_x Ω x up to a finite set, and the vertical faces give ∑ k ∫ 0 T [ q ( e k + 1 − , t ) − q ( e k + , t ) ] d t \sum_k\int_0^T[q(e_{k+1}^-,t)-q(e_k^+,t)]\,\mathrm{d}t ∑ k ∫ 0 T [ q ( e k + 1 − , t ) − q ( e k + , t )] d t ; grouping the two traces at each interior node e m e_m e m yields the net outflux plus the interface defect. □
The maximal cells K k f u l l K_k^{\mathrm{full}} K k full do not belong to the sampled family and the trained residuals do not vanish exactly, so (53) is not enforced by the objective; it serves instead as an a posteriori diagnostic, its three terms being computed independently after training.
Momentum, by contrast, is not conserved across a bed step, and the defect is fixed by the closure rather than by the equations. This is classical in open-channel hydraulics, where the jump of the momentum function across an obstacle equals the force it exerts [55 , 57 ] , and it is discussed for the Riemann problem at a step in [21 , 22 ] . We state it in the form used below.
Proposition 7 (Momentum defect at a step [55 , 57 ] ). Let ( η , q ) (\eta,q) ( η , q ) satisfy (6)–(7) at x 0 x_0 x 0 with q ≠ 0 q\ne0 q = 0 and ⟦ b ⟧ ≠ 0 \llbracket b\rrbracket\ne0 [ [ b ] ] = 0 , and assume 0 < h min ≤ h ± ≤ h max < ∞ 0<h_{\min}\le h_{\pm}\le h_{\max}<\infty 0 < h m i n ≤ h ± ≤ h m a x < ∞ . Then h + ≠ h − h_+\ne h_- h + = h − and
D : = ⟦ q u + 1 2 g h 2 ⟧ = ( h + − h − ) [ g 2 ( h + + h − ) − q 2 h + h − ] (54) D:=\llbracket qu+\frac{1}{2}gh^2\rrbracket=(h_+-h_-)\left[\frac{g}{2}(h_++h_-)-\frac{q^2}{h_+h_-}\right] \tag*{(54)} D := [ [ q u + 2 1 g h 2 ] ] = ( h + − h − ) [ 2 g ( h + + h − ) − h + h − q 2 ] (54) which vanishes if and only if q 2 = g 2 h + h − ( h + + h − ) q^2=\frac{g}{2}h_+h_-(h_++h_-) q 2 = 2 g h + h − ( h + + h − ) , the classical conjugate-depth relation of the hydraulic jump [55 ] , a codimension-one set. Moreover, if the nonconservative product g h ∂ x b gh\partial_xb g h ∂ x b is given a meaning by a regularisation for which the corresponding spatial integrals converge and are dominated, then at every Lebesgue point in time of both sides
D = − lim ε → 0 ∫ x 0 − ε x 0 + ε g h ∂ x b (55) D=-\lim_{\varepsilon\to0}\int_{x_0-\varepsilon}^{x_0+\varepsilon}gh\,\partial_xb \tag*{(55)} D = − ε → 0 lim ∫ x 0 − ε x 0 + ε g h ∂ x b (55) that is, the net horizontal force per unit width exerted by the step on the flow.
Proof. If h + = h − h_+=h_- h + = h − , (6)–(7) would give b + = b − b_+=b_- b + = b − ; hence h + ≠ h − h_+\ne h_- h + = h − . With u ± = q / h ± u_{\pm}=q/h_{\pm} u ± = q / h ± , D = q 2 ( 1 / h + − 1 / h − ) + 1 2 g ( h + 2 − h − 2 ) D=q^2(1/h_+-1/h_-)+\frac{1}{2}g(h_+^2-h_-^2) D = q 2 ( 1/ h + − 1/ h − ) + 2 1 g ( h + 2 − h − 2 ) , and factoring out h + − h − h_+-h_- h + − h − gives (54) . For (55) , integrate the momentum equation of (1) over ( x 0 − ε , x 0 + ε ) × ( t , t + σ ) (x_0-\varepsilon,x_0+\varepsilon)\times(t,t+\sigma) ( x 0 − ε , x 0 + ε ) × ( t , t + σ ) and let ε → 0 \varepsilon\to0 ε → 0 : the storage term is bounded by 4 ε ∥ q ∥ L ∞ 4\varepsilon\|q\|_{L^\infty} 4 ε ∥ q ∥ L ∞ , and the flux term converges to ∫ t t + σ D d s \int_t^{t+\sigma}D\,\mathrm{d}s ∫ t t + σ D d s by dominated convergence, the flux being bounded by ∥ q ∥ L ∞ 2 / h min + 1 2 g h max 2 \|q\|_{L^\infty}^2/h_{\min}+\frac{1}{2}gh_{\max}^2 ∥ q ∥ L ∞ 2 / h m i n + 2 1 g h m a x 2 . Dividing by σ \sigma σ and letting σ → 0 \sigma\to0 σ → 0 at a Lebesgue point gives (55) . □
Proposition 7 localises the modelling content of the formulation: the closure enters the objective only through r H r_H r H in (26) , and replacing (7) by a momentum-based condition as in [21 ] substitutes one term of the objective. Any closure satisfied by q = 0 q=0 q = 0 , η ≡ η ∗ \eta\equiv\eta^* η ≡ η ∗ leaves Theorem 1 and Corollary 1 unchanged.
Limitations and future work
The analysis has several limitations, which we state explicitly because each defines a direction for further work. No estimate links the trained objective to the error. Converting a small value of L \mathcal{L} L into a bound on ∥ ( η θ , q θ ) − ( η , q ) ∥ L 1 \lVert(\eta_\theta,q_\theta)-(\eta,q)\rVert_{L^1} ∥( η θ , q θ ) − ( η , q ) ∥ L 1 would require a quantitative sampling-consistency estimate and a stability estimate for the limit problem; the conditional L 1 L^1 L 1 estimate available for the inherited framework rests on the Bouchut–Perthame theory [64 ] for scalar conservation laws, which does not extend to a 2 × 2 2 \times2 2 × 2 system with a geometric source and internal stationary interfaces. Uniqueness of the zero set of L \mathcal{L} L is not established: a negative answer would upgrade Corollary 1 from a representability statement to a characterisation. The closure itself carries non-uniqueness, and no mechanism in the objective selects among admissible branches where the Riemann problem at the step is non-unique [24 , 25 , 23 , 26 ] . Finally, dry states are excluded by Assumption 2: the barrier (28) discourages but does not prevent h → 0 h \to0 h → 0 , and where the floor h min h_{\min} h m i n becomes active the residual no longer represents (2).
These limitations point to the following directions. The first is a stability framework for the shallow water system with discontinuous topography, which, combined with a sampling-consistency estimate for the random control-volume family, would turn a small value of L \mathcal{L} L into an error bound for the trained network. Finally, the treatment of wet–dry fronts and the extension to two space dimensions, where the control volumes become space–time prisms and the bed discontinuities curves, are needed for applications.
Implementation
Each sub-domain carries an independent fully connected network with two inputs ( x , t ) (x,t) ( x , t ) , affinely rescaled to [ − 1 , 1 ] 2 [-1,1]^2 [ − 1 , 1 ] 2 on Ω ‾ T \overline{\Omega}_T Ω T , four hidden layers of n h n_{\mathrm{h}} n h units and two outputs. The activation is tanh ( a z ) \tanh(az) tanh ( a z ) with a trainable slope a a a shared by all layers; its initial value a 0 a_0 a 0 and the width n h n_{\mathrm{h}} n h are the only architectural quantities that vary between test cases. The output layer is initialised with its weight matrix scaled by 0.1 0.1 0.1 and its bias set to ( η 0 ‾ ∣ Ω k , 0 ) (\overline{\eta_0}|_{\Omega_k},0) ( η 0 ∣ Ω k , 0 ) , the mean of η 0 \eta_0 η 0 over the sub-domain, so that the initial network represents a nearly flat free surface at the correct level and a nearly vanishing discharge, from which the equilibrium of Corollary 1 is reachable without a large excursion.
Since the control-volume family is fixed before training, every quantity that depends only on the geometry and the initial conditions is evaluated once in double precision and stored as a constant tensor: the Gauss nodes on the four faces of each cell and, on variable-bed sub-domains, in its interior; the bed values at those nodes, read one-sidedly as in § 3.2 ; the nominal slopes β p \beta_p β p , obtained by central differences of step 10 − 6 ∣ Ω k ∣ 10^{-6}|\Omega_k| 1 0 − 6 ∣ Ω k ∣ , and the corrected slopes (24); and the values of η 0 , q 0 \eta_0,q_0 η 0 , q 0 at the same nodes. The training loop therefore never evaluates b b b , η 0 \eta_0 η 0 or u 0 u_0 u 0 , and each evaluation of the objective reduces to a forward and a backward pass over a fixed point set. Its dominant cost is
N e v a l = ∑ k = 0 M [ 4 N k Q + 1 { b v a r i a b l e o n Ω k } N k Q 2 ] (56) N_{\mathrm{eval}}=\sum_{k=0}^{M}\left[4N_kQ+\mathbb{1}_{\{b\ \mathrm{variable\ on}\ \Omega_k\}}N_kQ^2\right] \tag*{(56)} N eval = k = 0 ∑ M [ 4 N k Q + 1 { b variable on Ω k } N k Q 2 ] (56)
network evaluations, to which the interface and boundary nodes add 2 M N Γ Q + 2 ( 4 N Γ + 1 ) 2MN_{\Gamma}Q+2(4N_{\Gamma}+1) 2 M N Γ Q + 2 ( 4 N Γ + 1 ) further evaluations. A variable-bed sub-domain contributes Q 2 Q^2 Q 2 interior nodes per cell and another 4 Q 4Q 4 Q face nodes, so activating the volume source multiplies its cost by 1 + Q / 4 1+Q/4 1 + Q /4 , a factor of four for Q = 12 Q=12 Q = 12 . The constant-bed flag of § 3.2 is obtained by sampling b b b at 513 interior points of each Ω k \Omega_k Ω k .
Training follows the two-stage schedule of [53 ] . The first stage performs N A d a m N_{\mathrm{Adam}} N Adam iterations of full-batch Adam [65 ] with learning rate 2 × 10 − 3 2 \times10^{-3} 2 × 1 0 − 3 , cosine-annealed to 2 × 10 − 5 2 \times10^{-5} 2 × 1 0 − 5 . The second performs at most N r o u n d s N_{\mathrm{rounds}} N rounds restarts of L-BFGS [66 , 67 ] with strong Wolfe line search, history size 60, gradient tolerance 10 − 9 10^{-9} 1 0 − 9 and step tolerance 10 − 12 10^{-12} 1 0 − 12 , each restart limited to N L B F G S N_{\mathrm{LBFGS}} N LBFGS iterations; the sequence stops as soon as a round fails to reduce the objective by a relative 10 − 3 10^{-3} 1 0 − 3 . Restarting discards stale curvature pairs accumulated across the sharp changes of the landscape that occur when the interface residuals become active. Network evaluation and training are carried out in single precision, whose only consequence for the well-balanced property is the round-off floor of Proposition 2. The procedure is summarised in Algorithm 1.
After training, the solution at ( x , t ) (x,t) ( x , t ) is evaluated by the network owning x x x , sub-domains being taken left-closed and right-open, and the bed value combined with the network output to form h θ = η θ − b h_\theta= \eta_\theta- b h θ = η θ − b is read from the same side, at an abscissa pulled 10 − 9 ∣ Ω k ∣ 10^{-9}|\Omega_k| 1 0 − 9 ∣ Ω k ∣ inside Ω k \Omega_k Ω k . Combining η θ \eta_\theta η θ from the network owning a jump abscissa with b b b evaluated at the raw abscissa would mix the two sides of the step and produce a spurious depth of the size of the bed jump at that point, at every time including t = 0 t = 0 t = 0 . The same convention must be applied when a reference solution is sampled for error norms.
The parameters that are fixed independently of the test case are collected in Table 1 . The case-dependent inputs are the total number of control volumes N N N , the number of interface and boundary time intervals N Γ N_\Gamma N Γ , the quadrature order Q Q Q , the width n h n_h n h , the initial slope a 0 a_0 a 0 , the boundary treatment and the optimiser budgets N A d a m N_{\mathrm{Adam}} N Adam , N r o u n d s N_{\mathrm{rounds}} N rounds , N L B F G S N_{\mathrm{LBFGS}} N LBFGS ; the blending constant is tied to the interface resolution by c τ = 2 N Γ c_\tau= 2N_\Gamma c τ = 2 N Γ . All computations use PyTorch 2.4.1 with CUDA 12.1 on a single NVIDIA A100-SXM4-80GB accelerator.
Table 1. Parameters common to every test case.
Algorithm 1 Well-balanced WE-PINN for the shallow water equations
Input: Ω x \Omega_x Ω x , T T T , bed b b b , initial conditions η 0 \eta_0 η 0 , u 0 u_0 u 0 ; N N N , N Γ N_{\Gamma} N Γ , Q Q Q , γ \gamma γ , α c \alpha_c α c , c τ c_{\tau} c τ , loss weights
Locate the bed discontinuities from b b b alone (Sec. 3.2) and build the sub-domains Ω 0 , … , Ω M \Omega_0,\ldots,\Omega_M Ω 0 , … , Ω M
Compute the scales (30) from η 0 \eta_0 η 0 , u 0 u_0 u 0
for k = 0 k = 0 k = 0 to M M M do
Allot N k N_k N k cells by (16); build the cell family on Ω k \Omega_k Ω k from (17)–(18)
Pre-evaluate b b b , η 0 \eta_0 η 0 , q 0 q_0 q 0 at all face nodes, one-sidedly inside Ω k \Omega_k Ω k
if b b b is non-constant on Ω k \Omega_k Ω k then
Pre-evaluate the interior nodes and assemble the corrected slope b ~ ′ \tilde{b}' b ~ ′ from (24)
end if
Initialise N θ k \mathcal{N}_{\theta_k} N θ k with output bias ( η 0 ‾ ∣ Ω k , 0 ) (\overline{\eta_0}|_{\Omega_k},0) ( η 0 ∣ Ω k , 0 )
end for
Build the interface nodes at every e m e_m e m and the boundary nodes at x L x_L x L , x R x_R x R
for i t = 1 \mathrm{it} = 1 it = 1 to N A d a m N_{\mathrm{Adam}} N Adam do
Evaluate R Q m R_Q^m R Q m , R Q p R_Q^p R Q p on every cell, r q r_q r q , r H r_H r H at every interface node, r B r_B r B at every boundary node
Assemble L \mathcal{L} L from (31) and update θ \theta θ with Adam
end for
for r = 1 r = 1 r = 1 to N r o u n d s N_{\mathrm{rounds}} N rounds do
Run L-BFGS for at most N L B F G S N_{\mathrm{LBFGS}} N LBFGS iterations on L \mathcal{L} L ; stop if the round gains less than a relative 10 − 3 10^{-3} 1 0 − 3
end for
Output: trained networks and the evaluator ( x , t ) ↦ ( η θ , q θ , h θ , u θ ) (x,t)\mapsto(\eta_\theta,q_\theta,h_\theta,u_\theta) ( x , t ) ↦ ( η θ , q θ , h θ , u θ )
Numerical experiments
Residual-operator and trained-network diagnostics
Two logically distinct statements are tested throughout, and they are reported separately. The first concerns the residual operator : the exact state is substituted into the same code that assembles the training objective, with no training involved, which tests Theorem 1 and Proposition 2 directly. The second concerns the trained network , whose deviation from the exact solution is, by Corollary 1, an optimisation error and not a property of the construction. Five diagnostics are used.
D1 Residual operator. The exact state is fed through the residual code; reported are max i ∣ R Q m ( K i ) ∣ / ∣ K i ∣ \max_i|R_Q^m(K_i)|/|K_i| max i ∣ R Q m ( K i ) ∣/∣ K i ∣ , max i ∣ R Q p ( K i ) ∣ / ∣ K i ∣ \max_i|R_Q^p(K_i)|/|K_i| max i ∣ R Q p ( K i ) ∣/∣ K i ∣ , the largest interface and boundary residuals, the objective L ( θ ⋆ ) \mathcal{L}(\theta^\star) L ( θ ⋆ ) , and the size of each of the two source contributions of (42) whose difference forms the momentum residual.
D2 Errors of the trained network in η \eta η , h h h , u u u and q q q , in L 1 L^1 L 1 , L 2 L^2 L 2 and L ∞ L^\infty L ∞ , on a uniform grid of 8000 points at t ∈ { T / 2 , T } t\in\{T/2,T\} t ∈ { T /2 , T } ; the error at t = 0 t=0 t = 0 vanishes identically by (29).
D3 Space–time extrema of the deviation from the exact solution on a 601 × 101 601\times101 601 × 101 grid, normalised by the physical scales η ⋆ \eta^\star η ⋆ , g h max \sqrt{gh_{\max}} g h m a x and h max g h max h_{\max}\sqrt{gh_{\max}} h m a x g h m a x , and the minimum depth.
D4 Residuals of the trained network: the weak cell residuals on the training control volumes.
D5 Interfaces and conservation: the traces and the jumps [ [ q ] ] [\![q]\!] [ [ q ] ] , [ [ H ] ] [\![H]\!] [ [ H ] ] , [ [ η ] ] [\![\eta]\!] [ [ η ] ] at every detected bed jump, and the three terms of the global mass balance (53), computed independently after training.
Unless stated otherwise, the parameters are those of Table 1 .
Preservation of the lake at rest
Configurations
Four bathymetries are used (Fig. 2, Table 2). In every case the initial state is the lake at rest, η 0 ≡ η ⋆ \eta_0\equiv\eta^\star η 0 ≡ η ⋆ , u 0 = 0 u_0=0 u 0 = 0 , so the exact solution on [ 0 , T ] [0,T] [ 0 , T ] is the initial state itself and every reported number is an absolute error. Nothing about the solution is supplied: the bed discontinuities, the decomposition, the constant-bed flags, the scales (30) and the boundary data are all derived from ( b , η 0 , u 0 ) (b,\eta_0,u_0) ( b , η 0 , u 0 ) . The four cases isolate different parts of the mechanism. WB1, a C ∞ C^\infty C ∞ Gaussian bump, involves one network, no interface and an active volume source, and therefore tests the bed-slope correction alone. WB2, a single step, produces two constant-bed sub-domains on which the volume source is not assembled, and tests the interface coupling and the constant-bed case of Proposition 2. WB3 combines smooth features with six bed jumps of both signs, the largest (0.95 m) exceeding the local depth (0.55 m), and contains a jump that the detector misses. WB4 is the piecewise-linear interpolant of 28 tabulated points (Appendix A), continuous with 23 kinks, over a domain and a time interval two to three orders of magnitude larger than the others. In every case min h 0 / h s a f e ≥ 6 \min h_0/h_{\mathrm{safe}} \ge6 min h 0 / h safe ≥ 6 , so the domain is fully wet and the barrier (28) is inactive.
Figure 2. The four lake-at-rest bathymetries: bed b ( x ) b(x) b ( x ) (grey) and exact free surface η ≡ η ⋆ \eta\equiv\eta^\star η ≡ η ⋆ (black), which is also the initial condition. From left to right: WB1, Gaussian bump; WB2, bottom step of height 1 m; WB3, compound bed with six discontinuities and two smooth features; WB4, piecewise-linear interpolant of 28 tabulated points. Horizontal and vertical extents differ by up to three orders of magnitude between panels.
Each configuration is run twice with identical geometry generation, seed and physics. Run A uses a small network, two hidden layers of 3 neurons per sub-domain: the solution is simple, and by Lemma 5 the equilibrium requires no approximation capacity, so a small network suffices and needs few resources. Its budget is deliberately austere (N = 900 N = 900 N = 900 requested cells, 10 3 10^3 1 0 3 Adam iterations, no L-BFGS, λ B = 100 \lambda_B = 100 λ B = 100 ). Run B uses the same network as the Riemann problems of § 6.3 , four hidden layers of 80 neurons per sub-domain; it doubles the resolution in each direction and adds up to four L-BFGS restarts (N = 3600 N = 3600 N = 3600 , 4 × 10 3 4 \times10^3 4 × 1 0 3 Adam iterations, ≤ 4 × 2 × 10 3 \le4 \times2 \times10^3 ≤ 4 × 2 × 1 0 3 L-BFGS iterations, λ B = 1 \lambda_B = 1 λ B = 1 ). The residual operator is structurally the same in both runs, whereas the network and the optimisation budget differ, which separates the two statements of § 6.1 . Apart from the network of Run A, two settings depart from Table 1 , each forced by the object under test: the working precision is float64, since the quantities to be measured are round-off floors; and both components of the state are pinned at each end at their initial values,
r B η = η ( x e , t ) − η 0 ( x e ) S H , r B q = q ( x e , t ) − q 0 ( x e ) S q , x e ∈ { x L , x R } , (57) r_B^\eta= \frac{\eta(x_e,t)-\eta_0(x_e)}{S_H}, \qquad r_B^q = \frac{q(x_e,t)-q_0(x_e)}{S_q}, \qquad x_e \in\{x_L,x_R\}, \tag*{(57)} r B η = S H η ( x e , t ) − η 0 ( x e ) , r B q = S q q ( x e , t ) − q 0 ( x e ) , x e ∈ { x L , x R } , (57)
imposed as a soft penalty. This is the most constraining boundary term available, and the proof of Corollary 1 applies to it verbatim, since both residuals vanish at the equilibrium.
The pass criteria follow from the analysis. For the residual operator: (C1) the mass, interface and boundary residuals are zero bitwise; (C2) the momentum residual sits at the round-off floor and grows with η ⋆ \eta^\star η ⋆ ; (C3) it is zero bitwise on a piecewise-constant bed; (C4) it falls by u 64 / u 32 = 2 − 53 / 2 − 24 ≈ 1.86 × 10 − 9 u_{64}/u_{32} = 2^{-53}/2^{-24} \approx1.86 \times10^{-9} u 64 / u 32 = 2 − 53 / 2 − 24 ≈ 1.86 × 1 0 − 9 when passing from float32 to float64. Criteria C1–C4 are the content of Theorem 1 and Proposition 2. For the trained network: (C5) the deviations are orders of magnitude below the physical scales; (C6) they do not grow over [ 0 , T ] [0,T] [ 0 , T ] . Criteria C5–C6 measure the optimiser and are, by Corollary 1, not claims about the construction.
Table 2: Lake-at-rest configurations and run settings. “Jumps” gives the number of discontinuities detected from b b b alone and, in parentheses, the true number; “sub-domains” gives the total and, in parentheses, the number with a variable bed, on which the volume source and the correction (24) are assembled. Networks are per sub-domain (hidden layers × \times × width); parameter counts are totals. For WB1, WB2 and WB4 the cells are shared by (16); for WB3, whose six sub-domains differ widely in width, the counts were set per sub-domain as listed in Table 4 .
Table 4: WB3 at η ⋆ = 1.5 \eta^\star= 1.5 η ⋆ = 1.5 m, by sub-domain: momentum residual of the exact equilibrium and statistics of the bed-slope shift δ K \delta_K δ K . Sub-domains 0–2 carry a variable bed; sub-domain 2 contains the undetected jump at x = 0.70 x=0.70 x = 0.70 . ⋄Not applicable: sub-domains 3–5 are flagged constant-bed (Section 3.2), so the volume source and the correction (24) are not assembled there (Section 3.4) and no shift δ K \delta_K δ K is computed; the momentum residual is still reported. Together these three sub-domains carry 720 (Run A) and 1440 (Run B) cells.
Table 4.
The residual operator at the exact equilibrium
Diagnostic D1 is evaluated at four surface levels per configuration: the level of the configuration itself and max b + 0.5 \max b + 0.5 max b + 0.5 , max b + 1.5 \max b + 1.5 max b + 1.5 and max b + 3.0 \max b + 3.0 max b + 3.0 m, each with its own boundary datum. Every configuration is built in both precisions with identical geometry. Table 3 summarises the results over the four levels, and Figure 3 shows the momentum floor level by level.
Table 3.
Figure 3. The residual-operator floor max i ∣ R Q p ( K i ) ∣ / ∣ K i ∣ \max_i |\mathcal{R}^{p}_{Q}(K_i)|/|K_i| max i ∣ R Q p ( K i ) ∣/∣ K i ∣ at the exact lake at rest, as a function of the surface level η ⋆ \eta^\star η ⋆ , in float32 (circles) and float64 (squares), on logarithmic axes; the dotted line is the reference slope ∝ η ⋆ \propto\eta^\star ∝ η ⋆ . No training is involved. The two precisions are separated by about nine decades in every variable-bed configuration, as Proposition 2 requires of a round-off floor; the WB2 panel is empty because the residual is zero bitwise in both precisions on a piecewise-constant bed.
Table 3: Diagnostic D1: the exact lake at rest fed through the residual code, with no training. Each entry is the interval [ min , max ] [\min, \max] [ min , max ] over the four surface levels. In all 32 evaluations the mass residual max i ∣ R Q m ∣ / ∣ K i ∣ \max_i |R^m_Q|/|K_i| max i ∣ R Q m ∣/∣ K i ∣ , the interface residuals max ( ∣ r q ∣ , ∣ r H ∣ ) \max(|r_q|, |r_H|) max ( ∣ r q ∣ , ∣ r H ∣ ) and the boundary residual are exactly zero, in both precisions; they are not tabulated. “Source” is the size max i ∣ S Q f a c e ∣ / ∣ K i ∣ \max_i |S^{\mathrm{face}}_Q|/|K_i| max i ∣ S Q face ∣/∣ K i ∣ of each of the two source contributions whose difference is the momentum residual. “Ratio” is f64/f32, to be compared with u 64 / u 32 ≈ 1.86 × 10 − 9 u_{64}/u_{32} \approx1.86 \times10^{-9} u 64 / u 32 ≈ 1.86 × 1 0 − 9 .
Criteria C1 and C3 are met exactly. The mass, interface and boundary residuals are exactly zero, bitwise, on every control volume, at every level, for all four bathymetries, both geometries and both precisions. This is what Proposition 2 predicts for R Q m R^m_Q R Q m , every term of which is a difference of identical stored values, and what Corollary 1 predicts for r q r_q r q , r H r_H r H and the boundary residuals. For WB2, the momentum residual and the objective are also zero bitwise, at every level and in single as well as double precision: on a constant-bed sub-domain the volume source is not assembled and the face term is a difference of identical partial sums, as stated in the last part of Proposition 2.
Criterion C2 concerns the configurations in which the bed varies. There the momentum residual is non-zero but confined to values between 10 − 16 10^{-16} 1 0 − 16 and 10 − 13 10^{-13} 1 0 − 13 , while each of the two source contributions whose difference produces it is of size between 0.6 0.6 0.6 and 4 × 10 2 4 \times10^{2} 4 × 1 0 2 . The cancellation made exact by (25) is therefore observed over about fifteen orders of magnitude. The floor increases with η ⋆ \eta^\star η ⋆ in every variable-bed configuration (Figure 3 ), consistently with the bound (45); the precision test C4 below is what separates round-off from an imbalance. Over the probe range the floor grows by factors of 5.7 and 10.1 for WB1 (level ratio 6.4) and 3.3 for WB3 (level ratio 2.7); exact proportionality is not expected, (45) being an upper bound attained on different cells at different levels. For WB4 the probe levels span a ratio of only 1.26, and the level test is uninformative there. Halving the cell width Δ x = 2 h x \Delta x = 2h_x Δ x = 2 h x from Run A to Run B, by quadrupling the number of randomly placed cells (§ 3.3 ; no grid is refined), increases the floor by factors of 1.9 (WB1), 2.0 (WB3) and 1.5 (WB4), against the factor 2 implied by the per-volume form of (45) . Finally, L ( θ ⋆ ) \mathcal{L}(\theta^\star) L ( θ ⋆ ) lies between 10 − 31 10^{-31} 1 0 − 31 and 5 × 10 − 29 5 \times10^{-29} 5 × 1 0 − 29 , the square of the floor, and is zero for WB2: Corollary 1 is confirmed numerically.
The decisive test, criterion C4, is the change of precision: a round-off floor must fall by u 64 / u 32 ≈ 1.86 × 10 − 9 u_{64}/u_{32} \approx1.86 \times10^{-9} u 64 / u 32 ≈ 1.86 × 1 0 − 9 , whereas a discretisation imbalance would not move. The measured ratios lie between 1.16 × 10 − 9 1.16 \times10^{-9} 1.16 × 1 0 − 9 and 2.33 × 10 − 9 2.33 \times10^{-9} 2.33 × 1 0 − 9 over all 24 variable-bed evaluations, that is between 0.62 and 1.25 times the prediction, while the float32 floors themselves span three decades. Together with C1–C3 this identifies everything that remains in Table 3 as floating-point arithmetic.
The compound bed WB3 provides a further test, of a situation that the analysis covers but the construction was not designed for. The detector accepts five of the six jumps of WB3, recovering their heights to six decimal places, and rejects every smooth feature. It misses the jump of + 0.30 +0.30 + 0.30 m at x = 0.70 x = 0.70 x = 0.70 , which lies immediately to the right of the steepest part of the oscillation on the ramp: the bracketing stage converges to a smooth point to its left, which the confirmation test correctly rejects. The missed jump is retained in the test, because it realises the situation of Remark 2(iii): some cells of the third sub-domain contain a bed discontinuity, the nominal slope is meaningless there, and the shift must absorb the whole increment. Table 4 shows that it does. On the two sub-domains without an undetected jump, max ∣ δ K ∣ ≤ 2.4 × 10 − 8 \max|\delta_K| \le2.4 \times10^{-8} max ∣ δ K ∣ ≤ 2.4 × 1 0 − 8 , of the order of the quadrature error, as Proposition 3(i) describes. On the sub-domain containing x = 0.70 x = 0.70 x = 0.70 , ∣ δ K ∣ > 1 |\delta_K| > 1 ∣ δ K ∣ > 1 on 17 of 390 (Run A) and 33 of 1620 (Run B) cells, with maxima 5.27 and 10.7. These reproduce Proposition 3(iii), δ K = J / Δ x + O ( 1 ) \delta_K = J/\Delta x + O(1) δ K = J /Δ x + O ( 1 ) : with J = 0.30 J = 0.30 J = 0.30 m and Δ x = 0.056967 \Delta x = 0.056967 Δ x = 0.056967 and 0.027951 0.027951 0.027951 m, J / Δ x = 5.266 J/\Delta x = 5.266 J /Δ x = 5.266 and 10.733, against the measured 5.266 and 10.73. The momentum residual on sub-domain is nevertheless at the same floor as on the others, so the C C C -property holds on cells that violate the hypothesis b ∈ C 1 ( K ) b \in C^1(K) b ∈ C 1 ( K ) under which the residual was constructed. On the constant-bed sub-domains the residual is 0 on sub-domain 4, about 8 × 10 − 28 8 \times10^{-28} 8 × 1 0 − 28 on sub-domain 3 and 2 × 10 − 38 2 \times10^{-38} 2 × 1 0 − 38 on sub-domain 5: the two non-zero values are not round-off, but the face term g η ⋆ Δ t ( b ( x 2 ) − b ( x 1 ) ) g\eta^\star\Delta t\left(b(x_2)-b(x_1)\right) g η ⋆ Δ t ( b ( x 2 ) − b ( x 1 ) ) produced by the exponentially small tail of the Gaussian bump (1.1 × 10 − 30 1.1 \times10^{-30} 1.1 × 1 0 − 30 m at x = 1.05 x=1.05 x = 1.05 and 2.4 × 10 − 41 2.4 \times10^{-41} 2.4 × 1 0 − 41 m at x = 1.40 x=1.40 x = 1.40 ). The missed jump has no consequence for this test, because the flow is at rest and, by Theorem 2, a continuous free surface is compatible with the step transition when q = 0 q=0 q = 0 ; for a moving flow over the same bed it would be an error.
Trained-network diagnostics across the suite
Because the exact solution is the initial state, every quantity reported for the trained network is an absolute error. Table 5 gives the space–time extrema of the deviation and the residuals reached (D3, D4).
Table 5: Diagnostics D3 and D4. Columns 3–5: space–time extrema of the deviation from the exact equilibrium on a 601 × 101 grid, normalised by η ⋆ \eta^\star η ⋆ , g h max \sqrt{gh_{\max}} g h m a x and h max g h max h_{\max}\sqrt{gh_{\max}} h m a x g h m a x . Column 6: minimum depth attained minus its exact value. Columns 7–8: largest weak cell residuals of the trained network, to be compared with the residual-operator floor of Table 3. Column 9: objective reached.
Table 5.
Criterion C5 is met by a wide margin: the normalised deviations never exceed 1.4 × 10 − 4 1.4 \times10^{-4} 1.4 × 1 0 − 4 in Run A and 3.0 × 10 − 16 3.0 \times10^{-16} 3.0 × 1 0 − 16 in Run B. In Run B the free surface of WB1 (Figure 4 ) is flat to 5.55 × 10 − 17 5.55 \times10^{-17} 5.55 × 1 0 − 17 m, which is 2 − 54 2^{-54} 2 − 54 , the spacing of double-precision numbers just below 0.5, and the minimum depth is reproduced exactly in every case; in Run A it falls below its exact value by at most 5.4 × 10 − 5 5.4 \times10^{-5} 5.4 × 1 0 − 5 m, so the barrier (28) is never active. Between the two runs the trained deviation changes by ten to fourteen decades, whereas the residual-operator floor of Table 3 changes by less than a factor of two. Comparing the trained weak residual with that floor isolates the optimisation gap: for WB3 it is a factor 2.1 in Run B (2.9 × 10 − 13 2.9 \times10^{-13} 2.9 × 1 0 − 13 against 1.4 × 10 − 13 1.4 \times10^{-13} 1.4 × 1 0 − 13 ) and a factor 5.9 × 10 11 5.9 \times10^{11} 5.9 × 1 0 11 in Run A (4.0 × 10 − 2 4.0 \times10^{-2} 4.0 × 1 0 − 2 against 6.8 × 10 − 14 6.8 \times10^{-14} 6.8 × 1 0 − 14 ). The construction contributes the floor; everything above it is the optimiser, as Corollary 1 states.
Figure 4. Lake at rest over a smooth Gaussian bump (WB1, η ⋆ = 0.5 \eta^\star= 0.5 η ⋆ = 0.5 m, T = 2 T = 2 T = 2 s). Left: free surface η = h + b \eta= h + b η = h + b and bed b b b ; centre: free surface magnified about the exact level η ⋆ \eta^\star η ⋆ ; right: discharge q q q , whose exact value is zero. Black: exact equilibrium; red: WE-PINN prediction at t = 0 t = 0 t = 0 , T / 2 T/2 T /2 and T T T (three dash patterns). The factors in the corners of the centre and right panels give the magnification and offset of the vertical axis. (a) Run A, austere budget; (b) Run B, extended budget.
Criterion C6, the absence of growth in time, is examined through Table 6 , which reports the relative errors at the final time t = T t=T t = T ; at t = 0 t=0 t = 0 they vanish identically by (29). Since b b b is exact and steady, the absolute errors in h h h and η \eta η coincide, and h h h is omitted. In Run A the errors at T T T exceed those at T / 2 T/2 T /2 by factors of 1.3 to 2.9, a growth roughly linear in t t t ; this reflects the blending τ ( t ) \tau(t) τ ( t ) of (29), which hands progressively
Table 6. Diagnostic D2: relative L 1 L^1 L 1 , L 2 L^2 L 2 and L ∞ L^\infty L ∞ errors at the final time t = T t=T t = T , on 8000 points. η \eta η is normalised by the exact field; the exact u u u and q q q vanish, so they are normalised by g h e x \sqrt{g h_{\mathrm{ex}}} g h ex and h e x g h e x h_{\mathrm{ex}}\sqrt{g h_{\mathrm{ex}}} h ex g h ex , h e x = η ⋆ − b h_{\mathrm{ex}}=\eta^\star-b h ex = η ⋆ − b .
more of the state to the network, and not an accumulating imbalance, which on a domain closed at both ends would compound. In Run B the errors at T / 2 T/2 T /2 and T T T are of the same order and decrease for u u u and q q q in WB2 and WB4; the errors in η \eta η of WB2 and WB4 are exactly zero at all 8000 evaluation points (Figure 5 and Figure 7 ). In Run A the residual deviation is a smooth structure organised by the bed, with extrema at the interfaces and, for WB3, at the undetected jump, rather than a wave emitted from a discontinuity (Figure 5 and Figure 6 ).
Figure 5. Lake at rest over a single bottom step of height 1 m (WB2, η ⋆ = 2 \eta^\star= 2 η ⋆ = 2 m, T = 1 T = 1 T = 1 s). The dotted vertical line marks the bed jump at x = 0 x = 0 x = 0 , detected from b b b alone; the depth is discontinuous there while the free surface is not. Left: free surface η = h + b \eta= h + b η = h + b and bed b b b ; centre: free surface magnified about the exact level η ⋆ \eta^\star η ⋆ ; right: discharge q q q , whose exact value is zero. Black: exact equilibrium; red: WE-PINN prediction at t = 0 t = 0 t = 0 , T / 2 T/2 T /2 and T T T (three dash patterns). The factors in the corners of the centre and right panels give the magnification and offset of the vertical axis. (a) Run A, austere budget; (b) Run B, extended budget.
Figure 6. Lake at rest over the compound bathymetry (WB3, η ⋆ = 1.5 \eta^\star=1.5 η ⋆ = 1.5 m, T = 0.15 T=0.15 T = 0.15 s). The dotted vertical lines mark the five bed jumps detected from b b b alone; the sixth jump, at x = 0.70 x=0.70 x = 0.70 m, is not detected and appears in the left panel as the step on the rising ramp. Left: free surface η = h + b \eta=h+b η = h + b and bed b b b ; centre: free surface magnified about the exact level η ⋆ \eta^\star η ⋆ ; right: discharge q q q , whose exact value is zero. Black: exact equilibrium; red: WE-PINN prediction at t = 0 t=0 t = 0 , T / 2 T/2 T /2 and T T T (three dash patterns). The factors in the corners of the centre and right panels give the magnification and offset of the vertical axis. (a) Run A, austere budget; (b) Run B, extended budget.
Figure 7. Lake at rest over the tabulated bed with 23 kinks (WB4, η ⋆ = 12 \eta^\star= 12 η ⋆ = 12 m, T = 100 T = 100 T = 100 s); the prediction is shown at t = 0 t = 0 t = 0 , 50 50 50 and 100 100 100 s. The bed is continuous, so no jump is detected and no interface is marked. Left: free surface η = h + b \eta= h + b η = h + b and bed b b b ; centre: free surface magnified about the exact level η ⋆ \eta^\star η ⋆ ; right: discharge q q q , whose exact value is zero. Black: exact equilibrium; red: WE-PINN prediction at t = 0 t = 0 t = 0 , T / 2 T/2 T /2 and T T T (three dash patterns). The factors in the corners of the centre and right panels give the magnification and offset of the vertical axis. (a) Run A, austere budget; (b) Run B, extended budget.
The interface coupling is examined in Table 7 , which reports, at the six detected interfaces, the largest jumps over t ∈ { T / 2 , T } t \in\{T/2,T\} t ∈ { T /2 , T } . All three jumps ⟦ q ⟧ \llbracket q \rrbracket [ [ q ] ] , ⟦ H ⟧ \llbracket H \rrbracket [ [ H ] ] and ⟦ η ⟧ \llbracket\eta\rrbracket [ [ η ] ] vanish at the lake at rest. In Run B they are bounded by $1.4 \times 10^{-15}$, 2.2 × 10 − 16 2.2 \times10^{-16} 2.2 × 1 0 − 16 and 2.2 × 10 − 16 2.2 \times10^{-16} 2.2 × 1 0 − 16 , with ⟦ H ⟧ = ⟦ η ⟧ = 0 \llbracket H \rrbracket=\llbracket\eta\rrbracket=0 [ [ H ] ] = [ [ η ] ] = 0 exactly at ten of the twelve sampled states, and the traces reproduce the exact depths to all printed digits, including the contrast 0.55 / 1.50 0.55/1.50 0.55/1.50 m at x = 1.05 x=1.05 x = 1.05 , where the bed jump exceeds the shallow-side depth. In Run A the jumps reach 3.9 × 10 − 4 3.9 \times10^{-4} 3.9 × 1 0 − 4 and 2.7 × 10 − 4 2.7 \times10^{-4} 2.7 × 1 0 − 4 , and the traces deviate from the exact depths in the fifth decimal place. $\llbracket H \rrbracket and [ [ η ] ] [\![\eta]\!] [ [ η ] ] coincide to the digits shown in all but one state, because the velocity head u 2 / 2 g u^2/2g u 2 /2 g is below 2 × 10 − 8 2 \times10^{-8} 2 × 1 0 − 8 m in Run A and 10 − 31 10^{-31} 1 0 − 31 m in Run B; only [ [ H ] ] [\![H]\!] [ [ H ] ] is tabulated.
Table 7. Diagnostic D5a: largest interface jumps of the trained network over t ∈ { T / 2 , T } t \in\{T/2, T\} t ∈ { T /2 , T } , with the exact depths on either side. Both jumps vanish at the lake at rest; [ [ η ] ] [\![\eta]\!] [ [ η ] ] coincides with [ [ H ] ] [\![H]\!] [ [ H ] ] to the digits shown.
Finally, Table 8 evaluates the three terms of (53) independently on a fine grid, a posteriori. Their sum, which must vanish, closes to between 1.7 × 10 − 6 1.7 \times10^{-6} 1.7 × 1 0 − 6 and 4.4 × 10 − 5 4.4 \times10^{-5} 4.4 × 1 0 − 5 of the initial water volume in Run A and to between 10 − 19 10^{-19} 1 0 − 19 and 4 × 10 − 17 4 \times10^{-17} 4 × 1 0 − 17 in Run B. Where an interface exists, the interface defect is of the same order as the other two terms, consistent with Proposition 6, in which the mass error is carried by [ [ q ] ] [\![q]\!] [ [ q ] ] . The boundary discharges, constrained directly by (57) , stay below 3.8 × 10 − 4 3.8 \times10^{-4} 3.8 × 1 0 − 4 and 3.6 × 10 − 15 3.6 \times10^{-15} 3.6 × 1 0 − 15 m2 ^2 2 s− 1 ^{-1} − 1 ; since the exact discharge is zero, they also confirm that no spurious wave reaches the ends of the domain.
Table 8. Diagnostic D5b: the three terms of the global mass balance (53) [m 2 \mathrm{m}^2 m 2 ], their sum normalised by the initial volume V 0 V_0 V 0 , and the largest boundary discharge over [ 0 , T ] [0,T] [ 0 , T ] [m 2 s − 1 \mathrm{m}^2\mathrm{s}^{-1} m 2 s − 1 ]. All vanish at the exact equilibrium. *Not applicable: WB1 and WB4 have no bed discontinuity and hence no interface (Table 2 ).
Table 2.
Summary and limitations
The suite separates the two statements of § 6.1 . The residual operator annihilates the lake at rest in the sense of Theorem 1: every residual is zero bitwise or at a round-off floor with the signatures predicted by Proposition 2, including on cells that violate the hypotheses under which the residual was constructed. The trained network approaches the equilibrium to a level set by the optimisation budget alone, which is the behaviour described by Corollary 1. Three limitations apply. (i) None of the four time windows covers a full gravity-wave transit of its domain (WB4, the longest, covers between 0.36 and 0.72 of one), so the statements about the trained solution are bounded in time; those about the residual operator involve no time integration. (ii) Exact preservation is a property of the objective and its minimiser, obtained only to the extent that the optimiser reaches it, not of a marching update rule. (iii) In float32, the working precision of Table 1 , the round-off floor is nine decades higher than in the float64 runs reported here (Table 3 ).
Riemann problems at a bottom step
Benchmark and set-up
The seven problems of this subsection, RP1–RP7, are taken from the wet-bed Riemann problems at a bottom step of Alcrudo and Benkhaldoun [20 ] , whose closed-form solutions serve as reference. All share the bed b = 0 b=0 b = 0 for x < 0 x<0 x < 0 and b = 1 b=1 b = 1 m for x ≥ 0 x\ge0 x ≥ 0 , with the initial conditions ( h l , u l ) (h_l,u_l) ( h l , u l ) for x < 0 x<0 x < 0 and ( h r , u r ) (h_r,u_r) ( h r , u r ) for x ≥ 0 x\ge0 x ≥ 0 , so that the initial discontinuity and the bed discontinuity coincide. The exact solution consists of simple waves travelling away from the step together with the stationary step transition of § 2.3 pinned to it, across which h h h , u u u and η \eta η jump while q q q and H H H are conserved. The amplitude of that jump is fixed by the cubic (8) , which has two admissible roots (Lemma 2). A correct solution therefore requires that the head condition be enforced instead of the continuity of η \eta η that a single smooth network would impose (Theorem 2), and that the physically relevant root be selected. Neither requirement is stated in the objective, which imposes only ⟦ q ⟧ = 0 \llbracket q \rrbracket=0 [ [ q ] ] = 0 and ⟦ H ⟧ = 0 \llbracket H \rrbracket=0 [ [ H ] ] = 0 at x = 0 x=0 x = 0 ; both must emerge from the minimisation.
The seven problems are listed in Table 9 and shown in Figure 8 . They cover the three characters of the transition (subcritical in RP6, critical in RP1 and RP2, supercritical in RP3, RP4, RP5 and RP7), wave patterns with and without shocks, a step twice the upstream depth (RP2), Froude numbers up to 3.2 (RP4), velocities up to 20 m s− 1 ^{-1} − 1 (RP7) and both signs of the free-surface jump. The ratio s max h t / h x s_{\max}h_t/h_x s m a x h t / h x measures how many cell widths the fastest wave crosses per cell height; it ranges from 5.4 to 26.4 and, by the quadrature argument following Proposition 1, controls the resolution of moving shocks.
Figure 8. Initial conditions of the seven Riemann problems at a bottom step, RP1–RP7, and of the smooth-bed control of Section 6.4. Each panel shows the bed, the initial free surface and the initial velocity. RP1–RP7 share b = 0 b=0 b = 0 for x < 0 x<0 x < 0 and b = 1 m b=1\ \mathrm{m} b = 1 m for x ≥ 0 x\ge0 x ≥ 0 and differ only in ( h l , u l , h r , u r ) (h_l,u_l,h_r,u_r) ( h l , u l , h r , u r ) and in the final time (Table 9); the dam break over a bump (last panel) has the smooth bed b = 3 2 e − x 2 / 2 b=\frac{3}{2}e^{-x^2/2} b = 2 3 e − x 2 /2 , no bed jump, and water initially at rest.
Table 9. The seven Riemann problems, with the step b = 0 → 1 m b=0\to1\ \mathrm{m} b = 0 → 1 m at x = 0 x=0 x = 0 and domain [ − L , L ] [-L,L] [ − L , L ] , taken from [20 ] . Wave pattern: R k R^k R k and S k S^k S k denote a k k k -rarefaction and a k k k -shock, and ∣ S S T ∣ \mid\mathrm{SST}\mid ∣ SST ∣ the stationary step transition, with its character (subcritical, critical, supercritical). U 2 U_2 U 2 and U 3 U_3 U 3 are the exact traces ( h , u ) (h,u) ( h , u ) at x = 0 − x=0^- x = 0 − and x = 0 + x=0^+ x = 0 + , F 2 F_2 F 2 , F 3 F_3 F 3 the corresponding Froude numbers and ⟦ η ⟧ \llbracket\eta\rrbracket [ [ η ] ] the exact free-surface jump. All values are properties of the benchmark, not results of the method.
Every run uses two sub-domains, obtained from the bathymetry alone by the detector of § 3.2 , which locates the jump at x = 0 x=0 x = 0 to machine precision and returns ⟦ b ⟧ = + 1.000000 \llbracket b \rrbracket=+1.000000 [ [ b ] ] = + 1.000000 in all seven cases; the network is never told that a step is present. The working precision is float32 and the parameters are those of Table 1 , with the transmissive boundary condition (27) ; the case-dependent settings are listed in Table 10 . The domain is sized from the fastest exact wave with a 35% margin, so that no wave reaches a boundary before T T T and the transmissive condition is exact; this is part of the test definition, and the boundary diagnostic of Section 6.3.3 verifies it a posteriori. The reference is the closed-form solution of [20 ] , computed as described in Appendix B and never used in the loss. Errors are relative, the norm of
Table 10. Case-dependent settings of the Riemann problems. N N N is the requested number of control volumes, N Γ N_{\Gamma} N Γ the number of interface and boundary time intervals (c τ = 2 N Γ c_{\tau}=2N_{\Gamma} c τ = 2 N Γ ), Q Q Q the Gauss–Legendre order, a 0 a_0 a 0 the initial activation slope; every sub-domain network has four hidden layers of 80 units. L-BFGS is run as a single round (N r o u n d s = 1 N_{\mathrm{rounds}}=1 N rounds = 1 ) of at most N L B F G S N_{\mathrm{LBFGS}} N LBFGS iterations.
ϕ θ − ϕ e x \phi_\theta-\phi_{\mathrm{ex}} ϕ θ − ϕ ex divided by the same norm of ϕ e x \phi_{\mathrm{ex}} ϕ ex , on a uniform grid of 8000 points, for ϕ ∈ { h , u , η , q , F } \phi\in\{h,u,\eta,q,F\} ϕ ∈ { h , u , η , q , F } . The L 1 L^1 L 1 norm measures the accuracy of the solution away from discontinuities, whereas the L ∞ L^\infty L ∞ norm measures the thickness of the smeared shock. None of the norms tests the interface, which occupies a single abscissa; the interface is judged by the traces and jumps of Table 12 .
Table 12. Interface diagnostic at t = T t = T t = T : traces of the trained network at x = 0 ∓ x = 0^\mp x = 0 ∓ , to be compared with U 2 U_2 U 2 , U 3 U_3 U 3 of Table 9; the discharge and head defects, which must vanish, normalised by the local ∣ q ∣ \lvert q\rvert ∣ q ∣ and H H H ; and the free-surface jump, which must not vanish, against its exact value.
Accuracy of the wave pattern
The trained solutions are compared with the exact ones in Figure 9 –Figure 15 , and the errors at the final time are given in Table 11 . In every case the number, type and position of the waves and the intermediate plateaux are recovered, and the stationary transition stays pinned at x = 0 x=0 x = 0 throughout. On the free surface the relative L 1 L^1 L 1 error at t = T t=T t = T lies between 6.9 × 10 − 4 6.9 \times10^{-4} 6.9 × 1 0 − 4 (RP6) and 3.5 × 10 − 3 3.5 \times10^{-3} 3.5 × 1 0 − 3 (RP1), one to four parts in a thousand, with the depth slightly larger and the discharge larger again. Between T / 2 T/2 T /2 and T T T this error changes by factors between 0.96 and 1.33: it does not accumulate in time, and in RP3 it decreases while the solution develops.
Table 11. Relative errors of the trained network at the final time t = T t=T t = T against the exact solution of [20 ] , on 8000 points. Each entry is the norm of the error divided by the same norm of the exact field; at t = 0 t=0 t = 0 all errors vanish identically by (29).
Figure 9. RP1, critical transition (h = 4 / 2 h=4/2 h = 4/2 m, u = − 10 / 0 u=-10/0 u = − 10/0 m s− 1 ^{-1} − 1 ): a 1-rarefaction and a 2-shock on the low bed, the critical transition and a 2-rarefaction on the high bed. Free surface η = h + b \eta=h+b η = h + b (top), depth (middle) and velocity (bottom) at t = 0 t=0 t = 0 , T / 2 T/2 T /2 and T T T . Black: exact solution [20 ] ; red dashed: WE-PINN; grey: bed.
Figure 15. RP7, high-velocity inflow (h = 2 / 3 h = 2/3 h = 2/3 m, u = 12 / 20 u = 12/20 u = 12/20 m s− 1 ^{-1} − 1 ): supercritical transition with both rarefactions on the high bed. Free surface η = h + b \eta= h + b η = h + b (top), depth (middle) and velocity (bottom) at t = 0 t = 0 t = 0 , T / 2 T/2 T /2 and T T T . Black: exact solution [20 ] ; red dashed: WE-PINN; grey: bed.
The two critical cases test a property that appears nowhere in the objective: the flow must reach F 3 = − 1 F_3=-1 F 3 = − 1 exactly at x = 0 + x=0^+ x = 0 + , the value at which the cubic (8) has a double root. In RP1 (Figure 9 ) the exact solution has four waves: a 1-rarefaction and a 2-shock on the low bed, the critical transition, and a transcritical 2-rarefaction on the high bed. All four are recovered with the correct plateau values. The trained traces ( 0.4295 , − 6.1102 ) (0.4295,-6.1102) ( 0.4295 , − 6.1102 ) and ( 0.8845 , − 2.9655 ) (0.8845,-2.9655) ( 0.8845 , − 2.9655 ) match the exact ( 0.4295 , − 6.1118 ) (0.4295,-6.1118) ( 0.4295 , − 6.1118 ) and ( 0.8889 , − 2.9530 ) (0.8889,-2.9530) ( 0.8889 , − 2.9530 ) to within 0.5% in depth, and give F 3 = − 1.007 F_3=-1.007 F 3 = − 1.007 at x = 0 + x=0^+ x = 0 + against the exact − 1 -1 − 1 : the critical state is attained without ever being prescribed.
RP2 (Figure 10 ) is the most severe geometric test, with a step twice the upstream depth: two shocks on the low bed force a transcritical 2-rarefaction on the high bed. The four-wave structure is reproduced, and the trained trace gives F 3 = − 0.980 F_3=-0.980 F 3 = − 0.980 at x = 0 + x=0^+ x = 0 + against the exact − 1 -1 − 1 . The free-surface jump, which exceeds the bed jump by 60%, is obtained as +1.6299 m against +1.6122 m, a 1.1% error that is the largest of the subset. The interface residuals of RP2 are nevertheless among the smallest (∣ [ [ q ] ] ∣ / ∣ q ∣ = 2.8 × 10 − 5 \lvert\lbrack\lbrack q\rbrack\rbrack\rvert/\lvert q\rvert=2.8\times10^{-5} ∣[[ q ]]∣ / ∣ q ∣ = 2.8 × 1 0 − 5 ), so the discrepancy lies in the states that the closure connects, not in the closure itself, and the minimum depth, 0.45 m, stays an order of magnitude above h s a f e h_{\mathrm{safe}} h safe .
Figure 10. RP2, step twice the upstream depth (h = 0.5 / 3 h = 0.5/3 h = 0.5/3 m, u = − 3 / 0 u = -3/0 u = − 3/0 m s− 1 ^{-1} − 1 ): two shocks on the low bed, a critical transition and a 2-rarefaction on the high bed. Free surface η = h + b \eta= h + b η = h + b (top), depth (middle) and velocity (bottom) at t = 0 t = 0 t = 0 , T / 2 T/2 T /2 and T T T . Black: exact solution [20 ] ; red dashed: WE-PINN; grey: bed.
RP3 and RP4 (Figure 11 and Figure 12 ) probe the robustness of the coupling and of the parameterisation. In RP3 the transition is supercritical from right to left, so the exact solution leaves the right state untouched, U 3 = U r U_3=U_r U 3 = U r . This targets a failure mode specific to a global space–time minimisation, in which spurious influence could reach regions that no wave has reached. The trained trace at x = 0 + x=0^+ x = 0 + is (3.0000, −8.0000), equal to U r U_r U r to four decimal places, and is held over the whole right half-domain, although the interface residuals carry ten times the weight of the cell residuals. RP4 stresses the nonlinearity of the momentum flux: with F 2 = + 3.19 F_2=+3.19 F 2 = + 3.19 the convective part q 2 / h q^2/h q 2 / h dominates the hydrostatic part by an order of magnitude at a depth of 1 m, which is where a parameterisation by η \eta η rather than h h h is most exposed. The traces (1.0004, 9.9948) and (1.1353, 8.8098) match the exact ones, no oscillation develops near the step, and the relative L 1 L^1 L 1 error in η \eta η , 8.6 × 10 − 4 8.6\times10^{-4} 8.6 × 1 0 − 4 , is among the smallest of the subset.
Figure 11. RP3, undisturbed far side (h = 1 / 3 h = 1/3 h = 1/3 m, u = − 11 / − 8 u = -11/-8 u = − 11/ − 8 m s− 1 ^{-1} − 1 ): a 1-shock and a 2-rarefaction on the low bed and a supercritical transition, with the right state untouched. Free surface η = h + b \eta= h + b η = h + b (top), depth (middle) and velocity (bottom) at t = 0 t = 0 t = 0 , T / 2 T/2 T /2 and T T T . Black: exact solution [20 ] ; red dashed: WE-PINN; grey: bed.
Figure 12. RP4, strongly supercritical flow (h = 1 / 3 h = 1/3 h = 1/3 m, u = 10 / 8 u = 10/8 u = 10/8 m s− 1 ^{-1} − 1 , F 2 = + 3.19 F_2 = +3.19 F 2 = + 3.19 ): supercritical transition followed by a 1-shock and a 2-rarefaction on the high bed. Free surface η = h + b \eta= h + b η = h + b (top), depth (middle) and velocity (bottom) at t = 0 t = 0 t = 0 , T / 2 T/2 T /2 and T T T . Black: exact solution [20 ] ; red dashed: WE-PINN; grey: bed.
The L ∞ L^\infty L ∞ column of Table 11 separates the subset into two groups that do not overlap. The three rarefaction-only cases RP5, RP6 and RP7 (Figure 13 , Figure 14 and Figure 15 ) reach 4.1 × 10 − 2 4.1\times10^{-2} 4.1 × 1 0 − 2 , 7.2 × 10 − 3 7.2\times10^{-3} 7.2 × 1 0 − 3 and 4.7 × 10 − 2 4.7\times10^{-2} 4.7 × 1 0 − 2 in h h h , while the four cases containing a shock lie between 7.8 × 10 − 2 7.8\times10^{-2} 7.8 × 1 0 − 2 and 3.0 × 10 − 1 3.0\times10^{-1} 3.0 × 1 0 − 1 . The separation does not follow the cell aspect: RP5 has the largest ratio s max h t / h x = 26.4 s_{\max}h_t/h_x=26.4 s m a x h t / h x = 26.4 and one of the smallest L ∞ L^\infty L ∞ errors, while RP2 has the smallest ratio, 5.4, and an error more than three times larger. The two groups differ in
Figure 13. RP5, fast rarefactions (h = 3 / 3 h = 3/3 h = 3/3 m, u = − 21 / − 7 u = -21/-7 u = − 21/ − 7 m s− 1 ^{-1} − 1 ): two rarefactions on the low bed and a supercritical transition, the fastest case of the subset. Free surface η = h + b \eta= h + b η = h + b (top), depth (middle) and velocity (bottom) at t = 0 t = 0 t = 0 , T / 2 T/2 T /2 and T T T . Black: exact solution [20 ] ; red dashed: WE-PINN; grey: bed.
Figure 14. RP6, subcritical transition in deep flow (h = 8 / 5 h = 8/5 h = 8/5 m, u = − 2 / 8 u = -2/8 u = − 2/8 m s− 1 ^{-1} − 1 ): two rarefactions separated by a subcritical transition with a negative free-surface jump. Free surface η = h + b \eta= h + b η = h + b (top), depth (middle) and velocity (bottom) at t = 0 t = 0 t = 0 , T / 2 T/2 T /2 and T T T . Black: exact solution [20 ] ; red dashed: WE-PINN; grey: bed.
the regularity of the lateral integrand, which is the mechanism identified after Proposition 1: the Gauss–Legendre rule on the lateral faces converges at its nominal rate on the Lipschitz integrand of a rarefaction however fast the wave crosses the cell, and degrades on the discontinuous integrand of a shock. Consistently, the free-surface jump of RP5, the largest of the subset, is reproduced to four decimal places (+1.6806 against +1.6805 m), and that of RP7 to the four decimals of the exact value (+1.1839 m). The shock smearing seen in RP1–RP4 is thus a resolution effect of the lateral quadrature, not a defect of the step treatment.
Finally, RP6 (Figure 14 ) tests the selection of the subcritical root, which nothing in the objective performs. The trained traces (4.2907, 2.7423) and (2.7203, 4.3257) give ⟦ η ⟧ = − 0.5704 \llbracket\eta\rrbracket= -0.5704 [ [ η ] ] = − 0.5704 m against the exact −0.5701 m, and both Froude numbers stay below unity across the step, whereas the supercritical root for the same discharge and head would have produced a shallower, faster state at x = 0 + x = 0+ x = 0 + and a larger negative jump, ⟦ η ⟧ ≈ − 1.13 \llbracket\eta\rrbracket\approx-1.13 [ [ η ] ] ≈ − 1.13 m. The selection is not forced by the far field, since the right state itself is supercritical (F r = + 1.14 Fr = +1.14 F r = + 1.14 ). RP6 is also the most accurate case, with a relative L 1 L^1 L 1 error of 6.9 × 10 − 4 6.9 \times10^{-4} 6.9 × 1 0 − 4 in η \eta η .
Interface fidelity, conservation and cost
Table 12 reports the traces of the trained network on both sides of the step. The closure is enforced uniformly: the discharge defect never exceeds 4.6 × 10 − 4 4.6 \times10^{-4} 4.6 × 1 0 − 4 of the local discharge and the head defect 1.6 × 10 − 4 1.6 \times10^{-4} 1.6 × 1 0 − 4 of the local head, with no systematic dependence on the character of the transition, the depth ratio or the presence of a shock. At the same time the free-surface jump, which must not vanish, is reproduced to within 0.3 % 0.3\% 0.3% in six of the seven cases and to 1.1 % 1.1\% 1.1% in RP2, over a range from − 0.5704 -0.5704 − 0.5704 to + 1.6806 +1.6806 + 1.6806 m that includes a negative jump. The two observations together distinguish the correct closure from a plausible substitute: a formulation that replaced the head condition by continuity of the free surface could also return small ⟦ q ⟧ \llbracket q \rrbracket [ [ q ] ] and ⟦ H ⟧ \llbracket H \rrbracket [ [ H ] ] , but would necessarily give ⟦ η ⟧ = 0 \llbracket\eta\rrbracket= 0 [ [ η ] ] = 0 and violate the head condition by the amount bounded in Theorem 2.
Table 13 collects the conservation, boundary and cost diagnostics. The residual of the mass balance (53) , with its three terms computed independently, stays between 3.5 × 10 − 6 3.5 \times10^{-6} 3.5 × 1 0 − 6 and 2.7 × 10 − 4 2.7 \times10^{-4} 2.7 × 1 0 − 4 of the initial water volume. The free-surface excursion at the boundaries never exceeds 6.2 × 10 − 4 6.2 \times10^{-4} 6.2 × 1 0 − 4 m, which confirms that no wave reached a boundary and that the transmissive condition was never stressed. The minimum depth, from 0.42 m (RP1) to 2.72 m (RP6), remains at least eight times h s a f e = 5 × 10 − 2 h_{\mathrm{safe}} = 5 \times10^{-2} h safe = 5 × 1 0 − 2 m, so the positivity barrier is inactive throughout.
Table 13. Conservation, boundary and cost diagnostics. Mass: residual of (53) normalised by the initial volume V 0 V_0 V 0 . Boundary: max t ∣ η θ − η 0 ∣ \max_t|\eta_\theta-\eta_0| max t ∣ η θ − η 0 ∣ at x = − L x=-L x = − L and x = + L x=+L x = + L , which detects a wave reaching a boundary. L ( θ ) \mathcal{L}(\theta) L ( θ ) : objective reached; N e v a l N_{\mathrm{eval}} N eval : number of loss evaluations; t t r a i n t_{\mathrm{train}} t train : training time on one A100-SXM4-80GB.
The cost is the main limitation. Training takes between 110 and 443 s per case on a single A100, against a fraction of a second for a well-balanced finite-volume scheme on the same problem, and, although the optimiser settings are the same in all seven cases (Table 10 ), the effort is not predictable from the data: the number of loss evaluations needed varies by a factor of 4.4 and the final objective by an order of magnitude. This sensitivity to the optimiser, not the treatment of the step, is the least satisfactory aspect of the present implementation. What the subset establishes is that the construction of § 3 solves the right problem: over a discontinuous bed, at non-zero discharge, in sub-, super- and critical regimes and with either sign of the free-surface jump, the trained network converges to the correct weak solution rather than to the continuous one that a single smooth network would be forced to produce.
A smooth-bed control: dam break over a bump
The last test removes the bed discontinuity altogether: b = 3 2 e − x 2 / 2 b = \frac{3}{2}e^{-x^2/2} b = 2 3 e − x 2 /2 on [ − 10 , 10 ] [-10,10] [ − 10 , 10 ] m with η 0 = 4 \eta_0 = 4 η 0 = 4 m for x < 0 x < 0 x < 0 and 2 m for x ≥ 0 x \ge0 x ≥ 0 , water initially at rest, transmissive boundaries and T = 1 T = 1 T = 1 s. The detector finds no jump, the decomposition collapses to a single network (4 × 40, 5123 parameters), and no interface condition is imposed: the interface term of the objective is identically zero at every iteration, not merely small. This is the empirical counterpart of Proposition 5: without a bed jump the additional machinery removes itself and only the source treatment of Sections 3.4–3.5 remains. Since the bed is smooth, non-constant and the flow unsteady, the test also checks what the lake-at-rest suite cannot: that the bed-slope correction, which makes the equilibrium exact, does not degrade the solution far from equilibrium, a question that Proposition 4 answers only asymptotically. The settings are N = 8000 N = 8000 N = 8000 , N Γ = 80 N_{\Gamma} = 80 N Γ = 80 , Q = 12 Q = 12 Q = 12 , a 0 = 0.9 a_0 = 0.9 a 0 = 0.9 , 5000 Adam iterations and one L-BFGS round of 10 4 10^4 1 0 4 iterations. No closed-form solution exists, and the reference is the second-order well-balanced MUSCL–HLL scheme of Appendix C [68 , 4 ] on 4000 cells at CFL = 0.4, with minmod reconstruction of ( η , u , b ) (\eta,u,b) ( η , u , b ) , hydrostatic reconstruction and two-stage SSP Runge–Kutta time stepping.
The solution (Figure 16 ) follows the reference through the rarefaction, over the bump, across the strong acceleration on the lee slope, where the velocity reaches 5.5 m s− 1 ^{-1} − 1 , and across the right-running shock, with the correct plateau values on both sides. The relative errors at t = T t=T t = T (Table 14 ) are 1.4 × 10 − 3 1.4 \times10^{-3} 1.4 × 1 0 − 3 in η \eta η and 1.5 × 10 − 3 1.5 \times10^{-3} 1.5 × 1 0 − 3 in h h h in L 1 L^1 L 1 , of the same order as in the cases with an interface. The L ∞ L^\infty L ∞ error, 1.7 × 10 − 1 1.7 \times10^{-1} 1.7 × 1 0 − 1 in h h h , sits on the shock and is the lateral-quadrature effect identified in § 6.3.2 (s max h t / h x = 6.3 s_{\max}h_t/h_x = 6.3 s m a x h t / h x = 6.3 ). The global mass balance closes to 3.9 × 10 − 5 3.9 \times10^{-5} 3.9 × 1 0 − 5 of the initial volume, and the final objective, 6.9 × 10 − 5 6.9 \times10^{-5} 6.9 × 1 0 − 5 , shows that removing the interface does not make the problem easier to optimise: the difficulty lies in the shock, not in the coupling.
Figure 16. Dam break over a smooth Gaussian bump with no bed jump: free surface (top), depth (middle) and velocity (bottom) at t = 0 t = 0 t = 0 , T / 2 T/2 T /2 and T T T . Black: well-balanced MUSCL–HLL reference; red dashed: WE-PINN with a single network and no interface condition; grey: bed.
Table 14. Dam break over a smooth bump: relative errors at t = T t = T t = T against the MUSCL–HLL reference, on 8000 points.
Conclusions
We have extended the weak-form space–time control-volume formulation of WE-PINNs from homogeneous conservation laws to the shallow water balance law over smooth and discontinuous bathymetry, and made the extension well balanced by construction. The construction combines three elements. The free-surface variables, which play the role they play in surface-gradient and pre-balanced finite-volume schemes, make the momentum flux constant and the geometric source vanish pointwise at the lake at rest. The source is evaluated over each control volume by an integration by parts that transfers the derivative from the network to the bed, so that the residual never differentiates the approximation. A cell-local shift of the bed slope, chosen so that the quadrature reproduces the exact bed increment, makes the equilibrium cancellation exact for any control-volume family, any quadrature order and any nominal bed slope; it decouples well-balancedness from the mesh and from the accuracy, and even the existence, of a bed derivative. Bed discontinuities are located from the bathymetry alone, and the resulting sub-domains, each carrying its own network, are coupled through conservation of discharge and total head, of which the first is forced by mass conservation and the second is a closure isolated in a single term of the objective.
The analysis establishes that the common zeros of the continuous residuals are the weak solutions of the balance law, that the fully discrete residual vanishes identically on the lake at rest, so that the equilibrium is an exactly representable global minimiser of the training objective, that the bed-slope correction is of the order of the quadrature error it cancels, and that an approximation with a continuous free surface cannot satisfy the head condition at a bed step at non-zero discharge, with an explicit lower bound on the defect. The decomposition at bed jumps is therefore necessary, not a convenience.
The experiments confirm these statements and separate what the construction guarantees from what the optimiser achieves. On four lake-at-rest configurations, over smooth, discontinuous, compound and tabulated beds, the residual operator annihilates the exact equilibrium bitwise or to a round-off floor identified by its dependence on the working precision, including on cells that contain an undetected bed jump; the trained network approaches the equilibrium to O ( 10 − 4 ) O(10^{-4}) O ( 1 0 − 4 ) of the physical scales under an austere budget and to round-off under an extended one, and the difference between the two is optimisation error. On seven Riemann problems at a bottom step with closed-form solutions, covering sub-, super- and critical transitions, the trained network recovers the stationary transition and the surrounding wave pattern, with relative L 1 L^1 L 1 errors in the free surface between 6.9 × 10 − 4 6.9 \times10^{-4} 6.9 × 1 0 − 4 and 3.5 × 10 − 3 3.5 \times10^{-3} 3.5 × 1 0 − 3 , free-surface jumps between − 0.57 -0.57 − 0.57 and + 1.68 +1.68 + 1.68 m reproduced, critical states attained without being prescribed, and the subcritical root selected without any explicit mechanism. The remaining L ∞ L^\infty L ∞ error is confined to shocks and is explained by the lateral quadrature of a discontinuous integrand. A dam break over a smooth bump confirms that, when the bed has no discontinuity, the decomposition and interface terms vanish and only the source treatment remains.
Several limitations remain. First, no estimate links the trained objective to the L 1 L^1 L 1 error. Second, the well-balanced guarantee concerns the objective and its minimiser, not the optimiser. Finally, dry states are not treated. These points set the directions of future work: a stability framework supporting a convergence estimate, and the extension of the method to wet–dry fronts.
Acknowledgments
The authors gratefully acknowledge the support and computing resources provided by the Toubkal Supercomputer [69 ] (https://toubkal.um6p.ma) at UM6P, Morocco, where all computational experiments were carried out on NVIDIA A100 GPUs.
Code Availability
The source code is publicly available at https://github.com/oubarka-ismail/Well-Balanced_WE-PINNs.
Tabulated bathymetry of configuration WB4
The bed of WB4 is the piecewise-linear interpolant of the following 28 points on [ 0 , 1500 ] [0,1500] [ 0 , 1500 ] m; the initial free surface is η 0 ≡ 12 \eta_0 \equiv12 η 0 ≡ 12 m and the water is at rest.
Table A.
The exact Riemann solver at a bottom step
The reference solutions of Section 6.3 follow the closed-form construction of [20 ] , reimplemented here. They are computed after training, used for comparison only, and never enter the loss. The construction applies when, and only when, the initial conditions are two constant states separated by a single bed step at the same abscissa; the solution is then self-similar in ξ = x / t \xi= x/t ξ = x / t , and the step is the stationary wave at ξ = 0 \xi= 0 ξ = 0 .
Building blocks
Away from the step the bed is constant and the system is the homogeneous shallow water system, so the two states connected by a k k k -wave lie on its classical wave curves. Writing c ( h ) = g h c(h) = \sqrt{gh} c ( h ) = g h , a state ( h , u ) (h,u) ( h , u ) is joined to ( h l , u l ) (h_l,u_l) ( h l , u l ) by a 1-wave and to ( h r , u r ) (h_r,u_r) ( h r , u r ) by a 2-wave when, respectively,
u = Ψ 1 ( h ; h l , u l ) : = { u l + 2 c ( h l ) − 2 c ( h ) , h ≤ h l (rarefaction) , u l − 1 2 g ( h − h l ) 2 ( 1 h + 1 h l ) , h > h l (shock) . (58) u = \Psi^1(h;h_l,u_l) :=
\begin{cases}
u_l + 2c(h_l) - 2c(h), & h \le h_l \quad\text{(rarefaction)},\\
u_l - \sqrt{\frac{1}{2}g(h-h_l)^2\left(\frac{1}{h}+\frac{1}{h_l}\right)}, & h > h_l \quad\text{(shock)}.
\end{cases} \tag*{(58)} u = Ψ 1 ( h ; h l , u l ) := ⎩ ⎨ ⎧ u l + 2 c ( h l ) − 2 c ( h ) , u l − 2 1 g ( h − h l ) 2 ( h 1 + h l 1 ) , h ≤ h l (rarefaction) , h > h l (shock) . (58)
u = Ψ 2 ( h ; h r , u r ) : = { u r − 2 c ( h r ) + 2 c ( h ) , h ≤ h r (rarefaction) , u r + 1 2 g ( h − h r ) 2 ( 1 h + 1 h r ) , h > h r (shock) . (59) u = \Psi^2(h;h_r,u_r) :=
\begin{cases}
u_r - 2c(h_r) + 2c(h), & h \le h_r \quad\text{(rarefaction)},\\
u_r + \sqrt{\frac{1}{2}g(h-h_r)^2\left(\frac{1}{h}+\frac{1}{h_r}\right)}, & h > h_r \quad\text{(shock)}.
\end{cases} \tag*{(59)} u = Ψ 2 ( h ; h r , u r ) := ⎩ ⎨ ⎧ u r − 2 c ( h r ) + 2 c ( h ) , u r + 2 1 g ( h − h r ) 2 ( h 1 + h r 1 ) , h ≤ h r (rarefaction) , h > h r (shock) . (59)
The associated speeds are, for the 1-family, the fan [ u l − c ( h l ) , u − c ( h ) ] [u_l-c(h_l),u-c(h)] [ u l − c ( h l ) , u − c ( h )] in the rarefaction case and the single ray u l − 1 2 g ( h + h l ) h / h l u_l-\sqrt{\frac{1}{2}g(h+h_l)h/h_l} u l − 2 1 g ( h + h l ) h / h l in the shock case, and symmetrically for the 2-family. Two states admitting a classical solution (the case u l + 2 c ( h l ) ≥ u r − 2 c ( h r ) u_l+2c(h_l) \ge u_r-2c(h_r) u l + 2 c ( h l ) ≥ u r − 2 c ( h r ) , outside which a vacuum forms) are connected through the intermediate state U m = ( h m , u m ) U_m=(h_m,u_m) U m = ( h m , u m ) obtained from the scalar equation Ψ 1 ( h m ; h l , u l ) = Ψ 2 ( h m ; h r , u r ) \Psi^1(h_m;h_l,u_l)=\Psi^2(h_m;h_r,u_r) Ψ 1 ( h m ; h l , u l ) = Ψ 2 ( h m ; h r , u r ) ; we write U m = R ( U l , U r ) U_m=\mathcal{R}(U_l,U_r) U m = R ( U l , U r ) for this classical Riemann solution.
Across the step the connection is not a wave curve but the stationary step transition (6)–(7). Given a trace ( h , u ) (h,u) ( h , u ) on one side and a bed increment Δ z \Delta z Δ z towards the other, the conjugate state T Δ z ( h , u ) = ( h ~ , u ~ ) T_{\Delta z}(h,u)=(\tilde{h},\tilde{u}) T Δ z ( h , u ) = ( h ~ , u ~ ) is defined by u ~ = q / h ~ \tilde{u}=q/\tilde{h} u ~ = q / h ~ with q = h u q=hu q = h u and h ~ \tilde{h} h ~ a positive root of the cubic (8) with A = H ⋆ : = h + u 2 / 2 g − Δ z A=H_\star:=h+u^2/2g-\Delta z A = H ⋆ := h + u 2 /2 g − Δ z . By Lemma 2 such a root exists if and only if α : = q 2 / ( 2 g H ⋆ 3 ) ≤ 4 / 27 \alpha:=q^2/(2gH_\star^3)\le4/27 α := q 2 / ( 2 g H ⋆ 3 ) ≤ 4/27 , and the two roots are given in closed form by
h ~ = H ⋆ [ 1 3 + 2 3 cos ( ϑ 3 − κ ) ] , ϑ = arccos ( 1 − 27 2 α ) , κ = { 0 , subcritical branch , 2 π 3 , supercritical branch , (60) \tilde{h}=H_\star\left[\frac{1}{3}+\frac{2}{3}\cos\left(\frac{\vartheta}{3}-\kappa\right)\right],\qquad\vartheta=\arccos\left(1-\frac{27}{2}\alpha\right),\qquad\kappa=
\begin{cases}
0, & \text{subcritical branch},\\
\frac{2\pi}{3}, & \text{supercritical branch},
\end{cases} \tag*{(60)} h ~ = H ⋆ [ 3 1 + 3 2 cos ( 3 ϑ − κ ) ] , ϑ = arccos ( 1 − 2 27 α ) , κ = { 0 , 3 2 π , subcritical branch , supercritical branch , (60)
which coalesce at the critical depth h ~ = 2 3 H ⋆ = ( q 2 / g ) 1 / 3 \tilde{h}=\frac{2}{3}H_\star=(q^2/g)^{1/3} h ~ = 3 2 H ⋆ = ( q 2 / g ) 1/3 when α = 4 / 27 \alpha=4/27 α = 4/27 . The implementation returns the branch matching the Froude regime of the incoming state, and refuses the transition when H ⋆ ≤ 0 H_\star\le0 H ⋆ ≤ 0 or α > 4 / 27 \alpha>4/27 α > 4/27 : the head carried by the incoming state is then insufficient to cross the step, and no solution of the assumed type exists.
The five admissible orderings
A solution is a sequence of the 1-wave W 1 W^1 W 1 , the 2-wave W 2 W^2 W 2 and the transition SST, arranged in order of increasing ξ \xi ξ with the transition fixed at ξ = 0 \xi= 0 ξ = 0 . Genuine nonlinearity forbids a wave of the same family on both sides of the step, except in the resonant patterns (D) and (E) below, where the second wave of that family is a transcritical rarefaction attached to the step, and the transition can be crossed only in the direction of the flow, so only five orderings are admissible. Following [20 ] they are, with U 2 U_2 U 2 and U 3 U_3 U 3 the traces at ξ = 0 − \xi= 0^- ξ = 0 − and ξ = 0 + \xi= 0^+ ξ = 0 + and U m U_m U m the intermediate state of a classical pair,
(A) U l → W 1 U 2 → S S T s u b U 3 → W 2 U r , (B) U l → W 1 U m → W 2 U 2 → S S T s u p U 3 = U r , (C) U l = U 2 → S S T s u p U 3 → W 1 U m → W 2 U r , (D) U l → W 1 U m → W 2 U 2 → S S T c r i t U 3 → R 2 U r , (E) U l → W 1 U 2 → S S T c r i t U 3 → R 1 U m → W 2 U r . (61) \begin{aligned}
\text{(A)}\quad&U_l \xrightarrow{W^1} U_2 \xrightarrow{\mathrm{SST}_{\mathrm{sub}}} U_3 \xrightarrow{W^2} U_r,\\
\text{(B)}\quad&U_l \xrightarrow{W^1} U_m \xrightarrow{W^2} U_2 \xrightarrow{\mathrm{SST}_{\mathrm{sup}}} U_3 = U_r,\\
\text{(C)}\quad&U_l = U_2 \xrightarrow{\mathrm{SST}_{\mathrm{sup}}} U_3 \xrightarrow{W^1} U_m \xrightarrow{W^2} U_r,\\
\text{(D)}\quad&U_l \xrightarrow{W^1} U_m \xrightarrow{W^2} U_2 \xrightarrow{\mathrm{SST}_{\mathrm{crit}}} U_3 \xrightarrow{R^2} U_r,\\
\text{(E)}\quad&U_l \xrightarrow{W^1} U_2 \xrightarrow{\mathrm{SST}_{\mathrm{crit}}} U_3 \xrightarrow{R^1} U_m \xrightarrow{W^2} U_r. \tag*{(61)}
\end{aligned} (A) (B) (C) (D) (E) U l W 1 U 2 SST sub U 3 W 2 U r , U l W 1 U m W 2 U 2 SST sup U 3 = U r , U l = U 2 SST sup U 3 W 1 U m W 2 U r , U l W 1 U m W 2 U 2 SST crit U 3 R 2 U r , U l W 1 U 2 SST crit U 3 R 1 U m W 2 U r . (61)
The five differ in where the transition sits relative to the two waves and in its character, and each carries its own solvability conditions.
In (A) the transition is subcritical and separates the two waves, so both U 2 U_2 U 2 and U 3 U_3 U 3 must be subcritical and the 1-wave must lie entirely in ξ < 0 \xi< 0 ξ < 0 and the 2-wave entirely in ξ > 0 \xi> 0 ξ > 0 . In (B) both waves lie on the low bed to the left of a supercritical transition, which leaves the right state untouched, U 3 = U r U_3 = U_r U 3 = U r ; this requires U r U_r U r itself to be supercritical and directed towards the step. Configuration (C) is its mirror image, with U l U_l U l supercritical and U 2 = U l U_2 = U_l U 2 = U l , and both waves on the far side of the step. In (D) and (E) the flow is choked: the transition is critical, ∣ F 3 ∣ = 1 |F_3| = 1 ∣ F 3 ∣ = 1 , and the state U 3 U_3 U 3 is joined to the far state not by a wave of arbitrary sign but by a transcritical rarefaction attached to the step, whose tail sits at ξ = 0 \xi= 0 ξ = 0 and which accelerates the flow away from the critical point. (D) and (E) are mirror images of each other under reversal of the flow direction: in both the transcritical fan lies on the right of the step, of the 2-family in (D) and of the 1-family in (E).
Reduction to a scalar equation, and selection
Each ordering reduces to one scalar unknown, so all five are solved by the same machinery.
Patterns (B), (C) and (D) are explicit up to a classical Riemann solve. In (B) the right state is known, U 3 = U r U_3 = U_r U 3 = U r , so U 2 = T − Δ z ( U r ) U_2 = \mathcal{T}_{-\Delta z}(U_r) U 2 = T − Δ z ( U r ) on the supercritical branch and U m = R ( U l , U 2 ) U_m = \mathcal{R}(U_l,U_2) U m = R ( U l , U 2 ) ; in (C), symmetrically, U 2 = U l U_2 = U_l U 2 = U l , U 3 = T + Δ z ( U l ) U_3 = \mathcal{T}_{+\Delta z}(U_l) U 3 = T + Δ z ( U l ) on the supercritical branch and U m = R ( U 3 , U r ) U_m = \mathcal{R}(U_3,U_r) U m = R ( U 3 , U r ) . In (D) criticality on the right of the step fixes U 3 U_3 U 3 outright: the transcritical fan carries the 2-invariant of U r U_r U r , so c 3 = 1 3 ( 2 c ( h r ) − u r ) c_3 = \frac{1}{3}(2c(h_r)-u_r) c 3 = 3 1 ( 2 c ( h r ) − u r ) , h 3 = c 3 2 / g h_3 = c_3^2/g h 3 = c 3 2 / g and u 3 = − c 3 u_3 = -c_3 u 3 = − c 3 , after which U 2 = T − Δ z ( U 3 ) U_2 = \mathcal{T}_{-\Delta z}(U_3) U 2 = T − Δ z ( U 3 ) and U m = R ( U l , U 2 ) U_m = \mathcal{R}(U_l,U_2) U m = R ( U l , U 2 ) .
Patterns (A) and (E) require a root. In (A) the unknown is the depth h 2 h_2 h 2 at ξ = 0 − \xi= 0^- ξ = 0 − , and the residual to be annihilated states that the conjugate of the 1-wave state matches the 2-wave curve,
Φ A ( h 2 ) : = u ~ ( h 2 ) − Ψ 2 ( h ~ ( h 2 ) ; h r , u r ) = 0 , ( h ~ , u ~ ) = T + Δ z ( h 2 , Ψ 1 ( h 2 ; h l , u l ) ) , (62) \Phi_A(h_2) := \widetilde{u}(h_2) - \Psi^2(\widetilde{h}(h_2);h_r,u_r) = 0,\qquad(\widetilde{h},\widetilde{u}) = \mathcal{T}_{+\Delta z}(h_2,\Psi^1(h_2;h_l,u_l)), \tag*{(62)} Φ A ( h 2 ) := u ( h 2 ) − Ψ 2 ( h ( h 2 ) ; h r , u r ) = 0 , ( h , u ) = T + Δ z ( h 2 , Ψ 1 ( h 2 ; h l , u l )) , (62)
on the subcritical branch. In (E) the unknown is again h 2 h_2 h 2 , and criticality at ξ = 0 + \xi= 0^+ ξ = 0 + with h 3 = ( q 2 / g ) 1 / 3 h_3 = (q^2/g)^{1/3} h 3 = ( q 2 / g ) 1/3 turns the head condition into
Φ E ( h 2 ) : = h 2 + u 2 2 2 g − 3 2 ( h 2 u 2 2 g ) 2 / 3 − Δ z = 0 , u 2 = Ψ 1 ( h 2 ; h l , u l ) . (63) \Phi_E(h_2) := h_2 + \frac{u_2^2}{2g} - \frac{3}{2}\left(\frac{h_2u_2^2}{g}\right)^{2/3} - \Delta z = 0,\qquad u_2 = \Psi^1(h_2;h_l,u_l). \tag*{(63)} Φ E ( h 2 ) := h 2 + 2 g u 2 2 − 2 3 ( g h 2 u 2 2 ) 2/3 − Δ z = 0 , u 2 = Ψ 1 ( h 2 ; h l , u l ) . (63)
Both residuals are undefined wherever the conjugate state fails to exist, so they are not simply bracketed between two guesses. Instead every sign change is located: Φ \Phi Φ is sampled on a geometric grid of 1500 points spanning [ 10 − 4 , 20 max ( h l , h r , 1 ) ] [10^{-4},20\max(h_l,h_r,1)] [ 1 0 − 4 , 20 max ( h l , h r , 1 )] , each bracketing pair of consecutive finite values of opposite sign is refined by Brent’s method to a tolerance of 10 − 14 10^{-14} 1 0 − 14 , and a pair straddling the boundary of the domain of definition is first bisected to locate that boundary. Every root so obtained is a candidate.
A candidate becomes the solution only if it passes the admissibility filters of its ordering: the Froude conditions at ξ = 0 ± \xi= 0^{\pm} ξ = 0 ± (∣ F 2 ∣ , ∣ F 3 ∣ < 1 |F_2|, |F_3| < 1 ∣ F 2 ∣ , ∣ F 3 ∣ < 1 in (A); ∣ F ∣ > 1 |F| > 1 ∣ F ∣ > 1 on the appropriate side in (B), (C); ∣ F 3 ∣ = 1 |F_3| = 1 ∣ F 3 ∣ = 1 in (D), (E)) and the ordering of the wave speeds, which must place the 1-wave, the transition and the 2-wave at increasing ξ \xi ξ without overlap. All five patterns are attempted for every initial condition. If none succeeds no reference is produced and the network is reported alone; if more than one succeeds the solver reports the ambiguity explicitly, since [20 ] establishes no uniqueness result. No such ambiguity arose in any of the seven configurations of § 6.3 .
The accepted solution is stored as an ordered list of self-similar segments in ξ \xi ξ (constant states, and rarefaction fans identified by their Riemann invariant) and is evaluated at any ( x , t ) (x,t) ( x , t ) by locating ξ = x / t \xi= x/t ξ = x / t in that list, so the reference is available pointwise and needs no interpolation. The dry-bed limiting solutions of [20 §7] are not used; the only vacuum handled is the degenerate right state of pattern (E), which does not occur in the wet-bed suite reported here.
The well-balanced finite-volume reference
For the dam break over a smooth bump of § 6.4 , which has no closed-form solution, the reference is a second-order well-balanced MUSCL–HLL scheme [68 , 4 ] , described here in full because the accuracy of the comparison depends on it. It is computed after training, on the host CPU, and never enters the loss.
Discretisation and boundary treatment
The domain [ x L , x R ] [x_L, x_R] [ x L , x R ] is divided into n x = 4000 n_x = 4000 n x = 4000 uniform cells of width Δ x \Delta x Δ x , with centres x i = x L + ( i + 1 2 ) Δ x x_i = x_L + (i + \frac{1}{2})\Delta x x i = x L + ( i + 2 1 ) Δ x and cell values ( h i , q i ) (h_i, q_i) ( h i , q i ) and b i = b ( x i ) b_i = b(x_i) b i = b ( x i ) . The bed is sampled once from the same function the network is given, so the two solvers see the same bathymetry. Two layers of ghost cells implement the boundary condition, identical to the one imposed on the network: constant extrapolation of ( h , q , b ) (h, q, b) ( h , q , b ) for the transmissive condition, and mirroring of h h h and b b b with sign reversal of q q q for a reflecting wall.
Reconstruction, flux and source
The reconstruction is performed on ( η , u , b ) (\eta, u, b) ( η , u , b ) rather than on ( h , q ) (h, q) ( h , q ) , which is what makes the scheme well balanced: at the lake at rest η \eta η and u u u are constant, every limited slope vanishes, and the reconstruction is exact. With δ ϕ i = minmod ( ϕ i − ϕ i − 1 , ϕ i + 1 − ϕ i ) \delta\phi_i = \operatorname{minmod}(\phi_i - \phi_{i-1}, \phi_{i+1} - \phi_i) δ ϕ i = minmod ( ϕ i − ϕ i − 1 , ϕ i + 1 − ϕ i ) the interface i + 1 2 i + \frac{1}{2} i + 2 1 receives
ϕ L = ϕ i + 1 2 δ ϕ i , ϕ R = ϕ i + 1 − 1 2 δ ϕ i + 1 , ϕ ∈ { η , u , b } . (64) \phi_L = \phi_i + \frac{1}{2}\delta\phi_i,\qquad\phi_R = \phi_{i+1} - \frac{1}{2}\delta\phi_{i+1},\qquad\phi\in\{\eta,u,b\}. \tag*{(64)} ϕ L = ϕ i + 2 1 δ ϕ i , ϕ R = ϕ i + 1 − 2 1 δ ϕ i + 1 , ϕ ∈ { η , u , b } . (64)
Two depths are then formed on each side: the consistent depth on the cell’s own bed and the reconstructed depth of [4 ] on the common bed,
h L , R c = ( η L , R − b L , R ) + , b ⋆ = max ( b L , b R ) , h L , R ⋆ = ( η L , R − b ⋆ ) + . (65) h^c_{L,R} = (\eta_{L,R} - b_{L,R})_+,\qquad b^\star= \max(b_L,b_R),\qquad h^\star_{L,R} = (\eta_{L,R} - b^\star)_+. \tag*{(65)} h L , R c = ( η L , R − b L , R ) + , b ⋆ = max ( b L , b R ) , h L , R ⋆ = ( η L , R − b ⋆ ) + . (65)
The numerical flux is the HLL flux evaluated on the reconstructed states ( h L ⋆ , h L ⋆ u L ) (h^\star_L,h^\star_Lu_L) ( h L ⋆ , h L ⋆ u L ) and ( h R ⋆ , h R ⋆ u R ) (h^\star_R,h^\star_Ru_R) ( h R ⋆ , h R ⋆ u R ) ,
F H L L = { F L , s L ≥ 0 , s R F L − s L F R + s L s R ( V R − V L ) s R − s L , s L < 0 < s R , F R , s R ≤ 0 , (66) \mathcal{F}^{\mathrm{HLL}} =
\begin{cases}
\mathcal{F}_L, & s_L \ge0,\\
\frac{s_R\mathcal{F}_L - s_L\mathcal{F}_R + s_Ls_R(V_R - V_L)}{s_R-s_L}, & s_L < 0 < s_R,\\
\mathcal{F}_R, & s_R \le0,
\end{cases} \tag*{(66)} F HLL = ⎩ ⎨ ⎧ F L , s R − s L s R F L − s L F R + s L s R ( V R − V L ) , F R , s L ≥ 0 , s L < 0 < s R , s R ≤ 0 , (66)
with Einfeldt wave speeds built from the physical and Roe-averaged states,
s L = min ( u L − c ( h L ⋆ ) , u ˉ − c ˉ ) , s R = max ( u R + c ( h R ⋆ ) , u ˉ + c ˉ ) , (67) s_L = \min\left(u_L - c(h^\star_L), \bar{u} - \bar{c}\right),\qquad s_R = \max\left(u_R + c(h^\star_R), \bar{u} + \bar{c}\right), \tag*{(67)} s L = min ( u L − c ( h L ⋆ ) , u ˉ − c ˉ ) , s R = max ( u R + c ( h R ⋆ ) , u ˉ + c ˉ ) , (67)
u ˉ = h L ⋆ u L + h R ⋆ u R h L ⋆ + h R ⋆ , c ˉ = 1 2 g ( h L ⋆ + h R ⋆ ) . \bar{u} = \frac{\sqrt{h^\star_L}u_L + \sqrt{h^\star_R}u_R}{\sqrt{h^\star_L}+\sqrt{h^\star_R}},\qquad\bar{c} = \sqrt{\frac{1}{2}g(h^\star_L+h^\star_R)}. u ˉ = h L ⋆ + h R ⋆ h L ⋆ u L + h R ⋆ u R , c ˉ = 2 1 g ( h L ⋆ + h R ⋆ ) .
replaced by the dry-front speeds ( u R − 2 c R , u R + c R ) (u_R - 2c_R, u_R + c_R) ( u R − 2 c R , u R + c R ) or ( u L − c L , u L + 2 c L ) (u_L - c_L, u_L + 2c_L) ( u L − c L , u L + 2 c L ) when one side is dry. The mass flux is common to the two cells, but the momentum flux is not: each side receives the interface value corrected by the difference between the hydrostatic pressures on its own bed and on the common bed,
F L q = F q , H L L + 1 2 g ( h L c ) 2 − 1 2 g ( h L ∗ ) 2 , F R q = F q , H L L + 1 2 g ( h R c ) 2 − 1 2 g ( h R ∗ ) 2 . (68) \mathcal{F}_L^q = \mathcal{F}^{q,\mathrm{HLL}} + \frac{1}{2}g(h_L^c)^2 - \frac{1}{2}g(h_L^*)^2,\qquad\mathcal{F}_R^q = \mathcal{F}^{q,\mathrm{HLL}} + \frac{1}{2}g(h_R^c)^2 - \frac{1}{2}g(h_R^*)^2. \tag*{(68)} F L q = F q , HLL + 2 1 g ( h L c ) 2 − 2 1 g ( h L ∗ ) 2 , F R q = F q , HLL + 2 1 g ( h R c ) 2 − 2 1 g ( h R ∗ ) 2 . (68)
This asymmetry is the whole of the well-balancing at second order in space: it is exactly the pressure difference the bed exerts between the two faces, and at the lake at rest it cancels the flux difference identically. The remaining bed-slope contribution, which arises only from the variation of b b b inside a cell and therefore only at second order, is added as the centred source
S i = − g h R , i − 1 / 2 c + h L , i + 1 / 2 c 2 b L , i + 1 / 2 − b R , i − 1 / 2 Δ x , (69) S_i = -g\frac{h_{R,i-1/2}^c + h_{L,i+1/2}^c}{2}\frac{b_{L,i+1/2} - b_{R,i-1/2}}{\Delta x}, \tag*{(69)} S i = − g 2 h R , i − 1/2 c + h L , i + 1/2 c Δ x b L , i + 1/2 − b R , i − 1/2 , (69)
evaluated between the two reconstructed faces of cell i i i , so that it too vanishes when η \eta η and u u u are constant.
Time integration and cost
Time stepping is the two-stage SSP Runge–Kutta scheme of Heun, with the depth clipped at zero after each stage and the step size taken as Δ t = min ( C F L Δ x / max ∣ s ∣ , t o u t − t ) \Delta t = \min(\mathrm{CFL}\,\Delta x/\max|s|,\,t_{\mathrm{out}}-t) Δ t = min ( CFL Δ x / max ∣ s ∣ , t out − t ) at C F L = 0.4 \mathrm{CFL}=0.4 CFL = 0.4 , where max ∣ s ∣ \max|s| max ∣ s ∣ is the largest Einfeldt speed of the current sweep, so that the solution is advanced exactly onto each reporting time. A run of the smooth-bump configuration takes about 3500 steps and a few seconds on one CPU core.