Heat equation order of accuracy (Crank-Nicolson)

Click For Summary

Discussion Overview

The discussion revolves around the order of accuracy of the Crank-Nicolson method applied to the heat equation, specifically examining its temporal and spatial discretizations. Participants explore the implications of using different finite difference methods and their effects on stability and convergence.

Discussion Character

  • Technical explanation
  • Debate/contested
  • Mathematical reasoning

Main Points Raised

  • Some participants discuss the Crank-Nicolson method's second-order accuracy in both time and space, noting that it averages the right side of the equation over two time steps.
  • Others argue that the accuracy of the temporal discretization is distinct from that of the spatial discretization, with the latter being determined by how the spatial derivatives are approximated.
  • A participant questions the necessity of using the Crank-Nicolson method over simpler centered difference methods, given that both can achieve second-order accuracy.
  • Concerns are raised about the stability of different methods, with some noting that Crank-Nicolson is unconditionally stable for the diffusion equation, while others suggest that alternative temporal discretizations might affect stability.
  • There is a discussion about the potential benefits and drawbacks of increasing the order of accuracy in relation to time and space step sizes, with some participants expressing uncertainty about the implications for stability and convergence speed.
  • One participant introduces a comparison between different temporal discretizations and questions whether a higher-order method would improve accuracy and stability.
  • Some participants highlight that the Crank-Nicolson method's effectiveness may extend beyond the heat equation to similar equations involving diffusion and advection terms.

Areas of Agreement / Disagreement

Participants express differing views on the necessity and advantages of the Crank-Nicolson method compared to simpler methods. While some agree on its stability and accuracy, others question its superiority and explore alternative approaches, indicating that the discussion remains unresolved.

Contextual Notes

Participants note that the accuracy and stability of the Crank-Nicolson method depend on the specific choices made in both temporal and spatial discretizations. There are mentions of potential cancellations in the discretization process that may influence the overall accuracy.

Who May Find This Useful

This discussion may be useful for those interested in numerical methods for partial differential equations, particularly in the context of heat transfer and diffusion processes, as well as for researchers exploring stability and accuracy in finite difference methods.

pomekrank
Messages
13
Reaction score
0
Hi,

Let's consider the heat equation as \frac{\partial T}{\partial t}=\alpha \frac{{{\partial }^{2}}T}{\partial {{x}^{2}}}

In order to have a second accuracy system, one can use the Crank-Nicolson method as \frac{{{\partial }^{2}}T}{\partial {{x}^{2}}}\approx \frac{1}{2}\left( \frac{T_{i+1}^{k+1}-2T_{i}^{k+1}+T_{i-1}^{k+1}}{\Delta {{x}^{2}}}+\frac{T_{i+1}^{k}-2T_{i}^{k}+T_{i-1}^{k}}{\Delta {{x}^{2}}} \right)+O\left( \Delta {{t}^{2}}+\Delta {{x}^{2}} \right)

However, when the finite difference method is use with respect to time, usually a forward Euler method like \frac{\partial T}{\partial t}\approx \frac{T_{i}^{k+1}-T_{i}^{k}}{\Delta t}+O\left( \Delta t,\,\,\Delta x \right)

Does it make the entire system an accuracy O\left( \Delta t,\Delta {{x}} \right) ? If so, why don't use a much simpler method like center difference \frac{\partial T}{\partial x}\approx \frac{T_{i+1}^{k}-T_{i-1}^{k}}{2\Delta x}+O\left( \Delta t,\,\Delta {{x}^{2}} \right) instead of Crank-Nicolson ? Furthermore, if one wants to get a full 2nd order system, how could it be possible ? Thank you,
Steven
 
Physics news on Phys.org
I use central difference on ##\partial/\partial{t}## but the stability condition stays the same. If you see the factors for ##T##, for ##\Delta{t}## larger than a limit, equation for ##T_{i+1}## give value raising up only.
 
You are wrongly attributing aspects of the temporal discretization them to the spatial discretization. And I think this is why you're confused.

Crank-Nicolson uses the temporal discretization: \frac{T_i^{n+1}-T_i^n}{\Delta t}=\alpha \frac{1}{2}\left(\frac{\partial^2 T^{n+1}}{\partial x^2}+\frac{\partial^2 T^{n}}{\partial x^2}\right)

This step is determines that the accuracy in \Delta t is second order. There are two things to note. First, we have not yet discretized the spatial derivative. Second, a important part of this temporal discretization is that we average the right side of the equation over the n and the n+1 time step.

The spatial discritization determines the accuracy in \Delta x. Crank-Nicolson uses center difference, which is second order accurate, to approximate the spatial derivative: \frac{\partial^2 T}{\partial x^2}\approx \frac{T_{i+1}-2T_i+T_{i-1}}{2\left(\Delta x\right)^2}.

Note that time doesn't even enter this approximation.

As a general rule, changing the temporal discretization alters the accuracy in \Delta t, and changing the spatial discretization alters the accuracy in \Delta x.
 
Ok if I do understand, Crank-Nicolson's order in space depends on how you approximate the spatial derivative and temporal is by definition an order of 2 because it's averaged. In my case it's true to say that C-N is O(Δt^2, Δx^2), but irrelevant to say that the order in the left side of the equation (dT/dt) is dependent of Δx.

However, there's still some facts that I need to get straight.
1- Why use C-N method over a simple centered spatial discretisation if center difference is also O(Δx^2)
2- Is it a good idea to increase the order of accuracy over decreasing the time/space step size ? In my case I would like to have a quadratic order for time and space. How would it affect stability and convergence speed ?

Thank you,
Steven
 
...
 
pomekrank said:
Ok if I do understand, Crank-Nicolson's order in space depends on how you approximate the spatial derivative and temporal is by definition an order of 2 because it's averaged. In my case it's true to say that C-N is O(Δt^2, Δx^2), but irrelevant to say that the order in the left side of the equation (dT/dt) is dependent of Δx

The temporal advance is 2nd order because that's what the math shows it to be. It's not a definition. There are multiple ways to "average" the RHS, and they will give you different orders of accuracy. Do you know how to calculate the accuracy of an approximation using Taylor series?
pomekrank said:
1- Why use C-N method over a simple centered spatial discretisation if center difference is also O(Δx^2)

I'm not sure I understand your point. C-N uses the standard centered difference to approximate the spatial derivative. One of the main advantages of C-N is that it is unconditionally stable.

pomekrank said:
2- Is it a good idea to increase the order of accuracy over decreasing the time/space step size ? In my case I would like to have a quadratic order for time and space. How would it affect stability and convergence speed ?

Again, I'm don't understand you question. C-N is second order (quadratic) in space and time. It is also unconditionally stable.

Are you asking about methods that are cubic, quartic, or higher order accurate? There are a number of trade-offs to using higher order methods. Higher order methods can have more restrictive stability limits. The algebraic systems that result are harder to solve. Some problems benifit greatly form using higher order methods, while other problems see little benefit.
 
pomekrank said:
1- Why use C-N method over a simple centered spatial discretisation if center difference is also O(Δx^2)

The C-N method is unconditionally stable for the diffusion equation. This means that criterions like ## \Delta t < \Delta x^{2} ## does not have to be obeyed.

the_wolfman said:
I'm not sure I understand your point. C-N uses the standard centered difference to approximate the spatial derivative. One of the main advantages of C-N is that it is unconditionally stable.

Just to make matters more confusing, as far as wiki goes C-N is only the implicit time discretization. The spatial you are free to choose.
 
Ok I get the fact that CN is unconditionally stable, but If i can reword my question to make it as easy as possible, if the left side is

(1) \frac{\partial T}{\partial t}\approx \frac{T_{i}^{k+1}-T_{i}^{k}}{\Delta t}+O\left( \Delta t \right)
or
(2) \frac{\partial T}{\partial t}\approx \frac{3T_{i}^{k}-4T_{i}^{k-1}+T_{i}^{k-2}}{2\Delta t}+O\left( \Delta {{t}^{2}} \right)

Using the same heat equation with CN method for estimating \frac{{{\partial }^{2}}T}{\partial {{x}^{2}}}.

Will (2) improve the accuracy of the system and the stability ?

The thing I didn't undestand in the first place was why to use (1) with CN since they have different order of accuracy. In this case, using (2) with CN should be better because we stay with all equation of order Δt^2.
 
There are 2 parts to the temporal discretization of CN. The first part is the discretization of the time derivative. The second part is the time discretization of the right side of the equation. The accuracy and stability of the CN method depends on the specific choice of both discretization.
There is a cancellation that occurs because CN picks a clever discretization of the right side of the equation. This cancelation allows CN to be 2nd accurate in time. You will never see cancellation if you ignore the temporal discretization of the right side of the equation.

Do you know how to evaluate the accuracy and stability of a finite difference method applied to a particular ODE? I do not know offhand what will happen if you use equation (2) to approximate the time derivate. I suspect that you will not see a significant difference in the accuracy of the two methods. I hesitate to comment on the stability, but there's a chance that the stability is worse using equation (2) than it is using equation (1).
 
  • #10
the_wolfman said:
The accuracy and stability of the CN method depends on the specific choice of both discretization.
There is a cancellation that occurs because CN picks a clever discretization of the right side of the equation.

Does CN is ONLY good with heat equation or it's still reliable for similar equation like
<br /> \frac{\partial T}{\partial t}=\alpha \frac{{{\partial }^{2}}T}{\partial {{x}^{2}}}+\beta \frac{\partial T}{\partial x}<br />
 
  • #11
Strum said:
The C-N method is unconditionally stable for the diffusion equation. This means that criterions like ## \Delta t < \Delta x^{2} ## does not have to be obeyed.
Just to make matters more confusing, as far as wiki goes C-N is only the implicit time discretization. The spatial you are free to choose.
 
  • #12
pomekrank said:
Does CN is ONLY good with heat equation or it's still reliable for similar equation like
<br /> \frac{\partial T}{\partial t}=\alpha \frac{{{\partial }^{2}}T}{\partial {{x}^{2}}}+\beta \frac{\partial T}{\partial x}<br />

Well C-N is just an implicit solution method. I would imagine you could use it on pretty much any equation you like. For linear equations the implementation is fairly simple as well. Here is the wiki page about the solution of that equation
http://en.wikipedia.org/wiki/Numerical_solution_of_the_convection–diffusion_equation

Also for a more general framework you could look up operator splitting methods of which C-N is just a specific case.
 
  • #13
If you want bypass linear systems, you can use shooting methods starting from both bounds and ask same value and same 1st derivative on a meeting point. RK4 and Numerov algorithm works fine. For Scrodinger equation I use Numerov with 1% error area. It is faster and simpler than RK4.
See this result
 
Last edited:

Similar threads

  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 3 ·
Replies
3
Views
4K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 5 ·
Replies
5
Views
4K
  • · Replies 8 ·
Replies
8
Views
5K