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