ComputationalRadiationPhysics / picongpu

Performance-Portable Particle-in-Cell Simulations for the Exascale Era :sparkles:
https://picongpu.readthedocs.io
Other
703 stars 217 forks source link

Particle injection #3912

Closed ervw12 closed 1 year ago

ervw12 commented 2 years ago

Hi, is there an implementation of particle injection in PIConGPU?

Motivation: Since you recently implemented a reflecting wall, one useful setup would be of a collisionless shock front. For example by letting a positron-electron species propagate against the reflecting wall so that it counter-propagates with its own species. Unfortunately, I cannot find a way to have an species, which is quasi infinite in the direction opposite to the reflecting wall.

Possible method: Having an injecting wall (e.g. cathode), either static or moving at light speed in one direction, where a species gets injected into the simulation box.

sbastrakov commented 2 years ago

Hello @ervw12 . We currently do not have a special feature for particle injection. The scheme you described could probably be done on the user side as well, in the iteration start pipeline (it's kinda same to the init pipelize in speciesInitialization.param, but run every iteration), with a CreateDensity<> followed up by a Manipulate<>.

We could maybe add this as a ready-to-use feature, depending on the implementation specifics. I personally do not have a working understanding of how it's done, but perhaps someone in the team does?

sbastrakov commented 2 years ago

So a scheme like described in SMILEI should be possible via an iteration start pipeline, like this:

Then the newly created injected_electrons will be pushed as usual, and then those left outside of the boundary will get absorbed. Those that crossed the boundary will be converted to normal electrons at start of next step.

This isn't a very pretty solution, but I think could be implemented with quite reasonable effort. I could try doing it myself next week if I have time.

pordyna commented 2 years ago

@sbastrakov Wouldn't be this somehow similar to how I'm injecting photons at the simulation boundary? Maybe you can reuse some of the code.

sbastrakov commented 2 years ago

@pordyna probably? In case it's somewhere in your branch, could you link it?

pordyna commented 2 years ago

https://github.com/pordyna/picongpu/tree/topic-RTSplitting so I pushed the branch that I'm currently using. Most of it is in particles/externalBeam. I use there some stuff which for now are in plugins/externalBeam which is mostly stuff that was previosuly in plugins/xrayScattering/ but probably you won't need it. There is also externalBeam.param and here is an example for iterationStart.param.

Let me know if you have some questions.

psychocoderHPC commented 2 years ago

https://github.com/pordyna/picongpu/tree/topic-RTSplitting so I pushed the branch that I'm currently using. Most of it is in particles/externalBeam. I use there some stuff which for now are in plugins/externalBeam which is mostly stuff that was previosuly in plugins/xrayScattering/ but probably you won't need it. There is also externalBeam.param and here is an example for iterationStart.param.

Let me know if you have some questions.

Take care this branch is experimental and is running on GPU only. There are some abstractions missing to make it generic.

steindev commented 2 years ago

Hei @ervw12, the use case you describe sounds very similar to the existing KHI example. It seems you just want to have two species of electrons and positrons were one pair of electrons and positrons has a drift along a given direction and the other pair just has some initial temperature without drift. If you combine this with periodic boundary boundary conditions along the axis of the drift you have exactly what you described: An electron-positron distribution propagating along one direction and colliding "with itself".

steindev commented 1 year ago

No further questions here, closing. @ervw12 feel free to reopen/post a comment if your issue is not resolved.