WarpX
InjectorMomentum.H
Go to the documentation of this file.
1 /* Copyright 2019-2020 Andrew Myers, Axel Huebl, Cameron Yang,
2  * Maxence Thevenet, Weiqun Zhang
3  *
4  * This file is part of WarpX.
5  *
6  * License: BSD-3-Clause-LBNL
7  */
8 #ifndef INJECTOR_MOMENTUM_H_
9 #define INJECTOR_MOMENTUM_H_
10 
11 #include "CustomMomentumProb.H"
12 #include "Utils/WarpXConst.H"
13 
14 #include <AMReX.H>
15 #include <AMReX_Config.H>
16 #include <AMReX_Dim3.H>
17 #include <AMReX_GpuQualifiers.H>
18 #include <AMReX_REAL.H>
19 #include <AMReX_Parser.H>
20 #include <AMReX_Random.H>
21 
22 #include <AMReX_BaseFwd.H>
23 
24 #include <cmath>
25 #include <string>
26 
27 // struct whose getMomentum returns constant momentum.
29 {
30  InjectorMomentumConstant (amrex::Real a_ux, amrex::Real a_uy, amrex::Real a_uz) noexcept
31  : m_ux(a_ux), m_uy(a_uy), m_uz(a_uz) {}
32 
33  AMREX_GPU_HOST_DEVICE
34  amrex::XDim3
35  getMomentum (amrex::Real, amrex::Real, amrex::Real,
36  amrex::RandomEngine const&) const noexcept
37  {
38  return amrex::XDim3{m_ux,m_uy,m_uz};
39  }
40 
41  AMREX_GPU_HOST_DEVICE
42  amrex::XDim3
43  getBulkMomentum (amrex::Real, amrex::Real, amrex::Real) const noexcept
44  {
45  return amrex::XDim3{m_ux,m_uy,m_uz};
46  }
47 
48 private:
49  amrex::Real m_ux, m_uy, m_uz;
50 };
51 
52 // struct whose getMomentum returns momentum for 1 particle, from random
53 // gaussian distribution.
55 {
56  InjectorMomentumGaussian (amrex::Real a_ux_m, amrex::Real a_uy_m,
57  amrex::Real a_uz_m, amrex::Real a_ux_th,
58  amrex::Real a_uy_th, amrex::Real a_uz_th) noexcept
59  : m_ux_m(a_ux_m), m_uy_m(a_uy_m), m_uz_m(a_uz_m),
60  m_ux_th(a_ux_th), m_uy_th(a_uy_th), m_uz_th(a_uz_th)
61  {}
62 
63  AMREX_GPU_HOST_DEVICE
64  amrex::XDim3
65  getMomentum (amrex::Real /*x*/, amrex::Real /*y*/, amrex::Real /*z*/,
66  amrex::RandomEngine const& engine) const noexcept
67  {
68  return amrex::XDim3{amrex::RandomNormal(m_ux_m, m_ux_th, engine),
69  amrex::RandomNormal(m_uy_m, m_uy_th, engine),
70  amrex::RandomNormal(m_uz_m, m_uz_th, engine)};
71  }
72 
73  AMREX_GPU_HOST_DEVICE
74  amrex::XDim3
75  getBulkMomentum (amrex::Real /*x*/, amrex::Real /*y*/, amrex::Real /*z*/) const noexcept
76  {
77  return amrex::XDim3{m_ux_m, m_uy_m, m_uz_m};
78  }
79 
80 private:
81  amrex::Real m_ux_m, m_uy_m, m_uz_m;
82  amrex::Real m_ux_th, m_uy_th, m_uz_th;
83 };
84 
85 
86 // struct whose getMomentum returns momentum for 1 particle, from random
87 // gaussian flux distribution in the specified direction.
88 // Along the normal axis, the distribution is v*Gaussian,
89 // with the sign set by flux_direction.
91 {
92  InjectorMomentumGaussianFlux (amrex::Real a_ux_m, amrex::Real a_uy_m,
93  amrex::Real a_uz_m, amrex::Real a_ux_th,
94  amrex::Real a_uy_th, amrex::Real a_uz_th,
95  int a_flux_normal_axis, int a_flux_direction) noexcept
96  : m_ux_m(a_ux_m), m_uy_m(a_uy_m), m_uz_m(a_uz_m),
97  m_ux_th(a_ux_th), m_uy_th(a_uy_th), m_uz_th(a_uz_th),
98  m_flux_normal_axis(a_flux_normal_axis),
99  m_flux_direction(a_flux_direction)
100  {}
101 
102  AMREX_GPU_HOST_DEVICE
103  amrex::XDim3
104  getMomentum (amrex::Real /*x*/, amrex::Real /*y*/, amrex::Real /*z*/,
105  amrex::RandomEngine const& engine) const noexcept
106  {
107  using namespace amrex::literals;
108  // Generate the v*Gaussian distribution.
109  amrex::Real const urand = 1._rt - amrex::Random(engine);
110  amrex::Real ur = std::sqrt(2._rt*std::log(1._rt/urand));
111  if (m_flux_direction < 0) ur = -ur;
112 
113  // Note that in 2D, with m_flux_normal_axis == 1, uy is out of the plane and so Gaussian and uz is v*Gaussian
114  amrex::Real const ux = (m_flux_normal_axis == 0 ? m_ux_th*ur : amrex::RandomNormal(m_ux_m, m_ux_th, engine));
115  amrex::Real const uy = (m_flux_normal_axis == 1 && AMREX_SPACEDIM==3 ? m_uy_th*ur : amrex::RandomNormal(m_uy_m, m_uy_th, engine));
116  amrex::Real const uz = (m_flux_normal_axis == AMREX_SPACEDIM-1 ? m_uz_th*ur : amrex::RandomNormal(m_uz_m, m_uz_th, engine));
117  return amrex::XDim3{ux, uy, uz};
118  }
119 
120  AMREX_GPU_HOST_DEVICE
121  amrex::XDim3
122  getBulkMomentum (amrex::Real /*x*/, amrex::Real /*y*/, amrex::Real /*z*/) const noexcept
123  {
124  return amrex::XDim3{m_ux_m, m_uy_m, m_uz_m};
125  }
126 
127 private:
128  amrex::Real m_ux_m, m_uy_m, m_uz_m;
129  amrex::Real m_ux_th, m_uy_th, m_uz_th;
132 };
133 
134 // struct whose getMomentum returns momentum for 1 particle with relativistic
135 // drift velocity beta, from the Maxwell-Boltzmann distribution.
137 {
138  // Constructor whose inputs are:
139  // the temperature parameter theta,
140  // boost velocity/c beta,
141  // and boost direction dir respectively.
142  InjectorMomentumBoltzmann(amrex::Real t, amrex::Real b, int d) noexcept
143  : dir(d), beta(b), vave(std::sqrt(amrex::Real(2.)*t))
144  {}
145 
146  AMREX_GPU_HOST_DEVICE
147  amrex::XDim3
148  getMomentum (amrex::Real /*x*/, amrex::Real /*y*/, amrex::Real /*z*/,
149  amrex::RandomEngine const& engine) const noexcept
150  {
151  amrex::Real x1, x2, gamma;
152  amrex::Real u[3];
153  x1 = amrex::Random(engine);
154  x2 = amrex::Random(engine);
155  // Each value of sqrt(-log(x1))*sin(2*pi*x2) is a sample from a Gaussian
156  // distribution with sigma = average velocity / c
157  // using the Box-Mueller Method.
158  u[(dir+1)%3] = vave*std::sqrt(-std::log(x1)) *std::sin(2*MathConst::pi*x2);
159  u[(dir+2)%3] = vave*std::sqrt(-std::log(x1)) *std::cos(2*MathConst::pi*x2);
160  u[dir] = vave*std::sqrt(-std::log(amrex::Random(engine)))*
161  std::sin(2*MathConst::pi*amrex::Random(engine));
162  gamma = u[0]*u[0]+u[1]*u[1]+u[2]*u[2];
163  gamma = std::sqrt(1+gamma);
164  // The following condition is equtaion 32 in Zenitani 2015
165  // (Phys. Plasmas 22, 042116) , called the flipping method. It
166  // transforms the intergral: d3x' -> d3x where d3x' is the volume
167  // element for positions in the boosted frame. The particle positions
168  // and densities can be initialized in the simulation frame.
169  // The flipping method can transform any symmetric distribution from one
170  // reference frame to another moving at a relative velocity of beta.
171  // An equivalent alternative to this method native to WarpX would be to
172  // initialize the particle positions and densities in the frame moving
173  // at speed beta, and then perform a Lorentz transform on the positions
174  // and MB sampled velocities to the simulation frame.
175  x1 = amrex::Random(engine);
176  if(-beta*u[dir]/gamma > x1)
177  {
178  u[dir] = -u[dir];
179  }
180  // This Lorentz transform is equation 17 in Zenitani.
181  // It transforms the integral d3u' -> d3u
182  // where d3u' is the volume element for momentum in the boosted frame.
183  u[dir] = 1/std::sqrt(1-beta*beta)*(u[dir]+gamma*beta);
184  // Note that if beta = 0 then the flipping method and Lorentz transform
185  // have no effect on the u[dir] direction.
186  return amrex::XDim3 {u[0],u[1],u[2]};
187  }
188 
189  AMREX_GPU_HOST_DEVICE
190  amrex::XDim3
191  getBulkMomentum (amrex::Real /*x*/, amrex::Real /*y*/, amrex::Real /*z*/) const noexcept
192  {
193  using namespace amrex;
194  Real u[3];
195  for (int idim = 0; idim < 3; ++idim) u[idim] = 0.0_rt;
196  const Real gamma = static_cast<amrex::Real>(1./sqrt(1+beta*beta));
197  u[dir] = gamma*beta;
198  return XDim3 {u[0],u[1],u[2]};
199  }
200 
201 private:
202  int dir;
203  amrex::Real beta, vave;
204 };
205 
206 // struct whose getMomentum returns momentum for 1 particle with relativistc
207 // drift velocity beta, from the Maxwell-Juttner distribution. Method is from
208 // Zenitani 2015 (Phys. Plasmas 22, 042116).
210 {
211  // Constructor whose inputs are:
212  // the temperature parameter theta,
213  // boost velocity/c beta,
214  // and boost direction dir respectively.
215  InjectorMomentumJuttner(amrex::Real t, amrex::Real b, int d) noexcept
216  : dir(d), beta(b), theta(t)
217  {}
218 
219  AMREX_GPU_HOST_DEVICE
220  amrex::XDim3
221  getMomentum (amrex::Real /*x*/, amrex::Real /*y*/, amrex::Real /*z*/,
222  amrex::RandomEngine const& engine) const noexcept
223  {
224  // Sobol method for sampling MJ Speeds,
225  // from Zenitani 2015 (Phys. Plasmas 22, 042116).
226  amrex::Real x1, x2, gamma;
227  amrex::Real u [3];
228  x1 = static_cast<amrex::Real>(0.);
229  gamma = static_cast<amrex::Real>(0.);
230  u[dir] = static_cast<amrex::Real>(0.);
231  // This condition is equation 10 in Zenitani,
232  // though x1 is defined differently.
233  while(u[dir]-gamma <= x1)
234  {
235  u[dir] = -theta*
236  std::log(amrex::Random(engine)*amrex::Random(engine)*amrex::Random(engine));
237  gamma = std::sqrt(1+u[dir]*u[dir]);
238  x1 = theta*std::log(amrex::Random(engine));
239  }
240  // The following code samples a random unit vector
241  // and multiplies the result by speed u[dir].
242  x1 = amrex::Random(engine);
243  x2 = amrex::Random(engine);
244  // Direction dir is an input parameter that sets the boost direction:
245  // 'x' -> d = 0, 'y' -> d = 1, 'z' -> d = 2.
246  u[(dir+1)%3] = 2*u[dir]*std::sqrt(x1*(1-x1))*std::sin(2*MathConst::pi*x2);
247  u[(dir+2)%3] = 2*u[dir]*std::sqrt(x1*(1-x1))*std::cos(2*MathConst::pi*x2);
248  // The value of dir is the boost direction to be transformed.
249  u[dir] = u[dir]*(2*x1-1);
250  x1 = amrex::Random(engine);
251  // The following condition is equtaion 32 in Zenitani, called
252  // The flipping method. It transforms the intergral: d3x' -> d3x
253  // where d3x' is the volume element for positions in the boosted frame.
254  // The particle positions and densities can be initialized in the
255  // simulation frame with this method.
256  // The flipping method can similarly transform any
257  // symmetric distribution from one reference frame to another moving at
258  // a relative velocity of beta.
259  // An equivalent alternative to this method native to WarpX
260  // would be to initialize the particle positions and densities in the
261  // frame moving at speed beta, and then perform a Lorentz transform
262  // on their positions and MJ sampled velocities to the simulation frame.
263  if(-beta*u[dir]/gamma>x1)
264  {
265  u[dir] = -u[dir];
266  }
267  // This Lorentz transform is equation 17 in Zenitani.
268  // It transforms the integral d3u' -> d3u
269  // where d3u' is the volume element for momentum in the boosted frame.
270  u[dir] = 1/std::sqrt(1-beta*beta)*(u[dir]+gamma*beta);
271  // Note that if beta = 0 then the flipping method and Lorentz transform
272  // have no effect on the u[dir] direction.
273  return amrex::XDim3 {u[0],u[1],u[2]};
274  }
275 
276  AMREX_GPU_HOST_DEVICE
277  amrex::XDim3
278  getBulkMomentum (amrex::Real /*x*/, amrex::Real /*y*/, amrex::Real /*z*/) const noexcept
279  {
280  using namespace amrex;
281  Real u[3];
282  for (int idim = 0; idim < 3; ++idim) u[idim] = 0.0_rt;
283  const Real gamma = static_cast<Real>(1./sqrt(1.+beta*beta));
284  u[dir] = gamma*beta;
285  return XDim3 {u[0],u[1],u[2]};
286  }
287 
288 private:
289  int dir;
290  amrex::Real beta, theta;
291 };
292 
301 {
302  InjectorMomentumRadialExpansion (amrex::Real a_u_over_r) noexcept
303  : u_over_r(a_u_over_r)
304  {}
305 
306  AMREX_GPU_HOST_DEVICE
307  amrex::XDim3
308  getMomentum (amrex::Real x, amrex::Real y, amrex::Real z,
309  amrex::RandomEngine const&) const noexcept
310  {
311  return {x*u_over_r, y*u_over_r, z*u_over_r};
312  }
313 
314  AMREX_GPU_HOST_DEVICE
315  amrex::XDim3
316  getBulkMomentum (amrex::Real x, amrex::Real y, amrex::Real z) const noexcept
317  {
318  return {x*u_over_r, y*u_over_r, z*u_over_r};
319  }
320 
321 private:
322  amrex::Real u_over_r;
323 };
324 
325 // struct whose getMomentumm returns local momentum computed from parser.
327 {
328  InjectorMomentumParser (amrex::ParserExecutor<3> const& a_ux_parser,
329  amrex::ParserExecutor<3> const& a_uy_parser,
330  amrex::ParserExecutor<3> const& a_uz_parser) noexcept
331  : m_ux_parser(a_ux_parser), m_uy_parser(a_uy_parser),
332  m_uz_parser(a_uz_parser) {}
333 
334  AMREX_GPU_HOST_DEVICE
335  amrex::XDim3
336  getMomentum (amrex::Real x, amrex::Real y, amrex::Real z,
337  amrex::RandomEngine const&) const noexcept
338  {
339  return amrex::XDim3{m_ux_parser(x,y,z),m_uy_parser(x,y,z),m_uz_parser(x,y,z)};
340  }
341 
342  AMREX_GPU_HOST_DEVICE
343  amrex::XDim3
344  getBulkMomentum (amrex::Real x, amrex::Real y, amrex::Real z) const noexcept
345  {
346  return amrex::XDim3{m_ux_parser(x,y,z),m_uy_parser(x,y,z),m_uz_parser(x,y,z)};
347  }
348 
349  amrex::ParserExecutor<3> m_ux_parser, m_uy_parser, m_uz_parser;
350 };
351 
352 // Base struct for momentum injector.
353 // InjectorMomentum contains a union (called Object) that holds any one
354 // instance of:
355 // - InjectorMomentumConstant : to generate constant density;
356 // - InjectorMomentumGaussian : to generate gaussian distribution;
357 // - InjectorMomentumGaussianFlux : to generate v*gaussian distribution;
358 // - InjectorMomentumRadialExpansion: to generate radial expansion;
359 // - InjectorMomentumParser : to generate momentum from parser;
360 // The choice is made at runtime, depending in the constructor called.
361 // This mimics virtual functions.
363 {
364  // This constructor stores a InjectorMomentumConstant in union object.
366  amrex::Real a_ux, amrex::Real a_uy, amrex::Real a_uz)
367  : type(Type::constant),
368  object(t, a_ux, a_uy, a_uz)
369  { }
370 
371  // This constructor stores a InjectorMomentumParser in union object.
373  amrex::ParserExecutor<3> const& a_ux_parser,
374  amrex::ParserExecutor<3> const& a_uy_parser,
375  amrex::ParserExecutor<3> const& a_uz_parser)
376  : type(Type::parser),
377  object(t, a_ux_parser, a_uy_parser, a_uz_parser)
378  { }
379 
380  // This constructor stores a InjectorMomentumGaussian in union object.
382  amrex::Real a_ux_m, amrex::Real a_uy_m, amrex::Real a_uz_m,
383  amrex::Real a_ux_th, amrex::Real a_uy_th, amrex::Real a_uz_th)
384  : type(Type::gaussian),
385  object(t,a_ux_m,a_uy_m,a_uz_m,a_ux_th,a_uy_th,a_uz_th)
386  { }
387 
388  // This constructor stores a InjectorMomentumGaussianFlux in union object.
390  amrex::Real a_ux_m, amrex::Real a_uy_m, amrex::Real a_uz_m,
391  amrex::Real a_ux_th, amrex::Real a_uy_th, amrex::Real a_uz_th,
392  int a_flux_normal_axis, int a_flux_direction)
393  : type(Type::gaussianflux),
394  object(t,a_ux_m,a_uy_m,a_uz_m,a_ux_th,a_uy_th,a_uz_th,a_flux_normal_axis,a_flux_direction)
395  { }
396 
398  amrex::Real theta, amrex::Real beta, int dir)
399  : type(Type::boltzmann),
400  object(t, theta, beta, dir)
401  { }
402 
403  // This constructor stores a InjectorMomentumJuttner in union object.
405  amrex::Real theta, amrex::Real beta, int dir)
406  : type(Type::juttner),
407  object(t, theta, beta, dir)
408  { }
409 
410  // This constructor stores a InjectorMomentumCustom in union object.
412  std::string const& a_species_name)
413  : type(Type::custom),
414  object(t, a_species_name)
415  { }
416 
417  // This constructor stores a InjectorMomentumRadialExpansion in union object.
419  amrex::Real u_over_r)
420  : type(Type::radial_expansion),
421  object(t, u_over_r)
422  { }
423 
424  // Explicitly prevent the compiler from generating copy constructors
425  // and copy assignment operators.
426  InjectorMomentum (InjectorMomentum const&) = delete;
427  InjectorMomentum (InjectorMomentum&&) = delete;
428  void operator= (InjectorMomentum const&) = delete;
429  void operator= (InjectorMomentum &&) = delete;
430 
431  void clear ();
432 
433  // call getMomentum from the object stored in the union
434  // (the union is called Object, and the instance is called object).
435  AMREX_GPU_HOST_DEVICE
436  amrex::XDim3
437  getMomentum (amrex::Real x, amrex::Real y, amrex::Real z,
438  amrex::RandomEngine const& engine) const noexcept
439  {
440  switch (type)
441  {
442  case Type::parser:
443  {
444  return object.parser.getMomentum(x,y,z,engine);
445  }
446  case Type::gaussian:
447  {
448  return object.gaussian.getMomentum(x,y,z,engine);
449  }
450  case Type::gaussianflux:
451  {
452  return object.gaussianflux.getMomentum(x,y,z,engine);
453  }
454  case Type::boltzmann:
455  {
456  return object.boltzmann.getMomentum(x,y,z,engine);
457  }
458  case Type::juttner:
459  {
460  return object.juttner.getMomentum(x,y,z,engine);
461  }
462  case Type::constant:
463  {
464  return object.constant.getMomentum(x,y,z,engine);
465  }
466  case Type::radial_expansion:
467  {
468  return object.radial_expansion.getMomentum(x,y,z,engine);
469  }
470  case Type::custom:
471  {
472  return object.custom.getMomentum(x,y,z,engine);
473  }
474  default:
475  {
476  amrex::Abort("InjectorMomentum: unknown type");
477  return {0.0,0.0,0.0};
478  }
479  }
480  }
481 
482  // call getBulkMomentum from the object stored in the union
483  // (the union is called Object, and the instance is called object).
484  AMREX_GPU_HOST_DEVICE
485  amrex::XDim3
486  getBulkMomentum (amrex::Real x, amrex::Real y, amrex::Real z) const noexcept
487  {
488  switch (type)
489  {
490  case Type::parser:
491  {
492  return object.parser.getBulkMomentum(x,y,z);
493  }
494  case Type::gaussian:
495  {
496  return object.gaussian.getBulkMomentum(x,y,z);
497  }
498  case Type::gaussianflux:
499  {
500  return object.gaussianflux.getBulkMomentum(x,y,z);
501  }
502  case Type::boltzmann:
503  {
504  return object.boltzmann.getBulkMomentum(x,y,z);
505  }
506  case Type::juttner:
507  {
508  return object.juttner.getBulkMomentum(x,y,z);
509  }
510  case Type::constant:
511  {
512  return object.constant.getBulkMomentum(x,y,z);
513  }
514  case Type::radial_expansion:
515  {
516  return object.radial_expansion.getBulkMomentum(x,y,z);
517  }
518  case Type::custom:
519  {
520  return object.custom.getBulkMomentum(x,y,z);
521  }
522  default:
523  {
524  amrex::Abort("InjectorMomentum: unknown type");
525  return {0.0,0.0,0.0};
526  }
527  }
528  }
529 
530 private:
531  enum struct Type { constant, custom, gaussian, gaussianflux, boltzmann, juttner, radial_expansion, parser};
533 
534  // An instance of union Object constructs and stores any one of
535  // the objects declared (constant or custom or gaussian or
536  // radial_expansion or parser).
537  union Object {
539  amrex::Real a_ux, amrex::Real a_uy, amrex::Real a_uz) noexcept
540  : constant(a_ux,a_uy,a_uz) {}
542  std::string const& a_species_name) noexcept
543  : custom(a_species_name) {}
545  amrex::Real a_ux_m, amrex::Real a_uy_m,
546  amrex::Real a_uz_m, amrex::Real a_ux_th,
547  amrex::Real a_uy_th, amrex::Real a_uz_th) noexcept
548  : gaussian(a_ux_m,a_uy_m,a_uz_m,a_ux_th,a_uy_th,a_uz_th) {}
550  amrex::Real a_ux_m, amrex::Real a_uy_m,
551  amrex::Real a_uz_m, amrex::Real a_ux_th,
552  amrex::Real a_uy_th, amrex::Real a_uz_th,
553  int a_flux_normal_axis, int a_flux_direction) noexcept
554  : gaussianflux(a_ux_m,a_uy_m,a_uz_m,a_ux_th,a_uy_th,a_uz_th,a_flux_normal_axis,a_flux_direction) {}
556  amrex::Real t, amrex::Real b, int dir) noexcept
557  : boltzmann(t,b,dir) {}
559  amrex::Real t, amrex::Real b, int dir) noexcept
560  : juttner(t,b,dir) {}
562  amrex::Real u_over_r) noexcept
563  : radial_expansion(u_over_r) {}
565  amrex::ParserExecutor<3> const& a_ux_parser,
566  amrex::ParserExecutor<3> const& a_uy_parser,
567  amrex::ParserExecutor<3> const& a_uz_parser) noexcept
568  : parser(a_ux_parser, a_uy_parser, a_uz_parser) {}
577  };
579 };
580 
581 // In order for InjectorMomentum to be trivially copyable, its destructor
582 // must be trivial. So we have to rely on a custom deleter for unique_ptr.
584  void operator () (InjectorMomentum* p) const {
585  if (p) {
586  p->clear();
587  delete p;
588  }
589  }
590 };
591 
592 #endif
AMREX_GPU_HOST_DEVICE amrex::XDim3 getBulkMomentum(amrex::Real x, amrex::Real y, amrex::Real z) const noexcept
Definition: InjectorMomentum.H:316
Object(InjectorMomentumGaussianFlux *, amrex::Real a_ux_m, amrex::Real a_uy_m, amrex::Real a_uz_m, amrex::Real a_ux_th, amrex::Real a_uy_th, amrex::Real a_uz_th, int a_flux_normal_axis, int a_flux_direction) noexcept
Definition: InjectorMomentum.H:549
int m_flux_normal_axis
Definition: InjectorMomentum.H:130
InjectorMomentumConstant(amrex::Real a_ux, amrex::Real a_uy, amrex::Real a_uz) noexcept
Definition: InjectorMomentum.H:30
parser
Definition: run_alltests.py:107
InjectorMomentumCustom custom
Definition: InjectorMomentum.H:570
Object(InjectorMomentumParser *, amrex::ParserExecutor< 3 > const &a_ux_parser, amrex::ParserExecutor< 3 > const &a_uy_parser, amrex::ParserExecutor< 3 > const &a_uz_parser) noexcept
Definition: InjectorMomentum.H:564
InjectorMomentum(InjectorMomentumConstant *t, amrex::Real a_ux, amrex::Real a_uy, amrex::Real a_uz)
Definition: InjectorMomentum.H:365
def x
Definition: read_lab_particles.py:25
AMREX_GPU_HOST_DEVICE amrex::XDim3 getBulkMomentum(amrex::Real x, amrex::Real y, amrex::Real z) const noexcept
Definition: InjectorMomentum.H:486
Definition: InjectorMomentum.H:90
InjectorMomentumGaussian gaussian
Definition: InjectorMomentum.H:571
AMREX_GPU_HOST_DEVICE amrex::XDim3 getMomentum(amrex::Real, amrex::Real, amrex::Real, amrex::RandomEngine const &engine) const noexcept
Definition: InjectorMomentum.H:104
InjectorMomentum(InjectorMomentumParser *t, amrex::ParserExecutor< 3 > const &a_ux_parser, amrex::ParserExecutor< 3 > const &a_uy_parser, amrex::ParserExecutor< 3 > const &a_uz_parser)
Definition: InjectorMomentum.H:372
InjectorMomentum(InjectorMomentumRadialExpansion *t, amrex::Real u_over_r)
Definition: InjectorMomentum.H:418
Type
Definition: InjectorMomentum.H:531
Definition: InjectorMomentum.H:326
def uz
Definition: read_lab_particles.py:29
void clear()
Definition: InjectorMomentum.cpp:12
InjectorMomentumRadialExpansion radial_expansion
Definition: InjectorMomentum.H:575
AMREX_GPU_HOST_DEVICE amrex::XDim3 getMomentum(amrex::Real x, amrex::Real y, amrex::Real z, amrex::RandomEngine const &) const noexcept
Definition: InjectorMomentum.H:336
InjectorMomentumGaussian(amrex::Real a_ux_m, amrex::Real a_uy_m, amrex::Real a_uz_m, amrex::Real a_ux_th, amrex::Real a_uy_th, amrex::Real a_uz_th) noexcept
Definition: InjectorMomentum.H:56
InjectorMomentumParser parser
Definition: InjectorMomentum.H:576
struct whose getMomentum returns momentum for 1 particle, for radial expansion.
Definition: InjectorMomentum.H:300
AMREX_GPU_HOST_DEVICE amrex::XDim3 getMomentum(amrex::Real, amrex::Real, amrex::Real, amrex::RandomEngine const &engine) const noexcept
Definition: InjectorMomentum.H:65
Definition: InjectorMomentum.H:209
def z
Definition: read_lab_particles.py:26
InjectorMomentumConstant constant
Definition: InjectorMomentum.H:569
Object(InjectorMomentumCustom *, std::string const &a_species_name) noexcept
Definition: InjectorMomentum.H:541
AMREX_GPU_HOST_DEVICE amrex::XDim3 getMomentum(amrex::Real, amrex::Real, amrex::Real, amrex::RandomEngine const &engine) const noexcept
Definition: InjectorMomentum.H:221
InjectorMomentumParser(amrex::ParserExecutor< 3 > const &a_ux_parser, amrex::ParserExecutor< 3 > const &a_uy_parser, amrex::ParserExecutor< 3 > const &a_uz_parser) noexcept
Definition: InjectorMomentum.H:328
Definition: InjectorMomentum.H:54
amrex::Real vave
Definition: InjectorMomentum.H:203
AMREX_GPU_HOST_DEVICE amrex::XDim3 getMomentum(amrex::Real, amrex::Real, amrex::Real, amrex::RandomEngine const &engine) const noexcept
Definition: InjectorMomentum.H:148
AMREX_GPU_HOST_DEVICE amrex::XDim3 getBulkMomentum(amrex::Real, amrex::Real, amrex::Real) const noexcept
Definition: InjectorMomentum.H:75
amrex::Real u_over_r
Definition: InjectorMomentum.H:322
InjectorMomentumJuttner(amrex::Real t, amrex::Real b, int d) noexcept
Definition: InjectorMomentum.H:215
Object(InjectorMomentumBoltzmann *, amrex::Real t, amrex::Real b, int dir) noexcept
Definition: InjectorMomentum.H:555
amrex::Real m_uy
Definition: InjectorMomentum.H:49
AMREX_GPU_HOST_DEVICE amrex::XDim3 getMomentum(amrex::Real x, amrex::Real y, amrex::Real z, amrex::RandomEngine const &engine) const noexcept
Definition: InjectorMomentum.H:437
InjectorMomentumGaussianFlux(amrex::Real a_ux_m, amrex::Real a_uy_m, amrex::Real a_uz_m, amrex::Real a_ux_th, amrex::Real a_uy_th, amrex::Real a_uz_th, int a_flux_normal_axis, int a_flux_direction) noexcept
Definition: InjectorMomentum.H:92
Definition: InjectorMomentum.H:537
AMREX_GPU_HOST_DEVICE amrex::XDim3 getBulkMomentum(amrex::Real, amrex::Real, amrex::Real) const noexcept
Definition: InjectorMomentum.H:191
amrex::Real m_uz
Definition: InjectorMomentum.H:49
Definition: InjectorMomentum.H:136
InjectorMomentumBoltzmann boltzmann
Definition: InjectorMomentum.H:573
InjectorMomentum(InjectorMomentumGaussian *t, amrex::Real a_ux_m, amrex::Real a_uy_m, amrex::Real a_uz_m, amrex::Real a_ux_th, amrex::Real a_uy_th, amrex::Real a_uz_th)
Definition: InjectorMomentum.H:381
Object(InjectorMomentumJuttner *, amrex::Real t, amrex::Real b, int dir) noexcept
Definition: InjectorMomentum.H:558
amrex::Real m_uz_m
Definition: InjectorMomentum.H:81
amrex::Real m_uz_th
Definition: InjectorMomentum.H:129
amrex::Real m_uz_th
Definition: InjectorMomentum.H:82
amrex::ParserExecutor< 3 > m_uz_parser
Definition: InjectorMomentum.H:349
Definition: InjectorMomentum.H:583
type
Definition: run_alltests_1node.py:67
AMREX_GPU_HOST_DEVICE amrex::XDim3 getBulkMomentum(amrex::Real x, amrex::Real y, amrex::Real z) const noexcept
Definition: InjectorMomentum.H:344
Object(InjectorMomentumConstant *, amrex::Real a_ux, amrex::Real a_uy, amrex::Real a_uz) noexcept
Definition: InjectorMomentum.H:538
AMREX_GPU_HOST_DEVICE amrex::XDim3 getMomentum(amrex::Real, amrex::Real, amrex::Real, amrex::RandomEngine const &) const noexcept
Definition: InjectorMomentum.H:35
int dir
Definition: InjectorMomentum.H:289
Definition: InjectorMomentum.H:362
AMREX_GPU_HOST_DEVICE amrex::XDim3 getBulkMomentum(amrex::Real, amrex::Real, amrex::Real) const noexcept
Definition: InjectorMomentum.H:278
InjectorMomentum(InjectorMomentumJuttner *t, amrex::Real theta, amrex::Real beta, int dir)
Definition: InjectorMomentum.H:404
amrex::Real m_uz_m
Definition: InjectorMomentum.H:128
InjectorMomentumRadialExpansion(amrex::Real a_u_over_r) noexcept
Definition: InjectorMomentum.H:302
InjectorMomentumJuttner juttner
Definition: InjectorMomentum.H:574
Definition: CustomMomentumProb.H:19
Definition: InjectorMomentum.H:28
Object object
Definition: InjectorMomentum.H:578
InjectorMomentum(InjectorMomentumCustom *t, std::string const &a_species_name)
Definition: InjectorMomentum.H:411
Type type
Definition: InjectorMomentum.H:532
int m_flux_direction
Definition: InjectorMomentum.H:131
InjectorMomentum(InjectorMomentumGaussianFlux *t, amrex::Real a_ux_m, amrex::Real a_uy_m, amrex::Real a_uz_m, amrex::Real a_ux_th, amrex::Real a_uy_th, amrex::Real a_uz_th, int a_flux_normal_axis, int a_flux_direction)
Definition: InjectorMomentum.H:389
InjectorMomentumGaussianFlux gaussianflux
Definition: InjectorMomentum.H:572
AMREX_GPU_HOST_DEVICE amrex::XDim3 getBulkMomentum(amrex::Real, amrex::Real, amrex::Real) const noexcept
Definition: InjectorMomentum.H:122
def ux
Definition: read_lab_particles.py:28
list x1
Definition: plot_particle_path.py:128
InjectorMomentumBoltzmann(amrex::Real t, amrex::Real b, int d) noexcept
Definition: InjectorMomentum.H:142
Definition: BreitWheelerEngineWrapper.H:35
amrex::Real theta
Definition: InjectorMomentum.H:290
InjectorMomentum(InjectorMomentumBoltzmann *t, amrex::Real theta, amrex::Real beta, int dir)
Definition: InjectorMomentum.H:397
int dir
Definition: InjectorMomentum.H:202
AMREX_GPU_HOST_DEVICE amrex::XDim3 getBulkMomentum(amrex::Real, amrex::Real, amrex::Real) const noexcept
Definition: InjectorMomentum.H:43
Object(InjectorMomentumRadialExpansion *, amrex::Real u_over_r) noexcept
Definition: InjectorMomentum.H:561
amrex::Real m_ux
Definition: InjectorMomentum.H:49
Object(InjectorMomentumGaussian *, amrex::Real a_ux_m, amrex::Real a_uy_m, amrex::Real a_uz_m, amrex::Real a_ux_th, amrex::Real a_uy_th, amrex::Real a_uz_th) noexcept
Definition: InjectorMomentum.H:544
AMREX_GPU_HOST_DEVICE amrex::XDim3 getMomentum(amrex::Real x, amrex::Real y, amrex::Real z, amrex::RandomEngine const &) const noexcept
Definition: InjectorMomentum.H:308