Saturation vapor pressure
The saturation vapor pressure
that is used by Large-scale condensation, Convection, the cloud diagnostics in Radiation and the Surface fluxes of humidity. Several formulations of model.atmosphere.saturation.
Clausius-Clapeyron and its approximations
The Clausius-Clapeyron (or more precisely Clapeyron) relation is exact for any phase transition
with latent heat
the condensed volume is negligible,
(error), the vapor is an ideal gas,
(error), the latent heat
is constant.
The last is by far the largest error:
Implemented formulations
using SpeedyWeather
subtypes(SpeedyWeather.AbstractSaturationVaporPressure)4-element Vector{Any}:
ClausiusClapeyronConstantL
ClausiusClapeyronLinearL
IFSMixedPhase
MagnusBolton| Formulation | Formula | Phases | Notes |
|---|---|---|---|
ClausiusClapeyronConstantL | liquid | ||
ClausiusClapeyronLinearL | liquid | , | |
IFSMixedPhase (default) | liquid, ice, mixed | as in the ECMWF IFS (), | |
MagnusBolton | liquid | , ≈0.1% accurate between -35˚C and 35˚C |
For Romps (2017) the exponents are
atmosphere = EarthAtmosphere(Float64)
formulations = (ClausiusClapeyronConstantL, ClausiusClapeyronLinearL, IFSMixedPhase, MagnusBolton)
for T in (233.15, 253.15, 273.15, 293.15, 313.15)
e = [SpeedyWeather.saturation_vapor_pressure(F(Float64), T, atmosphere) for F in formulations]
println(round(T - 273.15), "˚C: ", join(round.(e, digits = 2), ", "))
end-40.0˚C: 20.31, 19.01, 12.82, 18.96
-20.0˚C: 127.41, 125.53, 103.4, 125.74
0.0˚C: 610.78, 611.21, 610.77, 611.2
20.0˚C: 2364.3, 2340.34, 2335.84, 2336.95
40.0˚C: 7699.01, 7390.75, 7380.23, 7394.9For reference, give 19.0 (12.8 over ice), 125.6 (103.2 over ice), 611.2, 2339 and 7385 Pa at these temperatures.
Here is an overview of the accuracy of each formulation against quantified as relative error. The IFS formulation considers a mixed phase between -23˚ and 0˚C which we therefore also apply to the the reference and other formulations too to compare on a single axis from -100˚ to +100˚ covering both vapor saturation over ice and liquid water.
<img width="2000" height="1040" alt="image" src="https://github.com/user-attachments/assets/dcfe9a46-0708-484f-bc52-a9e9724624da" />
User interface
The default is IFSMixedPhase, as it is the only formulation with an ice phase and accurate to within 0.7% (relative to Goff-Gratch over ice below -23˚C, liquid above 0˚C, blended in between) between -100˚C and 100˚C. Clausius-Clapeyron with a constant latent heat was the default in previous versions, use saturation = ClausiusClapeyronConstantL(spectral_grid) to reproduce them. Choose another formulation through the atmosphere
spectral_grid = SpectralGrid(truncation = 32, nlayers = 8)
saturation = IFSMixedPhase(spectral_grid) # or MagnusBolton, ClausiusClapeyronLinearL, ...
atmosphere = EarthAtmosphere(spectral_grid; saturation)
model = PrimitiveWetModel(spectral_grid; atmosphere)
model.atmosphere.saturationIFSMixedPhase{Float32}(611.21f0, 273.16f0, 250.16f0, 17.502f0, 32.19f0, 22.587f0, -0.7f0)Coefficients are changed by keyword, e.g. ClausiusClapeyronConstantL(spectral_grid, e₀ = 611.2). The functions
T = 280f0 # temperature [K]
p = 85000f0 # pressure [Pa]
SpeedyWeather.saturation_vapor_pressure(T, atmosphere), # [Pa]
SpeedyWeather.grad_saturation_vapor_pressure(T, atmosphere), # deₛ/dT [Pa/K]
SpeedyWeather.saturation_humidity(T, p, atmosphere) # [kg/kg](990.81415f0, 68.04642f0, 0.007250079f0)evaluate the chosen formulation, which each also provides its derivative via SpeedyWeather.grad(saturation, T, atmosphere). The derivative is analytical, cheap and branch-free, so it can be used inside kernels and differentiated through.
The derivative of the saturation humidity follows from it as
available as SpeedyWeather.grad_saturation_humidity(T, p, atmosphere). The Large-scale condensation uses it for its implicit correction and for limiting reevaporation, so that both stay consistent with the chosen formulation.
Convection still assumes constant latent heat
The moist-adiabatic lapse rate in Convection still uses ClausiusClapeyronConstantL.
Define your own formulation
A new formulation is a subtype of SpeedyWeather.AbstractSaturationVaporPressure with a method for saturation_vapor_pressure(svp, T, atmosphere) and grad(svp, T, atmosphere)
@kwdef struct ConstantSaturation{NF} <: SpeedyWeather.AbstractSaturationVaporPressure
e₀::NF = 1000
end
SpeedyWeather.saturation_vapor_pressure(svp::ConstantSaturation, T, atmosphere) = svp.e₀
SpeedyWeather.grad(svp::ConstantSaturation, T, atmosphere) = zero(svp.e₀)
atmosphere = EarthAtmosphere(spectral_grid, saturation = ConstantSaturation{spectral_grid.NF}())
SpeedyWeather.saturation_vapor_pressure(T, atmosphere)1000.0f0The atmosphere argument provides constants like atmosphere.latent_heat_condensation and atmosphere.R_vapor if a formulation should be consistent with them. A struct with a single field (as here) has to be created with its number format, e.g. ConstantSaturation{Float32}(), as ConstantSaturation(spectral_grid) is ambiguous with the struct's positional constructor. Use ifelse rather than if to stay branch-free.