Cantera  2.5.1
importKinetics.h
Go to the documentation of this file.
1 /**
2  * @file importKinetics.h
3  * Definitions of global routines for the importing
4  * of data from XML files (see \ref inputfiles).
5  *
6  * This file contains routines which are global routines, i.e.,
7  * not part of any object. These routine take as input, ctml
8  * pointers to data, and pointers to %Cantera objects. The purpose
9  * of these routines is to initialize the %Cantera objects with data
10  * from the ctml tree structures.
11  */
12 
13 // This file is part of Cantera. See License.txt in the top-level directory or
14 // at https://cantera.org/license.txt for license and copyright information.
15 
16 #ifndef CT_IMPORTKINETICS_H
17 #define CT_IMPORTKINETICS_H
18 
19 #include "Kinetics.h"
20 
21 namespace Cantera
22 {
23 
24 //! Install information about reactions into the kinetics object, kin.
25 /*!
26  * At this point, parent usually refers to the phase XML element. One of the
27  * children of this element is reactionArray, the element which determines
28  * where in the XML file to look up the reaction rate data.
29  *
30  * @param p parent XML phase element
31  * @param kin Kinetics object to install reactions into
32  * @param default_phase The default_phase is the default phase to assume when
33  * looking up species.
34  * @param check_for_duplicates Check for reactions with exactly the same
35  * reactants and products.
36  *
37  * @return
38  * On return, if reaction instantiation goes correctly, return true.
39  * If there is a problem, return false.
40  *
41  * @deprecated The XML input format is deprecated and will be removed in
42  * Cantera 3.0.
43  *
44  * @ingroup kineticsmgr
45  */
46 bool installReactionArrays(const XML_Node& p, Kinetics& kin,
47  std::string default_phase,
48  bool check_for_duplicates = false);
49 
50 //! Import a reaction mechanism for a phase or an interface.
51 /*!
52  * This routine will import a reaction mechanism into a kinetics object. The
53  * reaction mechanism may either be homogeneous or heterogeneous, involving
54  * multiple ThermoPhase objects. The hosting phase should be included as the
55  * first argument. For example, if phase I is an interface phase between bulk
56  * phases A and B. Then, the XML_Node for phase I should be the first
57  * argument. The vector of ThermoPhase objects should consist of pointers to
58  * phases I, A, and B.
59  *
60  * @param phase This is an XML node containing a description of the owning
61  * phase for the kinetics object. Within the phase is a XML
62  * element called reactionArray containing the location of the
63  * description of the reactions that make up the kinetics object.
64  * Also within the phase is an XML element called phaseArray
65  * containing a listing of other phases that participate in the
66  * kinetics mechanism.
67  *
68  * @param th This is a list of ThermoPhase pointers which must include all
69  * of the phases that participate in the kinetics operator. All
70  * of the phases must have already been initialized and formed
71  * within Cantera. However, their pointers should not have been
72  * added to the Kinetics object; this addition is carried out
73  * here. Additional phases may be include in the list; these have
74  * no effect.
75  *
76  * @param kin This is a pointer to a kinetics manager class that will be
77  * initialized with the kinetics mechanism. Inherited Kinetics
78  * classes should be used here.
79  *
80  * @deprecated The XML input format is deprecated and will be removed in
81  * Cantera 3.0.
82  *
83  * @ingroup kineticsmgr
84  */
85 bool importKinetics(const XML_Node& phase, std::vector<ThermoPhase*> th,
86  Kinetics* kin);
87 
88 //! Build a single-phase ThermoPhase object with associated kinetics mechanism.
89 /*!
90  * In a single call, this routine initializes a ThermoPhase object and a
91  * homogeneous kinetics object for a phase. It returns the fully initialized
92  * ThermoPhase object pointer and kinetics pointer.
93  *
94  * @param root pointer to the XML tree which will be searched to find the
95  * XML phase element.
96  * @param id Name of the phase to be searched for.
97  * @param nm Name of the XML element. Should be "phase"
98  * @param th Pointer to a bare ThermoPhase object, which will be initialized
99  * by this operation.
100  * @param kin Pointer to a bare Kinetics object, which will be initialized
101  * by this operation to a homogeneous kinetics manager
102  * @return
103  * Returns true if all went well. If there are errors, it will return false.
104  *
105  * For Example
106  *
107  * @code
108  * ThermoPhase *th = new ThermoPhase();
109  * Kinetics *kin = new Kinetics();
110  * XML_Node *root = get_XML_File("gri30.xml");
111  * ok = buildSolutionFromXML(root, "gri30_mix", "phase", th, kin)
112  * @endcode
113  *
114  * @deprecated The XML input format is deprecated and will be removed in
115  * Cantera 3.0.
116  *
117  * @ingroup inputfiles
118  * @see importKinetics()
119  */
120 bool buildSolutionFromXML(XML_Node& root, const std::string& id,
121  const std::string& nm, ThermoPhase* th, Kinetics* kin);
122 
123 //! Check to ensure that all electrochemical reactions are specified correctly
124 /*!
125  * This function ensures the user has correctly specified all electrochemical
126  * reactions. The routine counts the amount of charge (i.e. number of electron
127  * elements specified for each species in each phase) for both reactants and
128  * products. If net charge transfer phases during a reaction, the reaction is
129  * electrochemical. If not already specified as such, the function defines the
130  * reaction as electrochemical, corrects the reaction attributes, and sets
131  * beta = 0.5.
132  *
133  * @param p This is an XML node containing a description of the owning
134  * phase for the kinetics object.
135  * @param kin This is a pointer to a kinetics manager class.
136  * @param r This is the reaction node that is being evaluated
137  * @return The function always returns true.
138  *
139  * @deprecated The XML input format is deprecated and will be removed in
140  * Cantera 3.0.
141  */
142 bool checkElectrochemReaction(const XML_Node& p, Kinetics& kin, const XML_Node& r);
143 
144 
145 }
146 
147 #endif
Base class for kinetics managers and also contains the kineticsmgr module documentation (see Kinetics...
bool buildSolutionFromXML(XML_Node &root, const std::string &id, const std::string &nm, ThermoPhase *th, Kinetics *kin)
Build a single-phase ThermoPhase object with associated kinetics mechanism.
bool importKinetics(const XML_Node &phase, std::vector< ThermoPhase * > th, Kinetics *k)
Import a reaction mechanism for a phase or an interface.
bool installReactionArrays(const XML_Node &p, Kinetics &kin, std::string default_phase, bool check_for_duplicates)
Install information about reactions into the kinetics object, kin.
Namespace for the Cantera kernel.
Definition: AnyMap.cpp:264
bool checkElectrochemReaction(const XML_Node &p, Kinetics &kin, const XML_Node &r)
Check to ensure that all electrochemical reactions are specified correctly.