Solve non-linear boundary-value-problem with finite difference method (FDM)

384 Views Asked by At

Given a boundary-value-problem

$u''(x) = (10^{-7}u(x) + 10^{-8}x(x-2))\cdot (1 + u'(x)^2)^\frac{3}{2}$

with conditions $u(0) = 0$ and $u(2) = 0$ and formulars for first and second derivation:

$u''(i) = \frac{u_{i-1} - 2u_i + u_{i+1}}{h^2}$ and $u'(i) = \frac{-u_{i-1} + u_{i+1}}{2h}$

As you can see, this differential equation is non-linear.

My professor told me to solve this problem with the Finite Difference Method (FDM) using Newton's Method.

If the problem were linear, I could have simply set up and solved the system of linear equations. But the nonlinearity poses a challenge that I can not master without a few tips.

Edit:

Please correct me if I am wrong.

So this is the second-order differential equation with the formulas added:

$f_{u_i} = \frac{u_{i-1} - 2u_i + u_{i+1}}{h^2} - (10^{-7}u_i + 10^{-8}x_i(x_i - 2))\cdot (1 + (\frac{-u_{i-1} + u_{i+1}}{2h})^2)^{\frac{3}{2}}$

The diagonal of the Jacobian Matrix is

$\frac{df_{u_i}}{du_i} = -\frac{2}{h^2} - 10^{-7}(1 + (\frac{-u_{i-1} + u_{i+1}}{2h})^2)^{\frac{3}{2}} $,

the lower diagonal of the Jacobian Matrix is

$\frac{df_{u_i}}{du_{i-1}} = \frac{1}{h^2} - (10^{-7}u_i + 10^{-8}x_i(x_i - 2))\cdot(1 + \frac{u_{i-1}^2}{4h^2} - \frac{u_{i-1}u_{i+1}}{2h} + \frac{u_{i+1}^2}{4h^2})^{\frac{3}{2}} = \frac{1}{h^2} - \frac{3}{2}(10^{-7}u_i + 10^{-8}x_i(x_i - 2))\cdot(1 + \frac{u_{i-1}^2}{4h^2} - \frac{u_{i-1}u_{i+1}}{2h} + \frac{u_{i+1}^2}{4h^2})^{\frac{1}{2}}\cdot (2\frac{u_{i-1}}{4h^2} - \frac{u_{i+1}}{h})^{\frac{1}{2}}$

the upper diagonal of the Jacobian Matrix is

$\frac{df_{u_i}}{du_{i+1}} = \frac{1}{h^2} - (10^{-7}u_i + 10^{-8}x_i(x_i - 2))\cdot(1 + \frac{u_{i-1}^2}{4h^2} - \frac{u_{i-1}u_{i+1}}{2h} + \frac{u_{i+1}^2}{4h^2})^{\frac{3}{2}} = \frac{1}{h^2} - \frac{3}{2}(10^{-7}u_i + 10^{-8}x_i(x_i - 2))\cdot(1 + \frac{u_{i-1}^2}{4h^2} - \frac{u_{i-1}u_{i+1}}{2h} + \frac{u_{i+1}^2}{4h^2})^{\frac{1}{2}}\cdot (2\frac{u_{i+1}}{4h^2} - \frac{u_{i-1}}{h})^{\frac{1}{2}}$

1

There are 1 best solutions below

7
On BEST ANSWER

Try to write the $i-$th component of this system of non linear equations. Indeed, you want to write $\mathbf{F}(\vec u)=\vec 0$ where $F$ is a vectorial function.

The i-th component of $(F(u))_i$is:

\begin{align} \frac{u_{i-1} - 2u_i + u_{i+1}}{h^2} - (10^{-7}u_i+10^{-8}x_i (x_i-2))\cdot(1+(\frac{-u_{i-1} + u_{i+1}}{2h})^2)^{3/2} \end{align}

For each $i \in \{1,\ldots, N\}$ you have to solve $(F(u))_i=0$

As your professor told you, you have to use Newton's method since the equation is non-linear, and so you need the jacobian matrix, and since you have $(F(u))_i$ we can get the i-th row of the jacobian, i.e. just compute

\begin{align} \frac{\partial F_i}{\partial u_j}, \quad j \in \{1, \ldots,N \} \end{align}

The only derivatives that are different from zeros are wrt $u_{i-1},u_{i},u_{i+1}$

As an example, if you derive w.r.t to $u_i$ (diagonal term)

\begin{align} (J)_{ii}=\frac{2}{h^2}-[10^{-7} \cdot (1+(\frac{u_{i+1}-u_{i-1}}{2h})^2)^{3/2}] \end{align}

You have to compute now $(J)_{i,i+1}$ and $(J)_{i,i-1}$ and then you can build your matrix $J(u)$, which is tridiagonal (except to first and last row, because of the boundary conditions)

But pay attention at the boundary, they have to be done separately.

Once you have $F$ and $J$, we have just to apply Newton's method for non-linear systems.

Starting with an initial guess $\vec u_o$, compute

\begin{align} JF(u_k) \delta^k=-F(u_k) \quad \star \\ u_{k+1}=u_k+ \delta^k \end{align}

until $||\delta^k ||_{\infty} \leq Tol$ where $Tol$ is a tolerance defined

Note that $\star$ is a linear system in $\delta^k$ ($k$ is just an index to underline the fact you're updating the scheme)

Once you have solved the equation, you'll have your solution.