MixtureFugacityTP.cpp Source File#
MixtureFugacityTP.cpp
Go to the documentation of this file.
798 // Derive the value of delta**2. This is a key quantity that determines the number of turning points
934 // Find an accurate root, since there might be a heavy amount of roundoff error due to bad conditioning in this solver.
942 dresdV = 3.0 * an * Vroot[i] * Vroot[i] + 2.0 * bn * Vroot[i] + cn; // derivative of the residual
948 double res2 = an * Vroot[i] * Vroot[i] * Vroot[i] + bn * Vroot[i] * Vroot[i] + cn * Vroot[i] + dn;
Header file for a derived class of ThermoPhase that handles non-ideal mixtures based on the fugacity ...
Base class for exceptions thrown by Cantera classes.
Definition ctexceptions.h:66
int reportSolnBranchActual() const
Report the solution branch which the solution is actually on.
Definition MixtureFugacityTP.cpp:36
double enthalpy_mole() const override
Molar enthalpy. Units: J/kmol.
Definition MixtureFugacityTP.cpp:42
int standardStateConvention() const override
This method returns the convention used in specification of the standard state, of which there are cu...
Definition MixtureFugacityTP.cpp:21
vector< double > m_g0_RT
Temporary storage for dimensionless reference state Gibbs energies.
Definition MixtureFugacityTP.h:537
void getEntropy_R(double *sr) const override
Get the array of nondimensional Enthalpy functions for the standard state species at the current T an...
Definition MixtureFugacityTP.cpp:74
vector< double > m_h0_RT
Temporary storage for dimensionless reference state enthalpies.
Definition MixtureFugacityTP.h:531
void getGibbs_ref(double *g) const override
Returns the vector of the Gibbs function of the reference state at the current temperature of the sol...
Definition MixtureFugacityTP.cpp:133
void getStandardChemPotentials(double *mu) const override
Get the array of chemical potentials at unit activity.
Definition MixtureFugacityTP.cpp:60
double critTemperature() const override
Critical temperature (K).
Definition MixtureFugacityTP.cpp:744
void getCp_R(double *cpr) const override
Get the nondimensional Heat Capacities at constant pressure for the standard state of the species at ...
Definition MixtureFugacityTP.cpp:109
virtual double densSpinodalLiquid() const
Return the value of the density at the liquid spinodal point (on the liquid side) for the current tem...
Definition MixtureFugacityTP.cpp:510
virtual void _updateReferenceStateThermo() const
Updates the reference state thermodynamic functions at the current T of the solution.
Definition MixtureFugacityTP.cpp:722
double satPressure(double TKelvin) override
Calculate the saturation pressure at the current mixture content for the given temperature.
Definition MixtureFugacityTP.cpp:520
void getActivityConcentrations(double *c) const override
This method returns an array of generalized concentrations.
Definition MixtureFugacityTP.cpp:259
int solveCubic(double T, double pres, double a, double b, double aAlpha, double Vroot[3], double an, double bn, double cn, double dn, double tc, double vc) const
Solve the cubic equation of state.
Definition MixtureFugacityTP.cpp:785
double critCompressibility() const override
Critical compressibility (unitless).
Definition MixtureFugacityTP.cpp:765
void setPressure(double p) override
Set the internally stored pressure (Pa) at constant temperature and composition.
Definition MixtureFugacityTP.cpp:188
const vector< double > & gibbs_RT_ref() const
Returns the vector of nondimensional Gibbs free energies of the reference state at the current temper...
Definition MixtureFugacityTP.cpp:139
void getStandardVolumes_ref(double *vol) const override
Get the molar volumes of the species reference states at the current T and P_ref of the solution.
Definition MixtureFugacityTP.cpp:154
virtual double densSpinodalGas() const
Return the value of the density at the gas spinodal point (on the gas side) for the current temperatu...
Definition MixtureFugacityTP.cpp:515
void getPureGibbs(double *gpure) const override
Get the pure Gibbs free energies of each species.
Definition MixtureFugacityTP.cpp:92
double calculatePsat(double TKelvin, double &molarVolGas, double &molarVolLiquid)
Calculate the saturation pressure at the current mixture content for the given temperature.
Definition MixtureFugacityTP.cpp:527
vector< double > moleFractions_
Storage for the current values of the mole fractions of the species.
Definition MixtureFugacityTP.h:516
void getEnthalpy_RT(double *hrt) const override
Get the nondimensional Enthalpy functions for the species at their standard states at the current T a...
Definition MixtureFugacityTP.cpp:69
void getEntropy_R_ref(double *er) const override
Returns the vector of nondimensional entropies of the reference state at the current temperature of t...
Definition MixtureFugacityTP.cpp:144
void setTemperature(const double temp) override
Set the temperature of the phase.
Definition MixtureFugacityTP.cpp:179
vector< double > m_s0_R
Temporary storage for dimensionless reference state entropies.
Definition MixtureFugacityTP.h:540
virtual double dpdVCalc(double TKelvin, double molarVol, double &presCalc) const
Calculate the pressure and the pressure derivative given the temperature and the molar volume.
Definition MixtureFugacityTP.cpp:717
void getGibbs_RT(double *grt) const override
Get the nondimensional Gibbs functions for the species at their standard states of solution at the cu...
Definition MixtureFugacityTP.cpp:83
double entropy_mole() const override
Molar entropy. Units: J/kmol/K.
Definition MixtureFugacityTP.cpp:50
virtual double densityCalc(double TKelvin, double pressure, int phaseRequested, double rhoguess)
Calculates the density given the temperature and the pressure and a guess at the density.
Definition MixtureFugacityTP.cpp:299
virtual double psatEst(double TKelvin) const
Estimate for the saturation pressure.
Definition MixtureFugacityTP.cpp:283
void getCp_R_ref(double *cprt) const override
Returns the vector of nondimensional constant pressure heat capacities of the reference state at the ...
Definition MixtureFugacityTP.cpp:149
void getStandardVolumes(double *vol) const override
Get the molar volumes of each species in their standard states at the current T and P of the solution...
Definition MixtureFugacityTP.cpp:114
virtual double sresid() const
Calculate the deviation terms for the total entropy of the mixture from the ideal gas mixture.
Definition MixtureFugacityTP.cpp:273
void getIntEnergy_RT(double *urt) const override
Returns the vector of nondimensional internal Energies of the standard state at the current temperatu...
Definition MixtureFugacityTP.cpp:101
int forcedState_
Force the system to be on a particular side of the spinodal curve.
Definition MixtureFugacityTP.h:528
virtual double liquidVolEst(double TKelvin, double &pres) const
Estimate for the molar volume of the liquid.
Definition MixtureFugacityTP.cpp:294
int forcedSolutionBranch() const
Report the solution branch which the solution is restricted to.
Definition MixtureFugacityTP.cpp:31
void compositionChanged() override
Apply changes to the state which are needed after the composition changes.
Definition MixtureFugacityTP.cpp:252
vector< double > m_cp0_R
Temporary storage for dimensionless reference state heat capacities.
Definition MixtureFugacityTP.h:534
int corr0(double TKelvin, double pres, double &densLiq, double &densGas, double &liqGRT, double &gasGRT)
Utility routine in the calculation of the saturation pressure.
Definition MixtureFugacityTP.cpp:440
void setForcedSolutionBranch(int solnBranch)
Set the solution branch to force the ThermoPhase to exist on one branch or another.
Definition MixtureFugacityTP.cpp:26
bool addSpecies(shared_ptr< Species > spec) override
Add a Species to this Phase.
Definition MixtureFugacityTP.cpp:161
virtual double hresid() const
Calculate the deviation terms for the total enthalpy of the mixture from the ideal gas mixture.
Definition MixtureFugacityTP.cpp:278
void getGibbs_RT_ref(double *grt) const override
Returns the vector of nondimensional Gibbs Free Energies of the reference state at the current temper...
Definition MixtureFugacityTP.cpp:128
int phaseState(bool checkState=false) const
Returns the Phase State flag for the current state of the object.
Definition MixtureFugacityTP.cpp:469
void getEnthalpy_RT_ref(double *hrt) const override
Returns the vector of nondimensional enthalpies of the reference state at the current temperature of ...
Definition MixtureFugacityTP.cpp:123
virtual void update(double T, double *cp_R, double *h_RT, double *s_R) const
Compute the reference-state properties for all species.
Definition MultiSpeciesThermo.cpp:94
An error indicating that an unimplemented function has been called.
Definition ctexceptions.h:195
void setState_TD(double t, double rho)
Set the internally stored temperature (K) and density (kg/m^3)
Definition Phase.cpp:377
virtual void setDensity(const double density_)
Set the internally stored density (kg/m^3) of the phase.
Definition Phase.cpp:586
void getMoleFractions(double *const x) const
Get the species mole fraction vector.
Definition Phase.cpp:434
double moleFraction(size_t k) const
Return the mole fraction of a single species.
Definition Phase.cpp:439
virtual void compositionChanged()
Apply changes to the state which are needed after the composition changes.
Definition Phase.cpp:905
virtual void setTemperature(double temp)
Set the internally stored temperature of the phase (K).
Definition Phase.h:623
double mean_X(const double *const Q) const
Evaluate the mole-fraction-weighted mean of an array Q.
Definition Phase.cpp:616
virtual void setState_TP(double t, double p)
Set the temperature (K) and pressure (Pa)
Definition ThermoPhase.cpp:121
double RT() const
Return the Gas Constant multiplied by the current temperature.
Definition ThermoPhase.h:1062
double m_tlast
last value of the temperature processed by reference state
Definition ThermoPhase.h:1985
virtual void getActivityCoefficients(double *ac) const
Get the array of non-dimensional molar-based activity coefficients at the current solution temperatur...
Definition ThermoPhase.h:747
MultiSpeciesThermo m_spthermo
Pointer to the calculation manager for species reference-state thermodynamic properties.
Definition ThermoPhase.h:1962
bool addSpecies(shared_ptr< Species > spec) override
Add a Species to this Phase.
Definition ThermoPhase.cpp:1054
This file contains definitions for utility functions and text for modules, inputfiles and logging,...
void writelog(const string &fmt, const Args &... args)
Write a formatted message to the screen.
Definition global.h:175
void writelogendl()
Write an end of line character to the screen and flush output.
Definition global.cpp:41
void scale(InputIter begin, InputIter end, OutputIter out, S scale_factor)
Multiply elements of an array by a scale factor.
Definition utilities.h:104
void warn_user(const string &method, const string &msg, const Args &... args)
Print a user warning raised from method as CanteraWarning.
Definition global.h:267
const int cSS_CONVENTION_TEMPERATURE
Standard state uses the molar convention.
Definition ThermoPhase.h:144
Contains declarations for string manipulation functions within Cantera.
Various templated functions that carry out common vector and polynomial operations (see Templated Arr...
Generated by