Magnetic field is not continuous along the length of a cut line

Please login with a confirmed email address before reporting spam

Hello,

I am simulating a magnetic field which is created by 4 cylindrical permanent magnets arranged in a circle. I am plotting the Magnetic field density along a cut line in the 3D space. Beginning at the edge of the magnets and going out vertically.

The problem is, that the 1D plot of the magnetic flux density is not continuous. The plot has "jumps", and because of that not accurate enough for me.

What is the Problem? Solver settings? The mesh? Something else?

The picture shows the plot in its entirety and zommed in at one point.

Thanks for any advice.



6 Replies Last Post 2024年5月23日 GMT+2 11:25
Robert Koslover Certified Consultant

Please login with a confirmed email address before reporting spam

Posted: 3 months ago 2024年5月18日 GMT+2 17:38
Updated: 3 months ago 2024年5月18日 GMT+2 17:44

FYI, plotting alongcut linesoften doesn't yield the smoothest of curves, because the mesh doesn't conform to the line. So it looks like mesh discretization effects to me. Or... maybe its just some computer graphics or rendering issue? Also, you seem to be talking about only one curve in your question, but your plot appears to show three curves. Did you intend to plot the same quantity three times, overlapped? Are these curves supposed to be the same quantity, but computed in three different ways or with different meshes, or something like that? Have you tried exporting your data (I recommend only one curve at a time) and inspecting/plotting it with a separate tool or editor? Frankly, your variations seem pretty small. Finally, you say it isn't accurate enough for you, but even if the plot was smooth, you probably shouldn't assume the computed numbers were more accurate than that implied by the random deviations you see here.

-------------------
Scientific Applications & Research Associates (SARA) Inc.
www.comsol.com/partners-consultants/certified-consultants/sara
FYI, plotting along *cut lines* often doesn't yield the smoothest of curves, because the mesh doesn't conform to the line. So it looks like mesh discretization effects to me. Or... maybe its just some computer graphics or rendering issue? Also, you seem to be talking about only one curve in your question, but your plot appears to show three curves. Did you intend to plot the same quantity three times, overlapped? Are these curves supposed to be the same quantity, but computed in three different ways or with different meshes, or something like that? Have you tried exporting your data (I recommend only one curve at a time) and inspecting/plotting it with a separate tool or editor? Frankly, your variations seem pretty small. Finally, you say it isn't accurate enough for you, but even if the plot was smooth, you probably shouldn't assume the computed numbers were more accurate than that implied by the random deviations you see here.

Please login with a confirmed email address before reporting spam

Posted: 3 months ago 2024年5月18日 GMT+2 18:19

FYI, plotting alongcut linesoften doesn't yield the smoothest of curves, because the mesh doesn't conform to the line. So it looks like mesh discretization effects to me. Or... maybe its just some computer graphics or rendering issue? Also, you seem to be talking about only one curve in your question, but your plot appears to show three curves. Did you intend to plot the same quantity three times, overlapped? Are these curves supposed to be the same quantity, but computed in three different ways or with different meshes, or something like that? Have you tried exporting your data (I recommend only one curve at a time) and inspecting/plotting it with a separate tool or editor? Frankly, your variations seem pretty small. Finally, you say it isn't accurate enough for you, but even if the plot was smooth, you probably shouldn't assume the computed numbers were more accurate than that implied by the random deviations you see here.

They are four different cut lines plotted in the same graph. I attached a graph showing just one of the four cut lines. Do you have any tips to fix the mesh discretization effects?

>FYI, plotting along *cut lines* often doesn't yield the smoothest of curves, because the mesh doesn't conform to the line. So it looks like mesh discretization effects to me. Or... maybe its just some computer graphics or rendering issue? Also, you seem to be talking about only one curve in your question, but your plot appears to show three curves. Did you intend to plot the same quantity three times, overlapped? Are these curves supposed to be the same quantity, but computed in three different ways or with different meshes, or something like that? Have you tried exporting your data (I recommend only one curve at a time) and inspecting/plotting it with a separate tool or editor? Frankly, your variations seem pretty small. Finally, you say it isn't accurate enough for you, but even if the plot was smooth, you probably shouldn't assume the computed numbers were more accurate than that implied by the random deviations you see here. They are four different cut lines plotted in the same graph. I attached a graph showing just one of the four cut lines. Do you have any tips to fix the mesh discretization effects?


Robert Koslover Certified Consultant

Please login with a confirmed email address before reporting spam

Posted: 3 months ago 2024年5月18日 GMT+2 19:25

There exist operators that specify how to evaluate points within mesh elements, and using them might help, but whenever I do work resembling this, I don't normally use those. Anyway, if your model isn't too computationally demanding, then perhaps you should consider simply adding a physical line segment to the geometry rather than using a cut line, then remesh, and solve it again. If you want, you can make the mesh finer along that line itself. Either way, plotting along that line (a line plot) should then give you acontinuousplot, although it may not be meaningfully moreaccurate.

-------------------
Scientific Applications & Research Associates (SARA) Inc.
www.comsol.com/partners-consultants/certified-consultants/sara
There exist operators that specify how to evaluate points within mesh elements, and using them might help, but whenever I do work resembling this, I don't normally use those. Anyway, if your model isn't too computationally demanding, then perhaps you should consider simply adding a physical line segment to the geometry rather than using a cut line, then remesh, and solve it again. If you want, you can make the mesh finer along that line itself. Either way, plotting along that line (a line plot) should then give you a *continuous* plot, although it may not be meaningfully more *accurate*.

Magnus Olsson COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 3 months ago 2024年5月20日 GMT+2 15:47
Updated: 3 months ago 2024年5月20日 GMT+2 17:08

Hi,

Getting smooth and accurate field evaluation in electromagnetics is indeed a bit of a challenge. There are several reasons for this:

  1. The fields are obtained as the gradient (scalar magnetic potential) or curl (magnetic vector potential). Thus, with the quadratic default element order, your fields have at best a piecewise linear representation within an element. To obtain higher order interpolation of the fields, you need to increase the element order.
  2. Still there is no guarantee that, even if the interpolation/representation of the potentials is continuous, the fields will be continuous when interpolated on a line that cuts arbitrarily through the mesh. This is particularly true for the curl elements used for the magnetic vector potential as those use a reduced order representation that enforces the continuity of tangential vector components across element boundaries which is required by the curl operator.
  3. The real finite element solution is in general coarser than you think and the methods used to create smooth plots can be deceiving when postprocessing field gradients. This is well covered in one of our blog posts, see the "Averaging Between Elements" section in: https://www.comsol.com/blogs/how-to-evaluate-stresses-in-comsol-multiphysics/

In general the finite element method solves the weak formulation of the partial differential equation which means that it is correct in an "integral" or "average" sense and that it conserves the "flux" (force/charge/current depending on physics solved for) in an integral rather than pointwise sense. This is why you can solve a second order PDE using linear elements but the price is that the local fields can be quite noisy. If you are after highly smooth and accurate field plots in homogeneous isotropic domains using the boundary elements method may be an interesting option. The field evaluation is then performed by integrating the Green's function (integral equation kernel) over the boundaries which provides good accuracy and smooth plots as long as you do not evaluate too close to any boundary (as then the evaluation "sees" local discretization noise and approximations used in the near-field of individual elements). This is the reason that I stay away from the surface of the magnet in my attached example - close to the magnet, the finite element values are arguably a better choice. The local element size is a measure of what is "close" - keep a few times the element size away and you are fine.

For best accuracy you should switch off the far-field approximation in the boundary elements interface.

You can experiment with element order, the addition of a geometry line as Robert suggested , and compare to the boundary element solution in the attached model example.

Best regards,

-------------------
Magnus
Hi, Getting smooth and accurate field evaluation in electromagnetics is indeed a bit of a challenge. There are several reasons for this: 1. The fields are obtained as the gradient (scalar magnetic potential) or curl (magnetic vector potential). Thus, with the quadratic default element order, your fields have at best a piecewise linear representation within an element. To obtain higher order interpolation of the fields, you need to increase the element order. 2. Still there is no guarantee that, even if the interpolation/representation of the potentials is continuous, the fields will be continuous when interpolated on a line that cuts arbitrarily through the mesh. This is particularly true for the curl elements used for the magnetic vector potential as those use a reduced order representation that enforces the continuity of tangential vector components across element boundaries which is required by the curl operator. 3. The real finite element solution is in general coarser than you think and the methods used to create smooth plots can be deceiving when postprocessing field gradients. This is well covered in one of our blog posts, see the "Averaging Between Elements" section in: https://www.comsol.com/blogs/how-to-evaluate-stresses-in-comsol-multiphysics/ In general the finite element method solves the weak formulation of the partial differential equation which means that it is correct in an "integral" or "average" sense and that it conserves the "flux" (force/charge/current depending on physics solved for) in an integral rather than pointwise sense. This is why you can solve a second order PDE using linear elements but the price is that the local fields can be quite noisy. If you are after highly smooth and accurate field plots in homogeneous isotropic domains using the boundary elements method may be an interesting option. The field evaluation is then performed by integrating the Green's function (integral equation kernel) over the boundaries which provides good accuracy and smooth plots as long as you do not evaluate too close to any boundary (as then the evaluation "sees" local discretization noise and approximations used in the near-field of individual elements). This is the reason that I stay away from the surface of the magnet in my attached example - close to the magnet, the finite element values are arguably a better choice. The local element size is a measure of what is "close" - keep a few times the element size away and you are fine. For best accuracy you should switch off the far-field approximation in the boundary elements interface. You can experiment with element order, the addition of a geometry line as Robert suggested , and compare to the boundary element solution in the attached model example. Best regards,


Please login with a confirmed email address before reporting spam

Posted: 3 months ago 2024年5月21日 GMT+2 08:30

You can experiment with element order, the addition of a geometry line as Robert suggested , and compare to the boundary element solution in the attached model example.

Thanks, I will try that.

There is another problem that I have with the model. I am doing a time-dependet study where the 4 magnets rotate, using Rotating machinery, Magnetic (rmm).

The goal is to simulate eddy currents of a nearby obejct and affected magnetic flux density. To evaluate the effect of the object, I am meassuring at two cut points 3D with the same distance from the magnets, one point is at Z:-240 (see picture) and the other at Z=-240. I am plotting the magnetic flux density of the two points over time.

Withoutan object present, I would expect the value at +240 and -240 to be indentical. But that is not the result I am getting. Do you have any idea what the reason could be?

I have attached the meassured magnetic flux density at two points. One image shows rmm.normB, the other rmm.Bz and the last all vector components. The absolute value of the Z-component seems to be nearly the same (delta = 1,5μT). The X and Y components have a delta of roughly 35μT. Currently this accuracy is not good enough for me.

Thanks for any advice in advance!

Best regards, Felix

>You can experiment with element order, the addition of a geometry line as Robert suggested , and compare to the boundary element solution in the attached model example. Thanks, I will try that. There is another problem that I have with the model. I am doing a time-dependet study where the 4 magnets rotate, using Rotating machinery, Magnetic (rmm). The goal is to simulate eddy currents of a nearby obejct and affected magnetic flux density. To evaluate the effect of the object, I am meassuring at two cut points 3D with the same distance from the magnets, one point is at Z:-240 (see picture) and the other at Z=-240. I am plotting the magnetic flux density of the two points over time. **Without** an object present, I would expect the value at +240 and -240 to be indentical. But that is not the result I am getting. Do you have any idea what the reason could be? I have attached the meassured magnetic flux density at two points. One image shows rmm.normB, the other rmm.Bz and the last all vector components. The absolute value of the Z-component seems to be nearly the same (delta = 1,5μT). The X and Y components have a delta of roughly 35μT. Currently this accuracy is not good enough for me. Thanks for any advice in advance! Best regards, Felix


Magnus Olsson COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 3 months ago 2024年5月23日 GMT+2 11:25
Updated: 3 months ago 2024年5月23日 GMT+2 13:52

Dear Felix,

A model of a symmetric device will typically not yield fields that are perfectly (within numeric precision) symmetric unless you make the mesh symmetric - or if you reduce the model by symmetry cuts and produce the full field solution using symmetry datasets or manual definitions in the postprocessing.

My best guess is that what you see is the effect of assymetries in the mesh - assuming that you have ruled out modeling errors. By pushing the absolute accuracy of the model by just refining the mesh a lot you should also see a decrease in assymetry from the mesh but that can be computationally very expensive. A combination of using symmetry cuts and a finer mesh will give you the most within the constraints of available computational resources.

Best regards,

-------------------
Magnus
Dear Felix, A model of a symmetric device will typically not yield fields that are perfectly (within numeric precision) symmetric unless you make the mesh symmetric - or if you reduce the model by symmetry cuts and produce the full field solution using symmetry datasets or manual definitions in the postprocessing. My best guess is that what you see is the effect of assymetries in the mesh - assuming that you have ruled out modeling errors. By pushing the absolute accuracy of the model by just refining the mesh a lot you should also see a decrease in assymetry from the mesh but that can be computationally very expensive. A combination of using symmetry cuts and a finer mesh will give you the most within the constraints of available computational resources. Best regards,

Reply

Please read thediscussion forum rulesbefore posting.

Pleaselog into post a reply.

Note that while COMSOL employees may participate in the discussion forum, COMSOL®software users who are on-subscription should submit their questions via theSupport Centerfor a more comprehensive response from the Technical Support team.

Baidu
map