Are there design patterns or generalised approaches for particle simulations?
Posted
by
romeovs
on Programmers
See other posts from Programmers
or by romeovs
Published on 2012-03-26T19:44:48Z
Indexed on
2012/03/26
23:39 UTC
Read the original article
Hit count: 304
I'm working on a project (for college) in C++. The goal is to write a program that can more or less simulate a beam of particles flying trough the LHC synchrotron.
Not wanting to rush into things, me and my team are thinking about how to implement this and I was wondering if there are general design patterns that are used to solve this kind of problem.
The general approach we came up with so far is the following:
- there is a
Worldthat holds all objects - you can add objects to this world such as
Particle,DipoleandQuadrupole - time is cut up into discrete steps, and at each point in time, for each
Particlethe magnetic and electric forces that each object in theWorldgenerates are calculated and summed up (luckily electro-magnetism is linear). - each
Particlemoves accordingly (using a simple estimation approach to solve the differential movement equations) - save the
Particlepositions - repeat
This seems a good approach but, for instance, it is hard to take into account symmetries that might be present (such as the magnetic field of each Quadrupole) and is this thus suboptimal.
To take into account such symmetries as that of the Quadrupole field, it would be much easier to (also) make space discrete and somehow store form of the Quadrupole field somewhere. (Since 2532 or so Quadrupoles are stored this should lead to a massive gain of performance, not having to recalculate each Quadrupole field)
So, are there any design patterns? Is the World-approach feasible or is it old-fashioned, bad programming? What about symmetry, how is that generally taken into acount?
© Programmers or respective owner