7 #ifndef WARPX_PARTICLES_COLLISION_MCCPROCESS_H_ 8 #define WARPX_PARTICLES_COLLISION_MCCPROCESS_H_ 10 #include <AMReX_Math.H> 11 #include <AMReX_Vector.H> 12 #include <AMReX_RandomEngine.H> 13 #include <AMReX_GpuContainers.H> 28 const std::string& scattering_process,
29 const std::string& cross_section_file,
30 const amrex::Real energy
33 template <
typename InputVector>
35 const std::string& scattering_process,
36 const InputVector&& energies,
37 const InputVector&& sigmas,
38 const amrex::Real energy
56 void readCrossSectionFile (
57 const std::string cross_section_file,
58 amrex::Vector<amrex::Real>& energies,
59 amrex::Gpu::HostVector<amrex::Real>& sigmas
63 void sanityCheckEnergyGrid (
64 const amrex::Vector<amrex::Real>& energies,
76 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
79 if (E_coll < m_energy_lo) {
81 }
else if (E_coll > m_energy_hi) {
84 using amrex::Math::floor;
85 using amrex::Math::ceil;
87 amrex::Real temp = (E_coll - m_energy_lo) / m_dE;
88 int idx_1 =
static_cast<int>(floor(temp));
89 int idx_2 =
static_cast<int>(ceil(temp));
93 return m_sigmas_data[idx_1] + (m_sigmas_data[idx_2] - m_sigmas_data[idx_1]) * temp;
97 amrex::Real* m_sigmas_data =
nullptr;
98 amrex::Real m_energy_lo, m_energy_hi,
m_sigma_lo, m_sigma_hi, m_dE;
113 return m_exe_h.getCrossSection(E_coll);
125 void init (
const std::string& scattering_process,
const amrex::Real energy);
130 amrex::Gpu::DeviceVector<amrex::Real> m_sigmas_d;
139 #endif // WARPX_PARTICLES_COLLISION_MCCPROCESS_H_ AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real getCrossSection(amrex::Real E_coll) const
Definition: MCCProcess.H:77
MCCProcessType m_type
Definition: MCCProcess.H:100
amrex::Real getCrossSection(amrex::Real E_coll) const
Definition: MCCProcess.H:111
Executor m_exe_h
Definition: MCCProcess.H:134
Definition: MCCProcess.H:24
amrex::Vector< amrex::Real > m_energies
Definition: MCCProcess.H:127
Executor const & executor() const
Definition: MCCProcess.H:103
MCCProcessType type() const
Definition: MCCProcess.H:118
MCCProcessType
Definition: MCCProcess.H:15
amrex::Gpu::HostVector< amrex::Real > m_sigmas_h
Definition: MCCProcess.H:133
amrex::Real m_energy_penalty
Definition: MCCProcess.H:99
Definition: MCCProcess.H:68
amrex::Real getEnergyPenalty() const
Definition: MCCProcess.H:116
int m_grid_size
Definition: MCCProcess.H:136
amrex::Real m_sigma_lo
Definition: MCCProcess.H:98