Cantera  2.2.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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/ctml.h"
20 
21 using namespace std;
22 
23 namespace Cantera
24 {
25 
26 VPSSMgr_IdealGas::VPSSMgr_IdealGas(VPStandardStateTP* vp_ptr, SpeciesThermo* spth) :
27  VPSSMgr(vp_ptr, spth)
28 {
31 }
32 
34  VPSSMgr(right.m_vptp_ptr, right.m_spthermo)
35 {
38  *this = right;
39 }
40 
42 {
43  if (&b == this) {
44  return *this;
45  }
47  return *this;
48 }
49 
51 {
52  return new VPSSMgr_IdealGas(*this);
53 }
54 
55 void VPSSMgr_IdealGas::getIntEnergy_RT(doublereal* urt) const
56 {
57  getEnthalpy_RT(urt);
58  for (size_t k = 0; k < m_kk; k++) {
59  urt[k] -= 1.0;
60  }
61 }
62 
63 void VPSSMgr_IdealGas::getStandardVolumes(doublereal* vol) const
64 {
65  copy(m_Vss.begin(), m_Vss.end(), vol);
66 }
67 
69 {
70 
71  doublereal pp = log(m_plast / m_p0);
72  doublereal v = temperature() *GasConstant /m_plast;
73 
74  for (size_t k = 0; k < m_kk; k++) {
75  m_hss_RT[k] = m_h0_RT[k];
76  m_cpss_R[k] = m_cp0_R[k];
77  m_sss_R[k] = m_s0_R[k] - pp;
78  m_gss_RT[k] = m_hss_RT[k] - m_sss_R[k];
79  m_Vss[k] = v;
80  }
81 }
82 
83 void
84 VPSSMgr_IdealGas::initThermoXML(XML_Node& phaseNode, const std::string& id)
85 {
86  VPSSMgr::initThermoXML(phaseNode, id);
87 }
88 
89 PDSS*
90 VPSSMgr_IdealGas::createInstallPDSS(size_t k, const XML_Node& speciesNode,
91  const XML_Node* const phaseNode_ptr)
92 {
93  const XML_Node* ss = speciesNode.findByName("standardState");
94  if (ss) {
95  if (ss->attrib("model") != "ideal_gas") {
96  throw CanteraError("VPSSMgr_IdealGas::createInstallPDSS",
97  "standardState model for species isn't "
98  "ideal_gas: " + speciesNode["name"]);
99  }
100  }
101  if (m_Vss.size() < k+1) {
102  m_Vss.resize(k+1, 0.0);
103  }
104 
105  shared_ptr<SpeciesThermoInterpType> stit(
106  newSpeciesThermoInterpType(speciesNode.child("thermo")));
107  stit->validate(speciesNode["name"]);
108  m_spthermo->install_STIT(k, stit);
109 
110  PDSS* kPDSS = new PDSS_IdealGas(m_vptp_ptr, k, speciesNode,
111  *phaseNode_ptr, true);
112 
114  return kPDSS;
115 }
116 
118 {
119  return cPDSS_IDEALGAS;
120 }
121 
123 {
124  return cVPSSMGR_IDEALGAS;
125 }
126 
127 }
doublereal temperature() const
Return the temperature stored in the object.
Definition: VPSSMgr.h:494
bool m_useTmpRefStateStorage
Definition: VPSSMgr.h:746
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.
std::string attrib(const std::string &attr) const
Function returns the value of an attribute.
Definition: xml.cpp:527
SpeciesThermoInterpType * newSpeciesThermoInterpType(int type, double tlow, double thigh, double pref, const double *coeffs)
Create a new SpeciesThermoInterpType object given a corresponding constant.
vector_fp m_sss_R
Vector containing the species Standard State entropies at T = m_tlast and P = m_plast.
Definition: VPSSMgr.h:803
Virtual base class for the classes that manage the calculation of standard state properties for all t...
Definition: VPSSMgr.h:235
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:61
Declaration file for a derived class that handles the calculation of standard state thermo properties...
bool m_useTmpStandardStateStorage
Definition: VPSSMgr.h:779
virtual void initThermoXML(XML_Node &phaseNode, const std::string &id)
Finalize the thermo after all species have been entered.
Definition: VPSSMgr.cpp:383
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:711
virtual void install_STIT(size_t index, shared_ptr< SpeciesThermoInterpType > stit)=0
Install a new species thermodynamic property parameterization for one species.
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.
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:135
XML_Node & child(const size_t n) const
Return a changeable reference to the n'th child of the current node.
Definition: xml.cpp:573
Pure Virtual Base class for individual species reference state thermodynamic managers and text for th...
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:742
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:758
VPStandardStateTP * m_vptp_ptr
Variable pressure ThermoPhase object.
Definition: VPSSMgr.h:714
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:166
doublereal m_plast
The last pressure at which the Standard State thermodynamic properties were calculated at...
Definition: VPSSMgr.h:728
PDSS_enumType
Types of PDSS's.
Definition: mix_defs.h:121
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:99
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:138
vector_fp m_Vss
Vector containing the species standard state volumes at T = m_tlast and P = m_plast.
Definition: VPSSMgr.h:809
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:785
vector_fp m_cpss_R
Vector containing the species Standard State constant pressure heat capacities at T = m_tlast and P =...
Definition: VPSSMgr.h:791
vector_fp m_h0_RT
Definition: VPSSMgr.h:752
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:193
doublereal m_p0
Definition: VPSSMgr.h:734
const doublereal GasConstant
Universal Gas Constant. [J/kmol/K].
Definition: ct_defs.h:64
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:720
Derived class for pressure dependent standard states of an ideal gas species.
Definition: PDSS_IdealGas.h:25
vector_fp m_gss_RT
Vector containing the species Standard State Gibbs functions at T = m_tlast and P = m_plast...
Definition: VPSSMgr.h:797
vector_fp m_s0_R
Vector containing the species reference entropies at T = m_tlast and P = p_ref.
Definition: VPSSMgr.h:770