WarpX
SchwingerProcessWrapper.H
Go to the documentation of this file.
1 /* Copyright 2020 Luca Fedeli, Neil Zaim
2  *
3  * This file is part of WarpX.
4  *
5  * License: BSD-3-Clause-LBNL
6  */
7 
8 #ifndef WARPX_schwinger_process_wrapper_h_
9 #define WARPX_schwinger_process_wrapper_h_
10 
11 #include "QedWrapperCommons.H"
12 
13 #include <AMReX_Random.H>
14 
15 #include <picsar_qed/physics/schwinger/schwinger_pair_engine_core.hpp>
16 
17 #include <cmath>
18 
40 amrex::Real
41 getSchwingerProductionNumber (const amrex::Real dV, const amrex::Real dt,
42  const amrex::ParticleReal Ex, const amrex::ParticleReal Ey, const amrex::ParticleReal Ez,
43  const amrex::ParticleReal Bx, const amrex::ParticleReal By, const amrex::ParticleReal Bz,
44  const amrex::ParticleReal PoissonToGaussianThreshold,
45  amrex::RandomEngine const& engine)
46 {
47  using namespace amrex;
48  namespace pxr_p = picsar::multi_physics::phys;
49  namespace pxr_sh = picsar::multi_physics::phys::schwinger;
50 
51  const auto expectedPairNumber =
52  pxr_sh::expected_pair_number<amrex::Real, pxr_p::unit_system::SI>(
53  Ex, Ey, Ez, Bx, By, Bz, dV, dt);
54 
55  if (expectedPairNumber <= PoissonToGaussianThreshold) {
56  return amrex::RandomPoisson(expectedPairNumber, engine);
57  } else {
58  const auto numpairs =
59  amrex::RandomNormal(expectedPairNumber, std::sqrt(expectedPairNumber), engine);
60  return numpairs > 0._rt ? numpairs : 0._rt;
61  }
62 }
63 
64 #endif // WARPX_schwinger_process_wrapper_h_
#define AMREX_FORCE_INLINE
#define AMREX_GPU_HOST_DEVICE
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real getSchwingerProductionNumber(const amrex::Real dV, const amrex::Real dt, const amrex::ParticleReal Ex, const amrex::ParticleReal Ey, const amrex::ParticleReal Ez, const amrex::ParticleReal Bx, const amrex::ParticleReal By, const amrex::ParticleReal Bz, const amrex::ParticleReal PoissonToGaussianThreshold, amrex::RandomEngine const &engine)
Definition: SchwingerProcessWrapper.H:41
Real RandomNormal(Real mean, Real stddev)
unsigned int RandomPoisson(Real lambda)
float dt
Definition: stencil.py:442