RedlichKwongMFTP.cpp Source File#
RedlichKwongMFTP.cpp
Go to the documentation of this file.
111 double dHdT_V = (cpref + mv * dpdT_ - GasConstant - 1.0 / (2.0 * m_b_current * TKelvin * sqt) * log(vpb/mv) * fac
137 double pp = GasConstant * T/(molarV - m_b_current) - m_a_current/(sqrt(T) * molarV * (molarV + m_b_current));
243 m_tmpV[k] += 2.0 * moleFractions_[i] * TKelvin * a_coeff_vec(1,counter) - 3.0 * moleFractions_[i] * a_vec_Curr_[counter];
250 double hE_v = (mv * dpdni_[k] - RT() - b_vec_Curr_[k]/ (m_b_current * m_b_current * sqt) * log(vpb/mv)*fac
532 double sresid_mol_R = log(zz*(1.0 - hh)) + log(1.0 + hh) * fac / (sqT * GasConstant * m_b_current);
618 if (phaseRequested == FLUID_GAS || phaseRequested == FLUID_SUPERCRIT || phaseRequested == FLUID_UNDEFINED) {
624 if (phaseRequested >= FLUID_LIQUID_0 || phaseRequested == FLUID_UNDEFINED || phaseRequested == FLUID_SUPERCRIT) {
857int RedlichKwongMFTP::solveCubic(double T, double pres, double a, double b, double Vroot[3]) const
873 int nSolnValues = MixtureFugacityTP::solveCubic(T, pres, a, b, a, Vroot, an, bn, cn, dn, tc, vc);
Declaration for class Cantera::Species.
Headers for the factory class that can create known ThermoPhase objects (see Thermodynamic Properties...
A map of string keys to values whose type can vary at runtime.
Definition AnyMap.h:427
const UnitSystem & units() const
Return the default units that should be used to convert stored values.
Definition AnyMap.h:630
double convert(const string &key, const string &units) const
Convert the item stored by the given key to the units specified in units.
Definition AnyMap.cpp:1535
static AnyMap fromYamlFile(const string &name, const string &parent_name="")
Create an AnyMap from a YAML file.
Definition AnyMap.cpp:1771
A wrapper for a variable whose type is determined at runtime.
Definition AnyMap.h:86
void getRow(size_t n, double *const rw)
Get the nth row and return it in a vector.
Definition Array.cpp:79
virtual void resize(size_t n, size_t m, double v=0.0)
Resize the array, and fill the new entries with 'v'.
Definition Array.cpp:47
Base class for exceptions thrown by Cantera classes.
Definition ctexceptions.h:66
Error thrown for problems processing information contained in an AnyMap or AnyValue.
Definition AnyMap.h:738
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
double critTemperature() const override
Critical temperature (K).
Definition MixtureFugacityTP.cpp:744
virtual void _updateReferenceStateThermo() const
Updates the reference state thermodynamic functions at the current T of the solution.
Definition MixtureFugacityTP.cpp:722
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
vector< double > moleFractions_
Storage for the current values of the mole fractions of the species.
Definition MixtureFugacityTP.h:516
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
virtual double psatEst(double TKelvin) const
Estimate for the saturation pressure.
Definition MixtureFugacityTP.cpp:283
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
vector< double > m_cp0_R
Temporary storage for dimensionless reference state heat capacities.
Definition MixtureFugacityTP.h:534
bool addSpecies(shared_ptr< Species > spec) override
Add a Species to this Phase.
Definition MixtureFugacityTP.cpp:161
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
void checkSpeciesIndex(size_t k) const
Check that the specified species index is in range.
Definition Phase.cpp:153
size_t speciesIndex(const string &name) const
Returns the index of a species named 'name' within the Phase object.
Definition Phase.cpp:129
double moleFraction(size_t k) const
Return the mole fraction of a single species.
Definition Phase.cpp:439
double mean_X(const double *const Q) const
Evaluate the mole-fraction-weighted mean of an array Q.
Definition Phase.cpp:616
shared_ptr< Species > species(const string &name) const
Return the Species object for the named species.
Definition Phase.cpp:856
void calculateAB(double temp, double &aCalc, double &bCalc) const
Calculate the a and the b parameters given the temperature.
Definition RedlichKwongMFTP.cpp:765
double thermalExpansionCoeff() const override
Return the volumetric thermal expansion coefficient. Units: 1/K.
Definition RedlichKwongMFTP.cpp:701
void setBinaryCoeffs(const string &species_i, const string &species_j, double a0, double a1)
Set values for the interaction parameter between two species.
Definition RedlichKwongMFTP.cpp:71
double densSpinodalLiquid() const override
Return the value of the density at the liquid spinodal point (on the liquid side) for the current tem...
Definition RedlichKwongMFTP.cpp:638
void getPartialMolarEnthalpies(double *hbar) const override
Returns an array of partial molar enthalpies for the species in the mixture.
Definition RedlichKwongMFTP.cpp:213
void getChemPotentials(double *mu) const override
Get the species chemical potentials. Units: J/kmol.
Definition RedlichKwongMFTP.cpp:179
double sresid() const override
Calculate the deviation terms for the total entropy of the mixture from the ideal gas mixture.
Definition RedlichKwongMFTP.cpp:520
double soundSpeed() const override
Return the speed of sound. Units: m/s.
Definition RedlichKwongMFTP.cpp:707
double pressure() const override
Return the thermodynamic pressure (Pa).
Definition RedlichKwongMFTP.cpp:130
void getSpeciesParameters(const string &name, AnyMap &speciesNode) const override
Get phase-specific parameters of a Species object such that an identical one could be reconstructed a...
Definition RedlichKwongMFTP.cpp:471
RedlichKwongMFTP(const string &infile="", const string &id="")
Construct a RedlichKwongMFTP object from an input file.
Definition RedlichKwongMFTP.cpp:24
void initThermo() override
Initialize the ThermoPhase object after all species have been set up.
Definition RedlichKwongMFTP.cpp:372
double densSpinodalGas() const override
Return the value of the density at the gas spinodal point (on the gas side) for the current temperatu...
Definition RedlichKwongMFTP.cpp:660
void getPartialMolarVolumes(double *vbar) const override
Return an array of partial molar volumes for the species in the mixture.
Definition RedlichKwongMFTP.cpp:320
double cv_mole() const override
Molar heat capacity at constant volume. Units: J/kmol/K.
Definition RedlichKwongMFTP.cpp:116
void pressureDerivatives() const
Calculate dpdV and dpdT at the current conditions.
Definition RedlichKwongMFTP.cpp:713
double isothermalCompressibility() const override
Returns the isothermal compressibility. Units: 1/Pa.
Definition RedlichKwongMFTP.cpp:695
double hresid() const override
Calculate the deviation terms for the total enthalpy of the mixture from the ideal gas mixture.
Definition RedlichKwongMFTP.cpp:536
static const double omega_a
Omega constant for a -> value of a in terms of critical properties.
Definition RedlichKwongMFTP.h:265
double liquidVolEst(double TKelvin, double &pres) const override
Estimate for the molar volume of the liquid.
Definition RedlichKwongMFTP.cpp:551
double dpdVCalc(double TKelvin, double molarVol, double &presCalc) const override
Calculate the pressure and the pressure derivative given the temperature and the molar volume.
Definition RedlichKwongMFTP.cpp:682
static const double omega_vc
Omega constant for the critical molar volume.
Definition RedlichKwongMFTP.h:271
vector< CoeffSource > m_coeffSource
For each species, specifies the source of the a and b coefficients.
Definition RedlichKwongMFTP.h:227
void getPartialMolarIntEnergies(double *ubar) const override
Return an array of partial molar internal energies for the species in the mixture.
Definition RedlichKwongMFTP.cpp:309
void updateMixingExpressions() override
Update the a and b parameters.
Definition RedlichKwongMFTP.cpp:728
double cp_mole() const override
Molar heat capacity at constant pressure. Units: J/kmol/K.
Definition RedlichKwongMFTP.cpp:100
double standardConcentration(size_t k=0) const override
Returns the standard concentration , which is used to normalize the generalized concentration.
Definition RedlichKwongMFTP.cpp:141
bool addSpecies(shared_ptr< Species > spec) override
Add a Species to this Phase.
Definition RedlichKwongMFTP.cpp:353
void getActivityCoefficients(double *ac) const override
Get the array of non-dimensional activity coefficients at the current solution temperature,...
Definition RedlichKwongMFTP.cpp:147
double densityCalc(double T, double pressure, int phase, double rhoguess) override
Calculates the density given the temperature and the pressure and a guess at the density.
Definition RedlichKwongMFTP.cpp:583
vector< double > dpdni_
Vector of derivatives of pressure wrt mole number.
Definition RedlichKwongMFTP.h:258
void getPartialMolarEntropies(double *sbar) const override
Returns an array of partial molar entropies of the species in the solution.
Definition RedlichKwongMFTP.cpp:258
map< string, map< string, pair< double, double > > > m_binaryParameters
Explicitly-specified binary interaction parameters.
Definition RedlichKwongMFTP.h:223
void setSpeciesCoeffs(const string &species, double a0, double a1, double b)
Set the pure fluid interaction parameters for a species.
Definition RedlichKwongMFTP.cpp:29
int solveCubic(double T, double pres, double a, double b, double Vroot[3]) const
Prepare variables and call the function to solve the cubic equation of state.
Definition RedlichKwongMFTP.cpp:857
double RT() const
Return the Gas Constant multiplied by the current temperature.
Definition ThermoPhase.h:1062
void initThermoFile(const string &inputFile, const string &id)
Initialize a ThermoPhase object using an input file.
Definition ThermoPhase.cpp:995
virtual void getSpeciesParameters(const string &name, AnyMap &speciesNode) const
Get phase-specific parameters of a Species object such that an identical one could be reconstructed a...
Definition ThermoPhase.h:1831
double convert(double value, const string &src, const string &dest) const
Convert value from the units of src to the units of dest.
Definition Units.cpp:538
void fmt_append(fmt::memory_buffer &b, Args... args)
Versions 6.2.0 and 6.2.1 of fmtlib do not include this define before they include windows....
Definition fmt.h:29
void scale(InputIter begin, InputIter end, OutputIter out, S scale_factor)
Multiply elements of an array by a scale factor.
Definition utilities.h:104
Contains declarations for string manipulation functions within Cantera.
Various templated functions that carry out common vector and polynomial operations (see Templated Arr...
Generated by 1.9.7