00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #include "ct_defs.h"
00017 #include "xml.h"
00018 #include "ctml.h"
00019 #include "PDSS.h"
00020
00021 #include "ThermoFactory.h"
00022 #include "SpeciesThermo.h"
00023
00024 #include "VPStandardStateTP.h"
00025
00026 namespace Cantera {
00027
00028
00029
00030 PDSS::PDSS() :
00031 m_pdssType(cPDSS_UNDEF),
00032 m_temp(-1.0),
00033 m_pres(-1.0),
00034 m_p0(-1.0),
00035 m_minTemp(-1.0),
00036 m_maxTemp(10000.0),
00037 m_tp(0),
00038 m_vpssmgr_ptr(0),
00039 m_mw(0.0),
00040 m_spindex(-1),
00041 m_spthermo(0),
00042 m_h0_RT_ptr(0),
00043 m_cp0_R_ptr(0),
00044 m_s0_R_ptr(0),
00045 m_g0_RT_ptr(0),
00046 m_V0_ptr(0),
00047 m_hss_RT_ptr(0),
00048 m_cpss_R_ptr(0),
00049 m_sss_R_ptr(0),
00050 m_gss_RT_ptr(0),
00051 m_Vss_ptr(0)
00052 {
00053 }
00054
00055 PDSS::PDSS(VPStandardStateTP *tp, int spindex) :
00056 m_pdssType(cPDSS_UNDEF),
00057 m_temp(-1.0),
00058 m_pres(-1.0),
00059 m_p0(-1.0),
00060 m_minTemp(-1.0),
00061 m_maxTemp(10000.0),
00062 m_tp(tp),
00063 m_vpssmgr_ptr(0),
00064 m_mw(0.0),
00065 m_spindex(spindex),
00066 m_spthermo(0),
00067 m_h0_RT_ptr(0),
00068 m_cp0_R_ptr(0),
00069 m_s0_R_ptr(0),
00070 m_g0_RT_ptr(0),
00071 m_V0_ptr(0),
00072 m_hss_RT_ptr(0),
00073 m_cpss_R_ptr(0),
00074 m_sss_R_ptr(0),
00075 m_gss_RT_ptr(0),
00076 m_Vss_ptr(0)
00077 {
00078 if (tp) {
00079 m_spthermo = &(tp->speciesThermo());
00080 }
00081 if (tp) {
00082 m_vpssmgr_ptr = tp->provideVPSSMgr();
00083 }
00084 }
00085
00086
00087
00088
00089 PDSS::PDSS(const PDSS &b) :
00090 m_pdssType(cPDSS_UNDEF),
00091 m_temp(-1.0),
00092 m_pres(-1.0),
00093 m_p0(-1.0),
00094 m_minTemp(-1.0),
00095 m_maxTemp(10000.0),
00096 m_tp(0),
00097 m_vpssmgr_ptr(0),
00098 m_mw(b.m_mw),
00099 m_spindex(b.m_spindex),
00100 m_spthermo(b.m_spthermo),
00101 m_h0_RT_ptr(b.m_h0_RT_ptr),
00102 m_cp0_R_ptr(b.m_cp0_R_ptr),
00103 m_s0_R_ptr(b.m_s0_R_ptr),
00104 m_g0_RT_ptr(b.m_g0_RT_ptr),
00105 m_V0_ptr(b.m_V0_ptr),
00106 m_hss_RT_ptr(b.m_hss_RT_ptr),
00107 m_cpss_R_ptr(b.m_cpss_R_ptr),
00108 m_sss_R_ptr(b.m_sss_R_ptr),
00109 m_gss_RT_ptr(b.m_gss_RT_ptr),
00110 m_Vss_ptr(b.m_Vss_ptr)
00111 {
00112
00113
00114
00115
00116 *this = b;
00117 }
00118
00119
00120
00121
00122
00123
00124 PDSS& PDSS::operator=(const PDSS&b) {
00125 if (&b == this) return *this;
00126
00127 m_pdssType = b.m_pdssType;
00128 m_temp = b.m_temp;
00129 m_pres = b.m_pres;
00130 m_p0 = b.m_p0;
00131 m_minTemp = b.m_minTemp;
00132 m_maxTemp = b.m_maxTemp;
00133
00134
00135
00136
00137
00138 m_tp = 0;
00139 m_vpssmgr_ptr = 0;
00140 m_mw = b.m_mw;
00141 m_spindex = b.m_spindex;
00142 m_spthermo = 0;
00143 m_cp0_R_ptr = 0;
00144 m_h0_RT_ptr = 0;
00145 m_s0_R_ptr = 0;
00146 m_g0_RT_ptr = 0;
00147 m_V0_ptr = 0;
00148 m_cpss_R_ptr = 0;
00149 m_hss_RT_ptr = 0;
00150 m_sss_R_ptr = 0;
00151 m_gss_RT_ptr = 0;
00152 m_Vss_ptr = 0;
00153
00154
00155 m_tp = b.m_tp;
00156 m_vpssmgr_ptr = b.m_vpssmgr_ptr;
00157 m_spthermo = b.m_spthermo;
00158 m_cp0_R_ptr = b.m_cp0_R_ptr;
00159 m_h0_RT_ptr = b.m_h0_RT_ptr;
00160 m_s0_R_ptr = b.m_s0_R_ptr;
00161 m_g0_RT_ptr = b.m_g0_RT_ptr;
00162 m_V0_ptr = b.m_V0_ptr;
00163 m_cpss_R_ptr = b.m_cpss_R_ptr;
00164 m_hss_RT_ptr = b.m_hss_RT_ptr;
00165 m_sss_R_ptr = b.m_sss_R_ptr;
00166 m_gss_RT_ptr = b.m_gss_RT_ptr;
00167 m_Vss_ptr = b.m_Vss_ptr;
00168
00169 return *this;
00170 }
00171
00172 PDSS::~PDSS() {
00173 }
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183 PDSS *PDSS::duplMyselfAsPDSS() const {
00184 PDSS *ip = new PDSS(*this);
00185 return ip;
00186 }
00187
00188
00189
00190
00191
00192 PDSS_enumType PDSS::reportPDSSType() const {
00193 return m_pdssType;
00194 }
00195
00196 void PDSS::initThermoXML(const XML_Node& phaseNode, std::string& id) {
00197 AssertThrow(m_tp != 0, "PDSS::initThermoXML()");
00198 m_p0 = m_vpssmgr_ptr->refPressure(m_spindex);
00199 m_minTemp = m_vpssmgr_ptr->minTemp(m_spindex);
00200 m_maxTemp = m_vpssmgr_ptr->maxTemp(m_spindex);
00201 }
00202
00203 void PDSS::initThermo() {
00204 AssertThrow(m_tp != 0, "PDSS::initThermo()");
00205 m_vpssmgr_ptr = m_tp->provideVPSSMgr();
00206 initPtrs();
00207 m_mw = m_tp->molecularWeight(m_spindex);
00208 }
00209
00210 void PDSS::initAllPtrs(VPStandardStateTP *tp, VPSSMgr *vpssmgr_ptr,
00211 SpeciesThermo* spthermo) {
00212 m_tp = tp;
00213 m_vpssmgr_ptr = vpssmgr_ptr;
00214 m_spthermo = spthermo;
00215 initPtrs();
00216 }
00217
00218 void PDSS::initPtrs() {
00219 m_h0_RT_ptr = &(m_vpssmgr_ptr->mPDSS_h0_RT[0]);
00220 m_cp0_R_ptr = &(m_vpssmgr_ptr->mPDSS_cp0_R[0]);
00221 m_s0_R_ptr = &(m_vpssmgr_ptr->mPDSS_s0_R[0]);
00222 m_g0_RT_ptr = &(m_vpssmgr_ptr->mPDSS_g0_RT[0]);
00223 m_V0_ptr = &(m_vpssmgr_ptr->mPDSS_V0[0]);
00224
00225 m_hss_RT_ptr = &(m_vpssmgr_ptr->mPDSS_hss_RT[0]);
00226 m_cpss_R_ptr = &(m_vpssmgr_ptr->mPDSS_cpss_R[0]);
00227 m_sss_R_ptr = &(m_vpssmgr_ptr->mPDSS_sss_R[0]);
00228 m_gss_RT_ptr = &(m_vpssmgr_ptr->mPDSS_gss_RT[0]);
00229 m_Vss_ptr = &(m_vpssmgr_ptr->mPDSS_Vss[0]);
00230 }
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240 doublereal PDSS::enthalpy_mole() const {
00241 err("enthalpy_mole()");
00242 return (0.0);
00243 }
00244
00245 doublereal PDSS::enthalpy_RT() const {
00246 double RT = GasConstant * m_temp;
00247 return (enthalpy_mole()/RT);
00248 }
00249
00250
00251
00252
00253
00254
00255
00256
00257 doublereal PDSS::intEnergy_mole() const {
00258 err("intEnergy_mole()");
00259 return (0.0);
00260 }
00261
00262
00263
00264
00265
00266
00267
00268
00269 doublereal PDSS::entropy_mole() const {
00270 err("entropy_mole()");
00271 return (0.0);
00272 }
00273
00274 doublereal PDSS::entropy_R() const {
00275 return(entropy_mole()/GasConstant);
00276 }
00277
00278
00279
00280
00281
00282
00283
00284
00285 doublereal PDSS::gibbs_mole() const {
00286 err("gibbs_mole()");
00287 return (0.0);
00288 }
00289
00290 doublereal PDSS::gibbs_RT() const {
00291 double RT = GasConstant * m_temp;
00292 return (gibbs_mole()/RT);
00293 }
00294
00295
00296
00297
00298
00299
00300
00301
00302 doublereal PDSS::cp_mole() const {
00303 err("cp_mole()");
00304 return (0.0);
00305 }
00306
00307 doublereal PDSS::cp_R() const {
00308 return (cp_mole()/GasConstant);
00309 }
00310
00311 doublereal PDSS::molarVolume() const {
00312 err("molarVolume()");
00313 return 0.0;
00314 }
00315
00316 doublereal PDSS::density() const {
00317 err("density()");
00318 return 0.0;
00319 }
00320
00321
00322
00323
00324
00325
00326
00327
00328 doublereal PDSS::cv_mole() const {
00329 err("cv_mole()");
00330 return (0.0);
00331 }
00332
00333 doublereal PDSS::gibbs_RT_ref() const {
00334 err("gibbs_RT_ref()");
00335 return 0.0;
00336 }
00337
00338 doublereal PDSS::enthalpy_RT_ref() const {
00339 err("enthalpy_RT_ref()");
00340 return 0.0;
00341 }
00342
00343 doublereal PDSS::entropy_R_ref() const {
00344 err("entropy_RT_ref()");
00345 return 0.0;
00346 }
00347
00348 doublereal PDSS::cp_R_ref() const {
00349 err("entropy_RT_ref()");
00350 return 0.0;
00351 }
00352
00353 doublereal PDSS::molarVolume_ref() const {
00354 err("molarVolume_ref()");
00355 return 0.0;
00356 }
00357
00358
00359
00360
00361
00362
00363 doublereal PDSS::
00364 enthalpyDelp_mole() const {
00365 doublereal RT = m_temp * GasConstant;
00366 doublereal tmp = enthalpy_RT_ref();
00367 return(enthalpy_mole() - RT * tmp);
00368 }
00369
00370
00371
00372
00373
00374
00375
00376 doublereal PDSS::entropyDelp_mole() const {
00377 doublereal tmp = entropy_R_ref();
00378 return(entropy_mole() - GasConstant * tmp);
00379
00380 }
00381
00382
00383
00384
00385
00386
00387 doublereal PDSS::gibbsDelp_mole() const {
00388 doublereal RT = m_temp * GasConstant;
00389 doublereal tmp = gibbs_RT_ref();
00390 return(gibbs_mole() - RT * tmp);
00391 }
00392
00393
00394
00395
00396
00397
00398
00399
00400 doublereal PDSS::cpDelp_mole() const {
00401 doublereal tmp = cp_R_ref();
00402 return(cp_mole() - GasConstant * tmp);
00403 }
00404
00405
00406
00407
00408
00409
00410 doublereal PDSS::pressure() const {
00411 return (m_pres);
00412 }
00413
00414
00415
00416
00417
00418
00419
00420
00421 doublereal PDSS::thermalExpansionCoeff() const {
00422 throw CanteraError("PDSS::thermalExpansionCoeff()", "unimplemented");
00423 return (0.0);
00424 }
00425
00426
00427 doublereal PDSS::critTemperature() const {
00428 err("critTemperature()");
00429 return (0.0);
00430 }
00431
00432
00433 doublereal PDSS::critPressure() const {
00434 err("critPressure()");
00435 return (0.0);
00436 }
00437
00438
00439 doublereal PDSS::critDensity() const {
00440 err("critDensity()");
00441 return (0.0);
00442 }
00443
00444 void PDSS::setPressure(doublereal pres) {
00445 m_pres = pres;
00446 }
00447
00448
00449
00450
00451
00452
00453
00454
00455 doublereal PDSS::temperature() const {
00456 return m_temp;
00457 }
00458
00459 void PDSS::setTemperature(doublereal temp) {
00460 m_temp = temp;
00461 }
00462
00463 doublereal PDSS::molecularWeight() const {
00464 return m_mw;
00465 }
00466 void PDSS::setMolecularWeight(doublereal mw) {
00467 m_mw = mw;
00468 }
00469
00470 void PDSS::setState_TP(doublereal temp, doublereal pres) {
00471 err("setState_TP()");
00472 }
00473
00474 void PDSS::setState_TR(doublereal temp, doublereal rho) {
00475 err("setState_TR()");
00476 }
00477
00478
00479 doublereal PDSS::satPressure(doublereal t){
00480 err("satPressure()");
00481 return (0.0);
00482 }
00483
00484
00485 void PDSS::err(std::string msg) const {
00486 throw CanteraError("PDSS::" + msg, "unimplemented");
00487 }
00488
00489
00490 void PDSS::reportParams(int &kindex, int &type,
00491 doublereal * const c,
00492 doublereal &minTemp,
00493 doublereal &maxTemp,
00494 doublereal &refPressure) const {
00495 kindex = m_spindex;
00496 type = m_pdssType;
00497 minTemp = m_minTemp;
00498 maxTemp = m_maxTemp;
00499 refPressure = m_p0;
00500 }
00501 }