23#include <CD_NamespaceHeader.H>
53template <
typename R,
typename State,
typename T =
long long>
481#include <CD_NamespaceFooter.H>
Implementation of CD_KMCSolver.H.
KMCLeapPropagator
Supported propagators for hybrid tau leaping.
Definition CD_KMCSolver.H:33
Class for running Kinetic Monte-Carlo simulations.
Definition CD_KMCSolver.H:55
KMCSolver(const KMCSolver &)=default
Disallowed copy constructor.
Real m_eps
Maximum permitted change in propensities for non-critical reactions.
Definition CD_KMCSolver.H:461
virtual ~KMCSolver() noexcept
Destructor.
Definition CD_KMCSolverImplem.H:45
void advanceHybrid(State &a_state, const Real a_dt, const KMCLeapPropagator &a_leapPropagator=KMCLeapPropagator::ExplicitEuler) const noexcept
Advance using Cao et. al. hybrid algorithm over the input time. This can end up using substepping.
Definition CD_KMCSolverImplem.H:958
void stepPRC(State &a_state, const Real a_dt) const noexcept
Perform one leaping step using the PRC method for ALL reactions over a time step a_dt.
Definition CD_KMCSolverImplem.H:612
std::vector< std::vector< int > > m_nu
List of state changes for each reaction.
Definition CD_KMCSolver.H:478
void stepMidpoint(State &a_state, const Real a_dt) const noexcept
Perform one leaping step using the midpoint method for ALL reactions over a time step a_dt.
Definition CD_KMCSolverImplem.H:567
Real computeDt(const State &a_state, const ReactionList &a_reactions, const std::vector< Real > &a_propensities, const Real a_epsilon) const noexcept
Compute a time step, using the leap condition on the mean value with eps = 1.
Definition CD_KMCSolverImplem.H:361
void define(const ReactionList &a_reactions) noexcept
Define function. Sets the reactions.
Definition CD_KMCSolverImplem.H:52
void setSolverParameters(const T a_numCrit, const T a_numSSA, const T a_maxIter, const Real a_eps, const Real a_SSAlim, const Real a_exitTol) noexcept
Set solver parameters.
Definition CD_KMCSolverImplem.H:64
KMCSolver() noexcept
Default constructor – must subsequently define the object.
Definition CD_KMCSolverImplem.H:29
KMCSolver(const KMCSolver &&)=delete
Disallowed move constructor.
std::vector< std::vector< T > > getNu(const State &a_state, const ReactionList &a_reactions) const noexcept
Compute the state vector changes for all reactions.
Definition CD_KMCSolverImplem.H:83
ReactionList m_reactions
List of reactions used when advancing states.
Definition CD_KMCSolver.H:440
Real m_exitTol
Exit tolerance for implicit solvers.
Definition CD_KMCSolver.H:471
Real getCriticalTimeStep(const State &a_state) const noexcept
Get the time to the next critical reaction.
Definition CD_KMCSolverImplem.H:204
void stepExplicitEuler(State &a_state, const Real a_dt) const noexcept
Perform one plain tau-leaping step using ALL reactions.
Definition CD_KMCSolverImplem.H:534
T m_maxIter
Maximum number of iterations for implicit solvers.
Definition CD_KMCSolver.H:456
T m_numSSA
Maximum number of SSA steps to run when switching into SSA-based advancement for non-critical reactio...
Definition CD_KMCSolver.H:451
T m_Ncrit
Definition of critical reactions.
Definition CD_KMCSolver.H:446
void advanceSSA(State &a_state, const Real a_dt) const noexcept
Advance with the SSA over the input time. This can end up using substepping.
Definition CD_KMCSolverImplem.H:495
std::pair< ReactionList, ReactionList > partitionReactions(const State &a_state) const noexcept
Partition reactions into critical and non-critical reactions.
Definition CD_KMCSolverImplem.H:170
void stepSSA(State &a_state) const noexcept
Perform a single SSA step.
Definition CD_KMCSolverImplem.H:430
void advanceTau(State &a_state, const Real &a_dt, const KMCLeapPropagator &a_leapPropagator=KMCLeapPropagator::ExplicitEuler) const noexcept
Advance using a specified tau-leaping algorithm.
Definition CD_KMCSolverImplem.H:879
Real getNonCriticalTimeStep(const State &a_state) const noexcept
Get the non-critical time step.
Definition CD_KMCSolverImplem.H:260
Real totalPropensity(const State &a_state) const noexcept
Compute the total propensity for ALL reactions.
Definition CD_KMCSolverImplem.H:144
Real m_SSAlim
Threshold for switching to SSA-based algorithm within the Cao algorithm.
Definition CD_KMCSolver.H:466
void stepImplicitEuler(State &a_state, const Real a_dt) const noexcept
Perform one implicit Euler tau-leaping step using ALL reactions.
Definition CD_KMCSolverImplem.H:661
std::vector< Real > propensities(const State &a_state) const noexcept
Compute propensities for ALL reactions.
Definition CD_KMCSolverImplem.H:118
Base class for a tracer particle solver. This solver can advance particles in a pre-defined velocity ...
Definition CD_TracerParticleSolver.H:37
TracerParticleSolver()
Default constructor.
Definition CD_TracerParticleSolverImplem.H:25