Order of Accuracy for Finite Difference Method Backward Euler

  • Context: MHB 
  • Thread starter Thread starter evinda
  • Start date Start date
  • Tags Tags
    Accuracy
Click For Summary
SUMMARY

The discussion focuses on calculating the order of accuracy for the finite difference method using the Backward Euler technique to solve the heat equation. The error is defined as $$E^n=\max_{1 \leq i \leq N_x+1}|u^n_i-u(t_n, x_i)|$$, where varying the number of spatial subintervals \(N_x\) is essential for determining the order of accuracy. The user implemented a function named finite_difference_backward_euler with specific parameters, including 20 subintervals for the spatial domain and 400 for the time domain, yielding an order of accuracy result of approximately 0.1008, which should converge to 2. The user seeks clarification on potential coding errors affecting this outcome.

PREREQUISITES
  • Understanding of the heat equation and boundary value problems
  • Familiarity with finite difference methods, specifically Backward Euler
  • Knowledge of error analysis in numerical methods
  • Proficiency in MATLAB or similar programming languages for implementing numerical algorithms
NEXT STEPS
  • Review the implementation of the finite_difference_backward_euler function for potential coding errors
  • Investigate the impact of varying \(N_x\) on the order of accuracy
  • Learn about convergence analysis in numerical methods
  • Explore alternative numerical methods for solving the heat equation, such as Crank-Nicolson
USEFUL FOR

Mathematicians, numerical analysts, and software developers involved in computational mathematics, particularly those working on numerical solutions for partial differential equations.

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)
 
Physics 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)
 

Similar threads

  • · Replies 0 ·
Replies
0
Views
3K
  • · Replies 2 ·
Replies
2
Views
4K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 12 ·
Replies
12
Views
9K
  • · Replies 1 ·
Replies
1
Views
2K
Replies
1
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K