Maxwell distribution¶
Cookbook of Maxwell distribution can also be found in
irfpy.util.maxwell
To make test particle¶
A simplest way is using numpy.random.standard_normal
function.
It takes 1 argument which specifies the shape of the product.
For example,
>>> from numpy.random import standard_normal
>>> test_particles = standard_normal([10000, 3])
will generate 10000 test particles that has 3-compoenent velocity. The standard deviation (identical to thermal velocity) is fixed by 1. So you have to multiply by the value.
>>> vth = 30
>>> test_particles = test_particles * vth
Then, you may want to add bulk velocities.
>>> vb = [-400, 50, 0]
>>> test_particles[:, 0] = test_particles[:, 0] + vb[0]
>>> test_particles[:, 1] = test_particles[:, 1] + vb[1]
>>> test_particles[:, 2] = test_particles[:, 2] + vb[2]
You can find a sample in maxwell_velocity.py
in the script
folder.