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 *)
qs[x_,t_]=Normal[Series[q[(x-x0)k+x0,(t-t0)k+t0],{k,0,3}]]/.k->1

(* 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 *)
Collect[Simplify[upwind/\[CapitalDelta]t],{\[CapitalDelta]x,\[CapitalDelta]t}]//pdConv

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:

References

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