mirror of
https://github.com/CoolProp/CoolProp.git
synced 2026-04-01 03:00:13 -04:00
@@ -4,7 +4,25 @@
|
||||
High-Level API
|
||||
**************
|
||||
|
||||
For many users, all that is needed is a simple call to the ``PropsSI`` function.
|
||||
For many users, all that is needed is a simple call to the ``PropsSI`` function for pure fluids, pseudo-pure fluids and mixtures. For humid air properties, see :ref:`Humid air properties <Humid-Air>`. An example using ``PropsSI``:
|
||||
|
||||
.. ipython::
|
||||
|
||||
# Import the PropsSI function
|
||||
In [1]: from CoolProp.CoolProp import PropsSI
|
||||
|
||||
# Saturation temperature of Water at 1 atm in K
|
||||
In [2]: PropsSI('T','P',101325,'Q',0,'Water')
|
||||
|
||||
More information:
|
||||
|
||||
* :ref:`Table of inputs to PropsSI function <parameter_table>`
|
||||
* :ref`More examples of the high-level API <Props_Sample>`
|
||||
* :cpapi:`Documentation for all high-level functions exposed <CoolPropLib.h>`
|
||||
|
||||
All :ref:`the wrappers <wrappers>` wrap this function in the same way.
|
||||
|
||||
For pure and pseudo-pure fluids, two state points are required to fix the state. The equations of state are based on :math:`T` and :math:`\rho` as state variables, so :math:`T, rho` will always be the fastest inputs. P,T will be a bit slower (3-10 times), and then comes inputs where neither :math:`T` nor :math:`\rho` are given like :math:`p,h`. They will be much slower. If speed is an issue, you can look into table-based interpolation methods using TTSE or bicubic interpolation.
|
||||
|
||||
Code
|
||||
----
|
||||
@@ -15,11 +33,10 @@ Output
|
||||
------
|
||||
.. literalinclude:: snippets/propssi.cxx.output
|
||||
|
||||
.. _parameter_table:
|
||||
|
||||
.. include:: parameter_table.rst.in
|
||||
|
||||
|
||||
|
||||
.. _Props_Sample:
|
||||
|
||||
Sample Code
|
||||
@@ -36,8 +53,6 @@ Sample Code
|
||||
#Import the things you need
|
||||
In [1]: from CoolProp.CoolProp import PropsSI
|
||||
|
||||
In [1]: import timeit
|
||||
|
||||
# Specific heat (J/kg/K) of 20% ethylene glycol as a function of T
|
||||
In [2]: PropsSI('C','T',298.15,'P',101325,'INCOMP::MEG-20%')
|
||||
|
||||
@@ -50,6 +65,9 @@ Sample Code
|
||||
# Saturated vapor density of R134a at 0C
|
||||
In [2]: PropsSI('H','T',273.15,'Q',1,'R134a')
|
||||
|
||||
# Using properties from CoolProp to get R410A density
|
||||
In [2]: PropsSI('D','T',300,'P',101325,'HEOS::R32[0.697615]&R125[0.302385]')
|
||||
|
||||
# Using properties from REFPROP to get R410A density
|
||||
In [2]: PropsSI('D','T',300,'P',101325,'REFPROP::R32[0.697615]&R125[0.302385]')
|
||||
|
||||
|
||||
@@ -2,6 +2,10 @@
|
||||
Low Level API
|
||||
*************
|
||||
|
||||
For more advanced use, it can be useful to have access to lower-level internals of the CoolProp code. Also, this interface is strongly recommended for mixtures, where the high-level api has some serious limitations. For simpler use, you can use the :ref:`high-level interface <high_level_api>`.
|
||||
|
||||
At the C++ level, the code is based on the use of an :cpapi:`AbstractState` `abstract base class <http://en.wikipedia.org/wiki/Abstract_type>`_ which defines a protocol that :ref:`the property backends <backends>` must implement. In this way, it is very easy to extend CoolProp to connect with another completely unrelated property library, as was done for REFPROP.
|
||||
|
||||
Code
|
||||
----
|
||||
.. literalinclude:: snippets/AbstractState1.cxx
|
||||
|
||||
31
Web/develop/backends.rst
Normal file
31
Web/develop/backends.rst
Normal file
@@ -0,0 +1,31 @@
|
||||
.. _backends:
|
||||
|
||||
********************
|
||||
Backends in CoolProp
|
||||
********************
|
||||
|
||||
AbstractState
|
||||
-------------
|
||||
The :cpapi:`AbstractState` defines an interface between CoolProp and the rest of the world. The public methods like :cpapi:`AbstractState::rhomolar` are meant to be called by other code, while the protected functions like :cpapi:`AbstractState::calc_rhomolar` are meant to be implemented by the other backends.
|
||||
|
||||
Derived Backends
|
||||
----------------
|
||||
|
||||
The backends in CoolProp provide the implementation of the protocol defined by the abstract base class. There are a few primary backends:
|
||||
|
||||
* :cpapi:`HelmholtzEOSMixtureBackend` : This backend is the backend that provides properties using the CoolProp code.
|
||||
* :cpapi:`IncompressibleBackend` : This backend provided the thermophysical properties for incompressible pure fluids, incompressible mixtures, and brines
|
||||
* :cpapi:`REFPROPMixtureBackend` : This backend provides a clean interface between CoolProp and REFPROP
|
||||
|
||||
Example Backend
|
||||
---------------
|
||||
|
||||
Code
|
||||
----
|
||||
.. literalinclude:: snippets/ExampleBackend.cxx
|
||||
:language: c++
|
||||
|
||||
Output
|
||||
------
|
||||
.. literalinclude:: snippets/ExampleBackend.cxx.output
|
||||
|
||||
@@ -7,14 +7,21 @@ Information for Developers
|
||||
.. toctree::
|
||||
|
||||
code.rst
|
||||
backends.rst
|
||||
cmake.rst
|
||||
buildbot.rst
|
||||
documentation.rst
|
||||
|
||||
Address Sanitizer
|
||||
-----------------
|
||||
1. Clang >3.6, build from source on linux following instructions
|
||||
2. Check out CoolProp using git:
|
||||
|
||||
Address sanitizer is a module of the clang compiler that can help to pinpoint several memory problems, like addressing memory that is out of range.
|
||||
|
||||
The instructions here explain how to get address sanitizer working for CoolProp for testing purposes.
|
||||
|
||||
1. You need Clang >3.6, build from source on linux following instructions
|
||||
|
||||
2. Check out CoolProp using git::
|
||||
|
||||
git clone https://github.com/CoolProp/CoolProp --recursive
|
||||
|
||||
|
||||
Reference in New Issue
Block a user