About The Simulation

The simulation was written in the C++ programming langauge, and using the OpenGL graphic library to render the graphics to the screen, along with the GLUT utility toolkit.
The simulation defines a Class which contains all the information about the particle that is currently in the system, including constant ones, like its mass, and changing ones, like position, velocity and spin.
The system consist of a stationary magnetic field, which is defined for each point in space, and 2 equi-y planes that defines the part of the space where the field actually exists.
Each cycle of the simulation starts with setting the position of the particle to the edge of the particle "gun", adding it some user-controled uncertainty, setting it's velocity directly towards the screen, and setting its magnetic-moment or spin-state to a random value, depending on the physical mode adjusted by the keyboard (see manual section). then at each step the time is progressed by a constant interval which was set to 10^-5 seconds, the position is changed according to the velocity, the velocity according to the body-force, and if in semi-classical physical mode, the spin is measured along the axis tangent to the field in the current particle position.

The particle is modeled as solid sphere with an arrow directed in it's magnetic moment direction. It is way out of scale, and does not represent visually the true particle, if such a thing even exists, but rather supplies all the relevant information about the particle elegantly.


The "gun" which in practice consist of an oven and two slits to filter position and direction of particles that leave the oven, is modeled as a simple box-like shape which represents also the width of the slit that lets the particles pass, also not to scale.


The field exists everywhere between the gun and the screen, but is drawn sparsely for high rendering frequency (or in other words, for the program not to crawl). At each point on a chosen grid, a small arrow-like cylindrical object is drawn, to represent the direction of the field there, and its relative strength. To emphasize the strength, they were also colored. The more red the arrow, the more strong is the field there, and the more blue, the weaker it is. Mid-way values come out purple.
Let us define some plane parallel to the screen as the XZ plane, and the axis perpendicular to the screen that passes through the center of the gun as the Y axis.
The field does NOT change along the Y axis, and in the XZ plane (as the particles "sees" it ahead of it) it looks like this :

This field was obtained analytically, as a simple approximation to the field obtained by the original geometric setup. The equation for it is :

with B₀ of order of one Tesla. This form assures that the law of nature : ∇∙B = 0 will hold. It does ignore changes in the Y direction, but this is OK for a slowly varying field.

Finally, the screen is just drawn as a rectangle, parallel to the XZ plane, which upon the hits are gathered, indicated by little yellow dots.





Feel free to nevigate between the different sections of the website through the menu in the left side of the screen.
If you don't see it, please start again at the Project Index Page