SmileiPIC / Smilei

Particle-in-cell code for plasma simulation
https://smileipic.github.io/Smilei
335 stars 119 forks source link

Envelope Probes #656

Closed Z10Frank closed 11 months ago

Z10Frank commented 12 months ago

A small case of 1D gaussian envelope propagation in vacuum: Laser_pulse_1D_propagation_envelope.txt

At t=0 the Probes and Fields diags for Env_E_abs show a field identically 0 (maybe it is not computed at t=0). The Field Env_A_abs seems normal at t=0. For t>0, the Fields Env_E_abs and Env_A_abs are correct, but Probes appear fragmented and with ripples at the patch boundaries: S.Probe.Probe0("Env_A_abs").slide()

Screenshot 2023-10-07 at 11 03 35
Z10Frank commented 12 months ago

Same happens with 1 OpenMP thread and 1 MPI.

mccoys commented 12 months ago

Is this new? Only in 1d? Only envelope fields?

Z10Frank commented 12 months ago

I don't know if it is new. The equivalent simulation without envelope seems to work perfectly: Laser_pulse_1D_propagation_without_envelope.txt

S.Probe.Probe0("Ey").slide()

Screenshot 2023-10-07 at 19 02 42
Z10Frank commented 12 months ago

In LaserEnvelope1D::initEnvelope the Env_E_abs field seems to be computed at the envelope initialisation: ( *Env_Eabs1D )( i )= std::abs( ( ( *A1D )( i )-( *A01D )( i ) )/timestep - i1*omega*( *A1D )( i ) );, maybe it's a problem in the diags.

mccoys commented 12 months ago

But does the probe output correctly Ex

Z10Frank commented 12 months ago

In the envelope simulation it will always be zero, it's just a laser pulse in vacuum, so the only non zero quantities will be Env_E_abs and Env_A_abs.

Z10Frank commented 12 months ago

I have tried with the 2D and AM benchmarks, everything seems correct. With the 1D benchmark the bug appears, so it seems that the bug is limited to 1D.

Z10Frank commented 11 months ago

Removing the moving window and using only 1 patch the bug is the same. When the laser moves to the right the discontinuity in Env_E_abs seems to progressively disappear.

Z10Frank commented 11 months ago

Moving the laser initial position at the center allowed to study the phenomenon. Left panels: Fields (correct); right panels: Probes (with bug) At the start the field in the Probes seems correct (maybe a little shifted) on the left hand side of the window and damped on the right hand side:

Screenshot 2023-10-11 at 11 51 44

Afterwards, the laser moves on the right, the discontinuity disappears but the field remains damped:

Screenshot 2023-10-11 at 11 46 15

I tried substituting the same lines of code that work for other interpolators, and the result is the same. Maybe there is a problem in the Probes definition in 1D for the envelope fields, or at the moment of the output dump?