stfc / HartreeParticleDSL

MIT License
1 stars 1 forks source link

Support for "inflow"/"outflow" boundaries #66

Open LonelyCat124 opened 1 year ago

LonelyCat124 commented 1 year ago

For the next stage of PIC support, we need to support inflow and outflow boundary conditions.

This requires a new type of kernel, which is something like "size modifying per part kernel". Probably best is to just have two types, "inflow" kernels and "outflow" kernels though.

Outflow kernels are probably best implemented as a 3 step process:

  1. A parallel kernel doing some outflow work on each particle (e.g. if outside, flag particle for deletion).
  2. A serial section organising particles for deletion
  3. Removal of particles.

Inflow kernels are probably a 2 step process:

  1. Find out how many particles will be added, and create space
  2. Generate the new particles (in parallel ideally).

If I had more time, It would be nice to keep some of this space in reserve, but all the current code relies on particle_aosoa.size() so I can't do that optimisation for now.

I plan to make a miniapp to test out how to implement these with Cabana, and after that work out how to do it in the code, and THEN implement stuff to do a PIC program with it.