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.

Constant Speed, Random Direction Particle Generation

Please login with a confirmed email address before reporting spam

Hi,

I am trying to do a Monte Carlo simulation using the charged particle tracing module, but cannot seem to figure out how to properly use random functions (or equivalents) in the context of comsol. I have a 2 dimensional circular filament modeled in a 3 dimensional model of an ionization chamber, and from that filament I want to have electrons emitted. I set the filament (which is obviously just a boundary) as an inlet, and have tried using the initial velocity setting "Constant speed, hemispherical", but regardless of the sampling from distribution setting (either "Deterministic" or "Random"), the particles don't have different velocity distributions (even with the "Generate random arguments" setting selected in the Charged Particle Tracing node). Additionally, it seems that this setting discretizes the hemisphere into only N_vel separate possible velocities. I would like to have it so that if only one particle is released at a time, it would be released with a uniformly distributed velocity direction within the specified hemisphere.

I could potentially just randomly set the components of the velocity direction vector for each particle, but I cannot seem to figure out a way to uniquely seed the random functions. I understand that I can use the cpt.pidx variable and/or the t variable (if each particle is released at a different time) to uniquely seed each particle, but these seeds would remain the same every time the study is run. Ideally, there would be a way to access the time (not the time in the time-dependent study, but the actual current time in seconds from the epoch) to use as an additional seed argument for each particle.

I would also like to be able to have the particles initial position be randomly placed on the filament, but I have only found options for the particles to be uniformly distributed or some user defined density distribution.

Does anyone know of any ways to implement such a Monte Carlo model in comsol?

Thanks

1 Reply Last Post 10.07.2015, 10:31 GMT-4

Please login with a confirmed email address before reporting spam

Posted: 9 years ago 10.07.2015, 10:31 GMT-4
Hi

Even though I didn't understand your problem completely, I recommend you to use random(particleindex,t) to generate random numbers in between -0.5 and 0.5. This worked for me (today only I figured it out. And I am very happy to share this with you.) while I was trying to have random initial velocities. The problem is, comsol will assign the same random value for both vx and vy component. If you want two different values for vx and vy just try random(random(particleindex,t)).

Particleindex will give an unique integer number to each particle from 1 to total number of particles.

Cheers :)))
Hi Even though I didn't understand your problem completely, I recommend you to use random(particleindex,t) to generate random numbers in between -0.5 and 0.5. This worked for me (today only I figured it out. And I am very happy to share this with you.) while I was trying to have random initial velocities. The problem is, comsol will assign the same random value for both vx and vy component. If you want two different values for vx and vy just try random(random(particleindex,t)). Particleindex will give an unique integer number to each particle from 1 to total number of particles. Cheers :)))

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.