Magnetic field is not continuous along the length of a cut line
Posted May 18, 2024, 10:37 a.m. EDT Electromagnetics, Mesh, Studies & Solvers Version 6.2 6 Replies
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.
Please login with a confirmed email address before reporting spam
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.
-------------------Scientific Applications & Research Associates (SARA) Inc.
www.comsol.com/partners-consultants/certified-consultants/sara
Please login with a confirmed email address before reporting spam
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?
Attachments:
Please login with a confirmed email address before reporting spam
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.
-------------------Scientific Applications & Research Associates (SARA) Inc.
www.comsol.com/partners-consultants/certified-consultants/sara
Please login with a confirmed email address before reporting spam
Hi,
Getting smooth and accurate field evaluation in electromagnetics is indeed a bit of a challenge. There are several reasons for this:
- 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.
- 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.
- 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
Attachments:
Please login with a confirmed email address before reporting spam
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
Attachments:
Please login with a confirmed email address before reporting spam
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
Reply
Please read the discussion forum rules before posting.
Discussion Forum Rules and Guidelines
The goal of COMSOL Access is to provide a forum for you to communicate effectively with COMSOL as well as your colleagues within the multiphysics simulation community. This involves providing you with access to technical support and downloads of the latest {:comsol} software releases, as well as the ability to share your comments and work with other users of the {:comsol} software through forums such as the blog, discussion forum, and Application Exchange. In order to make this an efficient and pleasant experience for you and other members of COMSOL Access, we ask that you follow a few rules and guidelines.
When registering for COMSOL Access, you agree to provide your complete and truthful information for all fields requested on your COMSOL Access account registration page. You also agree to maintain the accuracy of all information associated with you on your COMSOL Access account. You agree to maintain your COMSOL Access account for use solely by you, not to share your username and password with anyone else, and to take appropriate precautions to restrict access to your username and password from others. Furthermore, you agree not to submit any information relating to your employer through your COMSOL Access account without your employer’s authorization. Should you use a COMSOL Access account associated with an employer, you agree to immediately discontinue using that account upon termination of that employment.
The moderators of the forums will remove any generally objectionable material as quickly as possible. You acknowledge that all posts made to these forums express the views and opinions of the author and not the administrators, moderators, or webmaster (except for posts by these people). Hence, they will not be held liable.
You agree not to post or link to any material that is abusive, obscene, vulgar, slanderous, hateful, threatening, sexually oriented, or that infringes upon or violates any third-party rights or any other material that may violate any applicable laws. You agree that you will not otherwise use your COMSOL Access account to violate or to assist anyone in violating any law. Engaging in any activity in violation of these COMSOL Access rules and guidelines may lead to you being immediately and permanently banned from COMSOL Access. The IP address of all posts is recorded to aid in enforcing these conditions. You agree that the webmaster, administrator, and moderators of the forums have the right to remove, move, or close any topic at any time as they see fit. As a user of COMSOL Access, you agree to any information you have entered into any of the forums being stored in a database.
You agree that you will not use your COMSOL Access account in violation of any applicable export control laws. You represent and warrant that you are not subject to any comprehensive sanction or embargo by the U.S. or any other country, nor are you identified on any list maintained by the U.S. government that identifies persons for which the U.S. maintains restrictions. Further, you represent and warrant that you are not subject to any restriction on the receipt of technology or products under the export control laws of the U.S. or any other country.
Basic Rules
- Flaming: Do not post any messages that harass, insult, belittle, threaten, or flame another member or guest. Debates are fine, but argue with the point, not the person.
- Trolling: Do not post with the purpose of starting a dispute. Note that a person disagreeing with your opinion is not considered trolling; keep it civil, even if you are sure that the other person is wrong. Anything seen as trolling will result in you being banned.
- Spamming: Posts without content or containing nonsense waste space and everyone's time. Spam will be removed from the forum.
- Offensive Posts, Links or Images: Do not use profanity, racial, ethnic, religious, or other slurs or any other offensive material.
- Advertising: Posting of advertisements for products or services, links to auctions, affiliate links, links to promote websites, and so forth is not allowed.
- Disclosure of Personal Information: Do not disclose any other member's email, real name, address, phone number, IP address, or other personal information. This includes posting contents of emails and private messages without the sender's consent. Do not bring personal disputes into the forums. Bans and warnings issued to other users are considered personal information.
- Misleading Titles: The subject line of the post should be as informative as possible about the content of the post. This also reduces the amount of duplicate posts.
- Thread Hijacking: Taking a thread off-topic to pursue one's own agenda is not permitted.
- Piracy: Do not upload, post, email, transmit, or otherwise make available any content that infringes upon any patent, trademark, trade secret, copyright, or other proprietary rights ("Rights") of any party. This includes COMSOL model files created by a forged or illegitimate license.
- Honesty: Users must provide truthful information in creating their COMSOL Access account.
These rules are subject to change. The moderators reserve the right to remove, edit, or move posts at their discretion. The COMSOL Access administrators will reserve the right to permanently remove a user account without notice if any of the rules are not followed. Particular services accessible with your COMSOL Access account may be subject to additional rules. You agree to comply with all rules applicable to each service you access through your COMSOL Access account.
Posting Guidelines
When posting, understand that you are trying to communicate with other people. Although many COMSOL Access members are not fluent in English, the official language of this forum is English.
Here are some important guidelines of language:
- Write in English.
- If you are familiar with LaTeX, please use this to write mathematical equations.
- Always do a quick check for spelling/grammar mistakes.
- Format your post in a legible manner. Use the Preview button often.
- Be concise and articulate as much as possible.
- Use the Enter key to create paragraphs.
- Capitalize correctly. It is difficult to read posts that are written entirely in uppercase or lowercase.
- Use correct punctuation. Avoid run-on sentences.
- Try to avoid using “text speak”, “net speak”, or slang. The purpose of language is to be understood.
- Never invent acronyms and use as few acronyms as possible. For example, write "COMSOL Multiphysics" and not "CMP".
- Review your post before publishing it. Try to catch typos.
- Please check to see if a topic has already been posted. Do not post multiple threads on the same topic.
Disclaimer
By submitting content to the forums, you hereby grant COMSOL a nonexclusive, royalty-free, perpetual, worldwide, and unrestricted license to reproduce, publicly display, publicly distribute, and prepare derivative works of the content. COMSOL hereby grants you a license to copy and/or use content from the forums solely for your own internal purposes. COMSOL provides the forum service for the benefit of our users to share content with the community. All content is provided "as is" without warranty of any kind, express or implied, including without limitation, warranties of merchantability, noninfringement, design, operation, and fitness for a particular purpose, and the entire risk as to the quality and performance of the programs is with you.
Neither COMSOL, the authors, nor the copyright owners of submitted materials warrant that the programs will be error-free, uninterrupted, virus-free, secure, and suitable for your needs, produce specific results, or that errors or failures will be corrected. Comments on supplied content should be sent to the author or copyright owner through the tools provided in the forums.
Please log in to 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 the Support Center for a more comprehensive response from the Technical Support team.
Suggested Content
- KNOWLEDGE BASE The Usage of Form Union and Form Assembly
- FORUM Magnetic Force-Based Simulation and Experiment Differ by scaling of (length)^2 for geometries with changing (length)
- FORUM Continuous Casting
- KNOWLEDGE BASE Using Symmetries in COMSOL Multiphysics
- BLOG How to Model Rotating Machinery in 3D