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