Introduction
This tutorial explains how to install and analyze the AstroGen2 simulation on a Linux server to study star formation in galaxies and galactic interactions.
Prerequisites
Before you begin, ensure that your server meets the following requirements.
This tutorial explains how to run the simulation on a Linux server, copy the generated data to a Windows machine and analyze it there. However, it is also possible to perform the simulation and the analysis of the simulation results on a single Windows machine.
For installation and simulation:
-
Operating system: Windows or Linux (Ubuntu recommended)
-
Already installed:
Before starting, install the following software on your system:
- CMake (version 3.10 or higher)
- GCC (GNU Compiler Collection)
sudo apt update sudo apt install cmake gcc g++
For analyzing the simulation results:
- Operating system: Windows
Step 1 – Installation
Connect to your Linux server and clone the repository onto your machine:
cd ~ && git clone https://github.com/Philip-Spaeth/AstroGen2.git
Navigate into the project directory:
cd ~/AstroGen2/simulation
Build the project using CMake:
mkdir build && cd build
cmake ..
make
Step 2 – Setting up initial galaxy data
The initial conditions for the galaxies must be stored in the ~/AstroGen2/input_data/
directory.
Navigate to the input folder ~/AstroGen2/input_data/
and clone the repository Example_ICs_AG2
:
cd ~/AstroGen2/input_data/
git clone https://github.com/Philip-Spaeth/Example_ICs_AG2.git
Step 3 – Simulation configuration
Edit the configuration settings to define galaxy parameters and simulation settings:
nano ~/AstroGen2/simulation/Config.ini
Adjust the following parameters:
Parameter | Description | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
inputPath |
Adjust this parameter to select the input dataset. The base directory is ~/AstroGen2/input_data/ .Example: inputPath = Example_ICs_AG2/galIC/22k.dat |
||||||||||
inputDataFormat |
If the format of the input file is changed, update this parameter accordingly:
|
||||||||||
numberOfParticles |
Set the number of particles for the simulation here. This value must not exceed the number of particles in the input file. With the above example input file, the maximum would be 22000. | ||||||||||
numParticlesOutput |
This additionally specifies how many particles are saved after the simulation. |
Step 4 – Running the compiled program
After building the project, you can run the simulation:
cd ~/AstroGen2/simulation/build/
./Astro_Genesis
./AstroGen2
Step 5 – Analyzing the simulation results
Now switch to your Windows device to perform the analysis there.
Step 5.1 – Setting up AGRender for analysis
-
Clone the
AGRender
Repository-
WSL subsystem for Windows
mkdir ~/AstroGen2 cd ~/AstroGen2 git clone https://github.com/Philip-Spaeth/AGRender.git
-
PowerShell
mkdir ~/AstroGen2 cd ~/AstroGen2 curl -o AGRender.zip https://github.com/Philip-Spaeth/AGRender/archive/refs/heads/master.zip tar -xf AGRender.zip mv AGRender-master AGRender
-
-
Add the analysis results
The
AGRender
program requires a separate directory calledoutput_data
to store render data. The calculated data must be located relative totype.exe
in theoutput_data
folder. For example:AstroGen2/ ├── output_data │ └── test └── AGRender └── pre_build └── type.exe
If you followed all steps on a single machine, you can directly use the calculated data in the
output_data
folder.If you are working on two separate systems, you need to copy the
output_data
folder with the analysis results from your Linux server to your Windows machine.Navigate to
AstroGen2
on your Windows machine and use the following command to copy the calculated data from the Linux server to your Windows machine:cd ~/AstroGen2 scp -r <user>@<server_ip>:~/AstroGen2/output_data .
-
Use precompiled binaries or compile from source
Choose one of the two options.
- Using precompiled binaries recommended
cd AGRender/pre_build # chmod +x galaxyPart.exe && chmod +x type.exe ./galaxyPart.exe or ./type.exe
-
Compiling the project with CMake
mkdir build && cd build cmake .. make
- Using precompiled binaries recommended
This should start an interactive environment where you can provide additional information.
Option | Description |
---|---|
Data folder to load | Select option 1 test |
video or liveViewer | Select option 2 for a live view of the simulation |
Step 5.2 – Controls for AGRender
-
Mouse: Rotate the view
-
Keyboard: Move and interact with particles
Key Action w Move forward s Move backward d Move right a Move left L Focus on galaxy center Ctrl Faster movement Space bar Start/Stop the simulation Left arrow Decrease speed Right arrow Increase speed Keys 1–9 Display specific particle types (gas, dark matter, etc.)
Example visualization
Conclusion
With this tutorial and the AstroGen2 program, you can now run scientific simulations of galaxies and thereby investigate star formations and the behavior of galaxies on a scientific level.