Skip to content

Instantly share code, notes, and snippets.

@S-Yuan137
Last active August 27, 2025 02:14
Show Gist options
  • Save S-Yuan137/33a1489bfc5d697e0748b76e0228fdf8 to your computer and use it in GitHub Desktop.
Save S-Yuan137/33a1489bfc5d697e0748b76e0228fdf8 to your computer and use it in GitHub Desktop.
Unit conversion in CGS in star formation group

CGS Units conversion in star formation group

distance

Given $\pi \text{pc} = 96,939,420,213,600,000 \text{m}$, the exact value from 2015 IAU resolution B2. So

$$ 1 \text{pc} = 30,856,775,814,913,673 \text{m}, $$

to the nearest integer.

time

$$ 1 \text{Myr} = 86400 \times 365.25 \times 10^6 \text{s}, $$

1 Myr in seconds, using 1 million Julian years

Velocity

$$ 1 \text{km/s} \approx 1.023 \text{pc/Myr} $$

Alfvénic velocity

In CGS, it is

$$ v_A = \frac{B}{\sqrt{4\pi\rho}} $$

In SI, it is $v_A = \frac{B}{\sqrt{\mu_0\rho}}$

(nominal) Solar mass

$$ 1\mathrm{M_{\odot}} = 1.9884\times10^{30} \text{kg}, $$

derived by the $G$ value in CODATA 2018.

Magnetic field

Magnetic field strength:

  • In cgs unit, $[B] = [M]^{0.5}[L]^{-0.5}[T]^{-1}$

    • The value usually used in the code is $B/\sqrt{4\pi}$, ie., $B_{\text{code}} = B/\sqrt{4\pi}$

      • So in the initial conditions file, $B$ or $B/\sqrt{4\pi}$ is inputted ? You need to pay attention.
    • $1 \text{cm}^{-1/2}\text{g}^{1/2}\text{s}^{-1} = 1 \text{Gauss} = 10^{-4} \rm{T}$

    • $1 \text{pc}^{-1/2} \text{M}_{\odot}^{1/2} \text{Myr}^{-1} = 8.045\times10^{-7} \text{Gauss} = 0.8045\mu\text{G}$

Thermal

Boltzmann constant: $k_B = 1.380649 \times 10^{-23} \text{J/K}$ in SI unit. (CODATA 2018)

In cgs unit, $1 \text{J} = 10^{7} \text{erg} = 10^7 \text{g}\cdot \text{cm}^2 \text{s}^{-2}$

Thus, $k_B = 1.380649 \times 10^{-16} \text{erg/K}$

Gravity constant

Gravitation constant: $G = 6.67430 \times 10^{-11} \text{m}^3 \text{kg}^{-1} \text{s}^{-2}$ in SI unit. (CODATA 2018)

$G$ in pc-Myr-Msun unit is $4.4998 \times 10^{-3} \text{pc}^3 \text{Myr}^{-2} \text{M}_{\odot}^{-1}$

$G$ in km-s-Msun unit is $4.29977 \times 10^{-3} \text{km}^3 \text{s}^{-2} \text{M}_{\odot}^{-1}$

Jeans length and mass

Jeans length:

$$ \lambda_J = \sqrt{5c_s^2 /(2\pi G \rho)}, $$

where $c_s$ is the sound speed. (Some may use $\lambda_J = c_s/\sqrt{4\pi G\rho}$, e.g., doi: 10.3389/fspa.2019.00051

Jeans mass:

$$ M_J = \frac{4\pi}{3} \rho \lambda_J^3, $$

where $\rho$ is the density.

the ambipolar diffusion coefficient

A typical value of the ambipolar diffusion coefficient is given by Toth, 1994, ApJ, 425, 171, page 3

$$ \alpha = 3.7 \times 10^{13} \text{cm}^3 \text{s}^{-1}\text{g}^{-1} = 79047.6 \text{pc}^3 \text{Myr}^{-1} \text{M}_{\odot}^{-1} $$

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment