VPSSMgr_IdealGas.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifdef WIN32
00022 #pragma warning(disable:4786)
00023 #pragma warning(disable:4503)
00024 #endif
00025
00026 #include "VPSSMgr_IdealGas.h"
00027 #include "utilities.h"
00028 #include "xml.h"
00029 #include "ctml.h"
00030 #include "SpeciesThermoFactory.h"
00031 #include "PDSS_IdealGas.h"
00032
00033 using namespace std;
00034 using namespace ctml;
00035
00036 namespace Cantera {
00037
00038 VPSSMgr_IdealGas::VPSSMgr_IdealGas(VPStandardStateTP *vp_ptr, SpeciesThermo *spth) :
00039 VPSSMgr(vp_ptr, spth)
00040 {
00041 m_useTmpRefStateStorage = true;
00042 m_useTmpStandardStateStorage = true;
00043 }
00044
00045
00046 VPSSMgr_IdealGas::~VPSSMgr_IdealGas()
00047 {
00048 }
00049
00050 VPSSMgr_IdealGas::VPSSMgr_IdealGas(const VPSSMgr_IdealGas &right) :
00051 VPSSMgr(right.m_vptp_ptr, right.m_spthermo)
00052 {
00053 m_useTmpRefStateStorage = true;
00054 m_useTmpStandardStateStorage = true;
00055 *this = right;
00056 }
00057
00058
00059 VPSSMgr_IdealGas& VPSSMgr_IdealGas::operator=(const VPSSMgr_IdealGas &b)
00060 {
00061 if (&b == this) return *this;
00062 VPSSMgr::operator=(b);
00063 return *this;
00064 }
00065
00066 VPSSMgr *VPSSMgr_IdealGas::duplMyselfAsVPSSMgr() const {
00067 VPSSMgr_IdealGas *vpm = new VPSSMgr_IdealGas(*this);
00068 return (VPSSMgr *) vpm;
00069 }
00070
00071
00072 void VPSSMgr_IdealGas::getIntEnergy_RT(doublereal* urt) const {
00073 getEnthalpy_RT(urt);
00074 for (int k = 0; k < m_kk; k++) {
00075 urt[k] -= 1.0;
00076 }
00077 }
00078
00079 void VPSSMgr_IdealGas::getStandardVolumes(doublereal* vol) const
00080 {
00081 copy(m_Vss.begin(), m_Vss.end(), vol);
00082 }
00083
00084 void VPSSMgr_IdealGas::_updateStandardStateThermo() {
00085
00086 doublereal pp = log(m_plast / m_p0);
00087 doublereal v = temperature() *GasConstant /m_plast;
00088
00089 for (int k = 0; k < m_kk; k++) {
00090 m_hss_RT[k] = m_h0_RT[k];
00091 m_cpss_R[k] = m_cp0_R[k];
00092 m_sss_R[k] = m_s0_R[k] - pp;
00093 m_gss_RT[k] = m_hss_RT[k] - m_sss_R[k];
00094 m_Vss[k] = v;
00095 }
00096 }
00097
00098 void
00099 VPSSMgr_IdealGas::initThermoXML(XML_Node& phaseNode, std::string id) {
00100 VPSSMgr::initThermoXML(phaseNode, id);
00101 }
00102
00103 PDSS *
00104 VPSSMgr_IdealGas::createInstallPDSS(int k, const XML_Node& speciesNode,
00105 const XML_Node * const phaseNode_ptr) {
00106
00107 const XML_Node *ss = speciesNode.findByName("standardState");
00108 if (ss) {
00109 std::string model = (*ss)["model"];
00110 if (model != "ideal_gas") {
00111 throw CanteraError("VPSSMgr_IdealGas::initThermoXML",
00112 "standardState model for species isn't "
00113 "ideal_gas: " + speciesNode.name());
00114 }
00115 }
00116 if ((int) m_Vss.size() < k+1) {
00117 m_Vss.resize(k+1, 0.0);
00118 }
00119
00120 SpeciesThermoFactory* f = SpeciesThermoFactory::factory();
00121 f->installThermoForSpecies(k, speciesNode,(ThermoPhase *) m_vptp_ptr, *m_spthermo, phaseNode_ptr);
00122
00123 PDSS *kPDSS = new PDSS_IdealGas(m_vptp_ptr, k, speciesNode,
00124 *phaseNode_ptr, true);
00125
00126 m_p0 = m_spthermo->refPressure(k);
00127 return kPDSS;
00128 }
00129
00130
00131 PDSS_enumType VPSSMgr_IdealGas::reportPDSSType(int k) const {
00132 return cPDSS_IDEALGAS;
00133 }
00134
00135
00136 VPSSMgr_enumType VPSSMgr_IdealGas::reportVPSSMgrType() const {
00137 return cVPSSMGR_IDEALGAS;
00138 }
00139
00140 }