Hello,
I am trying to use CoolProp in OpenFOAM, a C++ library mainly used for CFD.
I successfully build a simple solver (for transient heat conduction) whose purpose was to check whether I could effectively use the C++ low-level interface of CoolProp inside OpenFOAM. This solver works just fine.
Next I wanted to build an OpenFOAM thermophysical model (in practice it's a shared library) that uses CoolProp to compute density,thermal conductivity, viscosity, etc.
I tried building the library (always using the C++ low-level interface of CoolProp) and after some problems I have succeeded building it without errors. However when I tried using the new library in a standard OpenFOAM CFD solver (linking also CoolProp using a static library, as done in the simple heat transfer solver) I got the following CoolProp error:
terminate called after throwing an instance of 'CoolProp::CoolPropError<(CoolProp::CoolPropBaseError::ErrCode)4>'
what(): key [CO2] was not found in string_to_index_map in JSONFluidLibrary
Abandon (core dumped)
The error clearly comes from this definition:
shared_ptr<CoolProp::AbstractState> CarbonDioxide(CoolProp::AbstractState::factory("HEOS","CO2"));
If I understand correctly it seems that the string CO2 is not recognized. This is quite strange since it's exactly the same definition I used in the simple solver that works. The only difference is that now the definition is inside a library while before it was in the main source code of the solver.
Any suggestions? Is there a way to solve or bypass this error?
Thank you.
Best regards,
Edoardo