Commit Graph

56 Commits

Author SHA1 Message Date
Ian Bell
e66825cb93 Add a method for getting the fluid_param string length
Also update the error message
2025-05-04 18:15:33 -04:00
k-collie
1d98aa9f6a Include stdbool for C interface (#2342)
* Include stdbool for C interface

* Maintain pre-C99 compatibility
2024-01-09 12:54:07 -05:00
Jorrit Wronski
cbd53f344b Reformatted the code from #2317 and moved out of the deprecated section. Maybe @CSchulzeTLK can add the doxygen documentation? That would be awesome :-) 2023-11-28 11:21:23 +01:00
Christian Schulze
2cbcc5e236 New C Interface Functions (#2317)
* add more interface functions

* fix phase data type, "const*const"->"const*"
2023-11-28 11:15:33 +01:00
chrishauptmannAtEsiGroup
c525537175 Added second_partial_deriv and first_two_phase_deriv (#2291)
* Added AbstractState_second_partial_deriv and AbstractState_first_two_phase_deriv to CoolProp.dll

* added functions:  first_two_phase_deriv_splined, second_two_phase_deriv

---------

Co-authored-by: Chris Hauptmann <chn@esi-group.com>
2023-09-15 07:17:14 -04:00
chris-hampel-CA
36d91f178d Add fugacity functions needed for compatability with CoolProp.jl pkg (#2286)
* attempt to add fugacity functions needed for CoolProp.jl

* address first round of PR edits

change std:size_t to long
remove get_fugacity_coefficients
add .def exports

* remove fugacity refs in CoolPropLib.def
2023-09-07 21:09:50 -04:00
Friederike Boehm
c4cf52b671 AbstractState functions for CoolPropLib (#2135)
* Add AbstractState functions to CoolPropLib
AbstractState_get_mole_fractions_satState
AbstractState_keyed_output_satState
AbstractState_backend_name
add_fluids_as_JSON

* Overloaded AbstractState_get_phase_envelope_data and appended checkedMemory to function name
2022-06-07 08:26:10 -04:00
Friederike Boehm
44325d9e6a Add Props1SImulti and PropsSImulti to CoolPropLib (#2133)
Props1SImulti new function in CoolProp
2022-05-17 20:13:57 -04:00
Julien Marrec
6913fc41dc Format macros, they keep getting picked incrementally by clang format + Strip trailing whitespaces
```
find . -regextype posix-extended -regex '.*\.(cpp|hpp|c|h|cxx|hxx|py)$' | xargs -I@ sed -i 's/[ \t]*$//' "@"
```
2022-04-01 07:39:35 -04:00
Julien Marrec
05c8cf503b Lint: use automated tooling to reformat C++ and CMakeLists files (#2103)
* Add initial clang tidy / clang format config files

* Clang format the entire codebase

```
find ./src -regextype posix-extended -regex '.*\.(cpp|hpp|c|h|cxx|hxx)$' | xargs clang-format-12 -style=file -i -fallback-style=none
find ./include -regextype posix-extended -regex '.*\.(cpp|hpp|c|h|cxx|hxx)$' | xargs clang-format-12 -style=file -i -fallback-style=none
find ./Web -regextype posix-extended -regex '.*\.(cpp|hpp|c|h|cxx|hxx)$' | xargs clang-format-12 -style=file -i -fallback-style=none
find ./dev -regextype posix-extended -regex '.*\.(cpp|hpp|c|h|cxx|hxx)$' | xargs clang-format-12 -style=file -i -fallback-style=none
find ./wrappers -regextype posix-extended -regex '.*\.(cpp|hpp|c|h|cxx|hxx)$' | xargs clang-format-12 -style=file -i -fallback-style=none
```

* Add a .cmake-format file and reformat CmakeLists.txt with it

https://github.com/cheshirekow/cmake_format

* Add a clang-format workflow


only runs on PRs, only on touched files
2022-03-31 10:51:48 -04:00
friederikeboehm
5b8496f9da Add functions to CoolPropLib (#2084)
Add functions to CoolPropLib: AbstractState_get_mole_fractions and AbstractState_fluid_names
2022-02-02 19:04:51 -05:00
Ian Bell
260ba2489a Fix typo in CoolPropLib.h (#1450) 2017-03-09 19:05:45 -07:00
Reza Afzalan
b1451ab4a6 Update CoolPropLib.h (#1383)
* Update CoolPropLib.h , closes #1379

Update CoolPropLib.h , closes #1379

* Update HumidAirProp.cpp

#1379

* Update CoolPropLib.h

#1379
2017-01-03 18:15:22 -07:00
Ian Bell
3551bb52a9 Remove ununsed functions from DLL header 2016-11-04 22:48:45 -06:00
Ian Bell
669fe8cdb7 Update set_departure_function API in shared library; see #1317 2016-11-04 22:17:21 -06:00
JonWel
bc57d1401c Export cubic's alpha functions (#1302)
* Export setting of cubic alpha function
2016-10-31 08:27:55 -06:00
Ian Bell
64694b5beb Export set_config_bool to DLL 2016-10-31 07:53:14 -06:00
Ian Bell
d61c365215 Parse refprop HMX.BNC file and load coefficients (#1304)
* Add parser for HMX.BNC from REFPROP; closes #1294

Also move configuration variables into main pybind11 module

* Add the ability to over-write departure functions and binary interaction parameters
2016-10-30 21:26:05 -06:00
Ian Bell
cd5d9e265b Specify the minimum delta for spinodal tracer as config variable; closes #1295
Uses the key SPINODAL_MINIMUM_DELTA
2016-10-27 21:39:05 -06:00
Ian Bell
156b3e5cb9 Export spinodal curves in DLL; closes #1273 2016-10-17 20:06:08 -06:00
Ian Bell
ffbba512da Fix indent 2016-10-17 19:56:08 -06:00
Ian Bell
91704a450b Export critical points in DLL; closes #1274 2016-10-17 19:55:25 -06:00
Ian Bell
c929e92b3d Build/retrieve phase envelope through high-level DLL; closes #1158 2016-10-13 19:35:36 -06:00
Ian Bell
3e9ca1fbf4 Remove non-c types from CoolPropLib.[cpp/h]
@JonWel - watch out for the use of C++ types in C header
2016-08-21 12:45:35 -06:00
Ian Bell
57584a7254 Merge VTPR (#1195)
* Added first working version of VTPR;

* Get VTPR building hopefully

* Remove more constant iterators

* Make VTPR accessible through factory

* One last const iterator

* Fix a_alpha bug and make sqrt(2) into sqrt(2.0)

* Added analytic first derivative for VTPR

* Fix another set of sqrt(2) -> sqrt(2.0)

* Add some info on the derivatives for VTPR

Looks less hopeless than I had feared

* gE/RT needs to be multiplied by RT; closes #1161

* Added first working version of VTPR;

* Get VTPR building hopefully

* Remove more constant iterators

* Make VTPR accessible through factory

* One last const iterator

* Fix a_alpha bug and make sqrt(2) into sqrt(2.0)

* Added analytic first derivative for VTPR

* Fix another set of sqrt(2) -> sqrt(2.0)

* Add some info on the derivatives for VTPR

Looks less hopeless than I had feared

* gE/RT needs to be multiplied by RT; closes #1161

* Add VTPR code from @JonWel (#1194)

* 1rst draft to implement a simple volume translation to cubics

* A bit more of VT

* Derivatives for volume translation

* Better cm initialisation

* Solves the cubic equation with volume translation

* Correct the volume translation analytic development
Looks good now

* Update VTPR to be able to use volume translation

* Unprotect cm_term
This allows it to be used from the VTPR backend

* Update CoolPropLib.def

* Better derrivative of PI_12

The expression is simpler this way

* Solves #1176
Thanks @ibell

* Change the way the volume translation parrameter is set

* Start the bm derivatives for VTPR

* Correct one derivative

* Small bug

* Better bm derivatives for VTPR

* Add am and bm component derivatives for VTPR
@ibell I did not check yet the component derivatives of this commit, bu I checked the other ones with your code.
I'll have to addapt your code to also check these ones.

I separate the `am_term` and `bm_term` as the `am_bm_term` function was called twice. This reduce the call to the am_term part as this part ends up being called only once, and this helped writing the component derivatives.

The tau derivative is done numerically untill we find time to develop the analytical one.

The `am_bm_term` function started with a `set_temperature()`. I did not checked yet why this is needed and put this set temperature at the beginning of each of the `am_term` component derivatives.

I'll try to addapt the checking code tomorow.

* tab to spaces

* Re-writing of cubic coefficients
Introducing 3 intermediary varriables that simplify the cubic's coefficient with the volume translation.

* 1rst draft to implement a simple volume translation to cubics

* A bit more of VT

* Derivatives for volume translation

* Better cm initialisation

* Solves the cubic equation with volume translation

* Correct the volume translation analytic development
Looks good now

* Update VTPR to be able to use volume translation

* Unprotect cm_term
This allows it to be used from the VTPR backend

* Update CoolPropLib.def

* Better derrivative of PI_12

The expression is simpler this way

* Solves #1176
Thanks @ibell

* Change the way the volume translation parrameter is set

* Start the bm derivatives for VTPR

* Correct one derivative

* Small bug

* Better bm derivatives for VTPR

* Add am and bm component derivatives for VTPR
@ibell I did not check yet the component derivatives of this commit, bu I checked the other ones with your code.
I'll have to addapt your code to also check these ones.

I separate the `am_term` and `bm_term` as the `am_bm_term` function was called twice. This reduce the call to the am_term part as this part ends up being called only once, and this helped writing the component derivatives.

The tau derivative is done numerically untill we find time to develop the analytical one.

The `am_bm_term` function started with a `set_temperature()`. I did not checked yet why this is needed and put this set temperature at the beginning of each of the `am_term` component derivatives.

I'll try to addapt the checking code tomorow.

* tab to spaces

* Re-writing of cubic coefficients
Introducing 3 intermediary varriables that simplify the cubic's coefficient with the volume translation.
2016-08-21 12:34:55 -06:00
JonWel
75da119182 Export set_config_string, closes #1160 (#1163) 2016-07-19 08:08:38 -06:00
JonWel
579bba98c4 Export specify_phase() to the library, closes #1133 (#1134)
* Cubic calc_molar_mass, closes #1124

* Add simplified update and output functions
This allows simpler use of the low level interface by using the strings name instead of the parameter number.
The parameter number version stays and will be faster for more than one call with the same parameter.

* Add AbstractState_update_and_1_out

* Export specify_phase() to the library

* small correction
Safer to only accept an array of real numbers here.

* Small correction
Specifying the type of the array to avoid any convertion
2016-06-22 21:57:13 -06:00
Ian Bell
c16a4b64f5 Fix integer types in #1114 2016-06-08 07:30:28 -06:00
JonWel
afeca6a8b2 Export set_binary_interaction_double + Julia wrapper improvement (#1114)
* Precompiling of Julia Wrapper only for Julia 0.4+
Should allow to keep compatibility with Julia 0.3

* Export set_binary_interaction_double
to the shared library and add it to Julia Wrapper

* Correct comment in previous commit

* Change tab to spaces in precendent commit

* Add update_and_*_out functions

Add `AbstractState_update_and_common_out` and `AbstractState_update_and_5_out` to the wrapper

* Update .gitignore
2016-06-08 07:19:14 -06:00
Ian Bell
154de451fe Fix set_reference_stateD(); closes #1091
Now all inputs are molar, and the function actually works!
2016-06-05 15:16:02 -06:00
JonWel
a5c7886e47 Export first_partial_deriv to DLL wrapper of AbstractState, see #946 (#1062) 2016-05-11 07:10:51 -06:00
Ian Bell
3c24e94a28 Copy PlatformDetermination.h into the top of CoolPropLib.h; see #946 2016-05-06 18:21:01 -06:00
Ian Bell
9ec2acc664 Add cair_sat to DLL/SO; closes #1005 2016-03-24 17:31:18 -06:00
Ian Bell
dce9e5ea0e Fix a bunch of doxygen comments 2016-01-09 14:26:20 -07:00
Ian Bell
240165006a Add an accessor function to DLL to allow for getting multiple outputs at once from low-level interface
see #888
see #880
2015-12-13 00:15:24 -07:00
Ian Bell
4b8bd14d93 Add first_saturation_deriv to high-level interface around AbstractState; closes #835 2015-10-16 14:37:02 +02:00
Ian Bell
c063a40183 Implement a wrapper of AbstractState that can be called through the shared library
Closes #508
Closes #497

Sample code:

```
    #include "CoolPropLib.h"

    const long buffer_length = 255;
    char message_buffer[buffer_length];
    long errcode = 0;
    const long N = 2;
    double fractions[N] = {0.5, 0.5};
    long T_param = get_param_index("T");
    long PQ = get_input_pair_index("PQ_INPUTS");

    long handle = AbstractState_factory("HEOS", "Water&Ethanol", &errcode, message_buffer, buffer_length);
    AbstractState_set_fractions(handle, fractions, N, &errcode, message_buffer, buffer_length);
    AbstractState_update(handle, PQ, 101325, 0,  &errcode, message_buffer, buffer_length);
    double Tc = AbstractState_keyed_output(handle, T_param, &errcode, message_buffer, buffer_length);
    AbstractState_free(handle, &errcode, message_buffer, buffer_length);
```
2015-03-01 15:30:31 -07:00
mikekaganski
28691e8e75 const, ref and iterator optimization
1. Another set of arguments optimized:
* args-by-val converted to args-by-ref
* in some cases, reverse has been done, if that is better: if the
object's copy is modified in the func, it's better to avoid extra copy
from arg to local var
2. some const functions marked as such (this is just a beginning)
3. iterators were replaced with const_iterators where applicable
4. catches that catch std::exception& changed to catch (...) - that is
safer; if exception handling is restructured, this will have to be
reconsidered anyway
5. removed some basic structures' constructors; changed them to hold
const char*s to avoid unnecessary string constructions;
6. in some places, moved variable declarations to their definitions, to
avoid calling default constructors and then assigning
7. removed some unnecessary shared_pointers in favor of local objects;
8. in FORTRAN-style functions, added const specifiers to input doubles;
9. fixed a place where values were inserted into a map while iterating
through it
10. fixed is_valid_*_derivative: they could accept incorrect values and
throw when upper index is less than lower
2015-03-01 10:51:01 +10:00
Ian Bell
2495df75ed Catch exceptions in High-Level API; Closes #441
Signed-off-by: Ian Bell <ian.h.bell@gmail.com>
2015-01-30 05:00:31 -07:00
Ian Bell
2285e3b8c9 Removed some more functions
Signed-off-by: Ian Bell <ian.h.bell@gmail.com>
2014-12-26 22:23:01 -05:00
Ian Bell
d064baf230 Fix bug with PhaseSI function (at DLL level) taking Output parameter as first parameter
Signed-off-by: Ian Bell <ian.h.bell@gmail.com>
2014-12-18 18:18:45 -06:00
Ian Bell
41fc9b1144 saturation ancillaries are now exposed through the high-level API
Closes https://github.com/CoolProp/CoolProp/issues/225

Signed-off-by: Ian Bell <ian.h.bell@gmail.com>
2014-11-24 13:06:37 -05:00
Ian Bell
919d155602 Fixed functions in the dll export to require the length of the output string to be supplied
See https://github.com/CoolProp/CoolProp/issues/228

Should be fixed now

Signed-off-by: Ian Bell <ian.h.bell@gmail.com>
2014-11-20 18:39:33 -05:00
Ian Bell
babae66294 Fix typo in header
Signed-off-by: Ian Bell <ian.h.bell@gmail.com>
2014-11-19 23:07:33 -05:00
Ian Bell
ec3f4033f4 Try to fix __assert linking problem on VxWorks according to https://rowley.zendesk.com/entries/46176--Undefined-reference-to-assert-error-message
Signed-off-by: Ian Bell <ian.h.bell@gmail.com>
2014-11-19 23:04:17 -05:00
Ian Bell
82faac7a14 Improve docs for DLL
See https://github.com/CoolProp/CoolProp/issues/222

Signed-off-by: Ian Bell <ian.h.bell@gmail.com>
2014-11-19 12:00:26 -05:00
Ian Bell
9299cb8e07 Re-implements HAProps function at the C++ level.
Closes https://github.com/CoolProp/CoolProp/issues/182

Signed-off-by: Ian Bell <ian.h.bell@gmail.com>
2014-10-22 21:32:22 +00:00
Ian Bell
1416f62682 Fixed bug with second linkage problem with CoolPropLib
Signed-off-by: Ian Bell <ian.h.bell@gmail.com>
2014-10-15 21:37:23 +02:00
Ian Bell
e049485def Docs for PhaseSI copying
Signed-off-by: Ian Bell <ian.h.bell@gmail.com>
2014-10-14 15:23:37 +02:00
Ian Bell
199ced3f86 Implemented Phase output again
Added PhaseSI function which will return phase for given input - exposed to DLL
PropsSI can also return phase as double if "Phase" is the input

Signed-off-by: Ian Bell <ian.h.bell@gmail.com>
2014-10-14 11:21:07 +02:00