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 tracing, how to release particles?

Please login with a confirmed email address before reporting spam

Hello,

I am using the particle tracing module in comsol 4.2 to track charged particles in an electric field in 3D geometry. I basically need to release particles from the top plane of a cube and tract their motion towards the bottom plane in an electric field.

I know how to release multiple particles simultaneously using the range function. If I use X=range(0.3,0.02,0.7) and Y=range(0.3,0.02,0.7) and Z=constant, then I get a line of particles released. (see image what_i_get)

How do I get a 2D grid of particles released simultaneously? (see image what_i_want)

Can someone please help me with this?

Thanks,
Aditya


5 Replies Last Post 1 nov 2012, 13:38 GMT-4
COMSOL Moderator

Hello Aditya K

Your Discussion has gone 30 days without a reply. If you still need help with COMSOL and have an on-subscription license, please visit our Support Center for help.

If you do not hold an on-subscription license, you may find an answer in another Discussion or in the Knowledge Base.


Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 31 ott 2012, 19:41 GMT-4
Hi Aditya,

Did you ever get an answer? I have the same problem.

--Josh
Hi Aditya, Did you ever get an answer? I have the same problem. --Josh

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 1 nov 2012, 10:00 GMT-4
Dear Josh,

I got a work-around, rather than a solution. I simulate the model and do the particle tracing with an m x 1 row of points, export the results into a spreadsheet and save the model. I then save the model as an m-file, which auto-generates the all the commands used in the model. I then open comsol with matlab and create a new m-file. I import the saved model, and run a loop 'n' times with just three commands -
1. define the new y-coordinate of the row (equivalent to shifting the row of points laterally)
2. re-calculate the particle tracing
3. export the result into a new spreadsheet each time.

The result is 'n' spreadsheets each containing the particle tracing data of one 'm x 1' row of points, to give the total of 'm x n' points traced.

I then use the data in the way I want using another matlab script.

Hope this helps ! If you need more info on what exact commands to pick out from the model's m-file, let me know.

- Aditya
Dear Josh, I got a work-around, rather than a solution. I simulate the model and do the particle tracing with an m x 1 row of points, export the results into a spreadsheet and save the model. I then save the model as an m-file, which auto-generates the all the commands used in the model. I then open comsol with matlab and create a new m-file. I import the saved model, and run a loop 'n' times with just three commands - 1. define the new y-coordinate of the row (equivalent to shifting the row of points laterally) 2. re-calculate the particle tracing 3. export the result into a new spreadsheet each time. The result is 'n' spreadsheets each containing the particle tracing data of one 'm x 1' row of points, to give the total of 'm x n' points traced. I then use the data in the way I want using another matlab script. Hope this helps ! If you need more info on what exact commands to pick out from the model's m-file, let me know. - Aditya

Daniel Smith COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 1 nov 2012, 12:23 GMT-4
The Particle Tracing Module was not released until V4.2a, so you must be using the extremely limited particle tracing functionality available in the base COMSOL Multiphysics package. In the Particle Tracing Module you can easily release particles using uniform or graded grids. There are also lots of other ways of releasing particles on domains and boundaries. See slides 17-21 of this presentation:

www.comsol.com/showroom/documentation/model/12009/
The Particle Tracing Module was not released until V4.2a, so you must be using the extremely limited particle tracing functionality available in the base COMSOL Multiphysics package. In the Particle Tracing Module you can easily release particles using uniform or graded grids. There are also lots of other ways of releasing particles on domains and boundaries. See slides 17-21 of this presentation: http://www.comsol.com/showroom/documentation/model/12009/

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 1 nov 2012, 12:31 GMT-4
That's true, I was using particle tracing from the base package. Thanks for the new information, Daniel !
That's true, I was using particle tracing from the base package. Thanks for the new information, Daniel !

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 1 nov 2012, 13:38 GMT-4
Thanks Daniel and Aditya for your replies. I am also using the basic particle tracking functionality in Multiphysics, although if I continue using it regularly I will definitely consider purchasing the new particle tracking module.

Aditya, my version of Matlab is so old, I'm not sure your solution will work for me. I did find one other workaround. I realized that it is possible to enter a long sequence of coordinates without using the range command. For example:

x: 1, 2, 3, 1, 2, 3, 1, 2, 3
y: 1, 1, 1, 2, 2, 2, 3, 3, 3

So if you want a grid that is 3 rows and 10 points in each row, you have to enter 30 numbers in both the x and y input boxes. This is a real pain, especially if you need to calculate odd spacing. But it is possible to generate the correct sequence in Excel (where you can use equations to create the proper spacing as needed), and then export to a CSV. Then you can open the CVS in a text editor, copy the number sequence and paste into the Comsol GUI. Still kind of a pain but it did work for me. I think it would also be possible to create a serpentine polygon in the domain that you can define as a selectable boundary. Then you can define points evenly spaced along this polygon using boundary coordinates. I didn't try this yet because the CSV trick ended up working for me.
Thanks Daniel and Aditya for your replies. I am also using the basic particle tracking functionality in Multiphysics, although if I continue using it regularly I will definitely consider purchasing the new particle tracking module. Aditya, my version of Matlab is so old, I'm not sure your solution will work for me. I did find one other workaround. I realized that it is possible to enter a long sequence of coordinates without using the range command. For example: x: 1, 2, 3, 1, 2, 3, 1, 2, 3 y: 1, 1, 1, 2, 2, 2, 3, 3, 3 So if you want a grid that is 3 rows and 10 points in each row, you have to enter 30 numbers in both the x and y input boxes. This is a real pain, especially if you need to calculate odd spacing. But it is possible to generate the correct sequence in Excel (where you can use equations to create the proper spacing as needed), and then export to a CSV. Then you can open the CVS in a text editor, copy the number sequence and paste into the Comsol GUI. Still kind of a pain but it did work for me. I think it would also be possible to create a serpentine polygon in the domain that you can define as a selectable boundary. Then you can define points evenly spaced along this polygon using boundary coordinates. I didn't try this yet because the CSV trick ended up working for me.

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.