Crank-Nicolson vs Heun's method

  • Thread starter Smed
  • Start date
  • #1
36
1
Hi, can someone tell me the difference between the Crank-Nicolson and Heun numerical methods? For Heun's method I'm looking here http://en.wikipedia.org/wiki/Heun's_method and for the Crank-Nicolson method I'm looking here http://en.wikipedia.org/wiki/Crank–Nicolson_method . When I actually carry out a calculation with equal timesteps for both methods and f(t,u)=-.5*u, I get the exact same solution.

The equation I have for both is:

u[tex]^{n+1}[/tex] = u[tex]^{n}[/tex] - [tex]\frac{1}{2}[/tex]u[tex]^{n}[/tex]dt - [tex]\frac{1}{8}[/tex]u[tex]^{n}[/tex]dt[tex]^{2}[/tex]
 
Last edited by a moderator:

Answers and Replies

  • #2
335
44
I'm no expert, but from what I can gather Heun's method is for ODE's while Crank-Nicolson is for PDE's?
 
  • #3
Heun's method is an improvement of the forward Euler's method which is an explicit method.
While Crank-Nicolson method is an implicit method. Probably the improvement for the backward Euler method. This is the Crank-Nicolson method for ODE.

But of course the Crank-Nicolson method is verypopular in PDE.
 
  • #4
335
44
Ah, in all cases I've come across Crank-Nicolson, it has been to solve PDEs.

So, if I read my notes correctly, while both methods take an average of the current state and the state at the next timestep, the main difference between Heun's method and Crank-Nicolson is that for Heun's method you use a predictor for the next timestep, keeping it explicit, while for Crank-Nicolson it is used implicitly instead. At least that's my understanding.

Using this I get some different results from yours, both with Crank-Nicolson and Heun's method, are you sure you do Heun's method correctly?
 
  • #5
Redbelly98
Staff Emeritus
Science Advisor
Homework Helper
Insights Author
12,121
160
The equation I have for both is:

u[tex]^{n+1}[/tex] = u[tex]^{n}[/tex] - [tex]\frac{1}{2}[/tex]u[tex]^{n}[/tex]dt - [tex]\frac{1}{8}[/tex]u[tex]^{n}[/tex]dt[tex]^{2}[/tex]
If we make that a +⅛ instead, I agree that Heun's method gives that equation. But I get something different for Crank-Nicolson.

For Crank-Nicolson, ignore the x-dependence of u and we have
(un+1 - un) / Δt = ½ ( -½ un+1 - ½ un)​
Solve that for un+1 and we get something different than the Heun's method equation. (Though they do agree up to order Δt2.)
 

Related Threads on Crank-Nicolson vs Heun's method

  • Last Post
Replies
14
Views
2K
  • Last Post
Replies
3
Views
4K
Replies
0
Views
6K
Replies
1
Views
4K
  • Last Post
Replies
0
Views
2K
  • Last Post
Replies
5
Views
7K
  • Last Post
Replies
2
Views
3K
  • Last Post
Replies
1
Views
669
Replies
12
Views
5K
Top