Cantera  2.4.0
MixedSolventElectrolyte.cpp
Go to the documentation of this file.
1 /**
2  * @file MixedSolventElectrolyte.cpp see \ref thermoprops and class \link
3  * Cantera::MixedSolventElectrolyte MixedSolventElectrolyte \endlink).
4  */
5 
6 // This file is part of Cantera. See License.txt in the top-level directory or
7 // at http://www.cantera.org/license.txt for license and copyright information.
8 
12 #include "cantera/base/ctml.h"
13 
14 using namespace std;
15 
16 namespace Cantera
17 {
18 MixedSolventElectrolyte::MixedSolventElectrolyte() :
19  numBinaryInteractions_(0),
20  formMargules_(0),
21  formTempModel_(0)
22 {
23  warn_deprecated("class MixedSolventElectrolyte",
24  "To be removed after Cantera 2.4");
25 }
26 
27 MixedSolventElectrolyte::MixedSolventElectrolyte(const std::string& inputFile,
28  const std::string& id_) :
29  numBinaryInteractions_(0),
30  formMargules_(0),
31  formTempModel_(0)
32 {
33  warn_deprecated("class MixedSolventElectrolyte",
34  "To be removed after Cantera 2.4");
35  initThermoFile(inputFile, id_);
36 }
37 
38 MixedSolventElectrolyte::MixedSolventElectrolyte(XML_Node& phaseRoot,
39  const std::string& id_) :
40  numBinaryInteractions_(0),
41  formMargules_(0),
42  formTempModel_(0)
43 {
44  warn_deprecated("class MixedSolventElectrolyte",
45  "To be removed after Cantera 2.4");
46  importPhase(phaseRoot, this);
47 }
48 
49 // - Activities, Standard States, Activity Concentrations -----------
50 
52 {
53  // Update the activity coefficients
55 
56  // take the exp of the internally stored coefficients.
57  for (size_t k = 0; k < m_kk; k++) {
58  ac[k] = exp(lnActCoeff_Scaled_[k]);
59  }
60 }
61 
62 // ------------ Partial Molar Properties of the Solution ------------
63 
65 {
66  // First get the standard chemical potentials in molar form. This requires
67  // updates of standard state as a function of T and P
69  // Update the activity coefficients
71  for (size_t k = 0; k < m_kk; k++) {
72  double xx = std::max(moleFractions_[k], SmallNumber);
73  mu[k] += RT() * (log(xx) + lnActCoeff_Scaled_[k]);
74  }
75 }
76 
78 {
79  double h = 0;
80  vector_fp hbar(m_kk);
81  getPartialMolarEnthalpies(&hbar[0]);
82  for (size_t i = 0; i < m_kk; i++) {
83  h += moleFractions_[i]*hbar[i];
84  }
85  return h;
86 }
87 
89 {
90  double s = 0;
91  vector_fp sbar(m_kk);
92  getPartialMolarEntropies(&sbar[0]);
93  for (size_t i = 0; i < m_kk; i++) {
94  s += moleFractions_[i]*sbar[i];
95  }
96  return s;
97 }
98 
100 {
101  double cp = 0;
102  vector_fp cpbar(m_kk);
103  getPartialMolarCp(&cpbar[0]);
104  for (size_t i = 0; i < m_kk; i++) {
105  cp += moleFractions_[i]*cpbar[i];
106  }
107  return cp;
108 }
109 
111 {
112  return cp_mole() - GasConstant;
113 }
114 
116 {
117  // Get the nondimensional standard state enthalpies
118  getEnthalpy_RT(hbar);
119  // dimensionalize it.
120  for (size_t k = 0; k < m_kk; k++) {
121  hbar[k] *= RT();
122  }
123 
124  // Update the activity coefficients, This also update the internally stored
125  // molalities.
128  for (size_t k = 0; k < m_kk; k++) {
129  hbar[k] -= RT() * temperature() * dlnActCoeffdT_Scaled_[k];
130  }
131 }
132 
133 void MixedSolventElectrolyte::getPartialMolarCp(doublereal* cpbar) const
134 {
135  getCp_R(cpbar);
136  double T = temperature();
137 
138  // Update the activity coefficients, This also update the internally stored
139  // molalities.
142 
143  for (size_t k = 0; k < m_kk; k++) {
144  cpbar[k] -= 2 * T * dlnActCoeffdT_Scaled_[k] + T * T * d2lnActCoeffdT2_Scaled_[k];
145  }
146  // dimensionalize it.
147  for (size_t k = 0; k < m_kk; k++) {
148  cpbar[k] *= GasConstant;
149  }
150 }
151 
153 {
154  // Get the nondimensional standard state entropies
155  getEntropy_R(sbar);
156  double T = temperature();
157 
158  // Update the activity coefficients, This also update the
159  // internally stored molalities.
162 
163  for (size_t k = 0; k < m_kk; k++) {
164  double xx = std::max(moleFractions_[k], SmallNumber);
165  sbar[k] += - lnActCoeff_Scaled_[k] -log(xx) - T * dlnActCoeffdT_Scaled_[k];
166  }
167  // dimensionalize it.
168  for (size_t k = 0; k < m_kk; k++) {
169  sbar[k] *= GasConstant;
170  }
171 }
172 
174 {
175  double T = temperature();
176 
177  // Get the standard state values in m^3 kmol-1
178  getStandardVolumes(vbar);
179 
180  for (size_t iK = 0; iK < m_kk; iK++) {
181  int delAK = 0;
182  int delBK = 0;
183  for (size_t i = 0; i < numBinaryInteractions_; i++) {
184  size_t iA = m_pSpecies_A_ij[i];
185  size_t iB = m_pSpecies_B_ij[i];
186 
187  if (iA==iK) {
188  delAK = 1;
189  } else if (iB==iK) {
190  delBK = 1;
191  }
192 
193  double XA = moleFractions_[iA];
194  double XB = moleFractions_[iB];
195 
196  double g0 = (m_VHE_b_ij[i] - T * m_VSE_b_ij[i]);
197  double g1 = (m_VHE_c_ij[i] - T * m_VSE_c_ij[i]);
198 
199  vbar[iK] += XA*XB*(g0+g1*XB)+((delAK-XA)*XB+XA*(delBK-XB))*(g0+g1*XB)+XA*XB*(delBK-XB)*g1;
200  }
201  }
202 }
203 
205 {
206  initLengths();
208 }
209 
211 {
213 }
214 
215 void MixedSolventElectrolyte::initThermoXML(XML_Node& phaseNode, const std::string& id_)
216 {
217  if ((int) id_.size() > 0 && phaseNode.id() != id_) {
218  throw CanteraError("MixedSolventElectrolyte::initThermoXML",
219  "phasenode and Id are incompatible");
220  }
221 
222  // Check on the thermo field. Must have:
223  // <thermo model="MixedSolventElectrolyte" />
224  if (!phaseNode.hasChild("thermo")) {
225  throw CanteraError("MixedSolventElectrolyte::initThermoXML",
226  "no thermo XML node");
227  }
228  XML_Node& thermoNode = phaseNode.child("thermo");
229  string mString = thermoNode["model"];
230  if (!caseInsensitiveEquals(thermoNode["model"], "mixedsolventelectrolyte")) {
231  throw CanteraError("MixedSolventElectrolyte::initThermoXML",
232  "Unknown thermo model: " + thermoNode["model"]);
233  }
234 
235  // Go get all of the coefficients and factors in the activityCoefficients
236  // XML block
237  if (thermoNode.hasChild("activityCoefficients")) {
238  XML_Node& acNode = thermoNode.child("activityCoefficients");
239  if (!caseInsensitiveEquals(acNode["model"], "margules")) {
240  throw CanteraError("MixedSolventElectrolyte::initThermoXML",
241  "Unknown activity coefficient model: " + acNode["model"]);
242  }
243  for (size_t i = 0; i < acNode.nChildren(); i++) {
244  XML_Node& xmlACChild = acNode.child(i);
245 
246  // Process a binary salt field, or any of the other XML fields that
247  // make up the Pitzer Database. Entries will be ignored if any of
248  // the species in the entry isn't in the solution.
249  if (caseInsensitiveEquals(xmlACChild.name(), "binaryneutralspeciesparameters")) {
250  readXMLBinarySpecies(xmlACChild);
251  }
252  }
253  }
254 
255  // Go down the chain
256  MolarityIonicVPSSTP::initThermoXML(phaseNode, id_);
257 }
258 
260 {
261  double T = temperature();
262  lnActCoeff_Scaled_.assign(m_kk, 0.0);
263  for (size_t iK = 0; iK < m_kk; iK++) {
264  for (size_t i = 0; i < numBinaryInteractions_; i++) {
265  size_t iA = m_pSpecies_A_ij[i];
266  size_t iB = m_pSpecies_B_ij[i];
267  int delAK = 0;
268  int delBK = 0;
269  if (iA==iK) {
270  delAK = 1;
271  } else if (iB==iK) {
272  delBK = 1;
273  }
274  double XA = moleFractions_[iA];
275  double XB = moleFractions_[iB];
276  double g0 = (m_HE_b_ij[i] - T * m_SE_b_ij[i]) / RT();
277  double g1 = (m_HE_c_ij[i] - T * m_SE_c_ij[i]) / RT();
278  lnActCoeff_Scaled_[iK] += (delAK * XB + XA * delBK - XA * XB) * (g0 + g1 * XB) + XA * XB * (delBK - XB) * g1;
279  }
280  }
281 }
282 
284 {
285  doublereal T = temperature();
286  doublereal RTT = GasConstant*T*T;
287  dlnActCoeffdT_Scaled_.assign(m_kk, 0.0);
288  d2lnActCoeffdT2_Scaled_.assign(m_kk, 0.0);
289  for (size_t iK = 0; iK < m_kk; iK++) {
290  for (size_t i = 0; i < numBinaryInteractions_; i++) {
291  size_t iA = m_pSpecies_A_ij[i];
292  size_t iB = m_pSpecies_B_ij[i];
293  int delAK = 0;
294  int delBK = 0;
295  if (iA==iK) {
296  delAK = 1;
297  } else if (iB==iK) {
298  delBK = 1;
299  }
300  double XA = moleFractions_[iA];
301  double XB = moleFractions_[iB];
302  double g0 = -m_HE_b_ij[i] / RTT;
303  double g1 = -m_HE_c_ij[i] / RTT;
304  double temp = (delAK * XB + XA * delBK - XA * XB) * (g0 + g1 * XB) + XA * XB * (delBK - XB) * g1;
305  dlnActCoeffdT_Scaled_[iK] += temp;
306  d2lnActCoeffdT2_Scaled_[iK] -= 2.0 * temp / T;
307  }
308  }
309 }
310 
311 void MixedSolventElectrolyte::getdlnActCoeffdT(doublereal* dlnActCoeffdT) const
312 {
314  for (size_t k = 0; k < m_kk; k++) {
315  dlnActCoeffdT[k] = dlnActCoeffdT_Scaled_[k];
316  }
317 }
318 
319 void MixedSolventElectrolyte::getd2lnActCoeffdT2(doublereal* d2lnActCoeffdT2) const
320 {
322  for (size_t k = 0; k < m_kk; k++) {
323  d2lnActCoeffdT2[k] = d2lnActCoeffdT2_Scaled_[k];
324  }
325 }
326 
327 void MixedSolventElectrolyte::getdlnActCoeffds(const doublereal dTds, const doublereal* const dXds,
328  doublereal* dlnActCoeffds) const
329 {
330  double T = temperature();
332 
333  for (size_t iK = 0; iK < m_kk; iK++) {
334  dlnActCoeffds[iK] = 0.0;
335  for (size_t i = 0; i < numBinaryInteractions_; i++) {
336  size_t iA = m_pSpecies_A_ij[i];
337  size_t iB = m_pSpecies_B_ij[i];
338  int delAK = 0;
339  int delBK = 0;
340 
341  if (iA==iK) {
342  delAK = 1;
343  } else if (iB==iK) {
344  delBK = 1;
345  }
346 
347  double XA = moleFractions_[iA];
348  double XB = moleFractions_[iB];
349  double dXA = dXds[iA];
350  double dXB = dXds[iB];
351  double g0 = (m_HE_b_ij[i] - T * m_SE_b_ij[i]) / RT();
352  double g1 = (m_HE_c_ij[i] - T * m_SE_c_ij[i]) / RT();
353  dlnActCoeffds[iK] += ((delBK-XB)*dXA + (delAK-XA)*dXB)*(g0+2*g1*XB) + (delBK-XB)*2*g1*XA*dXB
354  + dlnActCoeffdT_Scaled_[iK]*dTds;
355  }
356  }
357 }
358 
360 {
361  double T = temperature();
362  dlnActCoeffdlnN_diag_.assign(m_kk, 0);
363 
364  for (size_t iK = 0; iK < m_kk; iK++) {
365  double XK = moleFractions_[iK];
366  for (size_t i = 0; i < numBinaryInteractions_; i++) {
367  size_t iA = m_pSpecies_A_ij[i];
368  size_t iB = m_pSpecies_B_ij[i];
369  int delAK = 0;
370  int delBK = 0;
371 
372  if (iA==iK) {
373  delAK = 1;
374  } else if (iB==iK) {
375  delBK = 1;
376  }
377 
378  double XA = moleFractions_[iA];
379  double XB = moleFractions_[iB];
380  double g0 = (m_HE_b_ij[i] - T * m_SE_b_ij[i]) / RT();
381  double g1 = (m_HE_c_ij[i] - T * m_SE_c_ij[i]) / RT();
382 
383  dlnActCoeffdlnN_diag_[iK] += 2*(delBK-XB)*(g0*(delAK-XA)+g1*(2*(delAK-XA)*XB+XA*(delBK-XB)));
384  }
385  dlnActCoeffdlnN_diag_[iK] = XK*dlnActCoeffdlnN_diag_[iK];//-XK;
386  }
387 }
388 
390 {
391  double T = temperature();
393 
394  // Loop over the activity coefficient gamma_k
395  for (size_t iK = 0; iK < m_kk; iK++) {
396  for (size_t iM = 0; iM < m_kk; iM++) {
397  double XM = moleFractions_[iM];
398  for (size_t i = 0; i < numBinaryInteractions_; i++) {
399  size_t iA = m_pSpecies_A_ij[i];
400  size_t iB = m_pSpecies_B_ij[i];
401  double delAK = 0.0;
402  double delBK = 0.0;
403  double delAM = 0.0;
404  double delBM = 0.0;
405  if (iA==iK) {
406  delAK = 1.0;
407  } else if (iB==iK) {
408  delBK = 1.0;
409  }
410  if (iA==iM) {
411  delAM = 1.0;
412  } else if (iB==iM) {
413  delBM = 1.0;
414  }
415 
416  double XA = moleFractions_[iA];
417  double XB = moleFractions_[iB];
418  double g0 = (m_HE_b_ij[i] - T * m_SE_b_ij[i]) / RT();
419  double g1 = (m_HE_c_ij[i] - T * m_SE_c_ij[i]) / RT();
420  dlnActCoeffdlnN_(iK,iM) += g0*((delAM-XA)*(delBK-XB)+(delAK-XA)*(delBM-XB));
421  dlnActCoeffdlnN_(iK,iM) += 2*g1*((delAM-XA)*(delBK-XB)*XB+(delAK-XA)*(delBM-XB)*XB+(delBM-XB)*(delBK-XB)*XA);
422  }
423  dlnActCoeffdlnN_(iK,iM) = XM*dlnActCoeffdlnN_(iK,iM);
424  }
425  }
426 }
427 
429 {
430  doublereal T = temperature();
431  dlnActCoeffdlnX_diag_.assign(m_kk, 0);
432 
433  for (size_t i = 0; i < numBinaryInteractions_; i++) {
434  size_t iA = m_pSpecies_A_ij[i];
435  size_t iB = m_pSpecies_B_ij[i];
436  double XA = moleFractions_[iA];
437  double XB = moleFractions_[iB];
438  double g0 = (m_HE_b_ij[i] - T * m_SE_b_ij[i]) / RT();
439  double g1 = (m_HE_c_ij[i] - T * m_SE_c_ij[i]) / RT();
440  dlnActCoeffdlnX_diag_[iA] += XA*XB*(2*g1*-2*g0-6*g1*XB);
441  dlnActCoeffdlnX_diag_[iB] += XA*XB*(2*g1*-2*g0-6*g1*XB);
442  }
443 }
444 
445 void MixedSolventElectrolyte::getdlnActCoeffdlnN_diag(doublereal* dlnActCoeffdlnN_diag) const
446 {
448  for (size_t k = 0; k < m_kk; k++) {
449  dlnActCoeffdlnN_diag[k] = dlnActCoeffdlnN_diag_[k];
450  }
451 }
452 
453 void MixedSolventElectrolyte::getdlnActCoeffdlnX_diag(doublereal* dlnActCoeffdlnX_diag) const
454 {
456  for (size_t k = 0; k < m_kk; k++) {
457  dlnActCoeffdlnX_diag[k] = dlnActCoeffdlnX_diag_[k];
458  }
459 }
460 
461 void MixedSolventElectrolyte::getdlnActCoeffdlnN(const size_t ld, doublereal* dlnActCoeffdlnN)
462 {
464  double* data = & dlnActCoeffdlnN_(0,0);
465  for (size_t k = 0; k < m_kk; k++) {
466  for (size_t m = 0; m < m_kk; m++) {
467  dlnActCoeffdlnN[ld * k + m] = data[m_kk * k + m];
468  }
469  }
470 }
471 
473 {
475  m_HE_b_ij.resize(num, 0.0);
476  m_HE_c_ij.resize(num, 0.0);
477  m_HE_d_ij.resize(num, 0.0);
478  m_SE_b_ij.resize(num, 0.0);
479  m_SE_c_ij.resize(num, 0.0);
480  m_SE_d_ij.resize(num, 0.0);
481  m_VHE_b_ij.resize(num, 0.0);
482  m_VHE_c_ij.resize(num, 0.0);
483  m_VHE_d_ij.resize(num, 0.0);
484  m_VSE_b_ij.resize(num, 0.0);
485  m_VSE_c_ij.resize(num, 0.0);
486  m_VSE_d_ij.resize(num, 0.0);
487  m_pSpecies_A_ij.resize(num, npos);
488  m_pSpecies_B_ij.resize(num, npos);
489 }
490 
492 {
493  string xname = xmLBinarySpecies.name();
494  if (xname != "binaryNeutralSpeciesParameters") {
495  throw CanteraError("MixedSolventElectrolyte::readXMLBinarySpecies",
496  "Incorrect name for processing this routine: " + xname);
497  }
498  vector_fp vParams;
499  string iName = xmLBinarySpecies.attrib("speciesA");
500  if (iName == "") {
501  throw CanteraError("MixedSolventElectrolyte::readXMLBinarySpecies", "no speciesA attrib");
502  }
503  string jName = xmLBinarySpecies.attrib("speciesB");
504  if (jName == "") {
505  throw CanteraError("MixedSolventElectrolyte::readXMLBinarySpecies", "no speciesB attrib");
506  }
507 
508  // Find the index of the species in the current phase. It's not an error to
509  // not find the species
510  size_t iSpecies = speciesIndex(iName);
511  if (iSpecies == npos) {
512  return;
513  }
514  string ispName = speciesName(iSpecies);
515  if (charge(iSpecies) != 0) {
516  throw CanteraError("MixedSolventElectrolyte::readXMLBinarySpecies", "speciesA charge problem");
517  }
518  size_t jSpecies = speciesIndex(jName);
519  if (jSpecies == npos) {
520  return;
521  }
522  string jspName = speciesName(jSpecies);
523  if (charge(jSpecies) != 0) {
524  throw CanteraError("MixedSolventElectrolyte::readXMLBinarySpecies", "speciesB charge problem");
525  }
526 
528  size_t iSpot = numBinaryInteractions_ - 1;
529  m_pSpecies_A_ij[iSpot] = iSpecies;
530  m_pSpecies_B_ij[iSpot] = jSpecies;
531 
532  for (size_t iChild = 0; iChild < xmLBinarySpecies.nChildren(); iChild++) {
533  XML_Node& xmlChild = xmLBinarySpecies.child(iChild);
534  string nodeName = toLowerCopy(xmlChild.name());
535 
536  // Process the binary species interaction child elements
537  if (nodeName == "excessenthalpy") {
538  // Get the string containing all of the values
539  getFloatArray(xmlChild, vParams, true, "toSI", "excessEnthalpy");
540  if (vParams.size() != 2) {
541  throw CanteraError("MixedSolventElectrolyte::readXMLBinarySpecies::excessEnthalpy for " + ispName
542  + "::" + jspName,
543  "wrong number of params found");
544  }
545  m_HE_b_ij[iSpot] = vParams[0];
546  m_HE_c_ij[iSpot] = vParams[1];
547  }
548 
549  if (nodeName == "excessentropy") {
550  // Get the string containing all of the values
551  getFloatArray(xmlChild, vParams, true, "toSI", "excessEntropy");
552  if (vParams.size() != 2) {
553  throw CanteraError("MixedSolventElectrolyte::readXMLBinarySpecies::excessEntropy for " + ispName
554  + "::" + jspName,
555  "wrong number of params found");
556  }
557  m_SE_b_ij[iSpot] = vParams[0];
558  m_SE_c_ij[iSpot] = vParams[1];
559  }
560 
561  if (nodeName == "excessvolume_enthalpy") {
562  // Get the string containing all of the values
563  getFloatArray(xmlChild, vParams, true, "toSI", "excessVolume_Enthalpy");
564  if (vParams.size() != 2) {
565  throw CanteraError("MixedSolventElectrolyte::readXMLBinarySpecies::excessVolume_Enthalpy for " + ispName
566  + "::" + jspName,
567  "wrong number of params found");
568  }
569  m_VHE_b_ij[iSpot] = vParams[0];
570  m_VHE_c_ij[iSpot] = vParams[1];
571  }
572 
573  if (nodeName == "excessvolume_entropy") {
574  // Get the string containing all of the values
575  getFloatArray(xmlChild, vParams, true, "toSI", "excessVolume_Entropy");
576  if (vParams.size() != 2) {
577  throw CanteraError("MixedSolventElectrolyte::readXMLBinarySpecies::excessVolume_Entropy for " + ispName
578  + "::" + jspName,
579  "wrong number of params found");
580  }
581  m_VSE_b_ij[iSpot] = vParams[0];
582  m_VSE_c_ij[iSpot] = vParams[1];
583  }
584  }
585 }
586 
587 }
virtual void getdlnActCoeffdlnN_diag(doublereal *dlnActCoeffdlnN_diag) const
Get the array of log species mole number derivatives of the log activity coefficients.
void s_update_lnActCoeff() const
Update the activity coefficients.
virtual void getChemPotentials(doublereal *mu) const
Get the species chemical potentials. Units: J/kmol.
virtual void getdlnActCoeffdlnX_diag(doublereal *dlnActCoeffdlnX_diag) const
Get the array of ln mole fraction derivatives of the log activity coefficients - diagonal component o...
CTML ("Cantera Markup Language") is the variant of XML that Cantera uses to store data...
std::string name() const
Returns the name of the XML node.
Definition: xml.h:370
vector_fp dlnActCoeffdlnX_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...
doublereal temperature() const
Temperature (K).
Definition: Phase.h:601
void resize(size_t n, size_t m, doublereal v=0.0)
Resize the array, and fill the new entries with &#39;v&#39;.
Definition: Array.h:112
size_t getFloatArray(const XML_Node &node, vector_fp &v, const bool convert, const std::string &unitsString, const std::string &nodeName)
This function reads the current node or a child node of the current node with the default name...
Definition: ctml.cpp:256
size_t speciesIndex(const std::string &name) const
Returns the index of a species named &#39;name&#39; within the Phase object.
Definition: Phase.cpp:175
virtual doublereal cv_mole() const
Molar heat capacity at constant volume. Units: J/kmol/K.
const size_t npos
index returned by functions to indicate "no position"
Definition: ct_defs.h:165
vector_fp m_HE_d_ij
Enthalpy term for the quaternary mole fraction interaction of the excess Gibbs free energy expression...
Headers for the factory class that can create known ThermoPhase objects (see Thermodynamic Properties...
Class XML_Node is a tree-based representation of the contents of an XML file.
Definition: xml.h:97
virtual void getCp_R(doublereal *cpr) const
Get the nondimensional Heat Capacities at constant pressure for the species standard states at the cu...
void warn_deprecated(const std::string &method, const std::string &extra)
Print a warning indicating that method is deprecated.
Definition: global.cpp:54
STL namespace.
vector_fp m_SE_b_ij
Entropy term for the binary mole fraction interaction of the excess Gibbs free energy expression...
virtual void getPartialMolarVolumes(doublereal *vbar) const
Return an array of partial molar volumes for the species in the mixture.
doublereal RT() const
Return the Gas Constant multiplied by the current temperature.
Definition: ThermoPhase.h:748
void readXMLBinarySpecies(XML_Node &xmlBinarySpecies)
Process an XML node called "binaryNeutralSpeciesParameters".
virtual void getd2lnActCoeffdT2(doublereal *d2lnActCoeffdT2) const
Get the array of temperature second derivatives of the log activity coefficients. ...
virtual void initThermoXML(XML_Node &phaseNode, const std::string &id)
Import and initialize a ThermoPhase object using an XML tree.
vector_fp dlnActCoeffdlnN_diag_
Storage for the current derivative values of the gradients with respect to logarithm of the mole frac...
virtual void getdlnActCoeffdT(doublereal *dlnActCoeffdT) const
Get the array of temperature derivatives of the log activity coefficients.
void initLengths()
Initialize lengths of local variables after all species have been identified.
vector_fp d2lnActCoeffdT2_Scaled_
Storage for the current derivative values of the gradients with respect to temperature of the log of ...
virtual void getPartialMolarCp(doublereal *cpbar) const
Returns an array of partial molar entropies for the species in the mixture.
vector_fp m_HE_b_ij
Enthalpy term for the binary mole fraction interaction of the excess Gibbs free energy expression...
std::string speciesName(size_t k) const
Name of the species with index k.
Definition: Phase.cpp:191
virtual void initThermoXML(XML_Node &phaseNode, const std::string &id)
Import and initialize a ThermoPhase object using an XML tree.
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 ...
vector_fp m_VHE_d_ij
Enthalpy term for the quaternary mole fraction interaction of the excess Gibbs free energy expression...
virtual doublereal enthalpy_mole() const
Molar enthalpy. Units: J/kmol.
void s_update_dlnActCoeff_dlnX_diag() const
Update the derivative of the log of the activity coefficients wrt log(mole fraction) ...
void resizeNumInteractions(const size_t num)
Resize internal arrays within the object that depend upon the number of binary Margules interaction t...
bool caseInsensitiveEquals(const std::string &input, const std::string &test)
Case insensitive equality predicate.
virtual void getStandardChemPotentials(doublereal *mu) const
Get the array of chemical potentials at unit activity for the species at their standard states at the...
Base class for exceptions thrown by Cantera classes.
Definition: ctexceptions.h:65
vector_fp m_VHE_b_ij
Enthalpy term for the binary mole fraction interaction of the excess Gibbs free energy expression...
vector_fp m_VHE_c_ij
Enthalpy term for the ternary mole fraction interaction of the excess Gibbs free energy expression...
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.
void importPhase(XML_Node &phase, ThermoPhase *th)
Import a phase information into an empty ThermoPhase object.
vector_fp lnActCoeff_Scaled_
Storage for the current values of the activity coefficients of the species.
vector_fp m_VSE_c_ij
Entropy term for the ternary mole fraction interaction of the excess Gibbs free energy expression...
vector_fp m_VSE_d_ij
Entropy term for the quaternary mole fraction interaction of the excess Gibbs free energy expression...
std::vector< size_t > m_pSpecies_B_ij
vector of species indices representing species B in the interaction
vector_fp m_SE_c_ij
Entropy term for the ternary mole fraction interaction of the excess Gibbs free energy expression...
vector_fp m_HE_c_ij
Enthalpy term for the ternary mole fraction interaction of the excess Gibbs free energy expression...
size_t numBinaryInteractions_
number of binary interaction expressions
virtual void getPartialMolarEntropies(doublereal *sbar) const
Returns an array of partial molar entropies for the species in the mixture.
bool hasChild(const std::string &ch) const
Tests whether the current node has a child node with a particular name.
Definition: xml.cpp:536
virtual doublereal entropy_mole() const
Molar entropy. Units: J/kmol/K.
XML_Node & child(const size_t n) const
Return a changeable reference to the n&#39;th child of the current node.
Definition: xml.cpp:546
std::vector< size_t > m_pSpecies_A_ij
vector of species indices representing species A in the interaction
const doublereal SmallNumber
smallest number to compare to zero.
Definition: ct_defs.h:126
std::string attrib(const std::string &attr) const
Function returns the value of an attribute.
Definition: xml.cpp:500
std::vector< double > vector_fp
Turn on the use of stl vectors for the basic array type within cantera Vector of doubles.
Definition: ct_defs.h:157
void s_update_dlnActCoeff_dlnN_diag() const
Update the derivative of the log of the activity coefficients wrt log(moles) - diagonal only...
std::string id() const
Return the id attribute, if present.
Definition: xml.cpp:428
const doublereal GasConstant
Universal Gas Constant. [J/kmol/K].
Definition: ct_defs.h:64
Contains declarations for string manipulation functions within Cantera.
virtual doublereal cp_mole() const
Molar heat capacity at constant pressure. Units: J/kmol/K.
vector_fp moleFractions_
Storage for the current values of the mole fractions of the species.
size_t m_kk
Number of species in the phase.
Definition: Phase.h:788
Array2D dlnActCoeffdlnN_
Storage for the current derivative values of the gradients with respect to logarithm of the species m...
virtual void getEntropy_R(doublereal *sr) const
Get the array of nondimensional Entropy functions for the standard state species at the current T and...
void s_update_dlnActCoeff_dlnN() const
Update the derivative of the log of the activity coefficients wrt log(moles_m)
vector_fp m_SE_d_ij
Entropy term for the quaternary mole fraction interaction of the excess Gibbs free energy expression...
void zero()
Set all of the entries to zero.
Definition: Array.h:198
virtual void initThermoFile(const std::string &inputFile, const std::string &id)
std::string toLowerCopy(const std::string &input)
Convert to lower case.
vector_fp m_VSE_b_ij
Entropy term for the binary mole fraction interaction of the excess Gibbs free energy expression...
Namespace for the Cantera kernel.
Definition: AnyMap.cpp:8
(see Thermodynamic Properties and class MixedSolventElectrolyte ).
size_t nChildren(bool discardComments=false) const
Return the number of children.
Definition: xml.cpp:556
void s_update_dlnActCoeff_dT() const
Update the derivative of the log of the activity coefficients wrt T.
virtual void getEnthalpy_RT(doublereal *hrt) const
Get the nondimensional Enthalpy functions for the species at their standard states at the current T a...
doublereal charge(size_t k) const
Dimensionless electrical charge of a single molecule of species k The charge is normalized by the the...
Definition: Phase.h:577
virtual void getStandardVolumes(doublereal *vol) const
Get the molar volumes of the species standard states at the current T and P of the solution...
vector_fp dlnActCoeffdT_Scaled_
Storage for the current derivative values of the gradients with respect to temperature of the log of ...
virtual void getPartialMolarEnthalpies(doublereal *hbar) const
Returns an array of partial molar enthalpies for the species in the mixture.