Cantera  2.2.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 #ifndef VCS_MULTIPHASEEQUIL_H
6 #define VCS_MULTIPHASEEQUIL_H
7 
8 #include "MultiPhase.h"
9 #include "vcs_solve.h"
10 #include "vcs_prob.h"
11 
12 namespace Cantera
13 {
14 //! Set a single-phase chemical solution to chemical equilibrium.
15 /*!
16  * The function uses the element abundance vector that is currently
17  * consistent with the composition within the phase itself. Two other
18  * thermodynamic quantities, determined by the XY string, are held constant
19  * during the equilibration. This is a convenience function that uses one or
20  * the other of the two chemical equilibrium solvers.
21  *
22  * @param s The object to set to an equilibrium state
23  * @param XY An integer specifying the two properties to be held constant.
24  * @param estimateEquil integer indicating whether the solver
25  * should estimate its own initial condition.
26  * - If 0, the initial mole fraction vector in the
27  * ThermoPhase object is used as the initial condition.
28  * - If 1, the initial mole fraction vector is used if the
29  * element abundances are satisfied.
30  * - if -1, the initial mole fraction vector is thrown out,
31  * and an estimate is formulated.
32  * @param printLvl Determines the amount of printing that gets sent to stdout
33  * from the vcs package (Note, you may have to compile with
34  * debug flags to get some printing).
35  * @param solver The equilibrium solver to use. If solver = 0, the ChemEquil
36  * solver will be used, and if solver = 1, the
37  * vcs_MultiPhaseEquil solver will be used (slower than
38  * ChemEquil, but more stable). If solver < 0 (default, then
39  * ChemEquil will be tried first, and if it fails
40  * vcs_MultiPhaseEquil will be tried.
41  * @param rtol Relative tolerance of the solve. Defaults to 1.0E-9.
42  * @param maxsteps The maximum number of steps to take to find the solution.
43  * @param maxiter For the MultiPhaseEquil solver only, this is the maximum
44  * number of outer temperature or pressure iterations to take
45  * when T and/or P is not held fixed.
46  * @param loglevel Controls amount of diagnostic output. loglevel
47  * = 0 suppresses diagnostics, and increasingly-verbose
48  * messages are written as loglevel increases.
49  * @deprecated Use ThermoPhase::equilibrate instead. To be removed after
50  * Cantera 2.2.
51  * @ingroup equilfunctions
52  */
53 int vcs_equilibrate(thermo_t& s, const char* XY,
54  int estimateEquil = 0, int printLvl = 0,
55  int solver = -1, doublereal rtol = 1.0e-9,
56  int maxsteps = VCS_MAXSTEPS,
57  int maxiter = 100, int loglevel = -99);
58 
59 //! Set a multi-phase chemical solution to chemical equilibrium.
60 /*!
61  * This function uses the vcs_MultiPhaseEquil interface to the vcs solver.
62  * The function uses the element abundance vector that is currently
63  * consistent with the composition within the phases themselves. Two other
64  * thermodynamic quantities, determined by the XY string, are held constant
65  * during the equilibration.
66  *
67  * @param s The object to set to an equilibrium state
68  * @param XY A character string representing the unknowns to be held constant
69  * @param estimateEquil integer indicating whether the solver
70  * should estimate its own initial condition.
71  * - If 0, the initial mole fraction vector in the
72  * ThermoPhase object is used as the initial condition.
73  * - If 1, the initial mole fraction vector is used if the
74  * element abundances are satisfied.
75  * - If -1, the initial mole fraction vector is thrown out,
76  * and an estimate is formulated.
77  * @param printLvl Determines the amount of printing that gets sent to stdout
78  * from the vcs package (Note, you may have to compile with
79  * debug flags to get some printing).
80  * @param solver Determines which solver is used.
81  * - 1 MultiPhaseEquil solver
82  * - 2 VCSnonideal Solver (default)
83  * @param rtol Relative tolerance of the solve. Defaults to 1.0E-9.
84  * @param maxsteps The maximum number of steps to take to find the solution.
85  * @param maxiter For the MultiPhaseEquil solver only, this is the maximum
86  * number of outer temperature or pressure iterations to take
87  * when T and/or P is not held fixed.
88  * @param loglevel Controls amount of diagnostic output. loglevel
89  * = 0 suppresses diagnostics, and increasingly-verbose
90  * messages are written as loglevel increases.
91  * @deprecated Use MultiPhase::equilibrate instead. To be removed after
92  * Cantera 2.2.
93  * @ingroup equilfunctions
94  */
95 int vcs_equilibrate(MultiPhase& s, const char* XY,
96  int estimateEquil = 0, int printLvl = 0,
97  int solver = 2,
98  doublereal rtol = 1.0e-9, int maxsteps = VCS_MAXSTEPS,
99  int maxiter = 100, int loglevel = -99);
100 
101 //! Set a multi-phase chemical solution to chemical equilibrium.
102 /*!
103  * This function uses the vcs_MultiPhaseEquil interface to the vcs solver.
104  * The function uses the element abundance vector that is currently
105  * consistent with the composition within the phases themselves. Two other
106  * thermodynamic quantities, determined by the XY string, are held constant
107  * during the equilibration.
108  *
109  * @param s The MultiPhase object to be set to an equilibrium state
110  * @param ixy An integer specifying the two properties to be held constant.
111  * @param estimateEquil integer indicating whether the solver
112  * should estimate its own initial condition.
113  * - If 0, the initial mole fraction vector in the
114  * ThermoPhase object is used as the initial condition.
115  * - If 1, the initial mole fraction vector is used if the
116  * element abundances are satisfied.
117  * - if -1, the initial mole fraction vector is thrown out,
118  * and an estimate is formulated.
119  * @param printLvl Determines the amount of printing that gets sent to stdout
120  * from the vcs package (Note, you may have to compile with
121  * debug flags to get some printing).
122  * @param solver Determines which solver is used.
123  * - 1 MultiPhaseEquil solver
124  * - 2 VCSnonideal Solver (default)
125  * @param rtol Relative tolerance of the solve. Defaults to 1.0E-9.
126  * @param maxsteps The maximum number of steps to take to find the solution.
127  * @param maxiter For the MultiPhaseEquil solver only, this is
128  * the maximum number of outer temperature or
129  * pressure iterations to take when T and/or P is
130  * not held fixed.
131  * @param loglevel Controls amount of diagnostic output. loglevel
132  * = 0 suppresses diagnostics, and increasingly-verbose
133  * messages are written as loglevel increases.
134  * @deprecated Use MultiPhase::equilibrate instead. To be removed after
135  * Cantera 2.2.
136  * @ingroup equilfunctions
137  */
138 int vcs_equilibrate_1(MultiPhase& s, int ixy,
139  int estimateEquil = 0, int printLvl = 0,
140  int solver = 2,
141  doublereal rtol = 1.0e-9, int maxsteps = VCS_MAXSTEPS,
142  int maxiter = 100, int loglevel = -99);
143 
144 //! Determine the phase stability of a single phase given the current conditions
145 //! in a MultiPhase object
146 /*!
147  * @param s The MultiPhase object to be set to an equilibrium state
148  * @param iphase Phase index within the multiphase object to be
149  * tested for stability.
150  * @param funcStab Function value that tests equilibrium. > 0 indicates stable
151  * < 0 indicates unstable
152  * @param printLvl Determines the amount of printing that gets sent to
153  * stdout from the vcs package (Note, you may have to compile
154  * with debug flags to get some printing).
155  * @param loglevel Controls amount of diagnostic output. loglevel
156  * = 0 suppresses diagnostics, and increasingly-verbose
157  * messages are written as loglevel increases.
158  */
159 int vcs_determine_PhaseStability(MultiPhase& s, int iphase,
160  double& funcStab, int printLvl, int loglevel);
161 
162 //! Translate a MultiPhase object into a VCS_PROB problem definition object
163 /*!
164  * @param mphase MultiPhase object that is the source for all of the information
165  * @param vprob VCS_PROB problem definition that gets all of the information
166  *
167  * Note, both objects share the underlying ThermoPhase objects. So, neither
168  * can be const objects.
169  */
170 int vcs_Cantera_to_vprob(MultiPhase* mphase, VCS_PROB* vprob);
171 
172 //! Translate a MultiPhase information into a VCS_PROB problem definition object
173 /*!
174  * This version updates the problem statement information only. All species and
175  * phase definitions remain the same.
176  *
177  * @param mphase MultiPhase object that is the source for all of the information
178  * @param vprob VCS_PROB problem definition that gets all of the information
179  */
180 int vcs_Cantera_update_vprob(MultiPhase* mphase, VCS_PROB* vprob);
181 
182 //! %Cantera's Interface to the Multiphase chemical equilibrium solver.
183 /*!
184  * Class vcs_MultiPhaseEquil is designed to be used to set a mixture
185  * containing one or more phases to a state of chemical equilibrium.
186  *
187  * Note, as currently constructed, the underlying ThermoPhase objects are
188  * shared between the MultiPhase object and this object. Therefore, mix is not
189  * a const argument, and the return parameters are contained in underlying
190  * ThermoPhase objects.
191  *
192  * @ingroup equilfunctions
193  */
195 {
196 public:
198 
199  //! Constructor for the multiphase equilibrium solver
200  /*!
201  * This constructor will initialize the object with a MultiPhase object,
202  * setting up the internal equilibration problem. Note, as currently
203  * constructed, the underlying ThermoPhase objects are shared between the
204  * MultiPhase object and this object. Therefore, mix is not a const
205  * argument, and the return parameters are contained in underlying
206  * ThermoPhase objects.
207  *
208  * @param mix Object containing the MultiPhase object
209  * @param printLvl Determines the amount of printing to stdout
210  * that occurs for each call:
211  * - 0: No printing
212  * - 1: Only printing to the .csv file
213  * - 2: print the soln only
214  * - 3: Print the setup and then the soln only
215  * - 4: Print a table for each iteration
216  * - 5: Print more than a table for each iteration
217  */
218  vcs_MultiPhaseEquil(MultiPhase* mix, int printLvl);
219 
220  virtual ~vcs_MultiPhaseEquil() {}
221 
222  //! Return the index of the ith component
223  /*!
224  * Returns the index of the ith component in the equilibrium
225  * calculation. The index refers to the ordering of the species
226  * in the MultiPhase object.
227  *
228  * @param m Index of the component. Must be between 0 and the
229  * number of components, which can be obtained from the
230  * numComponents() command.
231  */
232  size_t component(size_t m) const ;
233 
234  //! Get the stoichiometric reaction coefficients for a single
235  //! reaction index
236  /*!
237  * This returns a stoichiometric reaction vector for a single
238  * formation reaction for a noncomponent species. There are
239  * (nSpecies() - nComponents) formation reactions. Each
240  * formation reaction will have a value of 1.0 for the species
241  * that is being formed, and the other non-zero coefficients will
242  * all involve the components of the mixture.
243  *
244  * @param rxn Reaction number.
245  * @param nu Vector of coefficients for the formation reaction. Length is
246  * equal to the number of species in the MultiPhase object.
247  */
248  void getStoichVector(size_t rxn, vector_fp& nu);
249 
250  //! return the number of iterations
251  int iterations() const {
252  return m_iter;
253  }
254 
255  //! Equilibrate the solution using the current element abundances
256  //! stored in the MultiPhase object
257  /*!
258  * Use the vcs algorithm to equilibrate the current multiphase mixture.
259  *
260  * @param XY Integer representing what two thermo quantities are
261  * held constant during the equilibration
262  * @param estimateEquil integer indicating whether the solver should
263  * estimate its own initial condition.
264  * - If 0, the initial mole fraction vector in the
265  * ThermoPhase object is used as the initial condition.
266  * - If 1, the initial mole fraction vector is used if
267  * the element abundances are satisfied.
268  * - if -1, the initial mole fraction vector is thrown
269  * out, and an estimate is formulated.
270  * @param printLvl Determines the amount of printing that gets sent to
271  * stdout from the vcs package (Note, you may have to
272  * compile with debug flags to get some printing).
273  * @param err Internal error level
274  * @param maxsteps max steps allowed.
275  * @param loglevel Determines the amount of printing to the output file.
276  */
277  int equilibrate(int XY, int estimateEquil = 0,
278  int printLvl= 0, doublereal err = 1.0e-6,
279  int maxsteps = VCS_MAXSTEPS, int loglevel=-99);
280 
281  //! Equilibrate the solution using the current element abundances
282  //! stored in the MultiPhase object using constant T and P
283  /*!
284  * Use the vcs algorithm to equilibrate the current multiphase mixture.
285  *
286  * @param estimateEquil integer indicating whether the solver should
287  * estimate its own initial condition.
288  * - If 0, the initial mole fraction vector in the
289  * ThermoPhase object is used as the initial condition.
290  * - If 1, the initial mole fraction vector is used if the
291  * element abundances are satisfied.
292  * - if -1, the initial mole fraction vector is thrown
293  * out, and an estimate is formulated.
294  * @param printLvl Determines the amount of printing that gets sent to
295  * stdout from the vcs package (Note, you may have to
296  * compile with debug flags to get some printing).
297  * @param err Internal error level
298  * @param maxsteps max steps allowed.
299  * @param loglevel Determines the amount of printing to the output file.
300  */
301  int equilibrate_TP(int estimateEquil = 0,
302  int printLvl= 0, doublereal err = 1.0e-6,
303  int maxsteps = VCS_MAXSTEPS, int loglevel=-99);
304 
305  //! Equilibrate the solution using the current element abundances
306  //! stored in the MultiPhase object using either constant H and P
307  //! or constant U and P.
308  /*!
309  * Use the vcs algorithm to equilibrate the current multiphase
310  * mixture. The pressure of the calculation is taken from
311  * the current pressure stored with the MultiPhase object.
312  *
313  * @param Htarget Value of the total mixture enthalpy or total internal
314  * energy that will be kept constant. Note, this is and
315  * must be an extensive quantity. units = Joules
316  * @param XY Integer flag indicating what is held constant.
317  * Must be either HP or UP.
318  * @param Tlow Lower limit of the temperature. It's an error condition
319  * if the temperature falls below Tlow.
320  * @param Thigh Upper limit of the temperature. It's an error condition
321  * if the temperature goes higher than Thigh.
322  * @param estimateEquil integer indicating whether the solver
323  * should estimate its own initial condition.
324  * - If 0, the initial mole fraction vector in the
325  * ThermoPhase object is used as the initial condition.
326  * - If 1, the initial mole fraction vector is used if the
327  * element abundances are satisfied.
328  * - if -1, the initial mole fraction vector is thrown
329  * out, and an estimate is formulated.
330  * @param printLvl Determines the amount of printing that
331  * gets sent to stdout from the vcs package
332  * (Note, you may have to compile with debug
333  * flags to get some printing). See main
334  * constructor call for meaning of the levels.
335  * @param err Internal error level
336  * @param maxsteps max steps allowed.
337  * @param loglevel Determines the amount of printing to the output file.
338  */
339  int equilibrate_HP(doublereal Htarget, int XY, double Tlow, double Thigh,
340  int estimateEquil = 0,
341  int printLvl = 0, doublereal err = 1.0E-6,
342  int maxsteps = VCS_MAXSTEPS, int loglevel=-99);
343 
344  //! Equilibrate the solution using the current element abundances
345  //! stored in the MultiPhase object using constant S and P.
346  /*!
347  * Use the vcs algorithm to equilibrate the current multiphase
348  * mixture. The pressure of the calculation is taken from
349  * the current pressure stored with the MultiPhase object.
350  *
351  * @param Starget Value of the total mixture entropy that will be kept
352  * constant. Note, this is and must be an extensive
353  * quantity. units = Joules/K
354  * @param Tlow Lower limit of the temperature. It's an error condition
355  * if the temperature falls below Tlow.
356  * @param Thigh Upper limit of the temperature. It's an error condition
357  * if the temperature goes higher than Thigh.
358  * @param estimateEquil integer indicating whether the solver should
359  * estimate its own initial condition.
360  * - If 0, the initial mole fraction vector in the
361  * ThermoPhase object is used as the initial condition.
362  * - If 1, the initial mole fraction vector is used if the
363  * element abundances are satisfied.
364  * - If -1, the initial mole fraction vector is thrown
365  * out, and an estimate is formulated.
366  * @param printLvl Determines the amount of printing that
367  * gets sent to stdout from the vcs package
368  * (Note, you may have to compile with debug
369  * flags to get some printing). See main
370  * constructor call for meaning of the levels.
371  * @param err Internal error level
372  * @param maxsteps max steps allowed.
373  * @param loglevel Determines the amount of printing to the output file.
374  */
375  int equilibrate_SP(doublereal Starget, double Tlow, double Thigh,
376  int estimateEquil = 0,
377  int printLvl = 0, doublereal err = 1.0E-6,
378  int maxsteps = VCS_MAXSTEPS, int loglevel=-99);
379 
380  //! Equilibrate the solution using the current element abundances stored
381  //! in the MultiPhase object using constant V and constant T, H, U or S.
382  /*!
383  * Use the vcs algorithm to equilibrate the current multiphase
384  * mixture. The pressure of the calculation is taken from
385  * the current pressure stored with the MultiPhase object.
386  *
387  * @param XY Integer flag indicating what is held constant.
388  * Must be either TV, HV, UV, or SV.
389  * @param xtarget Value of the total thermodynamic parameter to
390  * be held constant in addition to V.
391  * Note, except for T, this must be an extensive
392  * quantity. units = Joules/K or Joules
393  * @param estimateEquil integer indicating whether the solver should
394  * estimate its own initial condition.
395  * - If 0, the initial mole fraction vector in the
396  * ThermoPhase object is used as the initial condition.
397  * - If 1, the initial mole fraction vector is used if the
398  * element abundances are satisfied.
399  * - if -1, the initial mole fraction vector is thrown
400  * out, and an estimate is formulated.
401  * @param printLvl Determines the amount of printing that gets sent to
402  * stdout from the vcs package (Note, you may have to
403  * compile with debug flags to get some printing). See
404  * main constructor call for meaning of the levels.
405  * @param err Internal error level
406  * @param maxsteps max steps allowed.
407  * @param logLevel Determines the amount of printing to the output file.
408  */
409  int equilibrate_TV(int XY, doublereal xtarget,
410  int estimateEquil = 0,
411  int printLvl = 0, doublereal err = 1.0E-6,
412  int maxsteps = VCS_MAXSTEPS, int logLevel = -99);
413 
414  //! Determine the phase stability of a phase at the current conditions
415  /*!
416  * Equilibration of the solution is not done before the determination is made.
417  *
418  * @param iph Phase number to determine the equilibrium. If the phase
419  * has a non-zero mole number....
420  * @param funcStab Value of the phase pop function
421  * @param printLvl Determines the amount of printing that gets sent to
422  * stdout from the vcs package (Note, you may have to
423  * compile with debug flags to get some printing).
424  * @param logLevel Determines the amount of printing to the output file.
425  */
426  int determine_PhaseStability(int iph, double& funcStab, int printLvl= 0, int logLevel = -99);
427 
428  //! Report the equilibrium answer in a comma separated table format
429  /*!
430  * This routine is used for in the test suite.
431  *
432  * @param reportFile Base name of the file to get the report.
433  * File name is incremented by 1 for each report.
434  */
435  void reportCSV(const std::string& reportFile);
436 
437  //! reports the number of components in the equilibration problem
438  /*!
439  * @return returns the number of components. If an equilibrium
440  * problem hasn't been solved yet, it returns -1.
441  */
442  size_t numComponents() const;
443 
444  //! Reports the number of element constraints in the equilibration problem
445  /*!
446  * @return returns the number of element constraints. If an equilibrium
447  * problem hasn't been solved yet, it returns -1.
448  */
449  size_t numElemConstraints() const;
450 
451  // Friend functions
452  friend int vcs_Cantera_to_vprob(MultiPhase* mphase, VCS_PROB* vprob);
453  friend int vcs_Cantera_update_vprob(MultiPhase* mphase, VCS_PROB* vprob);
454 
455 protected:
456  //! Vector that takes into account of the current sorting of the species
457  /*!
458  * The index of m_order is the original k value of the species in the
459  * multiphase. The value of m_order, k_sorted, is the current value of
460  * the species index.
461  *
462  * `m_order[korig] = k_sorted`
463  */
465 
466  //! Object which contains the problem statement
467  /*!
468  * The problem statement may contain some subtleties. For example, the
469  * element constraints may be different than just an element conservation
470  * contraint equations. There may be kinetically frozen degrees of
471  * freedom. There may be multiple electrolyte phases with zero charge
472  * constraints. All of these make the problem statement different than
473  * the simple element conservation statement.
474  */
476 
477  //! Pointer to the MultiPhase mixture that will be equilibrated.
478  /*!
479  * Equilibrium solutions will be returned via this variable.
480  */
482 
483  //! Print level from the VCSnonlinear package
484  /*!
485  * (Note, you may have to compile with debug flags to get some printing).
486  *
487  * - 0: No IO from the routine whatsoever
488  * - 1: file IO from reportCSV() carried out. One line print statements
489  * from equilibrate_XY() functions
490  * - 2: Problem statement information from vcs_Cantera_update_vprob();
491  * Final state of the system from vcs_solve_TP()
492  * - 3: Several more setup tables; Problem initialization routine
493  * - 4: One table for each iteration within vcs_solve_Tp()
494  * - 5: Multiple tables for each iteration within vcs_solve_TP()
495  */
497 
498  //! Stoichiometric matrix
500 
501  //! Iteration Count
502  int m_iter;
503 
504  //! Vector of indices for species that are included in the calculation.
505  /*!
506  * This is used to exclude pure-phase species with invalid thermo data
507  */
509 
510  //! The object that does all of the equilibration work.
511  /*!
512  * VCS_SOLVE will have different ordering for species and element constraints
513  * than this object or the VCS_PROB object.
514  */
516 };
517 
518 //! Global hook for turning on and off time printing.
519 /*!
520  * Default is to allow printing. But, you can assign this to zero globally to
521  * turn off all time printing. This is helpful for test suite purposes where
522  * you are interested in differences in text files.
523  */
524 extern int vcs_timing_print_lvl;
525 
526 }
527 
528 #endif
vector_int m_order
Vector that takes into account of the current sorting of the species.
int equilibrate_TP(int estimateEquil=0, int printLvl=0, doublereal 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...
MultiPhase * m_mix
Pointer to the MultiPhase mixture that will be equilibrated.
size_t numComponents() const
reports the number of components in the equilibration problem
int equilibrate_HP(doublereal Htarget, int XY, double Tlow, double Thigh, int estimateEquil=0, int printLvl=0, doublereal 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...
#define VCS_MAXSTEPS
Maximum steps in the inner loop.
Definition: vcs_defs.h:89
friend int vcs_Cantera_update_vprob(MultiPhase *mphase, VCS_PROB *vprob)
Translate a MultiPhase information into a VCS_PROB problem definition object.
int m_printLvl
Print level from the VCSnonlinear package.
int vcs_timing_print_lvl
Global hook for turning on and off time printing.
Definition: vcs_solve.cpp:26
Headers for the MultiPhase object that is used to set up multiphase equilibrium problems (see Equilib...
void reportCSV(const std::string &reportFile)
Report the equilibrium answer in a comma separated table format.
int vcs_Cantera_update_vprob(MultiPhase *mphase, VCS_PROB *vprob)
Translate a MultiPhase information into a VCS_PROB problem definition object.
ThermoPhase thermo_t
typedef for the ThermoPhase class
Definition: ThermoPhase.h:1660
int vcs_Cantera_to_vprob(MultiPhase *mphase, VCS_PROB *vprob)
Translate a MultiPhase object into a VCS_PROB problem definition object.
std::vector< int > vector_int
Vector of ints.
Definition: ct_defs.h:159
Header file for the internal object that holds the vcs equilibrium problem (see Class VCS_SOLVE and E...
Cantera's Interface to the Multiphase chemical equilibrium solver.
A class for multiphase mixtures.
Definition: MultiPhase.h:53
int iterations() const
return the number of iterations
int equilibrate_SP(doublereal Starget, double Tlow, double Thigh, int estimateEquil=0, int printLvl=0, doublereal 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...
size_t numElemConstraints() const
Reports the number of element constraints in the equilibration problem.
size_t component(size_t m) const
Return the index of the ith component.
int vcs_determine_PhaseStability(MultiPhase &s, int iphase, double &funcStab, int printLvl, int loglevel)
Determine the phase stability of a single phase given the current conditions in a MultiPhase object...
Header for the Interface class for the vcs thermo equilibrium solver package,.
int equilibrate(int XY, int estimateEquil=0, int printLvl=0, doublereal err=1.0e-6, int maxsteps=VCS_MAXSTEPS, int loglevel=-99)
Equilibrate the solution using the current element abundances stored in the MultiPhase object...
void getStoichVector(size_t rxn, vector_fp &nu)
Get the stoichiometric reaction coefficients for a single reaction index.
int determine_PhaseStability(int iph, double &funcStab, int printLvl=0, int logLevel=-99)
Determine the phase stability of a phase at the current conditions.
VCS_SOLVE m_vsolve
The object that does all of the equilibration work.
std::vector< double > vector_fp
Turn on the use of stl vectors for the basic array type within cantera Vector of doubles.
Definition: ct_defs.h:157
VCS_PROB m_vprob
Object which contains the problem statement.
friend int vcs_Cantera_to_vprob(MultiPhase *mphase, VCS_PROB *vprob)
Translate a MultiPhase object into a VCS_PROB problem definition object.
DenseMatrix m_N
Stoichiometric matrix.
int vcs_equilibrate(thermo_t &s, const char *XY, int estimateEquil, int printLvl, int solver, doublereal rtol, int maxsteps, int maxiter, int loglevel)
Set a single-phase chemical solution to chemical equilibrium.
vector_int m_species
Vector of indices for species that are included in the calculation.
Interface class for the vcs thermo equilibrium solver package, which generally describes the problem ...
Definition: vcs_prob.h:24
int equilibrate_TV(int XY, doublereal xtarget, int estimateEquil=0, int printLvl=0, doublereal 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...
A class for full (non-sparse) matrices with Fortran-compatible data storage, which adds matrix operat...
Definition: DenseMatrix.h:71
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:49
int vcs_equilibrate_1(MultiPhase &s, int ixy, int estimateEquil, int printLvl, int solver, doublereal tol, int maxsteps, int maxiter, int loglevel)
Set a multi-phase chemical solution to chemical equilibrium.