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

Dear author, I apologize for bothering you repeatedly. I would like to ask you to run the data obtained from two 1D files. #721

Open bear-maker opened 1 month ago

bear-maker commented 1 month ago

Dear Professor I'm very sorry to bother you, but I am eager to get an answer from you and sincerely request your help. The following two input files are the original code for me. Without adding any modules, I obtained the numb_density0000sdf files for the two input outputs respectively. I want to obtain data on electron density. The Input file is saved as a txt file below and labeled as input1 and input2 Thank you very much for your help. Your assistance has had a profound impact on me.

input1.txt input2.txt

bear-maker commented 1 month ago

Dear professor, if possible, please use 40 threads to run it, which is very important to me. Thanks again

DanRRRR commented 1 month ago

I am not an author of the code, I'm just the user like you. Unfortunately my Epoch does not work in 1D to try your files because instead of using SDF for output I use an implant code to the EPOCH which is doing outputs of particles and fields. And i can not open any SDF without tons of extra steps with some inferior third party apps I find not necessary to spend time on. Adding my implant code to never used 1D version of EPOCH (besides 2D/3D currently) I find useless plus it is a lot of work. if you had 2D/3D variant I might looked at it.

But besides that, because probably I am not native in English, I'm having additional difficulties to understand what specifically are you asking for, what is the problem ? Probably others also failed to understand details and so they hesitate to ask really a lot of questions, or are busy now, so due to all that keep silence. Let me as a first step to do that for them.

Are your input deck files not working? Why do you send two files, why two? Do they behave irrationally? Are they not loading or crash? Do you see something wrong at exactly 40 processors? Why 40? Or you just having difficulties to obtain density from SDF ? Please clarify more, may be somebody will be able to help

bear-maker commented 1 month ago

Thank you very much for your help. I will explain a few points: 1: There is a problem with the code. I just made some modifications and changed it to the file format required for epoch. You only need to delete the last serial number to run it. Put the compressed file below. You may not be able to decompress, I have already written the following text, you may need to paste and copy it. 2: The data I need now are two num0000.sdf files. Even if you are unable to read it, please send it to me and I will handle it myself (using two inputs (input1 and input2) to run and obtain data separately). 3: The reason for 40 is that I want to compare it with the data I am running. Thank you for your answer. These two codes only require a little time. If possible, please help me. May God bless you with a happy and fulfilling life.

run.zip

#input1
begin:boundaries
    bc_x_min = simple_laser
    bc_x_max = open
end:boundaries

begin:constant
  xlength = 10* micron
  grid_x_min = -6.8*micron
  # --- DRIVING LASER PULSE ---
  # wavelength
  las_lambda1 = 0.8* micron
  las_lambda2 = 0.8 * micron
A=(0.8*micron)/(c)
B=1/4*pi
lambda1=las_lambda1/cos(B)
lambda2=las_lambda2/cos(B)
vy_max=-c*sin(B)
  gamma = 1.0 / sqrt(1.0 - (vy_max/c)^2)
  m1=9.1*1/1e31
 pyz_c_max=gamma*m1*vy_max
ne0=1.75e27*100
L=0.2*0.8*micron
 vxz_low = 2.25e8
  vxz_high = 2.89e8
   gamma_lowz = 1.0 / sqrt(1.0 - (vxz_low/c)^2)
  gamma_highz = 1.0 / sqrt(1.0 - (vxz_high/c)^2)

  # Electron px range (p = gamma * mass * v)
  pxz_e_low = gamma_lowz * me * vxz_low
  pxz_e_high = gamma_highz * me * vxz_high
  # Carbon px range
  pxz_c_low = gamma_lowz * 22033*me * vxz_low
  pxz_c_high = gamma_highz * 22033*me * vxz_high
end

begin:control
  t_end = 40*femto 
 nx =2000
  x_min = grid_x_min
  x_max = x_min + xlength
  stdout_frequency=10
    dt_multiplier=0.999
end:control

begin:species
 name = electron
  charge = -1
  mass = 1
    number_density = if((x gt -2.4*micron) and (x lt 0*micron) , exp(x/L)*ne0, 0)
  number_density = if((x gt 0*micron) and (x lt 3.2*micron) , ne0, number_density(electron))
 nparticles= 20000
  identify:electron
end:species

begin:species
    name = C6
    mass = 22033.0
    charge = 1.0
    density = density(electron) 
 nparticles= 20000
end:species

begin:laser
  # LASER 1
  # laser block for primary laser pulse (more will be added later)
  boundary = x_min
  # intensity at the injection boundary
  intensity_w_cm2=1.37e20*0.5*0.95
  #amp=4e13*0.5
 # lambda = lambda2
 lambda = 0.8*micron*sqrt(2)
  # phase profile required to add curved wavefronts in order to focus the beam
  # Added pi / 2 so there will be a cosinus and not a sinus
  phase = 0
  pol_angle = 0
  #radial * temporal/longitudinal profiles
  profile = 1
   t_profile=gauss(time,6*femto,6*femto)
   #t_end=12*A+6*femto
end:laser

begin:output
  name = ey
  ey= always+single
  dt_snapshot =0.1*femto
time_stop=40 *femto
end:output

begin:output
  name = number_density
  file_prefix = ne
  number_density = always + species + no_sum + single
  dt_snapshot =0.1*femto
#time_start=0 *femto
time_stop=40 *femto
end:output
#input2
begin:boundaries
    bc_x_min = simple_laser
    bc_x_max = open
end:boundaries

begin:constant
  xlength = 10* micron
  grid_x_min = -6.8*micron
  # --- DRIVING LASER PULSE ---
  # wavelength
  las_lambda1 = 0.8* micron
  las_lambda2 = 0.8 * micron
A=(0.8*micron)/(c)
B=1/4*pi
lambda1=las_lambda1/cos(B)
lambda2=las_lambda2/cos(B)
vy_max=-c*sin(B)
  gamma = 1.0 / sqrt(1.0 - (vy_max/c)^2)
  m1=9.1*1/1e31
 pyz_c_max=gamma*m1*vy_max
ne0=1.75e27*100
L=0.2*0.8*micron
 vxz_low = 2.25e8
  vxz_high = 2.89e8
   gamma_lowz = 1.0 / sqrt(1.0 - (vxz_low/c)^2)
  gamma_highz = 1.0 / sqrt(1.0 - (vxz_high/c)^2)

  # Electron px range (p = gamma * mass * v)
  pxz_e_low = gamma_lowz * me * vxz_low
  pxz_e_high = gamma_highz * me * vxz_high
  # Carbon px range
  pxz_c_low = gamma_lowz * 22033*me * vxz_low
  pxz_c_high = gamma_highz * 22033*me * vxz_high
end

begin:control
  t_end = 40*femto 
 nx =2000
  x_min = grid_x_min
  x_max = x_min + xlength
  stdout_frequency=10
    dt_multiplier=0.999
end:control

begin:species
 name = electron
  charge = -1
  mass = 1
    number_density = if((x gt -2.4*micron) and (x lt 0*micron) , exp(x/L)*ne0, 0)
  number_density = if((x gt 0*micron) and (x lt 3.2*micron) , ne0, number_density(electron))
  npart_per_cell = 100
  identify:electron
end:species

begin:species
    name = C6
    mass = 22033.0
    charge = 1.0
    density = density(electron) 
      npart_per_cell = 100
end:species

begin:laser
  # LASER 1
  # laser block for primary laser pulse (more will be added later)
  boundary = x_min
  # intensity at the injection boundary
  intensity_w_cm2=1.37e20*0.5*0.95
  #amp=4e13*0.5
 # lambda = lambda2
 lambda = 0.8*micron*sqrt(2)
  # phase profile required to add curved wavefronts in order to focus the beam
  # Added pi / 2 so there will be a cosinus and not a sinus
  phase = 0
  pol_angle = 0
  #radial * temporal/longitudinal profiles
  profile = 1
   t_profile=gauss(time,6*femto,6*femto)
   #t_end=12*A+6*femto
end:laser

begin:output
  name = ey
  ey= always+single
  dt_snapshot =0.1*femto
time_stop=40 *femto
end:output

begin:output
  name = number_density
  file_prefix = ne
  number_density = always + species + no_sum + single
  dt_snapshot =0.1*femto
#time_start=0 *femto
time_stop=40 *femto
end:output
Status-Mirror commented 1 month ago

Hi @bear-maker,

Your first comment asks about reading an SDF file to obtain a number density. Have you seen our data visualisation documentation?

Cheers, Stuart

bear-maker commented 1 month ago

Hi @bear-maker,

Your first comment asks about reading an SDF file to obtain a number density. Have you seen our data visualisation documentation?

Cheers, Stuart

Thank you very much for your answer. Currently, I have not found any relevant data files and only have input examples。 My purpose is to verify a problem: for the same input, different threads will produce different results。 Compare mpirun-np 80 vs mpirun-np 40。

Status-Mirror commented 1 month ago

Hi @bear-maker,

The behaviour you describe is expected. When EPOCH loads particles, the positions within the cell are randomly sampled. The random seed is the same between two simulations, so running the code twice will give identical results if the same number of MPI cores are used.

When different MPI cores are used, different random number generators are used for each one - they can't all access the same random number list, as the order of calls would be different. This means that the positions of macro-particles within the cell would change.

If your results are sensitive to the positioning of macro-particles within a cell, then you should probably be using a higher resolution. Macro-particles aren't real particles, they're computational objects used to describe real particles. Any true physical result should be independent of the specific orientation of loaded macro-particles.

As a quick example, I've run your input deck on 1 and 2 cores. You can see that the underlying density is the same, but the noise level is different.

thread_differences

Hope this helps, Stuart

bear-maker commented 1 month ago

Hi @bear-maker,

The behaviour you describe is expected. When EPOCH loads particles, the positions within the cell are randomly sampled. The random seed is the same between two simulations, so running the code twice will give identical results if the same number of MPI cores are used.

When different MPI cores are used, different random number generators are used for each one - they can't all access the same random number list, as the order of calls would be different. This means that the positions of macro-particles within the cell would change.

If your results are sensitive to the positioning of macro-particles within a cell, then you should probably be using a higher resolution. Macro-particles aren't real particles, they're computational objects used to describe real particles. Any true physical result should be independent of the specific orientation of loaded macro-particles.

As a quick example, I've run your input deck on 1 and 2 cores. You can see that the underlying density is the same, but the noise level is different.

thread_differences

Hope this helps, Stuart

Dear Professor, hello. Thank you very much for your answer. I understand what you mean. At present, I would like to compare the data obtained from the interaction between laser and particles with mine. Purpose: To verify that my epoch is working properly. If possible, I would like to ask the professor to run a 1D code: laser particle interaction. And provide corresponding inputs and data files (marked with several mpis) Thank you very much. Wishing you a happy life.

Status-Mirror commented 1 month ago

You can try running the field ionisation demo. This is a 1D laser-plasma interaction with a solid density plasma, and output figures have been provided for the densities of ionised carbon.

You might not be interested in ionisation yourself, but if you can reproduce the density figures (on any number of MPI cores), then you're running EPOCH correctly.

Hope this helps, Stuart

bear-maker commented 1 month ago

You can try running the field ionisation demo. This is a 1D laser-plasma interaction with a solid density plasma, and output figures have been provided for the densities of ionised carbon.

You might not be interested in ionisation yourself, but if you can reproduce the density figures (on any number of MPI cores), then you're running EPOCH correctly.

Hope this helps, Stuart

Dear Professor, you may have misunderstood my meaning. The current situation is: My epoch is functioning properly, but I am unable to verify the accuracy of the data. So we need to compare it with your data. 1: I have provided an input here. If it is convenient for you, please provide the relevant data. (1D simulation only takes a few minutes of your valuable time) 2: Please let us know how many threads (MPI cores) you use. Sincerely hope that you can help us, as this will have a profound impact on our research work.

begin:constant
  xlength = 20* micron
  grid_x_min = -16.8*micron
  las_lambda1 = 0.8* micron
  las_lambda2 = 0.8 * micron
  ne0 = 1.75e27*100
end

begin:control
  t_end = 120*femto 
  nx = 20833
  x_min = grid_x_min
  x_max = x_min + xlength
  stdout_frequency = 10
  dt_multiplier = 0.999
end:control

begin:species
  name = electron
  charge = -1
  mass = 1
  number_density = if((x gt 0*micron) and (x lt 3.2*micron) , ne0, 0)
  npart_per_cell = 100
end:species

begin:species
    name = C6
    mass = 22033.0
    charge = 1.0
    density =if((x gt 0*micron) and (x lt 3.2*micron) , ne0, 0)
    npart_per_cell = 100
    immobile = T
end:species

begin:laser
  boundary = x_min
  intensity_w_cm2 = 2.14e20
  lambda = 0.8*micron
  phase = 0
  pol_angle = 0
  t_profile = gauss(time,26.66*femto,26.66*femto)
end:laser

begin:boundaries
    bc_x_min = simple_laser
    bc_x_max = open
end:boundaries

begin:output
  name = number_density
  file_prefix = number_density
  number_density = always + species
  dt_snapshot = 0.05*femto
  time_start = 50*femto
  time_stop = 120*femto
end:output

begin:output
  name = ey
  file_prefix = ey
  dt_snapshot = 1 * femto
  ey = always
end:output