Simulation software : OOPIC

Discuss the technical details of an "open source" community-driven design of a polywell reactor.

Moderators: tonybarry, MSimon

happyjack27
Posts: 1439
Joined: Wed Jul 14, 2010 5:27 pm

Re: Simulation software : OOPIC

Post by happyjack27 »

Finally, none of this math holds once you add ions and electrons - they make their own fields - that's why OOPIC and TechX code will be needed. This is good for "starting up" the machine. Dr. Park is even sketpical this code can account for the net effect of 1E12 to 1E14 particles acting together.
with a pic method, the number of cells might end up being the limiting factor, as far as resolution goes.

i used a brute force all-pairs method. tradeoff here is it's higher accuracy, but the computation time also grows a lot quicker with number of particles. so that was my resolution limit. i cheated it a little by making one virtual particle represent many real particles. i justified this by thinking of it as a discrete element computational fluid dynamic sim. that is, i though of the plasma as a continuous "fluid" (rather than a collection of particles) and my virtual particles to be "sample points" in the fluid.

whatever method one takes, ultimately you're going to be dealing with "sample points" of one sort or another. and doing it iteratively/recursively. that is, each new "sample" is a "sample" of the last "sample", which in turn is a sample of the previous, ad infinum. so you see the trick is to try to make it so that this infinite regress - so to speak - is a good stable copy of the infinite regress that is reality.
One line of code I've done for magnetic field calculations (without particles) involved breaking a current loop into segments, then vector addition of the field from all the segments. Analytic integration of the off axis magnetic field from a current loop has eluded me. Mattman, the plots you show in this thread might be explained by not doing vector addition correctly. That hyperphysics page you reference doesn't cover off axis calculations.
that was one of the hardest parts for me, when making my sim. for a long time i knew the static e-field was wrong somehow, but couldn't figure out. someone else took a look at it and they couldn't figure it out, either, but they did offer a link to a different way to do it. i implemented that and ti worked fine. still no idea why the original algorithm didn't work right. point being: yeah, i agree. those geometry calculations can be quite nuanced and tricky.

prestonbarrows
Posts: 78
Joined: Sat Aug 03, 2013 4:41 pm

Re: Simulation software : OOPIC

Post by prestonbarrows »

Matt, I can't say for sure without access to the actual vector field you are using to plot these. But, you either have an impossible, diverging, magnetic field or the vector plot is just misleading. I think it is very likely you have an issue with how you are handling the boundary conditions and symmetry planes in your code.

The integral of the magnetic flux through a closed surface must be identically zero from Gauss' law for magnetism. If you draw a box anywhere in space, the magnetic flux entering it and exiting it must be equal.

Put formally,ImageImage

Look at the attached crudely edited image of your plot, everywhere on the square surface outlined in the center the magnetic flux is pointing outwards. This violates Gauss' law and would require a magnetic mono-pole. The B-field should enter through the flat faces of the box and leave through the corners (or vice versa). To prove me wrong, you'll have to show me some flux passing from the outside of the box to its interior to balance the obvious flux passing from the interior towards the outside in order to satisfy Gauss.
H87p73L.png
H87p73L.png (199.52 KiB) Viewed 18620 times
Also attached is a quick plot i made with a commercial 3D modeler. No symmetry planes are used. Shown is a midplane slice where color represents the magnitude of B, the black vectors are normalized and not dependent on field magnitude, and the white streamlines are just for further illustration. Notice it is divergence free everywhere and B goes to zero with an undefined direction at the origin.
Bfield2.png
Bfield2.png (220.88 KiB) Viewed 18610 times

DeltaV
Posts: 2245
Joined: Mon Oct 12, 2009 5:05 am

Re: Simulation software : OOPIC

Post by DeltaV »

An interesting website, touching on the subtleties of vector fields:
http://mathinsight.org/
http://mathinsight.org/divergence_subtleties
http://mathinsight.org/curl_subtleties

D Tibbets
Posts: 2775
Joined: Thu Jun 26, 2008 6:52 am

Re: Simulation software : OOPIC

Post by D Tibbets »

Several perhaps picky items.

The field enters at the face centered point cusps , if you define North as invard vectors, but this is arbitrary, South could also be used , so long as you are consistant. The face centered point cusps have vecors one way and the corner, modified line cusps have vectors in the opposite direction.

In WB6 there was a wire cage- grounded Faraday cage, but this is essentially no different than the walls of the vacuum vessel, The only consideration is the radius relative to the machine. This has significance for charged particles trying to loop around to another cusp outside the machine, etc.

Matman's drawing of WB6 is off in regards to the electron emitters -the stalks in the upper four corners. They are not capacitors or fed by capacitors. They are head light filaments driven by low voltage (12-24V?) Marine batteries. It is easy to provide the amps at this low voltage. What EMC did not have was a high voltage power source that could deliver the nessisary power- voltsge * amps . They had a power supply that could provide ~ 12,000 volts at ~ 2 amps. To work around this they charged up high voltage capacitor banks to this voltage and then with the test- switched this stored energy to the magrid surface. This positive voltage provided the acceleration for the low voltage electrons from the headlight filamants and to prevent the voltage on the magrid from falling/ dropping, the current to the magrid had to match the electron emmiter current. Thus the capacitor supply.

This is different in the Navy machine- "Mini B". The electron emmiter/ gun was at high voltage, while the magrid is presumably grounded- no mention of a positive voltage power feed to the magrid mentioned.The electron gun in this case is again at about 2 amps capacity. The decreased final high energy electron injection power was adequate because the machine was smaller, the injection efficiency may have been better (???). And most of the charged particle energy was via the plasma guns- a bunch of medium energy ions and electrons sprayed into the machine by two plasma guns.
The plasma guns provided most of the heat. This is fundamentally different than WB6 where injected high energy electrons did essentially all of the heating. This progressive build up of pressure (density*temperature) needs to be more rapid than the leakage/ energy drain mechanism at all stages of Wiffleball inflation. Apparently this was the problem with difinatively achieving this in WB8 work- the E- gun capacity and/or injection efficiency was just not good enough.

PS: On the surface this would seem to suggest that WB6 results and earlier work may not have actually achieved Wiffleball status, but the nubs may be the critical factor. The injecter electrons in WB6 may have been getting only a few amps of current into the machine (see my thread on this speculation). The remaining current (40 or more amps at ~12,000 Volts) was hitting the only available target that was not magnetically shielded or at the top of the electrons potential well outside the Magrid- ie: the nubs were hit by high energy electrons and this would act as plasma guns in their own right. The current and power was much less than the power applied to the plasma guns in the Mini B machine, but the claimed cusp confinement was also much better in WB6 (not to mention the issue of recirculation that I do not think was possible in Mini B with it's grounded Magrid). The final comparison is an interesting, and speculative one on my part. WB8 without these nubs did not have this option. I'm curious about the presumably several versions of WB7 that may have eventually modified/ eliminated these nubs. Remember Nebel's comment about the heating of WB7 nubs- this would be from high energy electrons as mentioned above.

Dan Tibbets
To error is human... and I'm very human.

mattman
Posts: 459
Joined: Tue May 27, 2008 11:14 pm

Re: Simulation software : OOPIC

Post by mattman »

Hello,

This is a pretty serious criticism of my work.

I am fairly certain that my code can make your plot.

There are two reasons why the pictures may not be exact:

1. My plot is not exactly in the Z= 0 plane. It is likely that if I give Z=0, the code gives NaN. This is due to the math – your software may correct for it.


2. The rings spacing and power is such that the field repels in that particular configuration.

However I will go back and check.

====
Here is a flow chart of the benchmarking for a single ring.
Image

hanelyp
Posts: 2261
Joined: Fri Oct 26, 2007 8:50 pm

Re: Simulation software : OOPIC

Post by hanelyp »

One thing that stands out, the limits of integration around a ring are 0..2pi, not 0..pi/2. The derivation of several of your equations isn't clear.
The daylight is uncomfortably bright for eyes so long in the dark.

prestonbarrows
Posts: 78
Joined: Sat Aug 03, 2013 4:41 pm

Re: Simulation software : OOPIC

Post by prestonbarrows »

Being significantly off the midplane would explain the apparent 'divergence' near the origin. In that case, you would have flux coming 'out of the page' from one of the other two coils in the z direction. Gauss' law is of course is for all dimensions; I made the assumption you were on the midplane and could envoke symmetry into the z direction also.

I will admit that I have not combed through your code, I am just going by your plots. You absolutely can solve this problem with biot-savart of a single coil and then superimposing them into whatever configuration you want since there are no non-linear materials. You can do volumetric coils with biot-savart also without too much extra work.

Are you trying to use planes of symmetry to segment into the triangular wedges you have shown before? This could lead to issues like we are seeing here. For example, if you tried to split a coil in half with a symmetry plane (mirror image, or reflection over a plane), you violate conservation of charge. One side will have currents sinking into eachother and the other will have currents sourcing away from eachother.

What you need in this case is periodic symmetry (rotating around an axis). This will make the current flowing out of one boundary flow into the adjacent boundary and conserve charge. In this case, you can actually make an arbitrarily small angular slice to model since there is full rotational symmetry.

I hope I'm not coming off as a jerk here, just outlining issues I have had in the past when writing similar codes. See my crappy paint illustration if my explanation was not that great. Both cases look the identical when only one segment is done but the one on the left falls apart when you combine the segments back into the full picture.
symmetry.png
symmetry.png (11.41 KiB) Viewed 18547 times
Also, look at your vector plot along the x=0 and y=0 axes. Outside the coils, the vectors are apparently oriented parallel to the surface of the local coil. Just from the basics of how a solenoid works we know these should be directed perpendicular to the coil face (pointing through the center of the coil). Look at my example to see what I mean. This can not be explained away by plots reasonably offset from the midplane; though it could just be misleading graphics again I suppose.

If you plot just a single coil with your algorithm, does it look like a solenoid should qualitatively?

mattman
Posts: 459
Joined: Tue May 27, 2008 11:14 pm

Re: Simulation software : OOPIC

Post by mattman »

Preston,

The difference could be the code treats the rings like two points.... This could be an issue. I do not track the whole wire.

But the solution is still from "Low beta confinement in a Polywell modeled with conventional point cusp theories"


Image

Implementing this was tricky. There were 18 component vectors. These came from the 6 rings and 3 directions. So they could be listed as:

The contribution from ring 2 in the X direction
The contribution from ring 4 in the Y direction
The contribution from ring 2 in the Z direction
Ect….

The trick was keep track of the direction. Add the vectors in the positive direction... subtract vectors in the negative direction.

=====

I encoded this into excel. I used a test point: (0.02, 1E-8, 1E-8)

Image

The solution: 933 gauss in the X-direction is VERY close to the solution for one ring excel file, the single ring MATLAB code and Hyperphysics.

Image

The next step was to encode this into MATLAB. I setup MATLAB to give me the component vectors. I compared it against the excel output:

Image

I got agreement – except when the point sat outside the rings. There - the sign on the component vectors switched.

But an arbitrary swap of signs (in MATLAB) would give no physical consistency.

The code gives slightly different solutions when the z axis is on or off. Example:

Image

These fields would not “flow” if the signs were flipped.

These plots are consistent with alike poles which HATE each other.

Image

Additionally, the vector plots for the full solution is consistent with the vectors for single rings. Here is an example, you turn on and off different rings:

Image

Finally, you can move the rings and the field still looks appropriate:

Image

Just as a final check… here is a comparison between the MATLAB output and simple biot-savart expression.

Image

hanelyp
Posts: 2261
Joined: Fri Oct 26, 2007 8:50 pm

Re: Simulation software : OOPIC

Post by hanelyp »

mattman, the only one of those X,Y magnetic field plots not obviously wrong from visual inspection is the single coil. I expect you have a problem with vector addition in your code. Look at the 2 coil plot, how the field strength jumps crossing the origin from the quadrant near the coils to the opposite quadrant.

Simulation a coil with only 2 points strikes me as another problem. In the code I've written I usually run 8 or 12 segments around the coil.
The daylight is uncomfortably bright for eyes so long in the dark.

mattman
Posts: 459
Joined: Tue May 27, 2008 11:14 pm

Re: Simulation software : OOPIC

Post by mattman »

hanelyp,


The Equations account for the full wire.

The math is the super position of the field made by 6 rings in a box.

The solution for one ring is from the text: "J. Jackson, Classical Electrodynamics, 2nd ed. (Wiley, New York, 1975), pp. 177–180."

I had to go and check the original text. All they did was use superpositioning to make the field from 6 rings.

So the equations should account for this.

happyjack27
Posts: 1439
Joined: Wed Jul 14, 2010 5:27 pm

Re: Simulation software : OOPIC

Post by happyjack27 »

you shouldn't be getting any divergence in your b-field. gauss' law for magnetism (one of the equations in maxwell's equation) explicitly states, and i quote:

div B = 0.

happyjack27
Posts: 1439
Joined: Wed Jul 14, 2010 5:27 pm

Re: Simulation software : OOPIC

Post by happyjack27 »

i guess i'm not really sure. it may only be showing divergence because of precision loss - consider the point you made about the two bar magnets. i mean, exactly in-between the bar magnets, you get a saddle point. and that's kind of what we're seeing in the center, except we can't see the whole thing because of the coarse-graining. so i'm not sure. i can't tell. be interesting to see two facing coils - in an attracting position (poles aligned) and a repelling position (poles opposite). 'cause i mean, other than the what looks like a divergence, the arrows for the most part seem to be orientated right. and they do weaken in strength as you move from the magnet.

Post Reply