Git Product home page Git Product logo

galstep's Introduction

About

This code uses the algorithm described in Springel, Di Matteo & Hernquist (2005) for generating the initial conditions for a disk galaxy simulation with the codes GADGET-2 or RAMSES (using the DICE patch), including a stellar disk, a gaseous disk, a dark matter halo and a stellar bulge. The first two components follow an exponential density profile, and the last two a Dehnen density profile with gamma=1 by default, corresponding to a Hernquist profile. You can check out the expressions in Ruggiero & Lima Neto (2017).

Some notes which might save you some time:

1- Using this method, some combinations of component masses lead the dark matter halo to be unrelaxated near the very center of the galaxy. If that is the case for your galaxy, you will see a ring appearing in its stellar disk in less than one rotation time. When that happens, I like to relaxate the halo for a few hundred Myr while keeping the other components frozen (both Gadget2 and RAMSES can do that) in order to ensure a good state of equilibrium.

2- If you run GADGET-2 without any gas cooling, the gaseous disk will gain lots of energy over time due to the artificial viscosity, and will get a lot thicker.

3- The vertical equilibrium of the gas component depends on your simulation setup. If you use radiative cooling, it will settle on a very short timescale (a few tens of Myr at most). If not, it will take about one rotation period to reach equilibrium.

About units: the value for the gravitational constant G used in this code is such that the unit for length is 1.0 kpc, for mass 1.0e10 solar masses, and for velocity 1.0 km/s. This is the default for GADGET-2, and works out of the box in RAMSES with the DICE patch.

Required libraries

  • NumPy (python-numpy)
  • SciPy (python-scipy)
  • pyGadgetReader
  • h5py (only if you need the HDF5 file format, python-h5py)

Usage

You can run python galstep.py --help to see the message below. Also please check out the galaxy_params.ini file to see the available free parameters.

usage: galstep.py [-h] [-cores CORES] [--force-yes] [--force-no] [--hdf5]
                  [-o init.dat] [-i params_galaxy.ini]

Generates an initial conditions file for a galaxy simulation with halo,
stellar disk, gaseous disk and bulge components.

optional arguments:
  -h, --help            show this help message and exit
  -cores CORES          The number of cores to use during the potential
                        canculation. Make sure this number is a factor of
                        N_rho*N_z. Default is 1.
  --force-yes           Don't ask if you want to use the existing
                        potential_data.txt file. Useful for automating the
                        execution of the script.
  --force-no            Same as above, but with the opposite effect.
  --hdf5                Output initial conditions in HDF5 format.
  -o init.dat           The name of the output file.
  -i params_galaxy.ini  The name of the .ini file.

Troubleshooting

If you are getting OSError: [Errno 24] Too many open files while trying to run this code in OSX, please try this.

Works which used this code

Disclaimer

Feel free to use this code in your work, but please link this page in your paper.

galstep's People

Contributors

ruggiero avatar rennehan avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.