Thermodynamics
ClimateMachine.Thermodynamics
— ModuleThermodynamics
Moist thermodynamic functions, e.g., for air pressure (atmosphere equation of state), latent heats of phase transitions, saturation vapor pressures, and saturation specific humidities.
AbstractParameterSet's
Many functions defined in this module rely on CLIMAParameters.jl. CLIMAParameters.jl defines several functions (e.g., many planet parameters). For example, to compute the mole-mass ratio:
using CLIMAParameters.Planet: molmass_ratio
using CLIMAParameters: AbstractEarthParameterSet
struct EarthParameterSet <: AbstractEarthParameterSet end
param_set = EarthParameterSet()
_molmass_ratio = molmass_ratio(param_set)
Because these parameters are widely used throughout this module, param_set
is an argument for many Thermodynamics functions.
Thermodynamic State Constructors
ClimateMachine.Thermodynamics.PhasePartition
— TypePhasePartition
Represents the mass fractions of the moist air mixture.
Constructors
PhasePartition(q_tot::Real[, q_liq::Real[, q_ice::Real]])
PhasePartition(ts::ThermodynamicState)
See also PhasePartition_equil
Fields
tot
total specific humidity
liq
liquid water specific humidity (default:
0
)ice
ice specific humidity (default:
0
)
ClimateMachine.Thermodynamics.PhasePartition_equil
— FunctionPhasePartition_equil(param_set, T, ρ, q_tot, phase_type)
Partition the phases in equilibrium, returning a PhasePartition
object using the liquid_fraction
function where
param_set
anAbstractParameterSet
, see theThermodynamics
for more detailsT
temperatureρ
(moist-)air densityq_tot
total specific humidityphase_type
a thermodynamic state type
The residual q.tot - q.liq - q.ice
is the vapor specific humidity.
ClimateMachine.Thermodynamics.ThermodynamicState
— TypeThermodynamicState{FT}
A thermodynamic state, which can be initialized for various thermodynamic formulations (via its sub-types). All ThermodynamicState
's have access to functions to compute all other thermodynamic properties.
ClimateMachine.Thermodynamics.PhaseDry
— TypePhaseDry{FT} <: ThermodynamicState
A dry thermodynamic state (q_tot = 0
).
Constructors
PhaseDry(param_set, e_int, ρ)
Fields
param_set
parameter set, used to dispatch planet parameter function calls
e_int
internal energy
ρ
density of dry air
ClimateMachine.Thermodynamics.PhaseDry_given_pT
— FunctionPhaseDry_given_pT(param_set, p, T)
Constructs a PhaseDry
thermodynamic state from:
param_set
anAbstractParameterSet
, see theThermodynamics
for more detailsp
pressureT
temperature
ClimateMachine.Thermodynamics.PhaseDry_given_ρT
— FunctionPhaseDry_given_ρT(param_set, ρ, T)
Constructs a PhaseDry
thermodynamic state from:
param_set
anAbstractParameterSet
, see theThermodynamics
for more detailsρ
densityT
temperature
ClimateMachine.Thermodynamics.PhaseEquil
— TypePhaseEquil{FT} <: ThermodynamicState
A thermodynamic state assuming thermodynamic equilibrium (therefore, saturation adjustment may be needed).
Constructors
PhaseEquil(param_set, e_int, ρ, q_tot)
Fields
param_set
parameter set, used to dispatch planet parameter function calls
e_int
internal energy
ρ
density of air (potentially moist)
q_tot
total specific humidity
T
temperature: computed via
saturation_adjustment
ClimateMachine.Thermodynamics.PhaseNonEquil
— TypePhaseNonEquil{FT} <: ThermodynamicState
A thermodynamic state assuming thermodynamic non-equilibrium (therefore, temperature can be computed directly).
Constructors
PhaseNonEquil(param_set, e_int, q::PhasePartition, ρ)
Fields
param_set
parameter set, used to dispatch planet parameter function calls
e_int
internal energy
ρ
density of air (potentially moist)
q
phase partition
ClimateMachine.Thermodynamics.TemperatureSHumEquil
— FunctionTemperatureSHumEquil(param_set, T, ρ, q_tot)
Constructs a PhaseEquil
thermodynamic state from temperature.
param_set
anAbstractParameterSet
, see theThermodynamics
for more detailsT
temperatureρ
densityq_tot
total specific humidity
ClimateMachine.Thermodynamics.TemperatureSHumNonEquil
— FunctionTemperatureSHumNonEquil(param_set, T, ρ, q_pt)
Constructs a PhaseNonEquil
thermodynamic state from:
param_set
anAbstractParameterSet
, see theThermodynamics
for more detailsT
temperatureρ
(moist-)air densityq_pt
phase partition
ClimateMachine.Thermodynamics.TemperatureSHumEquil_given_pressure
— FunctionTemperatureSHumEquil_given_pressure(param_set, T, p, q_tot)
Constructs a PhaseEquil
thermodynamic state from temperature.
param_set
anAbstractParameterSet
, see theThermodynamics
for more detailsT
temperaturep
pressureq_tot
total specific humidity
ClimateMachine.Thermodynamics.LiquidIcePotTempSHumEquil
— FunctionLiquidIcePotTempSHumEquil(param_set, θ_liq_ice, ρ, q_tot)
Constructs a PhaseEquil
thermodynamic state from:
param_set
anAbstractParameterSet
, see theThermodynamics
for more detailsθ_liq_ice
liquid-ice potential temperatureρ
(moist-)air densityq_tot
total specific humiditytemperature_tol
temperature tolerance for saturation adjustmentmaxiter
maximum iterations for saturation adjustment
ClimateMachine.Thermodynamics.LiquidIcePotTempSHumNonEquil
— FunctionLiquidIcePotTempSHumNonEquil(param_set, θ_liq_ice, ρ, q_pt)
Constructs a PhaseNonEquil
thermodynamic state from:
param_set
anAbstractParameterSet
, see theThermodynamics
for more detailsθ_liq_ice
liquid-ice potential temperatureρ
(moist-)air densityq_pt
phase partition
and, optionally
potential_temperature_tol
potential temperature for non-linear equation solvemaxiter
maximum iterations for non-linear equation solve
ClimateMachine.Thermodynamics.LiquidIcePotTempSHumNonEquil_given_pressure
— FunctionLiquidIcePotTempSHumNonEquil_given_pressure(param_set, θ_liq_ice, p, q_pt)
Constructs a PhaseNonEquil
thermodynamic state from:
param_set
anAbstractParameterSet
, see theThermodynamics
for more detailsθ_liq_ice
liquid-ice potential temperaturep
pressureq_pt
phase partition
ClimateMachine.Thermodynamics.LiquidIcePotTempSHumEquil_given_pressure
— FunctionLiquidIcePotTempSHumEquil_given_pressure(param_set, θ_liq_ice, p, q_tot)
Constructs a PhaseEquil
thermodynamic state from:
param_set
anAbstractParameterSet
, see theThermodynamics
for more detailsθ_liq_ice
liquid-ice potential temperaturep
pressureq_tot
total specific humiditytemperature_tol
temperature tolerance for saturation adjustmentmaxiter
maximum iterations for saturation adjustment
Thermodynamic state methods
ClimateMachine.Thermodynamics.air_density
— Functionair_density(param_set, T, p[, q::PhasePartition])
The (moist-)air density from the equation of state (ideal gas law) where
param_set
anAbstractParameterSet
, see theThermodynamics
for more detailsT
air temperaturep
pressure
and, optionally,
q
PhasePartition
. Without this argument, the results are for dry air.
air_density(ts::ThermodynamicState)
The (moist-)air density, given a thermodynamic state ts
.
ClimateMachine.Thermodynamics.air_pressure
— Functionair_pressure(param_set, T, ρ[, q::PhasePartition])
The air pressure from the equation of state (ideal gas law) where
param_set
anAbstractParameterSet
, see theThermodynamics
for more detailsT
air temperatureρ
(moist-)air density
and, optionally,
q
PhasePartition
. Without this argument, the results are for dry air.
air_pressure(ts::ThermodynamicState)
The air pressure from the equation of state (ideal gas law), given a thermodynamic state ts
.
air_pressure(param_set, T::FT, T∞::FT, p∞::FT, ::DryAdiabaticProcess)
The air pressure for an isentropic process, where
param_set
anAbstractParameterSet
, see theThermodynamics
for more detailsT
temperatureT∞
ambient temperaturep∞
ambient pressure
ClimateMachine.Thermodynamics.air_pressure_given_θ
— Functionair_pressure_given_θ(param_set, θ::FT, Φ::FT, ::DryAdiabaticProcess)
The air pressure for an isentropic process, where
param_set
anAbstractParameterSet
, see theThermodynamics
for more detailsθ
potential temperatureΦ
gravitational potential
ClimateMachine.Thermodynamics.air_temperature
— Functionair_temperature(param_set, e_int, q::PhasePartition)
The air temperature, where
param_set
anAbstractParameterSet
, see theThermodynamics
for more detailse_int
internal energy per unit mass
and, optionally,
q
PhasePartition
. Without this argument, the results are for dry air.
air_temperature(ts::ThermodynamicState)
The air temperature, given a thermodynamic state ts
.
air_temperature(param_set, p::FT, θ::FT, Φ::FT, ::DryAdiabaticProcess)
The air temperature for an isentropic process, where
param_set
anAbstractParameterSet
, see theThermodynamics
for more detailsp
pressureθ
potential temperature
ClimateMachine.Thermodynamics.air_temperature_from_ideal_gas_law
— Functionair_temperature_from_ideal_gas_law(param_set, p, ρ, q::PhasePartition)
The air temperature, where
param_set
anAbstractParameterSet
, see theThermodynamics
for more detailsp
air pressureρ
air density
and, optionally,
q
PhasePartition
. Without this argument, the results are for dry air.
ClimateMachine.Thermodynamics.air_temperature_from_liquid_ice_pottemp
— Functionair_temperature_from_liquid_ice_pottemp(param_set, θ_liq_ice, ρ, q::PhasePartition)
The temperature given
param_set
anAbstractParameterSet
, see theThermodynamics
for more detailsθ_liq_ice
liquid-ice potential temperatureρ
(moist-)air density
and, optionally,
q
PhasePartition
. Without this argument, the results are for dry air.
ClimateMachine.Thermodynamics.air_temperature_from_liquid_ice_pottemp_given_pressure
— Functionair_temperature_from_liquid_ice_pottemp_given_pressure(
param_set,
θ_liq_ice,
p[, q::PhasePartition]
)
The air temperature where
param_set
anAbstractParameterSet
, see theThermodynamics
for more detailsθ_liq_ice
liquid-ice potential temperaturep
pressure
and, optionally,
q
PhasePartition
. Without this argument, the results are for dry air.
ClimateMachine.Thermodynamics.air_temperature_from_liquid_ice_pottemp_non_linear
— Functionair_temperature_from_liquid_ice_pottemp_non_linear(param_set, θ_liq_ice, ρ, q::PhasePartition)
Computes temperature T
given
param_set
anAbstractParameterSet
, see theThermodynamics
for more detailsθ_liq_ice
liquid-ice potential temperatureρ
(moist-)air densitytol
absolute tolerance for non-linear equation iterations. Can be one of:SolutionTolerance()
to stop when|x_2 - x_1| < tol
ResidualTolerance()
to stop when|f(x)| < tol
maxiter
maximum iterations for non-linear equation solve
and, optionally,
q
PhasePartition
. Without this argument, the results are for dry air,
by finding the root of T - air_temperature_from_liquid_ice_pottemp_given_pressure(param_set, θ_liq_ice, air_pressure(param_set, T, ρ, q), q) = 0
ClimateMachine.Thermodynamics.condensate
— Functioncondensate(q::PhasePartition{FT})
condensate(ts::ThermodynamicState)
Condensate of the phase partition.
ClimateMachine.Thermodynamics.cp_m
— Functioncp_m(param_set, [q::PhasePartition])
The isobaric specific heat capacity of moist air given
param_set
anAbstractParameterSet
, see theThermodynamics
for more details
and, optionally
q
PhasePartition
. Without this argument, the results are for dry air.
cp_m(ts::ThermodynamicState)
The isobaric specific heat capacity of moist air, given a thermodynamic state ts
.
ClimateMachine.Thermodynamics.cv_m
— Functioncv_m(param_set, [q::PhasePartition])
The isochoric specific heat capacity of moist air given
param_set
anAbstractParameterSet
, see theThermodynamics
for more details
and, optionally
q
PhasePartition
. Without this argument, the results are for dry air.
cv_m(ts::ThermodynamicState)
The isochoric specific heat capacity of moist air, given a thermodynamic state ts
.
ClimateMachine.Thermodynamics.dry_pottemp
— Functiondry_pottemp(param_set, T, ρ[, q::PhasePartition])
The dry potential temperature where
param_set
anAbstractParameterSet
, see theThermodynamics
for more detailsT
temperatureρ
(moist-)air density
and, optionally,
q
PhasePartition
. Without this argument, the results are for dry air.
dry_pottemp(ts::ThermodynamicState)
The dry potential temperature, given a thermodynamic state ts
.
ClimateMachine.Thermodynamics.dry_pottemp_given_pressure
— Functiondry_pottemp_given_pressure(param_set, T, p[, q::PhasePartition])
The dry potential temperature where
param_set
anAbstractParameterSet
, see theThermodynamics
for more detailsT
temperaturep
pressure
and, optionally,
q
PhasePartition
. Without this argument, the results are for dry air.
ClimateMachine.Thermodynamics.exner
— Functionexner(param_set, T, ρ[, q::PhasePartition)])
The Exner function where
param_set
anAbstractParameterSet
, see theThermodynamics
for more detailsT
temperatureρ
(moist-)air density
and, optionally,
q
PhasePartition
. Without this argument, the results are for dry air.
exner(ts::ThermodynamicState)
The Exner function, given a thermodynamic state ts
.
ClimateMachine.Thermodynamics.exner_given_pressure
— Functionexner_given_pressure(param_set, p[, q::PhasePartition])
The Exner function where
param_set
anAbstractParameterSet
, see theThermodynamics
for more detailsp
pressure
and, optionally,
q
PhasePartition
. Without this argument, the results are for dry air.
ClimateMachine.Thermodynamics.gas_constant_air
— Functiongas_constant_air(param_set, [q::PhasePartition])
The specific gas constant of moist air given
param_set
anAbstractParameterSet
, see theThermodynamics
for more detailsq
PhasePartition
. Without this argument, the results are for dry air.
gas_constant_air(ts::ThermodynamicState)
The specific gas constant of moist air given a thermodynamic state ts
.
ClimateMachine.Thermodynamics.gas_constants
— Function(R_m, cp_m, cv_m, γ_m) = gas_constants(param_set, [q::PhasePartition])
Wrapper to compute all gas constants at once, where optionally,
param_set
anAbstractParameterSet
, see theThermodynamics
for more detailsq
PhasePartition
. Without this argument, the results are for dry air.
The function returns a tuple of
R_m
gas_constant_air
cp_m
cp_m
cv_m
cv_m
γ_m = cp_m/cv_m
(R_m, cp_m, cv_m, γ_m) = gas_constants(ts::ThermodynamicState)
Wrapper to compute all gas constants at once, given a thermodynamic state ts
.
The function returns a tuple of
R_m
gas_constant_air
cp_m
cp_m
cv_m
cv_m
γ_m = cp_m/cv_m
ClimateMachine.Thermodynamics.has_condensate
— Functionhas_condensate(q::PhasePartition{FT})
has_condensate(ts::ThermodynamicState)
Bool indicating if condensate exists in the phase partition
ClimateMachine.Thermodynamics.Ice
— TypeIce <: Phase
An ice phase, to dispatch over saturation_vapor_pressure
and q_vap_saturation_generic
.
ClimateMachine.Thermodynamics.ice_specific_humidity
— Functionice_specific_humidity(ts::ThermodynamicState)
ice_specific_humidity(q::PhasePartition)
Ice specific humidity given
ts
a thermodynamic state
or
q
aPhasePartition
ClimateMachine.Thermodynamics.internal_energy
— Functioninternal_energy(param_set, T[, q::PhasePartition])
The internal energy per unit mass, given a thermodynamic state ts
or
param_set
anAbstractParameterSet
, see theThermodynamics
for more detailsT
temperature
and, optionally,
q
PhasePartition
. Without this argument, the results are for dry air.
internal_energy(ts::ThermodynamicState)
The internal energy per unit mass, given a thermodynamic state ts
.
internal_energy(ρ::FT, ρe::FT, ρu::AbstractVector{FT}, e_pot::FT)
The internal energy per unit mass, given
ρ
(moist-)air densityρe
total energy per unit volumeρu
momentum vectore_pot
potential energy (e.g., gravitational) per unit mass
ClimateMachine.Thermodynamics.internal_energy_sat
— Functioninternal_energy_sat(param_set, T, ρ, q_tot, phase_type)
The internal energy per unit mass in thermodynamic equilibrium at saturation where
param_set
anAbstractParameterSet
, see theThermodynamics
for more detailsT
temperatureρ
(moist-)air densityq_tot
total specific humidityphase_type
a thermodynamic state type
internal_energy_sat(ts::ThermodynamicState)
The internal energy per unit mass in thermodynamic equilibrium at saturation, given a thermodynamic state ts
.
ClimateMachine.Thermodynamics.latent_heat_fusion
— Functionlatent_heat_fusion(param_set, T::FT) where {FT<:Real}
The specific latent heat of fusion where
param_set
anAbstractParameterSet
, see theThermodynamics
for more detailsT
temperature
latent_heat_fusion(ts::ThermodynamicState)
The specific latent heat of fusion given a thermodynamic state ts
.
ClimateMachine.Thermodynamics.latent_heat_liq_ice
— Functionlatent_heat_liq_ice(param_set, q::PhasePartition{FT})
Effective latent heat of condensate (weighted sum of liquid and ice), with specific latent heat evaluated at reference temperature T_0
given
param_set
anAbstractParameterSet
, see theThermodynamics
for more detailsq
PhasePartition
. Without this argument, the results are for dry air.
ClimateMachine.Thermodynamics.latent_heat_sublim
— Functionlatent_heat_sublim(param_set, T::FT) where {FT<:Real}
The specific latent heat of sublimation where
param_set
anAbstractParameterSet
, see theThermodynamics
for more detailsT
temperature
latent_heat_sublim(ts::ThermodynamicState)
The specific latent heat of sublimation given a thermodynamic state ts
.
ClimateMachine.Thermodynamics.latent_heat_vapor
— Functionlatent_heat_vapor(param_set, T::FT) where {FT<:Real}
The specific latent heat of vaporization where
param_set
anAbstractParameterSet
, see theThermodynamics
for more detailsT
temperature
latent_heat_vapor(ts::ThermodynamicState)
The specific latent heat of vaporization given a thermodynamic state ts
.
ClimateMachine.Thermodynamics.Liquid
— TypeLiquid <: Phase
A liquid phase, to dispatch over saturation_vapor_pressure
and q_vap_saturation_generic
.
ClimateMachine.Thermodynamics.liquid_fraction
— Functionliquid_fraction(param_set, T, phase_type[, q])
The fraction of condensate that is liquid where
param_set
anAbstractParameterSet
, see theThermodynamics
for more detailsphase_type
a thermodynamic state type
PhaseNonEquil behavior
If q.liq
or q.ice
are nonzero, the liquid fraction is computed from them.
ThermodynamicState
Otherwise, phase equilibrium is assumed so that the fraction of liquid is a function that is 1 above T_freeze
and goes to zero below T_freeze
.
liquid_fraction(ts::ThermodynamicState)
The fraction of condensate that is liquid given a thermodynamic state ts
.
ClimateMachine.Thermodynamics.liquid_ice_pottemp
— Functionliquid_ice_pottemp(param_set, T, ρ, q::PhasePartition)
The liquid-ice potential temperature where
param_set
anAbstractParameterSet
, see theThermodynamics
for more detailsT
temperatureρ
(moist-)air density
and, optionally,
q
PhasePartition
. Without this argument, the results are for dry air.
liquid_ice_pottemp(ts::ThermodynamicState)
The liquid-ice potential temperature, given a thermodynamic state ts
.
ClimateMachine.Thermodynamics.liquid_ice_pottemp_given_pressure
— Functionliquid_ice_pottemp_given_pressure(param_set, T, p, q::PhasePartition)
The liquid-ice potential temperature where
param_set
anAbstractParameterSet
, see theThermodynamics
for more detailsT
temperaturep
pressure
and, optionally,
q
PhasePartition
. Without this argument, the results are for dry air.
ClimateMachine.Thermodynamics.liquid_ice_pottemp_sat
— Functionliquid_ice_pottemp_sat(param_set, T, ρ, phase_type[, q::PhasePartition])
The saturated liquid ice potential temperature where
param_set
anAbstractParameterSet
, see theThermodynamics
for more detailsT
temperatureρ
(moist-)air densityphase_type
a thermodynamic state type
and, optionally,
q
PhasePartition
. Without this argument, the results are for dry air.
liquid_ice_pottemp_sat(param_set, T, ρ, phase_type, q_tot)
The saturated liquid ice potential temperature where
param_set
anAbstractParameterSet
, see theThermodynamics
for more detailsT
temperatureρ
(moist-)air densityphase_type
a thermodynamic state typeq_tot
total specific humidity
liquid_ice_pottemp_sat(ts::ThermodynamicState)
The liquid potential temperature given a thermodynamic state ts
.
ClimateMachine.Thermodynamics.liquid_specific_humidity
— Functionliquid_specific_humidity(ts::ThermodynamicState)
liquid_specific_humidity(q::PhasePartition)
Liquid specific humidity given
ts
a thermodynamic state
or
q
aPhasePartition
ClimateMachine.Thermodynamics.moist_static_energy
— Functionmoist_static_energy(ts, e_pot)
Moist static energy, given
ts
a thermodynamic statee_pot
potential energy (e.g., gravitational) per unit mass
ClimateMachine.Thermodynamics.q_vap_saturation
— Functionq_vap_saturation(param_set, T, ρ, phase_type[, q::PhasePartition])
Compute the saturation specific humidity, given
param_set
anAbstractParameterSet
, see theThermodynamics
for more detailsT
temperatureρ
(moist-)air densityphase_type
a thermodynamic state type
and, optionally,
If the PhasePartition
q
is given, the saturation specific humidity is that of a mixture of liquid and ice, computed in a thermodynamically consistent way from the weighted sum of the latent heats of the respective phase transitions (Pressel et al., JAMES, 2015). That is, the saturation vapor pressure and from it the saturation specific humidity are computed from a weighted mean of the latent heats of vaporization and sublimation, with the weights given by the fractions of condensates q.liq/(q.liq + q.ice)
and q.ice/(q.liq + q.ice)
that are liquid and ice, respectively.
If the PhasePartition
q
is not given, or has zero liquid and ice specific humidities, the saturation specific humidity is that over a mixture of liquid and ice, with the fraction of liquid given by temperature dependent liquid_fraction(param_set, T, phase_type)
and the fraction of ice by the complement 1 - liquid_fraction(param_set, T, phase_type)
.
q_vap_saturation(ts::ThermodynamicState)
Compute the saturation specific humidity, given a thermodynamic state ts
.
ClimateMachine.Thermodynamics.q_vap_saturation_liquid
— Functionq_vap_saturation_liquid(ts::ThermodynamicState)
Compute the saturation specific humidity over liquid, given a thermodynamic state ts
.
ClimateMachine.Thermodynamics.q_vap_saturation_ice
— Functionq_vap_saturation_ice(ts::ThermodynamicState)
Compute the saturation specific humidity over ice, given a thermodynamic state ts
.
ClimateMachine.Thermodynamics.q_vap_saturation_generic
— Functionq_vap_saturation_generic(param_set, T, ρ[, phase=Liquid()])
Compute the saturation specific humidity over a plane surface of condensate, given
param_set
anAbstractParameterSet
, see theThermodynamics
for more detailsT
temperatureρ
(moist-)air density
and, optionally,
Liquid()
indicating condensate is liquidIce()
indicating condensate is ice
ClimateMachine.Thermodynamics.relative_humidity
— Functionrelative_humidity(param_set, T, p, phase_type, q::PhasePartition)
The relative humidity, given
param_set
anAbstractParameterSet
, see theThermodynamics
for more detailsp
pressurephase_type
a thermodynamic state type
and, optionally,
q
PhasePartition
. Without this argument, the results are for dry air.
relative_humidity(ts::ThermodynamicState)
The relative humidity, given a thermodynamic state ts
.
ClimateMachine.Thermodynamics.saturated
— Functionsaturated(ts::ThermodynamicState)
Boolean indicating if thermodynamic state is saturated.
ClimateMachine.Thermodynamics.saturation_adjustment
— Functionsaturation_adjustment(
param_set,
e_int,
ρ,
q_tot,
phase_type,
maxiter,
temperature_tol
)
Compute the temperature that is consistent with
param_set
anAbstractParameterSet
, see theThermodynamics
for more detailse_int
internal energyρ
(moist-)air densityq_tot
total specific humidityphase_type
a thermodynamic state typemaxiter
maximum iterations for non-linear equation solvetemperature_tol
temperature tolerance
by finding the root of
e_int - internal_energy_sat(param_set, T, ρ, q_tot, phase_type) = 0
using Newtons method with analytic gradients.
See also saturation_adjustment
.
ClimateMachine.Thermodynamics.saturation_excess
— Functionsaturation_excess(param_set, T, ρ, phase_type, q::PhasePartition)
The saturation excess in equilibrium where
param_set
anAbstractParameterSet
, see theThermodynamics
for more detailsT
temperatureρ
(moist-)air densityphase_type
a thermodynamic state typeq
PhasePartition
The saturation excess is the difference between the total specific humidity q.tot
and the saturation specific humidity in equilibrium, and it is defined to be nonzero only if this difference is positive.
saturation_excess(ts::ThermodynamicState)
Compute the saturation excess in equilibrium, given a thermodynamic state ts
.
ClimateMachine.Thermodynamics.saturation_vapor_pressure
— Functionsaturation_vapor_pressure(param_set, T, Liquid())
Return the saturation vapor pressure over a plane liquid surface given
T
temperatureparam_set
anAbstractParameterSet
, see theThermodynamics
for more detailssaturation_vapor_pressure(param_set, T, Ice())
Return the saturation vapor pressure over a plane ice surface given
T
temperatureparam_set
anAbstractParameterSet
, see theThermodynamics
for more detailssaturation_vapor_pressure(param_set, T, LH_0, Δcp)
Compute the saturation vapor pressure over a plane surface by integration of the Clausius-Clapeyron relation.
The Clausius-Clapeyron relation
`dlog(p_v_sat)/dT = [LH_0 + Δcp * (T-T_0)]/(R_v*T^2)`
is integrated from the triple point temperature T_triple
, using Kirchhoff's relation
`L = LH_0 + Δcp * (T - T_0)`
for the specific latent heat L
with constant isobaric specific heats of the phases. The linear dependence of the specific latent heat on temperature T
allows analytic integration of the Clausius-Clapeyron relation to obtain the saturation vapor pressure p_v_sat
as a function of the triple point pressure press_triple
.
ClimateMachine.Thermodynamics.soundspeed_air
— Functionsoundspeed_air(param_set, T[, q::PhasePartition])
The speed of sound in unstratified air, where
param_set
anAbstractParameterSet
, see theThermodynamics
for more detailsT
temperature
and, optionally,
q
PhasePartition
. Without this argument, the results are for dry air.
soundspeed_air(ts::ThermodynamicState)
The speed of sound in unstratified air given a thermodynamic state ts
.
ClimateMachine.Thermodynamics.specific_enthalpy
— Functionspecific_enthalpy(e_int, R_m, T)
Specific enthalpy, given
e_int
internal specific energyR_m
gas_constant_air
T
air temperature
specific_enthalpy(ts)
Specific enthalpy, given a thermodynamic state ts
.
ClimateMachine.Thermodynamics.specific_volume
— Functionspecific_volume(ts::ThermodynamicState)
The (moist-)air specific volume, given a thermodynamic state ts
.
ClimateMachine.Thermodynamics.supersaturation
— Functionsupersaturation(param_set, q, ρ, T, Liquid())
supersaturation(param_set, q, ρ, T, Ice())
param_set
- abstract set with earth parametersq
- phase partitionρ
- air density,T
- air temperatureLiquid()
,Ice()
- liquid or ice phase to dispatch over.
Returns supersaturation (qv/qv_sat -1) over water or ice.
ClimateMachine.Thermodynamics.temperature_and_humidity_from_virtual_temperature
— Functiontemperature_and_humidity_from_virtual_temperature(param_set, T_virt, ρ, RH)
The air temperature and q_tot
where
param_set
anAbstractParameterSet
, see theThermodynamics
for more detailsT_virt
virtual temperatureρ
air densityRH
relative humidityphase_type
a thermodynamic state type
ClimateMachine.Thermodynamics.total_energy
— Functiontotal_energy(param_set, e_kin, e_pot, T[, q::PhasePartition])
The total energy per unit mass, given
param_set
anAbstractParameterSet
, see theThermodynamics
for more detailse_kin
kinetic energy per unit masse_pot
potential energy per unit massT
temperature
and, optionally,
q
PhasePartition
. Without this argument, the results are for dry air.
total_energy(e_kin, e_pot, ts::ThermodynamicState)
The total energy per unit mass given a thermodynamic state ts
.
ClimateMachine.Thermodynamics.total_specific_enthalpy
— Functiontotal_specific_enthalpy(e_tot, R_m, T)
Total specific enthalpy, given
e_tot
total specific energyR_m
gas_constant_air
T
air temperature
total_specific_enthalpy(ts)
Total specific enthalpy, given
e_tot
total specific energyts
a thermodynamic state
ClimateMachine.Thermodynamics.total_specific_humidity
— Functiontotal_specific_humidity(ts::ThermodynamicState)
total_specific_humidity(param_set, T, p, relative_humidity)
Total specific humidity given
ts
a thermodynamic state
or
param_set
anAbstractParameterSet
, see theThermodynamics
for more detailsT
temperaturep
pressurerelative_humidity
relative humidity (can exceed 1 when there is super saturation/condensate)
ClimateMachine.Thermodynamics.vapor_specific_humidity
— Functionvapor_specific_humidity(q::PhasePartition{FT})
The vapor specific humidity, given a PhasePartition
q
.
ClimateMachine.Thermodynamics.virtual_pottemp
— Functionvirtual_pottemp(param_set, T, ρ[, q::PhasePartition])
The virtual potential temperature where
param_set
anAbstractParameterSet
, see theThermodynamics
for more detailsT
temperatureρ
(moist-)air density
and, optionally,
q
PhasePartition
. Without this argument, the results are for dry air.
virtual_pottemp(ts::ThermodynamicState)
The virtual potential temperature, given a thermodynamic state ts
.
ClimateMachine.Thermodynamics.virtual_temperature
— Functionvirtual_temperature(param_set, T, ρ[, q::PhasePartition])
The virtual temperature where
param_set
anAbstractParameterSet
, see theThermodynamics
for more detailsT
temperatureρ
(moist-)air density
and, optionally,
q
PhasePartition
. Without this argument, the results are for dry air.
virtual_temperature(ts::ThermodynamicState)
The virtual temperature, given a thermodynamic state ts
.
Dispatch types
ClimateMachine.Thermodynamics.DryAdiabaticProcess
— TypeDryAdiabaticProcess
For dispatching to isentropic formulas