28 PseudoBinaryVPSSTP::PseudoBinaryVPSSTP() :
30 PBType_(PBTYPE_PASSTHROUGH),
32 indexSpecialSpecies_(
npos),
35 numPassThroughSpecies_(0),
36 neutralPBindexStart(0),
44 PBType_(PBTYPE_PASSTHROUGH),
46 indexSpecialSpecies_(
npos),
49 numPassThroughSpecies_(0),
50 neutralPBindexStart(0),
67 PBMoleFractions_ = b.PBMoleFractions_;
68 cationList_ = b.cationList_;
69 numCationSpecies_ = b.numCationSpecies_;
70 anionList_ = b.anionList_;
71 numAnionSpecies_ = b.numAnionSpecies_;
72 passThroughList_ = b.passThroughList_;
73 numPassThroughSpecies_ = b.numPassThroughSpecies_;
74 neutralPBindexStart = b.neutralPBindexStart;
75 cationPhase_ = b.cationPhase_;
76 anionPhase_ = b.anionPhase_;
77 moleFractionsTmp_ = b.moleFractionsTmp_;
95 err(
"standardConcentration");
101 err(
"logStandardConc");
109 for (
size_t k = 0; k <
m_kk; k++) {
119 doublereal sum = 0.0;
121 case PBTYPE_PASSTHROUGH:
122 for (k = 0; k <
m_kk; k++) {
126 case PBTYPE_SINGLEANION:
129 for (k = 0; k <
m_kk; k++) {
132 for (k = 0; k < cationList_.size(); k++) {
136 PBMoleFractions_[0] = sumCat -sumAnion;
140 for (k = 0; k < numCationSpecies_; k++) {
141 PBMoleFractions_[1+k] = moleFractionsTmp_[cationList_[k]];
144 for (k = 0; k < numPassThroughSpecies_; k++) {
145 PBMoleFractions_[neutralPBindexStart + k] =
149 sum = std::max(0.0, PBMoleFractions_[0]);
151 sum += PBMoleFractions_[k];
154 PBMoleFractions_[k] /= sum;
158 case PBTYPE_SINGLECATION:
163 case PBTYPE_MULTICATIONANION:
176 throw CanteraError(
"PseudoBinaryVPSSTP",
"Base class method "
204 sprintf(p,
" \n %s:\n",
name().c_str());
207 sprintf(p,
" \n temperature %12.6g K\n",
temperature());
209 sprintf(p,
" pressure %12.6g Pa\n",
pressure());
211 sprintf(p,
" density %12.6g kg/m^3\n",
density());
217 sprintf(p,
" potential %12.6g V\n", phi);
237 sprintf(p,
" 1 kg 1 kmol\n");
239 sprintf(p,
" ----------- ------------\n");
241 sprintf(p,
" enthalpy %12.6g %12.4g J\n",
244 sprintf(p,
" internal energy %12.6g %12.4g J\n",
247 sprintf(p,
" entropy %12.6g %12.4g J/K\n",
250 sprintf(p,
" Gibbs function %12.6g %12.4g J\n",
253 sprintf(p,
" heat capacity c_p %12.6g %12.4g J/K\n",
257 sprintf(p,
" heat capacity c_v %12.6g %12.4g J/K\n",
262 sprintf(p,
" heat capacity c_v <not implemented> \n");
Header for intermediate ThermoPhase object for phases which employ gibbs excess free energy based for...
virtual doublereal standardConcentration(size_t k=0) const
The standard concentration used to normalize the generalized concentration.
PseudoBinaryVPSSTP & operator=(const PseudoBinaryVPSSTP &b)
Assignment operator.
void initThermoXML(XML_Node &phaseNode, const std::string &id)
Import and initialize a ThermoPhase object.
virtual doublereal density() const
Density (kg/m^3).
std::string int2str(const int n, const std::string &fmt)
Convert an int to a string using a format converter.
PseudoBinaryVPSSTP()
Constructor.
doublereal electricPotential() const
Returns the electric potential of this phase (V).
virtual doublereal gibbs_mole() const
Molar Gibbs function. Units: J/kmol.
GibbsExcessVPSSTP & operator=(const GibbsExcessVPSSTP &b)
Assignment operator.
void initLengths()
Initialize lengths of local variables after all species have been identified.
const size_t npos
index returned by functions to indicate "no position"
virtual void getActivities(doublereal *ac) const
Get the array of non-dimensional activities (molality based for this class and classes that derive fr...
virtual std::string report(bool show_thermo=true) const
returns a summary of the state of the phase as a string
virtual int eosType() const
Equation of state type flag.
size_t numPBSpecies_
Number of pseudo binary species.
Class XML_Node is a tree-based representation of the contents of an XML file.
void getMoleFractions(doublereal *const x) const
Get the species mole fraction vector.
std::string name() const
Return the name of the phase.
virtual doublereal entropy_mole() const
Molar entropy. Units: J/kmol/K.
doublereal intEnergy_mass() const
Specific internal energy.
virtual ThermoPhase * duplMyselfAsThermoPhase() const
Duplication routine for objects which inherit from ThermoPhase.
Base class for a phase with thermodynamic properties.
virtual doublereal logStandardConc(size_t k=0) const
Returns the natural logarithm of the standard concentration of the kth species.
virtual doublereal intEnergy_mole() const
Molar internal energy. Units: J/kmol.
virtual doublereal enthalpy_mole() const
Molar enthalpy. Units: J/kmol.
doublereal gibbs_mass() const
Specific Gibbs function.
doublereal entropy_mass() const
Specific entropy.
doublereal pressure() const
Returns the current pressure of the phase.
void getElectrochemPotentials(doublereal *mu) const
Get the species electrochemical potentials.
virtual void getChemPotentials(doublereal *mu) const
Get the species chemical potentials. Units: J/kmol.
doublereal cp_mass() const
Specific heat at constant pressure.
virtual void calcPseudoBinaryMoleFractions() const
Calculate pseudo binary mole fractions.
Base class for exceptions thrown by Cantera classes.
doublereal cv_mass() const
Specific heat at constant volume.
doublereal err(const std::string &msg) const
Error function.
virtual doublereal cv_mole() const
Molar heat capacity at constant volume. Units: J/kmol/K.
size_t nSpecies() const
Returns the number of species in the phase.
doublereal temperature() const
Temperature (K).
size_t indexSpecialSpecies_
index of special species
std::vector< double > vector_fp
Turn on the use of stl vectors for the basic array type within cantera Vector of doubles.
doublereal enthalpy_mass() const
Specific enthalpy.
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)
virtual void initThermoXML(XML_Node &phaseNode, const std::string &id)
Initialize a ThermoPhase object, potentially reading activity coefficient information from an XML dat...
Contains declarations for string manipulation functions within Cantera.
virtual void initThermo()
virtual void initThermo()
virtual doublereal cp_mole() const
Molar heat capacity at constant pressure. Units: J/kmol/K.
size_t m_kk
Number of species in the phase.
virtual void getStandardChemPotentials(doublereal *mu) const
Get the array of chemical potentials at unit activity.
doublereal charge(size_t k) const
Dimensionless electrical charge of a single molecule of species k The charge is normalized by the the...
void save()
Function to put this error onto Cantera's error stack.