Cantera  2.3.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 // This file is part of Cantera. See License.txt in the top-level directory or
11 // at http://www.cantera.org/license.txt for license and copyright information.
12 
14 #include "cantera/base/ctml.h"
18 
19 using namespace std;
20 
21 namespace Cantera
22 {
23 
24 VPSSMgr_IdealGas::VPSSMgr_IdealGas(VPStandardStateTP* vp_ptr, MultiSpeciesThermo* spth) :
25  VPSSMgr(vp_ptr, spth)
26 {
29 }
30 
32  VPSSMgr(right.m_vptp_ptr, right.m_spthermo)
33 {
36  *this = right;
37 }
38 
39 VPSSMgr_IdealGas& VPSSMgr_IdealGas::operator=(const VPSSMgr_IdealGas& b)
40 {
41  if (&b == this) {
42  return *this;
43  }
45  return *this;
46 }
47 
49 {
50  return new VPSSMgr_IdealGas(*this);
51 }
52 
53 void VPSSMgr_IdealGas::getIntEnergy_RT(doublereal* urt) const
54 {
55  getEnthalpy_RT(urt);
56  for (size_t k = 0; k < m_kk; k++) {
57  urt[k] -= 1.0;
58  }
59 }
60 
61 void VPSSMgr_IdealGas::getStandardVolumes(doublereal* vol) const
62 {
63  copy(m_Vss.begin(), m_Vss.end(), vol);
64 }
65 
67 {
68  doublereal pp = log(m_plast / m_p0);
69  doublereal v = temperature() *GasConstant /m_plast;
70 
71  for (size_t k = 0; k < m_kk; k++) {
72  m_hss_RT[k] = m_h0_RT[k];
73  m_cpss_R[k] = m_cp0_R[k];
74  m_sss_R[k] = m_s0_R[k] - pp;
75  m_gss_RT[k] = m_hss_RT[k] - m_sss_R[k];
76  m_Vss[k] = v;
77  }
78 }
79 
80 PDSS* VPSSMgr_IdealGas::createInstallPDSS(size_t k, const XML_Node& speciesNode,
81  const XML_Node* const phaseNode_ptr)
82 {
83  const XML_Node* ss = speciesNode.findByName("standardState");
84  if (ss && ss->attrib("model") != "ideal_gas") {
85  throw CanteraError("VPSSMgr_IdealGas::createInstallPDSS",
86  "standardState model for species isn't "
87  "ideal_gas: " + speciesNode["name"]);
88  }
89  if (m_Vss.size() < k+1) {
90  m_Vss.resize(k+1, 0.0);
91  }
92 
93  shared_ptr<SpeciesThermoInterpType> stit(
94  newSpeciesThermoInterpType(speciesNode.child("thermo")));
95  stit->validate(speciesNode["name"]);
96  m_spthermo->install_STIT(k, stit);
97 
98  PDSS* kPDSS = new PDSS_IdealGas(m_vptp_ptr, k, speciesNode,
99  *phaseNode_ptr, true);
100 
102  return kPDSS;
103 }
104 
106 {
107  warn_deprecated("VPSSMgr_IdealGas::reportPDSSType",
108  "To be removed after Cantera 2.3.");
109  return cPDSS_IDEALGAS;
110 }
111 
113 {
114  warn_deprecated("VPSSMgr_IdealGas::reportVPSSMgrType",
115  "To be removed after Cantera 2.3.");
116  return cVPSSMGR_IDEALGAS;
117 }
118 
119 }
Header for a general species thermodynamic property manager for a phase (see MultiSpeciesThermo).
bool m_useTmpRefStateStorage
boolean indicating whether temporary reference state storage is used -> default is false ...
Definition: VPSSMgr.h:734
doublereal temperature() const
Return the temperature stored in the object.
Definition: VPSSMgr.h:487
CTML ("Cantera Markup Language") is the variant of XML that Cantera uses to store data...
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:695
virtual void _updateStandardStateThermo()
Updates the standard state thermodynamic functions at the current T and P of the solution.
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:773
Virtual base class for the classes that manage the calculation of standard state properties for all t...
Definition: VPSSMgr.h:228
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)
Definition: VPSSMgr.cpp:60
Declaration file for a derived class that handles the calculation of standard state thermo properties...
bool m_useTmpStandardStateStorage
boolean indicating whether temporary standard state storage is used -> default is false ...
Definition: VPSSMgr.h:757
size_t m_kk
Number of species in the phase.
Definition: VPSSMgr.h:704
Class XML_Node is a tree-based representation of the contents of an XML file.
Definition: xml.h:97
void warn_deprecated(const std::string &method, const std::string &extra)
Print a warning indicating that method is deprecated.
Definition: global.cpp:54
STL namespace.
virtual doublereal refPressure(size_t k=npos) const
The reference-state pressure for species k.
virtual VPSSMgr_enumType reportVPSSMgrType() const
This utility function reports the type of manager for the calculation of ss properties.
VPSSMgr_enumType
enum for VPSSMgr types that are responsible for calculating the species standard state and reference-...
Definition: mix_defs.h:119
virtual void getIntEnergy_RT(doublereal *urt) const
Returns the vector of nondimensional internal Energies of the standard state at the current temperatu...
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:742
VPStandardStateTP * m_vptp_ptr
Variable pressure ThermoPhase object.
Definition: VPSSMgr.h:707
MultiSpeciesThermo * m_spthermo
Pointer to reference state thermo calculator.
Definition: VPSSMgr.h:713
doublereal m_plast
The last pressure at which the Standard State thermodynamic properties were calculated at...
Definition: VPSSMgr.h:721
PDSS_enumType
Types of PDSS&#39;s.
Definition: mix_defs.h:105
Base class for exceptions thrown by Cantera classes.
Definition: ctexceptions.h:65
This is a filter class for ThermoPhase that implements some prepatory steps for efficiently handling ...
virtual VPSSMgr * duplMyselfAsVPSSMgr() const
Duplication routine for objects which derive from VPSSMgr.
Variable pressures SS calculator for ideal gas phases.
Definition: mix_defs.h:122
vector_fp m_Vss
Vector containing the species standard state volumes at T = m_tlast and P = m_plast.
Definition: VPSSMgr.h:777
XML_Node & child(const size_t n) const
Return a changeable reference to the n&#39;th child of the current node.
Definition: xml.cpp:546
vector_fp m_hss_RT
Vector containing the species Standard State enthalpies at T = m_tlast and P = m_plast.
Definition: VPSSMgr.h:761
vector_fp m_cpss_R
Vector containing the species Standard State constant pressure heat capacities at T = m_tlast and P =...
Definition: VPSSMgr.h:765
vector_fp m_h0_RT
Vector containing the species reference enthalpies at T = m_tlast and P = p_ref.
Definition: VPSSMgr.h:738
Header for factory functions to build instances of classes that manage the standard-state thermodynam...
std::string attrib(const std::string &attr) const
Function returns the value of an attribute.
Definition: xml.cpp:500
Virtual base class for a species with a pressure dependent standard state.
Definition: PDSS.h:176
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:161
doublereal m_p0
Reference pressure (Pa) must be the same for all species - defaults to 1 atm.
Definition: VPSSMgr.h:724
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 PDSS_enumType reportPDSSType(int index=-1) const
This utility function reports the type of parameterization used for the species with index number ind...
A species thermodynamic property manager for a phase.
Derived class for pressure dependent standard states of an ideal gas species.
Definition: PDSS_IdealGas.h:24
virtual void install_STIT(size_t index, shared_ptr< SpeciesThermoInterpType > stit)
Install a new species thermodynamic property parameterization for one species.
Namespace for the Cantera kernel.
Definition: application.cpp:29
vector_fp m_gss_RT
Vector containing the species Standard State Gibbs functions at T = m_tlast and P = m_plast...
Definition: VPSSMgr.h:769
VPSSMgr_IdealGas(VPStandardStateTP *vp_ptr, MultiSpeciesThermo *spth)
Basic constructor that initializes the object.
vector_fp m_s0_R
Vector containing the species reference entropies at T = m_tlast and P = p_ref.
Definition: VPSSMgr.h:750