1 /**
2  * @file BulkKinetics.h
3  * @ingroup chemkinetics
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 CT_BULKKINETICS_H
10 #define CT_BULKKINETICS_H
11 
12 #include "Kinetics.h"
13 #include "RateCoeffMgr.h"
14 #include "ThirdBodyCalc.h"
15 #include "cantera/kinetics/MultiRate.h"
16 
17 namespace Cantera
18 {
19 
20 class ElementaryReaction2;
21 
22 //! Partial specialization of Kinetics for chemistry in a single bulk phase
23 class BulkKinetics : public Kinetics
24 {
25 public:
26     BulkKinetics(ThermoPhase* thermo = 0);
27 
28     virtual bool isReversible(size_t i);
29 
30     virtual void getDeltaGibbs(doublereal* deltaG);
31     virtual void getDeltaEnthalpy(doublereal* deltaH);
32     virtual void getDeltaEntropy(doublereal* deltaS);
33 
34     virtual void getDeltaSSGibbs(doublereal* deltaG);
35     virtual void getDeltaSSEnthalpy(doublereal* deltaH);
36     virtual void getDeltaSSEntropy(doublereal* deltaS);
37 
38     virtual void getRevRateConstants(double* krev,
39                                      bool doIrreversible = false);
40 
41     virtual bool addReaction(shared_ptr<Reaction> r, bool resize=true);
42     virtual void modifyReaction(size_t i, shared_ptr<Reaction> rNew);
43 
44     virtual void resizeSpecies();
45 
46     virtual void setMultiplier(size_t i, double f);
47     virtual void invalidateCache();
48 
49     void addThirdBody(shared_ptr<Reaction> r);
50 
51 protected:
52     virtual void addElementaryReaction(ElementaryReaction2& r);
53     virtual void modifyElementaryReaction(size_t i, ElementaryReaction2& rNew);
54 
55     //! Vector of rate handlers
56     std::vector<unique_ptr<MultiRateBase>> m_bulk_rates;
57     std::map<std::string, size_t> m_bulk_types; //!< Mapping of rate handlers
58 
59     Rate1<Arrhenius> m_rates;
60     std::vector<size_t> m_revindex; //!< Indices of reversible reactions
61     std::vector<size_t> m_irrev; //!< Indices of irreversible reactions
62 
63     //! Difference between the global reactants order and the global products
64     //! order. Of type "double" to account for the fact that we can have real-
65     //! valued stoichiometries.
66     vector_fp m_dn;
67 
68     ThirdBodyCalc m_multi_concm; //!< used with MultiRate evaluator
69     vector_fp concm_multi_values; //!< concentrations of third-body collision partners
70     std::vector<size_t> m_multi_indices; //!< reaction indices
71 
72     //! Third body concentrations
73     vector_fp m_concm;
74 
75     //! Activity concentrations, as calculated by ThermoPhase::getActivityConcentrations
76     vector_fp m_act_conc;
77 
78     //! Physical concentrations, as calculated by ThermoPhase::getConcentrations
79     vector_fp m_phys_conc;
80 
81     vector_fp m_grt;
82 
83     bool m_ROP_ok;
84     doublereal m_temp;
85 };
86 
87 }
88 
89 #endif
90