Skip to content

Commit bf13c54

Browse files
authored
update Thermodynamics docs (#75)
1 parent dd6e3bc commit bf13c54

File tree

1 file changed

+82
-38
lines changed

1 file changed

+82
-38
lines changed

docs/src/thermodynamics.md

Lines changed: 82 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,35 @@ using Breeze
55
thermo = ThermodynamicConstants()
66
```
77

8-
Breeze implements thermodynamic relations for moist atmospheres --
9-
fluids that can be described as a binary mixture of _(i)_ "dry" air, and _(ii)_ vapor,
10-
as well as liquid and solid condensates of the vapor component of various shapes and sizes.
8+
Breeze implements thermodynamic relations for moist atmospheres.
9+
By "moist", we mean that the atmosphere is a binary mixture
10+
of _(i)_ "dry" air, and _(ii)_ "vapor".
11+
The presence of moisture makes life interesting, because vapor can _condense_ or _solidify_
12+
(and liquid can _freeze_) into droplets and particles of so many shapes and sizes.
1113

1214
On Earth, dry air is itself a mixture of gases, the vapor component is ``\mathrm{H_2 O}``,
13-
and the condensates comprise clouds and precipitation such as rain, snow, hail, and grapuel.
15+
also known as "water".
16+
Liquid droplets, which include almost-suspended tiny droplets as well as big raindrops,
17+
and ice particles such as snow, graupel, and hail, are called "condensates".
1418
Breeze models dry air as having a fixed composition with
1519
constant [molar mass](https://en.wikipedia.org/wiki/Molar_mass).
16-
Dry air on Earth's is mostly nitrogen, oxygen, and argon.
20+
Dry air on Earth's is mostly nitrogen, oxygen, and argon, whose combination produces the typical
21+
(and Breeze's default) dry air molar mass
22+
23+
```@example thermo
24+
using Breeze
25+
thermo = ThermodynamicConstants()
26+
thermo.dry_air.molar_mass
27+
```
28+
29+
Water vapor, which in Breeze has the default molar mass
30+
31+
```@example thermo
32+
thermo.vapor.molar_mass
33+
```
34+
35+
is lighter than dry air.
36+
As a result, moist, humid air is _lighter_ than dry air.
1737

1838
## Two laws for ideal gases
1939

@@ -30,50 +50,60 @@ Above, ``R ≡ ℛ / m`` is the specific gas constant given the
3050
``ℛ ≈ 8.31 \; \mathrm{J} \, \mathrm{K}^{-1} \, \mathrm{mol}^{-1}`` and molar mass ``m`` of the gas species under consideration.
3151

3252
The [first law of thermodynamics](https://en.wikipedia.org/wiki/First_law_of_thermodynamics),
33-
aka "conservation of energy", states that an infinitesimal change in the
34-
external heat changes ``\mathrm{d} \mathcal{Q}`` are related to infinitesimal changes
35-
in temperature ``\mathrm{d} T`` and pressure ``\mathrm{d} p`` according to:[^1]
53+
aka "conservation of energy", states that infinitesimal changes in
54+
"heat content"[^1] ``\mathrm{d} \mathcal{H}`` are related to infinitesimal changes
55+
in temperature ``\mathrm{d} T`` and pressure ``\mathrm{d} p`` according to:[^2]
3656

3757
```math
38-
\mathrm{d} \mathcal{Q} = cᵖ \mathrm{d} T - \frac{\mathrm{d} p}{\rho} ,
58+
\mathrm{d} \mathcal{H} = cᵖ \mathrm{d} T - \frac{\mathrm{d} p}{ρ} ,
3959
```
4060

41-
[^1]: The conservation of energy states that any external heat input into the gas must equal the sum
61+
[^1]: ``\mathcal{H}`` is called [_enthalpy_](https://en.wikipedia.org/wiki/Enthalpy)
62+
63+
[^2]: The conservation of energy states that any external heat input into the gas must equal the sum
4264
of the change of the gas's internal energy and the work done by the gas, ``p \, \mathrm{d} V``.
4365
For atmospheric flows it's convenient to express everything per unit mass. Assuming the mass of
4466
the fluid is conserved, we have that the work done per unit mass is ``p \, \mathrm{d}(\rho^{-1})``
45-
and the internal energy per unit mass is ``cᵛ \mathrm{d} T``.
46-
Therefore, if ``\mathrm{d} \mathcal{Q}`` is the external heat change per unit mass,
67+
and the internal energy per unit mass is ``\mathcal{I} ≡ cᵛ \mathrm{d} T``.
68+
Therefore, if ``\mathrm{d} \mathcal{H}`` is the change in heat content per unit mass,
4769
we have:
4870

4971
```math
50-
\mathrm{d} \mathcal{Q} = cᵛ \mathrm{d}T + p \, \mathrm{d}(ρ^{-1}) .
72+
\mathrm{d} \mathcal{H} = cᵛ \mathrm{d} T + p \, \mathrm{d}(ρ^{-1}) .
5173
```
5274
53-
By utilising the identity ``\mathrm{d}(p / ρ) = p \, \mathrm{d}(ρ^{-1}) + ρ^{-1} \mathrm{d}p`` and using
54-
the ideal gas, we can rewrite the above conservation law as:
75+
By utilizing the identity ``\mathrm{d}(p / ρ) = p \, \mathrm{d}(ρ^{-1}) + ρ^{-1} \mathrm{d}p`` and using
76+
the ideal gas, we can rewrite the above conservation law as:
5577
5678
```math
57-
\mathrm{d} \mathcal{Q} = (cᵛ + R) \mathrm{d}T - ρ^{-1} \mathrm{d}p ,
79+
\mathrm{d} \mathcal{H} = (cᵛ + R) \mathrm{d} T - ρ^{-1} \mathrm{d}p ,
5880
```
5981
60-
which is the expression in the main text after noting that the specific heat capacities under
61-
constant pressure and under constant volume are related via ``cᵖ ≡ cᵛ + R``.
82+
which is the expression in the main text after noting that the specific heat capacities under
83+
constant pressure and under constant volume are related via ``cᵖ ≡ cᵛ + R``.
6284
6385
6486
where ``cᵖ`` is the specific heat capacity at constant pressure of the gas in question.
6587
66-
For example, to represent dry air typical for Earth, with molar mass ``m = 0.029 \; \mathrm{kg} \, \mathrm{mol}^{-1}`` and heat capacity ``c^p = 1005 \; \mathrm{J} \, \mathrm{kg}^{-1} \, \mathrm{K}^{-1}``,
88+
For example, to represent dry air typical for Earth, with molar mass ``m = 0.029 \; \mathrm{kg} \, \mathrm{mol}^{-1}`` and constant-pressure heat capacity ``c^p = 1005 \; \mathrm{J} \, \mathrm{kg}^{-1} \, \mathrm{K}^{-1}``,
6789
we write
6890
6991
```@example thermo
7092
using Breeze.Thermodynamics: IdealGas
7193
dry_air = IdealGas(molar_mass=0.029, heat_capacity=1005)
7294
```
7395

74-
### Adiabatic transformations and potential temperature
96+
We can also change the properties of dry air by specifying new values
97+
when constructing `ThermodynamicConstants`,
7598

76-
Within adiabatic transformations, ``\mathrm{d} \mathcal{Q} = 0``.
99+
```@example thermo
100+
weird_thermo = ThermodynamicConstants(dry_air_molar_mass=0.042, dry_air_heat_capacity=420)
101+
weird_thermo.dry_air
102+
```
103+
104+
### Potential temperature and "adiabatic" transformations
105+
106+
Within adiabatic transformations, ``\mathrm{d} \mathcal{H} = 0``.
77107
Then, combining the ideal gas law with conservation of energy yields
78108

79109
```math
@@ -91,57 +121,69 @@ As a result, the _potential temperature_, ``θ``, defined as
91121

92122
remains constant under adiabatic transformations.
93123
Notice that above, we also defined the Exner function, ``Π ≡ ( p / p₀ )^{R / cᵖ}``.
94-
By convention, we tend to use as reference values those at the surface ``z=0``, i.e., ``p₀ = p(z=0)``, ``T₀ = T(z=0)``, etc.
95-
This implies that the potential temperature under adiabatic transformation is ``θ(z) = θ₀ = T₀``.
96124

97-
(Superscript ``d`` denotes dry air, e.g., ``Rᵈ = 286.71 \; \mathrm{J} \, \mathrm{K}^{-1}``.)
125+
!!! note "About subscripts"
126+
The subscript "0" typically indicates some quantity evaluated at the surface ``z=0``.
127+
By convention, we tend to invoke constants that represent profiles evaluated at ``z=0``: i.e., ``p₀ = p(z=0)``, ``T₀ = T(z=0)``, etc.
128+
This implies that the potential temperature under adiabatic transformation is ``θ(z) = θ₀ = T₀``.
98129

99130
### Hydrostatic balance
100131

101132
Next we consider a reference state that does not exchange energy with its environment
102-
(i.e., ``\mathrm{d} \mathcal{Q} = 0``) and thus has constant potential temperature
133+
(i.e., ``\mathrm{d} \mathcal{H} = 0``) and thus has constant potential temperature
103134

104135
```math
105-
θ₀ = Tᵣ \left ( \frac{p₀}{pᵣ} \right )^{Rᵈ / cᵖᵈ} .
136+
θ₀ = Tᵣ \left ( \frac{p₀}{pᵣ} \right )^{R / cᵖ} .
106137
```
107138

108-
!!! note "About subscripts"
109-
Subscripts ``0`` typically indicate evaluated values.
110-
For example, in the above formula, ``p₀ ≡ pᵣ(z=0)``.
111-
Subscripts ``r`` indicate _reference_ states, which typically are
112-
functions of ``z``. This differs from the usual notation in which
113-
the subscripts ``0`` indicate "reference" and "00" means ``z=0``.
114-
139+
!!! note "Reference states"
140+
Subscripts ``r`` indicate a _reference_ state.
141+
The adiabatic, hydrostatically-balanced reference state in the process
142+
of elucidation presently has a ``z`` dependent reference pressure ``pᵣ(z)``,
143+
density ``ρᵣ(z)``, and temperature ``Tᵣ(z)``.
144+
This reference state also has a _constant_ potential temperature
145+
``θᵣ``, which we attempt to clarify by writing ``θ₀`` (since it's constant,
146+
it has the same value at ``z=0`` as at any height).
147+
We apologize that our notation differs from the usual in which
148+
``0`` subscripts indicate "reference" (🤔) and ``00`` (🫣) means ``z=0``.
115149

116150
Hydrostatic balance requires
117151

118152
```math
119-
∂_z pᵣ = - ρᵣ g .
153+
∂_z pᵣ = - ρᵣ g ,
154+
```
155+
156+
where ``g`` is gravitational acceleration, naturally by default
157+
158+
```@example thermo
159+
thermo.gravitational_acceleration
120160
```
121161

122162
By combining the hydrostatic balance with the ideal gas law and the definition of potential
123163
temperature we get
124164

125165
```math
126-
\frac{pᵣ}{p₀} = \left (1 - \frac{g z}{cᵖᵈ θ₀} \right )^{cᵖᵈ / Rᵈ} .
166+
\frac{pᵣ}{p₀} = \left (1 - \frac{g z}{cᵖ θ₀} \right )^{cᵖ / R} .
127167
```
128168

129169
Thus
130170

131171
```math
132-
Tᵣ(z) = θ₀ \left ( \frac{pᵣ}{p₀} \right )^{Rᵈ / cᵖᵈ} = θ₀ \left ( 1 - \frac{g z}{cᵖᵈ θ₀} \right ) ,
172+
Tᵣ(z) = θ₀ \left ( \frac{pᵣ}{p₀} \right )^{R / cᵖ} = θ₀ \left ( 1 - \frac{g z}{cᵖ θ₀} \right ) ,
133173
```
134174

135175
and
136176

137177
```math
138-
ρᵣ(z) = \frac{p₀}{Rᵈ θ₀} \left ( 1 - \frac{g z}{cᵖᵈ θ₀} \right )^{cᵖᵈ / Rᵈ - 1} .
178+
ρᵣ(z) = \frac{p₀}{Rᵈ θ₀} \left ( 1 - \frac{g z}{cᵖ θ₀} \right )^{cᵖ / R - 1} .
139179
```
140180

141181
## An example of a dry reference state in Breeze
142182

143183
We can visualise a hydrostatic reference profile evaluating Breeze's reference-state
144-
utilities (which assume a dry reference state) on a one-dimensional `RectilinearGrid`:
184+
utilities (which assume a dry reference state) on a one-dimensional `RectilinearGrid`.
185+
In the following code, the superscript ``d`` denotes dry air, e.g., an ideal gas
186+
with ``Rᵈ = 286.71 \; \mathrm{J} \, \mathrm{K}^{-1}``:
145187

146188
```@example reference_state
147189
using Breeze
@@ -251,6 +293,8 @@ q = 0.01 # 1% water vapor by mass
251293
cᵖᵐ = mixture_heat_capacity(qᵛ, thermo)
252294
```
253295

296+
## Liquid-ice potential temperature
297+
254298
## The Clausius--Clapeyron relation and saturation specific humidity
255299

256300
The [Clausius--Clapeyron relation](https://en.wikipedia.org/wiki/Clausius%E2%80%93Clapeyron_relation)

0 commit comments

Comments
 (0)