CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Main CFD Forum (https://www.cfd-online.com/Forums/main/)
-   -   1D wave equation (https://www.cfd-online.com/Forums/main/6753-1d-wave-equation.html)

rvndr October 27, 2003 13:44

1D wave equation
 
Hi

I am trying to solve 1D wave equation using eulers explicit scheme.After Discretization I am getting the following equation.

[Ui^(n+1)]=[v^2*U(i-1)^n]+[2(1-v^2)*Ui^n]+[v^2*U(i+1)^n]-[Ui^(n-1)].

The problem that I am facing is with the last term -Ui^(n-1).Because the values at (n-1) level are not known.We know only boundary conditions at nth level and are trying to find out at n+1 level.Then how to solve this equation.

Where v=c*(delta t/delta x);

Any help in this regard is higly solicilated.Thanks in advance.

regards rvndr


Roman October 28, 2003 02:43

Re: 1D wave equation
 
at first time stpe say n=1 i.e n+1=2,n=1,n-1=0. You should use value of variable at n at n-1 are equal.One you solve everything at that time step the next time n=2 i.e n+1=3,n=2,n-1=1. Now you value of variable in n-1=1 and n=2 so you can proceed. Roman

rvndr October 30, 2003 08:30

Re: 1D wave equation
 
thanks..............i did the same way

Peter November 3, 2003 19:01

Re: 1D wave equation
 
"You should use value of variable at n at n-1 are equal."

If you do that then you've effectively implemented u(x,0)=f(x) and u_t(x,0)=0 where the u_t equation is discretized with a one-sided approximation to the time derivative. Are these the initial conditions the original poster wanted ?

Tom November 5, 2003 04:13

Re: 1D wave equation
 
The easiest way to initialise the problem

u_tt = c^2.u_xx with u=f(x), u_t = g(x) at t=0

is to use Taylor series

u = u(x,0) + dt.u_t(x,0) + (1/2)dt^2.u_tt + O(dt^3)

~ f(x) + dt.g(x) + (1/2)dt^3.c^2.f''(x) + O(dt^3)

you can use this formula to obtain u at time level n=1,

Tom.


vasanth December 5, 2003 20:28

Re: 1D wave equation
 
Use forward difference if U_t is not specified at the boundary


All times are GMT -4. The time now is 22:29.