Closed henry2004y closed 7 months ago
Actually when we plot both trajectories in SI units, they are very close to each other:
using GLMakie
f = Figure(fontsize=18)
ax = Axis3(f[1, 1],
xlabel = "x",
ylabel = "y",
zlabel = "z",
aspect = :data,
)
lines!(ax, sol1)
trange = range(tspan2..., length=40)
xplot = sol2.(trange, idxs=1) .* l₀
yplot = sol2.(trange, idxs=2) .* l₀
zplot = sol2.(trange, idxs=3) .* l₀
lines!(ax, xplot, yplot, zplot, linestyle=:dashdot, linewidth=5)
f
So the differences are probably solely numerical. I've also tried with other E field values.
If it is a case given in this issue, I think the difference between the results obtained using the Vern9 algorithm should be numerical error.
One side finding from this experiment is that tracing in dimensionless units seems to be faster, because the timesteps are much larger.
In principle, the Lorentz equation in SI units
$$ \frac{\mathrm{d}\mathbf{v}}{\mathrm{d}t} = \frac{q}{m}\left( \mathbf{v}\times\mathbf{B} + \mathbf{E} \right) $$
can be normalized to
$$ \frac{\mathrm{d}\mathbf{v}^\prime}{\mathrm{d}t^\prime} = \mathbf{v}^\prime\times\mathbf{B}^\prime + \mathbf{E}^\prime $$
with the following transformation
$$ \begin{aligned} \mathbf{v} &= \mathbf{v}^\prime V_0 \ t &= t^\prime t_0 = t^\prime \Omega^{-1} = t^\prime \frac{m}{qB_0} \ \mathbf{B} &= \mathbf{B}^\prime B_0 \ \mathbf{E} &= \mathbf{E}^\prime E_0 = \mathbf{E}^\prime V_0 B_0 \end{aligned} $$
All the coefficients here are written in SI units. Often we would choose $V_0 = c$ (speed of light).
However, consider the following example
The two methods do not give the same results. Where did we do wrong?