Heat equation order of accuracy (Crank-Nicolson)

In summary, the Crank-Nicolson method uses a second order accurate temporal discretization and a second order accurate spatial discretization to approximate the heat equation. This method is unconditionally stable, meaning that there are no restrictions on the size of the time step. The choice of temporal discretization can affect the overall accuracy and stability of the system, and higher order methods may have trade-offs such as more restrictive stability limits and harder to solve algebraic systems.
  • #1
pomekrank
13
0
Hi,

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

In order to have a second accuracy system, one can use the Crank-Nicolson method as [itex]\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)[/itex]

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

Does it make the entire system an accuracy [itex]O\left( \Delta t,\Delta {{x}} \right)[/itex] ? If so, why don't use a much simpler method like center difference [itex]\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)[/itex] 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
  • #2
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.
 
  • #3
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: [itex] \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) [/itex]

This step is determines that the accuracy in [itex] \Delta t [/itex] 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 [itex] \Delta x [/itex]. Crank-Nicolson uses center difference, which is second order accurate, to approximate the spatial derivative: [itex]\frac{\partial^2 T}{\partial x^2}\approx \frac{T_{i+1}-2T_i+T_{i-1}}{2\left(\Delta x\right)^2}[/itex].

Note that time doesn't even enter this approximation.

As a general rule, changing the temporal discretization alters the accuracy in [itex] \Delta t [/itex], and changing the spatial discretization alters the accuracy in [itex] \Delta x [/itex].
 
  • #4
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 dependant 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
 
  • #5
...
 
  • #6
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 dependant 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.
 
  • #7
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.
 
  • #8
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) [itex]\frac{\partial T}{\partial t}\approx \frac{T_{i}^{k+1}-T_{i}^{k}}{\Delta t}+O\left( \Delta t \right)[/itex]
or
(2) [itex]\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)[/itex]

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

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.
 
  • #9
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
[itex]
\frac{\partial T}{\partial t}=\alpha \frac{{{\partial }^{2}}T}{\partial {{x}^{2}}}+\beta \frac{\partial T}{\partial x}
[/itex]
 
  • #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
[itex]
\frac{\partial T}{\partial t}=\alpha \frac{{{\partial }^{2}}T}{\partial {{x}^{2}}}+\beta \frac{\partial T}{\partial x}
[/itex]

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:

1. What is the Heat Equation Order of Accuracy?

The Heat Equation Order of Accuracy refers to the measure of how closely a numerical solution to the heat equation approximates the exact solution. It is a way to evaluate the accuracy and reliability of numerical methods used to solve the heat equation.

2. How is the Heat Equation Order of Accuracy calculated?

The Heat Equation Order of Accuracy is typically calculated by measuring the difference between the numerical solution and the exact solution at different points in time and space. This difference is then compared to the size of the time and space steps used in the numerical method.

3. What is the significance of the Crank-Nicolson method in the Heat Equation Order of Accuracy?

The Crank-Nicolson method is a commonly used numerical method for solving the heat equation. It has a second-order accuracy, meaning that the error between the numerical solution and the exact solution decreases at a rate of O(h^2), where h is the size of the time and space steps. This makes it a very accurate and reliable method for solving the heat equation.

4. How does the Heat Equation Order of Accuracy impact the reliability of numerical solutions?

The Heat Equation Order of Accuracy is an important measure of the reliability of numerical solutions to the heat equation. A higher order of accuracy indicates a closer approximation to the exact solution, making the numerical solution more reliable. However, the order of accuracy alone does not guarantee the accuracy of a numerical solution, as it also depends on the stability and convergence of the numerical method.

5. Are there any limitations to the Heat Equation Order of Accuracy?

While the Heat Equation Order of Accuracy is a useful measure of the accuracy of numerical solutions to the heat equation, it does have its limitations. It is based on the assumption of smooth and continuous solutions, which may not always hold true in real-world scenarios. Additionally, it does not take into account other factors that may affect the accuracy of a numerical solution, such as round-off errors or errors in the initial or boundary conditions.

Similar threads

  • Differential Equations
Replies
3
Views
411
Replies
4
Views
1K
  • Differential Equations
Replies
3
Views
2K
  • Differential Equations
Replies
1
Views
775
  • Differential Equations
Replies
3
Views
1K
  • Differential Equations
Replies
4
Views
645
  • Differential Equations
Replies
1
Views
2K
  • Differential Equations
Replies
3
Views
1K
Replies
5
Views
1K
  • Differential Equations
Replies
7
Views
2K
Back
Top