This, however, becomes very inefficient as the number of particles per mesh cell becomes large. A better solution would be to write this as
Bxl += weight000 * Bx_tot[ix][iy][iz];
where Bx_tot = Bx + Bx_ext is computed at the top of Particles3D::mover_PC().
Memory for B_ext and Bx_tot should not be allocated unless this feature is actually turned on. Bx_tot can simply be an alias pointer for B_ext in case this feature is turned off.
Under commit 05082fc8,
EMfields::B_ext
is used to add an external background magnetic field. The implementation needs to be corrected and improved:Particles3D::mover_PC()
such as are incorrect; a correct version would beBx_tot = Bx + Bx_ext
is computed at the top ofParticles3D::mover_PC()
.B_ext
andBx_tot
should not be allocated unless this feature is actually turned on.Bx_tot
can simply be an alias pointer forB_ext
in case this feature is turned off.