Contents
Index
Clapeyron.PHClapeyron.PSClapeyron.PTClapeyron.PT0Clapeyron.QPClapeyron.QTClapeyron.VTClapeyron.VT0Clapeyron.PpropertyClapeyron.T_scaleClapeyron.TpropertyClapeyron.activityClapeyron.activity_coefficientClapeyron.adiabatic_indexClapeyron.aqueous_activityClapeyron.chemical_potentialClapeyron.chemical_potential_resClapeyron.compressibility_factorClapeyron.cross_second_virialClapeyron.enthalpyClapeyron.enthalpy_resClapeyron.entropyClapeyron.entropy_resClapeyron.equivol_cross_second_virialClapeyron.excessClapeyron.fugacity_coefficientClapeyron.fundamental_derivative_of_gas_dynamicsClapeyron.gibbs_energyClapeyron.gibbs_energy_resClapeyron.gibbs_free_energyClapeyron.gibbs_free_energy_resClapeyron.helmholtz_energyClapeyron.helmholtz_energy_resClapeyron.helmholtz_free_energyClapeyron.helmholtz_free_energy_resClapeyron.identify_phaseClapeyron.internal_energyClapeyron.internal_energy_resClapeyron.inversion_temperatureClapeyron.isentropic_compressibilityClapeyron.isobaric_expansivityClapeyron.isobaric_heat_capacityClapeyron.isochoric_heat_capacityClapeyron.isothermal_compressibilityClapeyron.joule_thomson_coefficientClapeyron.lb_volumeClapeyron.mass_densityClapeyron.mass_enthalpyClapeyron.mass_entropyClapeyron.mass_gibbs_energyClapeyron.mass_gibbs_free_energyClapeyron.mass_helmholtz_energyClapeyron.mass_helmholtz_free_energyClapeyron.mass_internal_energyClapeyron.mass_isobaric_heat_capacityClapeyron.mass_isochoric_heat_capacityClapeyron.mixingClapeyron.molar_densityClapeyron.p_scaleClapeyron.partial_propertyClapeyron.pipClapeyron.pressureClapeyron.reference_chemical_potentialClapeyron.reference_chemical_potential_typeClapeyron.second_virial_coefficientClapeyron.speed_of_soundClapeyron.thermodynamic_factorClapeyron.volumeClapeyron.volume_virialClapeyron.x0_crit_pureClapeyron.x0_psatClapeyron.x0_sat_pureClapeyron.x0_saturation_temperatureClapeyron.x0_volumeClapeyron.x0_volume_gasClapeyron.x0_volume_liquidClapeyron.x0_volume_solid
Bulk properties
By default, Clapeyron.jl exports functions that can be evaluated in a direct pressure-temperature (P-T-0) basis (also available in the PT0 sub module.)
The basis is direct in the sense that only the most stable volume phase is calculated at the pressure-temperature-composition state, but no attempt is done to check if one or more phases can be formed at the input conditions.
A summary table can be found below:
| Property name | Main function | Variants (full function name with descriptor) |
|---|---|---|
| Volume (total) | volume | – |
| Temperature | temperature | – |
| Pressure | pressure | – |
| Helmholtz energy (total) | helmholtz_energy | helmholtz_energy_res (residual), mass_helmholtz_energy (mass-based), helmholtz_free_energy (deprecated), helmholtz_free_energy_res (deprecated), mass_helmholtz_free_energy (deprecated) |
| Molar density | molar_density | – |
| Mass density | mass_density | – |
| Compressibility factor | compressibility_factor | – |
| Gibbs energy (total) | gibbs_energy | gibbs_energy_res (residual), mass_gibbs_energy (mass-based), gibbs_free_energy (deprecated), gibbs_free_energy_res (deprecated), mass_gibbs_free_energy (deprecated) |
| Entropy (total) | entropy | entropy_res (residual), mass_entropy (mass-based) |
| Enthalpy (total) | enthalpy | enthalpy_res (residual), mass_enthalpy (mass-based) |
| Internal energy (total) | internal_energy | internal_energy_res (residual), mass_internal_energy (mass-based) |
| Isochoric heat capacity (molar) | isochoric_heat_capacity | mass_isochoric_heat_capacity (mass-based) |
| Isobaric heat capacity (molar) | isobaric_heat_capacity | mass_isobaric_heat_capacity (mass-based) |
| Adiabatic index | adiabatic_index | – |
| Isothermal compressibility | isothermal_compressibility | – |
| Isentropic compressibility | isentropic_compressibility | – |
| Speed of sound | speed_of_sound | – |
| Isobaric expansivity | isobaric_expansivity | – |
| Joule‑Thomson coefficient | joule_thomson_coefficient | – |
| Inversion temperature | inversion_temperature | – |
| Fundamental derivative of gas dynamics | fundamental_derivative_of_gas_dynamics | – |
| Second virial coefficient | second_virial_coefficient | – |
| Cross second virial coefficient | cross_second_virial | – |
| Equivolumetric cross second virial | equivol_cross_second_virial | – |
| Chemical potential | chemical_potential | chemical_potential_res (residual) |
| Fugacity coefficient | fugacity_coefficient | – |
| Activity coefficient | activity_coefficient | – |
| Activity | activity | – |
| Aqueous activity | aqueous_activity | – |
| Reference chemical potential | reference_chemical_potential | – |
| Reference chemical potential type | reference_chemical_potential_type | – |
| Mixing property | mixing | – |
| Excess property | excess | – |
| Partial property | partial_property | – |
| Thermodynamic factor | thermodynamic_factor | – |
| Phase identification parameter | pip | – |
| Phase identification | identify_phase | – |
First order bulk methods
The following methods are calculated as combinations of first order derivatives of the helmholtz energy with respect to volume and temperature, or first order derivatives of the gibbs energy with respect to pressure and temperature.
Clapeyron.volume — Function
volume(model::EoSModel, p, T, z=SA[1.0]; phase=:unknown, threaded=true, vol0=nothing)
volume(result::FlashResult)
volume(model, result::FlashResult)
volume(result::FlashResult, phase_index::Int)
volume(model, result::FlashResult, phase_index::Int)Calculates the volume (m³) of the compound modelled by model at a certain pressure p, temperature T and moles z. phase is a Symbol that determines the initial volume root to look for:
- If
phase =:unknown(Default), it will return the physically correct volume root with the least Gibbs energy. - If
phase =:liquid, it will return the volume of the phase using a liquid initial point. - If
phase =:vapor, it will return the volume of the phase using a gas initial point. - If
phase =:solid, it will return the volume of the phase using a solid initial point (only supported for EoS that support a solid phase). - If
phase =:stable, it will return the physically correct volume root with the least Gibbs energy, and perform a stability test on the result.
All volume calculations are checked for mechanical stability, that is: dP/dV <= 0.
The calculation of both volume roots can be calculated in serial (threaded=false) or in parallel (threaded=true).
An initial estimate of the volume vol0 can be optionally be provided.
volume(result::FlashResult) will return the volume of the aggregate of phases stored in the FlashResult whereas volume(result::FlashResult,phase_index) will return the volume of the ith phase. Because molar volumes are directly stored in the FlashResult struct, volume(model,result) will just call volume(result) instead. Similarly, volume(model,result::FlashResult,i) will just call volume(result,i).
The volume computation may fail and return NaN because the default initial point is too far from the actual volume. Providing a value for vol0 may help in these situations. Such a starting point can be found from physical knowledge, or by computing the volume using a different model for example.
The stability check is disabled by default. That means that the volume obtained just follows the relation p = pressure(model,V,T,z). For single component models, this is alright, but phase splits (with different compositions that the input) can and will occur, meaning that the volume solution does not correspond to an existing phase. For unknown multicomponent mixtures, it is recommended to use a phase equilibrium procedure (like tp_flash) to obtain a list of valid compositions, and then perform a volume calculation over those compositions. You can also pass phase=:stable to perform the stability test inside the volume solver. Finally, you can perform the stability test after the volume solver:
v = volume(model,p,T,z)
isstable(model,v,T,z)Clapeyron.pressure — Function
pressure(model::EoSModel, V, T, z=SA[1.])
pressure(model, result::FlashResult)Default units: [Pa]
Returns the pressure of the model at a given volume V, temperature T and composition z, defined as:
p = -∂A/∂Vwhere A is the Helmholtz energy [J], V is the volume [m³]
pressure(model, result::FlashResult) will return the equilibrium pressure stored in the result argument.
Clapeyron.helmholtz_energy — Function
helmholtz_free_energy(model::EoSModel, p, T, z=SA[1.]; phase=:unknown, threaded=true, vol0=nothing)
helmholtz_energy(model::EoSModel, p, T, z=SA[1.]; phase=:unknown, threaded=true, vol0=nothing)
helmholtz_free_energy(model, result::FlashResult)
helmholtz_free_energy(model, result::FlashResult, phase_index::Int)Default units: [J]
Calculates the Helmholtz energy, defined as:
A = eos(model,V(p),T,z)helmholtz_free_energy(model,result::FlashResult) will return the Helmholtz energy of the aggregate of phases stored in the FlashResult whereas helmholtz_free_energy(model,result::FlashResult,i::Int) will return the Helmholtz energy of the ith phase.
For Helmholtz-based models, it calls Clapeyron.volume to obtain V and evaluate the property in a volume-temperature (VT) basis. The keywords phase, threaded and vol0 are passed to the Clapeyron.volume solver. If you already have a volume, the VT0 module is available to evaluate this property directly in the VT basis, bypassing the volume iterative calculation.
Gibbs-based models are instead evaluated directly in the pressure-temperature basis.
Clapeyron.helmholtz_energy_res — Function
helmholtz_free_energy_res(model::EoSModel, p, T, z=SA[1.]; phase=:unknown, threaded=true, vol0=nothing)
helmholtz_energy_res(model::EoSModel, p, T, z=SA[1.]; phase=:unknown, threaded=true, vol0=nothing)
helmholtz_free_energy_res(model, result::FlashResult)
helmholtz_free_energy_res(model, result::FlashResult, phase_index::Int)Default units: [J]
Calculates the residual Helmholtz energy, defined as:
A = eos_res(model,V(p),T,z)helmholtz_free_energy_res(model,result::FlashResult) will return the residual Helmholtz energy of the aggregate of phases stored in the FlashResult whereas helmholtz_free_energy_res(model,result::FlashResult,i::Int) will return the residual Helmholtz energy of the ith phase.
For Helmholtz-based models, it calls Clapeyron.volume to obtain V and evaluate the property in a volume-temperature (VT) basis. The keywords phase, threaded and vol0 are passed to the Clapeyron.volume solver. If you already have a volume, the VT0 module is available to evaluate this property directly in the VT basis, bypassing the volume iterative calculation.
Gibbs-based models are instead evaluated directly in the pressure-temperature basis.
Clapeyron.molar_density — Function
molar_density(model::EoSModel, p, T, z=SA[1.]; phase=:unknown, threaded=true, vol0=nothing)
molar_density(result::FlashResult)
molar_density(model, result::FlashResult)
molar_density(result::FlashResult, phase_index::Int)
molar_density(model, result::FlashResult, phase_index::Int)Default units: [mol·m⁻³]
Calculates the molar density, defined as:
ρₙ = ∑nᵢ/Vmolar_density(model,result::FlashResult) will return the molar density of the aggregate of phases stored in the FlashResult whereas molar_density(model,result::FlashResult,i::Int) will return the molar density of the ith phase. Because molar volumes are directly stored in the FlashResult struct, molar_density(model,result) will just call molar_density(result) instead. Similarly, molar_density(model,result::FlashResult,i) will just call molar_density(result,i).
For Helmholtz-based models, it calls Clapeyron.volume to obtain V and evaluate the property in a volume-temperature (VT) basis. The keywords phase, threaded and vol0 are passed to the Clapeyron.volume solver. If you already have a volume, the VT0 module is available to evaluate this property directly in the VT basis, bypassing the volume iterative calculation.
Gibbs-based models are instead evaluated directly in the pressure-temperature basis.
Clapeyron.mass_density — Function
mass_density(model::EoSModel, p, T, z=SA[1.]; phase=:unknown, threaded=true)
mass_density(model, result::FlashResult)
mass_density(model, result::FlashResult, phase_index::Int)Default units: [kg·m⁻³]
Calculates the mass density, defined as:
ρₙ = Mr/VWhere Mr is the molecular weight of the model at the input composition.
mass_density(model,result::FlashResult) will return the mass density of the aggregate of phases stored in the FlashResult whereas mass_density(model,result::FlashResult,i::Int) will return the mass density of the ith phase.
For Helmholtz-based models, it calls Clapeyron.volume to obtain V and evaluate the property in a volume-temperature (VT) basis. The keywords phase, threaded and vol0 are passed to the Clapeyron.volume solver. If you already have a volume, the VT0 module is available to evaluate this property directly in the VT basis, bypassing the volume iterative calculation.
Gibbs-based models are instead evaluated directly in the pressure-temperature basis.
Clapeyron.compressibility_factor — Function
compressibility_factor(model::EoSModel, p, T, z=SA[1.]; phase=:unknown, threaded=true, vol0=nothing)
compressibility_factor(result::FlashResult)
compressibility_factor(model, result::FlashResult)
compressibility_factor(result::FlashResult, phase_index::Int)
compressibility_factor(model, result::FlashResult, phase_index::Int)Calculates the compressibility factor Z, defined as:
Z = p*V(p)/R*Tcompressibility_factor(model,result::FlashResult) will calculate the property only if there is a single phase in the result, and error otherwise. compressibility_factor(model,result::FlashResult, i::Int) will calculate the property at the ith phase of a FlashResult. Because molar volumes and pressures are directly stored in the FlashResult struct, compressibility_factor(model,result) will just call compressibility_factor(result) instead. Similarly, compressibility_factor(model,result::FlashResult,i) will just call compressibility_factor(result,i).
For Helmholtz-based models, it calls Clapeyron.volume to obtain V and evaluate the property in a volume-temperature (VT) basis. The keywords phase, threaded and vol0 are passed to the Clapeyron.volume solver. If you already have a volume, the VT0 module is available to evaluate this property directly in the VT basis, bypassing the volume iterative calculation.
Gibbs-based models are instead evaluated directly in the pressure-temperature basis.
Clapeyron.gibbs_energy — Function
gibbs_free_energy(model::EoSModel, p, T, z=SA[1.]; phase=:unknown, threaded=true, vol0=nothing)
gibbs_energy(model::EoSModel, p, T, z=SA[1.]; phase=:unknown, threaded=true, vol0=nothing)
gibbs_free_energy(model, result::FlashResult)
gibbs_free_energy(model, result::FlashResult, phase_index::Int)Default units: [J]
Calculates the Gibbs energy, defined as:
G = A + p*Vgibbs_free_energy(model,result::FlashResult) will return the Gibbs energy of the aggregate of phases stored in the FlashResult whereas gibbs_free_energy(model,result::FlashResult,i::Int) will return the Gibbs energy of the ith phase.
For Helmholtz-based models, it calls Clapeyron.volume to obtain V and evaluate the property in a volume-temperature (VT) basis. The keywords phase, threaded and vol0 are passed to the Clapeyron.volume solver. If you already have a volume, the VT0 module is available to evaluate this property directly in the VT basis, bypassing the volume iterative calculation.
Gibbs-based models are instead evaluated directly in the pressure-temperature basis.
Clapeyron.gibbs_energy_res — Function
gibbs_free_energy_res(model::EoSModel, p, T, z=SA[1.]; phase=:unknown, threaded=true, vol0=nothing)
gibbs_energy_res(model::EoSModel, p, T, z=SA[1.]; phase=:unknown, threaded=true, vol0=nothing)
gibbs_free_energy_res(model, result::FlashResult)
gibbs_free_energy_res(model, result::FlashResult, phase_index::Int)Default units: [J]
Calculates the residual Gibbs energy, defined as:
G = Ar - V*∂Ar/∂Vgibbs_free_energy_res(model,result::FlashResult) will return the residual Gibbs energy of the aggregate of phases stored in the FlashResult whereas gibbs_free_energy_res(model,result::FlashResult,i::Int) will return the residual Gibbs energy of the ith phase.
For Helmholtz-based models, it calls Clapeyron.volume to obtain V and evaluate the property in a volume-temperature (VT) basis. The keywords phase, threaded and vol0 are passed to the Clapeyron.volume solver. If you already have a volume, the VT0 module is available to evaluate this property directly in the VT basis, bypassing the volume iterative calculation.
Gibbs-based models are instead evaluated directly in the pressure-temperature basis.
Clapeyron.entropy — Function
entropy(model::EoSModel, p, T, z=SA[1.]; phase=:unknown, threaded=true, vol0=nothing)
entropy(model, result::FlashResult)
entropy(model, result::FlashResult, phase_index::Int)Default units: [J·K⁻¹]
Calculates entropy, defined as:
S = -∂A/∂Tentropy(model,result::FlashResult) will return the entropy of the aggregate of phases stored in the FlashResult whereas entropy(model,result::FlashResult,i::Int) will return the entropy of the ith phase.
For Helmholtz-based models, it calls Clapeyron.volume to obtain V and evaluate the property in a volume-temperature (VT) basis. The keywords phase, threaded and vol0 are passed to the Clapeyron.volume solver. If you already have a volume, the VT0 module is available to evaluate this property directly in the VT basis, bypassing the volume iterative calculation.
Gibbs-based models are instead evaluated directly in the pressure-temperature basis.
Clapeyron.entropy_res — Function
entropy_res(model::EoSModel, p, T, z=SA[1.]; phase=:unknown, threaded=true, vol0=nothing)
entropy_res(model, result::FlashResult)
entropy_res(model, result::FlashResult, phase_index::Int)Default units: [J·K⁻¹]
Calculates residual entropy, defined as:
S = -∂Ares/∂Tentropy_res(model,result::FlashResult) will return the residual entropy of the aggregate of phases stored in the FlashResult whereas entropy_res(model,result::FlashResult,i::Int) will return the residual entropy of the ith phase.
For Helmholtz-based models, it calls Clapeyron.volume to obtain V and evaluate the property in a volume-temperature (VT) basis. The keywords phase, threaded and vol0 are passed to the Clapeyron.volume solver. If you already have a volume, the VT0 module is available to evaluate this property directly in the VT basis, bypassing the volume iterative calculation.
Gibbs-based models are instead evaluated directly in the pressure-temperature basis.
Clapeyron.enthalpy — Function
enthalpy(model::EoSModel, p, T, z=SA[1.]; phase=:unknown, threaded=true, vol0=nothing)
enthalpy(model, result::FlashResult)
enthalpy(model, result::FlashResult, phase_index::Int)Default units: [J]
Calculates the enthalpy, defined as:
H = A - T * ∂A/∂T - V * ∂A/∂Venthalpy(model,result::FlashResult) will return the enthalpy of the aggregate of phases stored in the FlashResult whereas enthalpy(model,result::FlashResult,i::Int) will return the enthalpy of the ith phase.
For Helmholtz-based models, it calls Clapeyron.volume to obtain V and evaluate the property in a volume-temperature (VT) basis. The keywords phase, threaded and vol0 are passed to the Clapeyron.volume solver. If you already have a volume, the VT0 module is available to evaluate this property directly in the VT basis, bypassing the volume iterative calculation.
Gibbs-based models are instead evaluated directly in the pressure-temperature basis.
Clapeyron.enthalpy_res — Function
enthalpy_res(model::EoSModel, p, T, z=SA[1.]; phase=:unknown, threaded=true, vol0=nothing)
enthalpy_res(model, result::FlashResult)
enthalpy_res(model, result::FlashResult, phase_index::Int)Default units: [J]
Calculates the residual enthalpy, defined as:
H = Ar - T * ∂Ar/∂T - V * ∂Ar/∂Venthalpy_res(model,result::FlashResult) will return the residual enthalpy of the aggregate of phases stored in the FlashResult whereas enthalpy_res(model,result::FlashResult,i::Int) will return the residual enthalpy of the ith phase.
For Helmholtz-based models, it calls Clapeyron.volume to obtain V and evaluate the property in a volume-temperature (VT) basis. The keywords phase, threaded and vol0 are passed to the Clapeyron.volume solver. If you already have a volume, the VT0 module is available to evaluate this property directly in the VT basis, bypassing the volume iterative calculation.
Gibbs-based models are instead evaluated directly in the pressure-temperature basis.
Clapeyron.internal_energy — Function
internal_energy(model::EoSModel, p, T, z=SA[1.]; phase=:unknown, threaded=true, vol0=nothing)
internal_energy(model, result::FlashResult)
internal_energy(model, result::FlashResult, phase_index::Int)Default units: [J]
Calculates the internal energy, defined as:
U = A - T * ∂A/∂Tinternal_energy(model,result::FlashResult) will return the internal energy of the aggregate of phases stored in the FlashResult whereas internal_energy(model,result::FlashResult,i::Int) will return the internal energy of the ith phase.
For Helmholtz-based models, it calls Clapeyron.volume to obtain V and evaluate the property in a volume-temperature (VT) basis. The keywords phase, threaded and vol0 are passed to the Clapeyron.volume solver. If you already have a volume, the VT0 module is available to evaluate this property directly in the VT basis, bypassing the volume iterative calculation.
Gibbs-based models are instead evaluated directly in the pressure-temperature basis.
Clapeyron.internal_energy_res — Function
internal_energy_res(model::EoSModel, p, T, z=SA[1.]; phase=:unknown, threaded=true, vol0=nothing)
internal_energy_res(model, result::FlashResult)
internal_energy_res(model, result::FlashResult, phase_index::Int)Default units: [J]
Calculates the residual internal energy, defined as:
U = Ar - T * ∂Ar/∂Tinternal_energy_res(model,result::FlashResult) will return the residual internal energy of the aggregate of phases stored in the FlashResult whereas internal_energy_res(model,result::FlashResult,i::Int) will return the residual internal energy of the ith phase.
For Helmholtz-based models, it calls Clapeyron.volume to obtain V and evaluate the property in a volume-temperature (VT) basis. The keywords phase, threaded and vol0 are passed to the Clapeyron.volume solver. If you already have a volume, the VT0 module is available to evaluate this property directly in the VT basis, bypassing the volume iterative calculation.
Gibbs-based models are instead evaluated directly in the pressure-temperature basis.
Mass-based first order bulk properties
Clapeyron.mass_enthalpy — Function
mass_enthalpy(model::EoSModel, p, T, z=SA[1.]; phase=:unknown, threaded=true, vol0=nothing)
mass_enthalpy(model, result::FlashResult)
mass_enthalpy(model, result::FlashResult, phase_index::Int)Default units: [J·kg⁻¹]
Calculates the enthalpy per unit of mass, defined as:
H = (A - T * ∂A/∂T - V * ∂A/∂V)/MrWhere Mr is the molecular weight of the model at the input composition.
mass_enthalpy(model,result::FlashResult) will return the mass enthalpy of the aggregate of phases stored in the FlashResult whereas mass_enthalpy(model,result::FlashResult,i::Int) will return the mass enthalpy of the ith phase.
For Helmholtz-based models, it calls Clapeyron.volume to obtain V and evaluate the property in a volume-temperature (VT) basis. The keywords phase, threaded and vol0 are passed to the Clapeyron.volume solver. If you already have a volume, the VT0 module is available to evaluate this property directly in the VT basis, bypassing the volume iterative calculation.
Gibbs-based models are instead evaluated directly in the pressure-temperature basis.
Clapeyron.mass_entropy — Function
mass_entropy(model::EoSModel, p, T, z=SA[1.]; phase=:unknown, threaded=true, vol0=nothing)
mass_entropy(model, result::FlashResult)
mass_entropy(model, result::FlashResult, phase_index::Int)Default units: [J·kg⁻¹·K⁻¹]
Calculates entropy per unit of mass, defined as:
S = -∂A/∂T/MrWhere Mr is the molecular weight of the model at the input composition.
mass_entropy(model,result::FlashResult) will return the mass entropy of the aggregate of phases stored in the FlashResult whereas mass_entropy(model,result::FlashResult,i::Int) will return the mass entropy of the ith phase.
For Helmholtz-based models, it calls Clapeyron.volume to obtain V and evaluate the property in a volume-temperature (VT) basis. The keywords phase, threaded and vol0 are passed to the Clapeyron.volume solver. If you already have a volume, the VT0 module is available to evaluate this property directly in the VT basis, bypassing the volume iterative calculation.
Gibbs-based models are instead evaluated directly in the pressure-temperature basis.
Clapeyron.mass_internal_energy — Function
mass_internal_energy(model::EoSModel, p, T, z=SA[1.]; phase=:unknown, threaded=true, vol0=nothing)
mass_internal_energy(model, result::FlashResult)
mass_internal_energy(model, result::FlashResult, phase_index::Int)Default units: [J·kg⁻¹]
Calculates the internal energy per unit of mass, defined as:
U = (A - T * ∂A/∂T)/MrWhere Mr is the molecular weight of the model at the input composition.
mass_internal_energy(model,result::FlashResult) will return the mass internal energy of the aggregate of phases stored in the FlashResult whereas mass_internal_energy(model,result::FlashResult,i::Int) will return the mass internal energy of the ith phase.
For Helmholtz-based models, it calls Clapeyron.volume to obtain V and evaluate the property in a volume-temperature (VT) basis. The keywords phase, threaded and vol0 are passed to the Clapeyron.volume solver. If you already have a volume, the VT0 module is available to evaluate this property directly in the VT basis, bypassing the volume iterative calculation.
Gibbs-based models are instead evaluated directly in the pressure-temperature basis.
Clapeyron.mass_gibbs_energy — Function
mass_gibbs_free_energy(model::EoSModel, p, T, z=SA[1.]; phase=:unknown, threaded=true, vol0=nothing)
mass_gibbs_energy(model::EoSModel, p, T, z=SA[1.]; phase=:unknown, threaded=true, vol0=nothing)
mass_gibbs_free_energy(model, result::FlashResult)
mass_gibbs_free_energy(model, result::FlashResult, phase_index::Int)Default units: [J·kg⁻¹]
Calculates the Gibbs energy per unit of mass, defined as:
G = (A + p*V)/MrWhere Mr is the molecular weight of the model at the input composition.
mass_gibbs_free_energy(model,result::FlashResult) will return the mass Gibbs energy of the aggregate of phases stored in the FlashResult whereas mass_gibbs_free_energy(model,result::FlashResult,i::Int) will return the mass Gibbs energy of the ith phase.
For Helmholtz-based models, it calls Clapeyron.volume to obtain V and evaluate the property in a volume-temperature (VT) basis. The keywords phase, threaded and vol0 are passed to the Clapeyron.volume solver. If you already have a volume, the VT0 module is available to evaluate this property directly in the VT basis, bypassing the volume iterative calculation.
Gibbs-based models are instead evaluated directly in the pressure-temperature basis.
Clapeyron.mass_helmholtz_energy — Function
mass_helmholtz_free_energy(model::EoSModel, p, T, z=SA[1.]; phase=:unknown, threaded=true, vol0=nothing)
mass_helmholtz_energy(model::EoSModel, p, T, z=SA[1.]; phase=:unknown, threaded=true, vol0=nothing)
mass_helmholtz_free_energy(model, result::FlashResult)
mass_helmholtz_free_energy(model, result::FlashResult, phase_index::Int)Default units: [J·kg⁻¹]
Calculates the Helmholtz energy per unit of mass, defined as:
A = eos(model,V(p),T,z)/MrWhere Mr is the molecular weight of the model at the input composition.
mass_helmholtz_free_energy(model,result::FlashResult) will return the mass Helmholtz energy of the aggregate of phases stored in the FlashResult whereas mass_helmholtz_free_energy(model,result::FlashResult,i::Int) will return the mass Helmholtz energy of the ith phase.
For Helmholtz-based models, it calls Clapeyron.volume to obtain V and evaluate the property in a volume-temperature (VT) basis. The keywords phase, threaded and vol0 are passed to the Clapeyron.volume solver. If you already have a volume, the VT0 module is available to evaluate this property directly in the VT basis, bypassing the volume iterative calculation.
Gibbs-based models are instead evaluated directly in the pressure-temperature basis.
Second order bulk methods
The following methods are calculated as combinations all derivatives up to the second order of the helmholtz energy with respect to volume and temperature, or all derivatives up to the second order of the gibbs energy with respect to pressure and temperature.
Clapeyron.isochoric_heat_capacity — Function
isochoric_heat_capacity(model::EoSModel, p, T, z=SA[1.]; phase=:unknown, threaded=true, vol0=nothing)
isochoric_heat_capacity(model, result::FlashResult)
isochoric_heat_capacity(model, result::FlashResult, phase_index::Int)Default units: [J·K⁻¹]
Calculates the isochoric heat capacity, defined as:
Cv = -T * ∂²A/∂T²Internally, it calls Clapeyron.volume to obtain V and calculates the property via VT_isochoric_heat_capacity(model,V,T,z).
isochoric_heat_capacity(model,result::FlashResult) will calculate the property only if there is a single phase in the result, and error otherwise. isochoric_heat_capacity(model,result::FlashResult, i::Int) will calculate the property at the ith phase of a FlashResult.
For Helmholtz-based models, it calls Clapeyron.volume to obtain V and evaluate the property in a volume-temperature (VT) basis. The keywords phase, threaded and vol0 are passed to the Clapeyron.volume solver. If you already have a volume, the VT0 module is available to evaluate this property directly in the VT basis, bypassing the volume iterative calculation.
Gibbs-based models are instead evaluated directly in the pressure-temperature basis.
Clapeyron.isobaric_heat_capacity — Function
isobaric_heat_capacity(model::EoSModel, p, T, z=SA[1.]; phase=:unknown, threaded=true, vol0=nothing)
isobaric_heat_capacity(model, result::FlashResult)
isobaric_heat_capacity(model, result::FlashResult, phase_index::Int)Default units: [J·K⁻¹]
Calculates the isobaric heat capacity, defined as:
Cp = -T*(∂²A/∂T² - (∂²A/∂V∂T)^2 / ∂²A/∂V²)isobaric_heat_capacity(model,result::FlashResult) will calculate the property only if there is a single phase in the result, and error otherwise. isobaric_heat_capacity(model,result::FlashResult, i::Int) will calculate the property at the ith phase of a FlashResult.
For Helmholtz-based models, it calls Clapeyron.volume to obtain V and evaluate the property in a volume-temperature (VT) basis. The keywords phase, threaded and vol0 are passed to the Clapeyron.volume solver. If you already have a volume, the VT0 module is available to evaluate this property directly in the VT basis, bypassing the volume iterative calculation.
Gibbs-based models are instead evaluated directly in the pressure-temperature basis.
Clapeyron.adiabatic_index — Function
adiabatic_index(model::EoSModel, p, T, z=SA[1.]; phase=:unknown, threaded=true, vol0=nothing)
adiabatic_index(model, result::FlashResult)
adiabatic_index(model, result::FlashResult, phase_index::Int)Calculates the adiabatic index, defined as:
γ = Cp/Cvadiabatic_index(model,result::FlashResult) will calculate the property only if there is a single phase in the result, and error otherwise. adiabatic_index(model,result::FlashResult, i::Int) will calculate the property at the ith phase of a FlashResult.
For Helmholtz-based models, it calls Clapeyron.volume to obtain V and evaluate the property in a volume-temperature (VT) basis. The keywords phase, threaded and vol0 are passed to the Clapeyron.volume solver. If you already have a volume, the VT0 module is available to evaluate this property directly in the VT basis, bypassing the volume iterative calculation.
Gibbs-based models are instead evaluated directly in the pressure-temperature basis.
Clapeyron.isothermal_compressibility — Function
isothermal_compressibility(model::EoSModel, p, T, z=SA[1.]; phase=:unknown, threaded=true, vol0=nothing)
isothermal_compressibility(model, result::FlashResult)
isothermal_compressibility(model, result::FlashResult, phase_index::Int)Default units: [Pa⁻¹]
Calculates the isothermal compressibility, defined as:
κₜ = -(V*∂p/∂V)⁻¹isothermal_compressibility(model,result::FlashResult) will calculate the property only if there is a single phase in the result, and error otherwise. isothermal_compressibility(model,result::FlashResult, i::Int) will calculate the property at the ith phase of a FlashResult.
For Helmholtz-based models, it calls Clapeyron.volume to obtain V and evaluate the property in a volume-temperature (VT) basis. The keywords phase, threaded and vol0 are passed to the Clapeyron.volume solver. If you already have a volume, the VT0 module is available to evaluate this property directly in the VT basis, bypassing the volume iterative calculation.
Gibbs-based models are instead evaluated directly in the pressure-temperature basis.
Clapeyron.isentropic_compressibility — Function
isentropic_compressibility(model::EoSModel, p, T, z=SA[1.]; phase=:unknown, threaded=true, vol0=nothing)
isentropic_compressibility(model, result::FlashResult)
isentropic_compressibility(model, result::FlashResult, phase_index::Int)Default units: [Pa⁻¹]
Calculates the isentropic compressibility, defined as:
κₛ = (V*( ∂²A/∂V² - ∂²A/∂V∂T^2 / ∂²A/∂T² ))⁻¹isentropic_compressibility(model,result::FlashResult) will calculate the property only if there is a single phase in the result, and error otherwise. isentropic_compressibility(model,result::FlashResult, i::Int) will calculate the property at the ith phase of a FlashResult.
For Helmholtz-based models, it calls Clapeyron.volume to obtain V and evaluate the property in a volume-temperature (VT) basis. The keywords phase, threaded and vol0 are passed to the Clapeyron.volume solver. If you already have a volume, the VT0 module is available to evaluate this property directly in the VT basis, bypassing the volume iterative calculation.
Gibbs-based models are instead evaluated directly in the pressure-temperature basis.
Clapeyron.speed_of_sound — Function
speed_of_sound(model::EoSModel, p, T, z=SA[1.]; phase=:unknown, threaded=true, vol0=nothing)
speed_of_sound(model, result::FlashResult)
speed_of_sound(model, result::FlashResult, phase_index::Int)Default units: [m·s⁻¹]
Calculates the speed of sound, defined as:
c = V * √(∂²A/∂V² - ∂²A/∂V∂T^2 / ∂²A/∂T²)/Mr)Where Mr is the molecular weight of the model at the input composition.
speed_of_sound(model,result::FlashResult) will calculate the property only if there is a single phase in the result, and error otherwise. speed_of_sound(model,result::FlashResult, i::Int) will calculate the property at the ith phase of a FlashResult.
For Helmholtz-based models, it calls Clapeyron.volume to obtain V and evaluate the property in a volume-temperature (VT) basis. The keywords phase, threaded and vol0 are passed to the Clapeyron.volume solver. If you already have a volume, the VT0 module is available to evaluate this property directly in the VT basis, bypassing the volume iterative calculation.
Gibbs-based models are instead evaluated directly in the pressure-temperature basis.
Clapeyron.isobaric_expansivity — Function
isobaric_expansivity(model::EoSModel, p, T, z=SA[1.]; phase=:unknown, threaded=true, vol0=nothing)
isobaric_expansivity(model, result::FlashResult)
isobaric_expansivity(model, result::FlashResult, phase_index::Int)Default units: [K⁻¹]
Calculates the isobaric expansivity, defined as:
α = -∂²A/∂V∂T / (V*∂²A/∂V²)isobaric_expansivity(model,result::FlashResult) will calculate the property only if there is a single phase in the result, and error otherwise. isobaric_expansivity(model,result::FlashResult, i::Int) will calculate the property at the ith phase of a FlashResult.
For Helmholtz-based models, it calls Clapeyron.volume to obtain V and evaluate the property in a volume-temperature (VT) basis. The keywords phase, threaded and vol0 are passed to the Clapeyron.volume solver. If you already have a volume, the VT0 module is available to evaluate this property directly in the VT basis, bypassing the volume iterative calculation.
Gibbs-based models are instead evaluated directly in the pressure-temperature basis.
Clapeyron.joule_thomson_coefficient — Function
joule_thomson_coefficient(model::EoSModel, p, T, z=SA[1.]; phase=:unknown, threaded=true, vol0=nothing)
joule_thomson_coefficient(model, result::FlashResult)
joule_thomson_coefficient(model, result::FlashResult, phase_index::Int)Default units: [K·Pa⁻¹]
Calculates the Joule–Thomson coefficient, defined as:
μⱼₜ = -(∂²A/∂V∂T - ∂²A/∂V² * ((T*∂²A/∂T² + V*∂²A/∂V∂T) / (T*∂²A/∂V∂T + V*∂²A/∂V²)))⁻¹joule_thomson_coefficient(model,result::FlashResult) will calculate the property only if there is a single phase in the result, and error otherwise. joule_thomson_coefficient(model,result::FlashResult, i::Int) will calculate the property at the ith phase of a FlashResult.
For Helmholtz-based models, it calls Clapeyron.volume to obtain V and evaluate the property in a volume-temperature (VT) basis. The keywords phase, threaded and vol0 are passed to the Clapeyron.volume solver. If you already have a volume, the VT0 module is available to evaluate this property directly in the VT basis, bypassing the volume iterative calculation.
Gibbs-based models are instead evaluated directly in the pressure-temperature basis.
Clapeyron.inversion_temperature — Function
inversion_temperature(model::EoSModel, p, z=SA[1.0]; phase=:unknown, threaded=true, vol0=nothing)Calculates the inversion temperature T_inv, defined as the temperature where the Joule-Thomson coefficient becomes zero, i.e.
μⱼₜ(T) = 0The keywords phase, threaded and vol0 are passed to the Clapeyron.volume solver.
See also joule_thomson_coefficient.
Clapeyron.fundamental_derivative_of_gas_dynamics — Function
fundamental_derivative_of_gas_dynamics(model::EoSModel, p, T, z=SA[1.]; phase=:gas, threaded=true, vol0=nothing)::Symbol
fundamental_derivative_of_gas_dynamics(model, result::FlashResult)
fundamental_derivative_of_gas_dynamics(model, result::FlashResult, phase_index::Int)Calculates the fundamental derivative of gas dynamics.
fundamental_derivative_of_gas_dynamics(model,result::FlashResult) will calculate the property only if there is a single phase in the result, and error otherwise. fundamental_derivative_of_gas_dynamics(model,result::FlashResult, i::Int) will calculate the property at the ith phase of a FlashResult.
For Helmholtz-based models, it calls Clapeyron.volume to obtain V and evaluate the property in a volume-temperature (VT) basis. The keywords phase, threaded and vol0 are passed to the Clapeyron.volume solver. If you already have a volume, the VT0 module is available to evaluate this property directly in the VT basis, bypassing the volume iterative calculation.
Gibbs-based models are instead evaluated directly in the pressure-temperature basis.
Mass-based second order bulk properties
Clapeyron.mass_isochoric_heat_capacity — Function
mass_isochoric_heat_capacity(model::EoSModel, p, T, z=SA[1.]; phase=:unknown, threaded=true, vol0=nothing)
mass_isochoric_heat_capacity(model, result::FlashResult)
mass_isochoric_heat_capacity(model, result::FlashResult, phase_index::Int)Default units: [J·kg⁻¹·K⁻¹]
Calculates the isochoric heat capacity per unit of mass, defined as:
Cv = -T * ∂²A/∂T² / MrWhere Mr is the molecular weight of the model at the input composition.
mass_isochoric_heat_capacity(model,result::FlashResult) will calculate the property only if there is a single phase in the result, and error otherwise. mass_isochoric_heat_capacity(model,result::FlashResult, i::Int) will calculate the property at the ith phase of a FlashResult.
For Helmholtz-based models, it calls Clapeyron.volume to obtain V and evaluate the property in a volume-temperature (VT) basis. The keywords phase, threaded and vol0 are passed to the Clapeyron.volume solver. If you already have a volume, the VT0 module is available to evaluate this property directly in the VT basis, bypassing the volume iterative calculation.
Gibbs-based models are instead evaluated directly in the pressure-temperature basis.
Clapeyron.mass_isobaric_heat_capacity — Function
mass_isobaric_heat_capacity(model::EoSModel, p, T, z=SA[1.]; phase=:unknown, threaded=true, vol0=nothing)
mass_isobaric_heat_capacity(model, result::FlashResult)
mass_isobaric_heat_capacity(model, result::FlashResult, phase_index::Int)Default units: [J·kg⁻¹·K⁻¹]
Calculates the isobaric heat capacity per unit of mass, defined as:
Cp = (-T*(∂²A/∂T² - (∂²A/∂V∂T)^2 / ∂²A/∂V²))/MrWhere Mr is the molecular weight of the model at the input composition.
mass_isobaric_heat_capacity(model,result::FlashResult) will calculate the property only if there is a single phase in the result, and error otherwise. mass_isobaric_heat_capacity(model,result::FlashResult, i::Int) will calculate the property at the ith phase of a FlashResult.
For Helmholtz-based models, it calls Clapeyron.volume to obtain V and evaluate the property in a volume-temperature (VT) basis. The keywords phase, threaded and vol0 are passed to the Clapeyron.volume solver. If you already have a volume, the VT0 module is available to evaluate this property directly in the VT basis, bypassing the volume iterative calculation.
Gibbs-based models are instead evaluated directly in the pressure-temperature basis.
Temperature-only based properties
The following methods depend only on temperature and/or composition.
Clapeyron.second_virial_coefficient — Function
second_virial_coefficient(model::EoSModel, T, z=SA[1.])Default units: [m³]
Calculates the second virial coefficient B, defined as:
B = lim(ρ->0)[∂Aᵣ/∂ρ]where Aᵣ is the residual Helmholtz energy.
Clapeyron.cross_second_virial — Function
cross_second_virial(model,T,z)Default units: [m³]
Calculates the second cross virial coefficient (B₁₂) of a binary mixture, using the definition:
B̄ = x₁^2*B₁₁ + 2x₁x₂B₁₂ + x₂^2*B₂₂
B₁₂ = (B̄ - x₁^2*B₁₁ - x₂^2*B₂₂)/2x₁x₂The second cross virial coefficient calculated from an equation of state can present a dependency on composition [1], but normally, experiments for obtaining the second virial coefficient are made by mixing the same volume of two gases. You can calculate B₁₂ in this way by using (Clapeyron.equivolcrosssecond_virial)[@ref]
References
- Jäger, A., Breitkopf, C., & Richter, M. (2021). The representation of cross second virial coefficients by multifluid mixture models and other equations of state. Industrial & Engineering Chemistry Research, 60(25), 9286–9295. doi:10.1021/acs.iecr.1c01186
Clapeyron.equivol_cross_second_virial — Function
equivol_cross_second_virial(model::EoSModel,T,p_exp = 200000.0)Calculates the second cross virial coefficient, by simulating the mixing of equal volumes of pure gas, at T,P conditions. The equal volume of each pure gas sets an specific molar amount for each component. Details of the experiment can be found at [1].
Example
model = SAFTVRQMie(["helium","neon"])
B12 = equivol_cross_second_virial(model,model,T,p_exp = 200000.0)
References
- Brewer, J., & Vaughn, G. W. (1969). Measurement and correlation of some interaction second virial coefficients from − 125° to 50°C. I. The Journal of Chemical Physics, 50(7), 2960–2968. doi:10.1063/1.1671491
Chemical potential functions
Clapeyron.chemical_potential — Function
chemical_potential(model::EoSModel, p, T, z=SA[1.]; phase=:unknown, threaded=true, vol0=nothing)
chemical_potential(model, result::FlashResult)
chemical_potential(model, result::FlashResult, phase_index::Int)Default units: [J·mol⁻¹]
Calculates the chemical potential, defined as:
μᵢ = ∂A/∂nᵢchemical_potential(model,result::FlashResult) will return the chemical potential of the aggregate of phases stored in the FlashResult whereas chemical_potential(model,result::FlashResult,i::Int) will return the chemical potential of the ith phase.
For Helmholtz-based models, it calls Clapeyron.volume to obtain V and evaluate the property in a volume-temperature (VT) basis. The keywords phase, threaded and vol0 are passed to the Clapeyron.volume solver. If you already have a volume, the VT0 module is available to evaluate this property directly in the VT basis, bypassing the volume iterative calculation.
Gibbs-based models are instead evaluated directly in the pressure-temperature basis.
Clapeyron.chemical_potential_res — Function
chemical_potential_res(model::EoSModel, p, T, z=SA[1.]; phase=:unknown, threaded=true, vol0=nothing)
chemical_potential_res(model, result::FlashResult)
chemical_potential_res(model, result::FlashResult, phase_index::Int)Default units: [J·mol⁻¹]
Calculates the residual chemical potential, defined as:
μresᵢ = ∂Ares/∂nᵢchemical_potential_res(model,result::FlashResult) will return the residual chemical potential of the aggregate of phases stored in the FlashResult whereas chemical_potential_res(model,result::FlashResult,i::Int) will return the residual chemical potential of the ith phase.
For Helmholtz-based models, it calls Clapeyron.volume to obtain V and evaluate the property in a volume-temperature (VT) basis. The keywords phase, threaded and vol0 are passed to the Clapeyron.volume solver. If you already have a volume, the VT0 module is available to evaluate this property directly in the VT basis, bypassing the volume iterative calculation.
Gibbs-based models are instead evaluated directly in the pressure-temperature basis.
Clapeyron.fugacity_coefficient — Function
fugacity_coefficient(model::EoSModel, p, T, z=SA[1.]; phase=:unknown, threaded=true, vol0=nothing)Calculates the fugacity coefficient φᵢ, defined as:
log(φᵢ) = μresᵢ/RT - log(Z)Where μresᵢ is the vector of residual chemical potentials and Z is the compressibility factor.
For Helmholtz-based models, it calls Clapeyron.volume to obtain V and evaluate the property in a volume-temperature (VT) basis. The keywords phase, threaded and vol0 are passed to the Clapeyron.volume solver. If you already have a volume, the VT0 module is available to evaluate this property directly in the VT basis, bypassing the volume iterative calculation.
Gibbs-based models are instead evaluated directly in the pressure-temperature basis.
Clapeyron.activity_coefficient — Function
activity_coefficient(model::EoSModel,p,T,z=SA[1.0];reference = :pure, phase=:unknown, threaded=true, vol0=nothing)Calculates the activity, defined as:
log(γ*z) = (μ_mixt - μ_ref) / R̄ / Twhere μ_mixt is the chemical potential of the mixture and μ_ref is the reference chemical potential for the model at p,T conditions, calculated via Clapeyron.reference_chemical_potential. If the μ_ref keyword argument is not provided, the reference keyword is used to specify the reference chemical potential.
For Helmholtz-based models, it calls Clapeyron.volume to obtain V and evaluate the property in a volume-temperature (VT) basis. The keywords phase, threaded and vol0 are passed to the Clapeyron.volume solver. If you already have a volume, the VT0 module is available to evaluate this property directly in the VT basis, bypassing the volume iterative calculation.
Gibbs-based models are instead evaluated directly in the pressure-temperature basis.
Clapeyron.activity — Function
activity(model::EoSModel,p,T,z=SA[1.0];reference = :pure, phase=:unknown, threaded=true, vol0=nothing)Calculates the activity, defined as:
log(a) = (μ_mixt - μ_ref) / R̄ / Twhere μ_mixt is the chemical potential of the mixture and μ_ref is the reference chemical potential for the model at p,T conditions, calculated via Clapeyron.reference_chemical_potential. If the μ_ref keyword argument is not provided, the reference keyword is used to specify the reference chemical potential.
For Helmholtz-based models, it calls Clapeyron.volume to obtain V and evaluate the property in a volume-temperature (VT) basis. The keywords phase, threaded and vol0 are passed to the Clapeyron.volume solver. If you already have a volume, the VT0 module is available to evaluate this property directly in the VT basis, bypassing the volume iterative calculation.
Gibbs-based models are instead evaluated directly in the pressure-temperature basis.
Clapeyron.aqueous_activity — Function
aqueous_activity(model::EoSModel,p,T,z=SA[1.0]; phase=:unknown, threaded=true, vol0=nothing)Calculates the activity with the reference being infinite dilution in water, defined as:
log(a) = (μ_mixt - μ_inf) / R̄ / Twhere μ_mixt is the chemical potential of the mixture and μ_inf is the chemical potential of the components at infinite dilution in water.
For Helmholtz-based models, it calls Clapeyron.volume to obtain V and evaluate the property in a volume-temperature (VT) basis. The keywords phase, threaded and vol0 are passed to the Clapeyron.volume solver. If you already have a volume, the VT0 module is available to evaluate this property directly in the VT basis, bypassing the volume iterative calculation.
Gibbs-based models are instead evaluated directly in the pressure-temperature basis.
Clapeyron.reference_chemical_potential — Function
reference_chemical_potential(model::EoSModel,p,T,reference; phase=:unknown, threaded=true, vol0=nothing)Returns a reference chemical potential. Used in calculation of activity and activity_coefficient. There are two available references:
:pure: the reference potential is a pure component at specifiedT,pandphase:aqueous: the chemical potential of the pure components at specifiedT,pandphase:sat_pure_T: the reference potential is the pure saturated liquid phase at specifiedT.:zero: the reference potential is equal to zero for all components (used forActivityModel)
The keywords phase, threaded and vol0 are passed to the Clapeyron.volume solver.
Clapeyron.reference_chemical_potential_type — Function
reference_chemical_potential_type(model)::SymbolReturns a symbol with the type of reference chemical potential used by the input model.
Mixing and partial properties
Clapeyron.mixing — Function
mixing(model::EoSModel, p, T, z=SA[1.], property; phase=:unknown, threaded=true, vol0=nothing)Calculates the mixing function for a specified property as:
f_mix = f(p,T,z) - ∑zᵢ*f_pureᵢ(p,T)The keywords phase, threaded and vol0 are passed to the Clapeyron.volume solver.
Clapeyron.excess — Function
excess(model::EoSModel, p, T, z, property; phase=:unknown, threaded=true, vol0=nothing)Returns the excess value of a bulk property relative to its ideal mixing value.
By default this delegates to mixing. For some properties (e.g. entropy and gibbs_free_energy) specialized implementations are provided to use residual contributions.
Clapeyron.partial_property — Function
partial_property(model::EoSModel, p, T, z, property::X; phase=:unknown, threaded=true, vol0=nothing) where {X} is any extensive property.Calculates the partial molar property of a mixture at specified temperature, pressure, mol amounts, and extensive property of interest. The equality sum(z .* partial_property(model,p,T,z,property) - property(model,p,T,z)) should hold.
The keywords phase, threaded and vol0 are passed to the Clapeyron.volume solver.
Missing docstring for Clapeyron.shape_factors. Check Documenter's build log for details.
Clapeyron.thermodynamic_factor — Function
thermodynamic_factor(model::EoSModel, p, T, z=SA[1.]; phase=:unknown, threaded=true, vol0=nothing)Calculates the thermodynamic factor matrix Γᵢⱼ (size: N-1 × N-1) defined as:
Γᵢⱼ = δᵢⱼ + xᵢ ∂lnγᵢ/∂xⱼPhase identification
Clapeyron.pip — Function
pip(model::EoSModel,V,T,z=[1.0])Phase identification parameter Π, as described in 1. If Π > 1, then the phase is clasified as a liquid or a liquid-like vapor, being a vapor or vapor-like liquid otherwise.
This identification parameter fails at temperatures and pressures well above the critical point.
Calculated as:
Π = V*((∂²p/∂V∂T)/(∂p/∂T) - (∂²p/∂V²)/(∂p/∂V))References
- G. Venkatarathnama, L.R. Oellrich, Identification of the phase of a fluid using partial derivatives of pressure, volume,and temperature without reference to saturation properties: Applications in phase equilibria calculations, Fluid Phase Equilibria 301 (2011) 225–233
Clapeyron.identify_phase — Function
identify_phase(model::EoSModel, p, T, z=SA[1.]; phase=:unknown, threaded=true, vol0=nothing)::Symbol
identify_phase(result::FlashResult, i::Int)
identify_phase(model::EoSModel, result::FlashResult, i::Int)Returns the phase of a fluid at the conditions specified by V, T and z. Uses the phase identification parameter criteria from Clapeyron.pip.
Returns :liquid if the phase is liquid (or liquid-like), :vapour if the phase is vapour (or vapour-like), and :unknown if the calculation of the phase identification parameter failed.
identify_phase(model,result::FlashResult,i::Int) will return the phase type of the ith phase stored in the result, if available. identify_phase(model,result,i) will try to get the stored result first, and fallback to identify_phase(model,p,T,xi) if there is no phase stored.
For Helmholtz-based models, it calls Clapeyron.volume to obtain V and evaluate the property in a volume-temperature (VT) basis. The keywords phase, threaded and vol0 are passed to the Clapeyron.volume solver. If you already have a volume, the VT0 module is available to evaluate this property directly in the VT basis, bypassing the volume iterative calculation.
Gibbs-based models are instead evaluated directly in the pressure-temperature basis.
Initial guess functions
These methods are considered internal, they don't support Symbolics.jl or Unitful.jl overloads.
Clapeyron.lb_volume — Function
lb_volume(model::EoSModel)
lb_volume(model::EoSModel,z)
lb_volume(model::EoSModel,T,z)Returns the lower bound volume. It has different meanings depending on the Equation of State, but symbolizes the minimum allowable volume at a certain composition:
- SAFT EoS: the packing volume
- Cubic EoS, covolume (b) parameter
On empiric equations of state, the value is chosen to match the volume of the conditions at maximum pressure and minimum temperature, but the equation itself normally can be evaluated at lower volumes. On SAFT and Cubic EoS, volumes lower than lb_volume will likely error. The lower bound volume is used for guesses of liquid volumes at a certain pressure, saturated liquid volumes and critical volumes.
In most cases, the lower bound volume is independent of temperature. Some notable exceptions are the Quantum-Corrected Peng-Robinson cubic (QCPR) and Cubic-plus-Chain (CPC) models. For those, it is better to define the three-argument variant lb_volume(model,T,z)
Clapeyron.T_scale — Function
T_scale(model::EoSModel,z)Represents a temperature scaling factor.
On any EoS based on Critical parameters (Cubic or Empiric EoS), the temperature scaling factor is chosen to be the critical temperature. On SAFT or other molecular EoS, the temperature scaling factor is chosen to be a function of the potential depth ϵ. Used as scaling factors in saturation_pressure and as input for solving crit_pure
Clapeyron.p_scale — Function
p_scale(model::EoSModel,z)Represents a pressure scaling factor.
On any EoS based on Critical parameters (Cubic or Empiric EoS), the pressure scaling factor is chosen to be a function of the critical pressure. On SAFT or other molecular EoS, the pressure scaling factor is chosen to a function of ∑(zᵢϵᵢ(σᵢᵢ)³) Used as scaling factors in saturation_pressure and as input for solving crit_pure.
By default, it can be defined as a function of Clapeyron.lb_volume and Clapeyron.T_scale
Clapeyron.x0_volume — Function
x0_volume(model,p,T,z; phase = :unknown)Returns an initial guess of the volume at a pressure, temperature, composition and suggested phase. If the suggested phase is :unknown or :liquid, calls x0_volume_liquid. If the suggested phase is :gas, calls x0_volume_gas. If the suggested phase is solid, calls x0_volume_solid. Returns NaN otherwise.
Clapeyron.x0_volume_solid — Function
x0_volume_solid(model,T,z)
x0_volume_solid(model,p,T,z)Returns an initial guess to the solid volume, dependent on temperature T and composition z. Needs to be defined for EoS that support solid phase. By default returns NaN. Can be overrided if the EoS defines is_solid(::EoSModel) = true.
Clapeyron.x0_volume_liquid — Function
x0_volume_liquid(model,T,z)
x0_volume_liquid(model,p,T,z)Returns an initial guess to the liquid volume, dependent on temperature T and composition z. By default is 1.25 times lb_volume.
Clapeyron.x0_volume_gas — Function
x0_volume_gas(model,p,T,z)Returns an initial guess to the gas volume, depending of pressure p, temperature T and composition z. By default uses volume_virial
Clapeyron.volume_virial — Function
volume_virial(model::EoSModel,p,T,z=SA[1.0])
volume_virial(B::Real,p,T,z=SA[1.0])Calculates an approximation to the gas volume at specified pressure p, temperature T and composition z, by aproximating:
Z(v) ≈ 1 + B(T)/vwhere Z is the compressibility factor and B is the second virial coefficient. If B>0, (over the inversion temperature) returns NaN. If the solution to the problem is complex (Z = 1 + B/v implies solving a quadratic polynomial), returns -2*B. If you pass an EoSModel as the first argument, B will be calculated from the EoS at the input temperature T. You can provide your own second virial coefficient instead of a model.
Clapeyron.x0_sat_pure — Function
x0_sat_pure(model::EoSModel,T)
x0_sat_pure(model,T,crit)Returns a 2-tuple corresponding to (Vₗ,Vᵥ), where Vₗ and Vᵥ are the liquid and vapor initial guesses. Used in saturation_pressure methods that require initial volume guesses. It can be overloaded to provide more accurate estimates if necessary. If an EoS model provides a fast method for crit_pure, overloading has_fast_crit_pure will provide x0_sat_pure with additional information to improve its accuracy.
Clapeyron.x0_psat — Function
x0_psat(model::EoSModel, T,crit = nothing)Initial point for saturation pressure, given the temperature and V,T critical coordinates. On moderate pressures it will use a Zero Pressure initialization. On pressures near the critical point it will switch to spinodal finding. Used in saturation_pressure methods that require initial pressure guesses. If the initial temperature is over the critical point, it returns NaN. It can be overloaded to provide more accurate estimates if necessary.
Clapeyron.x0_saturation_temperature — Function
x0_saturation_temperature(model::EoSModel,p)Returns a 3-tuple corresponding to (T,Vₗ,Vᵥ), T is the initial guess for temperature and Vₗ and Vᵥ are the liquid and vapor initial guesses. Used in saturation_temperature with AntoineSaturation.
Clapeyron.x0_crit_pure — Function
x0_crit_pure(model::EoSModel,z)Returns a 2-tuple corresponding to (k,log10(Vc0)), where k is Tc0/T_scale(model,z)
Inverse property solvers
Clapeyron.Tproperty — Function
Tproperty(model::EoSModel,p,prop,z::AbstractVector,property = enthalpy;rootsolver = Roots.Order0(),phase =:unknown,abstol = 1e-15,reltol = 1e-15, verbose = false)Given p and any other bulk property prop calculated via property, returns the required temperature T such that property(model,p,T,z,phase) = prop.
Not all cases of pressure will work as Clapeyron.bubble_temperature(model,p,z) and Clapeyron.dew_temperature(model,p,z) does not always find a correct starting point.
Clapeyron.Pproperty — Function
Pproperty(model::EoSModel,T,prop,z = SA[1.0],property::TT = enthalpy;rootsolver = Roots.Order0(),phase =:unknown,abstol = 1e-15,reltol = 1e-15, verbose = false)Given T and any other bulk property prop calculated via property, returns the required pressure p such that property(model,p,T,z,phase) = prop.
Not all cases of temperature will work as Clapeyron.bubble_pressure(model,T,z) and Clapeyron.dew_pressure(model,T,z) does not always find a correct starting point.
Bulk properties in other basis
Clapeyron.VT0 — Module
VT0Module that stores Clapeyron properties in (total) volume-temperature basis.
Usage
using Clapeyron.VT0
model = PR("water")
T = 300.0
V = volume(model,1e5,T,phase = :l)
VT0.enthalpy(model,V,T)The functions stored in the VT0 module do not perform any type of phase stability checking. The user must be sure to give a physically sensible volume value. For calculations in volume-temperature basis that check and calculate if there are multiple phases, use the [VT] module instead.
Clapeyron.PT0 — Module
PT0Module that stores Clapeyron properties in (total) volume-temperature basis.
All bulk properties have the following form:
property(model,p,T,z,phase=:unknown, threaded=true, vol0=nothing)The keywords phase, threaded and vol0 are passed to the Clapeyron.volume solver.
only a volume solver is done to get the volume from the corresponding pressure-temperature pair. For a module that does a flash to check if there are more than one phase use the PT module instead.
Clapeyron.PT — Module
PTModule that stores Clapeyron properties in pressure-temperature basis.
All bulk properties have the following form:
property(model,p,T,z,phase=:unknown)If no phase argument is passed as an input, a pressure-temperature flash is done to check if the input pair corresponds to one or more phases. To evaluate the property directly in the P-T base, use the PT0 module instead.
Clapeyron.VT — Module
VTModule that stores Clapeyron properties in (total) volume-temperature basis.
All bulk properties have the following form:
property(model,V,T,z;p0 = nothing)A volume-temperature flash is done to check if the volume-temperature input pair corresponds to one or more phases. a p0 argument can be used to provide an initial pressure guess to the V-T flash. To evaluate the property directly in the V-T base, use the VT0 module instead.
Clapeyron.PS — Module
PSModule that stores Clapeyron properties in pressure - (total) entropy basis.
All bulk properties have the following form:
property(model,p,s,z;phase = :unknown, T0 = nothing)A pressure-entropy flash is done to check if the input pair corresponds to one or more phases. A T0 argument can be used to provide an initial temperature guess to the P-S flash. If a phase argument is specified, then it will be used to skip the flash and instead solve for the input conditions instead.
Clapeyron.PH — Module
PHModule that stores Clapeyron properties in pressure - (total) enthalpy basis.
All bulk properties have the following form:
property(model,p,h,z;phase = :unknown, T0 = nothing)A pressure-enthalpy flash is done to check if the input pair corresponds to one or more phases. A T0 argument can be used to provide an initial temperature guess to the P-H flash. If a phase argument is specified, then it will be used to skip the flash and instead solve for the input conditions instead.
Clapeyron.QT — Module
QTModule that stores Clapeyron properties in (molar) vapour fraction - temperature basis.
All bulk properties have the following form:
property(model,q,t,z;p0 = nothing)A vapour fraction - temperature flash is done to check if the input pair corresponds to one or more phases. a p0 argument can be used to provide an initial pressure guess to the Q-T flash.
Clapeyron.QP — Module
QPModule that stores Clapeyron properties in (molar) vapour fraction - pressure basis.
All bulk properties have the following form:
property(model,q,p,z;p0 = nothing)A vapour fraction - pressure flash is done to check if the input pair corresponds to one or more phases. a T0 argument can be used to provide an initial temperature guess to the Q-P flash.
Old aliases
The following functions were renamed to get rid of the _free naming. They still can be used, but they are considered deprecated.
Clapeyron.gibbs_free_energy — Function
gibbs_free_energy(model::EoSModel, p, T, z=SA[1.]; phase=:unknown, threaded=true, vol0=nothing)
gibbs_energy(model::EoSModel, p, T, z=SA[1.]; phase=:unknown, threaded=true, vol0=nothing)
gibbs_free_energy(model, result::FlashResult)
gibbs_free_energy(model, result::FlashResult, phase_index::Int)Default units: [J]
Calculates the Gibbs energy, defined as:
G = A + p*Vgibbs_free_energy(model,result::FlashResult) will return the Gibbs energy of the aggregate of phases stored in the FlashResult whereas gibbs_free_energy(model,result::FlashResult,i::Int) will return the Gibbs energy of the ith phase.
For Helmholtz-based models, it calls Clapeyron.volume to obtain V and evaluate the property in a volume-temperature (VT) basis. The keywords phase, threaded and vol0 are passed to the Clapeyron.volume solver. If you already have a volume, the VT0 module is available to evaluate this property directly in the VT basis, bypassing the volume iterative calculation.
Gibbs-based models are instead evaluated directly in the pressure-temperature basis.
Clapeyron.helmholtz_free_energy — Function
helmholtz_free_energy(model::EoSModel, p, T, z=SA[1.]; phase=:unknown, threaded=true, vol0=nothing)
helmholtz_energy(model::EoSModel, p, T, z=SA[1.]; phase=:unknown, threaded=true, vol0=nothing)
helmholtz_free_energy(model, result::FlashResult)
helmholtz_free_energy(model, result::FlashResult, phase_index::Int)Default units: [J]
Calculates the Helmholtz energy, defined as:
A = eos(model,V(p),T,z)helmholtz_free_energy(model,result::FlashResult) will return the Helmholtz energy of the aggregate of phases stored in the FlashResult whereas helmholtz_free_energy(model,result::FlashResult,i::Int) will return the Helmholtz energy of the ith phase.
For Helmholtz-based models, it calls Clapeyron.volume to obtain V and evaluate the property in a volume-temperature (VT) basis. The keywords phase, threaded and vol0 are passed to the Clapeyron.volume solver. If you already have a volume, the VT0 module is available to evaluate this property directly in the VT basis, bypassing the volume iterative calculation.
Gibbs-based models are instead evaluated directly in the pressure-temperature basis.
Clapeyron.gibbs_free_energy_res — Function
gibbs_free_energy_res(model::EoSModel, p, T, z=SA[1.]; phase=:unknown, threaded=true, vol0=nothing)
gibbs_energy_res(model::EoSModel, p, T, z=SA[1.]; phase=:unknown, threaded=true, vol0=nothing)
gibbs_free_energy_res(model, result::FlashResult)
gibbs_free_energy_res(model, result::FlashResult, phase_index::Int)Default units: [J]
Calculates the residual Gibbs energy, defined as:
G = Ar - V*∂Ar/∂Vgibbs_free_energy_res(model,result::FlashResult) will return the residual Gibbs energy of the aggregate of phases stored in the FlashResult whereas gibbs_free_energy_res(model,result::FlashResult,i::Int) will return the residual Gibbs energy of the ith phase.
For Helmholtz-based models, it calls Clapeyron.volume to obtain V and evaluate the property in a volume-temperature (VT) basis. The keywords phase, threaded and vol0 are passed to the Clapeyron.volume solver. If you already have a volume, the VT0 module is available to evaluate this property directly in the VT basis, bypassing the volume iterative calculation.
Gibbs-based models are instead evaluated directly in the pressure-temperature basis.
Clapeyron.helmholtz_free_energy_res — Function
helmholtz_free_energy_res(model::EoSModel, p, T, z=SA[1.]; phase=:unknown, threaded=true, vol0=nothing)
helmholtz_energy_res(model::EoSModel, p, T, z=SA[1.]; phase=:unknown, threaded=true, vol0=nothing)
helmholtz_free_energy_res(model, result::FlashResult)
helmholtz_free_energy_res(model, result::FlashResult, phase_index::Int)Default units: [J]
Calculates the residual Helmholtz energy, defined as:
A = eos_res(model,V(p),T,z)helmholtz_free_energy_res(model,result::FlashResult) will return the residual Helmholtz energy of the aggregate of phases stored in the FlashResult whereas helmholtz_free_energy_res(model,result::FlashResult,i::Int) will return the residual Helmholtz energy of the ith phase.
For Helmholtz-based models, it calls Clapeyron.volume to obtain V and evaluate the property in a volume-temperature (VT) basis. The keywords phase, threaded and vol0 are passed to the Clapeyron.volume solver. If you already have a volume, the VT0 module is available to evaluate this property directly in the VT basis, bypassing the volume iterative calculation.
Gibbs-based models are instead evaluated directly in the pressure-temperature basis.
Clapeyron.mass_gibbs_free_energy — Function
mass_gibbs_free_energy(model::EoSModel, p, T, z=SA[1.]; phase=:unknown, threaded=true, vol0=nothing)
mass_gibbs_energy(model::EoSModel, p, T, z=SA[1.]; phase=:unknown, threaded=true, vol0=nothing)
mass_gibbs_free_energy(model, result::FlashResult)
mass_gibbs_free_energy(model, result::FlashResult, phase_index::Int)Default units: [J·kg⁻¹]
Calculates the Gibbs energy per unit of mass, defined as:
G = (A + p*V)/MrWhere Mr is the molecular weight of the model at the input composition.
mass_gibbs_free_energy(model,result::FlashResult) will return the mass Gibbs energy of the aggregate of phases stored in the FlashResult whereas mass_gibbs_free_energy(model,result::FlashResult,i::Int) will return the mass Gibbs energy of the ith phase.
For Helmholtz-based models, it calls Clapeyron.volume to obtain V and evaluate the property in a volume-temperature (VT) basis. The keywords phase, threaded and vol0 are passed to the Clapeyron.volume solver. If you already have a volume, the VT0 module is available to evaluate this property directly in the VT basis, bypassing the volume iterative calculation.
Gibbs-based models are instead evaluated directly in the pressure-temperature basis.
Clapeyron.mass_helmholtz_free_energy — Function
mass_helmholtz_free_energy(model::EoSModel, p, T, z=SA[1.]; phase=:unknown, threaded=true, vol0=nothing)
mass_helmholtz_energy(model::EoSModel, p, T, z=SA[1.]; phase=:unknown, threaded=true, vol0=nothing)
mass_helmholtz_free_energy(model, result::FlashResult)
mass_helmholtz_free_energy(model, result::FlashResult, phase_index::Int)Default units: [J·kg⁻¹]
Calculates the Helmholtz energy per unit of mass, defined as:
A = eos(model,V(p),T,z)/MrWhere Mr is the molecular weight of the model at the input composition.
mass_helmholtz_free_energy(model,result::FlashResult) will return the mass Helmholtz energy of the aggregate of phases stored in the FlashResult whereas mass_helmholtz_free_energy(model,result::FlashResult,i::Int) will return the mass Helmholtz energy of the ith phase.
For Helmholtz-based models, it calls Clapeyron.volume to obtain V and evaluate the property in a volume-temperature (VT) basis. The keywords phase, threaded and vol0 are passed to the Clapeyron.volume solver. If you already have a volume, the VT0 module is available to evaluate this property directly in the VT basis, bypassing the volume iterative calculation.
Gibbs-based models are instead evaluated directly in the pressure-temperature basis.