CoolProp
6.8.1dev
An open-source fluid property and humid air property database
include
CoolPropLib.h
Go to the documentation of this file.
1
19
#ifndef COOLPROPDLL_H
20
#define COOLPROPDLL_H
21
22
// See also http://stackoverflow.com/questions/5919996/how-to-detect-reliably-mac-os-x-ios-linux-windows-in-c-preprocessor
23
// Copied verbatim from PlatformDetermination.h in order to have a single-include header
24
#if _WIN64
25
# define __ISWINDOWS__
26
#elif _WIN32
27
# define __ISWINDOWS__
28
#elif __APPLE__
29
# define __ISAPPLE__
30
#elif __linux || __unix || __posix
31
# define __ISLINUX__
32
#elif __powerpc__
33
# define __ISPOWERPC__
34
#else
35
# pragma error
36
#endif
37
38
#if defined(COOLPROP_LIB)
39
# ifndef EXPORT_CODE
40
# if defined(__ISWINDOWS__)
41
# define EXPORT_CODE extern "C"
__declspec(dllexport)
42
# else
43
# define EXPORT_CODE extern "C"
44
# endif
45
# endif
46
# ifndef CONVENTION
47
# if defined(__ISWINDOWS__)
48
# define CONVENTION __stdcall
49
# else
50
# define CONVENTION
51
# endif
52
# endif
53
#else
54
# ifndef EXPORT_CODE
55
# define EXPORT_CODE
56
# endif
57
# ifndef CONVENTION
58
# define CONVENTION
59
# endif
60
#endif
61
62
#ifndef __cplusplus
63
# if defined(__STDC_VERSION__)
64
# if (__STDC_VERSION__ >= 199901L)
65
# include <stdbool.h>
66
# endif
67
# endif
68
#endif
69
70
// Hack for PowerPC compilation to only use extern "C"
71
#if defined(__powerpc__) || defined(EXTERNC)
72
# undef EXPORT_CODE
73
# define EXPORT_CODE extern "C"
74
#endif
75
76
#if defined(__powerpc__)
77
// From https://rowley.zendesk.com/entries/46176--Undefined-reference-to-assert-error-message
78
// The __assert function is an error handler function that is invoked when an assertion fails.
79
// If you are writing a program that uses the assert macro then you must supply you own __assert error handler function. For example
80
inline
void
__assert(
const
char
* error) {
81
while
(1)
82
;
83
}
84
#endif
85
92
EXPORT_CODE
double
CONVENTION
Props1SI
(
const
char
* FluidName,
const
char
* Output);
93
100
EXPORT_CODE
void
CONVENTION
Props1SImulti
(
const
char
* Outputs,
char
* backend,
const
char
* FluidNames,
const
double
* fractions,
101
const
long
length_fractions,
double
* result,
long
* resdim1);
108
EXPORT_CODE
double
CONVENTION
PropsSI
(
const
char
* Output,
const
char
* Name1,
double
Prop1,
const
char
* Name2,
double
Prop2,
const
char
* Ref);
131
EXPORT_CODE
void
CONVENTION
PropsSImulti
(
const
char
* Outputs,
const
char
* Name1,
double
* Prop1,
const
long
size_Prop1,
const
char
* Name2,
132
double
* Prop2,
const
long
size_Prop2,
char
* backend,
const
char
* FluidNames,
const
double
* fractions,
133
const
long
length_fractions,
double
* result,
long
* resdim1,
long
* resdim2);
140
EXPORT_CODE
long
CONVENTION
PhaseSI
(
const
char
* Name1,
double
Prop1,
const
char
* Name2,
double
Prop2,
const
char
* Ref,
char
* phase,
int
n);
141
150
EXPORT_CODE
long
CONVENTION
get_global_param_string
(
const
char
* param,
char
* Output,
int
n);
158
EXPORT_CODE
long
CONVENTION
get_parameter_information_string
(
const
char
* key,
char
* Output,
int
n);
165
EXPORT_CODE
long
CONVENTION
get_fluid_param_string
(
const
char
* fluid,
const
char
* param,
char
* Output,
int
n);
172
EXPORT_CODE
long
CONVENTION
get_fluid_param_string_len
(
const
char
* fluid,
const
char
* param);
178
EXPORT_CODE
void
CONVENTION
set_config_string
(
const
char
* key,
const
char
* val);
184
EXPORT_CODE
void
CONVENTION
set_config_double
(
const
char
* key,
const
double
val);
190
EXPORT_CODE
void
CONVENTION
set_config_bool
(
const
char
* key,
const
bool
val);
202
EXPORT_CODE
void
CONVENTION
set_departure_functions
(
const
char
* string_data,
long
* errcode,
char
* message_buffer,
const
long
buffer_length);
208
EXPORT_CODE
int
CONVENTION
set_reference_stateS
(
const
char
* Ref,
const
char
* reference_state);
214
EXPORT_CODE
int
CONVENTION
set_reference_stateD
(
const
char
* Ref,
double
T,
double
rhomolar,
double
hmolar0,
double
smolar0);
221
EXPORT_CODE
void
CONVENTION
propssi_
(
const
char
* Output,
const
char
* Name1,
const
double
* Prop1,
const
char
* Name2,
const
double
* Prop2,
222
const
char
* Ref,
double
* output);
223
225
EXPORT_CODE
double
CONVENTION
F2K
(
double
T_F);
227
EXPORT_CODE
double
CONVENTION
K2F
(
double
T_K);
232
EXPORT_CODE
long
CONVENTION
get_param_index
(
const
char
* param);
237
EXPORT_CODE
long
CONVENTION
get_input_pair_index
(
const
char
* param);
240
EXPORT_CODE
long
CONVENTION
redirect_stdout
(
const
char
* file);
241
242
// ---------------------------------
243
// Getter and setter for debug level
244
// ---------------------------------
245
248
EXPORT_CODE
int
CONVENTION
get_debug_level
();
251
EXPORT_CODE
void
CONVENTION
set_debug_level
(
int
level);
252
253
/* \brief Extract a value from the saturation ancillary
254
*
255
* @param fluid_name The name of the fluid to be used - HelmholtzEOS backend only
256
* @param output The desired output variable ("P" for instance for pressure)
257
* @param Q The quality, 0 or 1
258
* @param input The input variable ("T")
259
* @param value The input value
260
*/
261
EXPORT_CODE
double
CONVENTION
saturation_ancillary
(
const
char
* fluid_name,
const
char
* output,
int
Q,
const
char
* input,
double
value);
262
263
// ---------------------------------
264
// Humid Air Properties
265
// ---------------------------------
266
272
EXPORT_CODE
double
CONVENTION
HAPropsSI
(
const
char
* Output,
const
char
* Name1,
double
Prop1,
const
char
* Name2,
double
Prop2,
const
char
* Name3,
273
double
Prop3);
274
282
EXPORT_CODE
double
CONVENTION
cair_sat
(
double
T);
283
289
EXPORT_CODE
void
CONVENTION
hapropssi_
(
const
char
* Output,
const
char
* Name1,
const
double
* Prop1,
const
char
* Name2,
const
double
* Prop2,
290
const
char
* Name3,
const
double
* Prop3,
double
* output);
291
299
EXPORT_CODE
double
CONVENTION
HAProps
(
const
char
* Output,
const
char
* Name1,
double
Prop1,
const
char
* Name2,
double
Prop2,
const
char
* Name3,
300
double
Prop3);
301
309
EXPORT_CODE
void
CONVENTION
haprops_
(
const
char
* Output,
const
char
* Name1,
const
double
* Prop1,
const
char
* Name2,
const
double
* Prop2,
310
const
char
* Name3,
const
double
* Prop3,
double
* output);
311
312
// ---------------------------------
313
// Low-level access
314
// ---------------------------------
315
325
EXPORT_CODE
long
CONVENTION
AbstractState_factory
(
const
char
* backend,
const
char
* fluids,
long
* errcode,
char
* message_buffer,
326
const
long
buffer_length);
336
EXPORT_CODE
void
CONVENTION
AbstractState_fluid_names
(
const
long
handle,
char
* fluids,
long
* errcode,
char
* message_buffer,
const
long
buffer_length);
345
EXPORT_CODE
void
CONVENTION
AbstractState_free
(
const
long
handle,
long
* errcode,
char
* message_buffer,
const
long
buffer_length);
356
EXPORT_CODE
void
CONVENTION
AbstractState_set_fractions
(
const
long
handle,
const
double
* fractions,
const
long
N,
long
* errcode,
char
* message_buffer,
357
const
long
buffer_length);
369
EXPORT_CODE
void
CONVENTION
AbstractState_get_mole_fractions
(
const
long
handle,
double
* fractions,
const
long
maxN,
long
* N,
long
* errcode,
370
char
* message_buffer,
const
long
buffer_length);
383
EXPORT_CODE
void
CONVENTION
AbstractState_get_mole_fractions_satState
(
const
long
handle,
const
char
* saturated_state,
double
* fractions,
384
const
long
maxN,
long
* N,
long
* errcode,
char
* message_buffer,
385
const
long
buffer_length);
395
EXPORT_CODE
double
CONVENTION
AbstractState_get_fugacity
(
const
long
handle,
const
long
i,
long
* errcode,
char
* message_buffer,
396
const
long
buffer_length);
406
EXPORT_CODE
double
CONVENTION
AbstractState_get_fugacity_coefficient
(
const
long
handle,
const
long
i,
long
* errcode,
char
* message_buffer,
407
const
long
buffer_length);
419
EXPORT_CODE
void
CONVENTION
AbstractState_update
(
const
long
handle,
const
long
input_pair,
const
double
value1,
const
double
value2,
long
* errcode,
420
char
* message_buffer,
const
long
buffer_length);
430
EXPORT_CODE
void
CONVENTION
AbstractState_specify_phase
(
const
long
handle,
const
char
* phase,
long
* errcode,
char
* message_buffer,
431
const
long
buffer_length);
440
EXPORT_CODE
void
CONVENTION
AbstractState_unspecify_phase
(
const
long
handle,
long
* errcode,
char
* message_buffer,
const
long
buffer_length);
450
EXPORT_CODE
double
CONVENTION
AbstractState_keyed_output
(
const
long
handle,
const
long
param,
long
* errcode,
char
* message_buffer,
451
const
long
buffer_length);
452
463
EXPORT_CODE
double
CONVENTION
AbstractState_first_saturation_deriv
(
const
long
handle,
const
long
Of,
const
long
Wrt,
long
* errcode,
464
char
* message_buffer,
const
long
buffer_length);
465
477
EXPORT_CODE
double
CONVENTION
AbstractState_first_partial_deriv
(
const
long
handle,
const
long
Of,
const
long
Wrt,
const
long
Constant,
long
* errcode,
478
char
* message_buffer,
const
long
buffer_length);
479
494
EXPORT_CODE
double
CONVENTION
AbstractState_second_two_phase_deriv
(
const
long
handle,
const
long
Of1,
const
long
Wrt1,
const
long
Constant1,
495
const
long
Wrt2,
const
long
Constant2,
long
* errcode,
char
* message_buffer,
496
const
long
buffer_length);
511
EXPORT_CODE
double
CONVENTION
AbstractState_second_partial_deriv
(
const
long
handle,
const
long
Of1,
const
long
Wrt1,
const
long
Constant1,
512
const
long
Wrt2,
const
long
Constant2,
long
* errcode,
char
* message_buffer,
513
const
long
buffer_length);
514
530
EXPORT_CODE
double
CONVENTION
AbstractState_first_two_phase_deriv_splined
(
const
long
handle,
const
long
Of,
const
long
Wrt,
const
long
Constant,
531
const
double
x_end,
long
* errcode,
char
* message_buffer,
const
long
buffer_length);
544
EXPORT_CODE
double
CONVENTION
AbstractState_first_two_phase_deriv
(
const
long
handle,
const
long
Of,
const
long
Wrt,
const
long
Constant,
545
long
* errcode,
char
* message_buffer,
const
long
buffer_length);
566
EXPORT_CODE
void
CONVENTION
AbstractState_update_and_common_out
(
const
long
handle,
const
long
input_pair,
const
double
* value1,
const
double
* value2,
567
const
long
length,
double
* T,
double
* p,
double
* rhomolar,
double
* hmolar,
568
double
* smolar,
long
* errcode,
char
* message_buffer,
const
long
buffer_length);
569
587
EXPORT_CODE
void
CONVENTION
AbstractState_update_and_1_out
(
const
long
handle,
const
long
input_pair,
const
double
* value1,
const
double
* value2,
588
const
long
length,
const
long
output,
double
* out,
long
* errcode,
char
* message_buffer,
589
const
long
buffer_length);
590
612
EXPORT_CODE
void
CONVENTION
AbstractState_update_and_5_out
(
const
long
handle,
const
long
input_pair,
const
double
* value1,
const
double
* value2,
613
const
long
length,
long
* outputs,
double
* out1,
double
* out2,
double
* out3,
double
* out4,
614
double
* out5,
long
* errcode,
char
* message_buffer,
const
long
buffer_length);
615
628
EXPORT_CODE
void
CONVENTION
AbstractState_set_binary_interaction_double
(
const
long
handle,
const
long
i,
const
long
j,
const
char
* parameter,
629
const
double
value,
long
* errcode,
char
* message_buffer,
630
const
long
buffer_length);
631
645
EXPORT_CODE
void
CONVENTION
AbstractState_set_cubic_alpha_C
(
const
long
handle,
const
long
i,
const
char
* parameter,
const
double
c1,
const
double
c2,
646
const
double
c3,
long
* errcode,
char
* message_buffer,
const
long
buffer_length);
647
659
EXPORT_CODE
void
CONVENTION
AbstractState_set_fluid_parameter_double
(
const
long
handle,
const
long
i,
const
char
* parameter,
const
double
value,
660
long
* errcode,
char
* message_buffer,
const
long
buffer_length);
661
673
EXPORT_CODE
void
CONVENTION
AbstractState_build_phase_envelope
(
const
long
handle,
const
char
* level,
long
* errcode,
char
* message_buffer,
674
const
long
buffer_length);
675
693
EXPORT_CODE
void
CONVENTION
AbstractState_get_phase_envelope_data
(
const
long
handle,
const
long
length,
double
* T,
double
* p,
double
* rhomolar_vap,
694
double
* rhomolar_liq,
double
* x,
double
* y,
long
* errcode,
char
* message_buffer,
695
const
long
buffer_length);
696
717
EXPORT_CODE
void
CONVENTION
AbstractState_get_phase_envelope_data_checkedMemory
(
const
long
handle,
const
long
length,
const
long
maxComponents,
double
* T,
718
double
* p,
double
* rhomolar_vap,
double
* rhomolar_liq,
double
* x,
double
* y,
719
long
* actual_length,
long
* actual_components,
long
* errcode,
char
* message_buffer,
720
const
long
buffer_length);
721
730
EXPORT_CODE
void
CONVENTION
AbstractState_build_spinodal
(
const
long
handle,
long
* errcode,
char
* message_buffer,
const
long
buffer_length);
731
746
EXPORT_CODE
void
CONVENTION
AbstractState_get_spinodal_data
(
const
long
handle,
const
long
length,
double
* tau,
double
* delta,
double
* M1,
747
long
* errcode,
char
* message_buffer,
const
long
buffer_length);
748
764
EXPORT_CODE
void
CONVENTION
AbstractState_all_critical_points
(
const
long
handle,
const
long
length,
double
* T,
double
* p,
double
* rhomolar,
765
long
* stable,
long
* errcode,
char
* message_buffer,
const
long
buffer_length);
776
EXPORT_CODE
double
CONVENTION
AbstractState_keyed_output_satState
(
const
long
handle,
const
char
* saturated_state,
const
long
param,
long
* errcode,
777
char
* message_buffer,
const
long
buffer_length);
787
EXPORT_CODE
void
CONVENTION
AbstractState_backend_name
(
const
long
handle,
char
* backend,
long
* errcode,
char
* message_buffer,
788
const
long
buffer_length);
789
793
EXPORT_CODE
void
CONVENTION
AbstractState_fluid_param_string
(
const
long
handle,
const
char
* param,
char
* return_buffer,
794
const
long
return_buffer_length,
long
* errcode,
char
* message_buffer,
795
const
long
buffer_length);
796
800
EXPORT_CODE
int
CONVENTION
AbstractState_phase
(
const
long
handle,
long
* errcode,
char
* message_buffer,
const
long
buffer_length);
801
805
EXPORT_CODE
double
CONVENTION
AbstractState_saturated_liquid_keyed_output
(
const
long
handle,
const
long
param,
long
* errcode,
char
* message_buffer,
806
const
long
buffer_length);
807
811
EXPORT_CODE
double
CONVENTION
AbstractState_saturated_vapor_keyed_output
(
const
long
handle,
const
long
param,
long
* errcode,
char
* message_buffer,
812
const
long
buffer_length);
813
821
EXPORT_CODE
void
CONVENTION
add_fluids_as_JSON
(
const
char
* backend,
const
char
* fluidstring,
long
* errcode,
char
* message_buffer,
822
const
long
buffer_length);
823
827
EXPORT_CODE
int
CONVENTION
C_is_valid_fluid_string
(
const
char
* fluidName);
828
832
EXPORT_CODE
int
CONVENTION
C_extract_backend
(
const
char
* fluid_string,
char
* backend,
const
long
backend_length,
char
* fluid,
833
const
long
fluid_length);
834
835
// *************************************************************************************
836
// *************************************************************************************
837
// ***************************** DEPRECATED *******************************************
838
// *************************************************************************************
839
// *************************************************************************************
840
845
EXPORT_CODE
double
CONVENTION
PropsS
(
const
char
* Output,
const
char
* Name1,
double
Prop1,
const
char
* Name2,
double
Prop2,
const
char
* Ref);
849
EXPORT_CODE
double
CONVENTION
Props
(
const
char
* Output,
const
char
Name1,
double
Prop1,
const
char
Name2,
double
Prop2,
const
char
* Ref);
853
EXPORT_CODE
double
CONVENTION
Props1
(
const
char
* FluidName,
const
char
* Output);
854
855
#endif
Generated on Sun Jun 1 2025 04:26:15 for CoolProp by
1.9.4