Cantera 2.6.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 https://cantera.org/license.txt for license and copyright information.
9
10#ifndef CT_ELEMENTS_H
11#define CT_ELEMENTS_H
12
14
15namespace 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 for ename is not found or the
97 * element has no stable isotopes, and therefore no standard atomic weight
98 */
99double getElementWeight(const std::string& ename);
100
101//! Get the atomic weight of an element.
102/*!
103 * Get the atomic weight of an element defined in Cantera by its atomic
104 * number. The named isotopes cannot be accessed from this function,
105 * since the atomic number of the isotopes is the same as the regular
106 * element from which they are derived.
107 *
108 * @param atomicNumber Integer, atomic number of the element
109 * @return The atomic weight of the element
110 * @exception IndexError if the passed atomic number less than 1 or
111 * larger than the number of elements defined
112 * @exception CanteraError if the element has no stable isotopes, and
113 * therefore no standard atomic weight
114 */
115double getElementWeight(int atomicNumber);
116
117//! Get the symbol for an element
118/*!
119 * Get the symbol for an element defined in Cantera by its name. This
120 * includes the named isotopes defined in Cantera.
121 *
122 * @param ename String, name of the element
123 * @return The symbol of the element in a string
124 * @exception CanteraError if a match for ename is not found
125 */
126std::string getElementSymbol(const std::string& ename);
127
128//! Get the symbol for an element
129/*!
130 * Get the symbol for an element defined in Cantera by its atomic
131 * number. The named isotopes cannot be accessed from this function,
132 * since the atomic number of the isotopes is the same as the regular
133 * element from which they are derived.
134 *
135 * @param atomicNumber Integer, atomic number of the element
136 * @return The symbol of the element in a string
137 * @exception IndexError if the passed atomic number less than 1 or
138 * larger than the number of elements defined
139 */
140std::string getElementSymbol(int atomicNumber);
141
142//! Get the name of an element
143/*!
144 * Get the name of an element defined in Cantera by its symbol. This
145 * includes the named isotopes defined in Cantera.
146 *
147 * @param ename String, symbol for the element
148 * @return The name of the element, in a string
149 * @exception CanteraError if a match for ename is not found
150 */
151std::string getElementName(const std::string& ename);
152
153//! Get the name of an element
154/*!
155 * Get the name of an element defined in Cantera by its atomic
156 * number. The named isotopes cannot be accessed from this function,
157 * since the atomic number of the isotopes is the same as the regular
158 * element from which they are derived.
159 *
160 * @param atomicNumber Integer, atomic number of the element
161 * @return The name of the element, in a string
162 * @exception CanteraError IndexError if the passed atomic number less than 1 or
163 * larger than the number of elements defined
164 */
165std::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 for ename is not found
175 */
176int getAtomicNumber(const std::string& ename);
177
178//! Get the number of named elements defined in Cantera.
179//! This array excludes named isotopes
181
182//! Get the number of named isotopes defined in Cantera.
183//! This array excludes the named elements
185
186} // namespace
187
188#endif
This file contains definitions of constants, types and terms that are used in internal routines and a...
Namespace for the Cantera kernel.
Definition: AnyMap.h:29
int numIsotopesDefined()
Get the number of named isotopes defined in Cantera.
Definition: Elements.cpp:337
int getAtomicNumber(const std::string &ename)
Get the atomic number for an element.
Definition: Elements.cpp:309
std::string getElementName(const std::string &ename)
Get the name of an element.
Definition: Elements.cpp:281
double getElementWeight(const std::string &ename)
Get the atomic weight of an element.
Definition: Elements.cpp:207
std::string getElementSymbol(const std::string &ename)
Get the symbol for an element.
Definition: Elements.cpp:253
int numElementsDefined()
Get the number of named elements defined in Cantera.
Definition: Elements.cpp:332