Commit Graph

693 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
Ian Bell
50fa2dc2b2 Cannot use memset with double arrays
Closes #2545
2025-05-03 16:41:16 -04:00
Ian Bell
3c61e22c44 Implement the array-based caching in AbstractState. (#2544)
* Implement the array-based caching in AbstractState. Not clear much more optimization is possible

Closes #2543
2025-04-30 07:18:43 -04:00
Ian Bell
a1d4433738 Remove the _R from AbstractState 2025-04-29 21:27:15 -04:00
Ian Bell
45fdfaa8ea Config should use unordered_map
Safe change, doubles the speed of lookups
2025-04-28 20:30:11 -04:00
Ian Bell
b20dcbbc8e Array header missing 2025-04-27 17:35:48 -04:00
Ian Bell
b502fc46ce Switch Helmholtz cache to array with memset for clear
Closes #2540
2025-04-27 16:27:59 -04:00
Ian Bell
71c4d24768 Switch methanol to the EOS of de Reuck to match REFPROP
Closes #2538
2025-04-27 09:26:36 -04:00
Ian Bell
49a0e1508b message to cerr as well 2025-04-12 08:02:44 -04:00
Ian Bell
b234116404 Oops, use the converted double 2025-04-12 07:54:52 -04:00
Ian Bell
873c1f700b type checks on env loads; fatal errors if not convertible 2025-04-12 07:53:38 -04:00
Ian Bell
f226e35e01 Maybe I fixed the env issue 2025-04-11 17:29:39 -04:00
Ian Bell
11438acf7b Another try at debugging weird env reading issue 2025-04-11 15:46:55 -04:00
Ian Bell
3cb96a021c Overwrite config with env (#2532)
* Allow paths to be set from environment variables

* Add some quick docs
2025-04-11 07:51:06 -04:00
Ian Bell
e3aa835ca8 Allow all() to throw
Due to the GERG terms where Tc is required to be stored
2025-04-03 19:30:56 -04:00
Ian Bell
dc360fc167 miniz fluids (#2495)
* Ignore depcache files [skip ci]

* Z lib compress the fluid data

And migrate to newer version of miniz

* Add the writing of the .z file

* This works on MSVC, not sure about any other platform

How does one inform the linker about what locations to search for this file?

* Does this give the necessary linking info to the compiler?

* Include the header only for MSVC

* The incbin is still needed for non-windows

* Missing headers for Python

* Add miniz source file

* Missing import

* Provide a solution for compilers that don't support assembly to embed files

* Don't specify standard since we have mixed C/C++

https://stackoverflow.com/questions/49000674/cython-std-c11-error-using-both-c-and-c

* rename miniz to cpp

* And cmake

* Back to .c again

Not sure what to do about Python now

* Build the C library and then link it in

* FIx cmake too

* Location for .z file

* arg to setup function

* Check for z file [skip ci]

* Force build temp to be here

* Try switching to setuptools version

* Force the build_temp to be build before clib construction begins

That was subtle...
2025-03-09 10:38:56 -04:00
Ian Bell
c54b241675 Switch EOS tests to multicomplex (#2490)
Found some issues in log function of mcx. Should update the tests to use autodiff probably, but that requires quite a lot more work
2025-03-02 13:58:21 -05:00
Andrej Dolenc
5775dac12a Support plotting in C++ (#2463)
* Initial rewrite to c++

* Minor cleanup

* Add simple unit test for ph plot

* Add tests for Ts plot

* Use coolprop's lin and logspace functions to generate ranges

* Remove copied file header comments

* Remove code for handling unit conversions

* Replace Optional return from value_at with Nan

* Rename generate_ranges to generate_values_in_range

* Clean up xy_switch code

* Remove redundand <memory> include

* Make namings more consistent

* Further cleanup

* Move implementation to .cpp file

* More renamings

* Finish moving implementation over to .cpp

* Move generate_values out of Details namespace

* Make get_axis_limits const-able

* Constify most of the methods

* Add _ for member variables

* Make isoline methods consts too

* Make tp limits parameter an enum instead

* Try to match the code style with rest of repo

* Move not needed code from .h to .cpp

* Match code style with curly braces on same line

* Update variable names in tests so they make more sense

* Clean up the public api for PropertyPlot

* Add docstrings to public interface in CoolPropPlot
2025-02-17 13:38:54 -05:00
Ian Bell
a19e69662f Update msgpack-c and selectively add boost (#2450)
(like was done in teqp)
2024-12-07 13:06:49 -05:00
Ian Bell
730620f7b1 Expose the neff function 2024-10-03 20:00:15 -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
Ian Bell
c4108e5a57 Fix order of initialization 2023-08-28 20:54:20 -04:00
Ian Bell
3cab04a678 format_as should be inline, not static 2023-08-28 20:54:05 -04:00
Arnab Mahanti
826e77f122 implemented VISC LAESECK-JPCRD-2017-CO2 (#2268) 2023-07-26 10:53:06 -04:00
Arnab Mahanti
377bab8ebe implemented TCX Huber-JPCRD-2016 for CO2 (#2267)
* implemented TCX Huber-JPCRD-2016 for CO2

* added CarbonDioxideHuberJPCRD2016 to json file

* fixed typo in Huber Eq. 3
2023-07-22 07:49:23 -04:00
Ian Bell
73418363e2 Add missing header 2023-05-13 07:20:09 -04:00
Pierre Wendling
d248c75a43 Update fmt submodule to 10.0.0 (#2252)
* Update fmt submodule to 10.0.0.

* Update format wrapper, add format_as overloads.

- Every enum that is formatted needs to define a format_as overload in
the same namespace.
- Add a wrapper for sprintf for fmt versions without ArgList.
2023-05-13 07:14:01 -04:00
Jorrit Wronski
136644d2cd Assume that Linux on PowerPC behaves like any other Linux 2022-12-07 09:21:26 +01:00
Jorrit Wronski
6b111a304c Handle the msgpack endianness 2022-12-07 09:18:08 +01:00
Jorrit Wronski
b20e71b7de Modifying some PPC code to make ppc64le work 2022-12-07 00:08:13 +01:00
msaitta-mpr
15720ab6cc Prevent crashes near critical density due to saturation calc (#2173)
* Add extrapolating secant solver

Sometimes, the backwards ancillary solver fails near the critical
point. This can happen if the ancillary function at its limit
(i.e., critical temperature) does not reach the desired seek value
(e.g., density). Because we are only usually using these to get a
guess value, we can extrapolate them without issue to avoid a crash
near the critical point.

This helps to resolve #2154.

* Stabilize saturation curve solution

Solving for the saturation curve near the critical point can be
unstable. This commit fixes that in a few ways.

1) Prevent the solver from overshooting and prevent a negative
temperature or density.

2) If it does fail, try again with a smaller omega value.

If the solver fails after all of this, we will still throw to allow
something downstream to handle it.

This helps to address issue #2154.

* Move saturation_D_pure max iterations to options
2022-10-28 18:08:13 -04:00
Zach Baird
e52c26c8e8 improve PC-SAFT flash (#2161)
* improve PC-SAFT flash

* fix error in PC-SAFT JSON file

* change C type to string
2022-08-27 18:59:31 -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
Ian Bell
381c8535e5 Update the Javascript tooling 2022-02-08 01:21:03 -05: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
77f3bdec7a Fix PHI0 delta derivatives for REFPROP backend. Closes #2073 2022-01-08 18:29:20 -05:00
Sébastien Raymond
c2bd2d9994 Fix cxx17 (#2005)
* fix cxx 17
2021-03-05 07:47:52 -05:00
Sébastien Raymond
21af8faa44 Fix cxx17 (#1990)
* fix cxx 17

* add legacy support

Co-authored-by: Ian Bell <ian.h.bell@gmail.com>
Co-authored-by: Jorrit Wronski <jowr@ipu.dk>
Co-authored-by: szebos <sebastien.newe@gmail.com>
2021-01-02 08:18:28 -05:00
Ian Bell
2e138f000c One more _HUGE
See #1988
2020-12-12 22:46:04 -05:00
Ian Bell
5a521c532f Apply prefactor also to values when caching 2020-12-09 11:11:32 -05:00
Ian Bell
e2acfce6e0 Fix HUGE -> _HUGE
See #1988

Only one character difference, but an important one!
2020-12-09 11:10:52 -05:00
Ian Bell
9cda7adc57 Allow for a prefactor multiplying alpha0
To deal with the ratio of gas constants from Jaeschke and Schley in GERG-2008
2020-12-07 08:45:20 -05:00
Ian Bell
0211813a0c Actually add the GERG-2004 contributions 2020-12-04 15:04:10 -05:00