Ephi - a simple physics simulator. Copyright (C) 2007 Indrek Mandre http://www.mare.ee/indrek/ephi/ This is a physics simulation software to simulate static magnetic fields and movement of charged particles within those fields. Coulomb forces are also accounted for when simulating particle paths. License ~~~~~~~~ This software is licensed under the GNU GPL which means it cannot be used in commercial software. See the LICENSE.txt for more details. How to build ~~~~~~~~~~~~~ Ephi has been developed on a Linux system. It consists of a series of command line applications so getting them to compile on non-unix systems would not be that much work. To build go to src/ and edit the Makefile. Its header contains some parameters you can/should tune. Just type % make and it should build a series of test applications and also the 'polywell' application. The tests ~~~~~~~~~~ The tests serve the purpose of verifying the simulator and for doing the occasional regression tests. test1 - an electron should make circles in a homogenous magnetic field with theoretically calculatable radius. test2 - measuring strength of bfield at the center and along the axis of a circular current flow. Can be compared against theoretical values. test3 - measuring strength of bfield from the middle of a finite straight wire. Can be compared against theoretical values. test4 - visual silly-test, send two electrons at a collision, see that they deflect. Testing of electric field and Coulomb's force. test5 - visual silly-test, see how an electron gets trapped around a circular current element. test6 - visual silly-test, visualise magnetic field strength and lines at cross-section of a solenoid test7 - visual silly-test, two opposite charges in space, fields lines test8 - electric field of a circular charge How it works ~~~~~~~~~~~~~ Current elements are constructed using several shapes of current carriers including circles, straight wires and bezier curves. Cubic beziers allow easy construction of arbitrary current paths. See http://en.wikipedia.org/wiki/B%C3%A9zier_curve If you want a stronger bfield then just increase the amperage. I don't see much point in stacking multiple current elements. This simulator is not intended to be that close to reality. The magnetic field is calculated by iterating over the wire in small steps and summing up elements according to Biot-Savart law. This of course is numeric integration and so an approximation. Electron dynamics are calculated over small timesteps as well. There is no support for induction tho. SI system is used almost everywhere. This puts single precision operation at a pressure tho. If you want to increase speed of calculations at the loss of accuracy then here are some things you can try: * change INTEGRATE_BIOT_SAVART_BY to a larger value in Makefile - this specifies the length of wire used at a single step of calculation (meters). * on polywell use the simulation.accuracy config option * use single precision (float) instead of double precision. See Makefile and comment in USE_FLOAT. Floats are unfortunately not good enough and errors grow up very quickly. I wrote some code to use the SSE2 CPU extension to speed up calculations. But it seems the gain with double precision is not that significant, I've not been able to test with the latest CPU-s around tho. Single precision is a different story, the gain there is more than twofold. You must 'make clean && make' to rebuild after changing parameters in the Makefile. Polywell ~~~~~~~~~ The polywell provides a simulation of an electron inside a polywell configuration magnetic containment system. Please see http://en.wikipedia.org/wiki/Polywell for more information. The application simulates time and writes the electron path elements into stdout. Additionally every 10 seconds .bmp files of the containment system and electrons' paths are flushed into the file system. You can forward individual path elements for later analysis into a file: % ./polywell The bitmaps are simple projections into the xy, xz and yz planes. Coordinate axises and also the rings of magnets are also drawn. Running polywell also provides a small povray script to visualise the configuration in 3D. Just run: % povray -geometry 800x800 +A +Q9 +AM2 polywell.pov Polywell application is now configured using the configuration files. See src/confs/ for differenc configurations. You can specify the configuration file with -c argument. Python interface ~~~~~~~~~~~~~~~~~ Ephi also provides a python interface for programming the simulation scenes in python. See src/*.py for examples. The API pretty much copies the one of C++, so you can rely on the Doxygen API reference for interface documentation. Disclaimer ~~~~~~~~~~~ I'm not a physicist nor am I a mathematician. Neither do I have any backgrounds in those fields, numeric calculation or simulation software. So In other words I'm a complete amateur and this software is intended to be used by other amateurs like me who don't take life too seriously and like to dream a bit. This means that any use of this software and any conclusions you draw from this are at your own risk and peril. Other than that, have fun. Indrek Mandre