Cantera  2.1.2
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  VPSSMgr(right.m_vptp_ptr, right.m_spthermo)
37 {
40  *this = right;
41 }
42 
44 {
45  if (&b == this) {
46  return *this;
47  }
49  return *this;
50 }
51 
53 {
54  return new VPSSMgr_IdealGas(*this);
55 }
56 
57 void VPSSMgr_IdealGas::getIntEnergy_RT(doublereal* urt) const
58 {
59  getEnthalpy_RT(urt);
60  for (size_t k = 0; k < m_kk; k++) {
61  urt[k] -= 1.0;
62  }
63 }
64 
65 void VPSSMgr_IdealGas::getStandardVolumes(doublereal* vol) const
66 {
67  copy(m_Vss.begin(), m_Vss.end(), vol);
68 }
69 
71 {
72 
73  doublereal pp = log(m_plast / m_p0);
74  doublereal v = temperature() *GasConstant /m_plast;
75 
76  for (size_t k = 0; k < m_kk; k++) {
77  m_hss_RT[k] = m_h0_RT[k];
78  m_cpss_R[k] = m_cp0_R[k];
79  m_sss_R[k] = m_s0_R[k] - pp;
80  m_gss_RT[k] = m_hss_RT[k] - m_sss_R[k];
81  m_Vss[k] = v;
82  }
83 }
84 
85 void
86 VPSSMgr_IdealGas::initThermoXML(XML_Node& phaseNode, const std::string& id)
87 {
88  VPSSMgr::initThermoXML(phaseNode, id);
89 }
90 
91 PDSS*
92 VPSSMgr_IdealGas::createInstallPDSS(size_t k, const XML_Node& speciesNode,
93  const XML_Node* const phaseNode_ptr)
94 {
95  //VPSSMgr::installSpecies(k, speciesNode, phaseNode_ptr);
96  const XML_Node* ss = speciesNode.findByName("standardState");
97  if (ss) {
98  std::string model = (*ss)["model"];
99  if (model != "ideal_gas") {
100  throw CanteraError("VPSSMgr_IdealGas::initThermoXML",
101  "standardState model for species isn't "
102  "ideal_gas: " + speciesNode.name());
103  }
104  }
105  if (m_Vss.size() < k+1) {
106  m_Vss.resize(k+1, 0.0);
107  }
108 
110  f->installThermoForSpecies(k, speciesNode,(ThermoPhase*) m_vptp_ptr, *m_spthermo, phaseNode_ptr);
111 
112  PDSS* kPDSS = new PDSS_IdealGas(m_vptp_ptr, k, speciesNode,
113  *phaseNode_ptr, true);
114 
116  return kPDSS;
117 }
118 
120 {
121  return cPDSS_IDEALGAS;
122 }
123 
125 {
126  return cVPSSMGR_IDEALGAS;
127 }
128 
129 }
Factory to build instances of classes that manage the standard-state thermodynamic properties of a se...
doublereal temperature() const
Return the temperature stored in the object.
Definition: VPSSMgr.h:499
bool m_useTmpRefStateStorage
Definition: VPSSMgr.h:751
CTML ("Cantera Markup Language") is the variant of XML that Cantera uses to store data...
virtual void _updateStandardStateThermo()
Updates the standard state thermodynamic functions at the current T and P of the solution.
vector_fp m_sss_R
Vector containing the species Standard State entropies at T = m_tlast and P = m_plast.
Definition: VPSSMgr.h:808
Various templated functions that carry out common vector operations (see Templated Utility Functions)...
Virtual base class for the classes that manage the calculation of standard state properties for all t...
Definition: VPSSMgr.h:238
virtual PDSS * createInstallPDSS(size_t k, const XML_Node &speciesNode, const XML_Node *const phaseNode_ptr)
Create and install an ideal gas standard state manager for one species within this object...
VPSSMgr & operator=(const VPSSMgr &right)
Assignment operator.
Definition: VPSSMgr.cpp:67
Declaration file for a derived class that handles the calculation of standard state thermo properties...
bool m_useTmpStandardStateStorage
Definition: VPSSMgr.h:784
virtual void initThermoXML(XML_Node &phaseNode, const std::string &id)
Finalize the thermo after all species have been entered.
Definition: VPSSMgr.cpp:393
static SpeciesThermoFactory * factory()
Static method to return an instance of this class.
virtual PDSS_enumType reportPDSSType(int index=-1) const
This utility function reports the type of parameterization used for the species with index number ind...
size_t m_kk
Number of species in the phase.
Definition: VPSSMgr.h:716
Class XML_Node is a tree-based representation of the contents of an XML file.
Definition: xml.h:100
virtual VPSSMgr_enumType reportVPSSMgrType() const
This utility function reports the type of manager for the calculation of ss properties.
VPSSMgr_IdealGas & operator=(const VPSSMgr_IdealGas &right)
Assignment operator.
VPSSMgr_IdealGas(VPStandardStateTP *vp_ptr, SpeciesThermo *spth)
Basic constructor that initializes the object.
void installThermoForSpecies(size_t k, const XML_Node &speciesNode, ThermoPhase *th_ptr, SpeciesThermo &spthermo, const XML_Node *phaseNode_ptr=0) const
Install a species thermodynamic property parameterization for the reference state for one species int...
Pure Virtual base class for the species thermo manager classes.
VPSSMgr_enumType
enum for VPSSMgr types that are responsible for calculating the species standard state and reference-...
Definition: mix_defs.h:133
Base class for a phase with thermodynamic properties.
Definition: ThermoPhase.h:101
const XML_Node * findByName(const std::string &nm, int depth=100000) const
This routine carries out a recursive search for an XML node based on the name of the node...
Definition: xml.cpp:754
Declarations for the class PDSS_IdealGas (pressure dependent standard state) which handles calculatio...
vector_fp m_cp0_R
Vector containing the species reference constant pressure heat capacities at T = m_tlast and P = p_re...
Definition: VPSSMgr.h:763
VPStandardStateTP * m_vptp_ptr
Variable pressure ThermoPhase object.
Definition: VPSSMgr.h:719
virtual void initThermoXML(XML_Node &phaseNode, const std::string &id)
Finalize the thermo after all species have been entered.
virtual void getEnthalpy_RT(doublereal *hrt) const
Get the nondimensional Enthalpy functions for the species at their standard states at the current T a...
Definition: VPSSMgr.cpp:173
doublereal m_plast
The last pressure at which the Standard State thermodynamic properties were calculated at...
Definition: VPSSMgr.h:733
PDSS_enumType
Types of PDSS's.
Definition: mix_defs.h:119
std::string name() const
Returns the name of the XML node.
Definition: xml.h:390
Classes providing support for XML data files.
virtual doublereal refPressure(size_t k=npos) const =0
The reference-state pressure for species k.
Base class for exceptions thrown by Cantera classes.
Definition: ctexceptions.h:68
This is a filter class for ThermoPhase that implements some prepatory steps for efficiently handling ...
Variable pressures SS calculator for ideal gas phases.
Definition: mix_defs.h:136
vector_fp m_Vss
Vector containing the species standard state volumes at T = m_tlast and P = m_plast.
Definition: VPSSMgr.h:814
virtual void getIntEnergy_RT(doublereal *urt) const
Returns the vector of nondimensional internal Energies of the standard state at the current temperatu...
vector_fp m_hss_RT
Vector containing the species Standard State enthalpies at T = m_tlast and P = m_plast.
Definition: VPSSMgr.h:790
vector_fp m_cpss_R
Vector containing the species Standard State constant pressure heat capacities at T = m_tlast and P =...
Definition: VPSSMgr.h:796
vector_fp m_h0_RT
Definition: VPSSMgr.h:757
Header for factory to build instances of classes that manage the standard-state thermodynamic propert...
Virtual base class for a species with a pressure dependent standard state.
Definition: PDSS.h:195
doublereal m_p0
Definition: VPSSMgr.h:739
const doublereal GasConstant
Universal Gas Constant. [J/kmol/K].
Definition: ct_defs.h:66
A VPSSMgr where all species in the phase obey an ideal gas equation of state.
virtual VPSSMgr * duplMyselfAsVPSSMgr() const
Duplication routine for objects which derive from VPSSMgr.
SpeciesThermo * m_spthermo
Pointer to reference state thermo calculator.
Definition: VPSSMgr.h:725
Derived class for pressure dependent standard states of an ideal gas species.
Definition: PDSS_IdealGas.h:28
vector_fp m_gss_RT
Vector containing the species Standard State Gibbs functions at T = m_tlast and P = m_plast...
Definition: VPSSMgr.h:802
vector_fp m_s0_R
Vector containing the species reference entropies at T = m_tlast and P = p_ref.
Definition: VPSSMgr.h:775