Warwick-Plasma / epoch

Particle-in-cell code for plasma physics simulations
https://epochpic.github.io
GNU General Public License v3.0
182 stars 58 forks source link

Particle number in 1D/2D simulation #526

Closed TrumeAAA closed 1 year ago

TrumeAAA commented 1 year ago

Hi, I performed several 2D simulations and get the energy spectrum of electrons and photons. How does EPOCH do that or how EPOCH determin number of particles in (E, E+dE) or how EPOCH calculate the number of particles in 2D or 1D simulations? I am confused. All the best.

Status-Mirror commented 1 year ago

The EPOCH field-solver relies on current densities - the absolute charge in a cell is never used when updating Maxwell's equations. We calculate the current density in EPOCH by calculating the absolute charge moved by particles (weight * charge), and dividing it by the cell volume ($dx \times dy \times dz$).

In EPOCH1D and EPOCH2D, we have missing dimensions in the grid, so we have to choose an arbitrary $dy$ and $dz$. In EPOCH, we set these to 1m. EPOCH modifides the macro-particle weights to keep the same particle number density in these massive cells, such that the current densities are calculated correctly and the field-solver equations proceed unaffected by the arbitrary $dy$ and $dz$.

However, this means that macro-particle weights in 1D, 2D and 3D will be radically different, so how can you quote an absolute number of particles in a 1D or 2D code? The way I choose to do this is to conserve laser-to-particle conversion efficiency. The total laser energy injected into a 2D simulation of size $(50\mu m \times 50 \mu m \times 1 m)$ will be much higher than that injected into a 3D simulation of size $(50\mu m \times 50 \mu m \times 50 \mu m)$, because the 3D code can model a laser-spatial-profile in the $z$-direction.

Example: you may choose to model a $10^{15} W/cm^{2}$ laser with a uniform circular spatial profile between $r=0$ and $r=10\mu m$, and a uniform temporal profile between $0$ and $50 fs$. In 3D space, this laser contains $1.6 \mu J$ of energy. In a 2D simulation, you would have to represent this laser as having a 1D spatial profile between $y = -10\mu m$ and $y = +10\mu m$, and we are forced to consider a $z$ between 0 and 1m (due to the EPOCH2D grid), and so we inject 10J of energy. Hence, the 2D simulation injects too much energy by a factor of $6.25 \times 10^6$, and if we assume energy spectra take the same form in 2D and 3D codes, and the laser-to-particle conversion efficiency is the same in 2D and 3D, then the number of particles in each bin would be overestimated by a factor of $6.25 \times 10^6$ in this example. If you re-scale your spectra by this factor in this example, then your 2D results should approximate the correct answer in 3D space.

Hope this helps, Stuart

Status-Mirror commented 1 year ago

I'm going to mark this as done for now, but if you have any further questions feel free to continue this thread!

Cheers, Stuart