| Cantera 3.0.0

Loading...
Searching...
No Matches
MargulesVPSSTP.cpp
Go to the documentation of this file.
1/**
2 * @file MargulesVPSSTP.cpp
3 * Definitions for ThermoPhase object for phases which
4 * employ excess Gibbs free energy formulations related to Margules
5 * expansions (see @ref thermoprops
6 * and class @link Cantera::MargulesVPSSTP MargulesVPSSTP@endlink).
7 */
8
9// This file is part of Cantera. See License.txt in the top-level directory or
10// at https://cantera.org/license.txt for license and copyright information.
11
12#include "cantera/thermo/MargulesVPSSTP.h"
13#include "cantera/thermo/ThermoFactory.h"
14#include "cantera/base/stringUtils.h"
15
16 namespace Cantera
17{
18 MargulesVPSSTP::MargulesVPSSTP(const string& inputFile, const string& id_)
19{
20 initThermoFile(inputFile, id_);
21}
22
23// -- Activities, Standard States, Activity Concentrations -----------
24
25 void MargulesVPSSTP::getLnActivityCoefficients(double* lnac) const
26{
27 // Update the activity coefficients
28 s_update_lnActCoeff();
29
30 // take the exp of the internally stored coefficients.
31 for (size_t k = 0; k < m_kk; k++) {
32 lnac[k] = lnActCoeff_Scaled_[k];
33 }
34}
35
36// ------------ Partial Molar Properties of the Solution ------------
37
38 void MargulesVPSSTP::getChemPotentials(double* mu) const
39{
40 // First get the standard chemical potentials in molar form. This requires
41 // updates of standard state as a function of T and P
42 getStandardChemPotentials(mu);
43
44 // Update the activity coefficients
45 s_update_lnActCoeff();
46 for (size_t k = 0; k < m_kk; k++) {
47 double xx = std::max(moleFractions_[k], SmallNumber);
48 mu[k] += RT() * (log(xx) + lnActCoeff_Scaled_[k]);
49 }
50}
51
52 double MargulesVPSSTP::enthalpy_mole() const
53{
54 size_t kk = nSpecies();
55 double h = 0;
56 vector<double> hbar(kk);
57 getPartialMolarEnthalpies(&hbar[0]);
58 for (size_t i = 0; i < kk; i++) {
59 h += moleFractions_[i]*hbar[i];
60 }
61 return h;
62}
63
64 double MargulesVPSSTP::entropy_mole() const
65{
66 size_t kk = nSpecies();
67 double s = 0;
68 vector<double> sbar(kk);
69 getPartialMolarEntropies(&sbar[0]);
70 for (size_t i = 0; i < kk; i++) {
71 s += moleFractions_[i]*sbar[i];
72 }
73 return s;
74}
75
76 double MargulesVPSSTP::cp_mole() const
77{
78 size_t kk = nSpecies();
79 double cp = 0;
80 vector<double> cpbar(kk);
81 getPartialMolarCp(&cpbar[0]);
82 for (size_t i = 0; i < kk; i++) {
83 cp += moleFractions_[i]*cpbar[i];
84 }
85 return cp;
86}
87
88 double MargulesVPSSTP::cv_mole() const
89{
90 return cp_mole() - GasConstant;
91}
92
93 void MargulesVPSSTP::getPartialMolarEnthalpies(double* hbar) const
94{
95 // Get the nondimensional standard state enthalpies
96 getEnthalpy_RT(hbar);
97
98 // dimensionalize it.
99 for (size_t k = 0; k < m_kk; k++) {
100 hbar[k] *= RT();
101 }
102
103 // Update the activity coefficients, This also update the internally stored
104 // molalities.
105 s_update_lnActCoeff();
106 s_update_dlnActCoeff_dT();
107 for (size_t k = 0; k < m_kk; k++) {
108 hbar[k] -= RT() * temperature() * dlnActCoeffdT_Scaled_[k];
109 }
110}
111
112 void MargulesVPSSTP::getPartialMolarCp(double* cpbar) const
113{
114 // Get the nondimensional standard state entropies
115 getCp_R(cpbar);
116 double T = temperature();
117
118 // Update the activity coefficients, This also update the internally stored
119 // molalities.
120 s_update_lnActCoeff();
121 s_update_dlnActCoeff_dT();
122
123 for (size_t k = 0; k < m_kk; k++) {
124 cpbar[k] -= 2 * T * dlnActCoeffdT_Scaled_[k] + T * T * d2lnActCoeffdT2_Scaled_[k];
125 }
126 // dimensionalize it.
127 for (size_t k = 0; k < m_kk; k++) {
128 cpbar[k] *= GasConstant;
129 }
130}
131
132 void MargulesVPSSTP::getPartialMolarEntropies(double* sbar) const
133{
134 // Get the nondimensional standard state entropies
135 getEntropy_R(sbar);
136 double T = temperature();
137
138 // Update the activity coefficients, This also update the internally stored
139 // molalities.
140 s_update_lnActCoeff();
141 s_update_dlnActCoeff_dT();
142
143 for (size_t k = 0; k < m_kk; k++) {
144 double xx = std::max(moleFractions_[k], SmallNumber);
145 sbar[k] += - lnActCoeff_Scaled_[k] -log(xx) - T * dlnActCoeffdT_Scaled_[k];
146 }
147
148 // dimensionalize it.
149 for (size_t k = 0; k < m_kk; k++) {
150 sbar[k] *= GasConstant;
151 }
152}
153
154 void MargulesVPSSTP::getPartialMolarVolumes(double* vbar) const
155{
156 double T = temperature();
157
158 // Get the standard state values in m^3 kmol-1
159 getStandardVolumes(vbar);
160
161 for (size_t i = 0; i < numBinaryInteractions_; i++) {
162 size_t iA = m_pSpecies_A_ij[i];
163 size_t iB = m_pSpecies_B_ij[i];
164 double XA = moleFractions_[iA];
165 double XB = moleFractions_[iB];
166 double g0 = (m_VHE_b_ij[i] - T * m_VSE_b_ij[i]);
167 double g1 = (m_VHE_c_ij[i] - T * m_VSE_c_ij[i]);
168 const double temp1 = g0 + g1 * XB;
169 const double all = -1.0*XA*XB*temp1 - XA*XB*XB*g1;
170
171 for (size_t iK = 0; iK < m_kk; iK++) {
172 vbar[iK] += all;
173 }
174 vbar[iA] += XB * temp1;
175 vbar[iB] += XA * temp1 + XA*XB*g1;
176 }
177}
178
179 void MargulesVPSSTP::initThermo()
180{
181 initLengths();
182 if (m_input.hasKey("interactions")) {
183 for (auto& item : m_input["interactions"].asVector<AnyMap>()) {
184 auto& species = item["species"].asVector<string>(2);
185 vector<double> h(2), s(2), vh(2), vs(2);
186 if (item.hasKey("excess-enthalpy")) {
187 h = item.convertVector("excess-enthalpy", "J/kmol", 2);
188 }
189 if (item.hasKey("excess-entropy")) {
190 s = item.convertVector("excess-entropy", "J/kmol/K", 2);
191 }
192 if (item.hasKey("excess-volume-enthalpy")) {
193 vh = item.convertVector("excess-volume-enthalpy", "m^3/kmol", 2);
194 }
195 if (item.hasKey("excess-volume-entropy")) {
196 vs = item.convertVector("excess-volume-entropy", "m^3/kmol/K", 2);
197 }
198 addBinaryInteraction(species[0], species[1],
199 h[0], h[1], s[0], s[1], vh[0], vh[1], vs[0], vs[1]);
200 }
201 }
202 GibbsExcessVPSSTP::initThermo();
203}
204
205 void MargulesVPSSTP::getParameters(AnyMap& phaseNode) const
206{
207 GibbsExcessVPSSTP::getParameters(phaseNode);
208 vector<AnyMap> interactions;
209 for (size_t n = 0; n < m_pSpecies_A_ij.size(); n++) {
210 AnyMap interaction;
211 interaction["species"] = vector<string>{
212 speciesName(m_pSpecies_A_ij[n]), speciesName(m_pSpecies_B_ij[n])};
213 if (m_HE_b_ij[n] != 0 || m_HE_c_ij[n] != 0) {
214 interaction["excess-enthalpy"].setQuantity(
215 {m_HE_b_ij[n], m_HE_c_ij[n]}, "J/kmol");
216 }
217 if (m_SE_b_ij[n] != 0 || m_SE_c_ij[n] != 0) {
218 interaction["excess-entropy"].setQuantity(
219 {m_SE_b_ij[n], m_SE_c_ij[n]}, "J/kmol/K");
220 }
221 if (m_VHE_b_ij[n] != 0 || m_VHE_c_ij[n] != 0) {
222 interaction["excess-volume-enthalpy"].setQuantity(
223 {m_VHE_b_ij[n], m_VHE_c_ij[n]}, "m^3/kmol");
224 }
225 if (m_VSE_b_ij[n] != 0 || m_VSE_c_ij[n] != 0) {
226 interaction["excess-volume-entropy"].setQuantity(
227 {m_VSE_b_ij[n], m_VSE_c_ij[n]}, "m^3/kmol/K");
228 }
229 interactions.push_back(std::move(interaction));
230 }
231 phaseNode["interactions"] = std::move(interactions);
232}
233
234 void MargulesVPSSTP::initLengths()
235{
236 dlnActCoeffdlnN_.resize(m_kk, m_kk);
237}
238
239 void MargulesVPSSTP::addBinaryInteraction(const string& speciesA,
240 const string& speciesB, double h0, double h1, double s0, double s1,
241 double vh0, double vh1, double vs0, double vs1)
242{
243 size_t kA = speciesIndex(speciesA);
244 size_t kB = speciesIndex(speciesB);
245 // The interaction is silently ignored if either species is not defined in
246 // the current phase.
247 if (kA == npos || kB == npos) {
248 return;
249 }
250 m_pSpecies_A_ij.push_back(kA);
251 m_pSpecies_B_ij.push_back(kB);
252
253 m_HE_b_ij.push_back(h0);
254 m_HE_c_ij.push_back(h1);
255 m_SE_b_ij.push_back(s0);
256 m_SE_c_ij.push_back(s1);
257 m_VHE_b_ij.push_back(vh0);
258 m_VHE_c_ij.push_back(vh1);
259 m_VSE_b_ij.push_back(vs0);
260 m_VSE_c_ij.push_back(vs1);
261 numBinaryInteractions_++;
262}
263
264
265 void MargulesVPSSTP::s_update_lnActCoeff() const
266{
267 double T = temperature();
268 lnActCoeff_Scaled_.assign(m_kk, 0.0);
269 for (size_t i = 0; i < numBinaryInteractions_; i++) {
270 size_t iA = m_pSpecies_A_ij[i];
271 size_t iB = m_pSpecies_B_ij[i];
272 double g0 = (m_HE_b_ij[i] - T * m_SE_b_ij[i]) / RT();
273 double g1 = (m_HE_c_ij[i] - T * m_SE_c_ij[i]) / RT();
274 double XA = moleFractions_[iA];
275 double XB = moleFractions_[iB];
276 const double XAXB = XA * XB;
277 const double g0g1XB = (g0 + g1 * XB);
278 const double all = -1.0 * XAXB * g0g1XB - XAXB * XB * g1;
279 for (size_t iK = 0; iK < m_kk; iK++) {
280 lnActCoeff_Scaled_[iK] += all;
281 }
282 lnActCoeff_Scaled_[iA] += XB * g0g1XB;
283 lnActCoeff_Scaled_[iB] += XA * g0g1XB + XAXB * g1;
284 }
285}
286
287 void MargulesVPSSTP::s_update_dlnActCoeff_dT() const
288{
289 double invT = 1.0 / temperature();
290 double invRTT = 1.0 / GasConstant*invT*invT;
291 dlnActCoeffdT_Scaled_.assign(m_kk, 0.0);
292 d2lnActCoeffdT2_Scaled_.assign(m_kk, 0.0);
293 for (size_t i = 0; i < numBinaryInteractions_; i++) {
294 size_t iA = m_pSpecies_A_ij[i];
295 size_t iB = m_pSpecies_B_ij[i];
296 double XA = moleFractions_[iA];
297 double XB = moleFractions_[iB];
298 double g0 = -m_HE_b_ij[i] * invRTT;
299 double g1 = -m_HE_c_ij[i] * invRTT;
300 const double XAXB = XA * XB;
301 const double g0g1XB = (g0 + g1 * XB);
302 const double all = -1.0 * XAXB * g0g1XB - XAXB * XB * g1;
303 const double mult = 2.0 * invT;
304 const double dT2all = mult * all;
305 for (size_t iK = 0; iK < m_kk; iK++) {
306 dlnActCoeffdT_Scaled_[iK] += all;
307 d2lnActCoeffdT2_Scaled_[iK] -= dT2all;
308 }
309 dlnActCoeffdT_Scaled_[iA] += XB * g0g1XB;
310 dlnActCoeffdT_Scaled_[iB] += XA * g0g1XB + XAXB * g1;
311 d2lnActCoeffdT2_Scaled_[iA] -= mult * XB * g0g1XB;
312 d2lnActCoeffdT2_Scaled_[iB] -= mult * (XA * g0g1XB + XAXB * g1);
313 }
314}
315
316 void MargulesVPSSTP::getdlnActCoeffdT(double* dlnActCoeffdT) const
317{
318 s_update_dlnActCoeff_dT();
319 for (size_t k = 0; k < m_kk; k++) {
320 dlnActCoeffdT[k] = dlnActCoeffdT_Scaled_[k];
321 }
322}
323
324 void MargulesVPSSTP::getd2lnActCoeffdT2(double* d2lnActCoeffdT2) const
325{
326 s_update_dlnActCoeff_dT();
327 for (size_t k = 0; k < m_kk; k++) {
328 d2lnActCoeffdT2[k] = d2lnActCoeffdT2_Scaled_[k];
329 }
330}
331
332 void MargulesVPSSTP::getdlnActCoeffds(const double dTds, const double* const dXds,
333 double* dlnActCoeffds) const
334{
335 double T = temperature();
336 s_update_dlnActCoeff_dT();
337 for (size_t iK = 0; iK < m_kk; iK++) {
338 dlnActCoeffds[iK] = 0.0;
339 }
340
341 for (size_t i = 0; i < numBinaryInteractions_; i++) {
342 size_t iA = m_pSpecies_A_ij[i];
343 size_t iB = m_pSpecies_B_ij[i];
344 double XA = moleFractions_[iA];
345 double XB = moleFractions_[iB];
346 double dXA = dXds[iA];
347 double dXB = dXds[iB];
348 double g0 = (m_HE_b_ij[i] - T * m_SE_b_ij[i]) / RT();
349 double g1 = (m_HE_c_ij[i] - T * m_SE_c_ij[i]) / RT();
350 const double g02g1XB = g0 + 2*g1*XB;
351 const double g2XAdXB = 2*g1*XA*dXB;
352 const double all = (-XB * dXA - XA *dXB) * g02g1XB - XB *g2XAdXB;
353 for (size_t iK = 0; iK < m_kk; iK++) {
354 dlnActCoeffds[iK] += all + dlnActCoeffdT_Scaled_[iK]*dTds;
355 }
356 dlnActCoeffds[iA] += dXB * g02g1XB;
357 dlnActCoeffds[iB] += dXA * g02g1XB + g2XAdXB;
358 }
359}
360
361 void MargulesVPSSTP::s_update_dlnActCoeff_dlnN_diag() const
362{
363 double T = temperature();
364 dlnActCoeffdlnN_diag_.assign(m_kk, 0.0);
365
366 for (size_t iK = 0; iK < m_kk; iK++) {
367 double XK = moleFractions_[iK];
368
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 size_t delAK = 0;
373 size_t 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
384 double g0 = (m_HE_b_ij[i] - T * m_SE_b_ij[i]) / RT();
385 double g1 = (m_HE_c_ij[i] - T * m_SE_c_ij[i]) / RT();
386
387 dlnActCoeffdlnN_diag_[iK] += 2*(delBK-XB)*(g0*(delAK-XA)+g1*(2*(delAK-XA)*XB+XA*(delBK-XB)));
388 }
389 dlnActCoeffdlnN_diag_[iK] = XK*dlnActCoeffdlnN_diag_[iK];
390 }
391}
392
393 void MargulesVPSSTP::s_update_dlnActCoeff_dlnN() const
394{
395 double T = temperature();
396 dlnActCoeffdlnN_.zero();
397
398 // Loop over the activity coefficient gamma_k
399 for (size_t iK = 0; iK < m_kk; iK++) {
400 for (size_t iM = 0; iM < m_kk; iM++) {
401 double XM = moleFractions_[iM];
402 for (size_t i = 0; i < numBinaryInteractions_; i++) {
403 size_t iA = m_pSpecies_A_ij[i];
404 size_t iB = m_pSpecies_B_ij[i];
405 double delAK = 0.0;
406 double delBK = 0.0;
407 double delAM = 0.0;
408 double delBM = 0.0;
409 if (iA==iK) {
410 delAK = 1.0;
411 } else if (iB==iK) {
412 delBK = 1.0;
413 }
414 if (iA==iM) {
415 delAM = 1.0;
416 } else if (iB==iM) {
417 delBM = 1.0;
418 }
419
420 double XA = moleFractions_[iA];
421 double XB = moleFractions_[iB];
422 double g0 = (m_HE_b_ij[i] - T * m_SE_b_ij[i]) / RT();
423 double g1 = (m_HE_c_ij[i] - T * m_SE_c_ij[i]) / RT();
424 dlnActCoeffdlnN_(iK,iM) += g0*((delAM-XA)*(delBK-XB)+(delAK-XA)*(delBM-XB));
425 dlnActCoeffdlnN_(iK,iM) += 2*g1*((delAM-XA)*(delBK-XB)*XB+(delAK-XA)*(delBM-XB)*XB+(delBM-XB)*(delBK-XB)*XA);
426 }
427 dlnActCoeffdlnN_(iK,iM) = XM*dlnActCoeffdlnN_(iK,iM);
428 }
429 }
430}
431
432 void MargulesVPSSTP::s_update_dlnActCoeff_dlnX_diag() const
433{
434 double T = temperature();
435 dlnActCoeffdlnX_diag_.assign(m_kk, 0.0);
436
437 for (size_t i = 0; i < numBinaryInteractions_; i++) {
438 size_t iA = m_pSpecies_A_ij[i];
439 size_t iB = m_pSpecies_B_ij[i];
440
441 double XA = moleFractions_[iA];
442 double XB = moleFractions_[iB];
443
444 double g0 = (m_HE_b_ij[i] - T * m_SE_b_ij[i]) / RT();
445 double g1 = (m_HE_c_ij[i] - T * m_SE_c_ij[i]) / RT();
446
447 dlnActCoeffdlnX_diag_[iA] += XA*XB*(2*g1*-2*g0-6*g1*XB);
448 dlnActCoeffdlnX_diag_[iB] += XA*XB*(2*g1*-2*g0-6*g1*XB);
449 }
450}
451
452 void MargulesVPSSTP::getdlnActCoeffdlnN_diag(double* dlnActCoeffdlnN_diag) const
453{
454 s_update_dlnActCoeff_dlnN_diag();
455 for (size_t k = 0; k < m_kk; k++) {
456 dlnActCoeffdlnN_diag[k] = dlnActCoeffdlnN_diag_[k];
457 }
458}
459
460 void MargulesVPSSTP::getdlnActCoeffdlnX_diag(double* dlnActCoeffdlnX_diag) const
461{
462 s_update_dlnActCoeff_dlnX_diag();
463 for (size_t k = 0; k < m_kk; k++) {
464 dlnActCoeffdlnX_diag[k] = dlnActCoeffdlnX_diag_[k];
465 }
466}
467
468 void MargulesVPSSTP::getdlnActCoeffdlnN(const size_t ld, double* dlnActCoeffdlnN)
469{
470 s_update_dlnActCoeff_dlnN();
471 double* data = & dlnActCoeffdlnN_(0,0);
472 for (size_t k = 0; k < m_kk; k++) {
473 for (size_t m = 0; m < m_kk; m++) {
474 dlnActCoeffdlnN[ld * k + m] = data[m_kk * k + m];
475 }
476 }
477}
478
479}
MargulesVPSSTP.h
(see Thermodynamic Properties and class MargulesVPSSTP).
ThermoFactory.h
Headers for the factory class that can create known ThermoPhase objects (see Thermodynamic Properties...
Cantera::AnyMap
A map of string keys to values whose type can vary at runtime.
Definition AnyMap.h:427
Cantera::AnyMap::hasKey
bool hasKey(const string &key) const
Returns true if the map contains an item named key.
Definition AnyMap.cpp:1423
Cantera::Array2D::zero
void zero()
Set all of the entries to zero.
Definition Array.h:143
Cantera::Array2D::resize
virtual void resize(size_t n, size_t m, double v=0.0)
Resize the array, and fill the new entries with 'v'.
Definition Array.cpp:47
Cantera::GibbsExcessVPSSTP::d2lnActCoeffdT2_Scaled_
vector< double > d2lnActCoeffdT2_Scaled_
Storage for the current derivative values of the gradients with respect to temperature of the log of ...
Definition GibbsExcessVPSSTP.h:234
Cantera::GibbsExcessVPSSTP::dlnActCoeffdlnN_
Array2D dlnActCoeffdlnN_
Storage for the current derivative values of the gradients with respect to logarithm of the species m...
Definition GibbsExcessVPSSTP.h:253
Cantera::GibbsExcessVPSSTP::lnActCoeff_Scaled_
vector< double > lnActCoeff_Scaled_
Storage for the current values of the activity coefficients of the species.
Definition GibbsExcessVPSSTP.h:226
Cantera::GibbsExcessVPSSTP::dlnActCoeffdlnX_diag_
vector< double > dlnActCoeffdlnX_diag_
Storage for the current derivative values of the gradients with respect to logarithm of the mole frac...
Definition GibbsExcessVPSSTP.h:244
Cantera::GibbsExcessVPSSTP::moleFractions_
vector< double > moleFractions_
Storage for the current values of the mole fractions of the species.
Definition GibbsExcessVPSSTP.h:222
Cantera::GibbsExcessVPSSTP::dlnActCoeffdT_Scaled_
vector< double > dlnActCoeffdT_Scaled_
Storage for the current derivative values of the gradients with respect to temperature of the log of ...
Definition GibbsExcessVPSSTP.h:230
Cantera::GibbsExcessVPSSTP::dlnActCoeffdlnN_diag_
vector< double > dlnActCoeffdlnN_diag_
Storage for the current derivative values of the gradients with respect to logarithm of the mole frac...
Definition GibbsExcessVPSSTP.h:239
Cantera::MargulesVPSSTP::getdlnActCoeffds
void getdlnActCoeffds(const double dTds, const double *const dXds, double *dlnActCoeffds) const override
Get the change in activity coefficients wrt changes in state (temp, mole fraction,...
Definition MargulesVPSSTP.cpp:332
Cantera::MargulesVPSSTP::enthalpy_mole
double enthalpy_mole() const override
Molar enthalpy. Units: J/kmol.
Definition MargulesVPSSTP.cpp:52
Cantera::MargulesVPSSTP::getPartialMolarEnthalpies
void getPartialMolarEnthalpies(double *hbar) const override
Returns an array of partial molar enthalpies for the species in the mixture.
Definition MargulesVPSSTP.cpp:93
Cantera::MargulesVPSSTP::getChemPotentials
void getChemPotentials(double *mu) const override
Get the species chemical potentials. Units: J/kmol.
Definition MargulesVPSSTP.cpp:38
Cantera::MargulesVPSSTP::m_VHE_c_ij
vector< double > m_VHE_c_ij
Enthalpy term for the ternary mole fraction interaction of the excess Gibbs free energy expression.
Definition MargulesVPSSTP.h:442
Cantera::MargulesVPSSTP::m_SE_b_ij
vector< double > m_SE_b_ij
Entropy term for the binary mole fraction interaction of the excess Gibbs free energy expression.
Definition MargulesVPSSTP.h:430
Cantera::MargulesVPSSTP::numBinaryInteractions_
size_t numBinaryInteractions_
number of binary interaction expressions
Definition MargulesVPSSTP.h:418
Cantera::MargulesVPSSTP::m_SE_c_ij
vector< double > m_SE_c_ij
Entropy term for the ternary mole fraction interaction of the excess Gibbs free energy expression.
Definition MargulesVPSSTP.h:434
Cantera::MargulesVPSSTP::s_update_dlnActCoeff_dlnN_diag
void s_update_dlnActCoeff_dlnN_diag() const
Update the derivative of the log of the activity coefficients wrt log(moles) - diagonal only.
Definition MargulesVPSSTP.cpp:361
Cantera::MargulesVPSSTP::getParameters
void getParameters(AnyMap &phaseNode) const override
Store the parameters of a ThermoPhase object such that an identical one could be reconstructed using ...
Definition MargulesVPSSTP.cpp:205
Cantera::MargulesVPSSTP::initThermo
void initThermo() override
Initialize the ThermoPhase object after all species have been set up.
Definition MargulesVPSSTP.cpp:179
Cantera::MargulesVPSSTP::getPartialMolarVolumes
void getPartialMolarVolumes(double *vbar) const override
Return an array of partial molar volumes for the species in the mixture.
Definition MargulesVPSSTP.cpp:154
Cantera::MargulesVPSSTP::m_pSpecies_A_ij
vector< size_t > m_pSpecies_A_ij
vector of species indices representing species A in the interaction
Definition MargulesVPSSTP.h:457
Cantera::MargulesVPSSTP::cv_mole
double cv_mole() const override
Molar heat capacity at constant volume. Units: J/kmol/K.
Definition MargulesVPSSTP.cpp:88
Cantera::MargulesVPSSTP::s_update_dlnActCoeff_dT
void s_update_dlnActCoeff_dT() const
Update the derivative of the log of the activity coefficients wrt T.
Definition MargulesVPSSTP.cpp:287
Cantera::MargulesVPSSTP::m_pSpecies_B_ij
vector< size_t > m_pSpecies_B_ij
vector of species indices representing species B in the interaction
Definition MargulesVPSSTP.h:464
Cantera::MargulesVPSSTP::m_VSE_c_ij
vector< double > m_VSE_c_ij
Entropy term for the ternary mole fraction interaction of the excess Gibbs free energy expression.
Definition MargulesVPSSTP.h:450
Cantera::MargulesVPSSTP::s_update_dlnActCoeff_dlnN
void s_update_dlnActCoeff_dlnN() const
Update the derivative of the log of the activity coefficients wrt log(moles_m)
Definition MargulesVPSSTP.cpp:393
Cantera::MargulesVPSSTP::entropy_mole
double entropy_mole() const override
Molar entropy. Units: J/kmol/K.
Definition MargulesVPSSTP.cpp:64
Cantera::MargulesVPSSTP::m_HE_b_ij
vector< double > m_HE_b_ij
Enthalpy term for the binary mole fraction interaction of the excess Gibbs free energy expression.
Definition MargulesVPSSTP.h:422
Cantera::MargulesVPSSTP::getdlnActCoeffdT
void getdlnActCoeffdT(double *dlnActCoeffdT) const override
Get the array of temperature derivatives of the log activity coefficients.
Definition MargulesVPSSTP.cpp:316
Cantera::MargulesVPSSTP::m_VSE_b_ij
vector< double > m_VSE_b_ij
Entropy term for the binary mole fraction interaction of the excess Gibbs free energy expression.
Definition MargulesVPSSTP.h:446
Cantera::MargulesVPSSTP::cp_mole
double cp_mole() const override
Molar heat capacity at constant pressure. Units: J/kmol/K.
Definition MargulesVPSSTP.cpp:76
Cantera::MargulesVPSSTP::getPartialMolarCp
void getPartialMolarCp(double *cpbar) const override
Returns an array of partial molar entropies for the species in the mixture.
Definition MargulesVPSSTP.cpp:112
Cantera::MargulesVPSSTP::initLengths
void initLengths()
Initialize lengths of local variables after all species have been identified.
Definition MargulesVPSSTP.cpp:234
Cantera::MargulesVPSSTP::getLnActivityCoefficients
void getLnActivityCoefficients(double *lnac) const override
Get the array of non-dimensional molar-based ln activity coefficients at the current solution tempera...
Definition MargulesVPSSTP.cpp:25
Cantera::MargulesVPSSTP::s_update_dlnActCoeff_dlnX_diag
void s_update_dlnActCoeff_dlnX_diag() const
Update the derivative of the log of the activity coefficients wrt log(mole fraction)
Definition MargulesVPSSTP.cpp:432
Cantera::MargulesVPSSTP::s_update_lnActCoeff
void s_update_lnActCoeff() const
Update the activity coefficients.
Definition MargulesVPSSTP.cpp:265
Cantera::MargulesVPSSTP::getdlnActCoeffdlnX_diag
void getdlnActCoeffdlnX_diag(double *dlnActCoeffdlnX_diag) const override
Get the array of ln mole fraction derivatives of the log activity coefficients - diagonal component o...
Definition MargulesVPSSTP.cpp:460
Cantera::MargulesVPSSTP::m_VHE_b_ij
vector< double > m_VHE_b_ij
Enthalpy term for the binary mole fraction interaction of the excess Gibbs free energy expression.
Definition MargulesVPSSTP.h:438
Cantera::MargulesVPSSTP::addBinaryInteraction
void addBinaryInteraction(const string &speciesA, const string &speciesB, double h0, double h1, double s0, double s1, double vh0, double vh1, double vs0, double vs1)
Add a binary species interaction with the specified parameters.
Definition MargulesVPSSTP.cpp:239
Cantera::MargulesVPSSTP::MargulesVPSSTP
MargulesVPSSTP(const string &inputFile="", const string &id="")
Construct a MargulesVPSSTP object from an input file.
Definition MargulesVPSSTP.cpp:18
Cantera::MargulesVPSSTP::m_HE_c_ij
vector< double > m_HE_c_ij
Enthalpy term for the ternary mole fraction interaction of the excess Gibbs free energy expression.
Definition MargulesVPSSTP.h:426
Cantera::MargulesVPSSTP::getdlnActCoeffdlnN_diag
void getdlnActCoeffdlnN_diag(double *dlnActCoeffdlnN_diag) const override
Get the array of log species mole number derivatives of the log activity coefficients.
Definition MargulesVPSSTP.cpp:452
Cantera::MargulesVPSSTP::getd2lnActCoeffdT2
void getd2lnActCoeffdT2(double *d2lnActCoeffdT2) const
Get the array of temperature second derivatives of the log activity coefficients.
Definition MargulesVPSSTP.cpp:324
Cantera::MargulesVPSSTP::getPartialMolarEntropies
void getPartialMolarEntropies(double *sbar) const override
Returns an array of partial molar entropies for the species in the mixture.
Definition MargulesVPSSTP.cpp:132
Cantera::MargulesVPSSTP::getdlnActCoeffdlnN
void getdlnActCoeffdlnN(const size_t ld, double *const dlnActCoeffdlnN) override
Get the array of derivatives of the log activity coefficients with respect to the log of the species ...
Definition MargulesVPSSTP.cpp:468
Cantera::Phase::nSpecies
size_t nSpecies() const
Returns the number of species in the phase.
Definition Phase.h:245
Cantera::Phase::m_kk
size_t m_kk
Number of species in the phase.
Definition Phase.h:947
Cantera::Phase::temperature
double temperature() const
Temperature (K).
Definition Phase.h:662
Cantera::Phase::speciesName
string speciesName(size_t k) const
Name of the species with index k.
Definition Phase.cpp:151
Cantera::Phase::speciesIndex
size_t speciesIndex(const string &name) const
Returns the index of a species named 'name' within the Phase object.
Definition Phase.cpp:138
Cantera::Phase::species
shared_ptr< Species > species(const string &name) const
Return the Species object for the named species.
Definition Phase.cpp:977
Cantera::ThermoPhase::getParameters
virtual void getParameters(AnyMap &phaseNode) const
Store the parameters of a ThermoPhase object such that an identical one could be reconstructed using ...
Definition ThermoPhase.cpp:1176
Cantera::ThermoPhase::RT
double RT() const
Return the Gas Constant multiplied by the current temperature.
Definition ThermoPhase.h:1077
Cantera::ThermoPhase::initThermo
virtual void initThermo()
Initialize the ThermoPhase object after all species have been set up.
Definition ThermoPhase.cpp:1093
Cantera::ThermoPhase::initThermoFile
void initThermoFile(const string &inputFile, const string &id)
Initialize a ThermoPhase object using an input file.
Definition ThermoPhase.cpp:1072
Cantera::ThermoPhase::m_input
AnyMap m_input
Data supplied via setParameters.
Definition ThermoPhase.h:2130
Cantera::VPStandardStateTP::getEntropy_R
void getEntropy_R(double *sr) const override
Get the array of nondimensional Entropy functions for the standard state species at the current T and...
Definition VPStandardStateTP.cpp:62
Cantera::VPStandardStateTP::getStandardChemPotentials
void getStandardChemPotentials(double *mu) const override
Get the array of chemical potentials at unit activity for the species at their standard states at the...
Definition VPStandardStateTP.cpp:48
Cantera::VPStandardStateTP::getCp_R
void getCp_R(double *cpr) const override
Get the nondimensional Heat Capacities at constant pressure for the species standard states at the cu...
Definition VPStandardStateTP.cpp:90
Cantera::VPStandardStateTP::getEnthalpy_RT
void getEnthalpy_RT(double *hrt) const override
Get the nondimensional Enthalpy functions for the species at their standard states at the current T a...
Definition VPStandardStateTP.cpp:56
Cantera::VPStandardStateTP::getStandardVolumes
void getStandardVolumes(double *vol) const override
Get the molar volumes of the species standard states at the current T and P of the solution.
Definition VPStandardStateTP.cpp:96
Cantera::GasConstant
const double GasConstant
Universal Gas Constant [J/kmol/K].
Definition ct_defs.h:120
Cantera
Namespace for the Cantera kernel.
Definition AnyMap.cpp:564
Cantera::npos
const size_t npos
index returned by functions to indicate "no position"
Definition ct_defs.h:195
Cantera::SmallNumber
const double SmallNumber
smallest number to compare to zero.
Definition ct_defs.h:158
stringUtils.h
Contains declarations for string manipulation functions within Cantera.