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 Plot

Please login with a confirmed email address before reporting spam

Dear Comsol Community,

I am simulating particle tracks in a mass spectrometer. I would like to know the particle positions after they exit the magnet, i.e. when they hit a screen. I would like to make a plot with the two axes "x Position" and "z Position" (they are flying in negative y-direction). I attached a picture of my setup.

I tryed various things that did not work. For example when I try to make a 1D global plot and chose the final timestep and also manipulate the x- and y-Axis expression to be particle positions x and z (mod1.qx and mod1.qz) I get an error :

Failed to evaluate variable.

-Variable:mod1.qz
-Global scope:
Failed to evaluate expression.
-Expression:mod1.qz
-Plot: glob1(Global)

Also, I tried to make a Cut Plane and process this further, which did not work out either.
Neither did creating 3D slices.

There should be a simple way to do this but I can not find it.

I am thankful for every advice!


6 Replies Last Post 2016年3月7日 GMT-5 05:31
Daniel Smith COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2013年6月11日 GMT-4 12:30
Hi, you can either make a Poincare plot or use the Phase Portrait to generate the plot you want. See the attached (V4.3b) model for an example on how to do this.
Hi, you can either make a Poincare plot or use the Phase Portrait to generate the plot you want. See the attached (V4.3b) model for an example on how to do this.


Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2013年6月12日 GMT-4 07:02
Thanks a lot! It worked out perfectly.
Thanks a lot! It worked out perfectly.

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2013年6月12日 GMT-4 08:36
Another question concerning the 2D-plot: is there a possibility to add a "grid" to the plot, for a better visualization of the particle position?

I would like to ask for another advice concerning the same setup:
(it does not concern the 2D plot anymore so maybe I should open a new thread(?))

Since I want to resolve the particles depending on their charge, I would like to add an electric field, resulting from two electrodes with opposite electric potential. In particle physics we call this a "Thomson parabola".

Is there a way to compute the particle trajectories depending on a magnetostatic AND an electrostatic study?
Because I can only select one study in the"Values of dependent Variables" in the settings window of the particle tracing study.
It is not possible to use the "mef"-module because it describes electric/magnet fields that evolve from the SAME object.
Also, checking both "mf" and "es" in the Magnetostatics study settings window does not work (the electric field has no impact on the particle trajectories).

Thank you in advance for another (hopefully the final) advice.
Another question concerning the 2D-plot: is there a possibility to add a "grid" to the plot, for a better visualization of the particle position? I would like to ask for another advice concerning the same setup: (it does not concern the 2D plot anymore so maybe I should open a new thread(?)) Since I want to resolve the particles depending on their charge, I would like to add an electric field, resulting from two electrodes with opposite electric potential. In particle physics we call this a "Thomson parabola". Is there a way to compute the particle trajectories depending on a magnetostatic AND an electrostatic study? Because I can only select one study in the"Values of dependent Variables" in the settings window of the particle tracing study. It is not possible to use the "mef"-module because it describes electric/magnet fields that evolve from the SAME object. Also, checking both "mf" and "es" in the Magnetostatics study settings window does not work (the electric field has no impact on the particle trajectories). Thank you in advance for another (hopefully the final) advice.

Daniel Smith COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2013年6月12日 GMT-4 12:22

Another question concerning the 2D-plot: is there a possibility to add a "grid" to the plot, for a better visualization of the particle position?

Not directly. You could use the "Streamline" plot to get the same effect though. See the attached (V4.3b) model.


Is there a way to compute the particle trajectories depending on a magnetostatic AND an electrostatic study?
Because I can only select one study in the"Values of dependent Variables" in the settings window of the particle tracing study.
It is not possible to use the "mef"-module because it describes electric/magnet fields that evolve from the SAME object.
Also, checking both "mf" and "es" in the Magnetostatics study settings window does not work (the electric field has no impact on the particle trajectories).

Yes, there are two ways of doing this.
1. Solve for the magnetostatics and electrostatics in the same Study, then pass this solution to the particle tracing study.
2. Solve for the magnetostatics first and pass this solution to the electrostatics study, then pass the electrostatics study to the particle tracing study (see the "Quadrupole Mass Spectrometer" model in the AC/DC Module Model Library for an example of how to do this)
[QUOTE] Another question concerning the 2D-plot: is there a possibility to add a "grid" to the plot, for a better visualization of the particle position? [/QUOTE] Not directly. You could use the "Streamline" plot to get the same effect though. See the attached (V4.3b) model. [QUOTE] Is there a way to compute the particle trajectories depending on a magnetostatic AND an electrostatic study? Because I can only select one study in the"Values of dependent Variables" in the settings window of the particle tracing study. It is not possible to use the "mef"-module because it describes electric/magnet fields that evolve from the SAME object. Also, checking both "mf" and "es" in the Magnetostatics study settings window does not work (the electric field has no impact on the particle trajectories). [/QUOTE] Yes, there are two ways of doing this. 1. Solve for the magnetostatics and electrostatics in the same Study, then pass this solution to the particle tracing study. 2. Solve for the magnetostatics first and pass this solution to the electrostatics study, then pass the electrostatics study to the particle tracing study (see the "Quadrupole Mass Spectrometer" model in the AC/DC Module Model Library for an example of how to do this)


Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2013年9月30日 GMT-4 11:35
I would like to add a comment to the model proposed by Daniel, in the 2D Plot Group 2 the Phase Portrait 1 must be employed with qy on the x-axis and cpt.vy on the y-axis to get the proper phase portrait (the beam emittence) and not the trace of the beam as in Poincaré scheme
I would like to add a comment to the model proposed by Daniel, in the 2D Plot Group 2 the Phase Portrait 1 must be employed with qy on the x-axis and cpt.vy on the y-axis to get the proper phase portrait (the beam emittence) and not the trace of the beam as in Poincaré scheme

Please login with a confirmed email address before reporting spam

Posted: 8 years ago 2016年3月7日 GMT-5 05:31


Another question concerning the 2D-plot: is there a possibility to add a "grid" to the plot, for a better visualization of the particle position?

Not directly. You could use the "Streamline" plot to get the same effect though. See the attached (V4.3b) model.


Is there a way to compute the particle trajectories depending on a magnetostatic AND an electrostatic study?
Because I can only select one study in the"Values of dependent Variables" in the settings window of the particle tracing study.
It is not possible to use the "mef"-module because it describes electric/magnet fields that evolve from the SAME object.
Also, checking both "mf" and "es" in the Magnetostatics study settings window does not work (the electric field has no impact on the particle trajectories).

Yes, there are two ways of doing this.
1. Solve for the magnetostatics and electrostatics in the same Study, then pass this solution to the particle tracing study.
2. Solve for the magnetostatics first and pass this solution to the electrostatics study, then pass the electrostatics study to the particle tracing study (see the "Quadrupole Mass Spectrometer" model in the AC/DC Module Model Library for an example of how to do this)

Dear Daniel,
Studying the example you attached I couldn`t recognize the main difference between the Poincare Plot and the Phase Portrait. What is difference between them in the context of the example?
I`ve spotted that the streamlines are limited by the domain (by the diameter of the cylinder). Is it possible to trim out the streamlines to a desired length?

[QUOTE] [QUOTE] Another question concerning the 2D-plot: is there a possibility to add a "grid" to the plot, for a better visualization of the particle position? [/QUOTE] Not directly. You could use the "Streamline" plot to get the same effect though. See the attached (V4.3b) model. [QUOTE] Is there a way to compute the particle trajectories depending on a magnetostatic AND an electrostatic study? Because I can only select one study in the"Values of dependent Variables" in the settings window of the particle tracing study. It is not possible to use the "mef"-module because it describes electric/magnet fields that evolve from the SAME object. Also, checking both "mf" and "es" in the Magnetostatics study settings window does not work (the electric field has no impact on the particle trajectories). [/QUOTE] Yes, there are two ways of doing this. 1. Solve for the magnetostatics and electrostatics in the same Study, then pass this solution to the particle tracing study. 2. Solve for the magnetostatics first and pass this solution to the electrostatics study, then pass the electrostatics study to the particle tracing study (see the "Quadrupole Mass Spectrometer" model in the AC/DC Module Model Library for an example of how to do this) [/QUOTE] Dear Daniel, Studying the example you attached I couldn`t recognize the main difference between the Poincare Plot and the Phase Portrait. What is difference between them in the context of the example? I`ve spotted that the streamlines are limited by the domain (by the diameter of the cylinder). Is it possible to trim out the streamlines to a desired length?

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.