Generating a multi-components galaxy

The script ic_makeGalaxy allows to create a multi-component galaxy model at equilibrium, combining a gas disk (Miyamoto-Nagai), a stellar disk (Exponential disk) a bulge (Plummer model) and a dark halo (generic 2-slope model). The equilibrium is obtained by solving the Jean equation in both spherical and cylindrical coordinates.

By default the script create a Milky-Way like galaxy, assuming a set of parameters. The command:

ic_makeGalaxy -o MW_galaxy.hdf5

will create the MW_galaxy.hdf5 file containing all the particles. The script can however take the parameters from a yaml file:

ic_makeGalaxy -p params.yml

where the params.hdf5 file contains for example the following parameters:

# using default parameters in tmp_parameter_file.yml

OutputUnits:
  UnitLength_in_cm:         3.085e21          # 1 kpc in centimeters
  UnitMass_in_g:            1.98848e43        # 10^10 M_sun in grams
  UnitVelocity_in_cm_per_s: 1e5               # 1 km/s in centimeters per second
  
Galaxy:  
  m_ref:              200000         # reference mass of particles [solar mass]
  nf:                 1              # particle count multiplicative factor (used to reduce noise) 
  hydro:              1              # if set to 0, turn gas to collisionless particles
  ftype:              "swift"        # output format (swift, gh5, gadget)
  outputfilename:     "galaxy.hdf5"  # output file name
  irand:              0              # random seed
  boxsize:            1500           # boxsize [kpc]
  
# Parameters for gas component
Gas:
  fm:                 1             # particle mass to ref. mass ratio (set to 0 disable the component)
  mass:               0.5e10        # component mass [solar mass]
  Hr:                 4.0           # radial scale [kpc]
  Hz:                 0.3           # vertical scale [kpc]
  rmax_to_Hr_ratio:   10            # rmax to Hr ratio
  zmax_to_Hz_ratio:   3             # zmax to Hz ratio
  sigmavel:           10            # velocity dispersion [km/s] (if hydro=0)
  T:                  100           # temperature [K]            (if hydro=1)

# Parameters for disk component
Disk:
  fm:                 1             # particle mass to ref. mass ratio (set to 0 disable the component)
  mass:               2e10          # component mass [solar mass]
  Hr:                 2.0           # radial scale [kpc]
  Hz:                 0.3           # vertical scale [kpc]
  fr:                 10            # grid rmax to Hr ratio
  fz:                 10            # grid rmax to Hr ratio
  toomre:             2             # Toomre stability criterion


# Parameters for bulge component
Bulge:
  fm:                 1             # particle mass to ref. mass ratio (set to 0 disable the component)
  mass:               0.4e10        # component mass [solar mass]
  Hr:                 1.0           # radial scale [kpc]
  fr:                 5.0           # grid rmax to Hr ratio

# Parameters for dark halo component
Halo:
  fm:                 5             # particle mass to ref. mass ratio (set to 0 disable the component)
  mass:               115e10        # component mass [solar mass]
  c:                  10            # concentration parameter
  alpha:              1             # inner slope
  beta:               3             # outer slope
  Rcut:               None          # cutting radius [kpc]
  power_cut:          3             # power of the cut if Rcut is defined
  fr:                 1.0           # rmax to r200 ratio
  dR:                 0.25          # grid resolution [kpc]

Plotting the corresponding rotation curve

To check the rotation curve corresponding to the model generated, pNbody offers the following command:

plotCylindricalProfile -y vcirc   --xmax 50 --rmax 50 --nr 64  --nr 64 --eps 0.1 --forceComovingIntegrationOff  MW_galaxy.hdf5

More examples

Additional examples of dwarf galaxies or galaxies with cusp or core may be found in the pNbody/examples/ic/ic_makeGalaxy directory.

Scripts

ic_makeGalaxy

usage: ic_makeGalaxy [-h] [-p PARAMETER_FILE] [-o OUTPUTFILENAME] [--debug]
                     [--print-parameters] [--HubbleParameter HUBBLEPARAMETER]

Generates a mulit-component galaxy model

options:
  -h, --help            show this help message and exit
  -p PARAMETER_FILE, --parameter-file PARAMETER_FILE
                        Name of the parameter file
  -o OUTPUTFILENAME     Name of the output file
  --debug               debug mode: save intermediate files
  --print-parameters    print parameters and quit
  --HubbleParameter HUBBLEPARAMETER
                        Hubble parameter

The model is made out of four components:

a gas disk (Miyamoto-Nagai)
a stellar disk (Exponential disk)
a bulge (Plummer model)
a dark halo (generic two slope model)

All components can be fine tuned using parameters provided by a parameter file (see below).

Examples:
--------
ic_makeGalaxy
ic_makeGalaxy -p params.yml
ic_makeGalaxy -p params.yml -o galaxy.hdf5
ic_makeGalaxy --print-parameters

where the file params.yml contains the following parameters:

'''

OutputUnits:
  UnitLength_in_cm:         3.085e21          # 1 kpc in centimeters
  UnitMass_in_g:            1.98848e43        # 10^10 M_sun in grams
  UnitVelocity_in_cm_per_s: 1e5               # 1 km/s in centimeters per second
  
Galaxy:  
  m_ref:              200000         # reference mass of particles [solar mass]
  nf:                 1              # particle count multiplicative factor (used to reduce noise) 
  hydro:              1              # if set to 0, turn gas to collisionless particles
  ftype:              "swift"        # output format (swift, gh5, gadget)
  outputfilename:     "galaxy.hdf5"  # output file name
  irand:              0              # random seed
  boxsize:            1500           # boxsize [kpc]
  
# Parameters for gas component
Gas:
  fm:                 1             # particle mass to ref. mass ratio (set to 0 disable the component)
  mass:               0.5e10        # component mass [solar mass]
  Hr:                 4.0           # radial scale [kpc]
  Hz:                 0.3           # vertical scale [kpc]
  rmax_to_Hr_ratio:   10            # rmax to Hr ratio
  zmax_to_Hz_ratio:   3             # zmax to Hz ratio
  sigmavel:           10            # velocity dispersion [km/s] (if hydro=0)
  T:                  100           # temperature [K]            (if hydro=1)

# Parameters for disk component
Disk:
  fm:                 1             # particle mass to ref. mass ratio (set to 0 disable the component)
  mass:               2e10          # component mass [solar mass]
  Hr:                 2.0           # radial scale [kpc]
  Hz:                 0.3           # vertical scale [kpc]
  fr:                 10            # grid rmax to Hr ratio
  fz:                 10            # grid rmax to Hr ratio
  toomre:             2             # Toomre stability criterion

# Parameters for bulge component
Bulge:
  fm:                 1             # particle mass to ref. mass ratio (set to 0 disable the component)
  mass:               0.4e10        # component mass [solar mass]
  Hr:                 1.0           # radial scale [kpc]
  fr:                 5.0           # grid rmax to Hr ratio

# Parameters for dark halo component
Halo:
  fm:                 5             # particle mass to ref. mass ratio (set to 0 disable the component)
  mass:               115e10        # component mass [solar mass]
  c:                  10            # concentration parameter
  alpha:              1             # inner slope
  beta:               3             # outer slope
  Rcut:               None          # cutting radius [kpc]
  power_cut:          3             # power of the cut if Rcut is defined
  fr:                 1.0           # rmax to r200 ratio
  dR:                 0.25          # grid resolution [kpc]

'''