mirror of
https://github.com/CoolProp/CoolProp.git
synced 2026-04-23 03:00:17 -04:00
Merge branch 'master' into two_phase_derivatives_and_splines
This commit is contained in:
106
CMakeLists.txt
106
CMakeLists.txt
@@ -29,7 +29,7 @@ project(${project_name})
|
||||
# Project version
|
||||
set (COOLPROP_VERSION_MAJOR 5)
|
||||
set (COOLPROP_VERSION_MINOR 0)
|
||||
set (COOLPROP_VERSION_PATCH 6dev)
|
||||
set (COOLPROP_VERSION_PATCH 7dev)
|
||||
set (COOLPROP_VERSION ${COOLPROP_VERSION_MAJOR}.${COOLPROP_VERSION_MINOR}.${COOLPROP_VERSION_PATCH})
|
||||
|
||||
#######################################
|
||||
@@ -431,18 +431,21 @@ if (COOLPROP_CSHARP_MODULE)
|
||||
# Make a src directory to deal with file permissions problem with MinGW makefile
|
||||
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/src)
|
||||
|
||||
set(SWIG_OPTIONS "${COOLPROP_SWIG_OPTIONS}")
|
||||
string(REPLACE " " ";" SWIG_OPTIONS "${SWIG_OPTIONS}")
|
||||
SET_SOURCE_FILES_PROPERTIES(${I_FILE} PROPERTIES SWIG_FLAGS "${SWIG_OPTIONS}")
|
||||
set(I_FILE "${CMAKE_SOURCE_DIR}/src/CoolProp.i")
|
||||
|
||||
SET(SWIG_MODULE_CoolProp_EXTRA_DEPS ${SWIG_DEPENDENCIES})
|
||||
# Set properties before adding module
|
||||
SET_SOURCE_FILES_PROPERTIES(${I_FILE} PROPERTIES CPLUSPLUS ON)
|
||||
if (WIN32)
|
||||
SET(CMAKE_SWIG_FLAGS -dllimport \"CoolProp\")
|
||||
#SET_SOURCE_FILES_PROPERTIES(${I_FILE} PROPERTIES SWIG_FLAGS "-dllimport CoolProp")
|
||||
SET(MORE_SWIG_FLAGS -dllimport \"CoolProp\")
|
||||
endif()
|
||||
|
||||
# Define which headers the CoolProp wrapper is dependent on
|
||||
SET(SWIG_MODULE_CoolProp_EXTRA_DEPS ${SWIG_DEPENDENCIES})
|
||||
|
||||
set(SWIG_OPTIONS "${COOLPROP_SWIG_OPTIONS}" "${MORE_SWIG_FLAGS}")
|
||||
string(REPLACE " " ";" SWIG_OPTIONS "${SWIG_OPTIONS}")
|
||||
message(STATUS "options passed to swig: ${SWIG_OPTIONS}")
|
||||
|
||||
# Set properties before adding module
|
||||
set(I_FILE "${CMAKE_SOURCE_DIR}/src/CoolProp.i")
|
||||
SET_SOURCE_FILES_PROPERTIES(${I_FILE} PROPERTIES SWIG_FLAGS "${SWIG_OPTIONS}" CPLUSPLUS ON)
|
||||
|
||||
SWIG_ADD_MODULE(CoolProp csharp ${I_FILE} ${APP_SOURCES})
|
||||
|
||||
add_definitions(-DNO_ERROR_CATCHING) #disable internal error catching and allow swig to do the error catching itself
|
||||
@@ -458,11 +461,6 @@ if (COOLPROP_CSHARP_MODULE)
|
||||
COMMAND 7z a "${CMAKE_CURRENT_BINARY_DIR}/platform-independent.7z" "${CMAKE_CURRENT_BINARY_DIR}/*.cs"
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
|
||||
# Install all the generated cs files
|
||||
install(
|
||||
CODE "file( GLOB _GeneratedCsharpSources \"${CMAKE_CURRENT_BINARY_DIR}/*.cs\" )"
|
||||
CODE "file( INSTALL \${_GeneratedCsharpSources} DESTINATION ${CMAKE_INSTALL_PREFIX}/Csharp/platform-independent )"
|
||||
)
|
||||
install (FILES ${CMAKE_SOURCE_DIR}/Web/coolprop/wrappers/Csharp/Example.cs DESTINATION Csharp)
|
||||
install (FILES "${CMAKE_CURRENT_BINARY_DIR}/platform-independent.7z" DESTINATION ${CMAKE_INSTALL_PREFIX}/Csharp)
|
||||
install (TARGETS ${app_name} DESTINATION Csharp/${CMAKE_SYSTEM_NAME}_${BITNESS}bit)
|
||||
@@ -472,7 +470,7 @@ if (COOLPROP_CSHARP_MODULE)
|
||||
# Copy the shared object to the folder with the executable - no idea like java.library.path in C#
|
||||
install (TARGETS ${app_name} DESTINATION ${CMAKE_SOURCE_DIR}/testing_root/Csharp${BITNESS})
|
||||
endif()
|
||||
file(TO_NATIVE_PATH ${CMAKE_INSTALL_PREFIX}/Csharp/platform-independent/*.cs cp_cs_path)
|
||||
file(TO_NATIVE_PATH ${CMAKE_CURRENT_BINARY_DIR}/*.cs cp_cs_path)
|
||||
file(TO_NATIVE_PATH ${CMAKE_INSTALL_PREFIX}/Csharp/Example.cs cp_example_path)
|
||||
if (${BITNESS} EQUAL "32")
|
||||
set(CSHARP_PLAT "-platform:x86")
|
||||
@@ -487,6 +485,63 @@ if (COOLPROP_CSHARP_MODULE)
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/testing_root/Csharp${BITNESS})
|
||||
endif()
|
||||
|
||||
if (COOLPROP_VBDOTNET_MODULE)
|
||||
|
||||
# Must have SWIG and C#
|
||||
FIND_PACKAGE(SWIG REQUIRED)
|
||||
INCLUDE(${SWIG_USE_FILE})
|
||||
FIND_PACKAGE(Csharp REQUIRED)
|
||||
|
||||
# Make a src directory to deal with file permissions problem with MinGW makefile
|
||||
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CoolPropVB)
|
||||
|
||||
|
||||
|
||||
SET(MORE_SWIG_FLAGS -dllimport \"CoolProp\" -namespace CoolProp)
|
||||
SET(CMAKE_SWIG_OUTDIR CoolPropVB/CsharpClassLibrary)
|
||||
|
||||
# Define which headers the CoolProp wrapper is dependent on
|
||||
SET(SWIG_MODULE_CoolProp_EXTRA_DEPS ${SWIG_DEPENDENCIES})
|
||||
|
||||
set(SWIG_OPTIONS "${MORE_SWIG_FLAGS}")
|
||||
string(REPLACE " " ";" SWIG_OPTIONS "${SWIG_OPTIONS}")
|
||||
message(STATUS "options passed to swig: ${SWIG_OPTIONS}")
|
||||
|
||||
# Set properties before adding module
|
||||
set(I_FILE "${CMAKE_SOURCE_DIR}/src/CoolProp.i")
|
||||
SET_PROPERTY(SOURCE ${I_FILE} PROPERTY CPLUSPLUS ON)
|
||||
SET_PROPERTY(SOURCE ${I_FILE} PROPERTY SWIG_FLAGS ${SWIG_OPTIONS})
|
||||
SWIG_ADD_MODULE(CoolProp csharp ${I_FILE} ${APP_SOURCES})
|
||||
|
||||
add_definitions(-DNO_ERROR_CATCHING) #disable internal error catching and allow swig to do the error catching itself
|
||||
|
||||
if (WIN32)
|
||||
set_target_properties(CoolProp PROPERTIES PREFIX "")
|
||||
endif()
|
||||
|
||||
add_dependencies (${app_name} generate_headers)
|
||||
|
||||
add_custom_command(TARGET CoolProp
|
||||
PRE_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/wrappers/VB.NET/CoolPropVB ${CMAKE_CURRENT_BINARY_DIR}/CoolPropVB
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
add_custom_command(TARGET CoolProp
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:CoolProp> ${CMAKE_CURRENT_BINARY_DIR}/CoolPropVB/CoolPropVB
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
add_custom_command(TARGET CoolProp
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_CURRENT_BINARY_DIR}/CoolPropVB/CsharpClassLibrary/CoolPropCSHARP_wrap.cxx
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
add_custom_command(TARGET CoolProp
|
||||
POST_BUILD
|
||||
COMMAND 7z a "${CMAKE_CURRENT_BINARY_DIR}/VB.net_VS2012_example.7z" "${CMAKE_CURRENT_BINARY_DIR}/CoolPropVB"
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
|
||||
install (FILES "${CMAKE_CURRENT_BINARY_DIR}/VB.net_VS2012_example.7z" DESTINATION ${CMAKE_INSTALL_PREFIX}/VB.NET)
|
||||
|
||||
endif()
|
||||
|
||||
if (COOLPROP_JAVA_MODULE)
|
||||
|
||||
# Must have SWIG and Java
|
||||
@@ -708,13 +763,13 @@ if (COOLPROP_MATLAB_SWIG_MODULE)
|
||||
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/+CoolProp.7z DESTINATION ${CMAKE_INSTALL_PREFIX}/MATLAB)
|
||||
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/SwigRef.m DESTINATION ${CMAKE_INSTALL_PREFIX}/MATLAB)
|
||||
install (TARGETS CoolPropMATLAB_wrap DESTINATION ${CMAKE_INSTALL_PREFIX}/MATLAB)
|
||||
enable_testing()
|
||||
add_custom_command(TARGET CoolPropMATLAB_wrap
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/wrappers/MATLAB/test.m ${CMAKE_CURRENT_BINARY_DIR}/.)
|
||||
add_test(NAME MATLABtest
|
||||
COMMAND $ENV{MATLAB_ROOT}/bin/matlab -r test -nojvm -nodesktop -nosplash
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
#enable_testing()
|
||||
#add_custom_command(TARGET CoolPropMATLAB_wrap
|
||||
# POST_BUILD
|
||||
# COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/wrappers/MATLAB/test.m ${CMAKE_CURRENT_BINARY_DIR}/.)
|
||||
#add_test(NAME MATLABtest
|
||||
# COMMAND $ENV{MATLAB_ROOT}/bin/matlab -r test -nojvm -nodesktop -nosplash
|
||||
# WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
endif()
|
||||
|
||||
if (COOLPROP_MATLAB_MODULE)
|
||||
@@ -805,7 +860,7 @@ if (COOLPROP_JAVASCRIPT_MODULE)
|
||||
add_definitions(-s DISABLE_EXCEPTION_CATCHING=0)
|
||||
add_definitions(-s ASSERTIONS=1)
|
||||
add_definitions(-DEXTERNC)
|
||||
set(CMAKE_EXE_LINKER_FLAGS "-DEXTERNC -s EXPORTED_FUNCTIONS=\"['_main','_F2K','_Props1SI','_PropsSI','_get_global_param_string','_HAProps']\"")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "-DEXTERNC -s ASSERTIONS=1 -s EXPORTED_FUNCTIONS=\"['_main','_F2K','_Props1SI','_PropsSI','_get_global_param_string','_HAProps']\"")
|
||||
set(CMAKE_BUILD_TYPE Release)
|
||||
|
||||
list(APPEND APP_SOURCES "${CMAKE_SOURCE_DIR}/src/CoolPropLib.cpp")
|
||||
@@ -814,6 +869,7 @@ if (COOLPROP_JAVASCRIPT_MODULE)
|
||||
add_dependencies (coolprop generate_headers)
|
||||
SET_TARGET_PROPERTIES(coolprop PROPERTIES PREFIX "" SUFFIX .js)
|
||||
install (TARGETS coolprop DESTINATION ${CMAKE_INSTALL_PREFIX}/Javascript)
|
||||
install (FILES "${CMAKE_SOURCE_DIR}/Web/coolprop/wrappers/Javascript/index.html" DESTINATION ${CMAKE_INSTALL_PREFIX}/Javascript)
|
||||
endif()
|
||||
|
||||
if (COOLPROP_MATHEMATICA_MODULE)
|
||||
|
||||
@@ -1,6 +1,30 @@
|
||||
Changelog for CoolProp
|
||||
======================
|
||||
|
||||
5.0.6
|
||||
-----
|
||||
|
||||
New Features:
|
||||
|
||||
* Mathematica wrapper finished
|
||||
|
||||
Issues Closed:
|
||||
|
||||
* `#396 <http://github.com/CoolProp/CoolProp/issues/396>`_ : Initialize fail for HEOS in mixture with Argon and CarbonDioxide (in Matlab)
|
||||
* `#395 <http://github.com/CoolProp/CoolProp/issues/395>`_ : keyed_output and incompressibles
|
||||
* `#394 <http://github.com/CoolProp/CoolProp/issues/394>`_ : Python list inputs
|
||||
* `#391 <http://github.com/CoolProp/CoolProp/issues/391>`_ : release.bsh and source file
|
||||
* `#390 <http://github.com/CoolProp/CoolProp/issues/390>`_ : Transport properties of water
|
||||
* `#389 <http://github.com/CoolProp/CoolProp/issues/389>`_ : HAPropsSI("D", "T",273.15+20, "R", 0.8, "P", 101325) lead to an error
|
||||
* `#384 <http://github.com/CoolProp/CoolProp/issues/384>`_ : Put the example.nb Mathematica file in the main folder
|
||||
* `#383 <http://github.com/CoolProp/CoolProp/issues/383>`_ : When doing release, force a full build of the docs
|
||||
* `#382 <http://github.com/CoolProp/CoolProp/issues/382>`_ : Fix up the mathematica docs
|
||||
* `#379 <http://github.com/CoolProp/CoolProp/issues/379>`_ : After a release is done, delete the release folder
|
||||
* `#378 <http://github.com/CoolProp/CoolProp/issues/378>`_ : Also integrate the sphinx docs into the binaries/release/unstable folder output
|
||||
* `#377 <http://github.com/CoolProp/CoolProp/issues/377>`_ : Remove old mathematica files
|
||||
* `#376 <http://github.com/CoolProp/CoolProp/issues/376>`_ : Add python to list of prerequisites for self-compilation in the docs
|
||||
* `#329 <http://github.com/CoolProp/CoolProp/issues/329>`_ : Configure buildbot to send emails when we break things
|
||||
|
||||
5.0.5
|
||||
-----
|
||||
|
||||
|
||||
@@ -46,10 +46,10 @@ To use the HAProps function, import it and do some calls, do something like this
|
||||
In [2]: h = HAPropsSI('H','T',298.15,'P',101325,'R',0.5); print h
|
||||
|
||||
# Temperature of saturated air at the previous enthalpy
|
||||
In [2]: T = HAPropsSI('T','P',101.325,'H',h,'R',1.0); print T
|
||||
In [2]: T = HAPropsSI('T','P',101325,'H',h,'R',1.0); print T
|
||||
|
||||
# Temperature of saturated air - order of inputs doesn't matter
|
||||
In [2]: T = HAPropsSI('T','H',h,'R',1.0,'P',101.325); print T
|
||||
In [2]: T = HAPropsSI('T','H',h,'R',1.0,'P',101325); print T
|
||||
|
||||
Or go to the :ref:`Humid-Air` documentation.
|
||||
|
||||
|
||||
@@ -6,13 +6,24 @@ C# Wrapper
|
||||
|
||||
Pre-compiled Binaries
|
||||
=====================
|
||||
Pre-compiled release binaries can be downloaded from :sfdownloads:`Csharp`. Development binaries coming from the buildbot server can be found at :sfnightly:`Csharp`.
|
||||
|
||||
To Use
|
||||
------
|
||||
|
||||
Copy all the platform-independent .cs files to a folder on your computer you want, here we call it ``platform-independent``. Copy the DLL for your system architecture to the same location. Copy the Example.cs file to the same location. You will need to have a copy of some version of C#.
|
||||
Pre-compiled binaries can be downloaded from :sfdownloads:`Csharp`. Development binaries coming from the buildbot server can be found at :sfnightly:`Csharp`.
|
||||
|
||||
Download the ``platform-independent.7z`` file and expand it to a folder called ``platform-independent`` using 7-zip. Download the special C# shared library for your system architecture to the same location from either :sfdownloads:`Csharp` (release) or :sfnightly:`Csharp` (development). Copy the Example.cs file to the same location. You will need to have a copy of some version of C#.
|
||||
|
||||
When you are finished, you should have a folder layout something like ::
|
||||
|
||||
main
|
||||
|- CoolProp.dll
|
||||
|- Example.cs
|
||||
|- platform-independent
|
||||
|- AbstractState.cs
|
||||
|- Configuration.cs
|
||||
|- ...
|
||||
|
||||
Windows
|
||||
^^^^^^^
|
||||
|
||||
@@ -24,7 +35,7 @@ At the command prompt, run::
|
||||
|
||||
where you might need to update the path to visual studio depending on your version installed. Use `-platform:x86` to tell C# that your DLL is 32-bit if you are on 32-bit, or `-platform:x64` if you are on 64-bit.
|
||||
|
||||
Alternatively, you can add all the .cs files to a visual studio project.
|
||||
Alternatively, you can add all the .cs files to a visual studio project. If you do that, add the DLL to the project as well, right-click on the DLL, and select the option to copy it to the output directory.
|
||||
|
||||
Linux/OSX
|
||||
^^^^^^^^^
|
||||
@@ -33,6 +44,8 @@ Same idea as windows, but command line is just a bit different::
|
||||
|
||||
mcs Example.cs platform-independent/*.cs -platform:x64
|
||||
./Example
|
||||
|
||||
Use `-platform:x86` to tell C# that your shared library is 32-bit if you are on 32-bit, or `-platform:x64` if you are on a 64-bit platform.
|
||||
|
||||
User-Compiled Binaries
|
||||
======================
|
||||
|
||||
@@ -6,7 +6,20 @@ Java Wrapper
|
||||
|
||||
Pre-compiled Binaries
|
||||
=====================
|
||||
Pre-compiled binaries can be downloaded from :sfdownloads:`Java`, which come from :sfnightly:`the nightly snapshots <Java>`.
|
||||
|
||||
Pre-compiled binaries can be downloaded from :sfdownloads:`Java`. Development binaries coming from the buildbot server can be found at :sfnightly:`Java`.
|
||||
|
||||
Download the ``platform-independent.7z`` file and expand it to a folder called ``platform-independent`` using 7-zip. Download the special Java shared library for your system architecture to the same location from either :sfdownloads:`Java` (release) or :sfnightly:`Java` (development). Copy the Example.java file to the same location. You will need to have a copy of some version of java.
|
||||
|
||||
When you are finished, you should have a folder layout something like ::
|
||||
|
||||
main
|
||||
|- CoolProp.dll
|
||||
|- Example.java
|
||||
|- platform-independent
|
||||
|- AbstractState.java
|
||||
|- Configuration.java
|
||||
|- ...
|
||||
|
||||
Usage
|
||||
-----
|
||||
|
||||
100
Web/coolprop/wrappers/Javascript/index.html
Normal file
100
Web/coolprop/wrappers/Javascript/index.html
Normal file
@@ -0,0 +1,100 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>CoolProp Javascript example</title>
|
||||
<link rel="stylesheet" href="http://code.jquery.com/ui/1.11.0/themes/smoothness/jquery-ui.css" />
|
||||
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
|
||||
<script src="http://code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
|
||||
|
||||
<script src="http://code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
|
||||
<script>
|
||||
//<link rel="stylesheet" href="/resources/demos/style.css" />
|
||||
</script>
|
||||
|
||||
<script src="http://www.coolprop.sourceforge.net/jscript/coolprop-latest.js"></script>
|
||||
<!-- <script src="coolprop.js"></script> -->
|
||||
<script>
|
||||
PropsSI = Module.cwrap('PropsSI','number',['string','string','number','string','number','string'])
|
||||
Props1 = Module.cwrap('Props1SI','number',['string','string'])
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="ui-widget">
|
||||
<label>FluidName: </label>
|
||||
<select id="FluidName">
|
||||
<option>Nitrogen</option>
|
||||
<option>R134a</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="ui-widget">
|
||||
<label>Input #1: </label>
|
||||
<select id="Name1">
|
||||
<option value="">Select one...</option>
|
||||
<option value="Pressure">Pressure [Pa]</option>
|
||||
<option value="Temperature">Temperature [K]</option>
|
||||
<option value="Density">Density [kg/m³]</option>
|
||||
</select>
|
||||
<input id ='Value1'></input>
|
||||
</div>
|
||||
<div class="ui-widget">
|
||||
<label>Input #2: </label>
|
||||
<select id="Name2">
|
||||
<option value="">Select one...</option>
|
||||
<option value="Pressure">Pressure [Pa]</option>
|
||||
<option value="Temperature">Temperature [K]</option>
|
||||
<option value="Density">Density [kg/m³]</option>
|
||||
</select>
|
||||
<input id ='Value2'></input>
|
||||
</div>
|
||||
|
||||
<button id="calc">Calculate</button>
|
||||
<div class="ui-widget">
|
||||
<label>Output: </label>
|
||||
</div>
|
||||
<div class="ui-widget">
|
||||
<p id="output">
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function text2key(text)
|
||||
{
|
||||
if (text == 'Pressure [Pa]')
|
||||
return 'P';
|
||||
else if (text == 'Temperature [K]')
|
||||
return 'T';
|
||||
else if (text == 'Density [kg/m³]')
|
||||
return 'D';
|
||||
}
|
||||
//using jQuery
|
||||
$('#calc').click( function() {
|
||||
var name = $('#FluidName :selected').text()
|
||||
var key1 = text2key($('#Name1 :selected').text())
|
||||
var key2 = text2key($('#Name2 :selected').text())
|
||||
var val1 = parseFloat($('#Value1').val())
|
||||
var val2 = parseFloat($('#Value2').val())
|
||||
|
||||
var T = PropsSI('T', key1, val1, key2, val2, name)
|
||||
var rho = PropsSI('D', key1, val1, key2, val2, name)
|
||||
var p = PropsSI('P', key1, val1, key2, val2, name)
|
||||
var s = PropsSI('S', key1, val1, key2, val2, name)
|
||||
var h = PropsSI('H', key1, val1, key2, val2, name)
|
||||
var cp = PropsSI('C', key1, val1, key2, val2, name)
|
||||
|
||||
text = ''
|
||||
text += 'T = ' + T + ' K\n' + '<br>'
|
||||
text += 'rho = ' + rho + ' kg/m³ <br>'
|
||||
text += 'p = ' + p + ' Pa<br>'
|
||||
text += 's = ' + s + ' J/kg/K<br>'
|
||||
text += 'h = ' + h + ' J/kg<br>'
|
||||
text += 'cp = ' + cp + ' J/kg/K<br>'
|
||||
|
||||
$( "#output" ).html( text);
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -10,7 +10,9 @@ Pre-Compiled Binaries
|
||||
|
||||
* Download the precompiled binaries from :sfdownloads:`Javascript`, or the development versions from the buildbot server at :sfnightly:`Javascript`
|
||||
|
||||
* Load your js file into your website, following the structure of `the example here <https://github.com/CoolProp/CoolProp/blob/master/wrappers/Javascript/index.html>`_, which is also included at the above download link
|
||||
* Load your js file into your website, following the structure of `the example here <https://github.com/CoolProp/CoolProp/blob/master/Web/coolprop/wrappers/Javascript/index.html>`_, which is also included at the above download link
|
||||
|
||||
* You can also build your website and include our hosted Javascript repository. You will never ever have to update your library by linking directly to ``<script src="http://www.coolprop.sourceforge.net/jscript/coolprop-latest.js"></script>`` in your HTML header. Until now, this file does not get updated automatically, so please file an issue on
|
||||
|
||||
User-Compiled Binaries
|
||||
======================
|
||||
@@ -51,7 +53,7 @@ We are following the instructions from `emscripten.org <http://kripken.github.io
|
||||
|
||||
10. Build the Javascript module::
|
||||
|
||||
cmake .. -DCOOLPROP_JAVASCRIPT_MODULE=ON -DCMAKE_TOOLCHAIN_FILE=${EMSCRIPTEN}/cmake/Platform/Emscripten.cmake
|
||||
cmake .. -DCOOLPROP_JAVASCRIPT_MODULE=ON -DCMAKE_TOOLCHAIN_FILE=${EMSCRIPTEN}/cmake/Modules/Platform/Emscripten.cmake
|
||||
|
||||
Windows
|
||||
-------
|
||||
@@ -83,4 +85,4 @@ Windows
|
||||
|
||||
7. Build the Javascript module::
|
||||
|
||||
cmake ../.. -DCOOLPROP_JAVASCRIPT_MODULE=ON -DCMAKE_TOOLCHAIN_FILE=%EMSCRIPTEN%/cmake/Platform/Emscripten.cmake
|
||||
cmake ../.. -DCOOLPROP_JAVASCRIPT_MODULE=ON -DCMAKE_TOOLCHAIN_FILE=%EMSCRIPTEN%/cmake/Modules/Platform/Emscripten.cmake
|
||||
|
||||
@@ -16,6 +16,7 @@ Target Operating Systems Not
|
||||
:ref:`Python <Python>` linux, OSX, win Wrapper is Cython based
|
||||
:ref:`Octave <Octave>` linux, OSX, win Wrapper is SWIG based
|
||||
:ref:`C# <Csharp>` linux, OSX, win Wrapper is SWIG based
|
||||
:ref:`VB.net <VBdotNet>` windows only Wrapper is SWIG based
|
||||
:ref:`MATLAB <MATLAB>` linux, OSX, win Wrapper is SWIG based
|
||||
:ref:`Java <Java>` linux, OSX, win Wrapper is SWIG based
|
||||
:ref:`Scilab <Scilab>` linux, OSX, win Wrapper is SWIG based (experimental)
|
||||
@@ -122,4 +123,5 @@ and explicitly typing "agree" before closing. Then you can use the compiler from
|
||||
SMath/index.rst
|
||||
StaticLibrary/index.rst
|
||||
SharedLibrary/index.rst
|
||||
DelphiLazarus/index.rst
|
||||
DelphiLazarus/index.rst
|
||||
VBdotNET/index.rst
|
||||
@@ -10,7 +10,7 @@ The source code of CoolProp is stored in a github repository at https://github.c
|
||||
Doxygen formatted documentation of the source files
|
||||
---------------------------------------------------
|
||||
|
||||
Real-time builds of the `doxygen <http://www.stack.nl/~dimitri/doxygen/>`_ formatted HTML outputs for the development code are at :bbsphinx:`the buildbot development server<_static/doxygen/html>`.
|
||||
Real-time builds of the `doxygen <http://www.stack.nl/~dimitri/doxygen/>`_ formatted HTML outputs for the development code are at :bbsphinx:`the buildbot development server<http://www.coolprop.org/_static/doxygen/html/>`.
|
||||
|
||||
More information
|
||||
----------------
|
||||
|
||||
@@ -27,6 +27,19 @@
|
||||
Timestamp = {2014.09.17}
|
||||
}
|
||||
|
||||
@Article{Huber2009,
|
||||
Title = {{New International Formulation for the Viscosity of H2O}},
|
||||
Author = {M.L. Huber and R.A. Perkins and A. Laesecke and D.G. Friend and J.V. Sengers and M.J Assael and I.M. Metaxa and E. Vogel and R. Mare{\v s} and K. Miyagawa},
|
||||
Journal = {J. Phys. Chem. Ref. Data},
|
||||
Year = {2009},
|
||||
Number = {2},
|
||||
Pages = {101-125},
|
||||
Volume = {38},
|
||||
|
||||
Owner = {Belli},
|
||||
Timestamp = {2013.04.08}
|
||||
}
|
||||
|
||||
@Manual{Jones2001,
|
||||
Title = {{SciPy}: Open source scientific tools for {Python}},
|
||||
Author = {Eric Jones and Travis Oliphant and Pearu Peterson and others},
|
||||
@@ -56,7 +69,7 @@
|
||||
Pages = {421--426},
|
||||
Volume = {128},
|
||||
|
||||
Doi = {0.1115/1.2175090},
|
||||
Doi = {10.1115/1.2175090},
|
||||
Owner = {jowr},
|
||||
Timestamp = {2014.12.16}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@ These pages help you to get started using CoolProp and provide detailed informat
|
||||
returning user. Please feel free to browse the pages and use the menu on the left to navigate
|
||||
on this website.
|
||||
|
||||
|
||||
What is CoolProp?
|
||||
-----------------
|
||||
|
||||
@@ -18,7 +17,6 @@ CoolProp is a C++ library that implements:
|
||||
- :ref:`Correlations of properties of incompressible fluids and brines <Pure>`
|
||||
- :ref:`Highest accuracy psychrometric routines <Humid-Air>`
|
||||
|
||||
|
||||
Environments Supported
|
||||
----------------------
|
||||
|
||||
@@ -48,6 +46,7 @@ Help
|
||||
|
||||
- File a `Github issue <https://github.com/CoolProp/CoolProp/issues>`_
|
||||
- Email the `Google group <https://groups.google.com/d/forum/coolprop-users>`_
|
||||
- `Docs for v4 of CoolProp <http://www.coolprop.org/v4/>`_
|
||||
|
||||
|
||||
Projects Using CoolProp
|
||||
|
||||
0
Web/scripts/fluid_properties.Incompressibles.sh
Normal file → Executable file
0
Web/scripts/fluid_properties.Incompressibles.sh
Normal file → Executable file
@@ -231,19 +231,35 @@ def docActivateCmd():
|
||||
@properties.renderer
|
||||
def fullBuildCommand(props):
|
||||
return ' '.join([docActivateCmd(), "python", "__init__.py", str(props.getProperty('fullBuild', default = False) or props.getProperty('branch') == 'release')])
|
||||
|
||||
@properties.renderer
|
||||
def rsyncCommand(props):
|
||||
"""
|
||||
A renderable command that creates the rsync command to be run
|
||||
"""
|
||||
|
||||
# Some basic preparations, make sure the machine has passwordless SSH access to the server
|
||||
#
|
||||
server_uri = 'coolprop@coolprop.dreamhosters.com'
|
||||
server_dir = '/home/coolprop/buildbot/server-master'
|
||||
server_des = "{0}:{1}".format(server_uri, server_dir)
|
||||
#
|
||||
local_build_dir = 'Web/_build/html'
|
||||
|
||||
if props.getProperty('branch') == 'release':
|
||||
server_target_dir = '{0}/public_html/release/sphinx'.format(server_des)
|
||||
elif props.getProperty('branch') == 'master':
|
||||
server_target_dir = '{0}/public_html/binaries/sphinx'.format(server_des)
|
||||
else:
|
||||
server_target_dir = '{0}/public_html/unstable/sphinx'.format(server_des)
|
||||
|
||||
return ' '.join([docActivateCmd(), 'rsync', '-a', '--stats', '{0}/ {1}'.format(local_build_dir,server_target_dir)])
|
||||
|
||||
# All what is needed to create the website, it makes sense to run the
|
||||
# nightly builds on the same machine. This avoids extra data transfer.
|
||||
def websiteFactory(platform, gitMode='incremental', fullBuild=False):
|
||||
if 'win' in platform.lower():
|
||||
raise ValueError("The docs cannot be build on a Windows machine, we rely on rsync...")
|
||||
# Some basic preparations, make sure the machine has passwordless SSH access to the server
|
||||
server_uri = 'coolprop@coolprop.dreamhosters.com'
|
||||
server_dir = '/home/coolprop/buildbot/server-master'
|
||||
server_des = "{0}:{1}".format(server_uri,server_dir)
|
||||
#
|
||||
local_build_dir = 'Web/_build/html'
|
||||
server_target_dir = '{0}/public_html/sphinx'.format(server_des)
|
||||
#
|
||||
# Create the factory to add the actions to
|
||||
factory = getBaseFactory(gitMode=gitMode)
|
||||
@@ -268,7 +284,7 @@ def websiteFactory(platform, gitMode='incremental', fullBuild=False):
|
||||
# Run sphinx website builder
|
||||
factory.addStep(ShellCommand(command=' '.join([docActivateCmd(), "make", "html"]), workdir= 'build/Web', haltOnFailure = True))
|
||||
# Upload the generated files
|
||||
factory.addStep(ShellCommand(command=' '.join([docActivateCmd(), 'rsync', '-a', '--stats', '{0}/ {1}'.format(local_build_dir,server_target_dir)]), haltOnFailure = True))
|
||||
factory.addStep(ShellCommand(command=rsyncCommand, haltOnFailure = True))
|
||||
return factory
|
||||
|
||||
|
||||
@@ -433,7 +449,7 @@ def javascript_slave(platform, cmake_args = [], cmake_env = {}, build_args = [],
|
||||
# Remove the temporary folder for installs
|
||||
factory.addStep(RemoveDirectory(dir="build/install_root", haltOnFailure = True))
|
||||
|
||||
factory.addStep(ShellCommand(command="cmake .. -DCOOLPROP_JAVASCRIPT_MODULE=ON -DCMAKE_TOOLCHAIN_FILE=${EMSCRIPTEN}/cmake/Platform/Emscripten.cmake",
|
||||
factory.addStep(ShellCommand(command="cmake .. -DCOOLPROP_JAVASCRIPT_MODULE=ON -DCMAKE_TOOLCHAIN_FILE=${EMSCRIPTEN}/cmake/Modules/Platform/Emscripten.cmake",
|
||||
workdir= working_folder,
|
||||
haltOnFailure = True))
|
||||
factory.addStep(ShellCommand(command=["cmake", "--build", ".", "--target", "install"]+build_args, workdir = working_folder, haltOnFailure = True))
|
||||
@@ -484,6 +500,7 @@ def excel_slave(gitMode = 'incremental'):
|
||||
# Create the factory to add the actions to
|
||||
factory = getBaseFactory(gitMode=gitMode)
|
||||
#
|
||||
factory.addStep(MakeDirectory(dir='build/bin/MicrosoftExcel', haltOnFailure = True))
|
||||
factory.addStep(MakeDirectory(dir=working_folder+'/32bitDLL', haltOnFailure = True))
|
||||
factory.addStep(MakeDirectory(dir=working_folder+'/64bitDLL', haltOnFailure = True))
|
||||
factory.addStep(RemoveDirectory(dir="build/install_root", haltOnFailure = True))
|
||||
@@ -587,9 +604,9 @@ def swig_matlab_builder(platform, gitMode = 'incremental', build_args = [], cmak
|
||||
|
||||
def prepend_path(cmd):
|
||||
if platform == 'windows':
|
||||
pre_path = 'set "PATH=swig-matlab-bin\\bin;C:\\Program Files\\7-Zip\\;%PATH%" && set "SWIG_LIB=swig-matlab-bin\\share\\swig\\3.0.3" && '
|
||||
pre_path = 'set "PATH=swig-matlab-bin\\bin;C:\\Program Files\\7-Zip\\;%PATH%" && set "SWIG_LIB=swig-matlab-bin\\share\\swig\\3.0.5" && '
|
||||
else:
|
||||
pre_path = 'export PATH=swig-matlab-bin/bin:${PATH} && export SWIG_LIB=swig-matlab-bin/share/swig/3.0.3 && '
|
||||
pre_path = 'export PATH=swig-matlab-bin/bin:${PATH} && export SWIG_LIB=swig-matlab-bin/share/swig/3.0.5 && '
|
||||
return pre_path+cmd
|
||||
|
||||
# Create the factory to add the actions to
|
||||
@@ -915,13 +932,17 @@ c['builders'].append(
|
||||
#Common boring 64-bit modules for windows, linux and OSX
|
||||
### OSX
|
||||
for platform in ['OSX', 'linux', 'windows']:
|
||||
for wrapper in ['Java','Csharp','Octave','PHP','64BIT_SHARED_LIBRARY','STATIC_LIBRARY','MATHEMATICA']:
|
||||
for wrapper in ['Java','Csharp','Octave','PHP','64BIT_SHARED_LIBRARY','STATIC_LIBRARY','MATHEMATICA','VBDOTNET']:
|
||||
if wrapper == 'PHP' and platform != 'linux': continue # only build PHP on linux
|
||||
if wrapper == 'VBDOTNET' and not platform.startswith('windows'): continue # only build VB.net on windows
|
||||
ctest_args, cmake_args, build_args = [], [], []
|
||||
if platform.startswith('windows'):
|
||||
ctest_args = ['-C', 'Release']
|
||||
if wrapper == 'Octave':
|
||||
cmake_args = ['-G', '"MinGW Makefiles"']
|
||||
elif wrapper == 'VBDOTNET':
|
||||
cmake_args = ['-G', '"Visual Studio 11 2012 Win64"']
|
||||
build_args = ['--config','Release']
|
||||
else:
|
||||
cmake_args = ['-G', '"Visual Studio 10 2010 Win64"']
|
||||
build_args = ['--config','Release']
|
||||
|
||||
@@ -160,6 +160,7 @@
|
||||
<IncludePath Value="."/>
|
||||
<IncludePath Value="../../include"/>
|
||||
<IncludePath Value="../../externals/Eigen"/>
|
||||
<IncludePath Value="../../externals/REFPROP-headers"/>
|
||||
<Preprocessor Value="ENABLE_CATCH"/>
|
||||
</Compiler>
|
||||
<Linker Options="" Required="yes"/>
|
||||
@@ -201,6 +202,7 @@
|
||||
<IncludePath Value="."/>
|
||||
<IncludePath Value="../../include"/>
|
||||
<IncludePath Value="../../externals/Eigen"/>
|
||||
<IncludePath Value="../../externals/REFPROP-headers"/>
|
||||
<Preprocessor Value="NDEBUG"/>
|
||||
<Preprocessor Value="ENABLE_CATCH"/>
|
||||
</Compiler>
|
||||
|
||||
@@ -581,8 +581,9 @@ class CoefficientData(SolutionData):
|
||||
self.conductivity.coeffs = self.convertMelinderArray(coeffs[3])
|
||||
|
||||
self.viscosity.source = self.viscosity.SOURCE_COEFFS
|
||||
self.viscosity.type = self.viscosity.INCOMPRESSIBLE_POLYNOMIAL
|
||||
self.viscosity.coeffs = self.convertMelinderArray(coeffs[4])/1e3
|
||||
self.viscosity.type = self.viscosity.INCOMPRESSIBLE_EXPPOLYNOMIAL
|
||||
self.viscosity.coeffs = self.convertMelinderArray(coeffs[4])
|
||||
self.viscosity.coeffs[0,0] -= math.log(1000) # Fixes the units mPa s -> Pa s
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -585,7 +585,7 @@ class Water(PureData):
|
||||
self.TminPsat = np.min(self.temperature.data[~np.isnan(self.saturation_pressure.data)])
|
||||
self.name = "Water"
|
||||
self.description = "Fit of the subcooled region of the full EOS from 1 bar to 100 bar"
|
||||
self.reference = "Wagner2002, Transport properties from Huber et. al (2 papers)"
|
||||
self.reference = "Wagner2002, Huber2009"
|
||||
self.reshapeAll()
|
||||
# Specific heat needs special coefficiencts
|
||||
# self.specific_heat.coeffs = np.zeros((5,7))
|
||||
|
||||
@@ -145,39 +145,39 @@
|
||||
"viscosity": {
|
||||
"coeffs": [
|
||||
[
|
||||
1.153000e-03,
|
||||
5.448000e-04,
|
||||
-5.552000e-03,
|
||||
3.038000e-03,
|
||||
6.669000e-03,
|
||||
-8.472000e-03
|
||||
-5.754755e+00,
|
||||
5.448000e-01,
|
||||
-5.552000e+00,
|
||||
3.038000e+00,
|
||||
6.669000e+00,
|
||||
-8.472000e+00
|
||||
],
|
||||
[
|
||||
-3.866000e-05,
|
||||
1.008000e-05,
|
||||
8.384000e-05,
|
||||
-7.435000e-05,
|
||||
-9.105000e-05,
|
||||
-3.866000e-02,
|
||||
1.008000e-02,
|
||||
8.384000e-02,
|
||||
-7.435000e-02,
|
||||
-9.105000e-02,
|
||||
0.000000e+00
|
||||
],
|
||||
[
|
||||
2.779000e-07,
|
||||
-2.809000e-07,
|
||||
-3.997000e-07,
|
||||
7.442000e-07,
|
||||
2.779000e-04,
|
||||
-2.809000e-04,
|
||||
-3.997000e-04,
|
||||
7.442000e-04,
|
||||
0.000000e+00,
|
||||
0.000000e+00
|
||||
],
|
||||
[
|
||||
-1.543000e-09,
|
||||
9.811000e-10,
|
||||
-3.466000e-09,
|
||||
-1.543000e-06,
|
||||
9.811000e-07,
|
||||
-3.466000e-06,
|
||||
0.000000e+00,
|
||||
0.000000e+00,
|
||||
0.000000e+00
|
||||
]
|
||||
],
|
||||
"type": "polynomial"
|
||||
"type": "exppolynomial"
|
||||
},
|
||||
"volume2input": {
|
||||
"coeffs": "null",
|
||||
|
||||
@@ -145,39 +145,39 @@
|
||||
"viscosity": {
|
||||
"coeffs": [
|
||||
[
|
||||
9.255000e-04,
|
||||
1.327000e-03,
|
||||
-5.979000e-03,
|
||||
-1.097000e-01,
|
||||
3.065000e-01,
|
||||
3.244000e+00
|
||||
-5.982255e+00,
|
||||
1.327000e+00,
|
||||
-5.979000e+00,
|
||||
-1.097000e+02,
|
||||
3.065000e+02,
|
||||
3.244000e+03
|
||||
],
|
||||
[
|
||||
-3.439000e-05,
|
||||
1.856000e-05,
|
||||
-2.184000e-04,
|
||||
1.670000e-03,
|
||||
-6.166000e-03,
|
||||
-3.439000e-02,
|
||||
1.856000e-02,
|
||||
-2.184000e-01,
|
||||
1.670000e+00,
|
||||
-6.166000e+00,
|
||||
0.000000e+00
|
||||
],
|
||||
[
|
||||
3.217000e-07,
|
||||
-1.646000e-06,
|
||||
1.297000e-05,
|
||||
-3.377000e-05,
|
||||
3.217000e-04,
|
||||
-1.646000e-03,
|
||||
1.297000e-02,
|
||||
-3.377000e-02,
|
||||
0.000000e+00,
|
||||
0.000000e+00
|
||||
],
|
||||
[
|
||||
-4.544000e-09,
|
||||
3.004000e-08,
|
||||
-1.141000e-07,
|
||||
-4.544000e-06,
|
||||
3.004000e-05,
|
||||
-1.141000e-04,
|
||||
0.000000e+00,
|
||||
0.000000e+00,
|
||||
0.000000e+00
|
||||
]
|
||||
],
|
||||
"type": "polynomial"
|
||||
"type": "exppolynomial"
|
||||
},
|
||||
"volume2input": {
|
||||
"coeffs": "null",
|
||||
|
||||
@@ -145,39 +145,39 @@
|
||||
"viscosity": {
|
||||
"coeffs": [
|
||||
[
|
||||
8.939000e-04,
|
||||
4.389000e-03,
|
||||
9.121000e-03,
|
||||
1.963000e-03,
|
||||
2.997000e-02,
|
||||
3.435000e-01
|
||||
-6.013855e+00,
|
||||
4.389000e+00,
|
||||
9.121000e+00,
|
||||
1.963000e+00,
|
||||
2.997000e+01,
|
||||
3.435000e+02
|
||||
],
|
||||
[
|
||||
-2.647000e-05,
|
||||
2.102000e-05,
|
||||
3.993000e-05,
|
||||
-4.892000e-04,
|
||||
-3.631000e-03,
|
||||
-2.647000e-02,
|
||||
2.102000e-02,
|
||||
3.993000e-02,
|
||||
-4.892000e-01,
|
||||
-3.631000e+00,
|
||||
0.000000e+00
|
||||
],
|
||||
[
|
||||
1.718000e-07,
|
||||
-8.688000e-08,
|
||||
3.785000e-06,
|
||||
1.526000e-08,
|
||||
1.718000e-04,
|
||||
-8.688000e-05,
|
||||
3.785000e-03,
|
||||
1.526000e-05,
|
||||
0.000000e+00,
|
||||
0.000000e+00
|
||||
],
|
||||
[
|
||||
-7.918000e-10,
|
||||
-4.353000e-09,
|
||||
-9.979000e-08,
|
||||
-7.918000e-07,
|
||||
-4.353000e-06,
|
||||
-9.979000e-05,
|
||||
0.000000e+00,
|
||||
0.000000e+00,
|
||||
0.000000e+00
|
||||
]
|
||||
],
|
||||
"type": "polynomial"
|
||||
"type": "exppolynomial"
|
||||
},
|
||||
"volume2input": {
|
||||
"coeffs": "null",
|
||||
|
||||
@@ -145,39 +145,39 @@
|
||||
"viscosity": {
|
||||
"coeffs": [
|
||||
[
|
||||
1.474000e-03,
|
||||
1.565000e-03,
|
||||
-8.435000e-03,
|
||||
7.552000e-03,
|
||||
1.529000e-02,
|
||||
-4.130000e-02
|
||||
-5.433755e+00,
|
||||
1.565000e+00,
|
||||
-8.435000e+00,
|
||||
7.552000e+00,
|
||||
1.529000e+01,
|
||||
-4.130000e+01
|
||||
],
|
||||
[
|
||||
-4.745000e-05,
|
||||
-4.106000e-06,
|
||||
1.640000e-04,
|
||||
-1.118000e-04,
|
||||
-9.481000e-05,
|
||||
-4.745000e-02,
|
||||
-4.106000e-03,
|
||||
1.640000e-01,
|
||||
-1.118000e-01,
|
||||
-9.481000e-02,
|
||||
0.000000e+00
|
||||
],
|
||||
[
|
||||
4.314000e-07,
|
||||
-5.135000e-07,
|
||||
-1.091000e-06,
|
||||
1.899000e-06,
|
||||
4.314000e-04,
|
||||
-5.135000e-04,
|
||||
-1.091000e-03,
|
||||
1.899000e-03,
|
||||
0.000000e+00,
|
||||
0.000000e+00
|
||||
],
|
||||
[
|
||||
-3.023000e-09,
|
||||
7.004000e-09,
|
||||
-1.967000e-08,
|
||||
-3.023000e-06,
|
||||
7.004000e-06,
|
||||
-1.967000e-05,
|
||||
0.000000e+00,
|
||||
0.000000e+00,
|
||||
0.000000e+00
|
||||
]
|
||||
],
|
||||
"type": "polynomial"
|
||||
"type": "exppolynomial"
|
||||
},
|
||||
"volume2input": {
|
||||
"coeffs": "null",
|
||||
|
||||
@@ -145,39 +145,39 @@
|
||||
"viscosity": {
|
||||
"coeffs": [
|
||||
[
|
||||
4.705000e-04,
|
||||
2.471000e-03,
|
||||
3.328000e-05,
|
||||
1.659000e-03,
|
||||
3.089000e-03,
|
||||
-1.865000e-02
|
||||
-6.437255e+00,
|
||||
2.471000e+00,
|
||||
3.328000e-02,
|
||||
1.659000e+00,
|
||||
3.089000e+00,
|
||||
-1.865000e+01
|
||||
],
|
||||
[
|
||||
-2.550000e-05,
|
||||
-1.171000e-05,
|
||||
1.086000e-05,
|
||||
3.157000e-06,
|
||||
1.831000e-05,
|
||||
-2.550000e-02,
|
||||
-1.171000e-02,
|
||||
1.086000e-02,
|
||||
3.157000e-03,
|
||||
1.831000e-02,
|
||||
0.000000e+00
|
||||
],
|
||||
[
|
||||
1.782000e-07,
|
||||
1.052000e-07,
|
||||
1.051000e-07,
|
||||
4.063000e-07,
|
||||
1.782000e-04,
|
||||
1.052000e-04,
|
||||
1.051000e-04,
|
||||
4.063000e-04,
|
||||
0.000000e+00,
|
||||
0.000000e+00
|
||||
],
|
||||
[
|
||||
-7.669000e-10,
|
||||
-1.634000e-09,
|
||||
-6.475000e-09,
|
||||
-7.669000e-07,
|
||||
-1.634000e-06,
|
||||
-6.475000e-06,
|
||||
0.000000e+00,
|
||||
0.000000e+00,
|
||||
0.000000e+00
|
||||
]
|
||||
],
|
||||
"type": "polynomial"
|
||||
"type": "exppolynomial"
|
||||
},
|
||||
"volume2input": {
|
||||
"coeffs": "null",
|
||||
|
||||
@@ -145,39 +145,39 @@
|
||||
"viscosity": {
|
||||
"coeffs": [
|
||||
[
|
||||
1.520000e-03,
|
||||
4.450000e-03,
|
||||
3.633000e-03,
|
||||
1.069000e-03,
|
||||
5.729000e-03,
|
||||
2.116000e-02
|
||||
-5.387755e+00,
|
||||
4.450000e+00,
|
||||
3.633000e+00,
|
||||
1.069000e+00,
|
||||
5.729000e+00,
|
||||
2.116000e+01
|
||||
],
|
||||
[
|
||||
-3.729000e-05,
|
||||
-2.688000e-05,
|
||||
-4.088000e-05,
|
||||
-1.248000e-04,
|
||||
-1.780000e-04,
|
||||
-3.729000e-02,
|
||||
-2.688000e-02,
|
||||
-4.088000e-02,
|
||||
-1.248000e-01,
|
||||
-1.780000e-01,
|
||||
0.000000e+00
|
||||
],
|
||||
[
|
||||
3.572000e-07,
|
||||
8.876000e-08,
|
||||
6.219000e-07,
|
||||
3.019000e-06,
|
||||
3.572000e-04,
|
||||
8.876000e-05,
|
||||
6.219000e-04,
|
||||
3.019000e-03,
|
||||
0.000000e+00,
|
||||
0.000000e+00
|
||||
],
|
||||
[
|
||||
-3.648000e-09,
|
||||
-2.209000e-09,
|
||||
6.331000e-09,
|
||||
-3.648000e-06,
|
||||
-2.209000e-06,
|
||||
6.331000e-06,
|
||||
0.000000e+00,
|
||||
0.000000e+00,
|
||||
0.000000e+00
|
||||
]
|
||||
],
|
||||
"type": "polynomial"
|
||||
"type": "exppolynomial"
|
||||
},
|
||||
"volume2input": {
|
||||
"coeffs": "null",
|
||||
|
||||
@@ -145,39 +145,39 @@
|
||||
"viscosity": {
|
||||
"coeffs": [
|
||||
[
|
||||
1.042000e-03,
|
||||
3.405000e-03,
|
||||
5.017000e-03,
|
||||
5.637000e-03,
|
||||
-2.922000e-02,
|
||||
-7.960000e-02
|
||||
-5.865755e+00,
|
||||
3.405000e+00,
|
||||
5.017000e+00,
|
||||
5.637000e+00,
|
||||
-2.922000e+01,
|
||||
-7.960000e+01
|
||||
],
|
||||
[
|
||||
-3.071000e-05,
|
||||
-1.511000e-05,
|
||||
-7.779000e-05,
|
||||
2.534000e-05,
|
||||
4.601000e-04,
|
||||
-3.071000e-02,
|
||||
-1.511000e-02,
|
||||
-7.779000e-02,
|
||||
2.534000e-02,
|
||||
4.601000e-01,
|
||||
0.000000e+00
|
||||
],
|
||||
[
|
||||
2.819000e-07,
|
||||
1.172000e-07,
|
||||
9.125000e-07,
|
||||
1.596000e-06,
|
||||
2.819000e-04,
|
||||
1.172000e-04,
|
||||
9.125000e-04,
|
||||
1.596000e-03,
|
||||
0.000000e+00,
|
||||
0.000000e+00
|
||||
],
|
||||
[
|
||||
-2.190000e-09,
|
||||
-2.379000e-09,
|
||||
-1.888000e-08,
|
||||
-2.190000e-06,
|
||||
-2.379000e-06,
|
||||
-1.888000e-05,
|
||||
0.000000e+00,
|
||||
0.000000e+00,
|
||||
0.000000e+00
|
||||
]
|
||||
],
|
||||
"type": "polynomial"
|
||||
"type": "exppolynomial"
|
||||
},
|
||||
"volume2input": {
|
||||
"coeffs": "null",
|
||||
|
||||
@@ -145,39 +145,39 @@
|
||||
"viscosity": {
|
||||
"coeffs": [
|
||||
[
|
||||
8.063000e-04,
|
||||
3.624000e-03,
|
||||
6.659000e-03,
|
||||
1.077000e-02,
|
||||
-1.097000e-02,
|
||||
-8.453000e-02
|
||||
-6.101455e+00,
|
||||
3.624000e+00,
|
||||
6.659000e+00,
|
||||
1.077000e+01,
|
||||
-1.097000e+01,
|
||||
-8.453000e+01
|
||||
],
|
||||
[
|
||||
-2.362000e-05,
|
||||
-1.262000e-06,
|
||||
-1.611000e-04,
|
||||
-9.796000e-05,
|
||||
7.825000e-04,
|
||||
-2.362000e-02,
|
||||
-1.262000e-03,
|
||||
-1.611000e-01,
|
||||
-9.796000e-02,
|
||||
7.825000e-01,
|
||||
0.000000e+00
|
||||
],
|
||||
[
|
||||
1.851000e-07,
|
||||
-3.022000e-08,
|
||||
1.530000e-06,
|
||||
3.070000e-06,
|
||||
1.851000e-04,
|
||||
-3.022000e-05,
|
||||
1.530000e-03,
|
||||
3.070000e-03,
|
||||
0.000000e+00,
|
||||
0.000000e+00
|
||||
],
|
||||
[
|
||||
-2.372000e-09,
|
||||
-7.761000e-10,
|
||||
1.061000e-08,
|
||||
-2.372000e-06,
|
||||
-7.761000e-07,
|
||||
1.061000e-05,
|
||||
0.000000e+00,
|
||||
0.000000e+00,
|
||||
0.000000e+00
|
||||
]
|
||||
],
|
||||
"type": "polynomial"
|
||||
"type": "exppolynomial"
|
||||
},
|
||||
"volume2input": {
|
||||
"coeffs": "null",
|
||||
|
||||
@@ -145,39 +145,39 @@
|
||||
"viscosity": {
|
||||
"coeffs": [
|
||||
[
|
||||
8.088000e-04,
|
||||
1.758000e-03,
|
||||
-8.372000e-04,
|
||||
-1.184000e-03,
|
||||
1.088000e-01,
|
||||
3.098000e-01
|
||||
-6.098955e+00,
|
||||
1.758000e+00,
|
||||
-8.372000e-01,
|
||||
-1.184000e+00,
|
||||
1.088000e+02,
|
||||
3.098000e+02
|
||||
],
|
||||
[
|
||||
-2.556000e-05,
|
||||
8.603000e-06,
|
||||
-1.601000e-05,
|
||||
-1.331000e-04,
|
||||
-7.003000e-04,
|
||||
-2.556000e-02,
|
||||
8.603000e-03,
|
||||
-1.601000e-02,
|
||||
-1.331000e-01,
|
||||
-7.003000e-01,
|
||||
0.000000e+00
|
||||
],
|
||||
[
|
||||
2.195000e-07,
|
||||
2.498000e-07,
|
||||
4.815000e-08,
|
||||
-5.489000e-06,
|
||||
2.195000e-04,
|
||||
2.498000e-04,
|
||||
4.815000e-05,
|
||||
-5.489000e-03,
|
||||
0.000000e+00,
|
||||
0.000000e+00
|
||||
],
|
||||
[
|
||||
-1.667000e-09,
|
||||
-3.569000e-09,
|
||||
-1.861000e-08,
|
||||
-1.667000e-06,
|
||||
-3.569000e-06,
|
||||
-1.861000e-05,
|
||||
0.000000e+00,
|
||||
0.000000e+00,
|
||||
0.000000e+00
|
||||
]
|
||||
],
|
||||
"type": "polynomial"
|
||||
"type": "exppolynomial"
|
||||
},
|
||||
"volume2input": {
|
||||
"coeffs": "null",
|
||||
|
||||
@@ -145,39 +145,39 @@
|
||||
"viscosity": {
|
||||
"coeffs": [
|
||||
[
|
||||
1.013000e-03,
|
||||
3.920000e-03,
|
||||
3.320000e-03,
|
||||
2.206000e-03,
|
||||
1.745000e-01,
|
||||
6.699000e-01
|
||||
-5.894755e+00,
|
||||
3.920000e+00,
|
||||
3.320000e+00,
|
||||
2.206000e+00,
|
||||
1.745000e+02,
|
||||
6.699000e+02
|
||||
],
|
||||
[
|
||||
-3.062000e-05,
|
||||
6.246000e-06,
|
||||
7.840000e-06,
|
||||
-6.011000e-04,
|
||||
-7.094000e-03,
|
||||
-3.062000e-02,
|
||||
6.246000e-03,
|
||||
7.840000e-03,
|
||||
-6.011000e-01,
|
||||
-7.094000e+00,
|
||||
0.000000e+00
|
||||
],
|
||||
[
|
||||
2.940000e-07,
|
||||
-1.752000e-07,
|
||||
-3.100000e-06,
|
||||
4.023000e-06,
|
||||
2.940000e-04,
|
||||
-1.752000e-04,
|
||||
-3.100000e-03,
|
||||
4.023000e-03,
|
||||
0.000000e+00,
|
||||
0.000000e+00
|
||||
],
|
||||
[
|
||||
-2.719000e-09,
|
||||
8.346000e-09,
|
||||
1.381000e-07,
|
||||
-2.719000e-06,
|
||||
8.346000e-06,
|
||||
1.381000e-04,
|
||||
0.000000e+00,
|
||||
0.000000e+00,
|
||||
0.000000e+00
|
||||
]
|
||||
],
|
||||
"type": "polynomial"
|
||||
"type": "exppolynomial"
|
||||
},
|
||||
"volume2input": {
|
||||
"coeffs": "null",
|
||||
|
||||
@@ -145,39 +145,39 @@
|
||||
"viscosity": {
|
||||
"coeffs": [
|
||||
[
|
||||
1.153000e-03,
|
||||
5.448000e-04,
|
||||
-5.552000e-03,
|
||||
3.038000e-03,
|
||||
6.669000e-03,
|
||||
-8.472000e-03
|
||||
-5.754755e+00,
|
||||
5.448000e-01,
|
||||
-5.552000e+00,
|
||||
3.038000e+00,
|
||||
6.669000e+00,
|
||||
-8.472000e+00
|
||||
],
|
||||
[
|
||||
-3.866000e-05,
|
||||
1.008000e-05,
|
||||
8.384000e-05,
|
||||
-7.435000e-05,
|
||||
-9.105000e-05,
|
||||
-3.866000e-02,
|
||||
1.008000e-02,
|
||||
8.384000e-02,
|
||||
-7.435000e-02,
|
||||
-9.105000e-02,
|
||||
0.000000e+00
|
||||
],
|
||||
[
|
||||
2.779000e-07,
|
||||
-2.809000e-07,
|
||||
-3.997000e-07,
|
||||
7.442000e-07,
|
||||
2.779000e-04,
|
||||
-2.809000e-04,
|
||||
-3.997000e-04,
|
||||
7.442000e-04,
|
||||
0.000000e+00,
|
||||
0.000000e+00
|
||||
],
|
||||
[
|
||||
-1.543000e-09,
|
||||
9.811000e-10,
|
||||
-3.466000e-09,
|
||||
-1.543000e-06,
|
||||
9.811000e-07,
|
||||
-3.466000e-06,
|
||||
0.000000e+00,
|
||||
0.000000e+00,
|
||||
0.000000e+00
|
||||
]
|
||||
],
|
||||
"type": "polynomial"
|
||||
"type": "exppolynomial"
|
||||
},
|
||||
"volume2input": {
|
||||
"coeffs": "null",
|
||||
|
||||
@@ -145,39 +145,39 @@
|
||||
"viscosity": {
|
||||
"coeffs": [
|
||||
[
|
||||
9.573000e-04,
|
||||
4.968000e-03,
|
||||
-2.722000e-02,
|
||||
9.351000e-02,
|
||||
7.364000e+00,
|
||||
3.717000e+01
|
||||
-5.950455e+00,
|
||||
4.968000e+00,
|
||||
-2.722000e+01,
|
||||
9.351000e+01,
|
||||
7.364000e+03,
|
||||
3.717000e+04
|
||||
],
|
||||
[
|
||||
-3.065000e-05,
|
||||
1.559000e-05,
|
||||
-1.753000e-04,
|
||||
-8.353000e-03,
|
||||
-4.014000e-02,
|
||||
-3.065000e-02,
|
||||
1.559000e-02,
|
||||
-1.753000e-01,
|
||||
-8.353000e+00,
|
||||
-4.014000e+01,
|
||||
0.000000e+00
|
||||
],
|
||||
[
|
||||
1.115000e-07,
|
||||
-1.796000e-06,
|
||||
2.021000e-05,
|
||||
1.901000e-04,
|
||||
1.115000e-04,
|
||||
-1.796000e-03,
|
||||
2.021000e-02,
|
||||
1.901000e-01,
|
||||
0.000000e+00,
|
||||
0.000000e+00
|
||||
],
|
||||
[
|
||||
-2.923000e-09,
|
||||
3.051000e-08,
|
||||
2.614000e-07,
|
||||
-2.923000e-06,
|
||||
3.051000e-05,
|
||||
2.614000e-04,
|
||||
0.000000e+00,
|
||||
0.000000e+00,
|
||||
0.000000e+00
|
||||
]
|
||||
],
|
||||
"type": "polynomial"
|
||||
"type": "exppolynomial"
|
||||
},
|
||||
"volume2input": {
|
||||
"coeffs": "null",
|
||||
|
||||
@@ -145,25 +145,25 @@
|
||||
"viscosity": {
|
||||
"coeffs": [
|
||||
[
|
||||
4.369000e-04,
|
||||
2.346000e-03,
|
||||
4.276000e-03,
|
||||
7.386000e-03,
|
||||
4.688000e-02,
|
||||
-6.470855e+00,
|
||||
2.346000e+00,
|
||||
4.276000e+00,
|
||||
7.386000e+00,
|
||||
4.688000e+01,
|
||||
0.000000e+00
|
||||
],
|
||||
[
|
||||
-2.666000e-05,
|
||||
-5.368000e-06,
|
||||
-4.526000e-05,
|
||||
5.437000e-04,
|
||||
-2.666000e-02,
|
||||
-5.368000e-03,
|
||||
-4.526000e-02,
|
||||
5.437000e-01,
|
||||
0.000000e+00,
|
||||
0.000000e+00
|
||||
],
|
||||
[
|
||||
2.035000e-07,
|
||||
2.871000e-07,
|
||||
1.838000e-06,
|
||||
2.035000e-04,
|
||||
2.871000e-04,
|
||||
1.838000e-03,
|
||||
0.000000e+00,
|
||||
0.000000e+00,
|
||||
0.000000e+00
|
||||
@@ -177,7 +177,7 @@
|
||||
0.000000e+00
|
||||
]
|
||||
],
|
||||
"type": "polynomial"
|
||||
"type": "exppolynomial"
|
||||
},
|
||||
"volume2input": {
|
||||
"coeffs": "null",
|
||||
|
||||
@@ -145,39 +145,39 @@
|
||||
"viscosity": {
|
||||
"coeffs": [
|
||||
[
|
||||
6.837000e-04,
|
||||
3.328000e-03,
|
||||
5.453000e-04,
|
||||
-3.900000e-03,
|
||||
-1.587000e-03,
|
||||
3.564000e-02
|
||||
-6.224055e+00,
|
||||
3.328000e+00,
|
||||
5.453000e-01,
|
||||
-3.900000e+00,
|
||||
-1.587000e+00,
|
||||
3.564000e+01
|
||||
],
|
||||
[
|
||||
-3.045000e-05,
|
||||
-3.984000e-05,
|
||||
-8.600000e-07,
|
||||
1.054000e-04,
|
||||
4.475000e-05,
|
||||
-3.045000e-02,
|
||||
-3.984000e-02,
|
||||
-8.600000e-04,
|
||||
1.054000e-01,
|
||||
4.475000e-02,
|
||||
0.000000e+00
|
||||
],
|
||||
[
|
||||
2.525000e-07,
|
||||
4.332000e-07,
|
||||
-1.593000e-07,
|
||||
-1.589000e-06,
|
||||
2.525000e-04,
|
||||
4.332000e-04,
|
||||
-1.593000e-04,
|
||||
-1.589000e-03,
|
||||
0.000000e+00,
|
||||
0.000000e+00
|
||||
],
|
||||
[
|
||||
-1.399000e-09,
|
||||
-1.860000e-09,
|
||||
-4.465000e-10,
|
||||
-1.399000e-06,
|
||||
-1.860000e-06,
|
||||
-4.465000e-07,
|
||||
0.000000e+00,
|
||||
0.000000e+00,
|
||||
0.000000e+00
|
||||
]
|
||||
],
|
||||
"type": "polynomial"
|
||||
"type": "exppolynomial"
|
||||
},
|
||||
"volume2input": {
|
||||
"coeffs": "null",
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
"type": "notdefined"
|
||||
},
|
||||
"name": "Water",
|
||||
"reference": "Wagner2002, Transport properties from Huber et. al (2 papers)",
|
||||
"reference": "Wagner2002, Huber2009",
|
||||
"saturation_pressure": {
|
||||
"coeffs": [
|
||||
-3.863635e+03,
|
||||
|
||||
@@ -73,9 +73,9 @@
|
||||
"Name1": "CarbonDioxide",
|
||||
"Name2": "Water",
|
||||
"betaT": 1.030538,
|
||||
"betaV": 0.828472,
|
||||
"gammaT": 0.828472,
|
||||
"function": "CarbonDioxide-Water",
|
||||
"gammaT": 1.021392,
|
||||
"betaV": 1.021392,
|
||||
"gammaV": 0.895156
|
||||
},
|
||||
{
|
||||
@@ -86,9 +86,9 @@
|
||||
"Name1": "CarbonDioxide",
|
||||
"Name2": "Nitrogen",
|
||||
"betaT": 0.994140013,
|
||||
"betaV": 1.107654104,
|
||||
"gammaT": 1.107654104,
|
||||
"function": "Nitrogen-CarbonDioxide",
|
||||
"gammaT": 1.022709642,
|
||||
"betaV": 1.022709642,
|
||||
"gammaV": 1.047578256
|
||||
},
|
||||
{
|
||||
@@ -99,8 +99,8 @@
|
||||
"Name1": "CarbonDioxide",
|
||||
"Name2": "Oxygen",
|
||||
"betaT": 1.0,
|
||||
"betaV": 1.031986,
|
||||
"gammaT": 1.0,
|
||||
"gammaT": 1.031986,
|
||||
"betaV": 1.0,
|
||||
"gammaV": 1.08446
|
||||
},
|
||||
{
|
||||
@@ -111,9 +111,9 @@
|
||||
"Name1": "CarbonDioxide",
|
||||
"Name2": "Argon",
|
||||
"betaT": 1.027147,
|
||||
"betaV": 0.968781,
|
||||
"gammaT": 0.968781,
|
||||
"function": "Argon-CarbonDioxide",
|
||||
"gammaT": 1.001378,
|
||||
"betaV": 1.001378,
|
||||
"gammaV": 1.02971
|
||||
},
|
||||
{
|
||||
@@ -124,8 +124,8 @@
|
||||
"Name1": "CarbonDioxide",
|
||||
"Name2": "CarbonMonoxide",
|
||||
"betaT": 0.993245,
|
||||
"betaV": 1.068392,
|
||||
"gammaT": 1.030855,
|
||||
"gammaT": 1.068392,
|
||||
"betaV": 1.030855,
|
||||
"gammaV": 1.245499
|
||||
},
|
||||
{
|
||||
@@ -136,9 +136,9 @@
|
||||
"Name1": "Water",
|
||||
"Name2": "Nitrogen",
|
||||
"betaT": 0.954149,
|
||||
"betaV": 0.805147,
|
||||
"gammaT": 0.805147,
|
||||
"function": "GeneralizedAirWater",
|
||||
"gammaT": 1.079628,
|
||||
"betaV": 1.079628,
|
||||
"gammaV": 0.733443
|
||||
},
|
||||
{
|
||||
@@ -149,9 +149,9 @@
|
||||
"Name1": "Water",
|
||||
"Name2": "Oxygen",
|
||||
"betaT": 0.798046,
|
||||
"betaV": 0.807842,
|
||||
"gammaT": 0.807842,
|
||||
"function": "GeneralizedAirWater",
|
||||
"gammaT": 0.972576,
|
||||
"betaV": 0.972576,
|
||||
"gammaV": 0.87346
|
||||
},
|
||||
{
|
||||
@@ -162,8 +162,8 @@
|
||||
"Name1": "Water",
|
||||
"Name2": "Argon",
|
||||
"betaT": 0.679104,
|
||||
"betaV": 0.921,
|
||||
"gammaT": 0.940398,
|
||||
"gammaT": 0.921,
|
||||
"betaV": 0.940398,
|
||||
"gammaV": 1.050952
|
||||
},
|
||||
{
|
||||
@@ -174,9 +174,9 @@
|
||||
"Name1": "Water",
|
||||
"Name2": "CarbonMonoxide",
|
||||
"betaT": 1.045927,
|
||||
"betaV": 0.823984,
|
||||
"gammaT": 0.823984,
|
||||
"function": "GeneralizedAirWater",
|
||||
"gammaT": 1.063348,
|
||||
"betaV": 1.063348,
|
||||
"gammaV": 0.766756
|
||||
},
|
||||
{
|
||||
@@ -187,8 +187,8 @@
|
||||
"Name1": "Nitrogen",
|
||||
"Name2": "Oxygen",
|
||||
"betaT": 0.997190589,
|
||||
"betaV": 0.995157044,
|
||||
"gammaT": 0.99952177,
|
||||
"gammaT": 0.995157044,
|
||||
"betaV": 0.99952177,
|
||||
"gammaV": 0.997082328
|
||||
},
|
||||
{
|
||||
@@ -199,8 +199,8 @@
|
||||
"Name1": "Nitrogen",
|
||||
"Name2": "Argon",
|
||||
"betaT": 0.999442,
|
||||
"betaV": 0.989311,
|
||||
"gammaT": 1.006697,
|
||||
"gammaT": 0.989311,
|
||||
"betaV": 1.006697,
|
||||
"gammaV": 1.001549
|
||||
},
|
||||
{
|
||||
@@ -211,8 +211,8 @@
|
||||
"Name1": "Nitrogen",
|
||||
"Name2": "CarbonMonoxide",
|
||||
"betaT": 1.002409,
|
||||
"betaV": 0.9941,
|
||||
"gammaT": 1.0,
|
||||
"gammaT": 0.9941,
|
||||
"betaV": 1.0,
|
||||
"gammaV": 1.001317
|
||||
},
|
||||
{
|
||||
@@ -223,8 +223,8 @@
|
||||
"Name1": "Oxygen",
|
||||
"Name2": "Argon",
|
||||
"betaT": 0.999039,
|
||||
"betaV": 0.988822,
|
||||
"gammaT": 1.006502,
|
||||
"gammaT": 0.988822,
|
||||
"betaV": 1.006502,
|
||||
"gammaV": 1.001341
|
||||
},
|
||||
{
|
||||
@@ -235,8 +235,8 @@
|
||||
"Name1": "Oxygen",
|
||||
"Name2": "CarbonMonoxide",
|
||||
"betaT": 1.0,
|
||||
"betaV": 1.0,
|
||||
"gammaT": 1.0,
|
||||
"betaV": 1.0,
|
||||
"gammaV": 1.0
|
||||
},
|
||||
{
|
||||
@@ -247,8 +247,8 @@
|
||||
"Name1": "CarbonMonoxide",
|
||||
"Name2": "Argon",
|
||||
"betaT": 1.0,
|
||||
"betaV": 0.954215746,
|
||||
"gammaT": 1.0,
|
||||
"gammaT": 0.954215746,
|
||||
"betaV": 1.0,
|
||||
"gammaV": 1.159720623
|
||||
},
|
||||
{
|
||||
|
||||
@@ -11,7 +11,7 @@ else:
|
||||
commons = dict(shell = True, stdout = sys.stdout, stderr = sys.stderr)
|
||||
|
||||
if not os.path.exists('swig-matlab'):
|
||||
subprocess.call('git clone https://github.com/KrisThielemans/swig swig-matlab', **commons)
|
||||
subprocess.call('git clone https://github.com/jaeandersson/swig swig-matlab', **commons)
|
||||
else:
|
||||
subprocess.call('git pull', shell = True, cwd = 'swig-matlab', stdout = sys.stdout, stderr = sys.stderr)
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#
|
||||
# Things to remember when you make a new release:
|
||||
#
|
||||
# * Force a new build on all buildbots from the release branch
|
||||
# * Run the script and check the logs
|
||||
# * Make a tag in your git software
|
||||
# * Update the default download on sourceforge to point to the new sources
|
||||
@@ -29,58 +30,70 @@ if [ $# != 2 ]; then
|
||||
fi
|
||||
#
|
||||
# Just a small function print messages
|
||||
SEPARATOR="----------------------------------"
|
||||
SEPARATOR="---------------------------------------------------"
|
||||
function printMessage {
|
||||
echo " "
|
||||
echo $SEPARATOR
|
||||
echo "$1"
|
||||
echo $SEPARATOR
|
||||
return 0
|
||||
}
|
||||
# Now we use the function defined above
|
||||
printMessage "Processing the input variables: "
|
||||
#
|
||||
# Process the version number and set parameters accordingly
|
||||
CPVERSION="$1"
|
||||
if [[ $CPVERSION == +([0-9]).+([0-9]).+([0-9]) ]]; then
|
||||
echo "CPVERSION = $CPVERSION"
|
||||
BINFOLDER="release"
|
||||
elif [ "$CPVERSION" == "nightly" ]; then
|
||||
echo "CPVERSION = $CPVERSION - which is a valid input"
|
||||
BINFOLDER="binaries"
|
||||
else
|
||||
echo "CPVERSION = $CPVERSION - not valid!"
|
||||
exit 1
|
||||
fi
|
||||
#
|
||||
BASEDIR="$HOME/buildbot/server-master/public_html"
|
||||
REPODIR="$HOME/src/CoolPropFull.git"
|
||||
TMPSDIR="$HOME/src/CoolProp.sources"
|
||||
SRCFOLDER="$BASEDIR/$BINFOLDER/source"
|
||||
DOCFOLDER="sphinx"
|
||||
DOC4FILES="4.2.5/coolpropv425docs.zip"
|
||||
DOC4FOLDER="$DOCFOLDER/v4"
|
||||
#
|
||||
# Process the dryrun option
|
||||
if [ "$2" == "release" ]; then
|
||||
DRYRUN=false
|
||||
else
|
||||
DRYRUN=true
|
||||
fi
|
||||
echo "DRYRUN = $DRYRUN"
|
||||
|
||||
pushd ${BASEDIR} # Change the folder
|
||||
#
|
||||
printMessage "Detected parameters"
|
||||
echo "CPVERSION = $CPVERSION - which is a valid input"
|
||||
echo "DRYRUN = $DRYRUN"
|
||||
echo "BINFOLDER = $BINFOLDER"
|
||||
#
|
||||
#
|
||||
SFUSER="jorritw" # ibell or jorritw
|
||||
# Absolute (!) paths -> XXXXDIR
|
||||
BASEDIR="$HOME/buildbot/server-master/public_html"
|
||||
REPODIR="$HOME/src/CoolPropFull.git"
|
||||
TMPSDIR="$HOME/src/CoolProp.sources"
|
||||
SRCSDIR="$BASEDIR/$BINFOLDER/source"
|
||||
#
|
||||
# Relative (!) paths -> XXXFOLDER
|
||||
DOCFOLDER="$BINFOLDER/docs"
|
||||
SPHFOLDER="$BINFOLDER/sphinx"
|
||||
DOC4FILES="4.2.5/coolpropv425docs.zip"
|
||||
DOC4FOLDER="$SPHFOLDER/v4"
|
||||
RSYNC_EXCL="--exclude=sphinx"
|
||||
#
|
||||
DOCFILE="documentation.zip"
|
||||
#
|
||||
#
|
||||
if [ "$DRYRUN" != "false" ]; then
|
||||
printMessage "Dry run detected"
|
||||
echo "Dry run; no zipping of the sources"
|
||||
echo "Dry run; no zipping of the docs"
|
||||
echo "Dry run; skipping python upload"
|
||||
echo "Dry run; skipping folder date"
|
||||
RSYNC_DRY_RUN=--dry-run
|
||||
else
|
||||
RSYNC_DRY_RUN=
|
||||
######################################
|
||||
# We start with the absolute paths ...
|
||||
######################################
|
||||
mkdir -p "$TMPSDIR" "$SRCSDIR" # Generating directories
|
||||
printMessage "Updating sources"
|
||||
pushd "$REPODIR"
|
||||
git pull
|
||||
git submodule update
|
||||
#python dev/scripts/git-archive-all $SRCFOLDER/CoolProp_sources.zip
|
||||
popd
|
||||
printMessage "Generating headers"
|
||||
rsync -a --delete "$REPODIR/" "$TMPSDIR"
|
||||
@@ -90,48 +103,52 @@ else
|
||||
#rm -rf .git*
|
||||
find . -iwholename "*/.git*" -exec rm -rf {} \;
|
||||
cd ..
|
||||
mkdir -p $SRCFOLDER
|
||||
rm -f $SRCFOLDER/CoolProp_sources.zip
|
||||
zip -rq $SRCFOLDER/CoolProp_sources.zip $(basename $TMPSDIR)
|
||||
rm -f $SRCSDIR/CoolProp_sources.zip
|
||||
zip -rq $SRCSDIR/CoolProp_sources.zip $(basename $TMPSDIR)
|
||||
cd $(basename $TMPSDIR)
|
||||
popd
|
||||
rm -f "$BINFOLDER/README.rst.txt"
|
||||
if [ "$CPVERSION" = "nightly" ]; then
|
||||
RSYNC_OPTS="-a --no-perms -z --stats --delete"
|
||||
rm -rf "$BINFOLDER/docs"
|
||||
CPVERSION="$CPVERSION"/ #$(date +%F)
|
||||
echo "CoolProp nightly binaries" > "$BINFOLDER/README.rst.txt"
|
||||
######################################
|
||||
# ... and now we use relative paths
|
||||
######################################
|
||||
pushd ${BASEDIR}
|
||||
mkdir -p "$DOCFOLDER" "$SPHFOLDER" "$DOC4FOLDER"
|
||||
printMessage "Preparing the docs and moving them into the $BINFOLDER folder for staging"
|
||||
rsync $RSYNC_DRY_RUN $RSYNC_OPTS "frs.sf.net-$SFUSER:/home/frs/project/coolprop/CoolProp/$DOC4FILES" "$(basename $DOC4FILES)"
|
||||
unzip -qo "$(basename $DOC4FILES)" -d "$DOC4FOLDER"
|
||||
zip -rq "$DOCFILE" $SPHFOLDER/* -x */$(basename $DOC4FOLDER)/*
|
||||
mv "$DOCFILE" "$DOCFOLDER"
|
||||
#
|
||||
if [ "$CPVERSION" == "nightly" ]; then
|
||||
printMessage "Detected nightly release, updating README.rst.txt"
|
||||
echo "CoolProp nightly binaries" > "$BINFOLDER/README.rst.txt"
|
||||
echo "-------------------------" >> "$BINFOLDER/README.rst.txt"
|
||||
echo -n "Development binaries of the" >> "$BINFOLDER/README.rst.txt"
|
||||
echo -n " \`CoolProp project <http://coolprop.sourceforge.net>\`_ " >> "$BINFOLDER/README.rst.txt"
|
||||
echo "updated on $(date +%F) at $(date +%X) $(date +%Z)." >> "$BINFOLDER/README.rst.txt"
|
||||
RSYNC_OPTS="-a --no-perms -z --stats --delete"
|
||||
else
|
||||
RSYNC_OPTS="-a --no-perms -z --stats"
|
||||
printMessage "Zipping up the docs and moving them into the $BINFOLDER folder for staging"
|
||||
rm -f documentation.zip
|
||||
zip -rq documentation.zip $DOCFOLDER/* -x */$(basename $DOC4FOLDER)/*
|
||||
mkdir -p "$BINFOLDER/docs"
|
||||
cp documentation.zip "$BINFOLDER/docs"
|
||||
echo "Uploading the python binaries to pypi"
|
||||
echo "Detected full release, uploading the python binaries to pypi"
|
||||
twine upload $BINFOLDER/Python/*.whl $BINFOLDER/Python/*.tar.gz
|
||||
fi
|
||||
RSYNC_DRY_RUN=
|
||||
popd
|
||||
fi
|
||||
#
|
||||
printMessage "Getting the latest v4 docs from SourceForge"
|
||||
rsync $RSYNC_DRY_RUN $RSYNC_OPTS "frs.sf.net-$SFUSER:/home/frs/project/coolprop/CoolProp/$DOC4FILES" "$(basename $DOC4FILES)"
|
||||
mkdir -p "$DOC4FOLDER"
|
||||
unzip -qo "$(basename $DOC4FILES)" -d "$DOC4FOLDER"
|
||||
#
|
||||
######################################
|
||||
# ... we continue with relative paths
|
||||
######################################
|
||||
pushd ${BASEDIR}
|
||||
printMessage "Copying the binaries to SourceForge"
|
||||
rsync $RSYNC_DRY_RUN $RSYNC_OPTS "$BINFOLDER/" frs.sf.net-$SFUSER:/home/frs/project/coolprop/CoolProp/$CPVERSION
|
||||
rsync $RSYNC_DRY_RUN $RSYNC_OPTS $RSYNC_EXCL "$BINFOLDER/" frs.sf.net-$SFUSER:/home/frs/project/coolprop/CoolProp/$CPVERSION
|
||||
if [ ${CPVERSION:0:7} != "nightly" ]; then
|
||||
printMessage "Publishing the docs on SourceForge"
|
||||
rsync $RSYNC_DRY_RUN $RSYNC_OPTS "$DOCFOLDER/" frs.sf.net-$SFUSER:/home/project-web/coolprop/htdocs
|
||||
rsync $RSYNC_DRY_RUN $RSYNC_OPTS "$SPHFOLDER/" frs.sf.net-$SFUSER:/home/project-web/coolprop/htdocs
|
||||
fi
|
||||
#
|
||||
if [[ ("$BINFOLDER" == "release") && ("$DRYRUN" == "false") ]]; then
|
||||
printMessage "Removing release directory"
|
||||
rm -rf "$BINFOLDER"
|
||||
mkdir -p "$BINFOLDER"
|
||||
fi
|
||||
# Change back to where we came from
|
||||
popd
|
||||
printMessage "Removing release directory"
|
||||
rm -rf $BINFOLDER
|
||||
printMessage "All done, goodbye."
|
||||
exit 0
|
||||
|
||||
30
dev/scripts/sfManageJavaScript.bsh
Normal file
30
dev/scripts/sfManageJavaScript.bsh
Normal file
@@ -0,0 +1,30 @@
|
||||
#!/bin/bash
|
||||
# A little script to build the JavaScript repository on the
|
||||
# web directory. Can be run to regenerate the repo in case
|
||||
# it case it gets deleted accidentally.
|
||||
#
|
||||
FILDIR="/home/frs/project/coolprop/CoolProp"
|
||||
WEBDIR="/home/project-web/coolprop/htdocs"
|
||||
#
|
||||
TARGETDIR="${WEBDIR}"/jscript
|
||||
mkdir -p "${TARGETDIR}"
|
||||
#
|
||||
function parsePath {
|
||||
local CURFILE="$1"
|
||||
local CPVERSION=$(cut -d/ -f7 <<<"${CURFILE}")
|
||||
local RES="${TARGETDIR}/coolprop-${CPVERSION}.js"
|
||||
echo "${RES}"
|
||||
}
|
||||
#
|
||||
JSFILES="$(find ${FILDIR} -iname '*coolprop.js')"
|
||||
for CURFILE in $JSFILES; do
|
||||
TARGETFILE="$(parsePath $CURFILE)"
|
||||
rsync "${CURFILE}" "${TARGETFILE}"
|
||||
done
|
||||
#
|
||||
pushd "${TARGETDIR}"
|
||||
CURVER="$(ls | tail -n 3 | head -n 1)"
|
||||
LATVER="coolprop-latest.js"
|
||||
ln -sf "${CURVER}" "${LATVER}"
|
||||
popd
|
||||
exit 0
|
||||
@@ -146,7 +146,7 @@
|
||||
EXPORT_CODE double CONVENTION K2F(double T_K);
|
||||
/** \brief Get the index for a parameter "T", "P", etc.
|
||||
*
|
||||
* @returns index The index as a long
|
||||
* @returns index The index as a long. If input is invalid, returns -1
|
||||
*/
|
||||
EXPORT_CODE long CONVENTION get_param_index(const char *param);
|
||||
/** \brief Redirect all output that would go to console (stdout) to a file
|
||||
|
||||
@@ -87,6 +87,7 @@
|
||||
#define DEPRECATED(func) func
|
||||
#endif
|
||||
|
||||
#include <iterator>
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
#include <cctype>
|
||||
@@ -95,6 +96,7 @@
|
||||
#include <fstream>
|
||||
#include <cerrno>
|
||||
#include <numeric>
|
||||
#include <set>
|
||||
|
||||
/// The following code for the trim functions was taken from http://stackoverflow.com/questions/216823/whats-the-best-way-to-trim-stdstring
|
||||
// trim from start
|
||||
@@ -319,30 +321,71 @@
|
||||
return x;
|
||||
}
|
||||
|
||||
/// Some functions related to testing and comparison of values
|
||||
bool inline check_abs(double A, double B, double D){
|
||||
double max = std::abs(A);
|
||||
double min = std::abs(B);
|
||||
if (min>max) {
|
||||
max = min;
|
||||
min = std::abs(A);
|
||||
}
|
||||
if (max>DBL_EPSILON*1e3) return ( ( 1.0-min/max*1e0 ) < D );
|
||||
else throw CoolProp::ValueError(format("Too small numbers: %f cannot be tested with an accepted error of %f for a machine precision of %f. ",max,D,DBL_EPSILON));
|
||||
};
|
||||
bool inline check_abs(double A, double B){
|
||||
return check_abs(A,B,1e5*DBL_EPSILON);
|
||||
};
|
||||
|
||||
template<class T> void normalize_vector(std::vector<T> &x)
|
||||
// From http://rosettacode.org/wiki/Power_set#C.2B.2B
|
||||
inline std::size_t powerset_dereference(std::set<std::size_t>::const_iterator v) { return *v; };
|
||||
|
||||
// From http://rosettacode.org/wiki/Power_set#C.2B.2B
|
||||
inline std::set<std::set<std::size_t> > powerset(std::set<std::size_t> const& set)
|
||||
{
|
||||
std::set<std::set<std::size_t> > result;
|
||||
std::vector<std::set<std::size_t>::const_iterator> elements;
|
||||
do
|
||||
{
|
||||
std::set<std::size_t> tmp;
|
||||
std::transform(elements.begin(), elements.end(),
|
||||
std::inserter(tmp, tmp.end()),
|
||||
powerset_dereference);
|
||||
result.insert(tmp);
|
||||
if (!elements.empty() && ++elements.back() == set.end())
|
||||
{
|
||||
// Sum up all the elements in the vector
|
||||
T sumx = std::accumulate( x.begin(), x.end(), static_cast<T>(0) );
|
||||
// Normalize the components by dividing each by the sum
|
||||
for (std::size_t i = 0; i < x.size(); ++i){
|
||||
x[i] /= sumx;
|
||||
}
|
||||
};
|
||||
elements.pop_back();
|
||||
}
|
||||
else
|
||||
{
|
||||
std::set<std::size_t>::const_iterator iter;
|
||||
if (elements.empty())
|
||||
{
|
||||
iter = set.begin();
|
||||
}
|
||||
else
|
||||
{
|
||||
iter = elements.back();
|
||||
++iter;
|
||||
}
|
||||
for (; iter != set.end(); ++iter)
|
||||
{
|
||||
elements.push_back(iter);
|
||||
}
|
||||
}
|
||||
} while (!elements.empty());
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/// Some functions related to testing and comparison of values
|
||||
bool inline check_abs(double A, double B, double D){
|
||||
double max = std::abs(A);
|
||||
double min = std::abs(B);
|
||||
if (min>max) {
|
||||
max = min;
|
||||
min = std::abs(A);
|
||||
}
|
||||
if (max>DBL_EPSILON*1e3) return ( ( 1.0-min/max*1e0 ) < D );
|
||||
else throw CoolProp::ValueError(format("Too small numbers: %f cannot be tested with an accepted error of %f for a machine precision of %f. ",max,D,DBL_EPSILON));
|
||||
};
|
||||
bool inline check_abs(double A, double B){
|
||||
return check_abs(A,B,1e5*DBL_EPSILON);
|
||||
};
|
||||
|
||||
template<class T> void normalize_vector(std::vector<T> &x)
|
||||
{
|
||||
// Sum up all the elements in the vector
|
||||
T sumx = std::accumulate( x.begin(), x.end(), static_cast<T>(0) );
|
||||
// Normalize the components by dividing each by the sum
|
||||
for (std::size_t i = 0; i < x.size(); ++i){
|
||||
x[i] /= sumx;
|
||||
}
|
||||
};
|
||||
|
||||
#define CATCH_ALL_ERRORS_RETURN_HUGE(x) try{ \
|
||||
x \
|
||||
|
||||
@@ -65,6 +65,10 @@ protected:
|
||||
double uref, rhoref;
|
||||
double xbase, Tbase;
|
||||
|
||||
double _xref, _Tref, _pref;
|
||||
double _href, _sref;
|
||||
double _uref, _rhoref;
|
||||
|
||||
/// These are the objects that hold the coefficients
|
||||
/** Note that all polynomials require a 2-dimensional array
|
||||
* of coefficients. This array may have only one row or
|
||||
@@ -150,7 +154,7 @@ public:
|
||||
double getpref() const {return pref;}
|
||||
double getxref() const {return xref;}
|
||||
double gethref() const {return href;}
|
||||
double getsref() {return s(Tref,pref,xref) - sref;}
|
||||
double getsref() {return sref;}
|
||||
double getTbase() const {return Tbase;}
|
||||
double getxbase() const {return xbase;}
|
||||
|
||||
@@ -272,7 +276,7 @@ protected:
|
||||
* pressure employing functions for internal energy and
|
||||
* density. Provides consistent formulations. */
|
||||
double h_u(double T, double p, double x) {
|
||||
return u(T,p,x)+(p-pref)/rhoref;
|
||||
return u(T,p,x)+(p-_pref)/_rhoref;
|
||||
};
|
||||
|
||||
/// Internal energy from h, p and rho.
|
||||
@@ -280,7 +284,7 @@ protected:
|
||||
* and pressure employing functions for enthalpy and
|
||||
* density. Provides consistent formulations. */
|
||||
double u_h(double T, double p, double x) {
|
||||
return h(T,p,x)-(p-pref)/rhoref;
|
||||
return h(T,p,x)-(p-_pref)/_rhoref;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -159,7 +159,7 @@ protected:
|
||||
double baseHorner(const std::vector<double> &coefficients, double x);
|
||||
DEPRECATED(double baseHorner(const std::vector<std::vector<double> > &coefficients, double x, double y));
|
||||
|
||||
bool do_debug(void){return get_debug_level()>=18;}
|
||||
bool do_debug(void){return get_debug_level()>=500;}
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ namespace CoolProp{
|
||||
|
||||
void PhaseEnvelopeRoutines::build(HelmholtzEOSMixtureBackend &HEOS)
|
||||
{
|
||||
if (HEOS.get_mole_fractions_ref().size() < 2){throw ValueError("Cannot build phase envelope for pure fluid");}
|
||||
std::size_t failure_count = 0;
|
||||
// Set some imput options
|
||||
SaturationSolvers::mixture_VLE_IO io;
|
||||
|
||||
@@ -1177,8 +1177,8 @@ void SaturationSolvers::successive_substitution(HelmholtzEOSMixtureBackend &HEOS
|
||||
}
|
||||
while(std::abs(f) > 1e-12 && iter < options.Nstep_max);
|
||||
|
||||
HEOS.SatL->update_TP_guessrho(T, p, rhomolar_liq);
|
||||
HEOS.SatV->update_TP_guessrho(T, p, rhomolar_vap);
|
||||
HEOS.SatL->update_TP_guessrho(T, p, HEOS.SatL->rhomolar());
|
||||
HEOS.SatV->update_TP_guessrho(T, p, HEOS.SatV->rhomolar());
|
||||
|
||||
options.p = HEOS.SatL->p();
|
||||
options.T = HEOS.SatL->T();
|
||||
|
||||
@@ -26,11 +26,17 @@ IncompressibleBackend::IncompressibleBackend() {
|
||||
IncompressibleBackend::IncompressibleBackend(IncompressibleFluid* fluid) {
|
||||
//this->_fractions_id = fluid->getxid();
|
||||
this->fluid = fluid;
|
||||
if (this->fluid->is_pure()){
|
||||
this->set_fractions(std::vector<long double>(1,1.0));
|
||||
}
|
||||
}
|
||||
|
||||
IncompressibleBackend::IncompressibleBackend(const std::string &fluid_name) {
|
||||
this->fluid = &get_incompressible_fluid(fluid_name);
|
||||
//this->_fractions_id = this->fluid->getxid();
|
||||
if (this->fluid->is_pure()){
|
||||
this->set_fractions(std::vector<long double>(1,1.0));
|
||||
}
|
||||
}
|
||||
|
||||
IncompressibleBackend::IncompressibleBackend(const std::vector<std::string> &component_names) {
|
||||
@@ -49,17 +55,22 @@ void IncompressibleBackend::update(CoolProp::input_pairs input_pair, double valu
|
||||
|
||||
clear();
|
||||
|
||||
if (get_debug_level()>=50) std::cout << format("Incompressible backend: _fractions are %s ",vec_to_string(_fractions).c_str()) << std::endl;
|
||||
if (get_debug_level()>=50) {
|
||||
std::cout << format("Incompressible backend: _fractions are %s ",vec_to_string(_fractions).c_str()) << std::endl;
|
||||
}
|
||||
if (_fractions.size()!=1){
|
||||
throw ValueError(format("%s is an incompressible fluid, mass fractions must be set to a vector with ONE entry, not %d.",this->name().c_str(),_fractions.size()));
|
||||
}
|
||||
if (fluid->is_pure()){
|
||||
this->_fluid_type = FLUID_TYPE_INCOMPRESSIBLE_LIQUID;
|
||||
if (get_debug_level()>=50) std::cout << format("Incompressible backend: Fluid type is %d ",this->_fluid_type) << std::endl;
|
||||
if ((_fractions.size()!=1) || (_fractions[0]!=0.0)){
|
||||
throw ValueError(format("%s is a pure fluid. The composition has to be set to a vector with one entry equal to 0.0 or nothing. %s is not valid.",this->name().c_str(),vec_to_string(_fractions).c_str()));
|
||||
if (_fractions[0]!=1.0){
|
||||
throw ValueError(format("%s is a pure fluid. The composition has to be set to a vector with one entry equal to 1.0. %s is not valid.",this->name().c_str(),vec_to_string(_fractions).c_str()));
|
||||
}
|
||||
} else {
|
||||
this->_fluid_type = FLUID_TYPE_INCOMPRESSIBLE_SOLUTION;
|
||||
if (get_debug_level()>=50) std::cout << format("Incompressible backend: Fluid type is %d ",this->_fluid_type) << std::endl;
|
||||
if (_fractions.size()!=1 || ((_fractions[0]<0.0) || (_fractions[0]>1.0)) ){
|
||||
if ( (_fractions[0]<0.0) || (_fractions[0]>1.0) ){
|
||||
throw ValueError(format("%s is a solution or brine. Mass fractions must be set to a vector with one entry between 0 and 1. %s is not valid.",this->name().c_str(),vec_to_string(_fractions).c_str()));
|
||||
}
|
||||
}
|
||||
@@ -136,8 +147,8 @@ void IncompressibleBackend::set_fractions(const std::vector<long double> &fracti
|
||||
void IncompressibleBackend::set_mole_fractions(const std::vector<long double> &mole_fractions){
|
||||
if (get_debug_level()>=10) std::cout << format("Incompressible backend: Called set_mole_fractions with %s ",vec_to_string(mole_fractions).c_str()) << std::endl;
|
||||
if (mole_fractions.size()!=1) throw ValueError(format("The incompressible backend only supports one entry in the mole fraction vector and not %d.",mole_fractions.size()));
|
||||
if (fluid->getxid()==IFRAC_PURE) {
|
||||
this->set_fractions(std::vector<long double>(1,0));
|
||||
if ((fluid->getxid()==IFRAC_PURE) && true ){//( this->_fractions[0]!=1.0 )){
|
||||
this->set_fractions(std::vector<long double>(1,1.0));
|
||||
if (get_debug_level()>=20) std::cout << format("Incompressible backend: Overwriting fractions for pure fluid with %s -> %s",vec_to_string(mole_fractions).c_str(),vec_to_string(this->_fractions).c_str()) << std::endl;
|
||||
} else if (fluid->getxid()==IFRAC_MOLE) {
|
||||
this->set_fractions(mole_fractions);
|
||||
@@ -157,8 +168,8 @@ void IncompressibleBackend::set_mole_fractions(const std::vector<long double> &m
|
||||
void IncompressibleBackend::set_mass_fractions(const std::vector<long double> &mass_fractions){
|
||||
if (get_debug_level()>=10) std::cout << format("Incompressible backend: Called set_mass_fractions with %s ",vec_to_string(mass_fractions).c_str()) << std::endl;
|
||||
if (mass_fractions.size()!=1) throw ValueError(format("The incompressible backend only supports one entry in the mass fraction vector and not %d.",mass_fractions.size()));
|
||||
if (fluid->getxid()==IFRAC_PURE) {
|
||||
this->set_fractions(std::vector<long double>(1,0));
|
||||
if ((fluid->getxid()==IFRAC_PURE) && true ){// ( this->_fractions[0]!=1.0 )) {
|
||||
this->set_fractions(std::vector<long double>(1,1.0));
|
||||
if (get_debug_level()>=20) std::cout << format("Incompressible backend: Overwriting fractions for pure fluid with %s -> %s",vec_to_string(mass_fractions).c_str(),vec_to_string(this->_fractions).c_str()) << std::endl;
|
||||
} else if (fluid->getxid()==IFRAC_MASS) {
|
||||
this->set_fractions(mass_fractions);
|
||||
@@ -178,8 +189,8 @@ void IncompressibleBackend::set_mass_fractions(const std::vector<long double> &m
|
||||
void IncompressibleBackend::set_volu_fractions(const std::vector<long double> &volu_fractions){
|
||||
if (get_debug_level()>=10) std::cout << format("Incompressible backend: Called set_volu_fractions with %s ",vec_to_string(volu_fractions).c_str()) << std::endl;
|
||||
if (volu_fractions.size()!=1) throw ValueError(format("The incompressible backend only supports one entry in the volume fraction vector and not %d.",volu_fractions.size()));
|
||||
if (fluid->getxid()==IFRAC_PURE) {
|
||||
this->set_fractions(std::vector<long double>(1,0));
|
||||
if ((fluid->getxid()==IFRAC_PURE) && true ){// ( this->_fractions[0]!=1.0 )) {
|
||||
this->set_fractions(std::vector<long double>(1,1.0));
|
||||
if (get_debug_level()>=20) std::cout << format("Incompressible backend: Overwriting fractions for pure fluid with %s -> %s",vec_to_string(volu_fractions).c_str(),vec_to_string(this->_fractions).c_str()) << std::endl;
|
||||
} else if (fluid->getxid()==IFRAC_VOLUME) {
|
||||
this->set_fractions(volu_fractions);
|
||||
@@ -425,6 +436,18 @@ TEST_CASE("Internal consistency checks and example use cases for the incompressi
|
||||
CAPTURE(res);
|
||||
CHECK( check_abs(val,res,acc) );
|
||||
}
|
||||
// Make sure the ruslt does not change -> reference state...
|
||||
val = backend.calc_smass();
|
||||
backend.update( CoolProp::PT_INPUTS, p, T );
|
||||
res = backend.calc_smass();
|
||||
{
|
||||
CAPTURE(T);
|
||||
CAPTURE(p);
|
||||
CAPTURE(x);
|
||||
CAPTURE(val);
|
||||
CAPTURE(res);
|
||||
CHECK( check_abs(val,res,acc) );
|
||||
}
|
||||
|
||||
val = fluid.u(T, p, x);
|
||||
res = backend.calc_umass();
|
||||
@@ -524,6 +547,22 @@ TEST_CASE("Internal consistency checks and example use cases for the incompressi
|
||||
CAPTURE(errmsg);
|
||||
CHECK( check_abs(expected,actual,acc) );
|
||||
}
|
||||
// entropy reference state problems
|
||||
//CoolProp::set_debug_level(51);
|
||||
expected = CoolProp::PropsSI("S","T",T,"P",p,"INCOMP::"+fluid+format("[%f]",x));
|
||||
actual = CoolProp::PropsSI("S","T",T,"P",p,"INCOMP::"+fluid+format("[%f]",x));
|
||||
{
|
||||
CAPTURE(T);
|
||||
CAPTURE(p);
|
||||
CAPTURE(x);
|
||||
CAPTURE(expected);
|
||||
CAPTURE(actual);
|
||||
std::string name = "INCOMP::"+fluid+format("[%f]",x);
|
||||
CAPTURE(name);
|
||||
std::string errmsg = CoolProp::get_global_param_string("errstring");
|
||||
CAPTURE(errmsg);
|
||||
CHECK( check_abs(expected,actual,acc) );
|
||||
}
|
||||
}
|
||||
SECTION("SecCool example")
|
||||
{
|
||||
|
||||
@@ -19,15 +19,23 @@ and transport properties.
|
||||
//IncompressibleFluid::IncompressibleFluid();
|
||||
|
||||
void IncompressibleFluid::set_reference_state(double T0, double p0, double x0, double h0, double s0){
|
||||
this->Tref = T0;
|
||||
this->rhoref = rho(T0,p0,x0);
|
||||
this->pref = p0;
|
||||
this->href = h0;
|
||||
// Now we take care of the energy related values
|
||||
this->uref = 0.0;
|
||||
this->uref = u(T0,p0,x0) - h0; // (value without ref) - (desired ref)
|
||||
this->sref = 0.0;
|
||||
this->sref = s(T0,p0,x0) - s0; // (value without ref) - (desired ref)
|
||||
this->_href = h0;
|
||||
this->_pref = p0;
|
||||
this->_Tref = T0;
|
||||
this->_xref = x0;
|
||||
this->_rhoref = rho(T0,p0,x0);
|
||||
this->_uref = h0; // Reset the old reference value
|
||||
this->_uref = u(T0,p0,x0); // uses _uref
|
||||
this->_sref = s0; // Reset the old reference value
|
||||
this->_sref = s(T0,p0,x0); // uses _sref
|
||||
// Save the values for later calls at composition changes
|
||||
this->href = h0;
|
||||
this->pref = p0;
|
||||
this->Tref = T0;
|
||||
this->xref = x0;
|
||||
this->rhoref = this->_rhoref;
|
||||
this->uref = this->_uref;
|
||||
this->sref = s0;
|
||||
}
|
||||
|
||||
void IncompressibleFluid::validate(){
|
||||
@@ -130,7 +138,7 @@ double IncompressibleFluid::s (double T, double p, double x){
|
||||
switch (specific_heat.type) {
|
||||
case IncompressibleData::INCOMPRESSIBLE_POLYNOMIAL:
|
||||
//throw NotImplementedError("Here you should implement the polynomial.");
|
||||
return poly.integral(specific_heat.coeffs, T, x, 0, -1, 0, Tbase, xbase) - sref;
|
||||
return poly.integral(specific_heat.coeffs, T, x, 0, -1, 0, Tbase, xbase) - _sref;
|
||||
break;
|
||||
case IncompressibleData::INCOMPRESSIBLE_NOT_SET:
|
||||
throw ValueError(format("%s (%d): The function type is not specified (\"[%d]\"), are you sure the coefficients have been set?",__FILE__,__LINE__,specific_heat.type));
|
||||
@@ -147,7 +155,7 @@ double IncompressibleFluid::u (double T, double p, double x){
|
||||
switch (specific_heat.type) {
|
||||
case IncompressibleData::INCOMPRESSIBLE_POLYNOMIAL:
|
||||
//throw NotImplementedError("Here you should implement the polynomial.");
|
||||
return poly.integral(specific_heat.coeffs, T, x, 0, 0, 0, Tbase, xbase) - uref;
|
||||
return poly.integral(specific_heat.coeffs, T, x, 0, 0, 0, Tbase, xbase) - _uref;
|
||||
break;
|
||||
case IncompressibleData::INCOMPRESSIBLE_NOT_SET:
|
||||
throw ValueError(format("%s (%d): The function type is not specified (\"[%d]\"), are you sure the coefficients have been set?",__FILE__,__LINE__,specific_heat.type));
|
||||
@@ -422,7 +430,7 @@ double IncompressibleFluid::T_c (double Cmass, double p, double x){
|
||||
}
|
||||
/// Temperature as a function of entropy as a function of temperature, pressure and composition.
|
||||
double IncompressibleFluid::T_s (double Smass, double p, double x){
|
||||
double s_raw = Smass + sref;
|
||||
double s_raw = Smass + _sref;
|
||||
switch (specific_heat.type) {
|
||||
case IncompressibleData::INCOMPRESSIBLE_POLYNOMIAL:
|
||||
return poly.solve_limitsInt(specific_heat.coeffs, x, s_raw, Tmin, Tmax, 0, -1, 0, Tbase, xbase, 0);
|
||||
@@ -438,7 +446,7 @@ double IncompressibleFluid::T_s (double Smass, double p, double x){
|
||||
}
|
||||
/// Temperature as a function of internal energy as a function of temperature, pressure and composition.
|
||||
double IncompressibleFluid::T_u (double Umass, double p, double x){
|
||||
double u_raw = Umass + uref;
|
||||
double u_raw = Umass + _uref;
|
||||
switch (specific_heat.type) {
|
||||
case IncompressibleData::INCOMPRESSIBLE_POLYNOMIAL:
|
||||
return poly.solve_limitsInt(specific_heat.coeffs, x, u_raw, Tmin, Tmax, 0, 0, 0, Tbase, xbase, 0);
|
||||
@@ -664,10 +672,38 @@ TEST_CASE("Internal consistency checks and example use cases for the incompressi
|
||||
// Compare reference state
|
||||
{
|
||||
res = XLT.h(Tref,pref,xref);
|
||||
CAPTURE(Tref);
|
||||
CAPTURE(pref);
|
||||
CAPTURE(xref);
|
||||
CAPTURE(href);
|
||||
CAPTURE(res);
|
||||
CHECK( check_abs(href,res,acc) );
|
||||
}
|
||||
{
|
||||
res = XLT.s(Tref,pref,xref);
|
||||
CAPTURE(Tref);
|
||||
CAPTURE(pref);
|
||||
CAPTURE(xref);
|
||||
CAPTURE(sref);
|
||||
CAPTURE(res);
|
||||
CHECK( check_abs(sref,res,acc) );
|
||||
}
|
||||
double res2 = XLT.s(Tref,pref,xref);
|
||||
CAPTURE(Tref);
|
||||
CAPTURE(pref);
|
||||
CAPTURE(xref);
|
||||
CAPTURE(res);
|
||||
CAPTURE(res2);
|
||||
CHECK( check_abs(res2,res,acc) );
|
||||
res = XLT.s(Tref,pref,xref);
|
||||
CAPTURE(Tref);
|
||||
CAPTURE(pref);
|
||||
CAPTURE(xref);
|
||||
CAPTURE(res);
|
||||
CAPTURE(res2);
|
||||
CHECK( check_abs(res2,res,acc) );
|
||||
}
|
||||
|
||||
|
||||
|
||||
Tref = 25+273.15;
|
||||
pref = 0.0;
|
||||
@@ -837,6 +873,15 @@ TEST_CASE("Internal consistency checks and example use cases for the incompressi
|
||||
CAPTURE(actual);
|
||||
CHECK( check_abs(expected,actual,acc) );
|
||||
}
|
||||
expected = CH3OH.s(T,p,x);
|
||||
{
|
||||
CAPTURE(T);
|
||||
CAPTURE(p);
|
||||
CAPTURE(x);
|
||||
CAPTURE(expected);
|
||||
CAPTURE(actual);
|
||||
CHECK( check_abs(expected,actual,acc) );
|
||||
}
|
||||
|
||||
expected = 0.0;
|
||||
actual = CH3OH.s(Tref,pref,xref);
|
||||
@@ -848,6 +893,15 @@ TEST_CASE("Internal consistency checks and example use cases for the incompressi
|
||||
CAPTURE(actual);
|
||||
CHECK( expected==actual );
|
||||
}
|
||||
expected = CH3OH.s(Tref,pref,xref);
|
||||
{
|
||||
CAPTURE(T);
|
||||
CAPTURE(p);
|
||||
CAPTURE(x);
|
||||
CAPTURE(expected);
|
||||
CAPTURE(actual);
|
||||
CHECK( expected==actual );
|
||||
}
|
||||
|
||||
// Compare u
|
||||
expected = -60043.78429641827;
|
||||
|
||||
@@ -32,8 +32,10 @@ REFPROPBackend::REFPROPBackend(const std::string & fluid_name) {
|
||||
|
||||
// Set the mole fraction to 1 in the base class (we can't set the mole fraction in this class,
|
||||
// otherwise a NotImplementedError will be returned)
|
||||
std::vector<long double> x(1, 1.0); // (one element with value of 1.0)
|
||||
REFPROPMixtureBackend::set_mole_fractions(x);
|
||||
if (get_mole_fractions().empty()){
|
||||
std::vector<long double> x(1, 1.0); // (one element with value of 1.0)
|
||||
REFPROPMixtureBackend::set_mole_fractions(x);
|
||||
}
|
||||
}
|
||||
|
||||
REFPROPBackend::~REFPROPBackend() {
|
||||
|
||||
@@ -51,6 +51,7 @@ enum DLLNameManglingStyle{ NO_NAME_MANGLING = 0, LOWERCASE_NAME_MANGLING, LOWERC
|
||||
#include "REFPROPMixtureBackend.h"
|
||||
#include "Exceptions.h"
|
||||
#include "Configuration.h"
|
||||
#include "CoolProp.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string>
|
||||
@@ -250,23 +251,6 @@ bool load_REFPROP()
|
||||
return false;
|
||||
}
|
||||
|
||||
#if defined(__ISWINDOWS__)
|
||||
|
||||
// Get data associated with path using the windows libraries,
|
||||
// and if you can (result == 0), the path exists
|
||||
#ifdef __MINGW32__
|
||||
struct stat buf;
|
||||
if ( stat( "c:\\Program Files\\REFPROP\\fluids", &buf) != 0){
|
||||
throw CoolProp::ValueError("REFPROP fluid files must be copied to c:\\Program Files\\REFPROP\\fluids");
|
||||
}
|
||||
#else
|
||||
struct _stat buf;
|
||||
if ( _stat( "c:\\Program Files\\REFPROP\\fluids", &buf) != 0){
|
||||
throw CoolProp::ValueError("REFPROP fluid files must be copied to c:\\Program Files\\REFPROP\\fluids");
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if (setFunctionPointers()!=COOLPROP_OK)
|
||||
{
|
||||
printf("There was an error setting the REFPROP function pointers, check types and names in header file.\n");
|
||||
@@ -395,6 +379,40 @@ void REFPROPMixtureBackend::set_REFPROP_fluids(const std::vector<std::string> &f
|
||||
}
|
||||
else
|
||||
{
|
||||
if (N == 1 && upper(components_joined_raw).find(".MIX") != std::string::npos){
|
||||
// It's a predefined mixture
|
||||
ierr = 0;
|
||||
std::vector<double> x(ncmax);
|
||||
char mix[255];
|
||||
strcpy(mix, components_joined_raw.c_str());
|
||||
SETMIXdll(mix,
|
||||
"HMX.BNC",
|
||||
"DEF",
|
||||
&N,
|
||||
component_string,
|
||||
&(x[0]),
|
||||
&ierr,
|
||||
herr,
|
||||
255,
|
||||
255,
|
||||
3,
|
||||
10000,
|
||||
255);
|
||||
if (static_cast<int>(ierr) <= 0){
|
||||
this->Ncomp = N;
|
||||
mole_fractions.resize(N);
|
||||
mole_fractions_liq.resize(N);
|
||||
mole_fractions_vap.resize(N);
|
||||
LoadedREFPROPRef = components_joined_raw;
|
||||
if (CoolProp::get_debug_level() > 5){ std::cout << format("%s:%d: Successfully loaded REFPROP fluid: %s\n",__FILE__,__LINE__, components_joined.c_str()); }
|
||||
if (dbg_refprop) std::cout << format("%s:%d: Successfully loaded REFPROP fluid: %s\n",__FILE__,__LINE__, components_joined.c_str());
|
||||
set_mole_fractions(std::vector<long double>(x.begin(), x.begin()+N));
|
||||
return;
|
||||
}
|
||||
else{
|
||||
throw ValueError(format("Unable to load mixture: %s",components_joined_raw.c_str()));
|
||||
}
|
||||
}
|
||||
// Loop over the file names - first we try with nothing, then .fld, then .FLD, then .ppf - means you can't mix and match
|
||||
for (unsigned int k = 0; k < number_of_endings; k++)
|
||||
{
|
||||
@@ -425,22 +443,25 @@ void REFPROPMixtureBackend::set_REFPROP_fluids(const std::vector<std::string> &f
|
||||
errormessagelength // Length of error message
|
||||
);
|
||||
|
||||
if (ierr <= 0) // Success (or a warning, which is silently squelched for now)
|
||||
if (static_cast<int>(ierr) <= 0) // Success (or a warning, which is silently squelched for now)
|
||||
{
|
||||
this->Ncomp = N;
|
||||
mole_fractions.resize(N);
|
||||
mole_fractions_liq.resize(N);
|
||||
mole_fractions_vap.resize(N);
|
||||
LoadedREFPROPRef = components_joined_raw;
|
||||
if (CoolProp::get_debug_level() > 5){ std::cout << format("%s:%d: Successfully loaded REFPROP fluid: %s\n",__FILE__,__LINE__, components_joined.c_str()); }
|
||||
if (dbg_refprop) std::cout << format("%s:%d: Successfully loaded REFPROP fluid: %s\n",__FILE__,__LINE__, components_joined.c_str());
|
||||
return;
|
||||
}
|
||||
else if (k < number_of_endings-1){ // Keep going
|
||||
if (CoolProp::get_debug_level() > 5){std::cout << format("REFPROP error/warning [ierr: %d]: %s",ierr, herr) << std::endl;}
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw ValueError(format("Could not load these fluids: %s; error: %s", components_joined_raw.c_str(), herr));
|
||||
if (CoolProp::get_debug_level() > 5){std::cout << format("k: %d #endings: %d", k, number_of_endings) << std::endl;}
|
||||
throw ValueError(format("Could not load these fluids: %s", components_joined_raw.c_str()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -514,21 +535,21 @@ long double REFPROPMixtureBackend::calc_T_critical(){
|
||||
char herr[255];
|
||||
double Tcrit, pcrit_kPa, dcrit_mol_L;
|
||||
CRITPdll(&(mole_fractions[0]),&Tcrit,&pcrit_kPa,&dcrit_mol_L,&ierr,herr,255);
|
||||
if (ierr > 0) { throw ValueError(format("%s",herr).c_str()); } //else if (ierr < 0) {set_warning(format("%s",herr).c_str());}
|
||||
if (static_cast<int>(ierr) > 0) { throw ValueError(format("%s",herr).c_str()); } //else if (ierr < 0) {set_warning(format("%s",herr).c_str());}
|
||||
return static_cast<long double>(Tcrit);
|
||||
};
|
||||
long double REFPROPMixtureBackend::calc_p_critical(){
|
||||
long ierr = 0;
|
||||
char herr[255];
|
||||
double Tcrit, pcrit_kPa, dcrit_mol_L;
|
||||
CRITPdll(&(mole_fractions[0]),&Tcrit,&pcrit_kPa,&dcrit_mol_L,&ierr,herr,255); if (ierr > 0) { throw ValueError(format("%s",herr).c_str()); } //else if (ierr < 0) {set_warning(format("%s",herr).c_str());}
|
||||
CRITPdll(&(mole_fractions[0]),&Tcrit,&pcrit_kPa,&dcrit_mol_L,&ierr,herr,255); if (static_cast<int>(ierr) > 0) { throw ValueError(format("%s",herr).c_str()); } //else if (ierr < 0) {set_warning(format("%s",herr).c_str());}
|
||||
return static_cast<long double>(pcrit_kPa*1000);
|
||||
};
|
||||
long double REFPROPMixtureBackend::calc_rhomolar_critical(){
|
||||
long ierr = 0;
|
||||
char herr[255];
|
||||
double Tcrit, pcrit_kPa, dcrit_mol_L;
|
||||
CRITPdll(&(mole_fractions[0]),&Tcrit,&pcrit_kPa,&dcrit_mol_L,&ierr,herr,255); if (ierr > 0) { throw ValueError(format("%s",herr).c_str()); } //else if (ierr < 0) {set_warning(format("%s",herr).c_str());}
|
||||
CRITPdll(&(mole_fractions[0]),&Tcrit,&pcrit_kPa,&dcrit_mol_L,&ierr,herr,255); if (static_cast<int>(ierr) > 0) { throw ValueError(format("%s",herr).c_str()); } //else if (ierr < 0) {set_warning(format("%s",herr).c_str());}
|
||||
return static_cast<long double>(dcrit_mol_L*1000);
|
||||
};
|
||||
long double REFPROPMixtureBackend::calc_T_reducing(){
|
||||
@@ -543,7 +564,7 @@ long double REFPROPMixtureBackend::calc_rhomolar_reducing(){
|
||||
};
|
||||
long double REFPROPMixtureBackend::calc_Ttriple(){
|
||||
if (mole_fractions.size() != 1){throw ValueError("calc_Ttriple cannot be evaluated for mixtures");}
|
||||
long icomp = 0;
|
||||
long icomp = 1;
|
||||
double wmm, ttrp, tnbpt, tc, pc, Dc, Zc, acf, dip, Rgas;
|
||||
INFOdll(&icomp, &wmm, &ttrp, &tnbpt, &tc, &pc, &Dc, &Zc, &acf, &dip, &Rgas);
|
||||
return static_cast<long double>(ttrp);
|
||||
@@ -572,7 +593,7 @@ double REFPROPMixtureBackend::calc_melt_Tmax()
|
||||
MELTPdll(&pmax_kPa, &(mole_fractions[0]),
|
||||
&Tmax_melt,
|
||||
&ierr,herr,errormessagelength); // Error message
|
||||
if (ierr > 0) { throw ValueError(format("%s",herr).c_str()); }
|
||||
if (static_cast<int>(ierr) > 0) { throw ValueError(format("%s",herr).c_str()); }
|
||||
//else if (ierr < 0) {set_warning(format("%s",herr).c_str());}
|
||||
return Tmax_melt;
|
||||
}
|
||||
@@ -586,7 +607,7 @@ long double REFPROPMixtureBackend::calc_melting_line(int param, int given, long
|
||||
MELTTdll(&_T, &(mole_fractions[0]),
|
||||
&p_kPa,
|
||||
&ierr,herr,errormessagelength); // Error message
|
||||
if (ierr > 0) { throw ValueError(format("%s",herr).c_str()); } //else if (ierr < 0) {set_warning(format("%s",herr).c_str());}
|
||||
if (static_cast<int>(ierr) > 0) { throw ValueError(format("%s",herr).c_str()); } //else if (ierr < 0) {set_warning(format("%s",herr).c_str());}
|
||||
return p_kPa*1000;
|
||||
}
|
||||
else if (param == iT && given == iP){
|
||||
@@ -594,7 +615,7 @@ long double REFPROPMixtureBackend::calc_melting_line(int param, int given, long
|
||||
MELTPdll(&p_kPa, &(mole_fractions[0]),
|
||||
&_T,
|
||||
&ierr,herr,errormessagelength); // Error message
|
||||
if (ierr > 0) { throw ValueError(format("%s",herr).c_str()); } //else if (ierr < 0) {set_warning(format("%s",herr).c_str());}
|
||||
if (static_cast<int>(ierr) > 0) { throw ValueError(format("%s",herr).c_str()); } //else if (ierr < 0) {set_warning(format("%s",herr).c_str());}
|
||||
return p_kPa*1000;
|
||||
}
|
||||
else{
|
||||
@@ -616,7 +637,7 @@ long double REFPROPMixtureBackend::calc_viscosity(void)
|
||||
TRNPRPdll(&_T,&rhomol_L,&(mole_fractions[0]), // Inputs
|
||||
&eta,&tcx, // Outputs
|
||||
&ierr,herr,errormessagelength); // Error message
|
||||
if (ierr > 0) { throw ValueError(format("%s",herr).c_str()); }
|
||||
if (static_cast<int>(ierr) > 0) { throw ValueError(format("%s",herr).c_str()); }
|
||||
//else if (ierr < 0) {set_warning(format("%s",herr).c_str());}
|
||||
_viscosity = 1e-6*eta;
|
||||
_conductivity = tcx;
|
||||
@@ -636,7 +657,7 @@ long double REFPROPMixtureBackend::calc_surface_tension(void)
|
||||
SURFTdll(&_T, &rho_mol_L, &(mole_fractions[0]), // Inputs
|
||||
&sigma, // Outputs
|
||||
&ierr, herr, errormessagelength); // Error message
|
||||
if (ierr > 0) { throw ValueError(format("%s",herr).c_str()); }
|
||||
if (static_cast<int>(ierr) > 0) { throw ValueError(format("%s",herr).c_str()); }
|
||||
//else if (ierr < 0) {set_warning(format("%s",herr).c_str());}
|
||||
_surface_tension = sigma;
|
||||
return static_cast<double>(_surface_tension);
|
||||
@@ -651,7 +672,7 @@ long double REFPROPMixtureBackend::calc_fugacity_coefficient(int i)
|
||||
FUGCOFdll(&_T, &rho_mol_L, &(mole_fractions[0]), // Inputs
|
||||
&(fug_cof[0]), // Outputs
|
||||
&ierr, herr, errormessagelength); // Error message
|
||||
if (ierr > 0) { throw ValueError(format("%s",herr).c_str()); }
|
||||
if (static_cast<int>(ierr) > 0) { throw ValueError(format("%s",herr).c_str()); }
|
||||
//else if (ierr < 0) {set_warning(format("%s",herr).c_str());}
|
||||
return static_cast<long double>(fug_cof[i]);
|
||||
}
|
||||
@@ -662,7 +683,7 @@ void REFPROPMixtureBackend::calc_phase_envelope(const std::string &type)
|
||||
char herr[255];
|
||||
SATSPLNdll(&(mole_fractions[0]), // Inputs
|
||||
&ierr, herr, errormessagelength); // Error message
|
||||
if (ierr > 0) { throw ValueError(format("%s",herr).c_str()); }
|
||||
if (static_cast<int>(ierr) > 0) { throw ValueError(format("%s",herr).c_str()); }
|
||||
}
|
||||
long double REFPROPMixtureBackend::calc_cpmolar_idealgas(void)
|
||||
{
|
||||
@@ -701,7 +722,7 @@ void REFPROPMixtureBackend::update(CoolProp::input_pairs input_pair, double valu
|
||||
&rhoLmol_L,&rhoVmol_L,&(mole_fractions_liq[0]),&(mole_fractions[0]), // Saturation terms
|
||||
&q,&emol,&hmol,&smol,&cvmol,&cpmol,&w,
|
||||
&ierr,herr,errormessagelength); //
|
||||
if (ierr > 0) { throw ValueError(format("PT: %s",herr).c_str()); }// TODO: else if (ierr < 0) {set_warning(format("%s",herr).c_str());}
|
||||
if (static_cast<int>(ierr) > 0) { throw ValueError(format("PT: %s",herr).c_str()); }// TODO: else if (ierr < 0) {set_warning(format("%s",herr).c_str());}
|
||||
|
||||
// Set all cache values that can be set with unit conversion to SI
|
||||
_p = value1;
|
||||
@@ -723,7 +744,7 @@ void REFPROPMixtureBackend::update(CoolProp::input_pairs input_pair, double valu
|
||||
&rhoLmol_L,&rhoVmol_L,&(mole_fractions_liq[0]),&(mole_fractions_vap[0]), // Saturation terms
|
||||
&q,&emol,&hmol,&smol,&cvmol,&cpmol,&w,
|
||||
&ierr,herr,errormessagelength);
|
||||
if (ierr > 0) { throw ValueError(format("DmolarT: %s",herr).c_str()); }// TODO: else if (ierr < 0) {set_warning(format("%s",herr).c_str());}
|
||||
if (static_cast<int>(ierr) > 0) { throw ValueError(format("DmolarT: %s",herr).c_str()); }// TODO: else if (ierr < 0) {set_warning(format("%s",herr).c_str());}
|
||||
|
||||
// Set all cache values that can be set with unit conversion to SI
|
||||
_p = p_kPa*1000;
|
||||
@@ -752,7 +773,7 @@ void REFPROPMixtureBackend::update(CoolProp::input_pairs input_pair, double valu
|
||||
&rhoLmol_L,&rhoVmol_L,&(mole_fractions_liq[0]),&(mole_fractions_vap[0]), // Saturation terms
|
||||
&q,&emol,&hmol,&smol,&cvmol,&cpmol,&w, // Other thermodynamic terms
|
||||
&ierr,herr,errormessagelength); // Error terms
|
||||
if (ierr > 0) { throw ValueError(format("DmolarP: %s",herr).c_str()); }// TODO: else if (ierr < 0) {set_warning(format("%s",herr).c_str());}
|
||||
if (static_cast<int>(ierr) > 0) { throw ValueError(format("DmolarP: %s",herr).c_str()); }// TODO: else if (ierr < 0) {set_warning(format("%s",herr).c_str());}
|
||||
|
||||
// Set all cache values that can be set with unit conversion to SI
|
||||
_rhomolar = value1;
|
||||
@@ -782,7 +803,7 @@ void REFPROPMixtureBackend::update(CoolProp::input_pairs input_pair, double valu
|
||||
&rhoLmol_L,&rhoVmol_L,&(mole_fractions_liq[0]),&(mole_fractions_vap[0]), // Saturation terms
|
||||
&q,&emol,&smol,&cvmol,&cpmol,&w,
|
||||
&ierr,herr,errormessagelength);
|
||||
if (ierr > 0) { throw ValueError(format("DmolarHmolar: %s",herr).c_str()); }// TODO: else if (ierr < 0) {set_warning(format("%s",herr).c_str());}
|
||||
if (static_cast<int>(ierr) > 0) { throw ValueError(format("DmolarHmolar: %s",herr).c_str()); }// TODO: else if (ierr < 0) {set_warning(format("%s",herr).c_str());}
|
||||
|
||||
// Set all cache values that can be set with unit conversion to SI
|
||||
_p = p_kPa*1000;
|
||||
@@ -812,7 +833,7 @@ void REFPROPMixtureBackend::update(CoolProp::input_pairs input_pair, double valu
|
||||
&rhoLmol_L,&rhoVmol_L,&(mole_fractions_liq[0]),&(mole_fractions_vap[0]), // Saturation terms
|
||||
&q,&emol,&hmol,&cvmol,&cpmol,&w,
|
||||
&ierr,herr,errormessagelength);
|
||||
if (ierr > 0) { throw ValueError(format("DmolarSmolar: %s",herr).c_str()); }// TODO: else if (ierr < 0) {set_warning(format("%s",herr).c_str());}
|
||||
if (static_cast<int>(ierr) > 0) { throw ValueError(format("DmolarSmolar: %s",herr).c_str()); }// TODO: else if (ierr < 0) {set_warning(format("%s",herr).c_str());}
|
||||
|
||||
// Set all cache values that can be set with unit conversion to SI
|
||||
_p = p_kPa*1000;
|
||||
@@ -842,7 +863,7 @@ void REFPROPMixtureBackend::update(CoolProp::input_pairs input_pair, double valu
|
||||
&rhoLmol_L,&rhoVmol_L,&(mole_fractions_liq[0]),&(mole_fractions_vap[0]), // Saturation terms
|
||||
&q,&hmol,&hmol,&cvmol,&cpmol,&w,
|
||||
&ierr,herr,errormessagelength);
|
||||
if (ierr > 0) { throw ValueError(format("DmolarUmolar: %s",herr).c_str()); }// TODO: else if (ierr < 0) {set_warning(format("%s",herr).c_str());}
|
||||
if (static_cast<int>(ierr) > 0) { throw ValueError(format("DmolarUmolar: %s",herr).c_str()); }// TODO: else if (ierr < 0) {set_warning(format("%s",herr).c_str());}
|
||||
|
||||
// Set all cache values that can be set with unit conversion to SI
|
||||
_p = p_kPa*1000;
|
||||
@@ -871,7 +892,7 @@ void REFPROPMixtureBackend::update(CoolProp::input_pairs input_pair, double valu
|
||||
&rhoLmol_L,&rhoVmol_L,&(mole_fractions_liq[0]),&(mole_fractions_vap[0]), // Saturation terms
|
||||
&q,&emol,&smol,&cvmol,&cpmol,&w, // Other thermodynamic terms
|
||||
&ierr,herr,errormessagelength); // Error terms
|
||||
if (ierr > 0) { throw ValueError(format("HmolarPmolar: %s",herr).c_str()); }// TODO: else if (ierr < 0) {set_warning(format("%s",herr).c_str());}
|
||||
if (static_cast<int>(ierr) > 0) { throw ValueError(format("HmolarPmolar: %s",herr).c_str()); }// TODO: else if (ierr < 0) {set_warning(format("%s",herr).c_str());}
|
||||
|
||||
// Set all cache values that can be set with unit conversion to SI
|
||||
_p = value2;
|
||||
@@ -901,7 +922,7 @@ void REFPROPMixtureBackend::update(CoolProp::input_pairs input_pair, double valu
|
||||
&q,&emol,&hmol,&cvmol,&cpmol,&w, // Other thermodynamic terms
|
||||
&ierr,herr,errormessagelength); // Error terms
|
||||
|
||||
if (ierr > 0) { throw ValueError(format("PSmolar: %s",herr).c_str()); }// TODO: else if (ierr < 0) {set_warning(format("%s",herr).c_str());}
|
||||
if (static_cast<int>(ierr) > 0) { throw ValueError(format("PSmolar: %s",herr).c_str()); }// TODO: else if (ierr < 0) {set_warning(format("%s",herr).c_str());}
|
||||
|
||||
// Set all cache values that can be set with unit conversion to SI
|
||||
_p = value1;
|
||||
@@ -932,7 +953,7 @@ void REFPROPMixtureBackend::update(CoolProp::input_pairs input_pair, double valu
|
||||
&q,&hmol,&smol,&cvmol,&cpmol,&w, // Other thermodynamic terms
|
||||
&ierr,herr,errormessagelength); // Error terms
|
||||
|
||||
if (ierr > 0) { throw ValueError(format("PUmolar: %s",herr).c_str()); }// TODO: else if (ierr < 0) {set_warning(format("%s",herr).c_str());}
|
||||
if (static_cast<int>(ierr) > 0) { throw ValueError(format("PUmolar: %s",herr).c_str()); }// TODO: else if (ierr < 0) {set_warning(format("%s",herr).c_str());}
|
||||
|
||||
// Set all cache values that can be set with unit conversion to SI
|
||||
_p = value1;
|
||||
@@ -961,7 +982,7 @@ void REFPROPMixtureBackend::update(CoolProp::input_pairs input_pair, double valu
|
||||
&q,&emol,&cvmol,&cpmol,&w, // Other thermodynamic terms
|
||||
&ierr,herr,errormessagelength); // Error terms
|
||||
|
||||
if (ierr > 0) { throw ValueError(format("HmolarSmolar: %s",herr).c_str()); }// TODO: else if (ierr < 0) {set_warning(format("%s",herr).c_str());}
|
||||
if (static_cast<int>(ierr) > 0) { throw ValueError(format("HmolarSmolar: %s",herr).c_str()); }// TODO: else if (ierr < 0) {set_warning(format("%s",herr).c_str());}
|
||||
|
||||
// Set all cache values that can be set with unit conversion to SI
|
||||
_p = p_kPa*1000; // 1000 for conversion from kPa to Pa
|
||||
@@ -992,7 +1013,7 @@ void REFPROPMixtureBackend::update(CoolProp::input_pairs input_pair, double valu
|
||||
&q,&smol,&cvmol,&cpmol,&w, // Other thermodynamic terms
|
||||
&ierr,herr,errormessagelength); // Error terms
|
||||
|
||||
if (ierr > 0) { throw ValueError(format("SmolarUmolar: %s",herr).c_str()); }// TODO: else if (ierr < 0) {set_warning(format("%s",herr).c_str());}
|
||||
if (static_cast<int>(ierr) > 0) { throw ValueError(format("SmolarUmolar: %s",herr).c_str()); }// TODO: else if (ierr < 0) {set_warning(format("%s",herr).c_str());}
|
||||
|
||||
// Set all cache values that can be set with unit conversion to SI
|
||||
_p = p_kPa*1000; // 1000 for conversion from kPa to Pa
|
||||
@@ -1031,7 +1052,7 @@ void REFPROPMixtureBackend::update(CoolProp::input_pairs input_pair, double valu
|
||||
&q,&emol,&hmol,&cvmol,&cpmol,&w, // Other thermodynamic terms
|
||||
&ierr,herr,errormessagelength); // Error terms
|
||||
|
||||
if (ierr > 0) { throw ValueError(format("SmolarT: %s",herr).c_str()); }// TODO: else if (ierr < 0) {set_warning(format("%s",herr).c_str());}
|
||||
if (static_cast<int>(ierr) > 0) { throw ValueError(format("SmolarT: %s",herr).c_str()); }// TODO: else if (ierr < 0) {set_warning(format("%s",herr).c_str());}
|
||||
|
||||
// Set all cache values that can be set with unit conversion to SI
|
||||
_p = p_kPa*1000; // 1000 for conversion from kPa to Pa
|
||||
@@ -1069,7 +1090,7 @@ void REFPROPMixtureBackend::update(CoolProp::input_pairs input_pair, double valu
|
||||
&q,&emol,&smol,&cvmol,&cpmol,&w, // Other thermodynamic terms
|
||||
&ierr,herr,errormessagelength); // Error terms
|
||||
|
||||
if (ierr > 0) { throw ValueError(format("HmolarT: %s",herr).c_str()); }// TODO: else if (ierr < 0) {set_warning(format("%s",herr).c_str());}
|
||||
if (static_cast<int>(ierr) > 0) { throw ValueError(format("HmolarT: %s",herr).c_str()); }// TODO: else if (ierr < 0) {set_warning(format("%s",herr).c_str());}
|
||||
|
||||
// Set all cache values that can be set with unit conversion to SI
|
||||
_p = p_kPa*1000; // 1000 for conversion from kPa to Pa
|
||||
@@ -1107,7 +1128,7 @@ void REFPROPMixtureBackend::update(CoolProp::input_pairs input_pair, double valu
|
||||
&q,&hmol,&smol,&cvmol,&cpmol,&w, // Other thermodynamic terms
|
||||
&ierr,herr,errormessagelength); // Error terms
|
||||
|
||||
if (ierr > 0) { throw ValueError(format("TUmolar: %s",herr).c_str()); }// TODO: else if (ierr < 0) {set_warning(format("%s",herr).c_str());}
|
||||
if (static_cast<int>(ierr) > 0) { throw ValueError(format("TUmolar: %s",herr).c_str()); }// TODO: else if (ierr < 0) {set_warning(format("%s",herr).c_str());}
|
||||
|
||||
// Set all cache values that can be set with unit conversion to SI
|
||||
_p = p_kPa*1000; // 1000 for conversion from kPa to Pa
|
||||
@@ -1145,7 +1166,7 @@ void REFPROPMixtureBackend::update(CoolProp::input_pairs input_pair, double valu
|
||||
&emol,&hmol,&smol,&cvmol,&cpmol,&w, // Other thermodynamic terms
|
||||
&ierr,herr,errormessagelength); // Error terms
|
||||
|
||||
if (ierr > 0) { throw ValueError(format("PQ: %s",herr).c_str()); }// TODO: else if (ierr < 0) {set_warning(format("%s",herr).c_str());}
|
||||
if (static_cast<int>(ierr) > 0) { throw ValueError(format("PQ: %s",herr).c_str()); }// TODO: else if (ierr < 0) {set_warning(format("%s",herr).c_str());}
|
||||
|
||||
// Set all cache values that can be set with unit conversion to SI
|
||||
_p = value1;
|
||||
@@ -1176,7 +1197,7 @@ void REFPROPMixtureBackend::update(CoolProp::input_pairs input_pair, double valu
|
||||
&emol,&hmol,&smol,&cvmol,&cpmol,&w, // Other thermodynamic terms
|
||||
&ierr,herr,errormessagelength); // Error terms
|
||||
|
||||
if (ierr > 0) {
|
||||
if (static_cast<int>(ierr) > 0) {
|
||||
throw ValueError(format("TQ(%s): %s",LoadedREFPROPRef.c_str(), herr).c_str());
|
||||
}// TODO: else if (ierr < 0) {set_warning(format("%s",herr).c_str());
|
||||
|
||||
|
||||
@@ -483,7 +483,6 @@ TEST_CASE("Check inputs to PropsSI","[PropsSI]")
|
||||
SECTION("Single state, trivial output, pure incompressible"){
|
||||
CHECK(ValidNumber(CoolProp::PropsSI("Tmin","P",0,"T",0,"INCOMP::DowQ")));
|
||||
};
|
||||
std::cout << get_global_param_string("errstring");
|
||||
SECTION("Bad input pair"){
|
||||
CHECK(!ValidNumber(CoolProp::PropsSI("D","Q",0,"Q",0,"Water")));
|
||||
};
|
||||
@@ -499,6 +498,12 @@ TEST_CASE("Check inputs to PropsSI","[PropsSI]")
|
||||
SECTION("Single state, single output, predefined mixture"){
|
||||
CHECK(ValidNumber(CoolProp::PropsSI("T","P",101325,"Q",0,"R410A.mix")));
|
||||
};
|
||||
SECTION("Single state, single output, predefined mixture from REFPROP"){
|
||||
CHECK(ValidNumber(CoolProp::PropsSI("T","P",101325,"Q",0,"REFPROP::R410A.mix")));
|
||||
};
|
||||
SECTION("Single state, single output, bad predefined mixture from REFPROP"){
|
||||
CHECK(!ValidNumber(CoolProp::PropsSI("T","P",101325,"Q",0,"REFPROP::RRRRRR.mix")));
|
||||
};
|
||||
SECTION("Predefined mixture"){
|
||||
std::vector<double> p(1, 101325), Q(1, 1.0), z;
|
||||
std::vector<std::string> outputs(1,"T"); outputs.push_back("Dmolar");
|
||||
|
||||
@@ -5,14 +5,6 @@
|
||||
%ignore CoolProp::set_config_json(rapidjson::Document &);
|
||||
%ignore CoolProp::get_config_as_json(rapidjson::Document &);
|
||||
|
||||
#ifdef SWIGMATLAB
|
||||
%ignore configuration_keys;
|
||||
%ignore CoolProp::ConfigurationItem::ConfigurationDataTypes;
|
||||
%ignore CoolProp::SsatSimpleState::SsatSimpleStateEnum;
|
||||
%ignore CoolProp::composition_types;
|
||||
%ignore CoolProp::fluid_types;
|
||||
#endif
|
||||
|
||||
%include "std_string.i" // This %include allows the use of std::string natively
|
||||
%include "std_vector.i" // This allows for the use of STL vectors natively(ish)
|
||||
%include "exception.i" //
|
||||
@@ -46,10 +38,12 @@ namespace std {
|
||||
#define SWIG
|
||||
#include "Configuration.h"
|
||||
#undef SWIG
|
||||
#include "HumidAirProp.h"
|
||||
%}
|
||||
|
||||
%include "DataStructures.h"
|
||||
%include "AbstractState.h"
|
||||
%include "CoolProp.h"
|
||||
%include "PhaseEnvelope.h"
|
||||
%include "Configuration.h"
|
||||
%include "Configuration.h"
|
||||
%include "HumidAirProp.h"
|
||||
@@ -228,7 +228,12 @@ EXPORT_CODE void CONVENTION set_debug_level(int level){
|
||||
CoolProp::set_debug_level(level);
|
||||
}
|
||||
EXPORT_CODE long CONVENTION get_param_index(const char * param){
|
||||
return CoolProp::get_parameter_index(param);
|
||||
try{
|
||||
return CoolProp::get_parameter_index(param);
|
||||
}
|
||||
catch(std::exception &){
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
EXPORT_CODE long CONVENTION get_global_param_string(const char *param, char * Output, int n)
|
||||
{
|
||||
@@ -249,7 +254,13 @@ EXPORT_CODE long CONVENTION get_global_param_string(const char *param, char * Ou
|
||||
}
|
||||
EXPORT_CODE long CONVENTION get_parameter_information_string(const char *param, char * Output, int n)
|
||||
{
|
||||
int key = CoolProp::get_parameter_index(param);
|
||||
int key;
|
||||
try{
|
||||
key = CoolProp::get_parameter_index(param);
|
||||
}
|
||||
catch(std::exception &){
|
||||
return 0;
|
||||
}
|
||||
if (key >= 0){
|
||||
std::string s = CoolProp::get_parameter_information(key, Output);
|
||||
if (s.size() < static_cast<unsigned int>(n)){
|
||||
|
||||
@@ -13,12 +13,14 @@
|
||||
#include "crossplatform_shared_ptr.h"
|
||||
#include "Exceptions.h"
|
||||
|
||||
#include <algorithm> // std::next_permutation
|
||||
#include <stdlib.h>
|
||||
#include "math.h"
|
||||
#include "time.h"
|
||||
#include "stdio.h"
|
||||
#include <string.h>
|
||||
#include <iostream>
|
||||
#include <list>
|
||||
|
||||
/// This is a stub overload to help with all the strcmp calls below and avoid needing to rewrite all of them
|
||||
std::size_t strcmp(const std::string &s, const std::string e){
|
||||
@@ -166,14 +168,88 @@ static double Brent_HAProps_T(const std::string &OutputName, const std::string &
|
||||
~BrentSolverResids(){};
|
||||
|
||||
double call(double T){
|
||||
return HAPropsSI(OutputName,"T",T,Input1Name,Input1,Input2Name,Input2)-TargetVal;
|
||||
double val = HAPropsSI(OutputName, "T", T, Input1Name, Input1, Input2Name, Input2);
|
||||
return val - TargetVal;
|
||||
}
|
||||
};
|
||||
|
||||
BrentSolverResids BSR = BrentSolverResids(OutputName, Input1Name, Input1, Input2Name, Input2, TargetVal);
|
||||
|
||||
std::string errstr;
|
||||
T = CoolProp::Brent(BSR,T_min,T_max,1e-7,1e-4,50,errstr);
|
||||
// Now we need to check the bounds and make sure that they are ok (don't yield invalid output)
|
||||
// and actually bound the solution
|
||||
double r_min = BSR.call(T_min);
|
||||
bool T_min_valid = ValidNumber(r_min);
|
||||
double r_max = BSR.call(T_max);
|
||||
bool T_max_valid = ValidNumber(r_max);
|
||||
if (!T_min_valid && !T_max_valid){
|
||||
throw CoolProp::ValueError(format("Both T_min [%g] and T_max [%g] yield invalid output values in Brent_HAProps_T",T_min,T_max).c_str());
|
||||
}
|
||||
else if (T_min_valid && !T_max_valid){
|
||||
while (!T_max_valid){
|
||||
// Reduce T_max until it works
|
||||
T_max = 0.95*T_max + 0.05*T_min;
|
||||
r_max = BSR.call(T_max);
|
||||
T_max_valid = ValidNumber(r_max);
|
||||
}
|
||||
}
|
||||
else if (!T_min_valid && T_max_valid){
|
||||
while (!T_min_valid){
|
||||
// Increase T_min until it works
|
||||
T_min = 0.95*T_min + 0.05*T_max;
|
||||
r_min = BSR.call(T_min);
|
||||
T_min_valid = ValidNumber(r_min);
|
||||
}
|
||||
}
|
||||
// We will do a secant call if the values at T_min and T_max have the same sign
|
||||
if (r_min*r_max > 0){
|
||||
if (std::abs(r_min) < std::abs(r_max)){
|
||||
T = CoolProp::Secant(BSR, T_min, 0.01*T_min, 1e-7, 50, errstr);
|
||||
}
|
||||
else{
|
||||
T = CoolProp::Secant(BSR, T_max, -0.01*T_max, 1e-7, 50, errstr);
|
||||
}
|
||||
}
|
||||
else{
|
||||
T = CoolProp::Brent(BSR, T_min, T_max, 1e-7, 1e-4, 50, errstr);
|
||||
}
|
||||
|
||||
return T;
|
||||
}
|
||||
static double Secant_Tdb_at_saturated_W(double psi_w, double p, double T_guess)
|
||||
{
|
||||
double T;
|
||||
class BrentSolverResids : public CoolProp::FuncWrapper1D
|
||||
{
|
||||
private:
|
||||
double pp_water, psi_w, p, r;
|
||||
public:
|
||||
BrentSolverResids(double psi_w, double p) : psi_w(psi_w), p(p) { pp_water = psi_w*p; };
|
||||
~BrentSolverResids(){};
|
||||
|
||||
double call(double T){
|
||||
double p_ws;
|
||||
if (T>=273.16){
|
||||
// Saturation pressure [Pa]
|
||||
Water->update(CoolProp::QT_INPUTS, 0, T);
|
||||
p_ws= Water->keyed_output(CoolProp::iP);
|
||||
}
|
||||
else{
|
||||
// Sublimation pressure [Pa]
|
||||
p_ws=psub_Ice(T);
|
||||
}
|
||||
double f = f_factor(T, p);
|
||||
double pp_water_calc = f*p_ws;
|
||||
double psi_w_calc = pp_water_calc/p;
|
||||
r = (psi_w_calc - psi_w)/psi_w;
|
||||
return r;
|
||||
}
|
||||
};
|
||||
|
||||
BrentSolverResids Resids(psi_w, p);
|
||||
|
||||
std::string errstr;
|
||||
T = CoolProp::Brent(Resids, 150, 350, 1e-16, 1e-7, 100, errstr);
|
||||
|
||||
return T;
|
||||
}
|
||||
@@ -207,7 +283,7 @@ static double Secant_HAProps_T(const std::string &OutputName, const std::string
|
||||
static double Secant_HAProps_W(const std::string &OutputName, const std::string &Input1Name, double Input1, const std::string &Input2Name, double Input2, double TargetVal, double W_guess)
|
||||
{
|
||||
// Use a secant solve in order to yield a target output value for HAProps by altering humidity ratio
|
||||
double x1=0,x2=0,x3=0,y1=0,y2=0,eps=1e-8,f=999,W=0.0001;
|
||||
double x1=0,x2=0,x3=0,y1=0,y2=0,eps=1e-12,f=999,W=0.0001;
|
||||
int iter=1;
|
||||
|
||||
while ((iter<=3 || std::abs(f)>eps) && iter<100)
|
||||
@@ -1089,7 +1165,6 @@ double MoleFractionWater(double T, double p, int HumInput, double InVal)
|
||||
{
|
||||
// Sublimation pressure [Pa]
|
||||
p_ws=psub_Ice(T);
|
||||
|
||||
}
|
||||
// Enhancement Factor [-]
|
||||
f=f_factor(T,p);
|
||||
@@ -1211,8 +1286,8 @@ double HAPropsSI(const std::string &OutputName, const std::string &Input1Name, d
|
||||
{
|
||||
// Add a check to make sure that Air and Water fluid states have been properly instantiated
|
||||
check_fluid_instantiation();
|
||||
|
||||
int In1Type, In2Type, In3Type,iT,iW,iTdp,iRH,ip,Type1,Type2;
|
||||
int iT, iW, iTdp, iRH, ip;
|
||||
givens In1Type, In2Type, In3Type, Type1, Type2, OutputType;
|
||||
double vals[3],p,T,RH,W,Tdp,psi_w,M_ha,v_bar,h_bar,s_bar,MainInputValue,SecondaryInputValue,T_guess;
|
||||
double Value1,Value2,W_guess;
|
||||
std::string MainInputName, SecondaryInputName, Name1, Name2;
|
||||
@@ -1220,11 +1295,17 @@ double HAPropsSI(const std::string &OutputName, const std::string &Input1Name, d
|
||||
vals[0]=Input1;
|
||||
vals[1]=Input2;
|
||||
vals[2]=Input3;
|
||||
|
||||
OutputType=Name2Type(OutputName.c_str());
|
||||
|
||||
// First figure out what kind of inputs you have, convert names to Macro expansions
|
||||
In1Type=Name2Type(Input1Name.c_str());
|
||||
In2Type=Name2Type(Input2Name.c_str());
|
||||
In3Type=Name2Type(Input3Name.c_str());
|
||||
|
||||
if (OutputType == In1Type){return Input1;}
|
||||
if (OutputType == In2Type){return Input2;}
|
||||
if (OutputType == In3Type){return Input3;}
|
||||
|
||||
// Pressure must be included
|
||||
ip=TypeMatch(GIVEN_P,Input1Name,Input2Name,Input3Name);
|
||||
@@ -1266,17 +1347,17 @@ double HAPropsSI(const std::string &OutputName, const std::string &Input1Name, d
|
||||
// Temperature and pressure are known, figure out which variable holds the other value
|
||||
if (In1Type!=GIVEN_T && In1Type!=GIVEN_P)
|
||||
{
|
||||
strcpy(SecondaryInputName,Input1Name);
|
||||
strcpy(SecondaryInputName, Input1Name);
|
||||
SecondaryInputValue=Input1;
|
||||
}
|
||||
else if (In2Type!=GIVEN_T && In2Type!=GIVEN_P)
|
||||
{
|
||||
strcpy(SecondaryInputName,Input2Name);
|
||||
strcpy(SecondaryInputName, Input2Name);
|
||||
SecondaryInputValue=Input2;
|
||||
}
|
||||
else if (In3Type!=GIVEN_T && In3Type!=GIVEN_P)
|
||||
{
|
||||
strcpy(SecondaryInputName,Input3Name);
|
||||
strcpy(SecondaryInputName, Input3Name);
|
||||
SecondaryInputValue=Input3;
|
||||
}
|
||||
else{
|
||||
@@ -1327,43 +1408,70 @@ double HAPropsSI(const std::string &OutputName, const std::string &Input1Name, d
|
||||
// Get the integer type codes
|
||||
Type1=Name2Type(Name1);
|
||||
Type2=Name2Type(Name2);
|
||||
|
||||
// First, if one of the inputs is something that can potentially yield
|
||||
// an explicit solution at a given iteration of the solver, use it
|
||||
if (Type1==GIVEN_RH || Type1==GIVEN_HUMRAT || Type1==GIVEN_TDP)
|
||||
|
||||
// First see if humidity ratio is provided, will be the fastest option
|
||||
if (Type1 == GIVEN_HUMRAT)
|
||||
{
|
||||
// First input variable is a "nice" one
|
||||
|
||||
// MainInput is the one that you are using in the call to HAProps
|
||||
MainInputValue=Value1;
|
||||
strcpy(MainInputName,Name1);
|
||||
MainInputValue=Value1; strcpy(MainInputName,Name1);
|
||||
// SecondaryInput is the one that you are trying to match
|
||||
SecondaryInputValue=Value2;
|
||||
strcpy(SecondaryInputName,Name2);
|
||||
SecondaryInputValue=Value2; strcpy(SecondaryInputName,Name2);
|
||||
}
|
||||
else if (Type2==GIVEN_RH || Type2==GIVEN_HUMRAT || Type2==GIVEN_TDP)
|
||||
else if (Type2 == GIVEN_HUMRAT)
|
||||
{
|
||||
// Second input variable is a "nice" one
|
||||
|
||||
// MainInput is the one that you are using in the call to HAProps
|
||||
MainInputValue=Value2;
|
||||
strcpy(MainInputName,Name2);
|
||||
// MainInput is the one that you are using in the call to HAPropsSI
|
||||
MainInputValue=Value2; strcpy(MainInputName, Name2);
|
||||
// SecondaryInput is the one that you are trying to match
|
||||
SecondaryInputValue=Value1;
|
||||
strcpy(SecondaryInputName,Name1);
|
||||
SecondaryInputValue=Value1; strcpy(SecondaryInputName, Name1);
|
||||
}
|
||||
// Next, if one of the inputs is something that can potentially yield
|
||||
// an explicit solution at a given iteration of the solver, use it
|
||||
else if (Type1 == GIVEN_RH || Type1 == GIVEN_TDP)
|
||||
{
|
||||
// MainInput is the one that you are using in the call to HAProps
|
||||
MainInputValue = Value1; strcpy(MainInputName, Name1);
|
||||
// SecondaryInput is the one that you are trying to match
|
||||
SecondaryInputValue = Value2; strcpy(SecondaryInputName, Name2);
|
||||
}
|
||||
else if (Type2 == GIVEN_RH || Type2 == GIVEN_TDP)
|
||||
{
|
||||
// MainInput is the one that you are using in the call to HAProps
|
||||
MainInputValue = Value2; strcpy(MainInputName, Name2);
|
||||
// SecondaryInput is the one that you are trying to match
|
||||
SecondaryInputValue=Value1; strcpy(SecondaryInputName, Name1);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Sorry, but currently at least one of the variables as an input to HAPropsSI() must be temperature, relative humidity, humidity ratio, or dewpoint\n Eventually will add a 2-D NR solver to find T and psi_w simultaneously, but not included now\n");
|
||||
return -1000;
|
||||
CoolProp::ValueError("Sorry, but currently at least one of the variables as an input to HAPropsSI() must be temperature, relative humidity, humidity ratio, or dewpoint\n Eventually will add a 2-D NR solver to find T and psi_w simultaneously, but not included now\n");
|
||||
return _HUGE;
|
||||
}
|
||||
|
||||
double T_min = 210;
|
||||
double T_min = 200;
|
||||
double T_max = 450;
|
||||
|
||||
if (Name2Type(MainInputName) == GIVEN_RH){
|
||||
T_max = CoolProp::PropsSI("T","P",p,"Q",0,"Water") - 1;
|
||||
if (MainInputValue < 1e-10){
|
||||
T_max = 1000;
|
||||
}
|
||||
else{
|
||||
T_max = CoolProp::PropsSI("T","P",p,"Q",0,"Water") - 1;
|
||||
}
|
||||
}
|
||||
// Minimum drybulb temperature is the drybulb temperature corresponding to saturated air for the humidity ratio
|
||||
// if the humidity ratio is provided
|
||||
else if (Name2Type(MainInputName) == GIVEN_HUMRAT){
|
||||
if (MainInputValue < 1e-10){
|
||||
T_min = 135; // Around the critical point of dry air
|
||||
T_max = 1000;
|
||||
}
|
||||
else{
|
||||
// Calculate the saturated humid air water partial pressure;
|
||||
double psi_w_sat = MoleFractionWater(T_min, p, GIVEN_HUMRAT, MainInputValue);
|
||||
//double pp_water_sat = psi_w_sat*p; // partial pressure of water, which is equal to f*p_{w_s}
|
||||
// Iteratively solve for temperature that will give desired pp_water_sat
|
||||
T_min = Secant_Tdb_at_saturated_W(psi_w_sat, p, T_min);
|
||||
}
|
||||
}
|
||||
|
||||
try{
|
||||
// Use the Brent's method solver to find T. Slow but reliable
|
||||
@@ -1912,7 +2020,94 @@ TEST_CASE_METHOD(HAPropsConsistencyFixture, "ASHRAE RP1485 Tables", "[RP1485]")
|
||||
CHECK(std::abs(actual/expected-1) < 0.01);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
TEST_CASE("Assorted tests","[HAPropsSI]")
|
||||
{
|
||||
CHECK(ValidNumber(HumidAir::HAPropsSI("T", "H", 267769, "P", 104300, "W", 0.0)));
|
||||
CHECK(ValidNumber(HumidAir::HAPropsSI("T", "B", 252.84, "W", 5.097e-4, "P", 101325)));
|
||||
CHECK(ValidNumber(HumidAir::HAPropsSI("T", "B",290, "R", 1, "P", 101325)));
|
||||
}
|
||||
// a predicate implemented as a function:
|
||||
bool is_not_a_pair (const std::set<std::size_t> &item) { return item.size() != 2; }
|
||||
|
||||
const int number_of_inputs = 6;
|
||||
std::string inputs[number_of_inputs] = {"W","D","B","R","T","V"};//,"H","S"};
|
||||
|
||||
class ConsistencyTestData
|
||||
{
|
||||
public:
|
||||
bool is_built;
|
||||
std::vector<Dictionary> data;
|
||||
std::list<std::set<std::size_t> > inputs_list;
|
||||
ConsistencyTestData(){
|
||||
is_built = false;
|
||||
};
|
||||
void build(){
|
||||
if (is_built){return;}
|
||||
std::vector<std::size_t> indices(number_of_inputs);
|
||||
for (std::size_t i = 0; i < number_of_inputs; ++i){ indices[i] = i;}
|
||||
// Generate a powerset of all the permutations of all lengths of inputs
|
||||
std::set<std::size_t> indices_set(indices.begin(), indices.end());
|
||||
std::set<std::set<std::size_t> > inputs_powerset = powerset(indices_set);
|
||||
inputs_list = std::list<std::set<std::size_t> >(inputs_powerset.begin(), inputs_powerset.end());
|
||||
inputs_list.remove_if(is_not_a_pair);
|
||||
|
||||
const int NT = 10, NW = 5;
|
||||
double p = 101325;
|
||||
for (double T = 210; T < 350; T += (350-210)/(NT-1))
|
||||
{
|
||||
double Wsat = HumidAir::HAPropsSI("W", "T", T, "P", p, "R", 1.0);
|
||||
for (double W = 1e-5; W < Wsat; W += (Wsat-1e-5)/(NW-1)){
|
||||
Dictionary vals;
|
||||
// Calculate all the values using T, W
|
||||
for (int i = 0; i < number_of_inputs; ++i){
|
||||
double v = HumidAir::HAPropsSI(inputs[i], "T", T, "P", p, "W", W);
|
||||
vals.add_number(inputs[i], v);
|
||||
}
|
||||
data.push_back(vals);
|
||||
std::cout << format("T %g W %g\n",T,W);
|
||||
}
|
||||
}
|
||||
is_built = true;
|
||||
};
|
||||
} consistency_data;
|
||||
|
||||
/*
|
||||
* This test is incredibly slow, which is why it is currently commented out. Many of the tests also fail
|
||||
*
|
||||
TEST_CASE("HAPropsSI", "[HAPropsSI]")
|
||||
{
|
||||
consistency_data.build();
|
||||
double p = 101325;
|
||||
for (std::size_t i = 0; i < consistency_data.data.size(); ++i)
|
||||
{
|
||||
for (std::list<std::set<std::size_t> >::iterator iter = consistency_data.inputs_list.begin(); iter != consistency_data.inputs_list.end(); ++iter)
|
||||
{
|
||||
std::vector<std::size_t> pair(iter->begin(), iter->end());
|
||||
std::string i0 = inputs[pair[0]], i1 = inputs[pair[1]];
|
||||
double v0 = consistency_data.data[i].get_double(i0), v1 = consistency_data.data[i].get_double(i1);
|
||||
if ((i0 == "B" && i1 == "V") || (i1 == "B" && i0 == "V")){continue;}
|
||||
std::ostringstream ss2;
|
||||
ss2 << "Inputs: \"" << i0 << "\"," << v0 << ",\"" << i1 << "\"," << v1;
|
||||
SECTION(ss2.str(), ""){
|
||||
|
||||
double T = consistency_data.data[i].get_double("T");
|
||||
double W = consistency_data.data[i].get_double("W");
|
||||
double Wcalc = HumidAir::HAPropsSI("W", i0, v0, i1, v1, "P", p);
|
||||
double Tcalc = HumidAir::HAPropsSI("T", i0, v0, i1, v1, "P", p);
|
||||
std::string err = CoolProp::get_global_param_string("errstring");
|
||||
CAPTURE(T);
|
||||
CAPTURE(W);
|
||||
CAPTURE(Tcalc);
|
||||
CAPTURE(Wcalc);
|
||||
CAPTURE(err);
|
||||
CHECK(std::abs(Tcalc - T) < 1e-1);
|
||||
CHECK(std::abs((Wcalc - W)/W) < 1e-3);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
#endif /* CATCH_ENABLED */
|
||||
|
||||
|
||||
36
wrappers/Lua/Makefile
Normal file
36
wrappers/Lua/Makefile
Normal file
@@ -0,0 +1,36 @@
|
||||
include lualib.mk
|
||||
|
||||
COOLPROP_CFLAGS ?= $(shell $(PKGCONFIG) --cflags CoolProp)
|
||||
COOLPROP_LDFLAGS ?= $(shell $(PKGCONFIG) --libs-only-L CoolProp)
|
||||
COOLPROP_LDLIBS ?= $(or $(shell $(PKGCONFIG) --libs-only-l CoolProp), -lCoolProp)
|
||||
COOLPROP_INCDIR ?= $(shell $(PKGCONFIG) --variable=includedir CoolProp)
|
||||
COOLPROP_LIBDIR ?= $(shell $(PKGCONFIG) --variable=libdir CoolProp)
|
||||
COOLPROP_HEADER ?= $(or $(COOLPROP_INCDIR)
|
||||
|
||||
CFLAGS ?= -g -O2 -Wall -Wextra -Wswitch-enum -Wwrite-strings -Wshadow
|
||||
XCFLAGS += -std=c99 -pedantic-errors -fPIC
|
||||
XCFLAGS += $(LUA_CFLAGS) $(COOLPROP_CFLAGS)
|
||||
XLDFLAGS += $(GUMBO_LDFLAGS) $(COOLPROP_LDLIBS)
|
||||
|
||||
all: coolprop/capi.so
|
||||
|
||||
coolprop/capi.o: coolprop/capi.c coolprop/compat.h
|
||||
|
||||
install: all
|
||||
$(MKDIR) '$(DESTDIR)$(LUA_CMOD_DIR)/coolprop'
|
||||
$(MKDIR) '$(DESTDIR)$(LUA_LMOD_DIR)/coolprop'
|
||||
$(INSTALLX) coolprop/capi.so '$(DESTDIR)$(LUA_CMOD_DIR)/coolprop/capi.so'
|
||||
$(INSTALL) coolprop.lua '$(DESTDIR)$(LUA_LMOD_DIR)/'
|
||||
$(INSTALL) coolprop/ffi.lua '$(DESTDIR)$(LUA_LMOD_DIR)/coolprop/'
|
||||
|
||||
uninstall:
|
||||
$(RM) '$(DESTDIR)$(LUA_LMOD_DIR)/coolprop.lua'
|
||||
$(RM) -r '$(DESTDIR)$(LUA_CMOD_DIR)/coolprop/'
|
||||
$(RM) -r '$(DESTDIR)$(LUA_LMOD_DIR)/coolprop/'
|
||||
|
||||
clean:
|
||||
$(RM) coolprop/capi.so coolprop/capi.o
|
||||
|
||||
.PHONY: all install uninstall clean
|
||||
|
||||
.DELETE_ON_ERROR:
|
||||
207
wrappers/Lua/README.rst
Normal file
207
wrappers/Lua/README.rst
Normal file
@@ -0,0 +1,207 @@
|
||||
Lua Wrapper for CoolProp
|
||||
========================
|
||||
|
||||
Lua C API and LuaJIT wrappers for CoolProp library (currently implementing the high-level C API).
|
||||
|
||||
by Aapo Talvensaari, Helsinki, Finland, January 2015
|
||||
|
||||
|
||||
Hello World with Lua Wrapper
|
||||
----------------------------
|
||||
|
||||
::
|
||||
|
||||
local cp = require "coolprop"
|
||||
print(cp.PropsSI("d(Hmass)/d(T)|P", "P", 101325, "T", 300, "Water"))
|
||||
|
||||
|
||||
Installation
|
||||
------------
|
||||
|
||||
This wrapper comes with a support for both LuaJIT FFI and PUC-Lua C-API.
|
||||
|
||||
To build a shared library of CoolProp, follow the instructions listed here:
|
||||
http://www.coolprop.org/coolprop/wrappers/SharedLibrary/index.html
|
||||
|
||||
|
||||
**Installing with Make**
|
||||
|
||||
1. Run ``make``
|
||||
2. Run ``make install``
|
||||
3. Done.
|
||||
|
||||
**Manual Lua (PUC) Installation**
|
||||
|
||||
1. First you need to build shared library version of a CoolLib library and install it somewhere in your operating system's library search path.
|
||||
2. Next you need to compile ``coolprop/cpapi.c`` wrapper. Easiest way to do it is to run ``make`` on Lua wrapper's root folder.
|
||||
3. Then place the resulting ``coolprop/cpapi.so`` in your Lua's ``package.cpath``, and there under ``coolprop`` directory.
|
||||
4. Done.
|
||||
|
||||
**Manual LuaJIT Installation**
|
||||
|
||||
1. First you need to build shared library version of a CoolLib library and install it somewhere in your operating system's library search path.
|
||||
2. Next you need to place ``coolprop.lua`` and ``coolprop/ffi.lua`` somewhere in your LuaJIT's ``package.path`` so that the LuaJIT can pick them up.
|
||||
3. Done.
|
||||
|
||||
|
||||
Lua API
|
||||
-------
|
||||
|
||||
The functions will in general return ``nil`` on error.
|
||||
|
||||
**number, string coolprop.PropsSI(output, name1, prop1, name2, prop2, ref)**
|
||||
|
||||
For many users, all that is needed is a simple call to the ``PropsSI`` function for pure fluids, pseudo-pure fluids
|
||||
and mixtures. This function will return ``nil`` on error, and additional string that contains the error message.
|
||||
|
||||
::
|
||||
|
||||
local cp = require "coolprop"
|
||||
print(cp.PropsSI("C", "P", 101325, "T", 300, "Water"))
|
||||
print(cp.PropsSI("d(Hmass)/d(T)|P", "P", 101325, "T", 300, "Water"))
|
||||
print(cp.PropsSI("D", "P", 101325, "T", 300, "Air.mix"))
|
||||
|
||||
|
||||
**number, string coolprop.Props1SI(fluidname, output)**
|
||||
|
||||
::
|
||||
|
||||
local cp = require "coolprop"
|
||||
print(cp.Props1SI("Water", "Phase"))
|
||||
|
||||
|
||||
**string coolprop.PhaseSI(name1, prop1, name2, prop2, ref)**
|
||||
|
||||
::
|
||||
|
||||
local cp = require "coolprop"
|
||||
print(cp.PhaseSI("P", 101325, "Q", 0, "Water"))
|
||||
|
||||
|
||||
**number, string coolprop.HAPropsSI(output, name1, prop1, name2, prop2, name3, prop3)**
|
||||
|
||||
::
|
||||
|
||||
local cp = require "coolprop"
|
||||
print(cp.HAPropsSI('H','T',298.15,'P',101325,'R',0.5))
|
||||
|
||||
|
||||
**string coolprop.get_global_param_string(param)**
|
||||
|
||||
Returns global parameter string. On error, returns ``nil``.
|
||||
|
||||
::
|
||||
|
||||
local cp = require "coolprop"
|
||||
print(cp.get_global_param_string("predefined_mixtures"))
|
||||
|
||||
|
||||
**number coolprop.get_param_index(param)**
|
||||
|
||||
Returns parameter index.
|
||||
|
||||
::
|
||||
|
||||
local cp = require "coolprop"
|
||||
print(cp.get_param_index("T"))
|
||||
|
||||
|
||||
**number coolprop.F2K(f)**
|
||||
|
||||
This function converts fahrenheits to kelvins.
|
||||
|
||||
::
|
||||
|
||||
local cp = require "coolprop"
|
||||
print(10, "Fahrenheits is", cp.F2K(10) , "Kelvins")
|
||||
|
||||
|
||||
**number coolprop.K2F(f)**
|
||||
|
||||
This function converts kelvins to fahrenheits.
|
||||
|
||||
::
|
||||
|
||||
local cp = require "coolprop"
|
||||
print(cp.F2K(10), "Kelvins is", cp.K2F(cp.F2K(10)), "Fahrenheits")
|
||||
|
||||
|
||||
**string coolprop.error()**
|
||||
|
||||
Returns the last error occurred.
|
||||
|
||||
::
|
||||
|
||||
local cp = require "coolprop"
|
||||
print(cp.error())
|
||||
|
||||
|
||||
**string coolprop.FluidsList()**
|
||||
|
||||
Returns the list of available fluids.
|
||||
|
||||
::
|
||||
|
||||
local cp = require "coolprop"
|
||||
print(cp.FluidsList())
|
||||
|
||||
|
||||
**string coolprop.version()**
|
||||
|
||||
Returns the version of the CoolLib library that is installed.
|
||||
|
||||
::
|
||||
|
||||
local cp = require "coolprop"
|
||||
print(cp.version())
|
||||
|
||||
|
||||
**string coolprop.gitrevision()**
|
||||
|
||||
Returns the Git revision of the CoolLib library that is installed.
|
||||
|
||||
::
|
||||
|
||||
local cp = require "coolprop"
|
||||
print(cp.gitrevision())
|
||||
|
||||
|
||||
**number coolprop.get_debug_level()**
|
||||
|
||||
Returns the current debug level.
|
||||
|
||||
::
|
||||
|
||||
local cp = require "coolprop"
|
||||
print(cp.get_debug_level())
|
||||
|
||||
|
||||
**coolprop.set_debug_level(level)**
|
||||
|
||||
Sets the debug level.
|
||||
|
||||
::
|
||||
|
||||
local cp = require "coolprop"
|
||||
cp.set_debug_level(0)
|
||||
|
||||
|
||||
**boolean coolprop.redirect_stdout(file)**
|
||||
|
||||
Sets the output to a file (to given path of the file).
|
||||
|
||||
::
|
||||
|
||||
local cp = require "coolprop"
|
||||
cp.redirect_stdout("output.log")
|
||||
|
||||
|
||||
Additional APIs (TBD)
|
||||
---------------------
|
||||
|
||||
- **string coolprop.get_parameter_information_string(key)**
|
||||
- **number coolprop.get_mixture_binary_pair_data(cas1, cas2, key)**
|
||||
- **string coolprop.get_fluid_param_string(fluid, param)**
|
||||
- **boolean coolprop.set_reference_stateS(ref, state)**
|
||||
- **boolean coolprop.set_reference_stateD(ref, t, rho, h0, s0)**
|
||||
- **number, string coolprop.saturation_ancillary(fluid, output, q, input, value)**
|
||||
99
wrappers/Lua/coolprop.lua
Normal file
99
wrappers/Lua/coolprop.lua
Normal file
@@ -0,0 +1,99 @@
|
||||
if jit and jit.status() then
|
||||
return require "coolprop.ffi"
|
||||
end
|
||||
local huge = math.huge
|
||||
local ok, lib = pcall(require, "coolprop.capi")
|
||||
assert(ok, "Unable to load Lua CoolProp C API Wrapper.")
|
||||
local coolprop = {}
|
||||
function coolprop.Props1SI(fluidname, output)
|
||||
local v = lib.Props1SI(fluidname, output)
|
||||
if v == huge then
|
||||
return nil, coolprop.error()
|
||||
end
|
||||
return v
|
||||
end
|
||||
function coolprop.PropsSI(output, name1, prop1, name2, prop2, ref)
|
||||
local v = lib.PropsSI(output, name1, prop1, name2, prop2, ref)
|
||||
if v == huge then
|
||||
return nil, coolprop.error()
|
||||
end
|
||||
return v
|
||||
end
|
||||
function coolprop.PhaseSI(name1, prop1, name2, prop2, ref)
|
||||
local e, s = lib.PhaseSI(name1, prop1, name2, prop2, ref or "")
|
||||
return e == 1 and s or nil
|
||||
end
|
||||
function coolprop.get_global_param_string(param)
|
||||
local e, s = lib.get_global_param_string(param)
|
||||
if e == 1 then
|
||||
return s
|
||||
end
|
||||
return nil
|
||||
end
|
||||
function coolprop.get_parameter_information_string(key)
|
||||
local e, s = lib.get_parameter_information_string(key)
|
||||
if e == 0 then return nil end
|
||||
return s
|
||||
end
|
||||
function coolprop.get_mixture_binary_pair_data(cas1, cas2, key)
|
||||
return tonumber(lib.get_mixture_binary_pair_data(cas1, cas2, key))
|
||||
end
|
||||
function coolprop.get_fluid_param_string(fluid, param)
|
||||
if lib.get_fluid_param_string(fluid, param, bub, 4096) == 1 then
|
||||
return ffi_str(bub)
|
||||
end
|
||||
return nil
|
||||
end
|
||||
function coolprop.set_reference_stateS(ref, state)
|
||||
return lib.set_reference_stateS(ref, state) == 1
|
||||
end
|
||||
function coolprop.set_reference_stateD(ref, t, rho, h0, s0)
|
||||
return lib.set_reference_stateD(ref, t, rho, h0, s0) == 1
|
||||
end
|
||||
function coolprop.F2K(f)
|
||||
return lib.F2K(f)
|
||||
end
|
||||
function coolprop.K2F(k)
|
||||
return lib.K2F(k)
|
||||
end
|
||||
function coolprop.get_param_index(param)
|
||||
local value = lib.get_param_index(param)
|
||||
if value == -1 then return nil end
|
||||
tonumber(value)
|
||||
end
|
||||
function coolprop.saturation_ancillary(fluid, output, q, input, value)
|
||||
local v = lib.saturation_ancillary(fluid, output, q, input, value)
|
||||
if v == huge then
|
||||
return nil, coolprop.error()
|
||||
end
|
||||
return v
|
||||
end
|
||||
function coolprop.redirect_stdout(file)
|
||||
return lib.redirect_stdout(file) == 1
|
||||
end
|
||||
function coolprop.get_debug_level()
|
||||
return lib.get_debug_level()
|
||||
end
|
||||
function coolprop.set_debug_level(level)
|
||||
lib.set_debug_level(level)
|
||||
end
|
||||
function coolprop.HAPropsSI(output, name1, prop1, name2, prop2, name3, prop3)
|
||||
local v = lib.HAPropsSI(output, name1, prop1, name2, prop2, name3, prop3)
|
||||
if v == huge then
|
||||
return nil, coolprop.error()
|
||||
end
|
||||
return v
|
||||
end
|
||||
function coolprop.error()
|
||||
return coolprop.get_global_param_string("errstring")
|
||||
end
|
||||
function coolprop.FluidsList()
|
||||
return coolprop.get_global_param_string("FluidsList")
|
||||
end
|
||||
function coolprop.version()
|
||||
return coolprop.get_global_param_string("version")
|
||||
end
|
||||
function coolprop.gitrevision()
|
||||
return coolprop.get_global_param_string("gitrevision")
|
||||
end
|
||||
return coolprop
|
||||
168
wrappers/Lua/coolprop/capi.c
Normal file
168
wrappers/Lua/coolprop/capi.c
Normal file
@@ -0,0 +1,168 @@
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <lua.h>
|
||||
#include <lauxlib.h>
|
||||
#include "../../../include/CoolPropLib.h"
|
||||
#include "compat.h"
|
||||
static int lua_coolprop_Props1SI(lua_State *L) {
|
||||
lua_pushnumber(L, Props1SI(
|
||||
luaL_checkstring(L, 1),
|
||||
luaL_checkstring(L, 2)
|
||||
));
|
||||
return 1;
|
||||
}
|
||||
static int lua_coolprop_PropsSI(lua_State *L) {
|
||||
lua_pushnumber(L, PropsSI(
|
||||
luaL_checkstring(L, 1),
|
||||
luaL_checkstring(L, 2),
|
||||
luaL_checknumber(L, 3),
|
||||
luaL_checkstring(L, 4),
|
||||
luaL_checknumber(L, 5),
|
||||
luaL_checkstring(L, 6)
|
||||
));
|
||||
return 1;
|
||||
}
|
||||
static int lua_coolprop_PhaseSI(lua_State *L) {
|
||||
char phase[256];
|
||||
lua_pushinteger(L, PhaseSI(
|
||||
luaL_checkstring(L, 1),
|
||||
luaL_checknumber(L, 2),
|
||||
luaL_checkstring(L, 3),
|
||||
luaL_checknumber(L, 4),
|
||||
luaL_checkstring(L, 5),
|
||||
phase,
|
||||
sizeof(phase)
|
||||
));
|
||||
lua_pushstring(L, phase);
|
||||
return 2;
|
||||
}
|
||||
static int lua_coolprop_get_global_param_string(lua_State *L) {
|
||||
char output[4096];
|
||||
lua_pushinteger(L, get_global_param_string(
|
||||
luaL_checkstring(L, 1),
|
||||
output,
|
||||
sizeof(output)
|
||||
));
|
||||
lua_pushstring(L, output);
|
||||
return 2;
|
||||
}
|
||||
static int lua_coolprop_get_parameter_information_string(lua_State *L) {
|
||||
char output[4096];
|
||||
lua_pushinteger(L, get_parameter_information_string(
|
||||
luaL_checkstring(L, 1),
|
||||
output,
|
||||
sizeof(output)
|
||||
));
|
||||
lua_pushstring(L, output);
|
||||
return 2;
|
||||
}
|
||||
/*
|
||||
static int lua_coolprop_get_mixture_binary_pair_data(lua_State *L) {
|
||||
lua_pushinteger(L, get_mixture_binary_pair_data(
|
||||
luaL_checkstring(L, 1),
|
||||
luaL_checkstring(L, 2),
|
||||
luaL_checkstring(L, 3)
|
||||
));
|
||||
return 1;
|
||||
}
|
||||
*/
|
||||
static int lua_coolprop_get_fluid_param_string(lua_State *L) {
|
||||
char output[4096];
|
||||
lua_pushinteger(L, get_fluid_param_string(
|
||||
luaL_checkstring(L, 1),
|
||||
luaL_checkstring(L, 2),
|
||||
output,
|
||||
sizeof(output)
|
||||
));
|
||||
lua_pushstring(L, output);
|
||||
return 2;
|
||||
}
|
||||
static int lua_coolprop_set_reference_stateS(lua_State *L) {
|
||||
lua_pushinteger(L, set_reference_stateS(
|
||||
luaL_checkstring(L, 1),
|
||||
luaL_checkstring(L, 2)
|
||||
));
|
||||
return 1;
|
||||
}
|
||||
static int lua_coolprop_set_reference_stateD(lua_State *L) {
|
||||
lua_pushinteger(L, set_reference_stateD(
|
||||
luaL_checkstring(L, 1),
|
||||
luaL_checknumber(L, 2),
|
||||
luaL_checknumber(L, 3),
|
||||
luaL_checknumber(L, 4),
|
||||
luaL_checknumber(L, 5)
|
||||
));
|
||||
return 1;
|
||||
}
|
||||
static int lua_coolprop_F2K(lua_State *L) {
|
||||
lua_pushnumber(L, F2K(luaL_checknumber(L, 1)));
|
||||
return 1;
|
||||
}
|
||||
static int lua_coolprop_K2F(lua_State *L) {
|
||||
lua_pushnumber(L, K2F(luaL_checknumber(L, 1)));
|
||||
return 1;
|
||||
}
|
||||
static int lua_coolprop_get_param_index(lua_State *L) {
|
||||
lua_pushnumber(L, get_param_index(luaL_checkstring(L, 1)));
|
||||
return 1;
|
||||
}
|
||||
static int lua_coolprop_redirect_stdout(lua_State *L) {
|
||||
lua_pushnumber(L, redirect_stdout(
|
||||
luaL_checkstring(L, 1)
|
||||
));
|
||||
return 1;
|
||||
}
|
||||
static int lua_coolprop_get_debug_level(lua_State *L) {
|
||||
lua_pushinteger(L, get_debug_level());
|
||||
return 1;
|
||||
}
|
||||
static int lua_coolprop_set_debug_level(lua_State *L) {
|
||||
set_debug_level(luaL_checknumber(L, 1));
|
||||
return 0;
|
||||
}
|
||||
static int lua_coolprop_saturation_ancillary(lua_State *L) {
|
||||
lua_pushnumber(L, saturation_ancillary(
|
||||
luaL_checkstring(L, 1),
|
||||
luaL_checkstring(L, 2),
|
||||
luaL_checkinteger(L, 3),
|
||||
luaL_checkstring(L, 4),
|
||||
luaL_checknumber(L, 5)
|
||||
));
|
||||
return 1;
|
||||
}
|
||||
static int lua_coolprop_HAPropsSI(lua_State *L) {
|
||||
lua_pushnumber(L, HAPropsSI(
|
||||
luaL_checkstring(L, 1),
|
||||
luaL_checkstring(L, 2),
|
||||
luaL_checknumber(L, 3),
|
||||
luaL_checkstring(L, 4),
|
||||
luaL_checknumber(L, 5),
|
||||
luaL_checkstring(L, 6),
|
||||
luaL_checknumber(L, 7)
|
||||
));
|
||||
return 1;
|
||||
}
|
||||
static struct luaL_Reg funcs[] = {
|
||||
{"Props1SI", lua_coolprop_Props1SI},
|
||||
{"PropsSI", lua_coolprop_PropsSI},
|
||||
{"PhaseSI", lua_coolprop_PhaseSI},
|
||||
{"get_global_param_string", lua_coolprop_get_global_param_string},
|
||||
{"get_parameter_information_string", lua_coolprop_get_parameter_information_string},
|
||||
//{"get_mixture_binary_pair_data", lua_coolprop_get_mixture_binary_pair_data},
|
||||
{"get_fluid_param_string", lua_coolprop_get_fluid_param_string},
|
||||
{"set_reference_stateS", lua_coolprop_set_reference_stateS},
|
||||
{"set_reference_stateD", lua_coolprop_set_reference_stateD},
|
||||
{"F2K", lua_coolprop_F2K},
|
||||
{"K2F", lua_coolprop_K2F},
|
||||
{"get_param_index", lua_coolprop_get_param_index},
|
||||
{"redirect_stdout", lua_coolprop_redirect_stdout},
|
||||
{"get_debug_level", lua_coolprop_get_debug_level},
|
||||
{"set_debug_level", lua_coolprop_set_debug_level},
|
||||
{"saturation_ancillary", lua_coolprop_saturation_ancillary},
|
||||
{"HAPropsSI", lua_coolprop_HAPropsSI},
|
||||
{NULL, NULL}
|
||||
};
|
||||
int luaopen_coolprop_capi(lua_State *L) {
|
||||
luaL_newlib(L, funcs);
|
||||
return 1;
|
||||
}
|
||||
11
wrappers/Lua/coolprop/compat.h
Normal file
11
wrappers/Lua/coolprop/compat.h
Normal file
@@ -0,0 +1,11 @@
|
||||
#if !defined(__STDC_VERSION__) || !(__STDC_VERSION__ >= 199901L)
|
||||
# error C99 compiler required.
|
||||
#endif
|
||||
|
||||
#ifndef LUA_VERSION_NUM
|
||||
# error Lua >= 5.1 is required.
|
||||
#endif
|
||||
|
||||
#if LUA_VERSION_NUM < 502
|
||||
# define luaL_newlib(L, l) (lua_newtable(L), luaL_register(L, NULL, l))
|
||||
#endif
|
||||
129
wrappers/Lua/coolprop/ffi.lua
Normal file
129
wrappers/Lua/coolprop/ffi.lua
Normal file
@@ -0,0 +1,129 @@
|
||||
local ffi = require "ffi"
|
||||
local ffi_new = ffi.new
|
||||
local ffi_str = ffi.string
|
||||
local ffi_load = ffi.load
|
||||
local ffi_cdef = ffi.cdef
|
||||
local ffi_typeof = ffi.typeof
|
||||
local pcall = pcall
|
||||
local huge = math.huge
|
||||
ffi_cdef[[
|
||||
double Props1SI(const char *FluidName, const char* Output);
|
||||
double PropsSI(const char *Output, const char *Name1, double Prop1, const char *Name2, double Prop2, const char *Ref);
|
||||
long PhaseSI(const char *Name1, double Prop1, const char *Name2, double Prop2, const char *Ref, char *phase, int n);
|
||||
long get_global_param_string(const char *param, char *Output, int n);
|
||||
long get_parameter_information_string(const char *key, char *Output, int n);
|
||||
long get_mixture_binary_pair_data(const char *CAS1, const char *CAS2, const char *key);
|
||||
long get_fluid_param_string(const char *fluid, const char *param, char *Output, int n);
|
||||
int set_reference_stateS(const char *Ref, const char *reference_state);
|
||||
int set_reference_stateD(const char *Ref, double T, double rho, double h0, double s0);
|
||||
double F2K(double T_F);
|
||||
double K2F(double T_K);
|
||||
long get_param_index(const char *param);
|
||||
long redirect_stdout(const char *file);
|
||||
int get_debug_level();
|
||||
void set_debug_level(int level);
|
||||
double saturation_ancillary(const char *fluid_name, const char *output, int Q, const char *input, double value);
|
||||
double HAPropsSI(const char *Output, const char *Name1, double Prop1, const char *Name2, double Prop2, const char *Name3, double Prop3);
|
||||
]]
|
||||
local ok, newtab = pcall(require, "table.new")
|
||||
if not ok then newtab = function() return {} end end
|
||||
local but = ffi_typeof "char[?]"
|
||||
local buf = ffi_new(but, 256)
|
||||
local bub = ffi_new(but, 4096)
|
||||
local ok, lib = pcall(ffi_load, "CoolProp")
|
||||
if not ok then ok, lib = pcall(ffi_load, "coolprop") end
|
||||
assert(ok, "Unable to load CoolProp. Please check that the CoolProp shared library is in a default search path for dynamic libraries of your operating system.")
|
||||
local coolprop = newtab(0, 21)
|
||||
function coolprop.Props1SI(fluidname, output)
|
||||
local v = lib.Props1SI(fluidname, output)
|
||||
if v == huge then
|
||||
return nil, coolprop.error()
|
||||
end
|
||||
return v
|
||||
end
|
||||
function coolprop.PropsSI(output, name1, prop1, name2, prop2, ref)
|
||||
local v = lib.PropsSI(output, name1, prop1, name2, prop2, ref)
|
||||
if v == huge then
|
||||
return nil, coolprop.error()
|
||||
end
|
||||
return v
|
||||
end
|
||||
function coolprop.PhaseSI(name1, prop1, name2, prop2, ref)
|
||||
if lib.PhaseSI(name1, prop1, name2, prop2, ref or "", buf, 256) == 1 then
|
||||
return ffi_str(buf)
|
||||
end
|
||||
return nil
|
||||
end
|
||||
function coolprop.get_global_param_string(param)
|
||||
if lib.get_global_param_string(param, bub, 4096) == 1 then
|
||||
return ffi_str(bub)
|
||||
end
|
||||
return nil
|
||||
end
|
||||
function coolprop.get_parameter_information_string(key)
|
||||
local value = lib.get_parameter_information_string(key, bub, 4096)
|
||||
if value == 0 then return nil end
|
||||
return ffi_str(bub)
|
||||
end
|
||||
function coolprop.get_mixture_binary_pair_data(cas1, cas2, key)
|
||||
return tonumber(lib.get_mixture_binary_pair_data(cas1, cas2, key))
|
||||
end
|
||||
function coolprop.get_fluid_param_string(fluid, param)
|
||||
if lib.get_fluid_param_string(fluid, param, bub, 4096) == 1 then
|
||||
return ffi_str(bub)
|
||||
end
|
||||
return nil
|
||||
end
|
||||
function coolprop.set_reference_stateS(ref, state)
|
||||
return lib.set_reference_stateS(ref, state) == 1
|
||||
end
|
||||
function coolprop.set_reference_stateD(ref, t, rho, h0, s0)
|
||||
return lib.set_reference_stateD(ref, t, rho, h0, s0) == 1
|
||||
end
|
||||
function coolprop.F2K(f)
|
||||
return lib.F2K(f)
|
||||
end
|
||||
function coolprop.K2F(k)
|
||||
return lib.K2F(k)
|
||||
end
|
||||
function coolprop.get_param_index(param)
|
||||
local value = lib.get_param_index(param)
|
||||
if value == -1 then return nil end
|
||||
tonumber(value)
|
||||
end
|
||||
function coolprop.saturation_ancillary(fluid, output, q, input, value)
|
||||
local v = lib.saturation_ancillary(fluid, output, q, input, value)
|
||||
if v == huge then
|
||||
return nil, coolprop.error()
|
||||
end
|
||||
return v
|
||||
end
|
||||
function coolprop.redirect_stdout(file)
|
||||
return lib.redirect_stdout(file) == 1
|
||||
end
|
||||
function coolprop.get_debug_level()
|
||||
return lib.get_debug_level()
|
||||
end
|
||||
function coolprop.set_debug_level(level)
|
||||
lib.set_debug_level(level)
|
||||
end
|
||||
function coolprop.HAPropsSI(output, name1, prop1, name2, prop2, name3, prop3)
|
||||
local v = lib.HAPropsSI(output, name1, prop1, name2, prop2, name3, prop3)
|
||||
if v == huge then
|
||||
return nil, coolprop.error()
|
||||
end
|
||||
return v
|
||||
end
|
||||
function coolprop.error()
|
||||
return coolprop.get_global_param_string("errstring")
|
||||
end
|
||||
function coolprop.FluidsList()
|
||||
return coolprop.get_global_param_string("FluidsList")
|
||||
end
|
||||
function coolprop.version()
|
||||
return coolprop.get_global_param_string("version")
|
||||
end
|
||||
function coolprop.gitrevision()
|
||||
return coolprop.get_global_param_string("gitrevision")
|
||||
end
|
||||
return coolprop
|
||||
41
wrappers/Lua/example.lua
Normal file
41
wrappers/Lua/example.lua
Normal file
@@ -0,0 +1,41 @@
|
||||
local cp = require "coolprop"
|
||||
|
||||
print[[
|
||||
|
||||
Information Examples
|
||||
====================
|
||||
]]
|
||||
print("Version", cp.version())
|
||||
print("gitrevision", cp.gitrevision())
|
||||
print("FluidsList", cp.FluidsList())
|
||||
print("Debug Level", cp.get_debug_level())
|
||||
print()
|
||||
print[[
|
||||
|
||||
Usage Examples
|
||||
==============
|
||||
]]
|
||||
print(cp.Props1SI("Water", "Phase"))
|
||||
print(cp.PropsSI("C", "P", 101325, "T", 300, "Water"))
|
||||
print(cp.PropsSI("d(Hmass)/d(T)|P", "P", 101325, "T", 300, "Water"))
|
||||
print(cp.PropsSI("D", "P", 101325, "T", 300, "Air.mix"))
|
||||
print(cp.PhaseSI("P", 101325, "Q", 0, "Water"))
|
||||
print(cp.get_global_param_string("predefined_mixtures"))
|
||||
print(cp.get_param_index("T"))
|
||||
print(cp.HAPropsSI('H','T',298.15,'P',101325,'R',0.5))
|
||||
print(10, "Fahrenheits is", cp.F2K(10) , "Kelvins")
|
||||
print(cp.F2K(10), "Kelvins is", cp.K2F(cp.F2K(10)), "Fahrenheits")
|
||||
print()
|
||||
print[[
|
||||
|
||||
Error Examples
|
||||
==============
|
||||
]]
|
||||
print(cp.Props1SI("Error", "Phase"))
|
||||
print(cp.PropsSI("Error", "T", 298.15, "P", 101325, "Nitrogen"))
|
||||
print(cp.PhaseSI("Error", 101325, "Q", 0, "Water"))
|
||||
print(cp.get_parameter_information_string("Error")) -- What are the correct inputs for this?
|
||||
print(cp.saturation_ancillary("Water", "C", 10, "Error", 300)) -- What are the correct inputs for this?
|
||||
print(cp.HAPropsSI('Error','T',298.15,'P',101325,'R',0.5))
|
||||
print(cp.get_param_index("Error"))
|
||||
print()
|
||||
90
wrappers/Lua/lualib.mk
Normal file
90
wrappers/Lua/lualib.mk
Normal file
@@ -0,0 +1,90 @@
|
||||
# Lua pkg-config utilities for GNU Make.
|
||||
# Copyright (c) 2013-2015, Craig Barnes.
|
||||
#
|
||||
# Permission to use, copy, modify, and/or distribute this software for any
|
||||
# purpose with or without fee is hereby granted, provided that the above
|
||||
# copyright notice and this permission notice appear in all copies.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
# SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
|
||||
# OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||
# CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
-include local.mk
|
||||
|
||||
CC ?= gcc
|
||||
LDFLAGS ?= $(if $(ISDARWIN), -bundle -undefined dynamic_lookup, -shared)
|
||||
XLDFLAGS += $(if $(ISLINUX), $(NOASNEEDED))
|
||||
NOASNEEDED = -Wl,--no-as-needed
|
||||
PKGCONFIG ?= pkg-config --silence-errors 2>/dev/null
|
||||
MKDIR ?= mkdir -p
|
||||
INSTALL ?= install -p -m 0644
|
||||
INSTALLX ?= install -p -m 0755
|
||||
RM ?= rm -f
|
||||
LUA ?= $(or $(LUA_WHICH), $(error No Lua interpreter found))
|
||||
|
||||
PC_EXISTS = $(PKGCONFIG) --exists $(1) && echo $(1)
|
||||
FIND_PC = $(shell for P in $(1); do $(call PC_EXISTS, $$P) && break; done)
|
||||
EQUAL = $(and $(findstring $(1),$(2)),$(findstring $(2),$(1)))
|
||||
UNAME = $(shell uname)
|
||||
ISDARWIN = $(call EQUAL, $(UNAME), Darwin)
|
||||
ISLINUX = $(call EQUAL, $(UNAME), Linux)
|
||||
|
||||
CCOPTIONS = $(XCFLAGS) $(CPPFLAGS) $(CFLAGS)
|
||||
LDOPTIONS = $(XLDFLAGS) $(LDFLAGS) $(LDLIBS)
|
||||
|
||||
# The naming of Lua pkg-config files across distributions is a mess:
|
||||
# - Fedora and Arch use lua.pc
|
||||
# - Debian uses lua5.2.pc and lua5.1.pc
|
||||
# - OpenBSD ports uses lua52.pc and lua51.pc
|
||||
# - FreeBSD uses lua-5.2.pc and lua-5.1.pc
|
||||
LUA_NAMES = lua52 lua5.2 lua-5.2 lua51 lua5.1 lua-5.1 lua luajit
|
||||
LUA_WHICH = $(firstword $(shell which $(_LUA_PC) $(LUA_NAMES) 2>/dev/null))
|
||||
|
||||
LUA_PC ?= $(or \
|
||||
$(call FIND_PC, $(LUA_NAMES)), \
|
||||
$(error No pkg-config file found for Lua) \
|
||||
)
|
||||
|
||||
# The $(LUA_PC) variable may be set to a non-existant name via the
|
||||
# command-line, so we must check that it exists (possibly twice).
|
||||
_LUA_PC = $(or \
|
||||
$(shell $(call PC_EXISTS, $(LUA_PC))), \
|
||||
$(error No pkg-config file found with name '$(LUA_PC)') \
|
||||
)
|
||||
|
||||
# Some distros put the Lua headers in versioned sub-directories
|
||||
# and thus require extra CFLAGS
|
||||
LUA_CFLAGS ?= $(shell $(PKGCONFIG) --cflags $(_LUA_PC))
|
||||
|
||||
# Some pkg-config files have convenient variables for module paths
|
||||
LUA_PC_LMOD = $(shell $(PKGCONFIG) --variable=INSTALL_LMOD $(_LUA_PC))
|
||||
LUA_PC_CMOD = $(shell $(PKGCONFIG) --variable=INSTALL_CMOD $(_LUA_PC))
|
||||
|
||||
# Others force us to piece them together from parts...
|
||||
LUA_PREFIX ?= $(shell $(PKGCONFIG) --variable=prefix $(_LUA_PC))
|
||||
LUA_LIBDIR ?= $(shell $(PKGCONFIG) --variable=libdir $(_LUA_PC))
|
||||
LUA_INCDIR ?= $(shell $(PKGCONFIG) --variable=includedir $(_LUA_PC))
|
||||
LUA_VERSION ?= $(shell $(PKGCONFIG) --modversion $(_LUA_PC) | grep -o '^.\..')
|
||||
|
||||
LUA_LMOD_DIR ?= $(strip $(if $(LUA_PC_LMOD), $(LUA_PC_LMOD), \
|
||||
$(LUA_PREFIX)/share/lua/$(LUA_VERSION)))
|
||||
|
||||
LUA_CMOD_DIR ?= $(strip $(if $(LUA_PC_CMOD), $(LUA_PC_CMOD), \
|
||||
$(LUA_LIBDIR)/lua/$(LUA_VERSION)))
|
||||
|
||||
LUA_HEADERS ?= $(addprefix $(LUA_INCDIR)/, lua.h lauxlib.h)
|
||||
|
||||
|
||||
%.so: %.o
|
||||
$(CC) $(LDOPTIONS) -o $@ $<
|
||||
|
||||
%.o: %.c
|
||||
$(CC) $(CCOPTIONS) -c -o $@ $<
|
||||
|
||||
|
||||
.DELETE_ON_ERROR:
|
||||
.SECONDARY:
|
||||
@@ -223,6 +223,12 @@ cpdef PropsSI(in1, in2, in3 = None, in4 = None, in5 = None, in6 = None, in7 = No
|
||||
is_iterable1 = iterable(in1)
|
||||
is_iterable3 = iterable(in3)
|
||||
is_iterable5 = iterable(in5)
|
||||
|
||||
if _numpy_supported and is_iterable3 and isinstance(in3, np.ndarray) and (np.prod(in3.shape) != max(in3.shape)):
|
||||
raise ValueError("Input 3 is not one-dimensional")
|
||||
if _numpy_supported and is_iterable5 and isinstance(in5, np.ndarray) and (np.prod(in5.shape) != max(in5.shape)):
|
||||
raise ValueError("Input 5 is not one-dimensional")
|
||||
|
||||
if is_iterable1 or is_iterable3 or is_iterable5:
|
||||
# Prepare the output datatype
|
||||
if not is_iterable1:
|
||||
@@ -248,9 +254,9 @@ cpdef PropsSI(in1, in2, in3 = None, in4 = None, in5 = None, in6 = None, in7 = No
|
||||
vval1 = templist
|
||||
vval2 = in5
|
||||
else:
|
||||
vval.resize(1)
|
||||
vval1[0] = in3
|
||||
vval1.resize(1)
|
||||
vval1[0] = in3
|
||||
vval2.resize(1)
|
||||
vval2[0] = in5
|
||||
|
||||
# Extract the backend and the fluid from the input string
|
||||
|
||||
36
wrappers/VB.NET/CoolPropVB/CoolPropVB.sln
Normal file
36
wrappers/VB.NET/CoolPropVB/CoolPropVB.sln
Normal file
@@ -0,0 +1,36 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Express 2012 for Windows Desktop
|
||||
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "CoolPropVB", "CoolPropVB\CoolPropVB.vbproj", "{221A231D-EA9F-451E-A648-ADB53E43814B}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CsharpClassLibrary", "CsharpClassLibrary\CsharpClassLibrary.csproj", "{DEC3B691-4510-4181-89EE-7A4A495936A6}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Debug|x64 = Debug|x64
|
||||
Release|Any CPU = Release|Any CPU
|
||||
Release|x64 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{221A231D-EA9F-451E-A648-ADB53E43814B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{221A231D-EA9F-451E-A648-ADB53E43814B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{221A231D-EA9F-451E-A648-ADB53E43814B}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{221A231D-EA9F-451E-A648-ADB53E43814B}.Debug|x64.Build.0 = Debug|x64
|
||||
{221A231D-EA9F-451E-A648-ADB53E43814B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{221A231D-EA9F-451E-A648-ADB53E43814B}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{221A231D-EA9F-451E-A648-ADB53E43814B}.Release|x64.ActiveCfg = Release|x64
|
||||
{221A231D-EA9F-451E-A648-ADB53E43814B}.Release|x64.Build.0 = Release|x64
|
||||
{DEC3B691-4510-4181-89EE-7A4A495936A6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{DEC3B691-4510-4181-89EE-7A4A495936A6}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{DEC3B691-4510-4181-89EE-7A4A495936A6}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{DEC3B691-4510-4181-89EE-7A4A495936A6}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{DEC3B691-4510-4181-89EE-7A4A495936A6}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{DEC3B691-4510-4181-89EE-7A4A495936A6}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{DEC3B691-4510-4181-89EE-7A4A495936A6}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{DEC3B691-4510-4181-89EE-7A4A495936A6}.Release|x64.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
6
wrappers/VB.NET/CoolPropVB/CoolPropVB/App.config
Normal file
6
wrappers/VB.NET/CoolPropVB/CoolPropVB/App.config
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
|
||||
</startup>
|
||||
</configuration>
|
||||
111
wrappers/VB.NET/CoolPropVB/CoolPropVB/CoolPropVB.vbproj
Normal file
111
wrappers/VB.NET/CoolPropVB/CoolPropVB/CoolPropVB.vbproj
Normal file
@@ -0,0 +1,111 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{221A231D-EA9F-451E-A648-ADB53E43814B}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<StartupObject>CoolPropVB.Example</StartupObject>
|
||||
<RootNamespace>CoolPropVB</RootNamespace>
|
||||
<AssemblyName>CoolPropVB</AssemblyName>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<MyType>Console</MyType>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<DefineDebug>true</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DocumentationFile>CoolPropVB.xml</DocumentationFile>
|
||||
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<DefineDebug>false</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DocumentationFile>CoolPropVB.xml</DocumentationFile>
|
||||
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<OptionExplicit>On</OptionExplicit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<OptionCompare>Binary</OptionCompare>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<OptionStrict>Off</OptionStrict>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<OptionInfer>On</OptionInfer>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DefineDebug>true</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<OutputPath>bin\x64\Debug\</OutputPath>
|
||||
<DocumentationFile>CoolPropVB.xml</DocumentationFile>
|
||||
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<CodeAnalysisRuleSet>ManagedMinimumRules.ruleset</CodeAnalysisRuleSet>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<OutputPath>bin\x64\Release\</OutputPath>
|
||||
<DocumentationFile>CoolPropVB.xml</DocumentationFile>
|
||||
<Optimize>true</Optimize>
|
||||
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<CodeAnalysisRuleSet>ManagedMinimumRules.ruleset</CodeAnalysisRuleSet>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Deployment" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Import Include="Microsoft.VisualBasic" />
|
||||
<Import Include="System" />
|
||||
<Import Include="System.Collections" />
|
||||
<Import Include="System.Collections.Generic" />
|
||||
<Import Include="System.Data" />
|
||||
<Import Include="System.Diagnostics" />
|
||||
<Import Include="System.Linq" />
|
||||
<Import Include="System.Xml.Linq" />
|
||||
<Import Include="System.Threading.Tasks" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Example.vb" />
|
||||
<ProjectReference Include="..\CsharpClassLibrary\CsharpClassLibrary.csproj">
|
||||
<Project>{dec3b691-4510-4181-89ee-7a4a495936a6}</Project>
|
||||
<Name>CsharpClassLibrary</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="CoolProp.dll">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
19
wrappers/VB.NET/CoolPropVB/CoolPropVB/Example.vb
Normal file
19
wrappers/VB.NET/CoolPropVB/CoolPropVB/Example.vb
Normal file
@@ -0,0 +1,19 @@
|
||||
Module Example
|
||||
|
||||
Sub Main()
|
||||
' High-level interface example
|
||||
Dim Tbp As Double
|
||||
Tbp = CoolProp.CoolProp.PropsSI("T", "P", 101325, "Q", 0, "Water")
|
||||
Console.Write(Tbp)
|
||||
Console.Write(vbCrLf)
|
||||
|
||||
' Low-level interface example
|
||||
Dim Water As CoolProp.AbstractState
|
||||
Water = CoolProp.AbstractState.factory("HEOS", "Water")
|
||||
Water.update(CoolProp.input_pairs.PQ_INPUTS, 101325, 0)
|
||||
Console.Write(Water.T())
|
||||
Console.Write(vbCrLf)
|
||||
|
||||
End Sub
|
||||
|
||||
End Module
|
||||
@@ -0,0 +1,52 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{DEC3B691-4510-4181-89EE-7A4A495936A6}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>ClassLibrary1</RootNamespace>
|
||||
<AssemblyName>CsharpClassLibrary</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="*.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
@@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("CoolProp")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("CoolProp")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2015")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("8a84d196-96fc-47c6-b341-ed1ade8ee040")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
Reference in New Issue
Block a user