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.

Modelling a cylindrical and ring magnet as well as finding the force between them.

Please login with a confirmed email address before reporting spam

Hello,

I'm a student trying to learn Comsol, specifically how to model magnetic fields.

Currently I am trying to simulate the magnetic fields of a cylinder magnet with a ring magnet around it.

I am using the Magnetic Fields, No Currents module with a 2D axis symmetric geometry. I have the cylinder magnet and ring magnets defined as neodymium with a relative permeability of 1.05 and then used the magnetic flux conservation to define a remnant flux density of 1.48 and 1.32 [T] to the magnets respectively. I then define a world of air around that with a relative permeability of 1. I then define a very fine mesh and try to compute a stationary study, but can not get it to work.

Does anyone have any ideas?

I plan on then moving the ring magnet along the Z axis and compute the force between the two magnets.

Thanks ahead of time!


14 Replies Last Post Jun 5, 2015, 6:29 a.m. EDT
Edgar J. Kaiser Certified Consultant

Please login with a confirmed email address before reporting spam

Posted: 10 years ago Apr 24, 2015, 1:13 p.m. EDT
William,

you have to set Zero Magnetic Scalar Potential in one Point of the model to achieve an unambiguous solution.

Cheers
Edgar

--
Edgar J. Kaiser
emPhys Physical Technology
www.emphys.com
William, you have to set Zero Magnetic Scalar Potential in one Point of the model to achieve an unambiguous solution. Cheers Edgar -- Edgar J. Kaiser emPhys Physical Technology http://www.emphys.com

Please login with a confirmed email address before reporting spam

Posted: 10 years ago Apr 24, 2015, 2:04 p.m. EDT
Hello,

Thank you! That seems to get it working.

I then calculate the force due to displacing the magnet, however, I am getting a very large force. I believe from previous simulations, I should be getting a force on the order of about 300 [N]. Here I am getting a force of about 30,000 [N]. I believe I have the correct remnant flux densities and geometry. I will double check that. Am I forgetting or missing something?

Very Respectfully,

Will
Hello, Thank you! That seems to get it working. I then calculate the force due to displacing the magnet, however, I am getting a very large force. I believe from previous simulations, I should be getting a force on the order of about 300 [N]. Here I am getting a force of about 30,000 [N]. I believe I have the correct remnant flux densities and geometry. I will double check that. Am I forgetting or missing something? Very Respectfully, Will


Edgar J. Kaiser Certified Consultant

Please login with a confirmed email address before reporting spam

Posted: 10 years ago Apr 24, 2015, 2:32 p.m. EDT
First, you have to use two separate force calculations for the two magnets and then you will get even higher values. The dimensions of the magnets are in meters. Is that the intention? Such huge magnets?

--
Edgar J. Kaiser
emPhys Physical Technology
www.emphys.com
First, you have to use two separate force calculations for the two magnets and then you will get even higher values. The dimensions of the magnets are in meters. Is that the intention? Such huge magnets? -- Edgar J. Kaiser emPhys Physical Technology http://www.emphys.com

Please login with a confirmed email address before reporting spam

Posted: 10 years ago Apr 24, 2015, 4:46 p.m. EDT
Hello!

I believe that may have been my problem, let me change that!

Very Respectfully,

Will
Hello! I believe that may have been my problem, let me change that! Very Respectfully, Will

Please login with a confirmed email address before reporting spam

Posted: 10 years ago Apr 24, 2015, 5:26 p.m. EDT
Hello,

So I changed the scale to centimeters and redid the force calculation. Now I get a force of about 200 [N] which is much more reasonable, but not the 300 [N] I am looking for.

I have attached that file. Does it seem like I am doing everything correctly?

Very Respectfully,

Will

Hello, So I changed the scale to centimeters and redid the force calculation. Now I get a force of about 200 [N] which is much more reasonable, but not the 300 [N] I am looking for. I have attached that file. Does it seem like I am doing everything correctly? Very Respectfully, Will


Please login with a confirmed email address before reporting spam

Posted: 10 years ago Apr 24, 2015, 6:18 p.m. EDT
I figured it out.

Thank you very much for your help!

Very Respectfully,

Will
I figured it out. Thank you very much for your help! Very Respectfully, Will

Edgar J. Kaiser Certified Consultant

Please login with a confirmed email address before reporting spam

Posted: 10 years ago Apr 25, 2015, 3:33 a.m. EDT
Hi Will,

I am glad I could help. In general force calculations with the Maxwell Stress Tensor are very sensitive to the mesh. You may also want to avoid sharp corners.

Cheers and good luck
Edgar

--
Edgar J. Kaiser
emPhys Physical Technology
www.emphys.com
Hi Will, I am glad I could help. In general force calculations with the Maxwell Stress Tensor are very sensitive to the mesh. You may also want to avoid sharp corners. Cheers and good luck Edgar -- Edgar J. Kaiser emPhys Physical Technology http://www.emphys.com

Please login with a confirmed email address before reporting spam

Posted: 9 years ago May 21, 2015, 11:02 a.m. EDT
Hi Will,

Could you explain how you figured it out. I am trying to work a similar problem by simulating two Neodymium block magnets and finding the force of attraction between them.

Adam
Hi Will, Could you explain how you figured it out. I am trying to work a similar problem by simulating two Neodymium block magnets and finding the force of attraction between them. Adam

Please login with a confirmed email address before reporting spam

Posted: 9 years ago May 21, 2015, 12:28 p.m. EDT
Hi Adam,

So what I did, what you can see above, was simulate a cylindrical magnet and a ring magnet. I defined the geometry and placement for the cylinder and ring, defined a remnant flux density (Brmax) for each which I found from a online magnet seller, and then applied a 0 scalar potential on the border of the simulation. Then using the force calculation in the AC/DC module ( I believe it is in this one ), I found the force acting on one of the magnets. (the force on each should be equal and opposite, so I only had to do this once)

I believe you should be able to do this with blocks without much issue. I recommend making your world or volume around the magnets a good deal larger than the volume containing the magnets. It seemed that at least several centimeters from the edges did just fine.

To get a Force versus Displacement curve, I actually wrote a python script that does the calculation for me. To do this, I simulated the magnetic field of the interior cylindrical magnet, exported the Z component of the magnetic field from this magnet ( based on geometry, this is the only component that would change since I would only be "moving" the ring magnet in the Z direction ), and then found the force via: F = ∫ ∇(m•B) dV.

To do this method of scripting for block magnets should be relatively simple, depending on how they are moving apart. Let me know if you have any more questions. Hope this helps!

Do you know python?

Very Respectfully,

Will
Hi Adam, So what I did, what you can see above, was simulate a cylindrical magnet and a ring magnet. I defined the geometry and placement for the cylinder and ring, defined a remnant flux density (Brmax) for each which I found from a online magnet seller, and then applied a 0 scalar potential on the border of the simulation. Then using the force calculation in the AC/DC module ( I believe it is in this one ), I found the force acting on one of the magnets. (the force on each should be equal and opposite, so I only had to do this once) I believe you should be able to do this with blocks without much issue. I recommend making your world or volume around the magnets a good deal larger than the volume containing the magnets. It seemed that at least several centimeters from the edges did just fine. To get a Force versus Displacement curve, I actually wrote a python script that does the calculation for me. To do this, I simulated the magnetic field of the interior cylindrical magnet, exported the Z component of the magnetic field from this magnet ( based on geometry, this is the only component that would change since I would only be "moving" the ring magnet in the Z direction ), and then found the force via: F = ∫ ∇(m•B) dV. To do this method of scripting for block magnets should be relatively simple, depending on how they are moving apart. Let me know if you have any more questions. Hope this helps! Do you know python? Very Respectfully, Will

Please login with a confirmed email address before reporting spam

Posted: 9 years ago May 21, 2015, 1:39 p.m. EDT
Hi Will,

Thank you for your quick response! I do not know python, but I have it installed and I am sure it shouldn't be hard to learn and do this quick calculation. I think I am having the same issue you were having where the force that I am getting is two orders of magnitude higher than what I am expecting (130 lbf compared to 1.3 lbf). How did you end up fixing that?

Thanks,
Adam
Hi Will, Thank you for your quick response! I do not know python, but I have it installed and I am sure it shouldn't be hard to learn and do this quick calculation. I think I am having the same issue you were having where the force that I am getting is two orders of magnitude higher than what I am expecting (130 lbf compared to 1.3 lbf). How did you end up fixing that? Thanks, Adam

Please login with a confirmed email address before reporting spam

Posted: 9 years ago May 21, 2015, 3:54 p.m. EDT
Hello,

Check what units you are in. I had everything in terms of meters when it should have been in centimeters. That's why I was getting giant results.

I recommend downloading pythonxy for learning/using python. It is great, has all the libraries you could ever want with it and it is free.

Very Respectfully,

William Steinberger
Hello, Check what units you are in. I had everything in terms of meters when it should have been in centimeters. That's why I was getting giant results. I recommend downloading pythonxy for learning/using python. It is great, has all the libraries you could ever want with it and it is free. Very Respectfully, William Steinberger

Please login with a confirmed email address before reporting spam

Posted: 9 years ago May 26, 2015, 10:37 p.m. EDT

I figured it out.

Thank you very much for your help!

Very Respectfully,

Will

Dear William,
Would you like tell me what is formula are used to calculate magnetic forces in comsol?
thank you so much

[QUOTE] I figured it out. Thank you very much for your help! Very Respectfully, Will [/QUOTE] Dear William, Would you like tell me what is formula are used to calculate magnetic forces in comsol? thank you so much

Please login with a confirmed email address before reporting spam

Posted: 9 years ago May 29, 2015, 3:19 p.m. EDT
Hello,

There is a force module that comsol offers that you may have to buy that does the calculation for you. Otherwise, if you export the components of the magnetic field, you can use this: F = ∫ ∇(m•B) dV.

Hope this helps!

Very Respectfully,

Will
Hello, There is a force module that comsol offers that you may have to buy that does the calculation for you. Otherwise, if you export the components of the magnetic field, you can use this: F = ∫ ∇(m•B) dV. Hope this helps! Very Respectfully, Will

Please login with a confirmed email address before reporting spam

Posted: 9 years ago Jun 5, 2015, 6:29 a.m. EDT
Hi Will,

I had the same problem about how to sovle the force between two permanent magnets. I got two defferent forces acting on the two permanent magnets. Could you please upload your COMSOL (.mph) file, so I can learn how to solve it.


Thanks,
wanqun qiu
Hi Will, I had the same problem about how to sovle the force between two permanent magnets. I got two defferent forces acting on the two permanent magnets. Could you please upload your COMSOL (.mph) file, so I can learn how to solve it. Thanks, wanqun qiu

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.