henry2004y / TestParticle.jl

Test particle tracing in electromagnetic field
https://henry2004y.github.io/TestParticle.jl/dev/
MIT License
14 stars 3 forks source link

Output array from Boris #136

Closed henry2004y closed 4 months ago

henry2004y commented 5 months ago

https://github.com/henry2004y/TestParticle.jl/blob/e24fbe0abc2c5e2449717250b3ef433581d61834/src/pusher.jl#L165

The current strategy is to preallocate a large array based on nout, which often leads to a waste of memory when tracing is terminated early. I remember Chris had a tutorial demonstrating that pushing to arrays has the same performance as preallocation in this case. Check it out.