Contents

Index

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 nameMain functionVariants (full function name with descriptor)
Volume (total)volume
Temperaturetemperature
Pressurepressure
Helmholtz energy (total)helmholtz_energyhelmholtz_energy_res (residual), mass_helmholtz_energy (mass-based), helmholtz_free_energy (deprecated), helmholtz_free_energy_res (deprecated), mass_helmholtz_free_energy (deprecated)
Molar densitymolar_density
Mass densitymass_density
Compressibility factorcompressibility_factor
Gibbs energy (total)gibbs_energygibbs_energy_res (residual), mass_gibbs_energy (mass-based), gibbs_free_energy (deprecated), gibbs_free_energy_res (deprecated), mass_gibbs_free_energy (deprecated)
Entropy (total)entropyentropy_res (residual), mass_entropy (mass-based)
Enthalpy (total)enthalpyenthalpy_res (residual), mass_enthalpy (mass-based)
Internal energy (total)internal_energyinternal_energy_res (residual), mass_internal_energy (mass-based)
Isochoric heat capacity (molar)isochoric_heat_capacitymass_isochoric_heat_capacity (mass-based)
Isobaric heat capacity (molar)isobaric_heat_capacitymass_isobaric_heat_capacity (mass-based)
Adiabatic indexadiabatic_index
Isothermal compressibilityisothermal_compressibility
Isentropic compressibilityisentropic_compressibility
Speed of soundspeed_of_sound
Isobaric expansivityisobaric_expansivity
Joule‑Thomson coefficientjoule_thomson_coefficient
Inversion temperatureinversion_temperature
Fundamental derivative of gas dynamicsfundamental_derivative_of_gas_dynamics
Second virial coefficientsecond_virial_coefficient
Cross second virial coefficientcross_second_virial
Equivolumetric cross second virialequivol_cross_second_virial
Chemical potentialchemical_potentialchemical_potential_res (residual)
Fugacity coefficientfugacity_coefficient
Activity coefficientactivity_coefficient
Activityactivity
Aqueous activityaqueous_activity
Reference chemical potentialreference_chemical_potential
Reference chemical potential typereference_chemical_potential_type
Mixing propertymixing
Excess propertyexcess
Partial propertypartial_property
Thermodynamic factorthermodynamic_factor
Phase identification parameterpip
Phase identificationidentify_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.volumeFunction
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).

Tip

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.

Stability checks

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)
source
Clapeyron.pressureFunction
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/∂V

where 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.

source
Clapeyron.helmholtz_energyFunction
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.

source
Clapeyron.helmholtz_energy_resFunction
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.

source
Clapeyron.molar_densityFunction
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ᵢ/V

molar_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.

source
Clapeyron.mass_densityFunction
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/V

Where 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.

source
Clapeyron.compressibility_factorFunction
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*T

compressibility_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.

single phase property

This property is not defined for more than one phase. Calling this property with two-phase states will result in an error.

source
Clapeyron.gibbs_energyFunction
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*V

gibbs_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.

source
Clapeyron.gibbs_energy_resFunction
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/∂V

gibbs_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.

source
Clapeyron.entropyFunction
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/∂T

entropy(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.

source
Clapeyron.entropy_resFunction
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/∂T

entropy_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.

source
Clapeyron.enthalpyFunction
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/∂V

enthalpy(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.

source
Clapeyron.enthalpy_resFunction
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/∂V

enthalpy_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.

source
Clapeyron.internal_energyFunction
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/∂T

internal_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.

source
Clapeyron.internal_energy_resFunction
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/∂T

internal_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.

source

Mass-based first order bulk properties

Clapeyron.mass_enthalpyFunction
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)/Mr

Where 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.

source
Clapeyron.mass_entropyFunction
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/Mr

Where 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.

source
Clapeyron.mass_internal_energyFunction
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)/Mr

Where 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.

source
Clapeyron.mass_gibbs_energyFunction
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)/Mr

Where 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.

source
Clapeyron.mass_helmholtz_energyFunction
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)/Mr

Where 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.

source

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_capacityFunction
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.

source
Clapeyron.isobaric_heat_capacityFunction
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.

Accurate ideal model required

This property requires at least second order ideal model temperature derivatives. If you are computing these properties, consider using a different ideal model than the BasicIdeal default (e.g. EoS(["species"];idealmodel = ReidIdeal)).

single phase property

This property is not defined for more than one phase. Calling this property with two-phase states will result in an error.

source
Clapeyron.adiabatic_indexFunction
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/Cv

adiabatic_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.

Accurate ideal model required

This property requires at least second order ideal model temperature derivatives. If you are computing these properties, consider using a different ideal model than the BasicIdeal default (e.g. EoS(["species"];idealmodel = ReidIdeal)).

single phase property

This property is not defined for more than one phase. Calling this property with two-phase states will result in an error.

source
Clapeyron.isothermal_compressibilityFunction
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.

single phase property

This property is not defined for more than one phase. Calling this property with two-phase states will result in an error.

source
Clapeyron.isentropic_compressibilityFunction
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.

Accurate ideal model required

This property requires at least second order ideal model temperature derivatives. If you are computing these properties, consider using a different ideal model than the BasicIdeal default (e.g. EoS(["species"];idealmodel = ReidIdeal)).

single phase property

This property is not defined for more than one phase. Calling this property with two-phase states will result in an error.

source
Clapeyron.speed_of_soundFunction
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.

Accurate ideal model required

This property requires at least second order ideal model temperature derivatives. If you are computing these properties, consider using a different ideal model than the BasicIdeal default (e.g. EoS(["species"];idealmodel = ReidIdeal)).

single phase property

This property is not defined for more than one phase. Calling this property with two-phase states will result in an error.

source
Clapeyron.isobaric_expansivityFunction
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.

single phase property

This property is not defined for more than one phase. Calling this property with two-phase states will result in an error.

source
Clapeyron.joule_thomson_coefficientFunction
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.

Accurate ideal model required

This property requires at least second order ideal model temperature derivatives. If you are computing these properties, consider using a different ideal model than the BasicIdeal default (e.g. EoS(["species"];idealmodel = ReidIdeal)).

single phase property

This property is not defined for more than one phase. Calling this property with two-phase states will result in an error.

source
Clapeyron.inversion_temperatureFunction
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) = 0

The keywords phase, threaded and vol0 are passed to the Clapeyron.volume solver.

See also joule_thomson_coefficient.

source
Clapeyron.fundamental_derivative_of_gas_dynamicsFunction
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.

source

Mass-based second order bulk properties

Clapeyron.mass_isochoric_heat_capacityFunction
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² / Mr

Where 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.

Accurate ideal model required

This property requires at least second order ideal model temperature derivatives. If you are computing these properties, consider using a different ideal model than the BasicIdeal default (e.g. EoS(["species"];idealmodel = ReidIdeal)).

single phase property

This property is not defined for more than one phase. Calling this property with two-phase states will result in an error.

source
Clapeyron.mass_isobaric_heat_capacityFunction
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²))/Mr

Where 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.

Accurate ideal model required

This property requires at least second order ideal model temperature derivatives. If you are computing these properties, consider using a different ideal model than the BasicIdeal default (e.g. EoS(["species"];idealmodel = ReidIdeal)).

single phase property

This property is not defined for more than one phase. Calling this property with two-phase states will result in an error.

source

Temperature-only based properties

The following methods depend only on temperature and/or composition.

Clapeyron.second_virial_coefficientFunction
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.

source
Clapeyron.cross_second_virialFunction
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₂
Composition-dependent property

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

  1. 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
source
Clapeyron.equivol_cross_second_virialFunction
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

  1. 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
source

Chemical potential functions

Clapeyron.chemical_potentialFunction
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.

source
Clapeyron.chemical_potential_resFunction
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.

source
Clapeyron.fugacity_coefficientFunction
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.

source
Clapeyron.activity_coefficientFunction
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̄ / T

where μ_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.

source
Clapeyron.activityFunction
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̄ / T

where μ_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.

source
Clapeyron.aqueous_activityFunction
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̄ / T

where μ_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.

source
Clapeyron.reference_chemical_potentialFunction
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 specified T, p and phase
  • :aqueous: the chemical potential of the pure components at specified T, p and phase
  • :sat_pure_T: the reference potential is the pure saturated liquid phase at specified T.
  • :zero: the reference potential is equal to zero for all components (used for ActivityModel)

The keywords phase, threaded and vol0 are passed to the Clapeyron.volume solver.

source

Mixing and partial properties

Clapeyron.mixingFunction
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.

source
Clapeyron.excessFunction
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.

source
Clapeyron.partial_propertyFunction
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.

source
Missing docstring.

Missing docstring for Clapeyron.shape_factors. Check Documenter's build log for details.

Clapeyron.thermodynamic_factorFunction
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ⱼ
source

Phase identification

Clapeyron.pipFunction
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

  1. 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
source
Clapeyron.identify_phaseFunction
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.

source

Initial guess functions

These methods are considered internal, they don't support Symbolics.jl or Unitful.jl overloads.

Clapeyron.lb_volumeFunction
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)

source
Clapeyron.T_scaleFunction
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

source
Clapeyron.p_scaleFunction
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

source
Clapeyron.x0_volumeFunction
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.

source
Clapeyron.x0_volume_solidFunction
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.

source
Clapeyron.x0_volume_liquidFunction
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.

source
Clapeyron.volume_virialFunction
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)/v

where 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.

source
Clapeyron.x0_sat_pureFunction
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.

source
Clapeyron.x0_psatFunction
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.

source
Clapeyron.x0_crit_pureFunction
x0_crit_pure(model::EoSModel,z)

Returns a 2-tuple corresponding to (k,log10(Vc0)), where k is Tc0/T_scale(model,z)

source

Inverse property solvers

Clapeyron.TpropertyFunction
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.

source
Clapeyron.PpropertyFunction
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.

source

Bulk properties in other basis

Clapeyron.VT0Module
VT0

Module 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.

source
Clapeyron.PT0Module
PT0

Module 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.

source
Clapeyron.PTModule
PT

Module 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.

source
Clapeyron.VTModule
VT

Module 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.

source
Clapeyron.PSModule
PS

Module 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.

source
Clapeyron.PHModule
PH

Module 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.

source
Clapeyron.QTModule
QT

Module 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.

source
Clapeyron.QPModule
QP

Module 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.

source

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_energyFunction
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*V

gibbs_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.

source
Clapeyron.helmholtz_free_energyFunction
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.

source
Clapeyron.gibbs_free_energy_resFunction
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/∂V

gibbs_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.

source
Clapeyron.helmholtz_free_energy_resFunction
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.

source
Clapeyron.mass_gibbs_free_energyFunction
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)/Mr

Where 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.

source
Clapeyron.mass_helmholtz_free_energyFunction
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)/Mr

Where 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.

source