# Transient Friction Analysis of Pressure Waves Propagating in Power-Law Non-Newtonian Fluids
## 2 Mathematical Model and Solution Method
### Methods of Solution
#### 2.4.2 Numerical Solution  
The weighted residual method is employed to solve Equation (4) in this section. By substituting Equation (5) into Equation (4), the motion equation can be rewritten as  
\[\rho\frac{\partial u}{\partial t}=-f+K\left|\frac{\partial u}{\partial r} \right|^{n-1}\left(\frac{1}{r}\frac{\partial u}{\partial r}+n\frac{\partial^ {2}u}{\partial r^{2}}\right), \tag{14}\]  
where \(f\) is pressure gradient \(\partial P/\partial x\). Assuming that the functional form of the approximate solution \(u(r,t)\) is given by  
\[u(r,t)=\sum_{i=1}^{M}a_{i}(t)\text{cos}\,\frac{(2i-1)\pi r}{2R}=\mathbf{N}(r) \mathbf{a}(t), \tag{15}\]where \(a_{i}(t),\ i=1,2,\ldots,M\) is a set of unknown coefficients that vary over time, \(M\) is the number of trial functions, \(\mathbf{N}(r)\) is a row vector of trial functions that satisfies the boundary conditions represented by Equations (8) and (9)  
\[\mathbf{N}(r)=\Big{[}\cos\frac{\pi r}{2R}\quad\cdots\quad\cos\frac{(2j-1)\pi r }{2R}\quad\cdots\quad\cos\frac{(2M-1)\pi r}{2R}\Big{]},\]  
and \(\mathbf{a}\) is a column vector  
\[\mathbf{a}(t)=\big{[}a_{1}(t)\quad a_{2}(t)\quad\cdots\quad\cdots\quad a_{M}(t )\big{]}^{\mathrm{T}}.\]  
The approximate function assumed by Equation (15) satisfies the boundary conditions Equations (8) and (9). Substituting Equation (15) into Equation (14) yields the residual  
\[R(t,r,\mathbf{a})=-\rho\mathbf{N}(r)\frac{d\mathbf{a}(t)}{dt}-f(t)+K\bigg{|} \frac{\partial\mathbf{N}(r)}{\partial r}\mathbf{a}(t)\bigg{|}^{n-1}\bigg{(} \frac{1}{r}\frac{\partial\mathbf{N}(r)}{\partial r}+n\frac{\partial^{2} \mathbf{N}(r)}{\partial r^{2}}\bigg{)}\mathbf{a}(t). \tag{16}\]  
The collocation method is used to determine the \(M\) unknown coefficients \(a_{1},\ldots,a_{M}\). In order to obtain the \(M\) equations, we choose \(M\) uniformly distributed collocation points \(r_{j}\in(0,R),\ j=1,2,\ldots,M\), where we enforce the residual Equation (16) to be zero  
\[R\big{(}t,r_{j},\mathbf{a}\big{)}=0,\ j=1,2,\ldots,M. \tag{17}\]  
The derivative of time in Equation (16) is discretized using implicit finite difference, and the following equations can be obtained:  
\[ \begin{split} R_{tj}=-\rho\mathbf{N}\big{(}r_{j}\big{)}\frac{ \mathbf{a}_{m}-\mathbf{a}_{m-1}}{\Delta t}-f(t)+K\bigg{|}\frac{\partial \mathbf{N}(r_{j})}{\partial r}\mathbf{a}_{m}\bigg{|}^{n-1}\bigg{(}\frac{1}{r_ {j}}\frac{\partial\mathbf{N}(r_{j})}{\partial r}+n\frac{\partial^{2}\mathbf{ N}(r_{j})}{\partial r^{2}}\bigg{)}\mathbf{a}_{m}=0,\\ j=1,2,\ldots,M;\ m=2,3,\ldots,\end{split}  \tag{18}\]  
where \(\Delta t\) is the interval between two times steps, the subscript \(m\) represents the \(m\)th time step to be solved. Equation (18) is a nonlinear algebraic equation, which is solved using the Newton-Raphson method,  
\[\frac{\partial R_{tj}}{\partial\mathbf{a}_{m}}\Delta\mathbf{a}_{m}=-R_{tj} \Big{(}\mathbf{a}_{m}^{k-1}\Big{)},\ j=1,2,\ldots,M;m=2,3,\ldots;k=1,2,\ldots, \tag{19}\]  
where \(\Delta\mathbf{a}_{m}\) is the incremental column vector of unknown coefficients, superscript \(k\) represents the number of iteration steps, \(R_{tj}\Big{(}\mathbf{a}_{m}^{k-1}\Big{)}\) is the residual of the previous iteration step, and \(\partial R_{tj}/\partial\mathbf{a}_{m}\) is the Jacobian row vector for the \(j\)th equation,  
\[ \begin{split}\frac{\partial R_{tj}}{\partial\mathbf{a}_{m}}=- \frac{\rho}{\Delta t}\mathbf{N}\big{(}r_{j}\big{)}&+K(n-1)\bigg{|} \frac{\partial\mathbf{N}(r_{j})}{\partial r}\mathbf{a}_{m}^{k-1}\bigg{|}^{n-2} \Big{(}\mathbf{a}_{m}^{k-1}\Big{)}^{\mathrm{T}}\Big{(}\frac{1}{r_{j}}\frac{ \partial\mathbf{N}(r_{j})}{\partial r}+n\frac{\partial^{2}\mathbf{N}(r_{j})}{ \partial r^{2}}\bigg{)}^{\mathrm{T}}\frac{\partial\mathbf{N}(r_{j})}{\partial r }\\ +K\bigg{|}\Big{(}\mathbf{a}_{m}^{k-1}\Big{)}^{\mathrm{T}}\frac{ \partial\mathbf{N}^{\mathrm{T}}(r_{j})}{\partial r}\bigg{|}^{n-1}\bigg{(} \frac{1}{r_{j}}\frac{\partial\mathbf{N}(r_{j})}{\partial r}+n\frac{\partial^{2 }\mathbf{N}(r_{j})}{\partial r^{2}}\bigg{)},\\ j=1,2,\ldots,M;m=2,3,\ldots;k=1,2,\ldots.\end{split}