Skip to content

Commit

Permalink
More information on setting/getting interaction parameters and mixing…
Browse files Browse the repository at this point in the history
… rules; see #848
  • Loading branch information
ibell committed Nov 1, 2015
1 parent 8c00080 commit 27dad3f
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 0 deletions.
47 changes: 47 additions & 0 deletions Web/fluid_properties/Mixtures.rst
Expand Up @@ -36,6 +36,53 @@ Binary pairs
:header-rows: 1
:file: Mixtures.csv


Estimating binary interaction parameters
----------------------------------------

If you have a mixture that you would like to include in your analysis, but for which no interaction parameters are currently available, there are two estimation schemes available. These estimation schemes should be used with extreme caution. If you use these schemes, you should definitely check that you are getting reasonable output values. The two schemes available are

* ``linear`` - Tr and vr are a linear function of molar composition between the two pure fluid values
* ``Lorentz-Berthelot`` - all interaction parameters are 1.0

Here is a sample of using this in python::

import CoolProp.CoolProp as CP
CAS_He = CP.get_fluid_param_string('Helium','CAS')
CAS_Xe = CP.get_fluid_param_string('Xe','CAS')
CP.apply_simple_mixing_rule(CAS_He, CAS_Xe, 'linear')
CP.PropsSI('Dmass','T',300,'P',101325,'Helium[0.5]&Xenon[0.5]')
.. warning::

Use with caution!! For other mixtures this can give you entirely(!) wrong predictions

Using your own interaction parameters
-------------------------------------

If you have your own interaction parameters that you would like to use, you can set them using the ``set_mixture_binary_pair_data`` function. (You can also retrieve them using the ``set_mixture_binary_pair_data`` function). You must do this before you would like to call other functions. Some sample code is below.

.. ipython::

In [1]: import CoolProp.CoolProp as CP

In [1]: CAS_He = CP.get_fluid_param_string('Helium','CAS')

In [1]: CAS_Xe = CP.get_fluid_param_string('Xe','CAS')

# This adds a dummy entry in the library of interaction parameters if the mixture is not already there
In [1]: CP.apply_simple_mixing_rule(CAS_He, CAS_Xe, 'linear')

In [1]: CP.set_mixture_binary_pair_data(CAS_He, CAS_Xe, 'betaT', 1.0)

In [1]: CP.set_mixture_binary_pair_data(CAS_He, CAS_Xe, 'gammaT', 1.5)

In [1]: CP.set_mixture_binary_pair_data(CAS_He, CAS_Xe, 'betaV', 1.0)

In [1]: CP.set_mixture_binary_pair_data(CAS_He, CAS_Xe, 'gammaV', 1.5)

In [1]: CP.PropsSI('Dmass','T',300,'P',101325,'Helium[0.5]&Xenon[0.5]')

Phase Envelope
--------------
.. plot::
Expand Down
9 changes: 9 additions & 0 deletions wrappers/Python/CoolProp/CoolProp.pyx
Expand Up @@ -211,9 +211,15 @@ cpdef string get_parameter_information(int key, string info):
return _get_parameter_information(key, info)

cpdef string get_mixture_binary_pair_data(CAS1, CAS2, key) except *:
"""
Obtain mixture interaction parameter. Python wrapper of C++ function :cpapi:`CoolProp::get_mixture_binary_pair_data`
"""
return _get_mixture_binary_pair_data(CAS1, CAS2, key)

cpdef set_mixture_binary_pair_data(CAS1, CAS2, key, val):
"""
Set mixture interaction parameter. Python wrapper of C++ function :cpapi:`CoolProp::set_mixture_binary_pair_data`
"""
_set_mixture_binary_pair_data(CAS1, CAS2, key, val)

cpdef get_global_param_string(string param):
Expand All @@ -226,6 +232,9 @@ cpdef get_fluid_param_string(string fluid, string param):
return _get_fluid_param_string(fluid, param)

cpdef apply_simple_mixing_rule(CAS1, CAS2, rule):
"""
Apply simple mixing rule. Currently linear or Lorentz-Berthelot. Python wrapper of C++ function :cpapi:`CoolProp::apply_simple_mixing_rule`
"""
_apply_simple_mixing_rule(CAS1, CAS2, rule)

cpdef double saturation_ancillary(string name, string output, int Q, string input, double value):
Expand Down

0 comments on commit 27dad3f

Please sign in to comment.