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

opened qed,output the total photon energy information radiated in the whole simulation time #728

Closed m612402 closed 3 weeks ago

m612402 commented 1 month ago

My setup is that a laser is injected into the plasma and the qed module is turned on. I need to get the photon energy spectrum of the electron radiation in the plasma. But at present, the output module can only get the photon energy information radiated at a certain moment. What should I do in the output module to output the total photon energy information radiated in the whole simulation time, not at one moment? At present, I have tried to use time-average, and the result is wrong.Below is my output module:begin:output name = qed file_prefix = qed time_start =0las_period dt_snapshot = 40las_period time_stop = 80*las_period qed_energy=always + single+average end:output

Status-Mirror commented 1 month ago

Hi @m612402,

To get the photon energy spectrum of all photons created in the simulation, there are some things you can do.

Firstly, are you just looking for qed radiation? If you aren't interested in pair production, this makes things easier. Set photon_dynamics = F in your QED block. This prevents photons from moving, so they don't escape the simulation. If no pair production is present, then all photons will exist in the simulation window for all time.

Next, you'll need to output the momenta and the weight of the photons

begin:output
  dt_snapshot = t_end
  px = always
  py = always
  pz = always
  weight = always
end:output

And finally, to get the photon energy spectrum, calculate $E = pc$ for each photon, bin them by energy, and sum the photon weights in each bin.

If you need your photons to move for pair production, this will become more complicated. Is this what you need?

Cheers, Stuart

Status-Mirror commented 3 weeks ago

I'm going to mark this issue as closed for now, but feel free to repoen if you have more questions.

m612402 commented 2 weeks ago

Dear developer, thank you for your previous answer. I now have a new problem. When calculating the actual number of photons, should I multiply it by a weight factor? Is it the weight factor of electrons?according to“physics_packages_photons”, new_photon%weight = generating_electron%weight.Is it necessary to multiply by an additional factor, because the shape of the particle,“ ! Particle weighting multiplication factor

ifdef PARTICLE_SHAPE_BSPLINE3

REAL(num) :: cf2
REAL(num), PARAMETER :: fac = (1.0_num / 24.0_num)**c_ndims

elif PARTICLE_SHAPE_TOPHAT

REAL(num), PARAMETER :: fac = (1.0_num)**c_ndims

else

REAL(num) :: cf2
REAL(num), PARAMETER :: fac = (0.5_num)**c_ndims

endif”

Status-Mirror commented 2 weeks ago

The macro-photon weight is set to match the weight of the emitting macro-electron. We calculate the probability that an individual real electron emits a photon, and if it does, then we assume all real electrons represented by the macro-electron radiate at the same time.

The particle-shape code you refer to is used when interpolating the EM fields to the macro-particle position, and it doesn't affect the macro-particle weights.

When talking about "the actual number of photons", we have to be careful. In epoch3d, macro-particle weights correspond to the real numbers of particles. In epoch1d and epoch2d, we assume the cell-size is 1m in the omitted directions, which is likely to overestimate the number of particles present. It's better to think about the 1d and 2d codes as giving particle numbers per unit area (for 1d) or per unit length (for 2d). You should multiply your weights by the size of the system in the missing directions to get a better estimate of the real number of particles in 3d space.

Hope this helps, Stuart

m612402 commented 2 weeks ago

I used epoch2d to simulate. las_lambda = 1 micron nx = 1000 ny = 750 x_min = 0 x_max = 40 las_lambda y_min = -15 las_lambda y_max = -y_min npart_per_cell = 100 density =5critical(las_omega).I can calculate the particle weights from this,(5×1.1148×10^27 𝑚^(−3)×(1/25×10^(−6))×(1/25×10^(−6))×1𝑚^3)/100=8.9184×10^10. This is the same value I get when I output "weight" using the output module.I don't know how to find the multiplication factor you mentioned at the end"You should multiply your weights by the size of the system in the missing directions to get a better estimate of the real number of particles in 3d space".Thanks for your reply

Status-Mirror commented 2 weeks ago

Your weight calculation is correct, and it's what EPOCH is using to get the macro-particle weights. I can see that you're assuming the size of the cell in the $z$ direction is 1m, which is what EPOCH does.

However, this implies the size of your laser in the $z$ direction is 1m, and this seems unrealistic for a laser profile. If you have a uniform laser profile in your simulation window, with a 1e16 W/cm² laser, then how much energy is injected over 40 fs? This is intensity area time, or (1e20 W/m (30e-6 m 1 m) * 40e-15 s) = 120J, which is far higher than any real laser.

It's better to think of quantities in a 2D code like weight and energy as being per-unit-length. So the laser isn't 120 J, it's 120 J/m. If you want a real, physical energy, then you need to multiply this by the size of your system. How big is the region of interest in your $z$ direction? If the laser-focal-spot is of interest, then the implied $z$ size is probably the size in $y$. I can't tell you what this factor should be for you, but maybe you should choose something which maps your injected laser energy to the real physical laser energy.