Cantera  3.3.0a1
Loading...
Searching...
No Matches
vcs_MultiPhaseEquil.h
Go to the documentation of this file.
1/**
2 * @file vcs_MultiPhaseEquil.h
3 * Interface class for the vcsnonlinear solver
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_MULTIPHASEEQUIL_H
10#define VCS_MULTIPHASEEQUIL_H
11
12#include "MultiPhase.h"
13#include "vcs_solve.h"
14
15namespace Cantera
16{
17
18//! %Cantera's Interface to the Multiphase chemical equilibrium solver.
19/*!
20 * Class vcs_MultiPhaseEquil is designed to be used to set a mixture containing
21 * one or more phases to a state of chemical equilibrium.
22 *
23 * Note, as currently constructed, the underlying ThermoPhase objects are shared
24 * between the MultiPhase object and this object. Therefore, mix is not a const
25 * argument, and the return parameters are contained in underlying ThermoPhase
26 * objects.
27 *
28 * @ingroup equilGroup
29 */
31{
32public:
33 //! Constructor for the multiphase equilibrium solver
34 /*!
35 * This constructor will initialize the object with a MultiPhase object,
36 * setting up the internal equilibration problem. Note, as currently
37 * constructed, the underlying ThermoPhase objects are shared between the
38 * MultiPhase object and this object. Therefore, mix is not a const
39 * argument, and the return parameters are contained in underlying
40 * ThermoPhase objects.
41 *
42 * @param mix Object containing the MultiPhase object
43 * @param printLvl Determines the amount of printing to stdout
44 * that occurs for each call:
45 * - 0: No printing
46 * - 1: Minimal summary information
47 * - 2: Print the solution only
48 * - 3: Print the setup and then the solution only
49 * - 4: Print a table for each iteration
50 * - 5: Print more than a table for each iteration
51 */
52 vcs_MultiPhaseEquil(MultiPhase* mix, int printLvl);
53
54 virtual ~vcs_MultiPhaseEquil() {}
55
56 //! Equilibrate the solution using the current element abundances
57 //! stored in the MultiPhase object
58 /*!
59 * Use the vcs algorithm to equilibrate the current multiphase mixture.
60 *
61 * @param XY Integer representing what two thermo quantities are
62 * held constant during the equilibration
63 * @param estimateEquil integer indicating whether the solver should
64 * estimate its own initial condition.
65 * - If 0, the initial mole fraction vector in the ThermoPhase object is
66 * used as the initial condition.
67 * - If 1, the initial mole fraction vector is used if the element
68 * abundances are satisfied.
69 * - if -1, the initial mole fraction vector is thrown out, and an
70 * estimate is formulated.
71 * @param printLvl Determines the amount of printing that gets sent to
72 * stdout from the vcs package (Note, you may have to compile with debug
73 * flags to get some printing).
74 * @param err Internal error level
75 * @param maxsteps max steps allowed.
76 * @param loglevel Determines the amount of printing to the output file.
77 */
78 int equilibrate(int XY, int estimateEquil = 0,
79 int printLvl= 0, double err = 1.0e-6,
80 int maxsteps = VCS_MAXSTEPS, int loglevel=-99);
81
82 //! Equilibrate the solution using the current element abundances
83 //! stored in the MultiPhase object using constant T and P
84 /*!
85 * Use the vcs algorithm to equilibrate the current multiphase mixture.
86 *
87 * @param estimateEquil integer indicating whether the solver should
88 * estimate its own initial condition.
89 * - If 0, the initial mole fraction vector in the ThermoPhase object is
90 * used as the initial condition.
91 * - If 1, the initial mole fraction vector is used if the element
92 * abundances are satisfied.
93 * - if -1, the initial mole fraction vector is thrown out, and an
94 * estimate is formulated.
95 * @param printLvl Determines the amount of printing that gets sent to
96 * stdout from the vcs package (Note, you may have to compile with debug
97 * flags to get some printing).
98 * @param err Internal error level
99 * @param maxsteps max steps allowed.
100 * @param loglevel Determines the amount of printing to the output file.
101 */
102 int equilibrate_TP(int estimateEquil = 0,
103 int printLvl= 0, double err = 1.0e-6,
104 int maxsteps = VCS_MAXSTEPS, int loglevel=-99);
105
106 //! Equilibrate the solution using the current element abundances
107 //! stored in the MultiPhase object using either constant H and P
108 //! or constant U and P.
109 /*!
110 * Use the vcs algorithm to equilibrate the current multiphase mixture. The
111 * pressure of the calculation is taken from the current pressure stored
112 * with the MultiPhase object.
113 *
114 * @param Htarget Value of the total mixture enthalpy or total internal
115 * energy that will be kept constant. Note, this is and must be an
116 * extensive quantity. units = Joules
117 * @param XY Integer flag indicating what is held constant. Must be
118 * either HP or UP.
119 * @param Tlow Lower limit of the temperature. It's an error condition
120 * if the temperature falls below Tlow.
121 * @param Thigh Upper limit of the temperature. It's an error condition
122 * if the temperature goes higher than Thigh.
123 * @param estimateEquil integer indicating whether the solver
124 * should estimate its own initial condition.
125 * - If 0, the initial mole fraction vector in the ThermoPhase object is
126 * used as the initial condition.
127 * - If 1, the initial mole fraction vector is used if the element
128 * abundances are satisfied.
129 * - if -1, the initial mole fraction vector is thrown out, and an
130 * estimate is formulated.
131 * @param printLvl Determines the amount of printing that gets sent to
132 * stdout from the vcs package (Note, you may have to
133 * compile with debug flags to get some printing). See main
134 * constructor call for meaning of the levels.
135 * @param err Internal error level
136 * @param maxsteps max steps allowed.
137 * @param loglevel Determines the amount of printing to the output file.
138 */
139 int equilibrate_HP(double Htarget, int XY, double Tlow, double Thigh,
140 int estimateEquil = 0,
141 int printLvl = 0, double err = 1.0E-6,
142 int maxsteps = VCS_MAXSTEPS, int loglevel=-99);
143
144 //! Equilibrate the solution using the current element abundances stored in
145 //! the MultiPhase object using constant S and P.
146 /*!
147 * Use the vcs algorithm to equilibrate the current multiphase mixture. The
148 * pressure of the calculation is taken from the current pressure stored
149 * with the MultiPhase object.
150 *
151 * @param Starget Value of the total mixture entropy that will be kept
152 * constant. Note, this is and must be an extensive quantity.
153 * units = Joules/K
154 * @param Tlow Lower limit of the temperature. It's an error condition if
155 * the temperature falls below Tlow.
156 * @param Thigh Upper limit of the temperature. It's an error condition if
157 * the temperature goes higher than Thigh.
158 * @param estimateEquil integer indicating whether the solver should
159 * estimate its own initial condition.
160 * - If 0, the initial mole fraction vector in the ThermoPhase object is
161 * used as the initial condition.
162 * - If 1, the initial mole fraction vector is used if the element
163 * abundances are satisfied.
164 * - If -1, the initial mole fraction vector is thrown out, and an
165 * estimate is formulated.
166 * @param printLvl Determines the amount of printing that gets sent to
167 * stdout from the vcs package (Note, you may have to
168 * compile with debug flags to get some printing). See main
169 * constructor call for meaning of the levels.
170 * @param err Internal error level
171 * @param maxsteps max steps allowed.
172 * @param loglevel Determines the amount of printing to the output file.
173 */
174 int equilibrate_SP(double Starget, double Tlow, double Thigh,
175 int estimateEquil = 0,
176 int printLvl = 0, double err = 1.0E-6,
177 int maxsteps = VCS_MAXSTEPS, int loglevel=-99);
178
179 //! Equilibrate the solution using the current element abundances stored
180 //! in the MultiPhase object using constant V and constant T, H, U or S.
181 /*!
182 * Use the vcs algorithm to equilibrate the current multiphase mixture. The
183 * pressure of the calculation is taken from the current pressure stored
184 * with the MultiPhase object.
185 *
186 * @param XY Integer flag indicating what is held constant.
187 * Must be either TV, HV, UV, or SV.
188 * @param xtarget Value of the total thermodynamic parameter to be held
189 * constant in addition to V. Note, except for T, this must be an
190 * extensive quantity. units = Joules/K or Joules
191 * @param estimateEquil integer indicating whether the solver should
192 * estimate its own initial condition.
193 * - If 0, the initial mole fraction vector in the ThermoPhase object is
194 * used as the initial condition.
195 * - If 1, the initial mole fraction vector is used if the element
196 * abundances are satisfied.
197 * - if -1, the initial mole fraction vector is thrown out, and an
198 * estimate is formulated.
199 * @param printLvl Determines the amount of printing that gets sent to
200 * stdout from the vcs package (Note, you may have to compile with debug
201 * flags to get some printing). See main constructor call for meaning of
202 * the levels.
203 * @param err Internal error level
204 * @param maxsteps max steps allowed.
205 * @param logLevel Determines the amount of printing to the output file.
206 */
207 int equilibrate_TV(int XY, double xtarget,
208 int estimateEquil = 0,
209 int printLvl = 0, double err = 1.0E-6,
210 int maxsteps = VCS_MAXSTEPS, int logLevel = -99);
211
212protected:
213 //! Pointer to the MultiPhase mixture that will be equilibrated.
214 /*!
215 * Equilibrium solutions will be returned via this variable.
216 */
218
219 //! Print level from the VCSnonlinear package
220 /*!
221 * (Note, you may have to compile with debug flags to get some printing).
222 *
223 * - 0: No IO from the routine whatsoever
224 * - 1: One line print statements from equilibrate_XY() functions
225 * - 2: Problem statement information from vcs_Cantera_update_vprob();
226 * Final state of the system from vcs_solve_TP()
227 * - 3: Several more setup tables; Problem initialization routine
228 * - 4: One table for each iteration within vcs_solve_TP()
229 * - 5: Multiple tables for each iteration within vcs_solve_TP()
230 */
232
233 //! The object that contains the problem statement and does all of the equilibration work
234 /*!
235 * The problem statement may contain some subtleties. For example, the
236 * element constraints may be different than just an element conservation
237 * contraint equations. There may be kinetically frozen degrees of freedom.
238 * There may be multiple electrolyte phases with zero charge constraints.
239 * All of these make the problem statement different than the simple element
240 * conservation statement.
241 *
242 * VCS_SOLVE will have different ordering for species and element constraints
243 * than this object.
244 */
246};
247
248}
249
250#endif
Headers for the MultiPhase object that is used to set up multiphase equilibrium problems (see Chemica...
A class for multiphase mixtures.
Definition MultiPhase.h:62
This is the main structure used to hold the internal data used in vcs_solve_TP(), and to solve TP sys...
Definition vcs_solve.h:44
Cantera's Interface to the Multiphase chemical equilibrium solver.
VCS_SOLVE m_vsolve
The object that contains the problem statement and does all of the equilibration work.
int equilibrate_SP(double Starget, double Tlow, double Thigh, int estimateEquil=0, int printLvl=0, double err=1.0E-6, int maxsteps=VCS_MAXSTEPS, int loglevel=-99)
Equilibrate the solution using the current element abundances stored in the MultiPhase object using c...
int equilibrate_TP(int estimateEquil=0, int printLvl=0, double err=1.0e-6, int maxsteps=VCS_MAXSTEPS, int loglevel=-99)
Equilibrate the solution using the current element abundances stored in the MultiPhase object using c...
int equilibrate(int XY, int estimateEquil=0, int printLvl=0, double err=1.0e-6, int maxsteps=VCS_MAXSTEPS, int loglevel=-99)
Equilibrate the solution using the current element abundances stored in the MultiPhase object.
int equilibrate_TV(int XY, double xtarget, int estimateEquil=0, int printLvl=0, double err=1.0E-6, int maxsteps=VCS_MAXSTEPS, int logLevel=-99)
Equilibrate the solution using the current element abundances stored in the MultiPhase object using c...
int m_printLvl
Print level from the VCSnonlinear package.
int equilibrate_HP(double Htarget, int XY, double Tlow, double Thigh, int estimateEquil=0, int printLvl=0, double err=1.0E-6, int maxsteps=VCS_MAXSTEPS, int loglevel=-99)
Equilibrate the solution using the current element abundances stored in the MultiPhase object using e...
MultiPhase * m_mix
Pointer to the MultiPhase mixture that will be equilibrated.
Namespace for the Cantera kernel.
Definition AnyMap.cpp:595
#define VCS_MAXSTEPS
Maximum steps in the inner loop.
Definition vcs_defs.h:47
Header file for the internal object that holds the vcs equilibrium problem (see Class VCS_SOLVE and C...