- #1
- 1,798
- 33
- TL;DR Summary
- I have a simple PDE that I want to solve:
[tex]\frac{\partial v}{\partial t}=-\frac{\partial v}{\partial x}[/tex] along with boundary conditions:
[tex]\frac{\partial v}{\partial x}\Bigg|_{x=0,1}=0[/tex]
I know this has a simple analytical solution, but that's not the point.
I'm using a ``downwind'' approximation for the spatial derivative:
[tex]\frac{\partial v}{\partial x}\approx -\frac{3}{2h}v_{j}+\frac{2}{h}v_{j-1}-\frac{1}{2h}v_{j-2}[/tex]
I'm using the usual approximation for the time derivative, I get the following for a stencil:
[tex]v_{i+1,j}=\left(1+\frac{3\alpha}{2}\right)v_{i,j}-2\alpha v_{i,j-1}+\frac{\alpha}{2}v_{i,j-1}[/tex]
where [itex]\alpha=\delta t/\delta x[/itex]. To deal with the endpoints I evaluate the governing equation at the boundary points to get
[tex]\frac{\partial v}{\partial t}\Bigg|_{x=0,1}=0[/tex], and so this simply makes:
[tex]v_{i+1,1}=v(i,1),\quad v_{i+1,N}=v_{i,N}[/tex]
To deal with the point at [itex]j=2[/itex], I write the BC at [itex]x=0[/itex] as
[tex]\frac{v_{i,1}-v_{i,0}}{\delta x}=0[/tex]
This means that [itex]v_{i,0}=v_{i,1}[/itex]. This can be used in the stencil at [itex]j=2[/itex] to yield
[tex]v_{i+1,2}=\left(1+\frac{3\alpha}{2}\right)v_{i,2}-\frac{3\alpha}{2}v_{i,1}[/tex]
This completes the numerical model. It looks okay to me but it's unstable, and I don't see how. Can anyone suggest anything?
[tex]\frac{\partial v}{\partial x}\approx -\frac{3}{2h}v_{j}+\frac{2}{h}v_{j-1}-\frac{1}{2h}v_{j-2}[/tex]
I'm using the usual approximation for the time derivative, I get the following for a stencil:
[tex]v_{i+1,j}=\left(1+\frac{3\alpha}{2}\right)v_{i,j}-2\alpha v_{i,j-1}+\frac{\alpha}{2}v_{i,j-1}[/tex]
where [itex]\alpha=\delta t/\delta x[/itex]. To deal with the endpoints I evaluate the governing equation at the boundary points to get
[tex]\frac{\partial v}{\partial t}\Bigg|_{x=0,1}=0[/tex], and so this simply makes:
[tex]v_{i+1,1}=v(i,1),\quad v_{i+1,N}=v_{i,N}[/tex]
To deal with the point at [itex]j=2[/itex], I write the BC at [itex]x=0[/itex] as
[tex]\frac{v_{i,1}-v_{i,0}}{\delta x}=0[/tex]
This means that [itex]v_{i,0}=v_{i,1}[/itex]. This can be used in the stencil at [itex]j=2[/itex] to yield
[tex]v_{i+1,2}=\left(1+\frac{3\alpha}{2}\right)v_{i,2}-\frac{3\alpha}{2}v_{i,1}[/tex]
This completes the numerical model. It looks okay to me but it's unstable, and I don't see how. Can anyone suggest anything?