Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Equation Wrong in 18_Burgers_equation.ipynb? #25

Open
claybudin opened this issue Jul 27, 2016 · 4 comments
Open

Equation Wrong in 18_Burgers_equation.ipynb? #25

claybudin opened this issue Jul 27, 2016 · 4 comments

Comments

@claybudin
Copy link

Shouldn't the line:

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

be

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

?

@claybudin
Copy link
Author

claybudin commented Jul 27, 2016

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
Copy link
Author

claybudin commented Jul 27, 2016

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.

@gforsyth
Copy link
Member

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.

@claybudin
Copy link
Author

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...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants