MHB Order of Accuracy for Finite Difference Method Backward Euler

  • Thread starter Thread starter evinda
  • Start date Start date
  • Tags Tags
    Accuracy
Click For Summary
The discussion focuses on calculating the order of accuracy for the finite difference method using the backward Euler scheme applied to the heat equation. The user has implemented a code to approximate the solution and is seeking clarification on whether varying the number of spatial subintervals (N_x) is necessary to determine the order of accuracy. They report obtaining a value of approximately 0.1008 for the order of accuracy with specific subinterval settings but expect it to approach 2. The user is questioning if there might be an error in their code affecting the accuracy result. The conversation emphasizes the importance of correctly assessing the order of accuracy in numerical methods.
evinda
Gold Member
MHB
Messages
3,741
Reaction score
0
Hello! (Wave)
We are given the boundary / intial value problem for the heat equation:

$\left\{\begin{matrix}
u_t(t,x)=u_{xx}(t,x), \ \ x \in [a,b], \ \ t \geq 0\\
u(0,x)=u_0(x), \ \ \forall x \in [a,b] \\
u(t,a)=u(t,b)=0, \ \ \forall t \geq 0
\end{matrix}\right.$

I have written a code to approximate the solution of the problem.

How do we calculate the order of accuracy of the finite difference method backward euler?

I have found the error $$E^n=\max_{1 \leq i \leq N_x+1}|u^n_i-u(t_n, x_i)|, n=1, \dots, N_t+1$$

Do we have to take different values for $N_x$ to find the order of accuracy? (Thinking)
 
Mathematics news on Phys.org
I have tried the following:function [p1]=order_fin_dif_back_euler [u1, ex1]=finite_difference_backward - Pastebin.com

The first two arguments of the function [m]finite_difference_backward_euler[/m] stands for the interval $[a,b]$, the third is the number of subintervals of this interval, the fourth one is $T_f$ ($t \in [0,T_f]$) , the last argument is the number of subintervals of $[0,T_f]$.

For [m]number of subintervals of [a,b]=20[/m] and [m]number of subintervals of [0,T_f]=400[/m] I got that:
[m]p1 = 0.1008[/m]The order of accuracy should tend to $2$. Is there a mistake at my code? (Thinking)
 
Insights auto threads is broken atm, so I'm manually creating these for new Insight articles. In Dirac’s Principles of Quantum Mechanics published in 1930 he introduced a “convenient notation” he referred to as a “delta function” which he treated as a continuum analog to the discrete Kronecker delta. The Kronecker delta is simply the indexed components of the identity operator in matrix algebra Source: https://www.physicsforums.com/insights/what-exactly-is-diracs-delta-function/ by...

Similar threads

  • · Replies 16 ·
Replies
16
Views
4K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 38 ·
2
Replies
38
Views
11K
  • · Replies 7 ·
Replies
7
Views
2K
Replies
5
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 0 ·
Replies
0
Views
2K
Replies
20
Views
3K
  • · Replies 5 ·
Replies
5
Views
10K
  • · Replies 8 ·
Replies
8
Views
3K