CFDPython icon indicating copy to clipboard operation
CFDPython copied to clipboard

Equation Wrong in 18_Burgers_equation.ipynb?

Open claybudin opened this issue 9 years ago • 4 comments

Shouldn't the line:

utoE = lambda u: (u/2)**2

be

utoE = lambda u: (u**2)/2

?

claybudin avatar Jul 27 '16 20:07 claybudin

Also, shouldn't

utoA = lambda u: u**2

be

utoA = lambda u: u

?

Edit: I see now that utoA is actually computing A*u for use on the RHS of the equation for d It should probably be called utoAU or something...

claybudin avatar Jul 27 '16 20:07 claybudin

Also, I don't understand why the last 2 terms of the RHS of the discretized Burgers' eqn don't always cancel. Don't we have:

RHS = u(n,i) - dt/(2dx)(E(n,i+1) - E(n,i-1)) + dt/(4dx)(A(n,i+1)*u(n,i+1) - A(n,i-1)*u(n,i-1))

For Invscid Burgers: E(n,i) = 1/2*u(n,i)^2 A(n,i) = u(n,i)

so both terms reduce to

dt/(4*dx) * (u(n,i+1)^2 - u(n,i-1)^2)

one positive and the other negative.

???

Edit: This appears to be confirmed in Video Lecture #21 from the YouTube channel, although it isn't really discussed in much detail.

claybudin avatar Jul 27 '16 21:07 claybudin

Hey @claybudin, thanks for reporting these!

Mea culpa, I wrote this notebook a few years ago and we never really put it through any editorial/math checks since we got distracted with other projects. I think you're probably one of the first people to take a serious look at it. Off the top of my head, I can't see anything that you're missing in re: the math mistakes.

At the moment, my inclination is to shunt it off to a separate branch so no one else stumbles into it before I've had a chance to go through it and correct the errors.

Also, the Numba notebooks are also 3+ years out of date -- the changes 11 months ago were purely Python 3 syntax fixes, but no content was updated.

Apologies for the trouble and thanks for bringing it to my attention! I'll be sure to ping you when we get around to fixing this up.

gforsyth avatar Jul 27 '16 21:07 gforsyth

Yet another question:

Under the discussion in "Modified Thomas Algorithm Matrix", is what is being done with the modification equivalent to solving the first matrix equation shown under that heading? Why not just solve that equation directly for the full range of values (0 through n+1), with a(0) = c(0) = a(n+1) = c(n+1) = 0, all the b's 1 as before and d(0) = B(0) and d(n+1) = B(n+1) (ie the Boundary Conditions)?

Wouldn't that also ensure that the BCs are enforced (u(0) = B(0) and u(n+1) = B(n+1)) and all the internal values have access to the BCs. What is the advantage to doing the modification to d(0)?

Thanks, in advance...

claybudin avatar Jul 27 '16 21:07 claybudin