ComputationalRadiationPhysics / picongpu

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

variable ParticlePerCell in init #4910

Open BrianMarre opened 3 months ago

BrianMarre commented 3 months ago

It would be nice to be able to vary the number of particles we try to spawn in each cell over the simulation.

This would allow an increased number of samples in regions of interest while keeping the total number of macro particles down, and avoiding the need to use separate species.

This is feasible as discussed with psychocoderHPC offline but will require an interface change in the start position functors.

ikbuibui commented 3 months ago

In your opinion what would a good/convenient way to describe this initial particle density distribution be, just so I can get more of an idea of what the interface should maybe look like. Maybe a normalized SIM_DIM dimensional function, scaled by the max particles per cell you want?

pordyna commented 3 months ago

Exactly, with x, y, (z) in SI units like in density function and with the total domain size (in SI units) available in the functor since there is no way in PIConGPU to shift your coordinate system, and simulation box size is a runtime option. (Btw. this should be also a thing for the density functor ;) )

pordyna commented 3 months ago

I would also suggest that there should be a test if the result is an unsigned integer, but no automatic conversion so that the user fully controls the rounding. But, others may have a different opinion on that.