Generating a Milky Way galaxy based on the MW2014 Bovy model

The script ic_makeMW2014 allows to create the Bovy MW model model at equilibrium, combining a stellar disk (Miyamoto disk) a bulge (trucated power law model) and a dark halo (NFW). The equilibrium is obtained by solving the Jean equation in both spherical and cylindrical coordinates.

By default the script creates the exact MW2014 model. The command:

ic_makeMW2014 -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) 
  ftype:              "swift"        # output format (swift, gh5, gadget)
  outputfilename:     "galaxy.hdf5"  # output file name
  irand:              0              # random seed
  boxsize:            1500           # boxsize [kpc]
  

# Parameters for disk component
Disk:
  fm:                 1             # particle mass to ref. mass ratio (set to 0 disable the component)
  mass:               6.8e10        # component mass [solar mass]
  Hr:                 3.0           # radial scale [kpc]
  Hz:                 0.280         # vertical scale [kpc]
  rmax_to_Hr_ratio:   10            # rmax to Hr ratio
  zmax_to_Hz_ratio:   10            # zmax to Hz 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)
  alpha:              1.8           # power law slope
  r_c:                1.9           # cutting radius [kpc]
  r_1:                1.0           # radius [kpc]
  amplitude:          2.22646e8     # density factor [Msol/kpc3]
  fr:                 10            # rmax to r_c ratio
  dR:                 0.01          # grid resolution [kpc]  

# Parameters for dark halo component
Halo:
  fm:                 5             # particle mass to ref. mass ratio (set to 0 disable the component)
  r_s:                16            # scale radius [kpc]
  M_200:              0.6438e12     # virial mass [msol]
  r_200:              157.174455004 # virial radius [kpc]
  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

Scripts

ic_makeMW2014

usage: ic_makeMW2014 [-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 stellar disk (Exponential disk)
a bulge (Power law 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_makeMW2014
ic_makeMW2014 -p params.yml
ic_makeMW2014 -p params.yml -o galaxy.hdf5
ic_makeMW2014 --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) 
  ftype:              "swift"        # output format (swift, gh5, gadget)
  outputfilename:     "galaxy.hdf5"  # output file name
  irand:              0              # random seed
  boxsize:            1500           # boxsize [kpc]
  

# Parameters for disk component
Disk:
  fm:                 1             # particle mass to ref. mass ratio (set to 0 disable the component)
  mass:               6.8e10        # component mass [solar mass]
  Hr:                 3.0           # radial scale [kpc]
  Hz:                 0.280         # vertical scale [kpc]
  rmax_to_Hr_ratio:   10            # rmax to Hr ratio
  zmax_to_Hz_ratio:   10            # zmax to Hz 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)
  alpha:              1.8           # power law slope
  r_c:                1.9           # cutting radius [kpc]
  r_1:                1.0           # radius [kpc]
  amplitude:          2.22646e8     # density factor [Msol/kpc3]
  fr:                 10            # rmax to r_c ratio
  dR:                 0.01          # grid resolution [kpc]  

# Parameters for dark halo component
Halo:
  fm:                 5             # particle mass to ref. mass ratio (set to 0 disable the component)
  r_s:                16            # scale radius [kpc]
  M_200:              0.6438e12     # virial mass [msol]
  r_200:              157.174455004 # virial radius [kpc]
  fr:                 1.0           # rmax to r200 ratio
  dR:                 0.25          # grid resolution [kpc]

'''