Recent content by megapiano

  1. megapiano

    Need help with N-body simulation

    Yes, it also seems to make the gravitational field work in a finite distance. I still cannot find the paper that implemented this specific algorithm. I also think this method is only appropriate for n-body simulations of specifically galaxies, as it gives rise to spiral-arms and even the bar...
  2. megapiano

    Need help with N-body simulation

    @jedishrfu @pbuk Thanks for the help. Well, I was able to recover the part of the source-code I was looking for. The force calculation is: d = distance between particle1 and particle2 c = some constant forceGravity = (mass1 * mass2) * (1.0 - sin(min((d * d) / c, 1) * (pi / 2))); Is anyone...
  3. megapiano

    Need help with N-body simulation

    Hmm, I hadn't considered that. The softening constant is adjusted depending on the simulation, in attempt to make the error negligible, but I hadn't considered that the errors add up every step. Here is what I have now: // euler netforce = sum(gravity) acceleration = gravity / mass velocity...
  4. megapiano

    Need help with N-body simulation

    Sorry, how do you mean? The acceleration vector is re-calculated every step according to the netforce vector, which is reset and then cumulates gravitational forces at every step. Or do you mean that the acceleration vector doesn't have a deltaTime coefficient? In the actual code, it does, but...
  5. megapiano

    Need help with N-body simulation

    I was just a high school student when I developed this project. The purpose was to create an N-body solver, and then reduce the complexity from O(N^2) to O(nlog(n)) by implementing the Barnes-Hut recursive tree-building optimization algorithm. This was a computer science project that interested...
  6. megapiano

    Need help with N-body simulation

    Can you post a link to that project? I can't find it on the OpenSourcePhysics website. Or maybe just a sceenshot of the simulation?
  7. megapiano

    Need help with N-body simulation

    Many years ago, for my high school senior project, I wrote a solver for the N-body problem that is performance-optimized using the Barnes-Hut algorithm. (the optimization algorithm is not relevant to my question.) In one particular simulation, I simulated a spiral galaxy. The simulation is not...
Back
Top