CoolProp
6.6.0
An open-source fluid property and humid air property database
|
A class to do newton raphson solver for mixture VLE for p,Q or T,Q.
A class is used rather than a function so that it is easier to store iteration histories, additional output values, etc.
As in Gernert, FPE, 2014, except that only one of T and P are known
The independent variables are \(N-1\) mole fractions in liquid, \(N-1\) mole fractions in vapor, and the non-specified variable in p or T, for a total of \(2N-1\) independent variables
First N residuals are from
\(F_k = \ln f_i(T,p,\mathbf{x}) - \ln f_i(T,p,\mathbf{y})\) for \(i = 1, ... N\) and \(k=i\)
Derivatives are the same as for the saturation solver newton_raphson_saturation
Second N-1 residuals are from
\(F_k = \dfrac{z_i-x_i}{y_i-x_i} - \beta_{spec}\) for \( i = 1, ... N-2\) and \(k = i+N\)
Gernert eq. 35
\(\dfrac{\partial F_k}{\partial x_i} = \dfrac{z_i-y_i}{(y_i-x_i)^2}\)
Gernert eq. 36
\(\dfrac{\partial F_k}{\partial y_i} = -\dfrac{z_i-x_i}{(y_i-x_i)^2}\)
\(\dfrac{\partial F_k}{\partial T} = 0\) Because x, y and T are independent by definition of the formulation
\(\dfrac{\partial F_k}{\partial p} = 0\) Because x, y and p are independent by definition of the formulation
Definition at line 354 of file VLERoutines.h.
#include <VLERoutines.h>
Public Member Functions | |
newton_raphson_twophase () | |
void | resize (unsigned int N) |
void | pre_call () |
void | call (HelmholtzEOSMixtureBackend &HEOS, newton_raphson_twophase_options &IO) |
Call the Newton-Raphson VLE Solver. More... | |
void | build_arrays () |
Public Attributes | |
HelmholtzEOSMixtureBackend * | HEOS |
newton_raphson_twophase_options::imposed_variable_options | imposed_variable |
CoolPropDbl | error_rms |
CoolPropDbl | rhomolar_liq |
CoolPropDbl | rhomolar_vap |
CoolPropDbl | T |
CoolPropDbl | p |
CoolPropDbl | min_rel_change |
CoolPropDbl | beta |
std::size_t | N |
bool | logging |
int | Nsteps |
Eigen::MatrixXd | J |
Eigen::Vector2d | r |
Eigen::Vector2d | err_rel |
std::vector< CoolPropDbl > | K |
std::vector< CoolPropDbl > | x |
std::vector< CoolPropDbl > | y |
std::vector< CoolPropDbl > | z |
std::vector< SuccessiveSubstitutionStep > | step_logger |
|
inline |
Definition at line 368 of file VLERoutines.h.
void CoolProp::SaturationSolvers::newton_raphson_twophase::build_arrays | ( | ) |
Definition at line 1598 of file VLERoutines.cpp.
void CoolProp::SaturationSolvers::newton_raphson_twophase::call | ( | HelmholtzEOSMixtureBackend & | HEOS, |
newton_raphson_twophase_options & | IO | ||
) |
Call the Newton-Raphson VLE Solver.
This solver must be passed reasonable guess values for the mole fractions, densities, etc. You may want to take a few steps of successive substitution before you start with Newton Raphson.
HEOS | HelmholtzEOSMixtureBackend instance |
IO | The input/output data structure |
Definition at line 1514 of file VLERoutines.cpp.
|
inline |
Definition at line 385 of file VLERoutines.h.
void CoolProp::SaturationSolvers::newton_raphson_twophase::resize | ( | unsigned int | N | ) |
CoolPropDbl CoolProp::SaturationSolvers::newton_raphson_twophase::beta |
Definition at line 359 of file VLERoutines.h.
Eigen::Vector2d CoolProp::SaturationSolvers::newton_raphson_twophase::err_rel |
Definition at line 364 of file VLERoutines.h.
CoolPropDbl CoolProp::SaturationSolvers::newton_raphson_twophase::error_rms |
Definition at line 359 of file VLERoutines.h.
HelmholtzEOSMixtureBackend* CoolProp::SaturationSolvers::newton_raphson_twophase::HEOS |
Definition at line 357 of file VLERoutines.h.
newton_raphson_twophase_options::imposed_variable_options CoolProp::SaturationSolvers::newton_raphson_twophase::imposed_variable |
Definition at line 358 of file VLERoutines.h.
Eigen::MatrixXd CoolProp::SaturationSolvers::newton_raphson_twophase::J |
Definition at line 363 of file VLERoutines.h.
std::vector<CoolPropDbl> CoolProp::SaturationSolvers::newton_raphson_twophase::K |
Definition at line 365 of file VLERoutines.h.
bool CoolProp::SaturationSolvers::newton_raphson_twophase::logging |
Definition at line 361 of file VLERoutines.h.
CoolPropDbl CoolProp::SaturationSolvers::newton_raphson_twophase::min_rel_change |
Definition at line 359 of file VLERoutines.h.
std::size_t CoolProp::SaturationSolvers::newton_raphson_twophase::N |
Definition at line 360 of file VLERoutines.h.
int CoolProp::SaturationSolvers::newton_raphson_twophase::Nsteps |
Definition at line 362 of file VLERoutines.h.
CoolPropDbl CoolProp::SaturationSolvers::newton_raphson_twophase::p |
Definition at line 359 of file VLERoutines.h.
Eigen::Vector2d CoolProp::SaturationSolvers::newton_raphson_twophase::r |
Definition at line 364 of file VLERoutines.h.
CoolPropDbl CoolProp::SaturationSolvers::newton_raphson_twophase::rhomolar_liq |
Definition at line 359 of file VLERoutines.h.
CoolPropDbl CoolProp::SaturationSolvers::newton_raphson_twophase::rhomolar_vap |
Definition at line 359 of file VLERoutines.h.
std::vector<SuccessiveSubstitutionStep> CoolProp::SaturationSolvers::newton_raphson_twophase::step_logger |
Definition at line 366 of file VLERoutines.h.
CoolPropDbl CoolProp::SaturationSolvers::newton_raphson_twophase::T |
Definition at line 359 of file VLERoutines.h.
std::vector<CoolPropDbl> CoolProp::SaturationSolvers::newton_raphson_twophase::x |
Definition at line 365 of file VLERoutines.h.
std::vector<CoolPropDbl> CoolProp::SaturationSolvers::newton_raphson_twophase::y |
Definition at line 365 of file VLERoutines.h.
std::vector<CoolPropDbl> CoolProp::SaturationSolvers::newton_raphson_twophase::z |
Definition at line 365 of file VLERoutines.h.