Hi-PACE / hipace

Highly efficient Plasma Accelerator Emulation, quasistatic particle-in-cell code
https://hipace.readthedocs.io
Other
51 stars 14 forks source link

Plasma density gradient falling edge #1140

Open Zxy-1104 opened 1 month ago

Zxy-1104 commented 1 month ago

Hello, I would like to ask a question about the plasma density gradient setting In the input file, I set a plasma density gradient falling edge, but in the output file, I don't see this falling edge.(As shown in the first image, it shows rho_electron) And the second picture shows that at the beginning, I set the density distribution, but why is the density 0? image image input.txt

AlexanderSinn commented 1 month ago

Hello, due to HiPACE++ using the quasi static approximation, the same plasma particles are used for all z positions inside a single time step. This means that the gradient in the z-direction can only be seen when comparing multiple time steps with z=c*t. For this, it's easiest to use the plasma in-situ diagnostic plasmas.insitu_period = 1 (see image). Here it can also be seen that the plasma density is zero on the first step. This is because the first step evaluates (z<0e-6)*3.e25+(z>320e-6)*1.e25+(z>0e-6)*(z<320e-6)*(3-(2/320e-6)*z)*1.e25 at z=0 so both (z<0e-6) and (z>0e-6) are zero. This can be fixed by using >= instead: "(z<0e-6)*3.e25+(z>320e-6)*1.e25+(z>=0e-6)*(z<320e-6)*(3-(2/320e-6)*z)*1.e25" (note that "" is required with this).

image

Zxy-1104 commented 1 month ago

Thank you for your answer. However, I'm wondering if maintaining the same density in each time dimension will affect the accuracy of the calculation. In reality, the density gradient is time-independent. If I position a Gaussian beam at the initial location of zero (considering that both the grid and particle beam have a certain size) in a non-quasi-static situation, half of it will be in a uniform plasma at the start, and the other half will be in a falling edge. In the quasi-static case, the initial time is it calculated in terms of the particles being in a uniform plasma, and I want to know does that make a difference?

MaxThevenet commented 1 month ago

Hi @Zxy-1104,

Although a time step in HiPACE++ outputs the problem as a function of zeta (the longitudinal coordinate in your plots above) at a fixed propagation tstep (the physical time of the current time step), you could see such a quasi-static code as computing the problem as a function of time t = -zeta/c, at a fixed propagation position z = t_step*c. This explains why the density is uniform on your plot above. While both representations are correct, a plasma density varying too quickly longitudinally may very well cause violation of the quasi-static approximation.

Just being curious: could you say a few words on the use case that you are trying to model? Such a strong downramp could lead to downramp injection, but this mechanism typically violates the quasi-static approximation and cannot be modelled within HiPACE++.

Zxy-1104 commented 1 month ago

Thank you for your answer. In fact, this example is not the one we use now, but the one we used in a previous paper we investigated, calculated in EPOCH , and I tried to emulate it in HIPACE++, but I did ignore the quasi-static approximation problem, for which I am very sorry. Density gradient in my work is *((z<1.5e-1)((1/0.15)(z)(8.e22))+(z>1.5e-1)(z<1.35)8.e22+(z>1.35)(z<1.5)(((-1/0.15)**. We assume the beam evolves slowly compared to the timescale of the plasma response, and this gradient does not violate the quasi-static approximation.