Skip to content

Commit 6769fc1

Browse files
authored
Enhancements on Clausius-Clapeyron section in Docs (#54)
* format docstring * enhance docstring + code to avoid confusion of ℒᵛ(T=0) and ℒ₀ * cleaner * cleaner * homogenize docs, docstring and code * clarify bc * avoid confusing subscript 0 with reference temperature * add comma * use pᵛ⁺ notation * plot saturation vapor pressure * Update CI workflow to include new Go versions
1 parent 396931e commit 6769fc1

File tree

4 files changed

+44
-21
lines changed

4 files changed

+44
-21
lines changed

.github/workflows/CI.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,9 @@ jobs:
4040
fail-fast: false
4141
matrix:
4242
version:
43-
- "min"
44-
- "1"
43+
- "1.10"
44+
- "1.11"
45+
- "1.12"
4546
os:
4647
- ubuntu-latest
4748
- macOS-latest

docs/src/thermodynamics.md

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -269,14 +269,14 @@ heats, the latent heat of a phase transition is linear in temperature.
269269
For example, for phase change from vapor to liquid,
270270

271271
```math
272-
ℒˡ(T) = ℒˡ₀ + \big ( \underbrace{cᵖᵛ - cᵖˡ}_{≡Δcˡ} \big ) T ,
272+
ℒˡ(T) = ℒˡ_{0K} + \big ( \underbrace{cᵖᵛ - cᵖˡ}_{≡Δcˡ} \big ) T ,
273273
```
274274

275-
where ``ℒˡ₀`` is the latent heat at ``T = 0``, with ``T`` in Kelvin.
276-
Integrate that to get
275+
where ``ℒˡ_{0K}`` is the latent heat at absolute zero, ``T = 0 \; \mathrm{K}``.
276+
By integrating from the triple-point temperature ``Tᵗʳ`` for which ``p(Tᵗʳ) = pᵗʳ``, we get
277277

278278
```math
279-
pᵛ⁺(T) = pᵗʳ \left ( \frac{T}{Tᵗʳ} \right )^{Δcˡ / Rᵛ} \exp \left [ \frac{ℒˡ₀}{Rᵛ} \left (\frac{1}{Tᵗʳ} - \frac{1}{T} \right ) \right ] .
279+
pᵛ⁺(T) = pᵗʳ \left ( \frac{T}{Tᵗʳ} \right )^{Δcˡ / Rᵛ} \exp \left [ \frac{ℒˡ_{0K}}{Rᵛ} \left (\frac{1}{Tᵗʳ} - \frac{1}{T} \right ) \right ] .
280280
```
281281

282282
Consider parameters for liquid water,
@@ -292,6 +292,29 @@ or water ice,
292292
water_ice = CondensedPhase(latent_heat=2834000, heat_capacity=2108)
293293
```
294294

295+
The saturation vapor pressure is
296+
297+
```@example
298+
using Breeze
299+
using Breeze.Thermodynamics: saturation_vapor_pressure
300+
301+
thermo = AtmosphereThermodynamics()
302+
303+
T = collect(200:0.1:320)
304+
pᵛˡ⁺ = [saturation_vapor_pressure(Tⁱ, thermo, thermo.liquid) for Tⁱ in T]
305+
pᵛⁱ⁺ = [saturation_vapor_pressure(Tⁱ, thermo, thermo.solid) for Tⁱ in T]
306+
pᵛⁱ⁺[T .> thermo.triple_point_temperature] .= NaN
307+
308+
using CairoMakie
309+
310+
fig = Figure()
311+
ax = Axis(fig[1, 1], xlabel="Temperature (ᵒK)", ylabel="Saturation vapor pressure pᵛ⁺ (Pa)", yscale = log10, xticks=200:20:320)
312+
lines!(ax, T, pᵛˡ⁺, label="vapor pressure over liquid")
313+
lines!(ax, T, pᵛⁱ⁺, linestyle=:dash, label="vapor pressure over ice")
314+
axislegend(ax, position=:rb)
315+
fig
316+
```
317+
295318
The saturation specific humidity is
296319

297320
```math

src/Thermodynamics/atmosphere_thermodynamics.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ Likewise, during deposition, water molecules in the gas phase cluster into ice c
7979
Arguments
8080
=========
8181
- `FT`: Float type to use (defaults to Oceananigans.defaults.FloatType)
82-
- `latent_heat`: Difference between the internal energy of the gaseous phase at the energy_reference_temperature.
82+
- `latent_heat`: Difference between the internal energy of the gaseous phase at
83+
the `energy_reference_temperature`.
8384
- `heat_capacity`: Heat capacity of the phase of matter.
8485
"""
8586
function CondensedPhase(FT = Oceananigans.defaults.FloatType; latent_heat, heat_capacity)

src/Thermodynamics/vapor_saturation.jl

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,37 @@
11
"""
22
saturation_vapor_pressure(T, thermo, phase::CondensedPhase)
33
4-
Compute the saturation vapor pressure over a liquid surface by integrating
4+
Compute the saturation vapor pressure ``pᵛ⁺`` over a liquid surface by integrating
55
the Clausius-Clapeyron relation,
66
77
```math
8-
dp/dT = ℒᵛ / (Rᵛ T^2)
8+
dpᵛ⁺ / dT = pᵛ⁺ ℒᵛ(T) / (Rᵛ T^2)
99
```
1010
11-
which integrates to the expression
11+
where ``ℒᵛ(T) = ℒᵛ(T=0) + Δcᵖ T``, with ``Δcᵖ ≡ (cᵖᵛ - cᵖˡ)``.
1212
13-
```math
14-
p(T) = pᵗʳ \\left ( \\frac{T}{Tᵗʳ} \\right )^{aᵛ} \\exp \\left [ bᵛ (1/Tᵗʳ - 1/T) \\right ]
15-
```
16-
17-
where
13+
The saturation vapor pressure ``pᵛ⁺`` is obtained after integrating the above from
14+
the triple point, i.e., ``p(Tᵗʳ) = pᵗʳ`` to get
1815
1916
```math
20-
aᵛ ≡ (cᵖᵛ - cᵖˡ) / Rᵛ \\\\
21-
bᵛ ≡ ℒ₀ / Rᵛ - aᵛ T₀
17+
pᵛ⁺(T) = pᵗʳ \\left ( \\frac{T}{Tᵗʳ} \\right )^{Δcᵖ / Rᵛ} \\exp \\left [ (1/Tᵗʳ - 1/T) ℒᵛ(T=0) / Rᵛ \\right ]
2218
```
2319
"""
2420
@inline function saturation_vapor_pressure(T, thermo, phase::CondensedPhase)
25-
ℒ₀ = phase.latent_heat
21+
ℒ₀ = phase.latent_heat # at thermo.energy_reference_temperature
2622
cᵖˡ = phase.heat_capacity
2723
T₀ = thermo.energy_reference_temperature
2824
Tᵗʳ = thermo.triple_point_temperature
2925
pᵗʳ = thermo.triple_point_pressure
3026
cᵖᵛ = thermo.vapor.heat_capacity
3127
Rᵛ = vapor_gas_constant(thermo)
3228

33-
aᵛ = (cᵖᵛ - cᵖˡ) / Rᵛ
34-
bᵛ = ℒ₀ / Rᵛ - aᵛ * T₀
29+
Δcᵖ = cᵖᵛ - cᵖˡ
30+
31+
# latent heat at T = 0 ᵒK assuming temperature-independent specific heats
32+
ℒ₀ₖ = ℒ₀ - Δcᵖ * T₀
3533

36-
return pᵗʳ * (T / Tᵗʳ)^aᵛ * exp(bᵛ * (1/Tᵗʳ - 1/T))
34+
return pᵗʳ * (T / Tᵗʳ)^(Δcᵖ / Rᵛ) * exp((1/Tᵗʳ - 1/T) * ℒ₀ₖ / Rᵛ)
3735
end
3836

3937
# Over a liquid surface

0 commit comments

Comments
 (0)