PIC (particle-in-cell), space charge tracking simulation?

I know, that’s why I posted the link. :slight_smile:

This paper has some nice pictures https://arxiv.org/pdf/1310.7866.pdf, and it’s got Hartmut Ruhl and Amitava Bhattacharjee on the author list. They know their stuff. It covers the basics of particle shapes and mapping quantities from the grid to particle and vice-versa.

All the gory details are in the Particle Simulation Code manual - I can’t seem to google a copy of it.

On the Maxwell solver side there is https://github.com/wsshin/MaxwellFDM.jl, which appears to be under development. I know that the Julia FEM package is crying out for developers, and really feel as though that should be the ultimate goal.


I’m not sure what you mean here. FDTD is not really finite elements, and PIC isn’t finite elements either.

I should be clearer. In PIC moments of the distribution function gathered from particles are projected onto any grid. Then any grid will do. FDTD is the easiest to implement but there shouldn’t be any restriction to generalise to FEM, except some extra coding trickiness for dealing with shape functions and element shapes.

I believe that FDTD relies on the “nested” character of the Cartesian grid.
It gives it the conservation properties that make it a success.

I think you’re right, PIC should be able to work with any grid at all. I’m not sure though that it will necessarily lead to a more efficient code. Part of the appeal of PIC is that it can deal with “fronts” moving through space. In that case static graded grids don’t necessarily help very much. And if the graded grid needs to be redone many times over the simulation one could just as well work with a Lagrangean method without the complication of advection.

Could you explain what you mean by nested and graded grids? Do you mean adaptive mesh refinement?

Regarding conservation, explicit Cartesian FDTD plasma PIC codes can be formulated to exactly conserve either momentum or energy but not both. I’m most familiar with the momentum conserving kind. With FEM formulations there are more ways of getting it wrong, but it would still work.

A PIC code that works with arbitrary grids would open up opportunities for gyro kinetic particles for which Cartesian geometries fall short.

Are you also refering to the level set method for front tracking? I’ve never worked with that so would be interested to hear your thoughts.

I am possibly making an unjustified assumption that this is a topic of general interest, as it is only tangentially related to Julia. Perhaps this should be discussed through private messages?

The FDTD method relies on the “staggered” (or nested) grids for the dual quantities. That works well when the grid is Cartesian.

I have to state for the record that my familiarity with PIC codes is for the solid mechanics equations of fast dynamic deformation. The fronts refers then to shock waves or shear bands. I’m not really familiar with plasma physics or the application of these codes plasma physics. Sorry.

Perhaps the conversation is getting a bit narrow, but I’m hoping it will catch some attention and gather some momentum.

The FDTD method relies on the “staggered” (or nested) grids for the dual quantities. That works well when the grid is Cartesian.

The same outcome can be achieved with FEM grids via a careful choice of basis functions or choice of weak form.

So far I think there are very few alternatives to FDTD.

Personally I find these kind of topics fascinating and the scientific/numerical domain knowledge that people bring to the Julia forum is what makes it really interesting, not just another programming forum. So thanks for what you’ve posted so far; I for one appreciate it being posted publicly.

I’d also point out that discourse gives fairly powerful tools for people to mute threads they don’t find interesting.


I agree. In fact, I keep learning about new (to me) kinds of math and simulation by learning about Julia.

Did you complete that geometric multigrid routine? I’m currently using the AlgebraicMultigrid.jl, but geometric MG applies to my use case and is much faster in my experience.

Yes I did but I it still require some packaging work. Would you be interested to test it ? I am away from my computer but I can send it to you tomorrow.

1 Like

I would be interested too. Many thanks.

That would be great! I’ve coded a few of these before, but it seems wasteful to keep doing them individually if a nearly identical code could be used by more people.

Hi, i also have already coded PIC codes for plasma physics and fluid mechanics (VIC). I will be happy to help and contribute.


Hi @PetrKryslUCSD and @weymouth, I finally put the repo containing the GMG prototype on github.


Great, thanks @LaurentPlagne! I’m writing a separate fluid solver so general flows, so maybe we could see about developing a GMG solver which works for both?

Would be awesome !

I am currently working on CFD and full potential solver using my geometric algebra foundation Grassmann.jl. Will take a look at your work as well, but will not be contributing because I am developing a universal foundation for CFD based on geometric algebra from scratch and have my own repositories for that. Also solved the lid cavity problem already as well. Don’t know much about multi grid, I’m still learning. If anyone is interested in using Grassmann as the geometric foundation for CFD, let me know.

1 Like