2 #ifndef HELMHOLTZEOSMIXTUREBACKEND_H_ 3 #define HELMHOLTZEOSMIXTUREBACKEND_H_ 5 #include "AbstractState.h" 6 #include "CoolPropFluid.h" 7 #include "ReducingFunctions.h" 8 #include "ExcessHEFunction.h" 10 #include "PhaseEnvelope.h" 11 #include "DataStructures.h" 12 #include "Configuration.h" 20 class ResidualHelmholtz;
25 std::vector<CoolPropDbl> mole_fractions;
27 bool verify_mole_fractions_set(T i)
const {
28 if (i >= mole_fractions.size()){
36 return mole_fractions.resize(N);
38 std::size_t size()
const {
39 return mole_fractions.size();
42 mole_fractions.clear();
47 mole_fractions = values;
51 CoolPropDbl operator[](T i)
const {
52 verify_mole_fractions_set(i);
53 return mole_fractions[i];
55 operator std::vector<CoolPropDbl>& () {
return mole_fractions; }
63 void post_update(
bool optional_checks =
true);
64 std::vector<shared_ptr<HelmholtzEOSMixtureBackend>>
69 virtual void add_TPD_state() {
71 if (TPD_state.get() == NULL) {
72 bool sat_states =
false;
73 TPD_state.reset(get_copy(sat_states));
74 linked_states.push_back(TPD_state);
79 if (critical_state.get() == NULL) {
80 bool sat_states =
true;
81 critical_state.reset(get_copy(sat_states));
82 linked_states.push_back(critical_state);
87 if (transient_pure_state.get() == NULL) {
88 bool sat_states =
true;
89 transient_pure_state.reset(get_copy(sat_states));
90 linked_states.push_back(transient_pure_state);
97 std::vector<CoolPropDbl> K,
104 std::vector<CoolProp::CriticalState> _calc_all_critical_points(
bool find_critical_points =
true);
119 return get_backend_string(HEOS_BACKEND_MIX);
121 shared_ptr<ReducingFunction> Reducing;
122 shared_ptr<ResidualHelmholtz> residual_helmholtz;
131 for (std::vector<CoolPropFluid>::iterator it = components.begin(); it != components.end(); ++it) {
132 (*it).EOS().alphar.clear();
133 (*it).EOS().alpha0.clear();
152 bool using_mole_fractions() {
155 bool using_mass_fractions() {
158 bool using_volu_fractions() {
162 return components.size() == 1 && !components[0].EOS().pseudo_pure;
164 bool has_melting_line() {
165 return is_pure_or_pseudopure && components[0].ancillaries.melting_line.enabled();
167 CoolPropDbl calc_melting_line(
int param,
int given, CoolPropDbl value);
169 std::string fluid_param_string(
const std::string&);
178 virtual void set_binary_interaction_double(
const std::size_t i,
const std::size_t j,
const std::string& parameter,
const double value);
180 virtual double get_binary_interaction_double(
const std::size_t i,
const std::size_t j,
const std::string& parameter);
184 void set_binary_interaction_string(
const std::size_t i,
const std::size_t j,
const std::string& parameter,
const std::string& value);
189 virtual void set_cubic_alpha_C(
const size_t i,
const std::string& parameter,
const double c1,
const double c2,
const double c3) {
190 throw ValueError(
"set_cubic_alpha_C only defined for cubic backends");
194 virtual void set_fluid_parameter_double(
const size_t i,
const std::string& parameter,
const double value) {
195 throw ValueError(
"set_fluid_parameter_double only defined for cubic backends");
206 void calc_specify_phase(
phases phase_index) {
207 imposed_phase_index = phase_index;
208 _phase = phase_index;
212 void calc_unspecify_phase() {
213 imposed_phase_index = iphase_not_imposed;
216 void calc_ssat_max(
void);
217 void calc_hsat_max(
void);
218 CoolPropDbl calc_GWP20();
219 CoolPropDbl calc_GWP500();
220 CoolPropDbl calc_GWP100();
221 CoolPropDbl calc_ODP();
232 std::vector<CoolProp::CriticalState> calc_all_critical_points() {
233 bool find_critical_points =
true;
234 return _calc_all_critical_points(find_critical_points);
237 virtual void get_critical_point_starting_values(
double& delta0,
double& tau0) {
242 virtual void get_critical_point_search_radii(
double& R_delta,
double& R_tau);
244 virtual bool get_critical_is_terminated(
double& delta,
double& tau) {
245 return delta > 5 || tau > 5;
249 virtual void calc_build_spinodal();
253 return spinodal_values;
257 void calc_criticality_contour_values(
double& L1star,
double& M1star);
260 double calc_tangent_plane_distance(
const double T,
const double p,
const std::vector<double>& w,
const double rhomolar_guess);
263 void recalculate_singlephase_phase();
266 void calc_change_EOS(
const std::size_t i,
const std::string& EOS_name);
270 virtual const double get_fluid_constant(std::size_t i,
parameters param)
const {
282 return fld.
crit.rhomolar;
298 const std::vector<CoolPropFluid>& get_components()
const {
301 std::vector<CoolPropFluid>& get_components() {
304 std::vector<CoolPropDbl>& get_K() {
307 std::vector<CoolPropDbl>& get_lnK() {
317 std::vector<CoolPropDbl> calc_mole_fractions_liquid(
void) {
320 std::vector<CoolPropDbl> calc_mole_fractions_vapor(
void) {
324 const std::vector<CoolPropDbl> calc_mass_fractions(
void);
327 return PhaseEnvelope;
331 void calc_conformal_state(
const std::string& reference_fluid, CoolPropDbl& T, CoolPropDbl& rhomolar);
333 void resize(std::size_t N);
334 shared_ptr<HelmholtzEOSMixtureBackend> SatL, SatV;
357 void update_TP_guessrho(CoolPropDbl T, CoolPropDbl p, CoolPropDbl rho_guess);
358 void update_DmolarT_direct(CoolPropDbl rhomolar, CoolPropDbl T);
359 void update_HmolarQ_with_guessT(CoolPropDbl hmolar, CoolPropDbl Q, CoolPropDbl Tguess);
366 virtual void set_components(
const std::vector<CoolPropFluid>& components,
bool generate_SatL_and_SatV =
true);
370 void set_mixture_parameters();
376 void set_mole_fractions(
const std::vector<CoolPropDbl>& mf);
378 const std::vector<CoolPropDbl>& get_mole_fractions() {
379 return mole_fractions;
381 std::vector<CoolPropDbl>& get_mole_fractions_ref() {
382 return mole_fractions;
384 std::vector<double>& get_mole_fractions_doubleref(
void) {
385 return mole_fractions;
392 void set_mass_fractions(
const std::vector<CoolPropDbl>& mass_fractions);
394 void calc_ideal_curve(
const std::string& type, std::vector<double>& T, std::vector<double>& p);
396 CoolPropDbl calc_molar_mass(
void);
397 CoolPropDbl calc_gas_constant(
void);
398 CoolPropDbl calc_acentric_factor(
void);
400 CoolPropDbl calc_Bvirial(
void);
401 CoolPropDbl calc_Cvirial(
void);
402 CoolPropDbl calc_dBvirial_dT(
void);
403 CoolPropDbl calc_dCvirial_dT(
void);
405 CoolPropDbl calc_pressure(
void);
406 CoolPropDbl calc_cvmolar(
void);
407 CoolPropDbl calc_cpmolar(
void);
408 CoolPropDbl calc_gibbsmolar(
void);
409 CoolPropDbl calc_gibbsmolar_residual(
void) {
410 return gas_constant() * _T * (alphar() + delta() * dalphar_dDelta());
412 CoolPropDbl calc_gibbsmolar_nocache(CoolPropDbl T, CoolPropDbl rhomolar);
414 CoolPropDbl calc_helmholtzmolar(
void);
415 CoolPropDbl calc_cpmolar_idealgas(
void);
416 CoolPropDbl calc_pressure_nocache(CoolPropDbl T, CoolPropDbl rhomolar);
417 CoolPropDbl calc_smolar(
void);
418 CoolPropDbl calc_smolar_residual(
void) {
419 return gas_constant() * (tau() * dalphar_dTau() - alphar());
421 CoolPropDbl calc_smolar_nocache(CoolPropDbl T, CoolPropDbl rhomolar);
423 CoolPropDbl calc_hmolar(
void);
424 CoolPropDbl calc_hmolar_residual(
void) {
425 return gas_constant() * _T * (tau() * dalphar_dTau() + delta() * dalphar_dDelta());
427 CoolPropDbl calc_hmolar_nocache(CoolPropDbl T, CoolPropDbl rhomolar);
429 CoolPropDbl calc_umolar_nocache(CoolPropDbl T, CoolPropDbl rhomolar);
430 CoolPropDbl calc_umolar(
void);
431 CoolPropDbl calc_speed_sound(
void);
433 void calc_excess_properties();
440 CoolPropDbl calc_phase_identification_parameter(
void);
441 CoolPropDbl calc_fugacity(std::size_t i);
442 virtual CoolPropDbl calc_fugacity_coefficient(std::size_t i);
443 CoolPropDbl calc_chemical_potential(std::size_t i);
446 CoolPropDbl calc_flame_hazard(
void) {
447 return components[0].environment.FH;
450 CoolPropDbl calc_health_hazard(
void) {
451 return components[0].environment.HH;
454 CoolPropDbl calc_physical_hazard(
void) {
455 return components[0].environment.PH;
459 CoolPropDbl calc_alphar(
void);
461 CoolPropDbl calc_dalphar_dDelta(
void);
463 CoolPropDbl calc_dalphar_dTau(
void);
465 CoolPropDbl calc_d2alphar_dDelta2(
void);
467 CoolPropDbl calc_d2alphar_dDelta_dTau(
void);
469 CoolPropDbl calc_d2alphar_dTau2(
void);
471 CoolPropDbl calc_d3alphar_dDelta3(
void);
473 CoolPropDbl calc_d3alphar_dDelta2_dTau(
void);
475 CoolPropDbl calc_d3alphar_dDelta_dTau2(
void);
477 CoolPropDbl calc_d3alphar_dTau3(
void);
479 CoolPropDbl calc_d4alphar_dDelta4(
void);
481 CoolPropDbl calc_d4alphar_dDelta3_dTau(
void);
483 CoolPropDbl calc_d4alphar_dDelta2_dTau2(
void);
485 CoolPropDbl calc_d4alphar_dDelta_dTau3(
void);
487 CoolPropDbl calc_d4alphar_dTau4(
void);
489 CoolPropDbl calc_alpha0(
void);
490 CoolPropDbl calc_dalpha0_dDelta(
void);
491 CoolPropDbl calc_dalpha0_dTau(
void);
492 CoolPropDbl calc_d2alpha0_dDelta2(
void);
493 CoolPropDbl calc_d2alpha0_dDelta_dTau(
void);
494 CoolPropDbl calc_d2alpha0_dTau2(
void);
495 CoolPropDbl calc_d3alpha0_dDelta3(
void);
496 CoolPropDbl calc_d3alpha0_dDelta2_dTau(
void);
497 CoolPropDbl calc_d3alpha0_dDelta_dTau2(
void);
498 CoolPropDbl calc_d3alpha0_dTau3(
void);
500 CoolPropDbl calc_surface_tension(
void);
501 CoolPropDbl calc_viscosity(
void);
502 CoolPropDbl calc_viscosity_dilute(
void);
503 CoolPropDbl calc_viscosity_background(
void);
504 CoolPropDbl calc_viscosity_background(CoolPropDbl eta_dilute, CoolPropDbl& initial_density, CoolPropDbl& residual);
505 CoolPropDbl calc_conductivity(
void);
506 CoolPropDbl calc_conductivity_background(
void);
513 void calc_viscosity_contributions(CoolPropDbl& dilute, CoolPropDbl& initial_density, CoolPropDbl& residual, CoolPropDbl& critical);
519 void calc_conductivity_contributions(CoolPropDbl& dilute, CoolPropDbl& initial_density, CoolPropDbl& residual, CoolPropDbl& critical);
521 CoolPropDbl calc_saturated_liquid_keyed_output(
parameters key);
522 CoolPropDbl calc_saturated_vapor_keyed_output(
parameters key);
524 CoolPropDbl calc_Tmin(
void);
525 CoolPropDbl calc_Tmax(
void);
526 CoolPropDbl calc_pmax(
void);
527 CoolPropDbl calc_Ttriple(
void);
528 CoolPropDbl calc_p_triple(
void);
529 CoolPropDbl calc_pmax_sat(
void);
530 CoolPropDbl calc_Tmax_sat(
void);
531 void calc_Tmin_sat(CoolPropDbl& Tmin_satL, CoolPropDbl& Tmin_satV);
532 void calc_pmin_sat(CoolPropDbl& pmin_satL, CoolPropDbl& pmin_satV);
534 virtual CoolPropDbl calc_T_critical(
void);
535 virtual CoolPropDbl calc_p_critical(
void);
536 virtual CoolPropDbl calc_rhomolar_critical(
void);
538 CoolPropDbl calc_T_reducing(
void) {
539 return get_reducing_state().T;
541 CoolPropDbl calc_rhomolar_reducing(
void) {
542 return get_reducing_state().rhomolar;
544 CoolPropDbl calc_p_reducing(
void) {
545 return get_reducing_state().p;
549 CoolPropDbl calc_PIP(
void) {
556 std::string calc_name(
void);
557 std::vector<std::string> calc_fluid_names(
void);
559 void calc_all_alphar_deriv_cache(
const std::vector<CoolPropDbl>& mole_fractions,
const CoolPropDbl& tau,
const CoolPropDbl& delta);
560 virtual CoolPropDbl calc_alphar_deriv_nocache(
const int nTau,
const int nDelta,
const std::vector<CoolPropDbl>& mole_fractions,
561 const CoolPropDbl& tau,
const CoolPropDbl& delta);
587 CoolPropDbl calc_alpha0_deriv_nocache(
const int nTau,
const int nDelta,
const std::vector<CoolPropDbl>& mole_fractions,
const CoolPropDbl& tau,
588 const CoolPropDbl& delta,
const CoolPropDbl& Tr,
const CoolPropDbl& rhor);
590 virtual void calc_reducing_state(
void);
591 virtual SimpleState calc_reducing_state_nocache(
const std::vector<CoolPropDbl>& mole_fractions);
594 calc_reducing_state();
598 void update_states();
600 CoolPropDbl calc_compressibility_factor(
void) {
601 return 1 + delta() * dalphar_dDelta();
604 void calc_phase_envelope(
const std::string& type);
606 CoolPropDbl SRK_covolume();
613 void T_phase_determination_pure_or_pseudopure(
int other, CoolPropDbl value);
614 void p_phase_determination_pure_or_pseudopure(
int other, CoolPropDbl value,
bool& saturation_called);
615 void DmolarP_phase_determination();
623 virtual CoolPropDbl solver_rho_Tp(CoolPropDbl T, CoolPropDbl p, CoolPropDbl rho_guess = -1);
624 virtual CoolPropDbl solver_rho_Tp_SRK(CoolPropDbl T, CoolPropDbl p,
phases phase);
625 enum StationaryPointReturnFlag
627 ZERO_STATIONARY_POINTS,
628 ONE_STATIONARY_POINT_FOUND,
629 TWO_STATIONARY_POINTS_FOUND
631 virtual StationaryPointReturnFlag solver_dpdrho0_Tp(CoolPropDbl T, CoolPropDbl p, CoolPropDbl rhomax, CoolPropDbl& light, CoolPropDbl& heavy);
632 virtual CoolPropDbl solver_rho_Tp_global(CoolPropDbl T, CoolPropDbl p, CoolPropDbl rhomax);
640 bool cache_values =
false) {
642 std::size_t N = x.size();
643 for (std::size_t i = 0; i < N; ++i) {
645 summer = summer + derivs * x[i];
653 std::size_t N = x.size();
654 if (i == N - 1)
return 0;
657 throw ValueError(format(
"xN_flag is invalid"));
662 return HEOS.
components[i].EOS().dalphar_dTau(HEOS._tau, HEOS._delta);
664 std::size_t N = x.size();
665 if (i == N - 1)
return 0;
666 return HEOS.
components[i].EOS().dalphar_dTau(HEOS._tau, HEOS._delta) - HEOS.
components[N - 1].EOS().dalphar_dTau(HEOS._tau, HEOS._delta);
668 throw ValueError(format(
"xN_flag is invalid"));
675 std::size_t N = x.size();
676 if (i == N - 1)
return 0;
678 - HEOS.
components[N - 1].EOS().dalphar_dDelta(HEOS._tau, HEOS._delta);
680 throw ValueError(format(
"xN_flag is invalid"));
687 std::size_t N = x.size();
688 if (i == N - 1)
return 0;
692 throw ValueError(format(
"xN_flag is invalid"));
699 std::size_t N = x.size();
700 if (i == N - 1)
return 0;
704 throw ValueError(format(
"xN_flag is invalid"));
711 std::size_t N = x.size();
712 if (i == N - 1)
return 0;
716 throw ValueError(format(
"xN_flag is invalid"));
727 throw ValueError(format(
"xN_flag is invalid"));
735 throw ValueError(format(
"xN_flag is invalid"));
742 throw ValueError(format(
"xN_flag is invalid"));
749 throw ValueError(format(
"xN_flag is invalid"));
756 throw ValueError(format(
"xN_flag is invalid"));
760 CoolPropDbl d3alphardxidxjdxk(
HelmholtzEOSMixtureBackend& HEOS, std::vector<CoolPropDbl>& x, std::size_t i, std::size_t j, std::size_t k,
764 CoolPropDbl d3alphar_dxi_dxj_dDelta(
HelmholtzEOSMixtureBackend& HEOS, std::vector<CoolPropDbl>& x, std::size_t i, std::size_t j,
768 CoolPropDbl d3alphar_dxi_dxj_dTau(
HelmholtzEOSMixtureBackend& HEOS, std::vector<CoolPropDbl>& x, std::size_t i, std::size_t j,
772 CoolPropDbl d4alphar_dxi_dxj_dDelta2(
HelmholtzEOSMixtureBackend& HEOS, std::vector<CoolPropDbl>& x, std::size_t i, std::size_t j,
776 CoolPropDbl d4alphar_dxi_dxj_dDelta_dTau(
HelmholtzEOSMixtureBackend& HEOS, std::vector<CoolPropDbl>& x, std::size_t i, std::size_t j,
780 CoolPropDbl d4alphar_dxi_dxj_dTau2(
HelmholtzEOSMixtureBackend& HEOS, std::vector<CoolPropDbl>& x, std::size_t i, std::size_t j,
808 bool cache_values =
false) {
809 HelmholtzDerivatives a = CS.
all(HEOS, tau, delta, mole_fractions, cache_values) + Excess.
all(tau, delta, mole_fractions, cache_values);
810 a.delta_x_dalphar_ddelta = delta * a.dalphar_ddelta;
811 a.tau_x_dalphar_dtau = tau * a.dalphar_dtau;
813 a.delta2_x_d2alphar_ddelta2 = POW2(delta) * a.d2alphar_ddelta2;
814 a.deltatau_x_d2alphar_ddelta_dtau = delta * tau * a.d2alphar_ddelta_dtau;
815 a.tau2_x_d2alphar_dtau2 = POW2(tau) * a.d2alphar_dtau2;
820 std::vector<CoolPropDbl>& mole_fractions = HEOS.get_mole_fractions_ref();
821 return CS.dalphar_dxi(HEOS, mole_fractions, i, xN_flag) + Excess.dalphar_dxi(mole_fractions, i, xN_flag);
824 std::vector<CoolPropDbl>& mole_fractions = HEOS.get_mole_fractions_ref();
825 return CS.d2alphardxidxj(HEOS, mole_fractions, i, j, xN_flag) + Excess.d2alphardxidxj(mole_fractions, i, j, xN_flag);
828 std::vector<CoolPropDbl>& mole_fractions = HEOS.get_mole_fractions_ref();
829 return CS.d2alphar_dxi_dTau(HEOS, mole_fractions, i, xN_flag) + Excess.d2alphar_dxi_dTau(mole_fractions, i, xN_flag);
832 std::vector<CoolPropDbl>& mole_fractions = HEOS.get_mole_fractions_ref();
833 return CS.d2alphar_dxi_dDelta(HEOS, mole_fractions, i, xN_flag) + Excess.d2alphar_dxi_dDelta(mole_fractions, i, xN_flag);
836 std::vector<CoolPropDbl>& mole_fractions = HEOS.get_mole_fractions_ref();
837 return CS.d3alphar_dxi_dTau2(HEOS, mole_fractions, i, xN_flag) + Excess.d3alphar_dxi_dTau2(mole_fractions, i, xN_flag);
840 std::vector<CoolPropDbl>& mole_fractions = HEOS.get_mole_fractions_ref();
841 return CS.d3alphar_dxi_dDelta_dTau(HEOS, mole_fractions, i, xN_flag) + Excess.d3alphar_dxi_dDelta_dTau(mole_fractions, i, xN_flag);
844 std::vector<CoolPropDbl>& mole_fractions = HEOS.get_mole_fractions_ref();
845 return CS.d3alphar_dxi_dDelta2(HEOS, mole_fractions, i, xN_flag) + Excess.d3alphar_dxi_dDelta2(mole_fractions, i, xN_flag);
848 std::vector<CoolPropDbl>& mole_fractions = HEOS.get_mole_fractions_ref();
849 return CS.d3alphar_dxi_dxj_dTau(HEOS, mole_fractions, i, j, xN_flag) + Excess.d3alphar_dxi_dxj_dTau(mole_fractions, i, j, xN_flag);
852 std::vector<CoolPropDbl>& mole_fractions = HEOS.get_mole_fractions_ref();
853 return CS.d3alphar_dxi_dxj_dDelta(HEOS, mole_fractions, i, j, xN_flag) + Excess.d3alphar_dxi_dxj_dDelta(mole_fractions, i, j, xN_flag);
857 std::vector<CoolPropDbl>& mole_fractions = HEOS.get_mole_fractions_ref();
858 return CS.d3alphardxidxjdxk(HEOS, mole_fractions, i, j, k, xN_flag) + Excess.d3alphardxidxjdxk(mole_fractions, i, j, k, xN_flag);
862 std::vector<CoolPropDbl>& mole_fractions = HEOS.get_mole_fractions_ref();
863 return CS.d4alphar_dxi_dTau3(HEOS, mole_fractions, i, xN_flag) + Excess.d4alphar_dxi_dTau3(mole_fractions, i, xN_flag);
866 std::vector<CoolPropDbl>& mole_fractions = HEOS.get_mole_fractions_ref();
867 return CS.d4alphar_dxi_dDelta2_dTau(HEOS, mole_fractions, i, xN_flag) + Excess.d4alphar_dxi_dDelta2_dTau(mole_fractions, i, xN_flag);
870 std::vector<CoolPropDbl>& mole_fractions = HEOS.get_mole_fractions_ref();
871 return CS.d4alphar_dxi_dDelta_dTau2(HEOS, mole_fractions, i, xN_flag) + Excess.d4alphar_dxi_dDelta_dTau2(mole_fractions, i, xN_flag);
874 std::vector<CoolPropDbl>& mole_fractions = HEOS.get_mole_fractions_ref();
875 return CS.d4alphar_dxi_dDelta3(HEOS, mole_fractions, i, xN_flag) + Excess.d4alphar_dxi_dDelta3(mole_fractions, i, xN_flag);
878 std::vector<CoolPropDbl>& mole_fractions = HEOS.get_mole_fractions_ref();
879 return CS.d4alphar_dxi_dxj_dTau2(HEOS, mole_fractions, i, j, xN_flag) + Excess.d4alphar_dxi_dxj_dTau2(mole_fractions, i, j, xN_flag);
882 std::vector<CoolPropDbl>& mole_fractions = HEOS.get_mole_fractions_ref();
883 return CS.d4alphar_dxi_dxj_dDelta_dTau(HEOS, mole_fractions, i, j, xN_flag)
884 + Excess.d4alphar_dxi_dxj_dDelta_dTau(mole_fractions, i, j, xN_flag);
887 std::vector<CoolPropDbl>& mole_fractions = HEOS.get_mole_fractions_ref();
888 return CS.d4alphar_dxi_dxj_dDelta2(HEOS, mole_fractions, i, j, xN_flag) + Excess.d4alphar_dxi_dxj_dDelta2(mole_fractions, i, j, xN_flag);
890 virtual CoolPropDbl d4alphar_dxi_dxj_dxk_dDelta(
HelmholtzEOSMixtureBackend& HEOS, std::size_t i, std::size_t j, std::size_t k,
Definition: PhaseEnvelopeRoutines.h:8
virtual void add_transient_pure_state()
Update the state class used to calculate the critical point(s)
Definition: HelmholtzEOSMixtureBackend.h:86
std::vector< CoolPropDbl > lnK
The natural logarithms of the K factors of the components.
Definition: HelmholtzEOSMixtureBackend.h:97
MoleFractions mole_fractions
The bulk mole fractions of the mixture.
Definition: HelmholtzEOSMixtureBackend.h:96
double delta(void)
Return the reduced density ( )
Definition: AbstractState.cpp:549
Temperature at the critical point.
Definition: DataStructures.h:75
void set_reference_stateD(const std::string &FluidName, double T, double rhomolar, double hmolar0, double smolar0)
Set the reference state based on a thermodynamic state point specified by temperature and molar densi...
Definition: CoolProp.cpp:971
Molar density used for the critical point.
Definition: DataStructures.h:73
double get_config_double(configuration_keys key)
Return the value of a double configuration key.
Definition: Configuration.cpp:92
virtual bool clear()
Clear all the cached values.
Definition: AbstractState.cpp:186
Definition: DataStructures.h:36
phases
These are constants for the phases of the fluid.
Definition: DataStructures.h:176
Pressure at the critical point.
Definition: DataStructures.h:78
Temperature at the reducing state.
Definition: DataStructures.h:74
std::size_t N
Number of components.
Definition: HelmholtzEOSMixtureBackend.h:101
Ideal-gas constant.
Definition: DataStructures.h:69
SimpleState sat_min_liquid
The saturated liquid state at the minimum saturation temperature.
Definition: CoolPropFluid.h:422
x_N is an dependent variable, calculated by
Definition: ReducingFunctions.h:21
double R_u
The universal gas constant used for this EOS (usually, but not always, 8.314472 J/mol/K) ...
Definition: CoolPropFluid.h:430
The mother of all state classes.
Definition: AbstractState.h:78
Definition: HelmholtzEOSMixtureBackend.h:23
Definition: ExcessHEFunction.h:198
A modified class for the state point at the maximum saturation entropy on the vapor curve...
Definition: DataStructures.h:45
std::string get_parameter_information(int key, const std::string &info)
Return information about the parameter.
Definition: DataStructures.cpp:176
A thermophysical property provider for critical and reducing values as well as derivatives of Helmhol...
Definition: CoolPropFluid.h:521
shared_ptr< HelmholtzEOSMixtureBackend > transient_pure_state
A temporary state used for calculations of pure fluid properties.
Definition: HelmholtzEOSMixtureBackend.h:66
This structure holds values obtained while tracing the spinodal curve (most often in the process of f...
Definition: AbstractState.h:23
A data structure to hold the data for a phase envelope.
Definition: PhaseEnvelope.h:36
const std::vector< CoolPropDbl > & get_mole_fractions()
Get the mole fractions of the fluid.
Definition: HelmholtzEOSMixtureBackend.h:372
Definition: MixtureParameters.h:55
virtual HelmholtzDerivatives all(HelmholtzEOSMixtureBackend &HEOS, double tau, double delta, const std::vector< CoolPropDbl > &x, bool cache_values=false)
Calculate all the derivatives that do not involve any composition derivatives.
Definition: HelmholtzEOSMixtureBackend.h:639
input_pairs
These are input pairs that can be used for the update function (in each pair, input keys are sorted a...
Definition: DataStructures.h:274
const EquationOfState & EOS() const
Get a reference to the equation of state.
Definition: CoolPropFluid.h:532
Definition: Exceptions.h:45
double molar_mass
The molar mass in kg/mol (note NOT kg/kmol)
Definition: CoolPropFluid.h:430
std::vector< shared_ptr< HelmholtzEOSMixtureBackend > > linked_states
States that are linked to this one, and should be updated (BIP, reference state, etc.)
Definition: HelmholtzEOSMixtureBackend.h:65
shared_ptr< HelmholtzEOSMixtureBackend > TPD_state
A temporary state used for calculations of the tangent-plane-distance.
Definition: HelmholtzEOSMixtureBackend.h:67
Triple point temperature.
Definition: DataStructures.h:80
double tau(void)
Return the reciprocal of the reduced temperature ( )
Definition: AbstractState.cpp:545
Molar mass.
Definition: DataStructures.h:70
void set_reference_stateS(const std::string &FluidName, const std::string &reference_state)
Set the reference state based on a string representation.
Definition: CoolProp.cpp:892
SimpleState reduce
Reducing state used for the EOS (usually, but not always, the critical point)
Definition: CoolPropFluid.h:422
double acentric
The acentric factor .
Definition: CoolPropFluid.h:430
Molar density used for the reducing state.
Definition: DataStructures.h:72
virtual HelmholtzDerivatives all(const CoolPropDbl tau, const CoolPropDbl delta, const std::vector< CoolPropDbl > &mole_fractions, bool cache_values=false)
Calculate all the derivatives that do not involve any composition derivatives.
Definition: ExcessHEFunction.h:255
Acentric factor.
Definition: DataStructures.h:71
shared_ptr< HelmholtzEOSMixtureBackend > critical_state
A temporary state used for calculations of the critical point(s)
Definition: HelmholtzEOSMixtureBackend.h:68
Mole-based density.
Definition: DataStructures.h:96
bool clear()
Clear all the cached values.
Definition: HelmholtzEOSMixtureBackend.h:128
Definition: Helmholtz.h:45
Pressure.
Definition: DataStructures.h:90
void set_fluid_enthalpy_entropy_offset(const std::string &fluid, double delta_a1, double delta_a2, const std::string &ref)
Set the internal enthalpy and entropy offset variables.
Definition: FluidLibrary.cpp:355
Definition: HelmholtzEOSMixtureBackend.h:635
x_N is an independent variable, and not calculated by
Definition: ReducingFunctions.h:20
SimpleState crit
The state at the critical point.
Definition: CoolPropFluid.h:556
This simple class holds the values for guesses for use in some solvers that have the ability to use g...
Definition: AbstractState.h:33
Definition: TransportRoutines.h:8
Definition: HelmholtzEOSMixtureBackend.h:58
Triple point pressure.
Definition: DataStructures.h:81
virtual void add_critical_state()
Update the state class used to calculate the critical point(s)
Definition: HelmholtzEOSMixtureBackend.h:78
This class is a friend class of HelmholtzEOSMixtureBackend, therefore the static methods contained in...
Definition: FlashRoutines.h:28
x_N_dependency_flag
Definition: ReducingFunctions.h:18
void apply_simple_mixing_rule(const std::string &identifier1, const std::string &identifier2, const std::string &rule)
Add a simple mixing rule.
Definition: MixtureParameters.cpp:291
bool is_pure_or_pseudopure
A flag for whether the substance is a pure or pseudo-pure fluid (true) or a mixture (false) ...
Definition: HelmholtzEOSMixtureBackend.h:95
This file contains flash routines in which the state is unknown, and a solver of some kind must be us...
Definition: AbstractState.h:19
std::string backend_name(void)
Get a string representation of the backend - for instance "HelmholtzEOSMixtureBackend" for the core m...
Definition: HelmholtzEOSMixtureBackend.h:118
parameters
Define some constants that will be used throughout These are constants for the input and output para...
Definition: DataStructures.h:64
std::vector< CoolPropFluid > components
The components that are in use.
Definition: HelmholtzEOSMixtureBackend.h:92
Temperature.
Definition: DataStructures.h:89
This class contains the two primary contributions to the residual Helmholtz energy - a corresponding ...
Definition: HelmholtzEOSMixtureBackend.h:791
This class is a friend class of HelmholtzEOSMixtureBackend, therefore the static methods contained in...
Definition: MixtureDerivatives.h:33
Definition: DataStructures.h:16