2#ifndef HELMHOLTZEOSMIXTUREBACKEND_H_
3#define HELMHOLTZEOSMIXTUREBACKEND_H_
20class ResidualHelmholtz;
26 std::vector<CoolPropDbl> mole_fractions;
28 bool verify_mole_fractions_set(
T i)
const {
29 if (i >= mole_fractions.size()) {
38 return mole_fractions.resize(N);
41 return mole_fractions.size();
44 mole_fractions.clear();
49 mole_fractions = values;
54 verify_mole_fractions_set(i);
55 return mole_fractions[i];
57 operator std::vector<CoolPropDbl>&() {
58 return mole_fractions;
68 std::vector<shared_ptr<HelmholtzEOSMixtureBackend>>
83 bool sat_states =
false;
91 bool sat_states =
true;
99 bool sat_states =
true;
108 std::vector<CoolPropDbl>
K,
123 std::shared_ptr<EquationOfState::SuperAncillary_t>
get_superanc();
158 component.EOS().alphar.clear();
159 component.EOS().alpha0.clear();
200 std::vector<std::pair<double, double>> out;
201 for (
const auto& pr :
components[0].ancillaries.melting_line.get_parts_pranges()) {
202 out.emplace_back(
static_cast<double>(pr.first),
static_cast<double>(pr.second));
223 void set_binary_interaction_string(
const std::size_t i,
const std::size_t j,
const std::string& parameter,
const std::string& value)
override;
228 void set_cubic_alpha_C(
const size_t i,
const std::string& parameter,
const double c1,
const double c2,
const double c3)
override {
229 throw ValueError(
"set_cubic_alpha_C only defined for cubic backends");
234 throw ValueError(
"set_fluid_parameter_double only defined for cubic backends");
273 bool find_critical_points =
true;
306 void calc_change_EOS(
const std::size_t i,
const std::string& EOS_name)
override;
364 throw ValueError(
"mole_fractions_liquid is only defined in the two-phase region (current state is single-phase)");
366 return SatL->get_mole_fractions();
370 throw ValueError(
"mole_fractions_vapor is only defined in the two-phase region (current state is single-phase)");
372 return SatV->get_mole_fractions();
447 void calc_ideal_curve(
const std::string& type, std::vector<double>&
T, std::vector<double>&
p)
override;
698 bool cache_values =
false) {
700 std::size_t N = x.size();
701 for (std::size_t i = 0; i < N; ++i) {
703 summer = summer + derivs * x[i];
711 std::size_t N = x.size();
712 if (i == N - 1)
return 0;
722 std::size_t N = x.size();
723 if (i == N - 1)
return 0;
733 std::size_t N = x.size();
734 if (i == N - 1)
return 0;
745 std::size_t N = x.size();
746 if (i == N - 1)
return 0;
757 std::size_t N = x.size();
758 if (i == N - 1)
return 0;
769 std::size_t N = x.size();
770 if (i == N - 1)
return 0;
867 bool cache_values =
false) {
869 a.delta_x_dalphar_ddelta = delta * a.dalphar_ddelta;
870 a.tau_x_dalphar_dtau = tau * a.dalphar_dtau;
872 a.delta2_x_d2alphar_ddelta2 =
POW2(delta) * a.d2alphar_ddelta2;
873 a.deltatau_x_d2alphar_ddelta_dtau = delta * tau * a.d2alphar_ddelta_dtau;
874 a.tau2_x_d2alphar_dtau2 =
POW2(tau) * a.d2alphar_dtau2;