Differentitaion of a non-linear equation using FDM method

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?

• Isn't there a $\rho$ missing within the parenthesis of term $B_i$? – Fausto Arinos Barbuto May 6 '16 at 3:06
• No, there is't any $\rho$ in term $B_i$. – RePi May 6 '16 at 6:59
• That is strange, because you're then adding two terms, $A_iu_{i+1}$ and $B_iu_{i-1}$ that clearly do not have the same dimensions. It is like adding apples to oranges. I would humbly say that Eq. (16) in the paper you mentioned contains a typo. This presumed error propagates to the "central" term $D_iu_i$, as it also contains $B_i$. – Fausto Arinos Barbuto May 6 '16 at 13:30
• Also, the $p$ in the 2nd term of the RHS of $(I)$ is not correct. It should appear as $P$ (perimeter) rather than $p$ (pressure). The article shows it correctly, $P$. Thus $(I)$ is dimensionally correct, with all terms $ML^{-2}T^{-2}$. – Fausto Arinos Barbuto May 6 '16 at 14:26
• Thanks for your kind attention, you are right and $P$ is perimeter in RSH of $(I)$. Do you know how the equation $(I)$ leads to equation $(II)$? – RePi May 7 '16 at 4:43