simple particle simulators

Discuss how polywell fusion works; share theoretical questions and answers.

Moderators: tonybarry, MSimon

ohiovr
Posts: 431
Joined: Mon Mar 02, 2009 6:36 pm
Contact:

simple particle simulators

Post by ohiovr »

Hey everyone,

I've found several interesting particle simulators that run in applets. Its a major PITA to use java applets, I've resorted to using a virtual box. Woe is desktop java. Even a java made web browser for windows wouldn't load java applets.

Is there a desktop simulator you can recommend? I don't mind shelling out some money for one either.

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

Re: simple particle simulators

Post by hanelyp »

Best I've found so far is XOOPIC. Expect difficulties running it in windoze, and more difficulties with the scanty documentation.

I've given thought to writing a better simulator. One idea I have takes model source code and compiles it to an executable with exactly the features specified. A bit slower to start a model (minutes), but could execute faster than other methods (hours).
The daylight is uncomfortably bright for eyes so long in the dark.

ohiovr
Posts: 431
Joined: Mon Mar 02, 2009 6:36 pm
Contact:

Re: simple particle simulators

Post by ohiovr »

hanelyp wrote:Best I've found so far is XOOPIC. Expect difficulties running it in windoze, and more difficulties with the scanty documentation.

I've given thought to writing a better simulator. One idea I have takes model source code and compiles it to an executable with exactly the features specified. A bit slower to start a model (minutes), but could execute faster than other methods (hours).
Kool thanks. Well it should work with my linux mint Vbox. Actually the only way I could get java applets to run was with linux. Sorry state of affairs...

ohiovr
Posts: 431
Joined: Mon Mar 02, 2009 6:36 pm
Contact:

Re: simple particle simulators

Post by ohiovr »

hanelyp wrote:Best I've found so far is XOOPIC. Expect difficulties running it in windoze, and more difficulties with the scanty documentation.

I've given thought to writing a better simulator. One idea I have takes model source code and compiles it to an executable with exactly the features specified. A bit slower to start a model (minutes), but could execute faster than other methods (hours).
Actually if you were thinking of writing a better simulator I'd be willing to lend a hand. I know Unity3D pretty well. Maybe if we can codevelop libraries we can roll our own simulators. Unity is available for free. I use C# in Unity. You can use Javascript but I think C# is usually easier to write because it isn't as verbose. Unity already has a pretty nice physics package. We would need to roll our own lorenz force solver. How hard could it be?

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

Re: simple particle simulators

Post by hanelyp »

I was thinking C/C++ for the code. Given the speed demands almost anything else is second fiddle. XOOPIC runs microseconds of simulation time/day when particle counts get up where you need them for a good high beta simulation, and I'm hoping to run faster without sacrifice of simulation quality. I'm also looking at putting the physics solver in one thread and diagnostic displays and user interface in a separate asynchronous thread.

The physics package in Unity is probably well suited to games, but I doubt it can handle particle physics efficiently.

There's a possible technique of computing electromagnetic fields based on local particles and fields propagating from cell to cell. Likely tricky to get right, but potential orders of magnitude improvement in speed over other options. I need to bone up on Maxwell's equations for this.
The daylight is uncomfortably bright for eyes so long in the dark.

ohiovr
Posts: 431
Joined: Mon Mar 02, 2009 6:36 pm
Contact:

Re: simple particle simulators

Post by ohiovr »

Actually if you want to get fancy, use CUDA

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

Re: simple particle simulators

Post by prestonbarrows »

Plasma Physics via Computer Simulation is the classic on the theory of particle-based plasma codes. It outlines the algorithms and gives some coded examples. Be warned that it is dated, but the essentials are there if you are fluent in a more modern coding language.

What you are talking about is known as 'particle in cell'. These are commonly made as home-brew solutions to specific problems but there are few commercially available general purpose codes available. One is V-sim from Tech-X. It is in the range of a few grand per year per processor for a license though.

Reactor codes are generally MHD, not particle, based these days since that is more geared to things like tokamaks.

You will need to run with something low level like C and/or leverage parallel GPU processing to do anything useful in 3D in a reasonable time.

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

Re: simple particle simulators

Post by hanelyp »

The price described for V-sim is outside my budget.

MHD would be attractive if the situation I wanted to simulate had a short mean free path. For long mean free paths, such as in a polywell, I'm not seeing how that method fits.

The hardware I'd be running on has what was a high end CPU a couple years ago, but a low end video chip. My skills are better with C/C++ than GPU programming anyway.
The daylight is uncomfortably bright for eyes so long in the dark.

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

Re: simple particle simulators

Post by prestonbarrows »

hanelyp wrote:The price described for V-sim is outside my budget.

MHD would be attractive if the situation I wanted to simulate had a short mean free path. For long mean free paths, such as in a polywell, I'm not seeing how that method fits.

The hardware I'd be running on has what was a high end CPU a couple years ago, but a low end video chip. My skills are better with C/C++ than GPU programming anyway.
Yup, I agree, those were exactly my points. A few commercial software solutions exist but are extraordinarily expensive making it worth while to try and roll your own. Most of the cutting edge codes are aimed at tokamak type MHD applications, again making it worth while to roll your own.

Here is an interesting high-performance FOSS pic code https://github.com/ComputationalRadiati ... s/picongpu it was still in alpha development last time I used it. I am not sure how much / if any progress has been made on it since.

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

Re: simple particle simulators

Post by hanelyp »

prestonbarrows wrote:Here is an interesting high-performance FOSS pic code https://github.com/ComputationalRadiati ... s/picongpu it was still in alpha development last time I used it. I am not sure how much / if any progress has been made on it since.
Interesting. Appears to require an Nvidia GPU, which rules out my desktop server. I need to check if my gaming laptop might work with it.
The daylight is uncomfortably bright for eyes so long in the dark.

ohiovr
Posts: 431
Joined: Mon Mar 02, 2009 6:36 pm
Contact:

Re: simple particle simulators

Post by ohiovr »

I wonder if CUDA is easier to program [than OpenCL] seeing that developers put up with it's exclusivity.

asdfuogh
Posts: 77
Joined: Wed Jan 23, 2013 6:58 am
Location: California

Re: simple particle simulators

Post by asdfuogh »

CUDA is easier to program in, but also, nvidia is relatively dominant in GPUs as well. If you wanted to run a meaningful PIC simulation of a Polywell, I would recommend against anything that didn't use Fortran or C/C++ because it either means they're using an insignificant amount of particles or low resolution meshes. Of course, that's not necessarily true if it's a 1D code, but other than that, it's probably not worth it.

If you're looking to learn something from this, I would recommend trying to write your own code, or finding a simple 1D (or 1 and 2 halves dimension, ie. x, vx, vy, vz) PIC code to modify. It is not easy to jump into a large code written by physicists because we're shitty programmers in the sense of readability.

ladajo
Posts: 6258
Joined: Thu Sep 17, 2009 11:18 pm
Location: North East Coast

Re: simple particle simulators

Post by ladajo »

I don't think you can run a meaningful sim for a polywell.
How would you reconcile the magnetic fields against the electric fields at high beta and sufficient particle densities to mean anything useful?

That would need some pretty serious custom code and processing power that is beyond anything reasonable.
The development of atomic power, though it could confer unimaginable blessings on mankind, is something that is dreaded by the owners of coal mines and oil wells. (Hazlitt)
What I want to do is to look up C. . . . I call him the Forgotten Man. (Sumner)

asdfuogh
Posts: 77
Joined: Wed Jan 23, 2013 6:58 am
Location: California

Re: simple particle simulators

Post by asdfuogh »

>I don't think you can run a meaningful sim for a polywell. How would you reconcile the magnetic fields against the electric fields at high beta and sufficient particle densities to mean anything useful? That would need some pretty serious custom code and processing power that is beyond anything reasonable.

OP probably can't do it on his own home computer very easily without making it less than meaningful, but I would say that the approach to simulating depends on what you want to simulate. With the wide range of plasma length scales and time scales, you really have to have an idea of what's important in order to simplify your simulation to the point where you can actually solve a tiny part of the problem. For example, if we can even hold a plasma in the polywell center for a good millisecond or so, maybe you want to start asking how important the electrostatic drift instabilities are to this type of plasma. Then you'd have to already assume some equilibrium of sorts (ie. b-field, densities, temperatures, what else?) before you can even hope to do that type of simulation.

Also, another important type of simulation would be the plasma-material interaction between the coils and the plasma, since you're sticking the damned rings and plasma pretty close to each other, that may be a source of impurities that can cause more instabilities or other unwanted effects. I don't know enough about this type of simulation, but you don't really use PIC codes for it, I think.

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

Re: simple particle simulators

Post by happyjack27 »

ladajo wrote:I don't think you can run a meaningful sim for a polywell.
How would you reconcile the magnetic fields against the electric fields at high beta and sufficient particle densities to mean anything useful?

That would need some pretty serious custom code and processing power that is beyond anything reasonable.
at high particle count, if you're talking simulating ala particle-to-particle pair interaction, you can use a barnes-hut tree code http://en.wikipedia.org/wiki/Barnes%E2% ... simulation or a fast multipole method https://www.siam.org/pdf/news/637.pdf

that takes care of your cpu scaling problem.

but then you're going when you go really really high you're going to start running into i/o bottlenecks.

that's where you look for approximation methods and/or concentrate on smaller areas to reduce the particle count.

if by high beta you're talking high curvature... where your spatio and spatio-temporal derivatives become real significant, i've encountered some papers that use an approach centered on "vortexes" that may be of use there. some advanced and interesting stuff. over my head. http://crd.lbl.gov/assets/pubs_presos/A ... G/A124.pdf

Post Reply