- Introduction
- Fundamental Assumptions
- Working Fluid and Equation of State
- Heat Capacities
- Latent Heats
- Internal Energies
- Enthalpies
- Moist Static Energy
- Saturation Vapor Pressure
- Saturation Specific Humidity
- Saturation Adjustment
- Auxiliary Thermodynamic Functions
- Summary and Implementation Guidelines
!!! note "Cross-References"
This documentation is closely related to the API documentation which provides detailed function signatures and usage examples. The theoretical framework described here is implemented in the Thermodynamics.jl package.
Here we introduce one consistent set of thermodynamic approximations for all model components. The key to thermodynamic consistency at reasonable accuracy is to take the specific heat capacities of the constituents of moist air (dry air, water vapor, liquid water, and ice) to be constant, i.e., to assume the gases to be calorically perfect. We discuss how to derive all other thermodynamic quantities that are needed on the basis of this one approximation (Yatunin2026Romps2008,Ambaum2020, Romps2021). This includes:
- Giving accurate and easily adaptable closed-form expressions for internal energies, enthalpies, specific latent heats, and saturation vapor pressures
- Showing how to construct consistent sets of thermodynamic equations that either (i) assume phase equilibrium and require only one prognostic water variable, or (ii) do not assume phase equilibrium (but do assume thermal equilibrium) and require prognostic variables for all water phases
- Showing how to obtain temperatures from energy variables under either phase equilibrium assumptions (by
saturation adjustment) or phase non-equilibrium assumptions (by a closed-form expression for temperature).
The resulting thermodynamic functions are implemented in Thermodynamics.jl.
Specific thermodynamic formulations often vary in how they approximate the relevant material properties. The formulation used in Thermodynamics.jl balances three criteria:
- Accuracy: The formulation is accurate enough for atmospheric modeling (e.g., errors in saturation vapor pressure are within a few percent).
- Consistency: The formulation is thermodynamically consistent (e.g., it conserves energy and satisfies the Clausius-Clapeyron relation).
- Simplicity and Efficiency: The formulation leads to closed-form expressions that can be evaluated efficiently.
The implementation follows the thermodynamic formulation of the CliMA Earth System Model Yatunin2026. It relies on the Rankine-Kirchhoff approximations, which provide a consistent framework for moist thermodynamics Romps2021.
Specific choices of thermodynamic constants have been made in ClimaParams.jl to maximize accuracy given the Rankine-Kirchhoff approximations (Ambaum2020, Yatunin2026).
!!! note "Physical Motivation" The assumption of calorically perfect gases (constant specific heat capacities) is justified for atmospheric conditions because the error of approximating them as constant is less than 1% for dry air, the main constituent of moist air, and at most a few percent for the water phases. This approximation enables closed-form expressions for all thermodynamic quantities while maintaining sufficient accuracy for atmospheric modeling.
Our thermodynamic framework is based on the following fundamental assumptions:
- Ideal Gas Law: Dry air and water vapor behave as ideal gases
- Calorically Perfect Gases: Specific heat capacities are constant (temperature-independent)
- Negligible Condensate Volume: The specific volume of liquid water and ice is neglected relative to gas phases
- Thermal Equilibrium: All phases have the same temperature
- Reference State: All thermodynamic quantities are defined relative to a reference temperature
T₀
!!! tip "Implementation Note" These assumptions enable closed-form expressions for all thermodynamic quantities, making the implementation computationally efficient while maintaining sufficient accuracy for atmospheric modeling.
The working fluid is moist air. That is, it is an ideal mixture of dry air, water vapor, and condensed water (liquid and ice). Atmospheric models may choose to include precipitation (e.g., rain, snow, graupel) within the definitions of the condensed water specific humidities (
!!! note "Modeling Choice: Precipitation Included in Working Fluid" In the CliMA Earth System Model, precipitation is included as part of the working fluid. This choice means: - Mass and energy conservation are maintained across all phases (including precipitation) - Thermodynamic consistency is preserved throughout the system - All condensed water phases (cloud and precipitation) are assumed to be in thermal equilibrium with the surrounding air (which is an approximation, see Yatunin2026 for discussion)
Dry air and water vapor are taken to be ideal gases. The specific volume of all condensed phases (cloud liquid, cloud ice, and potentially precipitation) is neglected relative to that of the gas phases (it is a factor
!!! tip "Implementation Note"
When precipitation is included in the working fluid, its mass contributes to the total water content Thermodynamics.jl package.
!!! info "Sidebar: Pros and Cons of Including Precipitation in the Working Fluid" Pros: - Ensures mass and energy conservation across all phases - Simplifies the thermodynamic framework and implementation - Enables consistent inclusion of microphysics schemes that treat hydrometeors as occupying a continuous spectrum (without artificial spectral gaps between cloud condensate and precipitation)
**Cons:**
- Assumes precipitation is in thermal equilibrium with air, which may not always be true (e.g., large raindrops or hail)
See [Yatunin2026](@cite) for further discussion and justification of this modeling choice.
The density of the moist air is denoted by
| Symbol | Definition |
|---|---|
| dry air mass fraction | |
| water vapor specific humidity | |
| liquid water specific humidity (includes both cloud liquid and precipitating liquid) | |
| ice specific humidity (includes both cloud ice and precipitating ice/snow) | |
| condensate specific humidity (all condensed water, cloud + precipitation) | |
| total specific humidity (all water phases) |
!!! note "Precipitation Inclusion"
The liquid and ice specific humidities
Because this enumerates all constituents of the working fluid, we have
The pressure
!!! note "Precipitation and the Equation of State" Although precipitation is included in the working fluid, it does not contribute to the pressure because its specific volume is neglected. However, precipitation mass affects the density andspecific heat capacity.
This can also be written as
where
is the specific gas constant of moist air (which varies with composition); here, we have used
!!! note "Mathematical Note"
Although called a "constant,"
Equations \eqref{e:eos} and \eqref{e:Rm} constitute the equation of state of the working fluid. We use the notation
!!! example "Typical Values" For Earth's atmosphere at sea level:
| Quantity | Value |
|----------|-------|
| $R_d$ | $287.0$ J/(kg·K) |
| $R_v$ | $461.5$ J/(kg·K) |
| $\varepsilon_{dv}$ | $1.61$ |
| $R_m$ (typical moist air, $q_t = 0.01$) | $288.7$ J/(kg·K) |
| $R_m$ (air with precipitation, $q_t = 0.015$) | $289.0$ J/(kg·K) |
The isochoric specific heat capacities of the constituents of moist air are:
| Symbol | Definition |
|---|---|
| Isochoric specific heat capacity of dry air | |
| Isochoric specific heat capacity of water vapor | |
| Isochoric specific heat capacity of liquid water | |
| Isochoric specific heat capacity of ice |
Our key thermodynamic approximation is to take these isochoric specific heat capacities to be constants, i.e., we take the gases to be calorically perfect. This is an approximation because they depend weakly on temperature. But for atmospheric conditions, the error of approximating them as constant is less than 1% for dry air, the main constituent of moist air, and at most a few percent for the water phases.
The difference between the isochoric and isobaric specific heat capacities is proportional to the specific volume. Consistent with taking the specific volume of liquid water and ice to be zero, we take the isochoric and isobaric specific heat capacities of the condensed phases to be equal. The isobaric specific heat capacities of the constituents then are:
| Symbol | Definition |
|---|---|
| Isobaric specific heat capacity of dry air | |
| Isobaric specific heat capacity of water vapor | |
| Isobaric specific heat capacity of liquid water | |
| Isobaric specific heat capacity of ice |
!!! tip "Implementation Note"
The relationship
The corresponding specific heat capacities of moist air are the weighted sum of those of the constituents:
where
!!! note "Mathematical Note"
The second form of the equation is computationally more efficient as it avoids computing
Straightforward substitution shows that the above relation between the specific heat capacities of the constituents also holds for moist air as a whole:
!!! example "Typical Values" For Earth's atmosphere at standard conditions:
| Quantity | Value |
|----------|-------|
| $c_{vd}$ | $717.6$ J/(kg·K) |
| $c_{vv}$ | $1410.0$ J/(kg·K) |
| $c_{vl}$ | $4219.0$ J/(kg·K) |
| $c_{vi}$ | $2106.0$ J/(kg·K) |
| $c_{vm}$ (typical moist air, $q_t = 0.01$) | $720.0$ J/(kg·K) |
| $c_{pm}$ (typical moist air, $q_t = 0.01$) | $1008.0$ J/(kg·K) |
!!! tip "Implementation Note"
The specific heat capacities are implemented as weighted sums in the cp_m and cv_m functions. The implementation uses the rearranged form of equation \eqref{e:SpecificHeat} for computational efficiency.
Kirchhoff's relation states that the specific latent enthalpy (heat)
where
where
!!! note "Physical Interpretation" Kirchhoff's relation follows from the fact that the enthalpy difference between phases changes with temperature due to the different heat capacities of the phases. The latent heat represents the energy required to transform a unit mass from one phase to another at constant pressure.
!!! tip "Implementation Note" The linear temperature dependence of latent heats enables closed-form expressions for saturation vapor pressure and other thermodynamic quantities. This approximation is accurate to within a few percent for atmospheric temperature ranges.
For the phase transitions of water, this implies specifically:
| Formula | Description |
|---|---|
| Latent heat of vaporization | |
| Latent heat of fusion | |
| Latent heat of sublimation |
With
!!! example "Typical Values"
At the reference temperature
| Quantity | Value |
|----------|-------|
| $L_{v,0}$ | $2.501 \times 10^6$ J/kg (latent heat of vaporization) |
| $L_{f,0}$ | $0.334 \times 10^6$ J/kg (latent heat of fusion) |
| $L_{s,0}$ | $2.835 \times 10^6$ J/kg (latent heat of sublimation) |
At $T = 300$ K:
| Quantity | Value |
|----------|-------|
| $L_v$ | $2.430 \times 10^6$ J/kg |
| $L_f$ | $0.334 \times 10^6$ J/kg |
| $L_s$ | $2.764 \times 10^6$ J/kg |
!!! tip "Implementation Note"
The latent heats are implemented in the latent_heat_vapor, latent_heat_fusion, and latent_heat_sublim functions. The weighted latent heat for mixed-phase conditions is computed in latent_heat_mixed.
The specific internal energies of the constituents of moist air can be written as
Here, the reference specific internal energy
!!! note "Physical Interpretation"
The internal energy represents the total energy of a substance excluding kinetic and potential energy. The reference energies
The internal energy of moist air is the weighted sum of that of the constituents:
!!! tip "Implementation Note"
The internal energy is implemented as a weighted sum of constituent energies in the internal_energy function. The constituent energies are computed separately in internal_energy_dry, internal_energy_vapor, internal_energy_liquid, and internal_energy_ice.
The internal energy can be inverted to obtain the temperature given
where we have used
!!! note "Mathematical Note" The temperature recovery equation \eqref{e:temperature} is crucial to compute temperature from internal energy and composition when internal (or total) energy is used as a prognostic variable. This inversion is possible because internal energy is a monotonic function of temperature for our assumptions.
The reference specific internal energies
!!! example "Typical Values"
At the reference temperature
| Quantity | Value |
|----------|-------|
| $I_{v,0}$ | $2.501 \times 10^6$ J/kg (vapor reference energy) |
| $I_{i,0}$ | $0.334 \times 10^6$ J/kg (ice reference energy) |
For typical moist air at $T = 300$ K with $q_t = 0.01$:
| Quantity | Value |
|----------|-------|
| $I$ | $21.5 \times 10^3$ J/kg (total internal energy) |
The specific enthalpies of the constituents of moist air are obtained by adding
The formulation is reference-temperature invariant, meaning that the physics is independent of the choice of the arbitrary reference temperature
!!! note "Physical Interpretation"
Enthalpy represents the total energy of a substance including the work done against pressure. For ideal gases, enthalpy includes the
The enthalpy of moist air is the weighted sum of the constituent enthalpies:
where the last equality used
!!! tip "Implementation Note"
The enthalpy is implemented in the enthalpy function. The relationship
The enthalpy is the relevant thermodynamic energy quantity in fluid transport. It arises in boundary conditions for energy fluxes and in the modeling of subgrid-scale (SGS) turbulent transport.
!!! example "Typical Values"
For typical moist air at
The sum of the specific enthalpy of moist air and the specific gravitational potential energy Φ is the moist static energy Neelin1987
Moist static energy arises naturally as the static energy component that is transported in moist air. "Static" here refers to the fact that the (small) kinetic energy contribution to the total energy is neglected. The global integral of moist static energy is approximately conserved in adiabatic processes, even in the presence of reversible phase transitions and latent heat release. It is also approximately materially conserved Romps2015.
The Clausius-Clapeyron relation describes how the saturation vapor pressure
Here,
Substituting the linear relation \eqref{e:LHTemperature} between latent heat and temperature, and taking
!!! tip "Implementation Note"
The saturation vapor pressure is implemented in the saturation_vapor_pressure function. The closed-form expression enables efficient computation without numerical integration.
With Thermodynamics.jl (specified in ClimaParams.jl) are chosen to minimize errors in the Rankine-Kirchhoff approximation Yatunin2026.
!!! example "Typical Values"
At
| Quantity | Value |
|----------|-------|
| $p_v^*$ (liquid) | $3537$ Pa |
| $p_v^*$ (ice) | $286$ Pa |
At $T = 273.15$ K (triple point):
| Quantity | Value |
|----------|-------|
| $p_v^*$ (liquid) = $p_v^*$ (ice) | $611$ Pa |
The ratio of liquid to ice saturation vapor pressure at 300 K is approximately 12.4, reflecting the higher energy required for sublimation compared to vaporization.
To obtain the saturation vapor pressure over a mixture of liquid and ice (e.g., in mixed-phase clouds), using a weighted average of the relevant specific latent heats in the vapor pressure \eqref{e:SatVaporPressure} leads to a thermodynamically consistent formulation Pressel2015. That is, if a fraction
!!! note "Physical Interpretation" The weighted latent heat approach ensures thermodynamic consistency when computing saturation vapor pressure over mixed-phase conditions. This is important for modeling mixed-phase clouds where both liquid and ice coexist.
In phase equilibrium, the liquid fraction Thermodynamics.jl, this is parameterized following Kaul2015 as a power-law ramp interpolation, with some exponent
This smooth transition represents the statistical presence of supercooled liquid in a phase equilibrium framework.
Out of phase equilibrium, when prognostic variables for liquid (
This definition makes no assumption about the temperature dependence of the phase partitioning and allows for phase non-equilibrium states (e.g., supercooled liquid at temperatures where the equilibrium function would force freezing).
!!! tip "Implementation Note"
The liquid_fraction function in Thermodynamics.jl dispatches on the arguments provided.
- liquid_fraction(param_set, T) computes the phase equilibrium temperature-dependent fraction.
- liquid_fraction(param_set, T, q_liq, q_ice) computes the fraction from specific humidities. If no condensate is present (q_liq + q_ice ≈ 0), it falls back to a slightly smoothed Heaviside function (a linear ramp over
From the saturation vapor pressure $p_v^$, the saturation specific humidity can be computed using the ideal gas law \eqref{e:eos}, giving the density of water vapor at saturation $\rho_v^ = p_v^*(T)/(R_v T)$, and hence the saturation specific humidity
The thermodynamic state of a moist air parcel in local phase equilibrium is uniquely defined by its density
Obtaining the temperature and condensate specific humidities from the state variables
where I^*(T; \rho, q_t) is the internal energy at phase equilibrium. In an unsaturated equilibrium, there is no condensate, so I^* is the internal energy with q_l=q_i=0. At saturation, the internal energy I^* depends on the vapor specific humidity, q_v = q_v^*(T, \rho), and on the saturation excess (total condensate)
which is partitioned according to the liquid fraction λ_p into
In saturated conditions, finding the root of \eqref{e:SatAdjustment} is a nonlinear problem, which must be solved iteratively or approximately, in what is known as a saturation adjustment procedure.
A zeroth-order approximation of the temperature
Here, the isochoric specific heat capacity in phase equilibrium, $c_{vm}^* = c_{vm}(q^)$, is the specific heat capacity under phase equilibrium partitioning $q^$ of the phases, which here, for unsaturated conditions, means $q^=(q_t; q_l=0, q_i=0)$. If the total specific humidity $q_t$ is less than the saturation specific humidity at $T_1$ ($q_t \le q_v^(T_1, \rho)$), the air is indeed unsaturated, and
If the air is saturated ($q_t > q_v^(T_1, \rho)$), successively improved temperature estimates $T_{n+1}$ can be obtained from the temperature $T_n$ ($n=1,\dots$) by Newton's method. Linearizing the saturation internal energy $I^(T; \rho, q_t)$ around the temperature
and solving for the temperature
The derivative \partial I^*/\partial T|_{T_n} is obtained by differentiation of the internal energy \eqref{e:TotalInternalEnergy}. The implementation in Thermodynamics.jl includes the full derivative, including the temperature dependence of the liquid fraction
where
which follows from differentiation of the ideal gas law for vapor and the Clausius-Clapeyron relation. Note the inclusion of the
The resulting successive Newton approximations liquid_fraction), the derivative of
Using saturation adjustment makes it possible to construct a moist dynamical core that has the total specific humidity
Several auxiliary thermodynamic functions are commonly used.
The relative humidity is defined as the ratio of the partial pressure of water vapor
Using the ideal gas law for water vapor, p_v = q_v \rho R_v T, this can be written as
where p_v^* is the saturation vapor pressure \eqref{e:SatVaporPressure}. Over a mixture of ice and liquid, the saturation vapor pressure \eqref{e:SatVaporPressure} is evaluated with a specific latent heat L = λ_p L_v + (1-λ_p) L_s that is a weighted sum of those for vaporization and sublimation.
The potential temperature
where \Pi is known as the Exner function
Note that the adiabatic exponent
The virtual or density temperature
A virtual potential temperature can be defined analogously:
!!! note "Relationship between virtual temperature and 'density temperature'"
Some texts distinguish a "(condensate-ignoring) virtual temperature" and a "density temperature", and an analogous condensate-ignoring virtual potential temperature and density potential temperature.
In those texts, the definition of density temperature incorporates condensate mass but their "condensate-ignoring virtual temperature" does not.
We always take the mass of any condensate into account in the thermodynamics of moist air, so this distinction is irrelevant here.
In other words, because the virtual temperature defined above incorporates the mass of condensate into R_m(q) (and virtual potential temperature is additionally defined in terms of c_{pm}(q)) via the potential temperature exponent κ), there is no distinction between our virtual temperature and a hypothetical "density temperature".
When the amount of condensate in air is small and the temperature
is approximately materially conserved in adiabatic and reversible processes (including phase transitions). It is approximately the potential temperature \eqref{e:PotTempPressT} an air parcel would have if all liquid water in the parcel were evaporated and all ice sublimated. It is the limit of a more general expression for liquid-ice potential temperature for small
The liquid-ice potential temperature
Alternatively, when density
where
is the temperature that would correspond to
This expression for temperature as a function of liquid-ice potential temperature is obtained from \eqref{e:TempFromThetaLiGivenP} by substituting for pressure in the Exner function
The speed of sound in (moist) unstratified air is
with the appropriate gas constants for moist air. In the presence of stratification, additional terms arise Durran1999.
!!! note "Physical Interpretation" The speed of sound represents the rate at which pressure perturbations propagate through the fluid. The expression accounts for the effect of moisture on the gas constant and specific heat capacities of the air mixture.
!!! example "Typical Values"
For dry air at
!!! tip "Implementation Note"
The speed of sound is implemented in the soundspeed_air function. It is used in numerical schemes that require the characteristic wave speeds for stability analysis.
The thermodynamic framework presented here is based on a single fundamental approximation: calorically perfect gases with constant specific heat capacities. This approximation enables:
- Closed-form expressions for all thermodynamic quantities
- Consistent thermodynamics across all model components
- Computational efficiency without numerical integration
- Accuracy within 1-3% for atmospheric conditions
The most important equations for implementation are:
-
Equation of State:
$p = \rho R_m T$ with$R_m(q) = R_d (1 - q_t) + R_v q_v$ -
Internal Energy:
$I(T, q) = c_{vm}(q) (T - T_0) + q_v I_{v,0} - q_i I_{i,0} - (1 - q_t) R_d T_0$ -
Temperature Recovery:
$T = T_0 + (I - q_v I_{v,0} + q_i I_{i,0} + (1 - q_t) R_d T_0) / c_{vm}(q)$ - Saturation Vapor Pressure: Closed-form expression \eqref{e:SatVaporPressure}
-
Phase Equilibrium Approach (Saturation Adjustment):
- Prognostic variables:
$\rho$ ,$q_t$ ,$I$ - Diagnostic variables:
$T$ ,$q_l$ ,$q_i$ - Requires iterative solution for temperature
- Prognostic variables:
-
Phase Non-Equilibrium Approach:
- Prognostic variables:
$\rho$ ,$q_t$ ,$q_l$ ,$q_i$ ,$I$ - Diagnostic variable:
$T$ - Closed-form temperature recovery
- Prognostic variables:
- Saturation Adjustment: Use Newton's method with analytical derivatives (a derivative-free secant method is also provided)
- Temperature Recovery: Monotonic function enables robust inversion
- Mixed-Phase Conditions: Weighted latent heats ensure consistency
- Performance: Use rearranged forms to avoid redundant computations
The implementation should be validated against:
- Energy Conservation: Total energy should be conserved even in the presence of moist processes
- Temperature Recovery: Inversion should recover original temperature
- Saturation Consistency: Saturation conditions should be self-consistent
- Phase Transitions: Latent heat release should match energy changes
!!! note "Testing Framework" Comprehensive testing is performed using Tested Profiles that cover the full range of atmospheric conditions.
Thermodynamics.jl contains a battery of unit tests that check for consistency of the thermodynamic formulation and convergence of saturation adjustement in a broad range of conditions.
- Constant specific heat capacities (1-3% error)
- Neglected condensate volume
- Temperature-dependent heat capacities
- Non-ideal gases
!!! tip "Implementation Note"
The Thermodynamics.jl package provides a complete implementation of this framework with comprehensive testing and validation. See the API documentation for detailed function signatures and usage examples.
!!! note "References" This formulation is described in Yatunin2026, building on the theoretical framework described in Romps2008, Bott2008, and Marquet2016, with additional developments for mixed-phase conditions from Pressel2015.