diff options
Diffstat (limited to 'Source/Initialization')
-rw-r--r-- | Source/Initialization/InjectorMomentum.H | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/Source/Initialization/InjectorMomentum.H b/Source/Initialization/InjectorMomentum.H index 5bbad36c3..272af52c7 100644 --- a/Source/Initialization/InjectorMomentum.H +++ b/Source/Initialization/InjectorMomentum.H @@ -61,29 +61,27 @@ struct InjectorMomentumBoltzmann { amrex::Real x1, x2, gamma; amrex::Real u[3]; - vave = std::sqrt(2*t); x1 = amrex::Random(); x2 = amrex::Random(); // Each value of sqrt(-log(x1))*sin(2*pi*x2) is a sample from a Gaussian - // distribution with sigma = vave. - u[(dir+1)%3] = vave* std::sqrt(-std::log(x1)) *std::sin(2*M_PI*x2); - u[(dir+2)%3] = vave* std::sqrt(-std::log(x1)) *std::cos(2*M_PI*x2); + // distribution with sigma = average velocity / c. + u[(dir+1)%3] = vave*std::sqrt(-std::log(x1)) *std::sin(2*M_PI*x2); + u[(dir+2)%3] = vave*std::sqrt(-std::log(x1)) *std::cos(2*M_PI*x2); u[dir] = vave*std::sqrt(-std::log(amrex::Random()))* std::sin(2*M_PI*amrex::Random()); gamma = std::sqrt(std::pow(u[0],2)+std::pow(u[1],2)+std::pow(u[2],2)); - gamma = np.sqrt(1+gamma**2); - // The following condition is equtaion 32 in Zenitani, called - // The flipping method. It transforms the intergral: d3x' -> d3x - // where d3x' is the volume element for positions in the boosted frame. - // The particle positions and densities can be initialized in the - // simulation frame with this method. - // The flipping method can similarly transform any - // symmetric distribution from one reference frame to another moving at - // a relative velocity of beta. - // An equivalent alternative to this method native to WarpX - // would be to initialize the particle positions and densities in the - // frame moving at speed beta, and then perform a Lorentz transform - // on their positions and MJ sampled velocities to the simulation frame. + gamma = std::sqrt(1+std::pow(gamma,2)); + // The following condition is equtaion 32 in Zenitani 2015 + // (Phys. Plasmas 22, 042116) , called the flipping method. It + // transforms the intergral: d3x' -> d3x where d3x' is the volume + // element for positions in the boosted frame. The particle positions + // and densities can be initialized in the simulation frame. + // The flipping method can transform any symmetric distribution from one + // reference frame to another moving at a relative velocity of beta. + // An equivalent alternative to this method native to WarpX would be to + // initialize the particle positions and densities in the frame moving + // at speed beta, and then perform a Lorentz transform on the positions + // and MJ sampled velocities to the simulation frame. x1 = amrex::Random(); if(-beta*u[dir]/gamma > x1) { @@ -254,7 +252,7 @@ struct InjectorMomentum : type(Type::gaussian), object(t,a_ux_m,a_uy_m,a_uz_m,a_ux_th,a_uy_th,a_uz_th) { } - + InjectorMomentum (InjectorMomentumBoltzmann* t, amrex::Real theta, amrex::Real beta, int dir) : type(Type::boltzmann), |