CoolProp  6.6.0
An open-source fluid property and humid air property database
Public Member Functions | Public Attributes | List of all members
CoolProp::SaturationSolvers::newton_raphson_twophase Class Reference

Detailed Description

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

HelmholtzEOSMixtureBackendHEOS
 
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< CoolPropDblK
 
std::vector< CoolPropDblx
 
std::vector< CoolPropDbly
 
std::vector< CoolPropDblz
 
std::vector< SuccessiveSubstitutionStepstep_logger
 

Constructor & Destructor Documentation

◆ newton_raphson_twophase()

CoolProp::SaturationSolvers::newton_raphson_twophase::newton_raphson_twophase ( )
inline

Definition at line 368 of file VLERoutines.h.

Member Function Documentation

◆ build_arrays()

void CoolProp::SaturationSolvers::newton_raphson_twophase::build_arrays ( )

Definition at line 1598 of file VLERoutines.cpp.

◆ call()

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.

Parameters
HEOSHelmholtzEOSMixtureBackend instance
IOThe input/output data structure

Definition at line 1514 of file VLERoutines.cpp.

◆ pre_call()

void CoolProp::SaturationSolvers::newton_raphson_twophase::pre_call ( )
inline

Definition at line 385 of file VLERoutines.h.

◆ resize()

void CoolProp::SaturationSolvers::newton_raphson_twophase::resize ( unsigned int  N)

Member Data Documentation

◆ beta

CoolPropDbl CoolProp::SaturationSolvers::newton_raphson_twophase::beta

Definition at line 359 of file VLERoutines.h.

◆ err_rel

Eigen::Vector2d CoolProp::SaturationSolvers::newton_raphson_twophase::err_rel

Definition at line 364 of file VLERoutines.h.

◆ error_rms

CoolPropDbl CoolProp::SaturationSolvers::newton_raphson_twophase::error_rms

Definition at line 359 of file VLERoutines.h.

◆ HEOS

HelmholtzEOSMixtureBackend* CoolProp::SaturationSolvers::newton_raphson_twophase::HEOS

Definition at line 357 of file VLERoutines.h.

◆ imposed_variable

newton_raphson_twophase_options::imposed_variable_options CoolProp::SaturationSolvers::newton_raphson_twophase::imposed_variable

Definition at line 358 of file VLERoutines.h.

◆ J

Eigen::MatrixXd CoolProp::SaturationSolvers::newton_raphson_twophase::J

Definition at line 363 of file VLERoutines.h.

◆ K

std::vector<CoolPropDbl> CoolProp::SaturationSolvers::newton_raphson_twophase::K

Definition at line 365 of file VLERoutines.h.

◆ logging

bool CoolProp::SaturationSolvers::newton_raphson_twophase::logging

Definition at line 361 of file VLERoutines.h.

◆ min_rel_change

CoolPropDbl CoolProp::SaturationSolvers::newton_raphson_twophase::min_rel_change

Definition at line 359 of file VLERoutines.h.

◆ N

std::size_t CoolProp::SaturationSolvers::newton_raphson_twophase::N

Definition at line 360 of file VLERoutines.h.

◆ Nsteps

int CoolProp::SaturationSolvers::newton_raphson_twophase::Nsteps

Definition at line 362 of file VLERoutines.h.

◆ p

CoolPropDbl CoolProp::SaturationSolvers::newton_raphson_twophase::p

Definition at line 359 of file VLERoutines.h.

◆ r

Eigen::Vector2d CoolProp::SaturationSolvers::newton_raphson_twophase::r

Definition at line 364 of file VLERoutines.h.

◆ rhomolar_liq

CoolPropDbl CoolProp::SaturationSolvers::newton_raphson_twophase::rhomolar_liq

Definition at line 359 of file VLERoutines.h.

◆ rhomolar_vap

CoolPropDbl CoolProp::SaturationSolvers::newton_raphson_twophase::rhomolar_vap

Definition at line 359 of file VLERoutines.h.

◆ step_logger

std::vector<SuccessiveSubstitutionStep> CoolProp::SaturationSolvers::newton_raphson_twophase::step_logger

Definition at line 366 of file VLERoutines.h.

◆ T

CoolPropDbl CoolProp::SaturationSolvers::newton_raphson_twophase::T

Definition at line 359 of file VLERoutines.h.

◆ x

std::vector<CoolPropDbl> CoolProp::SaturationSolvers::newton_raphson_twophase::x

Definition at line 365 of file VLERoutines.h.

◆ y

std::vector<CoolPropDbl> CoolProp::SaturationSolvers::newton_raphson_twophase::y

Definition at line 365 of file VLERoutines.h.

◆ z

std::vector<CoolPropDbl> CoolProp::SaturationSolvers::newton_raphson_twophase::z

Definition at line 365 of file VLERoutines.h.


The documentation for this class was generated from the following files: