I am trying to write a code to solve a nonlinear BVP using the Finite Difference Method. The BVP is:
$(T^2)\frac{\partial^2 T}{\partial x^2} + T \left( \frac{\partial T}{\partial x}\right)^2 + Q = 0$
The boundary conditions are Dirichlet at $x = 0$ and Robin at $x = L$. The parameter $Q$ is a constant.

My (probably naive) approach is as follows:

  1. Use second-order accurate approximations for the first and second derivatives.
  2. Use the discretized form to generate a system of coupled equations for the spatial points.
  3. Construct a linear system of the form $\mathbf{A}\mathbf{x} = \mathbf{b}$, where $\mathbf{x}$ is a vector of $T$ at each spatial point $x_0, \ldots, x_L$, $\mathbf{A}$ is a matrix of the coefficients of $T$ arising from the discretization, and $\mathbf{b}$ is a solution vector including the source term $Q$.
  4. Solve the linear system for $\mathbf{x}$ somehow, I have not gotten this far.

I really don't know what to do about the nonlinearity. My first problem arises with the squared first derivative. If I apply the finite difference approximation to the first derivative, I get:
$T_i\left(\frac{T_{i+1} - T_{i-1}}{2\Delta x} \right)^2$
Developing the above term yields:
$T_i \left(\frac{T_{i+1}^2-2T_{i+1}T_{i-1}+T_{i-1}^2}{4 \Delta x^2} \right)$

I don't know how to handle this term. I need to linearize something at some point (before or after discretization?) but I am not sure how. And say I figure out a way to handle the squared first derivative, I don't know how to deal with the $T_i$ in front of it.

My question is: how do you discretize and then linearize (or vice-versa) these nonlinear terms?

Thank you for your time. Please let me know if I should elucidate anything.

  • $\begingroup$ Your math expanding the square is a bit wonky :-) $\endgroup$ – Wolfgang Bangerth Dec 11 '14 at 3:01
  • 1
    $\begingroup$ In brief: discretize first. Then you have a nonlinear system of algebraic equations, which you can solve using standard methods. $\endgroup$ – Geoff Oxberry Dec 11 '14 at 5:02
  • $\begingroup$ @WolfgangBangerth thanks for catching that. Not sure what I was doing. $\endgroup$ – coffeecake Dec 12 '14 at 19:05
  • $\begingroup$ @GeoffOxberry thanks for your comment. That puts me on the right track. I am not familiar with the "standard" methods... any suggestions/starting points? Thanks for your help. $\endgroup$ – coffeecake Dec 12 '14 at 19:06
  • $\begingroup$ In order, you probably want to try: Newton's method, quasi-Newton methods, and then things like nonlinear fixed point schemes (e.g., nonlinear CG, nonlinear GMRES). $\endgroup$ – Geoff Oxberry Dec 12 '14 at 20:26

Thanks to the help in the comments I solved the problem. I divided the spatial domain into $N$ grid points and discretized the PDE (without any sort of linearization), which resulted in $N-1$ nonlinear algebraic equations (as Geoff suggested) for the temperature at each grid point.

Then I employed Newton's method (again, as suggested by Geoff):

  1. Implement boundary conditions on the $N-1$ equations
  2. Develop a physically reasonable initial guess $F(x_0)$
  3. Compute the Jacobian of the $N-1$ equations, resulting in an $N-1 \times N-1$ tri-diagonal matrix
  4. Perform Newton iteration to solve for $\Delta T$

The method converged quickly and I am left with the correct temperature distribution.

Thanks for the help with this problem.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.