#include <FlashBase.h>

Inheritance diagram for FlashBase:

Public Member Functions

 FlashBase (void)
 
void setIdeal (bool i)
 
bool isIdeal (void)
 
virtual SolverNleInterfacesolver (void)=0
 
virtual int niter (void) const =0
 return Flash iterations More...
 
virtual void estimate (const Value &Pres, const Value &Temp)=0
 
const ValueTemperature (void) const
 
const ValuePressure (void) const
 
virtual const ValueFraction (Libpf::Utility::PhaseIndex p, bool clip=false) const =0
 during Flash iterations use this function to get the actual estimate of the fraction of phase p More...
 
virtual Vector X (Libpf::Utility::PhaseIndex p) const =0
 
virtual const ValueSumx (Libpf::Utility::PhaseIndex p) const =0
 
virtual bool converged (void) const =0
 returns true if the flash has been solved successfully, More...
 

Protected Member Functions

virtual ~FlashBase ()=default
 
virtual const ValuecalculateTotalP (const Value &rho) const =0
 
virtual const ValuecalculateTotalRho (void) const =0
 calculates total molar density for all phases in kmol/m3 More...
 
virtual const ValuecalculateTotalH (void) const =0
 calculates molar enthalpy for all phases in J/kmol based on current values of the hidden unknowns More...
 
virtual const ValuecalculateTotalS (void) const =0
 calculates molar entropy for all phases in J/kmol/K based on current values of the hidden unknowns More...
 
virtual void prepare_residuals (void)=0
 
virtual void prepare_Flash_residuals (void)=0
 
virtual int calculateResidualsEos (std::vector< Value > &y, uint32_t offset)=0
 
virtual void estimateEos (const Value &Pres, const Value &Temp)=0
 estimate eos roots-related unknowns More...
 
virtual int calculateResidualsEquilibrium (std::vector< Value > &y, uint32_t offset)=0
 
virtual void estimateEquilibrium (const Value &Pres, const Value &Temp)=0
 estimate equilibrium-related unknowns More...
 
virtual void setFlash_ (const Libpf::Utility::FlashMode &fm, const Value &x, const Value &y, bool strict=true)=0
 Set the stream's state variables and the Flash. More...
 
virtual int solveFlash (bool simultaneous, bool skip)=0
 
virtual std::string message (int code)=0
 
virtual void setup_ (std::vector< Value * > pbeta_, std::vector< const double * > pbetamin_, std::vector< const double * > pbetamax_)=0
 

Protected Attributes

Libpf::Utility::FlashMode fm_
 
bool zero_residuals_
 used to skip Flash residuals calculations if stream is empty More...
 
Value T_
 Temperature, unknown. More...
 
Value P_
 Pressure, unknown. More...
 
Value Pset_
 specified pressure, Pa More...
 
Value Tset_
 specified temperature, K More...
 
Value Hset_
 specified molar enthalpy, J/kmol More...
 
Value Sset_
 specified molar entropy, J/(kmol*K) More...
 
Value rhoset_
 specified molar density, kmol/m3 More...
 

Detailed Description

Common stuff to all Flashes including single phase Flashes

#include <libpf/streams/Flash.h>

Remarks
Warning
Thread safe:
Extendable:
Platform dependencies:

Constructor & Destructor Documentation

◆ ~FlashBase()

virtual FlashBase::~FlashBase ( )
protectedvirtualdefault

◆ FlashBase()

FlashBase::FlashBase ( void  )

Member Function Documentation

◆ calculateResidualsEos()

virtual int FlashBase::calculateResidualsEos ( std::vector< Value > &  y,
uint32_t  offset 
)
protectedpure virtual

fill in residuals for the calculation of {vapor, liquid} eos roots as required returns the number of eos roots that are computed

Implemented in Stream.

◆ calculateResidualsEquilibrium()

virtual int FlashBase::calculateResidualsEquilibrium ( std::vector< Value > &  y,
uint32_t  offset 
)
protectedpure virtual

fill in residuals for the calculation phase equilibria as required returns the number of equations that are computed

Implemented in StreamOne, StreamOneSolid, StreamSimple< NV, NL, NS >, StreamIapwsLiquidVapor, StreamTwo< F >, StreamTwo< FlashVl >, and StreamTwoSolid< F >.

◆ calculateTotalH()

virtual const Value & FlashBase::calculateTotalH ( void  ) const
protectedpure virtual

calculates molar enthalpy for all phases in J/kmol based on current values of the hidden unknowns

Implemented in Stream.

◆ calculateTotalP()

virtual const Value & FlashBase::calculateTotalP ( const Value rho) const
protectedpure virtual

return total pressure for all phases

Parameters
rhomolar density

Implemented in Stream.

◆ calculateTotalRho()

virtual const Value & FlashBase::calculateTotalRho ( void  ) const
protectedpure virtual

calculates total molar density for all phases in kmol/m3

Implemented in Stream.

◆ calculateTotalS()

virtual const Value & FlashBase::calculateTotalS ( void  ) const
protectedpure virtual

calculates molar entropy for all phases in J/kmol/K based on current values of the hidden unknowns

Implemented in Stream.

◆ converged()

virtual bool FlashBase::converged ( void  ) const
pure virtual

returns true if the flash has been solved successfully,

See also
SolverNleInterface::nonConverged

Implemented in Flash.

◆ estimate()

virtual void FlashBase::estimate ( const Value Pres,
const Value Temp 
)
pure virtual

Estimates trivial unknowns; use only in sequential mode ! must be overridden when more unknowns are present

Implemented in Flash, and FlashVl.

◆ estimateEos()

virtual void FlashBase::estimateEos ( const Value Pres,
const Value Temp 
)
protectedpure virtual

estimate eos roots-related unknowns

Implemented in Stream.

◆ estimateEquilibrium()

virtual void FlashBase::estimateEquilibrium ( const Value Pres,
const Value Temp 
)
protectedpure virtual

estimate equilibrium-related unknowns

Implemented in Flash, StreamIapwsLiquidVapor, StreamTwo< F >, StreamTwo< FlashVl >, and StreamTwoSolid< F >.

◆ Fraction()

virtual const Value & FlashBase::Fraction ( Libpf::Utility::PhaseIndex  p,
bool  clip = false 
) const
pure virtual

during Flash iterations use this function to get the actual estimate of the fraction of phase p

Parameters
pindex of the phase
clipwhether to clip the fraction between 0 and 1

Implemented in Flash, FlashVl, StreamOneSolid, and StreamTwoSolid< F >.

◆ isIdeal()

bool FlashBase::isIdeal ( void  )

◆ message()

virtual std::string FlashBase::message ( int  code)
protectedpure virtual

Implemented in Flash.

◆ niter()

virtual int FlashBase::niter ( void  ) const
pure virtual

return Flash iterations

Implemented in Flash.

◆ prepare_Flash_residuals()

virtual void FlashBase::prepare_Flash_residuals ( void  )
protectedpure virtual

to be called before evaluating the residuals; implement in Flash or its subclasses; put any stream-specific initialization stuff here

Implemented in Flash, FlashVl, FlashVlT, and FlashVlTx.

◆ prepare_residuals()

virtual void FlashBase::prepare_residuals ( void  )
protectedpure virtual

to be called before evaluating the residuals; implement in stream or its subclasses; put any Flash-specific initialization stuff here

Implemented in Stream, StreamOne, StreamOneSolid, StreamTwo< F >, StreamTwo< FlashVl >, and StreamTwoSolid< F >.

◆ Pressure()

const Value & FlashBase::Pressure ( void  ) const

during Flash iterations use this function to get the actual estimate of the pressure

◆ setFlash_()

virtual void FlashBase::setFlash_ ( const Libpf::Utility::FlashMode fm,
const Value x,
const Value y,
bool  strict = true 
)
protectedpure virtual

Set the stream's state variables and the Flash.

Implemented in Flash, FlashLlTx, and FlashVlT.

◆ setIdeal()

void FlashBase::setIdeal ( bool  i)

Setter for the ideal flash calculation

Parameters
itrue = ideal calculation false = not-ideal calculation

◆ setup_()

virtual void FlashBase::setup_ ( std::vector< Value * >  pbeta_,
std::vector< const double * >  pbetamin_,
std::vector< const double * >  pbetamax_ 
)
protectedpure virtual

set unknowns, solver sizes

Parameters
pbeta_vector of pointers to the phase betas
pbetamin_vector of pointers to the minimum allowable beta for the phases
pbetamax_vector of pointers to the maximum allowable beta for the phases

Implemented in Flash, FlashVl, and FlashVlTx.

◆ solveFlash()

virtual int FlashBase::solveFlash ( bool  simultaneous,
bool  skip 
)
protectedpure virtual

solve the flash if !simultaneous, only calls calculateResiduals if simultaneous

Parameters
simultaneousused if the flash is to solved during a simultaneous resolution of a larger set of equations
skipskip flash calculation and force the residuals to zero; used for streams with negligible flow

Implemented in Flash.

◆ solver()

virtual SolverNleInterface * FlashBase::solver ( void  )
pure virtual

Implemented in Flash.

◆ Sumx()

virtual const Value & FlashBase::Sumx ( Libpf::Utility::PhaseIndex  p) const
pure virtual

during Flash iterations use this function to get the actual estimate of the sum of molar fractions for phase p

Implemented in Flash, and FlashVl.

◆ Temperature()

const Value & FlashBase::Temperature ( void  ) const

during Flash iterations use this function to get the actual estimate of the temperature

◆ X()

virtual Vector FlashBase::X ( Libpf::Utility::PhaseIndex  p) const
pure virtual

during Flash iterations use this function to get the actual estimate of the molar fractions for phase p

Implemented in Flash, FlashVl, StreamOneSolid, and StreamTwoSolid< F >.

Member Data Documentation

◆ fm_

Libpf::Utility::FlashMode FlashBase::fm_
protected

used to store the current Flash specification; can be different from the FlashBasemode specified in the stream ( FlashBaseoption ) i.e. if PT stream is connected as outlet of a compressor it will be PS FlashBaseed

◆ Hset_

Value FlashBase::Hset_
protected

specified molar enthalpy, J/kmol

◆ P_

Value FlashBase::P_
protected

Pressure, unknown.

◆ Pset_

Value FlashBase::Pset_
protected

specified pressure, Pa

◆ rhoset_

Value FlashBase::rhoset_
protected

specified molar density, kmol/m3

◆ Sset_

Value FlashBase::Sset_
protected

specified molar entropy, J/(kmol*K)

◆ T_

Value FlashBase::T_
protected

Temperature, unknown.

◆ Tset_

Value FlashBase::Tset_
protected

specified temperature, K

◆ zero_residuals_

bool FlashBase::zero_residuals_
protected

used to skip Flash residuals calculations if stream is empty


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