# Common formula

## gravity

1. Newton’s gravitational law

   symbol | description | unit
   --- | --- | ---
   \(g\) | normal gravity at sea level | \(\frac{m}{s^2}\)
   \(g_{h}\) | gravity at specific height | \(\frac{m}{s^2}\)
   \(z\) | altitude | \(m\)
   \(R\) | local earth curvature radius | \(m\)

   \[g_{h} = g\left(\frac{R}{R + z}\right)^2\]

2. Normal gravity at sea level ellipsoid

   This is the WGS84 ellipsoidal gravity formula as taken from NIMA TR8350.2

   symbol | name | unit
   --- | --- | ---
   \(a\) | WGS84 semi-major axis | \(m\)
   \(b\) | WGS84 semi-minor axis | \(m\)
   \(e\) | eccentricity | \(m\)
   \(g\) | normal gravity at sea level | \(\frac{m}{s^2}\)
   \(g_{e}\) | gravity at equator | \(\frac{m}{s^2}\)
   \(g_{p}\) | gravity at poles | \(\frac{m}{s^2}\)
   \(\phi\) | latitude | \(degN\)

   \begin{eqnarray} e^2 & = & \frac{a^2-b^2}{a^2} \\ k & = & \frac{bg_{p} - ag_{e}}{ag_{e}} \\ g & = & g_{e}\frac{1 + k {\sin}^2(\frac{\pi}{180}\phi)}{\sqrt{1 - e^2{\sin}^2(\frac{\pi}{180}\phi)}} \\ g & = & 9.7803253359 \frac{1 + 0.00193185265241{\sin}^2(\frac{\pi}{180}\phi)} {\sqrt{1 - 0.00669437999013{\sin}^2(\frac{\pi}{180}\phi)}} \end{eqnarray}

3. Gravity at specific altitude

   This is the WGS84 ellipsoidal gravity formula as taken from NIMA TR8350.2

   symbol | name | unit
   --- | --- | ---
   \(a\) | WGS84 semi-major axis | \(m\)
   \(b\) | WGS84 semi-minor axis | \(m\)
   \(f\) | WGS84 flattening | \(m\)
   \(g\) | normal gravity at sea level | \(\frac{m}{s^2}\)
   \(g_{h}\) | gravity at specific height | \(\frac{m}{s^2}\)
   \(GM\) | WGS84 earth’s gravitational constant | \(\frac{m^3}{s^2}\)
   \(z\) | altitude | \(m\)
   \(\phi\) | latitude | \(degN\)
   \(\omega\) | WGS84 earth angular velocity | \(rad/s\)

   The formula used is the one based on the truncated Taylor series expansion:

   \begin{eqnarray} m & = & \frac{\omega^2a^2b}{GM} \\ g_{h} & = & g \left[ 1 - \frac{2}{a}\left(1+f+m-2f{\sin}^2(\frac{\pi}{180}\phi)\right)z + \frac{3}{a^2}z^2 \right] \\ \end{eqnarray}

## geopotential height

> symbol | description | unit
> --- | --- | ---
> \(g\) | normal gravity at sea level | \(\frac{m}{s^2}\)
> \(g_{0}\) | mean earth gravity | \(\frac{m}{s^2}\)
> \(g_{h}\) | gravity at specific height | \(\frac{m}{s^2}\)
> \(p\) | pressure | \(Pa\)
> \(R\) | local earth curvature radius | \(m\)
> \(z\) | altitude | \(m\)
> \(z_{g}\) | geopotential height | \(m\)
> \(\phi\) | latitude | \(degN\)
> \(\rho\) | mass density | \(\frac{kg}{m^3}\)

> The geopotential height allows the gravity in the hydrostatic equation

> \[dp = - \rho g_{h} dz\]

> to be replaced by a constant gravity

> \[dp = - \rho g_{0} dz_{g}\]

> providing

> \[dz_{g} = \frac{g_{h}}{g_{0}}dz\]

> With Newton’s gravitational law this becomes

> \[dz_{g} = \frac{g}{g_{0}}\left(\frac{R}{R + z}\right)^2dz\]

> And integrating this, considering that \(z=0\) and \(z_{g}=0\) at sea level, results in

> \[z_{g} = \frac{g}{g_{0}}\frac{Rz}{R + z}\]
> \[z = \frac{g_{0}Rz_{g}}{gR-g_{0}z_{g}}\]

## gas constant

> symbol | name | unit
> --- | --- | ---
> \(k\) | Boltzmann constant | \(\frac{kg m^2}{K s^2}\)
> \(N_A\) | Avogadro constant | \(\frac{1}{mol}\)
> \(R\) | universal gas constant | \(\frac{kg m^2}{K mol s^2}\)

> Relation between Boltzmann constant, universal gas constant, and Avogadro constant:

> \[k = \frac{R}{N_A}\]

## ideal gas law

> symbol | name | unit
> --- | --- | ---
> \(k\) | Boltzmann constant | \(\frac{kg m^2}{K s^2}\)
> \(N\) | amount of substance | \(molec\)
> \(p\) | pressure | \(Pa\)
> \(R\) | universal gas constant | \(\frac{kg m^2}{K mol s^2}\)
> \(T\) | temperature | \(K\)
> \(V\) | volume | \(m^3\)

> \[pV = \frac{NRT}{N_{A}} = NkT\]

## barometric formula

> symbol | name | unit
> --- | --- | ---
> \(g_{0}\) | mean earth gravity | \(\frac{m}{s^2}\)
> \(g_{h}\) | gravity at specific height | \(\frac{m}{s^2}\)
> \(k\) | Boltzmann constant | \(\frac{kg m^2}{K s^2}\)
> \(M_{air}\) | molar mass of total air | \(\frac{g}{mol}\)
> \(N\) | amount of substance | \(molec\)
> \(N_A\) | Avogadro constant | \(\frac{1}{mol}\)
> \(p\) | pressure | \(Pa\)
> \(R\) | universal gas constant | \(\frac{kg m^2}{K mol s^2}\)
> \(T\) | temperature | \(K\)
> \(V\) | volume | \(m^3\)
> \(z\) | altitude | \(m\)
> \(z_{g}\) | geopotential height | \(m\)
> \(\phi\) | latitude | \(degN\)
> \(\rho\) | mass density | \(\frac{kg}{m^3}\)

> From the ideal gas law we have:

> \[p = \frac{NkT}{V} = \frac{10^{-3}NM_{air}}{VN_{a}}\frac{kTN_{a}}{10^{-3}M_{air}} = \rho\frac{RT}{10^{-3}M_{air}}\]

> And from the hydrostatic assumption we get:

> \[dp = - \rho g_{h} dz\]

> Dividing \(dp\) by p we get:

> \[\frac{dp}{p} = -\frac{10^{-3}M_{air}\rho g_{h} dz}{\rho RT} = -\frac{10^{-3}M_{air}g_{h}dz}{RT}\]

> Integrating this expression from one pressure level to the next we get:

> \[p(i+1) = p(i)e^{-\int^{z(i+1)}_{z(i)}\frac{10^{-3}M_{air}g_{h}}{RT}dz}\]

> We can approximate this further by using an average value of the height dependent quantities \(M_{air}\), \(g_{h}\) and \(T\) for the integration over the range \([z(i),z(i+1)]\). This gives:

> \begin{eqnarray} g' & = & g_{h}(\phi,\frac{z(i)+z(i+1)}{2}) \\ p(i+1) & = & p(i)e^{-10^{-3}\frac{M_{air}(i)+M_{air}(i+1)}{2}\frac{2}{T(i)+T(i+1)}\frac{g'}{R}\left(z(i+1)-z(i)\right)} \\ & = & p(i)e^{-10^{-3}\frac{M_{air}(i)+M_{air}(i+1)}{T(i)+T(i+1)}\frac{g'}{R}\left(z(i+1)-z(i)\right)} \end{eqnarray}

> When using geopotential height the formula is the same except that \(g=g_{0}\) at all levels:

> \[p(i+1) = p(i)e^{-10^{-3}\frac{M_{air}(i)+M_{air}(i+1)}{T(i)+T(i+1)}\frac{g_{0}}{R}\left(z_{g}(i+1)-z_{g}(i)\right)}\]

## mass density

> symbol | name | unit
> --- | --- | ---
> \(N\) | amount of substance | \(molec\)
> \(N_A\) | Avogadro constant | \(\frac{1}{mol}\)
> \(M_{air}\) | molar mass of total air | \(\frac{g}{mol}\)
> \(V\) | volume | \(m^3\)
> \(\rho\) | mass density | \(\frac{kg}{m^3}\)

> \[\rho = \frac{10^{-3}NM_{air}}{VN_{a}}\]

## number density

> symbol | name | unit
> --- | --- | ---
> \(n\) | number density | \(\frac{molec}{m^3}\)
> \(N\) | amount of substance | \(molec\)
> \(V\) | volume | \(m^3\)

> \[n = \frac{N}{V}\]

## dry air vs. total air

> symbol | name | unit
> --- | --- | ---
> \(n\) | number density of total air | \(\frac{molec}{m^3}\)
> \(n_{dry\_air}\) | number density of dry air | \(\frac{molec}{m^3}\)
> \(n_{H_{2}O}\) | number density of H2O | \(\frac{molec}{m^3}\)
> \(M_{air}\) | molar mass of total air | \(\frac{g}{mol}\)
> \(M_{dry\_air}\) | molar mass of dry air | \(\frac{g}{mol}\)
> \(M_{H_{2}O}\) | molar mass of H2O | \(\frac{g}{mol}\)
> \(\rho\) | mass density of total air | \(\frac{kg}{m^3}\)
> \(\rho_{dry\_air}\) | mass density of dry air | \(\frac{kg}{m^3}\)
> \(\rho_{H_{2}O}\) | mass density of H2O | \(\frac{kg}{m^3}\)

> \begin{eqnarray} n & = & n_{dry\_air} + n_{H_{2}O} \\ M_{air}n & = & M_{dry\_air}n_{dry\_air} + M_{H_{2}O}n_{H_{2}O} \\ \rho & = & \rho_{dry\_air} + \rho_{H_{2}O} \\ \end{eqnarray}

## virtual temperature

> symbol | name | unit
> --- | --- | ---
> \(k\) | Boltzmann constant | \(\frac{kg m^2}{K s^2}\)
> \(M_{air}\) | molar mass of total air | \(\frac{g}{mol}\)
> \(M_{dry\_air}\) | molar mass of dry air | \(\frac{g}{mol}\)
> \(M_{H_{2}O}\) | molar mass of H2O | \(\frac{g}{mol}\)
> \(N\) | amount of substance | \(molec\)
> \(N_A\) | Avogadro constant | \(\frac{1}{mol}\)
> \(p\) | pressure | \(Pa\)
> \(p_{dry\_air}\) | dry air partial pressure | \(Pa\)
> \(p_{H_{2}O}\) | H2O partial pressure | \(Pa\)
> \(R\) | universal gas constant | \(\frac{kg m^2}{K mol s^2}\)
> \(T\) | temperature | \(K\)
> \(T_{v}\) | virtual temperature | \(K\)
> \(V\) | volume | \(m^3\)

> From the ideal gas law we have:

> \[p = \frac{NkT}{V} = \frac{10^{-3}NM_{air}}{VN_{a}}\frac{kTN_{a}}{10^{-3}M_{air}} = \rho \frac{RT}{10^{-3}M_{air}}\]

> The virtual temperature allows us to use the dry air molar mass in this equation:

> \[p = \rho\frac{RT_{v}}{10^{-3}M_{dry\_air}}\]

> This gives:

> \[T_{v} = \frac{M_{dry\_air}}{M_{air}}T\]

## volume mixing ratio

> symbol | name | unit
> --- | --- | ---
> \(n\) | number density of total air | \(\frac{molec}{m^3}\)
> \(n_{dry\_air}\) | number density of dry air | \(\frac{molec}{m^3}\)
> \(n_{H_{2}O}\) | number density of H2O | \(\frac{molec}{m^3}\)
> \(n_{x}\) | number density of quantity x | \(\frac{molec}{m^3}\)
> \(\nu_{x}\) | volume mixing ratio of quantity x with regard to total air | \(ppv\)
> \(\bar{\nu}_{x}\) | volume mixing ratio of quantity x with regard to dry air | \(ppv\)

> \begin{eqnarray} \nu_{x} & = & \frac{n_{x}}{n} \\ \bar{\nu}_{x} & = & \frac{n_{x}}{n_{dry\_air}} \\ \nu_{dry\_air} & = & \frac{n_{dry\_air}}{n} = \frac{n - n_{H_{2}O}}{n} = 1 - \nu_{H_{2}O} \\ \nu_{air} & = & \frac{n}{n} = 1 \\ \bar{\nu}_{dry\_air} & = & \frac{n_{dry\_air}}{n_{dry\_air}} = 1 \\ \bar{\nu}_{H_{2}O} & = & \frac{n_{H_{2}O}}{n_{dry\_air}} = \frac{\nu_{H_{2}O}}{\nu_{dry\_air}} = \frac{\nu_{H_{2}O}}{1 - \nu_{H_{2}O}} \\ \nu_{H_{2}O} & = & \frac{\bar{\nu}_{H_{2}O}}{1 + \bar{\nu}_{H_{2}O}} \end{eqnarray}

## mass mixing ratio

> symbol | name | unit
> --- | --- | ---
> \(M_{air}\) | molar mass of total air | \(\frac{g}{mol}\)
> \(M_{dry\_air}\) | molar mass of dry air | \(\frac{g}{mol}\)
> \(M_{x}\) | molar mass of quantity x | \(\frac{g}{mol}\)
> \(n\) | number density of total air | \(\frac{molec}{m^3}\)
> \(n_{dry\_air}\) | number density of dry air | \(\frac{molec}{m^3}\)
> \(n_{H_{2}O}\) | number density of H2O | \(\frac{molec}{m^3}\)
> \(n_{x}\) | number density of quantity x | \(\frac{molec}{m^3}\)
> \(q_{x}\) | mass mixing ratio of quantity x with regard to total air | \(\frac{kg}{kg}\)
> \(\bar{q}_{x}\) | mass mixing ratio of quantity x with regard to dry air | \(\frac{kg}{kg}\)
> \(\nu_{x}\) | volume mixing ratio of quantity x with regard to total air | \(ppv\)
> \(\bar{\nu}_{x}\) | volume mixing ratio of quantity x with regard to dry air | \(ppv\)

> \begin{eqnarray} q_{x} & = & \frac{n_{x}M_{x}}{nM_{air}} = \nu_{x}\frac{M_{x}}{M_{air}} \\ \bar{q}_{x} & = & \frac{n_{x}M_{x}}{n_{dry\_air}M_{dry\_air}} = \bar{\nu}_{x}\frac{M_{x}}{M_{dry\_air}} \\ q_{dry\_air} & = & \frac{n_{dry\_air}M_{dry\_air}}{nM_{air}} = \frac{nM_{air} - n_{H_{2}O}M_{H_{2}O}}{nM_{air}} = 1 - q_{H_{2}O} \\ q_{air} & = & \frac{nM_{air}}{nM_{air}} = 1 \\ \bar{q}_{dry\_air} & = & \frac{n_{dry\_air}M_{dry\_air}}{n_{dry\_air}M_{dry\_air}} = 1 \\ \bar{q}_{H_{2}O} & = & \frac{n_{H_{2}O}M_{H_{2}O}}{n_{dry\_air}M_{dry\_air}} = \frac{q_{H_{2}O}}{q_{dry\_air}} = \frac{q_{H_{2}O}}{1 - q_{H_{2}O}} \\ q_{H_{2}O} & = & \frac{\bar{q}_{H_{2}O}}{1 + \bar{q}_{H_{2}O}} \end{eqnarray}

## molar mass of total air

1. molar mass of total air from H2O volume mixing ratio

   symbol | name | unit
   --- | --- | ---
   \(M_{air}\) | molar mass of total air | \(\frac{g}{mol}\)
   \(M_{dry\_air}\) | molar mass of dry air | \(\frac{g}{mol}\)
   \(M_{H_{2}O}\) | molar mass of H2O | \(\frac{g}{mol}\)
   \(n\) | number density of total air | \(\frac{molec}{m^3}\)
   \(n_{dry\_air}\) | number density of dry air | \(\frac{molec}{m^3}\)
   \(n_{H_{2}O}\) | number density of H2O | \(\frac{molec}{m^3}\)
   \(\nu_{H_{2}O}\) | volume mixing ratio of H2O | \(ppv\)

   \begin{eqnarray} M_{air} & = & \frac{M_{dry\_air}n_{dry\_air} + M_{H_{2}O}n_{H_{2}O}}{n} \\ & = & M_{dry\_air}\left(1 - \nu_{H_{2}O}\right) + M_{H_{2}O}\nu_{H_{2}O} \end{eqnarray}

2. molar mass of total air from H2O mass mixing ratio

   symbol | name | unit
   --- | --- | ---
   \(M_{air}\) | molar mass of total air | \(\frac{g}{mol}\)
   \(M_{dry\_air}\) | molar mass of dry air | \(\frac{g}{mol}\)
   \(M_{H_{2}O}\) | molar mass of H2O | \(\frac{g}{mol}\)
   \(n\) | number density of total air | \(\frac{molec}{m^3}\)
   \(n_{dry\_air}\) | number density of dry air | \(\frac{molec}{m^3}\)
   \(n_{H_{2}O}\) | number density of H2O | \(\frac{molec}{m^3}\)
   \(q_{H_{2}O}\) | mass mixing ratio of H2O | \(\frac{kg}{kg}\)
   \(\nu_{H_{2}O}\) | volume mixing ratio of H2O | \(\frac{kg}{kg}\)

   \begin{eqnarray} M_{air} & = & M_{dry\_air}\left(1 - \nu_{H_{2}O}\right) + M_{H_{2}O}\nu_{H_{2}O} \\ & = & M_{dry\_air}\left(1 - \frac{M_{air}}{M_{H_{2}O}}q_{H_{2}O}\right) + M_{air}q_{H_{2}O} \\ & = & \frac{M_{dry\_air}}{1 + \frac{M_{dry\_air}}{M_{H_{2}O}}q_{H_{2}O} - q_{H_{2}O}} \\ & = & \frac{M_{H_{2}O}M_{dry\_air}}{M_{H_{2}O} + M_{dry\_air}q_{H_{2}O} - M_{H_{2}O}q_{H_{2}O}} \\ & = & \frac{M_{H_{2}O}M_{dry\_air}}{\left(1-q_{H_{2}O}\right)M_{H_{2}O} + q_{H_{2}O}M_{dry\_air}} \\ \end{eqnarray}

## partial pressure

> symbol | name | unit
> --- | --- | ---
> \(p\) | total pressure | \(Pa\)
> \(p_{x}\) | partial pressure of quantity | \(Pa\)
> \(\nu_{x}\) | volume mixing ratio of quantity x with regard to total air | \(ppv\)
> \(\bar{\nu}_{x}\) | volume mixing ratio of quantity x with regard to dry air | \(ppv\)

> \begin{eqnarray} p_{x} & = & \nu_{x}p \\ p_{x} & = & \bar{\nu}_{x}p_{dry\_air} \\ p_{x} & = & N_{x}kT \end{eqnarray}

## saturated water vapor pressure

> symbol | name | unit
> --- | --- | ---
> \(e_{w}\) | saturated water vapor pressure | \(Pa\)
> \(T\) | temperature | \(K\)

> This is the August-Roche-Magnus formula for the saturated water vapor pressure

> \[e_{w} = 610.94e^{\frac{17.625(T-273.15)}{(T-273.15)+243.04}}\]