chombo-discharge
CD_ItoPlasmaReaction.H
Go to the documentation of this file.
1 /* chombo-discharge
2  * Copyright © 2021 SINTEF Energy Research.
3  * Please refer to Copyright.txt and LICENSE in the chombo-discharge root directory.
4  */
5 
12 #ifndef CD_ItoPlasmaReaction_H
13 #define CD_ItoPlasmaReaction_H
14 
15 // Chombo includes
16 #include <Vector.H>
17 #include <RealVect.H>
18 
19 // Our includes
20 #include <CD_NamespaceHeader.H>
21 
22 namespace Physics {
23  namespace ItoPlasma {
24 
31  {
32  public:
36  ItoPlasmaReaction() = default;
37 
41  ItoPlasmaReaction(const std::initializer_list<int> a_reactants,
42  const std::initializer_list<int> a_particle_products,
43  const std::initializer_list<int> a_photon_products,
44  const std::initializer_list<std::pair<int, Real>> a_energy_jumps)
45  : m_reactants(a_reactants),
46  m_particle_products(a_particle_products),
47  m_photon_products(a_photon_products),
48  m_energy_jumps(a_energy_jumps)
49  {
50  this->computeStateChange();
51  this->computeEnergyChange();
52  }
53 
57  ItoPlasmaReaction(const std::initializer_list<int> a_reactants,
58  const std::initializer_list<int> a_particle_products,
59  const std::initializer_list<std::pair<int, Real>> a_energy_jumps)
60  : m_reactants(a_reactants),
61  m_particle_products(a_particle_products),
62  m_photon_products(0),
63  m_energy_jumps(a_energy_jumps)
64  {
65  this->computeStateChange();
66  this->computeEnergyChange();
67  }
68 
72  ItoPlasmaReaction(const std::initializer_list<int> a_reactants,
73  const std::initializer_list<int> a_particle_products,
74  const std::initializer_list<int> a_photon_products)
75  : m_reactants(a_reactants),
76  m_particle_products(a_particle_products),
77  m_photon_products(a_photon_products),
78  m_energy_jumps(0)
79  {
80  this->computeStateChange();
81  this->computeEnergyChange();
82  }
83 
87  ItoPlasmaReaction(const std::initializer_list<int> a_reactants,
88  const std::initializer_list<int> a_particle_products)
89  : m_reactants(a_reactants), m_particle_products(a_particle_products), m_photon_products(0), m_energy_jumps(0)
90  {
91  this->computeStateChange();
92  this->computeEnergyChange();
93  }
94 
99 
103  inline void
104  jumpState(Vector<long long>& a_particles, const long long a_num_reactions) const;
105 
109  inline void
110  jumpState(Vector<long long>& a_particles, Vector<long long>& a_Photons, const long long a_num_reactions) const;
111 
115  inline void
116  jumpEnergy(Vector<Real>& a_energies, const Vector<Real>& a_mean_energies, const long long a_num_reactions) const;
117 
121  inline void
122  jumpEnergy(Vector<Real>& a_energies,
123  const Vector<Real>& a_mean_energies,
124  const Vector<Real>& a_sources,
125  const long long a_num_reactions,
126  const Real a_dt) const;
127 
131  inline Real&
132  rate() const;
133 
137  inline Real
138  propensity(const Vector<long long>& a_particles) const;
139 
143  inline int
144  getGi(const Vector<long long>& a_particles) const;
145 
149  inline const std::list<int>&
150  getReactants() const;
151 
155  inline const std::list<int>&
156  getParticleProdcuts() const;
157 
161  inline const std::list<int>&
162  getPhotonProducts() const;
163 
167  inline const std::map<int, int>&
168  getStateChange() const;
169 
173  inline const int
174  getStateChange(const int a_idx) const;
175 
179  inline const std::map<int, Real>&
180  getEnergychange() const;
181 
185  inline const Real
186  getEnergychange(const int a_idx) const;
187 
188  protected:
189  // Reaction rate, mutable because I want ItoPlasmaReaction to be a const object, but reaction rate may need to change
190  mutable Real m_rate;
191 
192  std::list<int> m_reactants; // Particle reactants
193  std::list<int> m_particle_products; // Particle products
194  std::list<int> m_photon_products; // Photon products
195  std::list<std::pair<int, Real>> m_energy_jumps; // Energy changes
196 
197  std::map<int, int>
198  m_phiChange; // Change in species due to firing of one reaction. First index is species, second is change.
199  std::map<int, Real>
200  m_energyChange; // Change in energyk due to firing of one reaction. First index is species, second is change.
201 
205  inline void
207 
211  inline void
213  };
214  } // namespace ItoPlasma
215 } // namespace Physics
216 
217 #include <CD_NamespaceFooter.H>
218 
220 
221 #endif
Physics
Name containing various physics models for running chombo-discharge code.
Definition: CD_AdvectionDiffusion.H:15
Physics::ItoPlasma::ItoPlasmaReaction::~ItoPlasmaReaction
~ItoPlasmaReaction()
Dtor. Not much to see here.
Definition: CD_ItoPlasmaReaction.H:98
Physics::ItoPlasma::ItoPlasmaReaction::getEnergychange
const std::map< int, Real > & getEnergychange() const
Get the energy change. You need to iterate through this map.
Definition: CD_ItoPlasmaReactionImplem.H:204
Physics::ItoPlasma::ItoPlasmaReaction::ItoPlasmaReaction
ItoPlasmaReaction(const std::initializer_list< int > a_reactants, const std::initializer_list< int > a_particle_products, const std::initializer_list< int > a_photon_products, const std::initializer_list< std::pair< int, Real >> a_energy_jumps)
Full ctor. Includes Photons and energies. LEA fodder.
Definition: CD_ItoPlasmaReaction.H:41
Physics::ItoPlasma::ItoPlasmaReaction::jumpState
void jumpState(Vector< long long > &a_particles, const long long a_num_reactions) const
Allows a state to jump with N reactions.
Definition: CD_ItoPlasmaReactionImplem.H:24
Physics::ItoPlasma::ItoPlasmaReaction::ItoPlasmaReaction
ItoPlasmaReaction(const std::initializer_list< int > a_reactants, const std::initializer_list< int > a_particle_products, const std::initializer_list< std::pair< int, Real >> a_energy_jumps)
Full ctor. Includes energies but not Photons. LEA fodder.
Definition: CD_ItoPlasmaReaction.H:57
CD_ItoPlasmaReactionImplem.H
Implementation of CD_ItoPlasmaReaction.H.
Physics::ItoPlasma::ItoPlasmaReaction::ItoPlasmaReaction
ItoPlasmaReaction(const std::initializer_list< int > a_reactants, const std::initializer_list< int > a_particle_products, const std::initializer_list< int > a_photon_products)
Full Ctor, includes possible Photons but disregards energy. LFA fodder.
Definition: CD_ItoPlasmaReaction.H:72
Physics::ItoPlasma::ItoPlasmaReaction::computeStateChange
void computeStateChange()
Compute the state change.
Definition: CD_ItoPlasmaReactionImplem.H:151
Physics::ItoPlasma::ItoPlasmaReaction::ItoPlasmaReaction
ItoPlasmaReaction()=default
Allow, but you need full ctor to do anything.
Physics::ItoPlasma::ItoPlasmaReaction::jumpEnergy
void jumpEnergy(Vector< Real > &a_energies, const Vector< Real > &a_mean_energies, const long long a_num_reactions) const
Allows the energies to jump with N reactions. Assumes no energy sources.
Definition: CD_ItoPlasmaReactionImplem.H:69
Physics::ItoPlasma::ItoPlasmaReaction::ItoPlasmaReaction
ItoPlasmaReaction(const std::initializer_list< int > a_reactants, const std::initializer_list< int > a_particle_products)
Partial ctor. No Photons generated and no energy. LFA fodder.
Definition: CD_ItoPlasmaReaction.H:87
Physics::ItoPlasma::ItoPlasmaReaction::getReactants
const std::list< int > & getReactants() const
Get reactants.
Definition: CD_ItoPlasmaReactionImplem.H:133
Physics::ItoPlasma::ItoPlasmaReaction
Reaction class for ItoPlasmaPhysics.
Definition: CD_ItoPlasmaReaction.H:30
Physics::ItoPlasma::ItoPlasmaReaction::getGi
int getGi(const Vector< long long > &a_particles) const
Get gi.
Definition: CD_ItoPlasmaReactionImplem.H:127
Physics::ItoPlasma::ItoPlasmaReaction::getParticleProdcuts
const std::list< int > & getParticleProdcuts() const
Get reactants.
Definition: CD_ItoPlasmaReactionImplem.H:139
Physics::ItoPlasma::ItoPlasmaReaction::computeEnergyChange
void computeEnergyChange()
Compute the state change.
Definition: CD_ItoPlasmaReactionImplem.H:176
Physics::ItoPlasma::ItoPlasmaReaction::getStateChange
const std::map< int, int > & getStateChange() const
Get the state change. You need to iterate through this map.
Definition: CD_ItoPlasmaReactionImplem.H:186
Physics::ItoPlasma::ItoPlasmaReaction::getPhotonProducts
const std::list< int > & getPhotonProducts() const
Get reactants.
Definition: CD_ItoPlasmaReactionImplem.H:145
Physics::ItoPlasma::ItoPlasmaReaction::propensity
Real propensity(const Vector< long long > &a_particles) const
Get propensity function.
Definition: CD_ItoPlasmaReactionImplem.H:110
Physics::ItoPlasma::ItoPlasmaReaction::rate
Real & rate() const
Return a modifiable version of the reaction rate.
Definition: CD_ItoPlasmaReactionImplem.H:104