Physical constants
This page is a work in progress. If you have any questions or notice any errors, please raise an issue.
Overview
PhysicalConstants collects fundamental physical constants used throughout Terrarium's process implementations. All constants are stored as fields of a single struct so that they are passed explicitly through the call graph — avoiding global state and keeping the code fully differentiable with Enzyme.jl. The struct is parametrically typed so that constants are automatically promoted to the model's numeric precision NF.
Terrarium.PhysicalConstants — Type
struct PhysicalConstants{NF}A collection of general physical constants that do not (usually) need to be varied in parameter calibration.
Properties:
ρw: Density of water in kg/m^3ρi: Density of ice in kg/m^3ρₐ: Density of air at standard pressure and 0°C in kg/m^3cₐ: Specific heat capacity of dry air at standard pressure and 0°C in J/(m^3*K)Lsl: Sepcific latent heat of fusion of water in J/kgLlg: Specific latent heat of vaporization of water in J/kgLsg: Specific latent heat of sublimation of water in J/kgg: Gravitational constant in m/s^2Tref: Reference temperature (0°C in Kelvin)σ: Stefan-Boltzmann constant in J/(sm^2K^4)κ: von Kármán constantε: Ratio of molecular weight of water vapor to dry airRₐ: Specific gas constant of air in J/(kg*K)C_mass: Atomic mass of carbon [gC/mol]
Default values follow standard references. Individual constants can be overridden at construction to support unit-testing or sensitivity studies.
| Field | Symbol | Default | Units | Description |
|---|---|---|---|---|
ρw | $\rho_w$ | 1000.0 | kg/m³ | Density of liquid water |
ρi | $\rho_i$ | 916.2 | kg/m³ | Density of ice |
ρₐ | $\rho_a$ | 1.293 | kg/m³ | Density of dry air at 0°C, 1 atm |
cₐ | $c_a$ | 1005.7 | J/(kg·K) | Specific heat of dry air |
Lsl | $L_{sl}$ | 3.34×10⁵ | J/kg | Latent heat of fusion |
Llg | $L_{lv}$ | 2.257×10⁶ | J/kg | Latent heat of vaporization |
Lsg | $L_{sg}$ | 2.834×10⁶ | J/kg | Latent heat of sublimation |
g | $g$ | 9.80665 | m/s² | Gravitational acceleration |
Tref | $T_{\text{ref}}$ | 273.15 | K | Reference temperature (0°C) |
σ | $\sigma$ | 5.6704×10⁻⁸ | W/(m²·K⁴) | Stefan-Boltzmann constant |
κ | $\kappa$ | 0.4 | — | von Kármán constant |
ε | $\varepsilon$ | 0.622 | — | Ratio of molecular weights $M_v / M_d$ |
Rₐ | $R_a$ | 287.058 | J/(kg·K) | Specific gas constant of dry air |
C_mass | — | 12.0 | gC/mol | Molar mass of carbon |
Methods
Terrarium.celsius_to_kelvin — Function
celsius_to_kelvin(c::PhysicalConstants, T)Convert the given temperature in °C to Kelvin based on the constant Tref.
Terrarium.stefan_boltzmann — Function
stefan_boltzmann(c::PhysicalConstants, T, ϵ)Stefan-Boltzmann law $M = \epsilon \sigma T^4$ where T is the surface temperature in Kelvin and ϵ is the emissivity.
Terrarium.psychrometric_constant — Function
psychrometric_constant(c::PhysicalConstants, p)Calcualte the psychrometric constant at the given atmospheric pressure p.
Terrarium.compute_vpd — Function
compute_vpd(c, pres, q_air, T)
Computes the vapor pressure deficit over a surface at temperature T from the given surface pressure pres and specific humidity of air q_air.
compute_vpd(
i,
j,
grid,
fields,
atmos::Terrarium.AbstractAtmosphere,
c::PhysicalConstants
) -> Any
compute_vpd(
i,
j,
grid,
fields,
atmos::Terrarium.AbstractAtmosphere,
c::PhysicalConstants,
Ts
) -> Any
Computes the vapor pressure deficit over a surface at temperature Ts from the current atmospheric fields.