Skip to content

Commit 2c2fddf

Browse files
authored
Merge branch 'main' into glw/fix-internal-refs
2 parents df7041a + bfdc096 commit 2c2fddf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+1316
-5277
lines changed

.buildkite/pipeline.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ steps:
3131

3232
- label: "CPU tests"
3333
command:
34-
- "THERMODYNAMICS_INCLUDE_DEPRECATED=false julia --project=test/ --color=yes test/runtests.jl"
34+
- "julia --project=test/ --color=yes test/runtests.jl"
3535
agents:
3636
slurm_ntasks: 1
3737
timeout_in_minutes: 60

.github/dependabot.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
2+
# Julia support: https://discourse.julialang.org/t/psa-github-dependabot-now-supports-julia/134997
3+
version: 2
4+
updates:
5+
- package-ecosystem: "github-actions"
6+
directory: "/" # Location of package manifests
7+
schedule:
8+
interval: "weekly"
9+
- package-ecosystem: "julia"
10+
directories:
11+
- "/"
12+
schedule:
13+
interval: "weekly"
14+
day: "wednesday"
15+
groups: # groups all julia package updates into a single PR
16+
all-julia-packages:
17+
patterns:
18+
- "*"

.github/workflows/CompatHelper.yml

Lines changed: 0 additions & 16 deletions
This file was deleted.

.github/workflows/cla.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ permissions:
99

1010
on:
1111
merge_group:
12-
pull_request:
12+
pull_request_target:
1313
types: [opened, reopened, synchronize]
1414
branches:
1515
- main

NEWS.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
Thermodynamics.jl Release Notes
22
========================
33

4-
v1.xxx (TODO: release once refactoring is done)
4+
v1.0.0
55
--------
66

7-
- ![][[badge-✨feature/enhancement]] Complete rewrite of documentation
7+
- ![][[badge-💥breaking]] Removal of the deprecated object-oriented and state-based API (e.g., `ThermodynamicState`, `PhasePartition`, `PhaseEquil`). The package now relies exclusively on a stateless, completely functional API.
8+
- ![][[badge-🚀performance]] Enforced zero-allocations across core routines (`air_temperature`, `air_pressure`, `saturation_adjustment` with fixed iterations) backed by explicit testing.
9+
- ![][[badge-✨feature/enhancement]] Upgraded testing infrastructure: `Documenter.doctest` continuously checks all mathematical examples in the docstrings.
10+
- ![][[badge-✨feature/enhancement]] Rewrite of documentation
811
- Restructured documentation for better organization and clarity
912
- Updated all function documentation to be consistent and comprehensive
1013
- Improved code examples and usage patterns throughout documentation
@@ -17,10 +20,6 @@ v1.xxx (TODO: release once refactoring is done)
1720
- Added comprehensive tests and physical consistency validation for these functions
1821
PR [259](https://github.com/CliMA/Thermodynamics.jl/pull/259)
1922
PR [263](https://github.com/CliMA/Thermodynamics.jl/pull/263)
20-
21-
main
22-
----
23-
2423
- Renamed `specific_enthalpy*` to `enthalpy*`.
2524
- Renamed `specific_entropy*` to `entropy*`.
2625
- Renamed `latent_heat_liq_ice` to `humidity_weighted_latent_heat`.

Project.toml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
name = "Thermodynamics"
22
uuid = "b60c26fb-14c3-4610-9d3e-2d17fe7ff00c"
33
authors = ["Climate Modeling Alliance"]
4-
version = "0.15.7"
4+
version = "1.0.0"
55

66
[deps]
77
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
8-
98
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
109
RootSolvers = "7181ea78-2dcb-4de3-ab41-2b8ab5a31e74"
1110

@@ -18,7 +17,6 @@ CreateParametersExt = "ClimaParams"
1817
[compat]
1918
ClimaParams = "1"
2019
ForwardDiff = "1.0.1"
21-
2220
Random = "1"
2321
RootSolvers = "0.4, 1"
2422
julia = "1.6"

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ params = TD.Parameters.ThermodynamicsParameters(Float64)
5555

5656
# 2. Define your thermodynamic variables
5757
ρ = 1.1 # Density [kg/m³]
58-
e_int = 200000.0 # Internal energy [J/kg]
58+
e_int = -36000.0 # Internal energy [J/kg, can be negative]
5959
q_tot = 0.015 # Total specific humidity [kg/kg]
6060
q_liq = 0.005 # Liquid specific humidity [kg/kg]
6161
q_ice = 0.001 # Ice specific humidity [kg/kg]

docs/src/API.md

Lines changed: 6 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,12 @@ q_vap_saturation_from_pressure
125125

126126
```@docs
127127
saturation_adjustment
128+
∂e_int_∂T_sat_ρ
129+
∂e_int_∂T_sat_p
130+
∂θ_li_∂T_sat_ρ
131+
∂θ_li_∂T_sat_p
132+
∂p_∂T_sat_ρ
133+
∂h_∂T_sat_p
128134
```
129135

130136
### Air Entropies
@@ -150,76 +156,3 @@ TemperatureProfiles.DryAdiabaticProfile
150156
Thermodynamics.DataCollection
151157
```
152158

153-
## Deprecated Functions
154-
155-
These functions are deprecated and will be removed in a future release.
156-
157-
### Backward Compatibility Wrappers
158-
159-
These wrappers exist for backward compatibility with older versions of the package.
160-
161-
```@docs
162-
specific_enthalpy
163-
specific_enthalpy_dry
164-
specific_enthalpy_vapor
165-
specific_enthalpy_liquid
166-
specific_enthalpy_ice
167-
dry_pottemp
168-
total_specific_enthalpy
169-
q_vap_saturation_generic
170-
latent_heat_liq_ice
171-
```
172-
173-
### Other Deprecated Functions
174-
175-
```@docs
176-
air_temperature_given_hq
177-
air_temperature_given_pρq
178-
air_temperature_given_pθq
179-
air_temperature_given_ρθq
180-
air_temperature_given_ρθq_nonlinear
181-
saturated
182-
total_specific_humidity
183-
liquid_specific_humidity
184-
ice_specific_humidity
185-
mixing_ratios
186-
specific_volume
187-
q_vap_from_RH_liquid
188-
temperature_and_humidity_given_TᵥρRH
189-
liquid_ice_pottemp_sat
190-
PhasePartition_equil
191-
PhasePartition_equil_given_p
192-
```
193-
194-
## Thermodynamic State Constructors (Deprecated)
195-
196-
```@docs
197-
ThermodynamicState
198-
PhasePartition
199-
PhaseDry
200-
PhaseDry_ρe
201-
PhaseDry_pT
202-
PhaseDry_pθ
203-
PhaseDry_pe
204-
PhaseDry_ph
205-
PhaseDry_ρθ
206-
PhaseDry_ρT
207-
PhaseDry_ρp
208-
PhaseEquil
209-
PhaseEquil_ρeq
210-
PhaseEquil_ρTq
211-
PhaseEquil_pTq
212-
PhaseEquil_pθq
213-
PhaseEquil_peq
214-
PhaseEquil_phq
215-
PhaseEquil_ρθq
216-
PhaseEquil_ρpq
217-
PhaseNonEquil
218-
PhaseNonEquil_ρTq
219-
PhaseNonEquil_pTq
220-
PhaseNonEquil_ρθq
221-
PhaseNonEquil_pθq
222-
PhaseNonEquil_peq
223-
PhaseNonEquil_phq
224-
PhaseNonEquil_ρpq
225-
```

docs/src/Formulation.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Specific thermodynamic formulations often vary in how they approximate the relev
4747
2. **Consistency**: The formulation is thermodynamically consistent (e.g., it conserves energy and satisfies the Clausius-Clapeyron relation).
4848
3. **Simplicity and Efficiency**: The formulation leads to closed-form expressions that can be evaluated efficiently.
4949

50-
The implementation follows the thermodynamic formulation of the CliMA Earth System Model ([Yatunin2026](@cite)). It relies on the **Rankine-Kirchhoff approximations**, which provide a consistent framework for moist thermodynamics ([Romps2021](@cite)).
50+
The implementation follows the thermodynamic formulation of the CliMA Earth System Model [Yatunin2026](@cite). It relies on the **Rankine-Kirchhoff approximations**, which provide a consistent framework for moist thermodynamics [Romps2021](@cite).
5151

5252
Specific choices of thermodynamic constants have been made in [ClimaParams.jl](https://github.com/CliMA/ClimaParams.jl) to maximize accuracy given the Rankine-Kirchhoff approximations ([Ambaum2020](@cite), [Yatunin2026](@cite)).
5353

@@ -412,7 +412,7 @@ The sum of the specific enthalpy of moist air and the specific gravitational pot
412412
\end{equation}
413413
```
414414

415-
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](@cite)).
415+
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](@cite).
416416

417417
## 9. Saturation Vapor Pressure
418418

@@ -427,7 +427,7 @@ The Clausius-Clapeyron relation describes how the saturation vapor pressure $p_v
427427

428428
Here, $L$ is the specific latent heat of the phase transition, which is $L_v$ for the saturation vapor pressure over liquid, or $L_s$ for the saturation vapor pressure over ice.
429429

430-
Substituting the linear relation \eqref{e:LHTemperature} between latent heat and temperature, and taking $p_\mathrm{tr}$ to be the vapor pressure at the triple point (by definition equal to the saturation vapor pressures both over liquid and ice), the Clausius-Clapeyron relation can be integrated to give a closed-form expression for the saturation vapor pressure. This closed-form expression is known as the **Rankine-Kirchhoff approximation** ([Romps2021](@cite)), named after its independent discoverers. It is the unique solution consistent with our thermodynamic assumptions (constant heat capacities and ideal gas law):
430+
Substituting the linear relation \eqref{e:LHTemperature} between latent heat and temperature, and taking $p_\mathrm{tr}$ to be the vapor pressure at the triple point (by definition equal to the saturation vapor pressures both over liquid and ice), the Clausius-Clapeyron relation can be integrated to give a closed-form expression for the saturation vapor pressure. This closed-form expression is known as the **Rankine-Kirchhoff approximation** [Romps2021](@cite), named after its independent discoverers. It is the unique solution consistent with our thermodynamic assumptions (constant heat capacities and ideal gas law):
431431

432432
```math
433433
\begin{equation}
@@ -441,7 +441,7 @@ Substituting the linear relation \eqref{e:LHTemperature} between latent heat and
441441
!!! tip "Implementation Note"
442442
The saturation vapor pressure is implemented in the [`saturation_vapor_pressure`](@ref) function. The closed-form expression enables efficient computation without numerical integration.
443443

444-
With $L_0 = L_{v,0}$ or $L_0 = L_{s,0}$ and the corresponding heat capacity difference $\Delta c_p$, this gives saturation vapor pressures over liquid or ice that are accurate within 3% for temperatures between 200K and 330K ([Ambaum2020](@cite)). The accuracy of this approximation depends on the choice of thermodynamic constants; the values used in `Thermodynamics.jl` (specified in [ClimaParams.jl](https://github.com/CliMA/ClimaParams.jl)) are chosen to minimize errors in the Rankine-Kirchhoff approximation ([Yatunin2026](@cite)).
444+
With $L_0 = L_{v,0}$ or $L_0 = L_{s,0}$ and the corresponding heat capacity difference $\Delta c_p$, this gives saturation vapor pressures over liquid or ice that are accurate within 3% for temperatures between 200K and 330K [Ambaum2020](@cite). The accuracy of this approximation depends on the choice of thermodynamic constants; the values used in `Thermodynamics.jl` (specified in [ClimaParams.jl](https://github.com/CliMA/ClimaParams.jl)) are chosen to minimize errors in the Rankine-Kirchhoff approximation [Yatunin2026](@cite).
445445

446446
!!! example "Typical Values"
447447
At $T = 300$ K:
@@ -459,7 +459,7 @@ With $L_0 = L_{v,0}$ or $L_0 = L_{s,0}$ and the corresponding heat capacity diff
459459

460460
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.
461461

462-
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](@cite)). That is, if a fraction $\lambda_p$ of the condensate is liquid and the complement $1-\lambda_p$ is ice, calculating the saturation vapor pressure with a specific latent heat $\lambda_p L_v + (1-\lambda_p)L_s$ gives a thermodynamically consistent saturation vapor pressure over the mixture.
462+
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](@cite). That is, if a fraction $\lambda_p$ of the condensate is liquid and the complement $1-\lambda_p$ is ice, calculating the saturation vapor pressure with a specific latent heat $\lambda_p L_v + (1-\lambda_p)L_s$ gives a thermodynamically consistent saturation vapor pressure over the mixture.
463463

464464
!!! note "Physical Interpretation"
465465
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.
@@ -704,7 +704,7 @@ The speed of sound in (moist) unstratified air is
704704
\end{equation}
705705
```
706706

707-
with the appropriate gas constants for moist air. In the presence of stratification, additional terms arise ([Durran1999](@cite)).
707+
with the appropriate gas constants for moist air. In the presence of stratification, additional terms arise [Durran1999](@cite).
708708

709709
!!! note "Physical Interpretation"
710710
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.

docs/src/HowToGuide.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ sol = TD.saturation_adjustment(
8787
T_equil = sol.T
8888
q_liq_equil = sol.q_liq
8989
q_ice_equil = sol.q_ice
90-
converged = sol.converged
9190
9291
println("Equilibrium T: $T_equil")
9392
```

0 commit comments

Comments
 (0)