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.

Energy conservation for relativistic particle tracing in magnetic field - problem?

Please login with a confirmed email address before reporting spam

Trying to model propagation of a relativistic electron beam in a time-stationary magnetic field.

For such a field, the particle energy must be conserved. And it is indeed a case for simulation of electron beam focusing by a magnetic lens using the COMSOL own magnetic_lens.mph setup. For a non-relativistic energies of ~ 1keV, the energy is perfectly conserved. However, when changing the energy to 25 MeV (and checking the Relativistic Correction option), the energy variation among particles after passing the focal point could be as high as 6%, ranging from the initial 25 MeV to 26.5 MeV.

For the high-energy case, in order to keep the problem self-similar to the initial low-energy setup, the magnetic field in the lens and the time range were changed accordingly so the Larmor radius and the trajectories length are the same.

Interestingly, when the Relativistic Correction option is un-checked, then the energy is perfectly conserved again, although formally the particles are moving with a super-luminous velocity.

I tried to use finer meshes and a smaller time steps but still the energy conservation is broken.

7 Replies Last Post 13 set 2016, 11:52 GMT-4
Daniel Smith COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 8 years ago 13 set 2016, 09:44 GMT-4
Hi Gennady, energy should still be conserved even when the relativistic option is active. Is there any way you can post the model to this thread?

Dan
Hi Gennady, energy should still be conserved even when the relativistic option is active. Is there any way you can post the model to this thread? Dan

Please login with a confirmed email address before reporting spam

Posted: 8 years ago 13 set 2016, 10:06 GMT-4

Hi Gennady, energy should still be conserved even when the relativistic option is active. Is there any way you can post the model to this thread?

Dan


Dan,
Thanks for the prompt response.
Yes, and it is exactly why I'm puzzled.

PS
Tried to attach the file but clicking on the "Attach File" button does not do anything. What am I doing wrong? :)
[QUOTE] Hi Gennady, energy should still be conserved even when the relativistic option is active. Is there any way you can post the model to this thread? Dan [/QUOTE] Dan, Thanks for the prompt response. Yes, and it is exactly why I'm puzzled. PS Tried to attach the file but clicking on the "Attach File" button does not do anything. What am I doing wrong? :)

Jeff Hiller COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 8 years ago 13 set 2016, 10:07 GMT-4
Hi Gennady,
Recently I have heard from other Forum users, that the Attach button does not always work in Firefox. Is that the browser you are using? If so, consider using Chrome for instance.
Best,
Jeff
Hi Gennady, Recently I have heard from other Forum users, that the Attach button does not always work in Firefox. Is that the browser you are using? If so, consider using Chrome for instance. Best, Jeff

Please login with a confirmed email address before reporting spam

Posted: 8 years ago 13 set 2016, 10:13 GMT-4
Using Safari on MacOS, everything is updated. Java installed.
Using Safari on MacOS, everything is updated. Java installed.

Please login with a confirmed email address before reporting spam

Posted: 8 years ago 13 set 2016, 10:39 GMT-4

Hi Gennady, energy should still be conserved even when the relativistic option is active. Is there any way you can post the model to this thread?

Dan


Ok, Chrome upload works, Safari and Firefox still don't.
Bu, still can't download the mph file - size file error?
The file I used from the comsol app library magnetic_lens.mph which I'm attaching. And the settings are in the accompanying magnetic_lens_relativ_test.pdf file.

Thank you,
Gennady
[QUOTE] Hi Gennady, energy should still be conserved even when the relativistic option is active. Is there any way you can post the model to this thread? Dan [/QUOTE] Ok, Chrome upload works, Safari and Firefox still don't. Bu, still can't download the mph file - size file error? The file I used from the comsol app library magnetic_lens.mph which I'm attaching. And the settings are in the accompanying magnetic_lens_relativ_test.pdf file. Thank you, Gennady


Daniel Smith COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 8 years ago 13 set 2016, 11:17 GMT-4
Hi Gennady, the best thing to do here is to switch to an explicit timestepping method. To do this, go to Study 2>Solver Configurations>Solution 2>Time Dependent Solver 1. In the Time Stepping tab, set the "Method" to "Runge-Kutta", and the "Runge-Kutta method" to "Dormand-Prince 5". Accuracy can be improved by setting the "Steps taken by solver" to "Strict".

With these settings, the error drops to around 0.2%. You can reduce the relative and absolute tolerances to reduce the error further. For example, at a relative tolerance of 1E-9 and absolute tolerance of 1E-10, the error dropped to 0.0004% (see attached screenshot of the settings).

This is quite a difficult test case, since the magnetic flux density is on the order of 50[T], which is extremely high.

Dan
Hi Gennady, the best thing to do here is to switch to an explicit timestepping method. To do this, go to Study 2>Solver Configurations>Solution 2>Time Dependent Solver 1. In the Time Stepping tab, set the "Method" to "Runge-Kutta", and the "Runge-Kutta method" to "Dormand-Prince 5". Accuracy can be improved by setting the "Steps taken by solver" to "Strict". With these settings, the error drops to around 0.2%. You can reduce the relative and absolute tolerances to reduce the error further. For example, at a relative tolerance of 1E-9 and absolute tolerance of 1E-10, the error dropped to 0.0004% (see attached screenshot of the settings). This is quite a difficult test case, since the magnetic flux density is on the order of 50[T], which is extremely high. Dan


Please login with a confirmed email address before reporting spam

Posted: 8 years ago 13 set 2016, 11:52 GMT-4

Hi Gennady, the best thing to do here is to switch to an explicit timestepping method. To do this, go to Study 2>Solver Configurations>Solution 2>Time Dependent Solver 1. In the Time Stepping tab, set the "Method" to "Runge-Kutta", and the "Runge-Kutta method" to "Dormand-Prince 5". Accuracy can be improved by setting the "Steps taken by solver" to "Strict".

With these settings, the error drops to around 0.2%. You can reduce the relative and absolute tolerances to reduce the error further. For example, at a relative tolerance of 1E-9 and absolute tolerance of 1E-10, the error dropped to 0.0004% (see attached screenshot of the settings).

This is quite a difficult test case, since the magnetic flux density is on the order of 50[T], which is extremely high.

Dan


Dan,

Thanks, it worked! I am knew to Comsol and haven't gotten to that level of setting control. Now I understand it better.

PS. Just curious - RK methods are known for relatively bad handling of energy conservation. Often, a so-called Boris method is implemented for particle tracing in E- and B- fields. Is there an option for that?

PPS. A field of 50T is high in absolute terms, but I thought that it's OK since in relative terms (the ratio of the Larmor radius to the system size for example) all three cases are almost identical. Or there is anything else that I'm missing?

Thanks again, it's been a great lesson,

Gennady
[QUOTE] Hi Gennady, the best thing to do here is to switch to an explicit timestepping method. To do this, go to Study 2>Solver Configurations>Solution 2>Time Dependent Solver 1. In the Time Stepping tab, set the "Method" to "Runge-Kutta", and the "Runge-Kutta method" to "Dormand-Prince 5". Accuracy can be improved by setting the "Steps taken by solver" to "Strict". With these settings, the error drops to around 0.2%. You can reduce the relative and absolute tolerances to reduce the error further. For example, at a relative tolerance of 1E-9 and absolute tolerance of 1E-10, the error dropped to 0.0004% (see attached screenshot of the settings). This is quite a difficult test case, since the magnetic flux density is on the order of 50[T], which is extremely high. Dan [/QUOTE] Dan, Thanks, it worked! I am knew to Comsol and haven't gotten to that level of setting control. Now I understand it better. PS. Just curious - RK methods are known for relatively bad handling of energy conservation. Often, a so-called Boris method is implemented for particle tracing in E- and B- fields. Is there an option for that? PPS. A field of 50T is high in absolute terms, but I thought that it's OK since in relative terms (the ratio of the Larmor radius to the system size for example) all three cases are almost identical. Or there is anything else that I'm missing? Thanks again, it's been a great lesson, Gennady

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.