I'm a Ph.D student of Hydraulic structures. I'm reading a paper in that the equation $(II)$ below is obtained by differentiating the equation $(I)$ using FDE (Finite Difference Equation) method and 'upwind' scheme.unfortunately I wasn't able to get the details by myself.
\begin{equation} \frac{d}{dx}\left(C_T\frac{\rho u^2}{2}\right)=\frac{dp}{dx}-\frac{f\rho u^2p}{8Ar} \ , \quad \quad (I) \end{equation}
\begin{equation}
D_iu_i=A_i u_{i+1}+B_iu_{i-1}+Ar(p_i-p_{i+1})+C_i\ , \quad \quad (II)
\end{equation}
where
\begin{eqnarray}
A_i & = &C_T\{-(\rho uAr)_{i+1}\}, \\
B_i & = &C_T(uAr)_{i-1}, \\
C_i & = &-\frac{f}{8}u_i^2p_ix_i, \\
D_i & = & A_i+B_i \ .
\end{eqnarray}
In the above equations $C_T, \rho, f$ and $Ar$ are constants, $u=u(x), p=p(x)$ are differentiable functions of the non-negative real variable $x$ and $A, B, C$ and $D$ are the coefficients of FDE.
Here I have two questions:
1. How does the equation $(I)$ gives the equation $(II)$?
2. It's been said in the paper that the equation $(II)$ can be solved by Tri-Diagonal Matrix Algorithm (TDMA), while the equation $(II)$ leads to a non-linear system of equations. So, my second question is that how can TDMA be applied to a non-linear system of equations?