Cantera  2.3.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 }
24 
25 MixedSolventElectrolyte::MixedSolventElectrolyte(const std::string& inputFile,
26  const std::string& id_) :
27  numBinaryInteractions_(0),
28  formMargules_(0),
29  formTempModel_(0)
30 {
31  initThermoFile(inputFile, id_);
32 }
33 
34 MixedSolventElectrolyte::MixedSolventElectrolyte(XML_Node& phaseRoot,
35  const std::string& id_) :
36  numBinaryInteractions_(0),
37  formMargules_(0),
38  formTempModel_(0)
39 {
40  importPhase(phaseRoot, this);
41 }
42 
43 MixedSolventElectrolyte::MixedSolventElectrolyte(const MixedSolventElectrolyte& b)
44 {
45  MixedSolventElectrolyte::operator=(b);
46 }
47 
48 MixedSolventElectrolyte&
49 MixedSolventElectrolyte::operator=(const MixedSolventElectrolyte& b)
50 {
51  if (&b == this) {
52  return *this;
53  }
54 
55  MolarityIonicVPSSTP::operator=(b);
56 
57  numBinaryInteractions_ = b.numBinaryInteractions_;
58  m_HE_b_ij = b.m_HE_b_ij;
59  m_HE_c_ij = b.m_HE_c_ij;
60  m_HE_d_ij = b.m_HE_d_ij;
61  m_SE_b_ij = b.m_SE_b_ij;
62  m_SE_c_ij = b.m_SE_c_ij;
63  m_SE_d_ij = b.m_SE_d_ij;
64  m_VHE_b_ij = b.m_VHE_b_ij;
65  m_VHE_c_ij = b.m_VHE_c_ij;
66  m_VHE_d_ij = b.m_VHE_d_ij;
67  m_VSE_b_ij = b.m_VSE_b_ij;
68  m_VSE_c_ij = b.m_VSE_c_ij;
69  m_VSE_d_ij = b.m_VSE_d_ij;
70  m_pSpecies_A_ij = b.m_pSpecies_A_ij;
71  m_pSpecies_B_ij = b.m_pSpecies_B_ij;
72  formMargules_ = b.formMargules_;
73  formTempModel_ = b.formTempModel_;
74 
75  return *this;
76 }
77 
79 {
80  return new MixedSolventElectrolyte(*this);
81 }
82 
83 // - Activities, Standard States, Activity Concentrations -----------
84 
86 {
87  // Update the activity coefficients
89 
90  // take the exp of the internally stored coefficients.
91  for (size_t k = 0; k < m_kk; k++) {
92  ac[k] = exp(lnActCoeff_Scaled_[k]);
93  }
94 }
95 
96 // ------------ Partial Molar Properties of the Solution ------------
97 
99 {
100  // First get the standard chemical potentials in molar form. This requires
101  // updates of standard state as a function of T and P
103  // Update the activity coefficients
105  for (size_t k = 0; k < m_kk; k++) {
106  double xx = std::max(moleFractions_[k], SmallNumber);
107  mu[k] += RT() * (log(xx) + lnActCoeff_Scaled_[k]);
108  }
109 }
110 
112 {
113  double h = 0;
114  vector_fp hbar(m_kk);
115  getPartialMolarEnthalpies(&hbar[0]);
116  for (size_t i = 0; i < m_kk; i++) {
117  h += moleFractions_[i]*hbar[i];
118  }
119  return h;
120 }
121 
123 {
124  double s = 0;
125  vector_fp sbar(m_kk);
126  getPartialMolarEntropies(&sbar[0]);
127  for (size_t i = 0; i < m_kk; i++) {
128  s += moleFractions_[i]*sbar[i];
129  }
130  return s;
131 }
132 
134 {
135  double cp = 0;
136  vector_fp cpbar(m_kk);
137  getPartialMolarCp(&cpbar[0]);
138  for (size_t i = 0; i < m_kk; i++) {
139  cp += moleFractions_[i]*cpbar[i];
140  }
141  return cp;
142 }
143 
145 {
146  return cp_mole() - GasConstant;
147 }
148 
150 {
151  // Get the nondimensional standard state enthalpies
152  getEnthalpy_RT(hbar);
153  // dimensionalize it.
154  for (size_t k = 0; k < m_kk; k++) {
155  hbar[k] *= RT();
156  }
157 
158  // Update the activity coefficients, This also update the internally stored
159  // molalities.
162  for (size_t k = 0; k < m_kk; k++) {
163  hbar[k] -= RT() * temperature() * dlnActCoeffdT_Scaled_[k];
164  }
165 }
166 
167 void MixedSolventElectrolyte::getPartialMolarCp(doublereal* cpbar) const
168 {
169  getCp_R(cpbar);
170  double T = temperature();
171 
172  // Update the activity coefficients, This also update the internally stored
173  // molalities.
176 
177  for (size_t k = 0; k < m_kk; k++) {
178  cpbar[k] -= 2 * T * dlnActCoeffdT_Scaled_[k] + T * T * d2lnActCoeffdT2_Scaled_[k];
179  }
180  // dimensionalize it.
181  for (size_t k = 0; k < m_kk; k++) {
182  cpbar[k] *= GasConstant;
183  }
184 }
185 
187 {
188  // Get the nondimensional standard state entropies
189  getEntropy_R(sbar);
190  double T = temperature();
191 
192  // Update the activity coefficients, This also update the
193  // internally stored molalities.
196 
197  for (size_t k = 0; k < m_kk; k++) {
198  double xx = std::max(moleFractions_[k], SmallNumber);
199  sbar[k] += - lnActCoeff_Scaled_[k] -log(xx) - T * dlnActCoeffdT_Scaled_[k];
200  }
201  // dimensionalize it.
202  for (size_t k = 0; k < m_kk; k++) {
203  sbar[k] *= GasConstant;
204  }
205 }
206 
208 {
209  double T = temperature();
210 
211  // Get the standard state values in m^3 kmol-1
212  getStandardVolumes(vbar);
213 
214  for (size_t iK = 0; iK < m_kk; iK++) {
215  int delAK = 0;
216  int delBK = 0;
217  for (size_t i = 0; i < numBinaryInteractions_; i++) {
218  size_t iA = m_pSpecies_A_ij[i];
219  size_t iB = m_pSpecies_B_ij[i];
220 
221  if (iA==iK) {
222  delAK = 1;
223  } else if (iB==iK) {
224  delBK = 1;
225  }
226 
227  double XA = moleFractions_[iA];
228  double XB = moleFractions_[iB];
229 
230  double g0 = (m_VHE_b_ij[i] - T * m_VSE_b_ij[i]);
231  double g1 = (m_VHE_c_ij[i] - T * m_VSE_c_ij[i]);
232 
233  vbar[iK] += XA*XB*(g0+g1*XB)+((delAK-XA)*XB+XA*(delBK-XB))*(g0+g1*XB)+XA*XB*(delBK-XB)*g1;
234  }
235  }
236 }
237 
239 {
240  initLengths();
242 }
243 
245 {
247 }
248 
249 void MixedSolventElectrolyte::initThermoXML(XML_Node& phaseNode, const std::string& id_)
250 {
251  if ((int) id_.size() > 0 && phaseNode.id() != id_) {
252  throw CanteraError("MixedSolventElectrolyte::initThermoXML",
253  "phasenode and Id are incompatible");
254  }
255 
256  // Check on the thermo field. Must have:
257  // <thermo model="MixedSolventElectrolyte" />
258  if (!phaseNode.hasChild("thermo")) {
259  throw CanteraError("MixedSolventElectrolyte::initThermoXML",
260  "no thermo XML node");
261  }
262  XML_Node& thermoNode = phaseNode.child("thermo");
263  string mString = thermoNode["model"];
264  if (!ba::iequals(thermoNode["model"], "mixedsolventelectrolyte")) {
265  throw CanteraError("MixedSolventElectrolyte::initThermoXML",
266  "Unknown thermo model: " + thermoNode["model"]);
267  }
268 
269  // Go get all of the coefficients and factors in the activityCoefficients
270  // XML block
271  if (thermoNode.hasChild("activityCoefficients")) {
272  XML_Node& acNode = thermoNode.child("activityCoefficients");
273  if (!ba::iequals(acNode["model"], "margules")) {
274  throw CanteraError("MixedSolventElectrolyte::initThermoXML",
275  "Unknown activity coefficient model: " + acNode["model"]);
276  }
277  for (size_t i = 0; i < acNode.nChildren(); i++) {
278  XML_Node& xmlACChild = acNode.child(i);
279 
280  // Process a binary salt field, or any of the other XML fields that
281  // make up the Pitzer Database. Entries will be ignored if any of
282  // the species in the entry isn't in the solution.
283  if (ba::iequals(xmlACChild.name(), "binaryneutralspeciesparameters")) {
284  readXMLBinarySpecies(xmlACChild);
285  }
286  }
287  }
288 
289  // Go down the chain
290  MolarityIonicVPSSTP::initThermoXML(phaseNode, id_);
291 }
292 
294 {
295  double T = temperature();
296  lnActCoeff_Scaled_.assign(m_kk, 0.0);
297  for (size_t iK = 0; iK < m_kk; iK++) {
298  for (size_t i = 0; i < numBinaryInteractions_; i++) {
299  size_t iA = m_pSpecies_A_ij[i];
300  size_t iB = m_pSpecies_B_ij[i];
301  int delAK = 0;
302  int delBK = 0;
303  if (iA==iK) {
304  delAK = 1;
305  } else if (iB==iK) {
306  delBK = 1;
307  }
308  double XA = moleFractions_[iA];
309  double XB = moleFractions_[iB];
310  double g0 = (m_HE_b_ij[i] - T * m_SE_b_ij[i]) / RT();
311  double g1 = (m_HE_c_ij[i] - T * m_SE_c_ij[i]) / RT();
312  lnActCoeff_Scaled_[iK] += (delAK * XB + XA * delBK - XA * XB) * (g0 + g1 * XB) + XA * XB * (delBK - XB) * g1;
313  }
314  }
315 }
316 
318 {
319  doublereal T = temperature();
320  doublereal RTT = GasConstant*T*T;
321  dlnActCoeffdT_Scaled_.assign(m_kk, 0.0);
322  d2lnActCoeffdT2_Scaled_.assign(m_kk, 0.0);
323  for (size_t iK = 0; iK < m_kk; iK++) {
324  for (size_t i = 0; i < numBinaryInteractions_; i++) {
325  size_t iA = m_pSpecies_A_ij[i];
326  size_t iB = m_pSpecies_B_ij[i];
327  int delAK = 0;
328  int delBK = 0;
329  if (iA==iK) {
330  delAK = 1;
331  } else if (iB==iK) {
332  delBK = 1;
333  }
334  double XA = moleFractions_[iA];
335  double XB = moleFractions_[iB];
336  double g0 = -m_HE_b_ij[i] / RTT;
337  double g1 = -m_HE_c_ij[i] / RTT;
338  double temp = (delAK * XB + XA * delBK - XA * XB) * (g0 + g1 * XB) + XA * XB * (delBK - XB) * g1;
339  dlnActCoeffdT_Scaled_[iK] += temp;
340  d2lnActCoeffdT2_Scaled_[iK] -= 2.0 * temp / T;
341  }
342  }
343 }
344 
345 void MixedSolventElectrolyte::getdlnActCoeffdT(doublereal* dlnActCoeffdT) const
346 {
348  for (size_t k = 0; k < m_kk; k++) {
349  dlnActCoeffdT[k] = dlnActCoeffdT_Scaled_[k];
350  }
351 }
352 
353 void MixedSolventElectrolyte::getd2lnActCoeffdT2(doublereal* d2lnActCoeffdT2) const
354 {
356  for (size_t k = 0; k < m_kk; k++) {
357  d2lnActCoeffdT2[k] = d2lnActCoeffdT2_Scaled_[k];
358  }
359 }
360 
361 void MixedSolventElectrolyte::getdlnActCoeffds(const doublereal dTds, const doublereal* const dXds,
362  doublereal* dlnActCoeffds) const
363 {
364  double T = temperature();
366 
367  for (size_t iK = 0; iK < m_kk; iK++) {
368  dlnActCoeffds[iK] = 0.0;
369  for (size_t i = 0; i < numBinaryInteractions_; i++) {
370  size_t iA = m_pSpecies_A_ij[i];
371  size_t iB = m_pSpecies_B_ij[i];
372  int delAK = 0;
373  int delBK = 0;
374 
375  if (iA==iK) {
376  delAK = 1;
377  } else if (iB==iK) {
378  delBK = 1;
379  }
380 
381  double XA = moleFractions_[iA];
382  double XB = moleFractions_[iB];
383  double dXA = dXds[iA];
384  double dXB = dXds[iB];
385  double g0 = (m_HE_b_ij[i] - T * m_SE_b_ij[i]) / RT();
386  double g1 = (m_HE_c_ij[i] - T * m_SE_c_ij[i]) / RT();
387  dlnActCoeffds[iK] += ((delBK-XB)*dXA + (delAK-XA)*dXB)*(g0+2*g1*XB) + (delBK-XB)*2*g1*XA*dXB
388  + dlnActCoeffdT_Scaled_[iK]*dTds;
389  }
390  }
391 }
392 
394 {
395  double T = temperature();
396  dlnActCoeffdlnN_diag_.assign(m_kk, 0);
397 
398  for (size_t iK = 0; iK < m_kk; iK++) {
399  double XK = moleFractions_[iK];
400  for (size_t i = 0; i < numBinaryInteractions_; i++) {
401  size_t iA = m_pSpecies_A_ij[i];
402  size_t iB = m_pSpecies_B_ij[i];
403  int delAK = 0;
404  int delBK = 0;
405 
406  if (iA==iK) {
407  delAK = 1;
408  } else if (iB==iK) {
409  delBK = 1;
410  }
411 
412  double XA = moleFractions_[iA];
413  double XB = moleFractions_[iB];
414  double g0 = (m_HE_b_ij[i] - T * m_SE_b_ij[i]) / RT();
415  double g1 = (m_HE_c_ij[i] - T * m_SE_c_ij[i]) / RT();
416 
417  dlnActCoeffdlnN_diag_[iK] += 2*(delBK-XB)*(g0*(delAK-XA)+g1*(2*(delAK-XA)*XB+XA*(delBK-XB)));
418  }
419  dlnActCoeffdlnN_diag_[iK] = XK*dlnActCoeffdlnN_diag_[iK];//-XK;
420  }
421 }
422 
424 {
425  double T = temperature();
427 
428  // Loop over the activity coefficient gamma_k
429  for (size_t iK = 0; iK < m_kk; iK++) {
430  for (size_t iM = 0; iM < m_kk; iM++) {
431  double XM = moleFractions_[iM];
432  for (size_t i = 0; i < numBinaryInteractions_; i++) {
433  size_t iA = m_pSpecies_A_ij[i];
434  size_t iB = m_pSpecies_B_ij[i];
435  double delAK = 0.0;
436  double delBK = 0.0;
437  double delAM = 0.0;
438  double delBM = 0.0;
439  if (iA==iK) {
440  delAK = 1.0;
441  } else if (iB==iK) {
442  delBK = 1.0;
443  }
444  if (iA==iM) {
445  delAM = 1.0;
446  } else if (iB==iM) {
447  delBM = 1.0;
448  }
449 
450  double XA = moleFractions_[iA];
451  double XB = moleFractions_[iB];
452  double g0 = (m_HE_b_ij[i] - T * m_SE_b_ij[i]) / RT();
453  double g1 = (m_HE_c_ij[i] - T * m_SE_c_ij[i]) / RT();
454  dlnActCoeffdlnN_(iK,iM) += g0*((delAM-XA)*(delBK-XB)+(delAK-XA)*(delBM-XB));
455  dlnActCoeffdlnN_(iK,iM) += 2*g1*((delAM-XA)*(delBK-XB)*XB+(delAK-XA)*(delBM-XB)*XB+(delBM-XB)*(delBK-XB)*XA);
456  }
457  dlnActCoeffdlnN_(iK,iM) = XM*dlnActCoeffdlnN_(iK,iM);
458  }
459  }
460 }
461 
463 {
464  doublereal T = temperature();
465  dlnActCoeffdlnX_diag_.assign(m_kk, 0);
466 
467  for (size_t i = 0; i < numBinaryInteractions_; i++) {
468  size_t iA = m_pSpecies_A_ij[i];
469  size_t iB = m_pSpecies_B_ij[i];
470  double XA = moleFractions_[iA];
471  double XB = moleFractions_[iB];
472  double g0 = (m_HE_b_ij[i] - T * m_SE_b_ij[i]) / RT();
473  double g1 = (m_HE_c_ij[i] - T * m_SE_c_ij[i]) / RT();
474  dlnActCoeffdlnX_diag_[iA] += XA*XB*(2*g1*-2*g0-6*g1*XB);
475  dlnActCoeffdlnX_diag_[iB] += XA*XB*(2*g1*-2*g0-6*g1*XB);
476  }
477 }
478 
479 void MixedSolventElectrolyte::getdlnActCoeffdlnN_diag(doublereal* dlnActCoeffdlnN_diag) const
480 {
482  for (size_t k = 0; k < m_kk; k++) {
483  dlnActCoeffdlnN_diag[k] = dlnActCoeffdlnN_diag_[k];
484  }
485 }
486 
487 void MixedSolventElectrolyte::getdlnActCoeffdlnX_diag(doublereal* dlnActCoeffdlnX_diag) const
488 {
490  for (size_t k = 0; k < m_kk; k++) {
491  dlnActCoeffdlnX_diag[k] = dlnActCoeffdlnX_diag_[k];
492  }
493 }
494 
495 void MixedSolventElectrolyte::getdlnActCoeffdlnN(const size_t ld, doublereal* dlnActCoeffdlnN)
496 {
498  double* data = & dlnActCoeffdlnN_(0,0);
499  for (size_t k = 0; k < m_kk; k++) {
500  for (size_t m = 0; m < m_kk; m++) {
501  dlnActCoeffdlnN[ld * k + m] = data[m_kk * k + m];
502  }
503  }
504 }
505 
507 {
509  m_HE_b_ij.resize(num, 0.0);
510  m_HE_c_ij.resize(num, 0.0);
511  m_HE_d_ij.resize(num, 0.0);
512  m_SE_b_ij.resize(num, 0.0);
513  m_SE_c_ij.resize(num, 0.0);
514  m_SE_d_ij.resize(num, 0.0);
515  m_VHE_b_ij.resize(num, 0.0);
516  m_VHE_c_ij.resize(num, 0.0);
517  m_VHE_d_ij.resize(num, 0.0);
518  m_VSE_b_ij.resize(num, 0.0);
519  m_VSE_c_ij.resize(num, 0.0);
520  m_VSE_d_ij.resize(num, 0.0);
521  m_pSpecies_A_ij.resize(num, npos);
522  m_pSpecies_B_ij.resize(num, npos);
523 }
524 
526 {
527  string xname = xmLBinarySpecies.name();
528  if (xname != "binaryNeutralSpeciesParameters") {
529  throw CanteraError("MixedSolventElectrolyte::readXMLBinarySpecies",
530  "Incorrect name for processing this routine: " + xname);
531  }
532  vector_fp vParams;
533  string iName = xmLBinarySpecies.attrib("speciesA");
534  if (iName == "") {
535  throw CanteraError("MixedSolventElectrolyte::readXMLBinarySpecies", "no speciesA attrib");
536  }
537  string jName = xmLBinarySpecies.attrib("speciesB");
538  if (jName == "") {
539  throw CanteraError("MixedSolventElectrolyte::readXMLBinarySpecies", "no speciesB attrib");
540  }
541 
542  // Find the index of the species in the current phase. It's not an error to
543  // not find the species
544  size_t iSpecies = speciesIndex(iName);
545  if (iSpecies == npos) {
546  return;
547  }
548  string ispName = speciesName(iSpecies);
549  if (charge(iSpecies) != 0) {
550  throw CanteraError("MixedSolventElectrolyte::readXMLBinarySpecies", "speciesA charge problem");
551  }
552  size_t jSpecies = speciesIndex(jName);
553  if (jSpecies == npos) {
554  return;
555  }
556  string jspName = speciesName(jSpecies);
557  if (charge(jSpecies) != 0) {
558  throw CanteraError("MixedSolventElectrolyte::readXMLBinarySpecies", "speciesB charge problem");
559  }
560 
562  size_t iSpot = numBinaryInteractions_ - 1;
563  m_pSpecies_A_ij[iSpot] = iSpecies;
564  m_pSpecies_B_ij[iSpot] = jSpecies;
565 
566  for (size_t iChild = 0; iChild < xmLBinarySpecies.nChildren(); iChild++) {
567  XML_Node& xmlChild = xmLBinarySpecies.child(iChild);
568  string nodeName = ba::to_lower_copy(xmlChild.name());
569 
570  // Process the binary species interaction child elements
571  if (nodeName == "excessenthalpy") {
572  // Get the string containing all of the values
573  getFloatArray(xmlChild, vParams, true, "toSI", "excessEnthalpy");
574  if (vParams.size() != 2) {
575  throw CanteraError("MixedSolventElectrolyte::readXMLBinarySpecies::excessEnthalpy for " + ispName
576  + "::" + jspName,
577  "wrong number of params found");
578  }
579  m_HE_b_ij[iSpot] = vParams[0];
580  m_HE_c_ij[iSpot] = vParams[1];
581  }
582 
583  if (nodeName == "excessentropy") {
584  // Get the string containing all of the values
585  getFloatArray(xmlChild, vParams, true, "toSI", "excessEntropy");
586  if (vParams.size() != 2) {
587  throw CanteraError("MixedSolventElectrolyte::readXMLBinarySpecies::excessEntropy for " + ispName
588  + "::" + jspName,
589  "wrong number of params found");
590  }
591  m_SE_b_ij[iSpot] = vParams[0];
592  m_SE_c_ij[iSpot] = vParams[1];
593  }
594 
595  if (nodeName == "excessvolume_enthalpy") {
596  // Get the string containing all of the values
597  getFloatArray(xmlChild, vParams, true, "toSI", "excessVolume_Enthalpy");
598  if (vParams.size() != 2) {
599  throw CanteraError("MixedSolventElectrolyte::readXMLBinarySpecies::excessVolume_Enthalpy for " + ispName
600  + "::" + jspName,
601  "wrong number of params found");
602  }
603  m_VHE_b_ij[iSpot] = vParams[0];
604  m_VHE_c_ij[iSpot] = vParams[1];
605  }
606 
607  if (nodeName == "excessvolume_entropy") {
608  // Get the string containing all of the values
609  getFloatArray(xmlChild, vParams, true, "toSI", "excessVolume_Entropy");
610  if (vParams.size() != 2) {
611  throw CanteraError("MixedSolventElectrolyte::readXMLBinarySpecies::excessVolume_Entropy for " + ispName
612  + "::" + jspName,
613  "wrong number of params found");
614  }
615  m_VSE_b_ij[iSpot] = vParams[0];
616  m_VSE_c_ij[iSpot] = vParams[1];
617  }
618  }
619 }
620 
621 }
virtual void getdlnActCoeffdlnN_diag(doublereal *dlnActCoeffdlnN_diag) const
Get the array of log species mole number derivatives of the log activity coefficients.
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:299
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 speciesIndex(const std::string &name) const
Returns the index of a species named &#39;name&#39; within the Phase object.
Definition: Phase.cpp:251
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...
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:809
Base class for a phase with thermodynamic properties.
Definition: ThermoPhase.h:93
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 ...
int formTempModel_
form of the temperature dependence of the Margules interaction expression
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:267
virtual void initThermoXML(XML_Node &phaseNode, const std::string &id)
Import and initialize a ThermoPhase object using an XML tree.
MixedSolventElectrolyte is a derived class of GibbsExcessVPSSTP that employs the DH and local Margule...
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...
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...
int formMargules_
form of the Margules interaction 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.
virtual ThermoPhase * duplMyselfAsThermoPhase() const
Duplication routine for objects which inherit from ThermoPhase.
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:784
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:220
virtual void initThermoFile(const std::string &inputFile, const std::string &id)
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: application.cpp:29
(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.