numerical-mooc / assignment-bank

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

Adding Project by Akash Dhruv #9

Closed akashdhruv closed 9 years ago

labarba commented 9 years ago

As expected, Akash, a top-notch contribution to the numerical-methods-with-Python ecosystem.

Your code works nicely, and as you know, getting the right answer always comes before getting the right answer fast. But a few optimizations come to mind when reviewing your code. When you form your grid, for example, you have double loops—can you think of any method to replace those index manipulations and double loops?

Very nice illustration of the staggered grid! (newgrid.png)

You are using a triple loop for the pressure Poisson solver—again, this will work, but will be slow. Can you think of ways of replacing the triple loop.

Basically, whenever you are using index manipulations in Python, you should ask yourself if you can do it another way. Index manipulations are very slow in Python.

RK methods are called "multi-step methods" and this is different from fractional step. What you are doing, with a predictor step and a projection via the pressure Poisson equation is, in fact, a fractional step method.

Typos

Style

Other

I'm happy to merge this PR as is, and leave it up to you if you want to later on correct typos. You can then issue a new PR.

Great work in this course!

akashdhruv commented 9 years ago

Professor,

Thank you for the review. I was waiting for it since a long time. I will surely correct the typos and will try to incorporate all of your suggestions.

Happy Holidays

Regards, Akash

labarba commented 9 years ago

Sorry for the wait, Akash! The development to add a badging solution within Open edX was a lot more effort than I could've imagined. That was a big time sink for me and I got behind in lots of things. But you submitted really early, too!

akashdhruv commented 9 years ago

I understand professor. No problem.