Nonlinear parabolic equations: finite difference method

Click For Summary

Discussion Overview

The discussion revolves around the numerical solution of a nonlinear reaction-diffusion equation using the finite difference method, specifically focusing on the Fisher-Kolmogorov equation. Participants explore the implementation of boundary conditions, the application of the backward Euler method, and the challenges faced in achieving convergence with Newton's method.

Discussion Character

  • Technical explanation
  • Debate/contested
  • Mathematical reasoning

Main Points Raised

  • One participant describes the reaction-diffusion equation and the use of Neumann boundary conditions, expressing confusion about incorporating these conditions into the nonlinear system derived from the backward Euler method.
  • Another participant suggests using central difference to discretize the boundary conditions and provides a method for handling imaginary nodes to ensure accuracy.
  • A participant outlines their discretization matrix and the formulation of the nonlinear backward Euler method, indicating the need to solve a system of equations at each time step.
  • Concerns are raised about the convergence of Newton's method, with suggestions to modify the initial conditions to better satisfy the boundary conditions.
  • One participant proposes evaluating nonlinear terms at the current time step and using those values as initial guesses for the solution of the original equations.
  • Another participant mentions that the initial condition was modified to satisfy the boundary conditions but the issue persisted, particularly at the boundary x_0 = 0.
  • The original poster later identifies a bug related to variable initialization that was causing the numerical errors, expressing surprise at how such a small mistake could lead to significant issues.

Areas of Agreement / Disagreement

Participants express various approaches to handling boundary conditions and the nonlinear aspects of the problem, with no clear consensus on the best method. The discussion includes both agreement on certain techniques and differing opinions on the effectiveness of those techniques.

Contextual Notes

Participants discuss the limitations of their numerical methods, including potential issues with convergence and the accuracy of initial conditions, but do not resolve these limitations.

Who May Find This Useful

This discussion may be useful for individuals interested in numerical methods for solving nonlinear partial differential equations, particularly those working with reaction-diffusion equations and finite difference methods.

mercurial
Messages
14
Reaction score
0
To the moderator: please move this to the section on differential equations if you think it would be better there.

I'm looking at a reaction-diffusion equation of the form

[tex]\frac{\partial u}{\partial t} = \frac{\partial^2 u}{\partial x^2} + f(u),[/tex]

where, e.g., [tex]f(u) = u(1-u)[/tex] for the Fisher-Kolmogorov eqation, and I'm assuming the spatial domain is the unit interval with Neumann boundary conditions:

[tex]\frac{\partial u}{\partial x}(0, t) = 0, \; \frac{\partial u}{\partial x}(1, t) = 0, \; t\geq 0.[/tex]

To keep things totally simple, I'm using the backward Euler method. When the original equation is just the heat equation, i.e., [tex]f = 0[/tex], this method just involves solving a simple matrix equation,

[tex]BU^{n+1} = U^n,[/tex]

for evolving the solution from time step n to n+1. The matrix of course depends on the boundary conditions. The nonlinear version of Euler's method involves a nonlinear multi-variable equation:

[tex]BU^{n+1} + F(U^{n+1}) = U^n,[/tex]

which can be solved for each time step using Newton's method.

Where I'm getting confused is: exactly how do I incorporate the boundary conditions when deriving the system of nonlinear equations? My reasoning tells me that they should be the same as for the linear equation, i.e., the matrices B are the same for both the linear and nonlinear systems.

My solver works perfectly for the heat equation with Neumann conditions, but gives only garbage for the Fisher-Kolmogorov equation after the first time step (if it converges at all). I'm convinced that the problem is not a bug in programming Newton's method. Anyway I'm using a library for that, and I've checked the functions I've supplied a thousand times already. Anyone here have experience with nonlinear parabolic equations? They're not the kind of thing that's typically covered in basic numerical analysis texts.
 
Physics news on Phys.org
Can you show your equations you used for the boundary nodes?Also for inner nodes?i can check them for you.
How i do it is, use central diff to discretize bc's. You solve for the imaginary nodes (for 0, its one right outside say 0-, for 1 its 1+). Then you write the discrete form of the PDE then plug in the values for 1+ in terms of 1- and 0- in terms of 0+ (they are equal for your bcs). I used central diff because its 2nd order accurate in x, like the discrete form for the second derivative.I don't know if f(u) creates some weirdness but i don't think so, its a pretty well behaved function.
Also i use the link below, they have analytical solutions for many types of pde's. You can use that to verify your calculations.

http://eqworld.ipmnet.ru/index.htm
 
I'm using FD equations at the boundary nodes exactly like you describe: "central difference" because it's 2nd order accurate. The discretization matrix looks like:

[tex]A =<br /> \begin{pmatrix}<br /> -2 & 2 & 0 & \ldots \\<br /> 1 & -2 & 1 & 0 & \ldots \\<br /> 0 & 1 & -2 & 1 &\ldots<br /> \end{pmatrix},[/tex]

and I assume you know the rest. Writing [tex]U^n = (U_0^n,\ldots,U_m^n)^T[/tex] for the approximation at the n-time step, the backward Euler method for the heat equation is:

[tex]\frac{U^{n+1} - U^n}{k} = h^{-2}AU^{n+1},[/tex]

which becomes

[tex](I - (k/h^2)A)U^{n+1} = U^n.[/tex]

The matrix [tex]I - (k/h^2)A[/tex] is what I'm calling [tex]B[/tex]. According to my reasoning, the nonlinear equation involves a function [tex]F:\mathbf{R}^{m+1}\to \mathbf{R}^{m+1}[/tex] yielding a nonlinear backward Euler method:

[tex]\frac{U^{n+1} - U^n}{k} = h^{-2}AU^{n+1} + F(U^{n+1}).[/tex]

In the case of the Fisher-Kolmogorov eqn., [tex]F_i(U) = U_i(1-U_i)[/tex] in each coordinate. Again, I haven't found this in any books, but it's the most obvious thing to do. The system of equations I have to solve in each time step is:

[tex]BU^{n+1} -kF(U^{n+1}) - U^n = 0;[/tex]

sorry for changing my notation from my first post a little. I have to supply the left hand side together with its Jacobian to the nonlinear solver. Here the "current" time step [tex]U^n[/tex] is treated as a constant. The Jacobian of the LHS is [tex]B - kF'[/tex], where the Jacobian [tex]F'[/tex] is the obvious diagonal matrix.

So far so good?

For Newton's method I'm using the multi-root solver in the GNU Scientific Library http://www.gnu.org/software/gsl/. For my initial condition I'm using a Gaussian,

[tex]u_0(r) = \exp(-(r-0.5)^2/\sigma^2),[/tex]

with [tex]\sigma[/tex] chosen so that the function is basically flat at the endpoints [tex]x_0 = 0[/tex] and [tex]x_m = 1.[/tex] The solution I'm getting for the first time step clearly violates the boundary conditions, and taking this [tex]U^1[/tex] as a starting point, the solver doesn't even converge for the second time step.

The logical explanation is that I've done something wrong with the nonlinear solver, and I'll be embarrassed for wasting everyone's time if that turns out to be the case. But I've reexamined that code so often by now, I'm starting to entertain the idea that I've missed something subtle with the boundary conditions for the FD equations.

Thanks for your help in this matter!

Jerry
 
It seems fine to me. one issue with Newton's method is you should be close enough to the root, otherwise it might not converge. maybe you might change the IC, if its ok, to something that satisfies the BC's also. then the guess values(the prev values) might be closer to the solution.
 
Ah one more thing.first, you can evaluate the nonlinear terms in the current time step, solve the system with regular gauss elimination. Then use those values as the initial guess for the solution of the original equations where the nonlinear terms are evald in the forward time.
 
Hi Emreth,

I said in my last post that the initial condition u_0 is "basically flat at the endpoints." Thinking that that may be the problem, I modified it to satisfy the Neumann BC's exactly: to no avail. The same problem persists.

My starting guess for finding [tex]U^{n+1}[/tex] with Newton's method is (the logical choice) [tex]U^n[/tex] itself. The time step [tex]k[/tex] I'm using is so small that the evolution should be tame. I know how solutions of the Fisher-Kolmogorov equation behave, and behavior of my numerical solution on the interior of the domain agrees with that. The problem is just at the boundary, most notably at [tex]x_0 = 0.[/tex]

Thanks too for the tip on solving the linear part of the system forward in time to get a better initial guess for the nonlinear equations. I'll take a look at that later and get back to you.

Jerry
 
problem evidently resolved

It looks like I've found the problem, indeed a bug: a typo among variable names in initializing the system. Ludicrous how something like that can "emulate" a numerical error, especially ludicrous when considering how much time I spent looking for it! Thanks anyway to everyone who at least skimmed through the thread or thought about the problem.

Jerry
 

Similar threads

  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 4 ·
Replies
4
Views
4K
Replies
3
Views
2K
  • · Replies 0 ·
Replies
0
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 1 ·
Replies
1
Views
1K
  • · Replies 7 ·
Replies
7
Views
2K