I'm trying to write a program to solve the 1st order 1-D wave equation (transport equation) with given initial condition and periodic boundary conditions on the domain [0, 1]. I need to use 2nd order Adams-Bashforth but I'm not sure how to apply it to this problem. I'm hoping someone can help me understand it better.
The PDE:
$\displaystyle\frac{\delta u}{\delta t} + c\frac{\delta u}{\delta x} = 0$
Initial condition and boundary conditions:
$u(x, 0) = e^{-0.5[(x-0.5)/0.08]^2}$
$u(0, t) = u(1, t)$
In previous work, I've understood how to approximate the derivatives with finite differences obtained from the Taylor series. My understanding of Adams-Bashforth is that it gives an approximation of $y_{i+1}$ using the known values at previous points.
Ex: $\displaystyle y_{i+1} = y_i + \frac{h}{2}[3f(x_i, y_i)-f(x_{i-1}, y_{i-1})]$
So is the derivative then
$\displaystyle\frac{y_{i+1}-y_i}{h} = \frac{1}{2}[3f(x_i, y_i)-f(x_{i-1}, y_{i-1})]$
if so how do I apply it to the above PDE? There is something I'm not understanding. Can someone please explain how to solve this PDE using AB2? Thank you!
Update Re: Monte's comment I wasn't sure which derivative would need to be approximated with Adams-Bashforth. Now after rereading the problem I see it is supposed to use 2nd order central difference in space. So if I discretize the spatial derivative that will turn the PDE into and ODE?
new ODE?:
$\displaystyle\frac{du}{dt} + c\frac{u_{j+1}^n-u_{j-1}^n}{2\Delta x} = 0$
should the spatial finite difference be evaluated at n or n+1? What is $\displaystyle\frac{du}{dt}$ using 2nd order Adams-Bashforth method?
So I was probably over thinking this. What worked is rearranging the equation after it has been discretized in space to obtain:
$$\frac{du}{dt}=c\frac{u_{j+1}-u_{j-1}}{2\Delta x}=f(t, u)=f(u)$$
where
$$f(t^n, u^n) = f(u^n)=c\frac{u_{j+1}^n-u_{j-1}^n}{2\Delta x}$$
Then using the Adams-Bashforth formula to do the time stepping
$$u^{n+1}_j = u^{n}_j + c\Delta T\left(\frac{3}{2}f(u^n)-\frac{1}{2}f(u^{n-1})\right)$$