I try to apply modified PDE approach to first-order upwind scheme while I am reading the fluid simulation book1 by Robert Bridson today.

The procedure is very similar to which I used in my previous post. However the viscosity term I get is a bit different from the ones in the book.

This is my code:

(* Expand function q as series *)

(* Assign three discrete terms in the differencing scheme *)
Superscript[Subscript[q, i],n+1]=qs[x0+\[CapitalDelta]x,t0+\[CapitalDelta]t]
Superscript[Subscript[q, i],n]=qs[x0+\[CapitalDelta]x,t0]
Superscript[Subscript[q, i-1],n]=qs[x0,t0]

(* Construct the upwind scheme *)
upwind=Superscript[Subscript[q, i],n+1]-Superscript[Subscript[q, i],n]+\[CapitalDelta]t u (Superscript[Subscript[q, i],n]-Superscript[Subscript[q, i-1],n])/\[CapitalDelta]x

(* Simplify and display *)

The result I get is:

The modified PDE(up to a second-order truncation error) I get is

which is different from the one in the book:


  1. Bridson, Robert. Fluid simulation for computer graphics. CRC Press, 2015.