Cantera  3.3.0a1
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//! @}
20
21//! @name Sizes of Phases and Cutoff Mole Numbers
22//!
23//! All size parameters are listed here
24//! @{
25
26//! Cutoff relative mole fraction value, below which species are deleted from
27//! the equilibrium problem.
28#define VCS_RELDELETE_SPECIES_CUTOFF 1.0e-64
29
30//! Cutoff relative mole number value, below which species are deleted from the
31//! equilibrium problem.
32#define VCS_DELETE_MINORSPECIES_CUTOFF 1.0e-140
33
34//! Relative value of multiphase species mole number for a multiphase species
35//! which is small.
36#define VCS_SMALL_MULTIPHASE_SPECIES 1.0e-25
37
38//! Cutoff relative moles below which a phase is deleted
39//! from the equilibrium problem.
40#define VCS_DELETE_PHASE_CUTOFF 1.0e-13
41
42//! Cutoff moles below which a phase or species which comprises the bulk of an
43//! element's total concentration is deleted.
44#define VCS_DELETE_ELEMENTABS_CUTOFF 1.0e-280
45
46//! Maximum steps in the inner loop
47#define VCS_MAXSTEPS 50000
48
49//! @}
50
51//! @name Species Categories used during the iteration
52/*!
53 * These defines are valid values for spStatus()
54 */
55//! @{
56
57//! Species is a component which can be nonzero
58#define VCS_SPECIES_COMPONENT 2
59
60//! Species is a major species
61/*!
62 * A major species is either a species in a multicomponent phase with
63 * significant concentration or it's a Stoich Phase
64 */
65#define VCS_SPECIES_MAJOR 1
66
67//! Species is a major species
68/*!
69 * A major species is either a species in a multicomponent phase with
70 * significant concentration or it's a Stoich Phase
71 */
72#define VCS_SPECIES_MINOR 0
73
74//! Species lies in a multicomponent phase with concentration zero
75/*!
76 * The species lies in a multicomponent phase which currently doesn't exist.
77 * It concentration is currently zero.
78 */
79#define VCS_SPECIES_ZEROEDMS -2
80
81//! Species is a SS phase, that is currently zeroed out.
82/*!
83 * The species lies in a single-species phase which is currently zeroed out.
84 */
85#define VCS_SPECIES_ZEROEDSS -3
86
87//! Species has such a small mole fraction it is deleted even though its
88//! phase may possibly exist.
89/*!
90 * The species is believed to have such a small mole fraction that it best to
91 * throw the calculation of it out. It will be added back in at the end of the
92 * calculation.
93 */
94#define VCS_SPECIES_DELETED -4
95
96//! Species refers to an electron in the metal.
97/*!
98 * The unknown is equal to the electric potential of the phase in which it
99 * exists.
100 */
101#define VCS_SPECIES_INTERFACIALVOLTAGE -5
102
103//! Species lies in a multicomponent phase that is zeroed atm
104/*!
105 * The species lies in a multicomponent phase that is currently deleted and will
106 * stay deleted due to a choice from a higher level. These species will formally
107 * always have zero mole numbers in the solution vector.
108 */
109#define VCS_SPECIES_ZEROEDPHASE -6
110
111//! Species lies in a multicomponent phase that is active, but species
112//! concentration is zero
113/*!
114 * The species lies in a multicomponent phase which currently does exist. It
115 * concentration is currently identically zero, though the phase exists. Note,
116 * this is a temporary condition that exists at the start of an equilibrium
117 * problem. The species is soon "birthed" or "deleted".
118 */
119#define VCS_SPECIES_ACTIVEBUTZERO -7
120
121//! Species lies in a multicomponent phase that is active,
122//! but species concentration is zero due to stoich constraint
123/*!
124 * The species lies in a multicomponent phase which currently does exist. Its
125 * concentration is currently identically zero, though the phase exists. This is
126 * a permanent condition due to stoich constraints.
127 *
128 * An example of this would be a species that contains Ni. But, the amount of Ni
129 * elements in the current problem statement is exactly zero.
130 */
131#define VCS_SPECIES_STOICHZERO -8
132
133//! @}
134
135//! @name Phase Categories used during the iteration
136/*!
137 * These defines are valid values for the phase existence flag
138 */
139//! @{
140//! Always exists because it contains inerts which can't exist in any other phase
141#define VCS_PHASE_EXIST_ALWAYS 3
142
143//! Phase is a normal phase that currently exists
144#define VCS_PHASE_EXIST_YES 2
145
146//! Phase doesn't currently exist in the mixture
147#define VCS_PHASE_EXIST_NO 0
148
149//! Phase currently is zeroed due to a programmatic issue
150/*!
151 * We zero phases because we want to follow phase stability boundaries.
152 */
153#define VCS_PHASE_EXIST_ZEROEDPHASE -6
154
155//! @}
156//! @name Types of Element Constraint Equations
157//!
158//! There may be several different types of element constraints handled by the
159//! equilibrium program. These defines are used to assign each constraint to one
160//! category.
161//! @{
162
163//! Normal element constraint consisting of positive coefficients for the
164//! formula matrix.
165/*!
166 * All species have positive coefficients within the formula matrix. With this
167 * constraint, we may employ various strategies to handle small values of the
168 * element number successfully.
169 */
170#define VCS_ELEM_TYPE_ABSPOS 0
171
172//! This refers to conservation of electrons
173/*!
174 * Electrons may have positive or negative values in the Formula matrix.
175 */
176#define VCS_ELEM_TYPE_ELECTRONCHARGE 1
177
178//! This refers to a charge neutrality of a single phase
179/*!
180 * Charge neutrality may have positive or negative values in the Formula matrix.
181 */
182#define VCS_ELEM_TYPE_CHARGENEUTRALITY 2
183
184//! @}
185//! @name Types of Species Unknowns in the problem
186//! @{
187
188//! Unknown refers to mole number of a single species
189#define VCS_SPECIES_TYPE_MOLNUM 0
190
191//! Unknown refers to the voltage level of a phase
192/*!
193 * Typically, these species are electrons in metals. There is an infinite supply
194 * of them. However, their electrical potential is sometimes allowed to vary,
195 * for example if the open circuit voltage is sought after.
196 */
197#define VCS_SPECIES_TYPE_INTERFACIALVOLTAGE -5
198
199//! @}
200//! @name Types of State Calculations within VCS
201//!
202//! These values determine where the results are stored within the VCS_SOLVE object.
203//! @{
204
205//! State Calculation based on the old or base mole numbers
206#define VCS_STATECALC_OLD 0
207
208//! State Calculation based on the new or tentative mole numbers
209#define VCS_STATECALC_NEW 1
210
211//! State Calculation based on tentative mole numbers for a phase which is
212//! currently zeroed, but is being evaluated for whether it should pop back into
213//! existence
214#define VCS_STATECALC_PHASESTABILITY 2
215
216//! State Calculation based on a temporary set of mole numbers
217#define VCS_STATECALC_TMP 3
218//! @}
219
220}
221
222// namespace alias for backward compatibility
223namespace VCSnonideal = Cantera;
224
225#endif
Namespace for the Cantera kernel.
Definition AnyMap.cpp:595