# State Analysis of the Water Quality in Rivers in Consideration of Diffusion Phenomenon
## 2 Materials and Methods
### Streeter-Phelps Mathematical River Model  
The widely used Streeter-Phelps model is used to predict oxygen demand, following the introduction of pollutants into a river. This makes it possible to determine the oxygen concentration in successive sections of a polluted river. The essence of the model is an equation of the oxygen balance between two competing processes: the uptake of oxygen from the water, associated with the removal of organic carbon compounds, and the supply of oxygen from the atmosphere to the water through re-aeration. The Streeter-Phelps model is helpful for predicting the changes that occur in a polluted river [27; 28; 29]. It is assumed that the equations describe the reaction, under conditions of ideal and continuous mixing (the so-called continuous mixing chemical reactor). When considering changes in rivers, this situation refers to a certain stretch of water in the river. The effect of this approach is to obtain connected \"reactors\" for which the state of pollution is monitored, i.e., to divide the river into small sections. Otherwise, the river should be divided into sections corresponding to changes in flow or pollutant inflows. Each section should be treated as an individual case of the model considered [5; 6; 7]. Based on the Streeter-Phelps formulation, the process of BOD and DO changes can be modelled by differential equations:  
\[\frac{dx_{1}}{dt}=-k_{1}x_{1},x_{1}(t_{0})=x_{10} \tag{10}\]  
where \(x_{1}[\mathrm{mg}/\mathrm{L}]\)--BOD, \(t[\mathrm{day}]\)--time, and \(k_{1}\Big{[}\mathrm{d}^{-1}\Big{]}\)--reaction rate coefficient. By contrast, the change in DO level is:  
\[\frac{dx_{2N}}{dt}=-k_{2}x_{1}+k_{3}(x_{2N}-x_{2})+a \tag{11}\]  
where \(x_{2N}[\mathrm{mg}/\mathrm{L}]\)--DO concentration, \(k_{2}\Big{[}\mathrm{d}^{-1}\Big{]}\)--rate coefficient for the influence of BOD on DO, \(k_{3}\Big{[}\mathrm{d}^{-1}\Big{]}\)--rate coefficient for the uptake of oxygen from the atmosphere, and \(a[\mathrm{mg}/\mathrm{L}\cdot\mathrm{d}]\)--intensity of oxygen supply. Denoting \(x_{2}\) as DO deficit understood as:  
\[x_{2}=x_{2N}-x_{2s} \tag{12}\]  
The change in DO deficit over time can be described by the relationship:  
\[\frac{dx_{2}}{dt}=-k_{2}x_{1}-k_{3}x_{2}+a,x_{2}(t_{0})=x_{20} \tag{13}\]  
Using vector notation, Equations (10) and (13) take the form:  
\[\frac{dx}{dt}=Ax+Bw,x_{0}(t_{0})=x_{0} \tag{14}\]  
where \(A=\big{[}\begin{array}{cccc}-k_{1}&0;&-k_{2}&-k_{3}\end{array}\big{]}\)--state matrix, \(x\)--vector \(x=col[x_{1}x_{2}]\), \(B\)--control matrix, and \(w\)--external excitation and control vector. Equation (14) is the starting point for considering the mathematical modelling of a river without taking into account the phenomenon of diffusion. The model is presented as a continuously stirred reservoir. The above considerations apply to a section of river of small length. For large sections, the outflow from one reservoir is the inflow of another. The result is a division of the river into many fragments interpreted individually. A detailed description of the considerations has been included in previous works [5; 6; 7].