27 Reducing = std::make_shared<ConstantReducingFunction>(
cubic->get_Tr(),
cubic->get_rhor());
31 _cubic->get_unifaq().set_interaction_parameters();
34 m_fluid_names = names;
44 if (generate_SatL_and_SatV) {
45 bool SatLSatV =
false;
54 std::vector<CoolPropDbl> z(1, 1.0);
56 SatL->set_mole_fractions(z);
57 SatV->set_mole_fractions(z);
67 auto* _cubic =
static_cast<VTPRCubic*
>(cubic.get());
71 if (components.empty()) {
75 for (std::size_t i = 0; i < N; ++i) {
76 const std::string& alpha_type = components[i].alpha_type;
77 if (alpha_type !=
"default") {
78 const std::vector<double>& c = components[i].alpha_coeffs;
79 shared_ptr<AbstractCubicAlphaFunction> acaf;
80 if (alpha_type ==
"Twu") {
81 acaf = std::make_shared<TwuAlphaFunction>(get_cubic()->a0_ii(i), c[0], c[1], c[2], get_cubic()->get_Tr() / get_cubic()->get_Tc()[i]);
82 }
else if (alpha_type ==
"MathiasCopeman" || alpha_type ==
"Mathias-Copeman") {
86 throw ValueError(
"alpha function is not understood");
88 cubic->set_alpha_function(i, acaf);
95 for (
unsigned int i = 0; i < N; ++i) {
96 summer += mole_fractions[i] * molemass[i];
102 const double value) {
106 throw ValueError(
format(
"Both indices i [%d] and j [%d] are out of bounds. Must be between 0 and %d.", i, j, N - 1));
108 throw ValueError(
format(
"Index i [%d] is out of bounds. Must be between 0 and %d.", i, N - 1));
111 throw ValueError(
format(
"Index j [%d] is out of bounds. Must be between 0 and %d.", j, N - 1));
113 cubic->set_interaction_parameter(i, j, parameter, value);
114 for (
auto& linked_state : linked_states) {
115 linked_state->set_binary_interaction_double(i, j, parameter, value);
120 cubic->set_Q_k(sgi, value);
127 throw ValueError(
format(
"Both indices i [%d] and j [%d] are out of bounds. Must be between 0 and %d.", i, j, N - 1));
129 throw ValueError(
format(
"Index i [%d] is out of bounds. Must be between 0 and %d.", i, N - 1));
132 throw ValueError(
format(
"Index j [%d] is out of bounds. Must be between 0 and %d.", j, N - 1));
134 return cubic->get_interaction_parameter(i, j, parameter);
140 if (UNIFAC_path.empty()) {
141 throw ValueError(
"You must provide the path to the UNIFAC library files as VTPR_UNIFAC_PATH");
143 if (!(UNIFAC_path[UNIFAC_path.size() - 1] ==
'\\' || UNIFAC_path[UNIFAC_path.size() - 1] ==
'/')) {
144 throw ValueError(
"VTPR_UNIFAC_PATH must end with / or \\ character");
146 std::string group_path = UNIFAC_path +
"group_data.json";
148 std::string interaction_path = UNIFAC_path +
"interaction_parameters.json";
150 std::string decomps_path = UNIFAC_path +
"decompositions.json";
152 lib.populate(groups, interaction, decomps);
159 auto* _cubic =
static_cast<VTPRCubic*
>(cubic.get());
165# include <catch2/catch_all.hpp>