We are interested in solving the advection equation u_t=u_x where 0<=x<1, t>=0 with periodic boundary conditions and u(x,0)=f(x),f(x)=f(x+1) In the grid x_0,x_1,…x_N, t_0,t_1,…t_N. using the forward euler method, or (v(x_j,t_(n+1))−v(x_j,t_n))/(triangle t)=(v(x_(j+1),t_n)−v(x_(j−1),t_n))/(2triangle x) where v is the approximation of u at the grid points.

evitagimm9h

evitagimm9h

Answered question

2022-11-13

We are interested in solving the advection equation u t = u x where 0 x < 1, t 0
with periodic boundary conditions and u ( x , 0 ) = f ( x ) , f ( x ) = f ( x + 1 ) In the grid x 0 , x 1 , x N , t 0 , t 1 , t N .
using the forward euler method, or v ( x j , t n + 1 ) v ( x j , t n ) Δ t = v ( x j + 1 , t n ) v ( x j 1 , t n ) 2 Δ x where v is the approximation of u at the grid points.

What I don't understand:
We are essentially using v ( x j 1 , t n ) , v ( x j , t n ) , v ( x j + 1 , t n ) to calculate v ( x j , t n + 1 ). Initially this is fine because v ( x j , 0 ) is known for all j, but how would we calculate v ( x 0 , t 1 )? we can't, since that would require us to know v ( x 1 , t 0 ) which doesn't exist. And this issue propagates, each new t n we can calculate one less point than t n 1 .
What am I missing?

Answer & Explanation

trivialaxxf

trivialaxxf

Beginner2022-11-14Added 21 answers

Your recurrence relation for the forward time, central space scheme is
u j n + 1 = γ u j 1 n + u j n + γ u j + 1 n
where γ = Δ t / ( 2 Δ x ). Writing the first few terms out (for j = 1 , . . , M 1) yields
u 1 n + 1 = γ u 0 n + u 1 n + γ u 2 n u 2 n + 1 = γ u 1 n + u 2 n + γ u 3 n u M 1 n + 1 = γ u M 2 n + u M 1 n + γ u M n
which we can write as a matrix
(1) ( u 1 n + 1 u 2 n + 1 u 3 n + 1 u M 1 n + 1 ) = ( 1 γ γ 1 γ γ 1 γ γ 1 ) ( u 1 n u 2 n u 3 n u M 1 n ) + ( γ u 0 n 0 0 γ u M n )
To answer your question 'how would we calculate v ( x 0 , t 1 )?', periodic boundary conditions imply u 0 n = u M 1 n and u 1 n = u M n for all n (time). Therefore, we can rewrite the matrix equation (1) as
(2) ( u 1 n + 1 u 2 n + 1 u 3 n + 1 u M 1 n + 1 ) = ( 1 γ γ γ 1 γ γ 1 γ γ γ 1 ) ( u 1 n u 2 n u 3 n u M 1 n )
We also know that the initial condition u ( x , 0 ) = f ( x ) u j 0 = f j where f j = f ( x j ) is f ( x ) evaluated at the spatial grid points x j . So for the first iteration we need to solve
( u 1 1 u 2 1 u 3 1 u M 1 1 ) = ( 1 γ γ γ 1 γ γ 1 γ γ γ 1 ) ( f 1 f 2 f 3 f M 1 )
and thereafter we solve (2).
Laila Murphy

Laila Murphy

Beginner2022-11-15Added 3 answers

When you rewrite your equation
(1) v ( x j , t n + 1 ) v ( x j , t n ) Δ t = v ( x j + 1 , t n ) v ( x j 1 , t n ) 2 Δ x
you get this
(2) v ( x j , t n + 1 ) v ( x j , t n ) = Δ t ( v ( x j + 1 , t n ) v ( x j 1 , t n ) ) 2 Δ x
(3) v ( x j , t n + 1 ) = v ( x j , t n ) + Δ t ( v ( x j + 1 , t n ) v ( x j 1 , t n ) ) 2 Δ x
you said we have the initial condition where t n = 0 . The grid is only between 0 x 1 then you discretize it so x j 1 is the first point in the array. Forward euler is the most basic runge kutte method.

Do you have a similar question?

Recalculate according to your conditions!

Ask your question.
Get an expert answer.

Let our experts help you. Answer in as fast as 15 minutes.

Didn't find what you were looking for?