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.

how to track a single particle among surface injection in particle tracing model

Please login with a confirmed email address before reporting spam

i am trying to understand the relationship of particle's initial position and it's movement
i used mesh based injection for the inlet.
does anyone know how to track a single particle among hundreds of particles?
whenever i try to evaluate particle, they showed me all particles.

18 Replies Last Post 22 mag 2017, 19:55 GMT-4
Daniel Smith COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 10 years ago 22 lug 2014, 08:49 GMT-4
Hi, you can add a Filter subnode to the Particle Trajectories plot type. You can only render a certain number or fraction of all the particles. In addition, you can also use a logical expression to pick out specific particles. Each particle is assigned a unique number, determined by the variable fpt.pidx (if fpt is the identifier for the Particle Tracing for Fluid Flow interface). You could use a logical expression like fpt.pidx==100 to only render the particle whose index is 100.
Hi, you can add a Filter subnode to the Particle Trajectories plot type. You can only render a certain number or fraction of all the particles. In addition, you can also use a logical expression to pick out specific particles. Each particle is assigned a unique number, determined by the variable fpt.pidx (if fpt is the identifier for the Particle Tracing for Fluid Flow interface). You could use a logical expression like fpt.pidx==100 to only render the particle whose index is 100.

Please login with a confirmed email address before reporting spam

Posted: 10 years ago 23 lug 2014, 21:16 GMT-4
thanks! it works!
thanks! it works!

Please login with a confirmed email address before reporting spam

Posted: 10 years ago 23 lug 2014, 21:27 GMT-4

Hi, you can add a Filter subnode to the Particle Trajectories plot type. You can only render a certain number or fraction of all the particles. In addition, you can also use a logical expression to pick out specific particles. Each particle is assigned a unique number, determined by the variable fpt.pidx (if fpt is the identifier for the Particle Tracing for Fluid Flow interface). You could use a logical expression like fpt.pidx==100 to only render the particle whose index is 100.


for the logical expression, we can just input logical number? can we try initial position?
[QUOTE] Hi, you can add a Filter subnode to the Particle Trajectories plot type. You can only render a certain number or fraction of all the particles. In addition, you can also use a logical expression to pick out specific particles. Each particle is assigned a unique number, determined by the variable fpt.pidx (if fpt is the identifier for the Particle Tracing for Fluid Flow interface). You could use a logical expression like fpt.pidx==100 to only render the particle whose index is 100. [/QUOTE] for the logical expression, we can just input logical number? can we try initial position?

Daniel Smith COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 10 years ago 24 lug 2014, 08:31 GMT-4

for the logical expression, we can just input logical number? can we try initial position?


To use initial position, just use the at() operator. So, to look at the particles whose initial x-position is greater than 0 you would type at(0,qx>0) into the "Logical expression for inclusion" edit field.
[QUOTE] for the logical expression, we can just input logical number? can we try initial position? [/QUOTE] To use initial position, just use the at() operator. So, to look at the particles whose initial x-position is greater than 0 you would type at(0,qx>0) into the "Logical expression for inclusion" edit field.

Please login with a confirmed email address before reporting spam

Posted: 10 years ago 25 lug 2014, 01:15 GMT-4


for the logical expression, we can just input logical number? can we try initial position?


To use initial position, just use the at() operator. So, to look at the particles whose initial x-position is greater than 0 you would type at(0,qx>0) into the "Logical expression for inclusion" edit field.

thanks, in(), the first 0 ,what does it mean? what if i know the eactly coordinate for one particle, like (0,0,0), how can write it in "logical expression for inclulsion" at(y==0,z==0)? i tried some like this, don't work
[QUOTE] [QUOTE] for the logical expression, we can just input logical number? can we try initial position? [/QUOTE] To use initial position, just use the at() operator. So, to look at the particles whose initial x-position is greater than 0 you would type at(0,qx>0) into the "Logical expression for inclusion" edit field. [/QUOTE] thanks, in(), the first 0 ,what does it mean? what if i know the eactly coordinate for one particle, like (0,0,0), how can write it in "logical expression for inclulsion" at(y==0,z==0)? i tried some like this, don't work

Please login with a confirmed email address before reporting spam

Posted: 9 years ago 23 nov 2015, 10:00 GMT-5

Hi, you can add a Filter subnode to the Particle Trajectories plot type. You can only render a certain number or fraction of all the particles. In addition, you can also use a logical expression to pick out specific particles. Each particle is assigned a unique number, determined by the variable fpt.pidx (if fpt is the identifier for the Particle Tracing for Fluid Flow interface). You could use a logical expression like fpt.pidx==100 to only render the particle whose index is 100.



which logical expression should I write if I want to show for example particle number 2, 36, 97 and 100 in one plot?
[QUOTE] Hi, you can add a Filter subnode to the Particle Trajectories plot type. You can only render a certain number or fraction of all the particles. In addition, you can also use a logical expression to pick out specific particles. Each particle is assigned a unique number, determined by the variable fpt.pidx (if fpt is the identifier for the Particle Tracing for Fluid Flow interface). You could use a logical expression like fpt.pidx==100 to only render the particle whose index is 100. [/QUOTE] which logical expression should I write if I want to show for example particle number 2, 36, 97 and 100 in one plot?

Gunnar Andersson COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 9 years ago 27 nov 2015, 10:23 GMT-5
which logical expression should I write if I want to show for example particle number 2, 36, 97 and 100 in one plot?


You can use logical OR:

(fpt.pidx==2) || (fpt.pidx==36) || (fpt.pidx==97) || (fpt.pidx==100)

[QUOTE]which logical expression should I write if I want to show for example particle number 2, 36, 97 and 100 in one plot?[/QUOTE] You can use logical OR: (fpt.pidx==2) || (fpt.pidx==36) || (fpt.pidx==97) || (fpt.pidx==100)

Please login with a confirmed email address before reporting spam

Posted: 9 years ago 28 nov 2015, 02:14 GMT-5
Dear All,
Can we, for example, to label all the particles or rays in the graphics window as it is done for domains in the geometry node? Assume, that you have 50 rays or particles rendered. How can I understand to which particle or ray which index is assigned?
Dear All, Can we, for example, to label all the particles or rays in the graphics window as it is done for domains in the geometry node? Assume, that you have 50 rays or particles rendered. How can I understand to which particle or ray which index is assigned?

Please login with a confirmed email address before reporting spam

Posted: 9 years ago 29 nov 2015, 09:09 GMT-5

Dear All,
Can we, for example, to label all the particles or rays in the graphics window as it is done for domains in the geometry node? Assume, that you have 50 rays or particles rendered. How can I understand to which particle or ray which index is assigned?


I have also this problem. Is there any way to label all the particles in the graphic window?
[QUOTE] Dear All, Can we, for example, to label all the particles or rays in the graphics window as it is done for domains in the geometry node? Assume, that you have 50 rays or particles rendered. How can I understand to which particle or ray which index is assigned? [/QUOTE] I have also this problem. Is there any way to label all the particles in the graphic window?

Gunnar Andersson COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 9 years ago 30 nov 2015, 02:27 GMT-5
If you have only a couple of particles, then I suggest that you add a Color Expression attribute to the Particle Trajectories plot. For many particles it's probably better to use a Derived Values > Particle Evaluation node.
If you have only a couple of particles, then I suggest that you add a Color Expression attribute to the Particle Trajectories plot. For many particles it's probably better to use a Derived Values > Particle Evaluation node.

Please login with a confirmed email address before reporting spam

Posted: 9 years ago 1 dic 2015, 11:05 GMT-5

If you have only a couple of particles, then I suggest that you add a Color Expression attribute to the Particle Trajectories plot. For many particles it's probably better to use a Derived Values > Particle Evaluation node.

I cannot still figure out from your words how to evaluate a certain index assigned to a certain particle or a ray. Ultimately, I can just iterate through all the particles or rays by typing '{interface name}.pidx==X' (where X is the number of a particle or a ray), but it is a humdrum and cumbersome job. Could you please explain further what should I do?
[QUOTE] If you have only a couple of particles, then I suggest that you add a Color Expression attribute to the Particle Trajectories plot. For many particles it's probably better to use a Derived Values > Particle Evaluation node. [/QUOTE] I cannot still figure out from your words how to evaluate a certain index assigned to a certain particle or a ray. Ultimately, I can just iterate through all the particles or rays by typing '{interface name}.pidx==X' (where X is the number of a particle or a ray), but it is a humdrum and cumbersome job. Could you please explain further what should I do?

Gunnar Andersson COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 9 years ago 2 dic 2015, 02:31 GMT-5
I cannot still figure out from your words how to evaluate a certain index assigned to a certain particle or a ray. Ultimately, I can just iterate through all the particles or rays by typing '{interface name}.pidx==X' (where X is the number of a particle or a ray), but it is a humdrum and cumbersome job. Could you please explain further what should I do?


Have you tried using a color expression with the particle index, e.g., fpt.pidx, as expression?
[QUOTE]I cannot still figure out from your words how to evaluate a certain index assigned to a certain particle or a ray. Ultimately, I can just iterate through all the particles or rays by typing '{interface name}.pidx==X' (where X is the number of a particle or a ray), but it is a humdrum and cumbersome job. Could you please explain further what should I do?[/QUOTE] Have you tried using a color expression with the particle index, e.g., fpt.pidx, as expression?

Please login with a confirmed email address before reporting spam

Posted: 9 years ago 2 dic 2015, 11:39 GMT-5

I cannot still figure out from your words how to evaluate a certain index assigned to a certain particle or a ray. Ultimately, I can just iterate through all the particles or rays by typing '{interface name}.pidx==X' (where X is the number of a particle or a ray), but it is a humdrum and cumbersome job. Could you please explain further what should I do?


Have you tried using a color expression with the particle index, e.g., fpt.pidx, as expression?

It works now. The expression colours all the rays (I am working with the Ray Optics module). As I understand I have to use the 'Manual colour range' or 'Manual data range' in the 'Range' section in order to single out the necessary ray. Is it correct? No numbers can we render in the graphics window for each ray?
As for the 'Derived values', it gives nothing when I type 'gop.pidx' in the expression field for the 'Ray Evaluation' node.
[QUOTE] [QUOTE]I cannot still figure out from your words how to evaluate a certain index assigned to a certain particle or a ray. Ultimately, I can just iterate through all the particles or rays by typing '{interface name}.pidx==X' (where X is the number of a particle or a ray), but it is a humdrum and cumbersome job. Could you please explain further what should I do?[/QUOTE] Have you tried using a color expression with the particle index, e.g., fpt.pidx, as expression? [/QUOTE] It works now. The expression colours all the rays (I am working with the Ray Optics module). As I understand I have to use the 'Manual colour range' or 'Manual data range' in the 'Range' section in order to single out the necessary ray. Is it correct? No numbers can we render in the graphics window for each ray? As for the 'Derived values', it gives nothing when I type 'gop.pidx' in the expression field for the 'Ray Evaluation' node.

Gunnar Andersson COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 9 years ago 2 dic 2015, 11:51 GMT-5
No numbers can we render in the graphics window for each ray?


This is correct.


[QUOTE]No numbers can we render in the graphics window for each ray?[/QUOTE] This is correct.

Please login with a confirmed email address before reporting spam

Posted: 9 years ago 2 dic 2015, 11:59 GMT-5

No numbers can we render in the graphics window for each ray?


This is correct.

Thank you very much for your help. I really appreciate it. Hope that COMSOL company will provide us with the opportunity mentioned and will enhance more deeply documentation on visualization (of course taking into consideration the pudlished documentation on the topic) in the future versions.
[QUOTE] [QUOTE]No numbers can we render in the graphics window for each ray?[/QUOTE] This is correct. [/QUOTE] Thank you very much for your help. I really appreciate it. Hope that COMSOL company will provide us with the opportunity mentioned and will enhance more deeply documentation on visualization (of course taking into consideration the pudlished documentation on the topic) in the future versions.

Daniel Smith COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 9 years ago 4 dic 2015, 11:36 GMT-5
You can't render the particle (or ray) index in the Graphics window, you can set the Color expression to interface.pidx (or interface.ridx for rays), then set the "Point style" to "Point" in the "Particle Trajectories" plot. You can then click on the rendered point for the particle (or ray) in the Graphics window, and the particle index and its coordinates will appear in the results table below the graphics window. This is probably more convenient than adjusting the color or data range.

By interactively clicking on the particles you want to isolate, you can use their index in the logical expression of the filter node as discussed above.
You can't render the particle (or ray) index in the Graphics window, you can set the Color expression to interface.pidx (or interface.ridx for rays), then set the "Point style" to "Point" in the "Particle Trajectories" plot. You can then click on the rendered point for the particle (or ray) in the Graphics window, and the particle index and its coordinates will appear in the results table below the graphics window. This is probably more convenient than adjusting the color or data range. By interactively clicking on the particles you want to isolate, you can use their index in the logical expression of the filter node as discussed above.

Please login with a confirmed email address before reporting spam

Posted: 9 years ago 5 dic 2015, 01:44 GMT-5

You can't render the particle (or ray) index in the Graphics window, you can set the Color expression to interface.pidx (or interface.ridx for rays), then set the "Point style" to "Point" in the "Particle Trajectories" plot. You can then click on the rendered point for the particle (or ray) in the Graphics window, and the particle index and its coordinates will appear in the results table below the graphics window. This is probably more convenient than adjusting the color or data range.

By interactively clicking on the particles you want to isolate, you can use their index in the logical expression of the filter node as discussed above.

Thanks for you reply, Daniel. It makes sense. However, in the Ray Optics module you have to type 'gop.pidx', but not 'gop.ridx' in 'Colour Expression' field to render the ray index. Moreover, when the rays are converged into the focus, it is difficult to select one of them in order to get the index of the ray. Nonetheless, we have two methods to render indices. It is still or would be prefereable for the user to have labelled them in the graphics window in such form as it is done for geometry entities.
[QUOTE] You can't render the particle (or ray) index in the Graphics window, you can set the Color expression to interface.pidx (or interface.ridx for rays), then set the "Point style" to "Point" in the "Particle Trajectories" plot. You can then click on the rendered point for the particle (or ray) in the Graphics window, and the particle index and its coordinates will appear in the results table below the graphics window. This is probably more convenient than adjusting the color or data range. By interactively clicking on the particles you want to isolate, you can use their index in the logical expression of the filter node as discussed above. [/QUOTE] Thanks for you reply, Daniel. It makes sense. However, in the Ray Optics module you have to type 'gop.pidx', but not 'gop.ridx' in 'Colour Expression' field to render the ray index. Moreover, when the rays are converged into the focus, it is difficult to select one of them in order to get the index of the ray. Nonetheless, we have two methods to render indices. It is still or would be prefereable for the user to have labelled them in the graphics window in such form as it is done for geometry entities.

Please login with a confirmed email address before reporting spam

Posted: 7 years ago 22 mag 2017, 19:55 GMT-4
Thanks Daniel. Smart operation!
Thanks Daniel. Smart operation!

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.