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 <physics/schwinger/schwinger_pair_engine_core.hpp>
14 #include <AMReX_Random.H>
15 #include <cmath>
16 
36 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
37 amrex::Real
38 getSchwingerProductionNumber (const amrex::Real dV, const amrex::Real dt,
39  const amrex::Real Ex, const amrex::Real Ey, const amrex::Real Ez,
40  const amrex::Real Bx, const amrex::Real By, const amrex::Real Bz,
41  const amrex::Real PoissonToGaussianThreshold,
42  amrex::RandomEngine const& engine)
43 {
44  using namespace amrex;
45  namespace pxr_p = picsar::multi_physics::phys;
46  namespace pxr_sh = picsar::multi_physics::phys::schwinger;
47 
48  const auto expectedPairNumber =
49  pxr_sh::expected_pair_number<amrex::Real, pxr_p::unit_system::SI>(
50  Ex, Ey, Ez, Bx, By, Bz, dV, dt);
51 
52  if (expectedPairNumber <= PoissonToGaussianThreshold) {
53  return amrex::RandomPoisson(expectedPairNumber, engine);
54  } else {
55  const auto numpairs =
56  amrex::RandomNormal(expectedPairNumber, std::sqrt(expectedPairNumber), engine);
57  return numpairs > 0._rt ? numpairs : 0._rt;
58  }
59 }
60 
61 #endif // WARPX_schwinger_process_wrapper_h_
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real getSchwingerProductionNumber(const amrex::Real dV, const amrex::Real dt, const amrex::Real Ex, const amrex::Real Ey, const amrex::Real Ez, const amrex::Real Bx, const amrex::Real By, const amrex::Real Bz, const amrex::Real PoissonToGaussianThreshold, amrex::RandomEngine const &engine)
Definition: SchwingerProcessWrapper.H:38
Definition: PML.H:52