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