Cantera  4.0.0a2
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
13#include "cantera/thermo/PDSS.h"
16
17namespace Cantera
18{
19MargulesVPSSTP::MargulesVPSSTP(const string& inputFile, const string& id_)
20{
21 initThermoFile(inputFile, id_);
22}
23
24// -- Activities, Standard States, Activity Concentrations -----------
25
26void MargulesVPSSTP::getLnActivityCoefficients(span<double> lnac) const
27{
28 checkArraySize("MargulesVPSSTP::getLnActivityCoefficients", lnac.size(), m_kk);
29 // Update the activity coefficients
31
32 // take the exp of the internally stored coefficients.
33 for (size_t k = 0; k < m_kk; k++) {
34 lnac[k] = lnActCoeff_Scaled_[k];
35 }
36}
37
38// ------------ Partial Molar Properties of the Solution ------------
39
40void MargulesVPSSTP::getChemPotentials(span<double> mu) const
41{
42 // First get the standard chemical potentials in molar form. This requires
43 // updates of standard state as a function of T and P
45
46 // Update the activity coefficients
48 for (size_t k = 0; k < m_kk; k++) {
49 double xx = std::max(moleFractions_[k], SmallNumber);
50 mu[k] += RT() * (log(xx) + lnActCoeff_Scaled_[k]);
51 }
52}
53
55{
56 double kappa_T = isothermalCompressibility();
57 if (kappa_T == 0.0) {
58 return cp_mole();
59 }
60 double beta = thermalExpansionCoeff();
61 return cp_mole() - temperature() * molarVolume() * beta * beta / kappa_T;
62}
63
65{
66 // V^E has no pressure dependence in this model, so only the standard
67 // state PDSS derivatives contribute to kappa_T.
68 double sum_xk_dVkdP = 0.0;
69 for (size_t k = 0; k < m_kk; k++) {
70 sum_xk_dVkdP += moleFractions_[k] * providePDSS(k)->dVdP();
71 }
72 return -sum_xk_dVkdP / molarVolume();
73}
74
76{
77 // Standard state contribution
78 double dVdT = 0.0;
79 for (size_t k = 0; k < m_kk; k++) {
80 dVdT += moleFractions_[k] * providePDSS(k)->dVdT();
81 }
82 // Excess volume contribution: d/dT [XA*XB*(g0 + g1*XB)]
83 // where g0 = VHE_b - T*VSE_b, g1 = VHE_c - T*VSE_c
84 // => dg0/dT = -VSE_b, dg1/dT = -VSE_c
85 for (size_t i = 0; i < numBinaryInteractions_; i++) {
86 double XA = moleFractions_[m_pSpecies_A_ij[i]];
87 double XB = moleFractions_[m_pSpecies_B_ij[i]];
88 dVdT -= XA * XB * (m_VSE_b_ij[i] + m_VSE_c_ij[i] * XB);
89 }
90 return dVdT / molarVolume();
91}
92
93void MargulesVPSSTP::getPartialMolarEnthalpies(span<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.
106 for (size_t k = 0; k < m_kk; k++) {
107 hbar[k] -= RT() * temperature() * dlnActCoeffdT_Scaled_[k];
108 }
109}
110
111void MargulesVPSSTP::getPartialMolarCp(span<double> cpbar) const
112{
113 // Get the nondimensional standard state heat capacities
114 getCp_R(cpbar);
115
116 for (size_t k = 0; k < m_kk; k++) {
117 cpbar[k] *= GasConstant;
118 }
119}
120
121void MargulesVPSSTP::getPartialMolarEntropies(span<double> sbar) const
122{
123 // Get the nondimensional standard state entropies
124 getEntropy_R(sbar);
125 double T = temperature();
126
127 // Update the activity coefficients.
130
131 for (size_t k = 0; k < m_kk; k++) {
132 double xx = std::max(moleFractions_[k], SmallNumber);
133 sbar[k] += - lnActCoeff_Scaled_[k] -log(xx) - T * dlnActCoeffdT_Scaled_[k];
134 }
135
136 // dimensionalize it.
137 for (size_t k = 0; k < m_kk; k++) {
138 sbar[k] *= GasConstant;
139 }
140}
141
142void MargulesVPSSTP::getPartialMolarVolumes(span<double> vbar) const
143{
144 double T = temperature();
145
146 // Get the standard state values in m^3 kmol-1
147 getStandardVolumes(vbar);
148
149 for (size_t i = 0; i < numBinaryInteractions_; i++) {
150 size_t iA = m_pSpecies_A_ij[i];
151 size_t iB = m_pSpecies_B_ij[i];
152 double XA = moleFractions_[iA];
153 double XB = moleFractions_[iB];
154 double g0 = (m_VHE_b_ij[i] - T * m_VSE_b_ij[i]);
155 double g1 = (m_VHE_c_ij[i] - T * m_VSE_c_ij[i]);
156 const double temp1 = g0 + g1 * XB;
157 const double all = -1.0*XA*XB*temp1 - XA*XB*XB*g1;
158
159 for (size_t iK = 0; iK < m_kk; iK++) {
160 vbar[iK] += all;
161 }
162 vbar[iA] += XB * temp1;
163 vbar[iB] += XA * temp1 + XA*XB*g1;
164 }
165}
166
168{
169 initLengths();
170 if (m_input.hasKey("interactions")) {
171 for (auto& item : m_input["interactions"].asVector<AnyMap>()) {
172 auto& species = item["species"].asVector<string>(2);
173 vector<double> h(2), s(2), vh(2), vs(2);
174 if (item.hasKey("excess-enthalpy")) {
175 h = item.convertVector("excess-enthalpy", "J/kmol", 2);
176 }
177 if (item.hasKey("excess-entropy")) {
178 s = item.convertVector("excess-entropy", "J/kmol/K", 2);
179 }
180 if (item.hasKey("excess-volume-enthalpy")) {
181 vh = item.convertVector("excess-volume-enthalpy", "m^3/kmol", 2);
182 }
183 if (item.hasKey("excess-volume-entropy")) {
184 vs = item.convertVector("excess-volume-entropy", "m^3/kmol/K", 2);
185 }
187 h[0], h[1], s[0], s[1], vh[0], vh[1], vs[0], vs[1]);
188 }
189 }
191}
192
194{
196 vector<AnyMap> interactions;
197 for (size_t n = 0; n < m_pSpecies_A_ij.size(); n++) {
198 AnyMap interaction;
199 interaction["species"] = vector<string>{
201 if (m_HE_b_ij[n] != 0 || m_HE_c_ij[n] != 0) {
202 interaction["excess-enthalpy"].setQuantity(
203 {m_HE_b_ij[n], m_HE_c_ij[n]}, "J/kmol");
204 }
205 if (m_SE_b_ij[n] != 0 || m_SE_c_ij[n] != 0) {
206 interaction["excess-entropy"].setQuantity(
207 {m_SE_b_ij[n], m_SE_c_ij[n]}, "J/kmol/K");
208 }
209 if (m_VHE_b_ij[n] != 0 || m_VHE_c_ij[n] != 0) {
210 interaction["excess-volume-enthalpy"].setQuantity(
211 {m_VHE_b_ij[n], m_VHE_c_ij[n]}, "m^3/kmol");
212 }
213 if (m_VSE_b_ij[n] != 0 || m_VSE_c_ij[n] != 0) {
214 interaction["excess-volume-entropy"].setQuantity(
215 {m_VSE_b_ij[n], m_VSE_c_ij[n]}, "m^3/kmol/K");
216 }
217 interactions.push_back(std::move(interaction));
218 }
219 phaseNode["interactions"] = std::move(interactions);
220}
221
223{
225}
226
227void MargulesVPSSTP::addBinaryInteraction(const string& speciesA,
228 const string& speciesB, double h0, double h1, double s0, double s1,
229 double vh0, double vh1, double vs0, double vs1)
230{
231 size_t kA = speciesIndex(speciesA, false);
232 size_t kB = speciesIndex(speciesB, false);
233 // The interaction is silently ignored if either species is not defined in
234 // the current phase.
235 if (kA == npos || kB == npos) {
236 return;
237 }
238 m_pSpecies_A_ij.push_back(kA);
239 m_pSpecies_B_ij.push_back(kB);
240
241 m_HE_b_ij.push_back(h0);
242 m_HE_c_ij.push_back(h1);
243 m_SE_b_ij.push_back(s0);
244 m_SE_c_ij.push_back(s1);
245 m_VHE_b_ij.push_back(vh0);
246 m_VHE_c_ij.push_back(vh1);
247 m_VSE_b_ij.push_back(vs0);
248 m_VSE_c_ij.push_back(vs1);
250}
251
252
254{
255 double T = temperature();
256 double deltaP_RT = (pressure() - OneAtm) / RT();
257 lnActCoeff_Scaled_.assign(m_kk, 0.0);
258 for (size_t i = 0; i < numBinaryInteractions_; i++) {
259 size_t iA = m_pSpecies_A_ij[i];
260 size_t iB = m_pSpecies_B_ij[i];
261 double g0 = (m_HE_b_ij[i] - T * m_SE_b_ij[i]) / RT()
262 + deltaP_RT * (m_VHE_b_ij[i] - T * m_VSE_b_ij[i]);
263 double g1 = (m_HE_c_ij[i] - T * m_SE_c_ij[i]) / RT()
264 + deltaP_RT * (m_VHE_c_ij[i] - T * m_VSE_c_ij[i]);
265 double XA = moleFractions_[iA];
266 double XB = moleFractions_[iB];
267 const double XAXB = XA * XB;
268 const double g0g1XB = (g0 + g1 * XB);
269 const double all = -1.0 * XAXB * g0g1XB - XAXB * XB * g1;
270 for (size_t iK = 0; iK < m_kk; iK++) {
271 lnActCoeff_Scaled_[iK] += all;
272 }
273 lnActCoeff_Scaled_[iA] += XB * g0g1XB;
274 lnActCoeff_Scaled_[iB] += XA * g0g1XB + XAXB * g1;
275 }
276}
277
279{
280 double invT = 1.0 / temperature();
281 double invRTT = 1.0 / GasConstant*invT*invT;
282 double deltaP = pressure() - OneAtm;
283 dlnActCoeffdT_Scaled_.assign(m_kk, 0.0);
284 for (size_t i = 0; i < numBinaryInteractions_; i++) {
285 size_t iA = m_pSpecies_A_ij[i];
286 size_t iB = m_pSpecies_B_ij[i];
287 double XA = moleFractions_[iA];
288 double XB = moleFractions_[iB];
289 double g0 = -(m_HE_b_ij[i] + deltaP * m_VHE_b_ij[i]) * invRTT;
290 double g1 = -(m_HE_c_ij[i] + deltaP * m_VHE_c_ij[i]) * invRTT;
291 const double XAXB = XA * XB;
292 const double g0g1XB = (g0 + g1 * XB);
293 const double all = -1.0 * XAXB * g0g1XB - XAXB * XB * g1;
294 for (size_t iK = 0; iK < m_kk; iK++) {
295 dlnActCoeffdT_Scaled_[iK] += all;
296 }
297 dlnActCoeffdT_Scaled_[iA] += XB * g0g1XB;
298 dlnActCoeffdT_Scaled_[iB] += XA * g0g1XB + XAXB * g1;
299 }
300}
301
302void MargulesVPSSTP::getdlnActCoeffdT(span<double> dlnActCoeffdT) const
303{
304 checkArraySize("MargulesVPSSTP::getdlnActCoeffdT", dlnActCoeffdT.size(), m_kk);
306 for (size_t k = 0; k < m_kk; k++) {
307 dlnActCoeffdT[k] = dlnActCoeffdT_Scaled_[k];
308 }
309}
310
311void MargulesVPSSTP::getdlnActCoeffds(const double dTds, span<const double> const dXds,
312 span<double> dlnActCoeffds) const
313{
314 checkArraySize("MargulesVPSSTP::getdlnActCoeffds", dlnActCoeffds.size(), m_kk);
315 checkArraySize("MargulesVPSSTP::getdlnActCoeffds", dXds.size(), m_kk);
316 double T = temperature();
317 double deltaP_RT = (pressure() - OneAtm) / RT();
319 for (size_t iK = 0; iK < m_kk; iK++) {
320 dlnActCoeffds[iK] = 0.0;
321 }
322
323 for (size_t i = 0; i < numBinaryInteractions_; i++) {
324 size_t iA = m_pSpecies_A_ij[i];
325 size_t iB = m_pSpecies_B_ij[i];
326 double XA = moleFractions_[iA];
327 double XB = moleFractions_[iB];
328 double dXA = dXds[iA];
329 double dXB = dXds[iB];
330 double g0 = (m_HE_b_ij[i] - T * m_SE_b_ij[i]) / RT()
331 + deltaP_RT * (m_VHE_b_ij[i] - T * m_VSE_b_ij[i]);
332 double g1 = (m_HE_c_ij[i] - T * m_SE_c_ij[i]) / RT()
333 + deltaP_RT * (m_VHE_c_ij[i] - T * m_VSE_c_ij[i]);
334 const double g02g1XB = g0 + 2*g1*XB;
335 const double g2XAdXB = 2*g1*XA*dXB;
336 const double all = (-XB * dXA - XA *dXB) * g02g1XB - XB *g2XAdXB;
337 for (size_t iK = 0; iK < m_kk; iK++) {
338 dlnActCoeffds[iK] += all + dlnActCoeffdT_Scaled_[iK]*dTds;
339 }
340 dlnActCoeffds[iA] += dXB * g02g1XB;
341 dlnActCoeffds[iB] += dXA * g02g1XB + g2XAdXB;
342 }
343}
344
346{
347 double T = temperature();
348 double deltaP_RT = (pressure() - OneAtm) / RT();
349 dlnActCoeffdlnN_diag_.assign(m_kk, 0.0);
350
351 for (size_t iK = 0; iK < m_kk; iK++) {
352 double XK = moleFractions_[iK];
353
354 for (size_t i = 0; i < numBinaryInteractions_; i++) {
355 size_t iA = m_pSpecies_A_ij[i];
356 size_t iB = m_pSpecies_B_ij[i];
357 size_t delAK = 0;
358 size_t delBK = 0;
359
360 if (iA==iK) {
361 delAK = 1;
362 } else if (iB==iK) {
363 delBK = 1;
364 }
365
366 double XA = moleFractions_[iA];
367 double XB = moleFractions_[iB];
368
369 double g0 = (m_HE_b_ij[i] - T * m_SE_b_ij[i]) / RT()
370 + deltaP_RT * (m_VHE_b_ij[i] - T * m_VSE_b_ij[i]);
371 double g1 = (m_HE_c_ij[i] - T * m_SE_c_ij[i]) / RT()
372 + deltaP_RT * (m_VHE_c_ij[i] - T * m_VSE_c_ij[i]);
373
374 dlnActCoeffdlnN_diag_[iK] += 2*(delBK-XB)*(g0*(delAK-XA)+g1*(2*(delAK-XA)*XB+XA*(delBK-XB)));
375 }
377 }
378}
379
381{
382 double T = temperature();
383 double deltaP_RT = (pressure() - OneAtm) / RT();
385
386 // Loop over the activity coefficient gamma_k
387 for (size_t iK = 0; iK < m_kk; iK++) {
388 for (size_t iM = 0; iM < m_kk; iM++) {
389 double XM = moleFractions_[iM];
390 for (size_t i = 0; i < numBinaryInteractions_; i++) {
391 size_t iA = m_pSpecies_A_ij[i];
392 size_t iB = m_pSpecies_B_ij[i];
393 double delAK = 0.0;
394 double delBK = 0.0;
395 double delAM = 0.0;
396 double delBM = 0.0;
397 if (iA==iK) {
398 delAK = 1.0;
399 } else if (iB==iK) {
400 delBK = 1.0;
401 }
402 if (iA==iM) {
403 delAM = 1.0;
404 } else if (iB==iM) {
405 delBM = 1.0;
406 }
407
408 double XA = moleFractions_[iA];
409 double XB = moleFractions_[iB];
410 double g0 = (m_HE_b_ij[i] - T * m_SE_b_ij[i]) / RT()
411 + deltaP_RT * (m_VHE_b_ij[i] - T * m_VSE_b_ij[i]);
412 double g1 = (m_HE_c_ij[i] - T * m_SE_c_ij[i]) / RT()
413 + deltaP_RT * (m_VHE_c_ij[i] - T * m_VSE_c_ij[i]);
414 dlnActCoeffdlnN_(iK,iM) += g0*((delAM-XA)*(delBK-XB)+(delAK-XA)*(delBM-XB));
415 dlnActCoeffdlnN_(iK,iM) += 2*g1*((delAM-XA)*(delBK-XB)*XB+(delAK-XA)*(delBM-XB)*XB+(delBM-XB)*(delBK-XB)*XA);
416 }
417 dlnActCoeffdlnN_(iK,iM) = XM*dlnActCoeffdlnN_(iK,iM);
418 }
419 }
420}
421
423{
424 double T = temperature();
425 double deltaP_RT = (pressure() - OneAtm) / RT();
426 dlnActCoeffdlnX_diag_.assign(m_kk, 0.0);
427
428 for (size_t i = 0; i < numBinaryInteractions_; i++) {
429 size_t iA = m_pSpecies_A_ij[i];
430 size_t iB = m_pSpecies_B_ij[i];
431
432 double XA = moleFractions_[iA];
433 double XB = moleFractions_[iB];
434
435 double g0 = (m_HE_b_ij[i] - T * m_SE_b_ij[i]) / RT()
436 + deltaP_RT * (m_VHE_b_ij[i] - T * m_VSE_b_ij[i]);
437 double g1 = (m_HE_c_ij[i] - T * m_SE_c_ij[i]) / RT()
438 + deltaP_RT * (m_VHE_c_ij[i] - T * m_VSE_c_ij[i]);
439
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
445void MargulesVPSSTP::getdlnActCoeffdlnN_diag(span<double> dlnActCoeffdlnN_diag) const
446{
448 for (size_t k = 0; k < m_kk; k++) {
449 dlnActCoeffdlnN_diag[k] = dlnActCoeffdlnN_diag_[k];
450 }
451}
452
453void MargulesVPSSTP::getdlnActCoeffdlnX_diag(span<double> dlnActCoeffdlnX_diag) const
454{
456 for (size_t k = 0; k < m_kk; k++) {
457 dlnActCoeffdlnX_diag[k] = dlnActCoeffdlnX_diag_[k];
458 }
459}
460
461void MargulesVPSSTP::getdlnActCoeffdlnN(const size_t ld, span<double> 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
472}
(see Thermodynamic Properties and class MargulesVPSSTP).
Declarations for the virtual base class PDSS (pressure dependent standard state) which handles calcul...
Headers for the factory class that can create known ThermoPhase objects (see Thermodynamic Properties...
A map of string keys to values whose type can vary at runtime.
Definition AnyMap.h:431
bool hasKey(const string &key) const
Returns true if the map contains an item named key.
Definition AnyMap.cpp:1477
void zero()
Set all of the entries to zero.
Definition Array.h:118
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:52
Array2D dlnActCoeffdlnN_
Storage for the current derivative values of the gradients with respect to logarithm of the species m...
vector< double > lnActCoeff_Scaled_
Storage for the current values of the activity coefficients of the species.
vector< double > dlnActCoeffdlnX_diag_
Storage for the current derivative values of the gradients with respect to logarithm of the mole frac...
vector< double > moleFractions_
Storage for the current values of the mole fractions of the species.
vector< double > dlnActCoeffdT_Scaled_
Storage for the current derivative values of the gradients with respect to temperature of the log of ...
vector< double > dlnActCoeffdlnN_diag_
Storage for the current derivative values of the gradients with respect to logarithm of the mole frac...
void getLnActivityCoefficients(span< double > lnac) const override
Get the array of non-dimensional molar-based ln activity coefficients at the current solution tempera...
double thermalExpansionCoeff() const override
Thermal expansion coefficient of the mixture.
void getPartialMolarEnthalpies(span< double > hbar) const override
Returns an array of partial molar enthalpies for the species in the mixture.
vector< double > m_VHE_c_ij
Enthalpy term for the ternary mole fraction interaction of the excess Gibbs free energy expression.
vector< double > m_SE_b_ij
Entropy term for the binary mole fraction interaction of the excess Gibbs free energy expression.
void getdlnActCoeffdlnN_diag(span< double > dlnActCoeffdlnN_diag) const override
Get the array of log species mole number derivatives of the log activity coefficients.
void getPartialMolarCp(span< double > cpbar) const override
Returns an array of partial molar heat capacities [J/kmol/K] for the species in the mixture.
size_t numBinaryInteractions_
number of binary interaction expressions
vector< double > m_SE_c_ij
Entropy term for the ternary mole fraction interaction of the excess Gibbs free energy expression.
void s_update_dlnActCoeff_dlnN_diag() const
Update the derivative of the log of the activity coefficients wrt log(moles) - diagonal only.
void getParameters(AnyMap &phaseNode) const override
Store the parameters of a ThermoPhase object such that an identical one could be reconstructed using ...
void initThermo() override
Initialize the ThermoPhase object after all species have been set up.
void getdlnActCoeffdlnX_diag(span< double > dlnActCoeffdlnX_diag) const override
Get the array of ln mole fraction derivatives of the log activity coefficients - diagonal component o...
void getdlnActCoeffdlnN(const size_t ld, span< double > const dlnActCoeffdlnN) override
Get the array of derivatives of the log activity coefficients with respect to the log of the species ...
vector< size_t > m_pSpecies_A_ij
vector of species indices representing species A in the interaction
double cv_mole() const override
Molar heat capacity at constant volume.
void s_update_dlnActCoeff_dT() const
Update the derivative of the log of the activity coefficients wrt T.
vector< size_t > m_pSpecies_B_ij
vector of species indices representing species B in the interaction
vector< double > m_VSE_c_ij
Entropy term for the ternary mole fraction interaction of the excess Gibbs free energy expression.
void s_update_dlnActCoeff_dlnN() const
Update the derivative of the log of the activity coefficients wrt log(moles_m)
double isothermalCompressibility() const override
Isothermal compressibility of the mixture.
vector< double > m_HE_b_ij
Enthalpy term for the binary mole fraction interaction of the excess Gibbs free energy expression.
void getdlnActCoeffds(const double dTds, span< const double > dXds, span< double > dlnActCoeffds) const override
Get the change in activity coefficients wrt changes in state (temp, mole fraction,...
vector< double > m_VSE_b_ij
Entropy term for the binary mole fraction interaction of the excess Gibbs free energy expression.
void getPartialMolarVolumes(span< double > vbar) const override
Return an array of partial molar volumes for the species in the mixture.
void initLengths()
Initialize lengths of local variables after all species have been identified.
void getPartialMolarEntropies(span< double > sbar) const override
Returns an array of partial molar entropies for the species in the mixture.
void s_update_dlnActCoeff_dlnX_diag() const
Update the derivative of the log of the activity coefficients wrt log(mole fraction)
void s_update_lnActCoeff() const
Update the activity coefficients.
void getdlnActCoeffdT(span< double > dlnActCoeffdT) const override
Get the array of temperature derivatives of the log activity coefficients.
vector< double > m_VHE_b_ij
Enthalpy term for the binary mole fraction interaction of the excess Gibbs free energy expression.
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.
MargulesVPSSTP(const string &inputFile="", const string &id="")
Construct a MargulesVPSSTP object from an input file.
void getChemPotentials(span< double > mu) const override
Get the species chemical potentials. Units: J/kmol.
vector< double > m_HE_c_ij
Enthalpy term for the ternary mole fraction interaction of the excess Gibbs free energy expression.
virtual double dVdT() const
Return the temperature derivative of the standard state molar volume at constant pressure [m³/kmol/K]...
Definition PDSS.cpp:73
virtual double dVdP() const
Return the pressure derivative of the standard state molar volume at constant temperature [m³/kmol/Pa...
Definition PDSS.cpp:78
size_t m_kk
Number of species in the phase.
Definition Phase.h:882
size_t speciesIndex(const string &name, bool raise=true) const
Returns the index of a species named 'name' within the Phase object.
Definition Phase.cpp:127
double temperature() const
Temperature (K).
Definition Phase.h:586
string speciesName(size_t k) const
Name of the species with index k.
Definition Phase.cpp:143
shared_ptr< Species > species(const string &name) const
Return the Species object for the named species.
Definition Phase.cpp:943
virtual double molarVolume() const
Molar volume (m^3/kmol).
Definition Phase.cpp:602
virtual double cp_mole() const
Molar heat capacity at constant pressure and composition [J/kmol/K].
virtual void getParameters(AnyMap &phaseNode) const
Store the parameters of a ThermoPhase object such that an identical one could be reconstructed using ...
double RT() const
Return the Gas Constant multiplied by the current temperature.
virtual void initThermo()
Initialize the ThermoPhase object after all species have been set up.
void initThermoFile(const string &inputFile, const string &id)
Initialize a ThermoPhase object using an input file.
AnyMap m_input
Data supplied via setParameters.
void getCp_R(span< double > cpr) const override
Get the nondimensional Heat Capacities at constant pressure for the species standard states at the cu...
double pressure() const override
Returns the current pressure of the phase.
void getStandardChemPotentials(span< double > mu) const override
Get the array of chemical potentials at unit activity for the species at their standard states at the...
void getEnthalpy_RT(span< double > hrt) const override
Get the nondimensional Enthalpy functions for the species at their standard states at the current T a...
void getEntropy_R(span< double > sr) const override
Get the array of nondimensional Entropy functions for the standard state species at the current T and...
void getStandardVolumes(span< double > vol) const override
Get the molar volumes of the species standard states at the current T and P of the solution.
const double OneAtm
One atmosphere [Pa].
Definition ct_defs.h:99
const double GasConstant
Universal Gas Constant [J/kmol/K].
Definition ct_defs.h:123
Namespace for the Cantera kernel.
Definition AnyMap.cpp:595
const size_t npos
index returned by functions to indicate "no position"
Definition ct_defs.h:183
const double SmallNumber
smallest number to compare to zero.
Definition ct_defs.h:161
void checkArraySize(const char *procedure, size_t available, size_t required)
Wrapper for throwing ArraySizeError.
Contains declarations for string manipulation functions within Cantera.