29 GibbsExcessVPSSTP::GibbsExcessVPSSTP() :
32 lnActCoeff_Scaled_(0),
33 dlnActCoeffdT_Scaled_(0),
34 d2lnActCoeffdT2_Scaled_(0),
35 dlnActCoeffdlnN_diag_(0),
36 dlnActCoeffdlnX_diag_(0),
37 dlnActCoeffdlnN_(0,0),
45 lnActCoeff_Scaled_(0),
46 dlnActCoeffdT_Scaled_(0),
47 d2lnActCoeffdT2_Scaled_(0),
48 dlnActCoeffdlnN_diag_(0),
49 dlnActCoeffdlnX_diag_(0),
50 dlnActCoeffdlnN_(0,0),
133 doublereal vtotal = 0.0;
134 for (
size_t i = 0; i <
m_kk; i++) {
183 for (
size_t k = 0; k <
m_kk; k++) {
194 for (
size_t k = 0; k <
m_kk; k++) {
197 }
else if (ac[k] < -700.) {
209 for (
size_t k = 0; k <
m_kk; k++) {
218 void GibbsExcessVPSSTP::getPartialMolarVolumes(doublereal* vbar)
const
226 const vector_fp& GibbsExcessVPSSTP::getPartialMolarVolumes()
const
228 return getStandardVolumes();
233 throw CanteraError(
"GibbsExcessVPSSTP",
"Base class method "
240 doublereal norm = accumulate(x, x +
m_kk, 0.0);
241 if (fabs(norm - 1.0) > 1.0E-9) {
243 "(MF sum - 1) exceeded tolerance of 1.0E-9:" +
fp2str(norm));
250 for (
int i = 0; i < sizeUA; i++) {
virtual void setMoleFractions_NoNorm(const doublereal *const x)
Set the mole fractions to the specified values without normalizing.
std::vector< doublereal > m_pp
Temporary storage space that is fair game.
std::string int2str(const int n, const std::string &fmt)
Convert an int to a string using a format converter.
doublereal electricPotential() const
Returns the electric potential of this phase (V).
void initLengths()
Initialize lengths of local variables after all species have been identified.
GibbsExcessVPSSTP & operator=(const GibbsExcessVPSSTP &b)
Assignment operator.
void resize(size_t n, size_t m, doublereal v=0.0)
Resize the array, and fill the new entries with 'v'.
virtual void getStandardVolumes(doublereal *vol) const
Get the molar volumes of each species in their standard states at the current T and P of the solution...
virtual void getActivities(doublereal *ac) const
Get the array of non-dimensional activities (molality based for this class and classes that derive fr...
virtual doublereal logStandardConc(size_t k=0) const
Returns the natural logarithm of the standard concentration of the kth species.
virtual void updateStandardStateThermo() const
Updates the standard state thermodynamic functions at the current T and P of the solution.
virtual ThermoPhase * duplMyselfAsThermoPhase() const
Duplication routine for objects which inherit from ThermoPhase.
virtual void getUnitsStandardConc(double *uA, int k=0, int sizeUA=6) const
Returns the units of the standard and generalized concentrations Note they have the same units...
virtual void getPartialMolarVolumes(doublereal *vbar) const
Return an array of partial molar volumes for the species in the mixture.
std::vector< doublereal > d2lnActCoeffdT2_Scaled_
Storage for the current derivative values of the gradients with respect to temperature of the log of ...
void getMoleFractions(doublereal *const x) const
Get the species mole fraction vector.
virtual void setState_TP(doublereal t, doublereal p)
Set the temperature (K) and pressure (Pa)
virtual doublereal standardConcentration(size_t k=0) const
The standard concentration used to normalize the generalized concentration.
std::vector< doublereal > dlnActCoeffdlnN_diag_
Storage for the current derivative values of the gradients with respect to logarithm of the mole frac...
virtual void getActivityCoefficients(doublereal *ac) const
Get the array of non-dimensional molar-based activity coefficients at the current solution temperatur...
VPStandardStateTP & operator=(const VPStandardStateTP &b)
Assignment operator.
Base class for a phase with thermodynamic properties.
virtual int eosType() const
Equation of state type flag.
virtual void initThermo()
Initialize the ThermoPhase object after all species have been set up.
std::string fp2str(const double x, const std::string &fmt)
Convert a double into a c++ string.
virtual void setConcentrations(const doublereal *const c)
Set the concentrations to the specified values within the phase.
virtual void getChemPotentials(doublereal *mu) const
Get the species chemical potentials. Units: J/kmol.
Header for intermediate ThermoPhase object for phases which employ gibbs excess free energy based for...
Base class for exceptions thrown by Cantera classes.
void calcDensity()
Calculate the density of the mixture using the partial molar volumes and mole fractions as input...
double checkMFSum(const doublereal *const x) const
utility routine to check mole fraction sum
This is a filter class for ThermoPhase that implements some prepatory steps for efficiently handling ...
void getElectrochemPotentials(doublereal *mu) const
Get the species electrochemical potentials.
virtual void setConcentrations(const doublereal *const conc)
Set the concentrations to the specified values within the phase.
virtual void setMoleFractions(const doublereal *const x)
Set the mole fractions to the specified values There is no restriction on the sum of the mole fractio...
virtual void setMassFractions(const doublereal *const y)
Set the mass fractions to the specified values, and then normalize them so that they sum to 1...
virtual void setMoleFractions(const doublereal *const x)
Set the mole fractions to the specified values, and then normalize them so that they sum to 1...
virtual void setMassFractions_NoNorm(const doublereal *const y)
Set the mass fractions to the specified values without normalizing.
virtual void setMassFractions_NoNorm(const doublereal *const y)
Set the mass fractions to the specified values without normalizing.
size_t nSpecies() const
Returns the number of species in the phase.
std::vector< doublereal > dlnActCoeffdlnX_diag_
Storage for the current derivative values of the gradients with respect to logarithm of the mole frac...
doublereal temperature() const
Temperature (K).
virtual void getActivityConcentrations(doublereal *c) const
This method returns an array of generalized concentrations.
std::vector< doublereal > lnActCoeff_Scaled_
Storage for the current values of the activity coefficients of the species.
std::vector< double > vector_fp
Turn on the use of stl vectors for the basic array type within cantera Vector of doubles.
virtual void getLnActivityCoefficients(doublereal *lnac) const
Get the array of non-dimensional molar-based ln activity coefficients at the current solution tempera...
virtual void setTemperature(const doublereal temp)
Set the internally stored temperature of the phase (K).
virtual void setPressure(doublereal p)
Set the internally stored pressure (Pa) at constant temperature and composition.
std::vector< doublereal > moleFractions_
Storage for the current values of the mole fractions of the species.
doublereal meanMolecularWeight() const
The mean molecular weight. Units: (kg/kmol)
Contains declarations for string manipulation functions within Cantera.
virtual void initThermo()
#define DATA_PTR(vec)
Creates a pointer to the start of the raw data for a vector.
virtual void setMassFractions(const doublereal *const y)
Set the mass fractions to the specified values and normalize them.
size_t m_kk
Number of species in the phase.
Array2D dlnActCoeffdlnN_
Storage for the current derivative values of the gradients with respect to logarithm of the species m...
virtual void setMoleFractions_NoNorm(const doublereal *const x)
Set the mole fractions to the specified values without normalizing.
doublereal m_Pcurrent
Current value of the pressure - state variable.
std::vector< doublereal > dlnActCoeffdT_Scaled_
Storage for the current derivative values of the gradients with respect to temperature of the log of ...
virtual void setDensity(const doublereal density_)
Set the internally stored density (kg/m^3) of the phase Note the density of a phase is an independent...
doublereal err(const std::string &msg) const
Error function.
doublereal charge(size_t k) const
Dimensionless electrical charge of a single molecule of species k The charge is normalized by the the...