Hypothesis on Electron and Ion Behavior Inside the Polywell.
-
- Posts: 1439
- Joined: Wed Jul 14, 2010 5:27 pm
i've seem to run into a problem modeling the b-field of particle-particle interatction. when i turn it on all the particles disappear. i'm guessing they their positions become infinit. so why? well at first i was thinking a bug, but now i'm thinking that as a proton and electron get closer they attract each other more and more, so they are going faster and faster, relative to each other, and this makes for a proportionally stronger magnetic field between them. and thus increasingly stronger force.
i looked it up and apparently the answer lies in quantum physics: in acting as a wave a particle can only have a number of discrete wavelengths. to actually collide with the proton an electron would have to have a wavelength exactly equal to the distance between them. but it can't, so it always overshoots. i'm going to try implementing this as a minimum distance between an ion and electron dependant on the charge of the ion.
(curious - i wonder if the quantized energy levels are exactly those energy levels that keep this runaway force problem from happening.)
i looked it up and apparently the answer lies in quantum physics: in acting as a wave a particle can only have a number of discrete wavelengths. to actually collide with the proton an electron would have to have a wavelength exactly equal to the distance between them. but it can't, so it always overshoots. i'm going to try implementing this as a minimum distance between an ion and electron dependant on the charge of the ion.
(curious - i wonder if the quantized energy levels are exactly those energy levels that keep this runaway force problem from happening.)
-
- Posts: 1439
- Joined: Wed Jul 14, 2010 5:27 pm
got it working now.
i don't have any static electric or magnetic fields yet though,
so all it does is expand. i got 1 part protons 1 part b-11 ions, and 6 parts electrons (to make net neutral). i start everything off with a velocity of zero and a random position, and the electrons just fly off right away, leaving the ions to expand more slowly.
no i've got to write the code for taking a 3-d wireframe of current and using it to apply static e and b fields. to the simulation.
i don't have any static electric or magnetic fields yet though,
so all it does is expand. i got 1 part protons 1 part b-11 ions, and 6 parts electrons (to make net neutral). i start everything off with a velocity of zero and a random position, and the electrons just fly off right away, leaving the ions to expand more slowly.
no i've got to write the code for taking a 3-d wireframe of current and using it to apply static e and b fields. to the simulation.
-
- Posts: 1439
- Joined: Wed Jul 14, 2010 5:27 pm
Tada!
http://www.youtube.com/watch?v=x5zPjqashAc
i've made the protons a little darker blue since i recorded that video 'cause i noticed they were a little hard to differentiate from the borons.
now i can officially say i did something that was pretty cool and had something to show for it.
http://www.youtube.com/watch?v=x5zPjqashAc
i've made the protons a little darker blue since i recorded that video 'cause i noticed they were a little hard to differentiate from the borons.
now i can officially say i did something that was pretty cool and had something to show for it.

Nice work.happyjack27 wrote:Tada!
http://www.youtube.com/watch?v=x5zPjqashAc
i've made the protons a little darker blue since i recorded that video 'cause i noticed they were a little hard to differentiate from the borons.
now i can officially say i did something that was pretty cool and had something to show for it.
I am actually pretty excited to see what happens when you add in the static B and E fields.
Also as a note: have you considered that (once you do) there might be some value in deleting particles which get sufficiently far away from the static fields (i.e. "outside" the reactor) and birthing some new particles into it to approximate a steady state.
-
- Posts: 1439
- Joined: Wed Jul 14, 2010 5:27 pm
yes i have. that's stage 3: particle cycling.
and i've actualy thought a little into that already. there's going to be a "loss radius" coming off the wire segments, which is basically the radius of the wire. a particle in that radius is considered lost. also, as you said, too high x^2+y^2+z^2 and it's considered lost. then it's a matter of reseting lost particles to injection points.
and i've actualy thought a little into that already. there's going to be a "loss radius" coming off the wire segments, which is basically the radius of the wire. a particle in that radius is considered lost. also, as you said, too high x^2+y^2+z^2 and it's considered lost. then it's a matter of reseting lost particles to injection points.
-
- Posts: 1439
- Joined: Wed Jul 14, 2010 5:27 pm
code hosted on sourceforge now.
https://sourceforge.net/projects/em-nbody/
svn co https://em-nbody.svn.sourceforge.net/svnroot/em-nbody em-nbody
https://sourceforge.net/projects/em-nbody/
svn co https://em-nbody.svn.sourceforge.net/svnroot/em-nbody em-nbody
-
- Posts: 1439
- Joined: Wed Jul 14, 2010 5:27 pm
i was using this: http://cnx.org/content/m31103/latest/
to find the magnetic field on a point induced by a current in a finite straight wire, only to find out in the end that it only calculated magnitude, and not direction.
so i calculated direction as the cross product of the current and the line perpendicular to the current that runs through the point. and i calculated the latter by using a vector projection to get the point where said perpendicular line intersects the wire.
then since after doing that i had the whole line as a vector, i just used that vector's magnitude as the distance from the current line to the point.
anyways, a lot of algebra later, i've got the code for relative mag field.
(by "relative" i mean you still have to multiply it by current density and m0/(4pi) to get the strength in teslas.)
so my point of all this is: could someone double-check my math here? please! (the two parts that say "correct??" are the answers that i need to be correct)
Please and thank you.
to find the magnetic field on a point induced by a current in a finite straight wire, only to find out in the end that it only calculated magnitude, and not direction.
so i calculated direction as the cross product of the current and the line perpendicular to the current that runs through the point. and i calculated the latter by using a vector projection to get the point where said perpendicular line intersects the wire.
then since after doing that i had the whole line as a vector, i just used that vector's magnitude as the distance from the current line to the point.
anyways, a lot of algebra later, i've got the code for relative mag field.
(by "relative" i mean you still have to multiply it by current density and m0/(4pi) to get the strength in teslas.)
so my point of all this is: could someone double-check my math here? please! (the two parts that say "correct??" are the answers that i need to be correct)
Code: Select all
#define translate(a,b) { a.x-b.x, a.y-b.y, c.z-c.z } //translate vector a by b
#define dot(a,b) (a.x*b.x + a.y*b.y + c.z*c.z) //dot product
#define SCALE(a) rsqrt(dot(a,a)) //reciprocal of the length of vector a.
//cross product stuff
#define crossx(a,b) (a.y*b.z - a.z*b.y)
#define crossy(a,b) (a.z*b.x - a.x*b.z)
#define crossz(a,b) (a.x*b.y - a.y*b.x)
#define cross(a,b) { crossx(a,b), crossy(a,b), crossz(a,b), a.w*b.w }
#define norm(a) { a.x*a.w, a.y*a.w, a.z*a.w, 1.0f } //norm of vector a
#define project(a,b) (dot(a,b)*b.w) //length of projection of a onto b
#define cosangle(a,b) (project(a,b)*a.w) //cosine of the angle between vector a and b.
//declaration of basic data types (T = scalar, T4 = vector)
typedef float T;
struct T4 {
T x,y,z,w;
}
//given a point p, and finite straight wire from point a to b, find the magnetic field direction and strength induced from current in the wire onto the point p:
T4 bfield_of_seg_on_point(T4 p, T4 a, T4 b) {
//convert point pairs to vectors.
T4 lvector = translate(b,a);
lvector.w = SCALE(lvector);
T4 v1 = translate(p,a);
v1.w = SCALE(v1);
T4 v2 = translate(p,b);
v2.w = SCALE(v2);
//proj = length of projection of v1 onto lvector, times the reciprocal magnitude of lvector.
T proj = project(v1,lvector)*lvector.w;
//r = perpendicular vector from line to point.
T4 r;
r.x = v1.x-lvector.x*proj; //=p.x-(a.x+lvector.x*proj);
r.y = v1.y-lvector.y*proj;
r.z = v1.z-lvector.z*proj;
r.w = SCALE(r);
T4 cr = cross(lvector,r);
T4 ret = norm(cr); //this is the direction of the magnetic field. <-correct??
T strength = cosangle(lvector,v1);
lvector.w = -lvector.w; //this effectively switches the direction of the vector.
strength += cosangle(lvector,v2);
ret.w = strength*r.w; //this is the relative strength of the magnetic field. <-correct??
return ret;
}
Don't use the radius of the wire if it that is the radius the magrid is at, as a number of us would love to see just what electrons do when they move out through cusps -- do they just run off, do they (mostly|somewhat|not at all) recirculate back into the cusp(s), etc.happyjack27 wrote:yes i have. that's stage 3: particle cycling.
and i've actualy thought a little into that already. there's going to be a "loss radius" coming off the wire segments, which is basically the radius of the wire. a particle in that radius is considered lost. also, as you said, too high x^2+y^2+z^2 and it's considered lost. then it's a matter of reseting lost particles to injection points.
If you could model double the magrid radius that should, I think, be sufficient. Anything that gets to twice the magrid distance from the center would be considered "lost" to the chamber walls, unless others think a larger distance outside the magrid would be worthwhile to simulate.
Nice work so far. N-body simulations are one of the reasons I learned what little coding I know. I've always been fascinated watching the virtual results.

-
- Posts: 1439
- Joined: Wed Jul 14, 2010 5:27 pm
those virtual results are wrong - there's an oddity in the original code i wasn't aware of (and apparently neither was nvidia). position is stored as a 4-vector so i just use the extra field to store the charge (the original used it to store mass). turns out thou that 4th field actually scales the position. that's why the borons occupy 1/5 the radius (5 times the charge) of the protons, and the electrons don't show up at all. clearly if nvidia didn't have the mass of all their bodies the same their results would have looked just as screwy.
anyways i fixed it by just storing that info in "constant memory" instead of the position 4-vector, and per particle type rather than per particle. now you see all the particles, including yellow electrons clearly and they expand together because they're net neutral and coloumb forces pull together any substantial charge discrepancies.
sorry no video yet. not really all that impressive anyways. just multicolored dots expanding. (and i've sped up the framerate about 5x)
now onto the static fields. i posted my bfield code above. got the efield code done too now. i want the math double-checked. the static fields are invisible though - you'll only see them by how the particles move.
the radius i'm talking about IS the wire radius. without it they have zero radius so the particles will never hit them (i'm using lines currents instead of cylinder currents 'cause the math is much simpler and you can approximate cyclinder currents with a bunch of line currents anyways). and if you want that, you can just set the radius to zero, anyways.
anyways i fixed it by just storing that info in "constant memory" instead of the position 4-vector, and per particle type rather than per particle. now you see all the particles, including yellow electrons clearly and they expand together because they're net neutral and coloumb forces pull together any substantial charge discrepancies.
sorry no video yet. not really all that impressive anyways. just multicolored dots expanding. (and i've sped up the framerate about 5x)
now onto the static fields. i posted my bfield code above. got the efield code done too now. i want the math double-checked. the static fields are invisible though - you'll only see them by how the particles move.
the radius i'm talking about IS the wire radius. without it they have zero radius so the particles will never hit them (i'm using lines currents instead of cylinder currents 'cause the math is much simpler and you can approximate cyclinder currents with a bunch of line currents anyways). and if you want that, you can just set the radius to zero, anyways.
-
- Posts: 1439
- Joined: Wed Jul 14, 2010 5:27 pm
new videos. includes electrons (thanks to the bug fix).
thanks to a little parameter i put in for testing, we can see them start out w/an electrostatic differential:
w/electrons dominant on the inside:
http://www.youtube.com/watch?v=Tjt9A8leMzA
w/electrons dominant on the outside:
http://www.youtube.com/watch?v=RYWlzxugvNM
thanks to a little parameter i put in for testing, we can see them start out w/an electrostatic differential:
w/electrons dominant on the inside:
http://www.youtube.com/watch?v=Tjt9A8leMzA
w/electrons dominant on the outside:
http://www.youtube.com/watch?v=RYWlzxugvNM
Can't wait to get away from this corporate firewall and view it.happyjack27 wrote:new videos. includes electrons (thanks to the bug fix).
thanks to a little parameter i put in for testing, we can see them start out w/an electrostatic differential:
w/electrons dominant on the inside:
http://www.youtube.com/watch?v=Tjt9A8leMzA
w/electrons dominant on the outside:
http://www.youtube.com/watch?v=RYWlzxugvNM
In previous video you don't visualize the wires? Will you visualize them?
-
- Posts: 1439
- Joined: Wed Jul 14, 2010 5:27 pm
i don't even have wires (static currents and voltages) yet. that's what i'm working on now. but no, the actual wires will be invisible. to make them show up i'd have to write OpenGL renderers for them, and frankly, i don't even know how to do that. But if the voltage and current is strong enough i'm sure you'll be able to deduce where they are from where the particles are.
-
- Posts: 1439
- Joined: Wed Jul 14, 2010 5:27 pm
the preliminary code to calculate the force from the static em-field of a finite straight wire segment on a moving point charge is available here. (the link is not a download, it'll show you it online. and you can download it from there if you really want.) if anyone finds any errors, please let me know. thanks.
Bah ... apparently I was more tired than I thought when I read your post. I understand now.happyjack27 wrote:the radius i'm talking about IS the wire radius. without it they have zero radius so the particles will never hit them (i'm using lines currents instead of cylinder currents 'cause the math is much simpler and you can approximate cyclinder currents with a bunch of line currents anyways). and if you want that, you can just set the radius to zero, anyways.krenshala wrote:Don't use the radius of the wire if it that is the radius the magrid is at, as a number of us would love to see just what electrons do when they move out through cusps -- do they just run off, do they (mostly|somewhat|not at all) recirculate back into the cusp(s), etc.
If you could model double the magrid radius that should, I think, be sufficient. Anything that gets to twice the magrid distance from the center would be considered "lost" to the chamber walls, unless others think a larger distance outside the magrid would be worthwhile to simulate.
What I meant to suggest was use two times the distance from center to the wires as another cut off distance to simulate particles lost to the chamber walls, or just far enough out to be "lost" to the system we are interested in.