# Viscosity (thermo.viscosity)¶

This module contains implementations of TPDependentProperty representing liquid and vapor viscosity. A variety of estimation and data methods are available as included in the chemicals library. Additionally liquid and vapor mixture viscosity predictor objects are implemented subclassing MixtureProperty.

For reporting bugs, adding feature requests, or submitting pull requests, please use the GitHub issue tracker.

## Pure Liquid Viscosity¶

class thermo.viscosity.ViscosityLiquid(CASRN='', MW=None, Tm=None, Tc=None, Pc=None, Vc=None, omega=None, Psat=None, Vml=None, extrapolation='linear', extrapolation_min=1e-05, **kwargs)[source]

Class for dealing with liquid viscosity as a function of temperature and pressure.

For low-pressure (at 1 atm while under the vapor pressure; along the saturation line otherwise) liquids, there are six coefficient-based methods from three data sources, one source of tabular information, two corresponding-states estimators, one group contribution method, and the external library CoolProp.

For high-pressure liquids (also, <1 atm liquids), there is one corresponding-states estimator, and the external library CoolProp.

Parameters
CASRNstr, optional

The CAS number of the chemical

MWfloat, optional

Molecular weight, [g/mol]

Tmfloat, optional

Melting point, [K]

Tcfloat, optional

Critical temperature, [K]

Pcfloat, optional

Critical pressure, [Pa]

Vcfloat, optional

Critical volume, [m^3/mol]

omegafloat, optional

Acentric factor, [-]

Psatfloat or callable, optional

Vapor pressure at a given temperature or callable for the same, [Pa]

Vmlfloat or callable, optional

Liquid molar volume at a given temperature and pressure or callable for the same, [m^3/mol]

If False, do not load property coefficients from data sources in files [-]

extrapolationstr or None

None to not extrapolate; see TDependentProperty for a full list of all options, [-]

methodstr or None, optional

If specified, use this method by default and do not use the ranked sorting; an exception is raised if this is not a valid method for the provided inputs, [-]

Notes

To iterate over all methods, use the lists stored in viscosity_liquid_methods and viscosity_liquid_methods_P for low and high pressure methods respectively.

Low pressure methods:

A simple function as expressed in [1], with data available for 100 fluids. Temperature limits are available for all fluids. See chemicals.viscosity.Viswanath_Natarajan_3 for details.

VISWANATH_NATARAJAN_3:

A simple function as expressed in [1], with data available for 432 fluids. Temperature limits are available for all fluids. See chemicals.viscosity.Viswanath_Natarajan_3 for details.

VISWANATH_NATARAJAN_2:

A simple function as expressed in [1], with data available for 135 fluids. Temperature limits are available for all fluids. See chemicals.viscosity.Viswanath_Natarajan_2 for details.

VISWANATH_NATARAJAN_2E:

A simple function as expressed in [1], with data available for 14 fluids. Temperature limits are available for all fluids. See chemicals.viscosity.Viswanath_Natarajan_2_exponential for details.

DIPPR_PERRY_8E:

A collection of 337 coefficient sets from the DIPPR database published openly in [4]. Provides temperature limits for all its fluids. EQ101 is used for its fluids.

LETSOU_STIEL:

CSP method, described in chemicals.viscosity.Letsou_Stiel.

PRZEDZIECKI_SRIDHAR:

CSP method, described in chemicals.viscosity.Przedziecki_Sridhar.

COOLPROP:

CoolProp external library; with select fluids from its library. Range is limited to that of the equations of state it uses, as described in [2]. Very slow.

VDI_TABULAR:

Tabular data in [3] along the saturation curve; interpolation is as set by the user or the default.

VDI_PPDS:

Coefficients for a equation form developed by the PPDS, published openly in [3]. Provides no temperature limits, but has been designed for extrapolation. Extrapolated to low temperatures it provides a smooth exponential increase. However, for some chemicals such as glycerol, extrapolated to higher temperatures viscosity is predicted to increase above a certain point.

JOBACK:

An estimation method for organic substances in [5]; this also requires molecular weight as an input.

High pressure methods:

LUCAS:

CSP method, described in chemicals.viscosity.Lucas. Calculates a low-pressure liquid viscosity as its input.

COOLPROP:

CoolProp external library; with select fluids from its library. Range is limited to that of the equations of state it uses, as described in [2]. Very slow, but unparalled in accuracy for pressure dependence.

A minimum viscosity value of 1e-5 Pa*s is set according to [4]. This is also just above the lowest experimental values of viscosity of helium, 9.4e-6 Pa*s. This excludes the behavior of superfluids, and also systems where the mean free path between moleules approaches the geometry of the system and then the viscosity is geometry-dependent.

References

1(1,2,3,4)

Viswanath, Dabir S., and G. Natarajan. Databook On The Viscosity Of Liquids. New York: Taylor & Francis, 1989

2(1,2)

Bell, Ian H., Jorrit Wronski, Sylvain Quoilin, and Vincent Lemort. “Pure and Pseudo-Pure Fluid Thermophysical Property Evaluation and the Open-Source Thermophysical Property Library CoolProp.” Industrial & Engineering Chemistry Research 53, no. 6 (February 12, 2014): 2498-2508. doi:10.1021/ie4033999. http://www.coolprop.org/

3(1,2)

Gesellschaft, V. D. I., ed. VDI Heat Atlas. 2nd edition. Berlin; New York:: Springer, 2010.

4(1,2)

Green, Don, and Robert Perry. Perry’s Chemical Engineers’ Handbook, Eighth Edition. McGraw-Hill Professional, 2007.

5

Joback, K.G., and R.C. Reid. “Estimation of Pure-Component Properties from Group-Contributions.” Chemical Engineering Communications 57, no. 1-6 (July 1, 1987): 233-43. doi:10.1080/00986448708960487.

6

Trachenko, K., and V. V. Brazhkin. “Minimal Quantum Viscosity from Fundamental Physical Constants.” Science Advances, April 2020. https://doi.org/10.1126/sciadv.aba3747.

Attributes
Tmax

Maximum temperature (K) at which the current method can calculate the property.

Tmin

Minimum temperature (K) at which the current method can calculate the property.

Methods

 calculate(T, method) Method to calculate low-pressure liquid viscosity at tempearture T with a given method. calculate_P(T, P, method) Method to calculate pressure-dependent liquid viscosity at temperature T and pressure P with a given method. test_method_validity(T, method) Method to check the validity of a method. test_method_validity_P(T, P, method) Method to check the validity of a high-pressure method.
property Tmax

Maximum temperature (K) at which the current method can calculate the property.

property Tmin

Minimum temperature (K) at which the current method can calculate the property.

calculate(T, method)[source]

Method to calculate low-pressure liquid viscosity at tempearture T with a given method.

This method has no exception handling; see T_dependent_property for that.

Parameters
Tfloat

Temperature at which to calculate viscosity, [K]

methodstr

Name of the method to use

Returns
mufloat

Viscosity of the liquid at T and a low pressure, [Pa*s]

calculate_P(T, P, method)[source]

Method to calculate pressure-dependent liquid viscosity at temperature T and pressure P with a given method.

This method has no exception handling; see TP_dependent_property for that.

Parameters
Tfloat

Temperature at which to calculate viscosity, [K]

Pfloat

Pressure at which to calculate viscosity, [K]

methodstr

Name of the method to use

Returns
mufloat

Viscosity of the liquid at T and P, [Pa*s]

name = 'liquid viscosity'
property_max = 200000000.0

Maximum valid value of liquid viscosity. Generous limit, as the value is that of bitumen in a Pitch drop experiment.

property_min = 0.0

Mimimum valid value of liquid viscosity.

ranked_methods = ['COOLPROP', 'DIPPR_PERRY_8E', 'VDI_PPDS', 'DUTT_PRASAD', 'VISWANATH_NATARAJAN_3', 'VISWANATH_NATARAJAN_2', 'VISWANATH_NATARAJAN_2E', 'VDI_TABULAR', 'LETSOU_STIEL', 'JOBACK', 'PRZEDZIECKI_SRIDHAR']

Default rankings of the low-pressure methods.

ranked_methods_P = ['COOLPROP', 'LUCAS']

Default rankings of the high-pressure methods.

test_method_validity(T, method)[source]

Method to check the validity of a method. Follows the given ranges for all coefficient-based methods. For CSP methods, the models are considered valid from 0 K to the critical point. For tabular data, extrapolation outside of the range is used if tabular_extrapolation_permitted is set; if it is, the extrapolation is considered valid for all temperatures.

It is not guaranteed that a method will work or give an accurate prediction simply because this method considers the method valid.

Parameters
Tfloat

Temperature at which to test the method, [K]

methodstr

Name of the method to test

Returns
validitybool

Whether or not a method is valid

test_method_validity_P(T, P, method)[source]

Method to check the validity of a high-pressure method. For COOLPROP, the fluid must be both a liquid and under the maximum pressure of the fluid’s EOS. LUCAS doesn’t work on some occasions, due to something related to Tr and negative powers - but is otherwise considered correct for all circumstances.

For tabular data, extrapolation outside of the range is used if tabular_extrapolation_permitted is set; if it is, the extrapolation is considered valid for all temperatures and pressures.

Parameters
Tfloat

Temperature at which to test the method, [K]

Pfloat

Pressure at which to test the method, [Pa]

methodstr

Name of the method to test

Returns
validitybool

Whether or not a method is valid

units = 'Pa*s'
thermo.viscosity.viscosity_liquid_methods = ['COOLPROP', 'DIPPR_PERRY_8E', 'VDI_PPDS', 'DUTT_PRASAD', 'VISWANATH_NATARAJAN_3', 'VISWANATH_NATARAJAN_2', 'VISWANATH_NATARAJAN_2E', 'VDI_TABULAR', 'LETSOU_STIEL', 'JOBACK', 'PRZEDZIECKI_SRIDHAR']

Holds all low-pressure methods available for the ViscosityLiquid class, for use in iterating over them.

thermo.viscosity.viscosity_liquid_methods_P = ['COOLPROP', 'LUCAS']

Holds all high-pressure methods available for the ViscosityLiquid class, for use in iterating over them.

## Pure Gas Viscosity¶

class thermo.viscosity.ViscosityGas(CASRN='', MW=None, Tc=None, Pc=None, Zc=None, dipole=None, Vmg=None, extrapolation='linear', extrapolation_min=1e-05, **kwargs)[source]

Class for dealing with gas viscosity as a function of temperature and pressure.

For gases at atmospheric pressure, there are 4 corresponding-states estimators, two sources of coefficient-based models, one source of tabular information, and the external library CoolProp.

For gases under the fluid’s boiling point (at sub-atmospheric pressures), and high-pressure gases above the boiling point, there are zero corresponding-states estimators, and the external library CoolProp.

Parameters
CASRNstr, optional

The CAS number of the chemical

MWfloat, optional

Molecular weight, [g/mol]

Tcfloat, optional

Critical temperature, [K]

Pcfloat, optional

Critical pressure, [Pa]

Zcfloat, optional

Critical compressibility, [-]

dipolefloat, optional

Dipole moment of the fluid, [debye]

Vmgfloat, optional

Molar volume of the fluid at a pressure and temperature, [m^3/mol]

If False, do not load property coefficients from data sources in files [-]

extrapolationstr or None

None to not extrapolate; see TDependentProperty for a full list of all options, [-]

methodstr or None, optional

If specified, use this method by default and do not use the ranked sorting; an exception is raised if this is not a valid method for the provided inputs, [-]

Notes

A string holding each method’s name is assigned to the following variables in this module, intended as the most convenient way to refer to a method. To iterate over all methods, use the lists stored in viscosity_gas_methods and viscosity_gas_methods_P for low and high pressure methods respectively.

Low pressure methods:

GHARAGHEIZI:

CSP method, described in chemicals.viscosity.Gharagheizi_gas_viscosity.

YOON_THODOS:

CSP method, described in chemicals.viscosity.Yoon_Thodos.

STIEL_THODOS:

CSP method, described in chemicals.viscosity.Stiel_Thodos.

LUCAS_GAS:

CSP method, described in chemicals.viscosity.Lucas_gas.

DIPPR_PERRY_8E:

A collection of 345 coefficient sets from the DIPPR database published openly in [3]. Provides temperature limits for all its fluids. chemicals.dippr.EQ102 is used for its fluids.

VDI_PPDS:

Coefficients for a equation form developed by the PPDS, published openly in [2]. Provides no temperature limits, but provides reasonable values at fairly high and very low temperatures.

COOLPROP:

CoolProp external library; with select fluids from its library. Range is limited to that of the equations of state it uses, as described in [1]. Very slow.

VDI_TABULAR:

Tabular data in [2] along the saturation curve; interpolation is as set by the user or the default.

High pressure methods:

COOLPROP:

CoolProp external library; with select fluids from its library. Range is limited to that of the equations of state it uses, as described in [1]. Very slow, but unparalled in accuracy for pressure dependence.

A minimum viscosity value of 1e-5 Pa*s is set according to [4]. This is also just above the lowest experimental values of viscosity of helium, 9.4e-6 Pa*s.

References

1(1,2)

Bell, Ian H., Jorrit Wronski, Sylvain Quoilin, and Vincent Lemort. “Pure and Pseudo-Pure Fluid Thermophysical Property Evaluation and the Open-Source Thermophysical Property Library CoolProp.” Industrial & Engineering Chemistry Research 53, no. 6 (February 12, 2014): 2498-2508. doi:10.1021/ie4033999. http://www.coolprop.org/

2(1,2)

Gesellschaft, V. D. I., ed. VDI Heat Atlas. 2nd edition. Berlin; New York:: Springer, 2010.

3

Green, Don, and Robert Perry. Perry’s Chemical Engineers’ Handbook, Eighth Edition. McGraw-Hill Professional, 2007.

4

Trachenko, K., and V. V. Brazhkin. “Minimal Quantum Viscosity from Fundamental Physical Constants.” Science Advances, April 2020. https://doi.org/10.1126/sciadv.aba3747.

Attributes
Tmax

Maximum temperature (K) at which the current method can calculate the property.

Tmin

Minimum temperature (K) at which the current method can calculate the property.

Methods

 calculate(T, method) Method to calculate low-pressure gas viscosity at tempearture T with a given method. calculate_P(T, P, method) Method to calculate pressure-dependent gas viscosity at temperature T and pressure P with a given method. test_method_validity(T, method) Method to check the validity of a temperature-dependent low-pressure method. test_method_validity_P(T, P, method) Method to check the validity of a high-pressure method.
property Tmax

Maximum temperature (K) at which the current method can calculate the property.

property Tmin

Minimum temperature (K) at which the current method can calculate the property.

calculate(T, method)[source]

Method to calculate low-pressure gas viscosity at tempearture T with a given method.

This method has no exception handling; see T_dependent_property for that.

Parameters
Tfloat

Temperature of the gas, [K]

methodstr

Name of the method to use

Returns
mufloat

Viscosity of the gas at T and a low pressure, [Pa*s]

calculate_P(T, P, method)[source]

Method to calculate pressure-dependent gas viscosity at temperature T and pressure P with a given method.

This method has no exception handling; see TP_dependent_property for that.

Parameters
Tfloat

Temperature at which to calculate gas viscosity, [K]

Pfloat

Pressure at which to calculate gas viscosity, [K]

methodstr

Name of the method to use

Returns
mufloat

Viscosity of the gas at T and P, [Pa*]

name = 'Gas viscosity'
property_max = 0.001

Maximum valid value of gas viscosity. Might be too high, or too low.

property_min = 0.0

Mimimum valid value of gas viscosity; limiting condition at low pressure is 0.

ranked_methods = ['COOLPROP', 'DIPPR_PERRY_8E', 'VDI_PPDS', 'VDI_TABULAR', 'GHARAGHEIZI', 'YOON_THODOS', 'STIEL_THODOS', 'LUCAS_GAS']

Default rankings of the low-pressure methods.

ranked_methods_P = ['COOLPROP']

Default rankings of the high-pressure methods.

test_method_validity(T, method)[source]

Method to check the validity of a temperature-dependent low-pressure method. For CSP most methods, the all methods are considered valid from 0 K up to 5000 K. For method GHARAGHEIZI, the method is considered valud from 20 K to 2000 K.

For tabular data, extrapolation outside of the range is used if tabular_extrapolation_permitted is set; if it is, the extrapolation is considered valid for all temperatures.

It is not guaranteed that a method will work or give an accurate prediction simply because this method considers the method valid.

Parameters
Tfloat

Temperature at which to test the method, [K]

methodstr

Name of the method to test

Returns
validitybool

Whether or not a method is valid

test_method_validity_P(T, P, method)[source]

Method to check the validity of a high-pressure method. For COOLPROP, the fluid must be both a gas and under the maximum pressure of the fluid’s EOS. No other methods are implemented.

For tabular data, extrapolation outside of the range is used if tabular_extrapolation_permitted is set; if it is, the extrapolation is considered valid for all temperatures and pressures.

It is not guaranteed that a method will work or give an accurate prediction simply because this method considers the method valid.

Parameters
Tfloat

Temperature at which to test the method, [K]

Pfloat

Pressure at which to test the method, [Pa]

methodstr

Name of the method to test

Returns
validitybool

Whether or not a method is valid

units = 'Pa*s'
thermo.viscosity.viscosity_gas_methods = ['COOLPROP', 'DIPPR_PERRY_8E', 'VDI_PPDS', 'VDI_TABULAR', 'GHARAGHEIZI', 'YOON_THODOS', 'STIEL_THODOS', 'LUCAS_GAS']

Holds all low-pressure methods available for the ViscosityGas class, for use in iterating over them.

thermo.viscosity.viscosity_gas_methods_P = ['COOLPROP']

Holds all high-pressure methods available for the ViscosityGas class, for use in iterating over them.

## Mixture Liquid Viscosity¶

class thermo.viscosity.ViscosityLiquidMixture(CASs=[], ViscosityLiquids=[], MWs=[], **kwargs)[source]

Class for dealing with the viscosity of a liquid mixture as a function of temperature, pressure, and composition. Consists of one electrolyte-specific method, and logarithmic rules based on either mole fractions of mass fractions.

Prefered method is mixing_logarithmic with mole fractions, or Laliberte if the mixture is aqueous and has electrolytes.

Parameters
CASslist[str], optional

The CAS numbers of all species in the mixture, [-]

ViscosityLiquidslist[ViscosityLiquid], optional

ViscosityLiquid objects created for all species in the mixture, [-]

MWslist[float], optional

Molecular weights of all species in the mixture, [g/mol]

correct_pressure_purebool, optional

Whether to try to use the better pressure-corrected pure component models or to use only the T-only dependent pure species models, [-]

Notes

To iterate over all methods, use the list stored in viscosity_liquid_mixture_methods.

LALIBERTE_MU:

Electrolyte model equation with coefficients; see thermo.electrochem.Laliberte_viscosity for more details.

MIXING_LOG_MOLAR:

Logarithmic mole fraction mixing rule described in chemicals.utils.mixing_logarithmic.

MIXING_LOG_MASS:

Logarithmic mole fraction mixing rule described in chemicals.utils.mixing_logarithmic.

LINEAR:

Linear mole fraction mixing rule described in mixing_simple.

References

1

Poling, Bruce E. The Properties of Gases and Liquids. 5th edition. New York: McGraw-Hill Professional, 2000.

Methods

 calculate(T, P, zs, ws, method) Method to calculate viscosity of a liquid mixture at temperature T, pressure P, mole fractions zs and weight fractions ws with a given method. test_method_validity(T, P, zs, ws, method) Method to test the validity of a specified method for the given conditions.
Tmax

Maximum temperature at which no method can calculate the property above.

Tmin

Minimum temperature at which no method can calculate the property under.

calculate(T, P, zs, ws, method)[source]

Method to calculate viscosity of a liquid mixture at temperature T, pressure P, mole fractions zs and weight fractions ws with a given method.

This method has no exception handling; see mixture_property for that.

Parameters
Tfloat

Temperature at which to calculate the property, [K]

Pfloat

Pressure at which to calculate the property, [Pa]

zslist[float]

Mole fractions of all species in the mixture, [-]

wslist[float]

Weight fractions of all species in the mixture, [-]

methodstr

Name of the method to use

Returns
mufloat

Viscosity of the liquid mixture, [Pa*s]

name = 'liquid viscosity'
property_max = 200000000.0

Maximum valid value of liquid viscosity. Generous limit, as the value is that of bitumen in a Pitch drop experiment.

property_min = 0

Mimimum valid value of liquid viscosity.

ranked_methods = ['Laliberte', 'Logarithmic mixing, molar', 'Logarithmic mixing, mass', 'LINEAR']
test_method_validity(T, P, zs, ws, method)[source]

Method to test the validity of a specified method for the given conditions. If Laliberte is applicable, all other methods are returned as inapplicable. Otherwise, there are no checks or strict ranges of validity.

Parameters
Tfloat

Temperature at which to check method validity, [K]

Pfloat

Pressure at which to check method validity, [Pa]

zslist[float]

Mole fractions of all species in the mixture, [-]

wslist[float]

Weight fractions of all species in the mixture, [-]

methodstr

Method name to use

Returns
validitybool

Whether or not a specifid method is valid

units = 'Pa*s'
thermo.viscosity.viscosity_liquid_mixture_methods = ['Laliberte', 'Logarithmic mixing, molar', 'Logarithmic mixing, mass', 'LINEAR']

Holds all mixing rules available for the ViscosityLiquidMixture class, for use in iterating over them.

## Mixture Gas Viscosity¶

class thermo.viscosity.ViscosityGasMixture(MWs=[], molecular_diameters=[], Stockmayers=[], CASs=[], ViscosityGases=[], **kwargs)[source]

Class for dealing with the viscosity of a gas mixture as a function of temperature, pressure, and composition. Consists of three gas viscosity specific mixing rules and a mole-weighted simple mixing rule.

Prefered method is Brokaw.

Parameters
MWslist[float], optional

Molecular weights of all species in the mixture, [g/mol]

molecular_diameterslist[float], optional

Lennard-Jones molecular diameters, [angstrom]

Stockmayerslist[float], optional

Lennard-Jones depth of potential-energy minimum over k or epsilon_k, [K]

CASslist[str], optional

The CAS numbers of all species in the mixture, [-]

ViscosityGaseslist[ViscosityGas], optional

ViscosityGas objects created for all species in the mixture, [-]

correct_pressure_purebool, optional

Whether to try to use the better pressure-corrected pure component models or to use only the T-only dependent pure species models, [-]

Notes

To iterate over all methods, use the list stored in viscosity_liquid_mixture_methods.

BROKAW:

Mixing rule described in Brokaw.

HERNING_ZIPPERER:

Mixing rule described in Herning_Zipperer.

WILKE:

Mixing rule described in Wilke.

LINEAR:

Mixing rule described in mixing_simple.

References

1

Poling, Bruce E. The Properties of Gases and Liquids. 5th edition. New York: McGraw-Hill Professional, 2000.

Methods

 calculate(T, P, zs, ws, method) Method to calculate viscosity of a gas mixture at temperature T, pressure P, mole fractions zs and weight fractions ws with a given method. test_method_validity(T, P, zs, ws, method) Method to test the validity of a specified method for the given conditions.
Tmax

Maximum temperature at which no method can calculate the property above.

Tmin

Minimum temperature at which no method can calculate the property under.

calculate(T, P, zs, ws, method)[source]

Method to calculate viscosity of a gas mixture at temperature T, pressure P, mole fractions zs and weight fractions ws with a given method.

This method has no exception handling; see mixture_property for that.

Parameters
Tfloat

Temperature at which to calculate the property, [K]

Pfloat

Pressure at which to calculate the property, [Pa]

zslist[float]

Mole fractions of all species in the mixture, [-]

wslist[float]

Weight fractions of all species in the mixture, [-]

methodstr

Name of the method to use

Returns
mufloat

Viscosity of gas mixture, [Pa*s]

name = 'gas viscosity'
property_max = 0.001

Maximum valid value of gas viscosity. Might be too high, or too low.

property_min = 0

Mimimum valid value of gas viscosity; limiting condition at low pressure is 0.

ranked_methods = ['BROKAW', 'HERNING_ZIPPERER', 'LINEAR', 'WILKE']
test_method_validity(T, P, zs, ws, method)[source]

Method to test the validity of a specified method for the given conditions. No methods have implemented checks or strict ranges of validity.

Parameters
Tfloat

Temperature at which to check method validity, [K]

Pfloat

Pressure at which to check method validity, [Pa]

zslist[float]

Mole fractions of all species in the mixture, [-]

wslist[float]

Weight fractions of all species in the mixture, [-]

methodstr

Method name to use

Returns
validitybool

Whether or not a specifid method is valid

units = 'Pa*s'
thermo.viscosity.viscosity_gas_mixture_methods = ['BROKAW', 'HERNING_ZIPPERER', 'WILKE', 'LINEAR']

Holds all mixing rules available for the ViscosityGasMixture class, for use in iterating over them.