chombo-discharge
Loading...
Searching...
No Matches
CD_KMCSingleStateReaction.H
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2021-2026 SINTEF Energy Research
3 *
4 * SPDX-License-Identifier: GPL-3.0-or-later
5 */
6
13#ifndef CD_KMCSINGLESTATEREACTION_H
14#define CD_KMCSINGLESTATEREACTION_H
15
16// Std includes
17#include <map>
18#include <vector>
19#include <list>
20
21// Chombo includes
22#include <REAL.H>
23
24// Our includes
25#include <CD_KMCSingleState.H>
26#include <CD_NamespaceHeader.H>
27
32template <typename State = KMCSingleState<long long>, typename T = long long>
34{
35public:
40
45
52 inline KMCSingleStateReaction(const std::list<size_t>& a_reactants, const std::list<size_t>& a_products) noexcept;
53
57 inline virtual ~KMCSingleStateReaction();
58
63 inline Real&
64 rate() const noexcept;
65
72 static inline T
73 population(const size_t& a_reactant, const State& a_state) noexcept;
74
81 inline Real
82 propensity(const State& a_state) const noexcept;
83
89 inline T
90 computeCriticalNumberOfReactions(const State& a_state) const noexcept;
91
99 inline const std::list<size_t>&
100 getReactants() const noexcept;
101
107 inline T
108 getStateChange(const size_t a_particleReactant) const noexcept;
109
115 inline void
116 advanceState(State& a_state, const T& a_numReactions) const noexcept;
117
118protected:
122 mutable Real m_rate;
123
130
134 std::list<size_t> m_reactants;
135
139 std::list<size_t> m_products;
140
144 std::map<size_t, T> m_stateChange;
145
149 inline void
150 computeStateChanges() noexcept;
151};
152
153#include <CD_NamespaceFooter.H>
154
156
157#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:34
virtual ~KMCSingleStateReaction()
Destructor.
Definition CD_KMCSingleStateReactionImplem.H:29
std::map< size_t, T > m_stateChange
State change for reactants/products.
Definition CD_KMCSingleStateReaction.H:144
std::list< size_t > m_products
Products.
Definition CD_KMCSingleStateReaction.H:139
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:134
Real m_propensityFactor
Factor for the case where two or more particles of the same species react.
Definition CD_KMCSingleStateReaction.H:129
T getStateChange(const size_t a_particleReactant) 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:122
void computeStateChanges() noexcept
Compute state change vectors from the reactant/product lists.
Definition CD_KMCSingleStateReactionImplem.H:34
static T population(const size_t &a_reactant, const State &a_state) noexcept
Get the population of the reactant in the input state.
Definition CD_KMCSingleStateReactionImplem.H:96
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
Default constructor.
KMCSingleStateReaction(const KMCSingleStateReaction &)=default
Copy constructor.
const std::list< size_t > & getReactants() const noexcept
Get the reactants involved in the reaction.
Definition CD_KMCSingleStateReactionImplem.H:139
Real & rate() const noexcept
Get modifiable reaction rate.
Definition CD_KMCSingleStateReactionImplem.H:89