implementations.problem_classes.PenningTrap_3D module¶
- class penningtrap(omega_B, omega_E, u0, nparts, sig)[source]¶
Bases:
ptype
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 for position, and for velocity.
q (np.1darray) – Particle’s charge.
m (np.1darray) – Mass.
nparts (int) – The number of particles.
sig (float) – The smoothing parameter \(\lambda>0\).
- work_counter¶
Counts the calls of the right-hand side, and calls of the Boris solver.
- Type:
dict
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 – The velocities at the \((m+1)\)-th node.
- Return type:
- build_f(f, part, t)[source]¶
Helper function to assemble the correct right-hand side out of B and E field.
- Parameters:
f (dtype_f) – The field values.
part (dtype_u) – The current particles data.
t (float) – The current time.
- Returns:
rhs – Correct right-hand side of type acceleration.
- Return type:
- dtype_f¶
alias of
fields
- dtype_u¶
alias of
particles
- eval_f(part, t)[source]¶
Routine to compute the E and B fields (named f for consistency with the original PEPC version).
- Parameters:
part (dtype_u) – The particles.
t (float) – Current time of the particles (not used here).
- Returns:
f – Fields for the particles (internal and external), i.e., the right-hand side of the problem.
- Return type:
dtype_f
- 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 – The internal E field for each particle.
- Return type:
np.2darray
- 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 – The internal E field for each particle.
- Return type:
np.ndarray