What Software Is Best for Simulating Particle Trajectories in 3D?

Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
4 replies · 2K views
strokebow
Messages
122
Reaction score
0
Hi,

I use a numerical method to trace trajectories of particles. I want to program a sort of 'video' type graph. A graph or 3d video or perhaps just 3 graphs (xy, xz, and yz) that would show the position of the ion as the software is run.

So my question is this...

What software would people recommend for doing this? Can I just use C++? Should I use matlab? or is there some other software where this can be achieved quite straightforwardly without having to write tonnes of code to do the display?

Any ideas?

thanks
 
Physics news on Phys.org
Do you already know Matlab? Do you already know C++? Easier to use what you know--the equations will be the same in any case.
Then, it depends on how efficient it needs to be. For a few particles, you might just use Matlab, because the set up is a lot easier, and you can use built in graphing functions. For 10 million particles, you might want to use c or fortran, just for speed.

If you don't know, I recommend just using Matlab, since it's easy and won't take much code.
 
Ok cool.

Its just a case of which has the easier to user graphing functions.

But you think C maybe faster? Whys that?
 
c is (much) faster than Matlab because it is a compiled language and has static typing and minimal software protections. Fortran can be faster than c sometimes, because there's even less imposed structure on function calls.

Neither have any sort of built in graphing routines, though.
 
There are special computer codes for tracing charged particles through magnetic optics, even when there are strong space-charge forces that can defocus the beam.

This one (1998) for beams claims to include space charge effects.

http://accelconf.web.cern.ch/accelconf/pac97/papers/pdf/8p085.pdf

uses the long standing TRANSPORT and TURTLE codes (see references).

This one uses Fortran 90

http://accelconf.web.cern.ch/AccelConf/l06/PAPERS/TUP079.PDF

I have written simple ray racing codes for charged particles in magnetic optics using TRUE BASIC. A simple plotting subroutine might be a short as 20 lines.