CoolProp
8.0.0
An open-source fluid property and humid air property database
src
Backends
Cubics
UNIFACLibrary.h
Go to the documentation of this file.
1
#ifndef UNIFAC_LIBRARY_H
2
#define UNIFAC_LIBRARY_H
3
4
#include <vector>
5
6
#include "
CoolProp/detail/json.h
"
7
#include "
CoolProp/CoolPropFluid.h
"
8
9
namespace
UNIFACLibrary
{
10
12
struct
Group
13
{
14
int
sgi
,
15
mgi
;
16
double
R_k
,
17
Q_k
;
18
};
19
21
struct
InteractionParameters
22
{
23
int
mgi1
,
24
mgi2
;
25
double
a_ij
,
26
a_ji
,
27
b_ij
,
28
b_ji
,
29
c_ij
,
30
c_ji
;
32
void
swap
() {
33
std::swap(
a_ij
,
a_ji
);
34
std::swap(
b_ij
,
b_ji
);
35
std::swap(
c_ij
,
c_ji
);
36
}
38
void
zero_out
() {
39
a_ij
= 0;
40
a_ji
= 0;
41
b_ij
= 0;
42
b_ji
= 0;
43
c_ij
= 0;
44
c_ji
= 0;
45
}
46
};
47
49
struct
ComponentGroup
50
{
51
int
count
;
52
UNIFACLibrary::Group
group
;
53
ComponentGroup
(
const
int
count
,
const
UNIFACLibrary::Group
group
) :
count
(
count
),
group
(
group
) {};
54
};
55
57
struct
Component
58
{
59
std::string
name
,
60
inchikey
,
61
registry_number
,
62
userid
;
63
double
Tc
,
64
pc
,
65
acentric
,
66
molemass
;
67
std::vector<ComponentGroup>
groups
;
68
std::string
alpha_type
;
69
std::vector<double>
alpha_coeffs
;
70
CoolProp::IdealHelmholtzContainer
alpha0
;
71
};
72
82
struct
UNIFACParameterLibrary
83
{
84
private
:
85
bool
m_populated;
86
std::vector<Group> groups;
87
std::vector<InteractionParameters> interaction_parameters;
88
std::vector<Component> components;
89
91
void
jsonize(std::string& s, nlohmann::json& doc);
92
94
void
populate(
const
nlohmann::json& group_data,
const
nlohmann::json& interaction_data,
const
nlohmann::json& decomp_data);
95
96
public
:
97
UNIFACParameterLibrary
() : m_populated(false) {};
98
100
bool
is_populated
() {
101
return
m_populated;
102
};
103
105
void
populate(std::string& group_data, std::string& interaction_data, std::string& decomp_data);
106
108
Group
get_group
(
int
sgi)
const
;
109
111
bool
has_group
(
int
sgi)
const
;
112
114
Component
get_component
(
const
std::string& identifier,
const
std::string& value)
const
;
115
117
InteractionParameters
get_interaction_parameters
(
int
mgi1,
int
mgi2)
const
;
118
};
119
120
};
/* namespace UNIFACLibrary*/
121
122
#endif
Generated by
1.9.4