31 IonsFromNeutralVPSSTP::IonsFromNeutralVPSSTP() :
33 ionSolnType_(cIonSolnType_SINGLEANION),
34 numNeutralMoleculeSpecies_(0),
35 indexSpecialSpecies_(
npos),
36 indexSecondSpecialSpecies_(
npos),
39 numPassThroughSpecies_(0),
40 neutralMoleculePhase_(0),
42 IOwnNThermoPhase_(true),
44 muNeutralMolecule_(0),
45 lnActCoeff_NeutralMolecule_(0)
50 const std::string& id_,
53 ionSolnType_(cIonSolnType_SINGLEANION),
54 numNeutralMoleculeSpecies_(0),
55 indexSpecialSpecies_(
npos),
56 indexSecondSpecialSpecies_(
npos),
59 numPassThroughSpecies_(0),
60 neutralMoleculePhase_(neutralPhase),
61 IOwnNThermoPhase_(true),
63 muNeutralMolecule_(0),
64 lnActCoeff_NeutralMolecule_(0)
78 const std::string& id_,
ThermoPhase* neutralPhase) :
80 ionSolnType_(cIonSolnType_SINGLEANION),
81 numNeutralMoleculeSpecies_(0),
82 indexSpecialSpecies_(
npos),
83 indexSecondSpecialSpecies_(
npos),
86 numPassThroughSpecies_(0),
87 neutralMoleculePhase_(neutralPhase),
88 IOwnNThermoPhase_(true),
90 muNeutralMolecule_(0),
92 lnActCoeff_NeutralMolecule_(0)
100 size_t numNeutMolSpec = geThermo->
nSpecies();
101 dlnActCoeff_NeutralMolecule_.resize(numNeutMolSpec);
102 dX_NeutralMolecule_.resize(numNeutMolSpec);
107 ionSolnType_(cIonSolnType_SINGLEANION),
108 numNeutralMoleculeSpecies_(0),
109 indexSpecialSpecies_(
npos),
110 indexSecondSpecialSpecies_(
npos),
111 numCationSpecies_(0),
113 numPassThroughSpecies_(0),
114 neutralMoleculePhase_(0),
116 IOwnNThermoPhase_(true),
117 moleFractionsTmp_(0),
118 muNeutralMolecule_(0),
120 lnActCoeff_NeutralMolecule_(0)
169 dlnActCoeff_NeutralMolecule_ = b.dlnActCoeff_NeutralMolecule_;
170 dX_NeutralMolecule_ = b.dX_NeutralMolecule_;
202 if (inputFile.size() == 0) {
204 "input file is null");
207 std::ifstream fin(path.c_str());
209 throw CanteraError(
"MargulesVPSSTP:constructPhaseFile",
"could not open "
210 +path+
" for reading.");
222 "ERROR: Can not find phase named " +
223 id_ +
" in file named " + inputFile);
225 fxml_phase->
copy(&phaseNode_XML);
233 if (id_.size() > 0) {
234 string idp = phaseNode.
id();
236 throw CanteraError(
"IonsFromNeutralVPSSTP::constructPhaseXML",
237 "phasenode and Id are incompatible");
244 if (!phaseNode.
hasChild(
"thermo")) {
245 throw CanteraError(
"IonsFromNeutralVPSSTP::constructPhaseXML",
246 "no thermo XML node");
255 stemp = thermoNode.
attrib(
"model");
257 if (formString !=
"ionsfromneutralmolecule") {
258 throw CanteraError(
"IonsFromNeutralVPSSTP::constructPhaseXML",
259 "model name isn't IonsFromNeutralMolecule: " + formString);
265 if (!thermoNode.
hasChild(
"neutralMoleculePhase")) {
266 throw CanteraError(
"IonsFromNeutralVPSSTP::constructPhaseXML",
267 "no neutralMoleculePhase XML node");
269 XML_Node& neutralMoleculeNode = thermoNode.
child(
"neutralMoleculePhase");
271 string nsource = neutralMoleculeNode[
"datasrc"];
274 throw CanteraError(
"IonsFromNeutralVPSSTP::constructPhaseXML",
292 throw CanteraError(
"IonsFromNeutralVPSSTP::constructPhaseXML",
293 "importPhase failed ");
304 return cIonsFromNeutral;
322 return hh - pres * molarV;
357 vector_fp& charges, std::vector<size_t>& neutMolIndex)
const
380 for (
size_t k = 0; k <
m_kk; k++) {
392 doublereal xx, fact2;
409 case cIonSolnType_PASSTHROUGH:
412 case cIonSolnType_SINGLEANION:
416 fact2 = 2.0 * RT_ * log(2.0);
431 mu[icat] = RT_ * log(xx);
442 case cIonSolnType_SINGLECATION:
445 case cIonSolnType_MULTICATIONANION:
465 for (
size_t k = 0; k <
m_kk; k++) {
475 for (
size_t k = 0; k <
m_kk; k++) {
495 for (
size_t k = 0; k <
m_kk; k++) {
502 for (
size_t k = 0; k <
m_kk; k++) {
512 for (
size_t k = 0; k <
m_kk; k++) {
522 for (
size_t k = 0; k <
m_kk; k++) {
532 for (
size_t k = 0; k <
m_kk; k++) {
533 for (
size_t m = 0; m <
m_kk; m++) {
534 dlnActCoeffdlnN[ld * k + m] = data[m_kk * k + m];
579 for (
size_t k = 0; k <
m_kk; k++) {
587 for (
size_t k = 0; k <
m_kk; k++) {
596 doublereal sum = 0.0;
597 for (
size_t k = 0; k <
m_kk; k++) {
600 for (
size_t k = 0; k <
m_kk; k++) {
610 doublereal sum = 0.0;
618 for (
size_t k = 0; k <
m_kk; k++) {
621 if (fabs(sum) > 1.0E-11) {
622 throw CanteraError(
"IonsFromNeutralVPSSTP::calcNeutralMoleculeMoleFractions",
623 "molefracts don't sum to one: " +
fp2str(sum));
631 case cIonSolnType_PASSTHROUGH:
632 for (
size_t k = 0; k <
m_kk; k++) {
637 case cIonSolnType_SINGLEANION:
661 for (
size_t k = 0; k <
m_kk; k++) {
665 for (
size_t k = 0; k <
m_kk; k++) {
670 for (
size_t k = 0; k <
m_kk; k++) {
678 throw CanteraError(
"",
"neutral molecule calc error - anion");
696 case cIonSolnType_SINGLECATION:
702 case cIonSolnType_MULTICATIONANION:
718 doublereal sumy, sumdy;
733 case cIonSolnType_PASSTHROUGH:
734 for (
size_t k = 0; k <
m_kk; k++) {
739 case cIonSolnType_SINGLEANION:
747 const doublereal temp = 1.0/fmij;
748 dy[jNeut] += dx[icat] * temp;
757 const doublereal temp = 1.0/fmij;
758 dy[jNeut] += dx[icat] * temp;
761 #ifdef DEBUG_MODE_NOT
763 for (
size_t k = 0; k <
m_kk; k++) {
767 for (
size_t k = 0; k <
m_kk; k++) {
772 for (
size_t k = 0; k <
m_kk; k++) {
780 throw CanteraError(
"",
"neutral molecule calc error - anion");
795 dy[k] = dy[k] * sumy - y_[k]*sumdy*sumy*sumy;
800 case cIonSolnType_SINGLECATION:
806 case cIonSolnType_MULTICATIONANION:
860 throw CanteraError(
"IonsFromNeutralVPSSTP",
"Base class method "
906 const std::vector<double>& elemVectorN,
907 const size_t nElementsN,
908 const std::vector<std::string>& elnamesVI ,
909 const std::vector<double>& elemVectorI,
910 const size_t nElementsI)
912 double fMax = 1.0E100;
913 for (
size_t mi = 0; mi < nElementsI; mi++) {
914 if (elnamesVI[mi] !=
"E") {
915 if (elemVectorI[mi] > 1.0E-13) {
916 double eiNum = elemVectorI[mi];
917 for (
size_t mn = 0; mn < nElementsN; mn++) {
918 if (elnamesVI[mi] == elnamesVN[mn]) {
919 if (elemVectorN[mn] <= 1.0E-13) {
922 fMax = std::min(fMax, elemVectorN[mn]/eiNum);
933 if (id_.size() > 0) {
934 string idp = phaseNode.
id();
936 throw CanteraError(
"IonsFromNeutralVPSSTP::initThermoXML",
937 "phasenode and Id are incompatible");
944 if (!phaseNode.
hasChild(
"thermo")) {
945 throw CanteraError(
"IonsFromNeutralVPSSTP::initThermoXML",
946 "no thermo XML node");
955 stemp = thermoNode.
attrib(
"model");
957 if (formString !=
"ionsfromneutralmolecule") {
958 throw CanteraError(
"IonsFromNeutralVPSSTP::initThermoXML",
959 "model name isn't IonsFromNeutralMolecule: " + formString);
965 if (!thermoNode.
hasChild(
"neutralMoleculePhase")) {
966 throw CanteraError(
"IonsFromNeutralVPSSTP::initThermoXML",
967 "no neutralMoleculePhase XML node");
969 XML_Node& neutralMoleculeNode = thermoNode.
child(
"neutralMoleculePhase");
971 string nsource = neutralMoleculeNode[
"datasrc"];
974 throw CanteraError(
"IonsFromNeutralVPSSTP::initThermoXML",
994 for (
size_t k = 0; k <
m_kk; k++) {
1003 for (
size_t k = 0; k <
m_kk; k++) {
1012 for (
size_t k = 0; k <
m_kk; k++) {
1021 for (
size_t k = 0; k <
m_kk; k++) {
1024 throw CanteraError(
"initThermoXML",
"Dynamic cast failed");
1037 std::vector<double> elemVectorN(nElementsN);
1038 std::vector<double> elemVectorN_orig(nElementsN);
1041 const std::vector<std::string>& elnamesVI =
elementNames();
1042 std::vector<double> elemVectorI(nElementsI);
1044 vector<doublereal> fm_tmp(m_kk);
1045 for (
size_t k = 0; k <
m_kk; k++) {
1052 for (
size_t m = 0; m < nElementsN; m++) {
1055 elemVectorN_orig = elemVectorN;
1056 fm_tmp.assign(m_kk, 0.0);
1058 for (
size_t m = 0; m < nElementsI; m++) {
1061 double fac =
factorOverlap(elnamesVN, elemVectorN, nElementsN,
1062 elnamesVI ,elemVectorI, nElementsI);
1064 for (
size_t m = 0; m < nElementsN; m++) {
1065 std::string mName = elnamesVN[m];
1066 for (
size_t mi = 0; mi < nElementsI; mi++) {
1067 std::string eName = elnamesVI[mi];
1068 if (mName == eName) {
1069 elemVectorN[m] -= fac * elemVectorI[mi];
1078 for (
size_t k = 0; k <
m_kk; k++) {
1079 for (
size_t m = 0; m < nElementsI; m++) {
1080 elemVectorI[m] =
nAtoms(k, m);
1083 elnamesVI ,elemVectorI, nElementsI);
1085 for (
size_t m = 0; m < nElementsN; m++) {
1086 std::string mName = elnamesVN[m];
1087 for (
size_t mi = 0; mi < nElementsI; mi++) {
1088 std::string eName = elnamesVI[mi];
1089 if (mName == eName) {
1090 elemVectorN[m] -= fac * elemVectorI[mi];
1095 bool notTaken =
true;
1096 for (
size_t iNeut = 0; iNeut < jNeut; iNeut++) {
1104 throw CanteraError(
"IonsFromNeutralVPSSTP::initThermoXML",
1105 "Simple formula matrix generation failed, one cation is shared between two salts");
1112 for (
size_t m = 0; m < nElementsN; m++) {
1113 if (fabs(elemVectorN[m]) > 1.0E-13) {
1114 throw CanteraError(
"IonsFromNeutralVPSSTP::initThermoXML",
1115 "Simple formula matrix generation failed");
1142 case cIonSolnType_PASSTHROUGH:
1144 case cIonSolnType_SINGLEANION:
1168 case cIonSolnType_SINGLECATION:
1169 throw CanteraError(
"IonsFromNeutralVPSSTP::s_update_lnActCoeff",
"Unimplemented type");
1171 case cIonSolnType_MULTICATIONANION:
1172 throw CanteraError(
"IonsFromNeutralVPSSTP::s_update_lnActCoeff",
"Unimplemented type");
1175 throw CanteraError(
"IonsFromNeutralVPSSTP::s_update_lnActCoeff",
"Unimplemented type");
1182 doublereal* dlnActCoeffds)
const
1190 for (
size_t k = 0; k <
m_kk; k++) {
1207 case cIonSolnType_PASSTHROUGH:
1209 case cIonSolnType_SINGLEANION:
1217 dlnActCoeffds[icat] = dlnActCoeff_NeutralMolecule_[jNeut]/fmij;
1223 dlnActCoeffds[icat]= 0.0;
1229 dlnActCoeffds[icat] = dlnActCoeff_NeutralMolecule_[jNeut];
1233 case cIonSolnType_SINGLECATION:
1234 throw CanteraError(
"IonsFromNeutralVPSSTP::s_update_lnActCoeffds",
"Unimplemented type");
1236 case cIonSolnType_MULTICATIONANION:
1237 throw CanteraError(
"IonsFromNeutralVPSSTP::s_update_lnActCoeffds",
"Unimplemented type");
1240 throw CanteraError(
"IonsFromNeutralVPSSTP::s_update_lnActCoeffds",
"Unimplemented type");
1261 case cIonSolnType_PASSTHROUGH:
1263 case cIonSolnType_SINGLEANION:
1287 case cIonSolnType_SINGLECATION:
1288 throw CanteraError(
"IonsFromNeutralVPSSTP::s_update_lnActCoeffdT",
"Unimplemented type");
1290 case cIonSolnType_MULTICATIONANION:
1291 throw CanteraError(
"IonsFromNeutralVPSSTP::s_update_lnActCoeffdT",
"Unimplemented type");
1294 throw CanteraError(
"IonsFromNeutralVPSSTP::s_update_lnActCoeffdT",
"Unimplemented type");
1315 case cIonSolnType_PASSTHROUGH:
1317 case cIonSolnType_SINGLEANION:
1341 case cIonSolnType_SINGLECATION:
1342 throw CanteraError(
"IonsFromNeutralVPSSTP::s_update_lnActCoeff_dlnX_diag()",
"Unimplemented type");
1344 case cIonSolnType_MULTICATIONANION:
1345 throw CanteraError(
"IonsFromNeutralVPSSTP::s_update_lnActCoeff_dlnX_diag()",
"Unimplemented type");
1348 throw CanteraError(
"IonsFromNeutralVPSSTP::s_update_lnActCoeff_dlnX_diag()",
"Unimplemented type");
1369 case cIonSolnType_PASSTHROUGH:
1371 case cIonSolnType_SINGLEANION:
1395 case cIonSolnType_SINGLECATION:
1396 throw CanteraError(
"IonsFromNeutralVPSSTP::s_update_lnActCoeff_dlnN_diag()",
"Unimplemented type");
1398 case cIonSolnType_MULTICATIONANION:
1399 throw CanteraError(
"IonsFromNeutralVPSSTP::s_update_lnActCoeff_dlnN_diag()",
"Unimplemented type");
1402 throw CanteraError(
"IonsFromNeutralVPSSTP::s_update_lnActCoeff_dlnN_diag()",
"Unimplemented type");
1410 size_t kcat = 0, kNeut = 0, mcat = 0, mNeut = 0;
1411 doublereal fmij = 0.0, mfmij;
1417 throw CanteraError(
"IonsFromNeutralVPSSTP::s_update_dlnActCoeff_dlnN()",
"dynamic cast failed");
1419 size_t nsp_ge = geThermo->
nSpecies();
1423 case cIonSolnType_PASSTHROUGH:
1425 case cIonSolnType_SINGLEANION:
1453 for (
size_t k = 0; k <
m_kk; k++) {
1464 for (
size_t m = 0; m <
m_kk; m++) {
1481 case cIonSolnType_SINGLECATION:
1482 throw CanteraError(
"IonsFromNeutralVPSSTP::s_update_lnActCoeff_dlnN",
"Unimplemented type");
1484 case cIonSolnType_MULTICATIONANION:
1485 throw CanteraError(
"IonsFromNeutralVPSSTP::s_update_lnActCoeff_dlnN",
"Unimplemented type");
1488 throw CanteraError(
"IonsFromNeutralVPSSTP::s_update_lnActCoeff_dlnN",
"Unimplemented type");
virtual void getdlnActCoeffdlnN(const size_t ld, doublereal *const dlnActCoeffdlnN)
Get the array of derivatives of the log activity coefficients with respect to the log of the species ...
XML_Node * get_XML_Node(const std::string &file_ID, XML_Node *root)
This routine will locate an XML node in either the input XML tree or in another input file specified ...
doublereal nAtoms(size_t k, size_t m) const
Number of atoms of element m in species k.
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_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.
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.
virtual ~IonsFromNeutralVPSSTP()
Destructor.
virtual ThermoPhase * duplMyselfAsThermoPhase() const
Duplication routine for objects which inherit from ThermoPhase.
virtual void setConcentrations(const doublereal *const c)
Set the concentrations to the specified values within the phase.
virtual void setState_TP(doublereal t, doublereal p)
Set the temperature (K) and pressure (Pa)
XML_Node * findXMLPhase(XML_Node *root, const std::string &idtarget)
Search an XML_Node tree for a named phase XML_Node.
Derived class for pressure dependent standard states of an ideal gas species.
IonsFromNeutralVPSSTP & operator=(const IonsFromNeutralVPSSTP &b)
Assignment operator.
size_t nElements() const
Number of elements.
static double factorOverlap(const std::vector< std::string > &elnamesVN, const std::vector< double > &elemVectorN, const size_t nElementsN, const std::vector< std::string > &elnamesVI, const std::vector< double > &elemVectorI, const size_t nElementsI)
Return the factor overlap.
virtual doublereal cp_mole() const
Molar heat capacity at constant pressure. Units: J/kmol/K.
std::string attrib(const std::string &attr) const
Function returns the value of an attribute.
std::vector< double > fm_neutralMolec_ions_
Formula Matrix for composition of neutral molecules in terms of the molecules in this ThermoPhase...
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'.
Header for intermediate ThermoPhase object for phases which consist of ions whose thermodynamics is c...
const size_t npos
index returned by functions to indicate "no position"
vector_fp m_speciesCharge
Vector of species charges. length m_kk.
Headers for the factory class that can create known ThermoPhase objects (see Thermodynamic Properties...
size_t indexSpecialSpecies_
Index of special species.
virtual void calcNeutralMoleculeMoleFractions() const
Calculate neutral molecule mole fractions.
virtual doublereal intEnergy_mole() const
Molar internal energy.
Class XML_Node is a tree-based representation of the contents of an XML file.
virtual void calcIonMoleFractions(doublereal *const mf) const
Calculate ion mole fractions from neutral molecule mole fractions.
void constructPhaseFile(std::string inputFile, std::string id)
The following methods are used in the process of constructing the phase and setting its parameters fr...
virtual void getdlnActCoeffdlnX_diag(doublereal *dlnActCoeffdlnX_diag) const
Get the array of ln mole fraction derivatives of the log activity coefficients - diagonal component o...
virtual void initThermo()
virtual void getStandardChemPotentials(doublereal *mu) const
Get the array of chemical potentials at unit activity for the species at their standard states at the...
doublereal molarDensity() const
Molar density (kmol/m^3).
std::string lowercase(const std::string &s)
Cast a copy of a string to lower case.
void getMoleFractions(doublereal *const x) const
Get the species mole fraction vector.
void s_update_dlnActCoeff_dlnN_diag() const
Update the derivative of the log of the activity coefficients wrt log(number of moles) - diagonal com...
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...
bool IOwnNThermoPhase_
If true then we own the underlying neutral Molecule Phase.
void getDissociationCoeffs(vector_fp &fm_neutralMolec_ions, vector_fp &charges, std::vector< size_t > &neutMolIndex) const
Get the Salt Dissociation Coefficients Returns the vector of dissociation coefficients and vector of ...
void constructPhaseXML(XML_Node &phaseNode, std::string id)
Import and initialize an IonsFromNeutralVPSSTP phase specification in an XML tree into the current ob...
XML_Node & child(const size_t n) const
Return a changeable reference to the n'th child of the current node.
virtual int eosType() const
Equation of state type flag.
Base class for a phase with thermodynamic properties.
doublereal mean_X(const doublereal *const Q) const
Evaluate the mole-fraction-weighted mean of an array Q.
doublereal err(const std::string &msg) const
Error function.
bool importPhase(XML_Node &phase, ThermoPhase *th, SpeciesThermoFactory *spfactory)
Import a phase information into an empty thermophase object.
virtual void getdlnActCoeffdlnN_diag(doublereal *dlnActCoeffdlnN_diag) const
Get the array of log concentration-like derivatives of the log activity coefficients - diagonal compo...
virtual doublereal cv_mole() const
Molar heat capacity at constant volume. Units: J/kmol/K.
virtual doublereal enthalpy_mole() const
Return the Molar enthalpy. Units: J/kmol.
virtual void setTemperature(const doublereal t)
Set the temperature of the phase.
virtual doublereal entropy_mole() const
Molar entropy. Units: J/kmol/K.
doublereal pressure() const
Returns the current pressure of the phase.
virtual void getPartialMolarEntropies(doublereal *sbar) const
Returns an array of partial molar entropies for the species in the mixture.
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 getdlnActCoeffdlnN_diag(doublereal *dlnActCoeffdlnN_diag) const
Get the array of log concentration-like derivatives of the log activity coefficients.
virtual void getChemPotentials(doublereal *mu) const
Get the species chemical potentials. Units: J/kmol.
IonSolnType_enumType ionSolnType_
Ion solution type.
virtual void getdlnActCoeffdT(doublereal *dlnActCoeffdT) const
Get the array of temperature derivatives of the log activity coefficients.
virtual void getdlnActCoeffdlnN(const size_t ld, doublereal *const dlnActCoeffdlnN)
Get the array of derivatives of the ln activity coefficients with respect to the ln species mole numb...
Array2D dlnActCoeffdlnN_NeutralMolecule_
Storage vector for the neutral molecule d ln activity coefficients dlnN.
virtual void getdlnActCoeffds(const doublereal dTds, const doublereal *const dXds, doublereal *dlnActCoeffds) const
Get the change in activity coefficients wrt changes in state (temp, mole fraction, etc) along a line in parameter space or along a line in physical space.
std::vector< doublereal > dlnActCoeffdT_NeutralMolecule_
Storage vector for the neutral molecule d ln activity coefficients dT.
void initLengths()
Initialize lengths of local variables after all species have been identified.
Base class for exceptions thrown by Cantera classes.
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...
std::vector< doublereal > muNeutralMolecule_
Storage vector for the neutral molecule chemical potentials.
void s_update_dlnActCoeffdT() const
Update the temperature derivative of the ln activity coefficients.
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...
bool hasChild(const std::string &ch) const
Tests whether the current node has a child node with a particular name.
const std::vector< std::string > & elementNames() const
Return a read-only reference to the vector of element names.
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.
void s_update_dlnActCoeff_dlnX_diag() const
Update the derivative of the log of the activity coefficients wrt log(mole fraction) ...
std::vector< size_t > anionList_
List of the species in this ThermoPhase which are anion species.
virtual void setState_TP(doublereal t, doublereal p)
Set the temperature (K) and pressure (Pa)
std::vector< size_t > passThroughList_
List of the species in this ThermoPhase which are passed through to the neutralMoleculePhase ThermoPh...
void copy(XML_Node *const node_dest) const
Copy all of the information in the current XML_Node tree into the destination XML_Node tree...
void s_update_dlnActCoeff_dlnN() const
Update the derivative of the log of the activity coefficients wrt log(number of moles) - diagonal com...
std::vector< doublereal > lnActCoeff_NeutralMolecule_
Storage vector for the neutral molecule ln activity coefficients.
int numCationSpecies_
Number of cation species.
size_t nSpecies() const
Returns the number of species in the phase.
void getNeutralMoleculeMoleGrads(const doublereal *const dx, doublereal *const dy) const
Calculate neutral molecule mole fractions.
std::vector< doublereal > dlnActCoeffdlnX_diag_
Storage for the current derivative values of the gradients with respect to logarithm of the mole frac...
size_t numPassThroughSpecies_
Number of the species in this ThermoPhase which are passed through to the neutralMoleculePhase Thermo...
#define AssertTrace(expr)
Assertion must be true or an error is thrown.
virtual void getEntropy_R(doublereal *sr) const
Get the array of nondimensional Enthalpy functions for the standard state species at the current T an...
doublereal temperature() const
Temperature (K).
std::string id() const
Return the id attribute, if present.
virtual void getdlnActCoeffdlnX_diag(doublereal *dlnActCoeffdlnX_diag) const
Get the array of log concentration-like derivatives of the log activity coefficients - diagonal compo...
const doublereal SmallNumber
smallest number to compare to zero.
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...
std::vector< doublereal > moleFractions_
Storage for the current values of the mole fractions of the species.
std::vector< size_t > fm_invert_ionForNeutral
Mapping between ion species and neutral molecule for quick invert.
virtual void getEnthalpy_RT(doublereal *hrt) const
Get the nondimensional Enthalpy functions for the species at their standard states at the current T a...
const doublereal GasConstant
Universal Gas Constant. [J/kmol/K].
virtual void initThermoXML(XML_Node &phaseNode, const std::string &id)
Initialize a ThermoPhase object, potentially reading activity coefficient information from an XML dat...
virtual void setMoleFractions_NoNorm(const doublereal *const x)
Set the mole fractions to the specified values without normalizing.
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.
std::vector< doublereal > dlnActCoeffdlnN_diag_NeutralMolecule_
Storage vector for the neutral molecule d ln activity coefficients dlnN - diagonal component...
std::vector< size_t > cationList_
List of the species in this ThermoPhase which are cation species.
virtual doublereal gibbs_mole() const
Molar Gibbs free Energy for an ideal gas. Units = J/kmol.
void initThermoXML(XML_Node &phaseNode, const std::string &id)
Import and initialize a ThermoPhase object.
XML_Node & xml()
Returns a reference to the XML_Node stored for the phase.
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...
int numAnionSpecies_
Number of anion species.
std::vector< doublereal > dlnActCoeffdlnX_diag_NeutralMolecule_
Storage vector for the neutral molecule d ln activity coefficients dX - diagonal component.
virtual void getPartialMolarCp(doublereal *cpbar) const
Return an array of partial molar heat capacities for the species in the mixture.
virtual void getdlnActCoeffds(const doublereal dTds, const doublereal *const dXds, doublereal *dlnActCoeffds) const
Get the change in activity coefficients w.r.t.
void zero()
Set all of the entries to zero.
virtual void setMoleFractions_NoNorm(const doublereal *const x)
Set the mole fractions to the specified values without normalizing.
std::vector< doublereal > NeutralMolecMoleFractions_
Mole fractions using the Neutral Molecule Mole fraction basis.
virtual void getPartialMolarEnthalpies(doublereal *hbar) const
Returns an array of partial molar enthalpies for the species in the mixture.
virtual void setMassFractions_NoNorm(const doublereal *const y)
Set the mass fractions to the specified values without normalizing.
size_t indexSecondSpecialSpecies_
Index of special species.
Declarations for the class PDSS_IonsFromNeutral ( which handles calculations for a single ion in a fl...
size_t numNeutralMoleculeSpecies_
Number of neutral molecule species.
ThermoPhase * neutralMoleculePhase_
This is a pointer to the neutral Molecule Phase.
virtual void getChemPotentials(doublereal *mu) const
Get the species chemical potentials. Units: J/kmol.
void build(std::istream &f)
Main routine to create an tree-like representation of an XML file.
void s_update_lnActCoeff() const
Update the activity coefficients.
int specialSpecies_
True if this species is the special species.
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...
virtual void setState_TP(doublereal T, doublereal pres)
Set the temperature and pressure at the same time.
std::vector< doublereal > moleFractionsTmp_
Temporary mole fraction vector.
virtual void setPressure(doublereal p)
Set the internally stored pressure (Pa) at constant temperature and composition.
doublereal charge(size_t k) const
Dimensionless electrical charge of a single molecule of species k The charge is normalized by the the...