31 IonsFromNeutralVPSSTP::IonsFromNeutralVPSSTP() :
32 ionSolnType_(cIonSolnType_SINGLEANION),
33 numNeutralMoleculeSpecies_(0),
34 indexSpecialSpecies_(
npos),
35 indexSecondSpecialSpecies_(
npos),
36 neutralMoleculePhase_(0),
38 IOwnNThermoPhase_(true)
43 const std::string& id_,
45 ionSolnType_(cIonSolnType_SINGLEANION),
46 numNeutralMoleculeSpecies_(0),
47 indexSpecialSpecies_(
npos),
48 indexSecondSpecialSpecies_(
npos),
49 neutralMoleculePhase_(neutralPhase),
50 IOwnNThermoPhase_(true)
60 const std::string& id_,
ThermoPhase* neutralPhase) :
61 ionSolnType_(cIonSolnType_SINGLEANION),
62 numNeutralMoleculeSpecies_(0),
63 indexSpecialSpecies_(
npos),
64 indexSecondSpecialSpecies_(
npos),
65 neutralMoleculePhase_(neutralPhase),
66 IOwnNThermoPhase_(true)
74 size_t numNeutMolSpec = geThermo->
nSpecies();
75 dlnActCoeff_NeutralMolecule_.resize(numNeutMolSpec);
76 dX_NeutralMolecule_.resize(numNeutMolSpec);
80 ionSolnType_(cIonSolnType_SINGLEANION),
81 numNeutralMoleculeSpecies_(0),
82 indexSpecialSpecies_(
npos),
83 indexSecondSpecialSpecies_(
npos),
84 neutralMoleculePhase_(0),
86 IOwnNThermoPhase_(true)
132 dlnActCoeff_NeutralMolecule_ = b.dlnActCoeff_NeutralMolecule_;
133 dX_NeutralMolecule_ = b.dX_NeutralMolecule_;
165 if (inputFile.size() == 0) {
167 "input file is null");
170 std::ifstream fin(path.c_str());
172 throw CanteraError(
"MargulesVPSSTP:constructPhaseFile",
"could not open "
173 +path+
" for reading.");
184 "ERROR: Can not find phase named " +
185 id_ +
" in file named " + inputFile);
193 if (id_.size() > 0) {
194 if (phaseNode.
id() != id_) {
195 throw CanteraError(
"IonsFromNeutralVPSSTP::constructPhaseXML",
196 "phasenode and Id are incompatible");
203 if (!phaseNode.
hasChild(
"thermo")) {
204 throw CanteraError(
"IonsFromNeutralVPSSTP::constructPhaseXML",
205 "no thermo XML node");
215 if (formString !=
"ionsfromneutralmolecule") {
216 throw CanteraError(
"IonsFromNeutralVPSSTP::constructPhaseXML",
217 "model name isn't IonsFromNeutralMolecule: " + formString);
223 if (!thermoNode.
hasChild(
"neutralMoleculePhase")) {
224 throw CanteraError(
"IonsFromNeutralVPSSTP::constructPhaseXML",
225 "no neutralMoleculePhase XML node");
227 XML_Node& neutralMoleculeNode = thermoNode.
child(
"neutralMoleculePhase");
231 throw CanteraError(
"IonsFromNeutralVPSSTP::constructPhaseXML",
256 return cIonsFromNeutral;
299 vector_fp& charges, std::vector<size_t>& neutMolIndex)
const
316 for (
size_t k = 0; k <
m_kk; k++) {
328 doublereal xx, fact2;
338 case cIonSolnType_PASSTHROUGH:
341 case cIonSolnType_SINGLEANION:
344 fact2 = 2.0 * RT_ * log(2.0);
359 mu[icat] = RT_ * log(xx);
370 case cIonSolnType_SINGLECATION:
373 case cIonSolnType_MULTICATIONANION:
393 for (
size_t k = 0; k <
m_kk; k++) {
403 for (
size_t k = 0; k <
m_kk; k++) {
422 for (
size_t k = 0; k <
m_kk; k++) {
429 for (
size_t k = 0; k <
m_kk; k++) {
439 for (
size_t k = 0; k <
m_kk; k++) {
449 for (
size_t k = 0; k <
m_kk; k++) {
459 for (
size_t k = 0; k <
m_kk; k++) {
460 for (
size_t m = 0; m <
m_kk; m++) {
461 dlnActCoeffdlnN[ld * k + m] = data[m_kk * k + m];
500 for (
size_t k = 0; k <
m_kk; k++) {
508 for (
size_t k = 0; k <
m_kk; k++) {
517 doublereal sum = 0.0;
518 for (
size_t k = 0; k <
m_kk; k++) {
521 for (
size_t k = 0; k <
m_kk; k++) {
531 doublereal sum = 0.0;
537 if (DEBUG_MODE_ENABLED) {
539 for (
size_t k = 0; k <
m_kk; k++) {
542 if (fabs(sum) > 1.0E-11) {
543 throw CanteraError(
"IonsFromNeutralVPSSTP::calcNeutralMoleculeMoleFractions",
544 "molefracts don't sum to one: " +
fp2str(sum));
550 case cIonSolnType_PASSTHROUGH:
551 for (
size_t k = 0; k <
m_kk; k++) {
556 case cIonSolnType_SINGLEANION:
579 if (DEBUG_MODE_ENABLED) {
580 for (
size_t k = 0; k <
m_kk; k++) {
584 for (
size_t k = 0; k <
m_kk; k++) {
589 for (
size_t k = 0; k <
m_kk; k++) {
593 throw CanteraError(
"IonsFromNeutralVPSSTP::calcNeutralMoleculeMoleFractions",
594 "neutral molecule calc error");
598 throw CanteraError(
"IonsFromNeutralVPSSTP::calcNeutralMoleculeMoleFractions",
599 "neutral molecule calc error - anion");
617 case cIonSolnType_SINGLECATION:
619 throw CanteraError(
"IonsFromNeutralVPSSTP::calcNeutralMoleculeMoleFractions",
"Unknown type");
623 case cIonSolnType_MULTICATIONANION:
625 throw CanteraError(
"IonsFromNeutralVPSSTP::calcNeutralMoleculeMoleFractions",
"Unknown type");
630 throw CanteraError(
"IonsFromNeutralVPSSTP::calcNeutralMoleculeMoleFractions",
"Unknown type");
638 doublereal sumy, sumdy;
650 case cIonSolnType_PASSTHROUGH:
651 for (
size_t k = 0; k <
m_kk; k++) {
656 case cIonSolnType_SINGLEANION:
664 const doublereal temp = 1.0/fmij;
665 dy[jNeut] += dx[icat] * temp;
674 const doublereal temp = 1.0/fmij;
675 dy[jNeut] += dx[icat] * temp;
678 #ifdef DEBUG_MODE_NOT
680 for (
size_t k = 0; k <
m_kk; k++) {
684 for (
size_t k = 0; k <
m_kk; k++) {
689 for (
size_t k = 0; k <
m_kk; k++) {
693 throw CanteraError(
"IonsFromNeutralVPSSTP::getNeutralMoleculeMoleGrads",
694 "neutral molecule calc error");
698 throw CanteraError(
"IonsFromNeutralVPSSTP::getNeutralMoleculeMoleGrads",
699 "neutral molecule calc error - anion");
714 dy[k] = dy[k] * sumy - y_[k]*sumdy*sumy*sumy;
719 case cIonSolnType_SINGLECATION:
721 throw CanteraError(
"IonsFromNeutralVPSSTP::getNeutralMoleculeMoleGrads",
726 case cIonSolnType_MULTICATIONANION:
728 throw CanteraError(
"IonsFromNeutralVPSSTP::getNeutralMoleculeMoleGrads",
734 throw CanteraError(
"IonsFromNeutralVPSSTP::getNeutralMoleculeMoleGrads",
820 const std::vector<double>& elemVectorN,
821 const size_t nElementsN,
822 const std::vector<std::string>& elnamesVI ,
823 const std::vector<double>& elemVectorI,
824 const size_t nElementsI)
826 double fMax = 1.0E100;
827 for (
size_t mi = 0; mi < nElementsI; mi++) {
828 if (elnamesVI[mi] !=
"E") {
829 if (elemVectorI[mi] > 1.0E-13) {
830 double eiNum = elemVectorI[mi];
831 for (
size_t mn = 0; mn < nElementsN; mn++) {
832 if (elnamesVI[mi] == elnamesVN[mn]) {
833 if (elemVectorN[mn] <= 1.0E-13) {
836 fMax = std::min(fMax, elemVectorN[mn]/eiNum);
846 if (id_.size() > 0) {
847 if (phaseNode.
id() != id_) {
848 throw CanteraError(
"IonsFromNeutralVPSSTP::initThermoXML",
849 "phasenode and Id are incompatible");
856 if (!phaseNode.
hasChild(
"thermo")) {
857 throw CanteraError(
"IonsFromNeutralVPSSTP::initThermoXML",
858 "no thermo XML node");
868 if (formString !=
"ionsfromneutralmolecule") {
869 throw CanteraError(
"IonsFromNeutralVPSSTP::initThermoXML",
870 "model name isn't IonsFromNeutralMolecule: " + formString);
876 if (!thermoNode.
hasChild(
"neutralMoleculePhase")) {
877 throw CanteraError(
"IonsFromNeutralVPSSTP::initThermoXML",
878 "no neutralMoleculePhase XML node");
880 XML_Node& neutralMoleculeNode = thermoNode.
child(
"neutralMoleculePhase");
884 throw CanteraError(
"IonsFromNeutralVPSSTP::initThermoXML",
896 for (
size_t k = 0; k <
m_kk; k++) {
903 for (
size_t k = 0; k <
m_kk; k++) {
910 for (
size_t k = 0; k <
m_kk; k++) {
917 for (
size_t k = 0; k <
m_kk; k++) {
921 throw CanteraError(
"initThermoXML",
"Dynamic cast failed");
934 std::vector<double> elemVectorN(nElementsN);
935 std::vector<double> elemVectorN_orig(nElementsN);
938 const std::vector<std::string>& elnamesVI =
elementNames();
939 std::vector<double> elemVectorI(nElementsI);
941 vector<doublereal> fm_tmp(m_kk);
942 for (
size_t k = 0; k <
m_kk; k++) {
946 for (
size_t m = 0; m < nElementsN; m++) {
949 elemVectorN_orig = elemVectorN;
950 fm_tmp.assign(m_kk, 0.0);
952 for (
size_t m = 0; m < nElementsI; m++) {
955 double fac =
factorOverlap(elnamesVN, elemVectorN, nElementsN,
956 elnamesVI ,elemVectorI, nElementsI);
958 for (
size_t m = 0; m < nElementsN; m++) {
959 std::string mName = elnamesVN[m];
960 for (
size_t mi = 0; mi < nElementsI; mi++) {
961 std::string eName = elnamesVI[mi];
962 if (mName == eName) {
963 elemVectorN[m] -= fac * elemVectorI[mi];
972 for (
size_t k = 0; k <
m_kk; k++) {
973 for (
size_t m = 0; m < nElementsI; m++) {
974 elemVectorI[m] =
nAtoms(k, m);
977 elnamesVI ,elemVectorI, nElementsI);
979 for (
size_t m = 0; m < nElementsN; m++) {
980 std::string mName = elnamesVN[m];
981 for (
size_t mi = 0; mi < nElementsI; mi++) {
982 std::string eName = elnamesVI[mi];
983 if (mName == eName) {
984 elemVectorN[m] -= fac * elemVectorI[mi];
989 bool notTaken =
true;
990 for (
size_t iNeut = 0; iNeut < jNeut; iNeut++) {
998 throw CanteraError(
"IonsFromNeutralVPSSTP::initThermoXML",
999 "Simple formula matrix generation failed, one cation is shared between two salts");
1006 for (
size_t m = 0; m < nElementsN; m++) {
1007 if (fabs(elemVectorN[m]) > 1.0E-13) {
1008 throw CanteraError(
"IonsFromNeutralVPSSTP::initThermoXML",
1009 "Simple formula matrix generation failed");
1035 case cIonSolnType_PASSTHROUGH:
1037 case cIonSolnType_SINGLEANION:
1061 case cIonSolnType_SINGLECATION:
1062 throw CanteraError(
"IonsFromNeutralVPSSTP::s_update_lnActCoeff",
"Unimplemented type");
1064 case cIonSolnType_MULTICATIONANION:
1065 throw CanteraError(
"IonsFromNeutralVPSSTP::s_update_lnActCoeff",
"Unimplemented type");
1068 throw CanteraError(
"IonsFromNeutralVPSSTP::s_update_lnActCoeff",
"Unimplemented type");
1075 doublereal* dlnActCoeffds)
const
1082 for (
size_t k = 0; k <
m_kk; k++) {
1099 case cIonSolnType_PASSTHROUGH:
1101 case cIonSolnType_SINGLEANION:
1109 dlnActCoeffds[icat] = dlnActCoeff_NeutralMolecule_[jNeut]/fmij;
1115 dlnActCoeffds[icat]= 0.0;
1121 dlnActCoeffds[icat] = dlnActCoeff_NeutralMolecule_[jNeut];
1125 case cIonSolnType_SINGLECATION:
1126 throw CanteraError(
"IonsFromNeutralVPSSTP::s_update_lnActCoeffds",
"Unimplemented type");
1128 case cIonSolnType_MULTICATIONANION:
1129 throw CanteraError(
"IonsFromNeutralVPSSTP::s_update_lnActCoeffds",
"Unimplemented type");
1132 throw CanteraError(
"IonsFromNeutralVPSSTP::s_update_lnActCoeffds",
"Unimplemented type");
1152 case cIonSolnType_PASSTHROUGH:
1154 case cIonSolnType_SINGLEANION:
1178 case cIonSolnType_SINGLECATION:
1179 throw CanteraError(
"IonsFromNeutralVPSSTP::s_update_lnActCoeffdT",
"Unimplemented type");
1181 case cIonSolnType_MULTICATIONANION:
1182 throw CanteraError(
"IonsFromNeutralVPSSTP::s_update_lnActCoeffdT",
"Unimplemented type");
1185 throw CanteraError(
"IonsFromNeutralVPSSTP::s_update_lnActCoeffdT",
"Unimplemented type");
1205 case cIonSolnType_PASSTHROUGH:
1207 case cIonSolnType_SINGLEANION:
1231 case cIonSolnType_SINGLECATION:
1232 throw CanteraError(
"IonsFromNeutralVPSSTP::s_update_lnActCoeff_dlnX_diag()",
"Unimplemented type");
1234 case cIonSolnType_MULTICATIONANION:
1235 throw CanteraError(
"IonsFromNeutralVPSSTP::s_update_lnActCoeff_dlnX_diag()",
"Unimplemented type");
1238 throw CanteraError(
"IonsFromNeutralVPSSTP::s_update_lnActCoeff_dlnX_diag()",
"Unimplemented type");
1258 case cIonSolnType_PASSTHROUGH:
1260 case cIonSolnType_SINGLEANION:
1284 case cIonSolnType_SINGLECATION:
1285 throw CanteraError(
"IonsFromNeutralVPSSTP::s_update_lnActCoeff_dlnN_diag()",
"Unimplemented type");
1287 case cIonSolnType_MULTICATIONANION:
1288 throw CanteraError(
"IonsFromNeutralVPSSTP::s_update_lnActCoeff_dlnN_diag()",
"Unimplemented type");
1291 throw CanteraError(
"IonsFromNeutralVPSSTP::s_update_lnActCoeff_dlnN_diag()",
"Unimplemented type");
1299 size_t kcat = 0, kNeut = 0, mcat = 0, mNeut = 0;
1300 doublereal fmij = 0.0;
1306 throw CanteraError(
"IonsFromNeutralVPSSTP::s_update_dlnActCoeff_dlnN()",
"dynamic cast failed");
1308 size_t nsp_ge = geThermo->
nSpecies();
1312 case cIonSolnType_PASSTHROUGH:
1314 case cIonSolnType_SINGLEANION:
1342 for (
size_t k = 0; k <
m_kk; k++) {
1353 for (
size_t m = 0; m <
m_kk; m++) {
1369 case cIonSolnType_SINGLECATION:
1370 throw CanteraError(
"IonsFromNeutralVPSSTP::s_update_lnActCoeff_dlnN",
"Unimplemented type");
1372 case cIonSolnType_MULTICATIONANION:
1373 throw CanteraError(
"IonsFromNeutralVPSSTP::s_update_lnActCoeff_dlnN",
"Unimplemented type");
1376 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).
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.
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...
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.
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 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.
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...
#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.
void setXMLdata(XML_Node &xmlPhase)
Stores the XML tree information for the current 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...
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...