Articles | Volume 29, issue 8
https://doi.org/10.5194/hess-29-2003-2025
https://doi.org/10.5194/hess-29-2003-2025
Technical note
 | 
22 Apr 2025
Technical note |  | 22 Apr 2025

Technical note: Quadratic Solution of the Approximate Reservoir Equation (QuaSoARe)

Julien Lerat
Abstract

This paper presents a method to solve the reservoir equation, a special type of scalar ordinary differential equation controlling the dynamic of conceptual reservoirs found in most hydrological models. The method, called the “Quadratic Solution of the Approximate Reservoir Equation” (QuaSoARe), applies to any reservoir equation regardless of its non-linearity or the number of fluxes entering and leaving the reservoir. The method is based on a piecewise quadratic interpolation of the flux functions, which leads to an analytical and mass-conservative solution. It is applied to two routing models and two rainfall–runoff stores that are representative of hydrological model components, and it is evaluated based on six catchments in eastern Australia that experienced one of the most extreme floods in recent Australian history. A comparison of the method against two standard numerical schemes, the fifth-order Radau implicit Runge–Kutta scheme and the explicit Runge–Kutta scheme of order 5(4), suggests that it can reach similar accuracy while reducing runtime by a factor of 10 to 50 depending on the model considered. At the same time, the method is simple enough to be presented as a short pseudo-code, which is included in this paper. Beyond solving a given reservoir equation, the method constitutes a promising avenue to define flexible models where flux functions are defined as piecewise quadratic functions, which can be solved exactly with QuaSoARe.

Share
1 Introduction

1.1 Reservoirs as ubiquitous components of environmental models

Environmental models, including hydrological models, often rely on components that can be modelled conceptually as a reservoir receiving inputs and generating outputs that are sole functions of the volume stored in the reservoir. Such reservoirs are extensively used in rainfall–runoff models such as GR4J (Perrin et al., 2003), HBV (Bergstrom and Forsman, 1973), IHACRES (Croke and Jakeman, 2004), and SAC-SMA (Burnash and Ferral, 1981), where the reservoir dynamic is described by a differential equation relating the change in storage to input and output fluxes. If the model is applied to a time step long enough for storage to change significantly, this equation must be integrated to obtain the storage level at the end of the time step and the total of each flux. However, apart from a few simple cases, there is no analytical solution to this mathematical problem, and one has to revert to numerical approximations (Clark and Kavetski, 2010; Kavetski and Clark, 2010). Furthermore, flux functions in hydrological models are often highly non-linear, which magnifies numerical errors when using inappropriate numerical schemes (Kavetski and Clark, 2011). This, in turn, degrades model simulation and calibration due to the extra parameterisation needed to compensate for these errors (Kavetski et al., 2006). In this context, this paper presents an approximate analytical method called the “Quadratic Solution of the Approximate Reservoir Equation” (QuaSoARe) to solve the scalar ordinary differential equation (ODE) underlying most conceptual reservoirs used in hydrology.

The integration of ODEs represents an entire field in applied mathematics, with a history as old as differential calculus. The reader might wonder why a paper is needed for such a well-beaten scientific track. Despite the voluminous literature written on the topic, the large number of software packages available, and the importance of proper ODE integration flagged by Kavetski and Clark (2010), the use of proven ODE numerical schemes remains rare in hydrological modelling. We suggest that this troubling fact may come about because the methods described in reference textbooks (Hairer et al., 2009; Shampine, 2020) aim to solve very general ODEs and hence require complex algorithms to handle every extreme scenario in the equation set-up. However, this complexity might be superfluous if one wants to solve a simple scalar equation such as a conceptual reservoir used in hydrological modelling. This paper aims to bridge this gap by proposing a simple yet effective and mass-conservative approximate solution designed specifically for the scalar reservoir equation ODE.

More precisely, let us denote the volume stored in the reservoir by S and assume that the reservoir is submitted to forcing variables Ṽ that remain constant over the time step. This assumption corresponds to most practical hydrological modelling scenarios where the time distribution of the forcings during the time step is unknown (e.g. time average of rainfall or potential evapotranspiration). In this case, the reservoir equation ODE is formulated as follows:

(1) d S d t = i = 1 n f i S , V ̃ ,

where fi denotes arbitrary continuous functions representing input or output fluxes from the reservoir. Here, it is assumed that the fi functions are Lipschitz continuous, which ensures that Eq. (1) has a unique solution (Hairer et al., 2009). We also assume that Eq. (1) is input-to-state stable, which guarantees that its solution is bounded if the inputs Ṽ are bounded (Mironchenko, 2023). Note that demonstrating the global stability of an ODE is a complex problem much beyond the scope of this paper. LaSalle (1960) presented a method using Lyapunov functions, which were later generalised by Sontag (1989) for systems such as Eq. (1). The mathematical assumptions made here and the theoretical limitations they introduce are further discussed in Sect. 4.

Solving Eq. (1) is an initial value problem over a time interval [0, δ], where δ is the time step. S0 is defined as the initial condition at t=0. To obtain a simulation from the reservoir, Eq. (1) is solved repeatedly for each time step with varying forcing variables (e.g. a daily series of rainfall values). It is highlighted that the presence of several functions fi in Eq. (1) is common in hydrological models, for example, to account for multiple runoff generation processes such as infiltration and overland flow or fluxes between surface water and groundwater stores (Clark et al., 2008). Other model components often require these fluxes (e.g. infiltration excess runoff being used as input into a routing model), which means that, in addition to solving for variable S, one must compute the total of each flux over the time step given by

(2) O i = 0 δ f i S , V ̃ d t .

It is important to note that the computation of Oi does not affect the solution S(t). To follow the terminology of atmospheric modelling, Oi is a diagnostic variable (American Meteorological Society, 2024), whereas S is a prognostic variable.

Equation (1) has a broad range of applications beyond hydrological modelling, for example, to estimate storage in an artificial reservoir (Fiorentini and Orlandini, 2013) or to solve the gradually varied flow equation in hydraulics (Gill, 1976). Unfortunately, there are very few cases where both Eqs. (1) and (2) have an analytical solution, a problem that is considerably more difficult than solving Eq. (1) alone. Consequently, most reservoir equations are solved using numerical approximation methods.

1.2 Numerical methods to solve the reservoir equation

The most common approach relies on discrete methods that estimate S from t=0 to δ at incremental steps using Runge–Kutta methods (Kavetski and Clark, 2010; Knoben et al., 2019; La Follette et al., 2021). These schemes are the topic of a voluminous literature, including several reference textbooks (Butcher, 2003; Hairer et al., 2009; Press et al., 2007; Shampine, 2020, to name but a few). Nonetheless, applying them requires significant expertise to (1) select the most appropriate scheme among the multiple variants available (e.g. Euler, Runge–Kutta, or Huen schemes), (2) decide if the scheme is explicit (where the solution depends on S0 only) or implicit (where it depends on both S0 and S(δ), which requires iterative optimisation), and (3) choose between fixed or variable step lengths to automatically slow down computation when facing numerical difficulties. These choices are not trivial and far from harmless, as warned by Michel et al. (2003) and Kavetski and Clark (2011), who show the disastrous consequences of solving the exponential store with an explicit Euler scheme. As a result, these techniques are not simple to code, and a modeller unfamiliar with them will often require a third-party software package. This adds a dependency to the model code, complicates maintenance, and increases runtime, sometimes significantly when using implicit methods compared to an analytical solution. At the same time, despite the exponential growth of computing power, runtime is still a limiting factor in hydrology when a large number of runs is required, for example, in a Monte Carlo uncertainty analysis or for the calibration of distributed models.

In addition, besides applying the right ODE integrator to Eq. (1), solving the reservoir equation requires a numerical integration of Eq. (2) using a potentially different algorithm. For example, a simple quadrature method can be used to estimate the integral on the right-hand side of Eq. (2) based on the two values S0 and S(δ). However, this approach can be highly inaccurate if the solution s(t) does not vary linearly with time, as demonstrated in the Supplement. A more accurate method is to expand Eq. (1) into a system of differential equations by adding one differential equation for each flux:

(3) d O i d t = f i S , V ̃ i = 1 , n .

The solution can then be obtained by applying the selected integrator to the system of ODEs combining Eqs. (1) and (3). However, because of the wide range of magnitudes observed in hydrological fluxes, this may lead to a system that could be characterised as “stiff” and for which many numerical schemes become unstable (Kavetski and Clark, 2011; Shampine, 2020).

Another angle of attack for solving an ODE is to replace the original equation with one for which an analytical solution exists. With the simplest ODEs being linear, it is not surprising that linearisation of Eq. (1) around a specific regime (e.g. steady-state) has constituted the first approach proposed by mathematicians (Hartman, 2002). Linearisation has often been used to solve complex differential equations in hydrology and hydraulics, for example, the Saint-Venant 1D hydrodynamic equation by Hayami (1951) or, more recently, those by Fan and Li (2006) or Munier et al. (2008). This approach is efficient if the true solution does not depart significantly from the linearisation regime. Unfortunately, hydrological systems often exhibit variations of several orders of magnitude that violate this assumption. A logical extension of the linearisation approach is to define several linear approximation regimes between which the solution can switch. This idea has been explored extensively in the control literature (Johansson, 2003), starting with the early work by Kalman (1955). More recently, this approach has been formalised in the field of electrical engineering under the name trajectory piecewise-linear approximation (TPLA), a method introduced by Rewienski and White (2003) to solve large non-linear differential equation systems. The theory presented by Rewienski and White (2003), along with its subsequent refinements (Bond and Daniel, 2009; Kalra and Nabi, 2020), aims to solve equation systems far more complex than the reservoir equation studied here. Adapting this theory for the scalar reservoir equation, along with a clear algorithmic description, would be a valuable contribution from this study. In addition, the TPLA theory relies on a transition between linearised states which is not necessarily continuous. Finally, the choice of the transition function is arbitrary, which adds subjectivity to the process and does not guarantee that the derivative of the solution remains continuous. This can be an issue if the model shows strong non-linearity. This problem was raised by Litrico et al. (2010), who proposed a continuous linearisation method to approximate the Saint-Venant hydrodynamic equations. Overall, the TPLA method is useful for representing complex non-linear dynamics. Still, a simpler approach restricted to a scalar system such as the reservoir equation would likely make its adoption easier. Extending the linearisation idea, Pope (1963) introduced the concept of an exponential integrator, where the linearisation of an ODE is combined with a discrete method such as a Runge–Kutta scheme applied to the residual between the linearised part and the original function. Hochbruck and Ostermann (2006) demonstrated this method's efficacy in solving large systems of stiff equations. However, its reliance on a discrete method to correct the linearised solution faces the same issues raised earlier for an application to hydrological models.

Overall, the review of the literature above highlighted the following research gaps:

  • The reservoir equation is a standard tool in hydrology that requires fast and robust numerical solutions in the absence of general analytical approaches.

  • Classical ODE numerical solvers such as Runge–Kutta methods are not straightforward, especially if the equations are stiff and lead to potentially unstable solutions.

  • Existing theoretical developments from control theory based on multiple linearisation points are complex and require care when switching between linearised regimes.

1.3 Objectives of the paper

This paper aims to

  • present an approximate analytical solution for the reservoir equation, with the solution solving Eq. (1) and computing all input and output fluxes from Eq. (2);

  • demonstrate the application of the method to four reservoir equations of increasing complexity and non-linearity and to compare the results with classical implicit and explicit discrete methods.

The method, including its pseudo-code, is presented in Sect. 2.2 and 2.3, while an accompanying Python package is released as supporting material. Section 4 details some limitations of the method and recommendations to remediate them. The protocol used to compare the method with existing discrete methods is detailed in Sect. 5, with results being presented in Sect. 6 and discussed in Sect. 7. The paper is concluded in Sect. 8.

2 Approximate analytical solution of the reservoir equation using piecewise quadratic functions

The method presented in this section is inspired by the TPLA and exponential-integrator methods, where the functions fi in Eq. (1) are approximated by functions for which an analytical solution of the reservoir equation exists.

https://hess.copernicus.org/articles/29/2003/2025/hess-29-2003-2025-f01

Figure 1QuaSoARe method applied to the example reservoir equation. The left plots (a, c) present the reservoir equation (i.e. the right-hand side of Eq. 4) as a dashed grey line and its QuaSoARe approximation as a blue line. The right plots (b, d) show this equation's analytical and QuaSoARe solutions using the same colours. A QuaSoARe configuration with three interpolation nodes is used in the two top plots (a, b), while four nodes are used in the two bottom plots (c, d).

Download

2.1 Illustrative example

Before presenting the method, an illustrative example using the following reservoir equation is introduced:

(4) d S d t = - S 3 2 .

This equation is a special case of the cubic flow-routing model, further discussed in Sect. 5.1. Assuming an initial condition S0 at t=0, the analytical solution of Eq. (4) is as follows:

(5) s ( t ) = S 0 1 + t S 0 2 .

The reservoir equation function from the right-hand side of Eq. (4) is plotted in Fig. 1a as a dashed grey line. The corresponding solution from Eq. (5) is shown in Fig. 1b as a dashed grey line using a value of S0 equal to 0.9. Other elements in this figure are related to the QuaSoARe method and are described in the following sections.

2.2 Reservoir equation approximation by quadratic functions

Before presenting the approximate solution, it needs to be established that the solution s(t) of Eq. (1) is monotonic, a result that is used repeatedly across this paper. This can be proved by contradiction: let us assume that s(t) is not monotonic. Consequently, s being derivable as a solution of Eq. (1), there exists a time t0>0 where the derivative of s changes sign, and ds/dt0 for t>t0. Let us now introduce the function s2, which is identical to s for t<t0 and which remains constant and equal to s(t0) for tt0. This function is a solution of Eq. (1) for all t>0 and is distinct from s for t>t0 because its derivative is zero, while the derivative of s is not. This is a contradiction, with the uniqueness of the solution of Eq. (1) being imposed by the fact that f is Lipschitz continuous, as stated in the previous section. Consequently, s is monotonic for t≥0.

Back to solving Eq. (1), let us assume that each function fi can be approximated by a function fi written as follows:

(6) f i ( S , V ̃ ) = j = 1 m - 1 a i , j S 2 + b i , j S + c i , j I j ( S ) ,

where the series α1<α2<<αm defines a partitioning of the interval [α1,αm] into m−1 intervals referred to as “interpolation bands”. In addition, the interval [α1, αm] is assumed to contain the bounds of s(t) (the solution to Eq. 1 is assumed to be bounded in Sect. 1.1). Ij(x) is the indicator function equal to 1 if x[αj,αj+1[ and equal to zero elsewhere. The αj values are referred to as “interpolation nodes” in this paper. The coefficients ai,j, bi,j, and ci,j are independent of S. The process to obtain ai,j, bi,j, and ci,j is detailed in Appendix A so that the approximated function fi matches the original function fi at the nodes αj and at the midpoint between αj.

The approximation described above is applied to the example equation given in Eq. (4): two approximations are presented in Fig. 1a and c using three and four nodes, respectively. Both lead to a highly accurate interpolation where true and approximated functions are visually indistinguishable. The interpolation error, that is, the difference between the true function and its approximated counterpart, is shown as an inset in both plots. This error is reduced by a factor of approximately 5 when the number of nodes increases from three to four.

The form of Eq. (6) was chosen for several reasons. First, a piecewise quadratic function is Lipschitz continuous on a bounded interval. As a result, the solution to the corresponding reservoir equation, referred to as the approximated reservoir equation, is unique like the one of Eq. (1). Second, this equation can be solved analytically, as is shown in Sect. 2.3. Third, a quadratic function can approximate a wide range of reservoir functions used in hydrology. For example, if ai,j=0, the equation becomes a linear function of S, which is the most common reservoir equation used in hydrology. Finally, the steady-state solution of the approximate reservoir equation (i.e. when the derivative of S is zero) can be determined analytically, which greatly facilitates the analysis of the behaviour of the reservoir and the selection of αj as discussed in Sect. 3. However, despite these appealing attributes, there are also downsides to this approximation, which are presented in Sect. 4, along with potential remediation.

Replacing the original functions fi by their approximated counterpart fi, the approximate reservoir equation is

(7) d S d t = i = 1 n f i ( S , V ̃ ) = j = 1 m A j S 2 + B j S + C j I j ( S ) ,

where Aj, Bj, and Cj are the sums of the flux coefficients for the interpolation band j. For example, Aj is given by

(8) A j = i = 1 n a i , j .

Importantly, Eq. (7) maintains an equality between the change in storage and the sum of the fluxes, meaning it conserves mass. This statement is trivial, but it ensures that the QuaSoARe algorithm generates mass-conservative simulations, which is a key requirement in hydrological modelling and is not always guaranteed by ODE numerical schemes, as pointed out by Clark and Kavetski (2010).

2.3 Analytical solution of the approximated reservoir equation

The solution to Eq. (7) can be obtained analytically as follows. Let us assume that the initial condition S0 falls in the interpolation band [αj0,αj0+1[ where j0[1,m-1]. For example, j0=2 (second band) when S0=0.9 in the illustrative example shown in Fig. 1a. When S0 falls into the j0th interpolation band at t=0, Eq. (7) can be simplified as follows:

(9) d S d t = A j 0 S 2 + B j 0 S + C j 0 .

The solution of this equation has an analytical expression, referred to as s(t). In addition, all fluxes from Eq. (2) can also be computed analytically. The process to obtain these expressions is not complex but tedious, and so its presentation is deferred to Appendix B. Using solution s(t), one can compute the value s(δ) at the end of the time step, leading to three cases:

  • Case 1. s(δ) lies in the interval [αj0,αj0+1[. Because it is monotonic (see beginning of Sect. 2.2), s(t) remains bounded by αj0 and αj0+1 for all t in [0,δ]. Consequently, Eq. (7) remains identical to Eq. (9) for t[0,δ], which means that s(t) is the solution of equation Eq. (7) over the interval [0, δ].

  • Case 2. sδ<αj0. Here, s(t) is a continuous function, with s0=S0αj0 and sδ<αj0. Hence, by the intermediate-value theorem, there exists a time tl<δ such that stl=αj0. Moreover, s(t) is decreasing, which means that s(t) remains in the interval [αj0,S0] for all t<tl. In other words, s(t) is the solution of Eq. (7) for t in [0, tl]. The expression for tl has an analytical expression equal to ναj0-νS0, where the function ν is given in Table B1 in the Appendix.

    When t>tl, Eq. (7) is no longer equivalent to Eq. (9) because s(t) becomes lower than αj0. As a result, s(t) is no longer the solution of Eq. (7). However, Eq. (7) becomes equivalent to an equation similar to Eq. (9), where Aj0 and Bj0 are replaced by Aj0-1 and Bj0-1, respectively.

  • Case 3. sδ>αj0+1. Following a similar reasoning to that above, s(t) is a strictly increasing function until it reaches the value αj0+1 at time tu<δ, where tu is equal to ναj0+1-ν(S0). This means that s is the solution of Eq. (7) for t[0,tu].

    For t>tu, s becomes greater than αj0+1 and is no longer the solution of Eq. (7). However, Eq. (7) then becomes equivalent to an equation similar to Eq. (9), where Aj0 and Bj0 are replaced by Aj0+1 and Bj0+1, respectively.

Overall, the first case above leads to an immediate resolution of Eq. (7) over the interval [0, δ], while the other cases provide a solution over two shorter intervals of [0, tl] and [0, tu], corresponding to cases 2 and 3, respectively. For these last two cases, if t is greater than tu or tl then Eq. (7) becomes equivalent to an equation similar to Eq. (9), where the index j0 is replaced by either j0−1 or j0+1, which suggests that the whole process can be repeated iteratively towards the end of the interval t=δ.

It is worth mentioning that the value s(δ) in the above algorithm may not be defined. Specific values of the coefficients Aj, Bj, and Cj can lead to a solution s(t) becoming infinite before reaching t=δ. The last column of Table B1 in Appendix B indicates the time interval during which s(t) remains bounded depending on these coefficients. This situation obviously excludes case 1 above but can be captured under case 2 or 3 if the invalid value s(δ) is replaced by +∞ or −∞ if s is increasing or decreasing, respectively. Note that this adjustment of the algorithm ensures that it can cope with an invalidity of s(δ) but does not guarantee its systematic convergence. This question is discussed further in Sect. 4.

It is important to highlight that each step in the algorithm described above is explicit because the calculation of s(δ) depends on past values of S only. In addition, the underlying analytical solution (see Appendix B) is computed using a limited set of standard mathematical functions (exponential, logarithm, hyperbolic tangent, and tangent). Both elements suggest that the QuaSoARe method is simple and fast to implement in any programming language. Finally, each QuaSoARe iteration is repeated, at most, m+1 times if the entire range [α1,αm] is traversed by the solution. Consequently, the runtime required to compute the approximate solution is bounded by the number of interpolation nodes. It cannot reach high values, as can happen with algorithms relying on variable time step sizes, like certain Runge–Kutta methods.

QuaSoARe is applied to the illustrative example with the approximated solution shown in Fig. 1b (interpolation using three nodes) and c (four nodes) as blue lines. QuaSoARe solutions closely match the analytical solution (dashed grey line) for both interpolation configurations. However, the match degrades towards the end of the simulation in Fig. 1b, with QuaSoARe underestimating the true solution. This is due to the negative interpolation error when S is lower than 0.5, as seen in the inset of Fig. 1a, which leads to a more rapid decrease in the approximated solution and, hence, progressive underestimation. This example highlights the potential of QuaSoARe in generating accurate simulations, as well as the need for high accuracy in the interpolation of flux functions.

In summary, the solution presented in this section provides a way to solve an approximate reservoir equation where piecewise quadratic interpolations replace the original reservoir functions. The solution is fully analytical, including the computation of all reservoir fluxes. It can be implemented using the pseudo-code presented in Fig. 2. Alternatively, Lerat (2024) released an open-source software package where QuaSoARe is coded in both Python and C languages.

https://hess.copernicus.org/articles/29/2003/2025/hess-29-2003-2025-f02

Figure 2QuaSoARe pseudo-code.

Download

3 Selecting interpolation nodes from the range of steady-state solutions

The QuaSoARe method presented in Sect. 2 relies on an interpolation of functions fi using nodes αj}j=1,,m. The choice of these nodes is crucial because it conditions the quality of the interpolation and, hence, the accuracy of the approximate solution. Let us now assume that the reservoir equation is solved for a fixed time step δ and a time series of p forcing values Ṽkk=1,p. In most reservoirs used in hydrology, the reservoir equation has at least one steady-state solution for each time step k, denoted by Sk, that is a solution of

(10) i = 1 n f i S k , V ̃ k = 0 .

If the set of all solutions Sk is not empty, a simple approach is to set α1 to min({Sk}) and αm to max({Sk}). Subsequently, the αi values are obtained by partitioning the interval [α1, αm] into m−1 equal sub-intervals. This approach relies on the fact that extreme values of s(t) are reached during time steps where the forcings Ṽk are likely to be extremes. At the same time, steady-state solutions are storage values that are reached when the integration time step δ tends towards infinity. Consequently, when an extreme forcing value is used, a simulation run for an infinite time step is likely to result in storage values that are more extreme than any other values of s(t) seen when using a finite time step, hence constituting a conservative estimate for their bounds.

In addition, the steady-state solutions – and, hence, their range – are straightforward to compute with QuaSoARe because, if they exist, they are the roots of a quadratic polynomial (right-hand side of Eq. 9), which can be computed analytically from the coefficients Aj, Bj, and Cj. The corresponding functionality is included in the QuaSoARe software package (Lerat, 2024).

Unfortunately, the existence of steady-state solutions is not guaranteed for all reservoir equations. For example, the exponential reservoir with zero inflows does not have one (Michel et al., 2003). In cases like that, it is recommended that one use a trial-and-error approach to obtain a set of αj values that cover the entire range of s(t) observed during the simulation.

4 Limitations of the method and recommendations

The QuaSoARe method is designed to solve a scalar ordinary differential equation. Hence, it cannot be used to solve a coupled system of equations. This is an important limitation of QuaSoARe as most hydrological models contain multiple stores that could benefit from a joint solution using a Runge–Kutta method, as presented by Clark and Kavetski (2010). Extension of QuaSoARe to higher dimensions is not straightforward because the analytical solutions underpinning the method do not have a vector equivalent. However, in the case where the model reservoirs operate in sequence with no feedback, a simple solution is to apply QuaSoARe to each reservoir in turn at a finer time interval than the desired time step. The fluxes generated at this finer time step can subsequently be used to feed the next reservoir in the model structure. This is arguably less efficient from a runtime perspective than applying QuaSoARe over the whole time step but is probably not dissimilar to discrete methods that often shorten the time step to very short sub-steps to control the error.

The second limitation of QuaSoARe is the quality of the piecewise quadratic interpolation. Figure 1 clearly shows that minor discrepancies between the true and interpolated flux functions can lead to noticeable simulation errors. The solution to this problem is to increase the number of interpolation nodes, as was shown in the illustrative example in Fig. 1, where the interpolation errors are reduced by a factor of 5 when switching from three to four nodes. This is straightforward to implement if a modeller starts with a high number of nodes, leading to an interpolation error smaller than their machine precision, as is done in Sect. 5. Such a small error level is theoretically achievable as the reservoir functions are assumed to be continuous and, hence, can be approximated up to any error level by a piecewise polynomial. If this configuration exceeds the modellers' runtime requirements then the number of nodes is progressively reduced to match this constraint.

Particular care should be taken with the interpolation of the reservoir function close to steady-state values discussed in the previous section. Functions with sharp transitions (e.g. rational fractions) cannot be interpolated accurately by a quadratic polynomial over large intervals. Consequently, if applied without constraint, the piecewise interpolation can overshoot and create erroneous steady-state values that do not exist in the original equation (i.e. values of S where fiS,Ṽ is null but not fiS,Ṽ). To avoid this problem, a constraint is imposed in the computation of the interpolation coefficients presented in Appendix A to restrict the quadratic functions to be monotonic and to prevent them from crossing the 0 line if the original flux function did not.

Another limitation of QuaSoARe comes from the mathematical assumptions introduced in Sect. 1. More specifically, there is a need for flux functions to be Lipschitz continuous, which is equivalent to having bounded derivatives if the function is absolutely continuous. This assumption is required to ensure the unicity of the solutions of Eq. (1) and, hence, their monotonous nature, as demonstrated at the beginning of Sect. 2.2, but it eliminates many common flux functions encountered in hydrological systems (e.g. power functions of S with an exponent lower than 1). A first solution to this problem is to alter the flux functions to obtain smoother functions with bounded derivatives following Kavetski et al. (2006; see Sect. 5 of their paper) and, hence, to revert to the domain of applicability of QuaSoARe. If this is not an option, QuaSoARe may still generate reasonable simulations if the solution of Eq. (1) does not come close to any discontinuity in the flux function derivatives. This is, of course, case specific. An example of such a case is presented in the Supplement.

The discussion above highlights that QuaSoARe, like all numerical ODE solvers, is not guaranteed to converge for all reservoir equations and initial conditions. Reservoir equations often define stability regions where solutions starting from similar initial conditions remain close for all t>0. If the interpolation accuracy is low, it is possible that the approximate and original stability regions do not coincide. As a result, certain values of the initial conditions may lead to a stable solution for the original equation but not for QuaSoARe. Fortunately, this problem is related to interpolation accuracy and can be diagnosed before running QuaSoARe. Similarly to what is mentioned above, it is recommended that QuaSoARe is first run using a high number of interpolation nodes to ensure that stability regions are approximated accurately. Ultimately, the validity interval of the analytical solutions can be verified during QuaSoARe execution using the expressions given in Table B1. Consequently, it is possible to catch this type of problem before attempting a QuaSoARe iteration. Note that this case was never encountered in practice while running the tests presented in the following section, where QuaSoARe is applied to a range of non-linear reservoir models using challenging hydro-climate data.

5 Comparison of the method with alternative numerical schemes

5.1 Reservoir equations tested

The QuaSoARe method is applied to four reservoir equations detailed in Table 1, representing common hydrological models of increasing complexity and non-linearity. All equations in this table depend on a storage scaling factor θ, which is expressed in the same unit as S. This factor acts like a storage capacity and controls the dynamic of the reservoir response. A total of 10 values of θ are evaluated for each equation using bounds for θ as indicated in the last column of Table 1.

The first two equations simulate the routing of an inflow time series from the upstream to downstream end of a river reach. This type of routing model is used in semi-distributed hydrological or flood forecasting models to approximate the solution of hydrodynamic equations (Hapuarachchi et al., 2022). The reach receives an inflow, denoted by Qinflow(t), which is assumed to be fixed over the time step t. Outflow from the reach is computed as a power function of the reach storage following Yevdjevich (1959), where β is the power exponent multiplied by a reference flow, denoted by Qref, which is introduced to simplify dimensional analysis (see Table 1). The routing model is run at an hourly time step. The case where β=1 corresponds to the linear routing model (Meyer, 1941), while β=2 is the quadratic routing store solved analytically by Bentura and Michel (1997). Both cases can be treated as quadratic functions of the storage and, hence, can be solved exactly with QuaSoARe. To provide a more meaningful challenge for the method, the two cases where β=3 (cubic reservoir, denoted CR) and β=6 (bi-cubic reservoir, denoted BCR) are selected.

The third equation corresponds to the production store of the GR4J model (Perrin et al., 2003). This model is a well-established daily conceptual rainfall–runoff model used worldwide. Its production store, referred to as GR, receives rainfall (P) and potential evapotranspiration (E) and generates three fluxes: infiltrated rainfall into the store, actual evapotranspiration from the store, and percolation leaked from the store. The first two fluxes are quadratic functions of the store level, which could be solved exactly with QuaSoARe. However, the percolation flux introduces a strong non-linearity with a fifth-order polynomial. Note that the version of GR used in this paper computes the three fluxes simultaneously in a single equation, similarly to Santos et al. (2018), whereas they are solved sequentially using the operator-splitting method in the original GR4J model presented by Perrin et al. (2003).

The fourth equation, denoted GRM (GR modified), is inspired by the GR equation but increases the non-linearity of the fluxes by converting the infiltrated rainfall and the actual evapotranspiration to fifth-order polynomials. In addition, a fourth flux is added to represent groundwater recharge in the form of a rational fraction. Rational fractions are difficult to interpolate with polynomials as they possess asymptotes, which leads to a challenging case for QuaSoARe.

We highlight that the main objective of introducing these four reservoir equations is to obtain challenging tests for QuaSoARe that are representative of hydrological models in use. The aim is not to improve existing models such as GR4J or to reproduce accurately observed data from existing catchments. Consequently, one should not be surprised by the unusual formulation of certain equations in Table 1.

Table 1Reservoir equations used for testing QuaSoARe.

Download Print Version | Download XLSX

5.2 Performance evaluation

The solution of the four reservoir equations is obtained with QuaSoARe using 5, 50, and 500 interpolation nodes. These three configurations lead to increasing accuracy of the interpolation of flux functions, which is expected to translate into higher solution accuracy.

QuaSoARe is compared with two discrete numerical schemes: the Radau IIA implicit Runge–Kutta method of order 5 (Hairer and Wanner, 1996), referred to as “Radau”, and the explicit Runge–Kutta method of order 5(4) (Dormand and Prince, 1980), denoted “RK45”. The Radau method was chosen because it is implicit (and, hence, is able to handle stiff equations) and of high order, with both characteristics leading us to qualify its outputs as the reference for comparison with other methods. The RK45 method was selected because it is the de facto explicit ODE solver that is widely recognised for its combination of speed and accuracy (Shampine, 2020). Both methods are run using the SciPy package implementation, where these two algorithms are coded in Python (Virtanen et al., 2020).

Three performance criteria are used to compare the performance of these integration methods. The first criterion measures the maximum absolute error between the fluxes computed from one of the methods above and the Radau method:

(11) E m = max F ^ i m k - F ^ i radau k , k = 1 , , p , i = 1 , , n ,

where F^im(k) is the ith flux computed with method m for time step k. Em is measured in the unit of the reservoir fluxes: m3 s−1 for CR and BCR and mm d−1 for the two remaining equations.

The second criterion is the maximum mass balance error between the fluxes computed with one of the methods and Radau:

(12) B m = max k = 1 p F ^ i m k - F ^ i radau k k = 1 p F ^ i radau k , i = 1 , , n × 100 .

Bm is dimensionless and reported in percent. Finally, the third criterion compares the runtime of a method against the Radau runtime:

(13) R m = T m T radau × 100 .

The runtime was measured on a laptop computer using a quad-core processor with a clock speed of 3 GHz. Note that the runtime of QuaSoARe is assessed using a version of the code written in pure Python so that it can be compared with the Radau and RK45 methods. A faster version of the code written in C within the same package is recommended for application purposes (Lerat, 2024). Measuring runtime is dependent on the machine used and thus may lack generality. An alternative metric to measure computational speed was tested (not reported here), where runtime is assessed by the number of flux function evaluations following Clark and Kavetski (2010). This metric provided similar results to Rm but is more challenging to interpret because QuaSoARe and the two discrete methods do not evaluate the same functions (analytical solutions for QuaSoARe and original flux functions for RK45 and Radau). Consequently, the simple runtime metric Rm is preferred here.

Table 2Characteristic of the case study catchments.

* Potential evapotranspiration

Download Print Version | Download XLSX

5.3 Case study area

QuaSoARe performance is evaluated for six sites in the Richmond River catchment in eastern Australia, close to the city of Lismore. The catchments are presented in Table 1, and their location is shown in Fig. 3. This area was chosen because it experienced a devastating flood in February 2022, which prompted an in-depth analysis of the event (Lerat et al., 2022). In addition, the maximum rainfall totals observed during this flood exceeded 700 mm in 24 h. Such extreme values constitute a challenging test for ODE solvers, as pointed out by La Follette et al. (2021). For each catchment, the outlet station and one station located upstream of the outlet, as shown in Fig. 3, are selected. The hourly streamflow data from 1 February 2022 to 10 April 2022 at the upstream station are used to run the two routing models (CR and BCR). The daily catchment average climate data from 1 January 2010 to 31 December 2022 are used to run the two hydrological models (GR and GRM).

As highlighted in Sect. 5.2, the aim of this paper is not to simulate hydrological processes accurately in these catchments but only to obtain realistic forcing data for the numerical experiments presented here.

https://hess.copernicus.org/articles/29/2003/2025/hess-29-2003-2025-f03

Figure 3Location of the test catchments.

6 Results

6.1 Simulation of the GR4J production store

As an example of the application of QuaSoARe, this section details the results obtained with the GR4J production store (GR) presented in Table 1 for the Coopers Creek at Ewing Bridge catchment. The GR simulation is run with a storage scaling factor of 500 mm, a typical value for this parameter in Australia. Figure 4 shows the interpolation performed by QuaSoARe to approximate the three fluxes of the GR model using 10 nodes. The plots show the storage level S divided by the scaling factor θ on the x axis and the instantaneous flux on the y axis. The values for P and E required to compute the flux functions, as indicated in Table 1, are set to 4.2 and 3.1 mm d−1, corresponding to the mean daily rainfall and potential evapotranspiration over the simulation period, respectively. The interpolation error is shown as a thin black line on the same plot using the a secondary y axis of a different scale. In the three plots, the QuaSoARe flux appears to be indistinguishable from the “true” flux, which is visually satisfying but insufficient to guarantee an accurate solution, as already seen in Fig. 1. The interpolation error for the first two fluxes is smaller in magnitude than 2×10-15 mm d−1, which is comparable to the machine precision in most computers. This is expected as the first two GR flux functions are quadratic functions that can be interpolated exactly by QuaSoARe. Note that using 10 nodes is superfluous in this case as 2 nodes would suffice. The third flux is a power function with an exponent of 5, which cannot be interpolated exactly. Consequently, the interpolation error is larger, reaching a magnitude of up to 2.5×10-3 mm d−1. This error remains small and shows an oscillating behaviour that is characteristic of polynomial interpolation using nodes with constant spacing. A potential improvement on this point is discussed in Sect. 7.

Figure 5 shows the daily storage levels and fluxes from the GR reservoir for the year 2022 using the Radau method (orange lines), considered to be the “truth”, and the QuaSoARe method (blue lines) configured with 10 interpolation nodes. In this figure, the Radau and QuaSoARe simulations are visually indistinguishable, which suggests that the interpolation errors shown in Fig. 4 remain small enough to have no lasting impact. The simulation errors are shown as thin black lines using a secondary y axis. These errors are lower in magnitude than 5×10-3 mm d−1, which is negligible compared to typical errors of climate input data. Observation errors are rarely below 10−2 mm d−1 in a research catchment and are probably much higher in the study catchment considered here (e.g. Chubb et al., 2016, report root mean squared errors of gridded daily rainfall data above 4.5 mm d−1). This result confirms that, despite the low number of nodes used, QuaSoARe can simulate the dynamic of the GR store and all its fluxes accurately. All flux errors exhibit oscillating patterns already noted in the interpolation error shown in Fig. 4c, which are likely to be due to a combination of oscillating interpolation errors and the alternation of wet and dry days leading to the sudden variations in actual evapotranspiration visible in Fig. 5c. This suggests that quantifying simulation errors in a highly non-linear reservoir equation is not straightforward and depends on both the quality of the numerical solution and the statistical characteristics of input forcings. More generally, the GR flux functions constitute a challenging case study because they combine the slow dynamic of the storage visible in Fig. 5a and the rapid changes in actual ET seen in Fig. 5c. QuaSoARe appears to resolve both with high accuracy.

https://hess.copernicus.org/articles/29/2003/2025/hess-29-2003-2025-f04

Figure 4True and approximated flux functions of the GR reservoir equation with a scaling factor θ set to 500 mm. P and E variables are set to 4.2 and 3.1 mm, respectively, and QuaSoARe interpolation uses 10 nodes.

Download

https://hess.copernicus.org/articles/29/2003/2025/hess-29-2003-2025-f05

Figure 5Radau and QuaSoARe storage level (a) and three fluxes (b–c) for the GR reservoir with a scaling factor θ set to 500 mm and using data from the Coopers Creek at Ewing Bridge catchment. QuaSoARe is configured with 10 interpolation nodes.

Download

https://hess.copernicus.org/articles/29/2003/2025/hess-29-2003-2025-f06

Figure 6Comparison of performance metrics between the RK45 method and QuaSoARe using 10, 50, and 500 interpolation nodes. The Radau method is used as a reference simulation against which performance metrics are computed. Numbers in black denote the median value of the performance metric, while the blue boxes show their minimum–maximum range.

Download

6.2 Performance assessment

Expanding the analysis of the previous section, Fig. 6 presents statistics of the three performance metrics introduced in Sect. 5.2. The metrics are computed for the four models (CR, BCR, GR, and GRM; see Table 1); the six study catchments (see Table 2); 10 values of the storage capacity parameter θ for each model (see Table 1); and five ODE solvers, including the Radau and RK45 methods and three configurations of QuaSoARe using 10, 50, and 500 nodes. Overall, 60 simulations are produced for each model and ODE solver combination. The Radau method is considered to be the reference against which the error of other methods is computed. The numbers shown in each plot of Fig. 6 report the median value of the metrics over the 60 corresponding simulations, while the blue boxes show their minimum–maximum range.

All the plots in Fig. 6 reveal that QuaSoARe simulations are extremely close to the Radau outputs if QuaSoARe is configured with a high number of nodes (500). The median absolute simulation error of QuaSoARe (Em) varies between 4.4×10-6 mm d−1 for the GR model (Fig. 6g) to 9.4×10-5 m3 s−1 for the BCR model. Both values are several orders of magnitude lower than the observation errors, which means that simulations from QuaSoARe and Radau can be considered to be interchangeable from a modeller's perspective. Importantly, these results also hold for the mass balance metric Bm, where the average difference between the flux totals from QuaSoARe and Radau remains lower than 2×10-6 % (Fig. 6k). At the same time, the QuaSoARe runtime is only a fraction of the Radau runtime, with median values varying from 3.8 % for the CR and BCR models (Fig. 6c and f) to 11.8 % for GRM (Fig. 6l). Finally, QuaSoARe performance is better than RK45 for most models and performance metrics. For example, the maximum absolute error of QuaSoARe is several orders of magnitude lower than that of RK45, except for the CR model, where the error of both methods is close to 1.5×10-5 m3 s−1 (Fig. 6a).

When fewer nodes are used, the errors of QuaSoARe increase and worsen the performance metrics. For example, the median maximum error for the GR model, shown in Fig. 6g, increases from 4.1×10-6 m3 s−1 when using 500 nodes to 3.1×10-3 m3 s−1 when using 10 nodes. This degradation is expected as the interpolation of the reservoir functions worsens with fewer nodes. Nonetheless, the errors remain insignificant compared to observation errors, which suggests that a low number of nodes remains an attractive configuration when applying QuaSoARe to hydrological models. The runtime efficacy of QuaSoARe when using 10 nodes is noticeable, with values remaining lower than 3 % of the Radau runtime for the four models.

We highlight that the results presented here correspond to challenging test cases with highly non-linear flux functions. For example, the GRM reservoir includes functions with polynomials of up to order 7. In addition, the selected catchments exhibit a particularly challenging hydro-climate regime to simulate, with maximum rainfall intensity exceeding several hundred millimetres per day.

7 Discussion

The QuaSoARe method presented in this paper is a valuable alternative to existing numerical schemes for solving the scalar reservoir equation for three reasons. First, the algorithm is simple to understand and code, relying, essentially, on the interpolation of the reservoir functions by piecewise quadratic polynomials. Consequently, it is believed to be straightforward to integrate into an existing modelling platform, and it helps strengthen the numerical solution of hydrological models without adding a significant burden in terms of code maintenance. Second, the method is much faster than standard alternatives such as the RK45 (explicit) and Radau (implicit) schemes tested in this paper. QuaSoARe reduces the runtime by a factor of 20 to 50 compared to Radau, depending on the model. This point further reinforces the value of the method for hydrological modelling tasks requiring repeated model evaluation, such as automated calibration or data assimilation. Finally, the configuration of QuaSoARe can be modified simply by changing the number of interpolation nodes to vary between highly accuracy but slow simulation times (say, with 500 nodes) to lower accuracy and fast runtime (say, with 10 nodes). As a result, the modeller remains in control of the algorithm via a single and easily interpretable configuration parameter.

The QuaSoARe performance reported in this paper is satisfactory, but one may wonder if there could be ways to improve it further without changing the algorithm's core. The first point that could be improved is the quality of the interpolation. Our method relies on piecewise quadratic polynomials, which could be replaced by more flexible functions. However, the requirements of QuaSoARe in terms of interpolation functions are stringent because they should, at the same time, be stable by linear combination (to compute all fluxes) and should lead to an analytical solution of the approximate reservoir equation. A powerful alternative to the quadratic polynomials explored in early versions of this work is a combination of exponential functions. This choice was later abandoned because it was prone to numerical overflow and did not provide significant performance improvements. Nonetheless, it is believed that other functions could meet the QuaSoARe requirements and help improve its performance in difficult situations, such as when the flux functions are rational fractions, which are notoriously tough to interpolate with polynomials (Berrut and Trefethen, 2004).

Related to this point, one may wonder about the performance of a linear interpolation in comparison to its quadratic counterpart as presented in this paper. Tests not shown here revealed that the linear interpolation worsens the maximum absolute error by an approximate factor of 10 with a similar runtime. Interestingly, the difference between the two approaches seems to persist even when using a large number of nodes and, hence, when the interpolation of both the linear and quadratic is expected to be close. Overall, the quadratic interpolation is recommended, but the linear approach as a degraded functionality is kept in the code (Lerat, 2024).

Several ideas could be explored to improve QuaSoARe further. In this paper, the interpolation nodes are placed at equal intervals between the two extremes α1 and αm. This could easily be modified to find the nodes providing the lowest interpolation errors. This might reduce the oscillations of the interpolation errors visible in Fig. 4c. However, this would also increase the algorithm's complexity, whereas simplicity was favoured in this first version of QuaSoARe. Finally, it is flagged that this method could be combined with a discrete method in a way similar to the exponential-integrator approach of Pope (1963). This will likely improve performance further but will also require using a discrete method, which was discarded in this paper's Introduction. However, this could be an interesting avenue for a modeller familiar with discrete methods.

Beyond potential improvements in QuaSoARe, we highlight that the flux functions defined in an empirical modelling context, like most rainfall–runoff models, remain arbitrary and are not derived from physically based equations. In this case, one could argue that piecewise quadratic functions could themselves constitute valid flux functions. This approach would have two merits: first, the instantaneous model equations could be characterised by a small set of coefficients (the interpolation coefficients), hence becoming fully parametric and amenable to optimisation or data assimilation, and, second, the model could be solved exactly with QuaSoARe. As a result, models formulated in this way could become powerful components of flexible modelling environments. This avenue is currently being explored to extend the work of Lerat et al. (2024), in which improvement of the model structure is obtained by updating state equations via data assimilation methods.

8 Conclusion

This paper presents a simple numerical algorithm called QuaSoARe to solve the instantaneous reservoir equation, provide a basis for building hydrological models based on this equation, and generate fast and accurate simulations. The method was tested on a range of highly non-linear models that are representative of hydrological models in use. Its performance suggests that the method matches the accuracy of a high-order implicit discrete method while requiring a fraction of its runtime. Yet, the method algorithm is simple and can be described with a short pseudo-code, which is included in this paper.

The method is limited by its applicability to scalar equations and by the quality of the quadratic interpolation underlying its analytical solution. To model a series of reservoirs, the implementation of sub-time-step integration is suggested. Higher accuracy in the interpolation of reservoir functions can always be achieved by increasing the number of interpolation nodes. The results of this study showed that using 10 to 50 nodes leads to an accuracy level that is an order of magnitude smaller than the typical error in hydro-climate observation data.

Appendix A: Interpolation coefficients

For each function fi and each interval [αj,αj+1], the interpolation process requires values of the coefficients ai,j, bi,j, and ci,j so that the approximated function fi matches fi as best as possible. This is achieved by matching fi at the two points αj and αj+1 and at their midpoint. Assuming that αj<αj+1, the quadratic interpolation leads to

(A1)ai,j=2f0+2f1-4fmαj+1-αj2,(A2)bi,j=-2αjai,j+4fm-3f0-f1αj+1-αj,(A3)ci,j=αj2ai,j-αj4fm-3f0-f1αj+1-αj+f0,

where

(A4) f 0 = f i α j , f 1 = f i α j + 1 , f m = f i α j + α j + 1 2 .

This solution is straightforward but can lead to a function fi that is non-monotonous, for example, when interpolating a function fi that presents sharp transitions or asymptotes. This situation can create an issue related to the steady-state solution of Eq. (1), as discussed in Sect. 4. To avoid this undesirable effect, the value of fm used in Eqs. (A1) to (A3) is replaced by a value fm defined as follows:

(A5) f m = max ( f m - , min f m + , f m ) ,

where the two bounds fm- and fm+ are given by

(A6)fm-=min3f0+f14,f0+3f14,(A7)fm+=max3f0+f14,f0+3f14.

It can be verified that using fm instead of fm in Eqs. (A1) to (A3) leads to a monotonous quadratic function fi.

Appendix B: Analytical solution of the approximated reservoir equation

In this Appendix, the approximate reservoir equation (Eq. 9) is solved over an interval [t0, t1] such that t,St[αjαj+1], starting from the initial condition S(t0)=S0. This solution is obtained by separating the variables leading to the following integral equation:

(B1) S 0 S 1 d S A j S 2 + B j S + C j = t ,

where S1=S(t1). Here, it is assumed that either Aj≠0 or Bj≠0. If this is not the case, the interpolation function fi is simply the constant Cj, leading to

Table B1Solutions of approximate reservoir equation.

Download Print Version | Download XLSX

(B2) S t 1 = S 0 + C j τ ,

where τ=t1-t0. If Aj≠0 or Bj≠0, the solutions of Eq. (B1) can be obtained from any calculus textbook. They are presented succinctly in Table B1. In this table, the subscript j is dropped to simplify notations. The function ν mentioned in the second column of Table B1 is defined as the following primitive:

(B3) ν A j , B j , C j , s = d S A j S 2 + B j S + C j .

This function is used to compute the times tl and tu mentioned in cases 2 and 3 in Sect. 2.3.

In Table B1, the following expressions are used to simplify notations further:

(B4)S=-Bj2Aj,(B5)Δ=Bj2-4AjCj,σΔ=sgn(Δ),qΔ=Δ2,(B6)ωΔx=tanx if Δ<0tanhx if Δ>0,(B7)ηΔx=atanx if Δ<0-atanhx if Δ>0 and x<1-atanh1/x if Δ>0 and x>1,

where sgn(Δ) is equal to +1 if Δ≥0 and to −1 otherwise.

Focus is now given to finding an expression for the total of the ith flux introduced in Eq. (2). Combining the solution of Eq. (B1) given in the third column of Table B1, denoted S(t), with Eq. (2) gives

(B8) O i ( t 0 , t 1 ) = t 0 t 1 f i S ( t ) d t = a i , j t 0 t 1 S ( t ) 2 d t + b i , j t 0 t 1 S ( t ) d t + c i , j τ ,

where τ=t1-t0. Note that, in the above equations, the integral boundaries used in Eq. (2) ([0,δ]) are generalised to [t0, t1] because fluxes are often computed on an smaller interval than [0, δ] in the algorithm described in Sect. 2.3. Solving Eq. (B8) is equivalent to integrating S(t) and S(t)2 between t0 and t1. To compute these two integrals, different cases for Aj and Bj are considered, starting with Aj=Bj=0. In this case, the following is obtained from Eq. (B2):

(B9)t0t1S(t)dt=S0τ+Cjτ22,(B10)t0t1S(t)2dt=S02τ+S0Cjτ2+Cj2τ33.

It is now assumed that Aj=0 and Bj≠0. The two integrals can be obtained by manipulating and integrating Eq. (9) as follows:

(B11)t0t1dSdtdt=Bjt0t1S(t)dt+Cjτt0t1S(t)dt=1Bj(S1-S0-Cjτ),(B12)t1t2StdSdtdt=Bjt1t2St2dt+Cjt1t2Stdtt0t1S(t)2dt=1BjS12-S022-Cjt0t1S(t)dt.

With these two equations, integrating S is done first using Eq. (B11). This integral is then used in Eq. (B13) to compute the integral of S2.

Finally, the general case where Aj≠0 is addressed. Following a similar approach than above, Eq. (9) is rearranged and integrated as follows:

(B13) t 0 t 1 d S d t d t = A j t 0 t 1 S ( t ) 2 d t + B j t 0 t 1 S ( t ) d t + C j τ t 0 t 1 S ( t ) 2 d t = 1 A j S 1 - S 0 - B j t 0 t 1 S ( t ) d t - C j τ .

Consequently, the integration of S2 can be deduced from the one of S. For the integration of S, the expression of S(t) given in the third column of Table B1 is used. If Δ=0 (see row before last in Table B1), the following is obtained:

(B14) t 0 t 1 S ( t ) d t = S τ - 1 a log 1 - a τ S 0 - S .

A value Δ≠0 leads to (see last row in Table B1)

(B15) t 0 t 1 S ( t ) d t = S τ + 1 2 a log 1 - σ Δ ω Δ 2 q Δ τ - 1 a log 1 - a S 0 - S q Δ ω Δ q Δ τ .
Code and data availability

The QuaSoARe method is released as part of a Python package written by Lerat (2024) (https://doi.org/10.5281/zenodo.13928253). The package contains two implementations of the method written in the Python and C languages. The C version is recommended due to its significantly faster runtime. All scripts and hydro-climate data used to generate the results in this paper are included in the code repository.

Supplement

The supplement related to this article is available online at https://doi.org/10.5194/hess-29-2003-2025-supplement.

Competing interests

The author has declared that there are no competing interests.

Disclaimer

Publisher's note: Copernicus Publications remains neutral with regard to jurisdictional claims made in the text, published maps, institutional affiliations, or any other geographical representation in this paper. While Copernicus Publications makes every effort to include appropriate place names, the final responsibility lies with the authors.

Acknowledgements

The contributions of Tewfik Sari and Vazken Andréassian from INRAE, who pointed out references for the TPLA method and commented on early versions of this paper, are greatly acknowledged. Comments provided by Justin Hughes, CSIRO; David Robertson, CSIRO; and Charles Perrin, INRAE, as well as the site map prepared by Steve Marvanek, CSIRO, and the editing by Margie Beilharz, are also acknowledged. Finally, the two anonymous reviewers who raised important questions and helped improve the quality of the paper significantly, are thanked.

Financial support

This research has been supported by Rous County Council as part of the Richmond and Wilsons Rivers Flood Risk Mitigation Project.

Review statement

This paper was edited by Roger Moussa and reviewed by two anonymous referees.

References

American Meteorological Society: Diagnostic Equation, Glossary of Meteorology, http://glossary.ametsoc.org/wiki/Diagnostic_equation (last access: 16 April 2025), 2024. 

Bentura, P. L. F. and Michel, C.: Flood routing in a wide channel with a quadratic lag-and-route method, Hydrol. Sci. J., 42, 169–189, https://doi.org/10.1080/02626669709492018, 1997. 

Bergstrom, S. and Forsman, A.: Development of a conceptual deterministic rainfall-runoff model, Hydrol. Res., 4, 147–170, https://doi.org/10.2166/nh.1973.0012, 1973. 

Berrut, J.-P. and Trefethen, L. N.: Barycentric Lagrange Interpolation, SIAM Rev., 46, 501–517, https://doi.org/10.1137/S0036144502417715, 2004. 

Bond, B. N. and Daniel, L.: Stable Reduced Models for Nonlinear Descriptor Systems Through Piecewise-Linear Approximation and Projection, IEEE T. Comput. Aid. D., 28, 1467–1480, https://doi.org/10.1109/TCAD.2009.2030596, 2009. 

Burnash, R. J. C. and Ferral, R. L.: A systems approach to real-time runoff analysis with a deterministic rainfall-runoff model, NOAA technical memorandum NWS WR, United States National Weather Service, Salt Lake City, 23 pages, https://repository.library.noaa.gov/view/noaa/14378 (last access: 16 April 2025), 1981. 

Butcher, J. C.: Numerical methods for ordinary differential equations, Wiley, Chichester, https://doi.org/10.1002/9781119121534, 2003. 

Chubb, T. H., Manton, M. J., Siems, S. T., and Peace, A. D.: Evaluation of the AWAP daily precipitation spatial analysis with an independent gauge network in the Snowy Mountains, Journal of Southern Hemisphere Earth Systems Science, 66, 55–67, https://doi.org/10.1071/es16006, 2016. 

Clark, M. P. and Kavetski, D.: Ancient numerical daemons of conceptual hydrological modeling: 1. Fidelity and efficiency of time stepping schemes, Water Resour. Res., 46, W10510, https://doi.org/10.1029/2009WR008894, 2010. 

Clark, M. P., Slater, A. G., Rupp, D. E., Woods, R. A., Vrugt, J. A., Gupta, H. V., Wagener, T., and Hay, L. E.: Framework for Understanding Structural Errors (FUSE): A modular framework to diagnose differences between hydrological models, Water Resour. Res., 44, W00B02, https://doi.org/10.1029/2007WR006735, 2008. 

Croke, B. F. W. and Jakeman, A. J.: A catchment moisture deficit module for the IHACRES rainfall-runoff model, Environ. Model. Softw., 19, 1–5, https://doi.org/10.1016/j.envsoft.2003.09.001, 2004. 

Dormand, J. R. and Prince, P. J.: A family of embedded Runge-Kutta formulae, J. Comput. Appl. Math., 6, 19–26, https://doi.org/10.1016/0771-050X(80)90013-3, 1980. 

Fan, P. and Li, J. C.: Diffusive wave solutions for open channel flows with uniform and concentrated lateral inflow, Adv. Water Resour., 29, 1000–1019, https://doi.org/10.1016/j.advwatres.2005.08.008, 2006. 

Fiorentini, M. and Orlandini, S.: Robust numerical solution of the reservoir routing equation, Adv. Water Resour., 59, 123–132, https://doi.org/10.1016/j.advwatres.2013.05.013, 2013. 

Gill, M. A.: Exact Solution of Gradually Varied Flow, J. Hydraul. Eng., 102, 1353–1364, https://doi.org/10.1061/JYCEAJ.0004617, 1976. 

Hairer, E. and Wanner, G.: Solving Ordinary Differential Equations II, Springer, Berlin, Heidelberg, https://doi.org/10.1007/978-3-642-05221-7, 1996. 

Hairer, E., Nørsett, S. P., and Wanner, G.: Solving ordinary differential equations I: nonstiff problems, 2nd rev. edn., Springer, Heidelberg, London, 528 pp., ISBN 978-3-540-56670-0, 2009. 

Hapuarachchi, H. A. P., Bari, M. A., Kabir, A., Hasan, M. M., Woldemeskel, F. M., Gamage, N., Sunter, P. D., Zhang, X. S., Robertson, D. E., Bennett, J. C., and Feikema, P. M.: Development of a national 7-day ensemble streamflow forecasting service for Australia, Hydrol. Earth Syst. Sci., 26, 4801–4821, https://doi.org/10.5194/hess-26-4801-2022, 2022. 

Hartman, P.: Ordinary Differential Equations, Second, Society for Industrial and Applied Mathematics, https://doi.org/10.1137/1.9780898719222, 2002. 

Hayami, S.: On the propagation of flood waves, Bulletins-Disaster Prevention Research Institute, Kyoto University, 1, 1–16, 1951. 

Hochbruck, M. and Ostermann, A.: Explicit Exponential Runge-Kutta Methods for Semilinear Parabolic Problems, SIAM J. Numer. Anal., 43, 1069–1090, 2006. 

Johansson, M.: Piecewise Linear Control Systems, Springer Berlin Heidelberg, Berlin, Heidelberg, https://doi.org/10.1007/3-540-36801-9, 2003. 

Kalman, E. R.: Phase-plane analysis of automatic control systems with nonlinear gain elements, Transactions of the American Institute of Electrical Engineers, Part II: Applications and Industry, 73, 383–390, https://doi.org/10.1109/TAI.1955.6367086, 1955. 

Kalra, S. and Nabi, M.: Automated scheme for linearisation points selection in TPWL method applied to non-linear circuits, J. Eng., 2020, 41–49, https://doi.org/10.1049/joe.2019.0876, 2020. 

Kavetski, D. and Clark, M. P.: Ancient numerical daemons of conceptual hydrological modeling: 2. Impact of time stepping schemes on model analysis and prediction, Water Resour. Res., 46, W10511, https://doi.org/10.1029/2009WR008896, 2010. 

Kavetski, D. and Clark, M. P.: Numerical troubles in conceptual hydrology: Approximations, absurdities and impact on hypothesis testing, Hydrol. Process., 25, 661–670, https://doi.org/10.1002/hyp.7899, 2011. 

Kavetski, D., Kuczera, G., and Franks, S. W.: Calibration of conceptual hydrological models revisited: 1. Overcoming numerical artefacts, J. Hydrol., 320, 173–186, https://doi.org/10.1016/j.jhydrol.2005.07.012, 2006. 

Knoben, W. J. M., Freer, J. E., Fowler, K. J. A., Peel, M. C., and Woods, R. A.: Modular Assessment of Rainfall–Runoff Models Toolbox (MARRMoT) v1.2: an open-source, extendable framework providing implementations of 46 conceptual hydrologic models as continuous state-space formulations, Geosci. Model Dev., 12, 2463–2480, https://doi.org/10.5194/gmd-12-2463-2019, 2019. 

La Follette, P. T., Teuling, A. J., Addor, N., Clark, M., Jansen, K., and Melsen, L. A.: Numerical daemons of hydrological models are summoned by extreme precipitation, Hydrol. Earth Syst. Sci., 25, 5425–5446, https://doi.org/10.5194/hess-25-5425-2021, 2021. 

LaSalle, J.: Some Extensions of Liapunov's Second Method, IRE Transactions on Circuit Theory, 7, 520–527, https://doi.org/10.1109/TCT.1960.1086720, 1960. 

Lerat, J.: pyquasoare (v1.5), Zenodo [code], https://doi.org/10.5281/zenodo.13928253, 2024. 

Lerat, J., Vaze, J., Marvanek, S., Ticehurst, C., and Wang, B.: Characterisation of the 2022 floods in the Northern Rivers region, CSIRO csiro:EP2022-5538, https://doi.org/10.25919/1bcs-e398, 2022. 

Lerat, J., Chiew, F., Robertson, D., Andréassian, V., and Zheng, H.: Data Assimilation Informed Model Structure Improvement (DAISI) for Robust Prediction Under Climate Change: Application to 201 Catchments in Southeastern Australia, Water Resour. Res., 60, e2023WR036595, https://doi.org/10.1029/2023WR036595, 2024. 

Litrico, X., Pomet, J.-B., and Guinot, V.: Simplified nonlinear modeling of river flow routing, Adv. Water Resour., 33, 1015–1023, https://doi.org/10.1016/j.advwatres.2010.06.004, 2010. 

Meyer, O. H.: Flood-routing on the Sacramento River, Eos, Transactions American Geophysical Union, 22, 118–124, https://doi.org/10.1029/TR022i001p00118, 1941. 

Michel, C., Perrin, C., and Andreássian, V.: The exponential store: a correct formulation for rainfall–runoff modelling, Hydrol. Sci. J., 48, 109–124, https://doi.org/10.1623/hysj.48.1.109.43484, 2003. 

Mironchenko, A.: Input-to-State Stability, in: Input-to-State Stability: Theory and Applications, edited by: Mironchenko, A., Springer International Publishing, Cham, 41–115, https://doi.org/10.1007/978-3-031-14674-9_2, 2023. 

Munier, S., Litrico, X., Belaud, G., and Malaterre, P.-O.: Distributed approximation of open-channel flow routing accounting for backwater effects, Adv. Water Resour., 31, 1590–1602, https://doi.org/10.1016/j.advwatres.2008.07.007, 2008. 

Perrin, C., Michel, C., and Andréassian, V.: Improvement of a parsimonious model for streamflow simulation, J. Hydrol., 279, 275–289, https://doi.org/10.1016/S0022-1694(03)00225-7, 2003. 

Pope, D. A.: An exponential method of numerical integration of ordinary differential equations, Commun. ACM, 6, 491–493, https://doi.org/10.1145/366707.367592, 1963. 

Press, W. H., Teukolsky, S. A., Vetterling, W. T., and Flannery, B. P.: Numerical Recipes 3rd Edition: The Art of Scientific Computing, 3rd edition., Cambridge University Press, Cambridge, UK, New York, 1256 pp., 2007. 

Rewienski, M. and White, J.: A trajectory piecewise-linear approach to model order reduction and fast simulation of nonlinear circuits and micromachined devices, IEEE T. Comput. Aid. D., 22, 155–170, https://doi.org/10.1109/TCAD.2002.806601, 2003.  

Santos, L., Thirel, G., and Perrin, C.: Continuous state-space representation of a bucket-type rainfall-runoff model: a case study with the GR4 model using state-space GR4 (version 1.0), Geosci. Model Dev., 11, 1591–1605, https://doi.org/10.5194/gmd-11-1591-2018, 2018. 

Shampine, L. F.: Numerical Solution of Ordinary Differential Equations, Routledge, New York, 632 pp., https://doi.org/10.1201/9780203745328, 2020. 

Sontag, E. D.: Smooth stabilization implies coprime factorization, IEEE T. Automat. Cont., 34, 435–443, https://doi.org/10.1109/9.28018, 1989. 

Virtanen, P., Gommers, R., Oliphant, T. E., Haberland, M., Reddy, T., Cournapeau, D., Burovski, E., Peterson, P., Weckesser, W., Bright, J., van der Walt, S. J., Brett, M., Wilson, J., Millman, K. J., Mayorov, N., Nelson, A. R. J., Jones, E., Kern, R., Larson, E., Carey, C. J., Polat, Ý., Feng, Y., Moore, E. W., VanderPlas, J., Laxalde, D., Perktold, J., Cimrman, R., Henriksen, I., Quintero, E. A., Harris, C. R., Archibald, A. M., Ribeiro, A. H., Pedregosa, F., van Mulbregt, P., and SciPy 1.0 Contributors: SciPy 1.0: Fundamental Algorithms for Scientific Computing in Python, Nature Methods, 17, 261–272, https://doi.org/10.1038/s41592-019-0686-2, 2020. 

Yevdjevich, V. M.: Analytical integration of the differential equation for water storage, J. Res. Nat. Bur. Stand. B, 63B, 43, https://doi.org/10.6028/jres.063B.007, 1959. 

Download
Short summary
This paper presents a method to solve a certain type of equation controlling the storage of water in hydrological models. This equation is often solved with complex numerical methods that may lead to slow runtimes. The method, called the Quadratic Solution of the Approximate Reservoir Equation (QuaSoARe), is both fast and applicable to any equation of this kind regardless of its complexity. The method reduces runtime by a factor of 10 to 50 depending on the model.
Share