1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Continuum Mechanics Simulation; need some help with the math

  1. Apr 27, 2013 #1
    Hello all,
    I've been playing with computer simulations quite a bit recently, and wrote one that crudely simulates the formation of star systems. My first version was a conventional many body simulation with about 300 small bodies; it actually tends to come up with convincing star systems, either with one or two stars, and several smaller bodies orbiting. In that sense, it is successful.

    Unfortunately, the computation cost scaling on an N-body simulation is only so-so, requiring n(n-1) calculations. Even with a negligibility condition, it becomes unmanageable very quickly (and I have a really fast computer...). It's just too many operations.

    I've since gone back to the drawing board and decided to try a continuum mechanics approach, where I specify the state of matter at specific fixed intervals, and move mass between them. This way allows considerable optimizations over the N-body simulation, and is more able to be run on my graphics card, which is at least several hundred times more powerful than my CPU for single precision operations (~5TFlops vs ~20GFlops). Cost scaling for this approach appears to be linear for the gravity calculations, plus I can use a look-up table to speed things along.

    While I can currently specify the properties of the gas at any given point, I'm not entirely certain how to move mass between points on the grid. I need something that respects both the bulk velocity of the gas, as well as having it respond to the pressure at adjacent points, and so forth. The most promising suggestion I've heard so far is to model my problem as an electronic one, with a grid of capacitors, and then solve with kirkov's laws. I like that idea, and it would be easy computationally, but I'm not entirely sure how to set up the parallels for current, voltage, etc. Any suggestions would be much appreciated.
  2. jcsd
  3. Apr 27, 2013 #2
    It might help to check out computational fluid dynamics software, which is geared to solving continuum fluid mechanics problems. You may have to modify the set up a little to include mutual gravitation..
  4. Apr 27, 2013 #3
    I would absolutely love to see source code for such an application, but I'd be surprised if I could find one. I can find commercial stuff, but nothing I could get source code to or modify, much less incorporate into my own program or redistribute. If you know of an open source one, I'd certainly check it out.
  5. Apr 27, 2013 #4
    Try googling computational fluid dynamics. I'm sure that there are some cfd products out there where you can include some of your own source code.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook