# An Optimized and Scalable Algorithm for the Fast Convergence of Steady 1-D Open-Channel Flows

^{*}

## Abstract

**:**

## 1. Introduction

## 2. Materials and Methods

#### 2.1. Equations

^{2}), Q is the discharge (m

^{3}/s), q

_{l}is a lateral discharge per unit length (m

^{2}/s), g is the gravity acceleration (m/s

^{2}), S

_{f}is the friction slope (-), u

_{x}is the velocity along the x direction of q

_{l}(m/s) and z

_{s}is the free surface elevation (m). The numerical resolution of this set of non-conservative equations has been shown to provide accurate results in many practical cases, including in the presence of discontinuities [22,23].

_{l}. We assume that the sign of Q is independent from x. It means that a single equation remains with a single unknown A. In order to keep the same numerical scheme as the one used for the unsteady system (which is important when a steady solution is used as the initial condition of an unsteady problem and to be able to use a similar algorithmic strategy), Kerger et al. [14] added a pseudo-temporal term (pseudo-time is $\tau $ (s)) to the steady form of Equation (1):

_{s,BC}is imposed at the border, Equation (4) becomes:

_{s}at the external border, a nil z

_{s}gradient is imposed and Equation (4) becomes:

#### 2.2. Original Solving Strategy

#### 2.2.1. Non-Linear Krylov Acceleration

**x**

_{n}, on the value of the function f at

**x**

_{n}and on the invert of the Jacobian matrix J:

^{−1}at each iteration, NKA evaluates it from N previous moves or sets it to the identity matrix, in which case the method degenerates to the fixed-point method.

**x**(denoted

**v**) and N evolutions of $f\left(x\right)$ (denoted

**w**) at iterate n:

_{i}are the solution of the projection:

**x**is decomposed into two components:

- The first term depicts the correction as a linear combination of previous corrections.
- The second term is similar to the second term of a fixed-point iteration that takes into account previous evolutions of function f.

#### 2.2.2. Evolutionary Domain

_{vel}(cross-section area used to compute the velocity). The node i + 1, which was supposed to be converged, undergoes a new convergence process that indirectly affects nodes i + 2, i + 3, … Theoretically, all the nodes located downstream of node i should be kept in the computational domain.

^{2}/s) before considering the extension of the computation domain: $\partial A/\partial \tau \le {\xi}_{p}$. Then, the most downstream node can be removed from the partial domain once it drops under the final residual threshold ${\xi}_{f}$ (m

^{2}/s): $\partial A/\partial \tau \le {\xi}_{f}$. Finally, we have to make sure that the nodes that were removed from the domain are not impacted by the computation domain in such a way that their residuals $\partial A/\partial \tau $ become higher than the final precision threshold ${\xi}_{f}$. Dimensionless parameters are discussed further in Section 3.2.

#### 2.2.3. Combination of Solving Strategies

_{i}and A

_{i}

_{+ 1}refer to the cross-section area of the nodes i and i + 1 as depicted in Figure 1, and $0<\eta \le 1$ is the safety coefficient (-). After several tests, we found that $\eta =0.5$ provides stability with a limited impact on the computation time.

Algorithm 1 |

Initialize (computation list is empty) |

Add most downstream node to computation list |

While some nodes still have to be converged ($\partial A/\partial \tau >{\xi}_{f}$): |

Add most downstream node to computation list |

Initialize lastly added upstream node |

While nodes of computation list not converged ($\partial A/\partial \tau >{\xi}_{p}$): |

Compute cross section change for each node |

If NKA activated: |

Adapt cross section change with NKA algorithm |

If lastly removed downstream node significantly impacted: |

Add it back to the computation list and do not expand upstream |

Else: |

If downstream node in computation list fully converged ($\partial A/\partial \tau \le {\xi}_{f}$): |

Remove this node from computation list |

If upstream nodes remain to be added to computation list: |

Add 1 upstream node to the computation list |

Finalize |

#### 2.3. Alternative Non-Linear Solver

## 3. Results and Discussion

#### 3.1. Validation

^{2}/s and ${\xi}_{f}={10}^{-10}$ m

^{2}/s.

#### 3.2. Optimal Setting of the New Algorithm

^{2}/s for tests 1 to 3. The Manning equation was used for friction in tests 1 to 3, with the Manning coefficient n = 0.04 s/m

^{1/3}.

^{1/3}. The cross-section is uniform along the channel and is rectangular with a width of 1 m. A discharge of 1 m

^{2}/s was injected upstream and a water depth equal to 0.7 m was imposed downstream.

^{2}/s.

^{−2}m

^{2}/s for tests 3 and 5. This can be explained by the fact that the residual naturally decreases at each iteration. Keeping some nodes in the computation domain results in a decrease in the residual for each node included in the computation domain.

^{2}/s. Cross-sections are rectangular and 1 m wide. Four domain lengths were tested (20 m, 200 m, 2 km and 20 km) with a spatial step of 0.1 m, meaning that these domains include 200, 2000, 20,000 and 200,000 nodes.

^{1/3}. The downstream boundary condition is a water level set at 1 m, and 1 m

^{3}/s is injected at the upper node and the injection of 4 m

^{3}/s is shared amongst the other nodes (through the q

_{l}term in Equation (1), ${u}_{x}=0$).

^{−6}and 10

^{−8}m

^{2}/s. For partial residual values of 10

^{−2}and 10

^{−4}m

^{2}/s, the evolution is linear up to 50,000 nodes; however, for the finest discretization, the computation time increases in a nonlinear way.

^{−10}. We also found that an efficient ratio ${\xi}_{f}/{\xi}_{p}$ is around 10

^{−6}.

#### 3.3. Performance of the Models

^{1/3}was used to estimate friction losses. The downstream boundary condition is a water depth equal to 0.6 m. The unit discharge is uniform and is equal to 1 m

^{2}/s. The precision parameters are as follows: ${\xi}_{p}={10}^{-6}$ m

^{2}/s and ${\xi}_{f}={10}^{-8}$ m

^{2}/s.

^{0}to in order of 10

^{2}according to the number of nodes considered.

#### 3.4. Real-World Application

^{3}/s. Since the details of the hydraulic results are of limited interest for this paper, we focused on the execution time and showed that the Froude number remains under 1 for both discharges (Figure 14). For the same machine as the one used earlier, the execution times (CPU time) are 0.018 s and 0.022 s, respectively (${\xi}_{f}={10}^{-8}$ m

^{2}/s and ${\xi}_{p}={10}^{-2}$ m

^{2}/s). In comparison, the computation time of a five-minute full simulation was about 0.2 s. Given the length of the stretch and the celerity of a wave, the time for a wave to travel from downstream to upstream is of the order of 80 min. This means that approximately 3.2 s of computation time are required is order to simulate the propagation of a wave downstream to upstream. It is clear that the gain of time offered by our original technique is significant.

## 4. Conclusions

## Author Contributions

## Funding

## Conflicts of Interest

## Computer Code and Software

## References

- Proust, S.; Berni, C.; Boudou, M.; Chiaverini, A.; Dupuis, V.; Faure, J.-B.; Paquier, A.; Lang, M.; Guillen-Ludena, S.; Lopez, D.; et al. Predicting the flow in the floodplains with evolving land occupations during extreme flood events (FlowRes ANR project). In Proceedings of the E3S Web of Conferences, Lyon, France, 17–21 October 2016; Volume 7. [Google Scholar]
- Drab, A.; Riha, J. An approach to the implementation of European Directive 2007/60/EC on flood risk management in the Czech Republic. Nat. Hazards Earth Syst. Sci.
**2010**, 10, 1977–1987. [Google Scholar] [CrossRef] - Schwanenberg, D.; Becker, B.P.J.; Xu, M. The open real-time control (RTC)-Tools software framework for modeling RTC in water resources sytems. J. Hydroinform.
**2014**, 17, 130–148. [Google Scholar] [CrossRef] [Green Version] - Tayefi, V.; Lane, S.N.; Hardy, R.J.; Yu, D. A comparison of one- and two-dimensional approaches to modelling flood inundation over complex upland floodplains. Hydrol. Process.
**2007**, 21, 3190–3202. [Google Scholar] [CrossRef] - Horritt, M.S.; Bates, P.D. Evaluation of 1D and 2D numerical models for predicting river flood inundation. J. Hydrol.
**2002**, 268, 87–99. [Google Scholar] [CrossRef] - Cook, A.; Merwade, V. Effect of topographic data, geometric configuration and modeling approach on flood inundation mapping. J. Hydrol.
**2009**, 377, 131–142. [Google Scholar] [CrossRef] - Goffin, L.; Dewals, B.J.; Erpicum, S.; Pirotton, M.; Archambeau, P. Non-linear optimization of a 1-D shallow water model and integration into Simulink for operational use. In Proceedings of the Sustainable Hydraulics in the Era of Global Change—4th European Congress of the International Association of Hydroenvironment Engineering and Research (IAHR 2016); Liege, Belgium, 27–29 July 2016, CRC Press/Balkema: Boca Raton, FL, USA, 2016; pp. 445–451. [Google Scholar]
- Bourdarias, C.; Gerbi, S.; Gisclon, M. A kinetic formulation for a model coupling free surface and pressurised flows in closed pipes. J. Comput. Appl. Math.
**2008**, 218, 522–531. [Google Scholar] [CrossRef] [Green Version] - Paiva, R.C.D.; Collischonn, W.; Tucci, C.E.M. Large scale hydrologic and hydrodynamic modeling using limited data and a GIS based approach. J. Hydrol.
**2011**, 406, 170–181. [Google Scholar] [CrossRef] - Paz, A.R.; Bravo, J.M.; Allasia, D.; Collischonn, W.; Tucci, C.E.M. Large-scale hydrodynamic modeling of a complex river network and floodplains. J. Hydrol. Eng.
**2010**, 15, 152–165. [Google Scholar] [CrossRef] - Lai, X.; Jiang, J.; Liang, Q.; Huang, Q. Large-scale hydrodynamic modeling of the middle Yangtze River Basin with complex river-lake interactions. J. Hydrol.
**2013**, 492, 228–243. [Google Scholar] [CrossRef] - Remo, J.W.F.; Pinter, N. Retro-modeling the Middle Mississippi River. J. Hydrol.
**2007**, 337, 421–435. [Google Scholar] [CrossRef] - Biancamaria, S.; Bates, P.D.; Boone, A.; Mognard, N.M. Large-scale coupled hydrologic and hydraulic modelling of the Ob river in Siberia. J. Hydrol.
**2009**, 379, 136–150. [Google Scholar] [CrossRef] [Green Version] - Kerger, F.; Archambeau, P.; Erpicum, S.; Dewals, B.J.; Pirotton, M. A fast universal solver for 1D continuous and discontinuous steady flows in rivers and pipes. Int. J. Numer. Methods Fluids
**2011**, 66, 38–48. [Google Scholar] [CrossRef] - Sandric, I.; Ionita, C.; Chitu, Z.; Dardala, M.; Irimia, R.; Furtuna, F.T. Using CUDA to accelerate uncertainty propagation modelling for landslide susceptibility assessment. Environ. Model. Softw.
**2019**, 115, 176–186. [Google Scholar] [CrossRef] - Neal, J.C.; Fewtrell, T.J.; Bates, P.D.; Wright, N.G. A comparison of three parallelisation methods for 2D flood inundation models. Environ. Model. Softw.
**2010**, 25, 398–411. [Google Scholar] [CrossRef] - Lacasta, A.; Garcia-Navarro, P.; Burguete, J.; Murillo, J. Preprocess static subdomain decomposition in practical cases of 2D unsteady hydraulic simulation. Comput. Fluids
**2013**, 80, 225–232. [Google Scholar] [CrossRef] [Green Version] - Brodtkorb, A.R.; Sætra, M.L.; Altinakar, M. Efficient shallow water simulations on GPUs: Implementation, visualization, verification, and validation. Comput. Fluids
**2012**, 55, 1–12. [Google Scholar] [CrossRef] - Petaccia, G.; Leporati, F.; Torti, E. OpenMP and CUDA simulations of Sella Zerbino Dam break on unstructured grids. Comput. Geosci.
**2016**, 20, 1123–1132. [Google Scholar] [CrossRef] - Smith, L.S.; Liang, Q. Towards a generalised GPU/CPU shallow-flow modelling tool. Comput. Fluids
**2013**, 88, 334–343. [Google Scholar] [CrossRef] - Chaudhry, M.H. Open-Channel Flow; Springer Science & Business Media: Berlin/Heidelberg, Germany, 2007. [Google Scholar]
- Bruwier, M.; Archambeau, P.; Erpicum, S.; Pirotton, M.; Dewals, B. Discretization of the divergence formulation of the bed slope term in the shallow-water equations and consequences in terms of energy balance. Appl. Math. Model.
**2016**, 40, 7532–7544. [Google Scholar] [CrossRef] - Franzini, F.; Soares-Frazão, S. Efficiency and accuracy of Lateralized HLL, HLLS and Augmented Roe’s scheme with energy balance for river flows in irregular channels. Appl. Math. Model.
**2016**, 40, 7427–7446. [Google Scholar] [CrossRef] - Erpicum, S.; Dewals, B.; Archambeau, P.; Pirotton, M. Dam break flow computation based on an efficient flux vector splitting. J. Comput. Appl. Math.
**2010**, 234, 2143–2151. [Google Scholar] [CrossRef] - Broyden, C.G. A class of methods for solving nonlinear simultaneous equations. Math. Comput.
**1965**, 19, 577–593. [Google Scholar] [CrossRef] - Knoll, D.A.; Keyes, D.E. Jacobian-free Newton–Krylov methods: A survey of approaches and applications. J. Comput. Phys.
**2004**, 193, 357–397. [Google Scholar] [CrossRef] [Green Version] - Anderson, D.G. Iterative Procedures for Nonlinear Integral Equations. J. ACM
**1965**, 12, 547–560. [Google Scholar] [CrossRef] - Walker, H.F.; Ni, P. Anderson acceleration for fixed-point iterations. SIAM J. Numer. Anal.
**2011**, 49, 1715–1735. [Google Scholar] [CrossRef] [Green Version] - Saad, Y.; Schultz, M.H. GMRES: A generalized minimal residual algorithm for solving nonsymmetric linear systems. SIAM J. Sci. Stat. Comput.
**1986**, 7, 856–869. [Google Scholar] [CrossRef] [Green Version] - Carlson, N.N.; Miller, K. Design and application of a gradient-weighted moving finite element code I: In one dimension. SIAM J. Sci. Comput.
**1998**, 19, 728–765. [Google Scholar] [CrossRef] - Carlson, N.N.; Miller, K. Design and Application of a Gradient-Weighted Moving Finite Element Code II: In Two Dimensions. SIAM J. Sci. Comput.
**1998**, 19, 766–798. [Google Scholar] [CrossRef] [Green Version] - Calef, M.T.; Fichtl, E.D.; Warsa, J.S.; Berndt, M.; Carlson, N.N. Nonlinear Krylov acceleration applied to a discrete ordinates formulation of the k-eigenvalue problem. J. Comput. Phys.
**2013**, 238, 188–209. [Google Scholar] [CrossRef] [Green Version] - Wang, C.; Cheng, J.; Berndt, M.; Carlson, N.N.; Luo, H. Application of nonlinear Krylov acceleration to a reconstructed discontinuous Galerkin method for compressible flows. Comput. Fluids
**2018**, 163, 32–49. [Google Scholar] [CrossRef] - Andersson, J.A.E.; Gillis, J.; Horn, G.; Rawlings, J.B.; Diehl, M. CasADi—A software framework for nonlinear optimization and optimal control. Math. Program. Comput.
**2018**, 11, 1–36. [Google Scholar] [CrossRef] - Baayen, J.; Piovesan, T.; VanderWees, J. Optimization problems subject to the nonlinear semi-implicitly discretized Saint-Venant equations have a unique solution. arXiv
**2018**, arXiv:1801.06507. [Google Scholar] - Aureli, F.; Maranzoni, A.; Mignosa, P.; Ziveri, C. A weighted surface-depth gradient method for the numerical integration of the 2D shallow water equations with topography. Adv. Water Resour.
**2008**, 31, 962–974. [Google Scholar] [CrossRef]

**Figure 1.**Upwinding directions of the unknown and flow properties at the upstream limit of the computation domain.

**Figure 3.**Comparison between the analytical solution and the numerical results produced by the new algorithm and CasADi for validation test A.

**Figure 4.**Comparison between the analytical solution and the numerical results produced by the new algorithm and CasADi for validation test B.

**Figure 5.**Comparison between the analytical solution and the numerical results produced by the new algorithm and CasADi for validation test C.

**Figure 12.**CPU time evolution with the number of nodes when (

**a**) the spatial step is kept constant and when (

**b**) the domain span is fixed.

**Figure 13.**Comparison of the CPU time evolution with the number of nodes between our algorithm and CasADi and the associated speed up factor.

Test | Upstream BC | Downstream BC |
---|---|---|

A | q = 1 m^{2}/s | h = 1.7 m |

B | q = 0.4 m^{2}/s | h = 0.75 m |

C | q = 0.4 m^{2}/s | Transmissive |

Test | Analytical | New Algorithm | CasADi | ||
---|---|---|---|---|---|

Head (m) | Head (m) | Diff. | Head (m) | Diff. | |

A | 1.71764 | 1.72147 | 0.22% | 1.71958 | 0.11% |

B | 1.18040 | 1.17062 | −0.83% | 1.16664 | −1.17% |

C | 1.18040 | 1.17062 | −0.83% | 1.16664 | −1.17% |

Test | Channel Bed | Friction | BC |
---|---|---|---|

1 | $z(x)=0.05\mathrm{sin}\left(\pi x/2\right)+0.05$, rectangular cross-section | Manning, n = 0.04 s/m^{1/3} | q = 1 m/s^{2}, z_{down} = 1.2 m |

2 | $z(x)=0.05\mathrm{sin}\left(\pi x/2\right)+0.05$, rectangular cross-section | Manning, n = 0.04 s/m^{1/3} | q = 1 m/s^{2}, z_{down} = 0.55 m |

3 | $z(x)=0.05\mathrm{sin}\left(2\pi x\right)+0.05$, rectangular cross-section | Manning, n = 0.04 s/m^{1/3} | q = 1 m/s^{2}, z_{down} = 0.55 m |

4 | Flat bottom with a weir, rectangular cross-section | Manning, n = 0.04 s/m^{1/3} | q = 1 m/s^{2}, z_{down} = 0.7 m |

5 | 0.2% slope, sudden change in cross-section | Manning, n = 0.04 s/m^{1/3} | q = 1 m/s^{2}, z_{down} = 0.7 m |

Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations. |

© 2020 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/).

## Share and Cite

**MDPI and ACS Style**

Goffin, L.; Dewals, B.; Erpicum, S.; Pirotton, M.; Archambeau, P.
An Optimized and Scalable Algorithm for the Fast Convergence of Steady 1-D Open-Channel Flows. *Water* **2020**, *12*, 3218.
https://doi.org/10.3390/w12113218

**AMA Style**

Goffin L, Dewals B, Erpicum S, Pirotton M, Archambeau P.
An Optimized and Scalable Algorithm for the Fast Convergence of Steady 1-D Open-Channel Flows. *Water*. 2020; 12(11):3218.
https://doi.org/10.3390/w12113218

**Chicago/Turabian Style**

Goffin, Louis, Benjamin Dewals, Sebastien Erpicum, Michel Pirotton, and Pierre Archambeau.
2020. "An Optimized and Scalable Algorithm for the Fast Convergence of Steady 1-D Open-Channel Flows" *Water* 12, no. 11: 3218.
https://doi.org/10.3390/w12113218