12 #ifndef CD_ItoPlasmaReactionImplem_H
13 #define CD_ItoPlasmaReactionImplem_H
17 #include <CD_NamespaceHeader.H>
19 #define ITO_REACTION_DEBUG 0
21 using namespace Physics::ItoPlasma;
26 #if ITO_REACTION_DEBUG
27 if (a_num_reactions < 0) {
28 MayDay::Abort(
"ItoPlasmaReaction::jumpState - can't have negative number of reactions!");
30 for (
int i = 0; i < a_particles.size(); i++) {
31 if (a_particles[i] < 0) {
32 MayDay::Abort(
"ItoPlasmaReaction::jumpState can't have negative particles on the way in");
37 for (
const auto& r : m_reactants) {
38 a_particles[r] -= a_num_reactions;
41 for (
const auto& r : m_particle_products) {
42 a_particles[r] += a_num_reactions;
45 #if ITO_REACTION_DEBUG
46 for (
int i = 0; i < a_particles.size(); i++) {
47 if (a_particles[i] < 0) {
48 MayDay::Abort(
"ItoPlasmaReaction::jumpState can't have negative particles on the way out");
56 Vector<long long>& a_Photons,
57 const long long a_num_reactions)
const
60 this->
jumpState(a_particles, a_num_reactions);
62 for (
const auto& r : m_photon_products) {
63 a_Photons[r] += a_num_reactions;
70 const Vector<Real>& a_mean_energies,
71 const long long a_num_reactions)
const
73 for (
const auto& r : m_energy_jumps) {
75 a_energies[r.first] -= a_mean_energies[r.first] * a_num_reactions;
78 a_energies[r.first] += r.second * a_num_reactions;
85 const Vector<Real>& a_mean_energies,
86 const Vector<Real>& a_sources,
87 const long long a_num_reactions,
88 const Real a_dt)
const
91 for (
const auto& r : m_energy_jumps) {
93 a_energies[r.first] -= a_mean_energies[r.first] * a_num_reactions;
96 a_energies[r.first] += r.second * a_num_reactions;
99 a_energies[r.first] += a_sources[r.first] * a_dt;
115 Vector<long long> particles = a_particles;
118 for (
const auto& r : m_reactants) {
132 inline const std::list<int>&
138 inline const std::list<int>&
141 return m_particle_products;
144 inline const std::list<int>&
147 return m_photon_products;
155 for (
const auto& r : m_reactants) {
156 if (m_phiChange.find(r) == m_phiChange.end()) {
157 m_phiChange.emplace(r, -1);
165 for (
const auto& r : m_particle_products) {
166 if (m_phiChange.find(r) == m_phiChange.end()) {
167 m_phiChange.emplace(r, +1);
178 for (
const auto& r : m_energy_jumps) {
179 if (m_energyChange.find(r.first) == m_energyChange.end()) {
180 m_energyChange.emplace(r.first, r.second);
185 inline const std::map<int, int>&
196 if (m_phiChange.find(a_idx) != m_phiChange.end()) {
197 ret = m_phiChange.at(a_idx);
203 inline const std::map<int, Real>&
206 return m_energyChange;
214 if (m_energyChange.find(a_idx) != m_energyChange.end()) {
215 ret = m_energyChange.at(a_idx);
221 #include <CD_NamespaceFooter.H>