Note: This discussion is about an older version of the COMSOL Multiphysics® software. The information provided may be out of date.

Discussion Closed This discussion was created more than 6 months ago and has been closed. To start a new discussion with a link back to this one, click here.

Particle energy distribution

Please login with a confirmed email address before reporting spam

Hey Comsol gurus,

I am trying to simulate complex particle distributions in electric and magnetic fields. The mf and es parts are working quite nicely but I am experiencing some difficulties setting up my particle source. I want to have complete controll over the particles energy/velocity distribution. I tried to use an analytic function to describe the energy spectrum but this (within the Inlet condition of cpt) worked only in dependancy on x,y,z - and I dont want to have that. As an example, it would be helpful if someone told me how I can set up a distribution with (for example) exponential energy spectrum homogeneous over a certain surface - ideally without using a parametric sweep.

I hope you guys can help me and I am thanking you very much in advance,

Florian

5 Replies Last Post 04.03.2014, 17:15 GMT-5
Daniel Smith COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 10.06.2013, 13:32 GMT-4
Hi, you would need to use some combination of the random(...) and randomnormal(...) functions to construct a custom velocity distribution function. You can use the "particleindex" as the input argument.

For example, try entering an inlet velocity like:

randomnormal(particleindex,t)^2

or

random(particleindex,t)

then create a histogram of the resulting velocity to see the distribution. By using combinations of the uniform and normal distribution functions you should be able to construct a custom distribution.
Hi, you would need to use some combination of the random(...) and randomnormal(...) functions to construct a custom velocity distribution function. You can use the "particleindex" as the input argument. For example, try entering an inlet velocity like: randomnormal(particleindex,t)^2 or random(particleindex,t) then create a histogram of the resulting velocity to see the distribution. By using combinations of the uniform and normal distribution functions you should be able to construct a custom distribution.

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 12.06.2013, 04:41 GMT-4
Hey Daniel,

thank you very much for your quick response. It worked fine for me.
Now I want to apply a certain binning in particle energy, so for example
allow only integere numbers as particle energies. Is there a rounding
function that I can applie after the random?

Is there somewhere a list with all the Comsol functions and internal
variables? I think this could be very helpful to a lot of Comsol users.

Best regards,
Florian
Hey Daniel, thank you very much for your quick response. It worked fine for me. Now I want to apply a certain binning in particle energy, so for example allow only integere numbers as particle energies. Is there a rounding function that I can applie after the random? Is there somewhere a list with all the Comsol functions and internal variables? I think this could be very helpful to a lot of Comsol users. Best regards, Florian

Daniel Smith COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 12.06.2013, 08:39 GMT-4
Hi, random(...) generates numbers between -0.5 and 0.5, so you to create random integers between say 0 and 100 you would need to enter something like:

round(100*(0.5+random(particleindex,t)))

Note that you can't use only energy as an initial condition directly. There are 6 initial conditions required for each particle, position (qx,qy,qz) and velocity (d(qx,t), d(qy,t), d(qz,t)). Position plus energy is only 4 so you would need to add two conditions for, say, the initial angle as well. To do this you would have to implement the transform between velocity space and energy/angular space.

A list of reserved names and functions can be found in the Introduction to COMSOL Multiphysics booklet:
www.comsol.com/shared/downloads/IntroductionToCOMSOLMultiphysics.pdf

randomnormal(...) is just a fast way creating a normally distributed random number using Defintions>Functions and particleindex is just a quick way of referencing the postprocessing variable cpt.pidx.
Hi, random(...) generates numbers between -0.5 and 0.5, so you to create random integers between say 0 and 100 you would need to enter something like: round(100*(0.5+random(particleindex,t))) Note that you can't use only energy as an initial condition directly. There are 6 initial conditions required for each particle, position (qx,qy,qz) and velocity (d(qx,t), d(qy,t), d(qz,t)). Position plus energy is only 4 so you would need to add two conditions for, say, the initial angle as well. To do this you would have to implement the transform between velocity space and energy/angular space. A list of reserved names and functions can be found in the Introduction to COMSOL Multiphysics booklet: http://www.comsol.com/shared/downloads/IntroductionToCOMSOLMultiphysics.pdf randomnormal(...) is just a fast way creating a normally distributed random number using Defintions>Functions and particleindex is just a quick way of referencing the postprocessing variable cpt.pidx.

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 11.07.2013, 14:15 GMT-4
I have a related question. Suppose I have a file with a list of initial poisitions and velocities. Is there a way to use the values in that file as the inlet for the particle tracking?

Thank you,

Jason
I have a related question. Suppose I have a file with a list of initial poisitions and velocities. Is there a way to use the values in that file as the inlet for the particle tracking? Thank you, Jason

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 04.03.2014, 17:15 GMT-5
Jason, did you ever find out how to do this?

Thanks,
Yelena
Jason, did you ever find out how to do this? Thanks, Yelena

Note that while COMSOL employees may participate in the discussion forum, COMSOL® software users who are on-subscription should submit their questions via the Support Center for a more comprehensive response from the Technical Support team.