Progress in Fusor Plasma Simulations

This area is for ADVANCED theory and discussions only. If you just joined fusor.net, chances are this is NOT the area for you to be posting.
User avatar
Nicolas Krause
Posts: 230
Joined: Fri Sep 30, 2016 7:36 pm
Real name: Nicolas Krause
Location: Canada
Contact:

Re: Progress in Fusor Plasma Simulations

Post by Nicolas Krause »

I'd contacted Matthew Lilley a few years back asking if I could see his code. He let me know he doesn't have it anymore, I believe it was written in Fortran and he indicated it was a poster for a conference, I don't know if he was trying to get funding for a project or look better on the job market but it's over a decade old at this point. I agree that the dynamics are very complex, I guess the reason I'm interested in the non-linear methods he was attempting is two fold. Firstly, it seems a good way to try and overcome some of the limitations amateurs like us have, buying a supercomputer to simulate some ungodly number of particles is a bit out of reach. Secondly, I think trying something different allows you to make different discoveries, I understand that PiC simulations are the standard for plasma modelling, and with very good reason, but I like the non-linear math and instead of trying to copy what everyone else is doing at least its a different tack.
User avatar
Liam David
Posts: 509
Joined: Sat Jan 25, 2014 5:30 pm
Real name: Liam David
Location: Arizona

Re: Progress in Fusor Plasma Simulations

Post by Liam David »

I'm not trying to downplay a more analytic approach - quite the opposite. I think it complements simulations and can give some great insights, as Lilley's work demonstrates. It'd be interesting to see if I/we could replicate some of his results, and how well that lines up with his ODE... we could solve it numerically after all. To word what I meant earlier more carefully, it's important to recognize idealizations where they exist, and much work on fusors over the years has shown that they don't work quite like we thought, as in recirculation, beam-beam reactions, and all that. I'm quite the math-y guy and really do enjoy PDEs and the like....
User avatar
Richard Hull
Moderator
Posts: 14976
Joined: Fri Jun 15, 2001 9:44 am
Real name: Richard Hull

Re: Progress in Fusor Plasma Simulations

Post by Richard Hull »

Agreed, any path to discovery and learning more about what we are doing to increase the yield is for the best, regardless of how it is arrived at, be it via simulation or in hardware. I have long believed there is no one explanation for how all fusion is done in the simple fusor.

Richard Hull
Progress may have been a good thing once, but it just went on too long. - Yogi Berra
Fusion is the energy of the future....and it always will be
The more complex the idea put forward by the poor amateur, the more likely it will never see embodiment
User avatar
Nicolas Krause
Posts: 230
Joined: Fri Sep 30, 2016 7:36 pm
Real name: Nicolas Krause
Location: Canada
Contact:

Re: Progress in Fusor Plasma Simulations

Post by Nicolas Krause »

Ah right, I see what you're saying Liam, yes I'd definitely agree with that. The whole art of simulating is picking the right simplifications so that the model captures the desired behaviour. I think the reason I'm interested in Lilley's work, is Richard talks a lot about how he has to condition his fusor to get good fusion numbers. The leading theory being that this is created by wall loading of the device with deuterium, this seems to be the furthest starting point for an orbit one could imagine. So the mechanism in my head is like so, a stable orbit leads to more chances to fuse, so an increase in the number of particles with stable orbits increases fusion, the best way to increase stable orbits is by starting the particles from their furthest possible point. The best way to do this is with wall loading. That's sort of the logical chain of thought I have regarding Lilley's work, no clue if people here would agree or disagree with it, but it seems to me plausible.
User avatar
Richard Hull
Moderator
Posts: 14976
Joined: Fri Jun 15, 2001 9:44 am
Real name: Richard Hull

Re: Progress in Fusor Plasma Simulations

Post by Richard Hull »

I have always believed the walls on the long MFP in 6" and larger fusors was charged with neutral D molecules/atoms over time. Bombarding electrons at near full energy and even some neutrals of high energy pop imbedded D out at some X value of sufficient loading as Deuterons to undergo full acceleration towards the grid. Due to MFP few make it, fewer still circulate. Fusion occurs in velocity space within the spherical fusion reactor. This was pointed out by empirical experiment way back in 2004 by U of W. In 1999 Robert Hirsch told me he believed our fusion took placed in velocity space and not in a thermal environment. Velocity space includes inside the grid, but the grid represents near zero volume in the sphere related to the overall volume of the vessel.

Spheres offer only increased 360 degree volume of velocity space over a well done BOT type design. There are many other rare processes fast neutral/wall D fusions, neutral/neutral, neutral/deuteron, the list goes on and on. This is not to boost the sphere as a fusor, for I have already denigrated it for its well proven lower neutron and fusion production over other designs already extant and in use here. I work it more for aesthetics than any other reason now.

Richard Hull
Progress may have been a good thing once, but it just went on too long. - Yogi Berra
Fusion is the energy of the future....and it always will be
The more complex the idea put forward by the poor amateur, the more likely it will never see embodiment
User avatar
Liam David
Posts: 509
Joined: Sat Jan 25, 2014 5:30 pm
Real name: Liam David
Location: Arizona

Re: Progress in Fusor Plasma Simulations

Post by Liam David »

Just a quick update as I work on a new and improved (read: much faster and with fewer bugs) iteration of the code. Some eye candy with ion optics:

https://youtu.be/XyJW5LpbuBE
User avatar
Nicolas Krause
Posts: 230
Joined: Fri Sep 30, 2016 7:36 pm
Real name: Nicolas Krause
Location: Canada
Contact:

Re: Progress in Fusor Plasma Simulations

Post by Nicolas Krause »

Lovely visualization Liam, are those level surfaces of ions in the video?
User avatar
Liam David
Posts: 509
Joined: Sat Jan 25, 2014 5:30 pm
Real name: Liam David
Location: Arizona

Re: Progress in Fusor Plasma Simulations

Post by Liam David »

It's the density of D2+ ions on the domain.
User avatar
Liam David
Posts: 509
Joined: Sat Jan 25, 2014 5:30 pm
Real name: Liam David
Location: Arizona

Re: Progress in Fusor Plasma Simulations

Post by Liam David »

I've rewritten much of the code and have fundamentally changed the data storage architecture to reduce memory operations, resulting in about an order of magnitude speedup especially at large particle counts. The precision has also been reduced from double to single.

I have also focused on maximizing the performance of collisionless particle tracking, meaning simulations of several million particles evolving for several milliseconds are possible with an overnight run (with a timestep of 40ps). A common performance metric for PIC codes is particle push/boundary check operations per second, and mine achieves ~10^10/s on an RTX 3080, or very roughly 600 GFLOPS. It's a memory-limited application, so the raw FLOP performance does not come close to the maximum of about 30 TFLOPS.

Other changes include:
  • Implementing a 5-point stencil (instead of a 3-point) for the Laplacian in the electric field solver, and making it fully applicable to cylindrical coordinates by including the 1/r*df/dr term. It now accurately produces the logarithmic potentials found in cylindrical geometries.
  • Adding magnetic fields, which is accomplished by providing a magnetization density vector field M and solving a Poisson equation much like the electrostatic case. Some preliminary simulations indicate that a moderate axial magnetic field can enhance ion lifetime, as well as the phase space of stable and quasi-stable orbits. The Boris algorithm is used to push the particles.
  • Accounting for collision angle in the fusion rate calculation (work in progress).
5-point Laplacian
5-point Laplacian

Magnetic field lines superimposed on electric potential
Magnetic field lines superimposed on electric potential
User avatar
Liam David
Posts: 509
Joined: Sat Jan 25, 2014 5:30 pm
Real name: Liam David
Location: Arizona

Re: Progress in Fusor Plasma Simulations

Post by Liam David »

As I hinted at before, the simulation reproduces the color bands seen on cylindrical cathodes, as well as the off-axis beams and circumferential ring bisecting the inside. Due to all the code changes, I can now simulate steady state, which constitutes ~8e6 total particles. I'm also getting hints of what may be ion acoustic waves (or transit time resonance) at ~13 MHz... I'm slowly building confidence in the simulation, although the calculated locations of fusion reactions are not where expected, as in not within the cathode due to anomalous electron trapping. More results to come.

High density beamline obscured to enhance contrast
High density beamline obscured to enhance contrast
User avatar
Javier Lopez
Posts: 141
Joined: Wed Feb 22, 2006 3:32 am
Real name: Javier L

Re: Progress in Fusor Plasma Simulations

Post by Javier Lopez »

Can you set external magnetic fields in your simulations?
User avatar
Dennis P Brown
Posts: 3147
Joined: Sun May 20, 2012 10:46 am
Real name: Dennis Brown

Re: Progress in Fusor Plasma Simulations

Post by Dennis P Brown »

With all those posts and you still not using your full name either you are intentionally breaking the rules or feel you are above them. I'd suggest you follow the rules here if you want to continue posting.
User avatar
Richard Hull
Moderator
Posts: 14976
Joined: Fri Jun 15, 2001 9:44 am
Real name: Richard Hull

Re: Progress in Fusor Plasma Simulations

Post by Richard Hull »

All of the posts by "fusion" will be deleted if he doesn't change his user name along with any responses to his posts.

Richard Hull
Progress may have been a good thing once, but it just went on too long. - Yogi Berra
Fusion is the energy of the future....and it always will be
The more complex the idea put forward by the poor amateur, the more likely it will never see embodiment
Frank Sanns
Site Admin
Posts: 2117
Joined: Fri Jun 14, 2002 2:26 pm
Real name: Frank Sanns

Re: Progress in Fusor Plasma Simulations

Post by Frank Sanns »

Negative. Do not delete Javier's posts.

He has been on here for over a decade but has just come back after the rule changes.

Give him a chance to respond. I have sent him an email but I do not want to change his login name as it will prevent him access.

Under no circumstances should we be nuking somebody with over 100 posts. It is not good form and it will screw up over 100 threads.
Achiever's madness; when enough is still not enough. ---FS
We have to stop looking at the world through our physical eyes. The universe is NOT what we see. It is the quantum world that is real. The rest is just an electron illusion. ---FS
User avatar
Richard Hull
Moderator
Posts: 14976
Joined: Fri Jun 15, 2001 9:44 am
Real name: Richard Hull

Re: Progress in Fusor Plasma Simulations

Post by Richard Hull »

Can we go back and un pink all those posts? I do not know how to do it.

Richard Hull
Progress may have been a good thing once, but it just went on too long. - Yogi Berra
Fusion is the energy of the future....and it always will be
The more complex the idea put forward by the poor amateur, the more likely it will never see embodiment
User avatar
Liam David
Posts: 509
Joined: Sat Jan 25, 2014 5:30 pm
Real name: Liam David
Location: Arizona

Re: Progress in Fusor Plasma Simulations

Post by Liam David »

I'm rewriting much of the plasma simulation to improve its accuracy and speed, and one of the modules that most needs updating is the electromagnetic (EM) field solver.

The previous EM solver wasn't a true EM solver. That is to say, it solved the electrostatic and magnetostatic Poisson equations using the relaxation and/or finite difference methods, situation depending.

poissonE.png
poissonE.png (1.58 KiB) Viewed 13173 times
poissonM.png
poissonM.png (5.09 KiB) Viewed 13173 times

These methods completely decouple the electric and magnetic fields, and give accurate solutions only when the fields' and source' rates of change are very slow (i.e. quasi-static). In addition, relaxation is ridiculously slow, and even using sparse matrices to solve an Ax=b finite difference scheme in >2D is extremely memory-intensive (many TB of RAM).

The new 3D solver uses the finite difference time domain (FDTD) method which fully couples the electric and magnetic fields, any charges and currents present, and all boundary conditions in a relativistic, self-consistent manner. There are still drawbacks, such as non-uniform propagation along diagonals when using a cartesian grid (visible in the videos) and the need to store previous iterations of the fields, but it is still much better than the other methods. Technically, it solves the electric potential and magnetic vector potential equations, converting them into the E and B fields in a post-processing step.

potentialEquations.png
potentialEquations.png (8.49 KiB) Viewed 13173 times

All that aside, here are some videos of a test simulation with the new EM solver. The domain is a conducting box at 0 V with two conducting hemispheres at +100 kV and -100 kV. All other boundaries are open. The potentials are applied instantly, simulating a step function response. Note the interference and reflection of the waves. The timestep is 2e-13 s and the domain is 256^3 cells spanning (84 mm)^3. Steady-state (i.e. the Poisson equation solution) is approached after some time. Since energy is lost only through the open boundaries, reaching steady-state takes a long time. Videos are of the YZ plane.

E Field: https://youtu.be/8IOmu2IlU3Y
Potential: https://youtu.be/erYUmWrbwc0

domain.png
Efield.png
User avatar
Nathan Marshall
Posts: 53
Joined: Wed May 08, 2019 8:13 pm
Real name: Nathan Marshall

Re: Progress in Fusor Plasma Simulations

Post by Nathan Marshall »

Very nice, Liam! I am curious how you implemented the boundary conditions. I have played around with 2D FDTD wave equations but always had issues when trying to implement open boundary conditions.
User avatar
Liam David
Posts: 509
Joined: Sat Jan 25, 2014 5:30 pm
Real name: Liam David
Location: Arizona

Re: Progress in Fusor Plasma Simulations

Post by Liam David »

Yeah, the open boundary conditions are the difficult part. I'm using equation 3.9 in the attached paper for each boundary, representing a wave traveling out of the boundary. I haven't yet completely verified my implementation, so I can't say much about its usefulness, but it seems to work alright. For the conductor boundaries, I just enforce the applied potentials which leads to the 100% reflections.

The other thing I have not implemented is the Lorenz gauge condition, which is required to get a physical solution since the potential wave equations are derived under its assumption. Since phi and A are decoupled, if I initialize some phi, it will never produce a B-field unless I initialize a valid A. It also calculates a non-physical E-field since it depends on A as well. Depending on how difficult the Lorenz gauge is to implement, I may backtrack to the coupled phi and A equations.
Attachments
ln_fdtd_1d.pdf
(60.09 KiB) Downloaded 455 times
User avatar
Nathan Marshall
Posts: 53
Joined: Wed May 08, 2019 8:13 pm
Real name: Nathan Marshall

Re: Progress in Fusor Plasma Simulations

Post by Nathan Marshall »

Wow, I implemented the same boundary condition into my wave equation solver and it worked like a charm! I was overthinking the problem and trying to implement perfectly matched layers from research literature which was too complicated. I didn't think that simply using a 1D open boundary condition would work so well but should have tried that first. I do notice some minor reflections on close inspection since these boundary conditions are not perfect in 2D, but it works well enough for my applications! Thanks for the suggestion.

Quick clip of single slit diffraction from my FDTD solver: https://youtube.com/shorts/kdysUlUlRHI?feature=share
Attachments
Screenshot from 2022-08-30 20-44-51.png
User avatar
Liam David
Posts: 509
Joined: Sat Jan 25, 2014 5:30 pm
Real name: Liam David
Location: Arizona

Re: Progress in Fusor Plasma Simulations

Post by Liam David »

Great to hear that it works for you too, and nice simulation! I also get minor reflections in 3D... something to work on but it's not a priority. I've got more significant errors elsewhere. I was also looking at perfectly matched layers, but like you say they're much more complicated and they also artificially increase the domain size.
User avatar
Liam David
Posts: 509
Joined: Sat Jan 25, 2014 5:30 pm
Real name: Liam David
Location: Arizona

Re: Progress in Fusor Plasma Simulations

Post by Liam David »

There are still some hiccups in the FDTD solver; namely, there's a spurious open boundary that is radiating inwards, but it doesn't affect the dynamics of the plasma which is confined mostly in the center of the domain. I'm probably combing over the GPU solver as you read this...

My latest challenge is one of different scales. Accurately capturing electron dynamics requires timesteps on the order of 1e-13 s. I need simulation durations on the order of hundreds of microseconds, which translates to billions of timesteps. Even with each timestep taking some tens of milliseconds, that translates to weeks of computation (note that each timestep is rather involved, requiring moving particles, computing molecular reactions, depositing charge and current onto the mesh, solving the FDTD equations, adjusting the cathode potential, and logging any important parameters). I need the long duration to limit the divergence of the current. If the background pressure is over the glow discharge threshold, the number of particles grows without bound, quickly surpassing the 20 million limit imposed by my 8 GB of GPU VRAM. Lowering the cathode potential increases the discharge pressure, but changing it unphysically fast generates massive EM waves that mess things up. Lots of work to do.

Deliberately asymmetric.
Deliberately asymmetric.
Pablo Llaguno
Posts: 104
Joined: Sun Feb 05, 2017 6:00 pm
Real name: Pablo Llaguno

Re: Progress in Fusor Plasma Simulations

Post by Pablo Llaguno »

Amazing work Liam.

When you solve the scalar and vector potentials wave (inhomogeneous) equations, I am confused as to why do you need to implement a Lorenz gauge condition. The physical electric and magnetic fields are independent of the gauge function (gauge invariance) and the usual treatment in textbooks is that if this gauge function can be found, then it is not necessary to solve it.

For the Coulomb gauge the gauge function is determined by a Poisson equation, with the divergence of the vector potential as the source. For the Lorenz gauge I can't remember, but my electrodynamics book (Griffiths) has a problem (10.6) that shows it is always possible to meet the Lorenz gauge, assuming you have solutions for the inhomogeneous wave functions for V and A. Wouldn't your numerical solutions for V and A make unnecessary implementing a Lorenz gauge function?
User avatar
Liam David
Posts: 509
Joined: Sat Jan 25, 2014 5:30 pm
Real name: Liam David
Location: Arizona

Re: Progress in Fusor Plasma Simulations

Post by Liam David »

Thanks, Pablo. Indeed, you are correct: FDTD solvers don't require you to pick a gauge. I decided to incorporate it (although nowhere do I explicitly solve it) for a few reasons.

1. It's relativistically valid. While I don't use relativistic particle pushing yet, it is relatively simple to implement.
2. It decouples the potential equations. This makes writing a finite difference scheme much simpler.
3. It is less numerically intensive as it requires slightly less memory access and has far fewer floating point operations.
4. Who doesn't like the symmetry?
Coupled equations
Coupled equations
Lorenz gauge
Lorenz gauge
lorenz.PNG (2.13 KiB) Viewed 12686 times
Decoupled potential equations
Decoupled potential equations
lorenz gauge.PNG (6.31 KiB) Viewed 12686 times
Pablo Llaguno
Posts: 104
Joined: Sun Feb 05, 2017 6:00 pm
Real name: Pablo Llaguno

Re: Progress in Fusor Plasma Simulations

Post by Pablo Llaguno »

Using the Lorenz gauge for this simulation is actually a very astute thing to do. However I am still confused with the reasoning behind this quote
Liam David wrote: Mon Aug 29, 2022 10:05 am The other thing I have not implemented is the Lorenz gauge condition, which is required to get a physical solution since the potential wave equations are derived under its assumption. Since phi and A are decoupled, if I initialize some phi, it will never produce a B-field unless I initialize a valid A. It also calculates a non-physical E-field since it depends on A as well. Depending on how difficult the Lorenz gauge is to implement, I may backtrack to the coupled phi and A equations.
How does initializing a phi (in the grid boundary conditions I imagine) affect the Lorenz gauge? Couldn't you initialize A such that the initial B is zero?

On another note, have you considered using Multiphysics simulators such as COMSOL? I did some FDTD simulations for an optical waveguide and while different from plasma simulations, it still solves Maxwell's equations. I guess it's much faster to do PIC simulations in MATLAB?
User avatar
Liam David
Posts: 509
Joined: Sat Jan 25, 2014 5:30 pm
Real name: Liam David
Location: Arizona

Re: Progress in Fusor Plasma Simulations

Post by Liam David »

Consider this example: I have two parallel plates that are instantaneously set to some potential difference at t=0. We know in advance that the resulting EM waves within the gap between the plates will have both E and B components due to the coupling in Maxwell's equations. There are no charges or currents in the gap, so the potential wave equations become homogenous--both the coupled ones and the decoupled ones.

Consider first the coupled equations (no applied gauge). We have a nonzero d(phi)/dt due to our initial conditions. The first coupled equation tells us that the time derivative of the divergence of A must be nonzero. Thus, except perhaps instantaneously, A cannot be zero. The 2nd coupled equation leads us to the same conclusion. Our algorithm, developed around finite difference stencils, would take this coupling into account and give us equations of the form
phi(n+1) = f (phi(n-1), A(n-1); phi(n-2), A(n-2); ...)
A(n+1) = g (phi(n-1), A(n-1); phi(n-2), A(n-2); ...)
Here n is the timestep index.

Now consider the decoupled equations (in the Lorenz gauge). Since the initial conditions for phi have no coupling to A, unless A is given an initial condition that satisfies the Lorenz gauge, not only will it be zero for all time, but the solution will be nonphysical essentially as constructed. The finite difference stencils give equations of the form
phi(n+1) = f' (phi(n-1); phi(n-2); ...)
A(n+1) = g' (A(n-1); A(n-2); ...)

Another issue can (and does) arise: the continuity equation. It is a corollary to Maxwell's equations and can thus be derived from them, and it must hold true for the simulation to be physical. It relates the change in charge density (rho) to the current density (J) and sort of (although incompletely) couples the decoupled phi and A equations. The discretization of the simulation can increasingly violate continuity over time, causing divergences in the fields. This qualitatively hasn't been an issue for me yet, but it is something I will eventually fix. One method is to define a fictitious field that effectively transports charge conservation errors out of the simulation domain at v > c.

Continuity equation
Continuity equation
continuity.PNG (1.58 KiB) Viewed 12501 times
Post Reply

Return to “Advanced Technical Discussion Area”