tohuwabohu
Jedi Master
Well I am still working on the efficient algorithm to allow at least 1 million asteroids to be simulated.
I implemented multiple grids but realized that the solution to the poisson's equation does not approximate the local fields accurately. The grid would have to be extremely fine which is not affordable (would take few seconds to be only initialized and this has to be done in every cycle). Thus I have to make kind of an hybrid. The far fields will be interpolated in a cell through a linear function from the source cell while the near fields will be calculated directly between particles.
This cell approach should reduce the time to be grid dependent and moreover the accuracy will be good enough. But I am not sure enough if this will give me at least 1 cps for 1mil asteroids.
The thing with these methods is, that their cost is linear with number of particles but they are efficient only when massively parallelized. It is hardly a victory when 100k particles gives you 1 cps and 1 mil gives you 0.1 cps.
Only the grid structure takes half a second to be created and initialized and then the forces have to be evaluated so I am going to give it a last try and see how that goes.
In the meantime I ported the graphics into OpenGL because the win GDI was awfully slow. Looks much better now. Left the Oort cloud to evolve for a bit with only 10,000 asteroids on my laptop, and it looks promising. The undersampling is noticeable near the center.
Thank you Psychegram for the suggestions, I actually tried to raise the density of the asteroids so that their mass combined is what is needed to be but then they started to behave chaotically because the gravitational forces between them were considerable. I would say that each of the asteroids acted like a small planet and considering that the acceleration is proportional to the mass of the body, all asteroids around were accelerated and then flung away. It was really chaotic movement unlike the one on the pictures from the 10,000 bodies simulation. There one can already see some kind of spiral to be forming.
I also considered that the distribution of the mass might be like this: most of the mass in the cloud might be due to very small asteroids, perhaps few meters and maybe less in diameter (dust like) but in extreme quantities and there are only few percent of large bodies, like few kilometers or even hundreds of kilometers in diameter. But that would be even more computationally expensive.
ad 2) yes yes this is an excellent suggestion, I have already thought of this mainly when it comes to the interaction of the companion star with the Oort cloud asteroids. The charge can have significant impact on the behavior. I already partially implemented the charge considerations into the simulation. Basically the equations for gravity and electricity are similar so if the companion is significantly charged with negative charge (assuming Sun is positive) then the attractive coulomb force can make the difference. This is definitely an excellent question for the Cs. Another good question would be if the companion has some bodies attached like planets that are orbiting him. Maybe even its own asteroid belt. This is all very interesting because the collision of two clouds could be something totally different than a lone companion would do.
So well I will try to improve my algorithm some more. Even few 100k particles with 1 cps would be great. I think I can make it. In the worst case I simply reduce the diameter of the oort cloud so that the asteroids are tightly packed. Because I observed that using only 10,000 asteroids, the companion simply goes between them like totally unaffected, the distances between the asteroids are considerable even though it doesn't look like it at first sight. So this is mainly why I wish to maximize the asteroid count so that the space is realistically populated. Ok guys I keep you posted on my progress.
I implemented multiple grids but realized that the solution to the poisson's equation does not approximate the local fields accurately. The grid would have to be extremely fine which is not affordable (would take few seconds to be only initialized and this has to be done in every cycle). Thus I have to make kind of an hybrid. The far fields will be interpolated in a cell through a linear function from the source cell while the near fields will be calculated directly between particles.
This cell approach should reduce the time to be grid dependent and moreover the accuracy will be good enough. But I am not sure enough if this will give me at least 1 cps for 1mil asteroids.
The thing with these methods is, that their cost is linear with number of particles but they are efficient only when massively parallelized. It is hardly a victory when 100k particles gives you 1 cps and 1 mil gives you 0.1 cps.
Only the grid structure takes half a second to be created and initialized and then the forces have to be evaluated so I am going to give it a last try and see how that goes.
In the meantime I ported the graphics into OpenGL because the win GDI was awfully slow. Looks much better now. Left the Oort cloud to evolve for a bit with only 10,000 asteroids on my laptop, and it looks promising. The undersampling is noticeable near the center.
Thank you Psychegram for the suggestions, I actually tried to raise the density of the asteroids so that their mass combined is what is needed to be but then they started to behave chaotically because the gravitational forces between them were considerable. I would say that each of the asteroids acted like a small planet and considering that the acceleration is proportional to the mass of the body, all asteroids around were accelerated and then flung away. It was really chaotic movement unlike the one on the pictures from the 10,000 bodies simulation. There one can already see some kind of spiral to be forming.
I also considered that the distribution of the mass might be like this: most of the mass in the cloud might be due to very small asteroids, perhaps few meters and maybe less in diameter (dust like) but in extreme quantities and there are only few percent of large bodies, like few kilometers or even hundreds of kilometers in diameter. But that would be even more computationally expensive.
ad 2) yes yes this is an excellent suggestion, I have already thought of this mainly when it comes to the interaction of the companion star with the Oort cloud asteroids. The charge can have significant impact on the behavior. I already partially implemented the charge considerations into the simulation. Basically the equations for gravity and electricity are similar so if the companion is significantly charged with negative charge (assuming Sun is positive) then the attractive coulomb force can make the difference. This is definitely an excellent question for the Cs. Another good question would be if the companion has some bodies attached like planets that are orbiting him. Maybe even its own asteroid belt. This is all very interesting because the collision of two clouds could be something totally different than a lone companion would do.
So well I will try to improve my algorithm some more. Even few 100k particles with 1 cps would be great. I think I can make it. In the worst case I simply reduce the diameter of the oort cloud so that the asteroids are tightly packed. Because I observed that using only 10,000 asteroids, the companion simply goes between them like totally unaffected, the distances between the asteroids are considerable even though it doesn't look like it at first sight. So this is mainly why I wish to maximize the asteroid count so that the space is realistically populated. Ok guys I keep you posted on my progress.