CoolProp 8.0.0
An open-source fluid property and humid air property database
UNIFACLibrary.h
Go to the documentation of this file.
1#ifndef UNIFAC_LIBRARY_H
2#define UNIFAC_LIBRARY_H
3
4#include <vector>
5
8
9namespace UNIFACLibrary {
10
12struct Group
13{
14 int sgi,
16 double R_k,
18};
19
22{
23 int mgi1,
25 double a_ij,
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
50{
51 int count;
54};
55
58{
59 std::string name,
63 double Tc,
67 std::vector<ComponentGroup> groups;
68 std::string alpha_type;
69 std::vector<double> alpha_coeffs;
71};
72
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
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