numerical-mooc / assignment-bank

Contribute alternative assignments for Numerical Methods with Python
MIT License
14 stars 75 forks source link

Chase Johnson Project Submission #12

Closed LTChaseJohnson closed 9 years ago

LTChaseJohnson commented 9 years ago

Here is my final project submission. I labeled it as a new module 7, my reason for doing so is because a new module could be built around hyperbolic PDEs just like we have done with elliptic and parabolic. So far this module would contain a lesson on explicit 1-D with a second notebook with an assessment problem. The next steps for this module could be 2-D notebooks. I am working on another notebook right now that I would like to contribute to this module. I'm actually very excited about it, I just won't finish the third one in time. It is an implicit method for the 1-D wave equation. I've also worked very hard to properly cite any references that I used. If you have any suggestions or see any mistakes, I would gladly make changes.

gforsyth commented 9 years ago

Hi @LTChaseJohnson

I took a quick look and this looks good, I have two things to fix, both very minor.

  1. Creative Commons covers writing+ideas but not code. You should add a separate license statement for the code you've written. We use MIT as it's the most permissive.
  2. You are using single $ to wrap your equations, which is why they appear so small. For equations that aren't inline, use a double $ on both ends and it will make the equations more readable.
LTChaseJohnson commented 9 years ago

Thanks Gil! I'll make those corrections now. I am also going to stop by and see if you could help me on a third notebook I would like to contribute to this module using an implicit method. There are some problems because the RHS matrix has n and n-1 values in it. Once I get that resolved I will push that third notebook. I think it will be after the semester ends, though.

LTChaseJohnson commented 9 years ago

Finished your recommended edits.

labarba commented 9 years ago

Thanks for your enthusiastic contribution to numericalmooc!!

This is excellent work. Just let me throw a couple of style pet-peeves of mine: these days, a lot of people are starting sentences with "so" when there is no reason to. Your first paragraph on Explicit FD starts like that. Don't do it! (it's just ugly). Second, compound adjectives are hyphenated, thus: "second-order terms," or even "first- and second-order terms."

With that out of the way, let me say that your work shows that you have really understood the core of this course—like the fundamental concern about choosing the numerical scheme that is appropriate for the physics of the problem.

Now, you say in the introductory paragraph that a second lesson for this new module would use implicit methods, because they are unconditionally stable. This gets you into a very interesting question: when do we get value from implicit methods? They do remove the stability constraint on the time step, but remember that the time step still has to be small enough to capture the physics. When you have something like a wave equation, you may find that the physics requires a small time step anyway, so the extra effort to code an implicit method may not be worth it!

Another way to continue this module might be to move from the wave equation to the Schroedinger equation. (And I know you would love this.) BUT—and here it gets really interesting—the only way to solve the Schroedinger equation (as far as I know!) is Crank-Nicolson!!!

Other comments:

I'm happy to merge this PR now, and if you want to make improvements you can open a new PR.

LTChaseJohnson commented 9 years ago

Dr. Barba and Gil,

Thanks for a great class! I'll make the recommended changes when I get back in town tomorrow and make another pull request. I'm also about halfway done with a 2d explicit notebook that I hope will be done over the break. I'm really excited about continuing this class even after final grades are posted. On Dec 21, 2014 9:02 AM, "Lorena A. Barba" notifications@github.com wrote:

Thanks for your enthusiastic contribution to numericalmooc!!

This is excellent work. Just let me throw a couple of style pet-peeves of mine: these days, a lot of people are starting sentences with "so" when there is no reason to. Your first paragraph on Explicit FD starts like that. Don't do it! (it's just ugly). Second, compound adjectives are hyphenated, thus: "second-order terms," or even "first- and second-order terms."

With that out of the way, let me say that your work shows that you have really understood the core of this course—like the fundamental concern about choosing the numerical scheme that is appropriate for the physics of the problem.

Now, you say in the introductory paragraph that a second lesson for this new module would use implicit methods, because they are unconditionally stable. This gets you into a very interesting question: when do we get value from implicit methods? They do remove the stability constraint on the time step, but remember that the time step still has to be small enough to capture the physics. When you have something like a wave equation, you may find that the physics requires a small time step anyway, so the extra effort to code an implicit method may not be worth it!

Another way to continue this module might be to move from the wave equation to the Schroedinger equation. (And I know you would love this.) BUT—and here it gets really interesting—the only way to solve the Schroedinger equation (as far as I know!) is Crank-Nicolson!!!

Other comments:

  • On your title, I think you mean "2-D Hyperbolic PDEs"? (Note that Module 3 deals with 1D hyperbolic PDEs: the convection equation and traffic

    equation.)

    Did you notice that our approximation for the initial condition is only first order accurate and our governing equation has second order accuracy? —you mean the overall discretized equation has second-order accuracy (note hyphens, too), not the governing

    equation, which is the PDE.

    O(2) approximation —I think you mean O(\Delta t^2).

    In LaTeX mode, use a backslash on mathematical functions, like \cos

    and \exp, to get roman type for the function.

    I see you've let the masses on the Internet convince you of abbreviating NumPy with np. Oh well. We like to keep it as numpy because it is more readable and you only need to type 3 more chars each

    time!

    A semi-colon at the end of your final plot statement will suppress the

    ugly Matplotlib output, like <matplotlib.legend.Legend at 0x829ea58>

    It's not Its http://www.its-not-its.info

I'm happy to merge this PR now, and if you want to make improvements you can open a new PR.

— Reply to this email directly or view it on GitHub https://github.com/numerical-mooc/assignment-bank/pull/12#issuecomment-67771361 .