Cantera  2.3.0
PDSS_IonsFromNeutral.h
Go to the documentation of this file.
1 /**
2  * @file PDSS_IonsFromNeutral.h
3  * Declarations for the class PDSS_IonsFromNeutral (
4  * which handles calculations for a single ion in a fluid, whose properties
5  * are calculated from another neutral molecule.
6  * (see \ref pdssthermo and class \link Cantera::PDSS_IonsFromNeutral PDSS_IonsFromNeutral\endlink).
7  */
8 
9 // This file is part of Cantera. See License.txt in the top-level directory or
10 // at http://www.cantera.org/license.txt for license and copyright information.
11 
12 #ifndef CT_PDSS_IONSFROMNEUTRAL_H
13 #define CT_PDSS_IONSFROMNEUTRAL_H
14 
15 #include "PDSS.h"
16 
17 namespace Cantera
18 {
19 class ThermoPhase;
20 
21 //! Derived class for pressure dependent standard states of an ideal gas species
22 /*!
23  * @attention This class currently does not have any test cases or examples. Its
24  * implementation may be incomplete, and future changes to Cantera may
25  * unexpectedly cause this class to stop working. If you use this class,
26  * please consider contributing examples or test cases. In the absence of
27  * new tests or examples, this class may be deprecated and removed in a
28  * future version of Cantera. See
29  * https://github.com/Cantera/cantera/issues/267 for additional information.
30  *
31  * This class is for a single Ideal Gas species.
32  *
33  * @ingroup pdssthermo
34  */
36 {
37 public:
38  //! @name Constructors
39  //! @{
40 
41  //! Constructor
42  /*!
43  * @param tp Pointer to the ThermoPhase object pertaining to the phase
44  * @param spindex Species index of the species in the phase
45  */
46  PDSS_IonsFromNeutral(VPStandardStateTP* tp, size_t spindex);
47 
48  //! Constructor that initializes the object by examining the input file
49  //! of the ThermoPhase object
50  /*!
51  * This function calls the constructPDSSFile member function.
52  *
53  * @param tp Pointer to the ThermoPhase object pertaining to the phase
54  * @param spindex Species index of the species in the phase
55  * @param inputFile String name of the input file
56  * @param id String name of the phase in the input file. The default
57  * is the empty string, in which case the first phase in the
58  * file is used.
59  * @deprecated To be removed after Cantera 2.3.
60  */
61  PDSS_IonsFromNeutral(VPStandardStateTP* tp, size_t spindex,
62  const std::string& inputFile, const std::string& id = "");
63 
64  //! Constructor that initializes the object by examining the input file
65  //! of the ThermoPhase object
66  /*!
67  * This function calls the constructPDSSXML member function.
68  *
69  * @param vptp_ptr Pointer to the ThermoPhase object pertaining to the phase
70  * @param spindex Species index of the species in the phase
71  * @param speciesNode Reference to the species XML tree.
72  * @param phaseRef Reference to the XML tree containing the phase information.
73  * @param spInstalled Boolean indicating whether the species is installed
74  * yet or not.
75  */
76  PDSS_IonsFromNeutral(VPStandardStateTP* vptp_ptr, size_t spindex, const XML_Node& speciesNode,
77  const XML_Node& phaseRef, bool spInstalled);
78 
80  PDSS_IonsFromNeutral& operator=(const PDSS_IonsFromNeutral& b);
81  virtual PDSS* duplMyselfAsPDSS() const;
82  virtual void initAllPtrs(VPStandardStateTP* vptp_ptr, VPSSMgr* vpssmgr_ptr,
83  MultiSpeciesThermo* spthermo_ptr);
84 
85  //! @}
86  //! @name Molar Thermodynamic Properties of the Species Standard State in the Solution
87  //! @{
88 
89  // See PDSS.h for documentation of functions overridden from Class PDSS
90 
91  virtual doublereal enthalpy_RT() const;
92  virtual doublereal intEnergy_mole() const;
93  virtual doublereal entropy_R() const;
94 
95  /*!
96  * @copydoc PDSS::gibbs_RT()
97  *
98  * \f[
99  * \frac{\mu^o_k}{RT} = \sum_{m}{ \alpha_{m , k} \frac{\mu^o_{m}}{RT}} + ( 1 - \delta_{k,sp}) 2.0 \ln{2.0}
100  * \f]
101  *
102  * *m* is the neutral molecule species index. \f$ \alpha_{m , k} \f$ is the
103  * stoiciometric coefficient for the neutral molecule, *m*, that creates the
104  * thermodynamics for the ionic species *k*. A factor \f$ 2.0 \ln{2.0} \f$
105  * is added to all ions except for the species ionic species, which in this
106  * case is the single anion species, with species index *sp*.
107  */
108  virtual doublereal gibbs_RT() const;
109  virtual doublereal cp_R() const;
110  virtual doublereal molarVolume() const;
111  virtual doublereal density() const;
112 
113  //! @}
114  //! @name Properties of the Reference State of the Species in the Solution
115  //! @{
116 
117  virtual doublereal gibbs_RT_ref() const;
118  virtual doublereal enthalpy_RT_ref() const;
119  virtual doublereal entropy_R_ref() const;
120  virtual doublereal cp_R_ref() const;
121  virtual doublereal molarVolume_ref() const;
122 
123  //! @}
124  //! @name Mechanical Equation of State Properties
125  //! @{
126 
127  virtual void setTemperature(doublereal temp);
128  virtual doublereal temperature() const;
129  virtual void setState_TP(doublereal temp, doublereal pres);
130  virtual void setState_TR(doublereal temp, doublereal rho);
131 
132  //! @}
133  //! @name Initialization of the Object
134  //! @{
135 
136  //! Initialization of a PDSS object using an input XML file.
137  /*!
138  * This routine is a precursor to constructPDSSXML(XML_Node*)
139  * routine, which does most of the work.
140  *
141  * @param vptp_ptr Pointer to the Variable pressure ThermoPhase object
142  * @param spindex Species index within the phase
143  * @param inputFile XML file containing the description of the phase
144  * @param id Optional parameter identifying the name of the
145  * phase. If none is given, the first XML
146  * phase element will be used.
147  * @deprecated To be removed after Cantera 2.3.
148  */
149  void constructPDSSFile(VPStandardStateTP* vptp_ptr, size_t spindex,
150  const std::string& inputFile, const std::string& id);
151 
152  //! Initialization of a PDSS object using an XML tree
153  /*!
154  * This routine is a driver for the initialization of the object.
155  *
156  * basic logic:
157  * - initThermo() (cascade)
158  * - getStuff from species Part of XML file
159  * - initThermoXML(phaseNode) (cascade)
160  *
161  * @param vptp_ptr Pointer to the Variable pressure ThermoPhase object
162  * @param spindex Species index within the phase
163  * @param speciesNode Reference to the phase Information for the species
164  * that this standard state refers to
165  * @param phaseNode Reference to the phase Information for the phase
166  * that owns this species.
167  * @param id Optional parameter identifying the name of the
168  * phase. If none is given, the first XML
169  * phase element will be used.
170  */
171  void constructPDSSXML(VPStandardStateTP* vptp_ptr, size_t spindex,
172  const XML_Node& speciesNode,
173  const XML_Node& phaseNode, const std::string& id);
174 
175  virtual void initThermo();
176  //@}
177 
178 protected:
179  //! Pointer to the Neutral Molecule ThermoPhase object
180  /*!
181  * This is a shallow pointer.
182  */
184 
185 public:
186  //! Number of neutral molecule species that make up the stoichiometric
187  //! vector for this species, in terms of calculating thermodynamic functions
188  size_t numMult_;
189 
190  //! Vector of species indices in the neutral molecule ThermoPhase
191  std::vector<size_t> idNeutralMoleculeVec;
192 
193  //! Stoichiometric coefficient for this species using the Neutral Molecule
194  //! Species in the vector idNeutralMoleculeVec
196 
197  //! Add 2RTln2 to the entropy and Gibbs free energies for this species
198  /*!
199  * This is true if this species is not the special species
200  */
202 
203  //! Vector of length equal to the number of species in the neutral molecule phase
204  mutable vector_fp tmpNM;
205 
206  //! True if this species is the special species
208 };
209 }
210 
211 #endif
virtual doublereal temperature() const
Return the current stored temperature.
virtual PDSS * duplMyselfAsPDSS() const
Duplication routine for objects which inherit from PDSS.
std::vector< size_t > idNeutralMoleculeVec
Vector of species indices in the neutral molecule ThermoPhase.
vector_fp factorVec
Stoichiometric coefficient for this species using the Neutral Molecule Species in the vector idNeutra...
size_t numMult_
Number of neutral molecule species that make up the stoichiometric vector for this species...
Derived class for pressure dependent standard states of an ideal gas species.
Virtual base class for the classes that manage the calculation of standard state properties for all t...
Definition: VPSSMgr.h:228
virtual doublereal density() const
Return the standard state density at standard state.
virtual void setState_TP(doublereal temp, doublereal pres)
Set the internal temperature and pressure.
vector_fp tmpNM
Vector of length equal to the number of species in the neutral molecule phase.
Class XML_Node is a tree-based representation of the contents of an XML file.
Definition: xml.h:97
virtual void setTemperature(doublereal temp)
Set the internal temperature.
virtual void setState_TR(doublereal temp, doublereal rho)
Set the internal temperature and density.
virtual doublereal enthalpy_RT_ref() const
Return the molar enthalpy divided by RT at reference pressure.
virtual doublereal cp_R() const
Return the molar const pressure heat capacity divided by RT.
Base class for a phase with thermodynamic properties.
Definition: ThermoPhase.h:93
Declarations for the virtual base class PDSS (pressure dependent standard state) which handles calcul...
virtual doublereal gibbs_RT() const
Return the molar Gibbs free energy divided by RT.
Base class for PDSS classes which compute nondimensional properties directly.
Definition: PDSS.h:662
virtual doublereal entropy_R_ref() const
Return the molar entropy divided by R at reference pressure.
void constructPDSSFile(VPStandardStateTP *vptp_ptr, size_t spindex, const std::string &inputFile, const std::string &id)
Initialization of a PDSS object using an input XML file.
virtual doublereal enthalpy_RT() const
Return the standard state molar enthalpy divided by RT.
void constructPDSSXML(VPStandardStateTP *vptp_ptr, size_t spindex, const XML_Node &speciesNode, const XML_Node &phaseNode, const std::string &id)
Initialization of a PDSS object using an XML tree.
virtual doublereal cp_R_ref() const
Return the molar heat capacity divided by R at reference pressure.
virtual doublereal molarVolume_ref() const
Return the molar volume at reference pressure.
This is a filter class for ThermoPhase that implements some prepatory steps for efficiently handling ...
PDSS_IonsFromNeutral(VPStandardStateTP *tp, size_t spindex)
Constructor.
virtual doublereal gibbs_RT_ref() const
Return the molar Gibbs free energy divided by RT at reference pressure.
const ThermoPhase * neutralMoleculePhase_
Pointer to the Neutral Molecule ThermoPhase object.
virtual doublereal intEnergy_mole() const
Return the molar internal Energy in units of J kmol-1.
virtual void initThermo()
Initialization routine for all of the shallow pointers.
std::vector< double > vector_fp
Turn on the use of stl vectors for the basic array type within cantera Vector of doubles.
Definition: ct_defs.h:157
Virtual base class for a species with a pressure dependent standard state.
Definition: PDSS.h:176
virtual doublereal entropy_R() const
Return the standard state entropy divided by RT.
virtual void initAllPtrs(VPStandardStateTP *vptp_ptr, VPSSMgr *vpssmgr_ptr, MultiSpeciesThermo *spthermo_ptr)
Initialize or Reinitialize all shallow pointers in the object.
virtual doublereal molarVolume() const
Return the molar volume at standard state.
A species thermodynamic property manager for a phase.
bool add2RTln2_
Add 2RTln2 to the entropy and Gibbs free energies for this species.
Namespace for the Cantera kernel.
Definition: application.cpp:29
int specialSpecies_
True if this species is the special species.