Thermodynamics¶
JAX implementations of the aerosol/atmospheric thermodynamics functions. All
functions are elementwise, broadcast naturally over arrays, and are differentiable
via jax.grad. They are faithful translations of the NumPy reference
implementations in pyrcel.legacy.thermo.
Legacy reference
The original NumPy implementations remain available in pyrcel.legacy.thermo
for cross-checking. They are not part of the v2 numerical path and are not
differentiable.
sigma_w ¶
Surface tension of water for a given temperature.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
T
|
float
|
Ambient temperature, K. |
required |
Returns:
| Type | Description |
|---|---|
float
|
Surface tension, J/m². |
Notes
Linear fit to experimental data:
See Also
pyrcel.legacy.thermo.sigma_w
Source code in pyrcel/thermo.py
es ¶
Saturation vapor pressure over water for a given temperature.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
T_c
|
float
|
Ambient temperature, °C. |
required |
Returns:
| Type | Description |
|---|---|
float
|
Saturation vapor pressure, Pa. |
Notes
Magnus formula:
See Also
pyrcel.legacy.thermo.es
Source code in pyrcel/thermo.py
Seq ¶
κ-Köhler equilibrium supersaturation over an aerosol particle.
Two numerical stability improvements over the naïve formulation:
- Difference-of-cubes:
r³ - r_dry³is rewritten as(r - r_dry)(r² + r·r_dry + r_dry²)to avoid catastrophic cancellation whenr ≈ r_dry(near the dry particle limit). - Compensated final step:
exp(A)·B - 1is replaced byB·expm1(A) + (B - 1)whereB - 1 = -κ·r_dry³ / denomis computed without cancellation, so the result is accurate even whenA ≪ 1(large droplets) andB ≈ 1(dilute solution).
For kappa <= 0 the solute term is suppressed (B = 1,
B - 1 = 0), so the result reduces to the pure-curvature Kelvin
term expm1(A).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
r
|
array or float
|
Droplet radius, m. |
required |
r_dry
|
array or float
|
Dry particle radius, m. |
required |
T
|
float
|
Ambient temperature, K. |
required |
kappa
|
array or float
|
Particle hygroscopicity parameter. For |
required |
Returns:
| Type | Description |
|---|---|
array or float
|
Equilibrium supersaturation \(S_\mathrm{eq}\). |
Notes
The full κ-Köhler equation [Petters2007]:
where the Kelvin parameter is
References
[Petters2007] Petters, M. D., & Kreidenweis, S. M. (2007). A single parameter representation of hygroscopic growth and cloud condensation nucleus activity. Atmos. Chem. Phys., 7, 1961–1971. doi:10.5194/acp-7-1961-2007
See Also
pyrcel.legacy.thermo.Seq
Source code in pyrcel/thermo.py
rho_air ¶
Density of moist air for a given temperature, pressure, and relative humidity.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
T
|
float
|
Ambient temperature, K. |
required |
P
|
float
|
Ambient pressure, Pa. |
required |
RH
|
float
|
Relative humidity, decimal (default 1.0). |
1.0
|
Returns:
| Type | Description |
|---|---|
float
|
Air density, kg/m³. |
Notes
Uses the virtual temperature \(T_v = T(1 + 0.61\, q_\mathrm{sat})\) with
so that
See Also
pyrcel.legacy.thermo.rho_air
Source code in pyrcel/thermo.py
ka ¶
Thermal conductivity of air, modified for non-continuum effects.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
T
|
float
|
Ambient temperature, K. |
required |
rho
|
float
|
Ambient air density, kg/m³. |
required |
r
|
array or float
|
Droplet/particle radius, m. |
required |
Returns:
| Type | Description |
|---|---|
array or float
|
Non-continuum-corrected thermal conductivity, J m⁻¹ s⁻¹ K⁻¹. |
Notes
where \(\alpha_t\) is the thermal accommodation coefficient.
See Also
pyrcel.legacy.thermo.ka
Source code in pyrcel/thermo.py
dv ¶
Diffusivity of water vapor in air, modified for non-continuum effects.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
T
|
float
|
Ambient temperature, K. |
required |
r
|
array or float
|
Droplet/particle radius, m. |
required |
P
|
float
|
Ambient pressure, Pa. |
required |
accom
|
float
|
Condensation coefficient (default |
ac
|
Returns:
| Type | Description |
|---|---|
array or float
|
Non-continuum-corrected water vapor diffusivity, m²/s. |
Notes
where \(\alpha_c\) is the condensation (accommodation) coefficient.
See Also
pyrcel.legacy.thermo.dv