Introduction and Motivation
Following up after the simplified model in the previous post, I can now get into more high powered applications. The only “new physics” to be discussed at this point is the new model for the galaxies, which will be random populations of density functions which have been granted to us by Kiujiken & Dubinski. We also introduce dark matter to our galaxies, which turns out to be a necessity for stability.
The simulation on the other hand requires a new approach; using the parallelism of CUDA to cut down on the extremely expensive simulation times. With the number of masses I intended to use, the straightforward CPU based approach (without any fancy speed ups ) simulations of a reasonable time-scale would have taken lifetimes! Particularly on my poor little laptop. I’ll be discussing the technology behind GPU computing and the CUDA based algorithm which allows for these simulations to be ran in hours, or minutes really, if you don’t want to bother making smooth videos like I did.
There is quite a bit of motivation for this work for me personally, GPU computing opens doors to a new scope of computational science, in areas like fluid dynamics, quantum electrodynamics (QED), and molecular dynamics.
The Physics
I’ll break this portion into descriptions of Kiujiken & Dubinski’s models for the bulge, halo, and disk which I have generated to use as initial conditions. The bulge and halo are simpler, nearly spherically symmetric models which are approximately stable on their own, the rings are more complex due to their asymmetry. The functions I post below are distribution functions in energy which have density functions (the probability to be found in a region of phase space which one would expect to use to populate at random) associated with them through integration over 2 or 3 variables, depending on the model. The paper solves for these functions as well.
The Bulge
The bulge utilizes King’s model, which can be thought of as a truncated Isothermal Sphere. Model’s such as these achieve stability by requiring inward gravitational forces to match outward “pressure” when forming a distribution. One must make corrections to an infinity which arises at the origin, as well as the truncation which must be made in a simulation, without which the sphere would go to infinity and contain theoretically infinite mass. Here’s what that ends up looking like in the paper:
These are not very pretty! What matters here are the desired ρb value specifying the central bulge density, and the relationships between ψc and σb and σ0, which determine how sharply the distribution cuts off. The author’s chose values which gave a more centrally dense bulge than the halo distribution, likely to match observation.
The Disk
The model for the disk expects there to be central mass, from the bulge and halo, in order to be stable. As such, masses closest to the center are given more energy such that they don’t collapse inward. Simulating the thing alone the results in an expansion of these masses, but I’ve done it anyway for the sake of completion. The distribution function below has become a function of 3 energy variables, w.r.t. planar motions, angular momentum, and the additional z energy component which the paper models simply as an oscillation across the plane of the disk:
the density and frequency parameters with a tilde are chosen to match observations, in particular light densities and rotation speeds of real disk galaxies, and likely for stability as well when the disk model is mixed with the other two. Energies and frequencies as a function of Rc are dependent on the energy of a circular orbit with the desired Lz parameter.
The Halo
If you can make out the now tiny axes (which have remained the same size) through the artifacts in the gif you can see the halo is massive in comparison to the visible galaxy. It’s also literally massive, ~94% of the entire system using this combined model. The distribution function is not too different from that of the bulge, it decays more slowly and most importantly, it is not spherical. It’s known as an Evan’s model and has slightly flattened poles, converging slightly inward towards the disk
As described, the parameters A, B, and C, correspond to the density scale, the “core” radius, and the flattening parameter which is characteristic of Evan’s model.
All Together
The Code
The CUDA device code i’ve used is shown below. As demonstrated by NVDIA, the acceleration kernel is split into chunks (“tiles”) which can access a smaller pool of shared memory while they run. The other kernels perform the leapfrog steps of the algorithm after acceleration has been calculated for each body.
These are all called with the same thread dimensions using CUDA’s kernel launch syntax:
References
-
The Disk-Bulge-Halo model for galaxies, stability, etc: Kiujiken & Dubinski
-
Their GalactICS package which I have used to populate galaxies is publicly available
-
My GitHub repo for this project