Cantera  2.4.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 //! Get the atomic weight of an element.
90 /*!
91  * Get the atomic weight of an element defined in Cantera by its symbol
92  * or by its name. This includes the named isotopes defined in Cantera.
93  *
94  * @param ename String, name or symbol of the element
95  * @return The atomic weight of the element
96  * @exception CanteraError If a match is not found, throws a CanteraError
97  */
98 double getElementWeight(const std::string& ename);
99 
100 //! Get the atomic weight of an element.
101 /*!
102  * Get the atomic weight of an element defined in Cantera by its atomic
103  * number. The named isotopes cannot be accessed from this function,
104  * since the atomic number of the isotopes is the same as the regular
105  * element from which they are derived.
106  *
107  * @param atomicNumber Integer, atomic number of the element
108  * @return The atomic weight of the element
109  * @exception CanteraError If a match is not found, throws a CanteraError
110  */
111 double getElementWeight(int atomicNumber);
112 
113 //! Get the symbol for an element
114 /*!
115  * Get the symbol for an element defined in Cantera by its name. This
116  * includes the named isotopes defined in Cantera.
117  *
118  * @param ename String, name of the element
119  * @return The symbol of the element in a string
120  * @exception CanteraError If a match is not found, throws a CanteraError
121  */
122 std::string getElementSymbol(const std::string& ename);
123 
124 //! Get the symbol for an element
125 /*!
126  * Get the symbol for an element defined in Cantera by its atomic
127  * number. The named isotopes cannot be accessed from this function,
128  * since the atomic number of the isotopes is the same as the regular
129  * element from which they are derived.
130  *
131  * @param atomicNumber Integer, atomic number of the element
132  * @return The symbol of the element in a string
133  * @exception CanteraError If a match is not found, throws a CanteraError
134  */
135 std::string getElementSymbol(int atomicNumber);
136 
137 //! Get the name of an element
138 /*!
139  * Get the name of an element defined in Cantera by its symbol. This
140  * includes the named isotopes defined in Cantera.
141  *
142  * @param ename String, symbol for the element
143  * @return The name of the element, in a string
144  * @exception CanteraError If a match is not found, throws a CanteraError
145  */
146 std::string getElementName(const std::string& ename);
147 
148 //! Get the name of an element
149 /*!
150  * Get the name of an element defined in Cantera by its atomic
151  * number. The named isotopes cannot be accessed from this function,
152  * since the atomic number of the isotopes is the same as the regular
153  * element from which they are derived.
154  *
155  * @param atomicNumber Integer, atomic number of the element
156  * @return The name of the element, in a string
157  * @exception CanteraError If a match is not found, throws a CanteraError
158  */
159 std::string getElementName(int atomicNumber);
160 
161 //! Get the atomic number for an element
162 /*!
163  * Get the atomic number of an element defined in Cantera by its symbol
164  * or name. This includes the named isotopes included in Cantera.
165  *
166  * @param ename String, name or symbol of the element
167  * @return The integer atomic number of the element
168  * @exception CanteraError If a match is not found, throws a CanteraError
169  */
170 int getAtomicNumber(const std::string& ename);
171 
172 //! Get the number of named elements defined in Cantera.
173 //! This array excludes named isotopes
174 int numElementsDefined();
175 
176 //! Get the number of named isotopes defined in Cantera.
177 //! This array excludes the named elements
178 int numIsotopesDefined();
179 
180 } // namespace
181 
182 #endif
int getAtomicNumber(const std::string &ename)
Get the atomic number for an element.
Definition: Elements.cpp:254
int numElementsDefined()
Get the number of named elements defined in Cantera.
Definition: Elements.cpp:277
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:166
int numIsotopesDefined()
Get the number of named isotopes defined in Cantera.
Definition: Elements.cpp:282
string getElementSymbol(const std::string &ename)
Get the symbol for an element.
Definition: Elements.cpp:198
Namespace for the Cantera kernel.
Definition: AnyMap.cpp:8
string getElementName(const std::string &ename)
Get the name of an element.
Definition: Elements.cpp:226