Physics utilities

Warning

This page is a work in progress. If you have any questions or notice any errors, please raise an issue.

Overview

This module provides small, self-contained thermodynamic and atmospheric utility functions that are shared across multiple process implementations. All functions are @inlined and scalar-valued; they are intended to be called from within kernel functions. Note that these functions are mostly intended for internal use within the Terrarium.jl codebase, and are therefore not exported as part of the public API. However, once can still access them via Terrarium.function_name if needed.

Some of the functionality here builds upon Thermodynamics.jl, which provides the basic thermodynamic building blocks, based on Rankine-Kirchhoff approximations. For a mathematical overview of these approximations, see here.

Saturation vapor pressure

The saturation vapor pressure $e_{\text{sat}}$ is computed using a wrapper around saturation_vapor_pressure from Thermodynamics.jl and is based on the integration of the Clausius-Clapeyron relation (see here for details).

Vapor pressure and humidity conversions

Specific humidity $q$ and vapor pressure $e$ conversions (including related variables like relative humidity) are handled by Thermodynamics.jl functions (or wrappers around these functions). Specifically:

\[\begin{equation} q = \frac{\varepsilon e}{p - e (1 - \varepsilon)} . \end{equation}\]

Partial pressures of trace gases

The partial pressures of O₂ and CO₂ are computed from total surface pressure and, for CO₂, the volumetric concentration in ppm:

\[\begin{align} p_{\text{O}_2} &= 0.209 \, p \\ p_{\text{CO}_2} &= C_{\text{CO}_2} \times 10^{-6} \times p \end{align}\]

Methods

Terrarium.relative_to_specific_humidityFunction
relative_to_specific_humidity(r_h, pr, T, c::ThermodynamicConstants)

Derives specific humidity from measured relative humidity r_h [%], air pressure pr [Pa], air temperature T [°C], and physical constants c. Assumes saturation over ice for T <= 0°C and over liquid water otherwise. Wrapper around q_vap_from_RH.

source

References

[24]
W. J. Shuttleworth. Water Vapor in the Atmosphere. In: Terrestrial Hydrometeorology (John Wiley & Sons, Ltd, 2012); Chapter 2, pp. 14–24.