Numerically solving a transport equation

Click For Summary

Discussion Overview

The discussion revolves around numerically solving a transport equation using finite difference methods. Participants explore different approximations for spatial and time derivatives, boundary conditions, and stability issues related to the numerical model.

Discussion Character

  • Technical explanation
  • Debate/contested
  • Mathematical reasoning

Main Points Raised

  • One participant presents a downwind approximation for the spatial derivative and describes the numerical model, noting instability without identifying the cause.
  • Another participant inquires about the Courant Number, suggesting it should be less than one for stability in explicit schemes, and emphasizes the importance of using an upwind approximation.
  • A participant mentions their Courant number is 0.1 and questions whether a different approximation for the spatial derivative should be used.
  • A side remark is made regarding the use of indexing conventions for spatial and temporal dimensions, suggesting consistency for clarity.
  • Another participant points out a potential sign error in the original downwind approximation and suggests that the correct second-order scheme should be different, also recommending reverting to a first-order scheme if issues persist.

Areas of Agreement / Disagreement

Participants express differing views on the appropriateness of the downwind versus upwind approximation, and there is no consensus on the stability of the proposed numerical model or the correct form of the spatial derivative approximation.

Contextual Notes

Participants highlight the importance of the Courant Number and its implications for stability, but the discussion does not resolve the underlying issues of instability or the correct formulation of the numerical scheme.

hunt_mat
Homework Helper
Messages
1,816
Reaction score
33
TL;DR
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:
\frac{\partial v}{\partial x}\approx -\frac{3}{2h}v_{j}+\frac{2}{h}v_{j-1}-\frac{1}{2h}v_{j-2}
I'm using the usual approximation for the time derivative, I get the following for a stencil:
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}
where \alpha=\delta t/\delta x. To deal with the endpoints I evaluate the governing equation at the boundary points to get
\frac{\partial v}{\partial t}\Bigg|_{x=0,1}=0, and so this simply makes:
v_{i+1,1}=v(i,1),\quad v_{i+1,N}=v_{i,N}
To deal with the point at j=2, I write the BC at x=0 as
\frac{v_{i,1}-v_{i,0}}{\delta x}=0
This means that v_{i,0}=v_{i,1}. This can be used in the stencil at j=2 to yield
v_{i+1,2}=\left(1+\frac{3\alpha}{2}\right)v_{i,2}-\frac{3\alpha}{2}v_{i,1}
This completes the numerical model. It looks okay to me but it's unstable, and I don't see how. Can anyone suggest anything?
 
Physics news on Phys.org
What is the Courant Number you use? (##C = \frac{u\Delta t}{\Delta x}##) Since this is an explicit scheme, it should be lower than one. Also, you want to be 'upwinding' not 'downwinding', i.e. the point you calculate should be dependent on the points upwind from it, since that is what will be influencing that point.
 
My Courant number is 0.1. I should use:
\frac{\partial v}{\partial x}\Bigg|_{x=x_{j}}\approx-\frac{3}{2\delta x}v_{j}+\frac{2}{\delta x}v_{j+1}-\frac{1}{2\delta x}v_{j+1}
for my approximation?
 
Just as a side remark:
normally the counter ##i## would be used for x-direction, ##j## for the y-direction, ##k## for the z-direction and ##n## for time. Same for the ##\delta## sign. If you mean a small finite distance then use ##\Delta## instead.
It would be very convenient if you use the same counters since that makes everything you write down much more readable. I will definitely use it this way since otherwise I confuse myself.

I based my remark on your own remark in that you use the 'downwind' approximation. But it really depends on the sign of ##a## in ##\frac{\partial v}{\partial t} + a \frac{\partial v}{\partial x} = 0##. In your case ##a=1## and thus the upwind side is at the 'left' side of the query point (i.e. where x is lower). So if indeed ##x_{i-1} < x_{i}## then you are already using upwind, although you called it downwind.

Actually, it seems that you have a sign error in the equation below:
hunt_mat said:
I'm using a ``downwind'' approximation for the spatial derivative:
\frac{\partial v}{\partial x}\approx -\frac{3}{2h}v_{j}+\frac{2}{h}v_{j-1}-\frac{1}{2h}v_{j-2}

Since for a second order scheme it would look like this (which is the negative of what you got):
<br /> \frac{\partial v}{\partial x}\Bigg|_{x=x_{i}}\approx \frac{3v_{i} -4v_{i-1} +v_{i-2}}{2\Delta x}<br />Lastly, you now use a second order spatial derivative. If all fails, go back to a first order scheme since that is usually more robust.
 

Similar threads

  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 10 ·
Replies
10
Views
1K
  • · Replies 15 ·
Replies
15
Views
2K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 5 ·
Replies
5
Views
4K
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
995
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 1 ·
Replies
1
Views
1K
Replies
49
Views
3K