Simulation software : OOPIC

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

Moderators: tonybarry, MSimon

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

Simulation software : OOPIC

Post by hanelyp »

For the last week and a half I've been fiddling with OOPIC, in particular XOOPIC available from http://ptsg.egr.msu.edu/ .

Initial impressions:

A very powerful piece of software, supporting full EM calculations and configurable ion species.

Limitations and drawbacks:
- Only does 2D calculations, Cartesian or cylindrical coordinates. So won't do a standard model polywell.
- So far I've found 2 crash bugs
- A problem with coordinate conversion if physical coordinates go outside the first quadrant. I've patched.
- A particle leaving the model region causes an array index error, easily enough prevented by model setup.
- Other bugs
- a zero area current region, easily created by accident, breaks magnetic calculations.
- overlapping Exitports appear to case a pathological condition.
- timestep too large causes problems you wouldn't expect.
- Slow, which should probably be expected given the nature of the simulated system.

So far I haven't figured how to include a charged grid in a model.
The daylight is uncomfortably bright for eyes so long in the dark.

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

Re: Simulation software : OOPIC

Post by happyjack27 »

doesn't sound like very good programming.

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

Re: Simulation software : OOPIC

Post by prestonbarrows »

happyjack27 wrote:doesn't sound like very good programming.
That's because it is 20+ years old. Check out Tech-X and Vorpral. That is the newest interation and is fully 3D E-M.

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

Re: Simulation software : OOPIC

Post by mattman »

Tech-X is where it is at. That is the code to use.

===

Comparing the Bussard’s and the Navy’s Polywell:


First, the vector fields for both devices (at maximum power):

Image

Note that the vector sizes do NOT scale between each plot. However, the Navy machine had about twice the power of WB-6 and the rings had a MUCH SMALLER cross section AND footprint. This means the navy wrapped with a material much more conductive then copper wiring! Also, they had individual power supplies for EACH ring… as opposed to WB6 where they were strung together in series.

This is reflected in a comparison of the magnetic energy density made by the rings.

Image

All in all, there are many differences between the machines. The navy used e-guns and plasma cannons, while bussard used an electric field on the outside.

Overall the navy machine is ~14X more powerful, in a much smaller volume of space... this may help get the plasma get closer to cusp confinement.

Can OOPIC duplicate these conditions, or energies?
Last edited by mattman on Fri Sep 05, 2014 3:34 am, edited 4 times in total.

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

Re: Simulation software : OOPIC

Post by hanelyp »

Amps and particle energies don't appear to be a problem for OOPIC. Particle collision simulation can be turned on. The biggest limitation on what it appears capable of, assuming enough computer time, is the 2D simulation.

Matman, I note that the images you show are low beta. And the magnetic field lines don't look right near the center. Part of the reason the simulations I'm attempting are running slow is I'm running large numbers of particles trying to push high beta.
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 »

Hello,

These fields have no particles in them, so there is no Beta involved. They are just what is produced by the rings themselves. I have uploaded the code which generated them on GitHub:

1. The MATLAB code for making the XY Vector field

2. The MATLAB code for making the energy density plot

In terms of duplicating the behavior of the plasma inside the machine - I have a short movie of the plasma moving around the Navy device. This is a composite of images. You can see it, by clicking the image below.

Image

Overall, you can do a comparison of WB-6 and the Navy machine. There are several differences in the way they are setup. First Bussard's machine had a wire cage on the outside. Below is a Sketchup/CAD model and picture of this machine. (in blue is the chunk you could do an OOPIC simulation of).

Image

Image

The Navy ditched the cage, in favor of a electron and plasma gun. Here is a Sketchup/CAD model of their design:

Image

Image

Based on the energy density analysis, the Navy device is ~14 times more powerful in the center, then WB6 was.

What is interesting, is the likely hood of better internal wiring than the typical copper wiring. Also the overall decrease in size.

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

Re: Simulation software : OOPIC

Post by happyjack27 »

a particle-in-cell simulation will be limited in spatial precision. it'll cause a ssystemic bias in its estimation of magnetic trapping factor. it will underestimate it. it will produce choppy / periodic iso-surfaces where there should be smooth ones.

while it's interesting and some of its results may certainly be useful, be cautioned that it could produce false negatives where the difference between a continuous and a periodic flux surface is a critical one,

better to augment it with something like the fast multipole method to improve the spatial accuracy / resolution with minimal computational cost.

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

Re: Simulation software : OOPIC

Post by hanelyp »

Better particle in cell simulations can interpolate between sample points, which is much better than assuming a constant field within a cell, but still less than perfect fidelity. Realistically, compromises must be made if the plasma is contributing a large portion of electromagnetic fields.
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 »

Matt, there is something wrong with your magnetic plots. From Maxwell's equations, the divergence of B is equal to zero. That is not the case for your plots, clearly so near the center. Also, the magnitude of B would go to zero at the origin.

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

Re: Simulation software : OOPIC

Post by mattman »

Hello,

Actually, the code/math gives a null result at the dead center. Typically you use 1E-8, instead of zero to avoid this.

================

I am very certain of these plot and the code used.

I validated them several times, and in several ways. They have been checked against excel plots, simple Biot-Savart law expressions and published values. The code was developed for the simpler single ring first, followed by all the rings.

It was 8 months of work.

The process is all spelled out in this post.


================

The heavy lifting was done by Dr. Khachan's team: Matt Carr and David Gummersall at the University of Sydney. Their paper: "Low Beta Confinement in a Polywell Modeled with Conventional Point Cusp Theories" developed the math to model the field. Writing that into MATLAB took a long time but, I argue it was a better path than using a canned software (like COMSOL). I took what they did and applied to WB-6, and then checked the output against Bussards' values, an excel implementation, simple biot-savart expressions and basic common sense. I did this for a single ring first, got agreement, and moved on to the full field. It took months. The code was re-written several times - there were particular issues with getting the vector field properly pointed. It is objected oriented, broken into functions and has sensible variable names. It is also well commented and easy to follow.

This code is benchmarked. This code is spectacular.

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

Re: Simulation software : OOPIC

Post by hanelyp »

Harder to tell on the WB6 XY Vector field, but the interior of the Navy XY Vector field plot is clearly off in both magnitude and direction. It looks like 4 sectors put together, each sector computed based on the current in that sector but ignoring the current in other sectors.
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 »

The vector lengths are just scaled.

Relative to one another, they are correct.

But, overall, the lengths are arbitrary.

=======

The direction is correct.

A simple case illustrates this: two poles facing each other.

Image

The XY plot looks very similar. The MaGrid - really is - 6 poles shoved together. The field comes in through the rings, exits everywhere else.

Teahive
Posts: 362
Joined: Mon Dec 06, 2010 10:09 pm

Re: Simulation software : OOPIC

Post by Teahive »

mattman wrote:A simple case illustrates this: two poles facing each other.
Does that mean that the field lines (arrows) going towards the center are concentrated along the two central axes and thus not represented by the sample points shown in the plot?

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

Re: Simulation software : OOPIC

Post by mattman »

By sample points, do you mean: joint, center, corner and axis?

We can estimate the fields at these points using simple Biot-Savart expressions.

But, it will not tell us the direction, only the strength.

Actually, I used this simple calculator to start. and then adopted the math for the 4 points.

===
To get the direction I needed the model from "Low Beta Confinement in a Polywell Modeled with Conventional Point Cusp Theories". It does the full field calculations in the X, Y and Z direction I encoded this into MATLAB, and checked it against the simpler expressions.

====
You can even pick a start and ending point inside WB-6 and the code will plot the X, Y and Z fields as the particle moves.

===

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.

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

Re: Simulation software : OOPIC

Post by hanelyp »

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.
The daylight is uncomfortably bright for eyes so long in the dark.

Post Reply