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

issue about in the ionisation simulation, I can't output the ID of particles #710

Closed XnjeMa closed 2 months ago

XnjeMa commented 2 months ago

When I use input.deck like this:

begin:constant

lambda0 =1.0*micron #laser wavelength 0.8e-6
lambdaL=0.8*micron
omega0 = 2.0*pi*c/lambdaL #laser frenquency
n_c = critical(omega0) # /m3
n0 = 2.4e26
omega_p = sqrt(n0*qe*qe/me/epsilon0)
lambda_p = 2*pi*c/omega_p
period0=lambda0/c
periodL=lambdaL/c #laser period
a_peak0 = 16.64
E_peak0 = a_peak0*me*omega0*c/qe
intensity_w_cm2_t = a_peak0*a_peak0*1.37e18/(lambdaL*1e6)^2# guass function parameter for space envelop
Tau = 2.0*period0# constant intensity duration
d= 100.0*period0# guass function parameter for space envelop
w_0 = 4*lambda0 # Beam waist size FWHM=2w0*sqrt(ln2)
x_spot = 300*lambda0 # Distance from x_min to spot
x_R = pi * w_0^2 / lambdaL # Rayleigh range
RC = x_spot * (1.0 + (x_R / x_spot)^2) # Radius of curvature on x_min
w_bnd = w_0 * sqrt(1.0 + (x_spot/x_R)^2) # Spot size at x_min
gouy = atan(x_spot/x_R) # Gouy phase shift at x_min# positions in x,y directions
x0 = 0*lambda0
x1 = 900*lambda0
flat0=300*lambda0
flat1=600*lambda0
flat2=900*lambda0
end:constant

begin:control
nx = 22500 #0.04um/cell
ny = 400 #0.050um/cell# global number of particles
t_end = 3600* femto# size of simulation domain
x_min = 0.0*lambda0
x_max = 900.0*lambda0
y_min = -20.0*lambda0
y_max = 20.0*lambda0
field_order=4
smooth_currents = T
dt_multiplier=0.6
stdout_frequency = 200
print_constants = T
use_more_setup_memory = T
use_multiphoton=T
use_bsi=F
field_ionisation=T
end:control

begin:window
move_window = T
window_v_x = 0
window_start_time = 300e-15
window_stop_time = 3200e-15
bc_x_min_after_move = simple_outflow
bc_x_max_after_move = simple_outflow
end:window

begin:boundaries
bc_x_min = simple_laser
bc_x_max = simple_outflow
bc_y_min = periodic #periodic #simple_outflow
bc_y_max = periodic #periodic #simple_outflow
end:boundarie

begin:collisions
collisional_ionisation = T
ci_n_step = 3
end:collisions

begin:laser
boundary = x_min
id = 1
#amp = E_peak0 * w_0 / w_bnd # amplitude on boundary
intensity_w_cm2 = intensity_w_cm2_t
lambda = 1.0*lambdaL
pol_angle = 0.0*pi # 0.0*pi:p
phase = 0.0*pi + 2.0 * pi/ lambdaL * y^2 / (2.0 * RC) - gouy
profile = gauss(y, 0, w_bnd)
#t_profile= semigauss(time, 1 ,0.001, 20e-15 )
t_profile=gauss(time,20e-15,20e-15/1.665) #Tau=2w0*sqrt(ln2)
t_start = start
t_end = 40 * femto
end:laser

begin:species
charge = 0.0
atomic_no=7
mass = 1837.2*14
name = N2
ionise=T
unique_electron_species=T
density=if(x gt x0 and x lt x1 ,if(x gt x0 and x lt flat0,(x-x0)/(flat0-x0), if(x gt flat0 and x lt flat1,1,if(x gt flat1 and x lt flat2,(flat2-x)/(flat2-flat1),0))),0)*n0
temperature_ev=25e-3
npart_per_cell = 2
end:species

begin:subset
name = electron
random_fraction = 1
include_species:electron_from_N2
include_species:electron_from_N21
end:subset

begin:probe
name=electron_outflow_probe
point=(900e-6,0.0)
normal=(1.0,0.0)
ek_min=0.0
include_species:electron_from_N2
include_species:electron_from_N21
dumpmask=always
end:probe

begin:output
#information of 510-810
name=field
file_prefix=electron_out
grid = always+single
particle_probes=always+electron
time_start=lambda0/c*0.0
ex = always
ey = always
charge_density = always + species+electron
dt_snapshot = 150* femto
particles = always
id = always
end:output

when I echo the input.deck, it report the error:

Specify output directory
 Name of species 1 is N2
 Name of species 2 is N21
 Name of species 3 is N22
 Name of species 4 is electron_from_N2
 Name of species 5 is electron_from_N21
 Initial conditions complete and valid.
 Calculating optimal processor topology
 Processor subdivision is            9           8
Redistributing.          Balance: 0.677,     after: 1.000 (pre-load balance)
 Attempting to load particles
 Loaded 13767600 particles of species "N2"
 Loaded 0 particles of species "N21"
 Loaded 0 particles of species "N22"
 Loaded 0 particles of species "electron_from_N2"
 Loaded 0 particles of species "electron_from_N21"
application called MPI_Abort(MPI_COMM_WORLD, 9) - process 3
application called MPI_Abort(MPI_COMM_WORLD, 9) - process 12
application called MPI_Abort(MPI_COMM_WORLD, 9) - process 13

can you ask this question for me,please

Status-Mirror commented 2 months ago

Hi @XnjeMa,

This simulation is a bit too big for me to run myself. Are you able to reproduce the error on a similar but smaller input deck? Maybe with fewer cells or fewer loaded particles.

Does the simulation produce any output files when it runs? That MPI_Abort call could mean that the simulation ran out of time on your cluster, possibly because the simulation is too big to run within the queueing window.

Cheers, Stuart

XnjeMa commented 2 months ago

Hi @XnjeMa,

This simulation is a bit too big for me to run myself. Are you able to reproduce the error on a similar but smaller input deck? Maybe with fewer cells or fewer loaded particles.

Does the simulation produce any output files when it runs? That MPI_Abort call could mean that the simulation ran out of time on your cluster, possibly because the simulation is too big to run within the queueing window.

Cheers, Stuart

begin:constant

lambda0 =1.0*micron #laser wavelength 0.8e-6
lambdaL=0.8*micron
omega0 = 2.0*pi*c/lambdaL #laser frenquency
n_c = critical(omega0) # /m3
n0 = 2.4e26
omega_p = sqrt(n0*qe*qe/me/epsilon0)
lambda_p = 2*pi*c/omega_p
period0=lambda0/c
periodL=lambdaL/c #laser period
a_peak0 = 6.64
E_peak0 = a_peak0*me*omega0*c/qe
intensity_w_cm2_t = a_peak0*a_peak0*1.37e18/(lambdaL*1e6)^2# guass function parameter for space envelop
Tau = 2.0*period0# constant intensity duration
d= 100.0*period0# guass function parameter for space envelop
w_0 = 4*lambda0 # Beam waist size FWHM=2w0*sqrt(ln2)
x_spot = 100*lambda0 # Distance from x_min to spot
x_R = pi * w_0^2 / lambdaL # Rayleigh range
RC = x_spot * (1.0 + (x_R / x_spot)^2) # Radius of curvature on x_min
w_bnd = w_0 * sqrt(1.0 + (x_spot/x_R)^2) # Spot size at x_min
gouy = atan(x_spot/x_R) # Gouy phase shift at x_min# positions in x,y directions
x0 = 0*lambda0
x1 = 150*lambda0
flat0=50*lambda0
flat1=100*lambda0
flat2=150*lambda0
end:constant

begin:control# global number of gridpoints box 100*40
nx = 3000 #0.04um/cell
ny = 200 #0.050um/cell
# global number of particles
t_end = 600* femto
# size of simulation domain
x_min = 0.0*lambda0
x_max = 150.0*lambda0
y_min = -20.0*lambda0
y_max = 20.0*lambda0
field_order=4
smooth_currents = T
dt_multiplier=0.6
stdout_frequency = 200
print_constants = T
use_more_setup_memory = T
use_multiphoton=T
use_bsi=F
field_ionisation=T
end:control

begin:window
move_window = T
window_v_x = 0
window_start_time = 300e-15
window_stop_time = 3200e-15
bc_x_min_after_move = simple_outflow
bc_x_max_after_move = simple_outflow
end:window

begin:boundaries
bc_x_min = simple_laser
bc_x_max = simple_outflow
bc_y_min = periodic #periodic #simple_outflow
bc_y_max = periodic #periodic #simple_outflow
end:boundaries

begin:collisions
collisional_ionisation = T
ci_n_step = 3
end:collisions

begin:laser
boundary = x_min
id = 1
#amp = E_peak0 * w_0 / w_bnd # amplitude on boundary
intensity_w_cm2 = intensity_w_cm2_t
lambda = 1.0*lambdaL
pol_angle = 0.0*pi # 0.0*pi:p
phase = 0.0*pi + 2.0 * pi/ lambdaL * y^2 / (2.0 * RC) - gouy
profile = gauss(y, 0, w_bnd)
#t_profile= semigauss(time, 1 ,0.001, 20e-15 )
t_profile=gauss(time,20e-15,20e-15/1.665) #Tau=2w0*sqrt(ln2)
t_start = start
t_end = 40 * femto
end:laser

begin:species
charge = 0.0
atomic_no=2
mass = 1837.2*4
name = N2
ionise=T
unique_electron_species=T
density=if(x gt x0 and x lt x1 ,if(x gt x0 and x lt flat0,(x-x0)/(flat0-x0), if(x gt flat0 and x lt flat1,1,if(x gt flat1 and x lt flat2,(flat2-x)/(flat2-flat1),0))),0)*n0
temperature_ev=25e-3
npart_per_cell = 2
end:species

begin:subset
name = electron
random_fraction = 1
include_species:electron_from_N2
include_species:electron_from_N21
end:subset

begin:probe
name=electron_outflow_probe
point=(150e-6,0.0)
normal=(1.0,0.0)
ek_min=0.0
include_species:electron_from_N2
include_species:electron_from_N21
dumpmask=always
end:probe

begin:output
#information of 510-810
name=field
file_prefix=electron_out
grid = always+single
particle_probes=always+electron
time_start=lambda0/c*0.0
ex = always
ey = always
charge_density = always + species+electron
dt_snapshot = 150* femto
particles = always
id = always
end:output

I have make it smaller,can you re-run it to check this problem. if it still too big ,I can fix it. within this small task,it still have the error

XnjeMa commented 2 months ago

Hi @XnjeMa,

This simulation is a bit too big for me to run myself. Are you able to reproduce the error on a similar but smaller input deck? Maybe with fewer cells or fewer loaded particles.

Does the simulation produce any output files when it runs? That MPI_Abort call could mean that the simulation ran out of time on your cluster, possibly because the simulation is too big to run within the queueing window.

Cheers, Stuart

the code produce 2 output files. when it produce the second files,it report the error. i guess maybe it is not about the code, but about the process i add the '-DPARTICLE_ID-DPARTICLE_ID-DPARTICLE_weight'block

I find the -DPARTICLE_ID in the Makefile, and then I add the code in the diagnostics.F90,but it don't work

if defined(PARTICLE_ID) || defined(PARTICLE_ID4)

DO i = 1, n_species CALL generate_particle_ids(species_list(i)%attached_list) END DO

endif

Do I need any more procedure to do to output the ID and particle?

Status-Mirror commented 2 months ago

Hi @XnjeMa,

This deck appears to be working fine for me - I'm running it on a 4-core laptop. It's currently just dumped electron_out0002.sdf.

You shouldn't edit the source-code to run with -DPARTICLE_ID. When you uncomment this command in your Makefile, you need to run make clean, then you need to recompile. An example is given in the Changing precompiler directives section of our documentation.

If you've edited the source code, it might be worth downloading a clean version first, then uncommenting the line in Makefile, and then running make clean, then recompiling (for me this is make COMPILER=gfortran -j4).

Hope this helps, Stuart

XnjeMa commented 2 months ago

thank you for your help I have solved this problem it actually about the precompiler.