Physics Help Forum computational particle physics

 Physics Software Physics Software Forum - Physics software for computers and calculators

 Jul 22nd 2018, 09:03 AM #1 Junior Member   Join Date: Jul 2018 Posts: 4 computational particle physics Hi to all, I have a random number generator in FORTRAN, which gives a random numbers to my particles initial velocity in three dimension (vx,vy,vz). If, I want to make my particles to embark to move with a specific weight (eg. Maxwellian), what should I do? absv = sqrt(vx*vx+vy*vy+vz*vz) wt= absv*absv*exp(-(absv*absv)/(a*a)) (a = sqrt(2*k*t/m)) the random generator produce a number between -1 to 1 for the 3 velocity components. I make the arrangement so the velocity would be around -0.35 to 0.35 for each of them (non-relativistic range). My code is a test particle code, and I could make it work efficiently for each test particle in both constant and dipolar field (with or without Electric field(acc)), but still I am struggling with making the particles to move based on their initial weight. I don't even know, whether I need to use the Maxwell–Boltzmann speed distribution or Maxwell–Boltzmann velocity distribution which in concept, both are telling the same story but giving me different result. https://en.wikipedia.org/wiki/Maxwel...n_distribution BTW, if you simply plot any random numbers based on 'wt' you will get the maxwellian speed distribution as an output. I want to know, how can I make the 'wt' to be effective as a probability of particles initial distribution in my code. any suggestion is appreciated
 Jul 23rd 2018, 06:56 AM #2 Senior Member     Join Date: Jun 2016 Location: England Posts: 703 The Fortran (pseudo) random number generator generates a uniform distribution from where 0.0<=R<1.0. From your description I am guessing you have simply shifted this to give a uniform distribution where -0.35<=R<0.35 While what you actually want is the (Gaussian) shaped distribution indicated by your "wt" function. I know that this can be done, but I have never actually done it myself... The links I have found all seem to say "this is simple" but then go on to obfuscate the solution. Try: __________________ ~\o/~
Jul 23rd 2018, 08:06 PM   #3
Junior Member

Join Date: Jul 2018
Posts: 4
 Originally Posted by Woody The Fortran (pseudo) random number generator generates a uniform distribution from where 0.0<=R<1.0. From your description I am guessing you have simply shifted this to give a uniform distribution where -0.35<=R<0.35 While what you actually want is the (Gaussian) shaped distribution indicated by your "wt" function. I know that this can be done, but I have never actually done it myself... The links I have found all seem to say "this is simple" but then go on to obfuscate the solution. Try:
I have generated those numbers by using a self made function, Not some pseudo generator. I need to give my particles an specific ID's apart from just giving them random velocity. plus their distribution is not uniform in this domain (-0.35 up to 0.35).

Before I run the code, I need my particle to gain weight initially. If you plot the generated velocity over 'wt', you can find out that they follow the maxwellian, as I mentioned. The question simply comes down to a point that, how to make particles to gain initial weight? what should be done?

Modifying the way that I produce those random numbers won't be the appropriate solution for that. later I may need to change the maxwellian to another type of distribution (eg. loss cone ), So the concept is what I am looking for which can be used in different situation.
please let me know if you have any suggestions.
Thanks.

Last edited by mehdi6; Jul 23rd 2018 at 08:09 PM.

 Tags computational, fortran, particle, physics

 Thread Tools Display Modes Linear Mode

 Similar Physics Forum Discussions Thread Thread Starter Forum Replies Last Post lovebunny Nuclear and Particle Physics 12 May 6th 2018 12:22 PM lekha General Physics 5 Apr 12th 2014 07:57 AM joker1 Nuclear and Particle Physics 0 Mar 12th 2009 02:10 PM