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