Warwick-Plasma / epoch

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

QED block compilation can cause changes in particles #722

Closed Garnet5867 closed 3 weeks ago

Garnet5867 commented 1 month ago

Dear professor:

While compiling the QED module using the same program, I noticed that the initial state of the particles changed unexpectedly. The compilation process did not generate any error messages, which leads me to believe that the issue might be related to my compilation method, though I'm unsure about the exact cause.  Could you kindly provide some guidance or insights on what might have caused this? I would greatly appreciate your help in resolving this issue.  Thank you for your time and assistance!  Best regards,

Status-Mirror commented 1 month ago

Hi @Garnet5867,

When you use the QED module, each macro-particle is assigned a random "optical depth". This is tracked using the QED libraries, and once the particle has travelled a sufficient depth, a QED event is triggered.

Remember that EPOCH uses random numbers to assign macro-particle positions within a cell, and particle properties are evaluated at the same time. The random number list is also the same each time a simulation is run, provided the number of MPI processors is the same.

Imagine the first 3 random numbers are $r_1,r_2,r_3$. In a simulation without QED, $r_1$ is used to set the position of particle 1, $r_2$ sets particle 2, $r_3$ sets particle 3. When QED is active, $r_1$ sets position 1, $r_2$ sets the optical depth for particle 1, $r_3$ sets the position of particle 2. You can see that by requesting more random properties of particles, the initial states will change compared to simulations without the extra packages.

It's important to stress that macro-particles are not real objects! Your physical results should not depend on the exact initial positions of macro-particles. PIC codes give noisy results because there are many macro-particles present - if you find you require a greater precision than this, the PIC method may not be appropriate for you.

Hope this helps, Stuart