Writing physics simulations

After returning from a very intense 2 hour session with Dr. Moretti this afternoon (which was well worth the mental effort involved) I decided to try my hand at writing a little simulation of the effect of the Coriolis force on the trajectory of a cannon shell (with the Earth’s angular velocity increased to make it visible). Why did I pick this? Well, we have a nice 3D diagram in the notes which took my fancy, and I could see a “blow up the exam papers” game evolving.

Not being the kind of person to have small ideas, I decided immediately on a 3-d visual demonstration - and it would be nice to make it into a game as well, so that people were bothered to learn using it (don’t ask me who, but in everything I have grand ideas!).

A quick look around suggested using Python and “VPython”:http://www.vpython.org/ would be the simplest way to get started. An hour was long enough for me to get familiar with the examples and a little bit of the documentation and to have started writing the code. I got to the stage of a normal trajectory, and then stopped writing. I’d had visions of using images for the objects, and what did I have? A green square for the ground; two spheres and a broken trail behind the projectile. Good enough to give an idea, but not exactly realistic. Or inspiring.

So I did more surfing. Which didn’t really turn up anything useful. One of our lecturers last year (now sadly “moved on”:http://www.phys.warwick.ac.uk/current/directory/staff/marsh.php) wrote quite a few 2D simulations in Java or C++ (we saw some very nice gas simulations for thermodynamics). So this might be more profitable (C++ anyway, never used Java)

Is this the best I’m going to be able to do? Somehow I think so, which is a little disappointing. I think Flash might provide another method to make it look more pretty, but it would be a lot harder to write (due to a lack of libraries and lack of knowledge of Flash). I’ll persevere with the python solution

0 comments ↓

There are no comments yet...Kick things off by filling out the form below.

Leave a Comment