Cantera  2.3.0
vcs_defs.h
Go to the documentation of this file.
1 /**
2  * @file vcs_defs.h
3  * Defines and definitions within the vcs package
4  */
5 
6 // This file is part of Cantera. See License.txt in the top-level directory or
7 // at http://www.cantera.org/license.txt for license and copyright information.
8 
9 #ifndef VCS_DEFS_H
10 #define VCS_DEFS_H
11 
12 namespace Cantera
13 {
14 /*!
15  * ERROR CODES
16  */
17 //@{
18 #define VCS_SUCCESS 0
19 #define VCS_NOMEMORY 1
20 #define VCS_FAILED_CONVERGENCE -1
21 #define VCS_SHOULDNT_BE_HERE -2
22 #define VCS_PUB_BAD -3
23 #define VCS_THERMO_OUTOFRANGE -4
24 #define VCS_FAILED_LOOKUP -5
25 #define VCS_MP_FAIL -6
26 //@}
27 
28 /*!
29  * @name Type of the underlying equilibrium solve
30  * @{
31  */
32 
33 //! Current, it is always done holding T and P constant.
34 #define VCS_PROBTYPE_TP 0
35 //@}
36 
37 /*!
38  * @name Sizes of Phases and Cutoff Mole Numbers
39  *
40  * All size parameters are listed here
41  * @{
42  */
43 
44 //! Cutoff relative mole fraction value, below which species are deleted from
45 //! the equilibrium problem.
46 #ifndef VCS_RELDELETE_SPECIES_CUTOFF
47 #define VCS_RELDELETE_SPECIES_CUTOFF 1.0e-64
48 #endif
49 
50 //! Cutoff relative mole number value, below which species are deleted from the
51 //! equilibrium problem.
52 #ifndef VCS_DELETE_MINORSPECIES_CUTOFF
53 #define VCS_DELETE_MINORSPECIES_CUTOFF 1.0e-140
54 #endif
55 
56 //! Relative value of multiphase species mole number for a multiphase species
57 //! which is small.
58 #ifndef VCS_SMALL_MULTIPHASE_SPECIES
59 #define VCS_SMALL_MULTIPHASE_SPECIES 1.0e-25
60 #endif
61 
62 //! Cutoff relative moles below which a phase is deleted
63 //! from the equilibrium problem.
64 #ifndef VCS_DELETE_PHASE_CUTOFF
65 #define VCS_DELETE_PHASE_CUTOFF 1.0e-13
66 #endif
67 
68 //! Relative mole number of species in a phase that is created We want this to
69 //! be comfortably larger than the VCS_DELETE_PHASE_CUTOFF value so that the
70 //! phase can have a chance to survive.
71 #ifndef VCS_POP_PHASE_MOLENUM
72 #define VCS_POP_PHASE_MOLENUM 1.0e-11
73 #endif
74 
75 
76 //! Cutoff moles below which a phase or species which comprises the bulk of an
77 //! element's total concentration is deleted.
78 #ifndef VCS_DELETE_ELEMENTABS_CUTOFF
79 #define VCS_DELETE_ELEMENTABS_CUTOFF 1.0e-280
80 #endif
81 
82 //! Maximum steps in the inner loop
83 #ifndef VCS_MAXSTEPS
84 #define VCS_MAXSTEPS 50000
85 #endif
86 
87 //@}
88 
89 /*!
90  * @name State of Dimensional Units for Gibbs free energies
91  * @{
92  */
93 //! nondimensional
94 #define VCS_NONDIMENSIONAL_G 1
95 //! dimensioned
96 #define VCS_DIMENSIONAL_G 0
97 //@}
98 
99 
100 //! @name Species Categories used during the iteration
101 /*!
102  * These defines are valid values for spStatus()
103  */
104 //@{
105 
106 //! Species is a component which can never be nonzero because of a
107 //! stoichiometric constraint
108 /*!
109  * An example of this would be a species that contains Ni. But,
110  * the amount of Ni elements is exactly zero.
111  */
112 #define VCS_SPECIES_COMPONENT_STOICHZERO 3
113 
114 //! Species is a component which can be nonzero
115 #define VCS_SPECIES_COMPONENT 2
116 
117 //! Species is a major species
118 /*!
119  * A major species is either a species in a multicomponent phase with
120  * significant concentration or it's a Stoich Phase
121  */
122 #define VCS_SPECIES_MAJOR 1
123 
124 //! Species is a major species
125 /*!
126  * A major species is either a species in a multicomponent phase with
127  * significant concentration or it's a Stoich Phase
128  */
129 #define VCS_SPECIES_MINOR 0
130 
131 //! Species lies in a multicomponent phase, with a small phase concentration
132 /*!
133  * The species lies in a multicomponent phase that exists. It concentration is
134  * currently very low, necessitating a different method of calculation.
135  */
136 #define VCS_SPECIES_SMALLMS -1
137 
138 //! Species lies in a multicomponent phase with concentration zero
139 /*!
140  * The species lies in a multicomponent phase which currently doesn't exist.
141  * It concentration is currently zero.
142  */
143 #define VCS_SPECIES_ZEROEDMS -2
144 
145 //! Species is a SS phase, that is currently zeroed out.
146 /*!
147  * The species lies in a single-species phase which is currently zeroed out.
148  */
149 #define VCS_SPECIES_ZEROEDSS -3
150 
151 //! Species has such a small mole fraction it is deleted even though its
152 //! phase may possibly exist.
153 /*!
154  * The species is believed to have such a small mole fraction that it best to
155  * throw the calculation of it out. It will be added back in at the end of the
156  * calculation.
157  */
158 #define VCS_SPECIES_DELETED -4
159 
160 //! Species refers to an electron in the metal.
161 /*!
162  * The unknown is equal to the electric potential of the phase in which it
163  * exists.
164  */
165 #define VCS_SPECIES_INTERFACIALVOLTAGE -5
166 
167 //! Species lies in a multicomponent phase that is zeroed atm
168 /*!
169  * The species lies in a multicomponent phase that is currently deleted and will
170  * stay deleted due to a choice from a higher level. These species will formally
171  * always have zero mole numbers in the solution vector.
172  */
173 #define VCS_SPECIES_ZEROEDPHASE -6
174 
175 //! Species lies in a multicomponent phase that is active, but species
176 //! concentration is zero
177 /*!
178  * The species lies in a multicomponent phase which currently does exist. It
179  * concentration is currently identically zero, though the phase exists. Note,
180  * this is a temporary condition that exists at the start of an equilibrium
181  * problem. The species is soon "birthed" or "deleted".
182  */
183 #define VCS_SPECIES_ACTIVEBUTZERO -7
184 
185 //! Species lies in a multicomponent phase that is active,
186 //! but species concentration is zero due to stoich constraint
187 /*!
188  * The species lies in a multicomponent phase which currently does exist. Its
189  * concentration is currently identically zero, though the phase exists. This is
190  * a permanent condition due to stoich constraints.
191  *
192  * An example of this would be a species that contains Ni. But, the amount of Ni
193  * elements in the current problem statement is exactly zero.
194  */
195 #define VCS_SPECIES_STOICHZERO -8
196 
197 //@}
198 
199 //! @name Phase Categories used during the iteration
200 /*!
201  * These defines are valid values for the phase existence flag
202  */
203 //@{
204 //! Always exists because it contains inerts which can't exist in any other phase
205 #define VCS_PHASE_EXIST_ALWAYS 3
206 
207 //! Phase is a normal phase that currently exists
208 #define VCS_PHASE_EXIST_YES 2
209 
210 //! Phase is a normal phase that exists in a small concentration
211 /*!
212  * Concentration is so small that it must be calculated using an alternate
213  * method
214  */
215 #define VCS_PHASE_EXIST_MINORCONC 1
216 
217 //! Phase doesn't currently exist in the mixture
218 #define VCS_PHASE_EXIST_NO 0
219 
220 //! Phase currently is zeroed due to a programmatic issue
221 /*!
222  * We zero phases because we want to follow phase stability boundaries.
223  */
224 #define VCS_PHASE_EXIST_ZEROEDPHASE -6
225 
226 //@}
227 
228 /*!
229  * @name Types of Element Constraint Equations
230  *
231  * There may be several different types of element constraints handled by the
232  * equilibrium program. These defines are used to assign each constraint to one
233  * category.
234  * @{
235  */
236 
237 
238 //! An element constraint that is current turned off
239 #define VCS_ELEM_TYPE_TURNEDOFF -1
240 
241 //! Normal element constraint consisting of positive coefficients for the
242 //! formula matrix.
243 /*!
244  * All species have positive coefficients within the formula matrix. With this
245  * constraint, we may employ various strategies to handle small values of the
246  * element number successfully.
247  */
248 #define VCS_ELEM_TYPE_ABSPOS 0
249 
250 //! This refers to conservation of electrons
251 /*!
252  * Electrons may have positive or negative values in the Formula matrix.
253  */
254 #define VCS_ELEM_TYPE_ELECTRONCHARGE 1
255 
256 //! This refers to a charge neutrality of a single phase
257 /*!
258  * Charge neutrality may have positive or negative values in the Formula matrix.
259  */
260 #define VCS_ELEM_TYPE_CHARGENEUTRALITY 2
261 
262 //! Constraint associated with maintaining a fixed lattice stoichiometry in the
263 //! solids
264 /*!
265  * The constraint may have positive or negative values. The lattice 0 species
266  * will have negative values while higher lattices will have positive values
267  */
268 #define VCS_ELEM_TYPE_LATTICERATIO 3
269 
270 //! Constraint associated with maintaining frozen kinetic equilibria in
271 //! some functional groups within molecules
272 /*!
273  * We seek here to say that some functional groups or ionic states should be
274  * treated as if they are separate elements given the time scale of the problem.
275  * This will be abs positive constraint. We have not implemented any examples
276  * yet. A requirement will be that we must be able to add and subtract these
277  * constraints.
278  */
279 #define VCS_ELEM_TYPE_KINETICFROZEN 4
280 
281 //! Constraint associated with the maintenance of a surface phase
282 /*!
283  * We don't have any examples of this yet either. However, surfaces only exist
284  * because they are interfaces between bulk layers. If we want to treat surfaces
285  * within thermodynamic systems we must come up with a way to constrain their
286  * total number.
287  */
288 #define VCS_ELEM_TYPE_SURFACECONSTRAINT 5
289 //! Other constraint equations
290 /*!
291  * currently there are none
292  */
293 #define VCS_ELEM_TYPE_OTHERCONSTRAINT 6
294 //@}
295 
296 /*!
297  * @name Types of Species Unknowns in the problem
298  * @{
299  */
300 //! Unknown refers to mole number of a single species
301 #define VCS_SPECIES_TYPE_MOLNUM 0
302 
303 //! Unknown refers to the voltage level of a phase
304 /*!
305  * Typically, these species are electrons in metals. There is an infinite supply
306  * of them. However, their electrical potential is sometimes allowed to vary,
307  * for example if the open circuit voltage is sought after.
308  */
309 #define VCS_SPECIES_TYPE_INTERFACIALVOLTAGE -5
310 //@}
311 
312 /*!
313  * @name Types of State Calculations within VCS. These values determine where
314  * the results are stored within the VCS_SOLVE object.
315  * @{
316  */
317 //! State Calculation is currently in an unknown state
318 #define VCS_STATECALC_UNKNOWN -1
319 //! State Calculation based on the old or base mole numbers
320 #define VCS_STATECALC_OLD 0
321 
322 //! State Calculation based on the new or tentative mole numbers
323 #define VCS_STATECALC_NEW 1
324 
325 //! State Calculation based on tentative mole numbers for a phase which is
326 //! currently zeroed, but is being evaluated for whether it should pop back into
327 //! existence
328 #define VCS_STATECALC_PHASESTABILITY 2
329 
330 //! State Calculation based on a temporary set of mole numbers
331 #define VCS_STATECALC_TMP 3
332 //@}
333 
334 }
335 
336 // namespace alias for backward compatibility
337 namespace VCSnonideal = Cantera;
338 
339 #endif
Namespace for the Cantera kernel.
Definition: application.cpp:29