Cantera  2.3.0
Elements.h
Go to the documentation of this file.
1 /**
2  * @file Elements.h
3  * Contains the getElementWeight function and the definitions of element
4  * constraint types.
5  */
6 
7 // This file is part of Cantera. See License.txt in the top-level directory or
8 // at http://www.cantera.org/license.txt for license and copyright information.
9 
10 #ifndef CT_ELEMENTS_H
11 #define CT_ELEMENTS_H
12 
13 #include "cantera/base/ct_defs.h"
14 
15 namespace Cantera
16 {
17 
18 /*!
19  * @name Types of Element Constraint Equations
20  *
21  * There may be several different types of element constraints handled by the
22  * equilibrium program and by Cantera in other contexts. These defines are used
23  * to assign each constraint to one category.
24  * @{
25  */
26 
27 //! An element constraint that is current turned off
28 #define CT_ELEM_TYPE_TURNEDOFF -1
29 
30 //! Normal element constraint consisting of positive coefficients for the
31 //! formula matrix.
32 /*!
33  * All species have positive coefficients within the formula matrix. With this
34  * constraint, we may employ various strategies to handle small values of the
35  * element number successfully.
36  */
37 #define CT_ELEM_TYPE_ABSPOS 0
38 
39 //! This refers to conservation of electrons
40 /*!
41  * Electrons may have positive or negative values in the Formula matrix.
42  */
43 #define CT_ELEM_TYPE_ELECTRONCHARGE 1
44 
45 //! This refers to a charge neutrality of a single phase
46 /*!
47  * Charge neutrality may have positive or negative values in the Formula matrix.
48  */
49 #define CT_ELEM_TYPE_CHARGENEUTRALITY 2
50 
51 //! Constraint associated with maintaining a fixed lattice stoichiometry in a solid
52 /*!
53  * The constraint may have positive or negative values. The lattice 0 species
54  * will have negative values while higher lattices will have positive values
55  */
56 #define CT_ELEM_TYPE_LATTICERATIO 3
57 
58 //! Constraint associated with maintaining frozen kinetic equilibria in
59 //! some functional groups within molecules
60 /*!
61  * We seek here to say that some functional groups or ionic states should be
62  * treated as if they are separate elements given the time scale of the problem.
63  * This will be abs positive constraint. We have not implemented any examples
64  * yet. A requirement will be that we must be able to add and subtract these
65  * constraints.
66  */
67 #define CT_ELEM_TYPE_KINETICFROZEN 4
68 
69 //! Constraint associated with the maintenance of a surface phase
70 /*!
71  * We don't have any examples of this yet either. However, surfaces only exist
72  * because they are interfaces between bulk layers. If we want to treat surfaces
73  * within thermodynamic systems we must come up with a way to constrain their
74  * total number.
75  */
76 #define CT_ELEM_TYPE_SURFACECONSTRAINT 5
77 
78 //! Other constraint equations
79 /*!
80  * currently there are none
81  */
82 #define CT_ELEM_TYPE_OTHERCONSTRAINT 6
83 //@}
84 
85 //! Number indicating we don't know the entropy of the element in its most
86 //! stable state at 298.15 K and 1 bar.
87 #define ENTROPY298_UNKNOWN -123456789.
88 
89 //! Function to look up an atomic weight
90 /*!
91  * @deprecated Replaced with getElementWeight(). To be removed after Cantera 2.3
92  */
93 double LookupWtElements(const std::string& ename);
94 
95 //! Get the atomic weight of an element.
96 /*!
97  * Get the atomic weight of an element defined in Cantera by its symbol
98  * or by its name. This includes the named isotopes defined in Cantera.
99  *
100  * @param ename String, name or symbol of the element
101  * @return The atomic weight of the element
102  * @exception CanteraError If a match is not found, throws a CanteraError
103  */
104 double getElementWeight(const std::string& ename);
105 
106 //! Get the atomic weight of an element.
107 /*!
108  * Get the atomic weight of an element defined in Cantera by its atomic
109  * number. The named isotopes cannot be accessed from this function,
110  * since the atomic number of the isotopes is the same as the regular
111  * element from which they are derived.
112  *
113  * @param atomicNumber Integer, atomic number of the element
114  * @return The atomic weight of the element
115  * @exception CanteraError If a match is not found, throws a CanteraError
116  */
117 double getElementWeight(int atomicNumber);
118 
119 //! Get the symbol for an element
120 /*!
121  * Get the symbol for an element defined in Cantera by its name. This
122  * includes the named isotopes defined in Cantera.
123  *
124  * @param ename String, name of the element
125  * @return The symbol of the element in a string
126  * @exception CanteraError If a match is not found, throws a CanteraError
127  */
128 std::string getElementSymbol(const std::string& ename);
129 
130 //! Get the symbol for an element
131 /*!
132  * Get the symbol for an element defined in Cantera by its atomic
133  * number. The named isotopes cannot be accessed from this function,
134  * since the atomic number of the isotopes is the same as the regular
135  * element from which they are derived.
136  *
137  * @param atomicNumber Integer, atomic number of the element
138  * @return The symbol of the element in a string
139  * @exception CanteraError If a match is not found, throws a CanteraError
140  */
141 std::string getElementSymbol(int atomicNumber);
142 
143 //! Get the name of an element
144 /*!
145  * Get the name of an element defined in Cantera by its symbol. This
146  * includes the named isotopes defined in Cantera.
147  *
148  * @param ename String, symbol for the element
149  * @return The name of the element, in a string
150  * @exception CanteraError If a match is not found, throws a CanteraError
151  */
152 std::string getElementName(const std::string& ename);
153 
154 //! Get the name of an element
155 /*!
156  * Get the name of an element defined in Cantera by its atomic
157  * number. The named isotopes cannot be accessed from this function,
158  * since the atomic number of the isotopes is the same as the regular
159  * element from which they are derived.
160  *
161  * @param atomicNumber Integer, atomic number of the element
162  * @return The name of the element, in a string
163  * @exception CanteraError If a match is not found, throws a CanteraError
164  */
165 std::string getElementName(int atomicNumber);
166 
167 //! Get the atomic number for an element
168 /*!
169  * Get the atomic number of an element defined in Cantera by its symbol
170  * or name. This includes the named isotopes included in Cantera.
171  *
172  * @param ename String, name or symbol of the element
173  * @return The integer atomic number of the element
174  * @exception CanteraError If a match is not found, throws a CanteraError
175  */
176 int getAtomicNumber(const std::string& ename);
177 
178 //! Get the number of named elements defined in Cantera.
179 //! This array excludes named isotopes
180 int numElementsDefined();
181 
182 //! Get the number of named isotopes defined in Cantera.
183 //! This array excludes the named elements
184 int numIsotopesDefined();
185 
186 } // namespace
187 
188 #endif
int getAtomicNumber(const std::string &ename)
Get the atomic number for an element.
Definition: Elements.cpp:260
double LookupWtElements(const std::string &ename)
Function to look up an atomic weight.
Definition: Elements.cpp:165
int numElementsDefined()
Get the number of named elements defined in Cantera.
Definition: Elements.cpp:283
This file contains definitions of terms that are used in internal routines and are unlikely to need m...
double getElementWeight(const std::string &ename)
Get the atomic weight of an element.
Definition: Elements.cpp:172
int numIsotopesDefined()
Get the number of named isotopes defined in Cantera.
Definition: Elements.cpp:288
string getElementSymbol(const std::string &ename)
Get the symbol for an element.
Definition: Elements.cpp:204
Namespace for the Cantera kernel.
Definition: application.cpp:29
string getElementName(const std::string &ename)
Get the name of an element.
Definition: Elements.cpp:232