PenningTrap_3D#
- class penningtrap(omega_B, omega_E, u0, nparts, sig)[source]#
Bases:
ProblemCharged particles in a 3D Penning trap with Coulomb interaction, a second-order problem for the Boris integrator.
This class implements a standard Penning trap problem on the time interval \([0, t_{end}]\) fully investigated in [1]. The equations are given by the following equation of motion
\[\frac{dv}{dt}=f(x,v)=\alpha[E(x,t)+v\times B(x,t)],\]\[\frac{dx}{dt}=v\]with the particles \(x, v\in \mathbb{R}^{3}\). For the penning trap problem, the other parameters are given by the constant magnetic field \(B=\frac{\omega_{B}}{\alpha}\cdot \hat{e_{z}}\in \mathbb{R}^{3}\) along the \(z\)-axis with the particle’s charge-to-mass ratio \(\alpha=\frac{q}{m}\) so that
\[\begin{split}v\times B=\frac{\omega_{B}}{\alpha}\left( \begin{matrix} 0 & 1 & 0\\ -1 & 0 & 0\\ 0 & 0 & 0 \end{matrix} \right)v.\end{split}\]The electric field \(E(x_{i})=E_{ext}(x_{i})+E_{int}(x_{i})\in \mathbb{R}^{3}\) where
\[\begin{split}E_{ext}(x_{i})=-\epsilon\frac{\omega_{E}^{2}}{\alpha}\left( \begin{matrix} 1 & 0 & 0\\ 0 & 1 & 0\\ 0 & 0 & -2 \end{matrix} \right)x_{i}\end{split}\]and the inter-particle Coulomb interaction
\[E_{int}(x_{i})=\sum_{k=1, k\neq i}^{N_{particles}}Q_{k}\frac{x_{i}-x_{k}}{(|x_{i}-x_{k}|^{2}+\lambda^{2})^{3/2}}\]with the smoothing parameter \(\lambda>0\). The exact solution also given for the single particle penning trap more detailed [1], [2]. For to solve nonlinear equation of system, Boris trick is used (see [2]).
- Parameters:
omega_B (
float) – Amplitude of magnetic field.omega_E (
float) – Amplitude of electric field.u0 (
np.1darray) – Initial condition[pos, vel, [q], [m]]: position and velocity (three components each) around which the particles are placed, and the particles’ charge and mass (so far only \(q = m = 1\) is implemented).nparts (
int) – The number of particles.sig (
float) – The smoothing parameter \(\lambda>0\).
- Variables:
work_counter (
dict) – Counts the calls of the right-hand side, and calls of the Boris solver.
References
- boris_solver(c, dt, old_fields, new_fields, old_parts)[source]#
The actual Boris solver for static (!) B fields, extended by the c-term.
- Parameters:
c (
dtype_u) – The c term gathering the known values from the previous iteration.dt (
float) – The (probably scaled) time step size.old_fields (
dtype_f) – The field values at the previous node \(m\).new_fields (
dtype_f) – The field values at the current node \(m+1\).old_parts (
dtype_u) – The particles at the previous node \(m\).
- Returns:
vel (
particles) – The velocities at the \((m+1)\)-th node.
- build_f(f, part, t)[source]#
Helper function to assemble the correct right-hand side out of B and E field.
- eval_f(part, t)[source]#
Routine to compute the E and B fields (named f for consistency with the original PEPC version).
- static fast_interactions(N, pos, sig, q)[source]#
Computes the fast interactions.
- Parameters:
N (
int) – Number of particles.pos (
np.2darray) – Position.sig (
float) – The smoothing parameter \(\lambda > 0\).q (
np.1darray) – Particle’s charge.
- Returns:
Efield (
np.2darray) – The internal E field for each particle.
- get_interactions(part)[source]#
Routine to compute the particle-particle interaction, assuming \(q = 1\) for all particles.
- Parameters:
part (
dtype_u) – The particles.- Returns:
Efield (
np.ndarray) – The internal E field for each particle.
- u_exact(t)[source]#
Routine to compute the exact trajectory at time \(t\) (only for single-particle setup).
- Parameters:
t (
float) – Current time of the exact trajectory.- Returns:
u (
dtype_u) – Particle type containing the exact position and velocity.
- u_init()[source]#
Routine to compute the starting values for the particles.
The first particle starts at
u0. The others are shifted from it by random amounts in \([-1, 0)\) in each position component and in \([-5, -4)\) in each velocity component, drawn after seedingnp.randomwith the number of particles.- Returns:
u (
dtype_u) – Particle set filled with initial data.