Cantera  3.1.0a2
Loading...
Searching...
No Matches
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//! @name Types of Element Constraint Equations
19//!
20//! There may be several different types of element constraints handled by the
21//! equilibrium program and by %Cantera in other contexts. These defines are used
22//! to assign each constraint to one category.
23//! @{
24
25//! An element constraint that is current turned off
26#define CT_ELEM_TYPE_TURNEDOFF -1
27
28//! Normal element constraint consisting of positive coefficients for the
29//! formula matrix.
30/*!
31 * All species have positive coefficients within the formula matrix. With this
32 * constraint, we may employ various strategies to handle small values of the
33 * element number successfully.
34 */
35#define CT_ELEM_TYPE_ABSPOS 0
36
37//! This refers to conservation of electrons
38/*!
39 * Electrons may have positive or negative values in the Formula matrix.
40 */
41#define CT_ELEM_TYPE_ELECTRONCHARGE 1
42
43//! This refers to a charge neutrality of a single phase
44/*!
45 * Charge neutrality may have positive or negative values in the Formula matrix.
46 */
47#define CT_ELEM_TYPE_CHARGENEUTRALITY 2
48
49//! Constraint associated with maintaining a fixed lattice stoichiometry in a solid
50/*!
51 * The constraint may have positive or negative values. The lattice 0 species
52 * will have negative values while higher lattices will have positive values
53 */
54#define CT_ELEM_TYPE_LATTICERATIO 3
55
56//! Constraint associated with maintaining frozen kinetic equilibria in
57//! some functional groups within molecules
58/*!
59 * We seek here to say that some functional groups or ionic states should be
60 * treated as if they are separate elements given the time scale of the problem.
61 * This will be abs positive constraint. We have not implemented any examples
62 * yet. A requirement will be that we must be able to add and subtract these
63 * constraints.
64 */
65#define CT_ELEM_TYPE_KINETICFROZEN 4
66
67//! Constraint associated with the maintenance of a surface phase
68/*!
69 * We don't have any examples of this yet either. However, surfaces only exist
70 * because they are interfaces between bulk layers. If we want to treat surfaces
71 * within thermodynamic systems we must come up with a way to constrain their
72 * total number.
73 */
74#define CT_ELEM_TYPE_SURFACECONSTRAINT 5
75
76//! Other constraint equations
77/*!
78 * currently there are none
79 */
80#define CT_ELEM_TYPE_OTHERCONSTRAINT 6
81//! @}
82
83//! Number indicating we don't know the entropy of the element in its most
84//! stable state at 298.15 K and 1 bar.
85#define ENTROPY298_UNKNOWN -123456789.
86
87//! Get a vector of the atomic symbols of the elements defined in Cantera.
88//! @since New in version 3.0
89const vector<string>& elementSymbols();
90
91//! Get a vector of the names of the elements defined in Cantera.
92//! @since New in version 3.0
93const vector<string>& elementNames();
94
95//! Get a map with the element and isotope symbols and names as keys and weights as
96//! values.
97/*!
98 * This is a constant in the application so it is only generated once
99 * when it is first needed.
100 *
101 * @since New in version 3.0
102 */
103const map<string, double>& elementWeights();
104
105//! Get the atomic weight of an element.
106/*!
107 * Get the atomic weight of an element defined in %Cantera by its symbol
108 * or by its name. This includes the named isotopes defined in Cantera.
109 *
110 * @param ename String, name or symbol of the element
111 * @return The atomic weight of the element
112 * @exception CanteraError if a match for ename is not found or the
113 * element has no stable isotopes, and therefore no standard atomic weight
114 */
115double getElementWeight(const string& ename);
116
117//! Get the atomic weight of an element.
118/*!
119 * Get the atomic weight of an element defined in %Cantera by its atomic
120 * number. The named isotopes cannot be accessed from this function,
121 * since the atomic number of the isotopes is the same as the regular
122 * element from which they are derived.
123 *
124 * @param atomicNumber Integer, atomic number of the element
125 * @return The atomic weight of the element
126 * @exception IndexError if the passed atomic number less than 1 or
127 * larger than the number of elements defined
128 * @exception CanteraError if the element has no stable isotopes, and
129 * therefore no standard atomic weight
130 */
131double getElementWeight(int atomicNumber);
132
133//! Get the symbol for an element
134/*!
135 * Get the symbol for an element defined in %Cantera by its name. This
136 * includes the named isotopes defined in Cantera.
137 *
138 * @param ename String, name of the element
139 * @return The symbol of the element in a string
140 * @exception CanteraError if a match for ename is not found
141 */
142string getElementSymbol(const string& ename);
143
144//! Get the symbol for an element
145/*!
146 * Get the symbol for an element defined in %Cantera by its atomic
147 * number. The named isotopes cannot be accessed from this function,
148 * since the atomic number of the isotopes is the same as the regular
149 * element from which they are derived.
150 *
151 * @param atomicNumber Integer, atomic number of the element
152 * @return The symbol of the element in a string
153 * @exception IndexError if the passed atomic number less than 1 or
154 * larger than the number of elements defined
155 */
156string getElementSymbol(int atomicNumber);
157
158//! Get the name of an element
159/*!
160 * Get the name of an element defined in %Cantera by its symbol. This
161 * includes the named isotopes defined in Cantera.
162 *
163 * @param ename String, symbol for the element
164 * @return The name of the element, in a string
165 * @exception CanteraError if a match for ename is not found
166 */
167string getElementName(const string& ename);
168
169//! Get the name of an element
170/*!
171 * Get the name of an element defined in %Cantera by its atomic
172 * number. The named isotopes cannot be accessed from this function,
173 * since the atomic number of the isotopes is the same as the regular
174 * element from which they are derived.
175 *
176 * @param atomicNumber Integer, atomic number of the element
177 * @return The name of the element, in a string
178 * @exception CanteraError IndexError if the passed atomic number less than 1 or
179 * larger than the number of elements defined
180 */
181string getElementName(int atomicNumber);
182
183//! Get the atomic number for an element
184/*!
185 * Get the atomic number of an element defined in %Cantera by its symbol
186 * or name. This includes the named isotopes included in Cantera.
187 *
188 * @param ename String, name or symbol of the element
189 * @return The integer atomic number of the element
190 * @exception CanteraError if a match for ename is not found
191 */
192int getAtomicNumber(const string& ename);
193
194//! Get the number of named elements defined in Cantera.
195//! This array excludes named isotopes
196//! @since Type is `size_t` in %Cantera 3.0
197size_t numElementsDefined();
198
199//! Get the number of named isotopes defined in Cantera.
200//! This array excludes the named elements
201//! @since Type is `size_t` in %Cantera 3.0
202size_t numIsotopesDefined();
203
204} // namespace
205
206#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.cpp:564
double getElementWeight(const string &ename)
Get the atomic weight of an element.
Definition Elements.cpp:251
int getAtomicNumber(const string &ename)
Get the atomic number for an element.
Definition Elements.cpp:339
const vector< string > & elementNames()
Get a vector of the names of the elements defined in Cantera.
Definition Elements.cpp:227
string getElementName(const string &ename)
Get the name of an element.
Definition Elements.cpp:314
size_t numElementsDefined()
Get the number of named elements defined in Cantera.
Definition Elements.cpp:362
string getElementSymbol(const string &ename)
Get the symbol for an element.
Definition Elements.cpp:289
const map< string, double > & elementWeights()
Get a map with the element and isotope symbols and names as keys and weights as values.
Definition Elements.cpp:246
const vector< string > & elementSymbols()
Get a vector of the atomic symbols of the elements defined in Cantera.
Definition Elements.cpp:212
size_t numIsotopesDefined()
Get the number of named isotopes defined in Cantera.
Definition Elements.cpp:367