Equivalent Black-Box Formulation of One-Dimensional Hydrodynamic Models
This paper re-expresses the finite-difference solver of a one-dimensional hydrodynamic model as a “hand-wired neural network”: each time step corresponds to one network layer whose weights are written deterministically from the coefficients of the discrete scheme, with no training involved. The whole time-marching process becomes a forward pass of layer-wise matrix multiplications or layer-wise linear solves, it agrees with the original solver to within the discrete truncation error, and it remains differentiable end to end. Three progressively richer hand-wired layer constructions are given: (i) the linearized shallow-water equations correspond to a periodic banded sparse constant layer W = I + Δt·L + (Δt²/2)c²·D₂/Δx²; (ii) the full nonlinear Saint-Venant equations correspond to an “affine dynamic layer” W·s + b whose weights and biases are both produced by a Jacobian sub-network (path 1); (iii) the θ-weighted implicit scheme, once linearized about the current state, corresponds to a “dynamic implicit layer” whose single operation is a differentiable linear solve (path 2). For the linearized shallow-water equations the hand-wired network agrees with a node-by-node Lax–Wendroff solver to machine precision (maximum deviation 2.2×10⁻¹⁶ m); a Gaussian initial bump propagated through 50 layers (a quarter circuit) splits into two crests that fall exactly at 250.0 m and 750.0 m, consistent with the wave speed √(gH₀) = 7.00 m/s, with a maximum deviation of 1.5×10⁻² m from the periodic analytical solution and a measured grid-refinement order of 1.98–2.00. For the full Saint-Venant equations the dynamic layer of path 1 takes the affine form (dynamic weights plus dynamic biases) combined with fourth-order explicit marching, and cross-validates with path 2 (Crank–Nicolson, θ = 0.5) to 3.1×10⁻³ m, with measured temporal orders of 4.01 and 2.00, quantifying the trade-off between the two differentiable evolution paths. Within this representation the CFL condition of explicit schemes (necessary but not sufficient, and requiring an integrator that is stable on the purely imaginary spectrum), the neutral stability of implicit schemes for θ ≥ 1/2 on linear operators, and the θ-parameter family of the Preissmann scheme all acquire a network-language counterpart. The representation is then located within the “native white box – native black box – PINN – grey box” methodological spectrum, and is argued to occupy a position that has rarely been discussed systematically: an exact white box with hard-wired physical structure, plus a differentiable computational graph built from native neural-network operators. Four combined-use modes are discussed accordingly: an exact hard-constrained evolution skeleton for PINNs, a white-box preconditioner / coarse-grid propagator for hybrid solvers, a calibratable grey box for inverse problems (with only a few trainable physical parameters), and an upstream exact physics module of a differentiable hybrid computational graph. Three limitations are then identified: no ability to learn model-form error, the storage and solve cost of dense implicit layers, and the systematic gap between discretely differentiable gradients and continuous sensitivities. To test these statements, node-by-node white-box solvers are provided that correspond one-to-one to the three black-box layers (including a block-tridiagonal Thomas solver with a Sherman–Morrison corner correction); the three black-box/white-box pairs agree pointwise under identical well-posed conditions (maximum deviations 2.2×10⁻¹⁶, 0 and 7.1×10⁻¹⁵), and are cross-checked by three formula-independent tests (dense assembly, random block matrices, finite-difference Jacobians). Batched PyTorch implementations of the three layers are then given: autograd gradients agree with central differences to 1.1×10⁻¹⁰, and mini-batch stochastic gradient descent recovers Δt and the Manning coefficient n to 0.49999 s and 0.03000 (true values 0.5 s and 0.03) within 200 iterations. The review further shows that the CFL condition of explicit layers is only necessary and that time marching must be stable on the purely imaginary spectrum; the Lax–Wendroff constant layer and the fourth-order explicit dynamic layer are therefore adopted, and implementations bit-identical to the node-by-node white-box solvers are reported. In addition, the stages of a fourth-order scheme must all depart from the same base state: implementing the four stages as four chained Euler sub-layers degrades the scheme to first order (measured 0.88–0.97), a pitfall that deserves particular attention when wiring by hand.
Authors
- Xinchen Gu (ORCID: https://orcid.org/0000-0002-0563-2395)
- Haibin Tong (ORCID: https://orcid.org/0009-0009-3830-381X)
- Liangliang Xin
Publication Details
- Journal
- Preprints.org
- Published
- 2026-12-03
- DOI
- https://doi.org/10.20944/preprints202612.0442.v1
- Primary Topic
- Model Reduction and Neural Networks
- Type
- preprint