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