<p>Whether there is a tool that allows to define ICs of your choice, mainly depends on what is your choice. If you want to start from cosmological initial conditions, there are various flags in the code that can help you do that.
See section &quot;IC Generation&quot; of the <a href="https://wwwmpa.mpa-garching.mpg.de/gadget4/gadget4_manual.pdf" rel="nofollow noreferrer">Gadget-4 manual</a>. As instance:</p>
<blockquote>
<p><strong>NGENIC = 256</strong>
This master switch enables the creation of cosmological initial conditions for simulations with
periodic boundary conditions. The value of NGENIC should be set to the FFT-grid size used for
IC generation, which should be at least as fine as the particle resolution per dimension. If the
code is started without restartflag (i.e. when normally initial conditions are read), the code instead
creates the ICs first, followed by evolving them with the code, i.e. in this case the initial
conditions do not need to exist on disk. One can however also start the code with restartflag 6, in
which case the ICs are produced and written to disk, followed by a stop of the code. One can then
also use the produced files as ICs in a regular start of GADGET-4 without having the NGENIC
option set.</p>
</blockquote>
<p>Otherwise, if you want to simulate a particular region of space, such as a single galaxy, then the most correct way would be to first run a cosmological simulation (or download the data from a simulation already done) and then zoom-in in a particular region, where your object of interest is forming. You can take the initial conditions from the cosmological simulation and then increase the resolution as necessary. Anyway, it's not something that can be done in an afternoon, there are many subtleties involved. Hydro simulations are complicated.</p>
<p>Maybe you could find some useful references in this review</p>
<p><a href="http://arxiv.org/abs/1909.07976" rel="nofollow noreferrer">Cosmological Simulations of Galaxy Formation - Vogelsberger (2019)</a></p>
<p>or in this document</p>
<p><a href="http://jultika.oulu.fi/files/nbnfioulu-201610272951.pdf" rel="nofollow noreferrer">Cosmological Zoom Simulations</a></p>
<p>Otherwise, if you want to simulate something very specific, such as a particular <a href="https://www.youtube.com/watch?v=cTRQP6DSaqA" rel="nofollow noreferrer">geometrical configuration</a> not necessarily related to astrophysics, if no one has yet tried this configuration and published the initial conditions, then you should write some code to generate it for you.</p>

CC BY-SA 4.0
2022-07-11T08:17:48.060Z
2022-07-11T08:17:48.060Z
Prallax
<p>I want to use <a href="https://wwwmpa.mpa-garching.mpg.de/gadget4/" rel="nofollow noreferrer">GADGET-4</a> &quot;a parallel cosmological N-body and SPH code meant for simulations of cosmic structure formation and calculations relevant for galaxy evolution and galactic dynamics&quot; or similar computational tools to study and emulate how two galaxies interact, based on a set of initial conditions (ICs) that I define. I tried GADGET - 4 for a set of demo ICs that came with the model. However, I could not find any tool to define the ICs of my choice. Is there some cookbook I can refer to which will guide me on how to go about the same?</p>

<galaxy><cosmology><modeling><galactic-evolution>
Using cosmological model GADGET - 4
SlightDecoy
# Using cosmological model GADGET - 4

(Asked by: username_0 on 2022-07-11)

I want to use [GADGET-4](https://wwwmpa.mpa-garching.mpg.de/gadget4/) "a parallel cosmological N-body and SPH code meant for simulations of cosmic structure formation and calculations relevant for galaxy evolution and galactic dynamics" or similar computational tools to study and emulate how two galaxies interact, based on a set of initial conditions (ICs) that I define. I tried GADGET - 4 for a set of demo ICs that came with the model. However, I could not find any tool to define the ICs of my choice. Is there some cookbook I can refer to which will guide me on how to go about the same?

**Tags:** galaxy, cosmology, modeling, galactic-evolution


---

## 1 answers

### Answer by username_1 on 2022-07-11. Score: 4 | Accepted answer

Whether there is a tool that allows to define ICs of your choice, mainly depends on what is your choice. If you want to start from cosmological initial conditions, there are various flags in the code that can help you do that.
See section "IC Generation" of the [Gadget-4 manual](https://wwwmpa.mpa-garching.mpg.de/gadget4/gadget4_manual.pdf). As instance:

> **NGENIC = 256**
> This master switch enables the creation of cosmological initial conditions for simulations with
> periodic boundary conditions. The value of NGENIC should be set to the FFT-grid size used for
> IC generation, which should be at least as fine as the particle resolution per dimension. If the
> code is started without restartflag (i.e. when normally initial conditions are read), the code instead
> creates the ICs first, followed by evolving them with the code, i.e. in this case the initial
> conditions do not need to exist on disk. One can however also start the code with restartflag 6, in
> which case the ICs are produced and written to disk, followed by a stop of the code. One can then
> also use the produced files as ICs in a regular start of GADGET-4 without having the NGENIC
> option set.

Otherwise, if you want to simulate a particular region of space, such as a single galaxy, then the most correct way would be to first run a cosmological simulation (or download the data from a simulation already done) and then zoom-in in a particular region, where your object of interest is forming. You can take the initial conditions from the cosmological simulation and then increase the resolution as necessary. Anyway, it's not something that can be done in an afternoon, there are many subtleties involved. Hydro simulations are complicated.

Maybe you could find some useful references in this review

[Cosmological Simulations of Galaxy Formation - Vogelsberger (2019)](http://arxiv.org/abs/1909.07976)

or in this document

[Cosmological Zoom Simulations](http://jultika.oulu.fi/files/nbnfioulu-201610272951.pdf)

Otherwise, if you want to simulate something very specific, such as a particular [geometrical configuration](https://www.youtube.com/watch?v=cTRQP6DSaqA) not necessarily related to astrophysics, if no one has yet tried this configuration and published the initial conditions, then you should write some code to generate it for you.


---

