Cantera  2.0
VPSSMgr_IdealGas.cpp
Go to the documentation of this file.
1 /**
2  * @file VPSSMgr_IdealGas.cpp
3  * Definition file for a derived class that handles the calculation
4  * of standard state thermo properties for
5  * a set of species which have an Ideal Gas dependence
6  * (see \ref thermoprops and
7  * class \link Cantera::VPSSMgr_IdealGas VPSSMgr_IdealGas\endlink).
8  */
9 /*
10  * Copyright (2005) Sandia Corporation. Under the terms of
11  * Contract DE-AC04-94AL85000 with Sandia Corporation, the
12  * U.S. Government retains certain rights in this software.
13  */
14 
16 #include "cantera/base/utilities.h"
17 #include "cantera/base/xml.h"
18 #include "cantera/base/ctml.h"
21 
22 using namespace std;
23 using namespace ctml;
24 
25 namespace Cantera
26 {
27 
28 VPSSMgr_IdealGas::VPSSMgr_IdealGas(VPStandardStateTP* vp_ptr, SpeciesThermo* spth) :
29  VPSSMgr(vp_ptr, spth)
30 {
33 }
34 
36 {
37 }
38 
40  VPSSMgr(right.m_vptp_ptr, right.m_spthermo)
41 {
44  *this = right;
45 }
46 
47 
49 {
50  if (&b == this) {
51  return *this;
52  }
54  return *this;
55 }
56 
58 {
59  VPSSMgr_IdealGas* vpm = new VPSSMgr_IdealGas(*this);
60  return (VPSSMgr*) vpm;
61 }
62 
63 
64 void VPSSMgr_IdealGas::getIntEnergy_RT(doublereal* urt) const
65 {
66  getEnthalpy_RT(urt);
67  for (size_t k = 0; k < m_kk; k++) {
68  urt[k] -= 1.0;
69  }
70 }
71 
72 void VPSSMgr_IdealGas::getStandardVolumes(doublereal* vol) const
73 {
74  copy(m_Vss.begin(), m_Vss.end(), vol);
75 }
76 
78 {
79 
80  doublereal pp = log(m_plast / m_p0);
81  doublereal v = temperature() *GasConstant /m_plast;
82 
83  for (size_t k = 0; k < m_kk; k++) {
84  m_hss_RT[k] = m_h0_RT[k];
85  m_cpss_R[k] = m_cp0_R[k];
86  m_sss_R[k] = m_s0_R[k] - pp;
87  m_gss_RT[k] = m_hss_RT[k] - m_sss_R[k];
88  m_Vss[k] = v;
89  }
90 }
91 
92 void
93 VPSSMgr_IdealGas::initThermoXML(XML_Node& phaseNode, std::string id)
94 {
95  VPSSMgr::initThermoXML(phaseNode, id);
96 }
97 
98 PDSS*
99 VPSSMgr_IdealGas::createInstallPDSS(size_t k, const XML_Node& speciesNode,
100  const XML_Node* const phaseNode_ptr)
101 {
102  //VPSSMgr::installSpecies(k, speciesNode, phaseNode_ptr);
103  const XML_Node* ss = speciesNode.findByName("standardState");
104  if (ss) {
105  std::string model = (*ss)["model"];
106  if (model != "ideal_gas") {
107  throw CanteraError("VPSSMgr_IdealGas::initThermoXML",
108  "standardState model for species isn't "
109  "ideal_gas: " + speciesNode.name());
110  }
111  }
112  if (m_Vss.size() < k+1) {
113  m_Vss.resize(k+1, 0.0);
114  }
115 
117  f->installThermoForSpecies(k, speciesNode,(ThermoPhase*) m_vptp_ptr, *m_spthermo, phaseNode_ptr);
118 
119  PDSS* kPDSS = new PDSS_IdealGas(m_vptp_ptr, k, speciesNode,
120  *phaseNode_ptr, true);
121 
123  return kPDSS;
124 }
125 
126 
128 {
129  return cPDSS_IDEALGAS;
130 }
131 
132 
134 {
135  return cVPSSMGR_IDEALGAS;
136 }
137 
138 }