Units¶
Code Convention¶
We adopt the convention that:
where \(G\) is the gravitational constant and \(H_0\) is the Hubble parameter. Given the definition of \(\rho_c\) (the critical density of the universe), it follows that:
Cosmological Units¶
For cosmological runs we adopt the usual comoving coordinates and periodic boundary conditions. We also adopt the convention:
where \(L\) is the length of the periodic box centered on \(0,0,0\). The coordinates x, y and z have the range \(\left[-0.5,0.5\right)\). This also means that the volume of the box is \(1\), and thus the total matter (dark matter and baryons) in the box must be:
where \(\Omega_m\) is the matter density of the Universe.
Conversion to Physical Units¶
Summary¶
Unit |
Multiply by |
Units |
|---|---|---|
Length |
L |
comoving \(h^{-1}\) Mpc |
Mass |
\(L^3\times 2.77536627208\times 10^{11}\) |
\(h^{-1}M_\odot\) |
Velocity |
\(\sqrt{\frac{8\pi}{3}}\div({L\times a\times 100})\) |
km/s |
Where:
- \(L\)
The physical length of the box in comoving \(h^{-1}\) Mpc.
- \(a\)
The expansion factor.
Derivation¶
It is helpful to introduce the value of the gravitational constant.
Recall that:
where:
- pc
The length of a parsec.
- au
The length of the astronomical unit which is defined to be exactly 149 597 870 700 meters.
This means that \(1\) Mpc is \(\pi^{-1}\times 9.69394202136\times 10^{19}\) km, so we can rewrite \(G\) as the product of a density and time squared.
Also recall that:
Length¶
The length unit is simply the width of the cosmological box in \(L\) in \(h^{-1}\) Mpc.
Mass¶
The density unit is given by:
The mass unit is given by:
Velocity¶
The \(G=1\) criteria allows us to derive the velocity unit by factoring out the mass unit and the length unit.
Thus when \(L\) is expressed in \(h^{-1}\) Mpc:
Or in proper (non-comoving) units:
Time¶
The \(G=1\) criteria also allows us to derive the time unit by factoring out the density unit.
Multiplying by our density unit gives:
Other Unit Systems¶
kpc & km/s¶
It is often convenient to fix the length unit to be kpc, and the velocity unit to be km/s. With \(G=1\) as before, we can calculate the mass unit:
Thus, for \(G=1\), the mass unit must be:
The length unit is kpc, so the density unit is:
Similarily the time unit must be:
kpc & Gyrs¶
One can also fix the length unit to kpc, the time unit to Gyrs and thus the velocity unit to kpc/Gyr. The mass unit is then:
With \(3.15581184\times 10^7\) seconds in a year and \(3.15581184\times 10^{16}\) seconds in a Gyr, we get:
This means that the mass unit is:
Velocity¶
It should be noted that kpc/Gyr is very nearly km/s. This should be obvious because the time unit in the kpc and km/s unit system is very nearly 1 Gyr (but not exactly).
Units calculator¶
The file /tools/calculate_units.py provides a tool that allows to calculate the values for dKpcUnit and dMsolUnit that go into the parameter file. It provides six different modes, where any two of the four values mass unit, length unit, velocity unit and time unit can be provided.
Some sample sets of units relevant for planetary scale simulations are:
Length unit: 1 Earth radius, Velocity unit: 1 km/s
dKpcUnit = 2.064688206889847e-13
dMsolUnit = 4.8006351375833994e-08
Length unit: 1 Astronomical unit, Velocity unit: 1 km/s
dKpcUnit = 4.848101587970315e-09
dMsolUnit = 0.0011272388129170855
Length unit: 1 Astronomical unit, Mass unit: 1 Jupiter mass
dKpcUnit = 4.848101587970315e-09
dMsolUnit = 0.0009548380607523638