SmileiPIC / Smilei

Particle-in-cell code for plasma simulation
https://smileipic.github.io/Smilei
344 stars 120 forks source link

Changing number density of species does not change the number of particles #762

Closed soxzofia closed 1 week ago

soxzofia commented 1 week ago

Description

When I change the number density of hydrogen,number of particles in "Species creation summary" keep the old number,only when i set number density to zero, that number will become zero. 捕获

n0 = 1e-4 #number density
def my_profile(x,y,z):
    center_plasma = [Lsim/2.,Ltrans/2.,Ltrans/2.]
    Radius = 3.*l0
    Length = 8.*l0
    if ((abs(x-center_plasma[0])<Length) and ((y-center_plasma[1])**2+(z-center_plasma[2])**2<Radius*Radius)):
       return n0
    else:
       return 0
Species(
    name = 'hydrogen',
    ionization_model = 'tunnel',
    ionization_electrons = 'electron',
    atomic_number = 1,
    position_initialization = 'random',
    momentum_initialization = 'cold',
    particles_per_cell = nppc,
    mass = 1.*1836.0,
    charge = 0,
    number_density = my_profile,
    boundary_conditions = [['reflective']]
)
mccoys commented 1 week ago

The number of macro particles is unrelated to the particle density. I recommend to read the "pic algorithm" section for more information on the PIC method

soxzofia commented 1 week ago

Thanks!