Simulating the Cosmos with FLASH

Greetings! I’m Yaman Acharya from Nepal. I’m a rising sophomore double majoring in physics and math and minoring in computer science. This summer, I’m working with Dr. Johnson to learn Hacky Sack alongside determining the effect of travel time of light while observing the very large cosmic structures like galactic clusters. 

Light travels with a finite speed of 300,000,000 meters per second in vacuum. As electromagnetic waves are our primary source of information while observing the universe, we are never capable of seeing the universe as it is right now. For example, the light from the Sun takes almost 8 minutes 20 seconds to reach the Earth. So, we’re observing the Sun 8 minutes 20 seconds into the past. If a given star is 9 light years away from us, the light from that star takes 9 years to reach us. This means that the star appears as it was 9 years before. The observable universe is inexplicably large with the diameter of the observable universe expanding up to 93 billion light years. Recent studies have shown that the universe is expanding at a large scale i.e. the galaxies are moving farther away from each other. However, for a certain range, gravity is strong enough to overcome this expansion and form a group of thousands or maybe millions of galaxies bound together gravitationally which is known as a galactic cluster. Our own milky way is a part of a small galactic cluster of over 30 galaxies called the local group, which is a part of a larger galactic group containing more than 100,000 galaxies called the Laniakea Supercluster. The Laniakea Supercluster is assumed to have a radius of around 250 million light years i.e. the light itself takes more than 500 million years to go across this cosmic structure. Although it’s not gravitationally bound like its constituent such as the local group, the study of these large structures helps us understand the evolution of the universe from the big bang and thus is an important aspect of cosmology.

Figure 1: The Laniakea Supercluster

Now, when we are looking at these large cosmic structures, the travel time of light plays a significant factor in our observation. Suppose we’re looking at a structure like a local group which is 10 million light years across. The light from the farther end needs to travel additional 10 million years to reach us compared to the light from the nearer end. As the galaxies in any cluster are moving with a significant speed, this will affect our observation as the galaxies in the farther end would have significantly changed their position making our observation somehow inaccurate. Current observation and simulation methods rarely account for this difference in position. With this research, I wish to simulate a large-scale structure to analyze the effect of light travel time by adjusting the algorithm to account for the phenomena.

Simulating a large cosmic structure such as a galactic cluster is not an easy task. I’m trying to use the FLASH code to create a simulation. The FLASH code is a publicly available, high performance computing, multi-physics application code. Flash includes modules for astrophysics, cosmology, high-energy physics, cosmology, and various other research areas. Other than that, the test problems like  THE ZEL’DOVICH PANCAKE TEST provides a great test for cosmological expansion and particle dynamics, which are both very important in large scale cosmological simulations. Running the Flash code primarily was a big challenge. After facing various issues for almost two weeks, and fulfilling every system requirement, I finally installed Flash in my system. The first problem I ran with my flash code was the ‘Sedov’ Problem, which simulated a blast wave induced by a strong explosion. Running the first flash problem came with its own challenges. I had to make necessary adjustments and edits to various configuration files and makefiles which used a variety of programming languages like c, fortran, and python. Initially, reading and comprehending those files was challenging, but it started coming to me once I went over some syntaxes used in those languages. The Sedov problem gave me a proper overview of the Flash code. I learned to properly edit various default parameters to increase the number of particles, time steps, and many more. Also, I discovered the applications of packages and equations within the flash code stored under various directories. 

After spending almost a week on the Sedov explosion problem, I ran THE ZEL’DOVICH PANCAKE TEST simply referred to as the Pancake problem. The Pancake problem primarily caught my attention because, as pancake represents single-mode density perturbations, coding this problem is useful in creating more complex initial cosmological conditions. The density perturbations or fluctuations in the early universe were what led to the formation of large scale structures like galaxies and galactic clusters. The problem assigns Lagrangian coordinates and velocities to the dark matter particles making it reliable to visualize the data. A question may arise: why are we interested in dark matter particles while simulating the large cosmic structure? What is Dark matter in the first place? Dark matter is a hypothetical particle that plays its role in shaping the large cosmic structures. When scientists observed the velocity of revolution of stars in a galaxy around the galactic center, they expected the velocity to decrease with the increase in star’s distance from the center. However, they observed the velocity of revolution to be constant. It was only possible if the galaxy was more than five times more massive than it’s observed to be. The missing mass is supposed to be composed of Dark matter. Dark matter only interacts with other matters via the force of gravity. As they do not absorb, reflect, or emit light, they can never be directly observed. Dark matter is abundant in the universe; scientists suppose that dark matter makes up 27% of the universe, in contrast to the normal matter, which makes up less than 5%. 

Gravity is the leading force in formation of a large cosmic structure. So, the abundance of Dark matter is what led to the formation of galaxy and galactic clusters. Matters wouldn’t be able to interact via gravitational force as strongly as we observe given the absence of the Dark matter. In fact, the formation of large cosmic structures would be impossible in the first place. For the Pancake test, the checkpoint interval was set such that I could get 11 particle files that showed the evolution of the simulation from an initial timestep to the final timestep. The cosmological units were set in the universe with Omega Matter = 1 and Cosmological Constant = 0. The redshift at which the pancake forms a caustic zc was set to be 5. We measured the positions and velocities of the particles at z = 7, i.e., before the collapse, and also at z = 0 after several caustics have formed.. Now, for each particle, the particle velocity is given by the equation:

where xe is the distance of a point from the pancake midplane, and xl is the corresponding Lagrangian coordinate, found by iteratively solving

Because they are collision less, the dark matter particles behave very differently compared to gas. As particles accelerate toward the midplane, their phase profile develops a backwards “S” shape. I observed this phenomena when I took the first particle file that was created after running the code and analyzed it with python. I compared the x-coordinate of the particles with their x velocities and plotted them in a graph with python. I wrote a python algorithm to set the midpoint of the plane in the middle of the graph, which helped me obtain the backward S shape as shown in the diagram:

As the particles evolve and interact with each other, the particle distribution is smeared out close to the center of the spiral. For the final timestep, the results are shown for redshift z = 0 and distance x is measured from the pancake midplane. Dark matter phase diagram showing particle positions x and velocities v is thus expected to produce a graph that looks like following:

And surely, after running my code, I glanced the final particle file and used the similar algorithm as before to set the midpoint of the plane in the middle of the graph, from which I obtained the following plot:

So, with the use of the flash code, I was able to simulate the dynamics of Dark matter particles over numerous timesteps. Here, we’re just looking at the first and the last timestep to observe if we obtained the desired evolution or not, and it turns out we did. The next step would be using the pancake test problem to simulate a large-scale initial cosmological condition and evolve it with several timesteps to form a cluster. I’m currently trying to modify the pancake problem to simulate the formation of a cluster of galaxies in a cold dark matter universe. For my simulation, I’m willing to take a reference to The Santa Barbara cluster comparison project. My goal is to simulate a cluster in a box. I’m attempting to make an initial simulation in a box that extends to around 1 Megaparsec (Mpc) which is around 3.26 million Light Years. At the same time, I’m running the pancake problem varying the default parameters and analyzing the results to get a basic idea of simulating a larger structure. 

Finally, I want to talk about my experience with the hacky sack, which is my one true focus for the summer. Hacky Sack afternoon has truly been the highlight of my summer. For me, the hacky sack has become a source of confidence. It helps me realize that no problem is impossible. Also, it shows the value of diligence and consistency to achieve a certain goal. You don’t get a hack on a single attempt, it takes multiple failures to finally get a single hack. Sometimes you unexpectedly get a maximum efficiency hack, or even a double hack, which are pretty rare. However, sometimes you walk away without a single hack, Sometimes, a minor mistake ruins the beautiful group work. I see a beautiful connection between hacky sack and the work I’ve been pursuing this summer. Setting up the flash code and running it in my system was truly complicated. It took me almost 4 weeks just to run my first problem. However, once you get that first hack, it’s not as difficult to get the second or the third. In the same way, once I successfully ran my first flash problem, it was comparatively easier to run even more complex problems and fix the issues in the code. My goal is to end the summer research with a triple hack. Let’s see how it goes. I’m ending this blog with a photo of the hacky sack.

Leave a comment