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 Release Initial Velocity from File in Particle Tracing Module

Please login with a confirmed email address before reporting spam

I have a list of particle velocities in a text file that resulted from a Monte Carlo simulation. I'd like to use these values as input for initial particle velocities in a particle tracing simulation. What is the best way to go about this?

7 Replies Last Post 2017年1月20日 GMT-5 14:25

Please login with a confirmed email address before reporting spam

Posted: 10 years ago 2014年8月25日 GMT-4 20:30
I haven't found a completely satisfactory solution yet.

One solution is to set the initial velocity components as parameters; do a parametric sweep with swept parameters and values loaded from the file. The problem with this is that one sweep solution corresponds to one particle trajectory which becomes impractical to plot for more than a few trajectories since a particle trajectory node must be created in a plot group for each sweep setting. The workaround for this is NOT to plot the trajectories in Comsol, rather output the sweep solution results to data files that can then be plotted by other software (Matlab, Python, ...).
I haven't found a completely satisfactory solution yet. One solution is to set the initial velocity components as parameters; do a parametric sweep with swept parameters and values loaded from the file. The problem with this is that one sweep solution corresponds to one particle trajectory which becomes impractical to plot for more than a few trajectories since a particle trajectory node must be created in a plot group for each sweep setting. The workaround for this is NOT to plot the trajectories in Comsol, rather output the sweep solution results to data files that can then be plotted by other software (Matlab, Python, ...).

Daniel Smith COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 10 years ago 2014年8月26日 GMT-4 09:22
Hi Ryan, this should be possible using interpolation functions. In the attached model, I have an interpolation function containing my initial velocity data. The first column of the file is a unique number from 1 up to the number of particles. The second column is my initial x-velocity, the third my y-velocity and fourth my z-velocity. I then simply call the function in the Release 1 feature using vx0(particleindex), vy0(particleindex) etc.

The plot shows that I have the expected initial velocity for all particles at t=0.
Hi Ryan, this should be possible using interpolation functions. In the attached model, I have an interpolation function containing my initial velocity data. The first column of the file is a unique number from 1 up to the number of particles. The second column is my initial x-velocity, the third my y-velocity and fourth my z-velocity. I then simply call the function in the Release 1 feature using vx0(particleindex), vy0(particleindex) etc. The plot shows that I have the expected initial velocity for all particles at t=0.


Please login with a confirmed email address before reporting spam

Posted: 10 years ago 2014年8月26日 GMT-4 15:27
Daniel, that is a perfect idea. Thanks!
Daniel, that is a perfect idea. Thanks!

Please login with a confirmed email address before reporting spam

Posted: 7 years ago 2017年1月20日 GMT-5 13:34
Hi Daniel, I have a relate question. I am very new so please be as descriptive as possible. I would like to set my initial particle velocity to follow a distribution given by cos(theta) from -pi/2 to +pi/2. How can I achieve this?
Hi Daniel, I have a relate question. I am very new so please be as descriptive as possible. I would like to set my initial particle velocity to follow a distribution given by cos(theta) from -pi/2 to +pi/2. How can I achieve this?

Jeff Hiller COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 7 years ago 2017年1月20日 GMT-5 13:54
Hi Eric,
To request technical support from COMSOL employees, please email support@comsol.com .
Best regards,
Jeff
Hi Eric, To request technical support from COMSOL employees, please email support@comsol.com . Best regards, Jeff

Please login with a confirmed email address before reporting spam

Posted: 7 years ago 2017年1月20日 GMT-5 13:56
I don't really need technical support. Just looking for some tips. Is the forum not a better place to post so that others may also benefit from the answer?
I don't really need technical support. Just looking for some tips. Is the forum not a better place to post so that others may also benefit from the answer?

Jeff Hiller COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 7 years ago 2017年1月20日 GMT-5 14:25
The Discussion Forum is a great place to reach out for help from other users. Your post was addressed to a specific COMSOL employee though.

As the front page of the Discussion Forum so eloquently states, "COMSOL provides the Discussion Forum for the benefit of our user community to share ideas with each other, and for open discussion on topics that are of interest to the COMSOL Multiphysics user base.

While COMSOL employees may occasionally participate in Discussion Forum discussions, their contributions to a specific topic or technical question may not be as comprehensive as a response to a support request handled through COMSOL's support process.

All of COMSOL's on-subscription customers are welcome to submit their questions via: www.comsol.com/support to be addressed individually by the COMSOL Technical Support Team."

Best,
Jeff
The Discussion Forum is a great place to reach out for help from other users. Your post was addressed to a specific COMSOL employee though. As the front page of the Discussion Forum so eloquently states, "COMSOL provides the Discussion Forum for the benefit of our user community to share ideas with each other, and for open discussion on topics that are of interest to the COMSOL Multiphysics user base. While COMSOL employees may occasionally participate in Discussion Forum discussions, their contributions to a specific topic or technical question may not be as comprehensive as a response to a support request handled through COMSOL's support process. All of COMSOL's on-subscription customers are welcome to submit their questions via: www.comsol.com/support to be addressed individually by the COMSOL Technical Support Team." Best, Jeff

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.