Remarkably the image posted here is not of actual galaxies but rather those simulated by two codes. The top is from a code called AREPO while the bottom is from the code Gadget-2. Even more remarkable is that this simulation was for a code test of AREPO to see how it compared to a well established code like Gadget-2.
Both codes were developed by Volker Springel at Heidelberg University. Both codes solve hydrodynamics and gravitational collapse. However, the two codes could not be more different in terms of how they solve the hydrodynamics.
Gadget-2 solves hydrodynamics via smoothed particle hydrodynamics (SPH). SPH codes solve hydrodynamics in a similar way to N-body simulations. Fluids after all are just a collection of particles whose collective evolution can be explained by the Navier-Stokes equations. SPH just assumes that the particles in question are very large. Since fluid mechanics a scale free, so long as your particles are not too large they will act the same as a fluid with much smaller particles.
SPH codes are popular for cosmology simulations because they allow you to solve gravity in a similar way to normal N-body codes. This is convenient because the most computationally expensive part is usually solving the gravity. There are a number of tricks one can use with N-body simulations to reduce the expense which can be applied to SPH as well.
The downside is that SPH does a poor job of capturing shocks and other fluid discontinuities. These are important to track as these control fluid mixing as well as heating of the gas. Thus SPH usually gets the general structure correct but it looks clumpy, due to the particles, and shocks are much more diffusive than one would like.
In order to capture shocks and discontinuities properly one typically falls back on grid based codes. These codes treat the fluid in its continuum limit rather than treating it as a collection of particles. Having a grid allows one to solve the equations of fluid dynamics directly at each grid interface, leading to much sharper discontinuities. The problem with these types of codes is that gravity is difficult to and the resolution does not adjust with the flow, unlike in SPH where the resolution naturally follows where the gas is.
One can alleviate this problem by doing adaptive mesh refinement (AMR), which adapts the structure of the grid to the flow pattern. However, you still have a problem that the code is Eulerian rather than Lagrangian. In an Eulerian calculation one fixes a frame with respect to the gas and then calculates the flow with respect to that frame. This can lead to large errors if the flow is moving fast through the frame in question. On the other hand Lagrangian calculations follow a gas element of a specified mass. The fluid equations are solved in the frame of that gas, reducing errors due to its motion. This is another advantage SPH has.
Ideally one would like to have both the advantages of SPH and grid based codes. Well AREPO was developed to do just that. AREPO has what is known as a unstructured mesh, which is common in engineering circles. However, AREPO takes it one step further by allowing the mesh to move with the flow in a psuedo-Lagrangian way. This allows the grid to resize and shape itself as the fluid evolves, putting higher resolution in denser areas and reducing the errors due to fluid motion.
This leads to the much sharper and better looking galaxies in the AREPO image. One can see movies showing individual galaxies, here. It's uncanny how realistic these simulations look compared to real observations.
All is not roses for AREPO though as it is an expensive code to run, taking 50% longer to execute than Gadget-2. Plus the memory overhead is large for these type of codes. Nonetheless, the pay off one gets in terms of resulting simulation is quite impressive.
One more thing to wrap up this ridiculously long post (congrats to making it this far). Fermi released their 2 year all sky map. It shows even more sources than the 1 year map and with greater detail. Very cool stuff.

No comments:
Post a Comment