indeed, most of the SPH implementation are based on the "particles" in CUDA SDK. Ideally, it would be great if we can just use tree-code so that both adaptive smoothing length in SPH and the N-body code can be done. hmm..need to get my hands dirty on the GPU^^.
@tclyue That's why I do not code on GPU anymore : even with OpenCL it's still a pain in the *ss...true innovation will come with x86 GPU. You give your portable C++/OpenMP code to GPU-maker compiler, and you're done ! Sweet dynamic allocation handled natively, easy parallelization...I prefer to work on nice code that is readable and portable.
great, so you've managed to do Barnes-Hut on a GPU. I'm now looking more or less a same problem. Not too familiar with N-body code myself. it would be interesting if I can take a peek at your code?
@tclyue Sorry, I mixed up different simulations. In this simulation, it's done on GPU with direct particle-to-particle interaction, since it's faster than optimized Barnes-Hut on CPU. But as you pointed out, trees are not straight foward to implement on GPUs. I implemented SPH on GPU about 1 or 2 years ago. Difficulty comes from dynamic allocation of arrays, which is not possible on GPU. But with static allocation, you can get what you want.
@tclyue In order to have real time performance it's only n-body gravition with Barnes-Hut optimization. SPh would lead to much more interesting result : with SPH and more precisely viscosity, no need to impulse particles with orbital velocity, friction would lead to rotation.
@davespitvalve This is the trick to simulate arms-like clusters : each particle has an initial velocity which is the perfect circular orbital velocity according to the most massive particles at the center, but the few other massfull particles seeded randomly in the disk perturbate this circular orbit and produces the effect wanted. It is the most simple way to simulate a galaxy without handling collision and density through SPH scheme.
I know knothing about this stuff but I do know something:
You've created an opticall ilusion without knowing it. As the video finishes, all the things 'move' because of the spiral you've been watching for a while )=
It seems that brightness is density. Is this because you are rendering using additive blending? If this is the case, how is it that the very center of the galaxy is white? Even with additive blending, rendering many yellow particles will still yield a yellow color, not white.
Starting at around 0:10 or so, the simulation looks really good. It seems that the parameters and number system your using are all normalized so that you can scale it up to any size and achieve the same results. I'm having trouble coming up with real-world SI unit parameters to duplicate your results. How large is this galaxy? How fast are is the initial speed of each particle?
Indeed all my parameters are normalized : i've done things normalized to avoid handling huge numbers at cosmological scale.
In this simulation the galaxy has a diameter of about 0.8., galaxy thickness is about 20% of its diameter, and black hole is about 99.9% of the total mass. Orbital velocities are not a parameter, they are computed at initialization, because the only constraint is circular orbits : velocities then depend on distance and mass.
@VelRyphon Well you are obviously using this formula to get each initial particle velocity: {speed * cos(angle)} for x, and for y, {speed * sin(angle)}. My question is, what value is "speed" set to? And in what units? (e.g. units per second, units per step, units per hour, etc.)
@rdelcueto Yes, massless particles is only subject to gravitational field created by mass particles, i.e. in this case it only interacts with 500 particles. I'm not planning to implement Barnes-Hut on GPU, it's to creepy for me lol. Data structure is still really painful with GPU. Maybe the day GPUs are x86, we'll be able to directly compile C++ program with a GPU compiler instead of GCC for example !
Now I'm working on fractals, so n-body is not my priority anymore...for the moment lol.
just PMed u
tclyue 1 month ago
indeed, most of the SPH implementation are based on the "particles" in CUDA SDK. Ideally, it would be great if we can just use tree-code so that both adaptive smoothing length in SPH and the N-body code can be done. hmm..need to get my hands dirty on the GPU^^.
tclyue 1 month ago
@tclyue That's why I do not code on GPU anymore : even with OpenCL it's still a pain in the *ss...true innovation will come with x86 GPU. You give your portable C++/OpenMP code to GPU-maker compiler, and you're done ! Sweet dynamic allocation handled natively, easy parallelization...I prefer to work on nice code that is readable and portable.
VelRyphon 1 month ago
great, so you've managed to do Barnes-Hut on a GPU. I'm now looking more or less a same problem. Not too familiar with N-body code myself. it would be interesting if I can take a peek at your code?
tclyue 1 month ago
@tclyue Sorry, I mixed up different simulations. In this simulation, it's done on GPU with direct particle-to-particle interaction, since it's faster than optimized Barnes-Hut on CPU. But as you pointed out, trees are not straight foward to implement on GPUs. I implemented SPH on GPU about 1 or 2 years ago. Difficulty comes from dynamic allocation of arrays, which is not possible on GPU. But with static allocation, you can get what you want.
VelRyphon 1 month ago
What physics is involved in this simulation? N-body(of course) and standard SPH?
tclyue 1 month ago
@tclyue In order to have real time performance it's only n-body gravition with Barnes-Hut optimization. SPh would lead to much more interesting result : with SPH and more precisely viscosity, no need to impulse particles with orbital velocity, friction would lead to rotation.
VelRyphon 1 month ago
Those rings at the beginning shouldn't be there - your initial conditions aren't quite in equilibrium
davespitvalve 1 month ago
@davespitvalve This is the trick to simulate arms-like clusters : each particle has an initial velocity which is the perfect circular orbital velocity according to the most massive particles at the center, but the few other massfull particles seeded randomly in the disk perturbate this circular orbit and produces the effect wanted. It is the most simple way to simulate a galaxy without handling collision and density through SPH scheme.
VelRyphon 1 month ago
@VelRyphon Ah, I see - so there's not really proper self-gravity or hydrodynamics. I was wondering how you were able to run it so fast!
davespitvalve 1 month ago
thumbs up is nicepeter brought u here
ShOoPdAwOoP10101 3 months ago
Fantastic!
oxploro 3 months ago
yo i can see my house!
smartguy9765 4 months ago
Amazing
tom123216 7 months ago
Comment removed
heloizyjhenifer 7 months ago
I know knothing about this stuff but I do know something:
You've created an opticall ilusion without knowing it. As the video finishes, all the things 'move' because of the spiral you've been watching for a while )=
NaYh 11 months ago
It seems that brightness is density. Is this because you are rendering using additive blending? If this is the case, how is it that the very center of the galaxy is white? Even with additive blending, rendering many yellow particles will still yield a yellow color, not white.
TheJesseLenney 1 year ago
@TheJesseLenney Simply because it's not pure yellow ;) there's a little of blue, to allow white color for very high density.
VelRyphon 1 year ago 2
Starting at around 0:10 or so, the simulation looks really good. It seems that the parameters and number system your using are all normalized so that you can scale it up to any size and achieve the same results. I'm having trouble coming up with real-world SI unit parameters to duplicate your results. How large is this galaxy? How fast are is the initial speed of each particle?
TheJesseLenney 1 year ago
@TheJesseLenney
Indeed all my parameters are normalized : i've done things normalized to avoid handling huge numbers at cosmological scale.
In this simulation the galaxy has a diameter of about 0.8., galaxy thickness is about 20% of its diameter, and black hole is about 99.9% of the total mass. Orbital velocities are not a parameter, they are computed at initialization, because the only constraint is circular orbits : velocities then depend on distance and mass.
VelRyphon 1 year ago
@VelRyphon Well you are obviously using this formula to get each initial particle velocity: {speed * cos(angle)} for x, and for y, {speed * sin(angle)}. My question is, what value is "speed" set to? And in what units? (e.g. units per second, units per step, units per hour, etc.)
TheJesseLenney 1 year ago
Comment removed
rdelcueto 1 year ago
@rdelcueto Yes, massless particles is only subject to gravitational field created by mass particles, i.e. in this case it only interacts with 500 particles. I'm not planning to implement Barnes-Hut on GPU, it's to creepy for me lol. Data structure is still really painful with GPU. Maybe the day GPUs are x86, we'll be able to directly compile C++ program with a GPU compiler instead of GCC for example !
Now I'm working on fractals, so n-body is not my priority anymore...for the moment lol.
VelRyphon 1 year ago