teqp 0.22.0
Loading...
Searching...
No Matches
AbstractModel_implementation.cpp
Go to the documentation of this file.
6
7namespace teqp{
8 namespace cppinterface{
9
10 double AbstractModel::get_neff(const double T, const double rho, const EArrayd& molefracs) const {
11 return -3.0*(this->get_Ar01(T, rho, molefracs) - this->get_Ar11(T, rho, molefracs) )/this->get_Ar20(T,rho,molefracs);
12 };
13
14 std::tuple<double, double> AbstractModel::solve_pure_critical(const double T, const double rho, const std::optional<nlohmann::json>& flags) const {
15 return teqp::solve_pure_critical(*this, T, rho, flags.value_or(nlohmann::json{}));
16 }
17 std::tuple<EArrayd, EMatrixd> AbstractModel::get_pure_critical_conditions_Jacobian(const double T, const double rho, const std::optional<std::size_t>& alternative_pure_index, const std::optional<std::size_t>& alternative_length) const {
18 return teqp::get_pure_critical_conditions_Jacobian(*this, T, rho, alternative_pure_index, alternative_length);
19 }
20 EArray2 AbstractModel::extrapolate_from_critical(const double Tc, const double rhoc, const double Tnew, const std::optional<Eigen::ArrayXd>& molefracs) const {
21 return teqp::extrapolate_from_critical(*this, Tc, rhoc, Tnew, molefracs);
22 }
23
24 EArray2 AbstractModel::pure_VLE_T(const double T, const double rhoL, const double rhoV, int maxiter, const std::optional<Eigen::ArrayXd>& molefracs) const {
25 return teqp::pure_VLE_T(*this, T, rhoL, rhoV, maxiter, molefracs);
26 }
27
28 double AbstractModel::dpsatdT_pure(const double T, const double rhoL, const double rhoV) const {
29 return teqp::dpsatdT_pure(*this, T, rhoL, rhoV);
30 }
31
32 std::tuple<VLLE::VLLE_return_code,EArrayd,EArrayd,EArrayd> AbstractModel::mix_VLLE_T(const double T, const REArrayd& rhovecVinit, const REArrayd& rhovecL1init, const REArrayd& rhovecL2init, const double atol, const double reltol, const double axtol, const double relxtol, const int maxiter) const{
33
34 return VLLE::mix_VLLE_T(*this, T, rhovecVinit, rhovecL1init, rhovecL2init, atol, reltol, axtol, relxtol, maxiter);
35 }
36
37 std::vector<nlohmann::json> AbstractModel::find_VLLE_T_binary(const std::vector<nlohmann::json>& traces, const std::optional<VLLE::VLLEFinderOptions> options) const{
38 return VLLE::find_VLLE_T_binary(*this, traces, options);
39 }
40 std::vector<nlohmann::json> AbstractModel::find_VLLE_p_binary(const std::vector<nlohmann::json>& traces, const std::optional<VLLE::VLLEFinderOptions> options) const{
41 return VLLE::find_VLLE_p_binary(*this, traces, options);
42 }
43
44 nlohmann::json AbstractModel::trace_VLLE_binary(const double T, const REArrayd& rhovecV, const REArrayd& rhovecL1, const REArrayd& rhovecL2, const std::optional<VLLE::VLLETracerOptions> options) const{
45 return VLLE::trace_VLLE_binary(*this, T, rhovecV, rhovecL1, rhovecL2, options);
46 }
47
48 std::tuple<VLE_return_code,EArrayd,EArrayd> AbstractModel::mix_VLE_Tx(const double T, const REArrayd& rhovecL0, const REArrayd& rhovecV0, const REArrayd& xspec, const double atol, const double reltol, const double axtol, const double relxtol, const int maxiter) const{
49 return teqp::mix_VLE_Tx(*this, T, rhovecL0, rhovecV0, xspec, atol, reltol, axtol, relxtol, maxiter);
50
51 }
52 MixVLEReturn AbstractModel::mix_VLE_Tp(const double T, const double pgiven, const REArrayd& rhovecL0, const REArrayd& rhovecV0, const std::optional<MixVLETpFlags> &flags) const{
53 return teqp::mix_VLE_Tp(*this, T, pgiven, rhovecL0, rhovecV0, flags);
54 }
55 std::tuple<VLE_return_code,double,EArrayd,EArrayd> AbstractModel::mixture_VLE_px(const double p_spec, const REArrayd& xmolar_spec, const double T0, const REArrayd& rhovecL0, const REArrayd& rhovecV0, const std::optional<MixVLEpxFlags>& flags) const{
56 return teqp::mixture_VLE_px(*this, p_spec, xmolar_spec, T0, rhovecL0, rhovecV0, flags);
57 }
58
59 std::tuple<EArrayd, EArrayd> AbstractModel::get_drhovecdp_Tsat(const double T, const REArrayd& rhovecL, const REArrayd& rhovecV) const {
60 return teqp::get_drhovecdp_Tsat(*this, T, rhovecL, rhovecV);
61 }
62 std::tuple<EArrayd, EArrayd> AbstractModel::get_drhovecdT_psat(const double T, const REArrayd& rhovecL, const REArrayd& rhovecV) const {
63 return teqp::get_drhovecdT_psat(*this, T, rhovecL, rhovecV);
64 }
65 double AbstractModel::get_dpsat_dTsat_isopleth(const double T, const REArrayd& rhovecL, const REArrayd& rhovecV) const {
66 return teqp::get_dpsat_dTsat_isopleth(*this, T, rhovecL, rhovecV);
67 }
68 nlohmann::json AbstractModel::trace_VLE_isotherm_binary(const double T0, const EArrayd& rhovecL0, const EArrayd& rhovecV0, const std::optional<TVLEOptions> &options) const{
69 return teqp::trace_VLE_isotherm_binary(*this, T0, rhovecL0, rhovecV0, options);
70 }
71 nlohmann::json AbstractModel::trace_VLE_isobar_binary(const double p, const double T0, const EArrayd& rhovecL0, const EArrayd& rhovecV0, const std::optional<PVLEOptions> &options) const{
72 return teqp::trace_VLE_isobar_binary(*this, p, T0, rhovecL0, rhovecV0, options);
73 }
74
75 nlohmann::json AbstractModel::trace_critical_arclength_binary(const double T0, const EArrayd& rhovec0, const std::optional<std::string>& filename, const std::optional<TCABOptions> &options) const {
76 using crit = teqp::CriticalTracing<decltype(*this), double, std::decay_t<decltype(rhovec0)>>;
77 return crit::trace_critical_arclength_binary(*this, T0, rhovec0, filename , options);
78 }
79 EArrayd AbstractModel::get_drhovec_dT_crit(const double T, const REArrayd& rhovec) const {
80 using crit = teqp::CriticalTracing<decltype(*this), double, std::decay_t<decltype(rhovec)>>;
81 return crit::get_drhovec_dT_crit(*this, T, rhovec);
82 }
83 double AbstractModel::get_dp_dT_crit(const double T, const REArrayd& rhovec) const {
84 using crit = teqp::CriticalTracing<decltype(*this), double, std::decay_t<decltype(rhovec)>>;
85 return crit::get_dp_dT_crit(*this, T, rhovec);
86 }
87 EArray2 AbstractModel::get_criticality_conditions(const double T, const REArrayd& rhovec) const {
88 using crit = teqp::CriticalTracing<decltype(*this), double, std::decay_t<decltype(rhovec)>>;
89 return crit::get_criticality_conditions(*this, T, rhovec);
90 }
91 EigenData AbstractModel::eigen_problem(const double T, const REArrayd& rhovec, const std::optional<REArrayd>& alignment_v0) const {
92 using crit = teqp::CriticalTracing<decltype(*this), double, std::decay_t<decltype(rhovec)>>;
93 return crit::eigen_problem(*this, T, rhovec, alignment_v0.value_or(Eigen::ArrayXd()));
94 }
95 double AbstractModel::get_minimum_eigenvalue_Psi_Hessian(const double T, const REArrayd& rhovec) const {
96 using crit = teqp::CriticalTracing<decltype(*this), double, std::decay_t<decltype(rhovec)>>;
97 return crit::get_minimum_eigenvalue_Psi_Hessian(*this, T, rhovec);
98 }
99
100 }
101}
virtual double get_Ar01(const double T, const double rho, const REArrayd &molefrac) const =0
std::vector< nlohmann::json > find_VLLE_T_binary(const std::vector< nlohmann::json > &traces, const std::optional< VLLE::VLLEFinderOptions > options=std::nullopt) const
std::tuple< VLLE::VLLE_return_code, EArrayd, EArrayd, EArrayd > mix_VLLE_T(const double T, const REArrayd &rhovecVinit, const REArrayd &rhovecL1init, const REArrayd &rhovecL2init, const double atol, const double reltol, const double axtol, const double relxtol, const int maxiter) const
virtual double get_Ar20(const double T, const double rho, const REArrayd &molefrac) const =0
double dpsatdT_pure(const double T, const double rhoL, const double rhoV) const
virtual std::tuple< VLE_return_code, double, EArrayd, EArrayd > mixture_VLE_px(const double p_spec, const REArrayd &xmolar_spec, const double T0, const REArrayd &rhovecL0, const REArrayd &rhovecV0, const std::optional< MixVLEpxFlags > &flags=std::nullopt) const
virtual nlohmann::json trace_VLE_isobar_binary(const double p, const double T0, const EArrayd &rhovecL0, const EArrayd &rhovecV0, const std::optional< PVLEOptions > &=std::nullopt) const
virtual double get_dpsat_dTsat_isopleth(const double T, const REArrayd &rhovecL, const REArrayd &rhovecV) const
double get_neff(const double, const double, const EArrayd &) const
nlohmann::json trace_VLLE_binary(const double T, const REArrayd &rhovecV, const REArrayd &rhovecL1, const REArrayd &rhovecL2, const std::optional< VLLE::VLLETracerOptions > options) const
virtual EArrayd get_drhovec_dT_crit(const double T, const REArrayd &rhovec) const
virtual double get_minimum_eigenvalue_Psi_Hessian(const double T, const REArrayd &rhovec) const
virtual EArray2 get_criticality_conditions(const double T, const REArrayd &rhovec) const
EArray2 extrapolate_from_critical(const double Tc, const double rhoc, const double Tgiven, const std::optional< Eigen::ArrayXd > &molefracs=std::nullopt) const
virtual MixVLEReturn mix_VLE_Tp(const double T, const double pgiven, const REArrayd &rhovecL0, const REArrayd &rhovecV0, const std::optional< MixVLETpFlags > &flags=std::nullopt) const
virtual nlohmann::json trace_VLE_isotherm_binary(const double T0, const EArrayd &rhovec0, const EArrayd &rhovecV0, const std::optional< TVLEOptions > &=std::nullopt) const
virtual std::tuple< VLE_return_code, EArrayd, EArrayd > mix_VLE_Tx(const double T, const REArrayd &rhovecL0, const REArrayd &rhovecV0, const REArrayd &xspec, const double atol, const double reltol, const double axtol, const double relxtol, const int maxiter) const
virtual EigenData eigen_problem(const double T, const REArrayd &rhovec, const std::optional< REArrayd > &=std::nullopt) const
EArray2 pure_VLE_T(const double T, const double rhoL, const double rhoV, int maxiter, const std::optional< Eigen::ArrayXd > &molefracs=std::nullopt) const
std::tuple< double, double > solve_pure_critical(const double T, const double rho, const std::optional< nlohmann::json > &=std::nullopt) const
virtual double get_dp_dT_crit(const double T, const REArrayd &rhovec) const
virtual double get_Ar11(const double T, const double rho, const REArrayd &molefrac) const =0
virtual std::tuple< EArrayd, EArrayd > get_drhovecdp_Tsat(const double T, const REArrayd &rhovecL, const REArrayd &rhovecV) const
std::tuple< EArrayd, EMatrixd > get_pure_critical_conditions_Jacobian(const double T, const double rho, const std::optional< std::size_t > &alternative_pure_index, const std::optional< std::size_t > &alternative_length) const
std::vector< nlohmann::json > find_VLLE_p_binary(const std::vector< nlohmann::json > &traces, const std::optional< VLLE::VLLEFinderOptions > options=std::nullopt) const
virtual nlohmann::json trace_critical_arclength_binary(const double T0, const EArrayd &rhovec0, const std::optional< std::string > &=std::nullopt, const std::optional< TCABOptions > &=std::nullopt) const
virtual std::tuple< EArrayd, EArrayd > get_drhovecdT_psat(const double T, const REArrayd &rhovecL, const REArrayd &rhovecV) const
auto find_VLLE_p_binary(const AbstractModel &model, const std::vector< nlohmann::json > &traces, const std::optional< VLLEFinderOptions > &options=std::nullopt)
Given an isobaric VLE trace(s) for a binary mixture, obtain the VLLE solution.
Definition VLLE.hpp:477
auto find_VLLE_T_binary(const AbstractModel &model, const std::vector< nlohmann::json > &traces, const std::optional< VLLEFinderOptions > &options=std::nullopt)
Given an isothermal VLE trace(s) for a binary mixture, obtain the VLLE solution.
Definition VLLE.hpp:468
auto trace_VLLE_binary(const teqp::VLLE::AbstractModel &model, const double Tinit, const EArrayd &rhovecVinit, const EArrayd &rhovecL1init, const EArrayd &rhovecL2init, const std::optional< VLLETracerOptions > &options_=std::nullopt)
Given an initial VLLE solution, trace the VLLE curve. We know the VLLE curve is a function of only on...
Definition VLLE.hpp:519
auto mix_VLLE_T(const AbstractModel &model, double T, const EArrayd &rhovecVinit, const EArrayd &rhovecL1init, const EArrayd &rhovecL2init, double atol, double reltol, double axtol, double relxtol, int maxiter)
Definition VLLE.hpp:30
auto get_dpsat_dTsat_isopleth(const Model &model, const double &T, const Eigen::ArrayXd &rhovecL, const Eigen::ArrayXd &rhovecV)
Derivative of pressure w.r.t. temperature along the isopleth of a phase envelope (at constant composi...
Definition VLE.hpp:764
auto trace_VLE_isotherm_binary(const AbstractModel &model, double T, const Eigen::ArrayXd &rhovecL0, const Eigen::ArrayXd &rhovecV0, const std::optional< TVLEOptions > &options=std::nullopt)
Definition VLE.hpp:792
auto mix_VLE_Tx(const AbstractModel &model, double T, const Eigen::ArrayXd &rhovecL0, const Eigen::ArrayXd &rhovecV0, const Eigen::ArrayXd &xspec, double atol, double reltol, double axtol, double relxtol, int maxiter)
Definition VLE.hpp:76
auto solve_pure_critical(const Model &model, const Scalar T0, const Scalar rho0, const std::optional< nlohmann::json > &flags=std::nullopt)
Eigen::Array< double, 2, 1 > extrapolate_from_critical(const Model &model, const Scalar &Tc, const Scalar &rhoc, const Scalar &T, const std::optional< Eigen::ArrayXd > &z=std::nullopt)
auto dpsatdT_pure(const teqp::cppinterface::AbstractModel &model, double T, double rhoL, double rhoV, const std::optional< Eigen::ArrayXd > &molefracs=std::nullopt)
Definition VLE_pure.hpp:158
auto get_pure_critical_conditions_Jacobian(const AbstractModel &model, const double T, const double rho, const std::optional< std::size_t > &alternative_pure_index=std::nullopt, const std::optional< std::size_t > &alternative_length=std::nullopt)
auto pure_VLE_T(const teqp::cppinterface::AbstractModel &model, double T, double rhoL, double rhoV, int maxiter, const std::optional< Eigen::ArrayXd > &molefracs=std::nullopt)
Definition VLE_pure.hpp:138
auto mixture_VLE_px(const AbstractModel &model, double p_spec, const Eigen::ArrayXd &xmolar_spec, double T0, const Eigen::ArrayXd &rhovecL0, const Eigen::ArrayXd &rhovecV0, const std::optional< MixVLEpxFlags > &flags_=std::nullopt)
Definition VLE.hpp:399
auto mix_VLE_Tp(const AbstractModel &model, double T, double pgiven, const Eigen::ArrayXd &rhovecL0, const Eigen::ArrayXd &rhovecV0, const std::optional< MixVLETpFlags > &flags_=std::nullopt)
Definition VLE.hpp:287
auto get_drhovecdp_Tsat(const AbstractModel &model, const double &T, const Eigen::ArrayXd &rhovecL, const Eigen::ArrayXd &rhovecV)
Definition VLE.hpp:524
auto trace_VLE_isobar_binary(const Model &model, double p, double T0, const Eigen::ArrayXd &rhovecL0, const Eigen::ArrayXd &rhovecV0, const std::optional< PVLEOptions > &options=std::nullopt)
Definition VLE.hpp:1047
auto get_drhovecdT_psat(const AbstractModel &model, const double &T, const Eigen::ArrayXd &rhovecL, const Eigen::ArrayXd &rhovecV)
Definition VLE.hpp:598
Eigen::Ref< const EArrayd > REArrayd
Definition teqpcpp.hpp:18
Eigen::Array< double, 2, 1 > EArray2
Definition teqpcpp.hpp:15
Eigen::ArrayX< double > EArrayd
Definition teqpcpp.hpp:16