7 #ifndef MIXTURE_BINARY_PAIRS_H
8 #define MIXTURE_BINARY_PAIRS_H
16 typedef std::vector<std::vector<CoolPropDbl>>
STLMatrix;
47 static shared_ptr<ReducingFunction>
factory(
const std::vector<CoolPropFluid*>& components,
STLMatrix& F);
166 this->
N = pFluids.size();
167 T_c.resize(
N, std::vector<CoolPropDbl>(
N, 0));
168 v_c.resize(
N, std::vector<CoolPropDbl>(
N, 0));
171 for (std::size_t i = 0; i <
N; ++i) {
172 for (std::size_t j = 0; j <
N; j++) {
174 v_c[i][j] = 1.0 / 8.0 * pow(pow(
pFluids[i].EOS().reduce.rhomolar, -1.0 / 3.0) + pow(
pFluids[j].EOS().reduce.rhomolar, -1.0 / 3.0), 3);
191 if (i < 0 || i >=
N) {
192 if (j < 0 || j >=
N) {
193 throw ValueError(
format(
"Both indices i [%d] and j [%d] are out of bounds. Must be between 0 and %d.", i, j,
N-1));
195 throw ValueError(
format(
"Index i [%d] is out of bounds. Must be between 0 and %d.", i,
N-1));
197 }
else if (j < 0 || j >=
N) {
198 throw ValueError(
format(
"Index j [%d] is out of bounds. Must be between 0 and %d.", j,
N-1));
213 if (i < 0 || i >=
N) {
214 if (j < 0 || j >=
N) {
215 throw ValueError(
format(
"Both indices i [%d] and j [%d] are out of bounds. Must be between 0 and %d.", i, j,
N-1));
217 throw ValueError(
format(
"Index i [%d] is out of bounds. Must be between 0 and %d.", i,
N-1));
219 }
else if (j < 0 || j >=
N) {
220 throw ValueError(
format(
"Index j [%d] is out of bounds. Must be between 0 and %d.", j,
N-1));
222 if (parameter ==
"betaT") {
225 }
else if (parameter ==
"gammaT") {
228 }
else if (parameter ==
"betaV") {
231 }
else if (parameter ==
"gammaV") {
235 throw KeyError(
format(
"This key [%s] is invalid to set_binary_interaction_double", parameter.c_str()));
240 if (parameter ==
"betaT") {
242 }
else if (parameter ==
"gammaT") {
244 }
else if (parameter ==
"betaV") {
246 }
else if (parameter ==
"gammaV") {
249 throw KeyError(
format(
"This key [%s] is invalid to get_binary_interaction_double", parameter.c_str()));
386 const std::vector<CoolPropDbl>& Yc)
const;
395 const std::vector<CoolPropDbl>& Yc)
const;
400 const std::vector<CoolPropDbl>& Yc)
const;
550 double T_c, rhomolar_c;
701 gamma_T = (pFluids[i].EOS().reduce.T + pFluids[j].EOS().reduce.T + xi_ij) / (2 * sqrt(pFluids[i].EOS().reduce.T * pFluids[j].EOS().reduce.T));
702 CoolPropDbl v_i = 1 / pFluids[i].EOS().reduce.rhomolar;
703 CoolPropDbl v_j = 1 / pFluids[j].EOS().reduce.rhomolar;
705 gamma_v = (v_i + v_j + zeta_ij) / (0.25 * pow(pow(v_i, one_third) + pow(v_j, one_third), 3));