Warwick-Plasma / epoch

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

Particle ID change with time #518

Closed luckyanjali119 closed 1 year ago

luckyanjali119 commented 1 year ago

Dear code developer, I am using EPOCH-4.19.2. I am trying to track particles in a selected region. The particle ID changes with time. I am attaching my input. deck file and plot of particle id vs timestep. here, particles id shows a jump at 180 timesteps, however, i am expecting it to be same throughout the simulation run. particle12.pdf input.txt

Status-Mirror commented 1 year ago

Hi @luckyanjali119

We have recently solved an issue with persistant subsets. We found that, when multiple persistant subsets were used in a simulation, the code erroneously transferred particles between subsets. This has since been corrected.

Your simulation was too large for me to run, so I made a smaller input deck which I have included at the bottom of this message. When inspecting the files ion0000.sdf and ion0127.sdf (at 250 steps), I found that the ID values were unchanged:

8177386
8194560
8195989
8364363
9083164
9087504
9654531
10012104
12613686
12798473
12975603
13333923
13526266
13706623

Can you update your EPOCH files to match the current branch, including all the bug fixes since EPOCH v4.19.2 was released, and see if the problem still persists? You can also try running my reduced deck to confirm I haven't simply missed the bug by reducing the resolution too much.

Cheers, Stuart

begin:constant
  t_laser = 40.0e-15
  las_scale_y=5* micron
  lambda0 =1.5 * micron
  theta =0
  w_0 = 6 * micron 
  x_spot = 4 * micron
end:constant

begin:control
  nx = 450
  ny = 180
  nsteps = 250
  x_min = 0.0
  x_max = 150.0e-6
  y_min = -75.0e-6  
  y_max = 75.0e-6   
  dt_multiplier = 0.5
end:control

begin:boundaries
  bc_x_min = simple_laser
  bc_x_max = simple_outflow
  bc_y_min = open
  bc_y_max = open
end:boundaries

begin:species
  name = electron
  charge = -1.0
  mass = 1
  npart = nx * ny * 100
  density = 1.6898e26 * (exp(-(y/las_scale_y)^8))
  density = if(y gt -30*micron and y lt 30*micron,  density(electron),0.0)
end:species

begin:species
  name = Ion
  charge = 1.0
  mass = 1837
  npart = nx * ny * 100
  density = 1.6898e26 * (exp(-(y/las_scale_y)^8))
  density = if(y gt -30*micron and y lt 30*micron,  density(electron),0.0)
end:species

begin:laser
  boundary = x_min
  intensity_w_cm2 = 2.21e17
  lambda = lambda0 * cos(theta)
  phase = 0
  pol_angle =pi/2
  profile = gauss(y,0,6*micron)
  t_profile = gauss(time,2*t_laser,t_laser/2)
end:laser

begin:subset
  name = trace_ele
  random_fraction=1e-5
  x_min=25*micron
  x_max=40*micron
  y_min=-15*micron
  y_max=15*micron
  persist_start_time=0
  include_species:electron
end:subset

begin:subset
  name = trace_ion
  random_fraction=1e-5
  x_min=25*micron
  x_max=40*micron
  y_min=-15*micron
  y_max=15*micron
  persist_start_time=0
  include_species:Ion
end:subset

begin:output
  name =ele
  file_prefix = ele
  dt_snapshot =1.0e-15
  particles=trace_ele
  id=trace_ele
  px=trace_ele
  py=trace_ele
  pz=trace_ele
  particle_weight = trace_ele
end:output  

begin:output
  name =ion
  file_prefix = ion
  dt_snapshot =1.0e-15
  particles=trace_ion
  id=trace_ion
  px=trace_ion
  py=trace_ion
  pz=trace_ion
  particle_weight = trace_ion
end:output  
luckyanjali119 commented 1 year ago

Thank you for your reply. I have updated my EPOCH with a current main branch and run the input file you have attached here. I have run it for longer timesteps. However, I am still facing this issue. I am attaching the time vs particles id's plot for 9 electrons. Kindly have a look. IDd.pdf

keithbennett commented 1 year ago

Hi, I have re-run your original input deck and was unable to reproduce the issue. However, your plot seems to indicate that you are assuming that the particles will always be written to file in the same order. The particles are written to file in whatever order they happen to be in the original particle list and this can change over time. Since ordering the particles would be an extra, time-consuming step, it is currently left as a post-processing task.

luckyanjali119 commented 1 year ago

Dear code developer, Thank you for clearing my doubt. My particle tracking problem resolved with this.