chombo-discharge
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
KMCDualStateReaction< State, T > Class Template Reference

Reaction type for advancing a KMCDualState for Kinetic Monte Carlo. More...

#include <CD_KMCDualStateReaction.H>

Public Member Functions

 KMCDualStateReaction ()=default
 Disallowed constructor. Use the full constructor.
 
 KMCDualStateReaction (const KMCDualStateReaction &)=default
 Copy constructor (uses default).
 
 KMCDualStateReaction (const std::list< size_t > &a_lhsReactives, const std::list< size_t > &a_rhsReactives, const std::list< size_t > &a_rhsNonReactives) noexcept
 Full constructor. More...
 
virtual ~KMCDualStateReaction ()
 Destructor.
 
Real & rate () const noexcept
 Get modifiable reaction rate. More...
 
population (const size_t &a_reactant, const State &a_state) const noexcept
 Get the population of the reactant in the input state. More...
 
Real propensity (const State &a_state) const noexcept
 Compute the propensity function for this reaction type. More...
 
computeCriticalNumberOfReactions (const State &a_state) const noexcept
 Compute the number of times the reaction can fire before exhausting one of the reactants. More...
 
std::list< size_t > getReactants () const noexcept
 Get the reactants in the reaction. More...
 
std::list< size_t > getReactiveProducts () const noexcept
 Get the products from the reaction. More...
 
std::list< size_t > getNonReactiveProducts () const noexcept
 Get the non-reactive products from the reaction. More...
 
getStateChange (const size_t a_reactant) const noexcept
 Get the state change due to a change in the input reactant. More...
 
void advanceState (State &a_state, const T &a_numReactions) const noexcept
 Advance the incoming state with the number of reactions. More...
 

Protected Member Functions

void computeStateChanges () noexcept
 Compute state change.
 
void sanityCheck (const State &a_state) const noexcept
 Debugging function which ensures that the class data holders do not reach out of the incoming state. More...
 

Protected Attributes

Real m_rate
 Reaction rate.
 
Real m_propensityFactor
 Factor for the case where two or more particles of the same species react. More...
 
std::list< size_t > m_lhsReactives
 Reactive species.
 
std::list< size_t > m_rhsReactives
 Product species.
 
std::list< size_t > m_rhsNonReactives
 Non-reactive product species.
 
std::map< size_t, T > m_reactiveStateChange
 State change for reactants/products.
 
std::map< size_t, T > m_nonReactiveStateChange
 State change for non-reactive products.
 

Detailed Description

template<typename State = KMCDualState<long long>, typename T = long long>
class KMCDualStateReaction< State, T >

Reaction type for advancing a KMCDualState for Kinetic Monte Carlo.

Note
T is the integer type used for the state.

Constructor & Destructor Documentation

◆ KMCDualStateReaction()

template<typename State , typename T >
KMCDualStateReaction< State, T >::KMCDualStateReaction ( const std::list< size_t > &  a_lhsReactives,
const std::list< size_t > &  a_rhsReactives,
const std::list< size_t > &  a_rhsNonReactives 
)
inlinenoexcept

Full constructor.

Parameters
[in]a_lhsReactivesReactive species on the left-hand side of the reaction (i.e., the reactants)
[in]a_rhsReactivesReactive species on the right-hand side of the reaction (i.e., the products)
[in]a_rhsNonReactivesNon-reactive species on the right-hand side of the reaction (i.e., piggybacked products)

Member Function Documentation

◆ advanceState()

template<typename State , typename T >
void KMCDualStateReaction< State, T >::advanceState ( State &  a_state,
const T &  a_numReactions 
) const
inlinenoexcept

Advance the incoming state with the number of reactions.

Parameters
[in,out]a_stateState vector
[in]a_numReactionsNumber of reactions.

◆ computeCriticalNumberOfReactions()

template<typename State , typename T >
T KMCDualStateReaction< State, T >::computeCriticalNumberOfReactions ( const State &  a_state) const
inlinenoexcept

Compute the number of times the reaction can fire before exhausting one of the reactants.

Parameters
[in]a_stateState vector

◆ getNonReactiveProducts()

template<typename State , typename T >
std::list< size_t > KMCDualStateReaction< State, T >::getNonReactiveProducts
inlinenoexcept

Get the non-reactive products from the reaction.

Returns
m_rhsNonReactives

◆ getReactants()

template<typename State , typename T >
std::list< size_t > KMCDualStateReaction< State, T >::getReactants
inlinenoexcept

Get the reactants in the reaction.

Returns
m_lhsReactives

◆ getReactiveProducts()

template<typename State , typename T >
std::list< size_t > KMCDualStateReaction< State, T >::getReactiveProducts
inlinenoexcept

Get the products from the reaction.

Returns
m_rhsReactives

◆ getStateChange()

template<typename State , typename T >
T KMCDualStateReaction< State, T >::getStateChange ( const size_t  a_reactant) const
inlinenoexcept

Get the state change due to a change in the input reactant.

Parameters
[in]a_reactantReactive species

◆ population()

template<typename State , typename T >
T KMCDualStateReaction< State, T >::population ( const size_t &  a_reactant,
const State &  a_state 
) const
inlinenoexcept

Get the population of the reactant in the input state.

Parameters
[in]a_reactantReactive species
[in]a_stateState vector

◆ propensity()

template<typename State , typename T >
Real KMCDualStateReaction< State, T >::propensity ( const State &  a_state) const
inlinenoexcept

Compute the propensity function for this reaction type.

Parameters
[in]a_stateState vector
Note
User should set the rate before calling this routine.

◆ rate()

template<typename State , typename T >
Real & KMCDualStateReaction< State, T >::rate
inlinenoexcept

Get modifiable reaction rate.

Returns
m_rate

◆ sanityCheck()

template<typename State , typename T >
void KMCDualStateReaction< State, T >::sanityCheck ( const State &  a_state) const
inlineprotectednoexcept

Debugging function which ensures that the class data holders do not reach out of the incoming state.

This is necessary because PlasmaReaction does not have compile-time size restrictions on the incoming state. The internals of this method uses Chombo assertions so the compiler should be able to take this function out of the executable if compiling with the correct flags.

Member Data Documentation

◆ m_propensityFactor

template<typename State = KMCDualState<long long>, typename T = long long>
Real KMCDualStateReaction< State, T >::m_propensityFactor
protected

Factor for the case where two or more particles of the same species react.

For reactions X + X -> null the propensity is k * X * (X-1)/2 because there are X * (X-1)/2 unique pairs of particles in the cell.


The documentation for this class was generated from the following files: