chombo-discharge
CD_KMCSingleStateReaction.H
Go to the documentation of this file.
1 /* chombo-discharge
2  * Copyright © 2022 SINTEF Energy Research.
3  * Please refer to Copyright.txt and LICENSE in the chombo-discharge root directory.
4  */
5 
12 #ifndef CD_KMCSingleStateReaction_H
13 #define CD_KMCSingleStateReaction_H
14 
15 // Std includes
16 #include <map>
17 #include <vector>
18 #include <list>
19 
20 // Chombo includes
21 #include <REAL.H>
22 
23 // Our includes
24 #include <CD_KMCSingleState.H>
25 #include <CD_NamespaceHeader.H>
26 
31 template <typename State = KMCSingleState<long long>, typename T = long long>
33 {
34 public:
39 
44 
51  inline KMCSingleStateReaction(const std::list<size_t>& a_reactants, const std::list<size_t>& a_products) noexcept;
52 
56  inline virtual ~KMCSingleStateReaction();
57 
62  inline Real&
63  rate() const noexcept;
64 
70  inline T
71  population(const size_t& a_reactant, const State& a_state) const noexcept;
72 
78  inline Real
79  propensity(const State& a_state) const noexcept;
80 
85  inline T
86  computeCriticalNumberOfReactions(const State& a_state) const noexcept;
87 
92  inline std::list<size_t>
93  getReactants() const noexcept;
94 
99  inline T
100  getStateChange(const size_t a_reactant) const noexcept;
101 
107  inline void
108  advanceState(State& a_state, const T& a_numReactions) const noexcept;
109 
110 protected:
114  mutable Real m_rate;
115 
121 
125  std::list<size_t> m_reactants;
126 
130  std::list<size_t> m_products;
131 
135  std::map<size_t, T> m_stateChange;
136 
140  inline void
141  computeStateChanges() noexcept;
142 };
143 
144 #include <CD_NamespaceFooter.H>
145 
147 
148 #endif
Implementation of CD_KMCSingleStateReaction.H.
Declaration of a simple state vector for running Kinetic Monte Carlo for plasma problems.
Reaction type for advancing a KMCSingleState for Kinetic Monte Carlo.
Definition: CD_KMCSingleStateReaction.H:33
std::list< size_t > getReactants() const noexcept
Get the reactants involved in the reaction.
Definition: CD_KMCSingleStateReactionImplem.H:139
virtual ~KMCSingleStateReaction()
Destructor.
Definition: CD_KMCSingleStateReactionImplem.H:30
std::map< size_t, T > m_stateChange
State change for reactants/products.
Definition: CD_KMCSingleStateReaction.H:135
std::list< size_t > m_products
Products.
Definition: CD_KMCSingleStateReaction.H:130
Real propensity(const State &a_state) const noexcept
Compute the propensity function for this reaction type.
Definition: CD_KMCSingleStateReactionImplem.H:103
std::list< size_t > m_reactants
Reactants.
Definition: CD_KMCSingleStateReaction.H:125
T population(const size_t &a_reactant, const State &a_state) const noexcept
Get the population of the reactant in the input state.
Definition: CD_KMCSingleStateReactionImplem.H:96
Real m_propensityFactor
Factor for the case where two or more particles of the same species react.
Definition: CD_KMCSingleStateReaction.H:120
T getStateChange(const size_t a_reactant) const noexcept
Get the state change due to a change in the input reactant species.
Definition: CD_KMCSingleStateReactionImplem.H:146
Real m_rate
Reaction rate.
Definition: CD_KMCSingleStateReaction.H:114
void computeStateChanges() noexcept
Compute state change.
Definition: CD_KMCSingleStateReactionImplem.H:35
T computeCriticalNumberOfReactions(const State &a_state) const noexcept
Compute the number of times the reaction can fire before exhausting one of the reactants.
Definition: CD_KMCSingleStateReactionImplem.H:120
void advanceState(State &a_state, const T &a_numReactions) const noexcept
Advance the incoming state with the number of reactions.
Definition: CD_KMCSingleStateReactionImplem.H:159
KMCSingleStateReaction()=default
Disallowed constructor. Use the full constructor.
KMCSingleStateReaction(const KMCSingleStateReaction &)=default
Copy constructor (uses default).
Real & rate() const noexcept
Get modifiable reaction rate.
Definition: CD_KMCSingleStateReactionImplem.H:89