14 #include "vcs_species_thermo.h"
31 VCS_SPECIES_THERMO::VCS_SPECIES_THERMO(
size_t indexPhase,
32 size_t indexSpeciesPhase) :
34 IndexPhase(indexPhase),
35 IndexSpeciesPhase(indexSpeciesPhase),
37 SS0_Model(VCS_SS0_CONSTANT),
46 SSStar_Model(VCS_SSSTAR_CONSTANT),
48 Activity_Coeff_Model(VCS_AC_CONSTANT),
49 Activity_Coeff_Params(0),
50 SSStar_Vol_Model(VCS_SSVOL_IDEALGAS),
53 UseCanteraCalls(false),
54 m_VCS_UnitsFormat(VCS_UNITS_UNITLESS)
64 VCS_SPECIES_THERMO::~VCS_SPECIES_THERMO()
72 VCS_SPECIES_THERMO::VCS_SPECIES_THERMO(
const VCS_SPECIES_THERMO& b) :
73 IndexPhase(b.IndexPhase),
74 IndexSpeciesPhase(b.IndexSpeciesPhase),
75 OwningPhase(b.OwningPhase),
76 SS0_Model(b.SS0_Model),
77 SS0_feSave(b.SS0_feSave),
78 SS0_TSave(b.SS0_TSave),
85 SSStar_Model(b.SSStar_Model),
87 Activity_Coeff_Model(b.Activity_Coeff_Model),
88 Activity_Coeff_Params(0),
89 SSStar_Vol_Model(b.SSStar_Vol_Model),
91 SSStar_Vol0(b.SSStar_Vol0),
92 UseCanteraCalls(b.UseCanteraCalls),
93 m_VCS_UnitsFormat(b.m_VCS_UnitsFormat)
104 VCS_SPECIES_THERMO::operator=(
const VCS_SPECIES_THERMO& b)
107 IndexPhase = b.IndexPhase;
108 IndexSpeciesPhase = b.IndexSpeciesPhase;
109 OwningPhase = b.OwningPhase;
110 SS0_Model = b.SS0_Model;
111 SS0_feSave = b.SS0_feSave;
112 SS0_TSave = b.SS0_TSave;
117 SS0_Pref = b.SS0_Pref;
118 SSStar_Model = b.SSStar_Model;
122 SSStar_Params = b.SSStar_Params;
123 Activity_Coeff_Model = b.Activity_Coeff_Model;
127 Activity_Coeff_Params = b.Activity_Coeff_Params;
128 SSStar_Vol_Model = b.SSStar_Vol_Model;
132 SSStar_Vol_Params = b.SSStar_Vol_Params;
133 SSStar_Vol0 = b.SSStar_Vol0;
134 UseCanteraCalls = b.UseCanteraCalls;
135 m_VCS_UnitsFormat = b.m_VCS_UnitsFormat;
148 VCS_SPECIES_THERMO* VCS_SPECIES_THERMO::duplMyselfAsVCS_SPECIES_THERMO()
150 VCS_SPECIES_THERMO* ptr =
new VCS_SPECIES_THERMO(*
this);
173 double VCS_SPECIES_THERMO::GStar_R_calc(
size_t kglob,
double TKelvin,
176 char yo[] =
"VCS_SPECIES_THERMO::GStar_R_calc ";
178 fe = G0_R_calc(kglob, TKelvin);
180 if (UseCanteraCalls) {
181 AssertThrowVCS(m_VCS_UnitsFormat == VCS_UNITS_MKS,
"Possible inconsistency");
182 size_t kspec = IndexSpeciesPhase;
183 OwningPhase->setState_TP(TKelvin, pres);
184 fe = OwningPhase->GStar_calc_one(kspec);
185 double R = vcsUtil_gasConstant(m_VCS_UnitsFormat);
188 double pref = SS0_Pref;
189 switch (SSStar_Model) {
190 case VCS_SSSTAR_CONSTANT:
192 case VCS_SSSTAR_IDEAL_GAS:
193 fe += T * log(pres/ pref);
196 plogf(
"%sERROR: unknown SSStar model\n", yo);
216 double VCS_SPECIES_THERMO::
217 VolStar_calc(
size_t kglob,
double TKelvin,
double presPA)
219 char yo[] =
"VCS_SPECIES_THERMO::VStar_calc ";
223 if (UseCanteraCalls) {
224 AssertThrowVCS(m_VCS_UnitsFormat == VCS_UNITS_MKS,
"Possible inconsistency");
225 size_t kspec = IndexSpeciesPhase;
226 OwningPhase->setState_TP(TKelvin, presPA);
227 vol = OwningPhase->VolStar_calc_one(kspec);
229 switch (SSStar_Vol_Model) {
230 case VCS_SSVOL_CONSTANT:
233 case VCS_SSVOL_IDEALGAS:
237 plogf(
"%sERROR: unknown SSVol model\n", yo);
258 double VCS_SPECIES_THERMO::G0_R_calc(
size_t kglob,
double TKelvin)
261 char yo[] =
"VS_SPECIES_THERMO::G0_R_calc ";
264 if (SS0_Model == VCS_SS0_CONSTANT) {
268 if (TKelvin == SS0_TSave) {
272 if (UseCanteraCalls) {
273 AssertThrowVCS(m_VCS_UnitsFormat == VCS_UNITS_MKS,
"Possible inconsistency");
274 size_t kspec = IndexSpeciesPhase;
275 OwningPhase->setState_T(TKelvin);
276 fe = OwningPhase->G0_calc_one(kspec);
277 double R = vcsUtil_gasConstant(m_VCS_UnitsFormat);
281 case VCS_SS0_CONSTANT:
284 case VCS_SS0_CONSTANT_CP:
285 H = SS0_H0 + (TKelvin - SS0_T0) * SS0_Cp0;
286 S = SS0_Cp0 + SS0_Cp0 * log((TKelvin / SS0_T0));
287 fe = H - TKelvin * S;
291 plogf(
"%sERROR: unknown model\n", yo);
320 double VCS_SPECIES_THERMO::eval_ac(
size_t kglob)
323 char yo[] =
"VCS_SPECIES_THERMO::eval_ac ";
332 if (UseCanteraCalls) {
333 size_t kspec = IndexSpeciesPhase;
334 ac = OwningPhase->AC_calc_one(kspec);
336 switch (Activity_Coeff_Model) {
337 case VCS_AC_CONSTANT:
342 plogf(
"%sERROR: unknown model\n", yo);