Cantera  2.4.0
RedlichKisterVPSSTP.cpp
Go to the documentation of this file.
1 /**
2  * @file RedlichKisterVPSSTP.cpp
3  * Definitions for ThermoPhase object for phases which
4  * employ excess Gibbs free energy formulations related to RedlichKister
5  * expansions (see \ref thermoprops
6  * and class \link Cantera::RedlichKisterVPSSTP RedlichKisterVPSSTP\endlink).
7  */
8 
9 // This file is part of Cantera. See License.txt in the top-level directory or
10 // at http://www.cantera.org/license.txt for license and copyright information.
11 
15 #include "cantera/base/ctml.h"
16 
17 using namespace std;
18 
19 namespace Cantera
20 {
21 RedlichKisterVPSSTP::RedlichKisterVPSSTP() :
22  numBinaryInteractions_(0),
23  formRedlichKister_(0),
24  formTempModel_(0)
25 {
26 }
27 
28 RedlichKisterVPSSTP::RedlichKisterVPSSTP(const std::string& inputFile,
29  const std::string& id_) :
30  numBinaryInteractions_(0),
31  formRedlichKister_(0),
32  formTempModel_(0)
33 {
34  initThermoFile(inputFile, id_);
35 }
36 
38  const std::string& id_) :
39  numBinaryInteractions_(0),
40  formRedlichKister_(0),
41  formTempModel_(0)
42 {
43  importPhase(phaseRoot, this);
44 }
45 
46 // - Activities, Standard States, Activity Concentrations -----------
47 
49 {
50  // Update the activity coefficients
52 
53  for (size_t k = 0; k < m_kk; k++) {
54  lnac[k] = lnActCoeff_Scaled_[k];
55  }
56 }
57 
58 // ------------ Partial Molar Properties of the Solution ------------
59 
60 void RedlichKisterVPSSTP::getChemPotentials(doublereal* mu) const
61 {
62  // First get the standard chemical potentials in molar form. This requires
63  // updates of standard state as a function of T and P
65  // Update the activity coefficients
67 
68  for (size_t k = 0; k < m_kk; k++) {
69  double xx = std::max(moleFractions_[k], SmallNumber);
70  mu[k] += RT() * (log(xx) + lnActCoeff_Scaled_[k]);
71  }
72 }
73 
75 {
76  double h = 0;
77  vector_fp hbar(m_kk);
78  getPartialMolarEnthalpies(&hbar[0]);
79  for (size_t i = 0; i < m_kk; i++) {
80  h += moleFractions_[i]*hbar[i];
81  }
82  return h;
83 }
84 
86 {
87  double s = 0;
88  vector_fp sbar(m_kk);
89  getPartialMolarEntropies(&sbar[0]);
90  for (size_t i = 0; i < m_kk; i++) {
91  s += moleFractions_[i]*sbar[i];
92  }
93  return s;
94 }
95 
96 doublereal RedlichKisterVPSSTP::cp_mole() const
97 {
98  double cp = 0;
99  vector_fp cpbar(m_kk);
100  getPartialMolarCp(&cpbar[0]);
101  for (size_t i = 0; i < m_kk; i++) {
102  cp += moleFractions_[i]*cpbar[i];
103  }
104  return cp;
105 }
106 
108 {
109  return cp_mole() - GasConstant;
110 }
111 
113 {
114  // Get the nondimensional standard state enthalpies
115  getEnthalpy_RT(hbar);
116  // dimensionalize it.
117  double T = temperature();
118  for (size_t k = 0; k < m_kk; k++) {
119  hbar[k] *= GasConstant * T;
120  }
121 
122  // Update the activity coefficients, This also update the internally stored
123  // molalities.
126  for (size_t k = 0; k < m_kk; k++) {
127  hbar[k] -= GasConstant * T * T * dlnActCoeffdT_Scaled_[k];
128  }
129 }
130 
131 void RedlichKisterVPSSTP::getPartialMolarCp(doublereal* cpbar) const
132 {
133  getCp_R(cpbar);
134  double T = temperature();
135 
136  // Update the activity coefficients, This also update the internally stored
137  // molalities.
140 
141  for (size_t k = 0; k < m_kk; k++) {
142  cpbar[k] -= 2 * T * dlnActCoeffdT_Scaled_[k] + T * T * d2lnActCoeffdT2_Scaled_[k];
143  }
144  // dimensionalize it.
145  for (size_t k = 0; k < m_kk; k++) {
146  cpbar[k] *= GasConstant;
147  }
148 }
149 
151 {
152  // Get the nondimensional standard state entropies
153  getEntropy_R(sbar);
154  double T = temperature();
155 
156  // Update the activity coefficients, This also update the internally stored
157  // molalities.
160 
161  for (size_t k = 0; k < m_kk; k++) {
162  double xx = std::max(moleFractions_[k], SmallNumber);
163  sbar[k] += - lnActCoeff_Scaled_[k] -log(xx) - T * dlnActCoeffdT_Scaled_[k];
164  }
165  // dimensionalize it.
166  for (size_t k = 0; k < m_kk; k++) {
167  sbar[k] *= GasConstant;
168  }
169 }
170 
172 {
173  // Get the standard state values in m^3 kmol-1
174  getStandardVolumes(vbar);
175  for (size_t iK = 0; iK < m_kk; iK++) {
176  vbar[iK] += 0.0;
177  }
178 }
179 
181 {
182  initLengths();
184 }
185 
187 {
189 }
190 
191 void RedlichKisterVPSSTP::initThermoXML(XML_Node& phaseNode, const std::string& id_)
192 {
193  if ((int) id_.size() > 0 && phaseNode.id() != id_) {
194  throw CanteraError("RedlichKisterVPSSTP::initThermoXML",
195  "phasenode and Id are incompatible");
196  }
197 
198  // Check on the thermo field. Must have:
199  // <thermo model="Redlich-Kister" />
200  if (!phaseNode.hasChild("thermo")) {
201  throw CanteraError("RedlichKisterVPSSTP::initThermoXML",
202  "no thermo XML node");
203  }
204  XML_Node& thermoNode = phaseNode.child("thermo");
205  if (!caseInsensitiveEquals(thermoNode["model"], "redlich-kister")) {
206  throw CanteraError("RedlichKisterVPSSTP::initThermoXML",
207  "Unknown thermo model: " + thermoNode["model"]
208  + " - This object only knows \"Redlich-Kister\" ");
209  }
210 
211  // Go get all of the coefficients and factors in the activityCoefficients
212  // XML block
213  if (thermoNode.hasChild("activityCoefficients")) {
214  XML_Node& acNode = thermoNode.child("activityCoefficients");
215  if (!caseInsensitiveEquals(acNode["model"], "redlich-kister")) {
216  throw CanteraError("RedlichKisterVPSSTP::initThermoXML",
217  "Unknown activity coefficient model: " + acNode["model"]);
218  }
219  for (size_t i = 0; i < acNode.nChildren(); i++) {
220  XML_Node& xmlACChild = acNode.child(i);
221 
222  // Process a binary salt field, or any of the other XML fields that
223  // make up the Pitzer Database. Entries will be ignored if any of
224  // the species in the entry isn't in the solution.
225  if (caseInsensitiveEquals(xmlACChild.name(), "binaryneutralspeciesparameters")) {
226  readXMLBinarySpecies(xmlACChild);
227  }
228  }
229  }
230  // Go down the chain
231  GibbsExcessVPSSTP::initThermoXML(phaseNode, id_);
232 }
233 
235 {
236  doublereal T = temperature();
237  lnActCoeff_Scaled_.assign(m_kk, 0.0);
238 
239  // Scaling: I moved the division of RT higher so that we are always dealing
240  // with G/RT dimensionless terms within the routine. There is a severe
241  // problem with roundoff error in these calculations. The dimensionless
242  // terms help.
243  for (size_t i = 0; i < numBinaryInteractions_; i++) {
244  size_t iA = m_pSpecies_A_ij[i];
245  size_t iB = m_pSpecies_B_ij[i];
246  double XA = moleFractions_[iA];
247  double XB = moleFractions_[iB];
248  doublereal deltaX = XA - XB;
249  size_t N = m_N_ij[i];
250  vector_fp& he_vec = m_HE_m_ij[i];
251  vector_fp& se_vec = m_SE_m_ij[i];
252  doublereal poly = 1.0;
253  doublereal polyMm1 = 1.0;
254  doublereal sum = 0.0;
255  doublereal sumMm1 = 0.0;
256  doublereal sum2 = 0.0;
257  for (size_t m = 0; m < N; m++) {
258  doublereal A_ge = (he_vec[m] - T * se_vec[m]) / (GasConstant * T);
259  sum += A_ge * poly;
260  sum2 += A_ge * (m + 1) * poly;
261  poly *= deltaX;
262  if (m >= 1) {
263  sumMm1 += (A_ge * polyMm1 * m);
264  polyMm1 *= deltaX;
265  }
266  }
267  doublereal oneMXA = 1.0 - XA;
268  doublereal oneMXB = 1.0 - XB;
269  for (size_t k = 0; k < m_kk; k++) {
270  if (iA == k) {
271  lnActCoeff_Scaled_[k] += (oneMXA * XB * sum) + (XA * XB * sumMm1 * (oneMXA + XB));
272  } else if (iB == k) {
273  lnActCoeff_Scaled_[k] += (oneMXB * XA * sum) + (XA * XB * sumMm1 * (-oneMXB - XA));
274  } else {
275  lnActCoeff_Scaled_[k] += -(XA * XB * sum2);
276  }
277  }
278  // Debug against formula in literature
279  }
280 }
281 
283 {
284  dlnActCoeffdT_Scaled_.assign(m_kk, 0.0);
285  d2lnActCoeffdT2_Scaled_.assign(m_kk, 0.0);
286 
287  for (size_t i = 0; i < numBinaryInteractions_; i++) {
288  size_t iA = m_pSpecies_A_ij[i];
289  size_t iB = m_pSpecies_B_ij[i];
290  double XA = moleFractions_[iA];
291  double XB = moleFractions_[iB];
292  doublereal deltaX = XA - XB;
293  size_t N = m_N_ij[i];
294  doublereal poly = 1.0;
295  doublereal sum = 0.0;
296  vector_fp& se_vec = m_SE_m_ij[i];
297  doublereal sumMm1 = 0.0;
298  doublereal polyMm1 = 1.0;
299  doublereal sum2 = 0.0;
300  for (size_t m = 0; m < N; m++) {
301  doublereal A_ge = - se_vec[m];
302  sum += A_ge * poly;
303  sum2 += A_ge * (m + 1) * poly;
304  poly *= deltaX;
305  if (m >= 1) {
306  sumMm1 += (A_ge * polyMm1 * m);
307  polyMm1 *= deltaX;
308  }
309  }
310  doublereal oneMXA = 1.0 - XA;
311  doublereal oneMXB = 1.0 - XB;
312  for (size_t k = 0; k < m_kk; k++) {
313  if (iA == k) {
314  dlnActCoeffdT_Scaled_[k] += (oneMXA * XB * sum) + (XA * XB * sumMm1 * (oneMXA + XB));
315  } else if (iB == k) {
316  dlnActCoeffdT_Scaled_[k] += (oneMXB * XA * sum) + (XA * XB * sumMm1 * (-oneMXB - XA));
317  } else {
318  dlnActCoeffdT_Scaled_[k] += -(XA * XB * sum2);
319  }
320  }
321  }
322 }
323 
324 void RedlichKisterVPSSTP::getdlnActCoeffdT(doublereal* dlnActCoeffdT) const
325 {
327  for (size_t k = 0; k < m_kk; k++) {
328  dlnActCoeffdT[k] = dlnActCoeffdT_Scaled_[k];
329  }
330 }
331 
332 void RedlichKisterVPSSTP::getd2lnActCoeffdT2(doublereal* d2lnActCoeffdT2) const
333 {
335  for (size_t k = 0; k < m_kk; k++) {
336  d2lnActCoeffdT2[k] = d2lnActCoeffdT2_Scaled_[k];
337  }
338 }
339 
341 {
342  double T = temperature();
343  dlnActCoeffdlnX_diag_.assign(m_kk, 0.0);
344 
345  for (size_t i = 0; i < numBinaryInteractions_; i++) {
346  size_t iA = m_pSpecies_A_ij[i];
347  size_t iB = m_pSpecies_B_ij[i];
348  double XA = moleFractions_[iA];
349  double XB = moleFractions_[iB];
350  double deltaX = XA - XB;
351  size_t N = m_N_ij[i];
352  double poly = 1.0;
353  double sum = 0.0;
354  vector_fp& he_vec = m_HE_m_ij[i];
355  vector_fp& se_vec = m_SE_m_ij[i];
356  double sumMm1 = 0.0;
357  double polyMm1 = 1.0;
358  double polyMm2 = 1.0;
359  double sumMm2 = 0.0;
360  for (size_t m = 0; m < N; m++) {
361  double A_ge = (he_vec[m] - T * se_vec[m]) / (GasConstant * T);;
362  sum += A_ge * poly;
363  poly *= deltaX;
364  if (m >= 1) {
365  sumMm1 += (A_ge * polyMm1 * m);
366  polyMm1 *= deltaX;
367  }
368  if (m >= 2) {
369  sumMm2 += (A_ge * polyMm2 * m * (m - 1.0));
370  polyMm2 *= deltaX;
371  }
372  }
373 
374  for (size_t k = 0; k < m_kk; k++) {
375  if (iA == k) {
377  XA * (- (1-XA+XB) * sum + 2*(1.0 - XA) * XB * sumMm1
378  + sumMm1 * (XB * (1 - 2*XA + XB) - XA * (1 - XA + 2*XB))
379  + 2 * XA * XB * sumMm2 * (1.0 - XA + XB));
380  } else if (iB == k) {
382  XB * (- (1-XB+XA) * sum - 2*(1.0 - XB) * XA * sumMm1
383  + sumMm1 * (XA * (2*XB - XA - 1) - XB * (-2*XA + XB - 1))
384  - 2 * XA * XB * sumMm2 * (-XA - 1 + XB));
385  }
386  }
387  }
388 }
389 
391 {
392  doublereal T = temperature();
394 
395  for (size_t i = 0; i < numBinaryInteractions_; i++) {
396  size_t iA = m_pSpecies_A_ij[i];
397  size_t iB = m_pSpecies_B_ij[i];
398  double XA = moleFractions_[iA];
399  double XB = moleFractions_[iB];
400  doublereal deltaX = XA - XB;
401  size_t N = m_N_ij[i];
402  doublereal poly = 1.0;
403  doublereal sum = 0.0;
404  vector_fp& he_vec = m_HE_m_ij[i];
405  vector_fp& se_vec = m_SE_m_ij[i];
406  doublereal sumMm1 = 0.0;
407  doublereal polyMm1 = 1.0;
408  doublereal polyMm2 = 1.0;
409  doublereal sum2 = 0.0;
410  doublereal sum2Mm1 = 0.0;
411  doublereal sumMm2 = 0.0;
412  for (size_t m = 0; m < N; m++) {
413  doublereal A_ge = he_vec[m] - T * se_vec[m];
414  sum += A_ge * poly;
415  sum2 += A_ge * (m + 1) * poly;
416  poly *= deltaX;
417  if (m >= 1) {
418  sumMm1 += (A_ge * polyMm1 * m);
419  sum2Mm1 += (A_ge * polyMm1 * m * (1.0 + m));
420  polyMm1 *= deltaX;
421  }
422  if (m >= 2) {
423  sumMm2 += (A_ge * polyMm2 * m * (m - 1.0));
424  polyMm2 *= deltaX;
425  }
426  }
427 
428  for (size_t k = 0; k < m_kk; k++) {
429  if (iA == k) {
430  dlnActCoeff_dX_(k, iA) += (- XB * sum + (1.0 - XA) * XB * sumMm1
431  + XB * sumMm1 * (1.0 - 2.0 * XA + XB)
432  + XA * XB * sumMm2 * (1.0 - XA + XB));
433 
434  dlnActCoeff_dX_(k, iB) += ((1.0 - XA) * sum - (1.0 - XA) * XB * sumMm1
435  + XA * sumMm1 * (1.0 + 2.0 * XB - XA)
436  - XA * XB * sumMm2 * (1.0 - XA + XB));
437  } else if (iB == k) {
438  dlnActCoeff_dX_(k, iA) += ((1.0 - XB) * sum + (1.0 - XA) * XB * sumMm1
439  + XB * sumMm1 * (1.0 - 2.0 * XA + XB)
440  + XA * XB * sumMm2 * (1.0 - XA + XB));
441 
442  dlnActCoeff_dX_(k, iB) += (- XA * sum - (1.0 - XB) * XA * sumMm1
443  + XA * sumMm1 * (XB - XA - (1.0 - XB))
444  - XA * XB * sumMm2 * (-XA - (1.0 - XB)));
445  } else {
446  dlnActCoeff_dX_(k, iA) += (- XB * sum2 - XA * XB * sum2Mm1);
447  dlnActCoeff_dX_(k, iB) += (- XA * sum2 + XA * XB * sum2Mm1);
448  }
449  }
450  }
451 }
452 
453 void RedlichKisterVPSSTP::getdlnActCoeffds(const doublereal dTds, const doublereal* const dXds,
454  doublereal* dlnActCoeffds) const
455 {
458  for (size_t k = 0; k < m_kk; k++) {
459  dlnActCoeffds[k] = dlnActCoeffdT_Scaled_[k] * dTds;
460  for (size_t j = 0; j < m_kk; j++) {
461  dlnActCoeffds[k] += dlnActCoeff_dX_(k, j) * dXds[j];
462  }
463  }
464 }
465 
466 void RedlichKisterVPSSTP::getdlnActCoeffdlnN_diag(doublereal* dlnActCoeffdlnN_diag) const
467 {
469  for (size_t j = 0; j < m_kk; j++) {
470  dlnActCoeffdlnN_diag[j] = dlnActCoeff_dX_(j, j);
471  for (size_t k = 0; k < m_kk; k++) {
472  dlnActCoeffdlnN_diag[k] -= dlnActCoeff_dX_(j, k) * moleFractions_[k];
473  }
474  }
475 }
476 
477 void RedlichKisterVPSSTP::getdlnActCoeffdlnX_diag(doublereal* dlnActCoeffdlnX_diag) const
478 {
480  for (size_t k = 0; k < m_kk; k++) {
481  dlnActCoeffdlnX_diag[k] = dlnActCoeffdlnX_diag_[k];
482  }
483 }
484 
485 void RedlichKisterVPSSTP::getdlnActCoeffdlnN(const size_t ld, doublereal* dlnActCoeffdlnN)
486 {
488  double* data = & dlnActCoeffdlnN_(0,0);
489  for (size_t k = 0; k < m_kk; k++) {
490  for (size_t m = 0; m < m_kk; m++) {
491  dlnActCoeffdlnN[ld * k + m] = data[m_kk * k + m];
492  }
493  }
494 }
495 
497 {
498  std::string xname = xmLBinarySpecies.name();
499  if (xname != "binaryNeutralSpeciesParameters") {
500  throw CanteraError("RedlichKisterVPSSTP::readXMLBinarySpecies",
501  "Incorrect name for processing this routine: " + xname);
502  }
503  vector_fp hParams, sParams;
504  std::string iName = xmLBinarySpecies.attrib("speciesA");
505  if (iName == "") {
506  throw CanteraError("RedlichKisterVPSSTP::readXMLBinarySpecies", "no speciesA attrib");
507  }
508  std::string jName = xmLBinarySpecies.attrib("speciesB");
509  if (jName == "") {
510  throw CanteraError("RedlichKisterVPSSTP::readXMLBinarySpecies", "no speciesB attrib");
511  }
512 
513  // Find the index of the species in the current phase. It's not an error to
514  // not find the species. This means that the interaction doesn't occur for
515  // the current implementation of the phase.
516  size_t iSpecies = speciesIndex(iName);
517  if (iSpecies == npos) {
518  return;
519  }
520  size_t jSpecies = speciesIndex(jName);
521  if (jSpecies == npos) {
522  return;
523  }
524 
525  // Ok we have found a valid interaction
526  for (size_t iChild = 0; iChild < xmLBinarySpecies.nChildren(); iChild++) {
527  XML_Node& xmlChild = xmLBinarySpecies.child(iChild);
528  string nodeName = toLowerCopy(xmlChild.name());
529 
530  // Process the binary species interaction child elements
531  if (nodeName == "excessenthalpy") {
532  getFloatArray(xmlChild, hParams, true, "toSI", "excessEnthalpy");
533  } else if (nodeName == "excessentropy") {
534  getFloatArray(xmlChild, sParams, true, "toSI", "excessEntropy");
535  }
536  }
537  addBinaryInteraction(iName, jName, hParams.data(), hParams.size(),
538  sParams.data(), sParams.size());
539 }
540 
542  const std::string& speciesA, const std::string& speciesB,
543  const double* excess_enthalpy, size_t n_enthalpy,
544  const double* excess_entropy, size_t n_entropy)
545 {
546  size_t kA = speciesIndex(speciesA);
547  size_t kB = speciesIndex(speciesB);
548  if (kA == npos) {
549  throw CanteraError("RedlichKisterVPSSTP::addBinaryInteraction",
550  "Species '{}' not present in phase", speciesA);
551  } else if (kB == npos) {
552  throw CanteraError("RedlichKisterVPSSTP::addBinaryInteraction",
553  "Species '{}' not present in phase", speciesB);
554  }
555  if (charge(kA) != 0) {
556  throw CanteraError("RedlichKisterVPSSTP::addBinaryInteraction",
557  "Species '{}' should be neutral", speciesA);
558  } else if (charge(kB) != 0) {
559  throw CanteraError("RedlichKisterVPSSTP::addBinaryInteraction",
560  "Species '{}' should be neutral", speciesB);
561  }
562 
563  m_pSpecies_A_ij.push_back(kA);
564  m_pSpecies_B_ij.push_back(kB);
565  m_HE_m_ij.emplace_back(excess_enthalpy, excess_enthalpy + n_enthalpy);
566  m_SE_m_ij.emplace_back(excess_entropy, excess_entropy + n_entropy);
567  size_t N = max(n_enthalpy, n_entropy);
568  m_HE_m_ij.back().resize(N, 0.0);
569  m_SE_m_ij.back().resize(N, 0.0);
570  m_N_ij.push_back(N);
571  dlnActCoeff_dX_.resize(N, N, 0.0);
573 }
574 
575 }
void addBinaryInteraction(const std::string &speciesA, const std::string &speciesB, const double *excess_enthalpy, size_t n_enthalpy, const double *excess_entropy, size_t n_entropy)
Add a binary species interaction with the specified parameters.
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...
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
virtual void getdlnActCoeffdT(doublereal *dlnActCoeffdT) const
Get the array of temperature derivatives of the log activity coefficients.
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
const size_t npos
index returned by functions to indicate "no position"
Definition: ct_defs.h:165
size_t numBinaryInteractions_
number of binary interaction expressions
virtual void getPartialMolarCp(doublereal *cpbar) const
Returns an array of partial molar entropies for the species in the mixture.
Headers for the factory class that can create known ThermoPhase objects (see Thermodynamic Properties...
std::vector< vector_fp > m_HE_m_ij
Enthalpy term for the binary mole fraction interaction of the excess Gibbs free energy expression...
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.
Array2D dlnActCoeff_dX_
Two dimensional array of derivatives of activity coefficients wrt mole fractions. ...
doublereal RT() const
Return the Gas Constant multiplied by the current temperature.
Definition: ThermoPhase.h:748
std::vector< size_t > m_pSpecies_A_ij
vector of species indices representing species A in the interaction
virtual doublereal cp_mole() const
Molar heat capacity at constant pressure. Units: J/kmol/K.
virtual void getLnActivityCoefficients(doublereal *lnac) const
Get the array of non-dimensional molar-based ln activity coefficients at the current solution tempera...
virtual void getdlnActCoeffdlnN_diag(doublereal *dlnActCoeffdlnN_diag) const
Get the array of log species mole number derivatives of the log activity coefficients.
vector_fp d2lnActCoeffdT2_Scaled_
Storage for the current derivative values of the gradients with respect to temperature of the log of ...
void s_update_dlnActCoeff_dX_() const
Internal routine that calculates the derivative of the activity coefficients wrt the mole fractions...
virtual void getd2lnActCoeffdT2(doublereal *d2lnActCoeffdT2) const
Get the array of temperature second derivatives of the log activity coefficients. ...
void s_update_dlnActCoeff_dT() const
Update the derivative of the log of the activity coefficients wrt T.
virtual void getChemPotentials(doublereal *mu) const
Get the species chemical potentials. Units: J/kmol.
bool caseInsensitiveEquals(const std::string &input, const std::string &test)
Case insensitive equality predicate.
std::vector< size_t > m_pSpecies_B_ij
vector of species indices representing species B in the interaction
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
void readXMLBinarySpecies(XML_Node &xmlBinarySpecies)
Process an XML node called "binaryNeutralSpeciesParameters".
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 void getdlnActCoeffdlnX_diag(doublereal *dlnActCoeffdlnX_diag) const
Get the array of ln mole fraction derivatives of the log activity coefficients - diagonal component o...
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.
bool hasChild(const std::string &ch) const
Tests whether the current node has a child node with a particular name.
Definition: xml.cpp:536
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
virtual doublereal enthalpy_mole() const
Molar enthalpy. Units: J/kmol.
virtual void initThermoXML(XML_Node &phaseNode, const std::string &id)
Import and initialize a ThermoPhase object using an XML tree.
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
void initLengths()
Initialize lengths of local variables after all species have been identified.
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
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
virtual void getPartialMolarEnthalpies(doublereal *hbar) const
Returns an array of partial molar enthalpies for the species in the mixture.
Contains declarations for string manipulation functions within Cantera.
virtual void initThermoXML(XML_Node &phaseNode, const std::string &id)
Import and initialize a ThermoPhase object using an XML tree.
virtual void getPartialMolarVolumes(doublereal *vbar) const
Return an array of partial molar volumes for the species in the mixture.
virtual void getPartialMolarEntropies(doublereal *sbar) const
Returns an array of partial molar entropies for the species in the mixture.
vector_fp moleFractions_
Storage for the current values of the mole fractions of the species.
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 ...
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_dlnX_diag() const
Internal routine that calculates the total derivative of the activity coefficients with respect to th...
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.
void s_update_lnActCoeff() const
Update the activity coefficients.
Namespace for the Cantera kernel.
Definition: AnyMap.cpp:8
(see Thermodynamic Properties and class RedlichKisterVPSSTP).
virtual doublereal entropy_mole() const
Molar entropy. Units: J/kmol/K.
size_t nChildren(bool discardComments=false) const
Return the number of children.
Definition: xml.cpp:556
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...
std::vector< size_t > m_N_ij
Vector of the length of the polynomial for the interaction.
std::vector< vector_fp > m_SE_m_ij
Entropy term for the binary mole fraction interaction of the excess Gibbs free energy expression...
vector_fp dlnActCoeffdT_Scaled_
Storage for the current derivative values of the gradients with respect to temperature of the log of ...
virtual doublereal cv_mole() const
Molar heat capacity at constant volume. Units: J/kmol/K.