Closed YanleiYang closed 1 year ago
Is this the native happi plot? In happi you should obtain the units. If they don't appear there is a problem (we have had those problems with some versions). If you have a warning saying the python module Pint
is not available, please install it.
Anyway the units depend on the simulation dimension. See https://smileipic.github.io/Smilei/Understand/units.html#quantities-integrated-over-the-grid For instance, in 2D, you do not have information on the third dimension (the simulation is considered uniform along z). This means that, when you integrate the density, you can only do so on 2 axes x and y. You obtain a number of particles per unit of z. If you need a real number of particles, you need some assumption about the z direction.
Is this the native happi plot? In happi you should obtain the units. If they don't appear there is a problem (we have had those problems with some versions). If you have a warning saying the python module
Pint
is not available, please install it.Anyway the units depend on the simulation dimension. See https://smileipic.github.io/Smilei/Understand/units.html#quantities-integrated-over-the-grid For instance, in 2D, you do not have information on the third dimension (the simulation is considered uniform along z). This means that, when you integrate the density, you can only do so on 2 axes x and y. You obtain a number of particles per unit of z. If you need a real number of particles, you need some assumption about the z direction.
Sorry, I do make some modifications based on happi, which might confuse you. Now I upload the energy distribution of neutron plotted by native happi. As you can see, the number density is too small. I want to know what the "number density" means. My configure is:
lambda = 2 * math.pi
T_0 = lambda
Main(
geometry = "2Dcartesian",
number_of_patches = [128, 128],
interpolation_order = 2,
timestep = 0.01, # time step = 0.01 * T_0
simulation_time = 100 * T_0, # simulation time = 300 * T_0
time_fields_frozen = 0.0,
cell_length = [0.02 * lambda, 0.02 * lambda],
grid_length = [64 * lambda, 64 * lambda],
EM_boundary_conditions = [ ["silver-muller"] ],
reference_angular_frequency_SI = Lambda * 3e8 /1.e-6,
)
My ParticleBinning is
DiagParticleBinning(
name = "energy distribution of neutron",
deposited_quantity = "weight",
every = 200
time_average = 1,
species = ["neutron"],
axes = [ ["ekin", 0.001, 10., resolution_energy] ]
)
Assume the length in z direction is 1m, grid_length_x is 64 lambda and grid_length_y is 64 lambda, I can get the "number density" by integrating the dN/dE plot, but how do I get the "number"?
As you can see, your plot is in N_r/K_r, which means density per unit energy. This 1/K_r comes from the fact that you have a plot as a function of energy. If you add the argument sum={"ekin":"all"}
, happi will give you a number that corresponds to the total density. As you said, you can also integrate it yourself.
Now, to get a "number", you need to multiply by grid_length_x grid_length_y length_z. The first two lengths are 64 * lambda, already in the units of the code. For length_z, if you say it is 1m, you must convert it to the units of the code.
Be careful. By choosing 1m, you assume that your simulation is uniform along 1m. This is unrealistic for a laser that is only a few microns wide.
As you can see, your plot is in N_r/K_r, which means density per unit energy. This 1/K_r comes from the fact that you have a plot as a function of energy. If you add the argument
sum={"ekin":"all"}
, happi will give you a number that corresponds to the total density. As you said, you can also integrate it yourself.Now, to get a "number", you need to multiply by grid_length_x grid_length_y length_z. The first two lengths are 64 * lambda, already in the units of the code. For length_z, if you say it is 1m, you must convert it to the units of the code.
Be careful. By choosing 1m, you assume that your simulation is uniform along 1m. This is unrealistic for a laser that is only a few microns wide.
Ok, I got it. Thanks for your patience.
Here I get the energy distribution of a certain particle, for example, deuterium. The question is how to get the real number of deuterium in simulation. That's matter for me. I don't know what the "number density" means, what is the volume we specify when we talk about the "number density"?